MDL-46547 gradebook: Update to print_grade_page_head
authorAdrian Greeve <adrian@moodle.com>
Wed, 1 Oct 2014 07:41:56 +0000 (15:41 +0800)
committerAdrian Greeve <adrian@moodle.com>
Mon, 6 Oct 2014 01:14:04 +0000 (09:14 +0800)
Upgrade to print_grade_page_head to include help messages in the
title of the page.

grade/lib.php

index d3f13ac..fa33044 100644 (file)
@@ -747,12 +747,14 @@ class grade_plugin_info {
  * @param string  $bodytags Additional attributes that will be added to the <body> tag
  * @param string  $buttons Additional buttons to display on the page
  * @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
+ * @param string  $headerhelpidentifier The help string identifier if required.
+ * @param string  $headerhelpcomponent The component for the help string.
  *
  * @return string HTML code or nothing if $return == false
  */
 function print_grade_page_head($courseid, $active_type, $active_plugin=null,
                                $heading = false, $return=false,
-                               $buttons=false, $shownavigation=true) {
+                               $buttons=false, $shownavigation=true, $headerhelpidentifier = null, $headerhelpcomponent = null) {
     global $CFG, $OUTPUT, $PAGE;
 
     $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
@@ -781,6 +783,7 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
     grade_extend_settings($plugin_info, $courseid);
 
     $returnval = $OUTPUT->header();
+
     if (!$return) {
         echo $returnval;
     }
@@ -795,10 +798,18 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
             $returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
         }
 
+        $output = '';
+        // Add a help dialogue box if provided.
+        if (isset($headerhelpidentifier)) {
+            $output = $OUTPUT->heading_with_help($heading, $headerhelpidentifier, $headerhelpcomponent);
+        } else {
+            $output = $OUTPUT->heading($heading);
+        }
+
         if ($return) {
-            $returnval .= $OUTPUT->heading($heading);
+            $returnval .= $output;
         } else {
-            echo $OUTPUT->heading($heading);
+            echo $output;
         }
 
         if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {