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

Source for file constructor_model.php

Documentation is available at constructor_model.php

  1. <?php 
  2. @include '../../include_path.php';
  3. /**
  4.  * ProgressBar model example.
  5.  * 
  6.  * @version    $Id: constructor_model.php,v 1.2 2004/04/18 13:25:43 farell Exp $
  7.  * @author     Laurent Laville <pear@laurent-laville.org>
  8.  * @package    HTML_Progress
  9.  */
  10.  
  11. require_once 'HTML/Progress.php';
  12.  
  13. {
  14.     function TimerProgress()
  15.     {       
  16.         $this->HTML_Progress_DM(0,60,5);
  17.     }
  18. }
  19.  
  20. $timer = new TimerProgress();
  21. $bar = new HTML_Progress($timer);
  22. $bar->setAnimSpeed(100);
  23. $bar->setStringPainted(true);          // get space for the string
  24. $bar->setString('');                   // but don't paint it
  25.  
  26. $ui =$bar->getUI();
  27. $ui->setStringAttributes('width=170 height=20 valign=bottom align=center');
  28. ?>
  29. <html>
  30. <head>
  31. <title>ProgressBar model example</title>
  32. <style type="text/css">
  33. <!--
  34. <?php echo $bar->getStyle()?>
  35.  
  36. body {
  37.     background-color: #FFFFFF;
  38.     color: #000000;
  39.     font-family: Verdana, Arial;
  40. }
  41.  
  42. a:visited, a:active, a:link {
  43.     color: navy;
  44. }
  45. // -->
  46. </style>
  47. <script type="text/javascript">
  48. <!--
  49. <?php echo $bar->getScript()?>
  50. //-->
  51. </script>
  52. </head>
  53. <body>
  54. <h1><?php echo basename(__FILE__)?></h1>
  55.  
  56. <?php 
  57. echo $bar->toHtml()
  58.  
  59. do {
  60.     $bar->display();
  61.     if ($bar->getPercentComplete(== 1{
  62.         $bar->setString('All done!');
  63.         $bar->display();
  64.         break;   // the progress bar has reached 100%
  65.     }
  66.     if ($bar->getPercentComplete(== 0.25{
  67.         $bar->setString('Fourth part way done!');
  68.     }
  69.     if ($bar->getPercentComplete(== 0.5{
  70.         $bar->setString('Half way done!');
  71.     }
  72.     if ($bar->getPercentComplete(== 0.75{
  73.         $bar->setString('Three quarters way done!');
  74.     }
  75.     $bar->incValue();
  76. while(1);
  77. ?>
  78.  
  79. <p>&lt;&lt; <a href="index.html">Back examples TOC</a></p>
  80.  
  81. <h2>print_r </h2>
  82. <pre>
  83. <?php 
  84. print_r($bar->toArray())
  85. ?>
  86. </pre>
  87.  
  88. </body>
  89. </html>

Documentation generated on Mon, 11 Mar 2019 10:15:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.