MDL-73169 core_backup: Update course category breadcrumb nodes

This commit is contained in:
Mihail Geshoski
2022-03-02 17:27:38 +08:00
parent e949e1a33b
commit 5a1e70573d
3 changed files with 32 additions and 9 deletions
+20 -2
View File
@@ -48,8 +48,25 @@ if ($filearea == 'automated' && !can_download_from_backup_filearea($filearea, $c
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_title(get_string('managefiles', 'backup'));
$PAGE->set_heading(get_string('managefiles', 'backup'));
if ($context->contextlevel == CONTEXT_COURSECAT) {
core_course_category::page_setup();
// Set the restore course node active in the settings navigation block.
if ($restorecoursenode = $PAGE->settingsnav->find('restorecourse', navigation_node::TYPE_SETTING)) {
$restorecoursenode->make_active();
}
$PAGE->set_secondary_active_tab('restorecourse');
} else if ($context->contextlevel == CONTEXT_COURSE) {
$course = get_course($context->instanceid);
$PAGE->set_heading($course->fullname);
} else {
$PAGE->set_heading($SITE->fullname);
}
$title = get_string('managefiles', 'backup');
$PAGE->navbar->add($title);
$PAGE->set_title($title);
$PAGE->set_pagelayout('admin');
$browser = get_file_browser();
@@ -71,6 +88,7 @@ if ($data) {
echo $OUTPUT->header();
echo $OUTPUT->container_start();
echo $OUTPUT->heading($title);
$form->display();
echo $OUTPUT->container_end();
+11 -5
View File
@@ -48,13 +48,22 @@ if (!empty($filecontextid)) {
$url = new moodle_url('/backup/restorefile.php', array('contextid'=>$contextid));
$PAGE->set_url($url);
$PAGE->set_context($context);
switch ($context->contextlevel) {
case CONTEXT_COURSECAT:
core_course_category::page_setup();
break;
case CONTEXT_MODULE:
$heading = get_string('restoreactivity', 'backup');
$PAGE->set_heading(get_string('restoreactivity', 'backup'));
break;
case CONTEXT_COURSE:
$course = get_course($context->instanceid);
$PAGE->set_heading($course->fullname);
break;
default:
$heading = get_string('restorecourse', 'backup');
$PAGE->set_heading($SITE->fullname);
}
@@ -109,10 +118,7 @@ if ($action == 'choosebackupfile') {
die;
}
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_title(get_string('course') . ': ' . $coursefullname);
$PAGE->set_heading($heading);
$PAGE->set_pagelayout('admin');
$PAGE->activityheader->disable();
$PAGE->requires->js_call_amd('core_backup/async_backup', 'asyncBackupAllStatus', array($context->id));
@@ -60,6 +60,5 @@ Feature: Backup Moodle courses
Scenario: Backup a course using the one click backup button
When I perform a quick backup of course "Course 2"
Then I should see "Restore course"
And I should see "Course backup area"
Then I should see "Course backup area"
And I should see "backup-moodle2-course-"