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

Display group role strings in the My groups block

parent 95d15f89
......@@ -57,6 +57,7 @@ class PluginBlocktypeMyGroups extends SystemBlocktype {
foreach ($results['groups'] as $group) {
$group->description = str_shorten($group->description, 100, true);
$group->roledisplay = get_string($group->role, 'grouptype.'.$group->grouptype);
}
$smarty->assign('USERGROUPS',$results['groups']);
return $smarty->fetch('blocktype:mygroups:mygroups.tpl');
......
......@@ -3,7 +3,7 @@
{foreach from=$USERGROUPS item=item}
<tr>
<td class="r{cycle values=0,1}">
<h4><a href="{$WWWROOT}group/view.php?id={$item->id}">{$item->name|escape}</a> - {str tag=$item->type section=group}</h4>
<h4><a href="{$WWWROOT}group/view.php?id={$item->id}">{$item->name|escape}</a> - {$item->roledisplay|escape}</h4>
{if $item->description}
{$item->description}
{/if}
......
......@@ -940,7 +940,7 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
if ($filter == 'admin') {
$sql = "
INNER JOIN (
SELECT g.id, $adminsql AS membershiptype, $empty AS reason, $empty AS role
SELECT g.id, $adminsql AS membershiptype, $empty AS reason, $adminsql AS role
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
) t ON t.id = g.id";
......@@ -949,11 +949,11 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
else if ($filter == 'member') {
$sql = "
INNER JOIN (
SELECT g.id, 'admin' AS membershiptype, $empty AS reason, $empty AS role
SELECT g.id, 'admin' AS membershiptype, $empty AS reason, $adminsql AS role
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
UNION
SELECT g.id, 'member' AS type, $empty AS reason, $empty AS role
SELECT g.id, 'member' AS type, $empty AS reason, gm.role AS role
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role != 'admin')
) t ON t.id = g.id";
......@@ -981,11 +981,11 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
$filter = 'all';
$sql = "
INNER JOIN (
SELECT g.id, 'admin' AS membershiptype, '' AS reason, '' AS role
SELECT g.id, 'admin' AS membershiptype, '' AS reason, 'admin' AS role
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
UNION
SELECT g.id, 'member' AS membershiptype, '' AS reason, '' AS role
SELECT g.id, 'member' AS membershiptype, '' AS reason, gm.role AS role
FROM {group} g
INNER JOIN {group_member} gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')
UNION
......
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