diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 20:38:09 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 20:38:20 +0100 |
commit | c8bdd9c3fb0ab872b868c151f052748235601653 (patch) | |
tree | af4ffc33ad013f817af14aed25e54606429ad612 /bl | |
parent | d692600a31bf4aa9be8b71d8fcb16e90e9393aea (diff) |
finished feedcontroller
Diffstat (limited to 'bl')
-rw-r--r-- | bl/feedbl.php | 28 | ||||
-rw-r--r-- | bl/itembl.php | 29 |
2 files changed, 37 insertions, 20 deletions
diff --git a/bl/feedbl.php b/bl/feedbl.php index d196586bb..be63862e4 100644 --- a/bl/feedbl.php +++ b/bl/feedbl.php @@ -35,34 +35,34 @@ class FeedBl extends Bl { parent::__construct($feedMapper); } - // README: only call this for the cronjob! - public function findAll(){ + // README: only call this for the cronjob because it does not + // check that the feeds belong to the right user + public function findAll(){ + return $this->mapper->findAll(); } - public function findAllFromUser(){ - + public function findAllFromUser($userId){ + return $this->mapper->findAllFromUser($userId); } - public function create(){ - + public function create($feedUrl, $parentId, $userId){ + // TODO: download new items of feed } - public function update(){ - + public function update($feedId, $userId){ + // TODO: update given feed } - public function move(){ - + public function move($feedId, $folderId, $userId){ + $feed = $this->find($feedId, $userId); + $feed->setFolderId($folderId); + $this->mapper->update($feed); } - public function read(){ - - } - } diff --git a/bl/itembl.php b/bl/itembl.php index 7dee2318f..f2b1ac1b3 100644 --- a/bl/itembl.php +++ b/bl/itembl.php @@ -37,22 +37,39 @@ class ItemBl extends Bl { public function findAll(){ - + // TODO all the crazy finding of items } - public function finStarred(){ + public function starredCount($userId){ + return $this->mapper->starredCount($userId); + } + + public function star($itemId, $isStarred, $userId){ + $item = $this->find($itemId, $userId); + if($isStarred){ + $item->setStarred(); + } else { + $item->setUnstarred(); + } + $this->mapper->update($item); } - public function star(){ - + public function read($itemId, $isRead, $userId){ + $item = $this->find($itemId, $userId); + if($isRead){ + $item->setRead(); + } else { + $item->setUnread(); + } + $this->mapper->update($item); } - public function read(){ - + public function readFeed($feedId, $userId){ + $this->mapper->readFeed($feedId, $userId); } } |