Commit 527977d7 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

created a delete_group function

parent f37d228e
......@@ -67,13 +67,7 @@ $smarty->display('group/delete.tpl');
function deletegroup_submit(Pieform $form, $values) {
global $SESSION, $USER, $groupid;
db_begin();
delete_records('view_access_group', 'group', $groupid);
delete_records('group_member_invite', 'group', $groupid);
delete_records('group_member_request', 'group', $groupid);
delete_records('group_member', 'group', $groupid);
delete_records('group', 'id', $groupid);
db_commit();
delete_group($groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect('/group/mygroups.php');
}
......
......@@ -40,13 +40,7 @@ if ($action == 'delete') {
if ($owner != $USER->get('id')) {
json_reply('local', get_string('cantdeletegroupdontown', 'group'));
}
db_begin();
delete_records('view_access_group', 'group', $id);
delete_records('group_member_invite', 'group', $id);
delete_records('group_member_request', 'group', $id);
delete_records('group_member', 'group', $id);
delete_records('group', 'id', $id);
db_commit();
delete_group($id);
json_reply(null, get_string('deletegroup', 'group'));
}
......
......@@ -205,7 +205,6 @@ function get_tutor_groups($userid=0, $jointype=null) {
return get_records_sql_array($sql, $values);
}
// constants for group membership type
define('GROUP_MEMBERSHIP_ADMIN', 1);
define('GROUP_MEMBERSHIP_STAFF', 2);
......@@ -296,6 +295,10 @@ function group_has_members($groupid) {
return count_records_sql($sql, array($groupid, $groupid));
}
function delete_group($groupid) {
update_record('group', array('deleted' => 1), array('id' => $groupid));
}
/**
* function to set up groups for display in mygroups.php and find.php
*
......
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