]> git.mjollnir.org Git - moodle.git/commitdiff
mod-glossary MDL-19809 Updated print_header and build_navigation to OUTPUT and PAGE...
authorsamhemelryk <samhemelryk>
Mon, 7 Sep 2009 03:20:35 +0000 (03:20 +0000)
committersamhemelryk <samhemelryk>
Mon, 7 Sep 2009 03:20:35 +0000 (03:20 +0000)
13 files changed:
mod/glossary/comment.php
mod/glossary/comments.php
mod/glossary/deleteentry.php
mod/glossary/edit.php
mod/glossary/editcategories.php
mod/glossary/export.php
mod/glossary/exportentry.php
mod/glossary/import.php
mod/glossary/index.php
mod/glossary/print.php
mod/glossary/report.php
mod/glossary/showentry.php
mod/glossary/view.php

index 98fadf09085de40a7394267404046e824e59ae1d..ecb7b13177089e4d37c3f2a7385419a7ddcad5ee 100644 (file)
@@ -207,6 +207,7 @@ function glossary_comment_edit() {
 //////////////////////////////////
 
 function glossary_comment_print_header($course, $cm, $glossary, $entry, $action) {
+    global $PAGE, $OUTPUT;
     switch ($action){
         case 'add':
             $straction = get_string('addingcomment','glossary');
@@ -222,14 +223,12 @@ function glossary_comment_print_header($course, $cm, $glossary, $entry, $action)
     $strglossary   = get_string('modulename', 'glossary');
     $strcomments   = get_string('comments', 'glossary');
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strcomments, 'link' => "comments.php?id=$cm->id&amp;eid=$entry->id", 'type' => 'title');
-    $navlinks[] = array('name' => $straction, 'link' => '', 'type' => 'action');
-    $navigation = build_navigation($navlinks, $cm);
-
-    print_header_simple(format_string($glossary->name), '', $navigation,
-        '', '', true, update_module_button($cm->id, $course->id, $strglossary),
-        navmenu($course, $cm));
+    $PAGE->navbar->add($strcomments, new moodle_url($CFG->wwwroot.'/mod/glossary/comments.php', array('id'=>$cm->id,'eid'=>$entry->id)));
+    $PAGE->navbar->add($straction);
+    $PAGE->set_title(format_string($glossary->name));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+    echo $OUTPUT->header();
+    
 /// print original glossary entry for any comment action (add, update, delete)
     glossary_print_entry($course, $cm, $glossary, $entry, 'approval', '', false);
 }
index 6bf4ed51efb1d63a39b76bb87a538048a8c0f73a..84bb3f1db924214c6506e801ceb8674891f1cb00 100644 (file)
     $strcomments = get_string("comments", "glossary");
     $straddcomment = get_string("addcomment", "glossary");
 
-    $navigation = build_navigation($strcomments, $cm);
-    print_header_simple(strip_tags("$strcomments: $entry->concept"), "", $navigation,
-        "", "", true, update_module_button($cm->id, $course->id, $strglossary),
-        navmenu($course, $cm));
+    $PAGE->navbar->add($strcomments);
+    $PAGE->set_title(strip_tags("$strcomments: $entry->concept"));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+    echo $OUTPUT->header();
 
 /// original glossary entry
 
index 6a61cd21fab3e6757ab95571560118f04a593f43..92435d3a2289be8c565eef5c2353bb0a5acb491f 100644 (file)
@@ -38,8 +38,6 @@
 
     $strareyousuredelete = get_string("areyousuredelete","glossary");
 
-    $navigation = build_navigation('', $cm);
-
     if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
         print_error('nopermissiontodelentry');
     }
