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

Source for file Display.php

Documentation is available at Display.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * This action handles output of the 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: Display.php,v 1.7 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.  * This action handles output of the form.
  31.  *
  32.  * If you want to customize the form display, subclass this class and
  33.  * override the _renderForm() method, you don't need to change the perform()
  34.  * method itself.
  35.  *
  36.  * @category    HTML
  37.  * @package     HTML_QuickForm_Controller
  38.  * @author      Alexey Borzov <avb@php.net>
  39.  * @version     Release: 1.0.9
  40.  */
  41. {
  42.     function perform(&$page$actionName)
  43.     {
  44.         $pageName $page->getAttribute('id');
  45.         // If the original action was 'display' and we have values in container then we load them
  46.         // BTW, if the page was invalid, we should later call validate() to get the errors
  47.         list($oldName$page->controller->getActionName();
  48.         if ('display' == $oldName{
  49.             // If the controller is "modal" we should not allow direct access to a page
  50.             // unless all previous pages are valid (see also bug #2323)
  51.             if ($page->controller->isModal(&& !$page->controller->isValid($page->getAttribute('id'))) {
  52.                 $target =$page->controller->getPage($page->controller->findInvalid());
  53.                 return $target->handle('jump');
  54.             }
  55.             $data =$page->controller->container();
  56.             if (!empty($data['values'][$pageName])) {
  57.                 $page->loadValues($data['values'][$pageName]);
  58.                 $validate = false === $data['valid'][$pageName];
  59.             }
  60.         }
  61.         // set "common" defaults and constants
  62.         $page->controller->applyDefaults($pageName);
  63.         $page->isFormBuilt(or $page->buildForm();
  64.         // if we had errors we should show them again
  65.         if (isset($validate&& $validate{
  66.             if (PEAR::isError($err $page->validate())) {
  67.                 return $err;
  68.             }
  69.         }
  70.         return $this->_renderForm($page);
  71.     }
  72.  
  73.  
  74.    /**
  75.     * Actually outputs the form.
  76.     *
  77.     * If you want to customize the form's appearance (you most certainly will),
  78.     * then you should override this method. There is no need to override perform()
  79.     *
  80.     * @access private
  81.     * @param  HTML_QuickForm_Page  the page being processed
  82.     */
  83.     function _renderForm(&$page)
  84.     {
  85.         $page->display();
  86.     }
  87. }
  88. ?>

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