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

setOrientation Manual

defines the orientation of the progress bar

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

Synopsis

void setOrientation( $orient )

Attributes

Name Type Default
orient  integer   HTML_PROGRESS_BAR_HORIZONTAL | [ HTML_PROGRESS_BAR_VERTICAL ] 

$orient is an integer with identify, actually in version 1.0, only 2 shapes, Horizontal and Vertical Progress Bars.

Description

The setOrientation() method is used to change orientation of the progress bar after you invoked the constructor. For example, you can swap from a horizontal progress bar to a vertical one, by only one call such as: setOrientation(HTML_PROGRESS_BAR_VERTICAL).

Example

Example below will produced a vertical progress bar with only 6 cells. It's a dynamic example, the progress bar will run.

  1. <?php
  2. require_once ('HTML/Progress.php');
  3.  
  4. $bar = new HTML_Progress();
  5. $bar->setAnimSpeed(100);
  6. $bar->setIdent('PB1');
  7. $bar->setIncrement(10);
  8. $bar->setBorderPainted(true);
  9.  
  10. $ui =$bar->getUI();
  11. $ui->setOrientation(HTML_PROGRESS_BAR_VERTICAL);
  12. $ui->setFillWay('natural');
  13. $ui->setCellCount(6);
  14. $ui->setCellAttributes(array(
  15.     'active-color' => '#970038',
  16.     'inactive-color' => '#FFDDAA',
  17.     'width' => 50,
  18.     'height' => 13
  19. ));
  20. $ui->setBorderAttributes('width=1');
  21. $ui->setStringAttributes(array(
  22.     'font-size' => 8,
  23.     'color' => '#FF0000',
  24.     'background-color' => '#C3C6C3',
  25.     'align' => 'center'
  26.     'valign' => 'bottom'
  27. ));
  28.  
  29. ?>
  30. <!DOCTYPE html
  31.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  32.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  33.  
  34. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  35. <head>
  36. <title>Progress example</title>
  37. <style type="text/css">
  38. <!--
  39. <?php echo $bar->getStyle()?>
  40.  
  41. body {
  42.     background-color: #C3C6C3;
  43.     color: #000000;
  44.     font-family: Verdana, Arial;
  45. }
  46. // -->
  47. </style>
  48. <script type="text/javascript">
  49. <!--
  50. <?php echo $bar->getScript()?>
  51. //-->
  52. </script>
  53. </head>
  54. <body>
  55.  
  56. <?php 
  57. echo $bar->toHtml()
  58.  
  59. do {
  60.     $bar->display();
  61.     if ($bar->getPercentComplete(== 1{
  62.         break;   // the progress bar has reached 100%
  63.     }
  64.     $bar->incValue();
  65. while(1);
  66. ?>
  67.  
  68. </body>
  69. </html>

See Also

To display a progress bar filled in reverse order, have a look on setFillWay Manual

Prev   Next
setCellAttributes Manual

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