FacturaScripts

ListViewFiltersTrait

Description of ListViewFiltersTrait

Tags
author

Carlos Garcia Gomez [email protected]

Table of Contents

$filters  : array<string|int, BaseFilter>
Filter configuration preset by the user
$pageFilterKey  : int
Predefined filter values selected
$pageFilters  : array<string|int, PageFilter>
List of predefined filter values
$showFilters  : bool
addFilterAutocomplete()  : ListView
Add an autocomplete type filter to the ListView.
addFilterCheckbox()  : ListView
Adds a boolean condition type filter to the ListView.
addFilterDatePicker()  : ListView
Adds a date type filter to the ListView.
addFilterNumber()  : ListView
Adds a numeric type filter to the ListView.
addFilterPeriod()  : ListView
Adds a period type filter to the ListView.
addFilterSelect()  : ListView
Add a select type filter to a ListView.
addFilterSelectWhere()  : ListView
Add a select where type filter to a ListView.
deletePageFilter()  : bool
Removes a saved user filter.
getViewName()  : string
savePageFilter()  : int
Save filter values for user/s.
loadSavedFilters()  : void
sortFilters()  : void

Properties

Methods

addFilterAutocomplete()

Add an autocomplete type filter to the ListView.

public addFilterAutocomplete(string $key, string $label, string $field, string $table[, string $field_code = '' ][, string $field_title = '' ][, array<string|int, mixed> $where = [] ]) : ListView
Parameters
$key : string
$label : string
$field : string
$table : string
$field_code : string = ''
$field_title : string = ''
$where : array<string|int, mixed> = []
Return values
ListView

addFilterCheckbox()

Adds a boolean condition type filter to the ListView.

public addFilterCheckbox(string $key[, string $label = '' ][, string $field = '' ][, string $operation = '=' ][, mixed $match_value = true ][, array<string|int, mixed> $default = [] ]) : ListView
Parameters
$key : string
$label : string = ''
$field : string = ''
$operation : string = '='
$match_value : mixed = true
$default : array<string|int, mixed> = []
Return values
ListView

addFilterDatePicker()

Adds a date type filter to the ListView.

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

addFilterNumber()

Adds a numeric type filter to the ListView.

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

addFilterPeriod()

Adds a period type filter to the ListView.

public addFilterPeriod(string $key, string $label, string $field[, bool $dateTime = false ]) : ListView

(period + start date + end date)

Parameters
$key : string
$label : string
$field : string
$dateTime : bool = false
Return values
ListView

addFilterSelect()

Add a select type filter to a ListView.

public addFilterSelect(string $key, string $label, string $field[, array<string|int, mixed> $values = [] ]) : ListView
Parameters
$key : string
$label : string
$field : string
$values : array<string|int, mixed> = []
Return values
ListView

addFilterSelectWhere()

Add a select where type filter to a ListView.

public addFilterSelectWhere(string $key, array<string|int, mixed> $values[, string $label = '' ]) : ListView
Parameters
$key : string
$values : array<string|int, mixed>
$label : string = ''

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
ListView

deletePageFilter()

Removes a saved user filter.

public deletePageFilter(string $id_filter) : bool
Parameters
$id_filter : 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

Search results