Changeset 680 for branches/1.1dev/lib
- Timestamp:
- May 18, 2019 1:32:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1dev/lib/Nav.inc.php
r389 r680 3 3 * The Nav:: class provides a system for working with navigation elements. 4 4 * Currently it supports storing page titles and URLs for printing breadcrumbs 5 * and titles, as well as setting page features such as hiding the page title on 5 * and titles, as well as setting page features such as hiding the page title on 6 6 * some pages but not others. 7 7 * … … 74 74 { 75 75 if (isset($title)) { 76 $this->pages[sizeof($this->pages)-1]['title'] = $title; 76 $this->pages[sizeof($this->pages)-1]['title'] = $title; 77 77 } 78 78 if (isset($url)) { 79 $this->pages[sizeof($this->pages)-1]['url'] = $url; 79 $this->pages[sizeof($this->pages)-1]['url'] = $url; 80 80 } 81 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 } 84 } 85 82 $this->pages[sizeof($this->pages)-1]['features'] = array_merge($this->pages[sizeof($this->pages)-1]['features'], $features); 83 } 84 } 85 86 86 /** 87 87 * Set the features of the current page. Future versions of this class … … 100 100 $page_id = sizeof($this->pages) + intval($page_id); 101 101 } 102 102 103 103 if (!isset($this->pages[sizeof($this->pages)-1]['features']) || !isset($this->pages[$page_id]['features'])) { 104 104 $app->logMsg(sprintf('Page not available to set feature: page_id = %s', $page_id), LOG_ERR, __FILE__, __LINE__); 105 105 return false; 106 106 } 107 107 108 108 if (isset($features) && is_array($features)) { 109 109 // Set features for specified page. … … 128 128 * OUTPUT 129 129 *****************************************************************************/ 130 130 131 131 /** 132 132 * Get the value of a feature for specified page_id or current page if page_id not specified (future use). … … 144 144 $page_id = sizeof($this->pages) + intval($page_id); 145 145 } 146 146 147 147 switch ($feature) { 148 148 case 'breadcrumbs' : 149 149 // No breadcrumbs if displayed quantity of crumbs is less than 1. 150 return $this->pages[$page_id]['features'][$feature] && ((sizeof($this->pages) - $this->getFeature('chop_breadcrumbs')) > 0); 151 break; 150 return isset($this->pages[$page_id]['features'][$feature]) && $this->pages[$page_id]['features'][$feature] && ((sizeof($this->pages) - $this->getFeature('chop_breadcrumbs')) > 0); 152 151 default : 153 return $this->pages[$page_id]['features'][$feature];154 } 155 } 156 157 152 return isset($this->pages[$page_id]['features'][$feature]) ? $this->pages[$page_id]['features'][$feature] : ''; 153 } 154 } 155 156 158 157 /** 159 158 * Returns the title of current page. … … 170 169 $page_id = sizeof($this->pages) + intval($page_id); 171 170 } 172 171 173 172 if ($this->getFeature('title', $page_id)) { 174 173 return oTxt($this->pages[$page_id]['title'], true); … … 203 202 $page_id = sizeof($this->pages) + intval($page_id); 204 203 } 205 204 206 205 if ($this->getFeature('path', $page_id)) { 207 206 $path = ''; … … 246 245 $page_id = sizeof($this->pages) + intval($page_id); 247 246 } 248 247 249 248 if ($this->getFeature('breadcrumbs')) { 250 249 $breadcrumbs = ''; … … 276 275 $pathmark = $this->path_delimiter; 277 276 $crumb_count--; 278 277 279 278 if ($curr_id === $page_id) { 280 279 // Reached requested page. … … 297 296 echo $this->getBreadcrumbs($page_id); 298 297 } 299 298 300 299 /** 301 300 * Returns a string if the queried page is the current page. One use is to print … … 316 315 } 317 316 } 318 319 } 317 318 } 320 319 // End of class. 321 320
Note: See TracChangeset
for help on using the changeset viewer.