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.

(no description)

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

Defines 1 class

base:: (7 methods):
  __construct()
  create()
  get_header()
  get_entity_name()
  get_filter_persistent()
  applies_to_values()
  get_sample_values()


Class: base  - X-Ref

Base class for all report filters

Filters provide a form for collecting user input, and then return appropriate SQL fragments based on these values

__construct(filter $filter)   X-Ref
Do not allow the constructor to be called directly or overridden

param: filter $filter

create(filter $filter)   X-Ref
Creates an instance of a filter type, based on supplied report filter instance

The report filter instance is used by reports/entities to define what should be filtered against, e.g. a SQL fragment

param: filter $filter The report filter instance
return: static

get_header()   X-Ref
Returns the filter header

return: string

get_entity_name()   X-Ref
Returns the filter's entity name

return: string

get_filter_persistent()   X-Ref
Returns the filter persistent

Note that filters for system reports don't store a persistent and will return null.

return: filter_model|null

applies_to_values(array $values)   X-Ref
Given an array of current filter values for the report, determine whether the filter would apply to the report (i.e. user
has configured it from it's initial "Any value" state). A filter would typically be considered applied if it returns SQL
filter clauses, but child classes may override this method if they use different logic

param: array $values
return: bool

get_sample_values()   X-Ref
Return sample filter values, that when applied to a report would activate the filter - that is, cause the filter to return
SQL snippet. Should be overridden in child classes, to ensure compatibility with stress tests of reports

return: array