Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
core\output\progress_bar Class Reference
Inheritance diagram for core\output\progress_bar:
core\output\renderable core\output\templatable core\output\stored_progress_bar

Public Member Functions

 __construct ($htmlid='', $width=500, $autostart=false)
 Constructor.
 
 auto_update (bool $value)
 Set whether or not to auto render updates to the screen.
 
 create ()
 Create a new progress bar, this function will output html.
 
 error (string $errormsg)
 Set that the process running has errored.
 
 export_for_template (renderer_base $output)
 Export for template.
 
 get_content ()
 Get the content to be rendered.
 
 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_percent ()
 Get the percent.
 
 render ()
 Render the progress bar.
 
 restart ()
 Restart the progress bar.
 
 update ($cur, $total, $msg)
 Update progress bar according the number of tasks.
 
 update_full ($percent, $msg)
 Update progress bar according percent.
 

Protected Member Functions

 estimate ($pt)
 Estimate how much time it is going to take.
 
 set_haserrored (bool $value)
 Set the error flag on the object.
 
 update_raw ($percent, $msg)
 Update the progress bar.
 

Protected Attributes

bool $autoupdate = true
 Whether or not to auto render updates to the screen.
 
bool $haserrored = false
 Whether or not an error has occured.
 
string $idnumber
 unique id
 
int $lastupdate = 0
 time when last printed
 
int $percent = 0
 last percentage printed
 
int $timestart = 0
 when did we start printing this
 
int $width
 total width
 

Static Protected Attributes

static bool $supportsoutputbuffering = false
 Can use output buffering.
 

Constructor & Destructor Documentation

◆ __construct()

core\output\progress_bar::__construct ( $htmlid = '',
$width = 500,
$autostart = false )

Constructor.

Prints JS code if $autostart true.

Parameters
string$htmlidThe unique ID for the progress bar or HTML container id.
int$widthThe suggested width.
bool$autostartWhether to start the progress bar right away.

Member Function Documentation

◆ auto_update()

core\output\progress_bar::auto_update ( bool $value)

Set whether or not to auto render updates to the screen.

Parameters
bool$value
Return values
void

◆ create()

core\output\progress_bar::create ( )

Create a new progress bar, this function will output html.

Return values
voidEcho's output

Reimplemented in core\output\stored_progress_bar.

◆ error()

core\output\progress_bar::error ( string $errormsg)

Set that the process running has errored.

Parameters
string$errormsg
Return values
void

Reimplemented in core\output\stored_progress_bar.

◆ estimate()

core\output\progress_bar::estimate ( $pt)
protected

Estimate how much time it is going to take.

Parameters
int$ptFrom 1-100.
Return values
mixedNull (unknown), or int.

◆ export_for_template()

core\output\progress_bar::export_for_template ( renderer_base $output)

Export for template.

Parameters
renderer_base$outputThe renderer.
Return values
array

Implements core\output\templatable.

◆ get_content()

core\output\progress_bar::get_content ( )

Get the content to be rendered.

Return values
string

Reimplemented in core\output\stored_progress_bar.

◆ get_estimate_message()

core\output\progress_bar::get_estimate_message ( float $percent)

This gets the estimate message to be displayed with the progress bar.

Parameters
float$percent
Return values
string

◆ get_haserrored()

core\output\progress_bar::get_haserrored ( )

Check if the process has errored.

Return values
bool

◆ get_id()

core\output\progress_bar::get_id ( )

Getter for ID.

Return values
stringid

◆ get_percent()

core\output\progress_bar::get_percent ( )

Get the percent.

Return values
float

◆ render()

core\output\progress_bar::render ( )

Render the progress bar.

Return values
void

◆ set_haserrored()

core\output\progress_bar::set_haserrored ( bool $value)
protected

Set the error flag on the object.

Parameters
bool$value
Return values
void

◆ update()

core\output\progress_bar::update ( $cur,
$total,
$msg )

Update progress bar according the number of tasks.

Parameters
int$curCurrent task number.
int$totalTotal task number.
string$msgThe message needed to be shown.

◆ update_full()

core\output\progress_bar::update_full ( $percent,
$msg )

Update progress bar according percent.

Parameters
int$percentFrom 1-100.
string$msgThe message needed to be shown.

◆ update_raw()

core\output\progress_bar::update_raw ( $percent,
$msg )
protected

Update the progress bar.

Parameters
int$percentFrom 1-100.
string$msgThe message.
Return values
voidEcho's output
Exceptions
coding_exception

Reimplemented in core\output\stored_progress_bar.


The documentation for this class was generated from the following file: