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['notifications'] = array('notifications', t('Notifications'), "", t('Friend requests'));
120 $nav['messages'] = array('message', t('Messages'), "", t('Private mail'));
122 if(is_array($a->identities) && count($a->identities) > 1) {
123 $nav['manage'] = array('manage', t('Manage'), "", t('Manage other pages'));
126 $nav['settings'] = array('settings', t('Settings'),"", t('Account settings'));
127 $nav['profiles'] = array('profiles', t('Profiles'),"", t('Manage/edit profiles'));
128 $nav['contacts'] = array('contacts', t('Contacts'),"", t('Manage/edit friends and contacts'));
134 if (is_site_admin()){
135 $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration'));
141 * Provide a banner/logo/whatever
145 $banner = get_config('system','banner');
147 if($banner === false)
148 $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>';
151 $tpl = get_markup_template('nav.tpl');
153 $a->page['nav'] .= replace_macros($tpl, array(
154 '$langselector' => lang_selector(),
155 '$sitelocation' => $sitelocation,
157 '$banner' => $banner,
158 '$emptynotifications' => t('Nothing new here'),
159 '$userinfo' => $userinfo,
160 '$sel' => $a->nav_sel,
164 call_hooks('page_header', $a->page['nav']);
168 * Set a menu item in navbar as selected
171 function nav_set_selected($item){
178 'notifications' => null,
184 $a->nav_sel[$item] = 'selected';