HTML_QuickForm_Wizard
[ class tree: HTML_QuickForm_Wizard ] [ index: HTML_QuickForm_Wizard ] [ all elements ]

Source for file jump.php

Documentation is available at jump.php

  1. <?php
  2. /* vim: set number autoindent tabstop=2 shiftwidth=2 softtabstop=2: */
  3.  
  4. /**
  5. * Jump action
  6. *
  7. * PHP versions 4 and 5
  8. *
  9. * LICENSE: This source file is subject to version 3.0 of the PHP license
  10. * that is available through the world-wide-web at the following URI:
  11. * http://www.php.net/license/3_0.txt. If you did not receive a copy of
  12. * the PHP License and are unable to obtain it through the web, please
  13. * send a note to license@php.net so we can mail you a copy immediately.
  14. *
  15. * @category HTML
  16. * @package HTML_QuickForm_Wizard
  17. * @author Fabio Ambrosanio <fabio@ambrosanio.com>
  18. * @license http://www.php.net/license/3_01.txt PHP
  19. * @version @package_version@
  20. *
  21. * $Id: jump.php,v 1.1 2006/12/09 15:05:56 fabamb Exp $
  22. */
  23.  
  24. require_once 'HTML/QuickForm/Action/Jump.php';
  25.  
  26. /**
  27. * This class implements "jump" action that is to save form's data and jump to a specified page
  28. *
  29. */
  30. class HTML_QuickForm_Wizard_jump extends HTML_QuickForm_Action_Jump
  31. {
  32. /**
  33. * Pause in secs before jumping
  34. *
  35. * @var int
  36. */
  37. var $pause = 0;
  38.  
  39. /**
  40. * Constructor
  41. *
  42. * @param int $pause pause before jumping
  43. * @return HTML_QuickForm_Wizard_jump
  44. */
  45. function HTML_QuickForm_Wizard_jump($pause = 0)
  46. {
  47. $this->pause = $pause;
  48. }
  49.  
  50. function perform(&$page, $actionName)
  51. {
  52. // check whether the page is valid before trying to go to it
  53. if ($page->controller->isModal()) {
  54. // we check whether *all* pages up to current are valid
  55. // if there is an invalid page we go to it, instead of the
  56. // requested one
  57. $pageName = $page->getAttribute('id');
  58. if (!$page->controller->isValid($pageName)) {
  59. $pageName = $page->controller->findInvalid();
  60. }
  61. $current =& $page->controller->getPage($pageName);
  62.  
  63. } else {
  64. $current =& $page;
  65. }
  66.  
  67. // generate the URL for the page 'display' event and redirect to it
  68. $action = $current->getAttribute('action');
  69. $url = $action . (false === strpos($action, '?')? '?': '&') .
  70. $current->getButtonName('display') . '=true' .
  71. ((!defined('SID') || '' == SID)? '': '&' . SID);
  72.  
  73. // using meta tag we can pause before jumping
  74. print "<meta http-equiv='refresh' content='" . $this->pause . ";URL=$url'>";
  75. exit;
  76. }
  77. }
  78. ?>

Documentation generated on Thu, 19 Apr 2007 08:13:26 +0200 by phpDocumentor 1.3.0RC3