Example #1
0
 /**
  * Creates a new Conference model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Conference();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         $aValidate = ActiveForm::validate($model);
         //            Yii::trace('addDoclad(): return json ' . print_r($aValidate, true));
         return $aValidate;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
         //            return $this->redirect(['view', 'id' => $model->cnf_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }