| 14 | | $this->nav = $this->rootInfo['children']; |
| | 10 | // The use of the static sitewide page tree |
| | 11 | // requires too much memory on sites with more |
| | 12 | // than about 500-1000 pages. On smaller sites |
| | 13 | // it turns out to be a performance win to get |
| | 14 | // all of the page information for the site and |
| | 15 | // cache it for subsequent navigation elements on |
| | 16 | // the same page, which the base class does for us |
| | 22 | } |
| | 23 | |
| | 24 | public function buildNavigation() |
| | 25 | { |
| | 26 | if (sfConfig::get('app_a_many_pages', true)) |
| | 27 | { |
| | 28 | $activePage = aPageTable::retrieveBySlug($this->active); |
| | 29 | $this->activeInfo = $activePage->getInfo(); |
| | 30 | |
| | 31 | $rootPage = aPageTable::retrieveBySlug($this->root); |
| | 32 | $this->rootInfo = $rootPage->getTreeInfo(false, $this->options['depth']); |
| | 33 | // If no kids... |
| | 34 | if (!count($this->rootInfo)) |
| | 35 | { |
| | 36 | // Try the parent |
| | 37 | $rootPage = $rootPage->getParent(); |
| | 38 | if (!$rootPage) |
| | 39 | { |
| | 40 | // Parent does not exist - this is the home page and there are no subpages |
| | 41 | // (unlikely in practice due to admin pages) |
| | 42 | $this->rootInfo = array(); |
| | 43 | } |
| | 44 | else |
| | 45 | { |
| | 46 | // Parent does exist, use its kids |
| | 47 | $this->rootInfo = $rootPage->getTreeInfo(false, $this->options['depth']); |
| | 48 | } |
| | 49 | } |
| | 50 | $this->nav = $this->rootInfo; |
| | 51 | } |
| | 52 | else |
| | 53 | { |
| | 54 | $this->rootInfo = parent::$hash[$this->root]; |
| | 55 | $this->activeInfo = parent::$hash[$this->active]; |
| | 56 | if(isset($this->rootInfo['children'])) |
| | 57 | { |
| | 58 | $this->nav = $this->rootInfo['children']; |
| | 59 | } |
| | 60 | else |
| | 61 | { |
| | 62 | if (!isset($this->rootInfo['parent'])) |
| | 63 | { |
| | 64 | // A site root with no children |
| | 65 | $this->nav = array(); |
| | 66 | } |
| | 67 | else |
| | 68 | { |
| | 69 | $this->nav = $this->rootInfo['parent']['children']; |
| | 70 | } |
| | 71 | } |
| | 72 | } |
| | 73 | $this->depth = $this->options['depth']; |
| | 74 | |