예제 #1
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->renderAjax('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($date)
 {
     $model = new Event();
     $model->created_date = $date;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->renderAjax('create', ['model' => $model]);
     }
 }
예제 #3
0
 /**
  * Creates a new Event model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Event();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', '事件<' . $model->title . '>添加成功!  ');
         return $this->redirect(['index']);
     } else {
         return $this->renderAjax('create', ['model' => $model->loadDefaultValues()]);
     }
 }