Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_table\local\filter\filter Class Reference

Class representing a generic filter of any type. More...

Inheritance diagram for core_table\local\filter\filter:
core_table\local\filter\integer_filter core_table\local\filter\numeric_comparison_filter core_table\local\filter\string_filter

Public Member Functions

 __construct (string $name, ?int $jointype=null, ?array $values=null)
 Constructor for the generic filter class.
 
 add_filter_value ($value)
 Add a value to the filter.
 
 count ()
 Return the number of contexts.
 
 current ()
 Return the current filter value.
 
 get_filter_values ()
 Return the current filter values.
 
 get_join_type ()
 Return the currently specified join type.
 
 get_name ()
 Return the name of the filter.
 
 jsonSerialize ()
 Serialize filter.
 
 key ()
 Returns the current position of the iterator.
 
 next ()
 Move to the next value in the list.
 
 reset_iterator ()
 Reset the iterator position.
 
 rewind ()
 Rewind the Iterator position to the start.
 
 set_join_type (int $jointype)
 Specify the type of join to employ for the filter.
 
 valid ()
 Check if the current position is valid.
 

Public Attributes

int const JOINTYPE_ALL = 2
 All of the following match.
 
int const JOINTYPE_ANY = 1
 Any of the following match.
 
int const JOINTYPE_DEFAULT = 1
 The default filter type (ANY)
 
int const JOINTYPE_NONE = 0
 None of the following match.
 

Protected Member Functions

 sort_filter_values ()
 Sort the filter values to ensure reliable, and consistent output.
 

Protected Attributes

array $filtervalues = []
 The list of active filter values.
 
int $iteratorposition = null
 The current iterator position.
 
int $jointype = self::JOINTYPE_DEFAULT
 The join type currently in use.
 
int[] $jointypes
 valid join types
 
string $name = null
 The name of this filter.
 

Detailed Description

Class representing a generic filter of any type.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_table\local\filter\filter::__construct ( string $name,
?int $jointype = null,
?array $values = null )

Constructor for the generic filter class.

Parameters
string$nameThe name of the current filter.
int$jointypeThe join to use when combining the filters. See the JOINTYPE_ constants for further information on the field.
mixed[]$valuesAn array of filter objects to be applied.

Member Function Documentation

◆ add_filter_value()

core_table\local\filter\filter::add_filter_value ( $value)

Add a value to the filter.

Parameters
mixed$value
Return values
self

Reimplemented in core_table\local\filter\integer_filter, core_table\local\filter\numeric_comparison_filter, and core_table\local\filter\string_filter.

◆ count()

core_table\local\filter\filter::count ( )

Return the number of contexts.

Return values
int

◆ get_filter_values()

core_table\local\filter\filter::get_filter_values ( )

Return the current filter values.

Return values
mixed[]

◆ get_join_type()

core_table\local\filter\filter::get_join_type ( )

Return the currently specified join type.

Return values
int

◆ get_name()

core_table\local\filter\filter::get_name ( )

Return the name of the filter.

Return values
string

◆ jsonSerialize()

core_table\local\filter\filter::jsonSerialize ( )

Serialize filter.

Return values
mixed|object

◆ key()

core_table\local\filter\filter::key ( )

Returns the current position of the iterator.

Return values
int

◆ set_join_type()

core_table\local\filter\filter::set_join_type ( int $jointype)

Specify the type of join to employ for the filter.

Parameters
int$jointypeThe join type to use using one of the supplied constants
Return values
self

◆ valid()

core_table\local\filter\filter::valid ( )

Check if the current position is valid.

Return values
bool

Member Data Documentation

◆ $jointypes

int [] core_table\local\filter\filter::$jointypes
protected
Initial value:
= [
]
int const JOINTYPE_ALL
All of the following match.
Definition filter.php:54
int const JOINTYPE_ANY
Any of the following match.
Definition filter.php:51
int const JOINTYPE_NONE
None of the following match.
Definition filter.php:48

valid join types


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