.

DBFilterMultiColumn Class Reference
[QueryModifiers]

A filter containing several columns to apply to a search result. More...

Inheritance diagram for DBFilterMultiColumn:
DBFilter IDBQueryModifier

List of all members.

Public Member Functions

  __construct ($items, $title)
  contructor
  apply ($query)
  Apply.
  get_items ()
  Return colum items.

Detailed Description

A filter containing several columns to apply to a search result.

Construct with an array of DBFilterMultiColumnItems

 public function get_filters() {
   return array(
     new DBFilterGroup(
       '2col',
       tr('Two Column Test'),
       array(
         'example' => new DBFilterMultiColumn(array(
           new DBFilterMultiColumnItem('field_a', 'value_a'),
           new DBFilterMultiColumnItem('field_b', 'value_b', '<>')
         ), tr('Example')),
         'other' => new DBFilterMultiColumn(array(
           new DBFilterMultiColumnItem('field_a', 'other_value'),
           new DBFilterMultiColumnItem('field_b', 'other_value_b', '<>')
         ), tr('Other stuff'),
         // Filters can be mixed!
         'classic' => new DBFilterColumn('field_c', 'old_stuff', tr('Classic'))
       )
     );
   )
 }
Author:
Gerd Riesselmann

Definition at line 83 of file dbfiltermulticolumn.cls.php.


Constructor & Destructor Documentation

DBFilterMultiColumn::__construct ( items,
title  
)

contructor

Parameters:
array  items
string  title

Reimplemented from DBFilter.

Definition at line 95 of file dbfiltermulticolumn.cls.php.

00095                                                     {
00096                 $this->items = $items;
00097                 parent::__construct($title);    
00098         }

Member Function Documentation

DBFilterMultiColumn::apply ( query  ) 

Apply.

Parameters:
ISearchAdapter  $query

Reimplemented from DBFilter.

Definition at line 105 of file dbfiltermulticolumn.cls.php.

00105                                       {
00106                 $where = new DBWhereGroup($query);
00107                 foreach($this->items as $item) {
00108                         /* @var $item DBFilterMultiColumnItem */
00109                         $column = trim($item->column);
00110                         if (empty($column)) {
00111                                 return;
00112                         }
00113                         $where->add_where($column, $item->operator, $this->preprocess_value($item->value, $item->operator), $item->logical);
00114                 }
00115                 $query->add_where_object($where);
00116         }
DBFilterMultiColumn::get_items (  ) 

Return colum items.

Returns:
array Array of DBFilterMultiColumnItem

Definition at line 123 of file dbfiltermulticolumn.cls.php.

00123                                     {
00124                 return $this->items;
00125         }

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