Esempio n. 1
0
 /** Find images in a set
  * @access public
  * @return void
  * @throws Pas_Exception_Param
  */
 public function inasetAction()
 {
     if ($this->getParam('id', false)) {
         $id = $this->getParam('id');
         $page = $this->getPage();
         $key = md5('set' . $id . $page);
         if (!$this->getCache()->test($key)) {
             $flickr = $this->_api->getPhotosInAset($id, 10, $page);
             $this->getCache()->save($flickr);
         } else {
             $flickr = $this->getCache()->load($key);
         }
         $pagination = array('page' => $page, 'per_page' => $flickr->photoset->perpage, 'total_results' => (int) $flickr->photoset->total);
         $paginator = Zend_Paginator::factory($pagination['total_results']);
         $paginator->setCurrentPageNumber($pagination['page'])->setItemCountPerPage(10)->setCache($this->getCache());
         $paginator->setPageRange(10);
         $this->view->paginator = $paginator;
         $this->view->pictures = $flickr;
     } else {
         throw new Pas_Exception_Param($this->_missingParameter, 500);
     }
 }