]> git.mjollnir.org Git - moodle.git/commitdiff
mod-hotpot MDL-19810 Updated print_header and build_navigation to OUTPUT and PAGE...
authorsamhemelryk <samhemelryk>
Mon, 7 Sep 2009 03:55:32 +0000 (03:55 +0000)
committersamhemelryk <samhemelryk>
Mon, 7 Sep 2009 03:55:32 +0000 (03:55 +0000)
mod/hotpot/index.php
mod/hotpot/report.php
mod/hotpot/review.php
mod/hotpot/show.php
mod/hotpot/view.php

index 46bce06793a7823f5e50361b6b7b548e4c40983f..b2a1109586c7d2b4d400e05d6c62ced1a2e37379 100644 (file)
     $quotes = array("'"=>"\'", '"'=>'&quot;');
 
     // Print the header
-
-    $title = format_string($course->shortname) . ": $strmodulenameplural";
-    $heading = $course->fullname;
-    
-    $navlinks = array();
-    $navlinks[] = array('name' => $strmodulenameplural, 'link' => '', 'type' => 'activity');
-    $navigation = build_navigation($navlinks);
-    
-    print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
+    $PAGE->navbar->add($strmodulenameplural);
+    $PAGE->set_title(format_string($course->shortname) . ": $strmodulenameplural");
+    $PAGE->set_heading($course->fullname);
+    echo $OUTPUT->header();
 
     $next_url = "$CFG->wwwroot/course/view.php?id=$course->id";
 
index 2bb5794b336c7dd70a37aa94c4f0e38f5b942db9..b65c6812959da18bbed9549fb2c5dfbdc794fd9d 100644 (file)
@@ -426,9 +426,6 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
     global $OUTPUT;
     $strmodulenameplural = get_string("modulenameplural", "hotpot");
     $strmodulename  = get_string("modulename", "hotpot");
-
-    $title = format_string($course->shortname) . ": $hotpot->name";
-    $heading = $course->fullname;
     
     $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
     if (has_capability('mod/hotpot:viewreport',$modulecontext)) {
@@ -438,13 +435,16 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
             $module = "hotpot";
         }
 
-        $navigation = build_navigation(get_string("report$mode", $module), $cm);
+        $PAGE->navbar->add(get_string("report$mode", $module));
     } else {
-        $navigation = build_navigation(get_string("report", "quiz"), $cm);
+        $PAGE->navbar->add(get_string("report", "quiz"));
     }
 
-    $button = update_module_button($cm->id, $course->id, $strmodulename);
-    print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
+    $PAGE->set_title(format_string($course->shortname) . ": $hotpot->name");
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename));
+    echo $OUTPUT->header();
+    
     $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
     if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
         echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' 
index ef194add698191a71219ae19c7e5651f12bdbc41..7d82add3902b0ac56550a9e7270c7ea22fb7f0c8 100644 (file)
     $strmodulenameplural = get_string("modulenameplural", "hotpot");
     $strmodulename  = get_string("modulename", "hotpot");
     // print header
-    $title = format_string($course->shortname) . ": $hotpot->name";
-    $heading = $course->fullname;
-    
-    $navigation = build_navigation('', $cm);
-    $button = update_module_button($cm->id, $course->id, $strmodulename);
-    print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
+   
+    $PAGE->set_title(format_string($course->shortname) . ": $hotpot->name");
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button(update_module_button($cm->id, $course->id, $strmodulename));
+    echo $OUTPUT->header();
     print '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
     echo $OUTPUT->heading($hotpot->name);
     hotpot_print_attempt_summary($hotpot, $attempt);
index b8306b0a7e9c83556854dcfec9567eaadc573c74..e29f3c7a7636c3693cd0619805ea017b1e04ac11 100644 (file)
@@ -19,7 +19,9 @@
         $params->location = HOTPOT_LOCATION_COURSEFILES;
     }
     $title = get_string($params->action, 'hotpot').': '.$params->reference;
-    print_header($title, $title);
+    $PAGE->set_title($title);
+    $PAGE->set_heading($title);
+    echo $OUTPUT->header();
     hotpot_print_show_links($params->course, $params->location, $params->reference);
 ?>
 <script type="text/javascript">
index 593761530e931a473a425e0d6faf0d3dc1e96063..c5fb549d2d505c39aeaaf46965403cb3e651951a 100644 (file)
     $title = format_string($course->shortname.': '.$hotpot->name, true);
     $heading = $course->fullname;
 
-    $navigation = build_navigation('', $cm);
-
     $button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot"));
     $button = '<div style="font-size:0.75em;">'.$button.'</div>';
     $loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
+
+    $PAGE->set_title($title);
+    $PAGE->set_heading($heading);
+    $PAGE->set_button($button);
+    $PAGE->set_headingmenu($loggedinas);
+
     $time = time();
     $hppassword = optional_param('hppassword', '', PARAM_RAW);
     if (HOTPOT_FIRST_ATTEMPT && !has_capability('mod/hotpot:grade', $context)) {
@@ -65,7 +69,7 @@
             $error = get_string("nomoreattempts", "quiz");
         // get password
         } else if ($hotpot->password && empty($hppassword)) {
-            print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
+            echo $OUTPUT->header();
             echo $OUTPUT->heading($hotpot->name);
             $boxalign = 'center';
             $boxwidth = 500;
             $error = get_string("quizclosed", "quiz", userdate($hotpot->timeclose))."<br />\n";
         }
         if ($error) {
-            print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
+            echo $OUTPUT->header();
             notice($error, $nextpage);
             //
             // script stops here, if quiz is unavailable to student
     } else if ($frameset) { // HP5 v5
         switch ($framename) {
             case 'top':
-                print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
+                echo $OUTPUT->header();
                 print $footer;
             break;
             default:
     switch ($hotpot->navigation) {
         case HOTPOT_NAVIGATION_BAR:
             //update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
-            print_header($title, $heading, $navigation, "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags
-            );
+            print_header($title, $heading, '', "", $head.$styles.$scripts, true, $button, $loggedinas, false, $body_tags);
             if (!empty($available_msg)) {
                 echo $OUTPUT->notification($available_msg);
             }
         case HOTPOT_NAVIGATION_FRAME:
             switch ($framename) {
                 case 'top':
-                    print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
+                    echo $OUTPUT->header();
                     print $footer;
                 break;
                 case 'main':
                 break;
                 default:
                     $iframe_id = 'hotpot_iframe';
-                    $body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
-                    $iframe_js = '<script src="iframe.js" type="text/javascript"></script>'."\n";
-                    print_header(
-                        $title, $heading, $navigation,
-                        "", $head.$styles.$scripts.$iframe_js, true, $button,
-                        $loggedinas, false, $body_tags
-                    );
+                    $PAGE->requires->js('mod/hotpot/iframe.js');
+                    $PAGE->requires->js_function_call('set_iframe_height', array($iframe_id))->on_dom_ready();
+                    echo $OUTPUT->header();
                     if (!empty($available_msg)) {
                         echo $OUTPUT->notification($available_msg);
                     }