Affichage du nombre total d'article sur la page de configuration

https://github.com/marienfressinaud/FreshRSS/issues/263
Style à améliorer éventuellement
This commit is contained in:
Alexandre Alapetite committed 2013-11-13 21:32:50 +01:00
1 parent 5bd52cdcb6
commit d654b34fa7
3 files changed
+16 -6

No files matched your search

+3
View File
@@ -259,6 +259,9 @@ class configureController extends ActionController {
$this->view->themes = RSSThemes::get();
View::prependTitle (Translate::t ('general_and_reading_management') . ' - ');
$entryDAO = new EntryDAO ();
$this->view->nb_total = $entryDAO->count ();
}
public function importExportAction () {
+10 -4
View File
@@ -456,15 +456,21 @@ class EntryDAO extends Model_pdo {
$res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
return array('total' => $res[0], 'unread' => $res[1], 'read' => $res[0] - $res[1]);
}
public function count () {
$sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE priority > 0';
public function count ($minPriority = null) {
$sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id';
if ($minPriority !== null) {
$sql = ' WHERE priority > ' . intval($minPriority);
}
$stm = $this->bd->prepare ($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
return $res[0];
}
public function countNotRead () {
$sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE priority > 0 AND is_read = 0';
public function countNotRead ($minPriority = null) {
$sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id WHERE is_read = 0';
if ($minPriority !== null) {
$sql = ' AND priority > ' . intval($minPriority);
}
$stm = $this->bd->prepare ($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
+3 -2
View File
@@ -204,9 +204,10 @@
<div class="form-group">
<label class="group-name"></label>
<div class="group-controls">
<a class="btn" href="<?php echo _url('entry', 'optimize'); ?>">
<p><?php echo Translate::t('number_articles') ?> <code><?php echo $this->nb_total; ?></code></p>
<p><a class="btn" href="<?php echo _url('entry', 'optimize'); ?>">
<?php echo Translate::t('optimize_bdd'); ?>
</a>
</a></p>
<i class="icon i_help"></i> <?php echo Translate::t('optimize_todo_sometimes'); ?>
</div>
</div>