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

Source for file Next.php

Documentation is available at Next.php

  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: Next.php 6184 2005-09-07 10:08:17Z bmol $
  20.  
  21. require_once 'HTML/QuickForm/Action.php';
  22.  
  23. /**
  24.  * The action for a 'next' button of wizard-type multipage form.
  25.  * 
  26.  * @author  Alexey Borzov <avb@php.net>
  27.  * @package HTML_QuickForm_Controller
  28.  * @version $Revision: 6184 $
  29.  */
  30. {
  31.     function perform(&$page$actionName)
  32.     {
  33.         // save the form values and validation status to the session
  34.         $page->isFormBuilt(or $page->buildForm();
  35.         $pageName =  $page->getAttribute('id');
  36.         $data     =$page->controller->container();
  37.         $data['values'][$pageName$page->exportValues();
  38.         $data['valid'][$pageName]  $page->validate();
  39.  
  40.         // Modal form and page is invalid: don't go further
  41.         if ($page->controller->isModal(&& !$data['valid'][$pageName]{
  42.             return $page->handle('display');
  43.         }
  44.         // More pages?
  45.         if (null !== ($nextName $page->controller->getNextName($pageName))) {
  46.             $next =$page->controller->getPage($nextName);
  47.             return $next->handle('jump');
  48.         // Consider this a 'finish' button, if there is no explicit one
  49.         elseif($page->controller->isModal()) {
  50.             if ($page->controller->isValid()) {
  51.                 return $page->handle('process');
  52.             else {
  53.                 // this should redirect to the first invalid page
  54.                 return $page->handle('jump');
  55.             }
  56.         else {
  57.             return $page->handle('display');
  58.         }
  59.     }
  60. }
  61.  
  62. ?>

Documentation generated on Thu, 12 Jun 2008 14:07:36 -0500 by phpDocumentor 1.4.1