Fixes #1088: Show number of group members. Unlike the bugreport requested, the stats are displayed similar to userstream stats in a section in the sidebar. Additionaly, I removed a redundant notnull if check in ShowgroupAction->showMembers, fixed a SQL error in User_group->getMembers when no limit is passed, removed return value storing of void function and added an usage of Profile->getBestName.
This commit is contained in:
parent
37a7692053
commit
2f37539967
|
@ -333,6 +333,7 @@ class ShowgroupAction extends Action
|
||||||
function showSections()
|
function showSections()
|
||||||
{
|
{
|
||||||
$this->showMembers();
|
$this->showMembers();
|
||||||
|
$this->showStatistics();
|
||||||
$cloud = new GroupTagCloudSection($this, $this->group);
|
$cloud = new GroupTagCloudSection($this, $this->group);
|
||||||
$cloud->show();
|
$cloud->show();
|
||||||
}
|
}
|
||||||
|
@ -356,12 +357,10 @@ class ShowgroupAction extends Action
|
||||||
|
|
||||||
$this->element('h2', null, _('Members'));
|
$this->element('h2', null, _('Members'));
|
||||||
|
|
||||||
if ($member) {
|
$pml = new ProfileMiniList($member, null, $this);
|
||||||
$pml = new ProfileMiniList($member, null, $this);
|
$cnt = $pml->show();
|
||||||
$cnt = $pml->show();
|
if ($cnt == 0) {
|
||||||
if ($cnt == 0) {
|
$this->element('p', null, _('(None)'));
|
||||||
$this->element('p', null, _('(None)'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cnt == MEMBERS_PER_SECTION) {
|
if ($cnt == MEMBERS_PER_SECTION) {
|
||||||
|
@ -373,6 +372,41 @@ class ShowgroupAction extends Action
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show some statistics
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
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'));
|
||||||
|
|
||||||
|
$this->element('h2', null, _('Statistics'));
|
||||||
|
|
||||||
|
$this->elementStart('dl', 'entity_created');
|
||||||
|
$this->element('dt', null, _('Created'));
|
||||||
|
$this->element('dd', null, date('j M Y',
|
||||||
|
strtotime($this->group->created)));
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
|
$this->elementStart('dl', 'entity_members');
|
||||||
|
$this->element('dt', null, _('Members'));
|
||||||
|
$this->element('dd', null, (is_int($members_count)) ? $members_count : '0');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
|
$this->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
function showAnonymousMessage()
|
function showAnonymousMessage()
|
||||||
{
|
{
|
||||||
$m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
$m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
|
||||||
|
|
|
@ -74,16 +74,17 @@ class User_group extends Memcached_DataObject
|
||||||
'WHERE group_member.group_id = %d ' .
|
'WHERE group_member.group_id = %d ' .
|
||||||
'ORDER BY group_member.created DESC ';
|
'ORDER BY group_member.created DESC ';
|
||||||
|
|
||||||
if (common_config('db','type') == 'pgsql') {
|
if ($limit != null) {
|
||||||
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
if (common_config('db','type') == 'pgsql') {
|
||||||
} else {
|
$qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
|
||||||
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
} else {
|
||||||
|
$qry .= ' LIMIT ' . $offset . ', ' . $limit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$members = new Profile();
|
$members = new Profile();
|
||||||
|
|
||||||
$cnt = $members->query(sprintf($qry, $this->id));
|
$members->query(sprintf($qry, $this->id));
|
||||||
|
|
||||||
return $members;
|
return $members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,7 @@ class ProfileMiniList extends ProfileList
|
||||||
function showProfile()
|
function showProfile()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('li', 'vcard');
|
$this->out->elementStart('li', 'vcard');
|
||||||
$this->out->elementStart('a', array('title' => ($this->profile->fullname) ?
|
$this->out->elementStart('a', array('title' => $this->profile->getBestName(),
|
||||||
$this->profile->fullname :
|
|
||||||
$this->profile->nickname,
|
|
||||||
'href' => $this->profile->profileurl,
|
'href' => $this->profile->profileurl,
|
||||||
'rel' => 'contact member',
|
'rel' => 'contact member',
|
||||||
'class' => 'url'));
|
'class' => 'url'));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user