Example #1
0
 /**
  * Lists all Record models.
  * @return mixed
  */
 public function run()
 {
     $model = new RecordSearch();
     $dataProvider = $model->search(Yii::$app->request->queryParams);
     $dataProvider->pagination->pageSize = Yii::$app->params['search.page.size'];
     Yii::$app->view->params['aside'] = Filter::widget(['action' => 'search', 'model' => $model]);
     return $this->controller()->render('search', ['model' => $model, 'dataProvider' => $dataProvider]);
 }
 public function run($id = 0)
 {
     $controller = $this->controller;
     $record = $controller->findModel(Record::className(), $id);
     $form = new RequestDeactivateForm();
     $form->setAttributes(Yii::$app->request->post('RequestDeactivateForm'));
     if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($form);
     }
     if ($form->validate() && Yii::$app->record->requestDeactivation($record->id, Yii::$app->user->id, $form->code, $form->description)) {
         return $controller->redirect(['search']);
     }
     return $controller->redirect(['review', 'id' => $record->id]);
 }
Example #3
0
 public function run($id = 0)
 {
     $controller = $this->controller();
     $record = $controller->findModel(Record::className(), $id);
     $form = new DeactivateForm();
     $form->setAttributes(Yii::$app->request->post('DeactivateForm'));
     if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($form);
     }
     if ($form->validate()) {
         //true
         //            var_dump($form->isRejectAction()); die;
         $success = $form->isRejectAction() ? self::record()->rejectDeactivation($record->id, Yii::$app->user->id, $form->code, $form->description) : self::record()->approveDeactivate($record->id, Yii::$app->user->id);
         if ($success) {
             return $controller->redirect(['search']);
         }
     }
     return $controller->redirect(['review', 'id' => $record->id]);
 }
Example #4
0
 public function actionQc()
 {
     $model = new Record();
     $view = Yii::$app->view;
     $view->title = Yii::t('app', 'Search panel - List of records to QC');
     $view->params['aside'] = Filter::widget(['action' => 'qc', 'model' => $model]);
     $provider = $model->search(Yii::$app->request->queryParams);
     $provider->query->addSelect(['status_id' => 'record.status_id']);
     $provider->query->andFilterWhere(['in', 'status_id', self::getAvailableStatusesByAction('qc')]);
     return $this->render('qc', ['dataProvider' => $provider]);
 }