Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250605) (9223e346c3e)
|
Public Member Functions | |
add_action (action $action) | |
Adds an action to the report. | |
add_action_divider () | |
Adds action divider to the report. | |
add_columns () | |
Adds the columns we want to display in the report. | |
can_be_downloaded () | |
Validates access to download this report. | |
close_output () | |
Write the end of the file. | |
close_output_to_file () | |
Write the data to disk. | |
close_sheet ($columns) | |
Write the end of the sheet containing the data. | |
get_actions () | |
Return report actions. | |
get_base_fields () | |
Return report base fields. | |
get_checkbox_toggleall (bool $ismaster, ?stdClass $row=null) | |
Return instance of toggle all checkbox, if previously defined by {. | |
get_exclude_columns_for_download () | |
Return list of column names that will be excluded when table is downloaded. | |
get_extension () | |
Get the file extension. | |
get_filter_form_default () | |
Whether to use the default filters form. | |
get_initial_sort_column () | |
Get initial sort column. | |
get_initial_sort_direction () | |
Get initial sort column direction. | |
get_parameter (string $param, $default, string $type) | |
Return specific report parameter. | |
get_parameters () | |
Return all report parameters. | |
get_row_class (stdClass $row) | |
CSS classes to add to the row. | |
has_actions () | |
Whether report has any actions. | |
output () | |
Output the report. | |
require_can_view () | |
Validate access to the report. | |
row_callback (stdClass $row) | |
Called before rendering each row. | |
send_http_headers () | |
Output file headers to initialise the download of the file. | |
set_filename ($filename) | |
Set download filename base. | |
set_filepath (string $filepath) | |
Set file path when writing to file. | |
set_filter_form_default (bool $filterformdefault=true) | |
Override whether to use the default system report filters form, for instance this can be disabled if the UI requires it's own custom filter management form for a specific report. | |
set_initial_sort_column (string $uniqueidentifier, int $sortdirection) | |
Set initial sort column and sort direction for the report. | |
set_parameters (array $parameters) | |
Set all report parameters. | |
set_sheettitle ($title) | |
Set the title of the worksheet inside a spreadsheet. | |
start_output () | |
Write the start of the file. | |
start_output_to_file () | |
Set the dataformat to be output to current file. | |
start_sheet ($columns) | |
Write the start of the sheet we will be adding data to. | |
supports_html () | |
Method to define whether the dataformat supports export of HTML. | |
write_record ($record, $rownum) | |
Write a single record. | |
Static Public Member Functions | |
static | get_name () |
Provide default implementation of the report name. | |
Protected Member Functions | |
add_base_fields (string $sql) | |
Add list of fields that have to be always included in SQL query for actions and row classes. | |
add_filters () | |
Adds the filters we want to display in the report. | |
can_view () | |
Validates access to view this report. | |
export_html_image_source (\stored_file $file) | |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original) | |
format_record ($record) | |
Apply formatting to the cells of a given record. | |
initialise () | |
Initialise report, we need to set the main table, load our entities and set columns/filters. | |
replace_pluginfile_images (?string $content) | |
We need to locate all img tags within a given cell that match pluginfile URL's. | |
set_checkbox_toggleall (callable $callback) | |
Define toggle all checkbox for the report, required row data should be defined by calling {. | |
validate () | |
Report validation. | |
Protected Attributes | |
$extension | $extension = ".txt" |
$filename | $filename = '' |
string | $filepath = '' |
The location to store the output content. | |
$mimetype | $mimetype = "text/plain" |
|
finalinherited |
Adds an action to the report.
action | $action |
|
finalprotectedinherited |
Add list of fields that have to be always included in SQL query for actions and row classes.
string | $sql | SQL clause for the list of fields that only uses main table or base joins |
gradereport_summary\local\systemreports\summary::add_columns | ( | ) |
Adds the columns we want to display in the report.
They are all provided by the entities we previously added in the {
|
protected |
Adds the filters we want to display in the report.
They are all provided by the entities we previously added in the {
|
finalinherited |
Validates access to download this report.
bool |
|
protected |
Validates access to view this report.
bool |
Reimplemented from core_reportbuilder\system_report.
|
inherited |
Write the end of the file.
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Write the data to disk.
Calling code should have previously called {
bool | Whether the write succeeded |
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
inherited |
Write the end of the sheet containing the data.
array | $columns |
Reimplemented in dataformat_html\writer, and dataformat_json\writer.
|
protectedinherited |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original)
stored_file | $file |
string|null |
Reimplemented in dataformat_pdf\writer.
|
protectedinherited |
Apply formatting to the cells of a given record.
array | stdClass | $record |
array |
|
finalinherited |
Return report actions.
action|action_menu_filler[] |
|
finalinherited |
Return report base fields.
array |
|
finalinherited |
Return instance of toggle all checkbox, if previously defined by {.
bool | $ismaster | |
stdClass | null | $row |
checkbox_toggleall|null |
|
inherited |
Return list of column names that will be excluded when table is downloaded.
Extending classes should override this method as appropriate
string[] | Array of column unique identifiers |
|
inherited |
Get the file extension.
string | file extension |
|
finalinherited |
Whether to use the default filters form.
bool |
|
inherited |
Get initial sort column.
column|null |
|
inherited |
Get initial sort column direction.
int |
|
staticinherited |
Provide default implementation of the report name.
Extending classes can implement this method to provide their own name
string |
Reimplemented in core_admin\reportbuilder\local\systemreports\task_logs, core_ai\reportbuilder\local\systemreports\policy_acceptance, and core_ai\reportbuilder\local\systemreports\usage.
|
finalinherited |
Return specific report parameter.
Capability/permission checks relating to parameters retrieved here should also be considered in your {
string | $param | |
mixed | $default | |
string | $type |
mixed |
|
finalinherited |
Return all report parameters.
array |
|
inherited |
CSS classes to add to the row.
Can be overridden by system reports do define class to be added to output according to content of each row
stdClass | $row |
string |
Reimplemented in core_badges\reportbuilder\local\systemreports\badges, core_cohort\reportbuilder\local\systemreports\cohorts, core_reportbuilder\local\systemreports\report_schedules, core_reportbuilder\local\systemreports\reports_list, and core_tag\reportbuilder\local\systemreports\tags.
|
finalinherited |
Whether report has any actions.
bool |
|
finalinherited |
Output the report.
@uses core_reportbuilder\output\renderer\render_system_report()
string |
|
protectedinherited |
We need to locate all img tags within a given cell that match pluginfile URL's.
Partly so the exported file will show the image without requiring the user is logged in; and also to prevent some of the dataformats requesting the file themselves, which is likely to fail due to them not having an active session
string | null | $content |
string |
|
finalinherited |
Validate access to the report.
report_access_exception |
|
inherited |
Called before rendering each row.
Can be overridden to pre-fetch/create objects and store them in the class, which can later be used in column and action callbacks
stdClass | $row |
Reimplemented in core_badges\reportbuilder\local\systemreports\badges.
|
inherited |
Output file headers to initialise the download of the file.
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
finalprotectedinherited |
Define toggle all checkbox for the report, required row data should be defined by calling {.
callable | $callback | Callback to return value/label for each checkbox, implementing the following signature: function(stdClass $row): ?array containing value/label pair, or null if the checkbox should not be shown for the row |
|
inherited |
Set download filename base.
string | $filename |
|
inherited |
Set file path when writing to file.
string | $filepath |
coding_exception |
|
finalinherited |
Override whether to use the default system report filters form, for instance this can be disabled if the UI requires it's own custom filter management form for a specific report.
bool | $filterformdefault |
|
inherited |
Set initial sort column and sort direction for the report.
string | $uniqueidentifier | |
int | $sortdirection | One of SORT_ASC or SORT_DESC |
coding_exception |
|
finalinherited |
Set all report parameters.
array | $parameters |
|
inherited |
Set the title of the worksheet inside a spreadsheet.
For some formats this will be ignored.
string | $title |
Reimplemented in core\dataformat\spout_base, dataformat_excel\writer, and dataformat_ods\writer.
|
inherited |
Write the start of the file.
Reimplemented in dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Set the dataformat to be output to current file.
Calling code must call {
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
inherited |
Write the start of the sheet we will be adding data to.
array | $columns |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Method to define whether the dataformat supports export of HTML.
bool |
Reimplemented in dataformat_html\writer, and dataformat_pdf\writer.
|
protectedinherited |
Report validation.
report_access_exception | If user cannot access the report |
coding_exception | If no default column are specified |
|
abstractinherited |
Write a single record.
array | $record | |
int | $rownum |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.