| @@ 22-41 (lines=20) @@ | ||
| 19 | * @return string|\yii\web\Response |
|
| 20 | * @throws \yii\web\ServerErrorHttpException |
|
| 21 | */ |
|
| 22 | public function actionSettings() |
|
| 23 | { |
|
| 24 | if (\Yii::$app->request->isPost) { |
|
| 25 | $model = new GoogleFeed(); |
|
| 26 | if (Yii::$app->request->isPost && $model->load(Yii::$app->request->post()) && $model->validate()) { |
|
| 27 | $model->saveConfig(); |
|
| 28 | } elseif ($model->hasErrors()) { |
|
| 29 | Yii::$app->session->setFlash('error', Helper::formatModelErrors($model, '<br />')); |
|
| 30 | } |
|
| 31 | return $this->refresh(); |
|
| 32 | } |
|
| 33 | $model = new GoogleFeed(); |
|
| 34 | $model->loadConfig(); |
|
| 35 | return $this->render( |
|
| 36 | 'settings', |
|
| 37 | [ |
|
| 38 | 'model' => $model |
|
| 39 | ] |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * @return \yii\web\Response |
|
| @@ 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 |
|