Commit dd94611b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Show user roles on group members tab

parent 86a0b2f9
......@@ -38,11 +38,6 @@ if (!$group = get_record('group', 'id', $id, 'deleted', 0)) {
}
define('TITLE', $group->name . ' - ' . get_string('Members', 'group'));
$group->admins = get_column_sql("SELECT member
FROM {group_member}
WHERE \"group\" = ?
AND role = 'admin'", array($id));
$role = group_user_access($id);
// Search related stuff for member pager
......
......@@ -413,6 +413,16 @@ function group_invite_submit(Pieform $form, $values) {
}
}
function group_get_role_info($groupid) {
$roles = get_records_sql_assoc('SELECT role, edit_views, see_submitted_views, gr.grouptype FROM {grouptype_roles} gr
INNER JOIN {group} g ON g.grouptype = gr.grouptype
WHERE g.id = ?', array($groupid));
foreach ($roles as $role) {
$role->display = get_string($role->role, 'grouptype.'.$role->grouptype);
}
return $roles;
}
function group_get_membersearch_data($group, $query, $offset, $limit) {
$results = get_group_user_search_results($group, $query, $offset, $limit);
......@@ -422,7 +432,7 @@ function group_get_membersearch_data($group, $query, $offset, $limit) {
}
$params[] = 'limit=' . $limit;
$searchurl = get_config('wwwroot') . 'group/view.php?' . join('&', $params);
$results['roles'] = group_get_role_info($group);
$smarty = smarty_core();
$smarty->assign_by_ref('results', $results);
$smarty->assign('searchurl', $searchurl);
......
......@@ -424,11 +424,12 @@ class PluginSearchInternal extends PluginSearch {
if ($count > 0) {
$data = get_records_sql_assoc('
SELECT
u.id, u.firstname, u.lastname, u.username, u.email, u.staff, ' . db_format_tsfield('gm.ctime', 'jointime') . '
u.id, u.firstname, u.lastname, u.username, u.email, u.staff, ' . db_format_tsfield('gm.ctime', 'jointime') . ',
gm.role
FROM
{usr} u
INNER JOIN {group_member} gm ON (gm.member = u.id) ' . $where . '
ORDER BY gm.ctime, u.firstname, u.lastname, u.id',
ORDER BY gm.role = \'admin\' DESC, gm.ctime, u.firstname, u.lastname, u.id',
$values,
$offset,
$limit);
......
......@@ -2,10 +2,11 @@
{foreach from=$results.data item=r}
<tr class="{cycle values="r0,r1"}">
<td>
<h4><a href="{$WWWROOT}user/view.php?id={$r.id|escape}">{$r.name|escape}</a></h4>
<div class="fl"><img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=40&amp;id={$r.id|escape}" alt=""></div>
<p><strong>Joined:</strong> {$r.jointime}</p>
<p>{$r.introduction|str_shorten:80:true}</p>
<h4><a href="{$WWWROOT}user/view.php?id={$r.id|escape}">{$r.name|escape}</a></h4>
<p>{$results.roles[$r.role]->display}</p>
<p><strong>Joined:</strong> {$r.jointime}</p>
<p>{$r.introduction|str_shorten:80:true}</p>
</td>
</tr>
{/foreach}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment