diff --git a/backup/backupfilesedit.php b/backup/backupfilesedit.php index 9c171ae4152..382bfdbb701 100644 --- a/backup/backupfilesedit.php +++ b/backup/backupfilesedit.php @@ -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(); diff --git a/backup/restorefile.php b/backup/restorefile.php index 6351918868d..210128cf157 100644 --- a/backup/restorefile.php +++ b/backup/restorefile.php @@ -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)); diff --git a/backup/util/ui/tests/behat/backup_courses.feature b/backup/util/ui/tests/behat/backup_courses.feature index 6cf6563f41e..7a8d80f0747 100644 --- a/backup/util/ui/tests/behat/backup_courses.feature +++ b/backup/util/ui/tests/behat/backup_courses.feature @@ -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-"