HTML Page2 renderer
Overview
This example will run a default Progress2 Monitor, which used a PEAR::HTML_Page2
generator as renderer.
Screenshot
Demonstration
Give it a try
Dependencies
This example requires mandatory resources :
And also but optional :
Explains step by step
The progress meter wait 50ms (line 29) between each step of 1% (default).
The form windows (ProgressMonitor) have default title (In progress ...),
buttons name (Start, Cancel) and size : see class constructor parameters (line 26).
There are 10 cells 15x20:
Property | Value | Default |
active-color | | #006600 |
inactive-color | | #CCCCCC |
width | | 15 |
height | | 20 |
spacing | | 2 |
See also :
With basic percent text info aligned on right side:
Property | Value | Default |
left | | 5 |
top | | 5 |
width | | 50 |
height | | 0 |
align | | right |
valign | | right |
background-color | | |
font-size | | 11 |
font-family | | Verdana, Tahoma, Arial |
font-weight | | normal |
color | | #000000 |
class | | progressPercentLabel%s |
See also :
Source Code
<?php
/**
* PEAR::HTML_Page2 package made it easy to build
* a very simple Progress2 Monitor.
*
* @version $Id: monitorpg2.php,v 1.1 2005/06/12 21:05:38 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress2
* @subpackage Examples
* @access public
*/
require_once 'HTML/Progress2/Monitor.php';
require_once 'HTML/Page2.php';
$p = new HTML_Page2(array(
'charset' => 'utf-8',
'lineend' => PHP_EOL,
'doctype' => "XHTML 1.0 Strict",
'language' => 'en',
'cache' => 'false'
));
$p->setTitle('PEAR::HTML_Progress2 - Simple Monitor');
$p->setMetaData('author', 'Laurent Laville');
$pm = new HTML_Progress2_Monitor();
$bar =& $pm->getProgressElement();
$bar->setAnimSpeed(50);
$p->addStyleDeclaration(
$pm->getStyle()
);
$p->addScriptDeclaration(
$pm->getScript()
);
$p->addBodyContent(
$pm->toHtml()
);
echo $p->toHtml();
$pm->run();
?>