/**
  * Creates a new Incident model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Incident();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 /**
  * Creates a new Incident model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($raptor_id)
 {
     $incident = new Incident();
     $incident->raptor_id = $raptor_id;
     if ($incident->load(Yii::$app->request->post()) && $incident->save()) {
         Yii::$app->session->setFlash('success', 'The incident was successfully created.');
         return $this->redirect(['update', 'id' => $incident->id]);
     }
     return $this->render('create', ['incident' => $incident]);
 }
 public function actionCreateFromAssignation($id)
 {
     $model = new Incident();
     $model->solved = false;
     $model->user_id = Yii::$app->user->id;
     $assignationmodel = new Assignation();
     $assignationmodel = Assignation::findOne($id);
     $model->date = $assignationmodel->date;
     $model->equipment_id = $assignationmodel->equipment_id;
     $model->room_id = $assignationmodel->room_id;
     $model->location_id = $assignationmodel->location_id;
     $model->client_id = $assignationmodel->client_id;
     $this->layout = '/main2';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view2', 'id' => $model->id]);
     } else {
         return $this->render('create2', ['model' => $model]);
     }
 }