DBFilterGroup Class Reference
[Model]
Contains a set of DBFilter instances that form a group. More...
Public Member Functions |
|
| __construct ($key= '', $name= '', $filters=array(), $default= '') | |
| Constructor. |
|
| add_filter ($key, $filter) | |
| Add a new filter. |
|
| apply ($query) | |
| Apply filter. |
|
| count () | |
| Returns number of filters. |
|
| get_current_filter () | |
| Returns current filter. |
|
| get_current_key () | |
| Return current filter's key. |
|
| get_default_key () | |
| Return default filter's key. |
|
| get_filter ($key) | |
| Get filter for give key. |
|
| get_filters () | |
| Returns an array of all filters. |
|
| get_group_id () | |
| Return key of this group. |
|
| get_keys () | |
| Returns an array of all filter keys.
|
|
| get_name () | |
| Return name of this filter. |
|
| set_current_key ($key) | |
| Set current filter's key. |
|
| set_default_key ($key) | |
| Set default filter's key. |
|
Protected Attributes |
|
| $filters = array() | |
| An associative array of DBFilter instances.
|
|
| $group_key = '' | |
| $key_current_filter = '' | |
| $key_default_filter = '' | |
| $name = '' | |
Detailed Description
Contains a set of DBFilter instances that form a group.
For example, all possible filters on a column can form a group
Definition at line 11 of file dbfiltergroup.cls.php.
Constructor & Destructor Documentation
| DBFilterGroup::__construct | ( | $ | key = '', |
|
| $ | name = '', |
|||
| $ | filters = array(), |
|||
| $ | default = '' |
|||
| ) |
Constructor.
- Parameters:
-
array Associative array of DBFilter instances
Definition at line 26 of file dbfiltergroup.cls.php.
00026 { 00027 $this->name = $name; 00028 $this->group_key = $key; 00029 foreach($filters as $key => $value) { 00030 $this->add_filter(strval($key), $value); 00031 } 00032 $this->set_default_key($default); 00033 $this->set_current_key($default); 00034 }
Member Function Documentation
| DBFilterGroup::add_filter | ( | $ | key, | |
| $ | filter | |||
| ) |
Add a new filter.
Definition at line 56 of file dbfiltergroup.cls.php.
| DBFilterGroup::apply | ( | $ | query | ) |
Apply filter.
Implements IDBQueryModifier.
Definition at line 136 of file dbfiltergroup.cls.php.
00136 { 00137 $query->apply_modifier($this->get_current_filter()); 00138 }
| DBFilterGroup::count | ( | ) |
Returns number of filters.
Definition at line 85 of file dbfiltergroup.cls.php.
00085 { 00086 return count($this->filters); 00087 }
| DBFilterGroup::get_current_filter | ( | ) |
Returns current filter.
- Returns:
- DBFilter
Definition at line 125 of file dbfiltergroup.cls.php.
00125 { 00126 $ret = $this->get_filter($this->get_current_key()); 00127 if ($ret == false) { 00128 $ret = $this->get_filter($this->get_default_key()); 00129 } 00130 return $ret; 00131 }
| DBFilterGroup::get_current_key | ( | ) |
Return current filter's key.
Definition at line 116 of file dbfiltergroup.cls.php.
| DBFilterGroup::get_default_key | ( | ) |
Return default filter's key.
Definition at line 102 of file dbfiltergroup.cls.php.
| DBFilterGroup::get_filter | ( | $ | key | ) |
Get filter for give key.
Definition at line 64 of file dbfiltergroup.cls.php.
00064 { 00065 return Arr::get_item($this->filters, $key, false); 00066 }
| DBFilterGroup::get_filters | ( | ) |
Returns an array of all filters.
Definition at line 78 of file dbfiltergroup.cls.php.
| DBFilterGroup::get_group_id | ( | ) |
Return key of this group.
Definition at line 46 of file dbfiltergroup.cls.php.
| DBFilterGroup::get_keys | ( | ) |
Returns an array of all filter keys.
Definition at line 71 of file dbfiltergroup.cls.php.
| DBFilterGroup::get_name | ( | ) |
Return name of this filter.
Definition at line 39 of file dbfiltergroup.cls.php.
| DBFilterGroup::set_current_key | ( | $ | key | ) |
Set current filter's key.
Definition at line 109 of file dbfiltergroup.cls.php.
| DBFilterGroup::set_default_key | ( | $ | key | ) |
Set default filter's key.
Definition at line 92 of file dbfiltergroup.cls.php.
Member Data Documentation
DBFilterGroup::$filters = array()
[protected] |
An associative array of DBFilter instances.
Definition at line 15 of file dbfiltergroup.cls.php.
DBFilterGroup::$group_key = ''
[protected] |
Definition at line 17 of file dbfiltergroup.cls.php.
DBFilterGroup::$key_current_filter = ''
[protected] |
Definition at line 19 of file dbfiltergroup.cls.php.
DBFilterGroup::$key_default_filter = ''
[protected] |
Definition at line 18 of file dbfiltergroup.cls.php.
DBFilterGroup::$name = ''
[protected] |
Definition at line 16 of file dbfiltergroup.cls.php.
The documentation for this class was generated from the following file:
- gyro/core/model/base/dbfiltergroup.cls.php
