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

Class: HTML_Progress2

Source Location: /HTML_Progress2-2.4.2/HTML/Progress2.php

Class Overview

HTML_Common
   |
   --HTML_Progress2

HTML loading bar with only PHP and JS interface.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005-2008 Laurent Laville

Variables

Methods


Child classes:

myBar
HTML loading bar with only PHP and JS interface.

Inherited Variables

Inherited Methods


Class Details

[line 170]
HTML loading bar with only PHP and JS interface.

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.

Here is a basic example:

  1.  <?php
  2.  require_once 'HTML/Progress2.php';
  3.  
  4.  $pb = new HTML_Progress2();
  5.  $pb->setAnimSpeed(50);
  6.  ?>
  7.  <html>
  8.  <head>
  9.  <?php
  10.  echo $pb->getStyle(false);
  11.  echo $pb->getScript(false);
  12.  ?>
  13.  </head>
  14.  <body>
  15.  <?php
  16.  $pb->display();
  17.  $pb->run();
  18.  ?>
  19.  </body>
  20.  </html>



[ Top ]


Class Variables

$aflax = array()

[line 536]

Resources to handle AFLAX upload progress meter:

Type:   array


[ Top ]

$ajax = array()

[line 522]

Resources to handle AJAX progress meter:

Type:   array


[ Top ]

$animSpeed =

[line 245]

Delay in millisecond 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 444]

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 472]

Progress bar cells properties

  1.  $cell = array(
  2.    'class' => 'cell%s',                 # css class selector
  3.    'active-color' => '#006600',         # active color
  4.    'inactive-color' => '#CCCCCC',       # inactive color
  5.    'font-family' => 'Courier, Verdana'# font family
  6.    'font-size' => 8,                    # font size
  7.    'color' => '#000000',                # foreground color
  8.    'background-color' => '#FFFFFF',     # background color
  9.    'background-image' => 'none',        # cell background image
  10.    'background-repeat' => 'no-repeat',  # cell background image repeat option
  11.    'background-position' => 'top left'# cell background image start position
  12.    'width' => 15,                       # cell width
  13.    'height' => 20,                      # cell height
  14.    'spacing' => 2                       # cell spacing
  15.  );


Type:   array


[ Top ]

$cellCount =

[line 345]

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

Type:   integer


[ Top ]

$dispatcher =

[line 222]

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

Type:   array


[ Top ]

$fillWay =

[line 335]

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 425]

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-width' => 2,         # border width
  9.     'border-style' => 'solid',   # border style
  10.                                  # (solid, dashed, dotted ...)
  11.     'border-color' => '#DFDFDF #404040 #404040 #DFDFDF'
  12.                                  # border color (3dfx)
  13.  );


Type:   array


[ Top ]

$ident =

[line 213]

The label that uniquely identifies this progress object.

Type:   string


[ Top ]

$increment =

[line 288]

The progress bar's increment value.

The default is +1.


Type:   integer


[ Top ]

$indeterminate =

[line 192]

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 502]

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' => 'transparent',          # 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 277]

The progress bar's maximum value.

The default is 100.


Type:   integer


[ Top ]

$minimum =

[line 266]

The progress bar's minimum value.

The default is 0.


Type:   integer


[ Top ]

$orientation =

[line 309]

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

The default is horizontal.


Type:   integer


[ Top ]

$script =

[line 512]

External Javascript file to override internal default code

Type:   string


[ Top ]

$value =

[line 298]

The progress bar's current value.

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 647]

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 only percent label. The initial and minimum values are 0, and the maximum is 100.


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 619]

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

Constructor (ZE1)
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

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 ]

addLabel   [line 1986]

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

Add a new label to the progress meter.

