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

Set group view access on creation of group views

parent 9ae8d8bb
......@@ -186,6 +186,17 @@ function editview_submit(Pieform $form, $values) {
}
$view->commit();
if (empty($editing) && $group) {
// By default, group views should be visible to the group
$view->set_access(array(array(
'type' => 'group',
'id' => $group,
'startdate' => null,
'stopdate' => null,
'role' => null
)));
$view->commit();
}
if ($values['new']) {
$redirecturl = '/view/blocks.php?id=' . $view->get('id') . '&new=1';
......
......@@ -59,7 +59,7 @@ $pagination = build_pagination(array(
$smarty = smarty();
$smarty->assign('groupid', $group);
$smarty->assign('views', $data->data);
$smarty->assign('caneditgroupviews', group_user_can_edit_views($group));
$smarty->assign('caneditgroupview', group_user_can_edit_views($group));
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('heading', get_string('groupviewsfor', 'view', get_field('group', 'name', 'id', $group)));
$smarty->display('view/index.tpl');
......
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