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

Source for file itdynamic.php

Documentation is available at itdynamic.php

  1. <?php
  2. @include '../include_path.php';
  3. /**
  4.  * Monitor example using ITDynamic QF renderer, and
  5.  * a class-method as user callback.
  6.  *
  7.  * @version    $Id: itdynamic.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. require_once 'HTML/QuickForm/Renderer/ITDynamic.php';
  14. require_once 'HTML/Template/ITX.php';
  15.  
  16. class Progress_ITDynamic extends HTML_Progress_UI
  17. {
  18.     function Progress_ITDynamic()
  19.     {
  20.         parent::HTML_Progress_UI();
  21.         
  22.         $this->setCellCount(20);
  23.         $this->setProgressAttributes('background-color=#EEE');
  24.         $this->setStringAttributes('background-color=#EEE color=navy');
  25.         $this->setCellAttributes('inactive-color=#FFF active-color=#444444');
  26.     }
  27. }
  28.  
  29. class my2ClassHandler
  30. {
  31.     function my1Method($progressValue&$obj)
  32.     {
  33.         switch ($progressValue{
  34.          case 10:
  35.             $pic 'picture1.jpg';
  36.             break;
  37.          case 45:
  38.             $pic 'picture2.jpg';
  39.             break;
  40.          case 70:
  41.             $pic 'picture3.jpg';
  42.             break;
  43.          default:
  44.             $pic = null;
  45.         }
  46.         if (!is_null($pic)) {
  47.             $obj->setCaption('upload <b>%file%</b> in progress ... Start at %percent%%',
  48.                               array('file'=>$pic'percent'=>$progressValue)
  49.                              );
  50.         }
  51.         $bar =$obj->getProgressElement();
  52.         $bar->sleep();  // slow animation because we do noting else
  53.     }
  54. }
  55.  
  56. $monitor = new HTML_Progress_Monitor('frmMonitor5'array(
  57.     'title'  => 'Upload your pictures',
  58.     'start'  => 'Upload',
  59.     'cancel' => 'Stop',
  60.     'button' => array('style' => 'width:80px;')
  61.     )
  62. );
  63. $monitor->setProgressHandler(array('my2ClassHandler','my1Method'));
  64.  
  65. $progress = new HTML_Progress();
  66. $progress->setUI('Progress_ITDynamic');
  67. $progress->setAnimSpeed(50);
  68. $monitor->setProgressElement($progress);
  69.  
  70. $tpl =new HTML_Template_ITX('../templates');
  71.  
  72. $tpl->loadTemplateFile('itdynamic_monitor.html');
  73.  
  74. $tpl->setVariable(array(
  75.     'qf_style'  => "body {font-family: Verdana, Arial; } \n" $monitor->getStyle(),
  76.     'qf_script' => $monitor->getScript()
  77.     )
  78. );
  79.  
  80. $renderer =new HTML_QuickForm_Renderer_ITDynamic($tpl);
  81. $renderer->setElementBlock(array(
  82.     'buttons'     => 'qf_buttons'
  83. ));
  84.  
  85. $monitor->accept($renderer);
  86.  
  87. // Display progress uploader dialog box
  88. $tpl->show();
  89.  
  90. $monitor->run();   
  91.  
  92. echo '<p>&lt;&lt; <a href="../index.html">Back examples TOC</a></p>';
  93. ?>

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