Defines a new label identifier choosen between five categories:

  • HTML_PROGRESS2_LABEL_TEXT constant if you want a simple text zone
  • HTML_PROGRESS2_LABEL_BUTTON constant if you want a form button
  • HTML_PROGRESS2_LABEL_STEP constant if you want a step resume progress
  • HTML_PROGRESS2_LABEL_PERCENT constant if you want current progress value
  • HTML_PROGRESS2_LABEL_CROSSBAR constant if you want a little javascript animation


Parameters:

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

[ Top ]

addListener   [line 3264]

void addListener( mixed $callback, [string $nName = EVENT_DISPATCHER_GLOBAL])

Attachs a new observer.

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

  • See: HTML_Progress2::removeListener()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_CALLBACK, HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

Parameters:

mixed   $callback   —  PHP callback that will act as listener
string   $nName   —  Expected notification name, serves as a filter

[ Top ]

apiVersion   [line 766]

string apiVersion( )

Returns the current API version.

This function return a "PHP-standardized" version number string. This is useful if you would like to write programs working only on some versions of HTML_Progress2. See also php version_compare() function.


[ Top ]

display   [line 3061]

void display( )

Renders the new value of progress meter.

This method should be used only to display initial state of the progress meter. Next steps to refresh display must use either moveStep() or moveNext() methods.

  • Since: version 2.0.0 (2005-10-01)
  • Access: public

[ Top ]

drawCircleSegments   [line 2373]

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

Draw all circle segment pictures.

This function build/prepare all circle segment PNG pictures that will be send to browser output. Requires PEAR::Image_Color and PHP:gd extension.


Parameters:

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

[ Top ]

fileExists   [line 3700]

bool fileExists( string $fileName)

Checks whether the file exists in the include path

Method used to check if a file (Ajax engine driver) is available and readable.

  • Since: version 2.3.0a1 (2007-01-17)
  • Access: protected

Parameters:

string   $fileName   —  file name

[ Top ]

getAnimSpeed   [line 2455]

integer getAnimSpeed( )

Returns delay execution of the progress meter.

Given a delay in process of the progress meter is only necessary if you need demonstration or also smooth animation. The default value is zero (no delay).


[ Top ]

getBorderAttributes   [line 1716]

mixed getBorderAttributes( [bool $asString = false])

Returns progress bar's border attributes values.

Get all border attributes in a associative array with key-value couple (by default). Get the attributes as string is also possible.


Parameters:

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

[ Top ]

getCellAttributes   [line 1475]

mixed getCellAttributes( [bool $asString = false])

Returns cell attributes values.

Get all cell attributes in a associative array with key-value couple (by default). Get the attributes as string is also possible.


Parameters:

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

[ Top ]

getCellCoordinates   [line 1597]

array getCellCoordinates( )

Returns coordinates of each cell for a polygonal progress meter.

Get array of all cell coordinates (x,y) that define a polygonal progress meter. For example, a 3x3 square as: (0,0) for top left corner, (2,0) for top right corner, (2,2) for bottom right corner, and (0,2) for bottom left corner.


[ Top ]

getCellCount   [line 1419]

integer getCellCount( )

Returns count of cell in the progress meter.

Get the number of cell defined to a progress meter. It must be positive. The default value is 10.


[ Top ]

getError   [line 4391]

false|array|PEAR_Error getError( )

Pop an error off of the HTML_Progress2 stack.

Get all error data (code, message, level, context) from an object (PEAR_Error, ...) or a simple php array.


[ Top ]

getFillWay   [line 1367]

string getFillWay( )

Returns fill option of the progress meter.

Get 'natural' or 'reverse', depending of the fill way of progress meter. 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 1779]

mixed getFrameAttributes( [bool $asString = false])

Returns frame attributes values.

Get all frame attributes in a associative array with key-value couple (by default). Get the attributes as string is also possible.


Parameters:

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

[ Top ]

getIdent   [line 3219]

string getIdent( )

Returns the progress meter identifier.

Each progress meter has its own identifier. That allows to display more than only once meter at same time on same page.


[ Top ]

getIncrement   [line 1023]

