$ajax = array()
[line 501]
Resources to handle AJAX progress meter:
$animSpeed =
[line 225]
Delay in millisecond before each progress cells display.
1000 ms === sleep(1) <strong>usleep()</strong> function does not run on Windows platform.
$border = array()
[line 423]
Progress bar border properties
$border = array(
'class' => 'progressBorder%s', # css class selector
'width' => 0, # width size in pixel
'style' => 'solid', # style (solid, dashed, dotted ...)
'color' => '#000000' # color
);
$cell = array()
[line 451]
Progress bar cells properties
$cell = array(
'class' => 'cell%s', # css class selector
'active-color' => '#006600', # active color
'inactive-color' => '#CCCCCC', # inactive color
'font-family' => 'Courier, Verdana', # font family
'font-size' => 8, # font size
'color' => '#000000', # foreground color
'background-color' => '#FFFFFF', # background color
'background-image' => 'none', # cell background image
'background-repeat' => 'no-repeat', # cell background image repeat option
'background-position' => 'top left', # cell background image start position
'width' => 15, # cell width
'height' => 20, # cell height
'spacing' => 2 # cell spacing
);
$cellCount =
[line 325]
The cell count of the progress bar. The default is 10.
$dispatcher =
[line 202]
Stores the event dispatcher which handles notifications
$fillWay =
[line 315]
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
$frame = array()
[line 404]
Progress bar frame properties
$frame = array(
'show' => false, # frame show (true/false)
'left' => 200, # position from left
'top' => 100, # position from top
'width' => 320, # width
'height' => 90, # height
'color' => '#C0C0C0', # color
'border-width' => 2, # border width
'border-style' => 'solid', # border style
# (solid, dashed, dotted ...)
'border-color' => '#DFDFDF #404040 #404040 #DFDFDF' # border color (3dfx)
);
$ident =
[line 193]
The label that uniquely identifies this progress object.
$increment =
[line 268]
The progress bar's increment value.
The default is +1.
$indeterminate =
[line 172]
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.
$label = array()
[line 481]
Progress bar labels properties
$label = array(
'name' => array( # label name
'type' => 'text', # label type
# (text,button,step,percent,crossbar)
'value' => ' ', # label value
'left' => ($left), # label position from left
'top' => ($top - 16), # label position from top
'width' => 0, # label width
'height' => 0, # label height
'align' => 'left', # label align
'background-color' => 'transparent', # label background color
'font-family' => 'Verdana, Tahoma, Arial', # label font family
'font-size' => 11, # label font size
'font-weight' => 'normal', # label font weight
'color' => '#000000', # label font color
'class' => 'progressPercentLabel%s' # css class selector
);
$maximum =
[line 257]
The progress bar's maximum value.
The default is 100.
$minimum =
[line 246]
The progress bar's minimum value.
The default is 0.
$orientation =
[line 289]
Whether the progress bar is horizontal, vertical, polygonal or circle.
The default is horizontal.
$script =
[line 491]
External Javascript file to override internal default code
$value =
[line 278]
The progress bar's current value.
__construct (Constructor) [line 603]
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:
HTML_Progress2 (Constructor) [line 577]
HTML_Progress2 HTML_Progress2(
[
$errorPrefs = array()], [
$orient = HTML_PROGRESS2_BAR_HORIZONTAL], [
$min = 0], [
$max = 100], [
$percentLabel = 'pct1'])
|
|
Constructor (ZE1)
Parameters:
addLabel [line 1867]
void addLabel(
string
$type, string
$name, [string
$value = ' '])
|
|
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:
addListener [line 3094]
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.
Parameters:
apiVersion [line 714]
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.
display [line 2900]
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.
drawCircleSegments [line 2238]
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:
fileExists [line 3290]
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.
Parameters:
getAnimSpeed [line 2314]
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).
getBorderAttributes [line 1611]
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:
getCellAttributes [line 1386]
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:
getCellCoordinates [line 1500]
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.
getCellCount [line 1332]
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.
getError [line 3971]
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.
getFillWay [line 1282]
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'.
getFrameAttributes [line 1672]
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:
getIdent [line 3050]
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.
getIncrement [line 959]
Returns the progress meter increment value.
Get step of progress property of a progress meter. The default value is +1.
getLabelAttributes [line 1770]
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:
getMaximum [line 891]
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.
getMinimum [line 823]
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.
getOrientation [line 1206]
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.
getPercentComplete [line 1168]
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:
getProgressAttributes [line 2047]
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:
getScript [line 2116]
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.
Parameters:
getStyle [line 2372]
string getStyle(
[boolean
$raw = true])
|
|
Returns the cascading style sheet (CSS).
Get the CSS required to display the progress meter in a HTML document.
Parameters:
getValue [line 1009]
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.
hasErrors [line 3955]
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.
hide [line 2916]
Hides the progress meter.
Once the process is over this method provides a solution to remove/hide the progress meter of the browser screen.
importStyle [line 2482]
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.
Parameters:
incValue [line 1072]
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.
isBorderPainted [line 780]
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).
isIndeterminate [line 737]
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.
moveNext [line 1142]
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.
moveStep [line 1097]
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:
process [line 2994]
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.
raiseError [line 3933]
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).
registerAJAX [line 3177]
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.
Parameters:
removeLabel [line 2012]
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:
removeListener [line 3132]
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.
Parameters:
run [line 3018]
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).
setAnimSpeed [line 2334]
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:
setBorderAttributes [line 1651]
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:
setBorderPainted [line 799]
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:
setCellAttributes [line 1445]
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 :
- Vertical Bar :
Parameters:
setCellCoordinates [line 1521]
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:
setCellCount [line 1351]
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:
setFillWay [line 1301]
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:
setFrameAttributes [line 1717]
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
Parameters:
setIdent [line 3069]
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:
setIncrement [line 978]
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:
setIndeterminate [line 756]
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:
setLabelAttributes [line 1826]
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:
setMaximum [line 912]
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:
setMinimum [line 844]
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:
setOrientation [line 1229]
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:
setProgressAttributes [line 2094]
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:
setProgressHandler [line 2971]
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.
Parameters:
setScript [line 2196]
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:
setupAJAX [line 3229]
string setupAJAX(
[string
$serializer = null])
|
|
Include all needed libraries, stubs, and set defaultServer
Parameters:
setValue [line 1029]
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:
sleep [line 2940]
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
toArray [line 2611]
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.
toHtml [line 2645]
Returns the progress meter structure as HTML.
Get html code required to display the progress meter in any html document.