class Tree extends UIComponent

Constants

SYSTEM_TEMPLATE_UI_FOLDER

Properties

$xf_link from  UIComponent
$link_id from  UIComponent
array $GPvars from  UIComponent
Controller $mod from  UIComponent
protected array $local_template_marker from  UIComponent
protected bool $_overwrite_param_array from  UIComponent
protected bool|array|ModelCollection $marker_content from  UIComponent
string $mod_object_manager from  UIComponent
protected bool $_orig_marker_content from  UIComponent
protected array $_allowed_params_filter from  UIComponent
string $unique_dom_id from  UIComponent
protected string $uid from  UIComponent
string read-only $_content

When used in template this property will contain the XML/HTML within the XUI Nodes

from  UIComponent
$id_field
$pid_field
$uid_field
mixed $group_field

Supply the group field to filter the tree by group

$group_id
$table_query
$caption_field
$caption_label
$caption_label_i18n
string $sort_field

Table field used for sorting of items, set to e.g. 'sort' to enable sorting of items

$link_field
$css_item_class
$css_icon_class
array $options
$onDelete
$onRename
$onAdd
$delete_recursively
$current_id

Methods

__construct($unique_id = false)

No description

string
__toString()

No description

add_additional_listener(string $field, string $event, mixed $event_handler, array $params = array())

No description

void
add_field(string $field, array $params)

No description

array
create_tree_array(string $table, string $id_field = 'id', string $pid_field = 'pid', array|bool $group_ids = false, bool|string $is_root_field = false, mixed $context_id = false)

No description

array
create_tree_path(array $tree_array = null, int $node_id = 0)

No description

disable_form()

No description

string
display()

No description

enable_checkboxes()

No description

bool
fill_by_array($array, $reset = true)

No description

fill_by_callback($callback, $lazy_loading = false, $preload_levels = 2, $callback_returns_has_children = false)

No description

void
fill_by_sql(string $query)

Fill Tree by query Required fields in the query: id, pid, caption Optional: class

mixed
get($var)

Get Variable / Option

int
getRootPid()

Getter for the root id

get_checked_nodes()

No description

array
get_childs(int $id, bool|int $levels = false, bool $is_in_recursion = false)

No description

mixed
get_current_id()

Get currently selected Node ID This works only properly AFTER process()

mixed
get_element(bool|int $id = false)

No description

array
get_flat_tree($pid = 0, $depth = 0, $current_id = false, $parent_label = false, $is_in_recursion = false)

No description

get_form()

No description

array
get_parents($id)

No description

array
get_siblings(int $id)

Returns an array with all sibling IDs

string
get_unique_dom_id()

Generates a unique dom id, dependent on the provided UID, as well as the current context.

string
get_unique_id()

No description

Template|null
get_view(string|bool $section = false)

Return new template view If using within module xui the tpl file should be named [class_name].tpl e.g. xui_core_table.tpl within the module's template folder

init()

put your comment there.

load_tree_array($pid = false, $levels = false)

No description

string
parse_template(string $template_content, array|bool $marker_array = false)

No description

string|null
parse_template_cb_wrapper(mixed $matches)

No description

mixed|string
parse_xtag($xml_source)

No description

process(bool $render_form = true)

No description

render()

No description

string
render_as_ul_list(mixed $parent_id = 0, mixed $levels = false, mixed $options = array())

Render Tree as UL List

mixed
render_xtag_element()

No description

void
reset_marker_content()

restores original content of marker_content

void
set(mixed $var, mixed $value = false)

Set Variable / Option

void
setRootPid(int $rootPid)

Setter for the root id

void
set_array(mixed $member_array, mixed $vars)

Set Variable / Option for an array

set_caption(string $label)

Set Caption Label

set_caption_i18n(string $label)

Set Caption Label (i18n Mode)

void
set_marker_content(mixed $marker_content = false)

sets marker_content to passed data -> restore original content with reset_marker_content()

set_max_levels($levels)

No description

set_mod(mixed $mod)

Set link to owning module

set_model(Model $model, string $caption_field = false, string $id_field = false, string $pid_field = false, string $uid_field = false, int $group_field = false, array $group_id = false, mixed $additional_select_fields = false)

Define the model to get tree information from

void
set_option(string $option, bool $enabled = true)

Set a Tree Option

void
set_render_params(mixed $input_params = array())

Used to inject params. Only allowed params will be used (see $allowed_params_filter)

set_selected(array $node_ids = array(), bool $forced = false)

