]> git.mjollnir.org Git - moodle.git/commitdiff
forum MDL-19808 Upgraded print_header and build_navigation calls to OUTPUT/PAGE equiv...
authorsamhemelryk <samhemelryk>
Fri, 4 Sep 2009 05:50:21 +0000 (05:50 +0000)
committersamhemelryk <samhemelryk>
Fri, 4 Sep 2009 05:50:21 +0000 (05:50 +0000)
mod/forum/discuss.php
mod/forum/index.php
mod/forum/markposts.php
mod/forum/post.php
mod/forum/report.php
mod/forum/search.php
mod/forum/subscribe.php
mod/forum/subscribers.php
mod/forum/unsubscribeall.php
mod/forum/user.php

index 4e4cdd69d00a98c8f89850ae58132c8113abb2ff..b754816370bc811c9923903347e1a16d7f62a14b 100644 (file)
 
     $searchform = forum_search_form($course);
 
-    $navlinks = array();
-    $navlinks[] = array('name' => format_string($discussion->name), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
+    $PAGE->navbar->add(format_string($discussion->name), new moodle_url($CFG->wwwroot.'/mod/forum/discuss.php', array('id'=>$discussion->id)));
     if ($parent != $discussion->firstpost) {
-        $navlinks[] = array('name' => format_string($post->subject), 'type' => 'title');
+        $PAGE->navbar->add(format_string($post->subject));
     }
-
-    $navigation = build_navigation($navlinks, $cm);
-    print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
-                     $navigation, "", "", true, $searchform, navmenu($course, $cm));
-
+    $PAGE->set_title("$course->shortname: ".format_string($discussion->name));
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button($searchform);
+    echo $OUTPUT->header();
 
 /// Check to see if groups are being used in this forum
 /// If so, make sure the current person is allowed to see this discussion
index fa463d110d4ab120862b8e526334a2e8547372a7..71cab7c1c78495782f1d2556d55face34ac35ef4 100644 (file)
 
 
     /// Output the page
-    $navlinks = array();
-    $navlinks[] = array('name' => $strforums, 'link' => '', 'type' => 'activity');
-
-    print_header("$course->shortname: $strforums", $course->fullname,
-                    build_navigation($navlinks),
-                    "", "", true, $searchform, navmenu($course));
+    $PAGE->navbar->add($strforums);
+    $PAGE->set_title("$course->shortname: $strforums");
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button($searchform);
+    echo $OUTPUT->header();
 
     if (!isguest()) {
         echo $OUTPUT->box_start('subscription');
index 8ce1ebee80d3c047c4c2f31e0562243c7475fc15..b322fcf0bb030c63ba7fb3850c9abf6e750741a4 100644 (file)
@@ -33,8 +33,9 @@
     }
 
     if (isguest()) {   // Guests can't change forum
-        $navigation = build_navigation('', $cm);
-        print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
+        $PAGE->set_title($course->shortname);
+        $PAGE->set_heading($course->fullname);
+        echo $OUTPUT->header();
         echo $OUTPUT->confirm(get_string('noguesttracking', 'forum').'<br /><br />'.get_string('liketologin'), get_login_url(), $returnto);
         echo $OUTPUT->footer();
         exit;
index 516dd8a0121ea7ff079509159d39b44a5d208b63..da4499ca92e3a22d47718c6ba71bd67950ea4c39 100644 (file)
             require_login();
         }
 
-        $navigation = build_navigation('', $cm);
-        print_header($course->shortname, $course->fullname, $navigation, '' , '', true, "", navmenu($course, $cm));
-
+        $PAGE->set_title($course->shortname);
+        $PAGE->set_heading($course->fullname);
+        
+        echo $OUTPUT->header();
         echo $OUTPUT->confirm(get_string('noguestpost', 'forum').'<br /><br />'.get_string('liketologin'), get_login_url(), get_referer(false));
         echo $OUTPUT->footer();
         exit;
                     print_error("couldnotdeletereplies", "forum",
                           forum_go_back_to("discuss.php?d=$post->discussion"));
                 }
-                print_header();
+                echo $OUTPUT->header();
                 echo $OUTPUT->confirm(get_string("deletesureplural", "forum", $replycount+1),
                              "post.php?delete=$delete&confirm=$delete",
                              $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.'#p'.$post->id);
                     forum_print_posts_nested($course, $cm, $forum, $discussion, $post, false, false, $forumtracked, $posts);
                 }
             } else {
-                print_header();
+                echo $OUTPUT->header();
                 echo $OUTPUT->confirm(get_string("deletesure", "forum", $replycount),
                              "post.php?delete=$delete&confirm=$delete",
                              $CFG->wwwroot.'/mod/forum/discuss.php?d='.$post->discussion.'#p'.$post->id);
 
             $course = $DB->get_record('course', array('id' => $forum->course));
 
-            $navlinks = array();
-            $navlinks[] = array('name' => format_string($post->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
-            $navlinks[] = array('name' => get_string("prune", "forum"), 'link' => '', 'type' => 'title');
-            $navigation = build_navigation($navlinks, $cm);
-            print_header_simple(format_string($discussion->name).": ".format_string($post->subject), "", $navigation, '', "", true, "", navmenu($course, $cm));
-
+            $PAGE->navbar->add(format_string($post->subject, true), new moodle_url($CFG->wwwroot.'/mod/forum/discuss.php', array('d'=>$discussion->id)));
+            $PAGE->navbar->add(get_string("prune", "forum"));
+            $PAGE->set_title(format_string($discussion->name).": ".format_string($post->subject));
+            echo $OUTPUT->header();
             echo $OUTPUT->heading(get_string('pruneheading', 'forum'));
             echo '<center>';
 
 
     $forcefocus = empty($reply) ? NULL : 'message';
 
-    $navlinks = array();
+
+    $PAGE->navbar->add(format_string($toppost->subject, true), "discuss.php?d=$discussion->id");
     if ($post->parent) {
-        $navlinks[] = array('name' => format_string($toppost->subject, true), 'link' => "discuss.php?d=$discussion->id", 'type' => 'title');
-        $navlinks[] = array('name' => get_string('editing', 'forum'), 'link' => '', 'type' => 'title');
-    } else {
-        $navlinks[] = array('name' => format_string($toppost->subject), 'link' => '', 'type' => 'title');
+        $PAGE->navbar->add(get_string('editing', 'forum'));
     }
-    $navigation = build_navigation($navlinks, $cm);
 
-    print_header("$course->shortname: $strdiscussionname ".
-                  format_string($toppost->subject), $course->fullname,
-                  $navigation, $mform_post->focus($forcefocus), "", true, "", navmenu($course, $cm));
+    $PAGE->set_title("$course->shortname: $strdiscussionname ".format_string($toppost->subject));
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_focuscontrol($mform_post->focus($forcefocus));
+
+    echo $OUTPUT->header();
 
 // checkup
     if (!empty($parent) && !forum_user_can_see_post($forum, $discussion, $post, null, $cm)) {
index e648ca7a6b5b40aa26ec693aa19760323258a9b4..4f3f5a4e72fd52777dc974c879bf43d0a8568a3c 100644 (file)
@@ -55,7 +55,8 @@
     $strname    = get_string('name');
     $strtime    = get_string('time');
 
-    print_header("$strratings: ".format_string($post->subject));
+    $PAGE->set_title("$strratings: ".format_string($post->subject));
+    echo $OUTPUT->header();
 
     if (!$ratings = forum_get_ratings($post->id, $sqlsort)) {
         print_error('noresult', 'forum', '', format_string($post->subject));
index d237e904a41ad2937cd3fdc4cfd34869b71cadc0..ed67ff01e5a0fa90d64e1e472c9562269bc960cc 100644 (file)
 
     if (!$search || $showform) {
 
-        $navlinks = array();
-        $navlinks[] = array('name' => $strforums, 'link' => "index.php?id=$course->id", 'type' => 'activity');
-        $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
-        $navigation = build_navigation($navlinks);
+        $PAGE->navbar->add($strforums, new moodle_url($CFG->wwwroot.'/mod/forum/index.php', array('id'=>$course->id)));
+        $PAGE->navbar->add($strsearch);
 
-        print_header_simple("$strsearch", "", $navigation, 'search.words',
-                  "", "", "&nbsp;", navmenu($course));
+        $PAGE->set_title($strsearch);
+        $PAGE->set_focuscontrol('search.words');
+        echo $OUTPUT->header();
 
         forum_print_big_search_form($course);
         echo $OUTPUT->footer();
 
     $searchform = forum_search_form($course, $search);
 
-    $navlinks = array();
-    $navlinks[] = array('name' => $strsearch, 'link' => "search.php?id=$course->id", 'type' => 'activityinstance');
-    $navlinks[] = array('name' => s($search, true), 'link' => '', 'type' => 'link');
-    $navigation = build_navigation($navlinks);
-
-
+    $PAGE->navbar->add($strsearch, new moodle_url($CFG->wwwroot.'/mod/forum/search.php', array('id'=>$course->id)));
+    $PAGE->navbar->add(s($search, true));
     if (!$posts = forum_search_posts($searchterms, $course->id, $page*$perpage, $perpage, $totalcount)) {
-        print_header_simple("$strsearchresults", "", $navigation, 'search.words', "", "", "&nbsp;", navmenu($course));
+        $PAGE->set_title($strsearchresults);
+        $PAGE->set_focuscontrol('search.words');
+        echo $OUTPUT->header();
         echo $OUTPUT->heading(get_string("nopostscontaining", "forum", $search));
 
         if (!$individualparams) {
         exit;
     }
 
-
-    print_header_simple("$strsearchresults", "", $navigation, '', "", "",  $searchform, navmenu($course));
-
+    $PAGE->set_title($strsearchresults);
+    $PAGE->set_button($searchform);
+    echo $OUTPUT->header();
     echo '<div class="reportlink">';
     echo '<a href="search.php?id='.$course->id.
                              '&amp;user='.urlencode($user).
index f2e87f7b01abfa3b02d160dc946745aaae9fe20a..a70d64addf6be100fa0b7b203a8115390784f5bb 100644 (file)
     require_login($course->id, false, $cm);
 
     if (isguest()) {   // Guests can't subscribe
-
-        $navigation = build_navigation('', $cm);
-        print_header($course->shortname, $course->fullname, $navigation, '', '', true, "", navmenu($course, $cm));
-
+        $PAGE->set_title($course->shortname);
+        $PAGE->set_heading($course->fullname);
+        echo $OUTPUT->header();
         echo $OUTPUT->confirm(get_string('noguestsubscribe', 'forum').'<br /><br />'.get_string('liketologin'),
                      get_login_url(), new moodle_url());
         echo $OUTPUT->footer();
index f1ddf6e8394f071e5d7f62ec3171ef901d50100c..912430aff4abaa0eb2d16c658ecd67adcd7d91bd 100644 (file)
     $strsubscribers = get_string("subscribers", "forum");
     $strforums = get_string("forums", "forum");
 
-    $navigation = build_navigation($strsubscribers, $cm);
-
+    $PAGE->navbar->add($strsubscribers);
+    $PAGE->set_title($strsubscribers);
     if (has_capability('mod/forum:managesubscriptions', $context)) {
-        print_header_simple("$strsubscribers", "", $navigation,
-            "", "", true, forum_update_subscriptions_button($course->id, $id));
+        $PAGE->set_button(forum_update_subscriptions_button($course->id, $id));
         if ($edit != -1) {
             $USER->subscriptionsediting = $edit;
         }
     } else {
-        print_header_simple("$strsubscribers", "", $navigation, "", "", true, '');
         unset($USER->subscriptionsediting);
     }
+    echo $OUTPUT->header();
 
 /// Check to see if groups are being used in this forum
     groups_print_activity_menu($cm, "subscribers.php?id=$forum->id");
index 44920e26a7a13bc858ef753dfcb684b41b665b6a..3118536cbaee6aaaacee72ca8e3b9bd17143ca7d 100644 (file)
@@ -14,11 +14,11 @@ if (isguestuser()) {
 }
 
 $strunsubscribeall = get_string('unsubscribeall', 'forum');
-$navlinks = array(array('name' => get_string('modulename', 'forum'), 'link' => null, 'type' => 'misc'),
-                  array('name' => $strunsubscribeall, 'link' => null, 'type' => 'misc'));
-$navigation = build_navigation($navlinks);
-
-print_header($strunsubscribeall, format_string($COURSE->fullname), $navigation);
+$PAGE->navbar->add(get_string('modulename', 'forum'));
+$PAGE->navbar->add($strunsubscribeall);
+$PAGE->set_title($strunsubscribeall);
+$PAGE->set_heading(format_string($COURSE->fullname));
+echo $OUTPUT->header();
 echo $OUTPUT->heading($strunsubscribeall);
 
 if (data_submitted() and $confirm and confirm_sesskey()) {
index 76392cfb9598d304c37add20ea31ee37c79bab34..f3cf59503d206b591859dc02ae715959f5ffe598 100644 (file)
@@ -35,7 +35,7 @@ if (!$DB->get_record('role_assignments', array('userid' => $USER->id, 'contextid
 }
 
 if ($user->deleted) {
-    print_header();
+    echo $OUTPUT->header();
     echo $OUTPUT->heading(get_string('userdeleted'));
     echo $OUTPUT->footer();
     die;
@@ -49,18 +49,18 @@ $strparticipants = get_string('participants');
 $strmode         = get_string($mode, 'forum');
 $fullname        = fullname($user, has_capability('moodle/site:viewfullnames', $syscontext));
 
-$navlinks = array();
+$link = null;
 if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_COURSE, $course->id)) || has_capability('moodle/site:viewparticipants', $syscontext)) {
-    $navlinks[] = array('name' => $strparticipants, 'link' => "$CFG->wwwroot/user/index.php?id=$course->id", 'type' => 'core');
+    $link = new moodle_url($CFG->wwwroot.'/user/index.php',array('id'=>$course->id));
 }
-$navlinks[] = array('name' => $fullname, 'link' => "$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id", 'type' => 'title');
-$navlinks[] = array('name' => $strforumposts, 'link' => '', 'type' => 'title');
-$navlinks[] = array('name' => $strmode, 'link' => '', 'type' => 'title');
-
-$navigation = build_navigation($navlinks);
-
-print_header("$course->shortname: $fullname: $strmode", $course->fullname,$navigation);
-
+$PAGE->navbar->add($strparticipants, $link);
+$PAGE->navbar->add($fullname, new moodle_url($CFG->wwwroot.'/user/view.php',array('id'=>$user->id,'course'=>$course->id)));
+$PAGE->navbar->add($strforumposts);
+$PAGE->navbar->add($strmode);
+
+$PAGE->set_title("$course->shortname: $fullname: $strmode");
+$PAGE->set_heading($course->fullname);
+echo $OUTPUT->header();
 
 $currenttab = $mode;
 $showroles = 1;