ListViewFiltersTrait
Description of ListViewFiltersTrait
Tags
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
$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
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 —getViewName()
    public
    abstract                getViewName() : string
        
    
    
        Return values
string —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(array<string|int, DataBaseWhere> $where) : void
    
        Parameters
- $where : array<string|int, DataBaseWhere>
 
Return values
void —sortFilters()
    private
                    sortFilters() : void