cancel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. require_once('HTML/QuickForm/submit.php');
  3. /**
  4. * HTML class for a submit type element
  5. *
  6. * @author Valery Fremaux
  7. * @access public
  8. */
  9. class HTML_QuickForm_cancel extends HTML_QuickForm_button
  10. {
  11. // {{{ constructor
  12. /**
  13. * Class constructor
  14. *
  15. * @since 1.0
  16. * @access public
  17. * @return void
  18. */
  19. function HTML_QuickForm_cancel($elementName=null, $value=null, $escapeurl=null, $attributes = null)
  20. {
  21. if ($elementName==null){
  22. $elementName = 'cancel';
  23. }
  24. if ($value == null){
  25. $value = get_lang('cancel');
  26. }
  27. parent::HTML_QuickForm_button($elementName, $value, $attributes);
  28. if ($escapeurl!=null){
  29. $this->updateAttributes(array('onclick'=>'window.location.href = "'.$escapeurl.'"; return true;'));
  30. }
  31. } //end constructor
  32. function onQuickFormEvent($event, $arg, &$caller){
  33. $value = $arg[0];
  34. $escapeurl = $arg[1];
  35. if ($value != null){
  36. $this->updateAttributes(array('value'=> $value));
  37. }
  38. if ($escapeurl != null){
  39. $this->updateAttributes(array('onclick'=>'window.location.href = "'.$escapeurl.'"; return true;'));
  40. }
  41. return true;
  42. }
  43. function getFrozenHtml(){
  44. return HTML_QuickForm_submit::getFrozenHtml();
  45. }
  46. function freeze(){
  47. return HTML_QuickForm_submit::freeze();
  48. }
  49. // }}}
  50. } //end class MoodleQuickForm_cancel