diff options
Diffstat (limited to 'app/models/Feed.php')
| -rw-r--r-- | app/models/Feed.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php index 678809af6..e9e21f06a 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 $nbNotRead = -1; private $entries = null; private $name = ''; private $website = ''; @@ -82,8 +83,12 @@ class Feed extends Model { return $feedDAO->countEntries ($this->id ()); } public function nbNotRead () { + if ($this->nbNotRead < 0) { $feedDAO = new FeedDAO (); - return $feedDAO->countNotRead ($this->id ()); + $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); + } + + return $this->nbNotRead; } public function favicon () { $file = '/data/favicons/' . $this->id () . '.ico'; @@ -162,6 +167,12 @@ class Feed extends Model { } $this->keep_history = $value; } + public function _nbNotRead ($value) { //Alex + if (!is_int (intval ($value))) { + $value = -1; + } + $this->nbNotRead = $value; + } public function load () { if (!is_null ($this->url)) { @@ -506,7 +517,9 @@ class HelperFeed { $list[$key]->_httpAuth (base64_decode ($dao['httpAuth'])); $list[$key]->_error ($dao['error']); $list[$key]->_keepHistory ($dao['keep_history']); - + if (isset ($dao['nbNotRead'])) { + $list[$key]->_nbNotRead ($dao['nbNotRead']); + } if (isset ($dao['id'])) { $list[$key]->_id ($dao['id']); } |
