summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 18:08:52 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-14 18:08:52 +0200
commitd9acb9ed876d9814e468081d799f06ffd631580f (patch)
tree887653ca34a9b67adeb60435b3dd37f7329619c3 /controller
parentf52cdaa750f1efa8cb76f6d88c9b1dc291f7b328 (diff)
add serverside possibility to order by oldest first
Diffstat (limited to 'controller')
-rw-r--r--controller/itemcontroller.php7
-rw-r--r--controller/pagecontroller.php42
2 files changed, 27 insertions, 22 deletions
diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php
index dfc059505..0f590950e 100644
--- a/controller/itemcontroller.php
+++ b/controller/itemcontroller.php
@@ -57,6 +57,8 @@ class ItemController extends Controller {
public function index($type, $id, $limit, $offset=0) {
$showAll = $this->settings->getUserValue($this->userId, $this->appName,
'showAll') === '1';
+ $oldestFirst = $this->settings->getUserValue($this->userId, $this->appName,
+ 'oldestFirst') === '1';
$this->settings->setUserValue($this->userId, $this->appName,
'lastViewedFeedId', $id);
@@ -77,8 +79,9 @@ class ItemController extends Controller {
$params['starred'] = $this->itemBusinessLayer->starredCount($this->userId);
}
- $params['items'] = $this->itemBusinessLayer->findAll($id, $type, $limit,
- $offset, $showAll, $this->userId);
+ $params['items'] = $this->itemBusinessLayer->findAll(
+ $id, $type, $limit, $offset, $showAll, $this->userId, $oldestFirst
+ );
// this gets thrown if there are no items
// in that case just return an empty array
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php
index 88154803f..db0fa48bf 100644
--- a/controller/pagecontroller.php
+++ b/controller/pagecontroller.php
@@ -51,17 +51,17 @@ class PageController extends Controller {
* @NoAdminRequired
*/
public function settings() {
- $showAll = $this->settings->getUserValue($this->userId, $this->appName,
- 'showAll');
- $compact = $this->settings->getUserValue($this->userId, $this->appName,
- 'compact');
- $language = $this->l10n->getLanguageCode();
-
- return [
- 'showAll' => $showAll === '1',
- 'compact' => $compact === '1',
- 'language' => $language
- ];
+ $settings = ['showAll', 'compact', 'readOnScroll', 'oldestFirst'];
+
+ $result = ['language' => $this->l10n->getLanguageCode()];
+
+ foreach ($settings as $setting) {
+ $result[$setting] = $this->settings->getUserValue(
+ $this->userId, $this->appName, $setting
+ ) === '1';
+ }
+
+ return $result;
}
@@ -70,17 +70,19 @@ class PageController extends Controller {
*
* @param bool $showAll
* @param bool $compact
+ * @param bool $readOnScroll
+ * @param bool $oldestFirst
*/
- public function updateSettings($showAll, $compact) {
- if($showAll !== null) {
- $this->settings->setUserValue($this->userId, $this->appName,
- 'showAll', $showAll);
- }
-
- if($compact !== null) {
- $this->settings->setUserValue($this->userId, $this->appName,
- 'compact', $compact);
+ public function updateSettings($showAll, $compact, $readOnScroll, $oldestFirst) {
+ $settings = ['showAll', 'compact', 'readOnScroll', 'oldestFirst'];
+
+ foreach ($settings as $setting) {
+ if(${$setting} !== null) {
+ $this->settings->setUserValue($this->userId, $this->appName,
+ $setting, ${$setting});
+ }
}
}
+
} \ No newline at end of file