summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 15:52:54 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-25 15:52:54 +0200
commit32ee8feccfb28aa3141469581cd04d4813fd6835 (patch)
tree1c352659b803d1201ae0403583fe58abb44c8090 /app/models
parentd21c1bb13875189ab25f7bce4f05cc3fedaa4904 (diff)
affichage du nombre d'articles pour un flux donné
Diffstat (limited to 'app/models')
-rwxr-xr-xapp/models/Category.php6
-rw-r--r--app/models/Feed.php14
2 files changed, 17 insertions, 3 deletions
diff --git a/app/models/Category.php b/app/models/Category.php
index 6e2847b51..47ed913c9 100755
--- a/app/models/Category.php
+++ b/app/models/Category.php
@@ -23,9 +23,9 @@ class Category extends Model {
public function color () {
return $this->color;
}
- public function nbFlux () {
+ public function nbFeed () {
$catDAO = new CategoryDAO ();
- return $catDAO->countFlux ($this->id ());
+ return $catDAO->countFeed ($this->id ());
}
public function _id ($value) {
@@ -125,7 +125,7 @@ class CategoryDAO extends Model_pdo {
return $res[0]['count'];
}
- public function countFlux ($id) {
+ public function countFeed ($id) {
$sql = 'SELECT COUNT(*) AS count FROM feed WHERE category=?';
$stm = $this->bd->prepare ($sql);
$values = array ($id);
diff --git a/app/models/Feed.php b/app/models/Feed.php
index 92a20eb80..399c34d18 100644
--- a/app/models/Feed.php
+++ b/app/models/Feed.php
@@ -37,6 +37,10 @@ class Feed extends Model {
public function description () {
return $this->description;
}
+ public function nbEntries () {
+ $feedDAO = new FeedDAO ();
+ return $feedDAO->countEntries ($this->id ());
+ }
public function _url ($value) {
if (!is_null ($value) && filter_var ($value, FILTER_VALIDATE_URL)) {
@@ -186,6 +190,16 @@ class FeedDAO extends Model_pdo {
return $res[0]['count'];
}
+
+ public function countEntries ($id) {
+ $sql = 'SELECT COUNT(*) AS count FROM entry WHERE 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 {