diff options
| author | 2021-02-26 17:31:01 -0500 | |
|---|---|---|
| committer | 2021-02-26 23:31:01 +0100 | |
| commit | 449fee7a2cc9453da4aac03f833ccb28205d7d3a (patch) | |
| tree | b0ea6561ca18dd078d722a2eaa1c9d84af9366d2 /app/Models | |
| parent | a127f7dae3767d519fc0c6d7cbb84e640bace7c2 (diff) | |
"Show all" option on labels (#3472)
It uses the favorite option to keep a similar experience through out the application and also to limit the number of options.
See #3263
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/Context.php | 3 | ||||
| -rw-r--r-- | app/Models/TagDAO.php | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/app/Models/Context.php b/app/Models/Context.php index 1ca99a26d..4f18165c0 100644 --- a/app/Models/Context.php +++ b/app/Models/Context.php @@ -292,9 +292,10 @@ class FreshRSS_Context { self::$get_unread = $tag->nbUnread(); break; case 'T': + $tagDAO = FreshRSS_Factory::createTagDao(); self::$current_get['tags'] = true; self::$name = _t('index.menu.tags'); - self::$get_unread = 0; + self::$get_unread = $tagDAO->countNotRead(); break; default: throw new FreshRSS_Context_Exception('Invalid getter: ' . $get); diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index 854dc07f2..a9aad519d 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -259,12 +259,19 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $res[0]['count']; } - public function countNotRead($id) { + public function countNotRead($id = null) { $sql = 'SELECT COUNT(*) AS count FROM `_entrytag` et ' . 'INNER JOIN `_entry` e ON et.id_entry=e.id ' - . 'WHERE et.id_tag=? AND e.is_read=0'; + . 'WHERE e.is_read=0'; + $values = null; + + if (null !== $id) { + $sql .= ' AND et.id_tag=?'; + $values = [$id]; + } + $stm = $this->pdo->prepare($sql); - $values = array($id); + $stm->execute($values); $res = $stm->fetchAll(PDO::FETCH_ASSOC); return $res[0]['count']; |
