Examples TOCexamples

Hide progress bar

$Date: 2005/07/25 11:23:37 $

 Table of contents

Introduction

This example requires :


This example will hide a progress meter at end of a initialize process.

The initialize process is simulate by the user callback defined on lines 16 to 19. This callback is attached on the progress bar at line 24.

Finally when process is over, we hide the progress bar at line 54.

[Top]

 Render options

[Top]

 PHP source syntax highlight

  1. <?php
  2. /**
  3.  * Simple example that hide a progress meter at end of process.
  4.  *
  5.  * @version    $Id: hidden.php,v 1.2 2005/07/25 11:23:37 farell Exp $
  6.  * @author     Laurent Laville <pear@laurent-laville.org>
  7.  * @package    HTML_Progress
  8.  * @subpackage Examples
  9.  */
  10.  
  11. require_once 'HTML/Progress.php';
  12.  
  13. /*
  14.     user callback: job to do while the progress meter is visible
  15.  */
  16. function myFunctionHandler($progressValue, &$obj)
  17. {
  18.     $obj->sleep();  // nothing to do here, except sleep a bit ...
  19. }
  20.  
  21. $progress = new HTML_Progress();
  22. $progress->setAnimSpeed(100);
  23. $progress->setIncrement(10);
  24. $progress->setProgressHandler('myFunctionHandler');
  25. ?>
  26. <html>
  27. <head>
  28. <style type="text/css">
  29. <!--
  30. body {
  31.     background-color: #CCCC99;
  32.     color: #996;
  33.     font-family: Verdana, Arial;
  34. }
  35.  
  36. a:visited, a:active, a:link {
  37.     color: yellow;
  38. }
  39.  
  40. <?php echo $progress->getStyle(); ?>
  41. // -->
  42. </style>
  43. <script type="text/javascript">
  44. <!--
  45. <?php echo $progress->getScript(); ?>
  46. //-->
  47. </script>
  48. </head>
  49. <body>
  50.  
  51. <?php
  52. echo $progress->toHtml();
  53. $progress->run();
  54. $progress->hide();
  55. ?>
  56.  
  57. <h1>Your job is finished ! </h1>
  58. <p>The progress meter is now hidden.</p>
  59.  
  60. </body>
  61. </html>

[Top]