integer getIncrement( )

Returns the progress meter increment value.

Get step of progress property of a progress meter. The default value is +1.


[ Top ]

getLabelAttributes   [line 1880]

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

Returns attributes values of an existing label.

Get all attributes of an existing label identified by $name argument. This identifier must be the same as the one given to addLabel() method. Return attributes values in a associative array with key-value couple (by default). Get the attributes as string is also possible.


Parameters:

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

[ Top ]

getMaximum   [line 950]

integer getMaximum( )

Returns the progress meter maximum value.

Get the maximum value at which the progress meter will stop. The default value is 100 and can't be less than minimum.


[ Top ]

getMinimum   [line 877]

integer getMinimum( )

Returns the progress meter minimum value.

Get the minimum value at which the progress meter will start. The default value is zero and can't be negative.


[ Top ]

getOrientation   [line 1289]

integer getOrientation( )

Returns orientation of the progress bar.

There are only two distinct orientations for a progress bar: horizontal and vertical, identified by two constants: HTML_PROGRESS2_BAR_HORIZONTAL and HTML_PROGRESS2_BAR_VERTICAL. While circle and other polygonal progress meter are identified by two other constants: HTML_PROGRESS2_CIRCLE and HTML_PROGRESS2_POLYGONAL. The default orientation is horizontal.


[ Top ]

getPercentComplete   [line 1250]

float getPercentComplete( [boolean $float = true])

Returns the percent complete of the progress meter.

Note that this number is between 0.00 and 1.00 when $float = true. And this number is between 0 and 100 when $float = false.


Parameters:

boolean   $float   —  (optional) float or integer format

[ Top ]

getProgressAttributes   [line 2172]

mixed getProgressAttributes( [bool $asString = false])

Returns the progress background attributes values.

Get all background attributes in a associative array with key-value couple (by default). Get the attributes as string is also possible.


Parameters:

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

[ Top ]

getScript   [line 2243]

string getScript( [boolean $raw = true], [string $path = null])

Returns javascript progress meter handler.

Get the javascript URL or inline code that will handle the progress meter refresh.

  • See: HTML_Progress2::setScript()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_RESOURCE
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

Parameters:

boolean   $raw   —  (optional) html output with script tags or just raw data
string   $path   —  (optional) directory, with no trailing slash, where to get HTML_Progress2.js file

[ Top ]

getStyle   [line 2516]

string getStyle( [boolean $raw = true])

Returns the cascading style sheet (CSS).

Get the CSS required to display the progress meter in a HTML document.

  • Since: version 2.0.0 (2005-10-01)
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Access: public

Parameters:

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

[ Top ]

getValue   [line 1075]

integer getValue( )

Returns the progress meter current value.

Get the current value of the progress meter that is always between the minimum and maximum values, inclusive. The default value is equal to minimum.


[ Top ]

hasErrors   [line 4375]

integer hasErrors( )

Determine whether there are errors into the HTML_Progress2 stack.

This function gave you ability to be aware of API errors presence in user scripts.


[ Top ]

hide   [line 3077]

void hide( )

Hides the progress meter.

Once the process is over this method provides a solution to remove/hide the progress meter of the browser screen.

  • Since: version 2.0.0 (2005-10-01)
  • Access: public

[ Top ]

importStyle   [line 2637]

void|PEAR_Error importStyle( mixed $styles)

Import cascading style sheet (CSS) elements

Set the CSS required to display the progress meter in a HTML document.

  • Since: version 2.2.0 (2007-01-03)
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Access: public

Parameters:

mixed   $styles   —  CSS elements reference to import

[ Top ]

incValue   [line 1143]

void incValue( )

Updates the internal progress meter current value.

The new current value is equal to previous value increase by increment value. All listeners are notified. See also moveNext() method if you want a refresh display too.


[ Top ]

isBorderPainted   [line 833]

boolean isBorderPainted( )

Determines whether the progress bar border is painted or not.

