From d2f0451eb3764402cbdc09730fe172b74a96a1b0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 17 Mar 2013 12:54:41 +0100 Subject: Fix bug #30 : lorsque articles non lus dans une catégorie, les autres catégories affichent désormais tous leurs articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Entry.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'app/models/Entry.php') diff --git a/app/models/Entry.php b/app/models/Entry.php index 245fea2f6..71ace9b5e 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -443,6 +443,33 @@ class EntryDAO extends Model_pdo { return $res[0]['count']; } + public function countNotReadByFeed ($id) { + $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read = 0 AND id_feed = ?'; + $stm = $this->bd->prepare ($sql); + $stm->execute (array ($id)); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + + return $res[0]['count']; + } + + public function countNotReadByCat ($id) { + $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE is_read=0 AND category = ?'; + $stm = $this->bd->prepare ($sql); + $stm->execute (array ($id)); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + + return $res[0]['count']; + } + + public function countNotReadFavorites () { + $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read=0 AND is_favorite=1'; + $stm = $this->bd->prepare ($sql); + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + + return $res[0]['count']; + } + public function countFavorites () { $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_favorite=1'; $stm = $this->bd->prepare ($sql); -- cgit v1.2.3