HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next
HTML_Progress_UI::setCellAttributes
sets the look and feel of each progress bar cell

Synopsis

require_once 'HTML/Progress/UI.php';

void HTML_Progress_UI::setCellAttributes( mixed $attributes int $cells = NULL)

Description

This method is used to give a look and feel, such as spacing, size and color, to the progress meter cells.

$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.

Parameter

    mixed $attributes
  • the new cell attributes of the progress meter.

    Key-values allowed are:

    Attribute Format Default value
    id string progressCell%01s
    class string cell
    spacing integer 2
    active-color string #006600
    inactive-color string #CCCCCC
    font-family string Courier, Verdana
    font-size integer (compute)
    color string #000000
    width integer HB=15, VB=20 (HB:Horizontal Bar, VB:Vertical Bar)
    height integer HB=20, VB=15 (HB:Horizontal Bar, VB:Vertical Bar)

    integer $cell
  • the cell index if not nul. Otherwise, attributes will be apply for each cell.

Throws

Possible PEAR_Error values

Error level Error code Error message Solution
exception HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #2 "$cells" was expecting "integer" Fixed the cast of parameter
error HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #2 "$cells" was expecting "positive" Give an integer between zero and cell count
error HTML_PROGRESS_ERROR_INVALID_INPUT invalid input, parameter #2 "$cells" was expecting "less or equal (cell count)" Give an integer between zero and cell count

Note

( HTML_Progress >= 1.0 )

This function can not be called statically.

See

HTML_Progress_UI::getCellAttributes, HTML_Progress_UI::getCellCount

Example

Example below (that requires HTML_Progress >= 1.2.0RC3) will produced a progress bar with custom bluesand cells (see line 10).

  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. $bar->run();
  37. ?>
  38.  
  39. </body>
  40. </html>

Prev Up Next
HTML_Progress_UI::getCellAttributes Reference Guide HTML_Progress_UI::getCellCoordinates

Documentation generated on Sun, 12 Sep 2004 20:23:23 +0200 by phpDocumentor 1.3.0RC3