コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new MrClass();
     //                    print_r($_POST);
     //                    echo $_POST['MrClass']['start_date'];
     $_POST['MrClass']['start_date'] = date("Y-m-d", strtotime($_POST['MrClass']['start_date']));
     $_POST['MrClass']['end_date'] = date("Y-m-d", strtotime($_POST['MrClass']['end_date']));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['MrClass'])) {
         $model->attributes = $_POST['MrClass'];
         if ($model->save()) {
             Yii::app()->user->setFlash('mrClassAdd', "Classes added.");
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }