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 403]

(no description)

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

Defines 2 classes


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

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

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

param: stdClass $data
return: report_model

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

param: int $reportid
return: bool

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

param: report_model $persistent
return: array

Class: for  - X-Ref

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

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
return: bool