.

FilterText Class Reference
[Controller]

Class to create a filter widget and to filter search results by free text. More...

Inheritance diagram for FilterText:
IDBQueryModifier

List of all members.

Public Member Functions

  __construct ($page_data, $filtercolumn, $filtername, $operator, $adapter=false)
  Contructor.
  apply ($query)
  Modify given query.
  get_filter_title ()
  Return title of filter.
  get_filter_value ()
  Return current value to be filter after.
  prepare_view ($view)
  Set all data on the view.

Protected Member Functions

  get_view_var_name ()
  Returns the name of the variable that gets set on the view.

Protected Attributes

  $adapter
  $filter_object
  $page_data

Detailed Description

Class to create a filter widget and to filter search results by free text.

Author:
Gerd Riesselmann

Definition at line 8 of file filtertext.cls.php.


Constructor & Destructor Documentation

FilterText::__construct ( page_data,
filtercolumn,
filtername,
operator,
adapter = false  
)

Contructor.

Parameters:
PathStack 
Array  Array with filter names as keys and descriptions to display as values

Definition at line 26 of file filtertext.cls.php.

00026                                                                                                          {
00027                 $this->adapter = ($adapter instanceof IFilterTextAdapter) ? $adapter : new FilterTextDefaultAdapter($page_data, String::plain_ascii($filtername));
00028                 $this->page_data = $page_data;
00029                 $this->filter_object = new DBFilterColumn(
00030                         $filtercolumn, 
00031                         $this->adapter->get_value(), 
00032                         tr($filtername, 'app'), 
00033                         $operator
00034                 );
00035         }

Member Function Documentation

FilterText::apply ( query  ) 

Modify given query.

Implements IDBQueryModifier.

Definition at line 40 of file filtertext.cls.php.

00040                                       {
00041                 if ($this->get_filter_value()) {
00042                         $this->filter_object->apply($query);
00043                 }
00044         }
FilterText::get_filter_title (  ) 

Return title of filter.

Returns:
unknown_type

Definition at line 51 of file filtertext.cls.php.

00051                                            {
00052                 return $this->filter_object->get_title();
00053         }
FilterText::get_filter_value (  ) 

Return current value to be filter after.

Returns:
string

Definition at line 60 of file filtertext.cls.php.

00060                                            {
00061                 return $this->filter_object->get_value();
00062         }
FilterText::get_view_var_name (  )  [protected]

Returns the name of the variable that gets set on the view.

Returns:
string

Definition at line 87 of file filtertext.cls.php.

00087                                                {
00088                 return 'filtertext_data';
00089         }
FilterText::prepare_view ( view  ) 

Set all data on the view.

Parameters:
IView  $view

Definition at line 69 of file filtertext.cls.php.

00069                                             {           
00070                 $var_name = $this->get_view_var_name();
00071                 $textfilter_data = Arr::force($view->retrieve($var_name), false);
00072                 $textfilter_data[] = array(
00073                         'title' => $this->get_filter_title(),
00074                         'value' => $this->get_filter_value(),
00075                         'filter_object' => $this->filter_object,
00076                         'adapter' => $this->adapter,
00077                         'page_data' => $this->page_data
00078                 );
00079                 $view->assign($var_name, $textfilter_data);
00080         }

Member Data Documentation

FilterText::$adapter [protected]

Definition at line 17 of file filtertext.cls.php.

FilterText::$filter_object [protected]

Definition at line 13 of file filtertext.cls.php.

FilterText::$page_data [protected]

Definition at line 18 of file filtertext.cls.php.


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