Source for file complex.php
Documentation is available at complex.php
@include '../include_path.php';
* Observer ProgressBar example. Uses a custom observer class
* that handled progress of the second bar.
* @version $Id: complex.php,v 1.1 2004/06/27 13:08:28 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
require_once 'HTML/Progress.php';
require_once 'HTML/Progress/observer.php';
// 1. Defines ProgressBar observer
$log = isset ($event['log']) ? $event['log'] : "undefined event id.";
$val = isset ($event['value']) ? $event['value'] : "unknown value";
// if you want to do special on each step of progress bar1; it's here !!!
// updates $bar2 because $bar1 has completed a full loop
// 2. Creates ProgressBar
$bar2->setBorderPainted (true );
// 3. Creates and attach a listener
$ok = $bar1->addListener ($observer);
die ("Cannot add a valid listener to progress bar !");
// 4. Changes look-and-feel of ProgressBar
$ui1->setComment ('Complex Observer ProgressBar example');
$ui1->setProgressAttributes (array (
'background-color' => '#e0e0e0'
$ui1->setStringAttributes (array (
'background-color' => 'lightblue'
$ui2->setBorderAttributes (array (
$ui2->setCellAttributes (array (
'active-color' => '#3874B4',
'inactive-color' => '#EEEECC'
$ui2->setStringAttributes (array (
'background-color' => 'lightblue'
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">
<title>Complex Observer ProgressBar example</title>
background-color: lightblue;
<script type="text/javascript">
<?php echo $bar1->getScript (); ?>
<h1> <?php echo basename(__FILE__ ); ?></h1>
<table class="container">
<td width="25%" align="center">
<?php echo $bar1->toHTML (); ?>
<td width="25%" align="center">
<?php echo $bar2->toHTML (); ?>
$bar1->process (); // warning: don't forget it (even for a demo)
if ($bar1->getPercentComplete () == 1 ) {
$bar1->setValue (0 ); // the 1st progress bar has reached 100%, do a new loop
$bar1->incValue (); // updates 1st progress bar
} while ($bar2->getPercentComplete () < 1 );
<p><< <a href="../index.html">Back examples TOC</a></p>
Documentation generated on Mon, 11 Mar 2019 13:52:36 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|