X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fnav.php;h=5c24df51e20558b7f12425105b8f3848f8b75f55;hb=1aba538c96628468b84136386496ccc69050e810;hp=f7c5c4e01d2e3a0a47c042c5e29c655e1251ba3f;hpb=961a0c13c7fb257f356b9a67b1b0f3dd32bfc80c;p=friendica.git diff --git a/include/nav.php b/include/nav.php index f7c5c4e01d..5c24df51e2 100644 --- a/include/nav.php +++ b/include/nav.php @@ -1,61 +1,188 @@ page,'nav'))) + $a->page['nav'] = ''; + + /** + * Placeholder div for popup panel + */ + $a->page['nav'] .= '
' ; + /** + * + * Our network is distributed, and as you visit friends some of the + * sites look exactly the same - it isn't always easy to know where you are. + * Display the current site location as a navigation aid. + * + */ + + $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); + + $sitelocation = $myident . substr($a->get_baseurl(),strpos($a->get_baseurl(),'//') + 2 ); + + + // nav links: array of array('href', 'text', 'extra css classes', 'title') + $nav = Array(); + + /** + * Display login or logout + */ + + $nav['usermenu']=array(); + $userinfo = null; + if(local_user()) { - $a->page['nav'] .= '' . t('Logout') . "\r\n"; + $nav['logout'] = Array('logout',t('Logout'), "", t('End this session')); + + // user menu + $nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations')); + $nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page')); + $nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos')); + $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events')); + $nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos')); + + // user info + $r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid'])); + $userinfo = array( + 'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"), + 'name' => $a->user['username'], + ); + } else { - $a->page['nav'] .= '' . t('Login') . "\r\n"; + $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in')); } - $a->page['nav'] .= " \r\n\r\n"; + /** + * Admin page + */ + if (is_site_admin()){ + $nav['admin'] = array('admin/', t('Admin'), "", t('Site setup and configuration')); + } - $banner = get_config('system','banner'); + /** + * + * Provide a banner/logo/whatever + * + */ - if($banner === false) - $banner .= 'Friendika'; - + $banner = get_config('system','banner'); - $a->page['nav'] .= ' '; + if($banner === false) + $banner .= 'Friendika'; + + + $tpl = get_markup_template('nav.tpl'); + + $a->page['nav'] .= replace_macros($tpl, array( + '$langselector' => lang_selector(), + '$sitelocation' => $sitelocation, + '$nav' => $nav, + '$banner' => $banner, + '$emptynotifications' => t('Nothing new here'), + '$userinfo' => $userinfo, + '$sel' => $a->nav_sel, + '$apps' => $a->apps, + )); + + call_hooks('page_header', $a->page['nav']); +} + +/* + * Set a menu item in navbar as selected + * + */ +function nav_set_selected($item){ + $a = get_app(); + $a->nav_sel = array( + 'community' => null, + 'network' => null, + 'home' => null, + 'profiles' => null, + 'introductions' => null, + 'notifications' => null, + 'messages' => null, + 'directory' => null, + 'settings' => null, + 'contacts' => null, + ); + $a->nav_sel[$item] = 'selected'; +}