Changeset 680 for branches/1.1dev/lib


Ignore:
Timestamp:
May 18, 2019 1:32:39 AM (5 years ago)
Author:
anonymous
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/Nav.inc.php

    r389 r680  
    33 * The Nav:: class provides a system for working with navigation elements.
    44 * 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
    66 * some pages but not others.
    77 *
     
    7474    {
    7575        if (isset($title)) {
    76             $this->pages[sizeof($this->pages)-1]['title'] = $title;           
     76            $this->pages[sizeof($this->pages)-1]['title'] = $title;
    7777        }
    7878        if (isset($url)) {
    79             $this->pages[sizeof($this->pages)-1]['url'] = $url;           
     79            $this->pages[sizeof($this->pages)-1]['url'] = $url;
    8080        }
    8181        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
    8686    /**
    8787     * Set the features of the current page. Future versions of this class
     
    100100            $page_id = sizeof($this->pages) + intval($page_id);
    101101        }
    102        
     102
    103103        if (!isset($this->pages[sizeof($this->pages)-1]['features']) || !isset($this->pages[$page_id]['features'])) {
    104104            $app->logMsg(sprintf('Page not available to set feature: page_id = %s', $page_id), LOG_ERR, __FILE__, __LINE__);
    105105            return false;
    106106        }
    107        
     107
    108108        if (isset($features) && is_array($features)) {
    109109            // Set features for specified page.
     
    128128 * OUTPUT
    129129 *****************************************************************************/
    130  
     130
    131131    /**
    132132     * Get the value of a feature for specified page_id or current page if page_id not specified (future use).
     
    144144            $page_id = sizeof($this->pages) + intval($page_id);
    145145        }
    146        
     146
    147147        switch ($feature) {
    148148        case 'breadcrumbs' :
    149149            // 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);
    152151        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
    158157    /**
    159158     * Returns the title of current page.
     
    170169            $page_id = sizeof($this->pages) + intval($page_id);
    171170        }
    172        
     171
    173172        if ($this->getFeature('title', $page_id)) {
    174173            return oTxt($this->pages[$page_id]['title'], true);
     
    203202            $page_id = sizeof($this->pages) + intval($page_id);
    204203        }
    205        
     204
    206205        if ($this->getFeature('path', $page_id)) {
    207206            $path = '';
     
    246245            $page_id = sizeof($this->pages) + intval($page_id);
    247246        }
    248        
     247
    249248        if ($this->getFeature('breadcrumbs')) {
    250249            $breadcrumbs = '';
     
    276275                $pathmark = $this->path_delimiter;
    277276                $crumb_count--;
    278                
     277
    279278                if ($curr_id === $page_id) {
    280279                    // Reached requested page.
     
    297296        echo $this->getBreadcrumbs($page_id);
    298297    }
    299    
     298
    300299    /**
    301300     * Returns a string if the queried page is the current page. One use is to print
     
    316315        }
    317316    }
    318    
    319 } 
     317
     318}
    320319// End of class.
    321320
Note: See TracChangeset for help on using the changeset viewer.