MDL-10496:
[moodle-linuxchix.git] / lib / form / group.php
blobb4f3f16d9ecf54cda79d2b7d4c55d40d73be7aa4
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 //would cause problems with client side validation so will leave for now
21 //var $_elementTemplateType='fieldset';
22 /**
23 * set html for help button
25 * @access public
26 * @param array $help array of arguments to make a help button
27 * @param string $function function name to call to get html
29 function setHelpButton($helpbuttonargs, $function='helpbutton'){
30 if (!is_array($helpbuttonargs)){
31 $helpbuttonargs=array($helpbuttonargs);
32 }else{
33 $helpbuttonargs=$helpbuttonargs;
35 //we do this to to return html instead of printing it
36 //without having to specify it in every call to make a button.
37 if ('helpbutton' == $function){
38 $defaultargs=array('', '', 'moodle', true, false, '', true);
39 $helpbuttonargs=$helpbuttonargs + $defaultargs ;
41 $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
43 /**
44 * set html for help button
46 * @access public
47 * @param array $help array of arguments to make a help button
48 * @param string $function function name to call to get html
50 function getHelpButton(){
51 return $this->_helpbutton;
53 function getElementTemplateType(){
54 if ($this->_flagFrozen){
55 if ($this->getGroupType() == 'submit'){
56 return 'nodisplay';
57 } else {
58 return 'static';
60 } else {
61 return 'fieldset';
66 function setElements($elements){
67 parent::setElements($elements);
68 foreach ($this->_elements as $element){
69 if (method_exists($element, 'setHiddenLabel')){
70 $element->setHiddenLabel(true);