Declare already selected nodes

set_start_levels($levels)

No description

set_table(string $table, bool|string $caption_field = false, bool|string $id_field = false, bool|string $pid_field = false, bool|string $uid_field = false, bool|int $group_field = false, array|bool $group_id = false, bool $additional_select_fields = false)

No description

Details

at line 158
__construct($unique_id = false)

No description

Parameters

$unique_id

in UIComponent at line 324
string __toString()

No description

Return Value

string

at line 967
add_additional_listener(string $field, string $event, mixed $event_handler, array $params = array())

No description

Parameters

string $field

fieldname

string $event

Event

mixed $event_handler

Callback Eventhandler e.g. array($obj,'function')

array $params

Callback Params

at line 811
void add_field(string $field, array $params)

No description

Parameters

string $field

Field ID

array $params

Field Params

Return Value

void

at line 1561
array create_tree_array(string $table, string $id_field = 'id', string $pid_field = 'pid', array|bool $group_ids = false, bool|string $is_root_field = false, mixed $context_id = false)

No description

Parameters

string $table

Table

string $id_field

ID Field Name

string $pid_field

PID Field Name

array|bool $group_ids

group_context ids (table entries on destination table are filtered by this ids in group_id column, group_id column must exist!)

bool|string $is_root_field

of a field that contains information on whether or not this entry is supposed to be treated as a root entry

mixed $context_id

id A hard root id cutting the tree of. The entry having this id NOT INCLUDED in the tree. Entries having this as a pid instead get pid=0 assigned

Return Value

array

Tree Array [id => pid, ...] OR [id => [id => id, pid => pid, root => root]] if $is_root_field is provided)

at line 1621
array create_tree_path(array $tree_array = null, int $node_id = 0)

No description

Parameters

array $tree_array

like [id => pid]

int $node_id

Node ID

Return Value

array

Single-Dimension Breadcrumb

at line 228
disable_form()

No description

at line 471
string display()

No description

Return Value

string

HTML

at line 225
enable_checkboxes()

No description

at line 1457
bool fill_by_array($array, $reset = true)

No description

Parameters

$array
$reset

Return Value

bool

success

at line 1412
fill_by_callback($callback, $lazy_loading = false, $preload_levels = 2, $callback_returns_has_children = false)

No description

Parameters

$callback
$lazy_loading
$preload_levels
$callback_returns_has_children

at line 303
void fill_by_sql(string $query)

Fill Tree by query Required fields in the query: id, pid, caption Optional: class

Parameters

string $query

Return Value

void

in UIComponent at line 185
mixed get($var)

Get Variable / Option

Parameters

$var

Return Value

mixed

at line 1187
int getRootPid()

Getter for the root id

Return Value

int

at line 342
get_checked_nodes()

No description

at line 1284
array get_childs(int $id, bool|int $levels = false, bool $is_in_recursion = false)

No description

Parameters

int $id

ID of the element to return all childs of

bool|int $levels

Number of levels (e.g. 1 returns only one level below, false for unlimited)

bool $is_in_recursion

Return Value

array

at line 211
mixed get_current_id()

Get currently selected Node ID This works only properly AFTER process()

Return Value

mixed

ID

at line 1399
mixed get_element(bool|int $id = false)

No description

Parameters

bool|int $id

Element ID (if not set the current element will be returned)

Return Value

mixed

at line 976
array get_flat_tree($pid = 0, $depth = 0, $current_id = false, $parent_label = false, $is_in_recursion = false)

No description

Parameters

$pid
$depth
$current_id
$parent_label
$is_in_recursion

Return Value

array

at line 179
Form get_form()

No description

Return Value

Form

at line 1252
array get_parents($id)

No description

Parameters

$id

Return Value

array

Path of Nodes

at line 1380
array get_siblings(int $id)

Returns an array with all sibling IDs

Parameters

int $id

ID of the element to return all childs of

Return Value

array

in UIComponent at line 202
string get_unique_dom_id()

Generates a unique dom id, dependent on the provided UID, as well as the current context.

Return Value

string

at line 322
string get_unique_id()

No description

Return Value

string

unique name of the tree

in UIComponent at line 289
Template|null get_view(string|bool $section = false)

Return new template view If using within module xui the tpl file should be named [class_name].tpl e.g. xui_core_table.tpl within the module's template folder

Parameters

string|bool $section

Name

Return Value

Template|null

Exceptions

Exception

in UIComponent at line 72
init()

put your comment there.

..

