From 1c202b9364c766d1bd28a22a04b3f70077f23e84 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 May 2013 09:44:34 +0200 Subject: Correction code + ajout commentaires + à l'ajout d'un flux, on n'ajoute plus les trop vieux articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/indexController.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'app/controllers/indexController.php') diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 15cbd7edc..f4f0b98b3 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -6,14 +6,14 @@ class indexController extends ActionController { private $mode = 'all'; public function indexAction () { - if (Request::param ('output', '') == 'rss') { + if (Request::param ('output') == 'rss') { $this->view->_useLayout (false); + } else { + View::appendScript (Url::display ('/scripts/shortcut.js')); + View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main'))); + View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'actualize'))); } - View::appendScript (Url::display ('/scripts/shortcut.js')); - View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main'))); - View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'actualize'))); - $entryDAO = new EntryDAO (); $feedDAO = new FeedDAO (); $catDAO = new CategoryDAO (); @@ -28,6 +28,7 @@ class indexController extends ActionController { $type = $this->getType (); $error = $this->checkAndProcessType ($type); if (!$error) { + // On récupère les différents éléments de filtrage $this->view->state = $state = Request::param ('state', $this->view->conf->defaultView ()); $filter = Request::param ('search', ''); $this->view->order = $order = Request::param ('order', $this->view->conf->sortOrder ()); @@ -35,10 +36,13 @@ class indexController extends ActionController { $first = Request::param ('next', ''); try { + // EntriesGetter permet de déporter la complexité du filtrage $getter = new EntriesGetter ($type, $state, $filter, $order, $nb, $first); $getter->execute (); $entries = $getter->getPaginator (); + // Si on a récupéré aucun article "non lus" + // on essaye de récupérer tous les articles if ($state == 'not_read' && $entries->isEmpty ()) { $this->view->state = 'all'; $getter->_state ('all'); @@ -53,11 +57,6 @@ class indexController extends ActionController { 404, array ('error' => array (Translate::t ('page_not_found'))) ); - } catch(CurrentPagePaginationException $e) { - Error::error ( - 404, - array ('error' => array (Translate::t ('page_not_found'))) - ); } } else { Error::error ( -- cgit v1.2.3