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

Class: HTML_Progress2_Monitor

Source Location: /HTML_Progress2-2.3.0/Progress2/Monitor.php

Class Overview


Monitoring of HTML loading bar into a dialog box.


Author(s):

Version:

  • Release: 2.3.0

Copyright:

  • 2005-2007 Laurent Laville

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 89]
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 110]

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

Type:   string


[ Top ]

$buttonCancel =

[line 109]

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

Type:   string


[ Top ]

$buttonStart =

[line 108]

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

Type:   string


[ Top ]

$caption = array()

[line 120]

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

Type:   array


[ Top ]

$dispatcher =

[line 147]

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

Type:   array


[ Top ]

$windowname =

[line 107]

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

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 203]

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: 2.0.0
  • 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 params to configure error handler

[ Top ]

HTML_Progress2_Monitor (Constructor)   [line 167]

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

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

Parameters:

   $formName   — 
   $attributes   — 
   $errorPrefs   — 

[ Top ]

accept   [line 542]

void accept( &$renderer, object $renderer)

Accepts a renderer.

Accepts a QF renderer for design pattern.

  • Since: 2.0.0
  • Access: public

Parameters:

object   $renderer   —  An HTML_QuickForm_Renderer object
   &$renderer   — 

[ Top ]

addListener   [line 280]

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

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: 2.0.0RC2
  • Access: public

[ Top ]

getProgressElement   [line 431]

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

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: 2.0.0
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Access: public

Parameters:

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

[ Top ]

getStyle   [line 448]

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: 2.0.0
  • Throws: HTML_PROGRESS2_ERROR_INVALID_INPUT
  • Access: public

Parameters:

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

[ Top ]

isCanceled   [line 356]

bool isCanceled( )

Detect if progress monitor is stopped.

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

  • Since: 2.0.0
  • Access: public

[ Top ]

isStarted   [line 340]

bool isStarted( )

Detect if progress monitor is started.

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

  • Since: 2.0.0
  • Access: public

[ Top ]

removeListener   [line 309]

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.


Parameters:

mixed   $callback   —  PHP callback that act as listener

[ Top ]

run   [line 375]

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: 2.0.0
  • Access: public

[ Top ]

setCaption   [line 574]

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: 2.0.0
  • Access: public

Parameters:

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

[ Top ]

setProgressElement   [line 405]

void setProgressElement( &$bar, 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
   &$bar   — 

[ Top ]

toHtml   [line 496]

string toHtml( )

Returns the progress monitor structure as HTML.

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

  • Since: 2.0.0
  • Access: public

[ Top ]


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