4 require_once 'HTML/QuickForm/header.php';
7 * A pseudo-element used for adding headers to form
10 class MoodleQuickForm_header
extends HTML_QuickForm_header
13 * html for help button, if empty then no help
19 function MoodleQuickForm_header($elementName = null, $text = null) {
20 parent
::HTML_QuickForm_header($elementName, $text);
28 * @param object An HTML_QuickForm_Renderer object
32 function accept(&$renderer)
34 $this->_text
.= $this->getHelpButton();
35 $renderer->renderHeader($this);
40 * set html for help button
43 * @param array $help array of arguments to make a help button
44 * @param string $function function name to call to get html
46 function setHelpButton($helpbuttonargs, $function='helpbutton'){
47 if (!is_array($helpbuttonargs)){
48 $helpbuttonargs=array($helpbuttonargs);
50 $helpbuttonargs=$helpbuttonargs;
52 //we do this to to return html instead of printing it
53 //without having to specify it in every call to make a button.
54 if ('helpbutton' == $function){
55 $defaultargs=array('', '', 'moodle', true, false, '', true);
56 $helpbuttonargs=$helpbuttonargs +
$defaultargs ;
58 $this->_helpbutton
=call_user_func_array($function, $helpbuttonargs);
61 * get html for help button
64 * @return string html for help button
66 function getHelpButton(){
67 return $this->_helpbutton
;
69 } //end class MoodleQuickForm_header