JTableNested

From Joomla! Documentation

Jump to: navigation, search

JTableNested is a table class which supports modified pre-order tree traversal behaviour. This class is derived from the base JTable class and adds methods to support a binary tree structure in the database, with pre-order being the preferred method of traversal.

Contents

Availability

From Joomla 1.6

Defined in

/joomla/database/tablenested.php

Extends

Reserved Database Field Names

The operation of this class is dependent on the existence of specially-named fields (columns) in the database table.

Field name Description
left_id Primary key of the node on the left branch of the current node.
right_id Primary key of the node on the right branch of the current node.
parent_id Primary key of the parent node of the current node.
level Number of steps from the root node to the current node.
path Path from the root node to the current node.
alias Optional. Alias name for the current node.
checked_out Optional. As per JTable.
checked_out_time Optional. As per JTable.
published Optional. As per JTable.

Methods

Method name Description
delete Deletes a node, and optionally its child nodes, from the table.
getPath Gets and array of nodes from the root to a given node.
getTree Gets a node and all its child nodes.
isLeaf Determines if a node is a leaf node in the tree (has no children).
move Moves a node and its children to a new location in the tree.
orderDown Moves a node one position to the right in the same level.
orderUp Moves a node one position to the left in the same level.
publish Set the publishing state for a node or list of nodes in the table.
rebuildPath Rebuilds a node's path field from the alias values of the node from the current node to the root node of the tree.
setLocation Set the location of a node in the tree object.
store Stores a node in the database table.

Importing

jimport( 'joomla.database.tablenested' );

See also

Personal tools