SquareBack

Overview

This example will run a progress meter (square 4x4) filled in reverse way.

Screenshot

sample screenshot

Demonstration

Give it a try

Dependencies

This example requires mandatory resources :

And also but optional :

Explains step by step

The progress meter wait 200ms (line 14) between each step of 10% (line 15).

There are 12 cells 10x10 organized into polygonal shape (lines 17-18), a basic square 4x4 (line 20) :

Property Value Default
active-color   #006600
inactive-color   #CCCCCC
width 10 15
height 10 20
spacing   2
See also :

And the progress percent text info is center aligned on left side (line 19):

Property Value Default
left   5
top 15 5
width   50
height   0
align center right
valign left right
background-color   
font-size  11
font-family  Verdana, Tahoma, Arial
font-weight  normal
color  #000000
class  progressPercentLabel%s
See also :

Source Code

  1. <?php
  2. /**
  3. * Reverse Square progress meter.
  4. *
  5. * @version    $Id: squareback.php,v 1.4 2006/05/24 08:41:13 farell Exp $
  6. * @author     Laurent Laville <pear@laurent-laville.org>
  7. * @package    HTML_Progress2
  8. * @subpackage Examples
  9. * @access     public
  10. */
  11. require_once 'HTML/Progress2.php';
  12.  
  13. $pb = new HTML_Progress2();
  14. $pb->setAnimSpeed(200);
  15. $pb->setIncrement(10);
  16. $pb->setFillWay('reverse');
  17. $pb->setOrientation(HTML_PROGRESS2_POLYGONAL);
  18. $pb->setCellAttributes('width=10 height=10');
  19. $pb->setLabelAttributes('pct1', 'valign=left align=center top=15');
  20. $pb->setCellCoordinates(4,4);     // square 4x4
  21. ?>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  23.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  24. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  25. <head>
  26. <title>SquareBack Progress2 example</title>
  27. <style type="text/css">
  28. <!--
  29. <?php echo $pb->getStyle(); ?>
  30.  
  31. body {
  32.     background-color: #FFFFFF;
  33. }
  34.  -->
  35. </style>
  36. <?php echo $pb->getScript(false); ?>
  37. </head>
  38. <body>
  39.  
  40. <?php
  41. $pb->display();
  42. $pb->run();
  43. ?>
  44.  
  45. </body>
  46. </html>