public function moreButtonPhotoAction()
 {
     /*--------------- MODELS ----------------------*/
     $objModelUser = new Application_Model_User();
     $objModelAlbum = new Album_Model_Album();
     $objModelPhotoTag = new Album_Model_PhotoTag();
     $objModelSetting = new Admin_Model_GlobalSettings();
     /*---------------------------------------------*/
     $this->view->layout()->disableLayout();
     $params = $this->getRequest()->getParams();
     $user_id = $params['user_id'];
     $offsetAlbum = $params['album_offset'];
     $this->view->user_id = $user_id;
     $pageSize = $objModelSetting->settingValue('album_public_page_size');
     $whereAlbum = "user_id='{$user_id}' AND status='1'";
     $orderAlbum = "addedon DESC";
     /*------------------------ GET NEXT ALBUM DETAIL -------------------------------*/
     $nextOffsetAlbum = $offsetAlbum + $pageSize;
     $nextPageSize = 1;
     $arrNextalbum = $objModelAlbum->fetchAll($whereAlbum, $orderAlbum, $nextPageSize, $nextOffsetAlbum);
     $this->view->nextAlbumCount = count($arrNextalbum);
     $this->view->nextOffsetAlbum = $nextOffsetAlbum;
 }
Пример #2
0
 public function albumPhotosAction()
 {
     $objModelUser = new Application_Model_User();
     $objModelAlbumPhoto = new Album_Model_AlbumPhoto();
     $objModelAlbum = new Album_Model_Album();
     $objModelSetting = new Admin_Model_GlobalSettings();
     $objModelVote = new Application_Model_Vote();
     $objPage = new Base_Paginator();
     /*---------------------------------------------*/
     $username = $this->_getParam('username');
     $user = $this->getLeftPanel($username);
     $this->view->userName = $username;
     $this->view->userObject = $user;
     $userRecord = $objModelUser->getDataByUsername($username);
     $userId = $userRecord->getId();
     $userNs = new Zend_Session_Namespace('members');
     $this->view->loggedInUserId = $loggedInUserId = $userNs->userId;
     $this->view->userFullName = $username;
     /*------------------------ CHECK RELATION -------------*/
     $relationCondition = $this->checkRelation($userId, $loggedInUserId);
     $this->view->relationCondition = $relationCondition;
     /*-------------------------------------------------*/
     $albumId = $this->_getParam('id');
     $this->view->userId = $userId;
     $this->view->albumId = $albumId;
     /*----------- GET ALBUM WITH PAGINATION VALUE --------------------*/
     $pageSize = $objModelSetting->settingValue('album_photo_page_size');
     $page = $this->_getParam('page', 1);
     $whereAlbumPhoto = "album_id='{$albumId}' AND user_id='{$userId}' AND status=1 AND ({$relationCondition})";
     $orderAlbumPhoto = "addedon DESC";
     $arrAlbumPhoto = $objPage->fetchPageData($objModelAlbumPhoto, $page, $pageSize, $whereAlbumPhoto, $orderAlbumPhoto);
     $this->view->totalAlbumPhoto = $objPage->getTotalCount();
     $this->view->arrAlbumPhoto = $arrAlbumPhoto;
     /*------------------- GET ALBUM DETAIL --------------------------*/
     $whereAlbum = "id='{$albumId}'";
     $arrAlbum = $objModelAlbum->fetchAll($whereAlbum);
     $this->view->arrAlbum = $arrAlbum;
     $this->view->myLatitude = $latitude = $arrAlbum[0]->latitude;
     $this->view->myLongitude = $longitude = $arrAlbum[0]->longitude;
     /*------------------- GET TAG OF ALBUM -------------------------*/
     $strTag = $this->getAlbumTags($albumId);
     $this->view->strTag = $strTag;
     /*------------------ CHECK LIKED-UNLIKED ALBUM ------------------*/
     $whereVote = "item_type='album' AND item_id='{$albumId}' AND user_id='{$loggedInUserId}' AND vote='1'";
     $arrVote = $objModelVote->fetchAll($whereVote);
     if (count($arrVote) > 0) {
         $this->view->numVote = 1;
     } else {
         $this->view->numVote = 0;
     }
     $this->view->likeSrcUrl = Zend_Registry::get('siteurl') . "%2Fprofile%2Falbum-photos%2Fusername%2F" . $username . "%2Fid%2F" . $albumId;
 }
Пример #3
0
 public function albumPhotoEditAction()
 {
     $this->_helper->layout()->disableLayout();
     $objModelFriendGroup = new Application_Model_FriendGroup();
     $objModelAlbum = new Album_Model_Album();
     $objModelAlbumPhoto = new Album_Model_AlbumPhoto();
     $arrPostVal = $this->getRequest()->getParams();
     $photoId = $arrPostVal['photoId'];
     $albumId = $arrPostVal['albumId'];
     $this->getPhotoInfo($photoId, $albumId);
     /*----------- GET ALL PERMISSION --------------*/
     $arrFriendGroup = $objModelFriendGroup->getPermissions();
     $this->view->arrFriendGroup = $arrFriendGroup;
     /*----------- GET ALBUM TAG ------------------*/
     $this->view->albumPhotoTag = $albumPhotoTag = $objModelAlbumPhoto->getAlbumPhotoTags($photoId);
     $this->view->current_photo_id = $photoId;
     $this->view->current_album_id = $albumId;
     /*----------- GET ALL MY ALBUM ---------------*/
     $usersNs = new Zend_Session_Namespace("members");
     $userId = $usersNs->userId;
     $whereAlbum = "user_id='{$userId}' AND status='1'";
     $arrAlbumInfo = $objModelAlbum->fetchAll($whereAlbum);
     $arrAlbum = array();
     foreach ($arrAlbumInfo as $album) {
         $arrAlbum[$album->id] = $album->name;
     }
     $this->view->arrAlbum = $arrAlbum;
 }
Пример #4
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;
 }