Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core_reportbuilder\local\filters\text Class Reference
Inheritance diagram for core_reportbuilder\local\filters\text:
core_reportbuilder\local\filters\base

Public Member Functions

 applies_to_values (array $values)
 Given an array of current filter values for the report, determine whether the filter would apply to the report (i.e.
 
 get_entity_name ()
 Returns the filter's entity name.
 
 get_filter_persistent ()
 Returns the filter persistent.
 
 get_header ()
 Returns the filter header.
 
 get_sample_values ()
 Return sample filter values.
 
 get_sql_filter (array $values)
 Returns the filter clauses to be used with SQL where.
 
 get_sql_filter (?array $values)
 Return filter SQL.
 
 setup_form (MoodleQuickForm $mform)
 Adds filter-specific form elements.
 
 setup_form (\MoodleQuickForm $mform)
 Adds controls specific to this filter in the form.
 

Static Public Member Functions

static create (filter $filter)
 Creates an instance of a filter type, based on supplied report filter instance.
 

Public Attributes

int const ANY_VALUE = 0
 
int const CONTAINS = 1
 
int const DOES_NOT_CONTAIN = 2
 
int const ENDS_WITH = 6
 
int const IS_EMPTY = 7
 
int const IS_EQUAL_TO = 3
 
int const IS_NOT_EMPTY = 8
 
int const IS_NOT_EQUAL_TO = 4
 
int const STARTS_WITH = 5
 

Protected Attributes

filter $filter
 $filter
 
string $name
 $name
 

Member Function Documentation

◆ applies_to_values()

core_reportbuilder\local\filters\base::applies_to_values ( array $values)
inherited

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

Parameters
array$values
Return values
bool

◆ create()

static core_reportbuilder\local\filters\base::create ( filter $filter)
staticfinalinherited

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

Parameters
filter$filterThe report filter instance
Return values
static

◆ get_entity_name()

core_reportbuilder\local\filters\base::get_entity_name ( )
finalinherited

Returns the filter's entity name.

Return values
string

◆ get_filter_persistent()

core_reportbuilder\local\filters\base::get_filter_persistent ( )
finalinherited

Returns the filter persistent.

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

Return values
filter_model|null

◆ get_header()

core_reportbuilder\local\filters\base::get_header ( )
finalinherited

Returns the filter header.

Return values
string

◆ get_sample_values()

core_reportbuilder\local\filters\text::get_sample_values ( )

Return sample filter values.

Return values
array

Reimplemented from core_reportbuilder\local\filters\base.

◆ get_sql_filter() [1/2]

core_reportbuilder\local\filters\base::get_sql_filter ( array $values)
abstractinherited

Returns the filter clauses to be used with SQL where.

Ideally the field SQL should be included only once in the returned expression, however if that is unavoidable then use the {

See also
filter\get_field_sql_and_params} helper to ensure uniqueness of any parameters included within
Parameters
array$values
Return values
array[$sql, [...$params]]

Reimplemented in core_reportbuilder\local\filters\autocomplete, core_reportbuilder\local\filters\boolean_select, core_reportbuilder\local\filters\category, core_reportbuilder\local\filters\course_selector, core_reportbuilder\local\filters\date, core_reportbuilder\local\filters\duration, core_reportbuilder\local\filters\number, core_reportbuilder\local\filters\select, core_reportbuilder\local\filters\tags, and core_reportbuilder\local\filters\user.

◆ get_sql_filter() [2/2]

core_reportbuilder\local\filters\text::get_sql_filter ( ?array $values)

Return filter SQL.

Parameters
array | null$values
Return values
arrayarray of two elements - SQL query and named parameters

◆ setup_form() [1/2]

◆ setup_form() [2/2]

core_reportbuilder\local\filters\text::setup_form ( \MoodleQuickForm $mform)

Adds controls specific to this filter in the form.

Operator selector use the "$this->name . '_operator'" naming convention and the fields to enter custom values should use "$this->name . '_value'" or _value1/_value2/... in case there is more than one field for their naming.

Parameters
MoodleQuickForm$mform

The documentation for this class was generated from the following file: