HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]

Source for file method_callback.php

Documentation is available at method_callback.php

  1. <?php
  2. @include '../include_path.php';
  3. /**
  4.  * Monitor example with a new form template and progress bar
  5.  * color scheme. Used a class-method as user callback.
  6.  *
  7.  * @version    $Id: method_callback.php,v 1.1 2004/06/27 13:08:50 farell Exp $
  8.  * @author     Laurent Laville <pear@laurent-laville.org>
  9.  * @package    HTML_Progress
  10.  */
  11.  
  12. require_once 'HTML/Progress/monitor.php';
  13.  
  14. class Progress_Default2 extends HTML_Progress_UI
  15. {
  16.     function Progress_Default2()
  17.     {
  18.         parent::HTML_Progress_UI();
  19.         
  20.         $this->setProgressAttributes(array('background-color' => '#e0e0e0'));        
  21.         $this->setStringAttributes(array('color' => '#996''background-color' => '#CCCC99'));        
  22.         $this->setCellAttributes(array('active-color' => '#996'));
  23.     }
  24. }
  25.  
  26. class myClassHandler
  27. {
  28.     function myMethodHandler($progressValue&$obj)
  29.     {
  30.         if (fmod($progressValue,10== 0{
  31.             echo "myMethodHandler -> progress value is = $progressValue <br/>\n";
  32.         }
  33.         $bar =$obj->getProgressElement();
  34.         $bar->sleep();
  35.     }
  36. }
  37.  
  38.  
  39. $monitor = new HTML_Progress_Monitor('frmMonitor3'array(
  40.     'button' => array('style' => 'width:80px;')
  41.     )
  42. );
  43. $monitor->setProgressHandler(array('myClassHandler','myMethodHandler'));
  44.  
  45.  
  46. $progress = new HTML_Progress();
  47. $progress->setUI('Progress_Default2');   // Attach a progress ui-model 
  48. $progress->setAnimSpeed(20);
  49. $monitor->setProgressElement($progress);
  50. ?>
  51. <html>
  52. <head>
  53. <title>ProgressBar Monitor - Default renderer </title>
  54. <style type="text/css">
  55. <!--
  56. .progressStatus {
  57.     color:#000000; 
  58.     font-size:10px;
  59. }
  60. <?php echo $monitor->getStyle()?>
  61. // -->
  62. </style>
  63. <script type="text/javascript">
  64. <!--
  65. <?php echo $monitor->getScript()?>
  66. //-->
  67. </script>
  68. </head>
  69. <body>
  70. <h1><?php echo basename(__FILE__)?></h1>
  71.  
  72. <?php 
  73. $renderer =HTML_QuickForm::defaultRenderer();
  74. $renderer->setFormTemplate('
  75.     <table width="450" border="0" cellpadding="3" cellspacing="2" bgcolor="#CCCC99">
  76.     <form{attributes}>{content}
  77.     </form>
  78.     </table>
  79.     ');
  80. $renderer->setHeaderTemplate('
  81.     <tr>
  82.         <td style="white-space:nowrap;background:#996;color:#ffc;" align="left" colspan="2"><b>{header}</b></td>
  83.     </tr>
  84.     ');
  85. $monitor->accept($renderer);
  86.  
  87. echo $renderer->toHtml();
  88. $monitor->run();   
  89. ?>
  90.  
  91. <p>&lt;&lt; <a href="../index.html">Back examples TOC</a></p>
  92.  
  93. </body>
  94. </html>

Documentation generated on Mon, 11 Mar 2019 13:52:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.