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

Source for file model.php

Documentation is available at model.php

  1. <?php 
  2. @include '../include_path.php';
  3. /**
  4.  * ProgressBar model example.
  5.  * 
  6.  * @version    $Id: model.php,v 1.1 2004/07/05 21:32:09 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. function myFunctionHandler($progressValue&$obj)
  21. {
  22.     if ($obj->getPercentComplete(== 0.25{
  23.         $obj->setString('Fourth part way done!');
  24.     }
  25.     if ($obj->getPercentComplete(== 0.5{
  26.         $obj->setString('Half way done!');
  27.     }
  28.     if ($obj->getPercentComplete(== 0.75{
  29.         $obj->setString('Three quarters way done!');
  30.     }
  31.     if ($obj->getPercentComplete(== 1{
  32.         $obj->setString('All done!');
  33.         $obj->display();
  34.     else {
  35.         $obj->sleep();
  36.     }
  37. }
  38.  
  39. $timer = new TimerProgress();
  40. $bar = new HTML_Progress($timer);
  41. $bar->setAnimSpeed(100);
  42. $bar->setStringPainted(true);          // get space for the string
  43. $bar->setString('');                   // but don't paint it
  44. $bar->setProgressHandler('myFunctionHandler');
  45.  
  46. $ui =$bar->getUI();
  47. $ui->setStringAttributes('width=170 height=20 valign=bottom align=center');
  48. ?>
  49. <html>
  50. <head>
  51. <title>ProgressBar model example</title>
  52. <style type="text/css">
  53. <!--
  54. <?php echo $bar->getStyle()?>
  55.  
  56. body {
  57.     background-color: #FFFFFF;
  58.     color: #000000;
  59.     font-family: Verdana, Arial;
  60. }
  61.  
  62. a:visited, a:active, a:link {
  63.     color: navy;
  64. }
  65. // -->
  66. </style>
  67. <script type="text/javascript">
  68. <!--
  69. <?php echo $bar->getScript()?>
  70. //-->
  71. </script>
  72. </head>
  73. <body>
  74. <h1><?php echo basename(__FILE__)?></h1>
  75.  
  76. <?php 
  77. echo $bar->toHtml()
  78. $bar->run();
  79. ?>
  80.  
  81. <p>&lt;&lt; <a href="../index.html">Back examples TOC</a></p>
  82.  
  83. </body>
  84. </html>

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