diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-20 12:14:42 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-20 12:14:42 +0200 |
commit | b9f3136f3a7564b983aef6564f9c7488d5b2b25b (patch) | |
tree | a50cc5851cf399df4ba594eacac53f3533c6a2ea /controller/pagecontroller.php | |
parent | e56498784f6691d5ceba84ed070f5b6f0d27aafa (diff) |
get rid of unneeded settings core class and inject it from the core container
Diffstat (limited to 'controller/pagecontroller.php')
-rw-r--r-- | controller/pagecontroller.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/controller/pagecontroller.php b/controller/pagecontroller.php index 5b7cf7ea1..fe6fe967a 100644 --- a/controller/pagecontroller.php +++ b/controller/pagecontroller.php @@ -14,21 +14,22 @@ namespace OCA\News\Controller; use \OCP\IRequest; +use \OCP\IConfig; use \OCP\AppFramework\Http\JSONResponse; use \OCP\AppFramework\Controller; -use \OCA\News\Core\Settings; - class PageController extends Controller { private $settings; private $l10n; + private $userId; - public function __construct($appName, IRequest $request, Settings $settings, - $l10n){ + public function __construct($appName, IRequest $request, IConfig $settings, + $l10n, $userId){ parent::__construct($appName, $request); $this->settings = $settings; $this->l10n = $l10n; + $this->userId = $userId; } @@ -45,8 +46,10 @@ class PageController extends Controller { * @NoAdminRequired */ public function settings() { - $showAll = $this->settings->getUserValue('showAll'); - $compact = $this->settings->getUserValue('compact'); + $showAll = $this->settings->getUserValue($this->userId, $this->appName, + 'showAll'); + $compact = $this->settings->getUserValue($this->userId, $this->appName, + 'compact'); $language = $this->l10n->findLanguage(); $settings = array( @@ -67,11 +70,13 @@ class PageController extends Controller { $isCompact = $this->params('compact', null); if($isShowAll !== null) { - $this->settings->setUserValue('showAll', $isShowAll); + $this->settings->setUserValue($this->userId, $this->appName, + 'showAll', $isShowAll); } if($isCompact !== null) { - $this->settings->setUserValue('compact', $isCompact); + $this->settings->setUserValue($this->userId, $this->appName, + 'compact', $isCompact); } return new JSONResponse(); |