Skip to content

Commit

Permalink
MDL-73169 core_backup: Update course category breadcrumb nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Geshoski committed Mar 2, 2022
1 parent e949e1a commit 5a1e705
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
22 changes: 20 additions & 2 deletions backup/backupfilesedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,25 @@

$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();

Expand All @@ -71,6 +88,7 @@
echo $OUTPUT->header();

echo $OUTPUT->container_start();
echo $OUTPUT->heading($title);
$form->display();
echo $OUTPUT->container_end();

Expand Down
16 changes: 11 additions & 5 deletions backup/restorefile.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@

$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);
}


Expand Down Expand Up @@ -109,10 +118,7 @@
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));
Expand Down
3 changes: 1 addition & 2 deletions backup/util/ui/tests/behat/backup_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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-"

0 comments on commit 5a1e705

Please sign in to comment.