X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fshowgroup.php;h=17c37e4d79f82c15cf2ab5aad846b78f1625a9e8;hb=a9bb1c75282a642d34b88fee2a7ca31ab7c2a0fb;hp=a1dc3865bdbae98931adc47b59d2a48aa0ccfdbb;hpb=7313cd909479f771e960466d9194783c9a3158bb;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index a1dc3865bd..17c37e4d79 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -221,7 +221,8 @@ class ShowgroupAction extends GroupDesignAction function showGroupProfile() { - $this->elementStart('div', 'entity_profile vcard author'); + $this->elementStart('div', array('id' => 'i', + 'class' => 'entity_profile vcard author')); $this->element('h2', null, _('Group profile')); @@ -300,8 +301,8 @@ class ShowgroupAction extends GroupDesignAction $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))) { - $this->elementStart('li', 'entity_subscribe'); $cur = common_current_user(); if ($cur) { if ($cur->isMember($this->group)) { @@ -312,10 +313,9 @@ class ShowgroupAction extends GroupDesignAction $jf->show(); } } - $this->elementEnd('li'); Event::handle('EndGroupSubscribe', array($this, $this->group)); } - + $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('div'); } @@ -388,18 +388,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 +430,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 +443,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 +499,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; + } +} +