| @@ 97-125 (lines=29) @@ | ||
| 94 | ||
| 95 | $post = Yii::$app->request->post(); |
|
| 96 | if ($model->load($post) && $model->validate()) { |
|
| 97 | if ($model->save()) { |
|
| 98 | Yii::$app->session->setFlash('info', Yii::t('app', 'Object saved')); |
|
| 99 | $returnUrl = Yii::$app->request->get('returnUrl', ['/backend/navigation/index', 'id' => $model->id]); |
|
| 100 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 101 | case 'next': |
|
| 102 | return $this->redirect( |
|
| 103 | [ |
|
| 104 | '/backend/navigation/edit', |
|
| 105 | 'parent_id' => $model->parent_id, |
|
| 106 | 'returnUrl' => $returnUrl, |
|
| 107 | ] |
|
| 108 | ); |
|
| 109 | case 'back': |
|
| 110 | return $this->redirect($returnUrl); |
|
| 111 | default: |
|
| 112 | return $this->redirect( |
|
| 113 | Url::toRoute( |
|
| 114 | [ |
|
| 115 | '/backend/navigation/edit', |
|
| 116 | 'id' => $model->id, |
|
| 117 | 'parent_id' => $model->parent_id, |
|
| 118 | 'returnUrl' => $returnUrl, |
|
| 119 | ] |
|
| 120 | ) |
|
| 121 | ); |
|
| 122 | } |
|
| 123 | } else { |
|
| 124 | \Yii::$app->session->setFlash('error', Yii::t('app', 'Cannot update data')); |
|
| 125 | } |
|
| 126 | } |
|
| 127 | ||
| 128 | return $this->render( |
|
| @@ 257-292 (lines=36) @@ | ||
| 254 | } |
|
| 255 | ||
| 256 | $save_result = $model->save(); |
|
| 257 | if ($save_result) { |
|
| 258 | $this->runAction('save-info'); |
|
| 259 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 260 | $returnUrl = Yii::$app->request->get( |
|
| 261 | 'returnUrl', |
|
| 262 | [ |
|
| 263 | '/backend/properties/group', |
|
| 264 | 'id' => $property_group_id, |
|
| 265 | ] |
|
| 266 | ); |
|
| 267 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 268 | case 'next': |
|
| 269 | return $this->redirect( |
|
| 270 | [ |
|
| 271 | '/backend/properties/edit-property', |
|
| 272 | 'property_group_id' => $property_group_id, |
|
| 273 | 'returnUrl' => $returnUrl, |
|
| 274 | ] |
|
| 275 | ); |
|
| 276 | case 'back': |
|
| 277 | return $this->redirect($returnUrl); |
|
| 278 | default: |
|
| 279 | return $this->redirect( |
|
| 280 | Url::toRoute( |
|
| 281 | [ |
|
| 282 | '/backend/properties/edit-property', |
|
| 283 | 'id' => $model->id, |
|
| 284 | 'property_group_id' => $model->property_group_id, |
|
| 285 | 'returnUrl' => $returnUrl, |
|
| 286 | ] |
|
| 287 | ) |
|
| 288 | ); |
|
| 289 | } |
|
| 290 | } else { |
|
| 291 | Yii::$app->session->setFlash('error', Yii::t('app', 'Cannot save data')); |
|
| 292 | } |
|
| 293 | } |
|
| 294 | ||
| 295 | $searchModel = new PropertyStaticValues(); |
|