HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next
HTML_Progress_UI::setOrientation
sets the orientation of the progress meter

Synopsis

require_once 'HTML/Progress/UI.php';

void HTML_Progress_UI::setOrientation( integer $orient)

Description

This method is used to change orientation of the progress meter in one step.

It could be:

Orientation Use constant
horizontal HTML_PROGRESS_BAR_HORIZONTAL
vertical HTML_PROGRESS_BAR_VERTICAL
polygonal (square, rectangle) HTML_PROGRESS_POLYGONAL
circle, ellipse HTML_PROGRESS_CIRCLE

Parameter

    integer $orient
  • the new progress meter orientation.

Throws

Possible PEAR_Error values

Error level Error code Error message Solution
exception HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #1 "$orient" was expecting "integer" Fixed the cast of parameter
error HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #1 "$orient" was expecting "1|2|3|4" Expected one of these constants:

  1. HTML_PROGRESS_BAR_HORIZONTAL
  2. HTML_PROGRESS_BAR_VERTICAL
  3. HTML_PROGRESS_POLYGONAL
  4. HTML_PROGRESS_CIRCLE

Note

( HTML_Progress >= 1.0 )

This function can not be called statically.

Parameter $orient is an integer which identify only 2 shapes (in version 1.0): Horizontal and Vertical progress bars. Polygonal and Circle shapes are available only since version 1.2.0RC1.

See

HTML_Progress_UI::getOrientation

Example

Example below (that requires HTML_Progress >= 1.2.0RC3) will produced a vertical progress bar (see line 11) 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>setOrientation 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. $bar->run();
  59. ?>
  60.  
  61. </body>
  62. </html>

Prev Up Next
HTML_Progress_UI::getOrientation Reference Guide HTML_Progress_UI::getFillWay

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