From f6ad05ef445fa1d6e4965721adf0f7ab12334585 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 21 Jan 2005 05:04:24 +0000 Subject: [PATCH] Can now pass the image tag text to the helpbutton function. Tidied up the emoticonhelpbutton function to use new helpbutton function. --- lib/weblib.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 68d03846ef..d1f38640a0 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3043,28 +3043,37 @@ function error ($message, $link='') { * @param string $text If defined then this text is used in the page, and * the $page variable is ignored. * @param boolean $return If true then the output is returned as a string, if false it is printed to the current page. + * @param string $imagetext The full text for the helpbutton icon. If empty use default help.gif * @return string * @todo Finish documenting this function */ -function helpbutton ($page, $title='', $module='moodle', $image=true, $linktext=false, $text='', $return=false) { +function helpbutton ($page, $title='', $module='moodle', $image=true, $linktext=false, $text='', $return=false, + $imagetext='') { global $CFG, $THEME; if ($module == '') { $module = 'moodle'; } + $linkobject = ''; + if ($image) { - $icon = $CFG->pixpath .'/help.gif'; + if ($imagetext == '') { + $imagetext = ''.$title.''; + } if ($linktext) { - $linkobject = "$title\"\""; - } else { - $linkobject = "\"$title\""; + $linkobject .= $title.' '; } + + $linkobject .= $imagetext; + } else { - $linkobject = ''. $title .''; + $linkobject .= $title; } + + $linkobject .= ''; + if ($text) { $url = '/help.php?module='. $module .'&text='. htmlentities(urlencode($text)); } else { @@ -3096,12 +3105,9 @@ function emoticonhelpbutton($form, $field) { $SESSION->inserttextform = $form; $SESSION->inserttextfield = $field; - helpbutton('emoticons', get_string('helpemoticons'), 'moodle', false, true); - echo ' '; - link_to_popup_window ('/help.php?module=moodle&file=emoticons.html', 'popup', - '', - 400, 500, get_string('helpemoticons')); - echo '
'; + $imagetext = ''; + + helpbutton('emoticons', get_string('helpemoticons'), 'moodle', true, true, '', false, $imagetext); } /** -- 2.39.5