- <?php
- /* vim: set number autoindent tabstop=2 shiftwidth=2 softtabstop=2: */
-
- /**
- * Jump action
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm_Wizard
- * @author Fabio Ambrosanio <fabio@ambrosanio.com>
- * @license http://www.php.net/license/3_01.txt PHP
- * @version @package_version@
- *
- * $Id: jump.php,v 1.1 2006/12/09 15:05:56 fabamb Exp $
- */
-
- require_once 'HTML/QuickForm/Action/Jump.php';
-
- /**
- * This class implements "jump" action that is to save form's data and jump to a specified page
- *
- */
- class HTML_QuickForm_Wizard_jump extends HTML_QuickForm_Action_Jump
- {
- /**
- * Pause in secs before jumping
- *
- * @var int
- */
- var $pause = 0;
-
- /**
- * Constructor
- *
- * @param int $pause pause before jumping
- * @return HTML_QuickForm_Wizard_jump
- */
- function HTML_QuickForm_Wizard_jump($pause = 0)
- {
- $this->pause = $pause;
- }
-
- function perform(&$page, $actionName)
- {
- // check whether the page is valid before trying to go to it
- if ($page->controller->isModal()) {
- // we check whether *all* pages up to current are valid
- // if there is an invalid page we go to it, instead of the
- // requested one
- $pageName = $page->getAttribute('id');
- if (!$page->controller->isValid($pageName)) {
- $pageName = $page->controller->findInvalid();
- }
- $current =& $page->controller->getPage($pageName);
-
- } else {
- $current =& $page;
- }
-
- // generate the URL for the page 'display' event and redirect to it
- $action = $current->getAttribute('action');
- $url = $action . (false === strpos($action, '?')? '?': '&') .
- $current->getButtonName('display') . '=true' .
- ((!defined('SID') || '' == SID)? '': '&' . SID);
-
- // using meta tag we can pause before jumping
- print "<meta http-equiv='refresh' content='" . $this->pause . ";URL=$url'>";
- exit;
- }
- }
- ?>