mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 23:59:41 +02:00
role assign: MDL-17323 Show users from parent contexts ... Refine group labels.
This commit is contained in:
parent
a792ac1d7a
commit
490740d6cb
3 changed files with 30 additions and 8 deletions
|
@ -1177,17 +1177,21 @@ class existing_role_holders extends role_assign_user_selector_base {
|
|||
}
|
||||
|
||||
protected function this_con_group_name($search, $numusers) {
|
||||
$contexttype = get_contextlevel_name($this->context->contextlevel);
|
||||
if ($search) {
|
||||
$a = new stdClass;
|
||||
$a->search = $search;
|
||||
$a->contexttype = $contexttype;
|
||||
if ($numusers) {
|
||||
return get_string('usersinthiscontextmatching', 'role', $search);
|
||||
return get_string('usersinthisxmatching', 'role', $a);
|
||||
} else {
|
||||
return get_string('noneinthiscontextmatching', 'role', $search);
|
||||
return get_string('noneinthisxmatching', 'role', $a);
|
||||
}
|
||||
} else {
|
||||
if ($numusers) {
|
||||
return get_string('usersinthiscontext', 'role');
|
||||
return get_string('usersinthisx', 'role', $contexttype);
|
||||
} else {
|
||||
return get_string('noneinthiscontext', 'role');
|
||||
return get_string('noneinthisx', 'role', $contexttype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,8 +134,8 @@ $string['morethan'] = 'More than $a';
|
|||
$string['multipleroles'] = 'Multiple roles';
|
||||
$string['my:manageblocks'] = 'Manage myMoodle page blocks';
|
||||
$string['nocapabilitiesincontext'] = 'No capabilities available in this context';
|
||||
$string['noneinthiscontext'] = 'None in this context';
|
||||
$string['noneinthiscontextmatching'] = 'No users matching \'$a\' in this context';
|
||||
$string['noneinthisx'] = 'None in this $a';
|
||||
$string['noneinthisxmatching'] = 'No users matching \'$a->search\' in this $a->contexttype';
|
||||
$string['notabletoassignroleshere'] = 'You are not able to assign any roles here';
|
||||
$string['notabletooverrideroleshere'] = 'You are not able to override the permissions on any roles here';
|
||||
$string['notset'] = 'Not set';
|
||||
|
@ -230,8 +230,8 @@ $string['user:viewuseractivitiesreport'] = 'See user activity reports';
|
|||
$string['userhashiddenassignments'] = 'This user has one or more hidden role assignments in this course';
|
||||
$string['usersfrom'] = 'Users from $a';
|
||||
$string['usersfrommatching'] = 'Users from $a->contextname matching \'$a->search\'';
|
||||
$string['usersinthiscontext'] = 'Users in this context';
|
||||
$string['usersinthiscontextmatching'] = 'Users in this context matching \'$a\'';
|
||||
$string['usersinthisx'] = 'Users in this $a';
|
||||
$string['usersinthisxmatching'] = 'Users in this $a->contexttype matching \'$a->search\'';
|
||||
$string['userswiththisrole'] = 'Users with role';
|
||||
$string['userswithrole'] = 'All users with a role';
|
||||
$string['useshowadvancedtochange'] = 'Use \'Show advanced\' to change';
|
||||
|
|
|
@ -3303,6 +3303,24 @@ function capabilities_cleanup($component, $newcapdef=NULL) {
|
|||
* UI FUNCTIONS *
|
||||
****************/
|
||||
|
||||
/**
|
||||
* @param integer $contextlevel $context->context level. One of the CONTEXT_... constants.
|
||||
* @return string the name for this type of context.
|
||||
*/
|
||||
function get_contextlevel_name($contextlevel) {
|
||||
static $strcontextlevels = null;
|
||||
if (is_null($strcontextlevels)) {
|
||||
$strcontextlevels = array(
|
||||
CONTEXT_SYSTEM => get_string('coresystem'),
|
||||
CONTEXT_USER => get_string('user'),
|
||||
CONTEXT_COURSECAT => get_string('category'),
|
||||
CONTEXT_COURSE => get_string('course'),
|
||||
CONTEXT_MODULE => get_string('activitymodule'),
|
||||
CONTEXT_BLOCK => get_string('block')
|
||||
);
|
||||
}
|
||||
return $strcontextlevels[$contextlevel];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints human readable context identifier.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue