Source for file WizardComponent.abstract.php

Documentation is available at WizardComponent.abstract.php

  1. <?php
  2. /**
  3. * @since Jul 19, 2005
  4. * @package polyphony.wizard
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: WizardComponent.abstract.php,v 1.5 2007/09/19 14:04:50 adamfranco Exp $
  10. */
  11.  
  12. /**
  13. * A WizardComponent is an element that you can add to a {@link Wizard}. They can be used
  14. * to create simple interface components or to handle form input and validation.
  15. *
  16. * @since Jul 19, 2005
  17. * @package polyphony.wizard
  18. *
  19. * @copyright Copyright &copy; 2005, Middlebury College
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  21. *
  22. * @version $Id: WizardComponent.abstract.php,v 1.5 2007/09/19 14:04:50 adamfranco Exp $
  23. */
  24. abstract class WizardComponent
  25. extends SObject
  26. {
  27. var $_parent;
  28. var $_enabled = true;
  29. var $_enabledSticky = false;
  30. /**
  31. * Sets this component's parent (some kind of {@link WizardComponentWithChildren} so that it can
  32. * have access to its information, if needed.
  33. * @param ref object $parent
  34. * @access public
  35. * @return void
  36. */
  37. function setParent ($parent) {
  38. $this->_parent =$parent;
  39. }
  40. /**
  41. * Returns the top-level {@link Wizard} in which this component resides.
  42. * @access public
  43. * @return ref object
  44. */
  45. function getWizard () {
  46. return $this->_parent->getWizard();
  47. }
  48. /**
  49. * Returns true if this component (and all child components if applicable) have valid values.
  50. * By default, this will just return TRUE. Validate should be called usually before a save event
  51. * is handled, to make sure everything went smoothly.
  52. * @access public
  53. * @return boolean
  54. */
  55. function validate () {
  56. return true;
  57. }
  58. /**
  59. * Sets if this component will be enabled or disabled.
  60. * @param boolean $enabled
  61. * @param boolean $sticky If true, future calls to setEnabled without sticky
  62. * will have no effect.
  63. * @access public
  64. * @return void
  65. */
  66. function setEnabled ($enabled, $sticky = false) {
  67. if ($this->_enabledSticky) {
  68. if ($sticky) {
  69. $this->_enabled = $enabled;
  70. $this->_enabledSticky = $sticky;
  71. }
  72. } else {
  73. $this->_enabled = $enabled;
  74. $this->_enabledSticky = $sticky;
  75. }
  76. }
  77. /**
  78. * Answers true if this component will be enabled.
  79. * @access public
  80. * @return boolean
  81. */
  82. function isEnabled () {
  83. return $this->_enabled;
  84. }
  85. /**
  86. * Tells the wizard component to update itself - this may include getting
  87. * form post data or validation - whatever this particular component wants to
  88. * do every pageload.
  89. * @param string $fieldName The field name to use when outputting form data or
  90. * similar parameters/information.
  91. * @access public
  92. * @return boolean - TRUE if everything is OK
  93. */
  94. abstract function update ($fieldName);
  95. /**
  96. /**
  97. * Returns the values of wizard-components. Should return an array if children are involved,
  98. * otherwise a whatever type of object is expected.
  99. * @access public
  100. * @return mixed
  101. */
  102. abstract function getAllValues ();
  103. /**
  104. /**
  105. * Returns a block of XHTML-valid code that contains markup for this specific
  106. * component.
  107. * @param string $fieldName The field name to use when outputting form data or
  108. * similar parameters/information.
  109. * @access public
  110. * @return string
  111. */
  112. abstract function getMarkup ($fieldName);
  113.  
  114.  
  115.  
  116. ?>

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