From b0ff558ccb26ceeb1d8c222b8d6248aa7fbefe81 Mon Sep 17 00:00:00 2001
From: samhemelryk <samhemelryk>
Date: Mon, 7 Sep 2009 05:43:15 +0000
Subject: [PATCH] notes MDL-19806 Updated print_header and build_navigation to
 OUTPUT and PAGE equivalents

---
 mod/data/comment.php           |  4 ++--
 mod/data/edit.php              | 11 +++++------
 mod/data/export.php            |  7 +++----
 mod/data/field/latlong/kml.php |  5 ++---
 mod/data/import.php            |  4 ++--
 mod/data/index.php             |  8 +++-----
 mod/data/lib.php               | 10 ++++------
 mod/data/report.php            |  3 ++-
 mod/data/templates.php         |  8 +++-----
 mod/data/view.php              |  8 +++++---
 10 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/mod/data/comment.php b/mod/data/comment.php
index 1d65c6d2cf..151204394f 100755
--- a/mod/data/comment.php
+++ b/mod/data/comment.php
@@ -110,7 +110,7 @@
                 redirect('view.php?rid='.$record->id.'&amp;page='.$page, get_string('commentdeleted', 'data'));
 
             } else {    //print confirm delete form
-                print_header();
+                echo $OUTPUT->header();
                 data_print_comment($data, $comment, $page);
 
                 echo $OUTPUT->confirm(get_string('deletecomment','data'),
@@ -123,7 +123,7 @@
 
     }
 
-    print_header();
+    echo $OUTPUT->header();
     data_print_comments($data, $record, $page, $mform);
     echo $OUTPUT->footer();
 
diff --git a/mod/data/edit.php b/mod/data/edit.php
index 21b4fa6d06..51b8a329b8 100755
--- a/mod/data/edit.php
+++ b/mod/data/edit.php
@@ -68,8 +68,8 @@
     if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
         $strdatabases = get_string("modulenameplural", "data");
 
-        $navigation = build_navigation('', $cm);
-        print_header_simple(format_string($data->name), "", $navigation, "", "", true, '', navmenu($course, $cm));
+        $PAGE->set_title(format_string($data->name));
+        echo $OUTPUT->header();
         notice(get_string("activityiscurrentlyhidden"));
     }
 
@@ -108,10 +108,9 @@
 /// Print the page header
     $strdata = get_string('modulenameplural','data');
 
-    $navigation = build_navigation('', $cm);
-    print_header_simple($data->name, '', $navigation,
-                        '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
-                        navmenu($course, $cm), '', '');
+    $PAGE->set_title($data->name);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'data')));
+    echo $OUTPUT->header();
 
 /// Check to see if groups are being used here
     groups_print_activity_menu($cm, 'edit.php?d='.$data->id);
diff --git a/mod/data/export.php b/mod/data/export.php
index 915b2821ad..2242aef2f4 100644
--- a/mod/data/export.php
+++ b/mod/data/export.php
@@ -55,10 +55,9 @@ if($mform->is_cancelled()) {
     redirect('view.php?d='.$data->id);
 } elseif (!$formdata = (array) $mform->get_data()) {
     // build header to match the rest of the UI
-    $nav = build_navigation('', $cm);
-    print_header_simple($data->name, '', $nav,
-        '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
-        navmenu($course, $cm), '', '');
+    $PAGE->set_title($data->name);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'data')));
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
     // these are for the tab display
diff --git a/mod/data/field/latlong/kml.php b/mod/data/field/latlong/kml.php
index 690d8dc652..fa451ac41b 100644
--- a/mod/data/field/latlong/kml.php
+++ b/mod/data/field/latlong/kml.php
@@ -57,9 +57,8 @@ require_course_login($course, true, $cm);
 
 /// If it's hidden then it's don't show anything.  :)
 if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities',get_context_instance(CONTEXT_MODULE, $cm->id))) {
-    $navigation = build_navigation('', $cm);
-    print_header_simple(format_string($data->name), "", $navigation,
-        "", "", true, '', navmenu($course, $cm));
+    $PAGE->set_title($data->name);
+    echo $OUTPUT->header();
     notice(get_string("activityiscurrentlyhidden"));
 }
 
