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. <!DOCTYPE html
  15.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  16.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  17.  
  18. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  19. <head>
  20. <title>setCellAttributes example</title>
  21. <style type="text/css">
  22. <!--
  23. <?php echo $bar->getStyle()?>
  24. // -->
  25. </style>
  26. <script type="text/javascript">
  27. <!--
  28. <?php echo $bar->getScript()?>
  29. //-->
  30. </script>
  31. </head>
  32. <body>
  33.  
  34. <?php 
  35. echo $bar->toHtml()
  36.  
  37. do {
  38.     $bar->display();
  39.     if ($bar->getPercentComplete(== 1{
  40.         break;   // the progress bar has reached 100%
  41.     }
  42.     $bar->incValue();
  43. while(1);
  44. ?>
  45.  
  46. </body>
  47. </html>

See Also

setCellCount Manual

Prev Up Next
getCellAttributes Manual Reference Guides getCellCoordinates Manual

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