/** * * 过滤器 * @param unknown_type $filterChain */ public function filterCheckAdmin($filterChain) { //未登录,跳转 if (!($uid = $this->isAdmin())) { $this->redirect(Yii::app()->baseUrl . "/"); } //获取用户详细资料 $adminModel = new AdminModel(); $this->_userInfo = $adminModel->getInfoByUid($uid); $this->username = $this->_userInfo['username']; $this->hospital = $this->_userInfo['hospital']; $this->role = $this->_userInfo['role']; //账号错误 if (!$this->_userInfo) { $this->_output("302", 'access deny', 'text'); } $roleModel = new RoleModel(); $role = $roleModel->getInfoByCode($this->_userInfo['role']); if ($role && $role['permission']) { $permission = explode(',', $role['permission']); //生成菜单 $menuModel = new MenuModel(); $this->menus = $menuModel->getInfoByGroup($permission); foreach ($this->menus as $key => $value) { $this->menuGroup[$value['group']] = $value['group']; } } else { header("HTTP/1.1 401"); exit; } $filterChain->run(); }
/** * Runs a SQL query using the install resource provided and * remembers any errors that occur. * * @param unknown_type $installer * @param string $sql * @return Aschroder_SMTPPro_Helper_Mysql4_Install */ public function attemptQuery(&$installer, $sql) { try { $installer->run($sql); } catch (Exception $ex) { $this->addInstallProblem($ex); } return $this; }