MDL-63387 user: show both role names on course participants page.
This commit is contained in:
@@ -129,10 +129,10 @@ class participants_filter implements renderable, templatable {
|
||||
protected function get_roles_filter(): ?stdClass {
|
||||
$roles = [];
|
||||
$roles += [-1 => get_string('noroles', 'role')];
|
||||
$roles += get_viewable_roles($this->context);
|
||||
$roles += get_viewable_roles($this->context, null, ROLENAME_BOTH);
|
||||
|
||||
if (has_capability('moodle/role:assign', $this->context)) {
|
||||
$roles += get_assignable_roles($this->context, ROLENAME_ALIAS);
|
||||
$roles += get_assignable_roles($this->context, ROLENAME_BOTH);
|
||||
}
|
||||
|
||||
return $this->get_filter_object(
|
||||
|
||||
@@ -173,8 +173,8 @@ class user_roles_editable extends \core\output\inplace_editable {
|
||||
}
|
||||
|
||||
// Check that all the groups belong to the course.
|
||||
$allroles = role_fix_names(get_all_roles($context), $context);
|
||||
$assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);
|
||||
$allroles = role_fix_names(get_all_roles($context), $context, ROLENAME_BOTH);
|
||||
$assignableroles = get_assignable_roles($context, ROLENAME_BOTH, false);
|
||||
$viewableroles = get_viewable_roles($context);
|
||||
$userrolesbyid = get_user_roles($context, $userid, true, 'c.contextlevel DESC, r.sortorder ASC');
|
||||
$profileroles = get_profile_roles($context);
|
||||
|
||||
@@ -202,8 +202,11 @@ class participants extends \table_sql implements dynamic_table {
|
||||
if ($canseegroups) {
|
||||
$this->groups = groups_get_all_groups($this->courseid, 0, 0, 'g.*', true);
|
||||
}
|
||||
$this->allroles = role_fix_names(get_all_roles($this->context), $this->context);
|
||||
$this->assignableroles = get_assignable_roles($this->context, ROLENAME_ALIAS, false);
|
||||
|
||||
// If user has capability to review enrol, show them both role names.
|
||||
$allrolesnamedisplay = ($canreviewenrol ? ROLENAME_BOTH : ROLENAME_ALIAS);
|
||||
$this->allroles = role_fix_names(get_all_roles($this->context), $this->context, $allrolesnamedisplay);
|
||||
$this->assignableroles = get_assignable_roles($this->context, ROLENAME_BOTH, false);
|
||||
$this->profileroles = get_profile_roles($this->context);
|
||||
$this->viewableroles = get_viewable_roles($this->context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user