$Date: 2004/04/18 13:25:44 $
IntroductionThis example will run a polygonal (rectangle 15x3) ProgressBar filled in reverse way.
Cell coordinates are pre-computed 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]
PHP scriptBuild the progress bar
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setAnimSpeed(100);
$bar->setIncrement(10);
$ui =& $bar->getUI();
$ui->setFillWay('reverse');
$ui->setOrientation(HTML_PROGRESS_POLYGONAL);
$ui->setCellAttributes(array(
'width' => 10,
'height' => 10,
'active-color' => 'red',
'inactive-color' => 'orange',
)
);
$ui->setCellCoordinates(15,3); // Rectangle 15x3
Loop to run the progress
do {
$bar->display();
if ($bar->getPercentComplete() == 1) {
break; // the progress bar has reached 100%
}
// your user-process should be put HERE !
$bar->incValue();
} while(1);
[Top]
Render options active-color = red inactive-color = orange width = 10 height = 10
[Top]
Output
[Top]
Play full exampleRun the script below :
<?php
require_once 'HTML/Progress.php';
$bar = new HTML_Progress();
$bar->setAnimSpeed(100);
$bar->setIncrement(10);
$ui =& $bar->getUI();
$ui->setFillWay('reverse');
$ui->setOrientation(HTML_PROGRESS_POLYGONAL);
$ui->setCellAttributes(array(
'width' => 10,
'height' => 10,
'active-color' => 'red',
'inactive-color' => 'orange',
)
);
$ui->setCellCoordinates(15,3); // Rectangle 15x3
?>
<html>
<head>
<title>Reverse Rectangle ProgressBar example</title>
<style type="text/css">
<!--
<?php echo $bar->getStyle(); ?>
// -->
</style>
<script type="text/javascript">
<!--
<?php echo $ui->getScript(); ?>
//-->
</script>
</head>
<body>
<?php
echo $bar->toHtml();
do {
$bar->display();
if ($bar->getPercentComplete() == 1) {
break; // the progress bar has reached 100%
}
$bar->incValue();
} while(1);
?>
</body>
</html>
[Top]