public function albumSlideShowAction() { $this->_helper->layout()->disableLayout(); $albumId = $this->_getParam('album_id'); $objModelAlbum = new Album_Model_AlbumPhoto(); $whereAlbum = "album_id='{$albumId}'"; $orderAlbum = "addedon DESC"; $arrAlbum = $objModelAlbum->fetchAll($whereAlbum, $orderAlbum); $this->view->arrAlbum = $arrAlbum; $this->view->countAlbum = count($arrAlbum); }
public function getTaggesPhotoInfo($photoId) { $objModelAlbumPhoto = new Album_Model_AlbumPhoto(); $objModelVote = new Application_Model_Vote(); $objModelPhotoTag = new Album_Model_PhotoTag(); $usersNs = new Zend_Session_Namespace("members"); $userId = $usersNs->userId; $userFullName = $usersNs->userFullName; /*--------- START CHECK NEXT TAGGED IMAGE EXIST OR NOT ---------------*/ $whereTaggedPhoto = "photo_id='{$photoId}'"; $arrTaggedPhoto = $objModelPhotoTag->fetchRow($whereTaggedPhoto); if (empty($arrTaggedPhoto)) { $this->_redirect('/album/my-photos'); } /*--------- END CHECK NEXT TAGGED IMAGE EXIST OR NOT ---------------*/ $arrPhotoIds = array(); $valAlbumPhoto = $objModelAlbumPhoto->find($photoId); $this->view->photo = $valAlbumPhoto->getImage(); $this->view->name = $valAlbumPhoto->getName(); $this->view->caption = stripslashes($valAlbumPhoto->getCaption()); $this->view->location = $valAlbumPhoto->getLocation(); $this->view->permission = $valAlbumPhoto->getPermission(); $albumId = $valAlbumPhoto->getAlbumId(); $this->view->myLatitude = $latitude = $valAlbumPhoto->getLatitude(); $this->view->myLongitude = $longitude = $valAlbumPhoto->getLongitude(); $this->getAlbumInfo($albumId); // Get album info $this->view->albumId = $albumId; $this->view->photoId = $photoId; /*-----------------------------------------------------------------------*/ $db = Zend_Registry::get('db'); $where = "tagged_id='{$userId}'"; $query = $db->select()->from(array("pt" => "photo_tag"), array("pt.photo_id"))->join(array("ap" => "album_photo"), "pt.photo_id=ap.id", array("ap.image", "ap.id"))->where($where)->order(array('pt.created DESC')); $recordSet = $db->query($query); $arrRecord = $recordSet->fetchAll(); $this->view->numRecord = $numRecord = count($arrRecord); foreach ($arrRecord as $photo) { $arrPhotoIds[] = $photo->id; } $position = array_search($photoId, $arrPhotoIds); $nextPosition = $position + 1; $prevPosition = $position - 1; $arrSize = count($arrPhotoIds); $this->view->photoPosition = $nextPosition; $this->view->numPhotoAlbum = $arrSize; if (array_key_exists($nextPosition, $arrPhotoIds)) { $this->view->nextId = $arrPhotoIds[$nextPosition]; } else { $this->view->nextId = $arrPhotoIds[0]; } if (array_key_exists($prevPosition, $arrPhotoIds)) { $this->view->prevId = $arrPhotoIds[$prevPosition]; } else { $this->view->prevId = $arrPhotoIds[$arrSize - 1]; } /*------------------ CHECK LIKED-UNLIKED ALBUM ------------------*/ $this->view->userFullName = $userFullName; $whereVote = "item_type='album_photo' AND item_id='{$photoId}' AND user_id='{$userId}' AND vote='1'"; $arrVote = $objModelVote->fetchAll($whereVote); if (count($arrVote) > 0) { $this->view->numVote = 1; } else { $this->view->numVote = 0; } /*----------------- GET TAGGED PHOTO COUNTER ---------------------*/ $whereTagged = "tagged_id='{$userId}' AND photo_id='{$photoId}'"; $queryTagged = $db->select()->from(array("pt" => "photo_tag"), array("pt.counter"))->where($whereTagged); $recordSetTagged = $db->query($queryTagged); $arrRecordTaggedCounter = $recordSetTagged->fetchAll(); $this->view->counter = $arrRecordTaggedCounter[0]->counter; /*----------------- GET ALL TAGE FOR PHOTO -------------------------*/ $objAlbumPhotoTag = new Album_Model_AlbumPhotoTag(); $objTag = new Application_Model_Tags(); $allTagId = $objAlbumPhotoTag->fetchAll("photo_id='{$photoId}'"); $tagStr = ""; foreach ($allTagId as $tagId) { $valTag = $objTag->find($tagId->tagId); $tagStr .= $valTag->getTag(); } $this->view->tagStr = $tagStr; $this->view->likeSrcUrl = Zend_Registry::get('siteurl') . "%2Falbum%2Fmy-photos%2Ftagged-photo%2Fid%2F" . $photoId; }
/** * @Created By : Mahipal Singh Adhikari * @Created On : 27-Jan-2011 * @Description : Report Journal/Wall and other items as abuse to admin */ public function reportAbuseAction() { $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); //get request parameters $item_id = $this->_getParam('item_id'); $item_type = $this->_getParam('item_type'); //get logged in user ID $usersNs = new Zend_Session_Namespace('members'); $user_id = $usersNs->userId; if ($user_id == "" || $user_id == 0) { $JsonResultArray = array('error' => 1, 'response' => "Please login to report abuse."); echo Zend_Json::encode($JsonResultArray); exit; } if ($item_id == "" || $item_id == 0) { $JsonResultArray = array('error' => 2, 'response' => "No item is selected to report abuse."); echo Zend_Json::encode($JsonResultArray); exit; } if ($item_type == "") { $JsonResultArray = array('error' => 2, 'response' => "No item type is selected to report abuse."); echo Zend_Json::encode($JsonResultArray); exit; } //Get user report abuse info for item $modelM = new Application_Model_ReportAbuse(); $modelRes = $modelM->fetchRow("item_id={$item_id} AND item_type='{$item_type}' AND user_id={$user_id}"); if ($modelRes && $modelRes->getStatus() == 1) { $JsonResultArray = array('error' => 2, 'response' => "You've already reported this as abuse."); echo Zend_Json::encode($JsonResultArray); exit; } else { $params["itemId"] = $item_id; $params["itemType"] = $item_type; $params["userId"] = $user_id; $params["comment"] = ""; $params["status"] = 1; $modelM->setOptions($params); $dbRes = $modelM->save(); if ($dbRes) { //get item type information $itemTitle = ""; $authorId = ""; $author = ""; if ($item_type == 'blog') { $blogM = new Application_Model_Blog(); $blogRes = $blogM->find($item_id); $itemTitle = $blogRes->getTitle(); $authorId = $blogRes->getUserId(); $blog_url = Zend_Registry::get('siteurl') . "/journal/view-post/blog_id/" . $item_id; $itemTitle = "<a href='" . $blog_url . "' target='_blank'>" . $itemTitle . "</a>"; } else { if ($item_type == 'wall') { $wallM = new Application_Model_Wall(); $wallRes = $wallM->find($item_id); $itemTitle = $wallRes->getStatus(); $authorId = $wallRes->getUserId(); } else { if ($item_type == 'photo') { $objModelAlbumPhoto = new Album_Model_AlbumPhoto(); $albumPhotoRes = $objModelAlbumPhoto->find($item_id); $itemTitle = $albumPhotoRes->getName(); $authorId = $albumPhotoRes->getUserId(); } } } //get Blog/Wall owner/author user information if ($authorId != "") { $useAuthor = new Application_Model_User(); $authorRes = $useAuthor->find($authorId); $author = ucfirst($authorRes->getFirstName()) . " " . ucfirst($authorRes->getLastName()) . " (" . $authorRes->getUsername() . ")"; } //get user information who is reporting abuse item $userM = new Application_Model_User(); $userR = $userM->find($user_id); $reporterName = ucfirst($userR->getFirstName()) . " " . ucfirst($userR->getLastName()) . " (" . $userR->getUsername() . ")"; $reporterEmail = $userR->getEmail(); //Now send report abuse email to Administrator $settings = new Admin_Model_GlobalSettings(); $admin_email = $settings->settingValue('report_abuse'); //$admin_email = "*****@*****.**"; $mailOptions['receiver_email'] = $admin_email; $mailOptions['item_type'] = ucfirst($item_type); $mailOptions['item_title'] = $itemTitle; $mailOptions['item_author'] = $author; $mailOptions['reporter_name'] = $reporterName; $mailOptions['reporter_email'] = $reporterEmail; //create mail class object and send the email $Mail = new Base_Mail(); $Mail->sendReportAbuseEmail($mailOptions); //send response $JsonResultArray = array('error' => 3, 'response' => "Consider it reported!"); } else { $JsonResultArray = array('error' => 2, 'response' => "Error occured, please try again later."); } } echo Zend_Json::encode($JsonResultArray); exit; }
private function setModel($row) { $model = new Album_Model_AlbumPhoto(); $model->setId($row->id)->setAlbumId($row->album_id)->setUserId($row->user_id)->setName($row->name)->setCaption($row->caption)->setLocation($row->location)->setLongitude($row->longitude)->setLatitude($row->latitude)->setPermission($row->permission)->setImage($row->image)->setType($row->type)->setSize($row->size)->setStatus($row->status)->setAddedon($row->addedon); return $model; }
public function getPhotoInfo($photoId, $userId = NULL, $albumId = NULL) { $objModelAlbumPhoto = new Album_Model_AlbumPhoto(); $objModelVote = new Application_Model_Vote(); /*------------------------- CHECK RELATION ------------------------------*/ $userNs = new Zend_Session_Namespace('members'); $this->view->loggedInUserId = $loggedInUserId = $userNs->userId; $relationCondition = $this->checkRelation($userId, $loggedInUserId); $this->view->relationCondition = $relationCondition; /*-----------------------------------------------------------------------*/ $wherePhoto = "id='{$photoId}' AND ({$relationCondition})"; $arrPhotoIds = array(); $valAlbumPhoto = $objModelAlbumPhoto->fetchAll($wherePhoto); if (!empty($valAlbumPhoto)) { $this->view->photo = $valAlbumPhoto[0]->image; $this->view->name = $valAlbumPhoto[0]->name; $this->view->caption = stripslashes($valAlbumPhoto[0]->caption); $this->view->location = $valAlbumPhoto[0]->location; $this->view->permission = $valAlbumPhoto[0]->permission; $albumId = $valAlbumPhoto[0]->albumId; $this->view->myLatitude = $latitude = $valAlbumPhoto[0]->latitude; $this->view->myLongitude = $longitude = $valAlbumPhoto[0]->longitude; } else { $this->view->imageNotExist = 1; } $this->getAlbumInfo($albumId); // Get album info $this->view->albumId = $albumId; $this->view->photoId = $photoId; $objModelUser = new Application_Model_User(); $valUser = $objModelUser->find($userId); $frienUserName = $valUser->getUsername(); $this->view->likeSrcUrl = Zend_Registry::get('siteurl') . "%2Fprofile%2Fphoto%2Fusername%2F" . $frienUserName . "%2Falbum%2F" . $albumId . "%2Fid%2F" . $photoId; $whereAlbumPhoto = "album_id='{$albumId}' AND status='1' AND ({$relationCondition})"; $orderAlbumPhoto = "addedon DESC"; $arrAlbumPhoto = $objModelAlbumPhoto->fetchAll($whereAlbumPhoto, $orderAlbumPhoto); foreach ($arrAlbumPhoto as $photo) { $arrPhotoIds[] = $photo->id; } $position = array_search($photoId, $arrPhotoIds); $nextPosition = $position + 1; $prevPosition = $position - 1; $arrSize = count($arrPhotoIds); $this->view->photoPosition = $nextPosition; $this->view->numPhotoAlbum = $arrSize; if (array_key_exists($nextPosition, $arrPhotoIds)) { $this->view->nextId = $arrPhotoIds[$nextPosition]; } else { if (isset($arrPhotoIds[0])) { $this->view->nextId = $arrPhotoIds[0]; } } if (array_key_exists($prevPosition, $arrPhotoIds)) { $this->view->prevId = $arrPhotoIds[$prevPosition]; } else { if (isset($arrPhotoIds[$arrSize - 1])) { $this->view->prevId = $arrPhotoIds[$arrSize - 1]; } } /*------------------ CHECK LIKED-UNLIKED ALBUM ------------------*/ $whereVote = "item_type='album_photo' AND item_id='{$photoId}' AND user_id='{$loggedInUserId}' AND vote='1'"; $arrVote = $objModelVote->fetchAll($whereVote); if (count($arrVote) > 0) { $this->view->numVote = 1; } else { $this->view->numVote = 0; } }
public function getTaggesPhotoInfo($photoId) { $objModelAlbumPhoto = new Album_Model_AlbumPhoto(); $objModelVote = new Application_Model_Vote(); $usersNs = new Zend_Session_Namespace("members"); $userId = $usersNs->userId; $userFullName = $usersNs->userFullName; $arrPhotoIds = array(); $valAlbumPhoto = $objModelAlbumPhoto->find($photoId); $this->view->photo = $valAlbumPhoto->getImage(); $this->view->name = $valAlbumPhoto->getName(); $this->view->caption = stripslashes($valAlbumPhoto->getCaption()); $this->view->location = $valAlbumPhoto->getLocation(); $this->view->permission = $valAlbumPhoto->getPermission(); $albumId = $valAlbumPhoto->getAlbumId(); $this->view->myLatitude = $latitude = $valAlbumPhoto->getLatitude(); $this->view->myLongitude = $longitude = $valAlbumPhoto->getLongitude(); $this->getAlbumInfo($albumId); // Get album info $this->view->albumId = $albumId; $this->view->photoId = $photoId; /*-----------------------------------------------------------------------*/ $db = Zend_Registry::get('db'); $where = "tagged_id='{$userId}'"; $query = $db->select()->from(array("pt" => "photo_tag"), array("pt.photo_id"))->join(array("ap" => "album_photo"), "pt.photo_id=ap.id", array("ap.image", "ap.id"))->where($where)->order(array('pt.created DESC')); $recordSet = $db->query($query); $arrRecord = $recordSet->fetchAll(); $this->view->numRecord = $numRecord = count($arrRecord); foreach ($arrRecord as $photo) { $arrPhotoIds[] = $photo->id; } $position = array_search($photoId, $arrPhotoIds); $nextPosition = $position + 1; $prevPosition = $position - 1; $arrSize = count($arrPhotoIds); $this->view->photoPosition = $nextPosition; $this->view->numPhotoAlbum = $arrSize; if (array_key_exists($nextPosition, $arrPhotoIds)) { $this->view->nextId = $arrPhotoIds[$nextPosition]; } else { $this->view->nextId = $arrPhotoIds[0]; } if (array_key_exists($prevPosition, $arrPhotoIds)) { $this->view->prevId = $arrPhotoIds[$prevPosition]; } else { $this->view->prevId = $arrPhotoIds[$arrSize - 1]; } /*--------------------------------------------------------------------------*/ /* $whereAlbumPhoto = "album_id='{$albumId}' AND status='1'"; $orderAlbumPhoto = "addedon DESC"; $arrAlbumPhoto = $objModelAlbumPhoto->fetchAll($whereAlbumPhoto, $orderAlbumPhoto); foreach ($arrAlbumPhoto as $photo) { $arrPhotoIds[] = $photo->id; } $position = array_search($photoId, $arrPhotoIds); $nextPosition = $position+1; $prevPosition = $position-1; $arrSize = count($arrPhotoIds); $this->view->photoPosition = $nextPosition; $this->view->numPhotoAlbum = $arrSize; if(array_key_exists($nextPosition, $arrPhotoIds)) { $this->view->nextId = $arrPhotoIds[$nextPosition]; }else{ $this->view->nextId = $arrPhotoIds[0]; } if(array_key_exists($prevPosition, $arrPhotoIds)) { $this->view->prevId = $arrPhotoIds[$prevPosition]; }else{ $this->view->prevId = $arrPhotoIds[$arrSize-1]; } */ /*------------------ CHECK LIKED-UNLIKED ALBUM ------------------*/ $this->view->userFullName = $userFullName; $whereVote = "item_type='album_photo' AND item_id='{$photoId}' AND user_id='{$userId}' AND vote='1'"; $arrVote = $objModelVote->fetchAll($whereVote); if (count($arrVote) > 0) { $this->view->numVote = 1; } else { $this->view->numVote = 0; } }