diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 21:03:33 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-02 21:03:33 +0200 |
commit | ec8394eda1b1769b3cf1032fc03a107092b222a4 (patch) | |
tree | bcf13ab35f8b0accc4e30a466b9a5c0233648c3e /external | |
parent | 2b42d8bd9e54afa35d0e8b6cfd67183e3d3d00a8 (diff) |
add read button
Diffstat (limited to 'external')
-rw-r--r-- | external/itemapi.php | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/external/itemapi.php b/external/itemapi.php index e4d8ab904..b1b75ca35 100644 --- a/external/itemapi.php +++ b/external/itemapi.php @@ -75,17 +75,41 @@ class ItemAPI extends Controller { public function getUpdated() { + $result = array( + 'items' => array() + ); - } + $userId = $this->api->getUserId(); + $lastModified = (int) $this->params('lastModified', 0); + $type = (int) $this->params('type'); + $id = (int) $this->params('id'); + + $items = $this->itemBusinessLayer->findAllNew( + $id, + $type, + $lastModified, + true, + $userId + ); + + foreach ($items as $item) { + array_push($result['items'], $item->toAPI()); + } + return new NewsAPIResult($result); + } - public function get() { + private function setRead($isRead) { + $userId = $this->api->getUserId(); + $itemId = $this->params('itemId'); + $this->itemBusinessLayer->read($itemId, $isRead, $userId); } public function read() { - + $this->setRead(true); + return new NewsAPIResult(); } |