mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 08:09:47 +02:00
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:
parent
3d436d5974
commit
d4fe14d3e4
12 changed files with 68 additions and 56 deletions
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/checkbox.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a checkbox type element
|
* HTML class for a checkbox type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_checkbox extends HTML_QuickForm_checkbox{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* 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.
|
* Automatically generates and assigns an 'id' attribute for the element.
|
||||||
*
|
*
|
||||||
* Currently used to ensure that labels work on radio buttons and
|
* Currently used to ensure that labels work on radio buttons and
|
||||||
* checkboxes. Per idea of Alexander Radivanovich.
|
* checkboxes. Per idea of Alexander Radivanovich.
|
||||||
* Overriden in moodleforms to remove qf_ prefix.
|
* Overriden in moodleforms to remove qf_ prefix.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _generateId()
|
function _generateId()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/file.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a form element to upload a file
|
* HTML class for a form element to upload a file
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,24 +19,26 @@ class MoodleQuickForm_file extends HTML_QuickForm_file{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* set html for help button
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return string html for help button
|
* @param array $help array of arguments to make a help button
|
||||||
|
* @param string $function function name to call to get html
|
||||||
*/
|
*/
|
||||||
function getHelpButton(){
|
function getHelpButton(){
|
||||||
return $this->_helpbutton;
|
return $this->_helpbutton;
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once("HTML/QuickForm/group.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a form element group
|
* HTML class for a form element group
|
||||||
*
|
*
|
||||||
* @author Adam Daniel <adaniel1@eesus.jnj.com>
|
* @author Adam Daniel <adaniel1@eesus.jnj.com>
|
||||||
* @author Bertrand Mansion <bmansion@mamasam.com>
|
* @author Bertrand Mansion <bmansion@mamasam.com>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
@ -25,24 +25,26 @@ class MoodleQuickForm_group extends HTML_QuickForm_group{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* set html for help button
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return string html for help button
|
* @param array $help array of arguments to make a help button
|
||||||
|
* @param string $function function name to call to get html
|
||||||
*/
|
*/
|
||||||
function getHelpButton(){
|
function getHelpButton(){
|
||||||
return $this->_helpbutton;
|
return $this->_helpbutton;
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/hidden.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a hidden type element
|
* HTML class for a hidden type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,9 +19,10 @@ class MoodleQuickForm_hidden extends HTML_QuickForm_hidden{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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'){
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -9,8 +9,6 @@ require_once "$CFG->libdir/form/select.php";
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
class MoodleQuickForm_modgroupmode extends MoodleQuickForm_select{
|
class MoodleQuickForm_modgroupmode extends MoodleQuickForm_select{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
|
@ -43,9 +41,10 @@ class MoodleQuickForm_modgroupmode extends MoodleQuickForm_select{
|
||||||
{
|
{
|
||||||
switch ($event) {
|
switch ($event) {
|
||||||
case 'createElement':
|
case 'createElement':
|
||||||
$choices=array();
|
$choices = array();
|
||||||
$choices[0] = get_string('no');
|
$choices[0] = get_string('no');
|
||||||
$choices[1] = get_string('yes');
|
$choices[1] = get_string('yes');
|
||||||
|
$this->setHelpButton(array('groupmode', get_string('groupmode')));
|
||||||
$this->load($choices);
|
$this->load($choices);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/password.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a password type element
|
* HTML class for a password type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_password extends HTML_QuickForm_password{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/radio.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a radio type element
|
* HTML class for a radio type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
@ -43,13 +44,13 @@ class MoodleQuickForm_radio extends HTML_QuickForm_radio{
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Automatically generates and assigns an 'id' attribute for the element.
|
* Automatically generates and assigns an 'id' attribute for the element.
|
||||||
*
|
*
|
||||||
* Currently used to ensure that labels work on radio buttons and
|
* Currently used to ensure that labels work on radio buttons and
|
||||||
* checkboxes. Per idea of Alexander Radivanovich.
|
* checkboxes. Per idea of Alexander Radivanovich.
|
||||||
* Overriden in moodleforms to remove qf_ prefix.
|
* Overriden in moodleforms to remove qf_ prefix.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _generateId()
|
function _generateId()
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/select.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a select type element
|
* HTML class for a select type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_select extends HTML_QuickForm_select{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once("HTML/QuickForm/static.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a text type element
|
* HTML class for a text type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_static extends HTML_QuickForm_static{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once("HTML/QuickForm/text.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a text type element
|
* HTML class for a text type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_text extends HTML_QuickForm_text{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -3,7 +3,7 @@ require_once('HTML/QuickForm/textarea.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML class for a textarea type element
|
* HTML class for a textarea type element
|
||||||
*
|
*
|
||||||
* @author Jamie Pratt
|
* @author Jamie Pratt
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
@ -19,18 +19,19 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea{
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $help array of arguments to make a help button
|
* @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)){
|
if (!is_array($helpbuttonargs)){
|
||||||
$helpbuttonargs=array($helpbuttonargs);
|
$helpbuttonargs=array($helpbuttonargs);
|
||||||
}else{
|
}else{
|
||||||
$helpbuttonargs=$helpbuttonargs;
|
$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.
|
//without having to specify it in every call to make a button.
|
||||||
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
$defaultargs=array('', '', 'moodle', true, false, '', true);
|
||||||
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
$helpbuttonargs=$helpbuttonargs + $defaultargs ;
|
||||||
$this->_helpbutton=call_user_func_array('helpbutton', $helpbuttonargs);
|
$this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* get html for help button
|
* get html for help button
|
||||||
|
|
|
@ -337,7 +337,6 @@ class moodleform_mod extends moodleform {
|
||||||
$mform=$this->_form;
|
$mform=$this->_form;
|
||||||
$mform->addElement('header', '', get_string('modstandardels', 'form'));
|
$mform->addElement('header', '', get_string('modstandardels', 'form'));
|
||||||
$mform->addElement('modgroupmode', 'groupmode', get_string('groupmode'));
|
$mform->addElement('modgroupmode', 'groupmode', get_string('groupmode'));
|
||||||
$mform->setHelpButton('groupmode', array('groupmode', get_string('groupmode')));
|
|
||||||
$mform->setType('groupmode', PARAM_INT);
|
$mform->setType('groupmode', PARAM_INT);
|
||||||
|
|
||||||
$mform->addElement('modvisible', 'visible', get_string('visible'));
|
$mform->addElement('modvisible', 'visible', get_string('visible'));
|
||||||
|
@ -554,26 +553,27 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function setHelpButtons($buttons, $suppresscheck=false){
|
function setHelpButtons($buttons, $suppresscheck=false, $function='helpbutton'){
|
||||||
|
|
||||||
foreach ($buttons as $elementname => $button){
|
foreach ($buttons as $elementname => $button){
|
||||||
$this->setHelpButton($elementname, $button, $suppresscheck);
|
$this->setHelpButton($elementname, $button, $suppresscheck, $function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Add a single button.
|
* Add a single button.
|
||||||
*
|
*
|
||||||
* @param string $elementname name of the element to add the item to
|
* @param string $elementname name of the element to add the item to
|
||||||
* @param array $button - arguments to pass to setHelpButton
|
* @param array $button - arguments to pass to function $function
|
||||||
* @param boolean $suppresscheck - whether to throw an error if the element
|
* @param boolean $suppresscheck - whether to throw an error if the element
|
||||||
* doesn't exist.
|
* doesn't exist.
|
||||||
|
* @param string $function - function to generate html from the arguments in $button
|
||||||
*/
|
*/
|
||||||
function setHelpButton($elementname, $button, $suppresscheck=false){
|
function setHelpButton($elementname, $button, $suppresscheck=false, $function='helpbutton'){
|
||||||
if (array_key_exists($elementname, $this->_elementIndex)){
|
if (array_key_exists($elementname, $this->_elementIndex)){
|
||||||
//_elements has a numeric index, this code accesses the elements by name
|
//_elements has a numeric index, this code accesses the elements by name
|
||||||
$element=&$this->_elements[$this->_elementIndex[$elementname]];
|
$element=&$this->_elements[$this->_elementIndex[$elementname]];
|
||||||
if (method_exists($element, 'setHelpButton')){
|
if (method_exists($element, 'setHelpButton')){
|
||||||
$element->setHelpButton($button);
|
$element->setHelpButton($button, $function);
|
||||||
}else{
|
}else{
|
||||||
$a=new object();
|
$a=new object();
|
||||||
$a->name=$element->getName();
|
$a->name=$element->getName();
|
||||||
|
@ -935,5 +935,6 @@ MoodleQuickForm::registerElementType('hidden', "$CFG->libdir/form/hidden.php", '
|
||||||
MoodleQuickForm::registerElementType('modvisible', "$CFG->libdir/form/modvisible.php", 'MoodleQuickForm_modvisible');
|
MoodleQuickForm::registerElementType('modvisible', "$CFG->libdir/form/modvisible.php", 'MoodleQuickForm_modvisible');
|
||||||
MoodleQuickForm::registerElementType('modgroupmode', "$CFG->libdir/form/modgroupmode.php", 'MoodleQuickForm_modgroupmode');
|
MoodleQuickForm::registerElementType('modgroupmode', "$CFG->libdir/form/modgroupmode.php", 'MoodleQuickForm_modgroupmode');
|
||||||
MoodleQuickForm::registerElementType('selectyesno', "$CFG->libdir/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
|
MoodleQuickForm::registerElementType('selectyesno', "$CFG->libdir/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
|
||||||
|
MoodleQuickForm::registerElementType('modgrade', "$CFG->libdir/form/modgrade.php", 'MoodleQuickForm_modgrade');
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue