Class JTableNested

Description

Table class supporting modified pre-order tree traversal behavior.

Located in /libraries/joomla/database/tablenested.php (line 22)

JObject
   |
   --JTable
      |
      --JTableNested
Direct descendents
Class Description
JTableAsset Table class supporting modified pre-order tree traversal behavior.
JTableMenu Menu table
JTableCategory Category table
Variable Summary
string $alias
integer $level
integer $lft
integer $parent_id
integer $rgt
array $_cache
integer $_debug
string $_location
integer $_location_id
Method Summary
boolean check ()
void debug (integer $level)
boolean delete ([integer $pk = null], [boolean $children = true])
mixed getPath ([integer $pk = null], [boolean $diagnostic = false])
mixed getRootId ()
mixed getTree ([integer $pk = null], [boolean $diagnostic = false])
boolean isLeaf ([integer $pk = null])
mixed move (integer $delta, [string $where = ''])
boolean moveByReference (integer $referenceId, [string $position = 'after'], [integer $pk = null])
boolean orderDown (integer $pk)
boolean orderUp (integer $pk)
boolean publish ([mixed $pks = null], [integer $state = 1], [integer $userId = 0])
integer rebuild ([integer $parentId = null], [integer $leftId = 0], [integer $level = 0], [string $path = ''])
boolean rebuildPath ([integer $pk = null])
integer saveorder ([array $idArray = null], [array $lft_array = null])
boolean setLocation (integer $referenceId, [string $position = 'after'])
boolean store ([boolean $updateNulls = false])
mixed _getNode (integer $id, [string $key = null])
mixed _getTreeRepositionData (object $referenceNode, integer $nodeWidth, [string $position = 'before'])
void _logtable ([boolean $showData = true], [boolean $showQuery = true])
boolean _runQuery (string $query, string $errorMessage)
Variables
string $alias (line 66)

Object property holding the alias of this node used to constuct the full text path, forward-slash delimited.

  • since: 11.1
  • access: public
integer $level (line 39)

Object property holding the depth level of the node in the tree.

  • since: 11.1
  • access: public
integer $lft (line 48)

Object property holding the left value of the node for managing its placement in the nested sets tree.

  • since: 11.1
  • access: public
integer $parent_id (line 31)

Object property holding the primary key of the parent node. Provides adjacency list data for nodes.

  • since: 11.1
  • access: public
integer $rgt (line 57)

Object property holding the right value of the node for managing its placement in the nested sets tree.

  • since: 11.1
  • access: public
array $_cache = array() (line 93)

An array to cache values in recursive processes.

  • since: 11.1
  • access: protected
integer $_debug = 0 (line 101)

Debug level

  • since: 11.1
  • access: protected
string $_location (line 75)

Object property to hold the location type to use when storing the row.

Possible values are: ['before', 'after', 'first-child', 'last-child'].

  • since: 11.1
  • access: protected
integer $_location_id (line 85)

Object property to hold the primary key of the location reference node to use when storing the row. A combination of location type and reference node describes where to store the current node in the tree.

  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JTable

JTable::$_db
JTable::$_locked
JTable::$_rules
JTable::$_tbl
JTable::$_tbl_key
JTable::$_trackAssets

Inherited from JObject

JObject::$_errors
Methods
check (line 674)

Asset that the nested set data is valid.

boolean check ()

Redefinition of:
JTable::check()
Method to perform sanity checks on the JTable instance properties to ensure they are safe to store in the database. Child classes should override this method to make sure the data they are storing in the database is safe and as expected before storage.

Redefined in descendants as:
debug (line 112)

Sets the debug level on or off

  • since: 11.1
  • access: public
void debug (integer $level)
  • integer $level:
    1. = off, 1 = on
delete (line 542)

Method to delete a node and, optionally, its child nodes from the table.

boolean delete ([integer $pk = null], [boolean $children = true])
  • integer $pk: The primary key of the node to delete.
  • boolean $children: True to delete child nodes, false to move them up a level.

Redefinition of:
JTable::delete()
Method to delete a row from the database table by primary key value.

Redefined in descendants as:
getPath (line 128)

Method to get an array of nodes from a given node to its root.

mixed getPath ([integer $pk = null], [boolean $diagnostic = false])
  • integer $pk: Primary key of the node for which to get the path.
  • boolean $diagnostic: Only select diagnostic data for the nested sets.
getRootId (line 1207)

Gets the ID of the root item in the tree

  • return: The ID of the root row, or false and the internal error is set.
  • since: 11.1
  • access: public
mixed getRootId ()
getTree (line 168)

Method to get a node and all its child nodes.

mixed getTree ([integer $pk = null], [boolean $diagnostic = false])
  • integer $pk: Primary key of the node for which to get the tree.
  • boolean $diagnostic: Only select diagnostic data for the nested sets.
isLeaf (line 206)

Method to determine if a node is a leaf node in the tree (has no children).

boolean isLeaf ([integer $pk = null])
  • integer $pk: Primary key of the node to check.
move (line 266)

Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.

Negative numbers move the row up in the sequence and positive numbers move it down.

mixed move (integer $delta, [string $where = ''])
  • integer $delta: The direction and magnitude to move the row in the ordering sequence.
  • string $where: WHERE clause to use for limiting the selection of rows to compact the ordering values.

Redefinition of:
JTable::move()
Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
moveByReference (line 320)

