Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / form / radio.php
blob7b2ce8ebf6b3413ce33f87f901da1a8dc472cfa7
1 <?php
2 require_once('HTML/QuickForm/radio.php');
4 /**
5 * HTML class for a radio type element
7 * @author Jamie Pratt
8 * @access public
9 */
10 class MoodleQuickForm_radio extends HTML_QuickForm_radio{
11 /**
12 * html for help button, if empty then no help
14 * @var string
16 var $_helpbutton='';
17 /**
18 * set html for help button
20 * @access public
21 * @param array $help array of arguments to make a help button
22 * @param string $function function name to call to get html
24 function setHelpButton($helpbuttonargs, $function='helpbutton'){
25 if (!is_array($helpbuttonargs)){
26 $helpbuttonargs=array($helpbuttonargs);
27 }else{
28 $helpbuttonargs=$helpbuttonargs;
30 //we do this to to return html instead of printing it
31 //without having to specify it in every call to make a button.
32 if ('helpbutton' == $function){
33 $defaultargs=array('', '', 'moodle', true, false, '', true);
34 $helpbuttonargs=$helpbuttonargs + $defaultargs ;
36 $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
38 /**
39 * get html for help button
41 * @access public
42 * @return string html for help button
44 function getHelpButton(){
45 return $this->_helpbutton;
47 /**
48 * Automatically generates and assigns an 'id' attribute for the element.
50 * Currently used to ensure that labels work on radio buttons and
51 * checkboxes. Per idea of Alexander Radivanovich.
52 * Overriden in moodleforms to remove qf_ prefix.
54 * @access private
55 * @return void
57 function _generateId()
59 static $idx = 1;
61 if (!$this->getAttribute('id')) {
62 $this->updateAttributes(array('id' => 'id_'.substr(md5(microtime() . $idx++), 0, 6)));
64 } // end func _generateId
65 /**
66 * Slightly different container template when frozen.
68 * @return string
70 function getElementTemplateType(){
71 if ($this->_flagFrozen){
72 return 'static';
73 } else {
74 return 'default';