TimeTrex API Manual

TTTree
in package

Table of Contents

createNestedArrayWithDepth()  : array<string|int, mixed>
Takes a flat array of nodes typically straight from the database and converts into a nested array with depth/level values.
flattenArray()  : array<string|int, mixed>
Flatten a nested array.
FormatArray()  : array<string|int, mixed>
Format flat array for JS tree grid.
getAllChildren()  : array<string|int, mixed>
Get just the children of a specific parent.
getElementFromNodes()  : array<string|int, mixed>
Get one specific element from all nodes in nested array.
sortByName()  : int

Methods

createNestedArrayWithDepth()

Takes a flat array of nodes typically straight from the database and converts into a nested array with depth/level values.

public static createNestedArrayWithDepth( $nodes[, string $parent_id = '00000000-0000-0000-0000-000000000000' ][, int $depth = 1 ]) : array<string|int, mixed>
Parameters
$nodes :
$parent_id : string = '00000000-0000-0000-0000-000000000000'
$depth : int = 1
Return values
array<string|int, mixed>

flattenArray()

Flatten a nested array.

public static flattenArray( $nodes) : array<string|int, mixed>
Parameters
$nodes :
Return values
array<string|int, mixed>

FormatArray()

Format flat array for JS tree grid.

public static FormatArray( $nodes[, bool $include_root = true ]) : array<string|int, mixed>
Parameters
$nodes :
$include_root : bool = true
Return values
array<string|int, mixed>

getAllChildren()

Get just the children of a specific parent.

public static getAllChildren( $nodes[, string $parent_id = '00000000-0000-0000-0000-000000000000' ]) : array<string|int, mixed>
Parameters
$nodes :
$parent_id : string = '00000000-0000-0000-0000-000000000000'
Return values
array<string|int, mixed>

getElementFromNodes()

Get one specific element from all nodes in nested array.

public static getElementFromNodes( $nodes[, string $key = 'id' ]) : array<string|int, mixed>
Parameters
$nodes :
$key : string = 'id'
Return values
array<string|int, mixed>

sortByName()

public static sortByName( $a,  $b) : int
Parameters
$a :
$b :
Return values
int

Search results