| @@ 21-42 (lines=22) @@ | ||
| 18 | * @return string|\yii\web\Response |
|
| 19 | * @throws \yii\web\ServerErrorHttpException |
|
| 20 | */ |
|
| 21 | public function actionSettings() |
|
| 22 | { |
|
| 23 | if (\Yii::$app->request->isPost) { |
|
| 24 | $model = new GoogleFeed(); |
|
| 25 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
| 26 | $model->saveConfig(); |
|
| 27 | } elseif ($model->hasErrors()) { |
|
| 28 | Yii::$app->session->setFlash('error', Helper::formatModelErrors($model, '<br />')); |
|
| 29 | } |
|
| 30 | return $this->refresh(); |
|
| 31 | } |
|
| 32 | ||
| 33 | $model = new GoogleFeed(); |
|
| 34 | $model->loadConfig(); |
|
| 35 | ||
| 36 | return $this->render( |
|
| 37 | 'settings', |
|
| 38 | [ |
|
| 39 | 'model' => $model |
|
| 40 | ] |
|
| 41 | ); |
|
| 42 | } |
|
| 43 | ||
| 44 | ||
| 45 | } |
|
| @@ 48-69 (lines=22) @@ | ||
| 45 | * @return string|\yii\web\Response |
|
| 46 | * @throws \yii\web\ServerErrorHttpException |
|
| 47 | */ |
|
| 48 | public function actionSettings() |
|
| 49 | { |
|
| 50 | if (Yii::$app->request->isPost) { |
|
| 51 | $model = new Yml(); |
|
| 52 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
|
| 53 | $model->saveConfig(); |
|
| 54 | } elseif ($model->hasErrors()) { |
|
| 55 | Yii::$app->session->setFlash('error', Helper::formatModelErrors($model, '<br />')); |
|
| 56 | } |
|
| 57 | return $this->refresh(); |
|
| 58 | } |
|
| 59 | ||
| 60 | $model = new Yml(); |
|
| 61 | $model->loadConfig(); |
|
| 62 | ||
| 63 | return $this->render( |
|
| 64 | 'settings', |
|
| 65 | [ |
|
| 66 | 'model' => $model |
|
| 67 | ] |
|
| 68 | ); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @return \yii\web\Response |
|