HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next
HTML_Progress::setIndeterminate
sets the execution mode of the progress meter

Synopsis

require_once 'HTML/Progress.php';

void HTML_Progress::setIndeterminate( bool $continuous)

Description

This method is used to switch the progress bar in indeterminate mode.

Parameter

    boolean $continuous
  • whether countinuously displays animation.

Throws

Possible PEAR_Error values

Error level Error code Error message Solution
exception HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #1 "$continuous" was expecting "boolean" Fixed the cast of parameter

Note

( HTML_Progress >= 1.0 )

This function can not be called statically.

Read indeterminate.pkg to learn how to animate a progress bar to show unknown length-task activity.

See

HTML_Progress::isIndeterminate

Example

Example below (that requires HTML_Progress >= 1.2.0RC3) will produced a progress bar with 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. $bar->sleep(); // for purpose of demo only
  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>

Prev Up Next
HTML_Progress::isIndeterminate Reference Guide HTML_Progress::addListener

Documentation generated on Sun, 12 Sep 2004 20:23:12 +0200 by phpDocumentor 1.3.0RC3