Esempio n. 1
0
 /** Retrieve the sets of photos we have
  * @access public
  * @return void
  */
 public function setsAction()
 {
     $page = $this->getPage();
     $key = md5('sets' . $page);
     if (!$this->getCache()->test($key)) {
         $flickr = $this->_api->getSetsList($this->_flickr->userid, $page, 10);
         $this->getCache()->save($flickr);
     } else {
         $flickr = $this->getCache()->load($key);
     }
     if (!empty($flickr)) {
         $pagination = array('page' => $page, 'perpage' => (int) $flickr->photosets->perpage, 'total_results' => (int) $flickr->photosets->total);
         $paginator = Zend_Paginator::factory($pagination['total_results']);
         $paginator->setCurrentPageNumber($pagination['page'])->setItemCountPerPage($pagination['perpage'])->setCache($this->getCache());
         $this->view->paginator = $paginator;
         $this->view->photos = $flickr->photosets;
     } else {
         throw new Pas_Exception('No flickr result available', 500);
     }
 }