7 * Build page header and site navigation bars
11 if(!(x($a->page,'nav')))
14 $a->page['htmlhead'] .= replace_macros(get_markup_template('nav_head.tpl'), array());
17 * Placeholder div for popup panel
20 $a->page['nav'] .= '<div id="panel" style="display: none;"></div>' ;
22 $nav_info = nav_info($a);
28 $tpl = get_markup_template('nav.tpl');
30 $a->page['nav'] .= replace_macros($tpl, array(
31 '$baseurl' => $a->get_baseurl(),
32 '$sitelocation' => $nav_info['sitelocation'],
33 '$nav' => $nav_info['nav'],
34 '$banner' => $nav_info['banner'],
35 '$emptynotifications' => t('Nothing new here'),
36 '$userinfo' => $nav_info['userinfo'],
37 '$sel' => $a->nav_sel,
39 '$clear_notifs' => t('Clear notifications'),
40 '$search_hint' => t('@name, !forum, #tags, content')
43 call_hooks('page_header', $a->page['nav']);
47 function nav_info(&$a) {
49 $ssl_state = ((local_user()) ? true : false);
53 * Our network is distributed, and as you visit friends some of the
54 * sites look exactly the same - it isn't always easy to know where you are.
55 * Display the current site location as a navigation aid.
59 $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
61 $sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
64 // nav links: array of array('href', 'text', 'extra css classes', 'title')
68 * Display login or logout
71 $nav['usermenu']=array();
75 $nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
78 $nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
79 $nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
80 $nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
81 $nav['usermenu'][] = Array('videos/' . $a->user['nickname'], t('Videos'), "", t('Your videos'));
82 $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
83 $nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal notes'));
86 $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
88 'icon' => (count($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg"),
89 'name' => $a->user['username'],
94 $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
99 * "Home" should also take you home from an authenticated remote profile connection
102 $homelink = get_my_url();
104 $homelink = ((x($_SESSION,'visitor_home')) ? $_SESSION['visitor_home'] : '');
106 if(($a->module != 'home') && (! (local_user())))
107 $nav['home'] = array($homelink, t('Home'), "", t('Home Page'));
110 if(($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user()))
111 $nav['register'] = array('register',t('Register'), "", t('Create an account'));
115 if(! get_config('system','hide_help'))
116 $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'));
118 if(count($a->apps)>0)
119 $nav['apps'] = array('apps', t('Apps'), "", t('Addon applications, utilities, games'));
121 if (local_user() OR !get_config('system','local_search')) {
122 $nav['search'] = array('search', t('Search'), "", t('Search site content'));
124 $nav['searchoption'] = array(
129 if (get_config('system','poco_local_search'))
130 $nav['searchoption'][] = t("Forums");
133 $gdirpath = 'directory';
135 if(strlen(get_config('system','singleuser'))) {
136 $gdir = get_config('system','directory');
140 elseif(get_config('system','community_page_style') == CP_USERS_ON_SERVER)
141 $nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
142 elseif(get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY)
143 $nav['community'] = array('community', t('Community'), "", t('Conversations on the network'));
146 $nav['events'] = Array('events', t('Events'), "", t('Events and Calendar'));
148 $nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
150 $nav['about'] = Array('friendica', t('Information'), "", t('Information about this friendica instance'));
154 * The following nav links are only show to logged in users
160 $nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
161 $nav['net_reset'] = array('network/0?f=&order=comment&nets=all', t('Network Reset'), "", t('Load Network page with no filters'));
163 $nav['home'] = array('profile/' . $a->user['nickname'], t('Home'), "", t('Your posts and conversations'));
165 if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE, PAGE_PRVGROUP))) {
166 /* only show friend requests for normal pages. Other page types have automatic friendship. */
167 if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_PRVGROUP)))
168 $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
170 if(in_array($_SESSION['page_flags'], array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) {
171 $nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
172 $nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
173 $nav['notifications']['mark'] = array('', t('Mark all system notifications seen'), '','');
177 $nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
178 $nav['messages']['inbox'] = array('message', t('Inbox'), "", t('Inbox'));
179 $nav['messages']['outbox']= array('message/sent', t('Outbox'), "", t('Outbox'));
180 $nav['messages']['new'] = array('message/new', t('New Message'), "", t('New Message'));
182 if(is_array($a->identities) && count($a->identities) > 1) {
183 $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
186 $nav['delegations'] = Array('delegate', t('Delegations'), "", t('Delegate Page Management'));
188 $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
190 if(feature_enabled(local_user(),'multi_profiles'))
191 $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/Edit Profiles'));
193 $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
199 if (is_site_admin()){
200 $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
204 $nav['navigation'] = array('navigation/', t('Navigation'), "", t('Site map'));
209 * Provide a banner/logo/whatever
213 $banner = get_config('system','banner');
215 if($banner === false)
216 $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>';
218 call_hooks('nav_info', $nav);
222 'sitelocation' => $sitelocation,
225 'userinfo' => $userinfo,
231 * Set a menu item in navbar as selected
234 function nav_set_selected($item){
241 'introductions' => null,
242 'notifications' => null,
251 $a->nav_sel[$item] = 'selected';