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

Display group access roles on my views

parent a527e807
......@@ -1290,18 +1290,18 @@ class View {
WHERE va.view IN (' . $viewidlist . ')
GROUP BY va.view, va.artefact, a.title, a.artefacttype, t.plugin
ORDER BY a.title, va.artefact', '');
$accessgroups = get_records_sql_array('SELECT view, accesstype, id, name, startdate, stopdate
$accessgroups = get_records_sql_array('SELECT view, accesstype, grouptype, role, id, name, startdate, stopdate
FROM (
SELECT view, \'group\' AS accesstype, vg.role, g.id, g.name, startdate, stopdate
SELECT view, \'group\' AS accesstype, g.grouptype, vg.role, g.id, g.name, startdate, stopdate
FROM {view_access_group} vg
INNER JOIN {group} g ON g.id = vg.group AND g.deleted = 0
UNION SELECT view, \'user\' AS accesstype, NULL AS role, usr AS id, \'\' AS name, startdate, stopdate
UNION SELECT view, \'user\' AS accesstype, NULL AS grouptype, NULL AS role, usr AS id, \'\' AS name, startdate, stopdate
FROM {view_access_usr} vu
UNION SELECT view, accesstype, NULL AS role, 0 AS id, \'\' AS name, startdate, stopdate
UNION SELECT view, accesstype, NULL AS grouptype, NULL AS role, 0 AS id, \'\' AS name, startdate, stopdate
FROM {view_access} va
) AS a
WHERE view in (' . $viewidlist . ')
ORDER BY view, accesstype, role, name, id
ORDER BY view, accesstype, grouptype, role, name, id
', array());
}
......
......@@ -49,8 +49,9 @@
{str tag="loggedinlower" section="view"}{elseif $accessgroup.accesstype == 'public'}
{str tag="publiclower" section="view"}{elseif $accessgroup.accesstype == 'friends'}
<a href="{$WWWROOT}user/myfriends.php" id="link-myfriends">{str tag="friendslower" section="view"}</a>{elseif $accessgroup.accesstype == 'group'}
<a href="{$WWWROOT}group/view.php?id={$accessgroup.id}">{$accessgroup.name|escape}</a>{elseif $accessgroup.accesstype == 'tutorgroup'}
<a href="{$WWWROOT}group/view.php?id={$accessgroup.id}">{$accessgroup.name|escape}</a> ({str tag="tutors" section="view"}){elseif $accessgroup.accesstype == 'user'}
<a href="{$WWWROOT}group/view.php?id={$accessgroup.id}">{$accessgroup.name|escape}</a>{if !empty($accessgroup.role)}
{assign var="role" value=$accessgroup.role}{assign var="grouptype" value=$accessgroup.grouptype}
({str tag="$role" section="$grouptype"}){/if}{elseif $accessgroup.accesstype == 'user'}
<a href="{$WWWROOT}user/view.php?id={$accessgroup.id}">{$accessgroup.id|display_name|escape}</a>{/if}{if !$smarty.foreach.artefacts.last},{/if}
{/foreach}
{else}
......
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