[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Table/ -> Nested.php (summary)

Joomla! Content Management System

Copyright: (C) 2009 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 1694 lines (59 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Nested:: (23 methods):
  debug()
  getPath()
  getTree()
  isLeaf()
  setLocation()
  move()
  moveByReference()
  delete()
  check()
  store()
  publish()
  orderUp()
  orderDown()
  getRootId()
  rebuild()
  rebuildPath()
  reset()
  saveorder()
  recursiveUpdatePublishedColumn()
  _getNode()
  _getTreeRepositionData()
  _logtable()
  _runQuery()


Class: Nested  - X-Ref

Table class supporting modified pre-order tree traversal behavior.

debug($level)   X-Ref
Sets the debug level on or off

param: integer  $level  0 = off, 1 = on
return: void

getPath($pk = null, $diagnostic = false)   X-Ref
Method to get an array of nodes from a given node to its root.

param: integer  $pk          Primary key of the node for which to get the path.
param: boolean  $diagnostic  Only select diagnostic data for the nested sets.
return: mixed    An array of node objects including the start node.

getTree($pk = null, $diagnostic = false)   X-Ref
Method to get a node and all its child nodes.

param: integer  $pk          Primary key of the node for which to get the tree.
param: boolean  $diagnostic  Only select diagnostic data for the nested sets.
return: mixed    Boolean false on failure or array of node objects on success.

isLeaf($pk = null)   X-Ref
Method to determine if a node is a leaf node in the tree (has no children).

param: integer  $pk  Primary key of the node to check.
return: boolean  True if a leaf node, false if not or null if the node does not exist.

setLocation($referenceId, $position = 'after')   X-Ref
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.

param: integer  $referenceId  The primary key of the node to reference new location by.
param: string   $position     Location type string.
return: void

move($delta, $where = '')   X-Ref
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.

param: integer  $delta  The direction and magnitude to move the row in the ordering sequence.
param: string   $where  WHERE clause to use for limiting the selection of rows to compact the
return: mixed    Boolean true on success.

moveByReference($referenceId, $position = 'after', $pk = null, $recursiveUpdate = true)   X-Ref
Method to move a node and its children to a new location in the tree.

param: integer  $referenceId      The primary key of the node to reference new location by.
param: string   $position         Location type string. ['before', 'after', 'first-child', 'last-child']
param: integer  $pk               The primary key of the node to move.
param: boolean  $recursiveUpdate  Flag indicate that method recursiveUpdatePublishedColumn should be call.
return: boolean  True on success.

delete($pk = null, $children = true)   X-Ref
Method to delete a node and, optionally, its child nodes from the table.

param: integer  $pk        The primary key of the node to delete.
param: boolean  $children  True to delete child nodes, false to move them up a level.
return: boolean  True on success.

check()   X-Ref
Checks that the object is valid and able to be stored.

This method checks that the parent_id is non-zero and exists in the database.
Note that the root node (parent_id = 0) cannot be manipulated with this class.

return: boolean  True if all checks pass.

store($updateNulls = false)   X-Ref
Method to store a node in the database table.

param: boolean  $updateNulls  True to update null values as well.
return: boolean  True on success.

publish($pks = null, $state = 1, $userId = 0)   X-Ref
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.

param: mixed    $pks     An optional array of primary key values to update.  If not
param: integer  $state   The publishing state. eg. [0 = unpublished, 1 = published]
param: integer  $userId  The user id of the user performing the operation.
return: boolean  True on success.

orderUp($pk)   X-Ref
Method to move a node one position to the left in the same level.

param: integer  $pk  Primary key of the node to move.
return: boolean  True on success.

orderDown($pk)   X-Ref
Method to move a node one position to the right in the same level.

param: integer  $pk  Primary key of the node to move.
return: boolean  True on success.

getRootId()   X-Ref
Gets the ID of the root item in the tree

return: mixed  The primary id of the root row, or false if not found and the internal error is set.

rebuild($parentId = null, $leftId = 0, $level = 0, $path = '')   X-Ref
Method to recursively rebuild the whole nested set tree.

param: integer  $parentId  The root of the tree to rebuild.
param: integer  $leftId    The left id to start with in building the tree.
param: integer  $level     The level to assign to the current nodes.
param: string   $path      The path to the current nodes.
return: integer  1 + value of root rgt on success, false on failure

rebuildPath($pk = null)   X-Ref
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.

param: integer  $pk  Primary key of the node for which to get the path.
return: boolean  True on success.

reset()   X-Ref
Method to reset class properties to the defaults set in the class
definition. It will ignore the primary key as well as any private class
properties (except $_errors).

return: void

saveorder($idArray = null, $lftArray = null)   X-Ref
Method to update order of table rows

param: array  $idArray   id numbers of rows to be reordered.
param: array  $lftArray  lft values of rows to be reordered.
return: integer|boolean  1 + value of root rgt on success, false on failure.

recursiveUpdatePublishedColumn($pk, $newState = null)   X-Ref
Method to recursive update published column for children rows.

param: integer  $pk        Id number of row which published column was changed.
param: integer  $newState  An optional value for published column of row identified by $pk.
return: boolean  True on success.

_getNode($id, $key = null)   X-Ref
Method to get nested set properties for a node in the tree.

param: integer  $id   Value to look up the node by.
param: string   $key  An optional key to look up the node by (parent | left | right).
return: mixed    Boolean false on failure or node object on success.

_getTreeRepositionData($referenceNode, $nodeWidth, $position = 'before')   X-Ref
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.

param: object   $referenceNode  A node object with at least a 'lft' and 'rgt' with
param: integer  $nodeWidth      The width of the node for which to make room in the tree.
param: string   $position       The position relative to the reference node where the room
return: mixed    Boolean false on failure or data object on success.

_logtable($showData = true, $showQuery = true)   X-Ref
Method to create a log table in the buffer optionally showing the query and/or data.

param: boolean  $showData   True to show data
param: boolean  $showQuery  True to show query
return: void

_runQuery($query, $errorMessage)   X-Ref
Runs a query and unlocks the database on an error.

param: mixed   $query         A string or DatabaseQuery object.
param: string  $errorMessage  Unused.
return: void



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer