- Timestamp:
- 04/26/10 17:08:58 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
plugins/apostrophePlugin/trunk/lib/navigation/aNavigationAccordion.class.php
r837 r1065 4 4 { 5 5 protected $cssClass = 'a-nav-item'; 6 public function buildNavigation()6 public function initializeTree() 7 7 { 8 $this->rootInfo = parent::$hash[$this->root]; 9 $this->activeInfo = parent::$hash[$this->active]; 10 if(isset($this->rootInfo['children'])) 8 if (sfConfig::get('app_a_many_pages', true)) 11 9 { 12 $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 13 17 } 14 18 else 15 19 { 16 $this->nav = $this->rootInfo['parent']['children'];20 parent::initializeTree(); 17 21 } 22 } 23 public function buildNavigation() 24 { 25 if (sfConfig::get('app_a_many_pages', true)) 26 { 27 $activePage = aPageTable::retrieveBySlug($this->active); 28 $this->activeInfo = $activePage->getInfo(); 29 $this->rootInfo = $activePage->getAccordionInfo(false, null, $this->root); 30 // This rootInfo is already an array of kids 31 $this->nav = $this->rootInfo; 32 } 33 else 34 { 35 $this->rootInfo = parent::$hash[$this->root]; 36 $this->activeInfo = parent::$hash[$this->active]; 37 // This rootInfo is an individual page info 38 $this->nav = $this->rootInfo['children']; 39 } 40 // We no longer try to special case the situation where the root page has no children, 41 // because the active page should always be a descendant of the root page, and it 42 // complicated the implementation 18 43 $this->traverse($this->nav); 19 44 } … … 26 51 $this->applyCSS($tree, $node); 27 52 28 if(!self::isAncestor($node, $this->activeInfo) && !($node['id'] == $this->activeInfo['id'])) 53 // This is redundant if we used getAccordionInfo, and it won't work because we 54 // never set activeInfo or the 'parent' pointers 55 if (!sfConfig::get('app_a_many_pages', true)) 29 56 { 30 unset($node['children']); 57 if(!self::isAncestor($node, $this->activeInfo) && !($node['id'] == $this->activeInfo['id'])) 58 { 59 unset($node['children']); 60 } 31 61 } 32 62

