/** * DOCUMENT ME */ public static function treeTitlesOff() { aPageTable::treeSlotOff(); }
public function getChildren($livingOnly = true, $withSlot = 'title') { if ($this->childrenCache !== null) { if ($livingOnly === $this->childrenCacheLivingOnly && $this->childrenCacheSlot === $withSlot) { return $this->childrenCache; } } // TODO: consider whether it's possible to get the base query to // exclude archived children. That would result in multiple // calls to where(), but perhaps Doctrine can combine them for us. if ($withSlot !== false) { aPageTable::treeSlotOn($withSlot); } $children = $this->getNode()->getChildren(); if ($children === false) { $children = array(); } if ($withSlot !== false) { aPageTable::treeSlotOff(); } // Don't let Doctrine's clever reuse of objects prevent us from seeing // the results if we fetch a different slot this time... unless the child // is also the current page. In that case we assume that we have superior // data in the cache already (inclusive of all slots). Discarding that // was leading to disappearing data on emap $current = aTools::getCurrentPage(); foreach ($children as $child) { if ($current && $current->id === $child->id) { continue; } $child->clearSlotCache(); } if ($children !== false) { $living = array(); $dead = array(); foreach ($children as $child) { if ($child->admin) { // Never show admin pages in navigation continue; } if ($child->archived) { $dead[] = $child; } else { $living[] = $child; } } if ($livingOnly) { $children = $living; } else { $children = array_merge($living, $dead); } } else { $children = array(); } $this->childrenCache = $children; $this->childrenCacheLivingOnly = $livingOnly; $this->childrenCacheSlot = $withSlot; return $children; }