Class FOFTableNested
A class to manage tables holding nested sets (hierarchical data)
- FOFUtilsObject
- FOFTable implements JTableInterface
- FOFTableNested
Copyright: Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
License: General Public License version 2 or later; see LICENSE.txt
Located at fof/table/nested.php
Methods summary
public
|
#
__construct( string $table, string $key,
Public constructor. Overrides the parent constructor, making sure there are lft/rgt columns which make it compatible with nested sets. |
public
boolean
|
|
public
boolean
|
#
delete( integer $oid = null )
Delete a node, either the currently loaded one or the one specified in $id. If an $id is specified that node is loaded before trying to delete it. In the end the data model is reset. If the node has any children nodes they will be removed before the node itself is deleted. |
protected
boolean
|
|
public
|
|
public
|
|
public
static
|
|
public
|
|
public
|
|
public
|
#
insertAsRoot( )
Insert the current node as a tree root. It is a good idea to never use this method, instead providing a root node in your schema installation and then sticking to only one root. |
public
mixed
|
#
insertAsFirstChildOf(
Insert the current node as the first (leftmost) child of a parent node. |
public
mixed
|
#
insertAsLastChildOf(
Insert the current node as the last (rightmost) child of a parent node. |
public
mixed
|
|
public
mixed
|
#
insertLeftOf(
Insert the current node to the left of (before) a sibling node |
public
mixed
|
#
insertRightOf(
Insert the current node to the right of (after) a sibling node |
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
#
moveToLeftOf(
Moves the current node (and its subtree) to the left of another node. The other node can be in a different position in the tree or even under a different root. |
public
mixed
|
#
moveToRightOf(
Moves the current node (and its subtree) to the right of another node. The other node can be in a different position in the tree or even under a different root. |
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
#
makeFirstChildOf(
Moves a node and its subtree as a the first (leftmost) child of $parentNode |
public
mixed
|
#
makeLastChildOf(
Moves a node and its subtree as a the last (rightmost) child of $parentNode |
public
mixed
|
|
public
mixed
|
|
public
integer|mixed
|
|
public
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
#
isSelfOrDescendantOf(
Returns true if $otherNode is ourselves or if we are a descendant of $otherNode |
public
boolean
|
|
public
boolean
|
#
isSelfOrAncestorOf(
Returns true if $otherNode is ourselves or we are an ancestor of $otherNode |
public
boolean
|
|
public
boolean
|
|
public
boolean
|
#
inSameScope(
Returns true if both this node and $otherNode are root, leaf or child (same tree scope) |
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|
#
scopeDescendantsAndSelf( )
get() will return all descendants (even subtrees of subtrees!) and ourselves |
protected
|
#
scopeDescendants( )
get() will return all descendants (even subtrees of subtrees!) but not ourselves |
protected
|
#
scopeImmediateDescendants( )
get() will only return immediate descendants (first level children) of the current node |
public
|
#
withoutNode(
get() will not return the selected node if it's part of the query results |
protected
|
|
protected
|
|
public
|
|
public
|
#
getAncestorsAndSelf( )
Get all ancestors to this node and the node itself. In other words it gets the full path to the node and the node itself. |
public
|
#
getAncestorsAndSelfWithoutRoot( )
Get all ancestors to this node and the node itself, but not the root node. If you want to |
public
|
#
getAncestors( )
Get all ancestors to this node but not the node itself. In other words it gets the path to the node, without the node itself. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getImmediateDescendants( )
Get the immediate descendants (children). Unlike getDescendants it only goes one level deep into the tree structure. Descendants of descendant nodes will not be returned. |
public
array
|
#
getNestedList( string $column = 'title', null $key = null, string $seperator = ' ' )
Returns a hashed array where each element's key is the value of the $key column (default: the ID column of the table) and its value is the value of the $column column (default: title). Each nesting level will have the value of the $column column prefixed by a number of $separator strings, as many as its nesting level (depth). |
public
|
|
public
|
|
public
|
|
protected
static
|
|
public
mixed
|
|
protected
|
|
public
|
Methods inherited from FOFTable
_lock()
,
_unlock()
,
addBehavior()
,
addIncludePath()
,
addKnownField()
,
bind()
,
canDelete()
,
checkContentType()
,
checkin()
,
checkout()
,
forceInstance()
,
getAnInstance()
,
getAsset()
,
getAssetKey()
,
getAssetName()
,
getAssetParentId()
,
getAssetTitle()
,
getCSVHeader()
,
getClone()
,
getColumnAlias()
,
getConfigProvider()
,
getConfigProviderKey()
,
getContentType()
,
getData()
,
getDbo()
,
getFields()
,
getId()
,
getInstance()
,
getKeyName()
,
getKnownFields()
,
getNextOrder()
,
getQueryJoin()
,
getQueryJoinFields()
,
getRelations()
,
getRules()
,
getTableAlias()
,
getTableFields()
,
getTableName()
,
getTriggerEvents()
,
getUcmCoreAlias()
,
hasField()
,
hasTags()
,
hit()
,
isAssetsTracked()
,
isCheckedOut()
,
isQuoted()
,
load()
,
normalizeSelectFields()
,
onAfterBind()
,
onAfterCopy()
,
onAfterHit()
,
onAfterLoad()
,
onAfterMove()
,
onAfterReorder()
,
onAfterReset()
,
onAfterStore()
,
onBeforeBind()
,
onBeforeCopy()
,
onBeforeDelete()
,
onBeforeHit()
,
onBeforeMove()
,
onBeforePublish()
,
onBeforeReorder()
,
onBeforeReset()
,
onBeforeStore()
,
publish()
,
removeKnownField()
,
save()
,
setAssetKey()
,
setAssetsTracked()
,
setColumnAlias()
,
setConfig()
,
setDBO()
,
setHasTags()
,
setInput()
,
setKnownFields()
,
setQueryJoin()
,
setRules()
,
setSkipChecks()
,
setTableAlias()
,
setTablePrefix()
,
setTriggerEvents()
,
store()
,
toCSV()
Methods inherited from FOFUtilsObject
__toString()
,
def()
,
getError()
,
getErrors()
,
getProperties()
,
set()
,
setError()
,
setProperties()
Magic methods summary
Properties summary
protected
integer
|
$treeDepth |
#
The level (depth) of this node in the tree |
protected
|
$treeRoot |
#
The root node in the tree |
protected
|
$treeParent |
#
The parent node of ourselves |
protected
boolean
|
$treeNestedGet |
#
Should I perform a nested get (used to query ascendants/descendants) |
protected
array
|
$whereClauses |
#
A collection of custom, additional where clauses to apply during buildQuery |
Properties inherited from FOFTable
$_assetKey
,
$_autoChecks
,
$_columnAlias
,
$_configProviderKey
,
$_db
,
$_has_tags
,
$_includePaths
,
$_locked
,
$_queryJoin
,
$_relations
,
$_rules
,
$_skipChecks
,
$_tableAlias
,
$_tableExists
,
$_tablePrefix
,
$_tbl
,
$_tbl_key
,
$_trackAssets
,
$_trigger_events
,
$config
,
$configProvider
,
$contentType
,
$default_behaviors
,
$input
,
$instances
,
$knownFields
,
$tableCache
,
$tableDispatcher
,
$tableFieldCache
Properties inherited from FOFUtilsObject
Magic properties
public
integer
|
$lft |
|
#
Left value (for nested set implementation) |
public
integer
|
$rgt |
|
#
Right value (for nested set implementation) |
public
string
|
$hash |
|
#
Slug hash (optional; for faster searching) |
public
string
|
$slug |
|
#
Node's slug (optional) |
public
string
|
$title |
|
#
Title of the node (optional) |