By default, each progress bar (horizontal, vertical) has no border. This function gave ability to know if you've already set a border (return TRUE), or not (return FALSE).


[ Top ]

isIndeterminate   [line 789]

boolean isIndeterminate( )

Returns mode of the progress meter.

There are two types of progress meters: determinate and undeterminate.

Determinate progress meters are used when you know the length of time that an operation will take. The progress meter will fill up and, once full, the operation should be finished.

Undeterminate progress meters are used when you do not know the length of time of an operation. The progress meter will have an animation such a sliding box.


[ Top ]

moveNext   [line 1222]

void moveNext( )

Changes new value of the progress meter by increment increase.

Move current value to the next value of the progress meter defined by its increment. If result value is different than previous, then all listeners are notified.


[ Top ]

moveStep   [line 1171]

void moveStep( integer $step)

Changes new value of the progress meter by step increase.

Move current value to the next step of the progress meter defined by its increment. If result value is different than previous, then all listeners are notified. Caution: a step is always between 1 and (maximum / taskcount) rounded fractions up.


Parameters:

integer   $step   —  new step value

[ Top ]

process   [line 3157]

mixed process( )

Performs the progress user process.

This function call the user-specified progress function, defined by setProgressHandler() method. Default callback is the HTML_Progress2::sleep() method.


[ Top ]

raiseError   [line 4352]

mixed raiseError( )

A basic wrapper around the default PEAR_Error object.

This method throws any internal API error that could be raised due to a wrong programming. It will use your error handler system defined at class construction (by first argument).

  • See: _errorHandler()
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

[ Top ]

registerAFLAX   [line 3486]

void registerAFLAX( string $serverAflaxUrl, string $serverUploadUri, [array $callback = array()], [array $extension = array()])

Register an external AFLAX server to upload file with a progress meter.

Pure PHP solution of upload file with a progress bar is only possible since PHP 5.2.0 AFLAX stands for Asynchronous Flash and XML provides an upload file solution with integration of progress feedback.

  • See: HTML_Progress2::setupAFLAX()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_RESOURCE
  • Since: version 2.3.0a3 (2007-02-02)
  • Access: public

Parameters:

string   $serverAflaxUrl   —  Url of the Adobe Flash "aflax.swf" resource
string   $serverUploadUri   —  Uri of the php script to handle uploaded files
array   $callback   —  (optional) list of event handler for browse file dialog box
array   $extension   —  (optional) list of file types for browse file dialog box

[ Top ]

registerAJAX   [line 3352]

void registerAJAX( string $serverUrl, [array $stub = array()], [array $client = array('all')])

Register an external AJAX server to use for progress bar polling.

Until version 2.2.0 Progress2 has only COMET (streaming) ability. With first alpha of 2.3.0 version, Progress2 has now AJAX (polling) ability. Use PEAR::HTML_AJAX package as backend.

  • See: HTML_Progress2::setupAJAX()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_RESOURCE
  • Since: version 2.3.0a1 (2007-01-17)
  • Access: public

Parameters:

string   $serverUrl   —  the url the client should be making a request to
array   $stub   —  (optional) list of proxy definition for
array   $client   —  (optional) list of client libraries to use

[ Top ]

removeLabel   [line 2135]

void removeLabel( string $name)

Removes a label to the progress meter.

The label identifier must exists or it cannot be remove. This is the same identifier as the one given to addLabel() method.


Parameters:

string   $name   —  Label name

[ Top ]

removeListener   [line 3304]

bool removeListener( mixed $callback, [string $nName = EVENT_DISPATCHER_GLOBAL])

Removes a registered observer.

Detachs a previously registered observer and remove the Event Dispatcher if there is no more observer registered.

  • Return: True if observer was removed, false otherwise
  • See: HTML_Progress2::addListener()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_CALLBACK, HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

Parameters:

mixed   $callback   —  PHP callback that act as listener
string   $nName   —  Expected notification name, serves as a filter

