summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 01:25:55 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-23 01:25:55 +0200
commit4eaee79d9b27d9131bd862725dbe90ba54eec254 (patch)
tree4b6de904b6167d7ed6070d24e7f41ff8c5f6c500 /controller
parent7af31802517eb31a05e1c5d248a8c502d9d8b943 (diff)
implement #137 serverside
Diffstat (limited to 'controller')
-rw-r--r--controller/feedcontroller.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php
index c31d4d1d6..3b9ab5cf9 100644
--- a/controller/feedcontroller.php
+++ b/controller/feedcontroller.php
@@ -36,8 +36,8 @@ class FeedController extends Controller {
private $userId;
private $settings;
- public function __construct($appName,
- IRequest $request,
+ public function __construct($appName,
+ IRequest $request,
FolderService $folderService,
FeedService $feedService,
ItemService $itemService,
@@ -66,9 +66,9 @@ class FeedController extends Controller {
];
try {
- $params['newestItemId'] =
+ $params['newestItemId'] =
$this->itemService->getNewestItemId($this->userId);
-
+
// An exception occurs if there is a newest item. If there is none,
// simply ignore it and do not add the newestItemId
} catch (ServiceNotFoundException $ex) {}
@@ -81,11 +81,11 @@ class FeedController extends Controller {
* @NoAdminRequired
*/
public function active(){
- $feedId = (int) $this->settings->getUserValue($this->userId,
+ $feedId = (int) $this->settings->getUserValue($this->userId,
$this->appName,'lastViewedFeedId');
$feedType = $this->settings->getUserValue($this->userId, $this->appName,
'lastViewedFeedType');
-
+
// cast from null to int is 0
if($feedType !== null){
$feedType = (int) $feedType;
@@ -95,15 +95,15 @@ class FeedController extends Controller {
try {
if($feedType === FeedType::FOLDER){
$this->folderService->find($feedId, $this->userId);
-
+
} elseif ($feedType === FeedType::FEED){
$this->feedService->find($feedId, $this->userId);
-
+
// if its the first launch, those values will be null
} elseif($feedType === null){
throw new ServiceNotFoundException('');
}
-
+
} catch (ServiceNotFoundException $ex){
$feedId = 0;
$feedType = FeedType::SUBSCRIPTIONS;
@@ -123,18 +123,20 @@ class FeedController extends Controller {
*
* @param string $url
* @param int $parentFolderId
+ * @param string $title
*/
- public function create($url, $parentFolderId){
+ public function create($url, $parentFolderId, $title){
try {
- // we need to purge deleted feeds if a feed is created to
+ // we need to purge deleted feeds if a feed is created to
// prevent already exists exceptions
$this->feedService->purgeDeleted($this->userId, false);
- $feed = $this->feedService->create($url, $parentFolderId, $this->userId);
+ $feed = $this->feedService->create($url, $parentFolderId,
+ $this->userId, $title);
$params = ['feeds' => [$feed]];
try {
- $params['newestItemId'] =
+ $params['newestItemId'] =
$this->itemService->getNewestItemId($this->userId);
// An exception occurs if there is a newest item. If there is none,
@@ -153,7 +155,7 @@ class FeedController extends Controller {
/**
* @NoAdminRequired
- *
+ *
* @param int $feedId
*/
public function delete($feedId){