diff options
author | Alessandro Cosentino <cosenal@gmail.com> | 2012-06-04 18:17:11 -0400 |
---|---|---|
committer | Alessandro Cosentino <cosenal@gmail.com> | 2012-06-04 18:17:11 -0400 |
commit | 200aebe1f4220d9d0b8f1b3807704300ced28f16 (patch) | |
tree | 8f987111c58e586c778d573217967d8269b2dc2b /lib/item.php | |
parent | 48ca4574197d3452189eb204324f724dadf6a888 (diff) |
fixes bug on status bitfield; tests storing the status in db
Diffstat (limited to 'lib/item.php')
-rw-r--r-- | lib/item.php | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/item.php b/lib/item.php index a2ad69b2a..73fd472e1 100644 --- a/lib/item.php +++ b/lib/item.php @@ -46,21 +46,11 @@ class OC_News_Item { $this->title = $title; $this->url = $url; $this->guid = $guid; - $this->status |= StatusFlag::Unread; + $this->status |= StatusFlag::Unread; } public function getGuid(){ return $this->guid; - echo $item->getTitle() . ' - '; - if ($item->isRead()) { - echo $l->t('Read'); - } - else { - echo $l->t('Unread'); - } - echo '<br>'; - $item->setRead(); - } public function setGuid($guid){ @@ -76,7 +66,7 @@ class OC_News_Item { } public function setRead(){ - $this->status |= ~StatusFlag::Unread; + $this->status &= ~StatusFlag::Unread; } public function setUnread(){ @@ -84,17 +74,17 @@ class OC_News_Item { } public function isRead(){ - return ($this->status & ~StatusFlag::Unread); - } - - public function isImportant(){ - return ($this->status & StatusFlag::Important); + return !($this->status & StatusFlag::Unread); } public function setImportant(){ $this->status |= StatusFlag::Important; } + public function isImportant(){ + return ($this->status & StatusFlag::Important); + } + /** * NOTE: this is needed to store items in the database, otherwise * the status of an item should be retrieved with methods: isRead(), isImportant(), ... @@ -102,6 +92,10 @@ class OC_News_Item { public function getStatus(){ return $this->status; } + + public function setStatus($status){ + $this->status = $status; + } public function getTitle(){ return $this->title; |