]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/groupnav.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / lib / groupnav.php
1 <?php
2 /**
3  * StatusNet, the distributed open-source microblogging tool
4  *
5  * Tabset for a particular group
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  Action
23  * @package   StatusNet
24  * @author    Evan Prodromou <evan@status.net>
25  * @author    Sarven Capadisli <csarven@status.net>
26  * @copyright 2008 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET') && !defined('LACONICA')) {
32     exit(1);
33 }
34
35 require_once INSTALLDIR.'/lib/widget.php';
36
37 /**
38  * Tabset for a group
39  *
40  * Shows a group of tabs for a particular user group
41  *
42  * @category Output
43  * @package  StatusNet
44  * @author   Evan Prodromou <evan@status.net>
45  * @author   Sarven Capadisli <csarven@status.net>
46  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
47  * @link     http://status.net/
48  *
49  * @see      HTMLOutputter
50  */
51
52 class GroupNav extends Widget
53 {
54     var $action = null;
55     var $group = null;
56
57     /**
58      * Construction
59      *
60      * @param Action $action current action, used for output
61      */
62
63     function __construct($action=null, $group=null)
64     {
65         parent::__construct($action);
66         $this->action = $action;
67         $this->group = $group;
68     }
69
70     /**
71      * Show the menu
72      *
73      * @return void
74      */
75
76     function show()
77     {
78         $action_name = $this->action->trimmed('action');
79         $nickname = $this->group->nickname;
80
81         $this->out->elementStart('ul', array('class' => 'nav'));
82         if (Event::handle('StartGroupGroupNav', array($this))) {
83             $this->out->menuItem(common_local_url('showgroup', array('nickname' =>
84                                                                      $nickname)),
85                                  _('Group'),
86                                  sprintf(_('%s group'), $nickname),
87                                  $action_name == 'showgroup',
88                                  'nav_group_group');
89             $this->out->menuItem(common_local_url('groupmembers', array('nickname' =>
90                                                                         $nickname)),
91                                  _('Members'),
92                                  sprintf(_('%s group members'), $nickname),
93                                  $action_name == 'groupmembers',
94                                  'nav_group_members');
95
96             $cur = common_current_user();
97
98             if ($cur && $cur->isAdmin($this->group)) {
99                 $this->out->menuItem(common_local_url('blockedfromgroup', array('nickname' =>
100                                                                                 $nickname)),
101                                      _('Blocked'),
102                                      sprintf(_('%s blocked users'), $nickname),
103                                      $action_name == 'blockedfromgroup',
104                                      'nav_group_blocked');
105                 $this->out->menuItem(common_local_url('editgroup', array('nickname' =>
106                                                                          $nickname)),
107                                      _('Admin'),
108                                      sprintf(_('Edit %s group properties'), $nickname),
109                                      $action_name == 'editgroup',
110                                      'nav_group_admin');
111                 $this->out->menuItem(common_local_url('grouplogo', array('nickname' =>
112                                                                          $nickname)),
113                                      _('Logo'),
114                                      sprintf(_('Add or edit %s logo'), $nickname),
115                                      $action_name == 'grouplogo',
116                                      'nav_group_logo');
117                 $this->out->menuItem(common_local_url('groupdesignsettings', array('nickname' =>
118                                                                       $nickname)),
119                                      _('Design'),
120                                      sprintf(_('Add or edit %s design'), $nickname),
121                                      $action_name == 'groupdesignsettings',
122                                      'nav_group_design');
123             }
124             Event::handle('EndGroupGroupNav', array($this));
125         }
126         $this->out->elementEnd('ul');
127     }
128 }