diff -Naur /Users/sbourget/Downloads/moodle 2/lib/form/hierselect.php /Applications/MAMP/htdocs/moodle20/lib/form/hierselect.php --- /Users/sbourget/Downloads/moodle 2/lib/form/hierselect.php 1969-12-31 19:00:00.000000000 -0500 +++ /Applications/MAMP/htdocs/moodle20/lib/form/hierselect.php 2009-12-30 22:08:55.000000000 -0500 @@ -0,0 +1,88 @@ +_hiddenLabel = $hiddenLabel; + } + function toHtml(){ + if ($this->_hiddenLabel){ + $this->_generateId(); + return ''.parent::toHtml(); + } else { + return parent::toHtml(); + } + } + + + /** + * Automatically generates and assigns an 'id' attribute for the element. + * + * Currently used to ensure that labels work on radio buttons and + * checkboxes. Per idea of Alexander Radivanovich. + * Overriden in moodleforms to remove qf_ prefix. + * + * @access private + * @return void + */ + function _generateId() + { + static $idx = 1; + + if (!$this->getAttribute('id')) { + $this->updateAttributes(array('id' => 'id_'. substr(md5(microtime() . $idx++), 0, 6))); + } + } // end func _generateId + /** + * set html for help button + * + * @access public + * @param array $help array of arguments to make a help button + * @param string $function function name to call to get html + */ + function setHelpButton($helpbuttonargs, $function='helpbutton'){ + debugging('component setHelpButton() is not used any more, please use $mform->setHelpButton() instead'); + } + /** + * get html for help button + * + * @access public + * @return string html for help button + */ + function getHelpButton(){ + return $this->_helpbutton; + } + + /** + * Slightly different container template when frozen. Don't want to use a label tag + * with a for attribute in that case for the element label but instead use a div. + * Templates are defined in renderer constructor. + * + * @return string + */ + function getElementTemplateType(){ + if ($this->_flagFrozen){ + return 'static'; + } else { + return 'default'; + } + } +} \ No newline at end of file diff -Naur /Users/sbourget/Downloads/moodle 2/lib/formslib.php /Applications/MAMP/htdocs/moodle20/lib/formslib.php --- /Users/sbourget/Downloads/moodle 2/lib/formslib.php 2009-12-31 08:00:52.000000000 -0500 +++ /Applications/MAMP/htdocs/moodle20/lib/formslib.php 2009-12-30 22:22:17.000000000 -0500 @@ -2224,6 +2224,7 @@ MoodleQuickForm::registerElementType('group', "$CFG->libdir/form/group.php", 'MoodleQuickForm_group'); MoodleQuickForm::registerElementType('header', "$CFG->libdir/form/header.php", 'MoodleQuickForm_header'); MoodleQuickForm::registerElementType('hidden', "$CFG->libdir/form/hidden.php", 'MoodleQuickForm_hidden'); +MoodleQuickForm::registerElementType('hierselect', "$CFG->libdir/form/hierselect.php", 'MoodleQuickForm_hierselect'); MoodleQuickForm::registerElementType('htmleditor', "$CFG->libdir/form/htmleditor.php", 'MoodleQuickForm_htmleditor'); MoodleQuickForm::registerElementType('modgrade', "$CFG->libdir/form/modgrade.php", 'MoodleQuickForm_modgrade'); MoodleQuickForm::registerElementType('modvisible', "$CFG->libdir/form/modvisible.php", 'MoodleQuickForm_modvisible');