ListView
extends ListView
in package
Class created by Core/Base/PluginDeploy
Tags
Table of Contents
- DEFAULT_TEMPLATE = 'Master/BaseView.html.twig'
- $count : int
- Total count of read rows.
- $cursor : array<string|int, mixed>
- Cursor with data from the model display
- $filters : array<string|int, BaseFilter>
- Filter configuration preset by the user
- $icon : string
- $model : ModelClass
- Model to use in this view.
- $newCode : string
- Stores the new code from the save() procedure, to use in loadData().
- $offset : int
- Stores the offset for the cursor
- $order : array<string|int, mixed>
- $orderKey : string
- $orderOptions : array<string|int, mixed>
- $pageFilterKey : int
- Predefined filter values selected
- $pageFilters : array<string|int, PageFilter>
- List of predefined filter values
- $query : string
- $searchFields : array<string|int, mixed>
- $settings : array<string|int, mixed>
- $showFilters : bool
- $template : string
- $title : string
- View title
- $totalAmounts : array<string|int, mixed>
- $where : array<string|int, DataBaseWhere>
- Stores the where parameters for the cursor.
- $columns : array<string|int, GroupItem>
- $modals : array<string|int, mixed>
- $pageOption : PageOption
- Columns configuration
- $rows : array<string|int, mixed>
- $name : string
- __construct() : mixed
- Construct and initialize the class
- addColor() : ListView
- 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.
- addOrderBy() : ListView
- Adds a field to the Order By list
- addSearchFields() : ListView
- Adds a list of fields to the search in the ListView.
- btnNewUrl() : string
- columnForField() : ColumnItem|null
- Gets the column by the given field name
- columnForName() : ColumnItem
- Gets the column by the column name
- columnModalForName() : ColumnItem
- Gets the modal column by the column name
- deletePageFilter() : bool
- Removes a saved user filter.
- disableColumn() : BaseView
- Establishes the column's display or read only state.
- export() : bool
- Method to export the view data.
- getColumns() : array<string|int, GroupItem>
- Returns the column configuration
- getModals() : array<string|int, GroupItem>
- Returns the modal configuration
- getPagination() : array<string|int, mixed>
- getRow() : mixed
- If it exists, return the specified row type
- getViewName() : string
- Returns the name.
- loadData() : mixed
- Loads view data.
- loadFromData() : mixed
- Verifies the structure and loads into the model the given data array
- loadPageOptions() : mixed
- processFormData() : mixed
- Process form data.
- savePageFilter() : int
- Save filter values for user/s.
- setSettings() : BaseView
- assets() : mixed
- Adds assets to the asset manager.
- getColumnForName() : ColumnItem
- Gets the column by the column name from source group
- getPageWhere() : mixed
- Returns DataBaseWhere[] for locate a pageOption model.
- setSelectedOrderBy() : void
- Checks and establishes the selected value in the Order By
- getTotalSum() : float
- loadSavedFilters() : void
- loadTotalAmounts() : void
- processFormDataLoad() : mixed
- sortFilters() : void
Constants
DEFAULT_TEMPLATE
public
mixed
DEFAULT_TEMPLATE
= 'Master/BaseView.html.twig'
Properties
$count
Total count of read rows.
public
int
$count
= 0
$cursor
Cursor with data from the model display
public
array<string|int, mixed>
$cursor
= []
$filters
Filter configuration preset by the user
public
array<string|int, BaseFilter>
$filters
= []
$icon
public
string
$icon
$model
Model to use in this view.
public
ModelClass
$model
$newCode
Stores the new code from the save() procedure, to use in loadData().
public
string
$newCode
$offset
Stores the offset for the cursor
public
int
$offset
= 0
$order
public
array<string|int, mixed>
$order
= []
$orderKey
public
string
$orderKey
= ''
$orderOptions
public
array<string|int, mixed>
$orderOptions
= []
$pageFilterKey
Predefined filter values selected
public
int
$pageFilterKey
= 0
$pageFilters
List of predefined filter values
public
array<string|int, PageFilter>
$pageFilters
= []
$query
public
string
$query
= ''
$searchFields
public
array<string|int, mixed>
$searchFields
= []
$settings
public
array<string|int, mixed>
$settings
$showFilters
public
bool
$showFilters
= false
$template
public
string
$template
$title
View title
public
string
$title
$totalAmounts
public
array<string|int, mixed>
$totalAmounts
= []
$where
Stores the where parameters for the cursor.
public
array<string|int, DataBaseWhere>
$where
= []
$columns
protected
array<string|int, GroupItem>
$columns
= []
$modals
protected
array<string|int, mixed>
$modals
= []
$pageOption
Columns configuration
protected
PageOption
$pageOption
$rows
protected
array<string|int, mixed>
$rows
= []
$name
private
string
$name
Methods
__construct()
Construct and initialize the class
public
__construct(string $name, string $title, string $modelName, string $icon) : mixed
Parameters
- $name : string
- $title : string
- $modelName : string
- $icon : string
Return values
mixed —addColor()
public
addColor(string $fieldName, mixed $value, string $color[, string $title = '' ]) : ListView
Parameters
- $fieldName : string
- $value : mixed
- $color : string
- $title : string = ''
Return values
ListView —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 —addOrderBy()
Adds a field to the Order By list
public
addOrderBy(array<string|int, mixed> $fields, string $label, int $default) : ListView
Parameters
- $fields : array<string|int, mixed>
- $label : string
- $default : int
-
(0 = None, 1 = ASC, 2 = DESC)
Return values
ListView —addSearchFields()
Adds a list of fields to the search in the ListView.
public
addSearchFields(array<string|int, mixed> $fields) : ListView
To use integer columns, use CAST(columnName AS CHAR(50)).
Parameters
- $fields : array<string|int, mixed>
Return values
ListView —btnNewUrl()
public
btnNewUrl() : string
Return values
string —columnForField()
Gets the column by the given field name
public
columnForField(string $fieldName) : ColumnItem|null
Parameters
- $fieldName : string
Return values
ColumnItem|null —columnForName()
Gets the column by the column name
public
columnForName(string $columnName) : ColumnItem
Parameters
- $columnName : string
Return values
ColumnItem —columnModalForName()
Gets the modal column by the column name
public
columnModalForName(string $columnName) : ColumnItem
Parameters
- $columnName : string
Return values
ColumnItem —deletePageFilter()
Removes a saved user filter.
public
deletePageFilter(string $id_filter) : bool
Parameters
- $id_filter : string
Return values
bool —disableColumn()
Establishes the column's display or read only state.
public
disableColumn(string $columnName[, bool $disabled = true ][, string $readOnly = '' ]) : BaseView
Parameters
- $columnName : string
- $disabled : bool = true
- $readOnly : string = ''
Return values
BaseView —export()
Method to export the view data.
public
abstract export(mixed &$exportManager, mixed $codes) : bool
Parameters
- $exportManager : mixed
- $codes : mixed
Return values
bool —getColumns()
Returns the column configuration
public
getColumns() : array<string|int, GroupItem>
Return values
array<string|int, GroupItem> —getModals()
Returns the modal configuration
public
getModals() : array<string|int, GroupItem>
Return values
array<string|int, GroupItem> —getPagination()
public
getPagination() : array<string|int, mixed>
Return values
array<string|int, mixed> —getRow()
If it exists, return the specified row type
public
getRow(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getViewName()
Returns the name.
public
getViewName() : string
Return values
string —loadData()
Loads view data.
public
abstract loadData([mixed $code = '' ][, mixed $where = [] ][, mixed $order = [] ], mixed $offset[, mixed $limit = FS_ITEM_LIMIT ]) : mixed
Parameters
- $code : mixed = ''
- $where : mixed = []
- $order : mixed = []
- $offset : mixed
- $limit : mixed = FS_ITEM_LIMIT
Return values
mixed —loadFromData()
Verifies the structure and loads into the model the given data array
public
loadFromData(array<string|int, mixed> &$data) : mixed
Parameters
- $data : array<string|int, mixed>
Return values
mixed —loadPageOptions()
public
loadPageOptions([User|false $user = false ]) : mixed
Parameters
- $user : User|false = false
Return values
mixed —processFormData()
Process form data.
public
abstract processFormData(mixed $request, mixed $case) : mixed
Parameters
- $request : mixed
- $case : mixed
Return values
mixed —savePageFilter()
Save filter values for user/s.
public
savePageFilter(Request $request, User $user) : int
Parameters
- $request : Request
- $user : User
Return values
int —setSettings()
public
setSettings(string $key, mixed $value) : BaseView
Parameters
- $key : string
- $value : mixed
Return values
BaseView —assets()
Adds assets to the asset manager.
protected
assets() : mixed
Return values
mixed —getColumnForName()
Gets the column by the column name from source group
protected
getColumnForName(string $columnName, array<string|int, mixed> &$source) : ColumnItem
Parameters
- $columnName : string
- $source : array<string|int, mixed>
Return values
ColumnItem —getPageWhere()
Returns DataBaseWhere[] for locate a pageOption model.
protected
getPageWhere([User|false $user = false ]) : mixed
Parameters
- $user : User|false = false
Return values
mixed —setSelectedOrderBy()
Checks and establishes the selected value in the Order By
protected
setSelectedOrderBy(string $orderKey) : void
Parameters
- $orderKey : string
Return values
void —getTotalSum()
private
getTotalSum(string $tableName, string $fieldName, array<string|int, mixed> $where) : float
Parameters
- $tableName : string
- $fieldName : string
- $where : array<string|int, mixed>
Return values
float —loadSavedFilters()
private
loadSavedFilters(array<string|int, DataBaseWhere> $where) : void
Parameters
- $where : array<string|int, DataBaseWhere>
Return values
void —loadTotalAmounts()
private
loadTotalAmounts() : void
Return values
void —processFormDataLoad()
private
processFormDataLoad(Request $request) : mixed
Parameters
- $request : Request
Return values
mixed —sortFilters()
private
sortFilters() : void