aboutsummaryrefslogtreecommitdiff
path: root/app/models/Feed.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-02 19:51:07 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-04-02 19:51:07 +0200
commit204761a81035f04f3159f9679826c432912f0022 (patch)
tree7e64a03d0852063aa7781b0b6c310a640488e06e /app/models/Feed.php
parentbf24aa601f96d184f9635fa72377d7521b324b4f (diff)
Fix issue #44 : affichage du nombre d'entrées non lues dans la sidebar
Diffstat (limited to 'app/models/Feed.php')
-rw-r--r--app/models/Feed.php13
1 files changed, 13 insertions, 0 deletions
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;
@@ -313,6 +317,15 @@ class FeedDAO extends Model_pdo {
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'];
+ }
}
class HelperFeed {