FacturaScripts

TreeFilter extends SelectFilter
in package

Filter all records that match the search term and its children.

Table of Contents

Properties

$autosubmit  : bool
Submit form on every filter change.
$field  : string
Field name.
$fieldcode  : string
$fieldparent  : string
$fieldtitle  : string
$icon  : string
$key  : string
Filter key.
$label  : string
Label to show on this filter.
$ordernum  : int
$readonly  : bool
$table  : string
$values  : array<string|int, mixed>
$where  : array<string|int, mixed>
$i18n  : Translator
Translator object.
$value  : mixed

Methods

__construct()  : mixed
getDataBaseWhere()  : bool
getValue()  : mixed
Get the filter value
name()  : string
render()  : string
setValue()  : mixed
Set value to filter
setValueFromRequest()  : mixed
Set value to filter from form request
assets()  : mixed
Adds assets to the asset manager.
getHtmlOptions()  : string
onChange()  : string
readonly()  : string
buildTree()  : array<string|int, mixed>
obtiene los elementos en formato [[cod = x, titulo = x, codPadre = x]...] y los devuelve en un array de [codPadre = [codHijo...], ...] en donde codHijo es [cod = x, titulo = x, codPadre = x] y el elemento padre de todos está dentro de la clave 'ROOT'
buildTreeRecursive()  : array<string|int, mixed>
Recibe un array de [codPadre = [codHijo...], ...] en donde codHijo es [cod = x, titulo = x, codPadre = x] y el argumento del id del padre o rama a construir.
flattenTree()  : array<string|int, mixed>
Recibe un array recursivo de elementos $tree = [elemento1, elemento2, elemento3...] donde cada elemento tiene a su vez un $elemento['children'] = $tree con sus hijos.
getIds()  : array<string|int, mixed>
loadValues()  : array<string|int, mixed>

Properties

$autosubmit

Submit form on every filter change.

public bool $autosubmit

$label

Label to show on this filter.

public string $label

Methods

__construct()

public __construct(string $key, string $field, string $label, string $table, string $fieldparent[, string $fieldcode = '' ][, string $fieldtitle = '' ][, array<string|int, mixed> $where = [] ]) : mixed
Parameters
$key : string
$field : string
$label : string
$table : string
$fieldparent : string
$fieldcode : string = ''
$fieldtitle : string = ''
$where : array<string|int, mixed> = []

getDataBaseWhere()

public getDataBaseWhere(array<string|int, mixed> &$where) : bool
Parameters
$where : array<string|int, mixed>
Return values
bool

getValue()

Get the filter value

public getValue() : mixed

name()

public name() : string
Return values
string

setValue()

Set value to filter

public setValue(mixed $value) : mixed
Parameters
$value : mixed

setValueFromRequest()

Set value to filter from form request

public setValueFromRequest(Request &$request) : mixed
Parameters
$request : Request

assets()

Adds assets to the asset manager.

protected assets() : mixed

getHtmlOptions()

protected getHtmlOptions() : string
Return values
string

onChange()

protected onChange() : string
Return values
string

readonly()

protected readonly() : string
Return values
string

buildTree()

obtiene los elementos en formato [[cod = x, titulo = x, codPadre = x]...] y los devuelve en un array de [codPadre = [codHijo...], ...] en donde codHijo es [cod = x, titulo = x, codPadre = x] y el elemento padre de todos está dentro de la clave 'ROOT'

private buildTree(array<string|int, mixed> $elements) : array<string|int, mixed>
Parameters
$elements : array<string|int, mixed>
Return values
array<string|int, mixed>

buildTreeRecursive()

Recibe un array de [codPadre = [codHijo...], ...] en donde codHijo es [cod = x, titulo = x, codPadre = x] y el argumento del id del padre o rama a construir.

private buildTreeRecursive(array<string|int, mixed> &$grouped, mixed $parentId) : array<string|int, mixed>

Hace una llamada recursiva a la función y construye un array en forma de árbol, crea una rama y hace una llamada recursiva a las siguientes ramas.

Devuelve un array en forma de árbol al final, con children = [[cod = x, titulo = x, codPadre = x, children = [elementosHijos...]]] donde elementosHijos es otro [[cod = x, titulo = x, codPadre = x, children = [elementosHijos...]]].

Parameters
$grouped : array<string|int, mixed>
$parentId : mixed
Return values
array<string|int, mixed>

flattenTree()

Recibe un array recursivo de elementos $tree = [elemento1, elemento2, elemento3...] donde cada elemento tiene a su vez un $elemento['children'] = $tree con sus hijos.

private flattenTree(array<string|int, mixed> $tree[, int $level = 0 ]) : array<string|int, mixed>

Lo formatea para una salida más intuitiva.

Parameters
$tree : array<string|int, mixed>
$level : int = 0
Return values
array<string|int, mixed>

getIds()

private getIds() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadValues()

private loadValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results