HTML_Progress2
[ class tree: HTML_Progress2 ] [ index: HTML_Progress2 ] [ all elements ]

Class: HTML_Progress2

Source Location: /HTML_Progress2-2.0.0RC2/Progress2.php

Class Overview

HTML_Common
   |
   --HTML_Progress2

The HTML_Progress2 class allow you to add a loading bar to any of your xhtml document.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 122]
The HTML_Progress2 class allow you to add a loading bar to any of your xhtml document.

You should have a browser that accept DHTML feature.

PHP versions 4 and 5

LICENSE: This source file is subject to version 3.0 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_0.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.



[ Top ]


Class Variables

$animSpeed =

[line 197]

Delay in milisecond before each progress cells display.

1000 ms === sleep(1) <strong>usleep()</strong> function does not run on Windows platform.


Type:   integer


[ Top ]

$border = array()

[line 393]

Progress bar border properties

  1.  $border = array(
  2.     'class' => 'progressBorder%s',    # css class selector
  3.     'width' => 0,                     # width size in pixel
  4.     'style' => 'solid',               # style (solid, dashed, dotted ...)
  5.     'color' => '#000000'              # color
  6.  );


Type:   array


[ Top ]

$cell = array()

[line 419]

Progress bar cells properties

  1.  $cell = array(
  2.     'id' => 'pcel%01s',                    # cell identifier mask
  3.     'class' => 'cell%s',                   # css class selector
  4.     'active-color' => '#006600',           # active color
  5.     'inactive-color' => '#CCCCCC',         # inactive color
  6.     'font-family' => 'Courier, Verdana',   # font family
  7.     'font-size' => 8,                      # font size
  8.     'color' => '#000000',                  # foreground color
  9.     'background-color' => '#FFFFFF',       # background color
  10.     'width' => 15,                         # cell width
  11.     'height' => 20,                        # cell height
  12.     'spacing' => 2                         # cell spacing
  13.  );


Type:   array


[ Top ]

$cellCount =

[line 297]

The cell count of the progress bar. The default is 10.

Type:   integer


[ Top ]

$dispatcher =

[line 174]

Stores the event dispatcher which handles notifications
  • Since: 2.0.0RC2
  • Access: protected

Type:   array


[ Top ]

$fillWay =

[line 287]

Whether the progress bar is filled in 'natural' or 'reverse' way.

The default fill way is 'natural'.

  • 'way' = bar fill way
    • with Progress Bar Horizontal, natural way is : left to right
      reverse way is : right to left
    • with Progress Bar Vertical, natural way is : down to up
      reverse way is : up to down
    • with Progress Circle or Polygonal, natural way is : clockwise
      reverse way is : anticlockwise


Type:   string


[ Top ]

$frame = array()

[line 374]

Progress bar frame properties

  1.  $frame = array(
  2.     'show' => false,      # frame show (true/false)
  3.     'left' => 200,        # position from left
  4.     'top' => 100,         # position from top
  5.     'width' => 320,       # width
  6.     'height' => 90,       # height
  7.     'color' => '#C0C0C0'# color
  8.     'border' => 2,                                         # border width
  9.     'border-style' => 'solid',                             # border style
  10.                                                            # (solid, dashed, dotted ...)
  11.     'border-color' => '#DFDFDF #404040 #404040 #DFDFDF'    # border color (3dfx)
  12.  );


Type:   array


[ Top ]

$ident =

[line 165]

The label that uniquely identifies this progress object.

Type:   string


[ Top ]

$increment =

[line 240]

The progress bar's increment value.

The default is +1.


Type:   integer


[ Top ]

$indeterminate =

[line 144]

Whether the progress bar is in determinate or indeterminate mode.

The default is false. An indeterminate progress bar continuously displays animation indicating that an operation of unknown length is occuring.


Type:   boolean


[ Top ]

$label = array()

[line 449]