Method to move a node and its children to a new location in the tree.

boolean moveByReference (integer $referenceId, [string $position = 'after'], [integer $pk = null])
  • integer $referenceId: The primary key of the node to reference new location by.
  • string $position: Location type string. ['before', 'after', 'first-child', 'last-child']
  • integer $pk: The primary key of the node to move.
orderDown (line 1112)

Method to move a node one position to the right in the same level.

boolean orderDown (integer $pk)
  • integer $pk: Primary key of the node to move.
orderUp (line 1015)

Method to move a node one position to the left in the same level.

boolean orderUp (integer $pk)
  • integer $pk: Primary key of the node to move.
publish (line 884)

Method to set the publishing state for a node or list of nodes in the database

table. The method respects rows checked out by other users and will attempt to checkin rows that it can after adjustments are made. The method will not allow you to set a publishing state higher than any ancestor node and will not allow you to set a publishing state on a node with a checked out child.

boolean publish ([mixed $pks = null], [integer $state = 1], [integer $userId = 0])
  • mixed $pks: An optional array of primary key values to update. If not set the instance property value is used.
  • integer $state: The publishing state. eg. [0 = unpublished, 1 = published]
  • integer $userId: The user id of the user performing the operation.

Redefinition of:
JTable::publish()
Method to set the publishing state for a row or list of rows in the database table. The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
rebuild (line 1305)

Method to recursively rebuild the whole nested set tree.

integer rebuild ([integer $parentId = null], [integer $leftId = 0], [integer $level = 0], [string $path = ''])
  • integer $parentId: The root of the tree to rebuild.
  • integer $leftId: The left id to start with in building the tree.
  • integer $level: The level to assign to the current nodes.
  • string $path: The path to the current nodes.
rebuildPath (line 1397)

Method to rebuild the node's path field from the alias values of the nodes from the current node to the root node of the tree.

boolean rebuildPath ([integer $pk = null])
  • integer $pk: Primary key of the node for which to get the path.
saveorder (line 1460)

Method to update order of table rows

  • return: 1 + value of root rgt on success, false on failure.
  • since: 11.1
  • access: public
integer saveorder ([array $idArray = null], [array $lft_array = null])
  • array $idArray: id numbers of rows to be reordered.
  • array $lft_array: lft values of rows to be reordered.
setLocation (line 236)

Method to set the location of a node in the tree object. This method does not save the new location to the database, but will set it in the object so that when the node is stored it will be stored in the new location.

boolean setLocation (integer $referenceId, [string $position = 'after'])
  • integer $referenceId: The primary key of the node to reference new location by.
  • string $position: Location type string. ['before', 'after', 'first-child', 'last-child']
store (line 722)

Method to store a node in the database table.

boolean store ([boolean $updateNulls = false])
  • boolean $updateNulls: True to update null values as well.

Redefinition of:
JTable::store()
Method to store a row in the database from the JTable instance properties.

Redefined in descendants as:
_getNode (line 1508)

Method to get nested set properties for a node in the tree.

  • return: Boolean false on failure or node object on success.
  • since: 11.1
  • access: protected
mixed _getNode (integer $id, [string $key = null])
  • integer $id: Value to look up the node by.
  • string $key: Key to look up the node by.
_getTreeRepositionData (line 1567)

Method to get various data necessary to make room in the tree at a location for a node and its children. The returned data object includes conditions for SQL WHERE clauses for updating left and right id values to make room for the node as well as the new left and right ids for the node.

  • return: Boolean false on failure or data object on success.
  • since: 11.1
  • access: protected
mixed _getTreeRepositionData (object $referenceNode, integer $nodeWidth, [string $position = 'before'])
  • object $referenceNode: A node object with at least a 'lft' and 'rgt' with which to make room in the tree around for a new node.
  • integer $nodeWidth: The width of the node for which to make room in the tree.
  • string $position: The position relative to the reference node where the room should be made.
_logtable (line 1650)

Method to create a log table in the buffer optionally showing the query and/or data.

  • since: 11.1
  • access: protected
void _logtable ([boolean $showData = true], [boolean $showQuery = true])
  • boolean $showData: True to show data
  • boolean $showQuery: True to show query
_runQuery (line 1690)

Method to run an update query and check for a database error

  • return: False on exception
  • since: 11.1
  • access: protected
boolean _runQuery (string $query, string $errorMessage)
  • string $query: The query.
  • string $errorMessage: Unused.

Inherited Methods

Inherited From JTable

JTable::__construct()
JTable::addIncludePath()
JTable::bind()
JTable::canDelete()
JTable::check()
JTable::checkIn()
JTable::checkOut()
JTable::delete()
JTable::getDbo()
JTable::getFields()
JTable::getInstance()
JTable::getKeyName()
JTable::getNextOrder()
JTable::getRules()
JTable::getTableName()
JTable::hit()
JTable::isCheckedOut()
JTable::load()
JTable::move()
JTable::publish()
JTable::reorder()
JTable::reset()
JTable::save()
JTable::setDBO()
JTable::setRules()
JTable::store()
JTable::toXML()
JTable::_getAssetName()
JTable::_getAssetParentId()
JTable::_getAssetTitle()
JTable::_lock()
JTable::_unlock()

Inherited From JObject

JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 14:00:04 -0500 by phpDocumentor 1.4.4