mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-15 18:53:57 -04:00
affichage du nombre d'articles pour un flux donné
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<ul id="flux_menu">
|
||||
<li><a href="<?php echo Url::display (array ('params' => array ('get' => 'favoris'))); ?>">Favoris</a></li>
|
||||
<?php foreach ($this->cat_aside as $cat) { ?>
|
||||
<li><a href="<?php echo Url::display (array ('params' => array ('get' => $cat->id ()))); ?>"><?php echo $cat->name (); ?> <span><?php echo $cat->nbFlux (); ?> flux</span></a></li>
|
||||
<li><a href="<?php echo Url::display (array ('params' => array ('get' => $cat->id ()))); ?>"><?php echo $cat->name (); ?> <span><?php echo $cat->nbFeed (); ?> flux</span></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<span><a target="_blank" href="<?php echo $this->flux->website (); ?>"><?php echo $this->flux->website (); ?></a></span>
|
||||
|
||||
<label>Nombre d'articles</label>
|
||||
<span>Coming soon</span>
|
||||
<span><?php echo $this->flux->nbEntries (); ?></span>
|
||||
|
||||
<?php if (!empty ($this->categories)) { ?>
|
||||
<label>Ranger dans une catégorie</label>
|
||||
|
||||
@@ -59,8 +59,8 @@ class Request {
|
||||
|
||||
self::$params = $params;
|
||||
}
|
||||
public static function _param ($key, $value = null) {
|
||||
if (is_null ($value)) {
|
||||
public static function _param ($key, $value = false) {
|
||||
if ($value === false) {
|
||||
unset (self::$params[$key]);
|
||||
} else {
|
||||
self::$params[$key] = $value;
|
||||
|
||||
Reference in New Issue
Block a user