From 204761a81035f04f3159f9679826c432912f0022 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 2 Apr 2013 19:51:07 +0200 Subject: Fix issue #44 : affichage du nombre d'entrées non lues dans la sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/layout/aside_flux.phtml | 5 +++++ app/models/Feed.php | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 903a566af..1d1700170 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -58,10 +58,15 @@ + nbNotRead (); ?> + favicon <?php echo $feed->name (); ?> + 0 ? '' : ''; ?> + 0 ? '(' . $not_read . ') ' : ''; ?> name(); ?> + 0 ? '' : ''; ?> diff --git a/app/models/Feed.php b/app/models/Feed.php index 8e3168e3b..159b6e767 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -58,6 +58,10 @@ class Feed extends Model { $feedDAO = new FeedDAO (); return $feedDAO->countEntries ($this->id ()); } + public function nbNotRead () { + $feedDAO = new FeedDAO (); + return $feedDAO->countNotRead ($this->id ()); + } public function _id ($value) { $this->id = $value; @@ -311,6 +315,15 @@ class FeedDAO extends Model_pdo { $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); + return $res[0]['count']; + } + public function countNotRead ($id) { + $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read=0 AND id_feed=?'; + $stm = $this->bd->prepare ($sql); + $values = array ($id); + $stm->execute ($values); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + return $res[0]['count']; } } -- cgit v1.2.3