Esempio n. 1
0
 /**
  * Enable / Disable multiple Forms
  *
  * @param $status
  * @return \yii\web\Response
  * @throws NotFoundHttpException
  * @throws \Exception
  */
 public function actionUpdateStatus($status)
 {
     $forms = Form::findAll(['id' => Yii::$app->getRequest()->post('ids')]);
     if (empty($forms)) {
         throw new NotFoundHttpException(Yii::t('app', 'Page not found.'));
     } else {
         foreach ($forms as $form) {
             $form->status = $status;
             $form->update();
         }
         Yii::$app->getSession()->setFlash('success', Yii::t('app', 'The selected items have been successfully updated.'));
         return $this->redirect(['index']);
     }
 }