/**
  * Creates a new Review model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Review();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id_review]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Review model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($part)
 {
     $model = new Review();
     $model->part_fk = $part;
     $model->user_fk = Yii::$app->user->identity->user_id;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['part/view', 'id' => $model->part_fk]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Example #3
0
 /**
  * Creates a new Review model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (Yii::$app->user->isGuest || Yii::$app->user->identity->user_role != 4 && Yii::$app->user->identity->user_role != 3 && Yii::$app->user->identity->user_role != 2) {
         return $this->goHome();
     }
     $model = new Review(['scenario' => Review::SCENARIO_CREATE]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->review_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Review model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($vacancyId)
 {
     $model = new Review();
     $vacancy = Vacancy::findOne($vacancyId);
     if ($vacancy === null) {
         throw new HttpException(404, "This vacancy the Students Assistent is working for is not found");
     }
     $model->vacancy_id = $vacancyId;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }