diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 13:24:35 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 13:24:35 +0100 |
commit | 3455fe9cb792e584671f465ff6d51732fc1802ff (patch) | |
tree | 817a26f6d03bed8939c0842a63ca5349e28ed099 /bl | |
parent | f4f27ab927f16d7ff8900e92ecf7aee75f355f34 (diff) |
finished findall methods in itembl
Diffstat (limited to 'bl')
-rw-r--r-- | bl/itembl.php | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/bl/itembl.php b/bl/itembl.php index 6f3e5d002..c45ee3a91 100644 --- a/bl/itembl.php +++ b/bl/itembl.php @@ -27,24 +27,61 @@ namespace OCA\News\Bl; use \OCA\News\Db\Item; use \OCA\News\Db\ItemMapper; +use \OCA\News\Db\StatusFlag; +use \OCA\News\Db\FeedType; class ItemBl extends Bl { - public function __construct(ItemMapper $itemMapper){ + private $statusFlag; + + public function __construct(ItemMapper $itemMapper, StatusFlag $statusFlag){ parent::__construct($itemMapper); + $this->statusFlag = $statusFlag; } public function findAllNew($id, $type, $updatedSince, $showAll, $userId){ - // TODO all the crazy finding of items + $status = $this->statusFlag->typeToStatus($type, $showAll); + + switch($type){ + case FeedType::FEED: + $items = $this->mapper->findAllNewFeed($id, $updatedSince, + $status, $userId); + break; + case FeedType::FOLDER: + $items = $this->mapper->findAllNewFolder($id, $updatedSince, + $status, $userId); + break; + default: + $items = $this->mapper->findAllNew($updatedSince, $status, + $userId); + } + + return $items; } public function findAll($id, $type, $limit, $offset, $showAll, $userId){ - // TODO all the crazy finding of items + $status = $this->statusFlag->typeToStatus($type, $showAll); + + switch($type){ + case FeedType::FEED: + $items = $this->mapper->findAllFeed($id, $limit, $offset, + $status, $userId); + break; + case FeedType::FOLDER: + $items = $this->mapper->findAllFolder($id, $limit, $offset, + $status, $userId); + break; + default: + $items = $this->mapper->findAll($limit, $offset, $status, + $userId); + } + + return $items; } |