A free, self-hostable aggregator…
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.3 KiB

12 years ago
<?php
class indexController extends ActionController {
public function indexAction () {
$entryDAO = new EntryDAO ();
$catDAO = new CategoryDAO ();
12 years ago
$mode = Session::param ('mode', $this->view->conf->defaultView ());
$get = Request::param ('get');
$order = $this->view->conf->sortOrder ();
// Récupère les flux par catégorie, favoris ou tous
if ($get == 'favoris') {
$entries = $entryDAO->listFavorites ($mode, $order);
} elseif ($get != false) {
$entries = $entryDAO->listByCategory ($get, $mode, $order);
12 years ago
}
// Cas où on ne choisie ni catégorie ni les favoris
// ou si la catégorie ne correspond à aucune
if (!isset ($entries)) {
$entries = $entryDAO->listEntries ($mode, $order);
}
12 years ago
// Gestion pagination
12 years ago
$page = Request::param ('page', 1);
$this->view->entryPaginator = new Paginator ($entries);
$this->view->entryPaginator->_nbItemsPerPage ($this->view->conf->postsPerPage ());
$this->view->entryPaginator->_currentPage ($page);
$this->view->cat_aside = $catDAO->listCategories ();
12 years ago
}
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);
}
}