| @@ 25-46 (lines=22) @@ | ||
| 22 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 23 | * @throws \Ffcms\Core\Exception\NativeException |
|
| 24 | */ |
|
| 25 | public function actionIndex() |
|
| 26 | { |
|
| 27 | // initialize model and pass configs inside |
|
| 28 | $model = new FormSettings($this->getConfigs()); |
|
| 29 | ||
| 30 | // check if submit request is sended |
|
| 31 | if ($model->send()) { |
|
| 32 | if ($model->validate()) { |
|
| 33 | // save configurations |
|
| 34 | $this->setConfigs($model->getAllProperties()); |
|
| 35 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 36 | $this->response->redirect('search/index'); |
|
| 37 | } else { |
|
| 38 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | // render output view |
|
| 43 | return $this->view->render('settings', [ |
|
| 44 | 'model' => $model |
|
| 45 | ]); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 73-93 (lines=21) @@ | ||
| 70 | * @return string |
|
| 71 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 72 | */ |
|
| 73 | public function actionSettings() |
|
| 74 | { |
|
| 75 | // initialize settings model |
|
| 76 | $model = new FormSettings($this->getConfigs()); |
|
| 77 | ||
| 78 | // check if form is send |
|
| 79 | if ($model->send()) { |
|
| 80 | if ($model->validate()) { |
|
| 81 | $this->setConfigs($model->getAllProperties()); |
|
| 82 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 83 | $this->response->redirect('comments/index'); |
|
| 84 | } else { |
|
| 85 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | ||
| 89 | // render view |
|
| 90 | return $this->view->render('settings', [ |
|
| 91 | 'model' => $model |
|
| 92 | ]); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| @@ 190-207 (lines=18) @@ | ||
| 187 | * @return string |
|
| 188 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 189 | */ |
|
| 190 | public function actionSettings() |
|
| 191 | { |
|
| 192 | $model = new FormSettings($this->getConfigs()); |
|
| 193 | ||
| 194 | if ($model->send()) { |
|
| 195 | if ($model->validate()) { |
|
| 196 | $this->setConfigs($model->getAllProperties()); |
|
| 197 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 198 | $this->response->redirect('profile/index'); |
|
| 199 | } else { |
|
| 200 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 201 | } |
|
| 202 | } |
|
| 203 | ||
| 204 | return $this->view->render('settings', [ |
|
| 205 | 'model' => $model |
|
| 206 | ]); |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| @@ 85-104 (lines=20) @@ | ||
| 82 | * @return string |
|
| 83 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
| 84 | */ |
|
| 85 | public function actionSettings() |
|
| 86 | { |
|
| 87 | // load model and pass property's as argument |
|
| 88 | $model = new FormUserSettings($this->getConfigs()); |
|
| 89 | ||
| 90 | if ($model->send()) { |
|
| 91 | if ($model->validate()) { |
|
| 92 | $this->setConfigs($model->getAllProperties()); |
|
| 93 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
|
| 94 | $this->response->redirect('user/index'); |
|
| 95 | } else { |
|
| 96 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | // render view |
|
| 101 | return $this->view->render('settings', [ |
|
| 102 | 'model' => $model |
|
| 103 | ]); |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||