Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 307 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: system_report  - X-Ref

Base class for system reports

__construct(report $report, array $parameters)   X-Ref
System report constructor.

param: report $report
param: array $parameters

require_can_view()   X-Ref
Validate access to the report


validate()   X-Ref
Report validation


add_base_fields(string $sql)   X-Ref
Add list of fields that have to be always included in SQL query for actions and row classes

Base fields are only available in system reports because they are not compatible with aggregation

param: string $sql SQL clause for the list of fields that only uses main table or base joins

get_base_fields()   X-Ref
Return report base fields

return: array

set_filter_form_default(bool $filterformdefault = true)   X-Ref
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

param: bool $filterformdefault

get_filter_form_default()   X-Ref
Whether to use the default filters form

return: bool

add_action(action $action)   X-Ref
Adds an action to the report

param: action $action

add_action_divider()   X-Ref
Adds action divider to the report


has_actions()   X-Ref
Whether report has any actions

return: bool

get_actions()   X-Ref
Return report actions

return: action|action_menu_filler[]

set_parameters(array $parameters)   X-Ref
Set all report parameters

param: array $parameters

get_parameters()   X-Ref
Return all report parameters

return: array

get_parameter(string $param, $default, string $type)   X-Ref
Return specific report parameter

param: string $param
param: mixed $default
param: string $type
return: mixed

output()   X-Ref
Output the report

return: string

get_row_class(stdClass $row)   X-Ref
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

param: stdClass $row
return: string

row_callback(stdClass $row)   X-Ref
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

param: stdClass $row

can_be_downloaded()   X-Ref
Validates access to download this report.

return: bool

get_exclude_columns_for_download()   X-Ref
Return list of column names that will be excluded when table is downloaded. Extending classes should override this method
as appropriate

return: string[] Array of column unique identifiers

set_initial_sort_column(string $uniqueidentifier, int $sortdirection)   X-Ref
Set initial sort column and sort direction for the report

param: string $uniqueidentifier
param: int $sortdirection One of SORT_ASC or SORT_DESC

get_initial_sort_column()   X-Ref
Get initial sort column

return: column|null

get_initial_sort_direction()   X-Ref
Get initial sort column direction

return: int