]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/subgroupnav.php
Widget automatically delegates unimplemented methods to attribute
[quix0rs-gnu-social.git] / lib / subgroupnav.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  *
5  * Local navigation for subscriptions group of pages
6  *
7  * PHP version 5
8  *
9  * LICENCE: This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU Affero General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Affero General Public License for more details.
18  *
19  * You should have received a copy of the GNU Affero General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  * @category  Subs
23  * @package   StatusNet
24  * @author    Evan Prodromou <evan@status.net>
25  * @copyright 2008-2011 StatusNet, Inc.
26  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
27  * @link      http://status.net/
28  */
29
30 if (!defined('STATUSNET') && !defined('LACONICA')) {
31     exit(1);
32 }
33
34 require_once INSTALLDIR.'/lib/widget.php';
35
36 /**
37  * Local nav menu for subscriptions, subscribers
38  *
39  * @category Subs
40  * @package  StatusNet
41  * @author   Evan Prodromou <evan@status.net>
42  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
43  * @link     http://status.net/
44  */
45
46 class SubGroupNav extends Menu
47 {
48     var $user = null;
49
50     /**
51      * Construction
52      *
53      * @param Action $action current action, used for output
54      */
55
56     function __construct($action=null, $user=null)
57     {
58         parent::__construct($action);
59         $this->user = $user;
60     }
61
62     /**
63      * Show the menu
64      *
65      * @return void
66      */
67
68     function show()
69     {
70         $cur = common_current_user();
71         $action = $this->action->trimmed('action');
72
73         $this->out->elementStart('ul', array('class' => 'nav'));
74
75         if (Event::handle('StartSubGroupNav', array($this))) {
76
77             $this->out->menuItem(common_local_url('showstream', array('nickname' =>
78                                                                       $this->user->nickname)),
79                                  _('Profile'),
80                                  (empty($profile)) ? $this->user->nickname : $profile->getBestName(),
81                                  $action == 'showstream',
82                                  'nav_profile');
83             $this->out->menuItem(common_local_url('subscriptions',
84                                                   array('nickname' =>
85                                                         $this->user->nickname)),
86                                  _('Subscriptions'),
87                                  sprintf(_('People %s subscribes to'),
88                                          $this->user->nickname),
89                                  $action == 'subscriptions',
90                                  'nav_subscriptions');
91             $this->out->menuItem(common_local_url('subscribers',
92                                                   array('nickname' =>
93                                                         $this->user->nickname)),
94                                  _('Subscribers'),
95                                  sprintf(_('People subscribed to %s'),
96                                          $this->user->nickname),
97                                  $action == 'subscribers',
98                                  'nav_subscribers');
99             $this->out->menuItem(common_local_url('usergroups',
100                                                   array('nickname' =>
101                                                         $this->user->nickname)),
102                                  _('Groups'),
103                                  sprintf(_('Groups %s is a member of'),
104                                          $this->user->nickname),
105                                  $action == 'usergroups',
106                                  'nav_usergroups');
107             if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
108                 $this->out->menuItem(common_local_url('invite'),
109                                      _('Invite'),
110                                      sprintf(_('Invite friends and colleagues to join you on %s'),
111                                              common_config('site', 'name')),
112                                      $action == 'invite',
113                                      'nav_invite');
114             }
115
116             Event::handle('EndSubGroupNav', array($this));
117         }
118
119         $this->out->elementEnd('ul');
120     }
121 }