Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Public Member Functions | |
__construct (string $filterclass, string $name, lang_string $header, string $entityname, string $fieldsql='', array $fieldparams=[]) | |
Filter constructor. | |
add_join (string $join) | |
Add join clause required for this filter to join to existing tables/entities. | |
add_joins (array $joins) | |
Add multiple join clauses required for this filter, passing each to {. | |
get_entity_name () | |
Return filter entity name. | |
get_field_params () | |
Get the SQL params for the field being filtered. | |
get_field_sql () | |
Get SQL expression for the field. | |
get_field_sql_and_params (int $index=0) | |
Retrieve SQL expression and parameters for the field. | |
get_filter_class () | |
Get filter class path. | |
get_header () | |
Return header. | |
get_is_available () | |
Return available state of the filter for the current user. | |
get_joins () | |
Return joins. | |
get_name () | |
Get filter name. | |
get_options () | |
Get the options for the filter, returning via the the previously set options or generated via defined options callback. | |
get_persistent () | |
Return filter persistent. | |
get_unique_identifier () | |
Return unique identifier for this filter. | |
restrict_limited_operators (array $operators) | |
Filter given operators to include only those previously defined by {. | |
set_field_sql (string $sql, array $params=[]) | |
Set the SQL expression for the field that is being filtered. | |
set_header (lang_string $header) | |
Set header. | |
set_is_available (bool $available) | |
Conditionally set whether the filter is available. | |
set_limited_operators (array $limitoperators) | |
Set a limited subset of operators that should be used for the filter, refer to each filter class to find defined operator constants. | |
set_options ($options) | |
Set the options for the filter in the format that the filter class expected (e.g. | |
set_options_callback (callable $callback) | |
Set the options for the filter to be returned by a callback (that receives no arguments) in the format that the filter class expects. | |
set_persistent (filter_model $persistent) | |
Set filter persistent. | |
Protected Attributes | |
bool | $available = true |
$available | |
string[] | $joins = [] |
$joins | |
array | $limitoperators = [] |
$limitoperators | |
mixed | $options |
$options | |
filter_model | $persistent |
$persistent | |
core_reportbuilder\local\report\filter::__construct | ( | string | $filterclass, |
string | $name, | ||
lang_string | $header, | ||
string | $entityname, | ||
string | $fieldsql = '', | ||
array | $fieldparams = [] ) |
Filter constructor.
string | $filterclass | Filter type class to use, must extend { |
string | $name | Internal name of the filter |
lang_string | $header | Title of the filter used in reports |
string | $entityname | Name of the entity this filter belongs to. Typically when creating filters within entities this value should be the result of calling { |
string | $fieldsql | SQL clause to use for filtering, { |
array | $fieldparams |
moodle_exception | For invalid filter class |
core_reportbuilder\local\report\filter::add_join | ( | string | $join | ) |
Add join clause required for this filter to join to existing tables/entities.
This is necessary in the case where {
string | $join |
self |
core_reportbuilder\local\report\filter::add_joins | ( | array | $joins | ) |
Add multiple join clauses required for this filter, passing each to {.
Typically when defining filters in entities, you should pass {
string[] | $joins |
self |
core_reportbuilder\local\report\filter::get_entity_name | ( | ) |
Return filter entity name.
string |
core_reportbuilder\local\report\filter::get_field_params | ( | ) |
Get the SQL params for the field being filtered.
array |
core_reportbuilder\local\report\filter::get_field_sql | ( | ) |
Get SQL expression for the field.
string |
core_reportbuilder\local\report\filter::get_field_sql_and_params | ( | int | $index = 0 | ) |
Retrieve SQL expression and parameters for the field.
int | $index |
array | [$sql, [...$params]] |
core_reportbuilder\local\report\filter::get_filter_class | ( | ) |
Get filter class path.
string |
core_reportbuilder\local\report\filter::get_header | ( | ) |
Return header.
string |
core_reportbuilder\local\report\filter::get_is_available | ( | ) |
Return available state of the filter for the current user.
bool |
core_reportbuilder\local\report\filter::get_joins | ( | ) |
Return joins.
string[] |
core_reportbuilder\local\report\filter::get_name | ( | ) |
Get filter name.
string |
core_reportbuilder\local\report\filter::get_options | ( | ) |
Get the options for the filter, returning via the the previously set options or generated via defined options callback.
mixed |
core_reportbuilder\local\report\filter::get_persistent | ( | ) |
Return filter persistent.
filter_model|null |
core_reportbuilder\local\report\filter::get_unique_identifier | ( | ) |
Return unique identifier for this filter.
string |
core_reportbuilder\local\report\filter::restrict_limited_operators | ( | array | $operators | ) |
Filter given operators to include only those previously defined by {.
array | $operators | All operators as defined by the filter class |
array |
core_reportbuilder\local\report\filter::set_field_sql | ( | string | $sql, |
array | $params = [] ) |
Set the SQL expression for the field that is being filtered.
It will be passed to the filter class
string | $sql | |
array | $params |
self |
core_reportbuilder\local\report\filter::set_header | ( | lang_string | $header | ) |
core_reportbuilder\local\report\filter::set_is_available | ( | bool | $available | ) |
Conditionally set whether the filter is available.
For instance the filter may be added to a report with the expectation that only some users are able to see it
bool | $available |
self |
core_reportbuilder\local\report\filter::set_limited_operators | ( | array | $limitoperators | ) |
Set a limited subset of operators that should be used for the filter, refer to each filter class to find defined operator constants.
array | $limitoperators | Simple array of operator values |
self |
core_reportbuilder\local\report\filter::set_options | ( | $options | ) |
Set the options for the filter in the format that the filter class expected (e.g.
the "select" filter expects an array)
This method should only be used if the options do not require any calculations/queries, in which case {
mixed | $options |
self |
core_reportbuilder\local\report\filter::set_options_callback | ( | callable | $callback | ) |
Set the options for the filter to be returned by a callback (that receives no arguments) in the format that the filter class expects.
callable | $callback |
self |
core_reportbuilder\local\report\filter::set_persistent | ( | filter_model | $persistent | ) |
Set filter persistent.
filter_model | $persistent |
self |