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

Defines 1 class


Class: course  - X-Ref

Course entity class implementation

This entity defines all the course columns and filters to be used in any report.

get_default_table_aliases()   X-Ref
Database tables that this entity uses and their default aliases.

return: array

get_default_entity_name()   X-Ref
The default machine-readable name for this entity that will be used in the internal names of the columns/filters.

return: string

get_default_entity_title()   X-Ref
The default title for this entity in the list of columns/filters in the report builder.

return: lang_string

get_custom_fields()   X-Ref
Get custom fields helper

return: custom_fields

initialise()   X-Ref
Initialise the entity, adding all course and custom course fields

return: base

get_context_join()   X-Ref
Return syntax for joining on the context table

return: string

get_course_fields()   X-Ref
Course fields.

return: array

is_sortable(string $fieldname)   X-Ref
Check if this field is sortable

param: string $fieldname
return: bool

get_course_field_type(string $coursefield)   X-Ref
Return appropriate column type for given user field

param: string $coursefield
return: int

get_tag_joins()   X-Ref
Return joins necessary for retrieving tags

return: string[]

get_all_columns()   X-Ref
Returns list of all available columns.

These are all the columns available to use in any report that uses this entity.

return: column[]

get_all_filters()   X-Ref
Returns list of all available filters

return: array

get_options_for(string $fieldname)   X-Ref
Gets list of options if the filter supports it

param: string $fieldname
return: null|array

get_options_for_groupmode()   X-Ref
List of options for the field groupmode.

return: array

get_options_for_format()   X-Ref
List of options for the field format.

return: array

get_options_for_theme()   X-Ref
List of options for the field theme.

return: array

get_options_for_lang()   X-Ref
List of options for the field lang.

return: array

get_options_for_calendartype()   X-Ref
List of options for the field.

return: array

format($value, stdClass $row, string $fieldname)   X-Ref
Formats the course field for display.

param: mixed $value Current field value.
param: stdClass $row Complete row.
param: string $fieldname Name of the field to format.
return: string