7 * Build page header and site navigation bars
11 if(!(x($a->page,'nav')))
15 * Placeholder div for popup panel
18 $a->page['nav'] .= '<div id="panel" style="display: none;"></div>' ;
22 * Our network is distributed, and as you visit friends some of the
23 * sites look exactly the same - it isn't always easy to know where you are.
24 * Display the current site location as a navigation aid.
28 $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
30 $sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 );
33 // nav links: array of array('href', 'text', 'extra css classes')
37 * Display login or logout
41 $nav['logout'] = Array('logout',t('Logout'), "");
44 $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'nav-selected':''));
49 * "Home" should also take you home from an authenticated remote profile connection
52 $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
54 if(($a->module != 'home') && (! (local_user())))
55 $nav['home'] = array($homelink, t('Home'), "");
58 if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
59 $nav['register'] = array('register',t('Register'), "");
61 $help_url = $a->get_baseurl() . '/help';
63 if(! get_config('system','hide-help'))
64 $nav['help'] = array($help_url, t('Help'), "");
67 if(strlen($a->apps)) {
68 $nav['apps'] = array('apps', t('Apps'), "");
71 $nav['search'] = array('search', t('Search'), "");
73 $gdirpath = 'directory';
75 if(strlen(get_config('system','singleuser'))) {
76 $gdir = dirname(get_config('system','directory_submit_url'));
81 $nav['directory'] = array($gdirpath, t('Directory'), "");
85 * The following nav links are only show to logged in users
91 $nav['network'] = array('network', t('Network'), "");
93 $nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "");
96 /* only show friend requests for normal pages. Other page types have automatic friendship. */
98 if($_SESSION['page_flags'] == PAGE_NORMAL) {
99 $nav['notifications'] = array('notifications', t('Notifications'), "");
102 $nav['messages'] = array('message', t('Messages'), "");
104 if(is_array($a->identities) && count($a->identities) > 1) {
105 $nav['manage'] = array('manage', t('Manage'), "");
108 $nav['settings'] = array('settings', t('Settings'),"");
109 $nav['profiles'] = array('profiles', t('Profiles'),"");
110 $nav['contacts'] = array('contacts', t('Contacts'),"");
118 * Provide a banner/logo/whatever
122 $banner = get_config('system','banner');
124 if($banner === false)
125 $banner .= '<a href="http://project.friendika.com"><img id="logo-img" src="images/friendika-32.png" alt="logo" /></a><span id="logo-text"><a href="http://project.friendika.com">Friendika</a></span>';
128 $tpl = load_view_file('view/nav.tpl');
130 $a->page['nav'] .= replace_macros($tpl, array(
131 '$langselector' => lang_selector(),
132 '$sitelocation' => $sitelocation,
134 '$banner' => $banner,
137 call_hooks('page_header', $a->page['nav']);