com.lokorin.dfcrafters.lib
[ class tree: com.lokorin.dfcrafters.lib ] [ index: com.lokorin.dfcrafters.lib ] [ all elements ]

Class: SearchField

Source Location: /_includes/lib_search.php

Class Overview


Describes a field that should be used in a search.


Author(s):

  • Andreas Launila

Variables

Methods


Child classes:

FulltextSearch
Describes a search field that implements fulltext searches.
LikeSearch
Describes a search field that implements LIKE searches.
EqualSearch
Describes a search field that searches for things that are equal to the parameter.
LesserSearch
Describes a search field that searches for things that are lesser than the parameter.
GreaterSearch
Describes a search field that searches for things that are greater than the parameter.
GreaterEqualSearch
Describes a search field that searches for things that are greater than or equal to the parameter.
LesserEqualSearch
Describes a search field that searches for things that are lesser than or equal to the parameter.
CustomSearch
Describes a search field that uses a custom pattern to construct the sql conditions.

Class Details

[line 269]
Describes a field that should be used in a search.



Tags:

abstract:  
author:  Andreas Launila


[ Top ]


Class Variables

$parameter =

[line 281]

The parameter (if any) that has been caught by the search field.

Parameters are caught by $_REQUEST[$this->requestName] specifying a non empty value at construction.




Tags:

access:  protected

Type:   string


[ Top ]

$processCallback =

[line 293]

An optional callback that all parameters should be passed through.



Tags:

access:  private

Type:   callback


[ Top ]

$requestName =

[line 288]

The request index that is connected to this request field. I.e. the index in $_REQUEST that the search field should attempt to catch parameters from.



Tags:

access:  private

Type:   string


[ Top ]

$tableField =

[line 274]

The name of the field in the table.



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 309]

SearchField __construct( string $requestName, string $tableField, [string $processCallback = ''])

Constructor for SearchField.



Tags:

access:  public


Overridden in child classes as:

FulltextSearch::__construct()
Constructor for FulltextSearch.
LikeSearch::__construct()
Constructor for LikeSearch.
EqualSearch::__construct()
Constructor for EqualSearch.
LesserSearch::__construct()
Constructor for LesserSearch.
GreaterSearch::__construct()
Constructor for GreaterSearch.
GreaterEqualSearch::__construct()
Constructor for GreaterEqualSearch.
LesserEqualSearch::__construct()
Constructor for LesserSearch.
CustomSearch::__construct()
Constructor for CustomSearch.

Parameters:

string   $requestName   The name that identifies the field's value in the $_REQUEST array. It should be identical to names used in forms and so on. The value does not have to be unique but collisions might occur if it is not.
string   $tableField   The name of the table field that should be associated with the search field.
string   $processCallback   An optional callback that will be used by the search field to process parameters before they are used in the sql query. The callback should take one value which is the value of the parameter from $_REQUEST and return one value, which is the desired value to use.

[ Top ]

method getRequestName [line 354]

string getRequestName( )

Gets the name of the table field that the search field is connected to.



Tags:

return:  A table field name.
access:  public


[ Top ]

method getSqlWhereCondition [line 335]

string getSqlWhereCondition( )

Gets the where condition of the search field. This should be a sql statement that can be placed after "WHERE" in the sql query. A couple of examples: "id > 5", "(solved = 1) AND (tested = 0)".



Tags:

return:  An sql statement to be used in the WHERE section.
abstract:  
access:  public


Overridden in child classes as:

FulltextSearch::getSqlWhereCondition()
LikeSearch::getSqlWhereCondition()
EqualSearch::getSqlWhereCondition()
LesserSearch::getSqlWhereCondition()
GreaterSearch::getSqlWhereCondition()
GreaterEqualSearch::getSqlWhereCondition()
LesserEqualSearch::getSqlWhereCondition()
CustomSearch::getSqlWhereCondition()

[ Top ]

method isValid [line 325]

boolean isValid( )

Checks if the search field is valid, meaning if it has has caugth a non empty parameter.



Tags:

return:  True if the search field has a non empty parameter, false otherwise.
access:  public


[ Top ]

method setParameter [line 342]

void setParameter( mixed $newParameter)

Sets the parameter for the search done by the field to a new value.



Tags:

access:  public


Parameters:

mixed   $newParameter   The new search parameter that should be used by the field.

[ Top ]


Documentation generated on Tue, 10 Jan 2006 17:06:37 +0100 by phpDocumentor 1.3.0RC4