timeline: if a section is set to hidden and the user is not capable of editing a...
[moodle-blog-course-format.git] / lib / form / header.php
blob72704026bd1dc1104e12b85499951527bbe5a748
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 function MoodleQuickForm_header($elementName = null, $text = null) {
20 parent::HTML_QuickForm_header($elementName, $text);
23 // {{{ accept()
25 /**
26 * Accepts a renderer
28 * @param object An HTML_QuickForm_Renderer object
29 * @access public
30 * @return void
32 function accept(&$renderer)
34 $this->_text .= $this->getHelpButton();
35 $renderer->renderHeader($this);
36 } // end func accept
38 // }}}
39 /**
40 * set html for help button
42 * @access public
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);
49 }else{
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);
60 /**
61 * get html for help button
63 * @access public
64 * @return string html for help button
66 function getHelpButton(){
67 return $this->_helpbutton;
69 } //end class MoodleQuickForm_header