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

Source for file preview.php

Documentation is available at preview.php

  1. <?php
  2. // +----------------------------------------------------------------------+
  3. // | PEAR :: HTML :: Progress                                             |
  4. // +----------------------------------------------------------------------+
  5. // | Copyright (c) 1997-2004 The PHP Group                                |
  6. // +----------------------------------------------------------------------+
  7. // | This source file is subject to version 3.0 of the PHP license,       |
  8. // | that is bundled with this package in the file LICENSE, and is        |
  9. // | available at through the world-wide-web at                           |
  10. // | http://www.php.net/license/3_0.txt.                                  |
  11. // | If you did not receive a copy of the PHP license and are unable to   |
  12. // | obtain it through the world-wide-web, please send a note to          |
  13. // | license@php.net so we can mail you a copy immediately.               |
  14. // +----------------------------------------------------------------------+
  15. // | Author: Laurent Laville <pear@laurent-laville.org>                   |
  16. // +----------------------------------------------------------------------+
  17. //
  18. // $Id: preview.php,v 1.4 2004/07/05 22:04:15 farell Exp $
  19.  
  20. /**
  21.  * The ActionPreview class provides a live demonstration
  22.  * of the progress bar built by HTML_Progress_Generator.
  23.  *
  24.  * @version    1.2.0
  25.  * @author     Laurent Laville <pear@laurent-laville.org>
  26.  * @access     public
  27.  * @package    HTML_Progress
  28.  * @subpackage Progress_UI
  29.  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  30.  */
  31.  
  32. class ActionPreview extends HTML_QuickForm_Action
  33. {
  34.     function perform(&$page$actionName)
  35.     {
  36.         // like in Action_Next
  37.         $page->isFormBuilt(or $page->buildForm();
  38.         $page->handle('display');
  39.  
  40.         $strings $page->controller->exportValue('page4','strings');
  41.         $bar $page->controller->createProgressBar();
  42.  
  43.         do {
  44.             $percent $bar->getPercentComplete();
  45.             if ($bar->isStringPainted()) {
  46.                 if (substr($strings-1== ";"{
  47.                     $str explode(";"$strings);
  48.                 else {
  49.                     $str explode(";"$strings.";");
  50.                 }
  51.                 for ($i=0; $i<count($str)-1; $i++{
  52.                     list ($p$sexplode(","$str[$i]);
  53.                     if ($percent == floatval($p)/100{
  54.                         $bar->setString(trim($s));
  55.                     }
  56.                 }
  57.             }
  58.             $bar->display();
  59.             if ($percent == 1{
  60.                 break;   // the progress bar has reached 100%
  61.             }
  62.             $bar->sleep();
  63.             $bar->incValue();
  64.         while(1);
  65.     }
  66. }
  67. ?>

Documentation generated on Mon, 11 Mar 2019 13:52:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.