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

Class: HTML_Progress2_Monitor

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

Class Overview


Monitoring of HTML loading bar into a dialog box.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005-2008 Laurent Laville

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 91]
Monitoring of HTML loading bar into a dialog box.

The HTML_Progress2_Monitor class allow an easy way to display progress bar into a dialog box, and observe all changes easily. User-end can stop task at anytime.

Here is a basic example:

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



[ Top ]


Class Variables

$autorun =

[line 112]

Attributes of monitor form.
  • Since: 2.0.0
  • Access: public

Type:   string


[ Top ]

$buttonCancel =

[line 111]

Attributes of monitor form.
  • Since: 2.0.0
  • Access: public

Type:   string


[ Top ]

$buttonStart =

[line 110]

Attributes of monitor form.
  • Since: 2.0.0
  • Access: public

Type:   string


[ Top ]

$caption = array()

[line 122]

Monitor status (text label of progress bar).
  • Since: 2.0.0
  • Access: public

Type:   array


[ Top ]

$dispatcher =

[line 149]

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

Type:   array


[ Top ]

$windowname =

[line 109]

Attributes of monitor form.
  • Since: 2.0.0
  • Access: public

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 212]

HTML_Progress2_Monitor __construct( [string $formName = 'ProgressMonitor'], [array $attributes = array()], [array $errorPrefs = array()])

Constructor (ZE2) Summary

  • Creates a standard progress bar into a dialog box (QuickForm). Form name, buttons 'start', 'cancel' labels and style, and title of dialog box may also be changed.
    1.    $monitor = new HTML_Progress2_Monitor();
  • Creates a progress bar into a dialog box, with only a new form name.
    1.    $monitor = new HTML_Progress2_Monitor($formName);
  • Creates a progress bar into a dialog box, with a new form name, new buttons name and style, and also a different title box.
    1.    $monitor = new HTML_Progress2_Monitor($formName$attributes);

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

Parameters:

string   $formName   —  (optional) Name of monitor dialog box (QuickForm)
array   $attributes   —  (optional) List of renderer options
array   $errorPrefs   —  (optional) Hash of parameters to configure error handler

[ Top ]

HTML_Progress2_Monitor (Constructor)   [line 174]

HTML_Progress2_Monitor HTML_Progress2_Monitor( [string $formName = 'ProgressMonitor'], [array $attributes = array()], [array $errorPrefs = array()])

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

Parameters:

string   $formName   —  (optional) Name of monitor dialog box (QuickForm)
array   $attributes   —  (optional) List of renderer options
array   $errorPrefs   —  (optional) Hash of parameters to configure error handler

[ Top ]

accept   [line 572]

void accept( object &$renderer)

Accepts a renderer.

Accepts a QF renderer for design pattern.

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

Parameters:

object   &$renderer   —  An HTML_QuickForm_Renderer object

[ Top ]

addListener   [line 301]

void addListener( mixed $callback)

Adds a new observer.

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 ]

display   [line 556]

void display( )

Renders the initial state of progress monitor.

This function should be used only to display initial state of the progress monitor with default QF renderer. If you use another QF renderer (Smarty, ITDynamic, ...) read template engine renderer related documentation.

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

[ Top ]

getProgressElement   [line 458]

object &getProgressElement( )

Returns a reference to the progress bar.

This function returns a reference to the progress meter used with the monitor. Its allow to change easily part or all basic options.


[ Top ]

getScript   [line 502]

string getScript( [boolean $raw = true])

Returns javascript progress meter handler.

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

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

getStyle   [line 475]

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 ]

isCanceled   [line 379]

bool isCanceled( )

Detect if progress monitor is stopped.

This function returns TRUE if progress monitor was canceled by user, FALSE otherwise.

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

[ Top ]

isStarted   [line 363]

bool isStarted( )

Detect if progress monitor is started.

This function returns TRUE if progress monitor was started by user, FALSE otherwise.

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

[ Top ]

removeListener   [line 331]

bool removeListener( mixed $callback)

Removes a registered observer.

This function removes a registered observer, and if there are no more observer, remove the event dispatcher interface too.

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

Parameters:

mixed   $callback   —  PHP callback that act as listener

[ Top ]

run   [line 398]

void run( )

Runs the progress monitor.

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

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

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

[ Top ]

setCaption   [line 607]

void setCaption( [string $caption = '&nbsp;'], [array $args = array()])

Display a caption on action in progress.

The idea of a simple utility function for replacing variables with values in an message template, come from sprintfErrorMessage function of Error_Raise package by Greg Beaver.

This simple str_replace-based function can be used to have an order-independent sprintf, so messages can be passed in with different grammar ordering, or other possibilities without changing the source code.

Variables should simply be surrounded by % as in %varname%

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

Parameters:

string   $caption   —  (optional) message template
array   $args   —  (optional) associative array of template var -> message text

[ Top ]

setProgressElement   [line 431]

void setProgressElement( object &$bar)

Links a progress bar to this monitor.

This function allow to define a complete progress bar from scratch.


Parameters:

object   &$bar   —  a html_progress2 instance

[ Top ]

toHtml   [line 525]

string toHtml( )

Returns the progress monitor structure as HTML.

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

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

[ Top ]


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