home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / QuickForm / Action / Jump.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  2.4 KB  |  65 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * This action performs HTTP redirect to a specific page.
  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: Jump.php,v 1.5 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 performs HTTP redirect to a specific page.
  31.  * 
  32.  * @category    HTML
  33.  * @package     HTML_QuickForm_Controller
  34.  * @author      Alexey Borzov <avb@php.net>
  35.  * @version     Release: 1.0.8
  36.  */
  37. class HTML_QuickForm_Action_Jump extends HTML_QuickForm_Action
  38. {
  39.     function perform(&$page, $actionName)
  40.     {
  41.         // check whether the page is valid before trying to go to it
  42.         if ($page->controller->isModal()) {
  43.             // we check whether *all* pages up to current are valid
  44.             // if there is an invalid page we go to it, instead of the
  45.             // requested one
  46.             $pageName = $page->getAttribute('id');
  47.             if (!$page->controller->isValid($pageName)) {
  48.                 $pageName = $page->controller->findInvalid();
  49.             }
  50.             $current =& $page->controller->getPage($pageName);
  51.  
  52.         } else {
  53.             $current =& $page;
  54.         }
  55.         // generate the URL for the page 'display' event and redirect to it
  56.         $action = $current->getAttribute('action');
  57.         $url    = $action . (false === strpos($action, '?')? '?': '&') .
  58.                   $current->getButtonName('display') . '=true' .
  59.                   ((!defined('SID') || '' == SID || ini_get('session.use_only_cookies'))? '': '&' . SID);
  60.         header('Location: ' . $url);
  61.         exit;
  62.     }
  63. }
  64. ?>
  65.