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 / Progress2 / Generator / Preview.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  3.5 KB  |  91 lines

  1. <?php
  2. /**
  3.  * Copyright (c) 2005-2008, Laurent Laville <pear@laurent-laville.org>
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  *     * Redistributions of source code must retain the above copyright
  12.  *       notice, this list of conditions and the following disclaimer.
  13.  *     * Redistributions in binary form must reproduce the above copyright
  14.  *       notice, this list of conditions and the following disclaimer in the
  15.  *       documentation and/or other materials provided with the distribution.
  16.  *     * Neither the name of the authors nor the names of its contributors
  17.  *       may be used to endorse or promote products derived from this software
  18.  *       without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * PHP versions 4 and 5
  33.  *
  34.  * @category  HTML
  35.  * @package   HTML_Progress2
  36.  * @author    Laurent Laville <pear@laurent-laville.org>
  37.  * @copyright 2005-2008 Laurent Laville
  38.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  39.  * @version   CVS: $Id: Preview.php,v 1.9 2008/03/20 21:27:55 farell Exp $
  40.  * @link      http://pear.php.net/package/HTML_Progress2
  41.  * @since     File available since Release 2.0.0RC1
  42.  */
  43.  
  44.  
  45. /**
  46.  * The ActionPreview class provides a live demonstration
  47.  * of the progress bar built by HTML_Progress2_Generator.
  48.  *
  49.  * @category  HTML
  50.  * @package   HTML_Progress2
  51.  * @author    Laurent Laville <pear@laurent-laville.org>
  52.  * @copyright 2005-2008 Laurent Laville
  53.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  54.  * @version   Release: 2.4.0
  55.  * @link      http://pear.php.net/package/HTML_Progress2
  56.  * @since     Class available since Release 2.0.0RC1
  57.  */
  58.  
  59. class ActionPreview extends HTML_QuickForm_Action
  60. {
  61.     /**
  62.      * Performs an action on a page of the controller (wizard)
  63.      *
  64.      * @param string &$page      current page displayed by the controller
  65.      * @param string $actionName page action asked
  66.      *
  67.      * @return     void
  68.      * @since      version 2.0.0 (2005-10-01)
  69.      * @access     public
  70.      */
  71.     function perform(&$page, $actionName)
  72.     {
  73.         // like in Action_Next
  74.         $page->isFormBuilt() or $page->buildForm();
  75.         $page->handle('display');
  76.  
  77.         $stringid = $page->controller->exportValue('page4', 'stringid');
  78.         $bar      = $page->controller->createProgressBar();
  79.  
  80.         do {
  81.             $percent = $bar->getPercentComplete();
  82.             if ($percent == 1) {
  83.                 break;   // the progress bar has reached 100%
  84.             }
  85.             $bar->sleep();
  86.             $bar->moveNext();
  87.         } while (1);
  88.  
  89.     }
  90. }
  91. ?>