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

Source for file monitor_complex.php

Documentation is available at monitor_complex.php

  1. <?php 
  2. include '../../include_path.php';
  3. /**
  4.  * Complex Monitor ProgressBar example.
  5.  *
  6.  * @version    $Id: monitor_complex.php,v 1.2 2004/04/18 13:25:43 farell Exp $
  7.  * @author     Laurent Laville <pear@laurent-laville.org>
  8.  * @package    HTML_Progress
  9.  */
  10.  
  11. require_once ('HTML/Progress/monitor.php');
  12. require_once ('HTML/QuickForm/Renderer/ITStatic.php');
  13. require_once ('HTML/Template/ITX.php');
  14.  
  15. class ProgressMonitor extends HTML_Progress_Monitor
  16. {
  17.     
  18.     function ProgressMonitor()
  19.     {
  20.         $this->_id md5(microtime());
  21.  
  22.         $this->_form = new HTML_QuickForm('form');
  23.         
  24.         $this->_form->addElement('header''windowsname''Progress...');
  25.         $this->_form->addElement('static''progress');
  26.         $this->_form->addElement('submit''cancel''Cancel');
  27.         
  28.         $this->attachProgress();
  29.     }
  30.  
  31.     function attachProgress()
  32.     {
  33.         $this->_progress = new HTML_Progress();
  34.         $this->_progress->setIncrement(10);
  35.  
  36.         $ui =$this->_progress->getUI();
  37.         $ui->setProgressAttributes('background-color=#EEE');
  38.         $ui->setCellAttributes('inactive-color=#FFF active-color=#444444');
  39.         $ui->setStringAttributes('background-color=#EEE color=navy');
  40.  
  41.         $this->_progress->addListener($this);
  42.         
  43.         $bar =$this->_form->getElement('progress');
  44.         $bar->setText$this->_progress->toHtml() );
  45.     }
  46.  
  47.     function toHtml()
  48.     {
  49.         $tpl =new HTML_Template_ITX('.');
  50.         $tpl->loadTemplateFile('monitor.html');
  51.  
  52.         $js  $this->getScript();
  53.         $css $this->getStyle();
  54.         $tpl->setVariable("monitor_script"$js);
  55.         $tpl->setVariable("monitor_style"$css);
  56.  
  57.         $renderer =new HTML_QuickForm_Renderer_ITStatic($tpl);       
  58.         $this->_form->accept($renderer);
  59.         return $tpl->get();
  60.     }
  61.  
  62.     function display()
  63.     {
  64.         print $this->toHtml();
  65.     }
  66. }
  67.  
  68. $progressMonitor = new ProgressMonitor();
  69. $progressMonitor->display();
  70. $progressMonitor->run();
  71.  
  72. ?>

Documentation generated on Mon, 11 Mar 2019 10:15:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.