|
|
@@ -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'];
|
|
|
}
|
|
|
}
|