FacturaScripts

ListEmpresa extends ListController

Controller to list the items in the Empresa model

Table of Contents

$active Indicates the active view. string
$codeModel Model to use with select and autocomplete filters. CodeModel
$current Indicates current view, when drawing. string
$exportManager Object to export data. ExportManager
$views List of views displayed by the controller. \FacturaScripts\Core\Lib\ExtendedController\BaseView[]|\FacturaScripts\Core\Lib\ExtendedController\ListView[]
$className Name of the class of the controller (although its in inheritance from this class, the name of the final class we will have here) string
$dataBase It provides direct access to the database. DataBase
$empresa Selected company. Empresa
$multiRequestProtection MultiRequestProtection
$permissions User permissions on this controller. ControllerPermissions
$request Request on which we can get data. Request
$response HTTP Response object. Response
$template Name of the file for the template. string|bool
$title Title of the page. string
$uri Given uri, default is empty. string
$user User logged in. User|bool
getPageData() Returns basic page attributes array
createViews() Load views mixed
__construct() Initialize all objects and properties. mixed
privateCore() Runs the controller's private logic. mixed
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
addOrderBy() Adds an order field to the ListView. mixed
addSearchFields() Adds a list of fields to the search in the ListView. mixed
addView() Creates and adds a ListView to the controller. mixed
deleteFilterAction() Removes the selected page filter. mixed
execAfterAction() Runs the controller actions after data read. mixed
execPreviousAction() Runs the actions that alter the data before reading it. bool
exportAction() mixed
loadData() Loads the data to display. mixed
megaSearchAction() Returns a JSON response to MegaSearch. mixed
megaSearchColumns() Returns columns title for megaSearchAction function. array
saveFilterAction() Saves filter values for active view and user. mixed
createViews() Inserts the views or tabs to display. mixed
addButton() Adds a new button to the tab. mixed
addCustomView() mixed
getCurrentView() BaseView|ListView
getMainViewName() Returns the name assigned to the main view string
getSettings() Returns the configuration value for the indicated view. mixed
getViewModelValue() Return the value for a field in the model of the view. mixed
setCurrentView() mixed
setSettings() Set value for setting of a view mixed
autocompleteAction() Run the autocomplete action. array
checkOwnerData() Check if the active user has permission to view the information of the active record in the informed model. bool
deleteAction() Action to delete data. bool
getAutocompleteValues() Return values from Widget Values for autocomplete action array
getOwnerFilter() Returns the where filter to apply to obtain the data created by the active user. \FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
requestGet() Return array with parameters values array
validateFormToken() bool
addExtension() mixed
getPageData() Return the basic data for this page. array
getTemplate() Return the template to use for this controller. string|bool
pipe() mixed
publicCore() Execute the public part of the controller. mixed
redirect() Redirect to an url or controller. mixed
setTemplate() Set the template to use for this controller. bool
toolBox() ToolBox
url() Return the URL of the actual controller. string
checkPHPversion() mixed
getClassName() Return the name of the controller. string

Properties

$current

Indicates current view, when drawing.

private string $current

$views

List of views displayed by the controller.

public \FacturaScripts\Core\Lib\ExtendedController\BaseView[]|\FacturaScripts\Core\Lib\ExtendedController\ListView[] $views = []

$className

Name of the class of the controller (although its in inheritance from this class, the name of the final class we will have here)

private string $className

$request

Request on which we can get data.

public Request $request

$response

HTTP Response object.

protected Response $response

$template

Name of the file for the template.

private string|bool $template

$uri

Given uri, default is empty.

public string $uri

Methods

getPageData()

Returns basic page attributes

public getPageData( ) : array
Return values
array

createViews()

Load views

protected createViews( ) : mixed
Return values
mixed

__construct()

Initialize all objects and properties.

public __construct( $className : string [, $uri : string = '' ] ) : mixed
Parameters
$className : string
$uri : string = ''
Return values
mixed

