FacturaScripts

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

$orderOptions

List of fields available to order by.

public array $orderOptions = []

$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 = []

$pageFilters

List of predefined filter values

public \FacturaScripts\Dinamic\Model\PageFilter[] $pageFilters = []

$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 = []

$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 = ""

$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
mixed

addSearchFields()

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
mixed

btnNewUrl()

public btnNewUrl( ) : string
Return values
string

export()

Method to export the view data.

public export( &$exportManager : ExportManager , $codes : mixed ) : bool
Parameters
$exportManager : ExportManager
$codes : mixed
Return values
bool

getColumns()

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
mixed

loadPageOptions()

public loadPageOptions( [ $user : User|bool = false ] ) : mixed
Parameters
$user : User|bool = false
Return values
mixed

processFormData()

Process form data needed.

public processFormData( $request : Request , $case : string ) : mixed
Parameters
$request : Request
$case : string
Return values
mixed

assets()

Adds assets to the asset manager.

protected assets( ) : mixed
Return values
mixed

getTotalSum()

private getTotalSum( $tableName : string , $fieldName : string , $where : array ) : float
Parameters
$tableName : string
$fieldName : string
$where : array
Return values
float

loadTotalAmounts()

private loadTotalAmounts( ) : mixed
Return values
mixed

processFormDataLoad()

private processFormDataLoad( $request : Request ) : mixed
Parameters
$request : Request
Return values
mixed

setSelectedOrderBy()

Checks and establishes the selected value in the Order By

protected setSelectedOrderBy( $orderKey : string ) : mixed
Parameters
$orderKey : string
Return values
mixed

getViewName()

Returns the name.

public getViewName( ) : string
Return values
string

addFilterAutocomplete()

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
mixed

addFilterCheckbox()

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
mixed

addFilterDatePicker()

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
mixed

addFilterNumber()

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
mixed

addFilterPeriod()

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
mixed

addFilterSelect()

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
mixed

addFilterSelectWhere()

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
mixed

deletePageFilter()

Removes a saved user filter.

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

loadSavedFilters()

private loadSavedFilters( $where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] ) : mixed
Parameters
$where : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
Return values
mixed

export()

Method to export the view data.

public abstract export( &$exportManager : mixed , $codes : mixed ) : bool
Parameters
$exportManager : mixed
$codes : mixed
Return values
bool

loadData()

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
mixed

processFormData()

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
mixed

columnModalForName()

Gets the modal column by the column name

public columnModalForName( $columnName : string ) : ColumnItem
Parameters
$columnName : string
Return values
ColumnItem

columnForName()

Gets the column by the column name

public columnForName( $columnName : string ) : ColumnItem
Parameters
$columnName : string
Return values
ColumnItem

columnForField()

Gets the column by the given field name

public columnForField( $fieldName : string ) : ColumnItem
Parameters
$fieldName : string
Return values
ColumnItem

disableColumn()

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
mixed

getColumns()

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
array

getRow()

If it exists, return the specified row type

public getRow( $key : string ) : mixed
Parameters
$key : string
Return values
mixed

loadFromData()

Verifies the structure and loads into the model the given data array

public loadFromData( &$data : array ) : mixed
Parameters
$data : array
Return values
mixed

loadPageOptions()

public loadPageOptions( [ $user : User|bool = false ] ) : mixed
Parameters
$user : User|bool = false
Return values
mixed

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( $columnName : string , &$source : array ) : ColumnItem
Parameters
$columnName : string
$source : array
Return values
ColumnItem

getPageWhere()

Returns DataBaseWhere[] for locate a pageOption model.

protected getPageWhere( [ $user : User|bool = false ] ) : mixed
Parameters
$user : User|bool = false
Return values
mixed

Search results