public function actionCreate()
 {
     $model = new Rubrics();
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Rubrics'])) {
         $model->attributes = $_POST['Rubrics'];
         if ($model->save()) {
             if (Yii::app()->request->isAjaxRequest) {
                 $model->lvl = $_POST['lvl'] ? $_POST['lvl'] : 1;
                 Yii::app()->clientscript->scriptMap['jquery.js'] = false;
                 $this->renderPartial('/rubrics/menuItem', array('model' => $model), false, true);
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     } else {
         $this->render('/_form/create', array('model' => $model));
     }
 }
 public function actionAdd()
 {
     $model = new Rubrics();
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Rubrics'])) {
         $model->attributes = $_POST['Rubrics'];
         $model->menu = 'virtual';
         $model->ctype = 'text';
         $model->chpu = TranslitFilter::translitUrl($model->name);
         $model->parent_id = 0;
         if ($model->save()) {
             $text = new Text();
             $text->text = $_POST['Text']['text'];
             $text->rubric_id = $model->id;
             $text->save();
             $this->redirect('/admin/pages/');
         }
     }
     $this->render('form', array('model' => $model, 'title' => 'Виртуальные страницы'));
 }