コード例 #1
0
ファイル: Node.php プロジェクト: bluem/tree
 /**
  * Returns any node above (parent, grandparent, ...) this node
  *
  * The array returned from this method will include the root node. If you
  * do not want the root node, you should do an array_pop() on the array.
  *
  * Note: The argument is deprecated and will be removed in version 2; please use
  * getAncestorsAndSelf() instead. Also, in version 2 the root node will not be
  * included, as this is hardly ever necessary; you can prepare your code already
  * now by using constant Tree::API to check whether removing the root node is
  * necessary.
  *
  * @param bool $includeSelf [optional] Whether to include the node itself.
  *
  * @return Node[] Indexed array of nodes, sorted from the nearest
  *                one (or self) to the most remote one
  */
 public function getAncestors($includeSelf = false)
 {
     $ancestors = $includeSelf ? array($this) : array();
     if (null === $this->parent) {
         return $ancestors;
     }
     return array_merge($ancestors, $this->parent->getAncestors(true));
 }
コード例 #2
0
 public function __construct($iDatabaseID, $iParentID, $sAccountNumber, $sAccountName, $sAccountNameSlug, $bHideUi, $bIsDebit, $bIsCredit)
 {
     parent::__construct(array('id' => $iDatabaseID, 'parent' => $iParentID, 'sAccountName' => $sAccountName, 'sAccountNameSlug' => $sAccountNameSlug, 'sAccountNumber' => $sAccountNumber, 'bHideUI' => $bHideUi, 'bFrozen' => false, 'fBalance' => 0.0, 'bIsDebit' => $bIsDebit, 'bIsCredit' => $bIsCredit));
 }