[ Top ]

run   [line 3182]

void run( )

Runs the progress meter.

This function accept both modes: indeterminate and determinate, and execute all actions defined in the user callback identified by setProgressHandler() method.

All observers are also notified of main changes (start, stop meter).


[ Top ]

setAnimSpeed   [line 2475]

void setAnimSpeed( integer $delay)

Sets delay execution of the progress meter.

The delay (in millisecond) cannot exceed 1000 (1 second), that is enough to smooth an animation. User process should slow down animation and in most case the default value (zero) will be efficient.


Parameters:

integer   $delay   —  Delay in millisecond.

[ Top ]

setBorderAttributes   [line 1757]

void setBorderAttributes( mixed $attributes)

Sets the progress bar's border attributes.

Defines all border attributes (color, size, ...) a progress bar (only horizontal or vertical) can handle.

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 852]

void setBorderPainted( boolean $paint)

Decides to paint or not a border to the progress bar.

This function gave ability to set ($paint = TRUE) or remove ($paint = FALSE) a border to the current progress bar.


Parameters:

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

[ Top ]

setCellAttributes   [line 1536]

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

Sets cell attributes values.

Sets cell attributes for all cells (default) or a specific an existing cell.

Defaults are:

  • 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
  • background-image = none
  • background-repeat = no-repeat
  • background-position = top left
  • 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 1618]

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

Sets coordinates of each cell for a polygonal progress meter.

A polygonal progress meter is defined by its size (width, height) and its cells coordinates (array of couple x,y screen coordinates).


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 1438]

void setCellCount( integer $cells)

Sets count of cell in the progress meter.

Defines the number of cell to a progress meter. It must be positive. The default value is 10.


Parameters:

integer   $cells   —  Cell count on progress meter

[ Top ]

setFillWay   [line 1386]

void setFillWay( string $way)

Sets fill option of the progress meter.

Sets the progress meter fill option: must be 'natural' or 'reverse'. The default fill way is 'natural'.


Parameters:

string   $way   —  fill direction (natural or reverse)

[ Top ]

setFrameAttributes   [line 1825]

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

Sets the progress meter frame attributes.

Allows to build a customisable frame (color, size) around the progress meter.

Defaults are:

  • show = true
  • left = 200
  • top = 100
  • width = 320
  • height = 90
  • color = #C0C0C0
  • border-width = 2
  • border-style = solid
  • border-color = #DFDFDF #404040 #404040 #DFDFDF

  • Since: version 2.0.0 (2005-10-01)
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_OPTION
  • Access: public

Parameters:

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

[ Top ]

setIdent   [line 3239]

void setIdent( [mixed $ident = null])

Sets the progress meter identifier.

Each progress meter has its own identifier. That allows to display more than only once meter at same time on same page. If no identification string is given, then the default identifier will be six first characters of md5 hash value of the current unix timestamp.


Parameters:

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

[ Top ]

setIncrement   [line 1042]

void setIncrement( integer $inc)

Sets the progress meter increment value.

Defines step of progress property of a progress meter. Allows to ajust default value (+1).


Parameters:

integer   $inc   —  progress meter's increment value

[ Top ]

setIndeterminate   [line 808]

void setIndeterminate( boolean $continuous)

Sets the mode of progress meter.

Default progress meters are in determinate mode ($continuous = TRUE), but can be switched anytime in indeterminate mode ($continuous = FALSE).


Parameters:

boolean   $continuous   —  whether countinuously displays animation

[ Top ]

setLabelAttributes   [line 1938]

void setLabelAttributes( string $name, mixed $attributes)

Sets attributes values of an existing label.

Defines attributes (font, color, size, alignement ...) of an existing label. Whether an attribute is not specified, previous or default value is used instead.

Defaults are:

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


Parameters:

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

[ Top ]

setMaximum   [line 971]

void setMaximum( integer $max)

