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 addPosition() { import("@.Util.PositionCategory"); import("@.Util.City"); $data = $this->get('data') ? $this->get('data') : array(); /** 职位类别 **/ $data['positionCates'] = PositionCategory::getSubCatesInArr(); /** 工作城市 **/ $data['city'] = City::getCities(); $this->assign("data", $data); $this->display(); }
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); }
protected function _getRid($rid) { $input = array(); switch ($_SERVER['REQUEST_METHOD']) { case 'POST': $input =& $_POST; break; default: $input =& $_GET; } if (isset($input['pid']) && $input['pid'] > 0) { return PositionCategory::getRidById($input['pid']); } else { return 0; } }
public static function getCates() { return self::$_cates = M("position_category")->where("status = 1")->select(); }
/** * 边侧栏. * * @version 0.0.1 * @since 0.1.0 * * @author GenialX */ protected function _sider() { import("@.Util.PositionCategory"); $data = $this->get('data') ? $this->get('data') : array(); $cates = PositionCategory::getSubCatesInMultiArr(); $data['cates'] = $cates; $this->assign("data", $data); }