PHP Class FilterComponent, cakephp-filter

Inheritance: extends Component
ファイルを表示 Open project: josegonzalez/cakephp-filter Class Usage Examples

Public Properties

Property Type Description
$__data array Stores data for the current pagination set
$filterOptions array Holds filterOptions for 1.2 Compatibility
$paginate array Pagination array for component
$settings array actions: Actions upon which this component will act upon defaults: Holds pagination defaults for controller actions. fieldFormatting: Fields which will replace the regular syntax in where i.e. field = 'value' formOptionsDatetime: Formatting for datetime fields (unused) paginatorParams: Paginator params sent in the URL parsed: Used to tell whether the data options have been parsed redirect: Used to tell whether to redirect so the url includes filter data useTime: Used to tell whether time should be used in the filtering separator: Separator to use between fields in a date input rangeSeparator: Separator to use between dates in a date range url: Url variable used in paginate helper (array('url'=>$url)); whitelist: Array of fields and models for which this component may filter

Public Methods

Method Description
__arrayHasKeys ( array $array, array $keys, boolean $size = null ) : boolean Checks if all keys are held within an array
__buildNamedParams ( array $params ) : string Builds a named parameter list
__checkParams ( object &$controller ) : array Parses named parameters from the current GET request
__filterField ( string $model, string $filteredFieldName, $filteredFieldData, array $modelFieldNames = [] ) : array Filters an individual field
__prepareDatetime ( array $date ) : string Prepares a date array for a MySQL WHERE clause
__prepareFilter ( object &$controller ) Store sanitized version of filter data
initialize ( object &$controller, array $settings = [] ) : void Initializes FilterComponent for use in the controller
processAction ( &$controller )
processDatetime ( string $fieldname ) : null | string Builds up a selected datetime for the form helper
processFilters ( object &$controller ) : void Function which will change controller->data array

Method Details

__arrayHasKeys() public method

Checks if all keys are held within an array
Author: Jose Diaz-Gonzalez
public __arrayHasKeys ( array $array, array $keys, boolean $size = null ) : boolean
$array array
$keys array
$size boolean
return boolean array has keys, optional check on size of array

__buildNamedParams() public method

Builds a named parameter list
Author: Chad Jablonski
public __buildNamedParams ( array $params ) : string
$params array An array of parameters to parse
return string Parsed string of named parameters

__checkParams() public method

Parses named parameters from the current GET request
public __checkParams ( object &$controller ) : array
$controller object Reference to controller
return array Parsed params

__filterField() public method

Filters an individual field
Author: Jose Diaz-Gonzalez
public __filterField ( string $model, string $filteredFieldName, $filteredFieldData, array $modelFieldNames = [] ) : array
$model string name of model
$filteredFieldName string
$modelFieldNames array
return array

__prepareDatetime() public method

Prepares a date array for a MySQL WHERE clause
Author: Jeffrey Marvin
public __prepareDatetime ( array $date ) : string
$date array
return string

__prepareFilter() public method

Store sanitized version of filter data
public __prepareFilter ( object &$controller )
$controller object Reference to controller

initialize() public method

Initializes FilterComponent for use in the controller
public initialize ( object &$controller, array $settings = [] ) : void
$controller object A reference to the instantiating controller object
$settings array Array of settings for the Component
return void

processAction() public method

public processAction ( &$controller )

processDatetime() public method

Builds up a selected datetime for the form helper
public processDatetime ( string $fieldname ) : null | string
$fieldname string the name of the field to process
return null | string

processFilters() public method

Function which will change controller->data array
public processFilters ( object &$controller ) : void
$controller object Reference to controller
return void

Property Details

$__data public_oe property

Stores data for the current pagination set
public array $__data
return array

$filterOptions public_oe property

Holds filterOptions for 1.2 Compatibility
public array $filterOptions
return array

$paginate public_oe property

Pagination array for component
public array $paginate
return array

$settings public_oe property

actions: Actions upon which this component will act upon defaults: Holds pagination defaults for controller actions. fieldFormatting: Fields which will replace the regular syntax in where i.e. field = 'value' formOptionsDatetime: Formatting for datetime fields (unused) paginatorParams: Paginator params sent in the URL parsed: Used to tell whether the data options have been parsed redirect: Used to tell whether to redirect so the url includes filter data useTime: Used to tell whether time should be used in the filtering separator: Separator to use between fields in a date input rangeSeparator: Separator to use between dates in a date range url: Url variable used in paginate helper (array('url'=>$url)); whitelist: Array of fields and models for which this component may filter
public array $settings
return array