summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-09-14 02:22:36 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-09-14 02:22:44 +0200
commitdf8f6b5fee643c5b2af8e8d33a7865e898518485 (patch)
tree7100d25d814d5f4b4cf502c9e2b9e6dd5f562ab3 /controller
parent67d7754c364147c274790a76dab7cbfedd352645 (diff)
implement pull to refresh, fix #44
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index a35d27476..a3f632e39 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -89,6 +89,35 @@ class ItemController extends Controller {
}
+ /**
+ * @IsAdminExemption
+ * @IsSubAdminExemption
+ * @Ajax
+ */
+ public function newItems() {
+ $userId = $this->api->getUserId();
+ $showAll = $this->api->getUserValue('showAll') === '1';
+
+ $type = (int) $this->params('type');
+ $id = (int) $this->params('id');
+ $lastModified = (int) $this->params('lastModified', 0);
+
+ $params = array();
+
+ try {
+ $params['newestItemId'] = $this->itemBusinessLayer->getNewestItemId($userId);
+ $params['feeds'] = $this->feedBusinessLayer->findAll($userId);
+ $params['starred'] = $this->itemBusinessLayer->starredCount($userId);
+ $params['items'] = $this->itemBusinessLayer->findAllNew($id, $type,
+ $lastModified, $showAll, $userId);
+ // this gets thrown if there are no items
+ // in that case just return an empty array
+ } catch(BusinessLayerException $ex) {}
+
+ return $this->renderJSON($params);
+ }
+
+
private function setStarred($isStarred){
$userId = $this->api->getUserId();
$feedId = (int) $this->params('feedId');