Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
progress_bar Class Reference

Progress bar class. More...

Inheritance diagram for progress_bar:
renderable templatable

Public Member Functions

 __construct ($htmlid='', $width=500, $autostart=false)
 Constructor.
 
 create ()
 Create a new progress bar, this function will output html.
 
 export_for_template (renderer_base $output)
 Export for template.
 
 get_id ()
 Getter for ID.
 
 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.
 

Detailed Description

Progress bar class.

Manages the display of a progress bar.

To use this class.

  • construct
  • call create (or use the 3rd param to the constructor)
  • call update or update_full() or update() repeatedly
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Prints JS code if $autostart true.

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

Member Function Documentation

◆ create()

progress_bar::create ( )

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

Return values
voidEcho's output

◆ export_for_template()

progress_bar::export_for_template ( renderer_base $output)

Export for template.

Parameters
renderer_base$outputThe renderer.
Return values
array

Implements templatable.

◆ get_id()

progress_bar::get_id ( )

Getter for ID.

Return values
stringid

◆ update()

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()

progress_bar::update_full ( $percent,
$msg )

Update progress bar according percent.

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

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