$Date: 2004/04/18 13:25:43 $
IntroductionThis example will run a default ProgressBar Monitor, and used a default QuickForm renderer without any form template customizations. User callback 'logger' will write into a file through PEAR::Log.
[Top]
PHP scriptUser-Callback
<?php
// progressHandler.php
function logger($progressValue, &$obj)
{
include_once 'Log.php';
$logger = &Log::singleton('file', 'monitor.log', $_SERVER['REMOTE_ADDR']);
if (fmod($progressValue,25) == 0) {
$logger->info("$progressValue % has been reached");
} else {
$logger->debug("Progress ... $progressValue %");
}
}
?>
[Top]
Render options [Top]
Output
[Top]
Play full exampleRun the script below :
<?php
require_once 'HTML/Progress/monitor.php';
require_once 'progressHandler.php';
$monitor = new HTML_Progress_Monitor();
$bar =& $monitor->getProgressElement();
$bar->setAnimSpeed(25);
$monitor->setProgressHandler('logger');
?>
<html>
<head>
<title>ProgressBar Monitor - Default renderer </title>
<style type="text/css">
<!--
.progressStatus {
color:#000000;
font-size:10px;
}
<?php echo $monitor->getStyle(); ?>
// -->
</style>
<script type="text/javascript">
<!--
<?php echo $monitor->getScript(); ?>
//-->
</script>
</head>
<body>
<?php
echo $monitor->toHtml();
$monitor->run();
?>
</body>
</html>
[Top]