X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fshowgroup.php;h=9a12bafaf62aba1b4ff763738f1125c558f8cf19;hb=aa80d8fee3865e25e8d47a5c83b6575ca3dc79ea;hp=a0d05ba37a39f62c3861502968e5d89db53ecddc;hpb=ecb009bcf5a6893b90d153be18c423dd7377796d;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index a0d05ba37a..9a12bafaf6 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -316,6 +316,12 @@ class ShowgroupAction extends GroupDesignAction Event::handle('EndGroupSubscribe', array($this, $this->group)); } $this->elementEnd('li'); + if ($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'); } @@ -388,18 +394,23 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('div', array('id' => 'entity_members', 'class' => 'section')); - $this->element('h2', null, _('Members')); + if (Event::handle('StartShowGroupMembersMiniList', array($this))) { - $pml = new ProfileMiniList($member, $this); - $cnt = $pml->show(); - if ($cnt == 0) { - $this->element('p', null, _('(None)')); - } + $this->element('h2', null, _('Members')); + + $gmml = new GroupMembersMiniList($member, $this); + $cnt = $gmml->show(); + if ($cnt == 0) { + $this->element('p', null, _('(None)')); + } + + if ($cnt > MEMBERS_PER_SECTION) { + $this->element('a', array('href' => common_local_url('groupmembers', + array('nickname' => $this->group->nickname))), + _('All members')); + } - if ($cnt > MEMBERS_PER_SECTION) { - $this->element('a', array('href' => common_local_url('groupmembers', - array('nickname' => $this->group->nickname))), - _('All members')); + Event::handle('EndShowGroupMembersMiniList', array($this)); } $this->elementEnd('div'); @@ -425,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')); @@ -446,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'); @@ -502,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; + } +} +