MDL-9137 Fixing errors in the overview report
[moodle-pu.git] / lib / form / button.php
blob2e5649f3f80694532f3ea18c9723af799b200144
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
4 // | PHP version 4.0 |
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.0 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Authors: Adam Daniel <adaniel1@eesus.jnj.com> |
17 // | Bertrand Mansion <bmansion@mamasam.com> |
18 // +----------------------------------------------------------------------+
20 // $Id$
22 require_once("HTML/QuickForm/button.php");
24 /**
25 * HTML class for a button type element
27 * @author Adam Daniel <adaniel1@eesus.jnj.com>
28 * @author Bertrand Mansion <bmansion@mamasam.com>
29 * @version 1.1
30 * @since PHP4.04pl1
31 * @access public
33 class MoodleQuickForm_button extends HTML_QuickForm_button
35 /**
36 * html for help button, if empty then no help
38 * @var string
40 var $_helpbutton='';
41 /**
42 * set html for help button
44 * @access public
45 * @param array $help array of arguments to make a help button
46 * @param string $function function name to call to get html
48 function setHelpButton($helpbuttonargs, $function='helpbutton'){
49 if (!is_array($helpbuttonargs)){
50 $helpbuttonargs=array($helpbuttonargs);
51 }else{
52 $helpbuttonargs=$helpbuttonargs;
54 //we do this to to return html instead of printing it
55 //without having to specify it in every call to make a button.
56 if ('helpbutton' == $function){
57 $defaultargs=array('', '', 'moodle', true, false, '', true);
58 $helpbuttonargs=$helpbuttonargs + $defaultargs ;
60 $this->_helpbutton=call_user_func_array($function, $helpbuttonargs);
62 /**
63 * get html for help button
65 * @access public
66 * @return string html for help button
68 function getHelpButton(){
69 return $this->_helpbutton;
71 /**
72 * Slightly different container template when frozen.
74 * @return string
76 function getElementTemplateType(){
77 if ($this->_flagFrozen){
78 return 'nodisplay';
79 } else {
80 return 'default';
83 } //end class MoodleQuickForm_button