class Table extends UIComponent

Constants

SYSTEM_TEMPLATE_UI_FOLDER

Properties

$xf_link from  UIComponent
$link_id
$GPvars
Core $mod
protected array $local_template_marker from  UIComponent
protected $_overwrite_param_array
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
protected $process_priority
protected $process_queue_id
protected $process_queue
$order_by
$order_field
$start
$limit
string $order_field_secondary
$order_fields
$pre_ordered
$new_order_field
$new_order_by
$new_start
$sql_order_fields
$field_filter
$show_table_options
$show_optional_fields
$show_record_count
$ajax_table
string $hidden_array_sort_field
$hide_head_rows
$order_array
$fields_visible
$field_tooltips
$grouping
$group_type
$no_record_message
array $rows
int $rows_total
$extension_extui
protected $xtag_params
protected $large_export
string $export_filename

When exported the file will have the name provided here.

array $cmd_array

Methods

__construct(string|bool $table_id = false, array $table_attributes = array())

No description

string
__toString()

No description

void
_add_col_callback_to_q(string $field, mixed $callback, mixed $cb_params, string $type = "body")

Schedule Add Callback to Table Col (Will transform an existing col)

void
add_col(string $field, string $value, mixed $attributes = array(), $type = "body")

Schedule Add Col to Table

void
add_col_callback(string $field, callable $callback, array $cb_params = array(), string $type = "body", string $priority = 'auto')

Schedule Add Callback to Table Col (Will transform an existing col)

add_col_replace(mixed $field, array $replace, bool $regex = false, string $type = "body", string $priority = 'auto')

Simple Replace Function to be used in callbacks

add_row(array $record, string $type = "body", bool|string $class = false)

Add Single Row Object to Table

cb_property($matches)

No description

deactivateAjax()

No description

void
enable_grouping(array|bool $fields = true, bool $hide_group_col = false)

No description

enable_optional_fields(array $fields, array|bool $visible_fields = false)

No description

enable_periodical_update(int $interval = 10)

Enable periodical update (JS function)

enable_select_column(string $select_field, bool $multi_select = true, string|bool $field_name = false, array $condition = [])

No description

void
enable_table_options(bool $large_export = false, int $large_export_limit = 100)

No description

void
enable_tooltips(array $field_descriptions)

No description

string
export(mixed $export_format = 'csv')

Export (get_table-Alias)

void
fill_by_array(mixed $row_array, string $array_format = "assoc", string $type = "body")

Schedule Fill table by array

fill_by_callback($callback)

No description

fill_by_model_find(Model|ModelCollection $model, string $find_function = 'all')

No description

void
fill_by_sql(string $pquery, array $params = array(), string $type = "body", bool $language = false)

Fill Table with Query

mixed
get($var)

Get Variable / Option

array
getCMDArray()

Return the current table command which where given encoded via _GET params for this table instance

string
getId()

Returns the table id.

mixed
getTableUid()

No description

get_action()

No description

string
get_page_control()

Return Page Control

string
get_table(bool $export_format = false)

Get HTML Table

string
get_unique_dom_id()

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

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

hide_head_rows(mixed $hide = true)

No description

init()

put your comment there.

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()

Declared in Classes

render()

No description

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

setHiddenFields(array $fields = [])

Set cols to be hidden in output

setVisibleFields(array $fields = [])

Set cols to be visible in output

set_additional_data_callback(mixed $callback)

Registered a callback that will be called after the rows have been limited, passing the resulting row array as it's only parameter. The return of the callback can be used in any low-prio callback using the field 'field:_additional_data'. You should use this callback to load additional information required in the table that for some reason cannot be loaded in the fillby* Method, for example because you are using models and the data is from a foreign table.

void
set_array(mixed $member_array, mixed $vars)

Set Variable / Option for an array

set_cache(int|bool $ttl = false)

Allow use of Caches (e.g. Query Cache)

set_column_attributes($attributes, $type = 'body')

No description

void
set_column_class(array $col_class, string $type = 'body')

No description

void
set_column_format(array $formatting_options, $type = 'body')

Set formatting parameters for each column

set_column_responsive(array $responsive_cols, string $responsive_level = 'smartphone')

Set Responsive COLs (Other cols wil be hidden if given responsive level is reached)

set_column_tooltips($tooltips)

No description

set_export_filter(array $filter)

set all fields that shall be exported

void
set_grouping(string $field, bool $hide_group_col = false)

No description

void
set_limit(int $limit)

No description

void
set_marker_content(mixed $marker_content = false)

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

set_mod(mixed $mod)

Set link to owning module

void
set_order(string $field, string $direction = 'ASC', array $order_fields = null, string|bool $secondary_order_field = false)

No description

void
set_params(string|bool $table_id = false, array $table_attributes = array())

No description

void
set_render_params(mixed $input_params = array())

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

Details

at line 176
__construct(string|bool $table_id = false, array $table_attributes = array())

No description

Parameters

string|bool $table_id

UNIQUE Element Id (on page) for Table

array $table_attributes

attributes (everything valid inside tags, e.g. class,width etc.)

in UIComponent at line 324
string __toString()

No description

Return Value

string

at line 1586
void _add_col_callback_to_q(string $field, mixed $callback, mixed $cb_params, string $type = "body")

Schedule Add Callback to Table Col (Will transform an existing col)

Parameters

string $field

colname/identifier

mixed $callback

callback

mixed $cb_params

callback params/field names

string $type

type of col (default: body)

Return Value

void

at line 542
void add_col(string $field, string $value, mixed $attributes = array(), $type = "body")

Schedule Add Col to Table

Parameters

string $field

colname/identifier

string $value

default value for col

mixed $attributes

col attributes

$type

Return Value

void

at line 560
void add_col_callback(string $field, callable $callback, array $cb_params = array(), string $type = "body", string $priority = 'auto')

Schedule Add Callback to Table Col (Will transform an existing col)

Parameters

string $field

colname/identifier

callable $callback

Callback

array $cb_params

callback params/field names: array('field:id','myownvalue','field:_row')

string $type

type of col (default: body)

string $priority

auto, low, high: priority of the callback (low: Process after sort/limit is applied)

Return Value

void

Examples

add_col_callback('myfield',function($field_value,$another_field){ return
"<strong>{$field_value</strong>";},array('field:myfield','field:id'));

at line 604
add_col_replace(mixed $field, array $replace, bool $regex = false, string $type = "body", string $priority = 'auto')

Simple Replace Function to be used in callbacks

$table->add_col_replace('city',array('*'=>array('field:zip_code',' ','field:city')));

Parameters

mixed $field
array $replace

array(search=>replace) where replace can contain field:xxx vars. Multiple field vars can be written as array e.g. search=>array('field:a',' and ','field:b'). Use * as search to replace all

bool $regex

Set to true for regex mode

string $type

type of col (default: body)

string $priority

auto, low, high: priority of the collback

at line 525
TableRow add_row(array $record, string $type = "body", bool|string $class = false)

Add Single Row Object to Table

Parameters

array $record

Fieldrecord

string $type

type:head,body,foot

bool|string $class

additional CSS class

Return Value

TableRow

row-Objekt

at line 1317
cb_property($matches)

No description

Parameters

$matches

at line 2408
deactivateAjax()

No description

at line 299
void enable_grouping(array|bool $fields = true, bool $hide_group_col = false)

No description

Parameters

array|bool $fields

Allow grouping on the following fields (default: all fields)

bool $hide_group_col

Hide Grouping Col

Return Value

void

at line 222
enable_optional_fields(array $fields, array|bool $visible_fields = false)

No description

Parameters

array $fields

Defines the option fields

array|bool $visible_fields

Defines the option fields which should be visible by default

at line 267
enable_periodical_update(int $interval = 10)

Enable periodical update (JS function)

Parameters

int $interval

in seconds

at line 386
enable_select_column(string $select_field, bool $multi_select = true, string|bool $field_name = false, array $condition = [])

No description

Parameters

string $select_field

Specfiy the field used for the internal value of the input (e.g. ID)

bool $multi_select

Use Checkbox (true) or Radio (false)

string|bool $field_name

Specify the name of the field [used for radio inputs]

array $condition

OPTIONAL: A condition by matching field with value e.g. [field_name, matching_value]

at line 256
void enable_table_options(bool $large_export = false, int $large_export_limit = 100)

No description

Parameters

bool $large_export
  • enables possibility to export large amount of data, which cause memory issues otherwise (works with CSV, HTML and Excel exports using redirect with delay to handle the records in batches)
int $large_export_limit

The large export is only started when there are more records in the table than defined in this parameter

Return Value

void

at line 278
void enable_tooltips(array $field_descriptions)

No description

Parameters

array $field_descriptions

Field->Description Array

Return Value

void

at line 853
string export(mixed $export_format = 'csv')

Export (get_table-Alias)

Parameters

mixed $export_format

(csv|csv_excel_win|htm|xls)

Return Value

string

Content of Table as $export_format

at line 511
void fill_by_array(mixed $row_array, string $array_format = "assoc", string $type = "body")

Schedule Fill table by array

Parameters

mixed $row_array

raw

string $array_format

format for array

string $type

type of col (default: body)

Return Value

void

at line 479
fill_by_callback($callback)

No description

Parameters

$callback

at line 491
fill_by_model_find(Model|ModelCollection $model, string $find_function = 'all')

No description

Parameters

Model|ModelCollection $model

Empty Model providing the find_by() function (e.g. $this->model->contact()) or ModelCollection

string $find_function

Function name to use (e.g. 'find_all_by_id')

at line 468
void fill_by_sql(string $pquery, array $params = array(), string $type = "body", bool $language = false)

Fill Table with Query

Parameters

string $pquery

SQL for Prepared Statement

array $params

Params for Prepared Statement

string $type

type:head,body,foot - default body

bool $language

Use i18n Language Query?

Return Value

void

in UIComponent at line 185
mixed get($var)

Get Variable / Option

Parameters

$var

Return Value

mixed

at line 2376
array getCMDArray()

Return the current table command which where given encoded via _GET params for this table instance

Return Value

array

= ['id'=>'', 'field'=>'', 'order_by' => 'ASC', 'start'=>0, 'fields_visible'=>'', 'action'=> false]

at line 207
string getId()

Returns the table id.

Return Value

string

at line 2401
mixed getTableUid()

No description

Return Value

mixed

at line 1082
get_action()

No description

at line 2147
string get_page_control()

Return Page Control

Return Value

string

HTML

at line 1012
string get_table(bool $export_format = false)

Get HTML Table

Parameters

bool $export_format

ExportFormat ['batch']

Return Value

string

HTML

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

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

at line 287
hide_head_rows(mixed $hide = true)

No description

Parameters

mixed $hide

in UIComponent at line 72
init()

put your comment there.

..

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

in UIComponent at line 335
process()

Declared in Classes

at line 685
render()

No description

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 337
setHiddenFields(array $fields = [])

Set cols to be hidden in output

Parameters

array $fields

at line 329
setVisibleFields(array $fields = [])

Set cols to be visible in output

Parameters

array $fields

at line 632
set_additional_data_callback(mixed $callback)

Registered a callback that will be called after the rows have been limited, passing the resulting row array as it's only parameter. The return of the callback can be used in any low-prio callback using the field 'field:_additional_data'. You should use this callback to load additional information required in the table that for some reason cannot be loaded in the fillby* Method, for example because you are using models and the data is from a foreign table.

Parameters

mixed $callback

The callback that will be called after the rows have been limited. It is expected, that this callback returns an object that is of use in low-prio column callbacks

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 363
set_cache(int|bool $ttl = false)

Allow use of Caches (e.g. Query Cache)

Parameters

int|bool $ttl

at line 411
set_column_attributes($attributes, $type = 'body')

No description

Parameters

$attributes
$type

at line 448
void set_column_class(array $col_class, string $type = 'body')

No description

Parameters

array $col_class

Supply Column and Class value, e.g. array('col1'=>'myClass','col2'=>'myClass2')

string $type

Type of rows affected ('head','body','foot')

Return Value

void

at line 406
void set_column_format(array $formatting_options, $type = 'body')

Set formatting parameters for each column

$formatting_options['field1']=array("format"=>"money",
                                     "suffix"=>"EUR");

Parameters

array $formatting_options

Formatting parameters ['field' => ['format'=>'money','suffix'=>'EUR']

$type

Return Value

void

at line 422
set_column_responsive(array $responsive_cols, string $responsive_level = 'smartphone')

Set Responsive COLs (Other cols wil be hidden if given responsive level is reached)

Parameters

array $responsive_cols

Visible Columns

string $responsive_level

(smartphone, tablet)

at line 453
set_column_tooltips($tooltips)

No description

Parameters

$tooltips

at line 2367
set_export_filter(array $filter)

set all fields that shall be exported

Parameters

array $filter

rows to export

at line 314
void set_grouping(string $field, bool $hide_group_col = false)

No description

Parameters

string $field

Field ID

bool $hide_group_col

Hide Grouping Col?

Return Value

void

at line 374
void set_limit(int $limit)

No description

Parameters

int $limit

Record Count

Return Value

void

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

in UIComponent at line 90
set_mod(mixed $mod)

Set link to owning module

Parameters

mixed $mod

at line 351
void set_order(string $field, string $direction = 'ASC', array $order_fields = null, string|bool $secondary_order_field = false)

No description

Parameters

string $field

Column ID to order

string $direction

Direction to order (asc or desc)

array $order_fields

Array with field names which are sortable. Set to false for all fields.

string|bool $secondary_order_field

Secondary field to sort for (used in array sort)

Return Value

void

at line 189
void set_params(string|bool $table_id = false, array $table_attributes = array())

No description

Parameters

string|bool $table_id

UNIQUE DOM Element Id (on page) for Table (e.g. system_user_table)

array $table_attributes

attributes (everything valid inside tags, e.g. class,width etc.)

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