diff options
Diffstat (limited to 'external/itemapi.php')
-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(); } |