home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Direct.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.2 KB  |  53 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: Direct.php,v 1.2 2004/03/02 21:15:45 avb Exp $
  20.  
  21. require_once 'HTML/QuickForm/Action.php';
  22.  
  23. /**
  24.  * This action allows to go to a specific page of a multipage form.
  25.  * 
  26.  * Please note that the name for this action in addAction() should NOT be  
  27.  * 'direct', but the name of the page you wish to go to.
  28.  * 
  29.  * @author  Alexey Borzov <avb@php.net>
  30.  * @package HTML_QuickForm_Controller
  31.  * @version $Revision: 1.2 $
  32.  */
  33. class HTML_QuickForm_Action_Direct extends HTML_QuickForm_Action
  34. {
  35.     function perform(&$page, $actionName)
  36.     {
  37.         // save the form values and validation status to the session
  38.         $page->isFormBuilt() or $page->buildForm();
  39.         $pageName =  $page->getAttribute('id');
  40.         $data     =& $page->controller->container();
  41.         $data['values'][$pageName] = $page->exportValues();
  42.         $data['valid'][$pageName]  = $page->validate();
  43.  
  44.         $target =& $page->controller->getPage($actionName);
  45.         if (PEAR::isError($target)) {
  46.             return $target;
  47.         } else {
  48.             return $target->handle('jump');
  49.         }
  50.     }
  51. }
  52. ?>
  53.