Fixes bug MDL-8234, "New groups code & AS keyword"
[moodle-pu.git] / lib / form / group.php
blobaf8be99528f7c3d4ba4ed1b6bba4e245d09d1c5a
1 <?php
2 require_once("HTML/QuickForm/group.php");
4 /**
5 * HTML class for a form element group
7 * @author Adam Daniel <adaniel1@eesus.jnj.com>
8 * @author Bertrand Mansion <bmansion@mamasam.com>
9 * @version 1.0
10 * @since PHP4.04pl1
11 * @access public
13 class MoodleQuickForm_group extends HTML_QuickForm_group{
14 /**
15 * html for help button, if empty then no help
17 * @var string
19 var $_helpbutton='';
20 var $_elementTemplateType='fieldset';
21 //would cause problems with client side validation so will leave for now
22 //var $_elementTemplateType='fieldset';
23 /**
24 * set html for help button
26 * @access public
27 * @param array $help array of arguments to make a help button
28 * @param string $function function name to call to get html
30 function setHelpButton($helpbuttonargs, $function='helpbutton'){
31 if (!is_array($helpbuttonargs)){
32 $helpbuttonargs=array($helpbuttonargs);
33 }else{
34 $helpbuttonargs=$helpbuttonargs;
36 //we do this to to return html instead of printing it
37 //without having to specify it in every call to make a button.
38 if ('helpbutton' == $function){
39 $defaultargs=array('', '', 'moodle', true, false, '', true);
40 $helpbuttonargs=$helpbuttonargs + $defaultargs ;
42 $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
44 /**
45 * set html for help button
47 * @access public
48 * @param array $help array of arguments to make a help button
49 * @param string $function function name to call to get html
51 function getHelpButton(){
52 return $this->_helpbutton;
54 function getElementTemplateType(){
55 return $this->_elementTemplateType;
57 function setElements($elements){
58 parent::setElements($elements);
59 foreach ($this->_elements as $element){
60 if (method_exists($element, 'setHiddenLabel')){
61 $element->setHiddenLabel(true);