} /** * @ignore */ class myClassHandler { function myMethodHandler($progressValue, &$bar) { if (fmod($progressValue, 10) == 0) { echo "myMethodHandler -> progress value is = {$progressValue} <br/>\n"; } $bar->sleep(); } } $obs = new myClassHandler(); $monitor = new HTML_Progress_Monitor('frmMonitor3', array('button' => array('style' => 'width:80px;'))); $progress = new HTML_Progress(); $progress->setUI('Progress_Default2'); // Attach a progress ui-model $progress->setAnimSpeed(20); $progress->setProgressHandler(array(&$obs, 'myMethodHandler')); $monitor->setProgressElement($progress); ?> <html> <head> <title>ProgressBar Monitor - Default renderer </title> <style type="text/css"> <!-- .progressStatus { color:#000000; font-size:10px;
<?php /** * Simple Default Monitor ProgressBar example. * * @version $Id: default1.php,v 1.2 2005/07/25 12:15:50 farell Exp $ * @author Laurent Laville <*****@*****.**> * @package HTML_Progress * @subpackage Examples */ require_once 'HTML/Progress/monitor.php'; $monitor = new HTML_Progress_Monitor(); $bar =& $monitor->getProgressElement(); $bar->setAnimSpeed(50); $bar->setIncrement(10); ?> <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">
* @package HTML_Progress * @subpackage Examples */ require_once 'HTML/Progress/monitor.php'; 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("{$percent}% has been reached"); } else { $logger->debug("Progress ... {$progressValue}"); } } $monitor = new HTML_Progress_Monitor(); $monitor->setProgressHandler('logger'); $pb =& $monitor->getProgressElement(); $dm =& $pb->getDM(); $dm->setMaximum(300); ?> <html> <head> <title>ProgressBar Monitor - Default renderer </title> <style type="text/css"> <!-- .progressStatus { color:#000000; font-size:10px; } <?php
} } else { /* in case we have attached an indeterminate progress bar to the monitor ($obj) after a first pass that reached 60%, we swap from indeterminate mode to determinate mode and run a standard progress bar from 0 to 100% */ if ($progressValue == 60) { $bar->setIndeterminate(false); $bar->setString(null); // show percent-info $bar->setValue(0); } } } $monitor = new HTML_Progress_Monitor('frmMonitor4', array('button' => array('style' => 'width:80px;'))); $monitor->setProgressHandler('myFunctionHandler'); $progress = new HTML_Progress(); $progress->setAnimSpeed(20); $progress->setUI('Progress_ITDynamic'); // Attach a progress ui-model $progress->setStringPainted(true); // get space for the string $progress->setString(""); // but don't paint it $progress->setIndeterminate(true); // Progress start in indeterminate mode $monitor->setProgressElement($progress); ?> <html> <head>
$this->setStringAttributes(array('color' => '#996', 'background-color' => '#CCCC99')); $this->setCellAttributes(array('active-color' => '#996')); } } class myClassHandler { function myMethodHandler($progressValue, &$obj) { if (fmod($progressValue, 10) == 0) { echo "myMethodHandler -> progress value is = {$progressValue} <br/>\n"; } $bar =& $obj->getProgressElement(); $bar->sleep(); } } $monitor = new HTML_Progress_Monitor('frmMonitor3', array('button' => array('style' => 'width:80px;'))); $monitor->setProgressHandler(array('myClassHandler', 'myMethodHandler')); $progress = new HTML_Progress(); $progress->setUI('Progress_Default2'); // Attach a progress ui-model $progress->setAnimSpeed(20); $monitor->setProgressElement($progress); ?> <html> <head> <title>ProgressBar Monitor - Default renderer </title> <style type="text/css"> <!-- .progressStatus { color:#000000; font-size:10px;
break; case 70: $pic = 'picture3.jpg'; break; default: $pic = null; } if (!is_null($pic)) { $obj->setCaption('upload <b>%file%</b> in progress ... Start at %percent%%', array('file' => $pic, 'percent' => $progressValue)); } $bar =& $obj->getProgressElement(); $bar->sleep(); // slow animation because we do noting else } } $monitor = new HTML_Progress_Monitor('frmMonitor5', array('title' => 'Upload your pictures', 'start' => 'Upload', 'cancel' => 'Stop', 'button' => array('style' => 'width:80px;'))); $monitor->setProgressHandler(array('my2ClassHandler', 'my1Method')); $progress = new HTML_Progress(); $progress->setUI('Progress_ITDynamic'); $progress->setAnimSpeed(50); $monitor->setProgressElement($progress); $tpl =& new HTML_Template_ITX('../templates'); $tpl->loadTemplateFile('itdynamic_monitor.html'); $tpl->setVariable(array('qf_style' => "body {font-family: Verdana, Arial; } \n" . $monitor->getStyle(), 'qf_script' => $monitor->getScript())); $renderer =& new HTML_QuickForm_Renderer_ITDynamic($tpl); $renderer->setElementBlock(array('buttons' => 'qf_buttons')); $monitor->accept($renderer); // Display progress uploader dialog box $tpl->show(); $monitor->run(); echo '<p><< <a href="../index.html">Back examples TOC</a></p>';
<?php @(include '../include_path.php'); /** * PEAR::HTML_Page package made it easy to build * a very simple ProgressBar Monitor. * * @version $Id: htmlpage.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <*****@*****.**> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; require_once 'HTML/Page.php'; $p = new HTML_Page(array('charset' => 'utf-8', 'lineend' => OS_WINDOWS ? 'win' : 'unix', 'doctype' => "XHTML 1.0 Strict", 'language' => 'en', 'cache' => 'false')); $p->setTitle("PEAR::HTML_Progress - Simple Monitor demo"); $p->setMetaData("author", "Laurent Laville"); $progressMonitor = new HTML_Progress_Monitor(); $bar =& $progressMonitor->getProgressElement(); $bar->setAnimSpeed(20); $p->addStyleDeclaration($progressMonitor->getStyle()); $p->addScriptDeclaration($progressMonitor->getScript()); $p->addBodyContent('<h1>PEAR::HTML_Page renderer without user-callback</h1>'); $p->addBodyContent($progressMonitor->toHtml()); $p->addBodyContent('<p><< <a href="../index.html">Back examples TOC</a></p>'); $p->display(); $progressMonitor->run();