completion MDL-25927 Change print_help_icon to display_help_icon (returns html instea...
authorsam marshall <s.marshall@open.ac.uk>
Mon, 10 Jan 2011 13:04:54 +0000 (13:04 +0000)
committersam marshall <s.marshall@open.ac.uk>
Mon, 10 Jan 2011 13:04:54 +0000 (13:04 +0000)
course/format/topics/format.php
course/format/weeks/format.php
lib/completionlib.php

index 12611df..905892d 100644 (file)
@@ -69,7 +69,7 @@ if ($editing) {
 
 // Print the Your progress icon if the track completion is enabled
 $completioninfo = new completion_info($course);
 
 // Print the Your progress icon if the track completion is enabled
 $completioninfo = new completion_info($course);
-$completioninfo->print_help_icon();
+echo $completioninfo->display_help_icon();
 
 echo $OUTPUT->heading(get_string('topicoutline'), 2, 'headingblock header outline');
 
 
 echo $OUTPUT->heading(get_string('topicoutline'), 2, 'headingblock header outline');
 
index 9b9886a..99c7e9a 100644 (file)
@@ -61,7 +61,7 @@ defined('MOODLE_INTERNAL') || die();
 
     //Print the Your progress icon if the track completion is enabled
     $completioninfo = new completion_info($course);
 
     //Print the Your progress icon if the track completion is enabled
     $completioninfo = new completion_info($course);
-    $completioninfo->print_help_icon();
+    echo $completioninfo->display_help_icon();
 
     echo $OUTPUT->heading(get_string('weeklyoutline'), 2, 'headingblock header outline');
 
 
     echo $OUTPUT->heading(get_string('weeklyoutline'), 2, 'headingblock header outline');
 
index f0482db..f3fe8c2 100644 (file)
@@ -207,17 +207,19 @@ class completion_info {
     }
 
     /**
     }
 
     /**
-     * Print the Your progress help icon if the completion tracking is enabled.
+     * Returns the 'Your progress' help icon, if completion tracking is enabled.
      * @global object
      * @global object
-     * @return void
+     * @return string HTML code for help icon, or blank if not needed
      */
      */
-    public function print_help_icon() {
+    public function display_help_icon() {
         global $PAGE, $OUTPUT;
         global $PAGE, $OUTPUT;
+        $result = '';
         if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
         if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
-            echo '<span id = "completionprogressid" class="completionprogress">'.get_string('yourprogress','completion').' ';
-            echo $OUTPUT->help_icon('completionicons', 'completion');
-            echo '</span>';
+            $result .= '<span id = "completionprogressid" class="completionprogress">'.get_string('yourprogress','completion').' ';
+            $result .= $OUTPUT->help_icon('completionicons', 'completion');
+            $result .= '</span>';
         }
         }
+        return $result;
     }
 
     /**
     }
 
     /**