cvs: pear /HTML_Progress/examples/monitor default2.php
| From: | Laurent Laville | Date: | Mon, 25 Jul 2005 12:17:39 +0000 |
| Subject: | cvs: pear /HTML_Progress/examples/monitor default2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-33301@lists.php.net to get a copy of this message | ||
farell Mon Jul 25 08:17:39 2005 EDT
Modified files:
/pear/HTML_Progress/examples/monitor default2.php
Log:
example that show how this release (1.2.2) fixed the bug #4885
- setMaximum higher than 200 don't stop the progress monitor
http://cvs.php.net/diff.php/pear/HTML_Progress/examples/monitor/default2.php?r1=1.1&r2=1.2&ty=u
Index: pear/HTML_Progress/examples/monitor/default2.php
diff -u pear/HTML_Progress/examples/monitor/default2.php:1.1
pear/HTML_Progress/examples/monitor/default2.php:1.2
--- pear/HTML_Progress/examples/monitor/default2.php:1.1 Sun Jun 27 09:08:50 2004
+++ pear/HTML_Progress/examples/monitor/default2.php Mon Jul 25 08:17:39 2005
@@ -1,29 +1,34 @@
<?php
-@include '../include_path.php';
/**
* Default Monitor ProgressBar example with logging events.
*
- * @version $Id: default2.php,v 1.1 2004/06/27 13:08:50 farell Exp $
+ * @version $Id: default2.php,v 1.2 2005/07/25 12:17:39 farell Exp $
* @author Laurent Laville <pear@laurent-laville.org>
* @package HTML_Progress
+ * @subpackage Examples
*/
require_once 'HTML/Progress/monitor.php';
-function logger($progressValue, &$obj)
+function logger($progressValue, &$bar)
{
include_once 'Log.php';
$logger = &Log::singleton('file', 'monitor.log',
$_SERVER['REMOTE_ADDR']);
+ $percent = $bar->getPercentComplete(false);
if (fmod($progressValue,25) == 0) {
- $logger->info("$progressValue % has been reached");
+ $logger->info("$percent% has been reached");
} else {
- $logger->debug("Progress ... $progressValue %");
+ $logger->debug("Progress ... $progressValue");
}
}
$monitor = new HTML_Progress_Monitor();
$monitor->setProgressHandler('logger');
+
+$pb = &$monitor->getProgressElement();
+$dm = &$pb->getDM();
+$dm->setMaximum(300);
?>
<html>
<head>
@@ -31,8 +36,8 @@
<style type="text/css">
<!--
.progressStatus {
- color:#000000;
- font-size:10px;
+ color:#000000;
+ font-size:10px;
}
<?php echo $monitor->getStyle(); ?>
// -->
@@ -44,14 +49,11 @@
</script>
</head>
<body>
-<h1><?php echo basename(__FILE__); ?></h1>
-<?php
+<?php
echo $monitor->toHtml();
$monitor->run();
?>
-<p><< <a href="../index.html">Back examples
TOC</a></p>
-
</body>
</html>
\ No newline at end of file