Example #1
0
 /** Split off a subtree of rows as a new soo_nested_set object
  *  @param root id of subtree root node
  *  @return soo_txp_rowset
  */
 public function subtree($root, $index = null)
 {
     $out = new self();
     $root = $this->rows[$root];
     foreach ($this->rows as $row) {
         if ($row->lft >= $root->lft and $row->rgt <= $root->rgt) {
             $out->add_row($row, null, is_null($index) ? null : $row->{$index});
         }
     }
     return $out;
 }