FacturaScripts

ListViewFiltersTrait

Description of ListViewFiltersTrait

Table of Contents

$filters Filter configuration preset by the user \FacturaScripts\Core\Lib\ListFilter\BaseFilter[]
$pageFilterKey Predefined filter values selected int
$pageFilters List of predefined filter values \FacturaScripts\Dinamic\Model\PageFilter[]
$showFilters bool
getViewName() string
addFilterAutocomplete() Add an autocomplete type filter to the ListView. mixed
addFilterCheckbox() Adds a boolean condition type filter to the ListView. mixed
addFilterDatePicker() Adds a date type filter to the ListView. mixed
addFilterNumber() Adds a numeric type filter to the ListView. mixed
addFilterPeriod() Adds a period type filter to the ListView. mixed
addFilterSelect() Add a select type filter to a ListView. mixed
addFilterSelectWhere() Add a select where type filter to a ListView. mixed
deletePageFilter() Removes a saved user filter. bool
savePageFilter() Save filter values for user/s. int
loadSavedFilters() mixed
sortFilters() mixed

Properties

$filters

Filter configuration preset by the user

public \FacturaScripts\Core\Lib\ListFilter\BaseFilter[] $filters = []

$pageFilters

List of predefined filter values

public \FacturaScripts\Dinamic\Model\PageFilter[] $pageFilters = []

Methods

addFilterAutocomplete()

Add an autocomplete type filter to the ListView.

public addFilterAutocomplete( $key : string , $label : string , $field : string , $table : string [, $fieldcode : string = '' ] [, $fieldtitle : string = '' ] [, $where : array = [] ] ) : mixed
Parameters
$key : string
$label : string
$field : string
$table : string
$fieldcode : string = ''
$fieldtitle : string = ''
$where : array = []
Return values
mixed

addFilterCheckbox()

Adds a boolean condition type filter to the ListView.

public addFilterCheckbox( $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '=' ] [, $matchValue : mixed = true ] [, $default : array = [] ] ) : mixed
Parameters
$key : string
$label : string = ''
$field : string = ''
$operation : string = '='
$matchValue : mixed = true
$default : array = []
Return values
mixed

addFilterDatePicker()

Adds a date type filter to the ListView.

public addFilterDatePicker( $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '>=' ] ) : mixed
Parameters
$key : string
$label : string = ''
$field : string = ''
$operation : string = '>='
Return values
mixed

addFilterNumber()

Adds a numeric type filter to the ListView.

public addFilterNumber( $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '>=' ] ) : mixed
Parameters
$key : string
$label : string = ''
$field : string = ''
$operation : string = '>='
Return values
mixed

addFilterPeriod()

Adds a period type filter to the ListView.

public addFilterPeriod( $key : string , $label : string , $field : string ) : mixed

(period + start date + end date)

Parameters
$key : string
$label : string
$field : string
Return values
mixed

addFilterSelect()

Add a select type filter to a ListView.

public addFilterSelect( $key : string , $label : string , $field : string [, $values : array = [] ] ) : mixed
Parameters
$key : string
$label : string
$field : string
$values : array = []
Return values
mixed

addFilterSelectWhere()

Add a select where type filter to a ListView.

public addFilterSelectWhere( $key : string , $values : array ) : mixed
Parameters
$key : string
$values : array

Example of values: [ ['label' => 'Only active', 'where' => [ new DataBaseWhere('suspended', 'FALSE') ]] ['label' => 'Only suspended', 'where' => [ new DataBaseWhere('suspended', 'TRUE') ]] ['label' => 'All records', 'where' => []], ]

Return values
mixed

deletePageFilter()

Removes a saved user filter.

public deletePageFilter( $idfilter : string ) : bool
Parameters
$idfilter : string
Return values
bool

savePageFilter()

Save filter values for user/s.

public savePageFilter( $request : Request , $user : User ) : int
Parameters
$request : Request
$user : User
Return values
int

loadSavedFilters()

private loadSavedFilters( $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] ) : mixed
Parameters
$where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
Return values
mixed

Search results