@@ -92,9 +90,9 @@
         redirect("view.php?id=$cm->id&amp;mode=$prevmode&amp;hook=$hook");
 
     } else {        // the operation has not been confirmed yet so ask the user to do so
-        print_header_simple(format_string($glossary->name), "", $navigation,
-                      "", "", true, update_module_button($cm->id, $course->id, $strglossary),
-                      navmenu($course, $cm));
+        $PAGE->set_title(format_string($glossary->name));
+        $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+        echo $OUTPUT->header();
         $areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
         $linkyes    = 'deleteentry.php';
         $linkno     = 'view.php';
index 70ff623de84470bd828b439ff157040ca6a54c32..77f6df21e4f623c5638608a7625bee1f535b9631 100644 (file)
@@ -165,10 +165,9 @@ if ($mform->is_cancelled()){
 
 $stredit = empty($entry->id) ? get_string('addentry', 'glossary') : get_string('edit');
 
-$navigation = build_navigation($stredit, $cm);
-print_header_simple(format_string($glossary->name), "", $navigation, "",
-              "", true, "", navmenu($course, $cm));
-
+$PAGE->navbar->add($stredit);
+$PAGE->set_title(format_string($glossary->name));
+echo $OUTPUT->header();
 echo $OUTPUT->heading(format_string($glossary->name));
 
 $mform->display();
index 4c63875c5db78b235d6e3349154ae38052a10a2b..166200d07eae427d3f4d0d218eb454812ad031c1 100644 (file)
     $strglossaries   = get_string("modulenameplural", "glossary");
     $strglossary     = get_string("modulename", "glossary");
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strglossaries, 'link' => "index.php?id=$course->id", 'type' => 'activity');
-    $navlinks[] = array('name' => format_string($glossary->name), 'link' => "view.php?id=$cm->id&amp;tab=GLOSSARY_CATEGORY_VIEW", 'type' => 'activityinstance');
-    $navlinks[] = array('name' => get_string("categories","glossary"), 'link' => '', 'type' => 'title');
-    
-    $navigation = build_navigation($navlinks);
-
-    print_header_simple(format_string($glossary->name), "", $navigation,
-                        "", "", true, update_module_button($cm->id, $course->id, $strglossary),
-                        navmenu($course, $cm));
+    $PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/index.php', array('id'=>$course->id)));
+    $PAGE->navbar->add(format_string($glossary->name),  new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id,'tab'=>'GLOSSARY_CATEGORY_VIEW')));
+    $PAGE->navbar->add(get_string("categories","glossary"));
+    $PAGE->set_title(format_string($glossary->name));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+    echo $OUTPUT->header();
 
     if ( $hook >0 ) {
 
index e39e7bbfd46f8a35bb21f58c9e447d8b09b0b4f5..abf2d7a2561af29ece7feeeba167e3581e544187 100644 (file)
     $strexportfile = get_string("exportfile", "glossary");
     $strexportentries = get_string('exportentriestoxml', 'glossary');
 
-    $navigation = build_navigation($strexportentries, $cm);
-    print_header_simple(format_string($glossary->name), "",$navigation,
-        "", "", true, update_module_button($cm->id, $course->id, $strglossary),
-        navmenu($course, $cm));
+    $PAGE->navbar->add($strexportentries);
+    $PAGE->set_title(format_string($glossary->name));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
 
+    echo $OUTPUT->header();
     echo $OUTPUT->heading($strexportentries);
-
     echo $OUTPUT->box_start('glossarydisplay generalbox');
     ?>
     <form action="exportfile.php" method="post">
index 20e4d145a6253c8cfed0a623451f924b32ff485d..bee7a4dc87ee7627d74d88ea5b8fa20c4c9ffe9f 100644 (file)
     $entryalreadyexist = get_string('entryalreadyexist','glossary');
     $entryexported     = get_string('entryexported','glossary');
 
-    $navigation = build_navigation('', $cm);
-
     if (!$mainglossary->allowduplicatedentries) {
         if ($DB->get_record('glossary_entries', array('glossaryid'=>$mainglossary->id, 'lower(concept)'=>moodle_strtolower($entry->concept)))) {
-            print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm));
+            $PAGE->set_title(format_string($glossary->name));
+            echo $OUTPUT->header();
             echo $OUTPUT->notification(get_string('errconceptalreadyexists', 'glossary'));
             echo $OUTPUT->continue_button($returnurl);
             echo $OUTPUT->box_end();
@@ -72,7 +71,8 @@
     }
 
     if (!data_submitted() or !$confirm or !confirm_sesskey()) {
-        print_header_simple(format_string($glossary->name), '', $navigation, '', '', true, '', navmenu($course, $cm));
+        $PAGE->set_title(format_string($glossary->name));
+        echo $OUTPUT->header();
         echo '<div class="boxaligncenter">';
         $areyousure = '<h2>'.format_string($entry->concept).'</h2><p align="center">'.get_string('areyousureexport','glossary').'<br /><b>'.format_string($mainglossary->name).'</b>?';
         $linkyes    = 'exportentry.php';
index 417ed1b9afabd60c32b6bc38c139853f548cea6a..45b1ba183896ce37a361265549be3eb98fb9626e 100644 (file)
     $strsearch = get_string("search");
     $strimportentries = get_string('importentriesfromxml', 'glossary');
 
-    $navigation = build_navigation($strimportentries, $cm);
-    print_header_simple(format_string($glossary->name), "", $navigation,
-        "", "", true, update_module_button($cm->id, $course->id, $strglossary),
-        navmenu($course, $cm));
-
+    $PAGE->navbar->add($strimportentries);
+    $PAGE->set_title(format_string($glossary->name));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
+    
+    echo $OUTPUT->header();
     echo $OUTPUT->heading($strimportentries);
 
     if ( !$step ) {
index 2a2be4e195543243ab7df421a483dd2b524f9bcb..e4c30a410130aaca757bdea57af6dfa584838709 100644 (file)
 
 
 /// Print the header
-    $navlinks = array();
-    $navlinks[] = array('name' => $strglossarys, 'link' => "index.php?id=$course->id", 'type' => 'activity');
-    $navigation = build_navigation($navlinks);
-
-    print_header_simple("$strglossarys", "", $navigation, "", "", true, "", navmenu($course));
+    $PAGE->navbar->add($strglossarys, "index.php?id=$course->id");
+    $PAGE->set_title($strglossarys);
+    echo $OUTPUT->header();
 
 /// Get all the appropriate data
 
index fcafdc7b22cde14d037dfc832512a1f1fefc75c2..c7e7f77403da7d2f1a6063b870bc5afb4cdfff68 100644 (file)
@@ -30,7 +30,7 @@
         $entriesbypage = $CFG->glossary_entbypage;
     }
 
-    print_header();
+    echo $OUTPUT->header();
 
     require_course_login($course, true, $cm);
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
index 2dc173449a36ac041da22988e750160c1fdab422..533d81b993dc5ba7c24ba6b347df2ba00e01e8a0 100644 (file)
@@ -48,7 +48,8 @@
     $strname    = get_string('name');
     $strtime    = get_string('time');
 
-    print_header("$strratings: $entry->concept");
+    $PAGE->set_title("$strratings: $entry->concept");
+    echo $OUTPUT->header();
 
     if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
         print_error('ratingno', 'glossary');
index d534a870c05e6f42ae5ea5fd108309ca84e8e5a0..9861568654931fc2e1a4444d8c828069fae9cdb9 100644 (file)
         $strsearch = get_string("search");
 
         $CFG->framename = "newwindow";
-        $navlinks = array();
-        $navlinks[] = array('name' => $strglossaries, 'link' => '', 'type' => 'activity');
-        $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
-
-        $navigation = build_navigation($navlinks);
-
-        print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname, $navigation, "", "", true, "&nbsp;", "&nbsp;");
 
