Source for file WizardEventListener.abstract.php

Documentation is available at WizardEventListener.abstract.php

  1. <?php
  2.  
  3. /**
  4. * @since Jul 22, 2005
  5. * @package polyphony.wizard.components
  6. *
  7. * @copyright Copyright &copy; 2005, Middlebury College
  8. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  9. *
  10. * @version $Id: WizardEventListener.abstract.php,v 1.3 2007/09/19 14:04:51 adamfranco Exp $
  11. */
  12.  
  13. require_once(POLYPHONY.'/main/library/Wizard/WizardComponent.abstract.php');
  14.  
  15. /**
  16. * Supplies an event listener to a {@link Wizard}
  17. *
  18. *
  19. * @since Jul 22, 2005
  20. * @package polyphony.wizard.components
  21. *
  22. * @copyright Copyright &copy; 2005, Middlebury College
  23. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  24. *
  25. * @version $Id: WizardEventListener.abstract.php,v 1.3 2007/09/19 14:04:51 adamfranco Exp $
  26. */
  27. class WizardEventListener
  28. extends WizardComponent
  29. /* implements EventListener */
  30. {
  31. /**
  32. * Sets this component's parent (some kind of {@link WizardComponentWithChildren} so that it can
  33. * have access to its information, if needed.
  34. * @param ref object $parent
  35. * @access public
  36. * @return void
  37. */
  38. function setParent ($parent) {
  39. $this->_parent =$parent;
  40. $this->_attemptAdding();
  41. }
  42. /**
  43. * Attempts to add ourselves to the parent {@link Wizard} as an {@link EventListener}.
  44. * @access public
  45. * @return void
  46. */
  47. function _attemptAdding () {
  48. if ($this->_added) return;
  49. $wz =$this->getWizard();
  50. if ($wz) {
  51. $wz->addEventListener($this);
  52. $this->_added = true;
  53. }
  54. }
  55. /**
  56. * Tells the wizard component to update itself - this may include getting
  57. * form post data or validation - whatever this particular component wants to
  58. * do every pageload.
  59. * @param string $fieldName The field name to use when outputting form data or
  60. * similar parameters/information.
  61. * @access public
  62. * @return boolean - TRUE if everything is OK
  63. */
  64. function update ($fieldName) {
  65. throwError(new Error(__CLASS__."::".__FUNCTION__."() must be overridded in child classes."));
  66. }
  67. /**
  68. * Returns the values of wizard-components. Should return an array if children are involved,
  69. * otherwise a whatever type of object is expected.
  70. * @access public
  71. * @return mixed
  72. */
  73. function getAllValues () {
  74. return null;
  75. }
  76. /**
  77. * Returns a block of XHTML-valid code that contains markup for this specific
  78. * component.
  79. * @param string $fieldName The field name to use when outputting form data or
  80. * similar parameters/information.
  81. * @access public
  82. * @return string
  83. */
  84. function getMarkup ($fieldName) {
  85. return '';
  86. }
  87. /**
  88. * Handles an event triggered by an {@link EventTrigger}. The event type is passed in case this
  89. * particular EventListener is handling more than one type of event.
  90. * @param string $eventType
  91. * @param ref object $source The source object of the event.
  92. * @param array $context An array of contextual parameters - the content will be dependent on the thrown event.
  93. * @access public
  94. * @return void
  95. */
  96. function handleEvent ($eventType, $source, $context) {
  97. throwError(new Error(__CLASS__."::".__FUNCTION__."() must be overridded in child classes."));
  98. }
  99. }
  100. ?>

Documentation generated on Wed, 19 Sep 2007 10:28:05 -0400 by phpDocumentor 1.3.0RC3