home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / horizontal_string.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.8 KB  |  83 lines

  1. <?php 
  2. /**
  3.  * Horizontal String ProgressBar example.
  4.  * 
  5.  * @version    $Id: horizontal_string.php,v 1.1 2003/11/15 18:27:10 thesaur Exp $
  6.  * @author     Laurent Laville <pear@laurent-laville.org>
  7.  * @package    HTML_Progress
  8.  */
  9.  
  10. require_once ('HTML/Progress.php');
  11.  
  12. $bar = new HTML_Progress();
  13. $bar->setIncrement(5);
  14. $bar->setStringPainted(true);          // get space for the string
  15. $bar->setString('');                   // but don't paint it
  16.  
  17. $ui =& $bar->getUI();
  18. $ui->setStringAttributes('width=350 align=left');
  19.  
  20. ?>
  21. <!DOCTYPE html
  22.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  23.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  24.  
  25. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  26. <head>
  27. <title>Horizontal String ProgressBar example</title>
  28. <style type="text/css">
  29. <!--
  30. <?php echo $bar->getStyle(); ?>
  31.  
  32. body {
  33.     background-color: #FFFFFF;
  34.     color: #000000;
  35.     font-family: Verdana, Arial;
  36. }
  37.  
  38. a:visited, a:active, a:link {
  39.     color: navy;
  40. }
  41. // -->
  42. </style>
  43. <script type="text/javascript">
  44. <!--
  45. <?php echo $bar->getScript(); ?>
  46. //-->
  47. </script>
  48. </head>
  49. <body>
  50. <h1><?php echo basename(__FILE__); ?></h1>
  51.  
  52. <?php 
  53. echo $bar->toHtml(); 
  54.  
  55. $pkg = array('PEAR', 'Archive_Tar', 'Config', 
  56.     'HTML_QuickForm', 'HTML_CSS', 'HTML_Page', 'HTML_Template_Sigma', 
  57.     'Log', 'MDB', 'PHPUnit');
  58.  
  59. do {
  60.     $val = $bar->getValue();
  61.     $i = floor($val / 10);
  62.     $msg = ($val == 100) ? '' : "  installing package ($val %) ... : ".$pkg[$i];
  63.     $bar->setString($msg);
  64.  
  65.     $bar->display();
  66.     if ($bar->getPercentComplete() == 1) {
  67.         break;   // the progress bar has reached 100%
  68.     }
  69.     $bar->incValue();
  70. } while(1);
  71. ?>
  72.  
  73. <p><< <a href="index.html">Back examples TOC</a></p>
  74.  
  75. <h2>print_r </h2>
  76. <pre>
  77. <?php 
  78. print_r($bar->toArray()); 
  79. ?>
  80. </pre>
  81.  
  82. </body>
  83. </html>