Просмотр исходного кода

Ajout informations dans la sidebar

Marien Fressinaud 13 лет назад
Родитель
Сommit
08a01f87f1

+ 2 - 0
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 () {

+ 2 - 1
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 } ?>

+ 9 - 0
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 {

+ 1 - 1
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']; ?>" />

+ 1 - 1
public/theme/base.css

@@ -233,7 +233,7 @@ form {
 		}
 
 .post {
-	width: 80%;
+	width: 90%;
 	margin: 0 auto;
 }
 	.post.flux {