| @@ 65-85 (lines=21) @@ | ||
| 62 | * |
|
| 63 | * @NoAdminRequired |
|
| 64 | */ |
|
| 65 | public function setView($view) { |
|
| 66 | if (!$this->isViewAllowed($view)) { |
|
| 67 | return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY); |
|
| 68 | } |
|
| 69 | ||
| 70 | $userId = $this->userSession->getUser()->getUID(); |
|
| 71 | $app = $this->appName; |
|
| 72 | ||
| 73 | try { |
|
| 74 | $this->config->setUserValue( |
|
| 75 | $userId, |
|
| 76 | $app, |
|
| 77 | 'currentView', |
|
| 78 | $view |
|
| 79 | ); |
|
| 80 | } catch(\Exception $e) { |
|
| 81 | return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 82 | } |
|
| 83 | ||
| 84 | return new JSONResponse(); |
|
| 85 | } |
|
| 86 | ||
| 87 | ||
| 88 | /** |
|
| @@ 139-159 (lines=21) @@ | ||
| 136 | * |
|
| 137 | * @NoAdminRequired |
|
| 138 | */ |
|
| 139 | public function setShowWeekNr($showWeekNr) { |
|
| 140 | if (!is_bool($showWeekNr)) { |
|
| 141 | return new JSONResponse([], Http::STATUS_UNPROCESSABLE_ENTITY); |
|
| 142 | } |
|
| 143 | ||
| 144 | $userId = $this->userSession->getUser()->getUID(); |
|
| 145 | $app = $this->appName; |
|
| 146 | ||
| 147 | try { |
|
| 148 | $this->config->setUserValue( |
|
| 149 | $userId, |
|
| 150 | $app, |
|
| 151 | 'currentShowWeekNr', |
|
| 152 | (string)$showWeekNr |
|
| 153 | ); |
|
| 154 | } catch(\Exception $e) { |
|
| 155 | return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 156 | } |
|
| 157 | ||
| 158 | return new JSONResponse(); |
|
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * get config value for showing week numbers |
|