Changeset 389 for branches/1.1dev
- Timestamp:
- Oct 6, 2011 3:08:37 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/Nav.inc.php
r1 r389 56 56 $this->pages[] = array( 57 57 'title' => $title, 58 'url' => $url,58 'url' => is_null($url) ? $_SERVER['PHP_SELF'] : $url, 59 59 'features' => (isset($features) && is_array($features)) ? array_merge($this->default_features, $features) : $this->default_features 60 60 ); 61 } 62 63 /** 64 * Update the title, url, and features for the current page (the last added). 65 * 66 * @access public 67 * 68 * @param string $title The title of the page. 69 * @param string $url The URL to the page. Leave blank (or null) if 70 * page is to not be linked. 71 * @param array $features Set the features of the current page. 72 */ 73 function updatePage($title, $url=null, $features=null) 74 { 75 if (isset($title)) { 76 $this->pages[sizeof($this->pages)-1]['title'] = $title; 77 } 78 if (isset($url)) { 79 $this->pages[sizeof($this->pages)-1]['url'] = $url; 80 } 81 if (isset($features) && is_array($features)) { 82 $this->pages[sizeof($this->pages)-1]['features'] = array_merge($this->pages[sizeof($this->pages)-1]['features'], $features); 83 } 61 84 } 62 85 … … 78 101 } 79 102 103 if (!isset($this->pages[sizeof($this->pages)-1]['features']) || !isset($this->pages[$page_id]['features'])) { 104 $app->logMsg(sprintf('Page not available to set feature: page_id = %s', $page_id), LOG_ERR, __FILE__, __LINE__); 105 return false; 106 } 107 80 108 if (isset($features) && is_array($features)) { 81 109 // Set features for specified page. 110 $this->pages[$page_id]['features'] = array_merge($this->pages[$page_id]['features'], $features); 111 // Store "current page" features. 82 112 $this->pages[sizeof($this->pages)-1]['features'] = array_merge($this->pages[sizeof($this->pages)-1]['features'], $features); 83 // Store "current page" features.84 $this->pages[$page_id]['features'] = array_merge($this->pages[$page_id]['features'], $features);85 113 } 86 114 }
Note: See TracChangeset
for help on using the changeset viewer.