Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

File Size: 282 lines (8 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

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

param: action $action

has_actions()   X-Ref
Whether report has any actions

return: bool

get_actions()   X-Ref
Return report actions

return: action[]

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

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

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

return: string
param: stdClass $row

get_default_per_page()   X-Ref
Default 'per page' size. Can be overridden by system reports to define a different paging value

return: int

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