summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-23 01:23:47 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-23 01:23:47 +0100
commit29571aff347e7cd8ab9a755d6211fed575d4f129 (patch)
tree37ddedfff203eb84d2a2e9fdf3ac6a7268710caa /controller
parenta2d264b4d4d7d71c719c0665c40f55e411bdd4f4 (diff)
finished itemcontroller
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index 1dbf7c43e..7a9fb1aeb 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -48,7 +48,24 @@ class ItemController extends Controller {
* @Ajax
*/
public function items(){
- // TBD
+ $userId = $this->api->getUserId();
+ $limit = $this->params('limit');
+ $type = $this->params('type');
+ $id = $this->params('id');
+
+ if($limit !== null){
+ $offset = $this->params('offset', 0);
+ $items = $this->itemBl->findAll($id, $type, $limit, $offset, $userId);
+ } else {
+ $updatedSince = $this->params('updatedSince');
+ $items = $this->itemBl->findAllNew($id, $type, $updatedSince, $userId);
+ }
+
+ $params = array(
+ 'items' => $items
+ );
+
+ return $this->renderJSON($params);
}