Source for file SimpleStepWizard.class.php

Documentation is available at SimpleStepWizard.class.php

  1. <?php
  2. /**
  3. * @since Jul 20, 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: SimpleStepWizard.class.php,v 1.13 2007/09/19 14:04:50 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/Wizard/SimpleWizard.class.php");
  13.  
  14. require_once(POLYPHONY."/main/library/Wizard/Components/WizardStepContainer.class.php");
  15. require_once(POLYPHONY."/main/library/Wizard/Components/WNextStepButton.class.php");
  16. require_once(POLYPHONY."/main/library/Wizard/Components/WPreviousStepButton.class.php");
  17. require_once(POLYPHONY."/main/library/Wizard/Components/WSaveButton.class.php");
  18. require_once(POLYPHONY."/main/library/Wizard/Components/WCancelButton.class.php");
  19. require_once(POLYPHONY."/main/library/Wizard/Components/WStepDisplayBar.class.php");
  20. require_once(POLYPHONY."/main/library/Wizard/Components/WStepChangedListener.class.php");
  21.  
  22. /**
  23. * typecomment
  24. *
  25. * @since Jul 20, 2005
  26. * @package polyphony.wizard
  27. *
  28. * @copyright Copyright &copy; 2005, Middlebury College
  29. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  30. *
  31. * @version $Id: SimpleStepWizard.class.php,v 1.13 2007/09/19 14:04:50 adamfranco Exp $
  32. */
  33. class SimpleStepWizard extends SimpleWizard {
  34. var $_stepContainer;
  35. var $_nextButton;
  36. var $_prevButton;
  37. var $_saveButton;
  38. var $_cancelButton;
  39. /**
  40. * Constructor
  41. * @access public
  42. * @return void
  43. */
  44. function SimpleStepWizard () {
  45. $this->_stepContainer = new WizardStepContainer();
  46. $this->_nextButton = new WNextStepButton($this->_stepContainer);
  47. $this->_prevButton = new WPreviousStepButton($this->_stepContainer);
  48. $this->_saveButton = new WSaveButton();
  49. $this->_cancelButton = new WCancelButton();
  50. $this->addComponent("_steps", $this->_stepContainer);
  51. $this->addComponent("_save", $this->_saveButton);
  52. $this->addComponent("_cancel", $this->_cancelButton);
  53. $this->addComponent("_next", $this->_nextButton);
  54. $this->addComponent("_prev", $this->_prevButton);
  55. $this->addComponent("_stepsBar", new WStepDisplayBar($this->_stepContainer));
  56. }
  57. /**
  58. * Adds a new {@link WizardStep} to this wizard.
  59. * @param string $name A short id/name for this step.
  60. * @param ref object $step
  61. * @access public
  62. * @return ref object
  63. */
  64. function addStep ($name, $step) {
  65. return $this->_stepContainer->addStep($name, $step);
  66. }
  67. /**
  68. * Sets the step to the named step.
  69. * @param string $name
  70. * @access public
  71. * @return void
  72. */
  73. function setStep ($name) {
  74. $this->_stepContainer->setStep($name);
  75. }
  76. /**
  77. * Answer the name of the current step
  78. *
  79. * @return string
  80. * @access public
  81. * @since 6/5/07
  82. */
  83. function getCurrentStepName () {
  84. return $this->_stepContainer->getCurrentStepName();
  85. }
  86. /**
  87. * Returns a new SimpleStepWizard with the layout defined as passed. The layout
  88. * may include any of the following tags:
  89. *
  90. * _save - a save button
  91. * _cancel - a cancel button
  92. * _steps - the place where the current step content will go
  93. * _next - the next step button
  94. * _prev - the previous step button
  95. * @access public
  96. * @param string $text
  97. * @return ref object
  98. * @static
  99. */
  100. function withText ($text) {
  101. return parent::withText($text,"SimpleStepWizard");
  102. }
  103. /**
  104. * Returns a new SimpleStepWizard with the default layout and a title.
  105. * @param string $title
  106. * @access public
  107. * @return ref object
  108. */
  109. function withTitleAndDefaultLayout ($title) {
  110. $obj = SimpleStepWizard::withDefaultLayout("<h2>$title</h2>\n");
  111. return $obj;
  112. }
  113. /**
  114. * Returns a new SimpleStepWizard with the default layout including all the buttons.
  115. * @param optional string $pre Some text to put before the layout text.
  116. * @access public
  117. * @return ref object
  118. * @static
  119. */
  120. function withDefaultLayout ($pre = '') {
  121. return parent::withText($pre .
  122. "<div>\n" .
  123. "[[_stepsBar]]" .
  124. "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n" .
  125. "<tr>\n" .
  126. "<td align='left' width='50%'>\n" .
  127. "[[_cancel]]<br/>\n" .
  128. "[[_prev]]" .
  129. "</td>\n" .
  130. "<td align='right' width='50%'>\n" .
  131. "[[_save]]<br/>\n" .
  132. "[[_next]]" .
  133. "</td></tr></table>" .
  134. "</div>\n" .
  135. "<hr/>\n" .
  136. "<div>\n" .
  137. "[[_steps]]" .
  138. "</div>\n", "SimpleStepWizard");
  139. }
  140. /**
  141. * Returns the values of wizard-components. Should return an array if children are involved,
  142. * otherwise a whatever type of object is expected.
  143. * @access public
  144. * @return mixed
  145. */
  146. function getAllValues () {
  147. $values = parent::getAllValues();
  148. return $values['_steps'];
  149. }
  150. /**
  151. * Answer the 'Save' button to allow modification of its label and properties.
  152. *
  153. * @return object WSaveButton
  154. * @access public
  155. * @since 6/4/07
  156. */
  157. function getSaveButton () {
  158. return $this->_saveButton;
  159. }
  160. /**
  161. * Answer the 'Cancel' button to allow modification of its label and properties.
  162. *
  163. * @return object WSaveButton
  164. * @access public
  165. * @since 6/4/07
  166. */
  167. function getCancelButton () {
  168. return $this->_cancelButton;
  169. }
  170. }
  171.  
  172. ?>

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