public
|
|
public
boolean
|
#
beforeSave( )
check object_path and parent_path, avoid object is parent or ancestor of itself
check object_path and parent_path, avoid object is parent or ancestor of itself
Returns
boolean
|
public
mixed integer,
|
#
getParent( integer $id, integer $area_id = null, $status = array() )
get parent or array of parents
get parent or array of parents
Parameters
- $id
- $area_id
- $area_id, publication id: if defined search parent only inside the publication
- $status
Returns
mixed integer, integer, if only one parent found
array, if two or more parents found
false, error or none parent found
|
public
array,
|
#
getParents( integer|null $id = null, integer|null $area_id = null, array $status = array(), boolean $useCache = true )
Array of object $id tree parents objects
Array of object $id tree parents objects
If $useCache is true it will try to read/write from/to cache
Parameters
- $id
- The child id
- $area_id
- The publication (area) id
- $status
- An array of object status that parent must have
- $useCache
- If it has to use cache (true default)
Returns
array, parent ids (may be empty)
|
public
|
#
updateTree( integer $id, array $destination, array $options = array() )
Update tree position of object $id with new $destination array
Update tree position of object $id with new $destination array
To update tree:
- all parents are taken
- ids in all parents that missing from $destination are removed
- ids in $destination that missing from all parents are added
With $options you can limit the parents taken
Possible values are:
- area_id to limit parents to some publication.
- status to limit parents with specific status
Parameters
- $id
- $destination
- $options
- $options
- $destination
|
public
integer
|
#
getRootForSection( integer $id )
Return id of publication that contains the section, by id
Return id of publication that contains the section, by id
Parameters
Returns
integer
|
public
boolean
|
#
appendChild( integer $id, integer $idParent = null, integer $priority = null )
append an object to a parent in tree
append an object to a parent in tree
Parameters
- $id
- object id
- $idParent
- parent object id
- $priority
- if not passed append as last child else use passed position
Returns
boolean
|
public
integer
|
#
getAreaIdByPath( string $path )
Return id of publication by path
Return id of publication by path
Parameters
Returns
integer
|
public
boolean
|
#
movePriority( integer $id, integer $idParent, boolean $up = true )
move up or down a leaf tree inside a branch
move up or down a leaf tree inside a branch
Parameters
- $id
- object id to move
- $idParent
- parent object (branch)
- $up
- true move up (priority - 1), false move down (priority + 1)
Returns
boolean
|
public
boolean
|
#
movePriorityUp( integer $id, integer $idParent )
move up a leaf tree inside a branch
move up a leaf tree inside a branch
Parameters
- $id
- to move
- $idParent
- parent object (branch)
Returns
boolean
|
public
boolean
|
#
movePriorityDown( integer $id, integer $idParent )
move down a leaf tree inside a branch
move down a leaf tree inside a branch
Parameters
- $id
- to move
- $idParent
- parent object (branch)
Returns
boolean
|
public
boolean
|
#
removeChild( integer $id, integer $idParent )
remove a leaf tree from a branch
remove a leaf tree from a branch
Parameters
- $id
- to remove
- $idParent
- parent object (branch)
Returns
boolean
|
public
boolean
|
#
setPriority( integer $id, integer $priority, $idParent )
set position for a leaf tree in a branch
set position for a leaf tree in a branch
Parameters
- $id
- to move
- $priority
- $idParent parent object (branch)
- $idParent
Returns
boolean
|
public
integer
|
#
getPriority( integer $id, integer $idParent )
object position in a tree branch
object position in a tree branch
Parameters
- $id
- object id
- $idParent
- parent object (branch) id
Returns
integer
|
public
boolean
|
#
move( integer $idNewParent, integer $idOldParent, integer $id )
move branch to another parent
move branch to another parent
Parameters
- $idNewParent
- $idOldParent
- $id
Returns
boolean
|
public
array
|
#
getAllRoots( integer $userid = null, mixed $status = null, array $filter = array(), array $expandBranch = array() )
get all tree roots objects (publications)
get all tree roots objects (publications)
Parameters
- $userid
- $status
- string or array of status
- $filter
- filter options see BEAppModel::findObjects
- $expandBranch
- array of branch ids of which roots have to expanded
Returns
array
|
public
array
|
#
getAll( integer $id = null, string $userid = null, string $status = null, array $filter = array() )
Get Tree where 'id' (if it passed) has to be tree root
If it's a section id then an empty array is returned
Get Tree where 'id' (if it passed) has to be tree root
If it's a section id then an empty array is returned
Parameters
- $id
- publication id. If null get all trees, one for every publication
- $userid
- user. if null: no permission check (default); if '': guest user
- $status
- only objs with this status
- $filter
- see BEAppModel::findObjects
Returns
array every first level key is a publication
|
public
array
|
#
buildTree( array $items )
Return a tree build for the items passed
Return a tree build for the items passed
Parameters
Returns
array
|
private
|
#
putBranchInTree( array & $tree, array $branch )
search where have to stay $branch in $tree and put in
search where have to stay $branch in $tree and put in
Parameters
- $tree
- $branch
- to put in tree
|
public
boolean
|
#
isParent( integer $idParent, integer $id )
check if $idParent is an ancestor
check if $idParent is an ancestor
Parameters
Returns
boolean
|
public
boolean
|
#
isOnTree( integer $id, integer $area_id = null, $status = array() )
check if an object is on the tree
check if an object is on the tree
Parameters
- $id
- $area_id
- if defined check if the object is a descendant of a publication
- $status
Returns
boolean
|
public
array|integer
|
#
relatedObjectsOnTree( integer $id, array $options = array() )
Return a list of a count (based on $option['count']) of related object to $id that are on tree
Return a list of a count (based on $option['count']) of related object to $id that are on tree
$options can contain
- 'area_id' to filter on publication
- 'status' to filter on object status
- 'count' (default false) to get a count or a list of object ids
- 'relation' to filter on relation name
Parameters
- $id
- the object id
- $options
Returns
array|integer
|
public
array
|
#
getChildren( integer $id = null, string $userid = null, string $status = null, array $filter = array(), string $order = null, boolean $dir = true, integer $page = 1, integer $dim = null, array $excludeIds = array() )
Children of id element (only 1 level in tree).
If userid != null, only objects with read permissione for user, if ' ' - use guest/anonymous user,
if userid = null -> no permission check.
Filter: object types, search text query.
Children of id element (only 1 level in tree).
If userid != null, only objects with read permissione for user, if ' ' - use guest/anonymous user,
if userid = null -> no permission check.
Filter: object types, search text query.
Parameters
- $id
- root id
- $userid
- user: null (default) => no permission check. ' ' => guest/anonymous user,
- $status
- object status
- $filter
Filter: object types, search text query, eg. array(21, 22, "search" => "text to search").
Default: all object types
- $order
- field to order result (id, status, modified..)
- $dir
- true (default), ascending, otherwiese descending.
- $page
- Page number (for pagination)
- $dim
- Page dim (for pagination)
- $excludeIds
- array of ids to exclude
Returns
array
|
public
array
|
#
getDescendants( integer $id = null, string $userid = null, string $status = null, array $filter = array(), string $order = null, boolean $dir = true, integer $page = 1, integer $dim = null, array $excludeIds = array() )
Descendants of id element (all elements in tree).
(see: BEObject->find(), to search not using content tree ).
If userid present, only objects with read permissione, if ' ' - guest/anonymous user,
if userid = null -> no permission check.
Filter: object types, search text query.
Descendants of id element (all elements in tree).
(see: BEObject->find(), to search not using content tree ).
If userid present, only objects with read permissione, if ' ' - guest/anonymous user,
if userid = null -> no permission check.
Filter: object types, search text query.
Parameters
- $id
- root id
- $userid
- user: null (default) => no permission check. ' ' => guest/anonymous user,
- $status
- object status
- $filter
Filter: object types, search text query, eg. array(21, 22, "search" => "text to search").
Default: all object types
- $order
- field to order result (id, status, modified..)
- $dir
- true (default), ascending, otherwiese descending.
- $page
- Page number (for pagination)
- $dim
- Page dim (for pagination)
- $excludeIds
- array of ids to exclude
Returns
array
|
public
array,
|
#
cloneStructure( integer $id, array $options = array() )
Clone a tree structure
Clone Publication and sections and add related contents
Clone a tree structure
Clone Publication and sections and add related contents
Parameters
- $id
- $id, publication/section id
- $options
- $options, see BEAppObjectModel::arrangeDataForClone()
Returns
array, contain couple of original id and cloned id
Throws
|
public
|
#
copyContentsToBranch( integer $originalBranchId, integer $newBranchId )
copy contents from a branch to another brnach
copy contents from a branch to another brnach
Parameters
- $originalBranchId
- $originalBranchId, branch (publication/section) id where the contents are
- $newBranchId
- $newBranchId, branch (publication/section) id where the contents have to be copied
Throws
|
public
array
|
#
countUbiquity( array $objects, array $options = array() )
Add to array of BEdita objects a count of ubiquity
Add to array of BEdita objects a count of ubiquity
Parameters
Returns
array
|
public
|
|
public
boolean
|
#
removeTree( integer $id )
Removes a full tree that originates from the element with passed $id .
This method is an alias of Tree::removeBranch() .
Removes a full tree that originates from the element with passed $id .
This method is an alias of Tree::removeBranch() .
Parameters
- $id
- ID of element to remove.
Returns
boolean
true if everything was ok, false otherwise.
Throws
BeditaException Throws an exception if attempting to remove a non-root element, a leaf (or a tree generated by an object that should be a leaf instead!), or an ubiquitous tree (?!).
See
Tree::removeBranch()
|
public
integer
|
#
countChildrenContents( integer $parentId, array $options = array() )
Count children using $options if any
$options can contain every params used to customize Model::find()
Count children using $options if any
$options can contain every params used to customize Model::find()
Parameters
- $parentId
- the parent id
- $options
Returns
integer
See
self::countChildren()
|
public
integer
|
#
countChildrenSections( integer $parentId, array $options = array() )
Count children using $options if any
$options can contain every params used to customize Model::find()
Count children using $options if any
$options can contain every params used to customize Model::find()
Parameters
- $parentId
- the parent id
- $options
Returns
integer
See
self::countChildren()
|
public
integer
|
#
countChildren( integer $parentId, array $options = array() )
Count children using $options if any
$options can contain every params used to customize Model::find()
Count children using $options if any
$options can contain every params used to customize Model::find()
Parameters
- $parentId
- the parent id
- $options
Returns
integer
|
public
array
|
#
findChildrenList( integer $parentId, boolean $descendants = false )
Return a list of children ids
Return a list of children ids
Parameters
- $parentId
- The parent id
- $descendants
- True to get all descendants, false to get just children
Returns
array
|