X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowgroup.php;h=8e8ff717c112a0d2f7ba5544288089630b62d49e;hb=54de6d3260e7fde77eb86079bd67a815930b8b43;hp=6e06666909a10b31831859334e1fd4659cbe4eb3;hpb=ffc1ac02c3f1f566088c8bef7c54d1ae97e56a36;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index 6e06666909..8e8ff717c1 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -298,12 +298,12 @@ class ShowgroupAction extends GroupDesignAction $this->elementEnd('div'); + $cur = common_current_user(); $this->elementStart('div', 'entity_actions'); $this->element('h2', null, _('Group actions')); $this->elementStart('ul'); $this->elementStart('li', 'entity_subscribe'); if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { - $cur = common_current_user(); if ($cur) { if ($cur->isMember($this->group)) { $lf = new LeaveForm($this, $this->group); @@ -316,6 +316,12 @@ class ShowgroupAction extends GroupDesignAction Event::handle('EndGroupSubscribe', array($this, $this->group)); } $this->elementEnd('li'); + if ($cur && $cur->hasRight(Right::DELETEGROUP)) { + $this->elementStart('li', 'entity_delete'); + $df = new DeleteGroupForm($this, $this->group); + $df->show(); + $this->elementEnd('li'); + } $this->elementEnd('ul'); $this->elementEnd('div'); } @@ -392,8 +398,8 @@ class ShowgroupAction extends GroupDesignAction $this->element('h2', null, _('Members')); - $pml = new ProfileMiniList($member, $this); - $cnt = $pml->show(); + $gmml = new GroupMembersMiniList($member, $this); + $cnt = $gmml->show(); if ($cnt == 0) { $this->element('p', null, _('(None)')); } @@ -430,14 +436,6 @@ class ShowgroupAction extends GroupDesignAction function showStatistics() { - // XXX: WORM cache this - $members = $this->group->getMembers(); - $members_count = 0; - /** $member->count() doesn't work. */ - while ($members->fetch()) { - $members_count++; - } - $this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section')); @@ -451,7 +449,7 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('dl', 'entity_members'); $this->element('dt', null, _('Members')); - $this->element('dd', null, (is_int($members_count)) ? $members_count : '0'); + $this->element('dd', null, $this->group->getMemberCount()); $this->elementEnd('dl'); $this->elementEnd('div'); @@ -507,3 +505,26 @@ class GroupAdminSection extends ProfileSection return null; } } + +class GroupMembersMiniList extends ProfileMiniList +{ + function newListItem($profile) + { + return new GroupMembersMiniListItem($profile, $this->action); + } +} + +class GroupMembersMiniListItem extends ProfileMiniListItem +{ + function linkAttributes() + { + $aAttrs = parent::linkAttributes(); + + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] .= ' nofollow'; + } + + return $aAttrs; + } +} +