diff --git a/mod/data/import.php b/mod/data/import.php
index 878d565a2d..6aad72b4a3 100755
--- a/mod/data/import.php
+++ b/mod/data/import.php
@@ -65,8 +65,8 @@
 /// Print the page header
     $strdata = get_string('modulenameplural','data');
     
-    $navigation = build_navigation('', $cm);
-    print_header_simple($data->name, "", $navigation, "", "", true, "", navmenu($course));
+    $PAGE->set_title($data->name);
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
 /// Groups needed for Add entry tab
diff --git a/mod/data/index.php b/mod/data/index.php
index 12c4b8ae82..9f1497e881 100755
--- a/mod/data/index.php
+++ b/mod/data/index.php
@@ -43,11 +43,9 @@
     $strdata = get_string('modulename','data');
     $strdataplural  = get_string('modulenameplural','data');
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strdata, 'link' => "index.php?id=$course->id", 'type' => 'activity');
-    $navigation = build_navigation($navlinks);
-
-    print_header_simple($strdata, '', $navigation, '', '', true, "", navmenu($course));
+    $PAGE->navbar->add($strdata, new moodle_url($CFG->wwwroot.'/mod/data/index.php', array('id'=>$course->id)));
+    $PAGE->set_title($strdata);
+    echo $OUTPUT->header();
 
     if (! $datas = get_all_instances_in_course("data", $course)) {
         notice(get_string('thereareno', 'moodle',$strdataplural) , "$CFG->wwwroot/course/view.php?id=$course->id");
diff --git a/mod/data/lib.php b/mod/data/lib.php
index e1da115851..2ebe924f25 100755
--- a/mod/data/lib.php
+++ b/mod/data/lib.php
@@ -2051,13 +2051,11 @@ function data_get_available_presets($context) {
  */
 function data_print_header($course, $cm, $data, $currenttab='') {
 
-    global $CFG, $displaynoticegood, $displaynoticebad, $OUTPUT;
-
-    $navigation = build_navigation('', $cm);
-    print_header_simple($data->name, '', $navigation,
-            '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
-            navmenu($course, $cm));
+    global $CFG, $displaynoticegood, $displaynoticebad, $OUTPUT, $PAGE;
 
+    $PAGE->set_title($data->name);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'data')));
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
 // Groups needed for Add entry tab
diff --git a/mod/data/report.php b/mod/data/report.php
index 8ff382b4a6..6a181e008e 100755
--- a/mod/data/report.php
+++ b/mod/data/report.php
@@ -47,7 +47,8 @@
     $strrating  = get_string('rating', 'data');
     $strname    = get_string('name');
 
-    print_header($strratings);
+    $PAGE->set_title($strratings);
+    echo $OUTPUT->header();
 
     if (!$ratings = data_get_ratings($record->id, $sqlsort)) {
         print_error('noratingforrecord', 'data');
diff --git a/mod/data/templates.php b/mod/data/templates.php
index c4f0d8d1e5..1c252bbf48 100755
--- a/mod/data/templates.php
+++ b/mod/data/templates.php
@@ -79,11 +79,9 @@
     $bodytag .= '" ';
 
     $PAGE->requires->js('mod/data/data.js');
-    $navigation = build_navigation('', $cm);
-    print_header_simple($data->name, '', $navigation,
-                        '', '', true, update_module_button($cm->id, $course->id, get_string('modulename', 'data')),
-                        navmenu($course, $cm), '', $bodytag);
-
+    $PAGE->set_title($data->name);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'data')));
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(format_string($data->name));
 
 
diff --git a/mod/data/view.php b/mod/data/view.php
index 09dbdfb20d..2d8c032514 100755
--- a/mod/data/view.php
+++ b/mod/data/view.php
@@ -288,9 +288,11 @@
     }
     $buttons .= '</tr></table>';
 
-    $navigation = build_navigation(array(), $cm);
-    print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm));
-
+    $PAGE->set_title($title);
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button($buttons);
+    echo $OUTPUT->header();
+    
 /// Check to see if groups are being used here
     $returnurl = 'view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'&amp;';
     groups_print_activity_menu($cm, $returnurl);
-- 
2.39.5