diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 22:29:58 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-22 22:29:58 +0100 |
commit | 80644c69e096e272184b729071d8a41a3d31b79c (patch) | |
tree | d886219086c0db6d08db00264665d55d16d80792 /controller | |
parent | 452d91ee39c72e83d69fb5c462435cc245bcff73 (diff) |
finished get starred count
Diffstat (limited to 'controller')
-rw-r--r-- | controller/itemcontroller.php | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php index d4cf44de9..62a65a86e 100644 --- a/controller/itemcontroller.php +++ b/controller/itemcontroller.php @@ -58,17 +58,31 @@ class ItemController extends Controller { * @Ajax */ public function starred(){ - + $userId = $this->api->getUserId(); + $starredCount = $this->itemBl->starredCount($userId); + + $params = array( + 'starred' => $starredCount + ); + + return $this->renderJSON($params); } + private function setStarred($isStarred){ + $userId = $this->api->getUserId(); + $itemId = $this->params('itemId'); + + $this->itemBl->star($itemId, $isStarred, $userId); + } + /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function star(){ - + $this->setStarred(true); } @@ -78,17 +92,24 @@ class ItemController extends Controller { * @Ajax */ public function unstar(){ - + $this->setStarred(false); } + private function setRead($isRead){ + $userId = $this->api->getUserId(); + $itemId = $this->params('itemId'); + + $this->itemBl->read($itemId, $isRead, $userId); + } + /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function read(){ - + $this->setRead(true); } @@ -98,7 +119,7 @@ class ItemController extends Controller { * @Ajax */ public function unread(){ - + $this->setRead(false); } @@ -108,6 +129,11 @@ class ItemController extends Controller { * @Ajax */ public function readFeed(){ - + $userId = $this->api->getUserId(); + $feedId = $this->params('feedId'); + + $this->itemBl->readFeed($feedId, $userId); } + + }
\ No newline at end of file |