Sets the progress meter maximum value.

Set the maximum value at which the progress meter will stop. The default value is 100 and can't be less than minimum. If the new maximum is different than previous value, all listeners are notified.


Parameters:

integer   $max   —  progress meter's maximal value

[ Top ]

setMinimum   [line 898]

void setMinimum( integer $min)

Sets the progress meter minimum value.

Set the minimum value at which the progress meter will start. The default value is zero and can't be negative. If the new minimum is different than previous value, all listeners are notified.


Parameters:

integer   $min   —  progress meter's minimal value

[ Top ]

setOrientation   [line 1312]

void setOrientation( integer $orient)

Sets orientation of the progress bar.

There are only two distinct orientations for a progress bar: horizontal and vertical, identified by two constants: HTML_PROGRESS2_BAR_HORIZONTAL and HTML_PROGRESS2_BAR_VERTICAL. While circle and other polygonal progress meter are identified by two other constants: HTML_PROGRESS2_CIRCLE and HTML_PROGRESS2_POLYGONAL. The default orientation is horizontal.


Parameters:

integer   $orient   —  Orientation (horizontal or vertical)

[ Top ]

setProgressAttributes   [line 2220]

void setProgressAttributes( mixed $attributes)

Sets the progress background attributes values.

Background attributes are color and size, with default values:

  • background-color = #FFFFFF
  • background-image = none
  • background-repeat = no-repeat
  • background-position = top left
  • 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 3132]

void setProgressHandler( mixed $handler)

Sets the user progress callback function.

The process() function will call the user-callback defined here by this setProgressHandler() method.

The user-supplied progress function must return either positive for a step progression, using moveStep() method, or NULL for a standard progression, using moveNext() method.

  • See: HTML_Progress2::process()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_CALLBACK
  • Since: version 2.0.0 (2005-10-01)
  • Access: public

Parameters:

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

[ Top ]

setScript   [line 2329]

void setScript( string $url)

Sets the javascript progress meter handler.

Defines the javascript source (URL or inline code) that will handle the progress meter refresh.


Parameters:

string   $url   —  URL to the linked Progress JavaScript

[ Top ]

setupAFLAX   [line 3560]

string setupAFLAX( [boolean $raw = false], [string $path = null])

Include all needed JS libraries
  • See: HTML_Progress2::registerAFLAX()
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT, HTML_PROGRESS2_ERROR_INVALID_RESOURCE
  • Since: version 2.3.0a3 (2007-02-02)
  • Access: public

Parameters:

boolean   $raw   —  (optional) html output with script tags or just JS links
string   $path   —  (optional) directory, with no trailing slash, where to get HTML_Progress2_AFLAX.js and ajax.js files

[ Top ]

setupAJAX   [line 3411]

string setupAJAX( [string $serializer = null])

Include all needed libraries, stubs, and set defaultServer

Parameters:

string   $serializer   —  (optional) What encoding you are going to use for serializing/unserializing data

[ Top ]

setValue   [line 1095]

void setValue( integer $val)

Sets the progress meter current value.

Set the current value of the progress meter that is always between the minimum and maximum values, inclusive. If the new value is different from previous, then all listeners are notified.


Parameters:

integer   $val   —  progress meter's current value

[ Top ]

sleep   [line 3101]

void sleep( )

Delay execution.

The HTML_Progress2::sleep() function delays program execution for the given number of milliseconds. This is the default user callback when none are defined.

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 2769]

array toArray( )

Returns the progress meter structure into an array.

Get all progress meter properties, couple key-value, into a php array. This structure is read-only, a dump-like information.

  • Since: version 2.0.0 (2005-10-01)
  • Access: public

[ Top ]

toHtml   [line 2805]

string toHtml( )

Returns the progress meter structure as HTML.

Get html code required to display the progress meter in any html document.

  • Since: version 2.0.0 (2005-10-01)
  • Access: public

[ Top ]


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