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

setProgressAttributes Manual

defines look and feel of the core of progress bar

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

Synopsis

void setProgressAttributes( $attributes )

Attributes

Name Type Default
attributes array
  • class => progressBar
  • background-color => #FFFFFF
  • auto-size => true

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

Description

The setProgressAttributes() method is used to give a look and feel, such as size and color, to the core of progress bar.

Example

Example below will produced a plain progress bar. 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(array(
  11.     'active-color' => '#000084',
  12.     'inactive-color' => '#3A6EA5',
  13.     'width' => 20,
  14.     'spacing' => 0
  15. ));
  16. $ui->setBorderAttributes('width=1 style=inset color=white');
  17. $ui->setStringAttributes(array(
  18.     'width' => 200,
  19.     'height' => 20,
  20.     'font-size' => 14,
  21.     'background-color' => '#C3C6C3',
  22.     'valign' => 'top'
  23. ));
  24. ?>
  25. <!DOCTYPE html
  26.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  27.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  28.  
  29. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  30. <head>
  31. <title>setProgressAttributes example</title>
  32. <style type="text/css">
  33. <!--
  34. <?php echo $bar->getStyle()?>
  35. // -->
  36. </style>
  37. <script type="text/javascript">
  38. <!--
  39. <?php echo $bar->getScript()?>
  40. //-->
  41. </script>
  42. </head>
  43. <body bgcolor="#C3C6C3">
  44.  
  45. <?php 
  46. echo $bar->toHtml()
  47.  
  48. do {
  49.     $bar->display();
  50.     if ($bar->getPercentComplete(== 1{
  51.         break;   // the progress bar has reached 100%
  52.     }
  53.     $bar->incValue();
  54. while(1);
  55. ?>
  56.  
  57. </body>
  58. </html>

See Also

setBorderAttributes Manual, setStringAttributes Manual, setCellAttributes Manual

Prev Up Next
getProgressAttributes Manual Reference Guides getStringAttributes Manual

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