Ejemplo n.º 1
0
 public function init()
 {
     $roles = new Model_Roles();
     $result = $roles->getRoles();
     if ($result) {
         foreach ($result as $row) {
             $this->_list["role"][$row->getPkId()] = $row->getRoleName();
         }
     }
     $resources = new Model_Resources();
     $result2 = $resources->getAllResources();
     if ($result2) {
         foreach ($result2 as $row2) {
             $resource = $row2->getResourceName();
             $arr_resources = explode("/", $resource);
             $second_name = !empty($arr_resources[1]) ? ucfirst($arr_resources[1]) . " - " : "";
             $this->_list["resource"][$row2->getPkId()] = ucfirst($arr_resources[0]) . " - " . $second_name . $row2->getDescription();
         }
     }
     foreach ($this->_fields as $col => $name) {
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
Ejemplo n.º 2
0
 public function init()
 {
     $roles = new Model_Roles();
     $result = $roles->getRoleByCat(Model_Roles::COLDCHAIN);
     foreach ($result as $role) {
         $this->_list["role"][''] = 'Select';
         $this->_list["role"][$role->getPkId()] = $role->getRoleName();
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "login_id":
             case "email":
             case "phone":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "password":
             case "confirm_password":
                 $this->addElement("password", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "required" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
Ejemplo n.º 3
0
 public static function fields()
 {
     if (is_null(self::$_fields)) {
         // process
         self::$_fields = array_keys(self::getInstance()->toArray());
     }
     return self::$_fields;
 }
Ejemplo n.º 4
0
 private function _rolesDel()
 {
     if ($this->_modelRoles->delById($_GET['Id'])) {
         $this->_utilMsg->showMsg('删除角色成功', 1);
     } else {
         $this->_utilMsg->showMsg('删除角色失败', -2);
     }
 }
Ejemplo n.º 5
0
 public static function acl($pReload = FALSE)
 {
     if ($pReload || is_null(self::$_acl)) {
         self::$_acl = new Zend_Acl();
         foreach (Model_Roles::getInstance()->findAll() as $role) {
             self::$_acl->addRole(new Zend_Acl_Role($role->identity()));
         }
     }
     return self::$_acl;
 }
Ejemplo n.º 6
0
 public function init()
 {
     $roles = new Model_Roles();
     $result = $roles->getRoles();
     $action = Zend_Registry::get("action");
     if ($action == 'role-resources') {
         $this->_list["role"][""] = 'Select';
     }
     if ($result) {
         foreach ($result as $row) {
             $this->_list["role"][$row->getPkId()] = $row->getRoleName();
         }
     }
     $em = Zend_Registry::get("doctrine");
     $result = $em->getRepository("ResourceTypes")->findAll();
     $this->_list["resource_type"][''] = "Select";
     foreach ($result as $rs) {
         $this->_list["resource_type"][$rs->getPkId()] = $rs->getResourceType();
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "description":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "resource_name":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
Ejemplo n.º 7
0
 /**
  * 后台右边主页面显示
  */
 public function actionRight()
 {
     $this->_utilMsg->createNavBar();
     $gameTypeList = $this->_getGlobalData('game_type');
     $gameTypeList = Model::getTtwoArrConvertOneArr($gameTypeList, 'Id', 'name');
     $operatorList = $this->_getGlobalData('operator_list');
     $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name');
     $this->_utilRooms = $this->_getGlobalData('Util_Rooms', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $orgList = $this->_getGlobalData('org');
     $orgList = Model::getTtwoArrConvertOneArr($orgList, 'Id', 'name');
     $departmentList = $this->_getGlobalData('department');
     $departmentList = Model::getTtwoArrConvertOneArr($departmentList, 'Id', 'name');
     $userClass['word_department'] = $departmentList[$userClass['_departmentId']];
     $this->_modelRoles = $this->_getGlobalData('Model_Roles', 'object');
     if (count($userClass['_roles'])) {
         $rolesArr = array();
         foreach ($userClass['_roles'] as $roles) {
             $rolesArr[] = $this->_modelRoles->findByRoleToName($roles);
         }
         $userClass['word_roles'] = implode(',', $rolesArr);
     }
     $userClass['word_vip'] = implode(',', $userClass['_orderVipLevel']);
     $userClass['word_org'] = $orgList[$userClass['_orgId']];
     $userOeratorIds = array();
     $userClass['bulletin_list'] = $userClass->getMail(array(1, 15), array('type' => 1));
     //公告
     $userClass['bulletin_list'] = $userClass['bulletin_list']['data'];
     $userClass['work_list'] = $userClass->getMail(array(1, 15), array('type' => 2));
     //工作交接
     $userClass['work_list'] = $userClass['work_list']['data'];
     foreach ($userClass['_operatorIds'] as $list) {
         $str = "{$operatorList[$list['operator_id']]}[{$gameTypeList[$list['game_type_id']]}]";
         array_push($userOeratorIds, $str);
     }
     if ($userClass['_roomId']) {
         $roomClass = $this->_utilRooms->getRoom($userClass['_roomId']);
         $this->_view->assign('roomClass', $roomClass);
     }
     $this->_view->assign('userOeratorIds', $userOeratorIds);
     $this->_view->assign('userClass', $userClass);
     $this->_view->display();
 }
Ejemplo n.º 8
0
 /**
  *
  * @param boolean $pReload
  * @return Zend_Acl
  */
 public static function acl($pReload = FALSE)
 {
     if ($pReload || is_null(self::$_acl)) {
         $acl = new Zend_Acl();
         foreach (Model_Resources::getInstance()->find_all() as $res) {
             $acl->add($res);
         }
         foreach (Model_Roles::getInstance()->find_all() as $role) {
             $acl->addRole($role);
         }
         foreach (self::getInstance()->find_all() as $grant) {
             if ($grant->allow) {
                 $acl->allow($grant->role, $grant->resource);
             } else {
                 $acl->deny($grant->role, $grant->resource);
             }
         }
         self::$_acl = $acl;
     }
     return self::$_acl;
 }
 public function roleResourcesAction()
 {
     $form = new Form_Iadmin_RoleComboSearch();
     $form_add = new Form_Iadmin_RoleResource();
     $params = array();
     $rr = new Model_Resources();
     $roles = new Model_Roles();
     if ($this->_request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $role_name = $form->getValue('role');
             $description = $form->getValue('description');
             $resource_name = $form->getValue('resource_name');
             $resource_type = $form->getValue('resource_type');
             if (!empty($role_name)) {
                 $params['role'] = $role_name;
             }
             if (!empty($description)) {
                 $params['description'] = $description;
             }
             if (!empty($resource_name)) {
                 $params['resourceName'] = $resource_name;
             }
             if (!empty($resource_type)) {
                 $params['resourceType'] = $resource_type;
             }
         }
     } else {
         $role_name = $this->_getParam('role', '');
         $description = $this->_getParam('description');
         $resource_name = $this->_getParam('resource_name');
         $resource_type = $this->_getParam('resource_type');
         if (!empty($role_name)) {
             $params['role'] = $role_name;
             $form->role->setValue($role_name);
         }
         if (!empty($description)) {
             $params['description'] = $description;
             $form->description->setValue($description);
         }
         if (!empty($resource_name)) {
             $params['resourceName'] = $resource_name;
             $form->resource_name->setValue($resource_name);
         }
         if (!empty($resource_type)) {
             $params['resourceType'] = $resource_type;
             $form->resource_type->setValue($resource_type);
         }
     }
     //App_Controller_Functions::pr($params);
     $rr->form_values = $params;
     //  var_dump($params);
     $result = $rr->getAllResources();
     $roles->form_values['role'] = $params['role'];
     $role_result = $roles->getAllRolesResources();
     $this->view->roles = $role_result;
     $this->view->form = $form;
     $this->view->form_add = $form_add;
     $this->view->paginator = $result;
     $this->view->pagination_params = $params;
 }
Ejemplo n.º 10
0
 function get_role($pReload = FALSE)
 {
     if ($pReload || is_null($this->_role)) {
         // process
         $this->_role = Model_Roles::getInstance()->get($this->role);
     }
     return $this->_role;
 }
Ejemplo n.º 11
0
 /**
  * 获取所有的角色
  */
 public function getAllRoles()
 {
     $this->_modelRoles = $this->_getGlobalData('Model_Roles', 'object');
     $allRoles = $this->_modelRoles->findAll();
     return $this->getTtwoArrConvertOneArr($allRoles, 'role_value', 'role_name');
 }
Ejemplo n.º 12
0
 /**
  * 后台右边主页面显示
  */
 public function actionRight()
 {
     $this->_utilMsg->createNavBar();
     $gameTypeList = $this->_getGlobalData('game_type');
     $gameTypeList = Model::getTtwoArrConvertOneArr($gameTypeList, 'Id', 'name');
     $operatorList = $this->_getGlobalData('operator_list');
     $operatorList = Model::getTtwoArrConvertOneArr($operatorList, 'Id', 'operator_name');
     $this->_utilRooms = $this->_getGlobalData('Util_Rooms', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $orgList = $this->_getGlobalData('org');
     $orgList = Model::getTtwoArrConvertOneArr($orgList, 'Id', 'name');
     $departmentList = $this->_getGlobalData('department');
     $departmentList = Model::getTtwoArrConvertOneArr($departmentList, 'Id', 'name');
     $userClass['word_department'] = $departmentList[$userClass['_departmentId']];
     $this->_modelRoles = $this->_getGlobalData('Model_Roles', 'object');
     if ($userClass['_roles']) {
         $rolesArr = array();
         foreach ($userClass['_roles'] as $roles) {
             $rolesArr[] = $this->_modelRoles->findByRoleToName($roles);
         }
         $userClass['word_roles'] = implode(',', $rolesArr);
     }
     $userClass['word_vip'] = implode(',', $userClass['_orderVipLevel']);
     $userClass['word_org'] = $orgList[$userClass['_orgId']];
     $userOeratorIds = array();
     $userClass['bulletin_list'] = $userClass->getMail(array(1, 15), array('type' => 1));
     //公告
     $userClass['bulletin_list'] = $userClass['bulletin_list']['data'];
     $userClass['work_list'] = $userClass->getMail(array(1, 15), array('type' => 2));
     //工作交接
     $userClass['work_list'] = $userClass['work_list']['data'];
     foreach ($userClass['_operatorIds'] as $list) {
         $str = "{$operatorList[$list['operator_id']]}[{$gameTypeList[$list['game_type_id']]}]";
         array_push($userOeratorIds, $str);
     }
     if ($userClass['_roomId']) {
         $roomClass = $this->_utilRooms->getRoom($userClass['_roomId']);
         $this->_view->assign('roomClass', $roomClass);
         $displaycontent = "已经登录房间[" . $roomClass['_roomName'] . "] [<a href=" . Tools::url('Group', 'Room', array('doaction' => 'outRoom')) . "><font style='color:red;'>退出房间</font></a>] ";
     } else {
         $displaycontent = '<font color="#999999">您还未登录房间</font>[<a href="' . Tools::url('Group', 'Room') . '">房间列表</a>]';
     }
     $displaycontent .= ' [<a href="' . Tools::url('MyTask', 'Index') . '">我的工单列表</a>]';
     $tmpLang = $this->_getGlobalData('lang');
     $lang = array();
     foreach ($tmpLang as $key => $value) {
         $lang[$key]['lang'] = $value;
         $lang[$key]['url_lang'] = Tools::url(CONTROL, 'ChangeLang', array('lang' => $key));
     }
     $this->_view->assign('curLangId', LANG_ID);
     $this->_view->assign('lang', $lang);
     $this->_view->assign('userOeratorIds', $userOeratorIds);
     $this->_view->assign('userClass', $userClass);
     //将错误日志显示给管理员
     $Permission_IndexErrorLog = $this->_utilRbac->checkAct('Index_ErrorLog');
     //审核权限
     //		if(in_array($userClass['_userName'],explode(',',MasterAccount) )){
     if ($Permission_IndexErrorLog === 1) {
         $this->_view->assign('showErrorLogFiles', true);
         $this->_view->assign('errorLogFiles', $this->_errorLogFiles());
     } else {
         $this->_view->assign('showErrorLogFiles', false);
     }
     $this->_view->assign('displaycontent', $displaycontent);
     $this->_view->display();
 }
Ejemplo n.º 13
0
 public function roleseditAction()
 {
     $id = $this->_getParam("role_id", NULL);
     $this->view->role = Model_Roles::getInstance()->get($id);
 }