| @@ 123-170 (lines=48) @@ | ||
| 120 | * @return string |
|
| 121 | * @throws \yii\web\NotFoundHttpException |
|
| 122 | */ |
|
| 123 | public function actionUpdateMeta($id) |
|
| 124 | { |
|
| 125 | /* @var $model Meta */ |
|
| 126 | $model = Meta::find()->where( |
|
| 127 | [ |
|
| 128 | 'key' => $id, |
|
| 129 | ] |
|
| 130 | )->one(); |
|
| 131 | if ($model !== null) { |
|
| 132 | if ($model->load($_POST) && $model->validate()) { |
|
| 133 | if ($model->save()) { |
|
| 134 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 135 | $returnUrl = Yii::$app->request->get('returnUrl', ['meta']); |
|
| 136 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 137 | case 'next': |
|
| 138 | return $this->redirect( |
|
| 139 | [ |
|
| 140 | 'create-meta', |
|
| 141 | 'returnUrl' => $returnUrl, |
|
| 142 | ] |
|
| 143 | ); |
|
| 144 | case 'back': |
|
| 145 | return $this->redirect($returnUrl); |
|
| 146 | default: |
|
| 147 | return $this->redirect( |
|
| 148 | Url::toRoute( |
|
| 149 | [ |
|
| 150 | 'update-meta', |
|
| 151 | 'id' => $model->getPrimaryKey(), |
|
| 152 | 'returnUrl' => $returnUrl, |
|
| 153 | ] |
|
| 154 | ) |
|
| 155 | ); |
|
| 156 | } |
|
| 157 | } |
|
| 158 | ||
| 159 | } else { |
|
| 160 | return $this->render( |
|
| 161 | 'updateMeta', |
|
| 162 | [ |
|
| 163 | 'model' => $model, |
|
| 164 | ] |
|
| 165 | ); |
|
| 166 | } |
|
| 167 | } else { |
|
| 168 | throw new NotFoundHttpException('Meta tag '.$id.' not found'); |
|
| 169 | } |
|
| 170 | } |
|
| 171 | ||
| 172 | /** |
|
| 173 | * Creates a new Meta model. |
|
| @@ 279-327 (lines=49) @@ | ||
| 276 | * @return string |
|
| 277 | * @throws \yii\web\NotFoundHttpException |
|
| 278 | */ |
|
| 279 | public function actionUpdateCounter($id) |
|
| 280 | { |
|
| 281 | /* @var $model Counter */ |
|
| 282 | $model = Counter::find()->where( |
|
| 283 | [ |
|
| 284 | 'id' => $id, |
|
| 285 | ] |
|
| 286 | )->one(); |
|
| 287 | AceHelper::setAceScript($this); |
|
| 288 | if ($model !== null) { |
|
| 289 | if ($model->load($_POST) && $model->validate()) { |
|
| 290 | if ($model->save()) { |
|
| 291 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 292 | $returnUrl = Yii::$app->request->get('returnUrl', ['counter']); |
|
| 293 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 294 | case 'next': |
|
| 295 | return $this->redirect( |
|
| 296 | [ |
|
| 297 | 'create-counter', |
|
| 298 | 'returnUrl' => $returnUrl, |
|
| 299 | ] |
|
| 300 | ); |
|
| 301 | case 'back': |
|
| 302 | return $this->redirect($returnUrl); |
|
| 303 | default: |
|
| 304 | return $this->redirect( |
|
| 305 | Url::toRoute( |
|
| 306 | [ |
|
| 307 | 'update-counter', |
|
| 308 | 'id' => $model->id, |
|
| 309 | 'returnUrl' => $returnUrl |
|
| 310 | ] |
|
| 311 | ) |
|
| 312 | ); |
|
| 313 | } |
|
| 314 | } |
|
| 315 | ||
| 316 | } else { |
|
| 317 | return $this->render( |
|
| 318 | 'updateCounter', |
|
| 319 | [ |
|
| 320 | 'model' => $model, |
|
| 321 | ] |
|
| 322 | ); |
|
| 323 | } |
|
| 324 | } else { |
|
| 325 | throw new NotFoundHttpException('counter #'.$id.' not found'); |
|
| 326 | } |
|
| 327 | } |
|
| 328 | ||
| 329 | /** |
|
| 330 | * Creates a new Counter model. |
|
| @@ 564-610 (lines=47) @@ | ||
| 561 | * @return string |
|
| 562 | * @throws \yii\web\NotFoundHttpException |
|
| 563 | */ |
|
| 564 | public function actionUpdateRedirect($id) |
|
| 565 | { |
|
| 566 | /* @var $model Redirect */ |
|
| 567 | $model = Redirect::find()->where( |
|
| 568 | [ |
|
| 569 | 'id' => $id, |
|
| 570 | ] |
|
| 571 | )->one(); |
|
| 572 | if ($model !== null) { |
|
| 573 | if ($model->load($_POST) && $model->validate()) { |
|
| 574 | if ($model->save()) { |
|
| 575 | Yii::$app->session->setFlash('success', Yii::t('app', 'Records has been saved')); |
|
| 576 | $returnUrl = Yii::$app->request->get('returnUrl', ['redirect']); |
|
| 577 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 578 | case 'next': |
|
| 579 | return $this->redirect( |
|
| 580 | [ |
|
| 581 | 'create-redirect', |
|
| 582 | 'returnUrl' => $returnUrl, |
|
| 583 | ] |
|
| 584 | ); |
|
| 585 | case 'back': |
|
| 586 | return $this->redirect($returnUrl); |
|
| 587 | default: |
|
| 588 | return $this->redirect( |
|
| 589 | Url::toRoute( |
|
| 590 | [ |
|
| 591 | 'update-redirect', |
|
| 592 | 'id' => $model->id, |
|
| 593 | 'returnUrl' => $returnUrl, |
|
| 594 | ] |
|
| 595 | ) |
|
| 596 | ); |
|
| 597 | } |
|
| 598 | } |
|
| 599 | } else { |
|
| 600 | return $this->render( |
|
| 601 | 'updateRedirect', |
|
| 602 | [ |
|
| 603 | 'model' => $model, |
|
| 604 | ] |
|
| 605 | ); |
|
| 606 | } |
|
| 607 | } else { |
|
| 608 | throw new NotFoundHttpException('redirect #'.$id.' not found'); |
|
| 609 | } |
|
| 610 | } |
|
| 611 | ||
| 612 | /** |
|
| 613 | * Deletes an existing Redirect model. |
|