Progressbar

A Progressbar displays the current status of a long running process. To update the status, a progressbar invokes an action request every few seconds. The percentage value of the last action will be transmitted as POST value.

The progressbar has to be started by setting the option running to true.

Attributes

Name Allowed Values Description
id Text Sets the unique ID of the widget
actionrefresh Method Name Method which will be executed every few seconds
refresh Number Interval in seconds to execute actionrefresh (Default: 5)

Options

Name Allowed Values Description
percentage Number Percentage value: 0-100
running Bool start/stop the progressbar
message Text Message to display the current status (Default: 'Please wait …')

Example

XML

<datarealm>
  <button action="progressbar">Start</button>
  <progressbar id="progressbar" refresh="1" actionrefresh="progressstep" />
</datarealm>

PHP

// action: progressbar
$result->setOption('progressbar', 'running', true);
 
// action: progressstep, will be called each second (Refresh=1)
$value = (array_key_exists('progressbar', $_POST)) ? intval($_POST['progressbar']) : 100;
if ($value >= 100)
  $result->setOption('progressbar', 'running', false);
else
  $result->setOption('progressbar', 'percentage', $value + 20);

Result

Links

You could leave a comment if you were logged in.