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 | [ false ]   
  • width   
  • height   

$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. ?>
  26. <!DOCTYPE html
  27.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  28.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  29.  
  30. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  31. <head>
  32. <title>Progress example</title>
  33. <style type="text/css">
  34. <!--
  35. <?php echo $bar->getStyle()?>
  36. // -->
  37. </style>
  38. <script type="text/javascript">
  39. <!--
  40. <?php echo $bar->getScript()?>
  41. //-->
  42. </script>
  43. </head>
  44. <body bgcolor="#C3C6C3">
  45.  
  46. <?php 
  47. echo $bar->toHtml()
  48.  
  49. do {
  50.     $bar->display();
  51.     if ($bar->getPercentComplete(== 1{
  52.         break;   // the progress bar has reached 100%
  53.     }
  54.     $bar->incValue();
  55. while(1);
  56. ?>
  57.  
  58. </body>
  59. </html>

See Also

To build a plain bar the cell spacing should be set to zero. To do it, see setCellAttributes Manual

Prev   Next
Using Indeterminate Mode setScript Manual

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