diff options
| author | 2013-10-07 11:06:01 +0200 | |
|---|---|---|
| committer | 2013-10-07 11:06:01 +0200 | |
| commit | 71282fb72f8d113953aef5eb7be111a14ece3f22 (patch) | |
| tree | 4013261335fdc9e4b28f62a8ca9e6c2eba4e483f /app | |
| parent | 7c1c7226a3519d9f54c2bcdc288bb3a13c57479c (diff) | |
Fix issue #169: flux en jaune si 0 article
Diffstat (limited to 'app')
| -rw-r--r-- | app/layout/aside_flux.phtml | 5 | ||||
| -rw-r--r-- | app/models/Feed.php | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 5c954c8d9..0045380b5 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -64,11 +64,11 @@ </a> </div> - <?php if (!empty ($feeds)) { ?> <ul class="feeds<?php echo $c_active ? ' active' : ''; ?>"> <?php foreach ($feeds as $feed) { ?> + <?php $nbEntries = $feed->nbEntries (); ?> <?php $f_active = false; if ($this->get_f == $feed->id ()) { $f_active = true; } ?> - <li class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?>"> + <li class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>"> <div class="dropdown"> <div id="dropdown-<?php echo $feed->id(); ?>" class="dropdown-target"></div> <a class="dropdown-toggle" href="#dropdown-<?php echo $feed->id(); ?>"><i class="icon i_configure"></i></a> @@ -98,7 +98,6 @@ </li> <?php } ?> </ul> - <?php } ?> </li> <?php } } ?> </ul> diff --git a/app/models/Feed.php b/app/models/Feed.php index 6f09bf844..02a4e6be7 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -4,6 +4,7 @@ class Feed extends Model { private $id = null; private $url; private $category = '000000'; + private $nbEntries = -1; private $nbNotRead = -1; private $entries = null; private $name = ''; @@ -79,12 +80,16 @@ class Feed extends Model { return $this->keep_history; } public function nbEntries () { - $feedDAO = new FeedDAO (); - return $feedDAO->countEntries ($this->id ()); + if ($this->nbEntries < 0) { + $feedDAO = new FeedDAO (); + $this->nbEntries = $feedDAO->countEntries ($this->id ()); + } + + return $this->nbEntries; } public function nbNotRead () { if ($this->nbNotRead < 0) { - $feedDAO = new FeedDAO (); + $feedDAO = new FeedDAO (); $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); } |
