/** * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new CmsCategory();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['CmsCategory'])) {
         $model->attributes = $_POST['CmsCategory'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Ajax function - makes a new category on the file and returns the new list in the view
  **/
 public function new_category()
 {
     $this->use_layout = false;
     $cat = new CmsCategory();
     $cat->name = Request::get("cat");
     $cat->save();
     if (!($this->all_categories = $cat->clear()->all())) {
         $this->all_categories = array();
     }
     $this->cat_list = $this->render_partial("cat_list");
 }