MDL-10496:
[moodle-linuxchix.git] / lib / form / submit.php
blob406b2941a326cb1022565d17b69ca8efcf1a93c5
1 <?php
2 require_once("HTML/QuickForm/submit.php");
4 /**
5 * HTML class for a submit type element
7 * @author Adam Daniel <adaniel1@eesus.jnj.com>
8 * @author Bertrand Mansion <bmansion@mamasam.com>
9 * @version 1.0
10 * @since PHP4.04pl1
11 * @access public
13 class MoodleQuickForm_submit extends HTML_QuickForm_submit {
14 /**
15 * Called by HTML_QuickForm whenever form event is made on this element
17 * @param string $event Name of event
18 * @param mixed $arg event arguments
19 * @param object $caller calling object
20 * @since 1.0
21 * @access public
22 * @return void
24 function onQuickFormEvent($event, $arg, &$caller)
26 switch ($event) {
27 case 'createElement':
28 parent::onQuickFormEvent($event, $arg, $caller);
29 if ($caller->isNoSubmitButton($arg[0])){
30 //need this to bypass client validation
31 //for buttons that submit but do not process the
32 //whole form.
33 $onClick = $this->getAttribute('onclick');
34 $skip = 'skipClientValidation = true;';
35 $onClick = ($onClick !== null)?$skip.' '.$onClick:$skip;
36 $this->updateAttributes(array('onclick'=>$onClick));
38 return true;
39 break;
41 return parent::onQuickFormEvent($event, $arg, $caller);
43 } // end func onQuickFormEvent
44 /**
45 * Slightly different container template when frozen. Don't want to display a submit
46 * button if the form is frozen.
48 * @return string
50 function getElementTemplateType(){
51 if ($this->_flagFrozen){
52 return 'nodisplay';
53 } else {
54 return 'default';
58 function freeze(){
59 $this->_flagFrozen = true;