aboutsummaryrefslogtreecommitdiff
path: root/app/models/Entry.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 12:54:41 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-17 12:54:41 +0100
commitd2f0451eb3764402cbdc09730fe172b74a96a1b0 (patch)
tree3467700a0a616c70e94655a0bae81e6c12ec2b47 /app/models/Entry.php
parent82c550c7aa69b64880f432b4bfe6b95d8238e232 (diff)
Fix bug #30 : lorsque articles non lus dans une catégorie, les autres catégories affichent désormais tous leurs articles
Diffstat (limited to 'app/models/Entry.php')
-rwxr-xr-xapp/models/Entry.php27
1 files changed, 27 insertions, 0 deletions
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);