getRoleNames() static public method

Get a mapping of role keys and i18n key names.
static public getRoleNames ( boolean $contextOnly = false, array $roleIds = null ) : array
$contextOnly boolean If false, also returns site-level roles (Site admin)
$roleIds array Only return role names of these IDs
return array
 /**
  * @see GridHandler::renderFilter()
  */
 function renderFilter($request)
 {
     // Get filter data.
     import('classes.security.RoleDAO');
     $roleOptions = array(0 => 'grid.user.allRoles') + RoleDAO::getRoleNames(true);
     $filterData = array('roleOptions' => $roleOptions);
     return parent::renderFilter($request, $filterData);
 }
 /**
  * @copydoc Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     import('classes.security.RoleDAO');
     $roleOptions = RoleDAO::getRoleNames(true);
     $templateMgr->assign('roleOptions', $roleOptions);
     // Users can't edit the role once user group is created.
     // userGroupId is 0 for new User Groups because it is cast to int in UserGroupGridHandler.
     $disableRoleSelect = $this->getUserGroupId() > 0 ? true : false;
     $templateMgr->assign('disableRoleSelect', $disableRoleSelect);
     $templateMgr->assign('selfRegistrationRoleIds', $this->getPermitSelfRegistrationRoles());
     return parent::fetch($request);
 }
 /**
  * @see GridHandler::renderFilter()
  */
 function renderFilter($request)
 {
     // Get filter data.
     import('classes.security.RoleDAO');
     $roleOptions = array(0 => 'grid.user.allPermissionLevels') + RoleDAO::getRoleNames(true);
     // Reader roles are not important for stage assignments.
     if (array_key_exists(ROLE_ID_READER, $roleOptions)) {
         unset($roleOptions[ROLE_ID_READER]);
     }
     $filterData = array('roleOptions' => $roleOptions);
     $workflowStages = array(0 => 'grid.userGroup.allStages') + WorkflowStageDAO::getWorkflowStageTranslationKeys();
     $filterData['stageOptions'] = $workflowStages;
     return parent::renderFilter($request, $filterData);
 }
Beispiel #4
0
 /**
  * @see Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr =& TemplateManager::getManager();
     import('classes.security.RoleDAO');
     $roleOptions = RoleDAO::getRoleNames(true);
     $templateMgr->assign('roleOptions', $roleOptions);
     $userGroupDao =& DAORegistry::getDAO('UserGroupDAO');
     $stages = $userGroupDao->getWorkflowStageTranslationKeys();
     $templateMgr->assign('stageOptions', $stages);
     // Users can't edit the role once user group is created.
     $disableRoleSelect = !is_null($this->getUserGroupId()) ? true : false;
     $templateMgr->assign('disableRoleSelect', $disableRoleSelect);
     return parent::fetch($request);
 }