From: samhemelryk Date: Mon, 7 Sep 2009 06:18:27 +0000 (+0000) Subject: backup MDL-19789 Updated print_header and build_navigation to OUTPUT and PAGE equivalents X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=67c351d2d882ce14a1e96b4bccceb51fe1890890;p=moodle.git backup MDL-19789 Updated print_header and build_navigation to OUTPUT and PAGE equivalents --- diff --git a/backup/backup.php b/backup/backup.php index 542e55d6fe..941ea8178d 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -62,15 +62,12 @@ } //If no course has been selected, show a list of available courses - - $navlinks = array(); + $PAGE->set_title("$site->shortname: $strcoursebackup"); + $PAGE->set_heading($site->fullname); if (!$id) { - $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc'); - $navlinks[] = array('name' => $strcoursebackup, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header("$site->shortname: $strcoursebackup", $site->fullname, $navigation); - + $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($strcoursebackup); + echo $OUTPUT->header(); if ($courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname')) { echo $OUTPUT->heading(get_string("choosecourse")); echo $OUTPUT->box_start(); @@ -93,17 +90,14 @@ //Print header if (has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) { - $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc'); - $navlinks[] = array('name' => $strcoursebackup, 'link' => 'backup.php', 'type' => 'misc'); - $navlinks[] = array('name' => "$course->fullname ($course->shortname)", 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header("$site->shortname: $strcoursebackup", $site->fullname, $navigation); + $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($strcoursebackup, new moodle_url($CFG->wwwroot.'/backup/backup.php')); + $PAGE->navbar->add("$course->fullname ($course->shortname)"); + echo $OUTPUT->header(); } else { - $navlinks[] = array('name' => $course->fullname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc'); - $navlinks[] = array('name' => $strcoursebackup, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$course->shortname: $strcoursebackup", $course->fullname, $navigation); + $PAGE->navbar->add($course->fullname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); + $PAGE->navbar->add($strcoursebackup); + echo $OUTPUT->header(); } //Print form diff --git a/backup/restore.php b/backup/restore.php index a24a642420..b95ced3373 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -97,13 +97,12 @@ $stradministration = get_string("administration"); //If no file has been selected from the FileManager, inform and end - $navlinks = array(); - $navlinks[] = array('name' => $stradministration, 'link' => "$CFG->wwwroot/$CFG->admin/index.php", 'type' => 'misc'); - $navlinks[] = array('name' => $strcourserestore, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - + $PAGE->set_title("$site->shortname: $strcourserestore"); + $PAGE->set_heading($site->fullname); if (!$file) { - print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation); + $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($strcourserestore); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("nofilesselected")); echo $OUTPUT->continue_button("$CFG->wwwroot/$CFG->admin/index.php"); echo $OUTPUT->footer(); @@ -112,7 +111,9 @@ //If cancel has been selected, inform and end if ($cancel) { - print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation); + $PAGE->navbar->add($stradministration, new moodle_url($CFG->wwwroot.'/'.$CFG->admin.'/index.php')); + $PAGE->navbar->add($strcourserestore); + echo $OUTPUT->header(); echo $OUTPUT->heading(get_string("restorecancelled")); echo $OUTPUT->continue_button("$CFG->wwwroot/course/view.php?id=".$id); echo $OUTPUT->footer(); @@ -123,16 +124,12 @@ //Print header if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { - $navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - print_header("$site->shortname: $strcourserestore", $site->fullname, $navigation); + $PAGE->navbar->add(basename($file)); + echo $OUTPUT->header(); } else { - $navlinks = array(); - $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc'); - $navlinks[] = array('name' => $strcourserestore, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - print_header("$course->shortname: $strcourserestore", $course->fullname, $navigation); + $PAGE->navbar->add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); + $PAGE->navbar->add($strcourserestore); + echo $OUTPUT->header(); } //Print form echo $OUTPUT->heading("$strcourserestore".((empty($to) ? ': '.basename($file) : '')));