Commit 707d06d8 authored by Evan Goldenberg's avatar Evan Goldenberg
Browse files

On the group page, show if the user has submitted a view to that group


Signed-off-by: default avatarEvan Goldenberg <evang@catalyst.net.nz>
parent 6574400c
......@@ -123,11 +123,15 @@ if ($role) {
}
}
if (group_allows_submission($group->grouptype) &&
!get_record_select('view', 'owner = ? AND submittedgroup = ?', array($USER->get('id'), $group->id))
&& ($viewdata = View::get_user_views())) {
if (group_allows_submission($group->grouptype) && ($viewdata = View::get_user_views())) {
$submitted = get_record_select('view', 'owner = ? AND submittedgroup = ?', array($USER->get('id'), $group->id));
if (!$submitted) {
$group_view_submission_form = group_view_submission_form($group->id, $viewdata);
$smarty->assign('group_view_submission_form', $group_view_submission_form);
}
else {
$group_view_submission_form = get_string('youhavesubmitted', 'view', get_config('wwwroot') . 'view/view.php?id=' . $submitted->id, $submitted->title);
}
$smarty->assign('group_view_submission_form', $group_view_submission_form);
}
$smarty->assign('role', $role);
......
......@@ -77,6 +77,8 @@ $string['viewsownedbygroup'] = 'Views owned by this group';
$string['viewssharedtogroup'] = 'Views shared to this group';
$string['viewssharedtogroupbyothers'] = 'Views shared to this group by others';
$string['viewssubmittedtogroup'] = 'Views submitted to this group';
$string['submitaviewtogroup'] = 'Submit a view to this group';
$string['youhavesubmitted'] = 'You have submitted <a href="%s">%s</a> to this group';
// access levels
$string['public'] = 'Public';
......
......@@ -2131,9 +2131,7 @@ class View {
if ($views = get_records_sql_array(
"SELECT v.id, v.title
FROM {view} v
LEFT OUTER JOIN {group} g on (v.submittedgroup = g.id AND g.deleted = 0)
LEFT OUTER JOIN {host} h on (v.submittedhost = h.wwwroot)
WHERe v.owner = ?
WHERE v.owner = ?
AND v.type != 'profile'
ORDER BY v.title, v.id
", array($userid))) {
......
......@@ -63,7 +63,7 @@
{/if}
{if $group_view_submission_form}
<h3>{str tag="viewssubmittedtogroup" section="view"}</h3>
<h3>{str tag="submitaviewtogroup" section="view"}</h3>
<div>{$group_view_submission_form}</div>
{/if}
......
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