Progress bar labels properties

  1.  $label = array(
  2.     'name' => array(                  # label name
  3.       'type' => 'text',               # label type
  4.                                       # (text,button,step,percent,crossbar)
  5.       'value' => '&nbsp;',            # label value
  6.       'left' => ($left),              # label position from left
  7.       'top' => ($top - 16),           # label position from top
  8.       'width' => 0,                   # label width
  9.       'height' => 0,                  # label height
  10.       'align' => 'left',              # label align
  11.       'background-color' => '',       # label background color
  12.       'font-family' => 'Verdana, Tahoma, Arial',    # label font family
  13.       'font-size' => 11,                            # label font size
  14.       'font-weight' => 'normal',                    # label font weight
  15.       'color' => '#000000',                         # label font color
  16.       'class' => 'progressPercentLabel%s'           # css class selector
  17.  );


Type:   array


[ Top ]

$maximum =

[line 229]

The progress bar's maximum value.

The default is 100.


Type:   integer


[ Top ]

$minimum =

[line 218]

The progress bar's minimum value.

The default is 0.


Type:   integer


[ Top ]

$orientation =

[line 261]

Whether the progress bar is horizontal, vertical, polygonal or circle.

The default is horizontal.


Type:   integer


[ Top ]

$script =

[line 459]

External Javascript file to override internal default code

Type:   string


[ Top ]

$value =

[line 250]

The progress bar's current value.

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 565]

HTML_Progress2 __construct( [array $errorPrefs = array()], [int $orient = HTML_PROGRESS2_BAR_HORIZONTAL], [int $min = 0], [int $max = 100], [mixed $percentLabel = 'pct1'])

Constructor (ZE2) Summary

Creates a natural horizontal progress bar that displays ten separated cells with no border and no labels. The initial and minimum values are 0, and the maximum is 100.

  1.    $bar = new HTML_Progress2();


Parameters:

array   $errorPrefs   —  (optional) Hash of params to configure error handler
int   $orient   —  (optional) Orientation of progress bar
int   $min   —  (optional) Minimum value of progress bar
int   $max   —  (optional) Maximum value of progress bar
mixed   $percentLabel   —  (optional) Progress bar percent label id.

[ Top ]

HTML_Progress2 (Constructor)   [line 535]

HTML_Progress2 HTML_Progress2( [ $errorPrefs = array()], [ $orient = HTML_PROGRESS2_BAR_HORIZONTAL], [ $min = 0], [ $max = 100], [ $percentLabel = 'pct1'])

Constructor (ZE1)
  • Since: 2.0.0
  • Access: public

Parameters:

   $errorPrefs   — 
   $orient   — 
   $min   — 
   $max   — 
   $percentLabel   — 

[ Top ]

addLabel   [line 1729]

void addLabel( string $type, string $name, [string $value = '&nbsp;'])

Add a new label to the progress bar.

Parameters:

string   $type   —  Label type (text,button,step,percent,crossbar)
string   $name   —  Label name
string   $value   —  (optional) default label value

[ Top ]

addListener   [line 2807]

void addListener( mixed $callback)

Adds a new observer to the Event Dispatcher that will listen for all messages emitted by this HTML_Progress2 instance.

Parameters:

mixed   $callback   —  PHP callback that will act as listener

[ Top ]

apiVersion   [line 668]

string apiVersion( )

Returns the current API version compatible with php.version_compare()
  • Tutorial: progress.apiversion.pkg
  • Since: 2.0.0
  • Access: public

[ Top ]

display   [line 2638]

void display( )

Renders the new value of progress bar.
  • Tutorial: progress.display.pkg
  • Since: 2.0.0
  • Access: public

[ Top ]

drawCircleSegments   [line 2120]

array drawCircleSegments( [string $dir = '.'], [string $fileMask = 'c%s.png'])

Draw all circle segment pictures

Parameters:

string   $dir   —  (optional) Directory where pictures should be created
string   $fileMask   —  (optional) sprintf format for pictures filename

[ Top ]

getAnimSpeed   [line 2193]

integer getAnimSpeed( )

Returns delay execution of the progress bar

[ Top ]

getBorderAttributes   [line 1506]

mixed getBorderAttributes( [bool $asString = false])

Returns the progress bar's border attributes. Assoc array (defaut) or string.

Parameters:

bool   $asString   —  (optional) whether to return the attributes as string

[ Top ]

getCellAttributes   [line 1291]

mixed getCellAttributes( [bool $asString = false])

Returns the common and private cell attributes. Assoc array (defaut) or string

Parameters:

bool   $asString   —  (optional) whether to return the attributes as string

[ Top ]

getCellCoordinates   [line 1399]

array getCellCoordinates( )

Returns the coordinates of each cell for a polygonal progress shape.

