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: */
  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: Display.php 6184 2005-09-07 10:08:17Z bmol $
  20.  
  21. require_once 'HTML/QuickForm/Action.php';
  22.  
  23. /**
  24.  * This action handles the output of the form.
  25.  * 
  26.  * If you want to customize the form display, subclass this class and
  27.  * override the _renderForm() method, you don't need to change the perform()
  28.  * method itself.
  29.  * 
  30.  * @author  Alexey Borzov <avb@php.net>
  31.  * @package HTML_QuickForm_Controller
  32.  * @version $Revision: 6184 $
  33.  */
  34. {
  35.     function perform(&$page$actionName)
  36.     {
  37.         $pageName $page->getAttribute('id');
  38.         // If the original action was 'display' and we have values in container then we load them
  39.         // BTW, if the page was invalid, we should later call validate() to get the errors
  40.         list($oldName$page->controller->getActionName();
  41.         if ('display' == $oldName{
  42.             // If the controller is "modal" we should not allow direct access to a page
  43.             // unless all previous pages are valid (see also bug #2323)
  44.             if ($page->controller->isModal(&& !$page->controller->isValid($page->getAttribute('id'))) {
  45.                 $target =$page->controller->getPage($page->controller->findInvalid());
  46.                 return $target->handle('jump');
  47.             }
  48.             $data =$page->controller->container();
  49.             if (!empty($data['values'][$pageName])) {
  50.                 $page->loadValues($data['values'][$pageName]);
  51.                 $validate false === $data['valid'][$pageName];
  52.             }
  53.         }
  54.         // set "common" defaults and constants
  55.         $page->controller->applyDefaults($pageName);
  56.         $page->isFormBuilt(or $page->buildForm();
  57.         // if we had errors we should show them again
  58.         if (isset($validate&& $validate{
  59.             $page->validate();
  60.         }
  61.         return $this->_renderForm($page);
  62.     }
  63.  
  64.  
  65.    /**
  66.     * Actually outputs the form.
  67.     * 
  68.     * If you want to customize the form's appearance (you most certainly will),
  69.     * then you should override this method. There is no need to override perform()
  70.     * 
  71.     * @access public
  72.     * @param  object HTML_QuickForm_Page  the page being processed
  73.     */
  74.     function _renderForm(&$page)
  75.     {
  76.         $page->display();
  77.     }
  78. }
  79. ?>

Documentation generated on Thu, 12 Jun 2008 13:18:56 -0500 by phpDocumentor 1.4.1