+        $PAGE->navbar->add($strglossaries);
+        $PAGE->navbar->add($strsearch);
+        $PAGE->set_title(strip_tags("$course->shortname: $strglossaries $strsearch"));
+        $PAGE->set_heading($course->fullname);
+        echo $OUTPUT->header();
     } else {
-        print_header();    // Needs to be something here to allow linking back to the whole glossary
+        echo $OUTPUT->header();    // Needs to be something here to allow linking back to the whole glossary
     }
 
     if ($entries) {
index b272382aae5d4b320e1bb924e5589be5085118e0..622b25b08fc8ef2873d35a99586e7f3936729319 100644 (file)
         require_login($course->id);
     }
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
-        print_header();
+        echo $OUTPUT->header();
         notice(get_string("activityiscurrentlyhidden"));
     }
     add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&amp;tab=$tab", $glossary->id, $cm->id);
     $strwaitingapproval = get_string('waitingapproval', 'glossary');
 
 /// If we are in approval mode, prit special header
+    $PAGE->set_title(format_string($glossary->name));
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
     if ($tab == GLOSSARY_APPROVAL_VIEW) {
         require_capability('mod/glossary:approve', $context);
-
-        $navigation = build_navigation($strwaitingapproval, $cm);
-        print_header_simple(format_string($glossary->name), "", $navigation, "", "", true,
-            update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
-
+        $PAGE->navbar->add($strwaitingapproval);
+        echo $OUTPUT->header();
         echo $OUTPUT->heading($strwaitingapproval);
-    } else { /// Print standard header
-        $navigation = build_navigation('', $cm);
-        print_header_simple(format_string($glossary->name), "", $navigation, "", "", true,
-            update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
+    } else { /// Print standard header    
+        echo $OUTPUT->header();
     }
 
 /// All this depends if whe have $showcommonelements