mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-58702-master' of git://github.com/zig-moodle/moodle
This commit is contained in:
commit
fca5c2de05
2 changed files with 21 additions and 1 deletions
|
@ -1061,7 +1061,26 @@ class restore_ui_stage_process extends restore_ui_stage {
|
||||||
if (!empty($info->role_mappings->mappings)) {
|
if (!empty($info->role_mappings->mappings)) {
|
||||||
$context = context_course::instance($this->ui->get_controller()->get_courseid());
|
$context = context_course::instance($this->ui->get_controller()->get_courseid());
|
||||||
$assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);
|
$assignableroles = get_assignable_roles($context, ROLENAME_ALIAS, false);
|
||||||
$html .= $renderer->role_mappings($info->role_mappings->mappings, $assignableroles);
|
|
||||||
|
// Get current role mappings.
|
||||||
|
$currentroles = role_fix_names(get_all_roles(), $context);
|
||||||
|
// Get backup role mappings.
|
||||||
|
$rolemappings = $info->role_mappings->mappings;
|
||||||
|
|
||||||
|
array_map(function($rolemapping) use ($currentroles) {
|
||||||
|
foreach ($currentroles as $role) {
|
||||||
|
// Find matching archetype to determine the backup's shortname for label display.
|
||||||
|
if ($rolemapping->archetype == $role->archetype) {
|
||||||
|
$rolemapping->name = $rolemapping->shortname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($rolemapping->name == null) {
|
||||||
|
$rolemapping->name = get_string('undefinedrolemapping', 'backup', $rolemapping->archetype);
|
||||||
|
}
|
||||||
|
}, $rolemappings);
|
||||||
|
|
||||||
|
$html .= $renderer->role_mappings($rolemappings, $assignableroles);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -326,6 +326,7 @@ $string['timetaken'] = 'Time taken';
|
||||||
$string['title'] = 'Title';
|
$string['title'] = 'Title';
|
||||||
$string['totalcategorysearchresults'] = 'Total categories: {$a}';
|
$string['totalcategorysearchresults'] = 'Total categories: {$a}';
|
||||||
$string['totalcoursesearchresults'] = 'Total courses: {$a}';
|
$string['totalcoursesearchresults'] = 'Total courses: {$a}';
|
||||||
|
$string['undefinedrolemapping'] = 'Role mapping undefined for: \'{$a}\' archetype';
|
||||||
$string['unnamedsection'] = 'Unnamed section';
|
$string['unnamedsection'] = 'Unnamed section';
|
||||||
$string['userinfo'] = 'Userinfo';
|
$string['userinfo'] = 'Userinfo';
|
||||||
$string['module'] = 'Module';
|
$string['module'] = 'Module';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue