| @@ 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( |
|
| @@ 207-242 (lines=36) @@ | ||
| 204 | } |
|
| 205 | ||
| 206 | $save_result = $model->save(); |
|
| 207 | if ($save_result) { |
|
| 208 | $this->runAction('save-info'); |
|
| 209 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 210 | $returnUrl = Yii::$app->request->get( |
|
| 211 | 'returnUrl', |
|
| 212 | [ |
|
| 213 | '/backend/properties/group', |
|
| 214 | 'id' => $property_group_id, |
|
| 215 | ] |
|
| 216 | ); |
|
| 217 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 218 | case 'next': |
|
| 219 | return $this->redirect( |
|
| 220 | [ |
|
| 221 | '/backend/properties/edit-property', |
|
| 222 | 'property_group_id' => $property_group_id, |
|
| 223 | 'returnUrl' => $returnUrl, |
|
| 224 | ] |
|
| 225 | ); |
|
| 226 | case 'back': |
|
| 227 | return $this->redirect($returnUrl); |
|
| 228 | default: |
|
| 229 | return $this->redirect( |
|
| 230 | Url::toRoute( |
|
| 231 | [ |
|
| 232 | '/backend/properties/edit-property', |
|
| 233 | 'id' => $model->id, |
|
| 234 | 'property_group_id' => $model->property_group_id, |
|
| 235 | 'returnUrl' => $returnUrl, |
|
| 236 | ] |
|
| 237 | ) |
|
| 238 | ); |
|
| 239 | } |
|
| 240 | } else { |
|
| 241 | Yii::$app->session->setFlash('error', Yii::t('app', 'Cannot save data')); |
|
| 242 | } |
|
| 243 | } |
|
| 244 | ||
| 245 | $searchModel = new PropertyStaticValues(); |
|