home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Back.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.3 KB  |  55 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4.0                                                      |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author: Alexey Borzov <avb@php.net>                                  |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Back.php,v 1.3 2004/03/02 21:15:45 avb Exp $
  20.  
  21. require_once 'HTML/QuickForm/Action.php';
  22.  
  23. /**
  24.  * The action for a 'back' button of wizard-type multipage form. 
  25.  * 
  26.  * @author  Alexey Borzov <avb@php.net>
  27.  * @package HTML_QuickForm_Controller
  28.  * @version $Revision: 1.3 $
  29.  */
  30. class HTML_QuickForm_Action_Back extends HTML_QuickForm_Action
  31. {
  32.     function perform(&$page, $actionName)
  33.     {
  34.         // save the form values and validation status to the session
  35.         $page->isFormBuilt() or $page->buildForm();
  36.         $pageName =  $page->getAttribute('id');
  37.         $data     =& $page->controller->container();
  38.         $data['values'][$pageName] = $page->exportValues();
  39.         if (!$page->controller->isModal()) {
  40.             $data['valid'][$pageName]  = $page->validate();
  41.         }
  42.  
  43.         // get the previous page and go to it
  44.         // we don't check validation status here, 'jump' handler should
  45.         if (null === ($prevName = $page->controller->getPrevName($pageName))) {
  46.             $page->handle('jump');
  47.         } else {
  48.             $prev =& $page->controller->getPage($prevName);
  49.             $prev->handle('jump');
  50.         }
  51.     }
  52. }
  53.  
  54. ?>
  55.