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', 'title')
37 * Display login or logout
40 $nav['usermenu']=array();
44 $nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
47 $nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
48 $nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
49 $nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
50 $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
51 $nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
54 $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
56 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
57 'name' => $a->user['username'],
62 $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
67 * "Home" should also take you home from an authenticated remote profile connection
70 $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
72 if(($a->module != 'home') && (! (local_user())))
73 $nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
76 if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
77 $nav['register'] = array('register',t('Register'), "", t('Create an account'));
79 $help_url = $a->get_baseurl() . '/help';
81 if(! get_config('system','hide_help'))
82 $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
85 $nav['apps'] = array('apps', t('Apps'), "", t('Addon applications, utilities, games'));
87 $nav['search'] = array('search', t('Search'), "", t('Search site content'));
89 $gdirpath = 'directory';
91 if(strlen(get_config('system','singleuser'))) {
92 $gdir = dirname(get_config('system','directory_submit_url'));
96 elseif(! get_config('system','no_community_page'))
97 $nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
99 $nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
103 * The following nav links are only show to logged in users
109 $nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
111 $nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
114 /* only show friend requests for normal pages. Other page types have automatic friendship. */
116 if($_SESSION['page_flags'] == PAGE_NORMAL) {
117 $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
118 $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
122 $nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
124 if(is_array($a->identities) && count($a->identities) > 1) {
125 $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
128 $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
129 $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/edit profiles'));
130 $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
136 if (is_site_admin()){
137 $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
143 * Provide a banner/logo/whatever
147 $banner = get_config('system','banner');
149 if($banner === false)
150 $banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendika-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
153 $tpl = get_markup_template('nav.tpl');
155 $a->page['nav'] .= replace_macros($tpl, array(
156 '$langselector' => lang_selector(),
157 '$sitelocation' => $sitelocation,
159 '$banner' => $banner,
160 '$emptynotifications' => t('Nothing new here'),
161 '$userinfo' => $userinfo,
162 '$sel' => $a->nav_sel,
166 call_hooks('page_header', $a->page['nav']);
170 * Set a menu item in navbar as selected
173 function nav_set_selected($item){
180 'introductions' => null,
181 'notifications' => null,
189 $a->nav_sel[$item] = 'selected';