Example #1
0
 public function __construct(Page $oMe, $oParent = null)
 {
     $this->oMe = $oMe;
     $this->bIsCurrent = null;
     if ($oParent === null && !$oMe->isRoot()) {
         $oParent = self::navigationItemForPage($oMe->getParent());
     }
     parent::__construct($oParent);
 }
Example #2
0
 /**
  * Moves current node and its subtree to be the next sibling of $sibling
  * The modifications in the current object and the tree are immediate
  *
  * @param      Page $sibling	Propel object for sibling node
  * @param      PropelPDO $con	Connection to use.
  *
  * @return     Page The current Propel object
  */
 public function moveToNextSiblingOf($sibling, PropelPDO $con = null)
 {
     if (!$this->isInTree()) {
         throw new PropelException('A Page object must be already in the tree to be moved. Use the insertAsNextSiblingOf() instead.');
     }
     if ($sibling->isRoot()) {
         throw new PropelException('Cannot move to next sibling of a root node.');
     }
     if ($sibling->isDescendantOf($this)) {
         throw new PropelException('Cannot move a node as sibling of one of its subtree nodes.');
     }
     $this->moveSubtreeTo($sibling->getRightValue() + 1, $sibling->getLevel() - $this->getLevel(), $con);
     return $this;
 }
Example #3
0
 /**
  * Filter the query to restrict the result to siblings of an object.
  * The result does not include the object passed as parameter.
  *
  * @param     Page $page The object to use for sibling search
  * @param      PropelPDO $con Connection to use.
  *
  * @return    PageQuery The current query, for fluid interface
  */
 public function siblingsOf($page, PropelPDO $con = null)
 {
     if ($page->isRoot()) {
         return $this->add(PagePeer::LEVEL_COL, '1<>1', Criteria::CUSTOM);
     } else {
         return $this->childrenOf($page->getParent($con))->prune($page);
     }
 }