Commit 23c30e08 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add group menu to more group pages

parent 81f9f076
......@@ -30,6 +30,7 @@ require(dirname(dirname(__FILE__)) . '/init.php');
require_once('pieforms/pieform.php');
require('group.php');
$groupid = param_integer('id');
define('GROUP', $groupid);
$group = get_record_sql("SELECT g.name
FROM {group} g
......
......@@ -32,6 +32,7 @@ require_once('group.php');
define('TITLE', get_string('editgroup', 'group'));
$id = param_integer('id');
define('GROUP', $id);
$group_data = get_record_sql("SELECT g.name, g.description, g.grouptype, g.jointype
FROM {group} g
......
......@@ -32,10 +32,8 @@ require('group.php');
$groupid = param_integer('id');
$userid = param_integer('user');
$group = get_record('group', 'id', $groupid, 'deleted', 0);
if (!$group) {
throw new GroupNotFoundException(get_string('groupnotfound', 'group', $groupid));
}
define('GROUP', $groupid);
$group = group_current_group();
$user = get_record('usr', 'id', $userid, 'deleted', 0);
if (!$user) {
......@@ -83,7 +81,6 @@ $form = pieform(array(
$smarty = smarty();
$smarty->assign('heading', TITLE);
$smarty->assign('form', $form);
$smarty->assign('group', $group);
$smarty->display('group/invite.tpl');
function invitetogroup_submit(Pieform $form, $values) {
......
......@@ -32,10 +32,8 @@ require('group.php');
$groupid = param_integer('id');
$returnto = param_alpha('returnto', 'mygroups');
$group = get_record('group', 'id', $groupid, 'deleted', 0);
if (!$group) {
throw new GroupNotFoundException(get_string('groupnotfound', 'group', $groupid));
}
define('GROUP', $groupid);
$group = group_current_group();
define('TITLE', get_string('leavespecifiedgroup', 'group', $group->name));
......
......@@ -32,10 +32,8 @@ require('group.php');
$groupid = param_integer('id');
$returnto = param_alpha('returnto', 'mygroups');
$group = get_record('group', 'id', $groupid, 'deleted', 0);
if (!$group) {
throw new GroupNotFoundException(get_string('groupnotfound', 'group', $groupid));
}
define('GROUP', $groupid);
$group = group_current_group();
if ($group->jointype != 'request'
|| record_exists('group_member', 'group', $groupid, 'member', $USER->get('id'))
......@@ -73,7 +71,6 @@ $form = pieform(array(
$smarty = smarty();
$smarty->assign('heading', TITLE);
$smarty->assign('form', $form);
$smarty->assign('group', $group);
$smarty->display('group/requestjoin.tpl');
function requestjoingroup_submit(Pieform $form, $values) {
......
......@@ -36,10 +36,8 @@ require_once('group.php');
$id = param_integer('id');
$instance = interaction_instance_from_id($id);
if (!$group = get_record('group', 'id', $instance->get('group'), 'deleted', 0)) {
throw new GroupNotFoundException(get_string('groupnotfound', 'group', $id));
}
define('GROUP', $instance->get('group'));
$group = group_current_group();
$membership = group_user_access((int)$group->id);
if ($membership != 'admin') {
......@@ -72,7 +70,6 @@ $smarty = smarty(array('tablerenderer'), array(), array(), array('sideblocks' =>
$smarty->assign('form', $form);
$smarty->assign('heading', TITLE);
$smarty->assign('message', get_string('deleteinteractionsure', 'group'));
$smarty->assign('group', $group);
$smarty->display('interaction/delete.tpl');
?>
......@@ -49,11 +49,10 @@ else {
define('TITLE', get_string('addtitle', 'interaction.' . $plugin));
}
define('GROUP', $groupid);
$group = group_current_group();
safe_require('interaction', $plugin);
if (!$group = get_record('group', 'id', $groupid, 'deleted', 0)) {
throw new GroupNotFoundException(get_string('groupnotfound', 'group', $groupid));
}
$membership = group_user_access($groupid);
if ($membership != 'admin') {
throw new AccessDeniedException(get_string('notallowedtoeditinteractions', 'group'));
......@@ -84,7 +83,6 @@ $form = pieform(array(
$smarty = smarty(array('tablerenderer'), array(), array(), array('sideblocks' => array(interaction_sideblock($groupid))));
$smarty->assign('form', $form);
$smarty->assign('heading', TITLE);
$smarty->assign('group', $group);
$smarty->display('interaction/edit.tpl');
?>
......@@ -3,7 +3,7 @@
{include file="columnleftstart.tpl"}
<h2>{$heading|escape}</h2>
{include file="group/simplegroup.tpl" group=$group}
{include file="group/simplegroup.tpl" group=$GROUP}
{$form}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -3,7 +3,7 @@
{include file="columnleftstart.tpl"}
<h2>{$heading|escape}</h2>
{include file="group/simplegroup.tpl" group=$group}
{include file="group/simplegroup.tpl" group=$GROUP}
{$form}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -2,7 +2,7 @@
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{$group->name|escape}</h2>
<h2>{$GROUP->name|escape}</h2>
<div class="message">
<h3>{$heading|escape}</h3>
<p>{$message}</p>
......
......@@ -2,7 +2,7 @@
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<h2>{$group->name|escape} - {$heading|escape}</h2>
<h2>{$GROUP->name|escape} - {$heading|escape}</h2>
{$form}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......
Supports Markdown
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