[ Top ]

getCellCount   [line 1241]

integer getCellCount( )

Returns the number of cell in the progress bar. The default value is 10.

[ Top ]

getError   [line 3627]

false|array|PEAR_Error getError( )

Pop an error off of the HTML_Progress2 stack

[ Top ]

getFillWay   [line 1194]

string getFillWay( )

Returns 'natural' or 'reverse', depending of the fill way of progress bar.

For horizontal progress bar, natural way is from left to right, and reverse way is from right to left. For vertical progress bar, natural way is from down to up, and reverse way is from up to down. The default fill way is 'natural'.


[ Top ]

getFrameAttributes   [line 1563]

mixed getFrameAttributes( [bool $asString = false])

Returns the frame attributes. Assoc array (defaut) or string.

Parameters:

bool   $asString   —  (optional) whether to return the attributes as string

[ Top ]

getIdent   [line 2770]

string getIdent( )

Returns the current identification string.

[ Top ]

getIncrement   [line 893]

integer getIncrement( )

Returns the progress bar's increment value. The default value is +1.

[ Top ]

getLabelAttributes   [line 1643]

mixed getLabelAttributes( string $name, [bool $asString = false])

Returns the label attributes. Assoc array (defaut) or string.

Parameters:

string   $name   —  progress label id.
bool   $asString   —  (optional) whether to return the attributes as string

[ Top ]

getMaximum   [line 829]

integer getMaximum( )

Returns the progress bar's maximum value. The default value is 100.

[ Top ]

getMinimum   [line 765]

integer getMinimum( )

Returns the progress bar's minimum value. The default value is 0.

[ Top ]

getOrientation   [line 1123]

integer getOrientation( )

Returns HTML_PROGRESS2_BAR_HORIZONTAL or HTML_PROGRESS2_BAR_VERTICAL, depending on the orientation of the progress bar.

The default orientation is HTML_PROGRESS2_BAR_HORIZONTAL.


[ Top ]

getPercentComplete   [line 1089]

float getPercentComplete( [boolean $float = true])

Returns the percent complete for the progress bar. Note that this number is between 0.00 and 1.00.

Parameters:

boolean   $float   —  (optional) float or integer format

[ Top ]

getProgressAttributes   [line 1905]

mixed getProgressAttributes( [bool $asString = false])

Returns the progress attributes. Assoc array (defaut) or string.

Parameters:

bool   $asString   —  (optional) whether to return the attributes as string

[ Top ]

getScript   [line 1968]

string getScript( [boolean $raw = true])

Get the javascript URL or inline code to manage progress bar.
  • Tutorial: progress.getscript.pkg
  • See: HTML_Progress2::setScript()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

boolean   $raw   —  (optional) html output with script tags or just raw data

[ Top ]

getStyle   [line 2247]

string getStyle( [boolean $raw = true])

Get the cascading style sheet to put inline on HTML document
  • Tutorial: progress.getstyle.pkg
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

boolean   $raw   —  (optional) html output with script tags or just raw data

[ Top ]

getValue   [line 940]

integer getValue( )

Returns the progress bar's current value. The value is always between the minimum and maximum values, inclusive.

By default, the value is initialized with the minimum value.


[ Top ]

hasErrors   [line 3613]

integer hasErrors( )

Determine whether there are errors into the HTML_Progress2 stack

[ Top ]

hide   [line 2652]

void hide( )

Hides the progress bar.
  • Tutorial: progress.hide.pkg
  • Since: 2.0.0
  • Access: public

[ Top ]

incValue   [line 1000]

void incValue( )

Updates the progress bar's current value by adding increment value.

All change listeners are notified.


[ Top ]

isBorderPainted   [line 725]

boolean isBorderPainted( )

Determines whether the progress bar border is painted or not.

The default is false.


[ Top ]

isIndeterminate   [line 682]

boolean isIndeterminate( )

Returns mode of the progress bar (determinate or not).

[ Top ]

moveNext   [line 1065]

void moveNext( )

Changes value of the progress bar to the next step.

All change listeners are notified.


[ Top ]

moveStep   [line 1022]

void moveStep( integer $step)

Changes new step value of the progress bar.

All change listeners are notified.

  • Tutorial: progress.movestep.pkg
  • See: HTML_Progress2::moveNext()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

