diff options
| author | 2012-10-23 18:29:43 +0200 | |
|---|---|---|
| committer | 2012-10-23 18:29:43 +0200 | |
| commit | fca236dc6d6ff6e09182c560f3566904cbc7a70a (patch) | |
| tree | 850bfab52359702dad2a9eccd03f01b5c68c9bcb /app/controllers | |
| parent | 9a95cb844e80512205c519da69ec373e046b7f52 (diff) | |
affichage par catégories + meilleur exportation opml
Diffstat (limited to 'app/controllers')
| -rwxr-xr-x | app/controllers/configureController.php | 13 | ||||
| -rwxr-xr-x | app/controllers/indexController.php | 23 |
2 files changed, 29 insertions, 7 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index c501e5242..e61eb3872 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -99,12 +99,21 @@ class configureController extends ActionController { header('Content-type: text/xml'); $feedDAO = new FeedDAO (); - $this->view->feeds = $feedDAO->listFeeds (); - } elseif (Request::isPost ()) { + $catDAO = new CategoryDAO (); + + $list = array (); + foreach ($catDAO->listCategories () as $key => $cat) { + $list[$key]['name'] = $cat->name (); + $list[$key]['feeds'] = $feedDAO->listByCategory ($cat->id ()); + } + + $this->view->categories = $list; + } elseif ($this->view->req == 'import' && Request::isPost ()) { if ($_FILES['file']['error'] == 0) { $content = file_get_contents ($_FILES['file']['tmp_name']); $feeds = opml_import ($content); + Request::_param ('q'); Request::_param ('feeds', $feeds); Request::forward (array ('c' => 'feed', 'a' => 'massiveInsert')); } diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index b9d770e81..b8908dee3 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -3,25 +3,38 @@ class indexController extends ActionController { public function indexAction () { $entryDAO = new EntryDAO (); + $catDAO = new CategoryDAO (); $mode = Session::param ('mode', $this->view->conf->defaultView ()); - if ($mode == 'not_read') { - $entries = $entryDAO->listNotReadEntries (); - } elseif ($mode == 'all') { - $entries = $entryDAO->listEntries (); + $get = Request::param ('get'); + + // Récupère les flux par catégorie, favoris ou tous + if ($get == 'favoris') { + $entries = $entryDAO->listFavorites ($mode); + } elseif ($get != false) { + $entries = $entryDAO->listByCategory ($get, $mode); } + // 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); + } + + // Tri par date if ($this->view->conf->sortOrder () == 'high_to_low') { usort ($entries, 'sortReverseEntriesByDate'); } else { usort ($entries, 'sortEntriesByDate'); } - //gestion pagination + // 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); + + $this->view->cat_aside = $catDAO->listCategories (); } public function changeModeAction () { |
