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