integer   $step   —  new step value

[ Top ]

process   [line 2719]

mixed process( )

Performs the progress actions

[ Top ]

raiseError   [line 3593]

mixed raiseError( )

A basic wrapper around the default PEAR_Error object
  • Tutorial: progress.raiseerror.pkg
  • See: _errorHandler()
  • Since: 2.0.0
  • Access: public

[ Top ]

removeLabel   [line 1872]

void removeLabel( string $name)

Removes a label to the progress bar.
  • Tutorial: progress.removelabel.pkg
  • See: HTML_Progress2::addLabel()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

string   $name   —  Label name

[ Top ]

removeListener   [line 2834]

bool removeListener( mixed $callback)

Removes a registered observer.
  • Return: True if observer was removed, false otherwise
  • Tutorial: progress.removelistener.pkg
  • See: HTML_Progress2::addListener()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_CALLBACK
  • Since: 2.0.0
  • Access: public

Parameters:

mixed   $callback   —  PHP callback that act as listener

[ Top ]

run   [line 2740]

void run( )

Runs the progress bar (both modes: indeterminate and determinate), and execute all actions defined in user callback identified by method setProgressHandler.

[ Top ]

setAnimSpeed   [line 2210]

void setAnimSpeed( integer $delay)

Set the delays progress bar execution for the given number of miliseconds.

Parameters:

integer   $delay   —  Delay in milisecond.

[ Top ]

setBorderAttributes   [line 1544]

void setBorderAttributes( mixed $attributes)

Sets the progress bar's border attributes.

Defaults are:

  • class = progressBorder%s
  • width = 0
  • style = solid
  • color = #000000


Parameters:

mixed   $attributes   —  Associative array or string of HTML tag attributes

[ Top ]

setBorderPainted   [line 743]

void setBorderPainted( boolean $paint)

Sets the value of $_paintBorder property, which determines whether the progress bar should paint its border. The default is false.

Parameters:

boolean   $paint   —  whether the progress bar should paint its border

[ Top ]

setCellAttributes   [line 1349]

void setCellAttributes( mixed $attributes, [int $cell = null])

Sets the cell attributes for an existing cell.

Defaults are:

  • Common :
    • id = pcel%01s
    • class = cell
    • spacing = 2
    • active-color = #006600
    • inactive-color = #CCCCCC
    • font-family = Courier, Verdana
    • font-size = lowest value from cell width, cell height, and font size
    • color = #000000
    • background-color = #FFFFFF (added for progress circle shape on release 1.2.0)
    • Horizontal Bar :
      • width = 15
      • height = 20
    • Vertical Bar :
      • width = 20
      • height = 15


Parameters:

mixed   $attributes   —  Associative array or string of HTML tag attributes
int   $cell   —  (optional) Cell index

[ Top ]

setCellCoordinates   [line 1418]

void setCellCoordinates( integer $xgrid, integer $ygrid, [array $coord = array()])

Set the coordinates of each cell for a polygonal progress shape.

Parameters:

integer   $xgrid   —  The grid width in cell size
integer   $ygrid   —  The grid height in cell size
array   $coord   —  (optional) Coordinates (x,y) in the grid, of each cell

[ Top ]

setCellCount   [line 1258]

void setCellCount( integer $cells)

Sets the number of cell in the progress bar

Parameters:

integer   $cells   —  Cell count on progress bar

[ Top ]

setFillWay   [line 1212]

void setFillWay( string $way)

Sets the progress bar's fill way, which must be 'natural' or 'reverse'.

The default fill way is 'natural'.

  • Tutorial: progress.setfillway.pkg
  • See: HTML_Progress2::getFillWay()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

string   $way   —  fill direction (natural or reverse)

[ Top ]

setFrameAttributes   [line 1594]

void setFrameAttributes( [null|array $attributes = array()])

Build a frame around the progress bar.
  • Tutorial: progress.setframeattributes.pkg
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_OPTION
  • Since: 2.0.0
  • Access: public

Parameters:

null|array   $attributes   —  (optional) hash of style parameters

[ Top ]

setIdent   [line 2785]

void setIdent( [mixed $ident = null])

Sets this Progress instance's identification string.

Parameters:

mixed   $ident   —  (optional) the new identification string.

[ Top ]

setIncrement   [line 910]

