cvs: pear /Tree Common.php
| From: | Wolfram Kriesing | Date: | Mon, 19 Aug 2002 19:16:27 +0000 |
| Subject: | cvs: pear /Tree Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5815@lists.php.net to get a copy of this message | ||
cain Mon Aug 19 15:16:27 2002 EDT
Modified files:
/pear/Tree Common.php
Log:
- added method 'getParents'
Index: pear/Tree/Common.php
diff -u pear/Tree/Common.php:1.8 pear/Tree/Common.php:1.9
--- pear/Tree/Common.php:1.8 Fri Jul 26 06:35:47 2002
+++ pear/Tree/Common.php Mon Aug 19 15:16:27 2002
@@ -16,7 +16,7 @@
// | Authors: Wolfram Kriesing <wolfram@kriesing.de> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.8 2002/07/26 10:35:47 cain Exp $
+// $Id: Common.php,v 1.9 2002/08/19 19:16:27 cain Exp $
require_once('Tree/OptionsDB.php');
@@ -98,6 +98,25 @@
$parent = $this->getParent( $id );
return $parent['id'];
}
+
+ /**
+ * this gets all the preceeding nodes, the parent and it's parent and so on
+ *
+ * @version 2002/08/19
+ * @access public
+ * @author Wolfram Kriesing <wolfram@kriesing.de>
+ * @param integer $id the id of the element for which the parentId shall be retreived
+ * @return array of the parent nodes including the node with id $id
+ */
+ function getParents( $id )
+ {
+ $path = $this->getPath($id);
+ $parents = array();
+ foreach( $path as $aNode )
+ $parents[] = $aNode;
+ return $parents;
+ }
+
/**
*