Examples TOCexamples

Rectangle Back

$Date: 2005/07/25 11:19:41 $

 Table of contents

Introduction

This example requires :


This example will run a polygonal (rectangle 15x3) ProgressBar filled in reverse way.

Cell coordinates are pre-computed (line 27) but free x-y-grid coordinates are also possible. Percent text info is right aligned on a white background area of 50 pixels width, at right side of polygonal shape (default).

[Top]

 Render options

Here are options to build the progress bar cells :
active-color   = red
inactive-color = orange
width          = 10
height         = 10
HTML_Progress_UI::setCellAttributes()

[Top]

 Output

Screenshot

[Top]

 PHP source syntax highlight

  1. <?php
  2. /**
  3.  * Reverse Rectangle Progress example.
  4.  *
  5.  * @version    $Id: rectangleback.php,v 1.2 2005/07/25 11:19:41 farell Exp $
  6.  * @author     Laurent Laville <pear@laurent-laville.org>
  7.  * @package    HTML_Progress
  8.  * @subpackage Examples
  9.  */
  10.  
  11. require_once 'HTML/Progress.php';
  12.  
  13. $bar = new HTML_Progress();
  14. $bar->setAnimSpeed(100);
  15. $bar->setIncrement(10);
  16.  
  17. $ui =& $bar->getUI();
  18. $ui->setTab('    ');
  19. $ui->setFillWay('reverse');
  20. $ui->setOrientation(HTML_PROGRESS_POLYGONAL);
  21. $ui->setCellAttributes(array(
  22.     'width'  => 10,
  23.     'height' => 10,
  24.     'active-color'   => 'red',
  25.     'inactive-color' => 'orange',
  26. ));
  27. $ui->setCellCoordinates(15,3);         // Rectangle 15x3
  28. ?>
  29. <html>
  30. <head>
  31. <title>Reverse Rectangle ProgressBar example</title>
  32. <style type="text/css">
  33. <!--
  34. <?php echo $bar->getStyle(); ?>
  35.  
  36. body {
  37.     background-color: #FFFFFF;
  38.     color: #000000;
  39.     font-family: Verdana, Arial;
  40. }
  41.  
  42. a:visited, a:active, a:link {
  43.     color: navy;
  44. }
  45. // -->
  46. </style>
  47. <script type="text/javascript">
  48. <!--
  49. <?php echo $ui->getScript(); ?>
  50. //-->
  51. </script>
  52. </head>
  53. <body>
  54.  
  55. <?php
  56. echo $bar->toHtml();
  57. $bar->run();
  58. ?>
  59.  
  60. </body>
  61. </html>

[Top]