diff options
Diffstat (limited to 'controller/pagecontroller.php')
-rw-r--r-- | controller/pagecontroller.php | 42 |
1 files changed, 22 insertions, 20 deletions
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 |