]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/groupmemberlistitem.php
Merge branch 'limitdist' of gitorious.org:~evan/statusnet/evans-mainline into limitdist
[quix0rs-gnu-social.git] / lib / groupmemberlistitem.php
1 <?php
2
3 class GroupMemberListItem extends ProfileListItem
4 {
5     var $group = null;
6
7     function __construct($profile, $group, $action)
8     {
9         parent::__construct($profile, $action);
10
11         $this->group = $group;
12     }
13
14     function showFullName()
15     {
16         parent::showFullName();
17         if ($this->profile->isAdmin($this->group)) {
18             $this->out->text(' '); // for separating the classes.
19             // TRANS: Indicator in group members list that this user is a group administrator.
20             $this->out->element('span', 'role', _('Admin'));
21         }
22     }
23
24     function showActions()
25     {
26         $this->startActions();
27         if (Event::handle('StartProfileListItemActionElements', array($this))) {
28             $this->showSubscribeButton();
29             $this->showMakeAdminForm();
30             $this->showGroupBlockForm();
31             Event::handle('EndProfileListItemActionElements', array($this));
32         }
33         $this->endActions();
34     }
35
36     function showMakeAdminForm()
37     {
38         $user = common_current_user();
39
40         if (!empty($user) &&
41             $user->id != $this->profile->id &&
42             ($user->isAdmin($this->group) || $user->hasRight(Right::MAKEGROUPADMIN)) &&
43             !$this->profile->isAdmin($this->group)) {
44             $this->out->elementStart('li', 'entity_make_admin');
45             $maf = new MakeAdminForm($this->out, $this->profile, $this->group,
46                                      $this->returnToArgs());
47             $maf->show();
48             $this->out->elementEnd('li');
49         }
50
51     }
52
53     function showGroupBlockForm()
54     {
55         $user = common_current_user();
56
57         if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group)) {
58             $this->out->elementStart('li', 'entity_block');
59             $bf = new GroupBlockForm($this->out, $this->profile, $this->group,
60                                      $this->returnToArgs());
61             $bf->show();
62             $this->out->elementEnd('li');
63         }
64     }
65
66     function linkAttributes()
67     {
68         $aAttrs = parent::linkAttributes();
69
70         if (common_config('nofollow', 'members')) {
71             $aAttrs['rel'] .= ' nofollow';
72         }
73
74         return $aAttrs;
75     }
76
77     function homepageAttributes()
78     {
79         $aAttrs = parent::linkAttributes();
80
81         if (common_config('nofollow', 'members')) {
82             $aAttrs['rel'] = 'nofollow';
83         }
84
85         return $aAttrs;
86     }
87
88     /**
89      * Fetch necessary return-to arguments for the profile forms
90      * to return to this list when they're done.
91      *
92      * @return array
93      */
94     protected function returnToArgs()
95     {
96         $args = array('action' => 'groupmembers',
97                       'nickname' => $this->group->nickname);
98         $page = $this->out->arg('page');
99         if ($page) {
100             $args['param-page'] = $page;
101         }
102         return $args;
103     }
104 }
105