summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/showgroup.php44
-rw-r--r--classes/User_group.php24
2 files changed, 68 insertions, 0 deletions
diff --git a/actions/showgroup.php b/actions/showgroup.php
index b6a0f4844..ce11d574e 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -331,6 +331,7 @@ class ShowgroupAction extends GroupDesignAction
{
$this->showMembers();
$this->showStatistics();
+ $this->showAdmins();
$cloud = new GroupTagCloudSection($this, $this->group);
$cloud->show();
}
@@ -370,6 +371,18 @@ class ShowgroupAction extends GroupDesignAction
}
/**
+ * Show list of admins
+ *
+ * @return void
+ */
+
+ function showAdmins()
+ {
+ $adminSection = new GroupAdminSection($this, $this->group);
+ $adminSection->show();
+ }
+
+ /**
* Show some statistics
*
* @return void
@@ -423,3 +436,34 @@ class ShowgroupAction extends GroupDesignAction
$this->elementEnd('div');
}
}
+
+class GroupAdminSection extends ProfileSection
+{
+ var $group;
+
+ function __construct($out, $group)
+ {
+ parent::__construct($out);
+ $this->group = $group;
+ }
+
+ function getProfiles()
+ {
+ return $this->group->getAdmins();
+ }
+
+ function title()
+ {
+ return _('Admins');
+ }
+
+ function divId()
+ {
+ return 'group_admins';
+ }
+
+ function moreUrl()
+ {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/classes/User_group.php b/classes/User_group.php
index 9b4b01ead..27b444705 100644
--- a/classes/User_group.php
+++ b/classes/User_group.php
@@ -126,6 +126,30 @@ class User_group extends Memcached_DataObject
return $members;
}
+ function getAdmins($offset=0, $limit=null)
+ {
+ $qry =
+ 'SELECT profile.* ' .
+ 'FROM profile JOIN group_member '.
+ 'ON profile.id = group_member.profile_id ' .
+ 'WHERE group_member.group_id = %d ' .
+ 'AND group_member.is_admin = 1 ' .
+ 'ORDER BY group_member.modified ASC ';
+
+ if ($limit != null) {
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+ }
+
+ $admins = new Profile();
+
+ $admins->query(sprintf($qry, $this->id));
+ return $admins;
+ }
+
function getBlocked($offset=0, $limit=null)
{
$qry =