PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Chapter 13. How to adjust your code

Table of Contents

core class related
User Interface related
Data Management related

core class related

class constructor

HTML_Progress 1.x allows multiple signatures (5) while HTML_Progress2 allow one unique signature even if all parameters are optional.

Resume of HTML_Progress 1.x signatures :

  1. $bar = new HTML_Progress();
  2. $bar = new HTML_Progress($orient);
  3. $bar = new HTML_Progress($min, $max);
  4. $bar = new HTML_Progress($orient, $min, $max);
  5. $bar = new HTML_Progress($model);
[Caution] Caution
Signature #5 is no more allowed because feature was removed.

HTML_Progress2 signature :

  1. <?php
  2. $bar = new HTML_Progress2($errorPrefs, $orient, $min, $max, $percentLabel);
  3. /*
  4.        $errorPrefs   :hash of options to configure the API error handling system
  5.                       default is empty array (use PEAR_Error object)
  6.        $orient       :orientation of the progress bar (see constants)
  7.        $min          :minimum value of the progress bar (default is zero)
  8.        $max          :maximum value of the progress bar (default is 100)
  9.        $percentLabel :progress bar percent label identifier (default is 'pct1')
  10.  */
  11. ?>
apiVersion()

Returns the current API version compatible with the PHP function : version_compare()

This method return now a string rather than a float, and allow a largest version naming (such as x.y.zRCn)

getPercentComplete()

Returns the percent complete for the progress meter

This method has now an optional parameter that allows to return either

  • a float by default (range 0.00 to 1.00)
  • an integer (range 0 to 100)
display()

Rendering of the progress meter.

[Important] Important
This method has a new behavior. It will now send only toHtml() output to browser, while in previous version this method managed browser refresh. Refresh are now made by the moveNext() or moveStep() method.
HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007