PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Multiple Labels usage

Figure 21.3. Multi Labels usage

Multi Labels usage

Goals of this example is to show multiple labels usage. All four kind of label are presented with addLabel() and setLabelAttributes() methods implementation.

Example 21.3. Four kind of progress label

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5. $pb->setAnimSpeed(300);
  6. $pb->setIncrement(10);
  7.  
  8. // Adds additional labels
  9. $pb->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt1', 'Fire at will');
  10.  
  11. $pb->addLabel(HTML_PROGRESS2_LABEL_CROSSBAR, 'crs1');
  12. $pb->setLabelAttributes('crs1', array(
  13.     'valign' => 'top',
  14.     'align'  => 'center',
  15.     'width'  => 170,
  16.     'color'  => 'blue'
  17. ));
  18.  
  19. $pb->addLabel(HTML_PROGRESS2_LABEL_STEP, 'stp1');
  20. $pb->setLabelAttributes('stp1', array(
  21.     'valign' => 'bottom',
  22.     'color'  => 'blue'
  23. ));
  24.  
  25. $pb->addLabel(HTML_PROGRESS2_LABEL_BUTTON, 'btn1', 'Run again');
  26. $pb->setLabelAttributes('btn1', array(
  27.     'width' => 100,
  28.     'top' => 0,
  29.     'color' => 'red'
  30. ));
  31. ?>
  32. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  33.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  34. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  35. <head>
  36. <title>Labels Progress2 example</title>
  37. <style type="text/css">
  38. <!--
  39. <?php echo $pb->getStyle(); ?>
  40.  
  41. body {
  42.     background-color: #E0E0E0;
  43.     color: #000000;
  44.     font-family: Verdana, Arial;
  45. }
  46.  -->
  47. </style>
  48. <?php echo $pb->getScript(false); ?>
  49. </head>
  50. <body>
  51.  
  52. <?php
  53. $pb->display();
  54. $pb->run();
  55. ?>
  56.  
  57. </body>
  58. </html>
HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007