public function getPhotos($memberId = null)
 {
     if (is_null($memberId)) {
         throw new Exception('Member Id cannot be null.');
     } else {
         $result = PhotoTable::getInstance()->getPhotos($memberId);
         return $result;
     }
 }
Example #2
0
 public function executePreview()
 {
     $this->isStudent = $this->getUser()->isAuthenticated();
     $this->photos = PhotoTable::getInstance()->getPhotos($this->galery->getId(), $this->isStudent)->limit(4)->execute();
     $this->totalVisible = $this->galery->countPhotosVisible($this->isStudent);
     $this->totalPrivate = $this->galery->countPhotosVisible(True);
     $this->showMoreButton = $this->totalPrivate > count($this->photos);
     if ($this->showMoreButton) {
         $this->thumbsToDisplay = min(count($this->photos), 3);
     } else {
         $this->thumbsToDisplay = count($this->photos);
     }
 }
Example #3
0
 public function executeShow(sfWebRequest $request)
 {
     $this->galerie_photo = Doctrine_Core::getTable('GaleriePhoto')->find(array($request->getParameter('id')));
     // Hotlinking on a photo of the gallery
     $this->hotLinkedPhoto = intval($request->getParameter('photo'));
     $this->hotLinkedPass = preg_replace("/[^A-Za-z0-9 ]/", '', $request->getParameter('pass'));
     $this->isStudent = $this->getUser()->isAuthenticated();
     $this->isPhotographer = $this->galerie_photo->userIsPhotographer($this->getUser());
     $this->user = $this->getUser();
     // User auth changes photos we grab
     $this->photos = PhotoTable::getInstance()->getPhotos($this->galerie_photo->getId(), $this->isStudent, $this->hotLinkedPass)->execute();
     $response = $this->getResponse();
     $this->getContext()->getConfiguration()->loadHelpers('Thumb');
     $response->addMeta('og:title', $this->galerie_photo->getTitle());
     $response->addMeta('og:type', 'Galery');
     $response->addMeta('og:url', $this->generateUrl('galerie_photo_show', $this->galerie_photo));
     $response->addMeta('og:site_name', 'BDE-UTC : Portail des associations');
     $this->forward404Unless($this->galerie_photo);
 }
Example #4
0
 public function countPhotosVisible($logged_in = False)
 {
     return PhotoTable::getInstance()->getPhotos($this->getId(), $logged_in)->count();
 }