ListViewFiltersTrait
Description of ListViewFiltersTrait
Table of Contents
Properties
- $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
Methods
- 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.
- addFilterTree() : ListView
- Añade un filtro de tipo Arbol, recursivo
- deletePageFilter() : bool
- Removes a saved user filter.
- getViewName() : string
- savePageFilter() : int
- Save filter values for user/s.
- loadSavedFilters() : void
- sortFilters() : void
Properties
$filters
Filter configuration preset by the user
public
array<string|int, BaseFilter>
$filters
= []
$pageFilterKey
Predefined filter values selected
public
int
$pageFilterKey
= 0
$pageFilters
List of predefined filter values
public
array<string|int, PageFilter>
$pageFilters
= []
$showFilters
public
bool
$showFilters
= false
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
ListViewaddFilterCheckbox()
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
ListViewaddFilterDatePicker()
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
ListViewaddFilterNumber()
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
ListViewaddFilterPeriod()
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
ListViewaddFilterSelect()
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
ListViewaddFilterSelectWhere()
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
ListViewaddFilterTree()
Añade un filtro de tipo Arbol, recursivo
public
addFilterTree(string $key, string $label, string $field, string $table, string $fieldparent[, string $fieldcode = '' ][, string $fieldtitle = '' ][, array<string|int, mixed> $where = [] ]) : ListView
Un ejemplo de uso es el modelo familia de producto que contiene a su vez un padre que es familia de producto.
Parameters
- $key : string
-
Clave única para identificar el filtro.
- $label : string
-
Etiqueta que se mostrará para el filtro.
- $field : string
-
Campo de la tabla a filtrar.
- $table : string
-
Tabla de la base de datos donde se aplicará el filtro.
- $fieldparent : string
-
Campo que indica el padre para la estructura de árbol.
- $fieldcode : string = ''
-
Campo que representa el código del nodo del árbol.
- $fieldtitle : string = ''
-
Campo que representa el título o nombre del nodo del árbol.
- $where : array<string|int, mixed> = []
-
Condiciones WHERE adicionales.
Return values
ListViewdeletePageFilter()
Removes a saved user filter.
public
deletePageFilter(string $id_filter) : bool
Parameters
- $id_filter : string
Return values
boolgetViewName()
public
abstract getViewName() : string
Return values
stringsavePageFilter()
Save filter values for user/s.
public
savePageFilter(Request $request, User $user) : int
Parameters
Return values
intloadSavedFilters()
private
loadSavedFilters(array<string|int, DataBaseWhere> $where) : void
Parameters
- $where : array<string|int, DataBaseWhere>
sortFilters()
private
sortFilters() : void