MDL-10689:
[moodle-linuxchix.git] / lib / form / header.php
blobb2f6b7e408136b143c40f648a86d2130ddb4799c
1 <?php
2 // $Id$
4 require_once 'HTML/QuickForm/header.php';
6 /**
7 * A pseudo-element used for adding headers to form
9 */
10 class MoodleQuickForm_header extends HTML_QuickForm_header
12 /**
13 * html for help button, if empty then no help
15 * @var string
17 var $_helpbutton='';
19 // {{{ accept()
21 /**
22 * Accepts a renderer
24 * @param object An HTML_QuickForm_Renderer object
25 * @access public
26 * @return void
28 function accept(&$renderer)
30 $this->_text .= $this->getHelpButton();
31 $renderer->renderHeader($this);
32 } // end func accept
34 // }}}
35 /**
36 * set html for help button
38 * @access public
39 * @param array $help array of arguments to make a help button
40 * @param string $function function name to call to get html
42 function setHelpButton($helpbuttonargs, $function='helpbutton'){
43 if (!is_array($helpbuttonargs)){
44 $helpbuttonargs=array($helpbuttonargs);
45 }else{
46 $helpbuttonargs=$helpbuttonargs;
48 //we do this to to return html instead of printing it
49 //without having to specify it in every call to make a button.
50 if ('helpbutton' == $function){
51 $defaultargs=array('', '', 'moodle', true, false, '', true);
52 $helpbuttonargs=$helpbuttonargs + $defaultargs ;
54 $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
56 /**
57 * get html for help button
59 * @access public
60 * @return string html for help button
62 function getHelpButton(){
63 return $this->_helpbutton;
65 } //end class MoodleQuickForm_header