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;
 }
Example #2
0
 private function setModel($row)
 {
     $model = new Album_Model_Album();
     $model->setId($row->id)->setName($row->name)->setUserId($row->user_id)->setDescription($row->description)->setLocation($row->location)->setPermission($row->permission)->setCover($row->cover)->setLongitude($row->longitude)->setLatitude($row->latitude)->setStatus($row->status)->setAddedon($row->addedon);
     return $model;
 }
 public function addAlbumAction()
 {
     $this->_helper->layout()->disableLayout();
     $arrPostVal = $this->getRequest()->getParams();
     $albumName = $arrPostVal['album_name'];
     $album_new = $arrPostVal['album_new'];
     if ($album_new != "") {
         $option['id'] = $album_new;
     }
     $userNs = new Zend_Session_Namespace('members');
     $option['userId'] = $userNs->userId;
     // LoggedIn UserId
     $option['name'] = $albumName;
     $option['permission'] = 1;
     $option['status'] = 1;
     $albumM = new Album_Model_Album($option);
     $album_id = $albumM->save();
     if ($album_new == "") {
         print $album_id;
     } else {
         print $album_new;
     }
     exit;
 }
Example #4
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);
 }
Example #5
0
 public function albumUploadPhotoAction()
 {
     $this->_helper->layout()->disableLayout();
     $albumId = $this->_getParam('album_id');
     // For uploade photo on edit time of Album
     $this->view->albumId = $albumId;
     // For uploade photo on edit time of Album
     $review_edit = $this->_getParam('review_edit');
     // For uploade photo on Album create time
     $this->view->review_edit = $review_edit;
     // For uploade photo on Album create time
     $objModelAlbum = new Album_Model_Album();
     $usersNs = new Zend_Session_Namespace("members");
     $userId = $usersNs->userId;
     /*---------------------- GET USED PHOTO SIZE OF USER --------------------------*/
     $arrAlbumCapacity = $objModelAlbum->albumCapacity($userId);
     $this->view->capacityImage = $arrAlbumCapacity[0];
     $this->view->capacityPercent = $arrAlbumCapacity[1];
     $whereAlbum = "status=1 AND user_id='{$userId}'";
     $orderAlbum = "addedon DESC";
     $arrAlbum = $objModelAlbum->fetchAll($whereAlbum, $orderAlbum);
     $this->view->arrAlbum = $arrAlbum;
     /*---------------------------------------------------------------------*/
     // no output before this declaration
     $form = new Album_Form_Upload();
     if ($this->getRequest()->isPost()) {
         if ($form->isValid($this->getRequest()->getParams())) {
             if (method_exists($form->getElement('file'), 'isUploadify')) {
                 if (!$form->getElement('file')->isUploadify()) {
                     // Uploadify was not used even it was meant to be, f.e. javascript was disabled
                     $form->getElement('file')->addFilter('rename', $form->getElement('file')->getRandomFileName())->receive();
                 }
                 /**
                  * Here you can rename/copy/process files
                  * ideal situation is, that you upload file to temporary directory,
                  * than processes it, copy it to directory, where you want to store it
                  * and maybe rename to original filename or something else
                  */
                 // filename on HDD after upload was processed
                 //echo $form->getElement('file')->getFileName() . '<br/>';
                 // if was used rename filter in library/My/Form/Element/File.php, this will return original file name
                 //echo $form->getElement('file')->getOriginalFileName() . '<br/>';
             } else {
                 /**
                  * Uplodify was not used, Zend_Form_Element_File was used instead.
                  * You dont need this code when you decide to use My_Form_Element_File.
                  * If you use this code, replace "random" with your custom random file name, to prevent file collision.
                  */
                 $form->getElement('file')->addFilter('rename', 'random')->receive();
             }
             $this->_redirect('/test-upload');
         }
     }
     $this->view->form = $form;
 }