Пример #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 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]);
 }
Пример #4
0
 /**
 * postReports
 *
 * Up a report of incidence user
 *
 * @access public
 * @params soid => string
 			   message => string
 			   report_category_id => integer
 * @return json
 * @autor Fernando Saavedra
 *
 *
 */
 public function postReports()
 {
     $request = Request::all();
     $user = User::where("soid", "=", $request["soid"])->first();
     //dd($user->id);
     $report = new Report();
     $report->soid = $request["soid"];
     $report->message = $request["message"];
     $report->user_id = $user->id;
     $report->report_category_id = $request["report_category_id"];
     $report->save();
     return Response::json(array("success" => true, "service" => __FUNCTION__, "message" => "Reporte levantado exitosamente"));
 }