|
| __construct (string $idnumber, int $width=0, bool $autostart=true) |
| This overwrites the progress_bar::__construct method.
|
|
| auto_update (bool $value) |
| Set whether or not to auto render updates to the screen.
|
|
| create () |
| Just set the timestart, do not render the bar immediately.
|
|
| error (string $errormsg) |
| Set that the process running has errored and store that against the bar.
|
|
| export_for_template (renderer_base $output) |
| Export for template.
|
|
| export_for_template (\renderer_base $output) |
| Export for template.
|
|
| get_content () |
| Get the content to display the progress bar and start polling via AJAX.
|
|
| get_estimate_message (float $percent) |
| This gets the estimate message to be displayed with the progress bar.
|
|
| get_haserrored () |
| Check if the process has errored.
|
|
| get_id () |
| Getter for ID.
|
|
| get_message () |
| Get the progress bar message.
|
|
| get_percent () |
| Get the percent.
|
|
| init_js () |
| Initialise Javascript for stored progress bars.
|
|
| render () |
| Render the progress bar.
|
|
| restart () |
| Restart the progress bar.
|
|
| start () |
| Start the recording of the progress and store in the database.
|
|
| store_pending () |
| Store a progress bar record in a pending state.
|
|
| update ($cur, $total, $msg) |
| Update progress bar according the number of tasks.
|
|
| update_full ($percent, $msg) |
| Update progress bar according percent.
|
|
|
static | convert_to_idnumber (string $class, ?int $id=null) |
| We need a way to specify a unique idnumber for processes being monitored, so that firstly we don't accidentally overwrite a running process, and secondly so we can automatically load them in some cases, without having to manually code in its name.
|
|
static | get_by_id (int $id) |
| Load the stored progress bar from the database, based on it's record ID.
|
|
static | get_by_idnumber (string $idnumber) |
| Load the stored progress bar from the database based on its uniqued idnumber.
|
|
static | get_timeout () |
| Get the polling timeout in seconds.
|
|
static | load (\stdClass $record) |
| Load the stored progress bar object from its record in the database.
|
|
|
bool | $autoupdate = true |
| Whether or not to auto render updates to the screen.
|
|
core clock | $clock |
| Clock object.
|
|
bool | $haserrored = false |
| Whether or not an error has occured.
|
|
string | $idnumber |
| unique id
|
|
int | $lastupdate = 0 |
| time when last printed
|
|
string null | $message = null |
| Message to associate with bar.
|
|
int | $percent = 0 |
| last percentage printed
|
|
int | $recordid |
| DB record ID.
|
|
int | $timestart = 0 |
| when did we start printing this
|
|
int | $width |
| total width
|
|
|
static bool | $jsloaded = false |
| Flag to indicate the Javascript module has been initialised already.
|
|
static bool | $supportsoutputbuffering = true |
| Can use output buffering.
|
|
◆ __construct()
core\output\stored_progress_bar::__construct |
( |
string | $idnumber, |
|
|
int | $width = 0, |
|
|
bool | $autostart = true ) |
This overwrites the progress_bar::__construct method.
The stored progress bar does not need to check NO_OUTPUT_BUFFERING since it outputs to the page then polls for updates asynchronously, rather than waiting for synchronous updates in later output.
- Parameters
-
string | $idnumber | |
int | $width | The suggested width. |
bool | $autostart | Whether to start the progress bar right away. |
◆ auto_update()
core\output\progress_bar::auto_update |
( |
bool | $value | ) |
|
|
inherited |
Set whether or not to auto render updates to the screen.
- Parameters
-
- Return values
-
◆ clear_records()
core\output\stored_progress_bar::clear_records |
( |
| ) |
|
|
protected |
End the polling progress and delete the DB record.
- Return values
-
◆ convert_to_idnumber()
static core\output\stored_progress_bar::convert_to_idnumber |
( |
string | $class, |
|
|
?int | $id = null ) |
|
static |
We need a way to specify a unique idnumber for processes being monitored, so that firstly we don't accidentally overwrite a running process, and secondly so we can automatically load them in some cases, without having to manually code in its name.
So this uses the classname of the object being monitored, along with its id.
This method should be used when creating the stored_progress record to set it's idnumber.
- Parameters
-
string | $class | Class name of the object being monitored, e.g. local_something::task::my_task |
int | null | $id | ID of an object from database, e.g. 123 |
- Return values
-
string | Converted string, e.g. local_something_task_my_task_123 |
◆ create()
core\output\stored_progress_bar::create |
( |
| ) |
|
◆ error()
core\output\stored_progress_bar::error |
( |
string | $errormsg | ) |
|
Set that the process running has errored and store that against the bar.
- Parameters
-
- Return values
-
Reimplemented from core\output\progress_bar.
◆ estimate()
core\output\progress_bar::estimate |
( |
| $pt | ) |
|
|
protectedinherited |
Estimate how much time it is going to take.
- Parameters
-
- Return values
-
mixed | Null (unknown), or int. |
◆ export_for_template() [1/2]
core\output\progress_bar::export_for_template |
( |
renderer_base | $output | ) |
|
|
inherited |
Export for template.
- Parameters
-
renderer_base | $output | The renderer. |
- Return values
-
Implements core\output\templatable.
◆ export_for_template() [2/2]
core\output\stored_progress_bar::export_for_template |
( |
\renderer_base | $output | ) |
|
Export for template.
- Parameters
-
renderer_base | $output | The renderer. |
- Return values
-
◆ get_by_id()
static core\output\stored_progress_bar::get_by_id |
( |
int | $id | ) |
|
|
static |
Load the stored progress bar from the database, based on it's record ID.
- Parameters
-
- Return values
-
◆ get_by_idnumber()
static core\output\stored_progress_bar::get_by_idnumber |
( |
string | $idnumber | ) |
|
|
static |
Load the stored progress bar from the database based on its uniqued idnumber.
- Parameters
-
string | $idnumber | Unique ID of the bar |
- Return values
-
◆ get_content()
core\output\stored_progress_bar::get_content |
( |
| ) |
|
Get the content to display the progress bar and start polling via AJAX.
- Return values
-
Reimplemented from core\output\progress_bar.
◆ get_estimate_message()
core\output\progress_bar::get_estimate_message |
( |
float | $percent | ) |
|
|
inherited |
This gets the estimate message to be displayed with the progress bar.
- Parameters
-
- Return values
-
◆ get_haserrored()
core\output\progress_bar::get_haserrored |
( |
| ) |
|
|
inherited |
Check if the process has errored.
- Return values
-
◆ get_id()
core\output\progress_bar::get_id |
( |
| ) |
|
|
inherited |
Getter for ID.
- Return values
-
◆ get_message()
core\output\stored_progress_bar::get_message |
( |
| ) |
|
Get the progress bar message.
- Return values
-
◆ get_percent()
core\output\progress_bar::get_percent |
( |
| ) |
|
|
inherited |
Get the percent.
- Return values
-
◆ get_timeout()
static core\output\stored_progress_bar::get_timeout |
( |
| ) |
|
|
static |
Get the polling timeout in seconds.
Default: 5.
- Return values
-
◆ init_js()
core\output\stored_progress_bar::init_js |
( |
| ) |
|
Initialise Javascript for stored progress bars.
The javascript polls the status of all progress bars on the page, so it only needs to be initialised once.
- Return values
-
◆ load()
static core\output\stored_progress_bar::load |
( |
\stdClass | $record | ) |
|
|
static |
Load the stored progress bar object from its record in the database.
- Parameters
-
- Return values
-
◆ render()
core\output\progress_bar::render |
( |
| ) |
|
|
inherited |
Render the progress bar.
- Return values
-
◆ render_update()
core\output\stored_progress_bar::render_update |
( |
| ) |
|
|
protected |
Render an update to the CLI.
This will only work in CLI scripts, and not in scheduled/adhoc tasks even though they run via CLI, as they seem to use a different renderer (core_renderer instead of core_renderer_cli).
We also can't check this based on "CLI_SCRIPT" const as that is true for tasks.
So this will just check a flag to see if we want auto rendering of updates.
- Return values
-
◆ set_haserrored()
core\output\progress_bar::set_haserrored |
( |
bool | $value | ) |
|
|
protectedinherited |
Set the error flag on the object.
- Parameters
-
- Return values
-
◆ set_last_updated()
core\output\stored_progress_bar::set_last_updated |
( |
?int | $value = null | ) |
|
|
protected |
Set the time we started last updated the progress.
- Parameters
-
- Return values
-
◆ set_message()
core\output\stored_progress_bar::set_message |
( |
?string | $value = null | ) |
|
|
protected |
Set the message.
- Parameters
-
- Return values
-
◆ set_percent()
core\output\stored_progress_bar::set_percent |
( |
| $value = null | ) |
|
|
protected |
Set the percent completed.
- Parameters
-
- Return values
-
◆ set_record_id()
core\output\stored_progress_bar::set_record_id |
( |
int | $id | ) |
|
|
protected |
Set the DB record ID.
- Parameters
-
- Return values
-
◆ set_time_started()
core\output\stored_progress_bar::set_time_started |
( |
?int | $value | ) |
|
|
protected |
Set the time we started the process.
- Parameters
-
- Return values
-
◆ start()
core\output\stored_progress_bar::start |
( |
| ) |
|
Start the recording of the progress and store in the database.
- Return values
-
◆ store_pending()
core\output\stored_progress_bar::store_pending |
( |
| ) |
|
Store a progress bar record in a pending state.
- Return values
-
◆ update()
core\output\progress_bar::update |
( |
| $cur, |
|
|
| $total, |
|
|
| $msg ) |
|
inherited |
Update progress bar according the number of tasks.
- Parameters
-
int | $cur | Current task number. |
int | $total | Total task number. |
string | $msg | The message needed to be shown. |
◆ update_full()
core\output\progress_bar::update_full |
( |
| $percent, |
|
|
| $msg ) |
|
inherited |
Update progress bar according percent.
- Parameters
-
int | $percent | From 1-100. |
string | $msg | The message needed to be shown. |
◆ update_raw()
core\output\stored_progress_bar::update_raw |
( |
| $percent, |
|
|
| $msg ) |
|
protected |
Update the database record with the percentage and message.
- Parameters
-
- Return values
-
Reimplemented from core\output\progress_bar.
◆ update_record()
core\output\stored_progress_bar::update_record |
( |
| ) |
|
|
protected |
Update the database record.
- Exceptions
-
- Return values
-
The documentation for this class was generated from the following file:
- lib/classes/output/stored_progress_bar.php