Permalink
Browse files

completion MDL-25927 Change print_help_icon to display_help_icon (ret…

…urns html instead of printing)
  • Loading branch information...
1 parent 46f4c39 commit 563e97b8b920d9b7008b380335ba84d32c737f2b @sammarshallou sammarshallou committed Jan 10, 2011
Showing with 10 additions and 8 deletions.
  1. +1 −1 course/format/topics/format.php
  2. +1 −1 course/format/weeks/format.php
  3. +8 −6 lib/completionlib.php
View
2 course/format/topics/format.php
@@ -69,7 +69,7 @@
// 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');
View
2 course/format/weeks/format.php
@@ -61,7 +61,7 @@
//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');
View
14 lib/completionlib.php
@@ -207,17 +207,19 @@ public function is_enabled($cm=null) {
}
/**
- * 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
- * @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;
+ $result = '';
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;
}
/**

0 comments on commit 563e97b

Please sign in to comment.