|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 require_once('HTML/QuickForm/advcheckbox.php'); 00003 00013 class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{ 00019 var $_helpbutton=''; 00020 00025 var $_group; 00026 00041 function MoodleQuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null) 00042 { 00043 if ($values === null){ 00044 $values = array(0, 1); 00045 } 00046 00047 if (!is_null($attributes['group'])) { 00048 00049 $this->_group = 'checkboxgroup' . $attributes['group']; 00050 unset($attributes['group']); 00051 if (is_null($attributes)) { 00052 $attributes = array(); 00053 $attributes['class'] .= " $this->_group"; 00054 } elseif (is_array($attributes)) { 00055 if (isset($attributes['class'])) { 00056 $attributes['class'] .= " $this->_group"; 00057 } else { 00058 $attributes['class'] = $this->_group; 00059 } 00060 } elseif ($strpos = stripos($attributes, 'class="')) { 00061 $attributes = str_ireplace('class="', 'class="' . $this->_group . ' ', $attributes); 00062 } else { 00063 $attributes .= ' class="' . $this->_group . '"'; 00064 } 00065 } 00066 00067 parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values); 00068 } //end constructor 00069 00070 00078 function setHelpButton($helpbuttonargs, $function='helpbutton'){ 00079 debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead'); 00080 } 00087 function getHelpButton(){ 00088 return $this->_helpbutton; 00089 } 00090 00091 function toHtml() 00092 { 00093 return '<span>' . parent::toHtml() . '</span>'; 00094 } 00095 00101 function getFrozenHtml() 00102 { 00103 //$this->_generateId(); 00104 $output = '<input type="checkbox" disabled="disabled" id="'.$this->getAttribute('id').'" '; 00105 if ($this->getChecked()) { 00106 $output .= 'checked="checked" />'.$this->_getPersistantData(); 00107 } else { 00108 $output .= '/>'; 00109 } 00110 return $output; 00111 } //end func getFrozenHtml 00112 00113 }