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

setFillWay Manual

decides how the progress bar will be filled

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

Synopsis

void setFillWay( $way )

Attributes

Name Type Default
way  string   natural | [ reverse ]  

Description

The setFillWay() method is used to change the fill way of the progress bar. It could be natural (left to right for horizontal progress bar), (down to up for vertical progress bar) or reverse (right to left for horizontal progress bar), (up to down for vertical progress bar).

Example

Example below will produced a vertical progress bar with only 5 cells filled in reverse order. It's a dynamic example, the progress bar will run.

  1. <?php
  2. require_once ('HTML/Progress.php');
  3.  
  4. $bar = new HTML_Progress(HTML_PROGRESS_BAR_VERTICAL);
  5. $bar->setAnimSpeed(100);
  6. $bar->setIdent('PB1');
  7. $bar->setIncrement(10);
  8.  
  9. $ui =$bar->getUI();
  10. $ui->setComment('Reverse ProgressBar example');
  11. $ui->setTabOffset(1);
  12. $ui->setFillWay('reverse');
  13. $ui->setCellCount(5);
  14. $ui->setProgressAttributes(array(
  15.     'background-color' => '#e0e0e0'
  16. ));        
  17. $ui->setStringAttributes(array(
  18.     'valign' => 'left',
  19.     'color'  => 'red',
  20.     'background-color' => 'lightblue'
  21.     ));
  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>Progress example</title>
  31. <style type="text/css">
  32. <!--
  33. <?php echo $bar->getStyle()?>
  34.  
  35. body {
  36.     background-color: lightblue;
  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. do {
  54.     $bar->display();
  55.     if ($bar->getPercentComplete(== 1{
  56.         break;   // the progress bar has reached 100%
  57.     }
  58.     $bar->incValue();
  59. while(1);
  60. ?>
  61.  
  62. </body>
  63. </html>

See Also

To display a vertical progress bar, see setOrientation Manual

Prev   Next
setCellCount Manual setStringAttributes Manual

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