at line 1015
load_tree_array($pid = false, $levels = false)

No description

Parameters

$pid
$levels

in UIComponent at line 221
string parse_template(string $template_content, array|bool $marker_array = false)

No description

Parameters

string $template_content

HTML Template

array|bool $marker_array

Markers and Values

Return Value

string

Parsed HTML Content

in UIComponent at line 234
string|null parse_template_cb_wrapper(mixed $matches)

No description

Parameters

mixed $matches

Return Value

string|null

in UIComponent at line 260
mixed|string parse_xtag($xml_source)

No description

Parameters

$xml_source

Return Value

mixed|string

Exceptions

ContentException

at line 357
process(bool $render_form = true)

No description

Parameters

bool $render_form

at line 1528
render()

No description

at line 1352
string render_as_ul_list(mixed $parent_id = 0, mixed $levels = false, mixed $options = array())

Render Tree as UL List

Parameters

mixed $parent_id
mixed $levels
mixed $options

Return Value

string

in UIComponent at line 268
mixed render_xtag_element()

No description

Return Value

mixed

in UIComponent at line 173
void reset_marker_content()

restores original content of marker_content

Return Value

void

in UIComponent at line 106
void set(mixed $var, mixed $value = false)

Set Variable / Option

Parameters

mixed $var

Name of Variable to Set (Alternative: Assoc-Array for multiple variables)

mixed $value

Value of Variable

Return Value

void

at line 1196
void setRootPid(int $rootPid)

Setter for the root id

Parameters

int $rootPid

Return Value

void

in UIComponent at line 122
void set_array(mixed $member_array, mixed $vars)

Set Variable / Option for an array

Parameters

mixed $member_array

Name of Variable to Set (Alternative: Assoc-Array for multiple variables)

mixed $vars

Value of Variable

Return Value

void

at line 1654
set_caption(string $label)

Set Caption Label

Parameters

string $label

at line 1645
set_caption_i18n(string $label)

Set Caption Label (i18n Mode)

Parameters

string $label

in UIComponent at line 165
void set_marker_content(mixed $marker_content = false)

sets marker_content to passed data -> restore original content with reset_marker_content()

Parameters

mixed $marker_content

Return Value

void

at line 330
set_max_levels($levels)

No description

Parameters

$levels

in UIComponent at line 90
set_mod(mixed $mod)

Set link to owning module

Parameters

mixed $mod

at line 278
set_model(Model $model, string $caption_field = false, string $id_field = false, string $pid_field = false, string $uid_field = false, int $group_field = false, array $group_id = false, mixed $additional_select_fields = false)

Define the model to get tree information from

Parameters

Model $model
string $caption_field
string $id_field
  • id
string $pid_field
  • pid
string $uid_field
int $group_field
array $group_id
mixed $additional_select_fields

at line 221
void set_option(string $option, bool $enabled = true)

Set a Tree Option

Parameters

string $option

Option ('add'=>true, 'delete'=>true, 'rename'=>true, 'move'=>true, 'group'=>true, 'user'=>true, 'js_smartTree'=>true, 'ajax'=>false, 'show_tree_only'=>false, 'custom_link'=>array(), 'dragdrop'=>true)

bool $enabled

[only custom_link uses array]

Return Value

void

in UIComponent at line 135
void set_render_params(mixed $input_params = array())

Used to inject params. Only allowed params will be used (see $allowed_params_filter)

Parameters

mixed $input_params

Return Value

void

at line 238
set_selected(array $node_ids = array(), bool $forced = false)

Declare already selected nodes

Parameters

array $node_ids
bool $forced

(Forced = readonly)

at line 338
set_start_levels($levels)

No description

Parameters

$levels

at line 254
set_table(string $table, bool|string $caption_field = false, bool|string $id_field = false, bool|string $pid_field = false, bool|string $uid_field = false, bool|int $group_field = false, array|bool $group_id = false, bool $additional_select_fields = false)

No description

Parameters

string $table

Tablename (use prepare_query() in XF instance context)

bool|string $caption_field

Name of the caption field (Default: caption)

bool|string $id_field

ID Field (Default: id)

bool|string $pid_field

Parent-ID Field (Default: pid)

bool|string $uid_field

Uniqe-ID can be set if you have a additional uniqid, different from the pid->id tree construct (Default: false)

bool|int $group_field

Group ID to filter the tree in group mode

array|bool $group_id

List of additional fields which shall be selected (e.g. for using in custom link as variable)

bool $additional_select_fields