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

setIndeterminate Manual

sets the current value of the progress string

by by Laurent Laville
mailto:pear@laurent-laville.org
November 2003, Laurent Laville
(HTML_Progress 1.0+)

Synopsis

void setIndeterminate( $continuous )

Attributes

Name Type
continuous boolean

Description

The setIndeterminate() method is used to switch the progress abr in indeterminate mode. Read Using Indeterminate Mode to learn how to animate a progress bar to show unknown length-task activity.

Example

Look and feel of indeterminate mode used with HTML_Progress_Monitor.

  1. <?php 
  2. require_once ('HTML/Progress.php');
  3.  
  4. $bar = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
  5. $bar->setAnimSpeed(80);
  6. $bar->setIdent('PB1');
  7. $bar->setIncrement(10);
  8. $bar->setBorderPainted(true);
  9. $bar->setStringPainted(true);    // get space for the string
  10. $bar->setString("");             // but don't paint it
  11. $bar->setIndeterminate(true);    // progress start in indeterminate mode
  12.  
  13. $ui =$bar->getUI();
  14. $ui->setCellAttributes('active-color=#970038 inactive-color=#FFDDAA width=50 height=13');
  15. $ui->setBorderAttributes('width=1 color=#000000');
  16. $ui->setStringAttributes(array(
  17.     'font-size' => 8,
  18.     'color' => '#FF0000',
  19.     'background-color' => '#C3C6C3',
  20.     'align' => 'center'
  21.     'valign' => 'bottom'
  22. ));
  23. ?>
  24. <!DOCTYPE html
  25.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  26.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  27.  
  28. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  29. <head>
  30. <title>setIndeterminate example</title>
  31. <style type="text/css">
  32. <!--
  33. <?php echo $bar->getStyle()?>
  34.  
  35. body {
  36.     background-color: #C3C6C3;
  37.     color: #000000;
  38.     font-family: Verdana, Arial;
  39. }
  40. // -->
  41. </style>
  42. <script type="text/javascript">
  43. <!--
  44. <?php echo $bar->getScript()?>
  45. //-->
  46. </script>
  47. </head>
  48. <body>
  49.  
  50. <?php 
  51. echo $bar->toHtml();
  52.  
  53. $loop = 0;
  54.  
  55. do {
  56.     $bar->display();
  57.  
  58.     if ($bar->getPercentComplete(== 1{
  59.         $loop++;
  60.         if ($bar->isIndeterminate()) {
  61.             $bar->setValue(0);
  62.         else {
  63.             break;      // progress bar reached 100% in determinate mode
  64.         }
  65.     else {
  66.         $bar->incValue();
  67.     }
  68.  
  69.     /** rule to decide when to switch back to determinate mode
  70.      *  - after two full loops and half one
  71.      */       
  72.     if ($bar->isIndeterminate()) {
  73.         if ($loop == 2 && $bar->getValue(== 50{
  74.             $bar->setIndeterminate(false);  
  75.             $bar->setString(null);         // display % string
  76.             $bar->setValue(0);
  77.         }
  78.     }
  79.  
  80. while(1);
  81. ?>
  82.  
  83. </body>
  84. </html>

See Also

isIndeterminate Manual

Prev Up Next
isIndeterminate Manual Reference Guides getListeners Manual

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