]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-21153, fixed helpbutton debug message when using select & group elements"
authorDongsheng Cai <unoter@gmail.com>
Fri, 18 Dec 2009 07:09:59 +0000 (07:09 +0000)
committerDongsheng Cai <unoter@gmail.com>
Fri, 18 Dec 2009 07:09:59 +0000 (07:09 +0000)
lib/form/group.php
lib/form/select.php

index 1f91e48b9466a2e5fac22b1da6d4a4b2bad10299..74a49e5ca61ba4772a994cd9d78ada4a90d27edc 100644 (file)
@@ -30,6 +30,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{
      * @param string $function function name to call to get html
      */
     function setHelpButton($helpbuttonargs, $function='helpbutton'){
+        global $OUTPUT;
         if (!is_array($helpbuttonargs)){
             $helpbuttonargs=array($helpbuttonargs);
         }else{
@@ -37,11 +38,13 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{
         }
         //we do this to to return html instead of printing it
         //without having to specify it in every call to make a button.
-        if ('helpbutton' == $function){
+        if ($function == 'helpbutton') {
             $defaultargs=array('', '', 'moodle', true, false, '', true);
             $helpbuttonargs=$helpbuttonargs + $defaultargs ;
+            $this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs));
+        } else {
+            $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
         }
-        $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
     }
     /**
      * set html for help button
index 83c17871414643ed27b064d1dfd6fa75898a1430..92443e2a908ba28bdbce7bc31edba4abbfa9c910 100644 (file)
@@ -57,6 +57,7 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
      * @param string $function function name to call to get html
      */
     function setHelpButton($helpbuttonargs, $function='helpbutton'){
+        global $OUTPUT;
         if (!is_array($helpbuttonargs)){
             $helpbuttonargs=array($helpbuttonargs);
         }else{
@@ -67,8 +68,10 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
         if ('helpbutton' == $function){
             $defaultargs=array('', '', 'moodle', true, false, '', true);
             $helpbuttonargs=$helpbuttonargs + $defaultargs ;
+            $this->_helpbutton=$OUTPUT->help_icon(call_user_func_array('moodle_help_icon::make', $helpbuttonargs));
+        } else {
+            $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
         }
-        $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
     }
     /**
      * get html for help button