cvs: pear /HTML_Progress/examples/monitor default1.html default1.php default2.html default2.php function_callback.html function_callback.php
htmlpage.html htmlpage.php itdynamic.html itdynamic.php method_callback.html method_callback.php
| From: | Laurent Laville | Date: | Sun, 27 Jun 2004 13:08:50 +0000 |
| Subject: | cvs: pear /HTML_Progress/examples/monitor default1.html default1.php default2.html default2.php function_callback.html function_callback.php htmlpage.html htmlpage.php itdynamic.html itdynamic.php method_callback.html method_callback.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21184@lists.php.net to get a copy of this message | ||
farell Sun Jun 27 09:08:50 2004 EDT
Added files:
/pear/HTML_Progress/examples/monitor default1.html default1.php
default2.html default2.php
function_callback.html
function_callback.php
htmlpage.html htmlpage.php
itdynamic.html itdynamic.php
method_callback.html
method_callback.php
Log:
HTML_Progress examples reorganized by category
http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default1.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default1.html +++ pear/HTML_Progress/examples/monitor/default1.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, monitor, quickform, progress meter" /> <meta name="description" content"="HTML_Progress_Monitor run a bar inside a quickform window" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Default ProgressBar Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Default ProgressBar Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 11).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a default ProgressBar Monitor, and used a default QuickForm renderer without any form template customizations. No user callback was defined.</b></p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Even if we used default monitor values, we have changed on bar itself : <pre> speed = 50 (at line 17) </pre> <div class="fig">HTML_Progress::setAnimSpeed()</div> <pre> increment = 10 (at line 18) </pre> <div class="fig">HTML_Progress::setIncrement()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/default1.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="default1.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default1.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default1.php +++ pear/HTML_Progress/examples/monitor/default1.php <?php @include '../include_path.php'; /** * Simple Default Monitor ProgressBar example. * * @version $Id: default1.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ 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"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php echo $monitor->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default2.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default2.html +++ pear/HTML_Progress/examples/monitor/default2.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, monitor, quickform, progress meter" /> <meta name="description" content"="HTML_Progress_Monitor run a bar inside a quickform window" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Logs ProgressBar Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Logs ProgressBar Monitor</span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 11).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> <li>This example requires PEAR::Log (1.8.0+) </li> </ul> </p> <hr/> <p><b>This example will logs a default ProgressBar Monitor, and used a default QuickForm renderer without any form template customizations. </b></p> <p>User callback 'logger' (defined on lines 13 to 23) which write into a file through PEAR::Log was attached on progress bar at line 26.</p> <p>Here are the contents of that PEAR::Log file : <form> <textarea readOnly="true" rows="10" cols="80" wrap="virtual"> Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 1 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 2 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 3 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 4 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 5 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 6 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 7 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 8 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 9 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 10 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 11 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 12 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 13 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 14 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 15 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 16 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 17 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 18 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 19 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 20 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 21 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 22 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 23 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 24 % Jun 06 19:38:41 127.0.0.1 [info] 25 % has been reached Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 26 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 27 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 28 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 29 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 30 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 31 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 32 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 33 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 34 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 35 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 36 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 37 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 38 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 39 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 40 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 41 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 42 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 43 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 44 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 45 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 46 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 47 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 48 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 49 % Jun 06 19:38:43 127.0.0.1 [info] 50 % has been reached Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 51 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 52 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 53 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 54 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 55 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 56 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 57 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 58 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 59 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 60 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 61 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 62 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 63 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 64 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 65 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 66 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 67 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 68 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 69 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 70 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 71 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 72 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 73 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 74 % Jun 06 19:38:45 127.0.0.1 [info] 75 % has been reached Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 76 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 77 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 78 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 79 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 80 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 81 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 82 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 83 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 84 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 85 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 86 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 87 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 88 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 89 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 90 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 91 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 92 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 93 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 94 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 95 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 96 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 97 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 98 % Jun 06 19:38:48 127.0.0.1 [debug] Progress ... 99 % Jun 06 19:38:48 127.0.0.1 [info] 100 % has been reached </textarea> </form> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> None. All default values are used. <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/default2.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="default2.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default2.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default2.php +++ pear/HTML_Progress/examples/monitor/default2.php <?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 $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.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 %"); } } $monitor = new HTML_Progress_Monitor(); $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> <h1><?php echo basename(__FILE__); ?></h1> <?php echo $monitor->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/function_callback.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/function_callback.html +++ pear/HTML_Progress/examples/monitor/function_callback.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, indeterminate, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor in indeterminate mode with function callback" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Indeterminate Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Indeterminate Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, with a function user callback. Its starts in indeterminate mode then switch back in determinate mode.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_ITDynamic, defined on lines 14 to 25.</p> <p>The user callback defined on lines 27 to 47, and attached on progress bar at line 54, will run progress bar until its reached 60 then switch back to determinate mode to complete process. All 10%, we will echo result on monitor.</p> <p>QF renderer rules are defined on lines 91 to 103.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = navy background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> inactive-color = #FFF active-color = #444444 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_function_callback.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/function_callback.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="function_callback.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/function_callback.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/function_callback.php +++ pear/HTML_Progress/examples/monitor/function_callback.php <?php @include '../include_path.php'; /** * Monitor example with a new form template and progress bar * color scheme. Used a function as user callback. * * @version $Id: function_callback.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; class Progress_ITDynamic extends HTML_Progress_UI { function Progress_ITDynamic() { parent::HTML_Progress_UI(); $this->setCellCount(20); $this->setProgressAttributes('background-color=#EEE'); $this->setStringAttributes('background-color=#EEE color=navy'); $this->setCellAttributes('inactive-color=#FFF active-color=#444444'); } } function myFunctionHandler($progressValue, &$obj) { $bar =& $obj->getProgressElement(); $bar->sleep(); if (!$bar->isIndeterminate()) { if (fmod($progressValue,10) == 0) { $obj->setCaption("myFunctionHandler -> progress value is = $progressValue"); } } 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> <title>ProgressBar Monitor - Default renderer </title> <style type="text/css"> <!-- body { background-color: lightgrey; font-family: Verdana, Arial; } progressStatus { color: navy; font-size:10px; } <?php echo $monitor->getStyle(); ?> // --> </style> <script type="text/javascript"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php $renderer =& HTML_QuickForm::defaultRenderer(); $renderer->setFormTemplate(' <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#EEEEEE"> <form{attributes}>{content} </form> </table> '); $renderer->setHeaderTemplate(' <tr> <td style="white-space:nowrap;background:#7B7B88;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> </tr> '); $monitor->accept($renderer); echo $renderer->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/htmlpage.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/htmlpage.html +++ pear/HTML_Progress/examples/monitor/htmlpage.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, HTML_Page, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor with HTMLPage QF renderer" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: HTMLPage Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">HTMLPage basic Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_Page 2.0.0RC2+, HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p>Used PEAR::HTML_Page package as QF renderer to display ProgressBar Monitor.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> None used. Only default values. <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/htmlpage.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="htmlpage.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/htmlpage.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/htmlpage.php +++ pear/HTML_Progress/examples/monitor/htmlpage.php <?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 <pear@laurent-laville.org> * @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(); ?> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/itdynamic.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/itdynamic.html +++ pear/HTML_Progress/examples/monitor/itdynamic.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, IT template engine, QuickForm, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor with ITDynamic QF renderer" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: ITDynamic Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">ITDynamic Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, with a class-method user callback, that simulate a picture file upload operation.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_ITDynamic, defined on lines 16 to 27, and attached on progress bar at line 66.</p> <p>The user callback defined on lines 29 to 54, and attached on progress bar at line 63, will simulate a picture file upload operation at 10%, 45% and 70%.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = navy background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> inactive-color = #FFF active-color = #444444 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_itdynamic.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/itdynamic.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="itdynamic.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/itdynamic.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/itdynamic.php +++ pear/HTML_Progress/examples/monitor/itdynamic.php <?php @include '../include_path.php'; /** * Monitor example using ITDynamic QF renderer, and * a class-method as user callback. * * @version $Id: itdynamic.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; require_once 'HTML/QuickForm/Renderer/ITDynamic.php'; require_once 'HTML/Template/ITX.php'; class Progress_ITDynamic extends HTML_Progress_UI { function Progress_ITDynamic() { parent::HTML_Progress_UI(); $this->setCellCount(20); $this->setProgressAttributes('background-color=#EEE'); $this->setStringAttributes('background-color=#EEE color=navy'); $this->setCellAttributes('inactive-color=#FFF active-color=#444444'); } } class my2ClassHandler { function my1Method($progressValue, &$obj) { switch ($progressValue) { case 10: $pic = 'picture1.jpg'; break; case 45: $pic = 'picture2.jpg'; 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>'; ?> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/method_callback.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/method_callback.html +++ pear/HTML_Progress/examples/monitor/method_callback.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, indeterminate, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor in determinate mode with class-method callback" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Determinate Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Determinate Monitor</span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, in determinate mode, with a class-method user callback.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_Default2, defined on lines 14 to 24.</p> <p>The user callback defined on lines 26 to 36, and attached on progress bar at line 43, will echo each time +10% is reached.</p> <p>QF renderer rules are defined on lines 73 to 85.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #e0e0e0 </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = #996 background-color = #CCCC99 </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> active-color = #996 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_method_callback.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/method_callback.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="method_callback.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/method_callback.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/method_callback.php +++ pear/HTML_Progress/examples/monitor/method_callback.php <?php @include '../include_path.php'; /** * Monitor example with a new form template and progress bar * color scheme. Used a class-method as user callback. * * @version $Id: method_callback.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; class Progress_Default2 extends HTML_Progress_UI { function Progress_Default2() { parent::HTML_Progress_UI(); $this->setProgressAttributes(array('background-color' => '#e0e0e0')); $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; } <?php echo $monitor->getStyle(); ?> // --> </style> <script type="text/javascript"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php $renderer =& HTML_QuickForm::defaultRenderer(); $renderer->setFormTemplate(' <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99"> <form{attributes}>{content} </form> </table> '); $renderer->setHeaderTemplate(' <tr> <td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> </tr> '); $monitor->accept($renderer); echo $renderer->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html>
http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default1.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default1.html +++ pear/HTML_Progress/examples/monitor/default1.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, monitor, quickform, progress meter" /> <meta name="description" content"="HTML_Progress_Monitor run a bar inside a quickform window" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Default ProgressBar Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Default ProgressBar Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 11).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a default ProgressBar Monitor, and used a default QuickForm renderer without any form template customizations. No user callback was defined.</b></p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Even if we used default monitor values, we have changed on bar itself : <pre> speed = 50 (at line 17) </pre> <div class="fig">HTML_Progress::setAnimSpeed()</div> <pre> increment = 10 (at line 18) </pre> <div class="fig">HTML_Progress::setIncrement()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/default1.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="default1.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default1.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default1.php +++ pear/HTML_Progress/examples/monitor/default1.php <?php @include '../include_path.php'; /** * Simple Default Monitor ProgressBar example. * * @version $Id: default1.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ 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"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php echo $monitor->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default2.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default2.html +++ pear/HTML_Progress/examples/monitor/default2.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, monitor, quickform, progress meter" /> <meta name="description" content"="HTML_Progress_Monitor run a bar inside a quickform window" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Logs ProgressBar Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Logs ProgressBar Monitor</span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 11).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> <li>This example requires PEAR::Log (1.8.0+) </li> </ul> </p> <hr/> <p><b>This example will logs a default ProgressBar Monitor, and used a default QuickForm renderer without any form template customizations. </b></p> <p>User callback 'logger' (defined on lines 13 to 23) which write into a file through PEAR::Log was attached on progress bar at line 26.</p> <p>Here are the contents of that PEAR::Log file : <form> <textarea readOnly="true" rows="10" cols="80" wrap="virtual"> Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 1 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 2 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 3 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 4 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 5 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 6 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 7 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 8 % Jun 06 19:38:39 127.0.0.1 [debug] Progress ... 9 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 10 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 11 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 12 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 13 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 14 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 15 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 16 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 17 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 18 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 19 % Jun 06 19:38:40 127.0.0.1 [debug] Progress ... 20 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 21 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 22 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 23 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 24 % Jun 06 19:38:41 127.0.0.1 [info] 25 % has been reached Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 26 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 27 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 28 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 29 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 30 % Jun 06 19:38:41 127.0.0.1 [debug] Progress ... 31 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 32 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 33 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 34 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 35 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 36 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 37 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 38 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 39 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 40 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 41 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 42 % Jun 06 19:38:42 127.0.0.1 [debug] Progress ... 43 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 44 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 45 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 46 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 47 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 48 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 49 % Jun 06 19:38:43 127.0.0.1 [info] 50 % has been reached Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 51 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 52 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 53 % Jun 06 19:38:43 127.0.0.1 [debug] Progress ... 54 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 55 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 56 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 57 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 58 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 59 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 60 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 61 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 62 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 63 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 64 % Jun 06 19:38:44 127.0.0.1 [debug] Progress ... 65 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 66 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 67 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 68 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 69 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 70 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 71 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 72 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 73 % Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 74 % Jun 06 19:38:45 127.0.0.1 [info] 75 % has been reached Jun 06 19:38:45 127.0.0.1 [debug] Progress ... 76 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 77 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 78 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 79 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 80 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 81 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 82 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 83 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 84 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 85 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 86 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 87 % Jun 06 19:38:46 127.0.0.1 [debug] Progress ... 88 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 89 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 90 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 91 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 92 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 93 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 94 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 95 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 96 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 97 % Jun 06 19:38:47 127.0.0.1 [debug] Progress ... 98 % Jun 06 19:38:48 127.0.0.1 [debug] Progress ... 99 % Jun 06 19:38:48 127.0.0.1 [info] 100 % has been reached </textarea> </form> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> None. All default values are used. <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/default2.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="default2.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/default2.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/default2.php +++ pear/HTML_Progress/examples/monitor/default2.php <?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 $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.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 %"); } } $monitor = new HTML_Progress_Monitor(); $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> <h1><?php echo basename(__FILE__); ?></h1> <?php echo $monitor->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/function_callback.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/function_callback.html +++ pear/HTML_Progress/examples/monitor/function_callback.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, indeterminate, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor in indeterminate mode with function callback" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Indeterminate Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Indeterminate Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, with a function user callback. Its starts in indeterminate mode then switch back in determinate mode.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_ITDynamic, defined on lines 14 to 25.</p> <p>The user callback defined on lines 27 to 47, and attached on progress bar at line 54, will run progress bar until its reached 60 then switch back to determinate mode to complete process. All 10%, we will echo result on monitor.</p> <p>QF renderer rules are defined on lines 91 to 103.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = navy background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> inactive-color = #FFF active-color = #444444 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_function_callback.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/function_callback.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="function_callback.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/function_callback.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/function_callback.php +++ pear/HTML_Progress/examples/monitor/function_callback.php <?php @include '../include_path.php'; /** * Monitor example with a new form template and progress bar * color scheme. Used a function as user callback. * * @version $Id: function_callback.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; class Progress_ITDynamic extends HTML_Progress_UI { function Progress_ITDynamic() { parent::HTML_Progress_UI(); $this->setCellCount(20); $this->setProgressAttributes('background-color=#EEE'); $this->setStringAttributes('background-color=#EEE color=navy'); $this->setCellAttributes('inactive-color=#FFF active-color=#444444'); } } function myFunctionHandler($progressValue, &$obj) { $bar =& $obj->getProgressElement(); $bar->sleep(); if (!$bar->isIndeterminate()) { if (fmod($progressValue,10) == 0) { $obj->setCaption("myFunctionHandler -> progress value is = $progressValue"); } } 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> <title>ProgressBar Monitor - Default renderer </title> <style type="text/css"> <!-- body { background-color: lightgrey; font-family: Verdana, Arial; } progressStatus { color: navy; font-size:10px; } <?php echo $monitor->getStyle(); ?> // --> </style> <script type="text/javascript"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php $renderer =& HTML_QuickForm::defaultRenderer(); $renderer->setFormTemplate(' <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#EEEEEE"> <form{attributes}>{content} </form> </table> '); $renderer->setHeaderTemplate(' <tr> <td style="white-space:nowrap;background:#7B7B88;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> </tr> '); $monitor->accept($renderer); echo $renderer->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/htmlpage.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/htmlpage.html +++ pear/HTML_Progress/examples/monitor/htmlpage.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, HTML_Page, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor with HTMLPage QF renderer" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: HTMLPage Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">HTMLPage basic Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_Page 2.0.0RC2+, HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p>Used PEAR::HTML_Page package as QF renderer to display ProgressBar Monitor.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> None used. Only default values. <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_default1.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/htmlpage.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="htmlpage.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/htmlpage.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/htmlpage.php +++ pear/HTML_Progress/examples/monitor/htmlpage.php <?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 <pear@laurent-laville.org> * @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(); ?> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/itdynamic.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/itdynamic.html +++ pear/HTML_Progress/examples/monitor/itdynamic.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, IT template engine, QuickForm, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor with ITDynamic QF renderer" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: ITDynamic Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">ITDynamic Monitor </span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, with a class-method user callback, that simulate a picture file upload operation.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_ITDynamic, defined on lines 16 to 27, and attached on progress bar at line 66.</p> <p>The user callback defined on lines 29 to 54, and attached on progress bar at line 63, will simulate a picture file upload operation at 10%, 45% and 70%.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = navy background-color = #EEE </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> inactive-color = #FFF active-color = #444444 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_itdynamic.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/itdynamic.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="itdynamic.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/itdynamic.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/itdynamic.php +++ pear/HTML_Progress/examples/monitor/itdynamic.php <?php @include '../include_path.php'; /** * Monitor example using ITDynamic QF renderer, and * a class-method as user callback. * * @version $Id: itdynamic.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; require_once 'HTML/QuickForm/Renderer/ITDynamic.php'; require_once 'HTML/Template/ITX.php'; class Progress_ITDynamic extends HTML_Progress_UI { function Progress_ITDynamic() { parent::HTML_Progress_UI(); $this->setCellCount(20); $this->setProgressAttributes('background-color=#EEE'); $this->setStringAttributes('background-color=#EEE color=navy'); $this->setCellAttributes('inactive-color=#FFF active-color=#444444'); } } class my2ClassHandler { function my1Method($progressValue, &$obj) { switch ($progressValue) { case 10: $pic = 'picture1.jpg'; break; case 45: $pic = 'picture2.jpg'; 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>'; ?> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/method_callback.html?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/method_callback.html +++ pear/HTML_Progress/examples/monitor/method_callback.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="robots" content="index,nofollow" /> <meta name="keywords" content"="HTML_Progress, indeterminate, progress meter, monitor" /> <meta name="description" content"="HTML_Progress_Monitor in determinate mode with class-method callback" /> <meta name="author" content="Laurent Laville" /> <title>PEAR::HTML::Progress example: Determinate Monitor</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../examples.css" /> </head> <body> <a name="top"> <p><a href="../index.html"><img src="../images/home.gif" alt="Examples TOC"/>examples</a></p> <h1><span class="chapter">Determinate Monitor</span></h1> <p align="right">$Date: 2004/06/27 13:08:50 $</p> <div class="toc"> Table of contents </div> <ul> <li><a href="#intro">Introduction<a> <li><a href="#render">Render options<a> <li><a href="#output">Ouput</a> <li><a href="#source">PHP source syntax highlight<a> <li><a href="#run">Play demo<a> </ul> <a name="intro"> <h2><img src="../images/info.gif"/> Introduction</h2> <p>This example requires : <ul> <li>PEAR::HTML_Progress_Monitor 1.2.0RC3 or better (see source at line 12).</li> </ul> </p> <p>Be aware that: <ul> <li>HTML_Progress_Monitor has dependencies (HTML_CSS 0.3.4+, HTML_QuickForm 3.1.1+) </li> </ul> </p> <hr/> <p><b>This example will run a simple ProgressBar Monitor, in determinate mode, with a class-method user callback.</b></p> <p>Color scheme came from a UI pre-set model (class) called Progress_Default2, defined on lines 14 to 24.</p> <p>The user callback defined on lines 26 to 36, and attached on progress bar at line 43, will echo each time +10% is reached.</p> <p>QF renderer rules are defined on lines 73 to 85.</p> <p>[<a href="#top">Top</a>]</p> <a name="render"> <h2><img src="../images/config.gif"/> Render options </h2> Here are the progress attributes: <pre> background-color = #e0e0e0 </pre> <div class="fig">HTML_Progress_UI::setProgressAttributes()</div> Here are the progress string attributes: <pre> color = #996 background-color = #CCCC99 </pre> <div class="fig">HTML_Progress_UI::setStringAttributes()</div> Here are the progress cells attributes: <pre> active-color = #996 </pre> <div class="fig">HTML_Progress_UI::setCellAttributes()</div> <p>[<a href="#top">Top</a>]</p> <a name="output"> <h2><img src="../images/image.gif"/> Output</h2> <h3>Screenshot </h3> <p><img src="../screenshots/monitor_method_callback.png"/></p> <p>[<a href="#top">Top</a>]</p> <a name="source"> <h2><img src="../images/source.gif"/> PHP source syntax highlight</h2> <a target="_blank" href="../highlighter.php?file=monitor/method_callback.php">Open</a> source listing in a new window. <p>[<a href="#top">Top</a>]</p> <a name="run"> <h2><img src="../images/run.gif"/> Play demo</h2> <p><a href="method_callback.php">Run</a> the script.</p> <p>[<a href="#top">Top</a>]</p> </body> </html> http://cvs.php.net/co.php/pear/HTML_Progress/examples/monitor/method_callback.php?r=1.1&p=1 Index: pear/HTML_Progress/examples/monitor/method_callback.php +++ pear/HTML_Progress/examples/monitor/method_callback.php <?php @include '../include_path.php'; /** * Monitor example with a new form template and progress bar * color scheme. Used a class-method as user callback. * * @version $Id: method_callback.php,v 1.1 2004/06/27 13:08:50 farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once 'HTML/Progress/monitor.php'; class Progress_Default2 extends HTML_Progress_UI { function Progress_Default2() { parent::HTML_Progress_UI(); $this->setProgressAttributes(array('background-color' => '#e0e0e0')); $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; } <?php echo $monitor->getStyle(); ?> // --> </style> <script type="text/javascript"> <!-- <?php echo $monitor->getScript(); ?> //--> </script> </head> <body> <h1><?php echo basename(__FILE__); ?></h1> <?php $renderer =& HTML_QuickForm::defaultRenderer(); $renderer->setFormTemplate(' <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99"> <form{attributes}>{content} </form> </table> '); $renderer->setHeaderTemplate(' <tr> <td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td> </tr> '); $monitor->accept($renderer); echo $renderer->toHtml(); $monitor->run(); ?> <p><< <a href="../index.html">Back examples TOC</a></p> </body> </html>