some changes to setHelpButton methods on elements and MoodleQuickForm to allow non standard help buttons such as the grades pop up window.

This commit is contained in:
jamiesensei 2006-11-13 07:43:22 +00:00
parent 3d436d5974
commit d4fe14d3e4
12 changed files with 68 additions and 56 deletions

View file

@ -3,7 +3,7 @@ require_once('HTML/QuickForm/checkbox.php');
/**
* HTML class for a checkbox type element
*
*
* @author Jamie Pratt
* @access public
*/
@ -19,18 +19,19 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
*
* @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 setHelpButton($helpbuttonargs, $function='helpbutton'){
if (!is_array($helpbuttonargs)){
$helpbuttonargs=array($helpbuttonargs);
}else{
$helpbuttonargs=$helpbuttonargs;
}
//we do this to to return html instead of printing it
//we do this to to return html instead of printing it
//without having to specify it in every call to make a button.
$defaultargs=array('', '', 'moodle', true, false, '', true);
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
}
/**
* get html for help button
@ -43,13 +44,13 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
}
/**
* 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
* @return void
*/
function _generateId()
{