public function actionDelete()
 {
     $catid = EnvUtil::getRequest("catid");
     $category = PositionCategory::model()->fetchByPk($catid);
     $supCategoryNum = PositionCategory::model()->countByAttributes(array("pid" => 0));
     if (!empty($category) && $category["pid"] == 0 && $supCategoryNum == 1) {
         $this->ajaxReturn(array("IsSuccess" => false, "msg" => Ibos::lang("Leave at least a Category")), "json");
     }
     $ret = $this->_category->delete($catid);
     $this->ajaxReturn(array("IsSuccess" => !!$ret), "json");
 }
 public function handlePositionCategory($event)
 {
     $categorys = array();
     $records = PositionCategory::model()->findAll(array("order" => "sort ASC"));
     if (!empty($records)) {
         foreach ($records as $record) {
             $cat = $record->attributes;
             $categorys[$cat["catid"]] = $cat;
         }
     }
     Syscache::model()->modify("positioncategory", $categorys);
 }