|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 require_once("HTML/QuickForm/submit.php"); 00003 00013 class MoodleQuickForm_submit extends HTML_QuickForm_submit { 00014 function MoodleQuickForm_submit($elementName=null, $value=null, $attributes=null) { 00015 parent::HTML_QuickForm_submit($elementName, $value, $attributes); 00016 } 00027 function onQuickFormEvent($event, $arg, &$caller) 00028 { 00029 switch ($event) { 00030 case 'createElement': 00031 parent::onQuickFormEvent($event, $arg, $caller); 00032 if ($caller->isNoSubmitButton($arg[0])){ 00033 //need this to bypass client validation 00034 //for buttons that submit but do not process the 00035 //whole form. 00036 $onClick = $this->getAttribute('onclick'); 00037 $skip = 'skipClientValidation = true;'; 00038 $onClick = ($onClick !== null)?$skip.' '.$onClick:$skip; 00039 $this->updateAttributes(array('onclick'=>$onClick)); 00040 } 00041 return true; 00042 break; 00043 } 00044 return parent::onQuickFormEvent($event, $arg, $caller); 00045 00046 } // end func onQuickFormEvent 00053 function getElementTemplateType(){ 00054 if ($this->_flagFrozen){ 00055 return 'nodisplay'; 00056 } else { 00057 return 'default'; 00058 } 00059 } 00060 00061 function freeze(){ 00062 $this->_flagFrozen = true; 00063 } 00064 00065 }