/** * 取得实例 * * @return NavPanel */ public static function getInstance() { if (!self::$_instance instanceof self) { $className = __CLASS__; self::$_instance = new $className(); } return self::$_instance; }
public function rank() { $this->checkPermission('B03'); $this->loadModel('admin/account', 'account'); $userId = $this->getData('userId'); $panel = NavPanel::getInstance(); $menu = $panel->getAllMenu(); $this->bindModel->where('is_admin_g = 1'); $usergs = $this->bindModel->search(FALSE); $this->account->where('is_admin = 1'); $admins = $this->account->search(FALSE); $userRank = array(); if ($userId > 0) { $userRank = $this->bindModel->getRank($userId); } $this->userRank = $userRank; $this->setData('checked', $userId); $this->setData('groups', $usergs); $this->setData('admins', $admins); $data = array('menu' => $menu, 'panel' => $panel); $this->renderAdminView($this->controllerId . "/rank", $data); }
/** * 显示按钮 * @param type $rankId 按钮权限 * @param type $class 样式 * @param type $title 按钮名称 * @param type $css_name 样式 * @param type $url 地址 * @return type string */ public function button($rankId, $title, $class, $url = "javascript:;void(0)", $css_name = '') { if (NavPanel::getInstance()->checkPrem($rankId)) { } return "<a href='" . $url . "' class='" . $class . $css_name . "' >{$title}</a>"; }