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