void setIncrement( integer $inc)

Sets the progress bar's increment value.

Parameters:

integer   $inc   —  progress bar's increment value

[ Top ]

setIndeterminate   [line 703]

void setIndeterminate( boolean $continuous)

Sets the $indeterminate property of the progress bar, which determines whether the progress bar is in determinate or indeterminate mode.

An indeterminate progress bar continuously displays animation indicating that an operation of unknown length is occuring. By default, this property is false.


Parameters:

boolean   $continuous   —  whether countinuously displays animation

[ Top ]

setLabelAttributes   [line 1696]

void setLabelAttributes( string $name, mixed $attributes)

Sets label attributes.

Defaults are:

  • class = progressPercentLabel%s
  • width = 50
  • height = 0
  • font-size = 11
  • font-family = Verdana, Tahoma, Arial
  • font-weight = normal
  • color = #000000
  • background-color =
  • align = right
  • valign = right


Parameters:

string   $name   —  progress label id.
mixed   $attributes   —  Associative array or string of HTML tag attributes

[ Top ]

setMaximum   [line 848]

void setMaximum( integer $max)

Sets the progress bar's maximum value.

If the maximum value is different from previous maximum, all change listeners are notified.

  • Tutorial: progress.setmaximum.pkg
  • See: HTML_Progress2::getMaximum()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

integer   $max   —  progress bar's maximal value

[ Top ]

setMinimum   [line 784]

void setMinimum( integer $min)

Sets the progress bar's minimum value.

If the minimum value is different from previous minimum, all change listeners are notified.

  • Tutorial: progress.setminimum.pkg
  • See: HTML_Progress2::getMinimum()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

integer   $min   —  progress bar's minimal value

[ Top ]

setOrientation   [line 1142]

void setOrientation( integer $orient)

Sets the progress bar's orientation, which must be HTML_PROGRESS2_BAR_HORIZONTAL or HTML_PROGRESS2_BAR_VERTICAL.

The default orientation is HTML_PROGRESS2_BAR_HORIZONTAL.


Parameters:

integer   $orient   —  Orientation (horizontal or vertical)

[ Top ]

setProgressAttributes   [line 1951]

void setProgressAttributes( mixed $attributes)

Sets the common progress bar attributes.

Defaults are:

  • background-color = #FFFFFF
  • auto-size = true
  • Horizontal Bar :
    • width = (cell_count * (cell_width + cell_spacing)) + cell_spacing
    • height = cell_height + (2 * cell_spacing)
  • Vertical Bar :
    • width = cell_width + (2 * cell_spacing)
    • height = (cell_count * (cell_height + cell_spacing)) + cell_spacing


Parameters:

mixed   $attributes   —  Associative array or string of HTML tag attributes

[ Top ]

setProgressHandler   [line 2698]

void setProgressHandler( mixed $handler)

Sets the user callback function that execute all actions pending progress
  • Tutorial: progress.setprogresshandler.pkg
  • See: HTML_Progress2::process()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_CALLBACK
  • Since: 2.0.0
  • Access: public

Parameters:

mixed   $handler   —  Name of function or a class-method.

[ Top ]

setScript   [line 2080]

void setScript( string $url)

Set the external JavaScript code (file) to manage progress element.
  • Tutorial: progress.setscript.pkg
  • See: HTML_Progress2::getScript()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: 2.0.0
  • Access: public

Parameters:

string   $url   —  URL to the linked Progress JavaScript

[ Top ]

setValue   [line 959]

void setValue( integer $val)

Sets the progress bar's current value.

If the new value is different from previous value, all change listeners are notified.


Parameters:

integer   $val   —  progress bar's current value

[ Top ]

sleep   [line 2674]

void sleep( )

Default user callback when none are defined.

Delay execution of progress meter for the given number of milliseconds.

NOTE: The function http://www.php.net/manual/en/function.usleep.php did not work on Windows systems until PHP 5.0.0


[ Top ]

toArray   [line 2352]

array toArray( )

Returns the progress bar structure in an array.
  • Tutorial: progress.toarray.pkg
  • Since: 2.0.0
  • Access: public

[ Top ]

toHtml   [line 2385]

string toHtml( )

Returns the progress structure as HTML.
  • Tutorial: progress.tohtml.pkg
  • Since: 2.0.0
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:16:23 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.