ListView extends BaseView Uses ListViewFiltersTrait
View definition for its use in ListController
Table of Contents
DEFAULT_TEMPLATE | 'Master/ListView.html.twig' | |
---|---|---|
$orderKey | string | |
$orderOptions | List of fields available to order by. | array |
$query | string | |
$searchFields | List of fields where to search in when a search is made | array |
$totalAmounts | array | |
$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 | |
$columns | \FacturaScripts\Dinamic\Lib\Widget\GroupItem[] | |
$count | Total count of read rows. | int |
$cursor | Cursor with data from the model display | array |
$icon | string | |
$modals | array | |
$model | Model to use in this view. | ModelClass |
$name | string | |
$newCode | Stores the new code from the save() procedure, to use in loadData(). | string |
$offset | Stores the offset for the cursor | int |
$order | array | |
$pageOption | Columns configuration | PageOption |
$rows | array | |
$settings | array | |
$template | string | |
$title | View title | string |
$where | Stores the where parameters for the cursor. | \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] |
addOrderBy() | Adds a field to the Order By list | mixed |
addSearchFields() | Adds a list of fields to the search in the ListView. | mixed |
btnNewUrl() | string | |
export() | Method to export the view data. | bool |
getColumns() | Returns the column configuration | \FacturaScripts\Dinamic\Lib\Widget\ColumnItem[] |
loadData() | Loads the data in the cursor property, according to the where filter specified. | mixed |
loadPageOptions() | mixed | |
processFormData() | Process form data needed. | mixed |
assets() | Adds assets to the asset manager. | mixed |
getTotalSum() | float | |
loadTotalAmounts() | mixed | |
processFormDataLoad() | mixed | |
setSelectedOrderBy() | Checks and establishes the selected value in the Order By | mixed |
getViewName() | Returns the name. | 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 | |
export() | Method to export the view data. | bool |
loadData() | Loads view data. | mixed |
processFormData() | Process form data. | mixed |
__construct() | Construct and initialize the class | mixed |
columnModalForName() | Gets the modal column by the column name | ColumnItem |
columnForName() | Gets the column by the column name | ColumnItem |
columnForField() | Gets the column by the given field name | ColumnItem |
disableColumn() | Establishes the column's display or read only state. | mixed |
getColumns() | Returns the column configuration | \FacturaScripts\Dinamic\Lib\Widget\GroupItem[] |
getModals() | Returns the modal configuration | \FacturaScripts\Dinamic\Lib\Widget\GroupItem[] |
getPagination() | array | |
getRow() | If it exists, return the specified row type | mixed |
loadFromData() | Verifies the structure and loads into the model the given data array | mixed |
loadPageOptions() | mixed | |
assets() | Adds assets to the asset manager. | mixed |
getColumnForName() | Gets the column by the column name from source group | ColumnItem |
getPageWhere() | Returns DataBaseWhere[] for locate a pageOption model. | mixed |
Constants
DEFAULT_TEMPLATE
mixed
$DEFAULT_TEMPLATE
= 'Master/ListView.html.twig'
DEFAULT_TEMPLATE
mixed
$DEFAULT_TEMPLATE
= 'Master/BaseView.html.twig'
Properties
$orderKey
public
string
$orderKey
= ''
$orderOptions
List of fields available to order by.
public
array
$orderOptions
= []
$query
public
string
$query
= ''
$searchFields
List of fields where to search in when a search is made
public
array
$searchFields
= []
$totalAmounts
public
array
$totalAmounts
= []
$filters
Filter configuration preset by the user
public
\FacturaScripts\Core\Lib\ListFilter\BaseFilter[]
$filters
= []
$pageFilterKey
Predefined filter values selected
public
int
$pageFilterKey
= ""
$pageFilters
List of predefined filter values
public
\FacturaScripts\Dinamic\Model\PageFilter[]
$pageFilters
= []
$showFilters
public
bool
$showFilters
= false
$columns
protected
\FacturaScripts\Dinamic\Lib\Widget\GroupItem[]
$columns
= []
$count
Total count of read rows.
public
int
$count
= ""
$cursor
Cursor with data from the model display
public
array
$cursor
= []
$icon
public
string
$icon
$modals
protected
array
$modals
= []
$model
Model to use in this view.
public
ModelClass
$model
$name
private
string
$name
$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
= ""
$order
public
array
$order
= []
$pageOption
Columns configuration
protected
PageOption
$pageOption
$rows
protected
array
$rows
= []
$settings
public
array
$settings
$template
public
string
$template
$title
View title
public
string
$title
$where
Stores the where parameters for the cursor.
public
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
$where
= []
Methods
addOrderBy()
Adds a field to the Order By list
public
addOrderBy(
$fields :
array
, $label :
string
, $default :
int
)
: mixed
Parameters
- $fields : array
- $label : string
- $default : int
(0 = None, 1 = ASC, 2 = DESC)
Return values
mixedaddSearchFields()
Adds a list of fields to the search in the ListView.
public
addSearchFields(
$fields :
array
)
: mixed
To use integer columns, use CAST(columnName AS CHAR(50)).
Parameters
- $fields : array
Return values
mixedbtnNewUrl()
public
btnNewUrl(
)
: string
Return values
stringexport()
Method to export the view data.
public
export(
&$exportManager :
ExportManager
, $codes :
mixed
)
: bool
Parameters
- $exportManager : ExportManager
- $codes : mixed
Return values
boolgetColumns()
Returns the column configuration
public
getColumns(
)
: \FacturaScripts\Dinamic\Lib\Widget\ColumnItem[]
Return values
\FacturaScripts\Dinamic\Lib\Widget\ColumnItem[]loadData()
Loads the data in the cursor property, according to the where filter specified.
public
loadData(
[ $code :
string
= '' ]
[, $where :
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
= [] ]
[, $order :
array
= [] ]
[, $offset :
int
= -1 ]
[, $limit :
int
= FS_ITEM_LIMIT ]
)
: mixed
Parameters
- $code : string = ''
- $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = []
- $order : array = []
- $offset : int = -1
- $limit : int = FS_ITEM_LIMIT
Return values
mixedloadPageOptions()
public
loadPageOptions(
[ $user :
User|bool
= false ]
)
: mixed
Parameters
- $user : User|bool = false
Return values
mixedprocessFormData()
Process form data needed.
public
processFormData(
$request :
Request
, $case :
string
)
: mixed
Parameters
- $request : Request
- $case : string
Return values
mixedassets()
Adds assets to the asset manager.
protected
assets(
)
: mixed
Return values
mixedgetTotalSum()
private
getTotalSum(
$tableName :
string
, $fieldName :
string
, $where :
array
)
: float
Parameters
- $tableName : string
- $fieldName : string
- $where : array
Return values
floatloadTotalAmounts()
private
loadTotalAmounts(
)
: mixed
Return values
mixedprocessFormDataLoad()
private
processFormDataLoad(
$request :
Request
)
: mixed
Parameters
- $request : Request
Return values
mixedsetSelectedOrderBy()
Checks and establishes the selected value in the Order By
protected
setSelectedOrderBy(
$orderKey :
string
)
: mixed
Parameters
- $orderKey : string
Return values
mixedgetViewName()
Returns the name.
public
getViewName(
)
: string
Return values
stringaddFilterAutocomplete()
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
mixedaddFilterCheckbox()
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
mixedaddFilterDatePicker()
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
mixedaddFilterNumber()
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
mixedaddFilterPeriod()
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
mixedaddFilterSelect()
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
mixedaddFilterSelectWhere()
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
mixeddeletePageFilter()
Removes a saved user filter.
public
deletePageFilter(
$idfilter :
string
)
: bool
Parameters
- $idfilter : string
Return values
boolsavePageFilter()
Save filter values for user/s.
public
savePageFilter(
$request :
Request
, $user :
User
)
: int
Parameters
- $request : Request
- $user : User
Return values
intloadSavedFilters()
private
loadSavedFilters(
$where :
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
)
: mixed
Parameters
- $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
Return values
mixedsortFilters()
private
sortFilters(
)
: mixed
Return values
mixedexport()
Method to export the view data.
public
abstract export(
&$exportManager :
mixed
, $codes :
mixed
)
: bool
Parameters
- $exportManager : mixed
- $codes : mixed
Return values
boolloadData()
Loads view data.
public
abstract loadData(
[ $code :
mixed
= '' ]
[, $where :
mixed
= [] ]
[, $order :
mixed
= [] ]
, $offset :
mixed
[, $limit :
mixed
= FS_ITEM_LIMIT ]
)
: mixed
Parameters
- $code : mixed = ''
- $where : mixed = []
- $order : mixed = []
- $offset : mixed
- $limit : mixed = FS_ITEM_LIMIT
Return values
mixedprocessFormData()
Process form data.
public
abstract processFormData(
$request :
mixed
, $case :
mixed
)
: mixed
Parameters
- $request : mixed
- $case : mixed
Return values
mixed__construct()
Construct and initialize the class
public
__construct(
$name :
string
, $title :
string
, $modelName :
string
, $icon :
string
)
: mixed
Parameters
- $name : string
- $title : string
- $modelName : string
- $icon : string
Return values
mixedcolumnModalForName()
Gets the modal column by the column name
public
columnModalForName(
$columnName :
string
)
: ColumnItem
Parameters
- $columnName : string
Return values
ColumnItemcolumnForName()
Gets the column by the column name
public
columnForName(
$columnName :
string
)
: ColumnItem
Parameters
- $columnName : string
Return values
ColumnItemcolumnForField()
Gets the column by the given field name
public
columnForField(
$fieldName :
string
)
: ColumnItem
Parameters
- $fieldName : string
Return values
ColumnItemdisableColumn()
Establishes the column's display or read only state.
public
disableColumn(
$columnName :
string
[, $disabled :
bool
= true ]
[, $readOnly :
string
= '' ]
)
: mixed
Parameters
- $columnName : string
- $disabled : bool = true
- $readOnly : string = ''
Return values
mixedgetColumns()
Returns the column configuration
public
getColumns(
)
: \FacturaScripts\Dinamic\Lib\Widget\GroupItem[]
Return values
\FacturaScripts\Dinamic\Lib\Widget\GroupItem[]getModals()
Returns the modal configuration
public
getModals(
)
: \FacturaScripts\Dinamic\Lib\Widget\GroupItem[]
Return values
\FacturaScripts\Dinamic\Lib\Widget\GroupItem[]getPagination()
public
getPagination(
)
: array
Return values
arraygetRow()
If it exists, return the specified row type
public
getRow(
$key :
string
)
: mixed
Parameters
- $key : string
Return values
mixedloadFromData()
Verifies the structure and loads into the model the given data array
public
loadFromData(
&$data :
array
)
: mixed
Parameters
- $data : array
Return values
mixedloadPageOptions()
public
loadPageOptions(
[ $user :
User|bool
= false ]
)
: mixed
Parameters
- $user : User|bool = false
Return values
mixedassets()
Adds assets to the asset manager.
protected
assets(
)
: mixed
Return values
mixedgetColumnForName()
Gets the column by the column name from source group
protected
getColumnForName(
$columnName :
string
, &$source :
array
)
: ColumnItem
Parameters
- $columnName : string
- $source : array
Return values
ColumnItemgetPageWhere()
Returns DataBaseWhere[] for locate a pageOption model.
protected
getPageWhere(
[ $user :
User|bool
= false ]
)
: mixed
Parameters
- $user : User|bool = false