Esempio n. 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($type = self::TYPE_CMS_PAGE)
 {
     $model = new Cms();
     $categories = false;
     if (isset($_POST['Cms'])) {
         $model->attributes = $_POST['Cms'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->page_id, 'type' => $type));
         }
     }
     if (!$type) {
         $categories = $model->getAllCategoriesArray();
     }
     $this->render('create', array('model' => $model, 'type' => $type, 'categories' => $categories));
 }