X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fpersonalgroupnav.php;h=d379dcf5281d94885c08d287c5de3969a6067a62;hb=14fe22e4307044f2eb08264a7b83f9c2de245dba;hp=d72a8656775ab43be795fcfa3efad5cc95d27ab9;hpb=a64c6c501555bc70ef617ecb8c4a21b6e1f91518;p=quix0rs-gnu-social.git diff --git a/lib/personalgroupnav.php b/lib/personalgroupnav.php index d72a865677..d379dcf528 100644 --- a/lib/personalgroupnav.php +++ b/lib/personalgroupnav.php @@ -43,7 +43,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class PersonalGroupNav extends Menu { /** @@ -53,41 +52,57 @@ class PersonalGroupNav extends Menu */ function show() { - $user = null; + $user = common_current_user(); - // FIXME: we should probably pass this in + if (empty($user)) { + throw new ServerException('Cannot show personal group navigation without a current user.'); + } - $action = $this->action->trimmed('action'); - $nickname = $this->action->trimmed('nickname'); + $user_profile = $user->getProfile(); + $nickname = $user->nickname; + $name = $user_profile->getBestName(); - if ($nickname) { - $user = User::staticGet('nickname', $nickname); - $user_profile = $user->getProfile(); - $name = $user_profile->getBestName(); - } else { - // @fixme can this happen? is this valid? - $user_profile = false; - $name = $nickname; - } + $action = $this->actionName; + $mine = ($this->action->arg('nickname') == $nickname); // @fixme kinda vague $this->out->elementStart('ul', array('class' => 'nav')); if (Event::handle('StartPersonalGroupNav', array($this))) { $this->out->menuItem(common_local_url('all', array('nickname' => $nickname)), - _('Home'), + // TRANS: Menu item in personal group navigation menu. + _m('MENU','Home'), + // TRANS: Menu item title in personal group navigation menu. + // TRANS: %s is a username. sprintf(_('%s and friends'), $name), - $action == 'all', 'nav_timeline_personal'); + $mine && $action =='all', 'nav_timeline_personal'); + $this->out->menuItem(common_local_url('showstream', array('nickname' => + $nickname)), + // TRANS: Menu item in personal group navigation menu. + _m('MENU','Profile'), + // TRANS: Menu item title in personal group navigation menu. + _('Your profile'), + $mine && $action =='showstream', + 'nav_profile'); $this->out->menuItem(common_local_url('replies', array('nickname' => $nickname)), - _('Replies'), + // TRANS: Menu item in personal group navigation menu. + _m('MENU','Replies'), + // TRANS: Menu item title in personal group navigation menu. + // TRANS: %s is a username. sprintf(_('Replies to %s'), $name), - $action == 'replies', 'nav_timeline_replies'); + $mine && $action =='replies', 'nav_timeline_replies'); $this->out->menuItem(common_local_url('showfavorites', array('nickname' => $nickname)), - _('Favorites'), - sprintf(_('%s\'s favorite notices'), ($user_profile) ? $name : _('User')), - $action == 'showfavorites', 'nav_timeline_favorites'); + // TRANS: Menu item in personal group navigation menu. + _m('MENU','Favorites'), + // @todo i18n FIXME: Need to make this two messages. + // TRANS: Menu item title in personal group navigation menu. + // TRANS: %s is a username. + sprintf(_('%s\'s favorite notices'), + // TRANS: Replaces %s in '%s\'s favorite notices'. (Yes, we know we need to fix this.) + ($user_profile) ? $name : _m('FIXME','User')), + $mine && $action =='showfavorites', 'nav_timeline_favorites'); $cur = common_current_user(); @@ -96,15 +111,13 @@ class PersonalGroupNav extends Menu $this->out->menuItem(common_local_url('inbox', array('nickname' => $nickname)), - _('Inbox'), + // TRANS: Menu item in personal group navigation menu. + _m('MENU','Messages'), + // TRANS: Menu item title in personal group navigation menu. _('Your incoming messages'), - $action == 'inbox'); - $this->out->menuItem(common_local_url('outbox', array('nickname' => - $nickname)), - _('Outbox'), - _('Your sent messages'), - $action == 'outbox'); + $mine && $action =='inbox'); } + Event::handle('EndPersonalGroupNav', array($this)); } $this->out->elementEnd('ul');