aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-10-28 09:49:10 +0100
committerGravatar GitHub <noreply@github.com> 2018-10-28 09:49:10 +0100
commite04804d0f67dd43fd3f072b9a127768ee7b7b56c (patch)
treea49023ed25aab7fb1c1aafe749f7d462de0027b2 /app/Controllers/indexController.php
parent44bd07e506ade204151c276fdc05994d51efdd7a (diff)
parent4234dfe0d72b61fe931d2c76a1d8a335ce65a209 (diff)
Merge pull request #2049 from FreshRSS/dev1.12.0
FreshRSS 1.12.0
Diffstat (limited to 'app/Controllers/indexController.php')
-rwxr-xr-xapp/Controllers/indexController.php35
1 files changed, 24 insertions, 11 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index ddffdba73..fa914ef87 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -32,7 +32,29 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Error::error(404);
}
- $this->view->callbackBeforeContent = function($view) {
+ $this->view->categories = FreshRSS_Context::$categories;
+
+ $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
+ $title = FreshRSS_Context::$name;
+ if (FreshRSS_Context::$get_unread > 0) {
+ $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title;
+ }
+ Minz_View::prependTitle($title . ' · ');
+
+ $this->view->callbackBeforeFeeds = function ($view) {
+ try {
+ $tagDAO = FreshRSS_Factory::createTagDao();
+ $view->tags = $tagDAO->listTags(true);
+ $view->nbUnreadTags = 0;
+ foreach ($view->tags as $tag) {
+ $view->nbUnreadTags += $tag->nbUnread();
+ }
+ } catch (Exception $e) {
+ Minz_Log::notice($e->getMessage());
+ }
+ };
+
+ $this->view->callbackBeforeEntries = function ($view) {
try {
FreshRSS_Context::$number++; //+1 for pagination
$entries = FreshRSS_index_Controller::listEntriesByContext();
@@ -60,15 +82,6 @@ class FreshRSS_index_Controller extends Minz_ActionController {
Minz_Log::notice($e->getMessage());
Minz_Error::error(404);
}
-
- $view->categories = FreshRSS_Context::$categories;
-
- $view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
- $title = FreshRSS_Context::$name;
- if (FreshRSS_Context::$get_unread > 0) {
- $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title;
- }
- Minz_View::prependTitle($title . ' · ');
};
}
@@ -158,7 +171,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
*/
private function updateContext() {
if (empty(FreshRSS_Context::$categories)) {
- $catDAO = new FreshRSS_CategoryDAO();
+ $catDAO = FreshRSS_Factory::createCategoryDao();
FreshRSS_Context::$categories = $catDAO->listCategories();
}