From 6723babdd65d946cdc7e315d7f11fb3ca0e455d3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 25 Oct 2012 00:12:18 +0200 Subject: ajouts graphique + ajout suppression vieux articles --- app/App_FrontController.php | 3 +++ app/controllers/configureController.php | 5 ++++- app/controllers/feedController.php | 4 ++-- app/layout/aside.phtml | 7 +++++-- app/models/Category.php | 22 ++++++++++++++++++---- app/models/Entry.php | 31 ++++++++++++++++++++++++++++--- app/models/Feed.php | 6 +++--- app/models/RSSConfiguration.php | 16 ++++++++++++++++ app/views/configure/display.phtml | 3 +++ 9 files changed, 82 insertions(+), 15 deletions(-) (limited to 'app') diff --git a/app/App_FrontController.php b/app/App_FrontController.php index d61927c9e..6a8d1a28d 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -37,5 +37,8 @@ class App_FrontController extends FrontController { private function loadParamsView () { View::_param ('conf', Session::param ('conf', new RSSConfiguration ())); + + $entryDAO = new EntryDAO (); + View::_param ('nb_not_read', $entryDAO->countNotRead ()); } } diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index b382b2794..daabfd3bb 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -68,17 +68,20 @@ class configureController extends ActionController { $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); $sort = Request::param ('sort_order', 'low_to_high'); + $old = Request::param ('old_entries', 3); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); $this->view->conf->_sortOrder ($sort); + $this->view->conf->_oldEntries ($old); $values = array ( 'posts_per_page' => $this->view->conf->postsPerPage (), 'default_view' => $this->view->conf->defaultView (), 'display_posts' => $this->view->conf->displayPosts (), - 'sort_order' => $this->view->conf->sortOrder () + 'sort_order' => $this->view->conf->sortOrder (), + 'old_entries' => $this->view->conf->oldEntries (), ); $confDAO = new RSSConfigurationDAO (); diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 6dad1ac08..e728ac3b0 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -70,11 +70,11 @@ class feedController extends ActionController { 'id_feed' => $feed->id () ); $entryDAO->addEntry ($values); - - // TODO gérer suppression des articles trop vieux (à paramétrer) } } + $entryDAO->cleanOldEntries ($this->view->conf->oldEntries ()); + Request::forward (array (), true); } diff --git a/app/layout/aside.phtml b/app/layout/aside.phtml index 265a0902b..0b1d3f4f4 100644 --- a/app/layout/aside.phtml +++ b/app/layout/aside.phtml @@ -6,12 +6,15 @@