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: 446 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: report  - X-Ref

Helper class for manipulating custom reports and their elements (columns, filters, conditions, etc)

create_report(stdClass $data, bool $default = true)   X-Ref
Create custom report

return: report_model
param: stdClass $data
param: bool $default If $default is set to true it will populate report with default layout as defined by the selected

update_report(stdClass $data)   X-Ref
Update custom report

return: report_model
param: stdClass $data

delete_report(int $reportid)   X-Ref
Delete custom report

return: bool
param: int $reportid

add_report_column(int $reportid, string $uniqueidentifier)   X-Ref
Add given column to report

return: column
param: int $reportid
param: string $uniqueidentifier

delete_report_column(int $reportid, int $columnid)   X-Ref
Delete given column from report

return: bool
param: int $reportid
param: int $columnid

reorder_report_column(int $reportid, int $columnid, int $position)   X-Ref
Re-order given column within a report

return: bool
param: int $reportid
param: int $columnid
param: int $position

reorder_report_column_sorting(int $reportid, int $columnid, int $position)   X-Ref
Re-order given column sorting within a report

return: bool
param: int $reportid
param: int $columnid
param: int $position

toggle_report_column_sorting(int $reportid, int $columnid, bool $enabled,int $direction = SORT_ASC)   X-Ref
Toggle sorting options for given column within a report

return: bool
param: int $reportid
param: int $columnid
param: bool $enabled
param: int $direction

add_report_condition(int $reportid, string $uniqueidentifier)   X-Ref
Add given condition to report

return: filter
param: int $reportid
param: string $uniqueidentifier

delete_report_condition(int $reportid, int $conditionid)   X-Ref
Delete given condition from report

return: bool
param: int $reportid
param: int $conditionid

reorder_report_condition(int $reportid, int $conditionid, int $position)   X-Ref
Re-order given condition within a report

return: bool
param: int $reportid
param: int $conditionid
param: int $position

add_report_filter(int $reportid, string $uniqueidentifier)   X-Ref
Add given filter to report

return: filter
param: int $reportid
param: string $uniqueidentifier

delete_report_filter(int $reportid, int $filterid)   X-Ref
Delete given filter from report

return: bool
param: int $reportid
param: int $filterid

reorder_report_filter(int $reportid, int $filterid, int $position)   X-Ref
Re-order given filter within a report

return: bool
param: int $reportid
param: int $filterid
param: int $position

get_available_columns(report_model $persistent)   X-Ref
Get available columns for a given report

return: array
param: report_model $persistent

reorder_persistents_by_field(persistent $persistent, array $persistents, int $position,string $field)   X-Ref
Helper method for re-ordering given persistents (columns, filters, etc)

return: bool
param: persistent $persistent The persistent we are moving
param: persistent[] $persistents The rest of the persistents
param: int $position
param: string $field The field we need to update