addFilterAutocomplete()

Add an autocomplete type filter to the ListView.

protected addFilterAutocomplete( $viewName : string , $key : string , $label : string , $field : string , $table : string [, $fieldcode : string = '' ] [, $fieldtitle : string = '' ] [, $where : array = [] ] ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string

(Human reader description)

$field : string

(Field of the model to apply filter)

$table : string

(Table to search)

$fieldcode : string = ''

(Primary column of the table to search and match)

$fieldtitle : string = ''

(Column to show name or description)

$where : array = []

(Extra where conditions)

Return values
mixed

addFilterCheckbox()

Adds a boolean condition type filter to the ListView.

protected addFilterCheckbox( $viewName : string , $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '=' ] [, $matchValue : mixed = true ] [, $default : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = [] ] ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string = ''

(Human reader description)

$field : string = ''

(Field of the model to apply filter)

$operation : string = '='

(operation to perform with match value)

$matchValue : mixed = true

(Value to match)

$default : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[] = []

(where to apply when filter is empty)

Return values
mixed

addFilterDatePicker()

Adds a date type filter to the ListView.

protected addFilterDatePicker( $viewName : string , $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '>=' ] ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string = ''

(Human reader description)

$field : string = ''

(Field of the table to apply filter)

$operation : string = '>='

(Operation to perform)

Return values
mixed

addFilterNumber()

Adds a numeric type filter to the ListView.

protected addFilterNumber( $viewName : string , $key : string [, $label : string = '' ] [, $field : string = '' ] [, $operation : string = '>=' ] ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string = ''

(Human reader description)

$field : string = ''

(Field of the table to apply filter)

$operation : string = '>='

(Operation to perform)

Return values
mixed

addFilterPeriod()

Adds a period type filter to the ListView.

protected addFilterPeriod( $viewName : string , $key : string , $label : string , $field : string ) : mixed

(period + start date + end date)

Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string

(Human reader description)

$field : string

(Field of the table to apply filter)

Return values
mixed

addFilterSelect()

Add a select type filter to a ListView.

protected addFilterSelect( $viewName : string , $key : string , $label : string , $field : string [, $values : array = [] ] ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$label : string

(Human reader description)

$field : string

(Field of the table to apply filter)

$values : array = []

(Values to show)

Return values
mixed

addFilterSelectWhere()

Add a select where type filter to a ListView.

protected addFilterSelectWhere( $viewName : string , $key : string , $values : array ) : mixed
Parameters
$viewName : string
$key : string

(Filter identifier)

$values : array

(Values to show)

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

addOrderBy()

Adds an order field to the ListView.

protected addOrderBy( $viewName : string , $fields : array [, $label : string = '' ] , $default : int ) : mixed
Parameters
$viewName : string
$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.

protected addSearchFields( $viewName : string , $fields : array ) : mixed

To use integer columns, use CAST(columnName AS CHAR(50)).

Parameters
$viewName : string
$fields : array
Return values
mixed

addView()

Creates and adds a ListView to the controller.

protected addView( $viewName : string , $modelName : string [, $viewTitle : string = '' ] [, $icon : string = 'fas fa-search' ] ) : mixed
Parameters
$viewName : string
$modelName : string
$viewTitle : string = ''
$icon : string = 'fas fa-search'
Return values
mixed

deleteFilterAction()

Removes the selected page filter.

protected deleteFilterAction( ) : mixed
Return values
mixed

execAfterAction()

Runs the controller actions after data read.

protected execAfterAction( $action : string ) : mixed
Parameters
$action : string
Return values
mixed

execPreviousAction()

Runs the actions that alter the data before reading it.

protected execPreviousAction( $action : string ) : bool
Parameters
$action : string
Return values
bool

exportAction()

protected exportAction( ) : mixed
Return values
mixed

loadData()

Loads the data to display.

protected abstract loadData( $viewName : string , $view : BaseView ) : mixed
Parameters
$viewName : string
$view : BaseView
Return values
mixed

megaSearchAction()

Returns a JSON response to MegaSearch.

protected megaSearchAction( ) : mixed
Return values
mixed

megaSearchColumns()

Returns columns title for megaSearchAction function.

private megaSearchColumns( $view : ListView ) : array
Parameters
$view : ListView
Return values
array

saveFilterAction()

Saves filter values for active view and user.

protected saveFilterAction( ) : mixed
Return values
mixed

createViews()

Inserts the views or tabs to display.

protected abstract createViews( ) : mixed
Return values
mixed

addButton()

Adds a new button to the tab.

public addButton( $viewName : string , $btnArray : array ) : mixed
Parameters
$viewName : string
$btnArray : array
Return values
mixed

getMainViewName()

Returns the name assigned to the main view

public getMainViewName( ) : string
Return values
string

getSettings()

Returns the configuration value for the indicated view.

public getSettings( $viewName : string , $property : string ) : mixed
Parameters
$viewName : string
$property : string
Return values
mixed

getViewModelValue()

Return the value for a field in the model of the view.

public getViewModelValue( $viewName : string , $fieldName : string ) : mixed
Parameters
$viewName : string
$fieldName : string
Return values
mixed

setCurrentView()

public setCurrentView( $viewName : string ) : mixed
Parameters
$viewName : string
Return values
mixed

setSettings()

Set value for setting of a view

public setSettings( $viewName : string , $property : string , $value : mixed ) : mixed
Parameters
$viewName : string
$property : string
$value : mixed
Return values
mixed

autocompleteAction()

Run the autocomplete action.

protected autocompleteAction( ) : array

Returns a JSON string for the searched values.

Return values
array

checkOwnerData()

Check if the active user has permission to view the information of the active record in the informed model.

protected checkOwnerData( $model : object ) : bool
Parameters
$model : object
Return values
bool

deleteAction()

Action to delete data.

protected deleteAction( ) : bool
Return values
bool

getAutocompleteValues()

Return values from Widget Values for autocomplete action

protected getAutocompleteValues( $viewName : string , $fieldName : string ) : array
Parameters
$viewName : string
$fieldName : string
Return values
array

getOwnerFilter()

Returns the where filter to apply to obtain the data created by the active user.

protected getOwnerFilter( $model : object ) : \FacturaScripts\Core\Base\DataBase\DataBaseWhere[]
Parameters
$model : object
Return values
\FacturaScripts\Core\Base\DataBase\DataBaseWhere[]

requestGet()

Return array with parameters values

protected requestGet( $keys : array ) : array
Parameters
$keys : array
Return values
array

validateFormToken()

protected validateFormToken( ) : bool
Return values
bool

addExtension()

public static addExtension( $extension : mixed ) : mixed
Parameters
$extension : mixed
Return values
mixed

getPageData()

Return the basic data for this page.

public getPageData( ) : array
Return values
array

getTemplate()

Return the template to use for this controller.

public getTemplate( ) : string|bool
Return values
string|bool

pipe()

public pipe( $name : string , ...$arguments : array ) : mixed
Parameters
$name : string
$arguments : array
Return values
mixed

publicCore()

Execute the public part of the controller.

public publicCore( &$response : Response ) : mixed
Parameters
$response : Response
Return values
mixed

redirect()

Redirect to an url or controller.

public redirect( $url : string , $delay : int ) : mixed
Parameters
$url : string
$delay : int
Return values
mixed

setTemplate()

Set the template to use for this controller.

public setTemplate( $template : string|bool ) : bool
Parameters
$template : string|bool
Return values
bool

url()

Return the URL of the actual controller.

public url( ) : string
Return values
string

checkPHPversion()

private checkPHPversion( $min : float ) : mixed
Parameters
$min : float
Return values
mixed

getClassName()

Return the name of the controller.

protected getClassName( ) : string
Return values
string

Search results