diff options
Diffstat (limited to 'app/controllers/indexController.php')
| -rwxr-xr-x | app/controllers/indexController.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php new file mode 100755 index 000000000..3fda234ca --- /dev/null +++ b/app/controllers/indexController.php @@ -0,0 +1,34 @@ +<?php + +class indexController extends ActionController { + public function indexAction () { + $entryDAO = new EntryDAO (); + + $mode = Session::param ('mode', $this->view->conf->defaultView ()); + if ($mode == 'not_read') { + $entries = $entryDAO->listNotReadEntries (); + } elseif ($mode == 'all') { + $entries = $entryDAO->listEntries (); + } + + usort ($entries, 'sortEntriesByDate'); + + //gestion pagination + $page = Request::param ('page', 1); + $this->view->entryPaginator = new Paginator ($entries); + $this->view->entryPaginator->_nbItemsPerPage ($this->view->conf->postsPerPage ()); + $this->view->entryPaginator->_currentPage ($page); + } + + public function changeModeAction () { + $mode = Request::param ('mode'); + + if ($mode == 'not_read') { + Session::_param ('mode', 'not_read'); + } else { + Session::_param ('mode', 'all'); + } + + Request::forward (array (), true); + } +} |
