Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
core\output\task_indicator Class Reference
Inheritance diagram for core\output\task_indicator:
core\output\renderable core\output\templatable

Public Member Functions

 __construct (protected adhoc_task adhoc_task $task, protected string string $heading, protected string string $message, protected ?url ?url $redirecturl=null, protected ?pix_icon ?pix_icon $icon=new pix_icon('i/timer', ''), protected array array $extraclasses=[],)
 Find the task record, and get the progress bar object.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 has_task_record ()
 Check if there is a task record matching the defined task.
 

Protected Member Functions

 setup_task_data ()
 Fetch the task record matching the current task, if there is one.
 

Protected Attributes

stored_progress_bar stored_progress_bar $progressbar
 $progressbar
 
string string $runlabel = ''
 $runlabel Label for the link to run the task.
 
url url $runurl = null
 $runurl The URL to manually run the task.
 
stdClass stdClass $taskrecord
 $taskrecord
 

Constructor & Destructor Documentation

◆ __construct()

core\output\task_indicator::__construct ( protected adhoc_task adhoc_task $task,
protected string string $heading,
protected string string $message,
protected ?url ?url $redirecturl = null,
protected ?pix_icon ?pix_icon $icon = new pix_icon('i/timer', ''),
protected array array $extraclasses = [] )

Find the task record, and get the progress bar object.

Parameters
adhoc_task$taskThe task whose progress is being indicated. The task class must use stored_progress_task_trait.
string$headingThe header text for the indicator.
string$messageA message to explain what is happening while the task is running.
?url$redirecturlAn optional URL to redirect to when the task completes.
?pix_icon$iconAn optional icon to display with the heading.
array$extraclassesExtra class names to apply to the indicator's container.
Exceptions
coding_exception
Parameters
$task$task The task whose progress is being indicated. The task class must use stored_progress_task_trait.
$heading$heading The header text for the indicator.
$message$message A message to explain what is happening while the task is running.
$redirecturl$redirecturl An optional URL to redirect to when the task completes.
$icon$icon An optional icon to display with the heading.
$extraclasses$extraclasses Extra class names to apply to the indicator's container.

Member Function Documentation

◆ export_for_template()

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

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements core\output\templatable.

◆ has_task_record()

core\output\task_indicator::has_task_record ( )

Check if there is a task record matching the defined task.

If so, set the task ID and progress bar, then return true. If not, return false.

Return values
bool

◆ setup_task_data()

core\output\task_indicator::setup_task_data ( )
protected

Fetch the task record matching the current task, if there is one.

If one exists, also set up a progress bar, and set up the "run now" link if permitted.

Return values
void

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