Properties

$ERRORS

$ERRORS : array

Ошибки

Type

array

$ERRORS_MES

$ERRORS_MES : array

Сообщения об ошибках

Type

array

$_table

$_table : string

Таблица

Type

string

$_table_id

$_table_id : string

Поле ID

Type

string

$_table_left

$_table_left : string

Левый индекс

Type

string

$_table_right

$_table_right : string

Правый индекс

Type

string

$_table_level

$_table_level : string

ПОле уровень

Type

string

$_table_parent

$_table_parent : string

Поле parent

Type

string

Methods

__construct()

__construct(\Colibri\Data\DataAccessPoint  $dtp, string  $table, string  $id, string  $left, string  $right, string  $level, string  $parent) 

Конструктор

Parameters

\Colibri\Data\DataAccessPoint $dtp
string $table
string $id
string $left
string $right
string $level
string $parent

__get()

__get(string  $property) : mixed

Геттер

Parameters

string $property

Returns

mixed

Clear()

Clear(array  $data = array()) : boolean

Очищает данные

Parameters

array $data

Returns

boolean

Update()

Update(integer  $id, array  $data) : boolean

Обновляет данные

Parameters

integer $id
array $data

Returns

boolean

GetNode()

GetNode(boolean  $section_id = false, boolean  $returnAsReader = false, string  $criteria = '') : void

Возвращает данные по ноде

Parameters

boolean $section_id
boolean $returnAsReader
string $criteria

GetRootNode()

GetRootNode(boolean  $returnAsReader = false) : void

Возвращает данные корневой ноды

Parameters

boolean $returnAsReader

GetParentInfo()

GetParentInfo(integer  $section_id, array  $condition = '') : \Colibri\Data\Models\DataRow

Receives parent left, right and level for unit with number $id.

Parameters

integer $section_id
array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

Returns

\Colibri\Data\Models\DataRow

Insert()

Insert(integer  $section_id, array  $data = array()) : integer

Add a new element in the tree to element with number $section_id.

Parameters

integer $section_id

Number of a parental element

array $data

Contains parameters for additional fields of a tree (if is): array('filed name' => 'importance', etc)

Returns

integer —

Inserted element id

InsertNear()

InsertNear(integer  $id, array  $condition = '', array  $data = array()) : integer

Add a new element in the tree near element with number id.

Parameters

integer $id

Number of a parental element

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

array $data

Contains parameters for additional fields of a tree (if is): array('filed name' => 'importance', etc)

Returns

integer —

Inserted element id

MoveAll()

MoveAll(integer  $id, integer  $newParentId) : boolean

Assigns a node with all its children to another parent.

Parameters

integer $id

node ID

integer $newParentId

ID of new parent node

Returns

boolean —

TRUE if successful, FALSE otherwise.

ChangePosition()

ChangePosition(integer  $id1, integer  $id2) : boolean

Change items position.

Parameters

integer $id1

first item ID

integer $id2

second item ID

Returns

boolean —

TRUE if successful, FALSE otherwise.

ChangePositionAll()

ChangePositionAll(integer  $id1, integer  $id2, string  $position = 'after', array  $condition = '') : boolean

Swapping nodes within the same level and limits of one parent with all its children: $id1 placed before or after $id2.

Parameters

integer $id1

first item ID

integer $id2

second item ID

string $position

'before' or 'after' $id2

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

Returns

boolean —

TRUE if successful, FALSE otherwise.

Delete()

Delete(integer  $id, array  $condition = '') : boolean

Delete element with number $id from the tree wihtout deleting it's children.

Parameters

integer $id

Number of element

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

Returns

boolean —

TRUE if successful, FALSE otherwise.

DeleteAll()

DeleteAll(integer  $id, array  $condition = '') : boolean

Delete element with number $id from the tree and all it childret.

Parameters

integer $id

Number of element

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

Returns

boolean —

TRUE if successful, FALSE otherwise.

CountAll()

CountAll(integer  $id, array  $condition = '') : boolean

Counts element with number $id from the tree and all it childret.

Parameters

integer $id

Number of element

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

Returns

boolean —

TRUE if successful, FALSE otherwise.

Full()

Full(array  $fields, array  $condition = '', string  $joinWith = '', integer  $page = -1, integer  $pagesize = 10) : array

Returns all elements of the tree sortet by left.

Parameters

array $fields

needed fields (if is): array('filed1 name', 'filed2 name', etc)

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

string $joinWith

Join string

integer $page

Page

integer $pagesize

Pagesize

Returns

array —

needed fields

GetPositionNumber()

GetPositionNumber(integer  $id, string  $condition = '') : integer

Gets a position number

Parameters

integer $id
string $condition

Returns

integer

Branch()

Branch(integer  $id, array  $fields = '', array  $condition = '', array  $joinWith = '', integer  $page = -1, integer  $pagesize = 10) : \Colibri\Data\SqlClient\IDataReader

Returns all elements of a branch starting from an element with number $id.

Parameters

integer $id

Node unique id

array $fields

needed fields (if is): array('filed1 name', 'filed2 name', etc)

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

array $joinWith

Array structure: array('outer' => array('table' => 'condition'), 'inner' => array('table', 'condition')), etc where array key - join type (inner, outer, cross), condition - condition string

integer $page

Page

integer $pagesize

Pagesize

Returns

\Colibri\Data\SqlClient\IDataReader

Parents()

Parents(integer  $id, array  $fields = '', array  $condition = '', string  $joinWith = '') : \Colibri\Data\SqlClient\IDataReader

Returns all parents of element with number $id.

Parameters

integer $id

Node unique id

array $fields

needed fields (if is): array('filed1 name', 'filed2 name', etc)

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

string $joinWith

Join string

Returns

\Colibri\Data\SqlClient\IDataReader

Ajar()

Ajar(integer  $id, array  $fields = '', array  $condition = '', integer  $page = -1, integer  $pagesize = 10) : \Colibri\Data\SqlClient\IDataReader

Returns a slightly opened tree from an element with number $id.

Parameters

integer $id

Node unique id

array $fields

needed fields (if is): array('filed1 name', 'filed2 name', etc)

array $condition

Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string

integer $page

Page

integer $pagesize

Pagesize

Returns

\Colibri\Data\SqlClient\IDataReader

_setError()

_setError(string  $file, string  $class, string  $function, integer  $line, string  $sql, integer  $error) : void

Ошибка

Parameters

string $file
string $class
string $function
integer $line
string $sql
integer $error

GetNodeInfo()

GetNodeInfo(integer  $section_id) : array

Receives left, right and level for unit with number id.

Parameters

integer $section_id

Unique section id

Returns

array —
  • left, right, level

_PrepareCondition()

_PrepareCondition(array  $condition, boolean  $where = false, string  $prefix = '') : string

Transform array with conditions to SQL query Array structure: array('and' => array('id = 0', 'id2 >= 3'), 'or' => array('sec = \'www\'', 'sec2 <> \'erere\'')), etc where array key - condition (AND, OR, etc), value - condition string.

Parameters

array $condition
boolean $where
  • True - yes, flase - not
string $prefix

Returns

string

_PrepareJoin()

_PrepareJoin(string  $joinWith, string  $prefix = '') : string

Transform array with conditions to SQL query Array structure: array $joinWith Array structure: array('outer' => array('table' => array('fieldfrom', 'fieldto')), 'inner' => array('table' => array('fieldfrom', 'fieldto')), etc where array key - join type (inner, outer, cross), condition - condition string where array key - condition (AND, OR, etc), value - condition string.

Parameters

string $joinWith
string $prefix

Returns

string