| @@ 106-153 (lines=48) @@ | ||
| 103 | * @return string |
|
| 104 | * @throws \yii\web\NotFoundHttpException |
|
| 105 | */ |
|
| 106 | public function actionUpdateMeta($id) |
|
| 107 | { |
|
| 108 | /* @var $model Meta */ |
|
| 109 | $model = Meta::find()->where( |
|
| 110 | [ |
|
| 111 | 'key' => $id, |
|
| 112 | ] |
|
| 113 | )->one(); |
|
| 114 | if ($model !== null) { |
|
| 115 | if ($model->load($_POST) && $model->validate()) { |
|
| 116 | if ($model->save()) { |
|
| 117 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 118 | $returnUrl = Yii::$app->request->get('returnUrl', ['meta']); |
|
| 119 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 120 | case 'next': |
|
| 121 | return $this->redirect( |
|
| 122 | [ |
|
| 123 | 'create-meta', |
|
| 124 | 'returnUrl' => $returnUrl, |
|
| 125 | ] |
|
| 126 | ); |
|
| 127 | case 'back': |
|
| 128 | return $this->redirect($returnUrl); |
|
| 129 | default: |
|
| 130 | return $this->redirect( |
|
| 131 | Url::toRoute( |
|
| 132 | [ |
|
| 133 | 'update-meta', |
|
| 134 | 'id' => $model->getPrimaryKey(), |
|
| 135 | 'returnUrl' => $returnUrl, |
|
| 136 | ] |
|
| 137 | ) |
|
| 138 | ); |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | } else { |
|
| 143 | return $this->render( |
|
| 144 | 'updateMeta', |
|
| 145 | [ |
|
| 146 | 'model' => $model, |
|
| 147 | ] |
|
| 148 | ); |
|
| 149 | } |
|
| 150 | } else { |
|
| 151 | throw new NotFoundHttpException('Meta tag '.$id.' not found'); |
|
| 152 | } |
|
| 153 | } |
|
| 154 | ||
| 155 | /** |
|
| 156 | * Creates a new Meta model. |
|
| @@ 262-310 (lines=49) @@ | ||
| 259 | * @return string |
|
| 260 | * @throws \yii\web\NotFoundHttpException |
|
| 261 | */ |
|
| 262 | public function actionUpdateCounter($id) |
|
| 263 | { |
|
| 264 | /* @var $model Counter */ |
|
| 265 | $model = Counter::find()->where( |
|
| 266 | [ |
|
| 267 | 'id' => $id, |
|
| 268 | ] |
|
| 269 | )->one(); |
|
| 270 | AceHelper::setAceScript($this); |
|
| 271 | if ($model !== null) { |
|
| 272 | if ($model->load($_POST) && $model->validate()) { |
|
| 273 | if ($model->save()) { |
|
| 274 | Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been saved')); |
|
| 275 | $returnUrl = Yii::$app->request->get('returnUrl', ['counter']); |
|
| 276 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 277 | case 'next': |
|
| 278 | return $this->redirect( |
|
| 279 | [ |
|
| 280 | 'create-counter', |
|
| 281 | 'returnUrl' => $returnUrl, |
|
| 282 | ] |
|
| 283 | ); |
|
| 284 | case 'back': |
|
| 285 | return $this->redirect($returnUrl); |
|
| 286 | default: |
|
| 287 | return $this->redirect( |
|
| 288 | Url::toRoute( |
|
| 289 | [ |
|
| 290 | 'update-counter', |
|
| 291 | 'id' => $model->id, |
|
| 292 | 'returnUrl' => $returnUrl |
|
| 293 | ] |
|
| 294 | ) |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | } |
|
| 298 | ||
| 299 | } else { |
|
| 300 | return $this->render( |
|
| 301 | 'updateCounter', |
|
| 302 | [ |
|
| 303 | 'model' => $model, |
|
| 304 | ] |
|
| 305 | ); |
|
| 306 | } |
|
| 307 | } else { |
|
| 308 | throw new NotFoundHttpException('counter #'.$id.' not found'); |
|
| 309 | } |
|
| 310 | } |
|
| 311 | ||
| 312 | /** |
|
| 313 | * Creates a new Counter model. |
|
| @@ 547-593 (lines=47) @@ | ||
| 544 | * @return string |
|
| 545 | * @throws \yii\web\NotFoundHttpException |
|
| 546 | */ |
|
| 547 | public function actionUpdateRedirect($id) |
|
| 548 | { |
|
| 549 | /* @var $model Redirect */ |
|
| 550 | $model = Redirect::find()->where( |
|
| 551 | [ |
|
| 552 | 'id' => $id, |
|
| 553 | ] |
|
| 554 | )->one(); |
|
| 555 | if ($model !== null) { |
|
| 556 | if ($model->load($_POST) && $model->validate()) { |
|
| 557 | if ($model->save()) { |
|
| 558 | Yii::$app->session->setFlash('success', Yii::t('app', 'Records has been saved')); |
|
| 559 | $returnUrl = Yii::$app->request->get('returnUrl', ['redirect']); |
|
| 560 | switch (Yii::$app->request->post('action', 'save')) { |
|
| 561 | case 'next': |
|
| 562 | return $this->redirect( |
|
| 563 | [ |
|
| 564 | 'create-redirect', |
|
| 565 | 'returnUrl' => $returnUrl, |
|
| 566 | ] |
|
| 567 | ); |
|
| 568 | case 'back': |
|
| 569 | return $this->redirect($returnUrl); |
|
| 570 | default: |
|
| 571 | return $this->redirect( |
|
| 572 | Url::toRoute( |
|
| 573 | [ |
|
| 574 | 'update-redirect', |
|
| 575 | 'id' => $model->id, |
|
| 576 | 'returnUrl' => $returnUrl, |
|
| 577 | ] |
|
| 578 | ) |
|
| 579 | ); |
|
| 580 | } |
|
| 581 | } |
|
| 582 | } else { |
|
| 583 | return $this->render( |
|
| 584 | 'updateRedirect', |
|
| 585 | [ |
|
| 586 | 'model' => $model, |
|
| 587 | ] |
|
| 588 | ); |
|
| 589 | } |
|
| 590 | } else { |
|
| 591 | throw new NotFoundHttpException('redirect #'.$id.' not found'); |
|
| 592 | } |
|
| 593 | } |
|
| 594 | ||
| 595 | /** |
|
| 596 | * Deletes an existing Redirect model. |
|