|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
Public Member Functions | |
| add_default_columns () | |
| Add default datasource columns to the report. | |
| add_default_conditions () | |
| Add default datasource conditions to the report. | |
| add_default_filters () | |
| Add default datasource filters to the report. | |
| close_output () | |
| Write the end of the file. | |
| close_output_to_file () | |
| Write the data to disk. | |
| close_sheet ($columns) | |
| Write the end of the sheet containing the data. | |
| get_active_columns () | |
| Override parent method, returning only those columns specifically added to the custom report (rather than all that are available) | |
| get_active_conditions (bool $checkavailable=true) | |
| Override parent method, returning only those conditions specifically added to the custom report (rather than all that are available) | |
| get_active_filters () | |
| Override parent method, returning only those filters specifically added to the custom report (rather than all that are available) | |
| get_default_column_sorting () | |
| Return the default column sorting that will be set for the report upon creation, by {. | |
| get_default_columns () | |
| Return the default columns that will be added to the report upon creation, by {. | |
| get_default_condition_values () | |
| Return the default condition values that will be added to the report once is created. | |
| get_default_conditions () | |
| Return the conditions that will be added to the report once is created. | |
| get_default_filters () | |
| Return the filters that will be added to the report once is created. | |
| get_extension () | |
| Get the file extension. | |
| send_http_headers () | |
| Output file headers to initialise the download of the file. | |
| set_filename ($filename) | |
| Set download filename base. | |
| set_filepath (string $filepath) | |
| Set file path when writing to file. | |
| set_sheettitle ($title) | |
| Set the title of the worksheet inside a spreadsheet. | |
| start_output () | |
| Write the start of the file. | |
| start_output_to_file () | |
| Set the dataformat to be output to current file. | |
| start_sheet ($columns) | |
| Write the start of the sheet we will be adding data to. | |
| supports_html () | |
| Method to define whether the dataformat supports export of HTML. | |
| write_record ($record, $rownum) | |
| Write a single record. | |
Static Public Member Functions | |
| static | report_elements_modified (int $reportid) |
| Indicate that report elements have been modified, e.g. | |
Protected Member Functions | |
| add_all_from_entities (array $entitynames=[]) | |
| Adds all columns/filters/conditions from all the entities added to the report at once. | |
| add_all_from_entity (string $entityname, array $limitcolumns=[], array $limitfilters=[], array $limitconditions=[],) | |
| Adds all columns/filters/conditions from the given entity to the report at once. | |
| add_conditions_from_entity (string $entityname, array $include=[], array $exclude=[]) | |
| Add conditions from the given entity name to be available to use in a custom report. | |
| export_html_image_source (\stored_file $file) | |
| Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original) | |
| format_record ($record) | |
| Apply formatting to the cells of a given record. | |
| replace_pluginfile_images (?string $content) | |
| We need to locate all img tags within a given cell that match pluginfile URL's. | |
Protected Attributes | |
| $extension | $extension = ".txt" |
| $filename | $filename = '' |
| string | $filepath = '' |
| The location to store the output content. | |
| $mimetype | $mimetype = "text/plain" |
|
finalprotected |
Adds all columns/filters/conditions from all the entities added to the report at once.
| string[] | $entitynames | If specified, then only these entity elements are added (otherwise all) |
|
finalprotected |
Adds all columns/filters/conditions from the given entity to the report at once.
| string | $entityname | |
| string[] | $limitcolumns | Include only these columns |
| string[] | $limitfilters | Include only these filters |
| string[] | $limitconditions | Include only these conditions |
|
finalprotected |
Add conditions from the given entity name to be available to use in a custom report.
Wildcard matching is supported with '' in both $include and $exclude, e.g. ['customfield']
| string | $entityname | |
| string[] | $include | Include only these conditions, if omitted then include all |
| string[] | $exclude | Exclude these conditions, if omitted then exclude none |
| coding_exception | If both $include and $exclude are non-empty |
| core_reportbuilder\datasource::add_default_columns | ( | ) |
Add default datasource columns to the report.
Uses column data returned by the source {
| coding_exception | If default column sorting refers to an invalid column |
| core_reportbuilder\datasource::add_default_conditions | ( | ) |
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.
| core_reportbuilder\datasource::add_default_filters | ( | ) |
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.
|
inherited |
Write the end of the file.
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Write the data to disk.
Calling code should have previously called {
| bool | Whether the write succeeded |
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
inherited |
Write the end of the sheet containing the data.
| array | $columns |
Reimplemented in dataformat_html\writer, and dataformat_json\writer.
|
protectedinherited |
Given a stored_file, return a suitable source attribute for an img element in the export (or null to use the original)
| stored_file | $file |
| string|null |
Reimplemented in dataformat_pdf\writer.
|
protectedinherited |
Apply formatting to the cells of a given record.
| array | stdClass | $record |
| array |
| core_reportbuilder\datasource::get_active_columns | ( | ) |
Override parent method, returning only those columns specifically added to the custom report (rather than all that are available)
| column[] |
| core_reportbuilder\datasource::get_active_conditions | ( | bool | $checkavailable = true | ) |
Override parent method, returning only those conditions specifically added to the custom report (rather than all that are available)
| bool | $checkavailable |
| filter[] |
| core_reportbuilder\datasource::get_active_filters | ( | ) |
Override parent method, returning only those filters specifically added to the custom report (rather than all that are available)
| filter[] |
| core_reportbuilder\datasource::get_default_column_sorting | ( | ) |
Return the default column sorting that will be set for the report upon creation, by {.
When overriding this method in child classes, column identifiers specified must refer to default columns returned from the {
| int[] | array [column identifier => SORT_ASC/SORT_DESC] |
Reimplemented in core_admin\reportbuilder\datasource\task_logs, core_badges\reportbuilder\datasource\badges, core_badges\reportbuilder\datasource\users, core_blog\reportbuilder\datasource\blogs, core_cohort\reportbuilder\datasource\cohorts, core_comment\reportbuilder\datasource\comments, core_competency\reportbuilder\datasource\competencies, core_course\reportbuilder\datasource\categories, core_course\reportbuilder\datasource\courses, core_course\reportbuilder\datasource\participants, core_files\reportbuilder\datasource\files, core_group\reportbuilder\datasource\groups, core_notes\reportbuilder\datasource\notes, core_role\reportbuilder\datasource\roles, core_tag\reportbuilder\datasource\tags, and core_user\reportbuilder\datasource\users.
|
abstract |
Return the default columns that will be added to the report upon creation, by {.
| string[] |
Reimplemented in core_admin\reportbuilder\datasource\task_logs, core_badges\reportbuilder\datasource\badges, core_badges\reportbuilder\datasource\users, core_blog\reportbuilder\datasource\blogs, core_cohort\reportbuilder\datasource\cohorts, core_comment\reportbuilder\datasource\comments, core_competency\reportbuilder\datasource\competencies, core_course\reportbuilder\datasource\categories, core_course\reportbuilder\datasource\courses, core_course\reportbuilder\datasource\participants, core_files\reportbuilder\datasource\files, core_group\reportbuilder\datasource\groups, core_notes\reportbuilder\datasource\notes, core_role\reportbuilder\datasource\roles, core_tag\reportbuilder\datasource\tags, and core_user\reportbuilder\datasource\users.
| core_reportbuilder\datasource::get_default_condition_values | ( | ) |
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 {
| array |
Reimplemented in core_admin\reportbuilder\datasource\task_logs, core_cohort\reportbuilder\datasource\cohorts, core_competency\reportbuilder\datasource\competencies, core_course\reportbuilder\datasource\participants, core_files\reportbuilder\datasource\files, and core_user\reportbuilder\datasource\users.
|
abstract |
Return the conditions that will be added to the report once is created.
| string[] |
Reimplemented in core_admin\reportbuilder\datasource\task_logs, core_badges\reportbuilder\datasource\badges, core_badges\reportbuilder\datasource\users, core_blog\reportbuilder\datasource\blogs, core_cohort\reportbuilder\datasource\cohorts, core_comment\reportbuilder\datasource\comments, core_competency\reportbuilder\datasource\competencies, core_course\reportbuilder\datasource\categories, core_course\reportbuilder\datasource\courses, core_course\reportbuilder\datasource\participants, core_files\reportbuilder\datasource\files, core_group\reportbuilder\datasource\groups, core_notes\reportbuilder\datasource\notes, core_role\reportbuilder\datasource\roles, core_tag\reportbuilder\datasource\tags, and core_user\reportbuilder\datasource\users.
|
abstract |
Return the filters that will be added to the report once is created.
| string[] |
Reimplemented in core_admin\reportbuilder\datasource\task_logs, core_badges\reportbuilder\datasource\badges, core_badges\reportbuilder\datasource\users, core_blog\reportbuilder\datasource\blogs, core_cohort\reportbuilder\datasource\cohorts, core_comment\reportbuilder\datasource\comments, core_competency\reportbuilder\datasource\competencies, core_course\reportbuilder\datasource\categories, core_course\reportbuilder\datasource\courses, core_course\reportbuilder\datasource\participants, core_files\reportbuilder\datasource\files, core_group\reportbuilder\datasource\groups, core_notes\reportbuilder\datasource\notes, core_role\reportbuilder\datasource\roles, core_tag\reportbuilder\datasource\tags, and core_user\reportbuilder\datasource\users.
|
inherited |
Get the file extension.
| string | file extension |
|
protectedinherited |
We need to locate all img tags within a given cell that match pluginfile URL's.
Partly so the exported file will show the image without requiring the user is logged in; and also to prevent some of the dataformats requesting the file themselves, which is likely to fail due to them not having an active session
| string | null | $content |
| string |
|
staticfinal |
Indicate that report elements have been modified, e.g.
columns/filters/conditions have been added, removed or updated
| int | $reportid |
|
inherited |
Output file headers to initialise the download of the file.
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
inherited |
Set download filename base.
| string | $filename |
|
inherited |
Set file path when writing to file.
| string | $filepath |
| coding_exception |
|
inherited |
Set the title of the worksheet inside a spreadsheet.
For some formats this will be ignored.
| string | $title |
Reimplemented in core\dataformat\spout_base, dataformat_excel\writer, and dataformat_ods\writer.
|
inherited |
Write the start of the file.
Reimplemented in dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Set the dataformat to be output to current file.
Calling code must call {
Reimplemented in core\dataformat\spout_base, and dataformat_pdf\writer.
|
inherited |
Write the start of the sheet we will be adding data to.
| array | $columns |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.
|
inherited |
Method to define whether the dataformat supports export of HTML.
| bool |
Reimplemented in dataformat_html\writer, and dataformat_pdf\writer.
|
abstractinherited |
Write a single record.
| array | $record | |
| int | $rownum |
Reimplemented in core\dataformat\spout_base, dataformat_html\writer, dataformat_json\writer, and dataformat_pdf\writer.