aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-02 09:44:34 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-05-02 09:44:34 +0200
commit1c202b9364c766d1bd28a22a04b3f70077f23e84 (patch)
tree1bd32b85febf70713ebaaafa3cc2d24983f9ed5b /app/controllers/indexController.php
parent3dd7d245956bcf704c6be33b4fbf38a3f1b8ec2b (diff)
Correction code + ajout commentaires + à l'ajout d'un flux, on n'ajoute plus les trop vieux articles
Diffstat (limited to 'app/controllers/indexController.php')
-rwxr-xr-xapp/controllers/indexController.php19
1 files changed, 9 insertions, 10 deletions
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 (