summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-30 22:30:40 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-30 22:30:40 +0100
commit0f2891f4325d6f88845790393d006883831118fd (patch)
tree29720da808978990185a9ca5987a09621a8149d5 /app/models
parent3a8a6d2d56c468af924936a80e110727bc503594 (diff)
Fix issue #8 : ajoute le nombre de non lus pour les catégories (mérite amélioration ?)
Diffstat (limited to 'app/models')
-rwxr-xr-xapp/models/Category.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/Category.php b/app/models/Category.php
index 47ed913c9..ceecea453 100755
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -27,6 +27,10 @@ class Category extends Model {
$catDAO = new CategoryDAO ();
return $catDAO->countFeed ($this->id ());
}
+ public function nbNotRead () {
+ $catDAO = new CategoryDAO ();
+ return $catDAO->countNotRead ($this->id ());
+ }
public function _id ($value) {
$this->id = $value;
@@ -134,6 +138,16 @@ class CategoryDAO extends Model_pdo {
return $res[0]['count'];
}
+
+ public function countNotRead ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE category=? AND e.is_read=0';
+ $stm = $this->bd->prepare ($sql);
+ $values = array ($id);
+ $stm->execute ($values);
+ $res = $stm->fetchAll (PDO::FETCH_ASSOC);
+
+ return $res[0]['count'];
+ }
}
class HelperCategory {