Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
|
Public Member Functions | |
__construct (report $report, array $parameters) | |
System report constructor. | |
add_action (action $action) | |
Adds an action to the report. | |
add_action_divider () | |
Adds action divider to 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. | |
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. | |
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" |
|
final |
System report constructor.
report | $report | |
array | $parameters |
|
final |
Adds an action to the report.
action | $action |
|
finalprotected |
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 |
|
final |
Validates access to download this report.
bool |
|
abstractprotected |
Validates access to view this report.
This is necessary to implement independently of the page that would typically embed the report because subsequent pages are requested via AJAX requests, and access should be validated each time
Report parameters should also be considered when implementing this method
bool |
Reimplemented in core_admin\reportbuilder\local\systemreports\task_logs, core_admin\reportbuilder\local\systemreports\users, core_ai\reportbuilder\local\systemreports\policy_acceptance, core_ai\reportbuilder\local\systemreports\usage, core_badges\reportbuilder\local\systemreports\badges, core_badges\reportbuilder\local\systemreports\course_badges, core_badges\reportbuilder\local\systemreports\recipients, core_cohort\reportbuilder\local\systemreports\cohorts, core_comment\reportbuilder\local\systemreports\comments, core_reportbuilder\local\systemreports\report_access_list, core_reportbuilder\local\systemreports\report_schedules, core_reportbuilder\local\systemreports\reports_list, core_tag\reportbuilder\local\systemreports\tags, core_webservice\reportbuilder\local\systemreports\tokens, gradereport_summary\local\systemreports\summary, mod_lti\reportbuilder\local\systemreports\course_external_tools_list, report_configlog\reportbuilder\local\systemreports\config_changes, report_themeusage\reportbuilder\local\systemreports\theme_usage_report, and tool_admin_presets\reportbuilder\local\systemreports\admin_presets.
|
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 |
|
final |
Return report actions.
action|action_menu_filler[] |
|
final |
Return report base fields.
array |
|
final |
Return instance of toggle all checkbox, if previously defined by {.
bool | $ismaster | |
stdClass | null | $row |
checkbox_toggleall|null |
core_reportbuilder\system_report::get_exclude_columns_for_download | ( | ) |
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 |
|
final |
Whether to use the default filters form.
bool |
core_reportbuilder\system_report::get_initial_sort_column | ( | ) |
Get initial sort column.
column|null |
core_reportbuilder\system_report::get_initial_sort_direction | ( | ) |
Get initial sort column direction.
int |
|
static |
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.
|
final |
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 |
|
final |
Return all report parameters.
array |
core_reportbuilder\system_report::get_row_class | ( | stdClass | $row | ) |
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.
|
final |
Whether report has any actions.
bool |
|
final |
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 |
|
final |
Validate access to the report.
report_access_exception |
core_reportbuilder\system_report::row_callback | ( | stdClass | $row | ) |
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.
|
finalprotected |
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 |
|
final |
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 |
core_reportbuilder\system_report::set_initial_sort_column | ( | string | $uniqueidentifier, |
int | $sortdirection ) |
Set initial sort column and sort direction for the report.
string | $uniqueidentifier | |
int | $sortdirection | One of SORT_ASC or SORT_DESC |
coding_exception |
|
final |
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.
|
protected |
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.