diff options
| author | 2012-10-28 01:17:15 +0200 | |
|---|---|---|
| committer | 2012-10-28 01:17:15 +0200 | |
| commit | 08a01f87f156fb0a89c032a806645291e6fd55dd (patch) | |
| tree | 21029e844d6f84901e3d4ddf19dcb3b83365be66 /app | |
| parent | b5c39ef5ef10ca80816260030ef6a3e9a6c59acf (diff) | |
Ajout informations dans la sidebar
Diffstat (limited to 'app')
| -rwxr-xr-x | app/controllers/indexController.php | 2 | ||||
| -rw-r--r-- | app/layout/aside.phtml | 3 | ||||
| -rwxr-xr-x | app/models/Entry.php | 9 | ||||
| -rw-r--r-- | app/views/configure/shortcut.phtml | 2 |
4 files changed, 14 insertions, 2 deletions
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index b9e5f4f4a..a1b02196d 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -38,6 +38,8 @@ class indexController extends ActionController { $this->view->entryPaginator->_currentPage ($page); $this->view->cat_aside = $catDAO->listCategories (); + $this->view->nb_favorites = $entryDAO->countFavorites (); + $this->view->nb_total = $entryDAO->count (); } public function changeModeAction () { diff --git a/app/layout/aside.phtml b/app/layout/aside.phtml index 51c64fa08..f1c838950 100644 --- a/app/layout/aside.phtml +++ b/app/layout/aside.phtml @@ -12,7 +12,8 @@ <?php if (isset ($this->cat_aside)) { ?> <ul id="flux_menu"> - <li><a href="<?php echo Url::display (array ('params' => array ('get' => 'favoris'))); ?>">Favoris</a></li> + <li><a href="<?php echo Url::display (array ()); ?>">Tous <span><?php echo $this->nb_total; ?> article<?php echo $this->nb_total > 1 ? 's' : ''; ?></span></a></li> + <li><a href="<?php echo Url::display (array ('params' => array ('get' => 'favoris'))); ?>">Favoris <span><?php echo $this->nb_favorites; ?> article<?php echo $this->nb_favorites > 1 ? 's' : ''; ?></span></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->nbFeed (); ?> flux</span></a></li> <?php } ?> diff --git a/app/models/Entry.php b/app/models/Entry.php index 6fcc821f4..654286bd7 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -273,6 +273,15 @@ class EntryDAO extends Model_pdo { return $res[0]['count']; } + + public function countFavorites () { + $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_favorite=1'; + $stm = $this->bd->prepare ($sql); + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + + return $res[0]['count']; + } } class HelperEntry { diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 8050d2cee..cf8af7ff9 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -13,7 +13,7 @@ <label for="mark_read">Marquer l'article comme lu / non lu</label> <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" /> - <p>+ <code>shift</code> pour marquer tous les articles</p> + <p>+ <code>shift</code> pour marquer tous les articles comme non lus</p> <label for="mark_favorite">Mettre l'article en favori</label> <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" /> |
