public function actionCreate()
 {
     $model = new CategoriesNews();
     if (isset($_POST['CategoriesNews'])) {
         $model->attributes = $_POST['CategoriesNews'];
         $model->created = time();
         $model->alias = alias($_POST['CategoriesNews']['name']);
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Thêm thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/categoriesNews/index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function actionCreate()
 {
     $model = new CategoriesNews();
     if (isset($_POST['CategoriesNews'])) {
         $model->attributes = $_POST['CategoriesNews'];
         $model->created = time();
         $model->alias = alias($_POST['CategoriesNews']['name']);
         if (!empty($_POST['CategoriesNews']['parent_id'])) {
             $model->parent_id = $_POST['CategoriesNews']['parent_id'];
         } else {
             $model->parent_id = 0;
         }
         if ($model->save()) {
             Yii::app()->user->setFlash('success', translate('Thêm thành công.'));
             $this->redirect(PIUrl::createUrl('/admin/categoriesNews/index'));
         }
     }
     $arrCate = CategoriesNews::model()->getDataCategories1();
     $this->render('create', array('model' => $model, 'arrCate' => $arrCate));
 }