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 = get_my_url();
74 $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
76 if(($a->module != 'home') && (! (local_user())))
77 $nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
80 if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
81 $nav['register'] = array('register',t('Register'), "", t('Create an account'));
83 $help_url = $a->get_baseurl($ssl_state) . '/help';
85 if(! get_config('system','hide_help'))
86 $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
89 $nav['apps'] = array('apps', t('Apps'), "", t('Addon applications, utilities, games'));
91 $nav['search'] = array('search', t('Search'), "", t('Search site content'));
93 $gdirpath = 'directory';
95 if(strlen(get_config('system','singleuser'))) {
96 $gdir = dirname(get_config('system','directory_submit_url'));
100 elseif(! get_config('system','no_community_page'))
101 $nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
103 $nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
107 * The following nav links are only show to logged in users
113 $nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
115 $nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
118 /* only show friend requests for normal pages. Other page types have automatic friendship. */
120 if($_SESSION['page_flags'] == PAGE_NORMAL) {
121 $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
122 $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
123 $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
124 $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
128 $nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
129 $nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox'));
130 $nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox'));
131 $nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message'));
133 if(is_array($a->identities) && count($a->identities) > 1) {
134 $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
137 $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
138 $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/edit profiles'));
139 $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
145 if (is_site_admin()){
146 $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
152 * Provide a banner/logo/whatever
156 $banner = get_config('system','banner');
158 if($banner === false)
159 $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>';
162 $tpl = get_markup_template('nav.tpl');
164 $a->page['nav'] .= replace_macros($tpl, array(
165 '$langselector' => lang_selector(),
166 '$sitelocation' => $sitelocation,
168 '$banner' => $banner,
169 '$emptynotifications' => t('Nothing new here'),
170 '$userinfo' => $userinfo,
171 '$sel' => $a->nav_sel,
175 call_hooks('page_header', $a->page['nav']);
179 * Set a menu item in navbar as selected
182 function nav_set_selected($item){
189 'introductions' => null,
190 'notifications' => null,
198 $a->nav_sel[$item] = 'selected';