DB_NestedSet::moveTree
DB_NestedSet::moveTree() – Wrapper for node moving and copying
Synopsis
require_once 'DB/NestedSet.php';
int
DB_NestedSet::moveTree
(
int
$id
,
$targetid
,
constant
$pos
,
bool
$copy
= false
,
int
$target
)
Описание
This package is not documented yet.
Parameter
-
integer
$id
-
Source ID
-
$targetid
-
Target ID
-
constant
$pos
-
Position (use one of the NESE_MOVE_* constants)
-
boolean
$copy
-
Shall we create a copy
-
integer
$target
-
Target ID
Return value
returns ID of the moved node or false on error
See
see _moveInsideLevel
see _moveRoot2Root
see _moveAcross
Throws
throws no exceptions thrown
Замечание
This function can not be called statically.
Пример
Get SubBranch
<?php
require_once('DB/NestedSet.php');
$nestedSet =& DB_NestedSet::factory('DB', $dsn, $params);
$parent = $nestedSet->createRootNode(array('name' => 'root-node'), false, true);
$parent2 = $nestedSet->createSubNode($parent, array('name' => 'sub-node));
$parent3 = $nestedSet->createSubNode($parent2, array('name' => 'sub-node));
$nestedSet->createSubNode($parent3, array('name' => 'sub1'));
$node = $nestedSet->createSubNode($parent3, array('name' => 'sub2'));
$nestedSet->moveTree($node, $parent, NESE_MOVE_AFTER);
?>