]> git.mjollnir.org Git - moodle.git/commitdiff
backup MDL-19789 Updated print_header and build_navigation to OUTPUT and PAGE equivalents
authorsamhemelryk <samhemelryk>
Mon, 7 Sep 2009 06:18:27 +0000 (06:18 +0000)
committersamhemelryk <samhemelryk>
Mon, 7 Sep 2009 06:18:27 +0000 (06:18 +0000)
backup/backup.php
backup/restore.php

index 542e55d6fe59b6bfc139ba6d4974abe831b36b83..941ea8178d2ac2f516aaec352dbebd1a853b3296 100644 (file)
     }
 
     //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();
 
     //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
index a24a64242093f93ee422294eff23dbf11a3453da..b95ced33739759f97110de199ce39fcde6d65597 100644 (file)
     $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();
 
     //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();
 
     //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) : '')));