コード例 #1
0
 /**
  */
 public function run()
 {
     /** @var DataLogForm $model */
     $model = new DataLogForm();
     $get = Yii::$app->request->get();
     $dataProvider = $model->search($get);
     $dataProvider->pagination->pageSize = $this->pageSize;
     return $this->controller->render($this->viewFile, ['model' => $model, 'dataProvider' => $dataProvider]);
 }
コード例 #2
0
 /**
  * @param $id
  * @return $this|bool
  * @throws NotFoundHttpException
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     return $this->controller->render($this->viewFile, ['model' => $dataLogForm]);
 }
コード例 #3
0
 /**
  * @param $id
  * @return $this|bool
  * @throws NotFoundHttpException
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     if ($dataLogForm->rollback()) {
         Yii::$app->session->setFlash('success', 'Успешно применено!');
     } else {
         Yii::$app->session->setFlash('error', 'Ошибка при откате записи!');
     }
     if (!Yii::$app->request->isAjax) {
         return $this->controller->redirect($this->redirectUrl);
     }
     return true;
 }
コード例 #4
0
 /**
  * @param $id
  * @return $this
  * @throws NotFoundHttpException
  * @throws \Exception
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     if ($dataLogForm->delete()) {
         Yii::$app->session->setFlash('success', 'Лог удален!');
     } else {
         Yii::$app->session->setFlash('error', 'Ошибка удаления лога!');
     }
     if (!Yii::$app->request->isAjax) {
         return $this->controller->redirect($this->redirectUrl);
     }
     return true;
 }