|
28 | 28 | * @see http://en.wikipedia.org/wiki/Tree_traversal
|
29 | 29 | * @package cake
|
30 | 30 | * @subpackage cake.cake.libs.model.behaviors
|
| 31 | + * @link http://book.cakephp.org/view/1339/Tree |
31 | 32 | */
|
32 | 33 | class TreeBehavior extends ModelBehavior {
|
33 | 34 |
|
@@ -206,6 +207,7 @@ function beforeSave(&$Model) {
|
206 | 207 | * @param boolean $direct whether to count direct, or all, children
|
207 | 208 | * @return integer number of child nodes
|
208 | 209 | * @access public
|
| 210 | + * @link http://book.cakephp.org/view/1347/Counting-children |
209 | 211 | */
|
210 | 212 | function childcount(&$Model, $id = null, $direct = false) {
|
211 | 213 | if (is_array($id)) {
|
@@ -252,6 +254,7 @@ function childcount(&$Model, $id = null, $direct = false) {
|
252 | 254 | * @param integer $recursive The number of levels deep to fetch associated records
|
253 | 255 | * @return array Array of child nodes
|
254 | 256 | * @access public
|
| 257 | + * @link http://book.cakephp.org/view/1346/Children |
255 | 258 | */
|
256 | 259 | function children(&$Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) {
|
257 | 260 | if (is_array($id)) {
|
@@ -309,6 +312,7 @@ function children(&$Model, $id = null, $direct = false, $fields = null, $order =
|
309 | 312 | * @param integer $recursive The number of levels deep to fetch associated records
|
310 | 313 | * @return array An associative array of records, where the id is the key, and the display field is the value
|
311 | 314 | * @access public
|
| 315 | + * @link http://book.cakephp.org/view/1348/generatetreelist |
312 | 316 | */
|
313 | 317 | function generatetreelist(&$Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) {
|
314 | 318 | $overrideRecursive = $recursive;
|
@@ -364,6 +368,7 @@ function generatetreelist(&$Model, $conditions = null, $keyPath = null, $valuePa
|
364 | 368 | * @param integer $recursive The number of levels deep to fetch associated records
|
365 | 369 | * @return array Array of data for the parent node
|
366 | 370 | * @access public
|
| 371 | + * @link http://book.cakephp.org/view/1349/getparentnode |
367 | 372 | */
|
368 | 373 | function getparentnode(&$Model, $id = null, $fields = null, $recursive = null) {
|
369 | 374 | if (is_array($id)) {
|
@@ -397,6 +402,7 @@ function getparentnode(&$Model, $id = null, $fields = null, $recursive = null) {
|
397 | 402 | * @param integer $recursive The number of levels deep to fetch associated records
|
398 | 403 | * @return array Array of nodes from top most parent to current node
|
399 | 404 | * @access public
|
| 405 | + * @link http://book.cakephp.org/view/1350/getpath |
400 | 406 | */
|
401 | 407 | function getpath(&$Model, $id = null, $fields = null, $recursive = null) {
|
402 | 408 | if (is_array($id)) {
|
@@ -434,6 +440,7 @@ function getpath(&$Model, $id = null, $fields = null, $recursive = null) {
|
434 | 440 | * @param mixed $number how many places to move the node or true to move to last position
|
435 | 441 | * @return boolean true on success, false on failure
|
436 | 442 | * @access public
|
| 443 | + * @link http://book.cakephp.org/view/1352/moveDown |
437 | 444 | */
|
438 | 445 | function movedown(&$Model, $id = null, $number = 1) {
|
439 | 446 | if (is_array($id)) {
|
@@ -492,6 +499,7 @@ function movedown(&$Model, $id = null, $number = 1) {
|
492 | 499 | * @param mixed $number how many places to move the node, or true to move to first position
|
493 | 500 | * @return boolean true on success, false on failure
|
494 | 501 | * @access public
|
| 502 | + * @link http://book.cakephp.org/view/1353/moveUp |
495 | 503 | */
|
496 | 504 | function moveup(&$Model, $id = null, $number = 1) {
|
497 | 505 | if (is_array($id)) {
|
@@ -556,6 +564,7 @@ function moveup(&$Model, $id = null, $number = 1) {
|
556 | 564 | * delete, or the id of the parent to set as the parent_id
|
557 | 565 | * @return boolean true on success, false on failure
|
558 | 566 | * @access public
|
| 567 | + * @link http://book.cakephp.org/view/1628/Recover |
559 | 568 | */
|
560 | 569 | function recover(&$Model, $mode = 'parent', $missingParentAction = null) {
|
561 | 570 | if (is_array($mode)) {
|
@@ -634,6 +643,8 @@ function recover(&$Model, $mode = 'parent', $missingParentAction = null) {
|
634 | 643 | * @param AppModel $Model Model instance
|
635 | 644 | * @param array $options array of options to use in reordering.
|
636 | 645 | * @return boolean true on success, false on failure
|
| 646 | + * @link http://book.cakephp.org/view/1355/reorder |
| 647 | + * @link http://book.cakephp.org/view/1629/Reorder |
637 | 648 | */
|
638 | 649 | function reorder(&$Model, $options = array()) {
|
639 | 650 | $options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options);
|
@@ -673,6 +684,7 @@ function reorder(&$Model, $options = array()) {
|
673 | 684 | * @param boolean $delete whether to delete the node after reparenting children (if any)
|
674 | 685 | * @return boolean true on success, false on failure
|
675 | 686 | * @access public
|
| 687 | + * @link http://book.cakephp.org/view/1354/removeFromTree |
676 | 688 | */
|
677 | 689 | function removefromtree(&$Model, $id = null, $delete = false) {
|
678 | 690 | if (is_array($id)) {
|
@@ -741,6 +753,7 @@ function removefromtree(&$Model, $id = null, $delete = false) {
|
741 | 753 | * @return mixed true if the tree is valid or empty, otherwise an array of (error type [index, node],
|
742 | 754 | * [incorrect left/right index,node id], message)
|
743 | 755 | * @access public
|
| 756 | + * @link http://book.cakephp.org/view/1630/Verify |
744 | 757 | */
|
745 | 758 | function verify(&$Model) {
|
746 | 759 | extract($this->settings[$Model->alias]);
|
|
0 commit comments