| @@ 183-200 (lines=18) @@ | ||
| 180 | * @return string |
|
| 181 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 182 | */ |
|
| 183 | public function actionSettings() |
|
| 184 | { |
|
| 185 | $model = new FormSettings($this->getConfigs()); |
|
| 186 | ||
| 187 | if ($model->send()) { |
|
| 188 | if ($model->validate()) { |
|
| 189 | $this->setConfigs($model->getAllProperties()); |
|
| 190 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 191 | App::$Response->redirect('profile/index'); |
|
| 192 | } else { |
|
| 193 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 194 | } |
|
| 195 | } |
|
| 196 | ||
| 197 | return App::$View->render('settings', [ |
|
| 198 | 'model' => $model |
|
| 199 | ]); |
|
| 200 | } |
|
| 201 | ||
| 202 | ||
| 203 | } |
|
| @@ 162-181 (lines=20) @@ | ||
| 159 | * User identity settings |
|
| 160 | * @return string |
|
| 161 | */ |
|
| 162 | public function actionSettings() |
|
| 163 | { |
|
| 164 | // load model and pass property's as argument |
|
| 165 | $model = new FormUserSettings($this->getConfigs()); |
|
| 166 | ||
| 167 | if ($model->send()) { |
|
| 168 | if ($model->validate()) { |
|
| 169 | $this->setConfigs($model->getAllProperties()); |
|
| 170 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 171 | App::$Response->redirect('user/index'); |
|
| 172 | } else { |
|
| 173 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 174 | } |
|
| 175 | } |
|
| 176 | ||
| 177 | // render view |
|
| 178 | return App::$View->render('settings', [ |
|
| 179 | 'model' => $model->export() |
|
| 180 | ]); |
|
| 181 | } |
|
| 182 | ||
| 183 | /** |
|
| 184 | * Send invite to user by email |
|
| @@ 233-255 (lines=23) @@ | ||
| 230 | * @return string |
|
| 231 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 232 | */ |
|
| 233 | public function actionSettings() |
|
| 234 | { |
|
| 235 | // initialize model and pass configs |
|
| 236 | $model = new FormSettings($this->getConfigs()); |
|
| 237 | ||
| 238 | // check if form is submited to save data |
|
| 239 | if ($model->send()) { |
|
| 240 | // is validation passed? |
|
| 241 | if ($model->validate()) { |
|
| 242 | // save properties |
|
| 243 | $this->setConfigs($model->getAllProperties()); |
|
| 244 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 245 | App::$Response->redirect('feedback/index'); |
|
| 246 | } else { |
|
| 247 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 248 | } |
|
| 249 | } |
|
| 250 | ||
| 251 | // render view |
|
| 252 | return App::$View->render('settings', [ |
|
| 253 | 'model' => $model |
|
| 254 | ]); |
|
| 255 | } |
|
| 256 | ||
| 257 | } |
|
| @@ 268-288 (lines=21) @@ | ||
| 265 | * @return string |
|
| 266 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 267 | */ |
|
| 268 | public function actionSettings() |
|
| 269 | { |
|
| 270 | // initialize settings model |
|
| 271 | $model = new FormSettings($this->getConfigs()); |
|
| 272 | ||
| 273 | // check if form is send |
|
| 274 | if ($model->send()) { |
|
| 275 | if ($model->validate()) { |
|
| 276 | $this->setConfigs($model->getAllProperties()); |
|
| 277 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 278 | App::$Response->redirect('comments/index'); |
|
| 279 | } else { |
|
| 280 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 281 | } |
|
| 282 | } |
|
| 283 | ||
| 284 | // render view |
|
| 285 | return App::$View->render('settings', [ |
|
| 286 | 'model' => $model |
|
| 287 | ]); |
|
| 288 | } |
|
| 289 | ||
| 290 | ||
| 291 | ||
| @@ 378-398 (lines=21) @@ | ||
| 375 | * @throws SyntaxException |
|
| 376 | * @throws NativeException |
|
| 377 | */ |
|
| 378 | public function actionSettings() |
|
| 379 | { |
|
| 380 | // init model with config array data |
|
| 381 | $model = new FormSettings($this->getConfigs()); |
|
| 382 | ||
| 383 | // check if form is send |
|
| 384 | if ($model->send()) { |
|
| 385 | if ($model->validate()) { |
|
| 386 | $this->setConfigs($model->getAllProperties()); |
|
| 387 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 388 | App::$Response->redirect('content/index'); |
|
| 389 | } else { |
|
| 390 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 391 | } |
|
| 392 | } |
|
| 393 | ||
| 394 | // draw response |
|
| 395 | return App::$View->render('settings', [ |
|
| 396 | 'model' => $model->export() |
|
| 397 | ]); |
|
| 398 | } |
|
| 399 | } |
|