fm_update_progress_bar


bool fm_update_progress_bar ( string $progress_bar_name, int $number_of_steps_to_increment [, string $message [, int $number_of_steps [, int $current_step_number]]] )

 

Description


Allows you to update a progress bar by incrementing it, changing the message, resetting the number of steps and changing the current step number.

 

Parameters


progress_bar_name (required)
The name of the progress bar to update.

number_of_steps_to_increment (required)
The number of steps to increment.

message (optional)
The new message to be displayed on the progress bar.

number_of_steps (optional)
The new number of steps. This can be used to convert an indeterminate progress bar (barber pole) to a progress bar with steps once the number of steps is known. This can also be used to reset a progress bar instead of closing it and opening a new one.

current_step_number (optional)
The new current step number. Typically used when the number of steps is changed.

 

Return


Returns true if the progress bar was updated or false if the progress bar doesn’t exist.

 

Errors


315 Function not supported on server
904 Progress bar doesn’t exist

 

Example 1 - Display a progress bar with 10 steps
$name = 'Test';
$steps = 10;
$message = 'Testing, one moment please...';
$left = 25;
$top = 50;
$enableCancelButton = true;
$cancelButtonLabel = 'Stop';
fm_new_progress_bar($name, $steps, $message, $left, $top, $enableCancelButton, $cancelButtonLabel);
for ($i = 0; $i < $steps ; $i++) {
   sleep(1); // this is where you would do your processing
   fm_update_progress_bar($name, 1, $message . " step " . ($i + 1));
   if (fm_user_cancelled() === true) break;
}
// Make sure to close the progress bar.
fm_close_progress_bar($name);

Change Log

VersionDescription
3.0.0Added new parameters: number_of_steps, current_step_number.