Пример #1
0
 /**
  * Creates a new Report model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Report();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'date' => $model->date, 'location_id' => $model->location_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 /**
  * Creates a new Report model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Report();
     $model->create_date = date('Y-m-d');
     $tasks = Task::find(['deleted' => '0'])->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model, 'tasks' => $tasks]);
     }
 }
Пример #3
0
 public function actionIndex()
 {
     $report = new Report();
     if ($report->load(Yii::$app->request->post()) && $report->validate()) {
         $active_from = $_POST['Report']['active_from'];
         $active_to = $_POST['Report']['active_to'];
         $query = $report->ReportSql($active_from, $active_to);
         //return print_r($query);
         return $this->render('report', ['query' => $query]);
     }
     return $this->render('index', ['report' => $report]);
 }
Пример #4
0
 public function actionIndex()
 {
     $model = new Report();
     $models = null;
     try {
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             $models = $model->search();
         }
     } catch (\Exception $e) {
         $msg = isset($e->errorInfo[2]) ? $e->errorInfo[2] : $e->getMessage();
         $model->addError('_exception', $msg);
     }
     return $this->render('index', ['model' => $model, 'models' => $models]);
 }
Пример #5
0
 public function actionForm()
 {
     $model = new Report();
     if ($model->load(Yii::$app->request->post())) {
         $model->location_is_precise = true;
         $date = new DateTime();
         $model->time_sent = $date->format('Y-m-d H:i:s');
         $model->time_updated = $date->format('Y-m-d H:i:s');
         if ($model->validate()) {
             $model->save();
             \Yii::$app->session->setFlash('submittedForm');
             return $this->refresh();
         }
     }
     $languages = Language::find()->all();
     $language_arr = [];
     foreach ($languages as $language) {
         $language_arr[$language->id_language] = $language->name . " (" . $language->dialect . ")";
     }
     $disabilities = DisabilityCategory::find()->all();
     $disability_arr = [];
     foreach ($disabilities as $disability) {
         $disability_arr[$disability->id_disability_category] = $disability->category;
     }
     $problems = ProblemCategory::find()->all();
     $problem_arr = [];
     foreach ($problems as $problem) {
         $problem_arr[$problem->id_problem_category] = $problem->category;
     }
     return $this->render('form', ['model' => $model, 'languages' => $language_arr, 'disabilities' => $disability_arr, 'problems' => $problem_arr]);
 }