public function getAllAlbumComment($albumId, $item_type)
 {
     $objModelComment = new Application_Model_Comment();
     $objModelAlbum = new Album_Model_Album();
     $objModelAlbumPhoto = new Album_Model_AlbumPhoto();
     $objModelUser = new Application_Model_User();
     /*------------------- LoggedIn User -----------------*/
     $userNs = new Zend_Session_Namespace("members");
     $loggedInUserId = $userNs->userId;
     /*-------------- GET Item Posted User ---------------*/
     if ($item_type == 'photo_comment') {
         $valItem = $objModelAlbumPhoto->find($albumId);
     } else {
         if ($item_type == 'album_comment') {
             $valItem = $objModelAlbum->find($albumId);
         }
     }
     $itemCreatedUserId = $valItem->userId;
     /*---------------------------------------------------*/
     $arrAllComment = array();
     $whereComment = "parent_id='0' AND item_type='{$item_type}' AND item_id='{$albumId}' AND publish='1'";
     $orderComment = "addedon DESC";
     $arrComment = $objModelComment->fetchAll($whereComment, $orderComment);
     $i = 0;
     foreach ($arrComment as $com) {
         $userId = $com->userId;
         $permission = $this->checkCommentRemovePermission($loggedInUserId, $itemCreatedUserId, $userId);
         $valUser = $objModelUser->find($userId);
         $arrAllComment[$i]['commenterName'] = $valUser->getFirstName() . ' ' . $valUser->getLastName();
         $arrAllComment[$i]['imageName'] = $valUser->getImage();
         $arrAllComment[$i]['comment'] = nl2br(stripslashes($com->comment));
         $arrAllComment[$i]['commentId'] = stripslashes($com->id);
         $arrAllComment[$i]['addedon'] = $com->addedon;
         $arrAllComment[$i]['permission'] = $permission;
         $i++;
     }
     return $arrAllComment;
 }
Пример #2
0
 public function getAlbumInfo($albumId)
 {
     $objModelAlbum = new Album_Model_Album();
     $valAlbum = $objModelAlbum->find($albumId);
     $albumName = $valAlbum->getName();
     $albumDesc = $valAlbum->getDescription();
     $this->view->albumName = $albumName;
     $this->view->description = stripslashes($albumDesc);
 }