/**
  * Add category action
  */
 public function actionaddcategory()
 {
     // Perms
     if (!Yii::app()->user->checkAccess('op_blog_addcats')) {
         throw new CHttpException(403, Yii::t('error', 'Sorry, You don\'t have the required permissions to enter this section'));
     }
     $model = new BlogCats();
     if (isset($_POST['BlogCats'])) {
         $model->attributes = $_POST['BlogCats'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('adminblog', 'Category Added.'));
             $this->redirect(array('index'));
         }
     }
     // Adding sub?
     if (Yii::app()->request->getParam('parentid')) {
         $model->parentid = Yii::app()->request->getParam('parentid');
     }
     $roles = AuthItem::model()->findAll(array('order' => 'type DESC, name ASC'));
     $_roles = array();
     if (count($roles)) {
         foreach ($roles as $role) {
             $_roles[AuthItem::model()->types[$role->type]][$role->name] = $role->name;
         }
     }
     // Parent list
     $parents = array();
     $parentlist = BlogCats::model()->getRootCats();
     if (count($parentlist)) {
         foreach ($parentlist as $row) {
             $parents[$row->id] = $row->title;
         }
     }
     $this->breadcrumbs[Yii::t('adminblog', 'Adding Category')] = '';
     $this->pageTitle[] = Yii::t('adminblog', 'Adding Category');
     // Render
     $this->render('category_form', array('model' => $model, 'parents' => $parents, 'roles' => $_roles, 'label' => Yii::t('adminblog', 'Adding Category')));
 }