mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
The "alias" role names were not being used in the role assign screens. Now they are. MDL-11323
This commit is contained in:
parent
79c2d039d5
commit
d13d30ef78
@ -44,10 +44,14 @@
|
||||
} else {
|
||||
error('Invalid course id');
|
||||
}
|
||||
$coursecontext = $context;
|
||||
|
||||
} else if (!empty($courseid)){ // we need this for user tabs in user context
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Invalid course id');
|
||||
}
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
} else {
|
||||
$courseid = SITEID;
|
||||
$course = clone($SITE);
|
||||
@ -65,7 +69,8 @@
|
||||
|
||||
/// needed for tabs.php
|
||||
$overridableroles = get_overridable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context);
|
||||
$assignableroles = get_assignable_roles($context); // Plain role names, may be altered later
|
||||
|
||||
|
||||
/// Get some language strings
|
||||
|
||||
@ -158,6 +163,19 @@
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
|
||||
/// Rename some of the role names if needed
|
||||
if (isset($coursecontext)) {
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($assignableroles[$alias->roleid])) {
|
||||
$assignableroles[$alias->roleid] = $alias->text.' ('.$assignableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Process incoming role assignment
|
||||
|
||||
if ($frm = data_submitted()) {
|
||||
|
@ -28,6 +28,9 @@
|
||||
if (!$course = get_record('course', 'id', $courseid)) {
|
||||
error('Bad course ID');
|
||||
}
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
} else {
|
||||
$course = clone($SITE);
|
||||
$courseid = SITEID;
|
||||
@ -149,6 +152,18 @@
|
||||
include_once('tabs.php');
|
||||
}
|
||||
|
||||
/// Rename some of the role names if needed
|
||||
if (isset($coursecontext)) {
|
||||
if ($aliasnames = get_records('role_names', 'contextid', $coursecontext->id)) {
|
||||
foreach ($aliasnames as $alias) {
|
||||
if (isset($overridableroles[$alias->roleid])) {
|
||||
$overridableroles[$alias->roleid] = $alias->text.' ('.$overridableroles[$alias->roleid].')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading_with_help(get_string('overrides', 'role'), 'overrides');
|
||||
|
||||
if ($roleid) {
|
||||
|
@ -78,6 +78,8 @@ if ($currenttab != 'update') {
|
||||
|
||||
require_login($course);
|
||||
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // for role names later
|
||||
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strmodulenameplural = get_string("modulenameplural", $module->name);
|
||||
@ -125,6 +127,7 @@ if ($currenttab != 'update') {
|
||||
$navlinks[0] = array('name' => $course->shortname,
|
||||
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); // for role names later
|
||||
}
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $blockname", $course->fullname, $navigation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user