[limb-svn] r6978 - 3.x/trunk/limb/tree/src

svn at limb-project.com svn at limb-project.com
Wed Apr 30 18:45:48 MSD 2008


Author: serega
Date: 2008-04-30 18:45:48 +0400 (Wed, 30 Apr 2008)
New Revision: 6978
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6978

Modified:
   3.x/trunk/limb/tree/src/lmbTreeNestedCollection.class.php
Log:
-- configurable children_field added

Modified: 3.x/trunk/limb/tree/src/lmbTreeNestedCollection.class.php
===================================================================
--- 3.x/trunk/limb/tree/src/lmbTreeNestedCollection.class.php	2008-04-29 14:07:16 UTC (rev 6977)
+++ 3.x/trunk/limb/tree/src/lmbTreeNestedCollection.class.php	2008-04-30 14:45:48 UTC (rev 6978)
@@ -18,7 +18,8 @@
 {
   protected $node_field = 'id';
   protected $parent_field = 'parent_id';
-
+  protected $children_field = 'children';
+  
   function setNodeField($name)
   {
     $this->node_field = $name;
@@ -29,6 +30,11 @@
     $this->parent_field = $name;
   }
 
+  function setChildrenField($name)
+  {
+    $this->children_field = $name;
+  }
+  
   function rewind()
   {
     parent :: rewind();
@@ -68,7 +74,7 @@
         $children = array();
         $pos = sizeof($nested_array) - 1;
         self :: _doMakeNested($rs, $children, $prev_item_id, $level + 1);
-        $nested_array[$pos]['children'] = $children;
+        $nested_array[$pos][$this->children_field] = $children;
       }
       else
         return;



More information about the limb-svn mailing list