コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new OurService('create');
     if (Yii::app()->session['current-service-cat']) {
         $model->parent_id = Yii::app()->session['current-service-cat'];
     }
     if (isset($_POST['OurService'])) {
         $model->attributes = $_POST['OurService'];
         if ($model->save()) {
             $this->redirect(array('index', 'cat' => $model->parent_id));
         }
     }
     $this->render('create', array('model' => $model, 'actions' => $this->listActionsCanAccess));
 }