Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

(no description)

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

Defines 1 class


Class: datasource  - X-Ref

Class datasource

add_columns_from_entity(string $entityname, array $include = [], array $exclude = [])   X-Ref
Add columns from the given entity name to be available to use in a custom report

param: string $entityname
param: array $include Include only these columns, if omitted then include all
param: array $exclude Exclude these columns, if omitted then exclude none

add_default_columns()   X-Ref
Add default datasource columns to the report

This method is optional and can be called when the report is created to add the default columns defined in the
selected datasource.

get_default_column_sorting()   X-Ref
Return the default sorting that will be added to the report once it is created

return: int[] array [column identifier => SORT_ASC/SORT_DESC]

get_active_columns()   X-Ref
Return all configured report columns

return: column[]

add_filters_from_entity(string $entityname, array $include = [], array $exclude = [])   X-Ref
Add filters from the given entity name to be available to use in a custom report

param: string $entityname
param: array $include Include only these filters, if omitted then include all
param: array $exclude Exclude these filters, if omitted then exclude none

add_default_filters()   X-Ref
Add default datasource filters to the report

This method is optional and can be called when the report is created to add the default filters defined in the
selected datasource.

get_active_filters()   X-Ref
Return all configured report filters

return: filter[]

add_conditions_from_entity(string $entityname, array $include = [], array $exclude = [])   X-Ref
Add conditions from the given entity name to be available to use in a custom report

param: string $entityname
param: array $include Include only these conditions, if omitted then include all
param: array $exclude Exclude these conditions, if omitted then exclude none

add_default_conditions()   X-Ref
Add default datasource conditions to the report

This method is optional and can be called when the report is created to add the default conditions defined in the
selected datasource.

get_default_condition_values()   X-Ref
Return the default condition values that will be added to the report once is created

For any of the default conditions returned by the method {@see get_default_conditions} is
possible to set the initial values.

return: array

get_active_conditions()   X-Ref
Return all configured report conditions

return: filter[]

add_all_from_entity(string $entityname)   X-Ref
Adds all columns/filters/conditions from the given entity to the report at once

param: string $entityname

add_all_from_entities()   X-Ref
Adds all columns/filters/conditions from all the entities added to the report at once


report_elements_modified(int $reportid)   X-Ref
Indicate that report elements have been modified, e.g. columns/filters/conditions have been added, removed or updated

param: int $reportid