From cab03a03b4a4fec59b37dbb8f94a0747d5c287b7 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Mon, 12 Mar 2012 16:39:11 +0000 Subject: [PATCH] MDL-32008 Remove old group deletion code --- group/group.php | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/group/group.php b/group/group.php index cf1201643b7..3b23ad9f491 100644 --- a/group/group.php +++ b/group/group.php @@ -35,10 +35,12 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL); // This script used to support group delete, but that has been moved. In case // anyone still links to it, let's redirect to the new script. -if($delete) { - redirect('delete.php?courseid='.$courseid.'&groups='.$id); +if ($delete) { + debugging('Deleting a group through group/group.php is deprecated and will be removed soon. Please use group/delete.php instead'); + redirect(new moodle_url('delete.php', array('courseid' => $courseid, 'groups' => $id))); } + if ($id) { if (!$group = $DB->get_record('groups', array('id'=>$id))) { print_error('invalidgroupid'); @@ -74,28 +76,6 @@ require_capability('moodle/course:managegroups', $context); $returnurl = $CFG->wwwroot.'/group/index.php?id='.$course->id.'&group='.$id; -if ($id and $delete) { - if (!$confirm) { - $PAGE->set_title(get_string('deleteselectedgroup', 'group')); - $PAGE->set_heading($course->fullname . ': '. get_string('deleteselectedgroup', 'group')); - echo $OUTPUT->header(); - $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); - $optionsno = array('id'=>$courseid); - $formcontinue = new single_button(new moodle_url('group.php', $optionsyes), get_string('yes'), 'get'); - $formcancel = new single_button(new moodle_url($baseurl, $optionsno), get_string('no'), 'get'); - echo $OUTPUT->confirm(get_string('deletegroupconfirm', 'group', $group->name), $formcontinue, $formcancel); - echo $OUTPUT->footer(); - die; - - } else if (confirm_sesskey()){ - if (groups_delete_group($id)) { - redirect('index.php?id='.$course->id); - } else { - print_error('erroreditgroup', 'group', $returnurl); - } - } -} - // Prepare the description editor: We do support files for group descriptions $editoroptions = array('maxfiles'=>EDITOR_UNLIMITED_FILES, 'maxbytes'=>$course->maxbytes, 'trust'=>false, 'context'=>$context, 'noclean'=>true); if (!empty($group->id)) {