Progress handler that uses a standard Moodle progress bar to display progress.
More...
|
| __construct ($heading='', $delay=self::DEFAULT_DISPLAY_DELAY) |
| Constructs the progress reporter.
|
|
| end_html () |
| Finishes parent display then closes div and hides it.
|
|
| end_progress () |
| Marks the end of an operation that will display progress.
|
|
| get_current_description () |
|
| get_current_max () |
| Checks max value of current progress section.
|
|
| get_progress_count () |
| Obtains current indeterminate progress in a way suitable for adding to the progress display.
|
|
| get_progress_proportion_range () |
| Obtains current progress in a way suitable for drawing a progress bar.
|
|
int | increment_progress ($incby=1) |
| An alternative to calling progress.
|
|
| is_in_progress_section () |
|
| progress ($progress=self::INDETERMINATE) |
| Indicates that progress has occurred.
|
|
| set_display_names ($displaynames=true) |
| By default, the progress section names do not display because these will probably be untranslated and incomprehensible.
|
|
| start_html () |
| Starts displaying the progress bar, with optional heading and a special div so it can be hidden later.
|
|
| start_progress ($description, $max=self::INDETERMINATE, $parentcount=1) |
| Marks the start of an operation that will display progress.
|
|
| update_progress () |
| When progress is updated, after a certain time, starts actually displaying the progress bar.
|
|
|
int const | DEFAULT_DISPLAY_DELAY = 5 |
| Waits this many seconds before displaying progress bar.
|
|
int const | INDETERMINATE = -1 |
| Constant indicating that the number of progress calls is unknown.
|
|
int const | TIME_LIMIT_WITHOUT_PROGRESS = 3600 |
| This value is set rather high to ensure there are no regressions from previous behaviour.
|
|
int const | WIBBLE_STATES = 13 |
| Number of wibble states (state0...stateN-1 classes in CSS)
|
|
|
| get_time () |
| Gets time (this is provided so that unit tests can override it).
|
|
|
int | $count |
| Number of progress calls (restricted to ~ 1/second).
|
|
array | $currents = array() |
| Array of current progress values.
|
|
| $currentstate = 0 |
|
array | $descriptions = array() |
| Array of progress descriptions for each stack level.
|
|
| $direction = 1 |
|
bool | $displaynames = false |
| True to display names.
|
|
string | $heading |
| Text to display in heading if bar appears.
|
|
string | $id |
| HTML id for containing div.
|
|
int | $lastprogresstime |
| Time of last progress call.
|
|
| $lastwibble |
|
array | $maxes = array() |
| Array of maximum progress values for each stack level.
|
|
int[] | $parentcounts = array() |
| Array of counts within parent progress entry (ignored for first)
|
|
int | $starttime |
| Time at which the progress bar should display (if it isn't yet)
|
|
Progress handler that uses a standard Moodle progress bar to display progress.
Same as core\progress\display, but the bar does not appear until a certain time has elapsed, and disappears automatically after it finishes.
The bar can be re-used, i.e. if you end all sections it will disappear, but if you start all sections, a new bar will be output.
- Copyright
- 2013 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core\progress\display_if_slow::__construct |
( |
| $heading = '', |
|
|
| $delay = self::DEFAULT_DISPLAY_DELAY ) |
Constructs the progress reporter.
This will not output HTML just yet, until the required delay time expires.
- Parameters
-
string | $heading | Text to display above bar (if it appears); '' for none (default) |
int | $delay | Delay time (default 5 seconds) |
◆ end_html()
core\progress\display_if_slow::end_html |
( |
| ) |
|
◆ end_progress()
core\progress\base::end_progress |
( |
| ) |
|
|
inherited |
Marks the end of an operation that will display progress.
This must be paired with each start_progress call.
If there is a parent progress section, its progress will be increased automatically to reflect the end of the child section.
- Exceptions
-
◆ get_current_description()
core\progress\base::get_current_description |
( |
| ) |
|
|
inherited |
- Exceptions
-
- Return values
-
string | Current progress section description |
◆ get_current_max()
core\progress\base::get_current_max |
( |
| ) |
|
|
inherited |
Checks max value of current progress section.
- Return values
-
- Exceptions
-
◆ get_progress_count()
core\progress\base::get_progress_count |
( |
| ) |
|
|
inherited |
Obtains current indeterminate progress in a way suitable for adding to the progress display.
This returns the number of indeterminate calls (at any level) during the lifetime of this progress reporter, whether or not there is a current indeterminate step. (The number will not be ridiculously high because progress calls are limited to one per second.)
- Return values
-
int | Number of indeterminate progress calls |
◆ get_progress_proportion_range()
core\progress\base::get_progress_proportion_range |
( |
| ) |
|
|
inherited |
Obtains current progress in a way suitable for drawing a progress bar.
Progress is returned as a minimum and maximum value. If there is no indeterminate progress, these values will be identical. If there is intermediate progress, these values can be different. (For example, if the top level progress sections is indeterminate, then the values will always be 0.0 and 1.0.)
- Return values
-
array | Minimum and maximum possible progress proportions |
◆ get_time()
core\progress\base::get_time |
( |
| ) |
|
|
protectedinherited |
Gets time (this is provided so that unit tests can override it).
- Return values
-
◆ increment_progress()
int core\progress\base::increment_progress |
( |
| $incby = 1 | ) |
|
|
inherited |
An alternative to calling progress.
This keeps track of the number of items done internally. Call this method with no parameters to increment the internal counter by one or you can use the $incby parameter to specify a positive change in progress. The internal progress counter should not exceed $max as passed to start_progress for this section.
If you called start_progress with parameter INDETERMINATE then you cannot call this method.
$incby The positive change to apply to the internal progress counter. Defaults to 1.
◆ is_in_progress_section()
core\progress\base::is_in_progress_section |
( |
| ) |
|
|
inherited |
- Return values
-
bool | True if currently inside a progress section |
◆ progress()
core\progress\base::progress |
( |
| $progress = self::INDETERMINATE | ) |
|
|
inherited |
Indicates that progress has occurred.
The progress value should indicate the total progress so far, from 0 to the value supplied for $max (inclusive) in start_progress.
You do not need to call this function for every value. It is OK to skip values. It is also OK to call this function as often as desired; it doesn't update the display if called more than once per second.
It must be INDETERMINATE if start_progress was called with $max set to INDETERMINATE. Otherwise it must not be indeterminate.
- Parameters
-
int | $progress | Progress so far |
- Exceptions
-
◆ set_display_names()
core\progress\display::set_display_names |
( |
| $displaynames = true | ) |
|
|
inherited |
By default, the progress section names do not display because these will probably be untranslated and incomprehensible.
To make them display, call this method.
- Parameters
-
bool | $displaynames | True to display names |
◆ start_html()
core\progress\display_if_slow::start_html |
( |
| ) |
|
◆ start_progress()
core\progress\base::start_progress |
( |
| $description, |
|
|
| $max = self::INDETERMINATE, |
|
|
| $parentcount = 1 ) |
|
inherited |
Marks the start of an operation that will display progress.
This can be called multiple times for nested progress sections. It must be paired with calls to end_progress.
The progress maximum may be self::INDETERMINATE if the current operation has an unknown number of steps. (This is default.)
Calling this function will always result in a new display, so this should not be called exceedingly frequently.
When it is complete by calling end_progress(), each start_progress section automatically adds progress to its parent, as defined by $parentcount.
- Parameters
-
string | $description | Description to display |
int | $max | Maximum value of progress for this section |
int | $parentcount | How many progress points this section counts for |
- Exceptions
-
◆ update_progress()
core\progress\display_if_slow::update_progress |
( |
| ) |
|
◆ TIME_LIMIT_WITHOUT_PROGRESS
int const core\progress\base::TIME_LIMIT_WITHOUT_PROGRESS = 3600 |
|
inherited |
This value is set rather high to ensure there are no regressions from previous behaviour.
For testing, it may be useful to set the frontendservertimeout config option to a lower value, such as 180 seconds (default for some commercial products).
The number of seconds that can pass without progress() calls.
The documentation for this class was generated from the following file: