SquareBack
Overview
This example will run a progress meter (square 4x4) filled in reverse way.
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
<?php
/**
* Reverse Square progress meter.
*
* @version $Id: squareback.php,v 1.4 2006/05/24 08:41:13 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress2
* @subpackage Examples
* @access public
*/
require_once 'HTML/Progress2.php';
$pb = new HTML_Progress2();
$pb->setAnimSpeed(200);
$pb->setIncrement(10);
$pb->setFillWay('reverse');
$pb->setOrientation(HTML_PROGRESS2_POLYGONAL);
$pb->setCellAttributes('width=10 height=10');
$pb->setLabelAttributes('pct1', 'valign=left align=center top=15');
$pb->setCellCoordinates(4,4); // square 4x4
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>SquareBack Progress2 example</title>
<style type="text/css">
<!--
<?php echo $pb->getStyle(); ?>
body {
background-color: #FFFFFF;
}
-->
</style>
<?php echo $pb->getScript(false); ?>
</head>
<body>
<?php
$pb->display();
$pb->run();
?>
</body>
</html>