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

setCellAttributes Manual

defines look and feel of the progress bar cells

by by Laurent Laville
mailto:pear@laurent-laville.org
November 2003, Laurent Laville
(HTML_Progress 1.0+)

Synopsis

void setCellAttributes( $attributes, $cell )

Attributes

Name Type Default
attributes  array  
  • id => progressCell%01s   
  • class => cell   
  • spacing => 2   
  • active-color => #006600   
  • inactive-color => #CCCCCC   
  • font-family => Courier, Verdana   
  • font-size => 8   
  • color => #000000   
  • for horizontal bar:   
    • width => 15   
    • height => 20   
  • for vertical bar:   
    • width => 20   
    • height => 15   
cell  integer   null  

$attributes is an associative array or string of HTML tag attributes.

$cell is an integer that allows to identify each cell, and properties to apply.

Description

The setCellAttributes() method is used to give a look and feel, such as spacing, size and color, to the progress bar cells.

Example

Example below will produced a progress bar with smaller cell. It's a dynamic example, the progress bar will run.

  1. <?php
  2. require_once ('HTML/Progress.php');
  3.  
  4. $bar = new HTML_Progress();
  5. $bar->setAnimSpeed(100);
  6. $bar->setIncrement(10);
  7. $bar->setBorderPainted(true);
  8.  
  9. $ui =$bar->getUI();
  10. $ui->setCellAttributes('active-color=#3874B4 inactive-color=#EEEECC width=10');
  11. $ui->setBorderAttributes('width=1 color=navy');
  12. $ui->setStringAttributes('width=60 font-size=14 background-color=#EEEEEE align=center');
  13.  
  14. ?>
  15. <!DOCTYPE html
  16.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  17.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  18.  
  19. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  20. <head>
  21. <title>Progress example</title>
  22. <style type="text/css">
  23. <!--
  24. <?php echo $bar->getStyle()?>
  25. // -->
  26. </style>
  27. <script type="text/javascript">
  28. <!--
  29. <?php echo $bar->getScript()?>
  30. //-->
  31. </script>
  32. </head>
  33. <body>
  34.  
  35. <?php 
  36. echo $bar->toHtml()
  37.  
  38. do {
  39.     $bar->display();
  40.     if ($bar->getPercentComplete(== 1{
  41.         break;   // the progress bar has reached 100%
  42.     }
  43.     $bar->incValue();
  44. while(1);
  45. ?>
  46.  
  47. </body>
  48. </html>

See Also

To display a progress bar with more or less cells, see setCellCount Manual

Prev   Next
getStringAttributes Manual setOrientation Manual

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