7 * Build page header and site navigation bars
11 $ssl_state = ((local_user()) ? true : false);
13 if(!(x($a->page,'nav')))
17 * Placeholder div for popup panel
20 $a->page['nav'] .= '<div id="panel" style="display: none;"></div>' ;
24 * Our network is distributed, and as you visit friends some of the
25 * sites look exactly the same - it isn't always easy to know where you are.
26 * Display the current site location as a navigation aid.
30 $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
32 $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
35 // nav links: array of array('href', 'text', 'extra css classes', 'title')
39 * Display login or logout
42 $nav['usermenu']=array();
46 $nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
49 $nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
50 $nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
51 $nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
52 $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
53 $nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
56 $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
58 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl($ssl_state)."/images/person-48.jpg"),
59 'name' => $a->user['username'],
64 $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
69 * "Home" should also take you home from an authenticated remote profile connection
72 $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
74 if(($a->module != 'home') && (! (local_user())))
75 $nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
78 if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
79 $nav['register'] = array('register',t('Register'), "", t('Create an account'));
81 $help_url = $a->get_baseurl($ssl_state) . '/help';
83 if(! get_config('system','hide_help'))
84 $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
87 $nav['apps'] = array('apps', t('Apps'), "", t('Addon applications, utilities, games'));
89 $nav['search'] = array('search', t('Search'), "", t('Search site content'));
91 $gdirpath = 'directory';
93 if(strlen(get_config('system','singleuser'))) {
94 $gdir = dirname(get_config('system','directory_submit_url'));
98 elseif(! get_config('system','no_community_page'))
99 $nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
101 $nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
105 * The following nav links are only show to logged in users
111 $nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
113 $nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
116 /* only show friend requests for normal pages. Other page types have automatic friendship. */
118 if($_SESSION['page_flags'] == PAGE_NORMAL) {
119 $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
120 $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
121 $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
122 $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
126 $nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
127 $nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox'));
128 $nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox'));
129 $nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message'));
131 if(is_array($a->identities) && count($a->identities) > 1) {
132 $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
135 $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
136 $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/edit profiles'));
137 $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
143 if (is_site_admin()){
144 $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
150 * Provide a banner/logo/whatever
154 $banner = get_config('system','banner');
156 if($banner === false)
157 $banner .= '<a href="http://friendica.com"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="http://friendica.com">Friendica</a></span>';
160 $tpl = get_markup_template('nav.tpl');
162 $a->page['nav'] .= replace_macros($tpl, array(
163 '$langselector' => lang_selector(),
164 '$sitelocation' => $sitelocation,
166 '$banner' => $banner,
167 '$emptynotifications' => t('Nothing new here'),
168 '$userinfo' => $userinfo,
169 '$sel' => $a->nav_sel,
173 call_hooks('page_header', $a->page['nav']);
177 * Set a menu item in navbar as selected
180 function nav_set_selected($item){
187 'introductions' => null,
188 'notifications' => null,
196 $a->nav_sel[$item] = 'selected';