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 softtabstop=4: */
  3.  
  4. /**
  5.  * The action for a 'next' button of wizard-type multipage form.
  6.  * 
  7.  * PHP versions 4 and 5
  8.  *
  9.  * LICENSE: This source file is subject to version 3.01 of the PHP license
  10.  * that is available through the world-wide-web at the following URI:
  11.  * http://www.php.net/license/3_01.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_Controller
  17.  * @author      Alexey Borzov <avb@php.net>
  18.  * @copyright   2003-2007 The PHP Group
  19.  * @license     http://www.php.net/license/3_01.txt PHP License 3.01
  20.  * @version     CVS: $Id: Next.php,v 1.6 2007/05/18 09:34:18 avb Exp $
  21.  * @link        http://pear.php.net/package/HTML_QuickForm_Controller
  22.  */
  23.  
  24. /**
  25.  * Class representing an action to perform on HTTP request.
  26.  */
  27. require_once 'HTML/QuickForm/Action.php';
  28.  
  29. /**
  30.  * The action for a 'next' button of wizard-type multipage form.
  31.  *
  32.  * @category    HTML
  33.  * @package     HTML_QuickForm_Controller
  34.  * @author      Alexey Borzov <avb@php.net>
  35.  * @version     Release: 1.0.9
  36.  */
  37. {
  38.     function perform(&$page$actionName)
  39.     {
  40.         // save the form values and validation status to the session
  41.         $page->isFormBuilt(or $page->buildForm();
  42.         $pageName =  $page->getAttribute('id');
  43.         $data     =$page->controller->container();
  44.         $data['values'][$pageName$page->exportValues();
  45.         if (PEAR::isError($valid $page->validate())) {
  46.             return $valid;
  47.         }
  48.         $data['valid'][$pageName$valid;
  49.  
  50.         // Modal form and page is invalid: don't go further
  51.         if ($page->controller->isModal(&& !$data['valid'][$pageName]{
  52.             return $page->handle('display');
  53.         }
  54.         // More pages?
  55.         if (null !== ($nextName $page->controller->getNextName($pageName))) {
  56.             $next =$page->controller->getPage($nextName);
  57.             return $next->handle('jump');
  58.         // Consider this a 'finish' button, if there is no explicit one
  59.         elseif($page->controller->isModal()) {
  60.             if ($page->controller->isValid()) {
  61.                 return $page->handle('process');
  62.             else {
  63.                 // this should redirect to the first invalid page
  64.                 return $page->handle('jump');
  65.             }
  66.         else {
  67.             return $page->handle('display');
  68.         }
  69.     }
  70. }
  71.  
  72. ?>

Documentation generated on Tue, 22 Jul 2008 08:00:07 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.