| @@ 95-113 (lines=19) @@ | ||
| 92 | * |
|
| 93 | * @NoAdminRequired |
|
| 94 | */ |
|
| 95 | public function getView() { |
|
| 96 | $userId = $this->userSession->getUser()->getUID(); |
|
| 97 | $app = $this->appName; |
|
| 98 | ||
| 99 | try { |
|
| 100 | $view = $this->config->getUserValue( |
|
| 101 | $userId, |
|
| 102 | $app, |
|
| 103 | 'currentView', |
|
| 104 | 'month' |
|
| 105 | ); |
|
| 106 | } catch(\Exception $e) { |
|
| 107 | return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 108 | } |
|
| 109 | ||
| 110 | return new JSONResponse([ |
|
| 111 | 'value' => $view, |
|
| 112 | ]); |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * check if view is allowed |
|
| @@ 168-186 (lines=19) @@ | ||
| 165 | * |
|
| 166 | * @NoAdminRequired |
|
| 167 | */ |
|
| 168 | public function getShowWeekNr() { |
|
| 169 | $userId = $this->userSession->getUser()->getUID(); |
|
| 170 | $app = $this->appName; |
|
| 171 | ||
| 172 | try { |
|
| 173 | $showWeekNr = (bool) $this->config->getUserValue( |
|
| 174 | $userId, |
|
| 175 | $app, |
|
| 176 | 'currentShowWeekNr', |
|
| 177 | '' |
|
| 178 | ); |
|
| 179 | } catch(\Exception $e) { |
|
| 180 | return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 181 | } |
|
| 182 | ||
| 183 | return new JSONResponse([ |
|
| 184 | 'value' => $showWeekNr, |
|
| 185 | ]); |
|
| 186 | } |
|
| 187 | } |
|