Exemplo n.º 1
0
 public function thumbAction()
 {
     $this->_helper->layout->disableLayout();
     try {
         $film_mapper = new Default_Model_FilmMapper();
         $film = new Default_Model_Film($film_mapper->get($this->_getParam('file')));
     } catch (Exception $e) {
         throw new Zend_Controller_Action_Exception($e->getMessage(), 404);
     }
     $this->view->img = $film->getThumb(150, 100);
 }
Exemplo n.º 2
0
 public function listeAction()
 {
     // n'est appelé qu'en AJAX...
     $this->_helper->layout->disableLayout();
     $film = new Default_Model_FilmMapper();
     $films = $film->fetchAll();
     //$films = $film->simulateFetchAll();
     //        CFDJ_Debug::vd($films);
     $paginator = Zend_Paginator::factory($films);
     $paginator->setCurrentPageNumber($this->_getParam('page', 1));
     //$paginator->setView($view);
     $paginator->setItemCountPerPage(2);
     $this->view->paginator = $paginator;
     //$this->view->firstLoad = ! $this->_hasParam('page');
 }
Exemplo n.º 3
0
 /**
  * cherche les films dont les noms ressemblent le plus...
  *
  * @todo: add cache (sqllite?)
  * @return unknown_type
  */
 public function similarAction()
 {
     // retrieve film
     $film = $this->_getParam('film');
     $this->view->film = $film;
     // list all files ...
     $film_mapper = new Default_Model_FilmMapper();
     $t = $film_mapper->fetchAll();
     // compute levenshtein
     $t_similar = array();
     foreach ($t as $xfilm) {
         if ($xfilm->getFileName() == $film) {
             continue;
         }
         // don't compare with itself...
         $t_similar[$xfilm->getFileName()] = levenshtein($film, $xfilm->getFileName());
     }
     // order them
     asort($t_similar);
     // return 5 first ...
     $t = array_chunk($t_similar, 5, true);
     $this->view->similar = $t[0];
 }