. * */ namespace OCA\News\Controller; use \OCA\AppFramework\Controller\Controller; use \OCA\AppFramework\Core\API; use \OCA\AppFramework\Http\Request; class UserSettingsController extends Controller { public function __construct(API $api, Request $request){ parent::__construct($api, $request); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function read(){ $showAll = $this->api->getUserValue('showAll'); $params = array( 'showAll' => $showAll === '1' ); return $this->renderJSON($params); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function show(){ $this->api->setUserValue('showAll', true); return $this->renderJSON(); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function hide(){ $this->api->setUserValue('showAll', false); return $this->renderJSON(); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function getLanguage(){ $language = $this->api->getTrans()->findLanguage(); $params = array( 'language' => $language ); return $this->renderJSON($params); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function isCompactView(){ $compact = $this->api->getUserValue('compact'); $params = array( 'compact' => $compact === '1' ); return $this->renderJSON($params); } /** * @IsAdminExemption * @IsSubAdminExemption * @Ajax */ public function setCompactView(){ $isCompact = $this->params('compact'); $this->api->setUserValue('compact', $isCompact); return $this->renderJSON(); } }