Examples TOCexamples

Square Back

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

 Table of contents

Introduction

This example requires :


This example will run a polygonal (square 4x4) ProgressBar filled in reverse way.

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

[Top]

 Render options

Here are options to build this progress bar string (percent text info):
valign = left
align  = center
HTML_Progress_UI::setStringAttributes()
Here are options to build the progress bar cells :
width  = 10
height = 10
HTML_Progress_UI::setCellAttributes()

[Top]

 Output

Screenshot

[Top]

 PHP source syntax highlight

  1. <?php
  2. /**
  3.  * Reverse Square Progress example.
  4.  *
  5.  * @version    $Id: squareback.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->setStringAttributes('valign=left align=center');
  19. $ui->setFillWay('reverse');
  20. $ui->setOrientation(HTML_PROGRESS_POLYGONAL);
  21. $ui->setCellAttributes('width=10 height=10');
  22. $ui->setCellCoordinates(4,4);          // square 4x4
  23. ?>
  24. <html>
  25. <head>
  26. <title>Reverse Square Progress example</title>
  27. <style type="text/css">
  28. <!--
  29. <?php echo $bar->getStyle(); ?>
  30.  
  31. body {
  32.     background-color: #FFFFFF;
  33.     color: #000000;
  34.     font-family: Verdana, Arial;
  35. }
  36.  
  37. a:visited, a:active, a:link {
  38.     color: navy;
  39. }
  40. // -->
  41. </style>
  42. <script type="text/javascript">
  43. <!--
  44. <?php echo $ui->getScript(); ?>
  45. //-->
  46. </script>
  47. </head>
  48. <body>
  49.  
  50. <?php
  51. echo $bar->toHtml();
  52. $bar->run();
  53. ?>
  54.  
  55. </body>
  56. </html>

[Top]