コード例 #1
0
ファイル: MainController.php プロジェクト: YSeanKo/MCS
 public function actionClaim()
 {
     $this->layout = 'claim';
     $model = new Trip();
     //        $this->render('claim', array('model' => $model));
     //
     //        if ($model->load(Yii::$app->request->post()) && $model->claim(Yii::$app->params['adminEmail']))
     //        {
     //            Yii::$app->session->setFlash('contactFormSubmitted');
     //
     //            return $this->refresh();
     //        }
     //        else
     //        {
     //            return $this->render('claim', array('model' => $model));
     //        }
     if (isset($_POST['Trip'])) {
         $model->attributes = $_POST['Trip'];
         $model->claim();
         Yii::app()->user->setFlash('claim', 'Thank you for contacting us. We will respond to you as soon as possible.');
         $this->refresh();
     }
     $dataProvider = new CActiveDataProvider('Trip');
     $this->render('claim', array('model' => $model, 'dataProvider' => $dataProvider));
 }