/**
  * 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]);
     } 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()
 {
     $model = new Review();
     $categoryModel = new ReviewCategory();
     $treeParents = TreeHelper::build($categoryModel->find()->addOrderBy('tree')->addOrderBy('lft')->all());
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model, 'treeParents' => $treeParents]);
     }
 }
Beispiel #3
0
 public function actionAddReview()
 {
     $model = new Review();
     $model->load(Yii::$app->request->post());
     $model->user_id = Yii::$app->user->getId();
     $result = $model->save();
     if (!$result) {
         //            var_dump($model->getErrors()); die;
     }
     return $this->redirect(['reviews']);
 }
Beispiel #4
0
 public function actionConfirmed()
 {
     $codeBankCampaign = new CodeBankCampaign();
     $codeBankCampaign->loadDefaultValues();
     $review = new Review();
     $review->loadDefaultValues();
     $request = Yii::$app->request;
     if ($request->isPost && $codeBankCampaign->load($request->post()) && $review->load($request->post())) {
         $isValid = $codeBankCampaign->validate();
         $isValid = $review->validate() && $isValid;
         if ($isValid) {
             if ($review->save()) {
                 $codeBankCampaign->objectId = $review->id;
                 $codeBankCampaign->save();
                 return $this->redirect(['/campaign/index']);
             }
         }
     }
     return $this->render('step', ['model' => $review, 'codeBankCampaign' => $codeBankCampaign]);
 }