Merge branch 'wip-MDL-26747' of git://github.com/sammarshallou/moodle
[moodle.git] / lib / form / cancel.php
blob79ab00a44e2e169e7c132c53b8b1ff96af52fb76
1 <?php
2 if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
6 global $CFG;
7 require_once($CFG->libdir.'/form/submit.php');
9 /**
10 * HTML class for a submit type element
12 * @author Jamie Pratt
13 * @access public
15 class MoodleQuickForm_cancel extends MoodleQuickForm_submit
17 // {{{ constructor
19 /**
20 * Class constructor
22 * @since 1.0
23 * @access public
24 * @return void
26 function MoodleQuickForm_cancel($elementName=null, $value=null, $attributes=null)
28 if ($elementName==null){
29 $elementName='cancel';
31 if ($value==null){
32 $value=get_string('cancel');
34 MoodleQuickForm_submit::MoodleQuickForm_submit($elementName, $value, $attributes);
35 $this->updateAttributes(array('onclick'=>'skipClientValidation = true; return true;'));
36 } //end constructor
37 function onQuickFormEvent($event, $arg, &$caller)
39 switch ($event) {
40 case 'createElement':
41 $className = get_class($this);
42 $this->$className($arg[0], $arg[1], $arg[2]);
43 $caller->_registerCancelButton($this->getName());
44 return true;
45 break;
47 return parent::onQuickFormEvent($event, $arg, $caller);
48 } // end func onQuickFormEvent
50 function getFrozenHtml(){
51 return HTML_QuickForm_submit::getFrozenHtml();
54 function freeze(){
55 return HTML_QuickForm_submit::freeze();
57 // }}}
58 } //end class MoodleQuickForm_cancel