mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
Fixes bug MDL-8434, "group administration - can't delete groups".
This commit is contained in:
parent
fbe31d22d1
commit
5bca3fed8f
@ -34,6 +34,10 @@ if (! $course) {
|
||||
$success = false;
|
||||
print_error('invalidcourse'); //'The course ID is invalid'
|
||||
}
|
||||
if ($delete && !$groupid) {
|
||||
$success = false;
|
||||
print_error('errorinvalidgroup', 'group', groups_home_url($courseid));
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
// Make sure that the user has permissions to manage groups.
|
||||
@ -52,7 +56,11 @@ if ($success) {
|
||||
redirect(groups_home_url($courseid, $groupid, $groupingid, false));
|
||||
}
|
||||
elseif (isset($frm->confirmdelete)) {
|
||||
///TODO:
|
||||
if ($success = groups_delete_group($groupid)) {
|
||||
redirect(groups_home_url($courseid, null, $groupingid, false));
|
||||
} else {
|
||||
print_error('erroreditgroup', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
elseif (empty($frm->name)) {
|
||||
$err['name'] = get_string('missingname');
|
||||
@ -83,7 +91,7 @@ if ($success) {
|
||||
redirect(groups_home_url($courseid, $groupid, $groupingid, false));
|
||||
}
|
||||
else {
|
||||
print_error('erroreditgrouping', 'group', groups_home_url($courseid));
|
||||
print_error('erroreditgroup', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,7 +102,7 @@ if ($success) {
|
||||
// Form to edit existing group.
|
||||
$group = groups_get_group_settings($groupid);
|
||||
if (! $group) {
|
||||
print_error('The group ID is invalid.');
|
||||
print_error('errorinvalidgroup', 'group', groups_home_url($courseid));
|
||||
}
|
||||
$strname = s($group->name);
|
||||
$strdesc = s($group->description);
|
||||
@ -147,10 +155,10 @@ if ($success) {
|
||||
choose_from_menu_yesno('confirmdelete', false, '', true);*/
|
||||
?>
|
||||
|
||||
<p>Are you sure you want to delete group '<?php p($strname) ?>'?</p>
|
||||
<p><?php print_string('deletegroupconfirm', 'group', $strname); ?></p>
|
||||
<input type="hidden" name="delete" value="1" />
|
||||
<input type="submit" name="confirmdelete" value="Yes" />
|
||||
<input type="submit" name="cancel" value="<?php print_string('cancel', 'group'); ?>" />
|
||||
<input type="submit" name="confirmdelete" value="<?php print_string('yes'); ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string('no'); ?>" />
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
@ -20,6 +20,8 @@ $groupingid = optional_param('grouping', false, PARAM_INT);
|
||||
$groupingsettings->name = optional_param('name', PARAM_ALPHANUM);
|
||||
$groupingsettings->description= optional_param('description', PARAM_ALPHANUM);
|
||||
|
||||
$delete = optional_param('delete', false, PARAM_BOOL);
|
||||
|
||||
// Get the course information so we can print the header and
|
||||
// check the course id is valid
|
||||
$course = groups_get_course_info($courseid);
|
||||
@ -47,6 +49,13 @@ if ($success) {
|
||||
if (isset($frm->cancel)) {
|
||||
redirect(groups_home_url($courseid, null, $groupingid, false));
|
||||
}
|
||||
elseif (isset($frm->confirmdelete)) {
|
||||
if ($success = groups_delete_grouping($groupingid)) {
|
||||
redirect(groups_home_url($courseid));
|
||||
} else {
|
||||
print_error('erroreditgrouping', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
elseif (empty($frm->name)) {
|
||||
$err['name'] = get_string('missingname');
|
||||
}
|
||||
@ -62,7 +71,7 @@ if ($success) {
|
||||
redirect(groups_home_url($courseid, null, $groupingid, false));
|
||||
}
|
||||
else {
|
||||
print_error('erroreditgroup', 'group', groups_home_url($courseid));
|
||||
print_error('erroreditgrouping', 'group', groups_home_url($courseid));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,6 +97,9 @@ if ($success) {
|
||||
}
|
||||
$strgroups = get_string('groups');
|
||||
$strparticipants = get_string('participants');
|
||||
if ($delete) {
|
||||
$strheading = get_string('deletegrouping', 'group');
|
||||
}
|
||||
|
||||
/// Print the page and form
|
||||
|
||||
@ -108,6 +120,18 @@ if ($success) {
|
||||
if ($groupingid) {
|
||||
echo '<input type="hidden" name="grouping" value="'. $groupingid .'" />';
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
/*echo 'Are you sure you want to delete grouping X ?';
|
||||
choose_from_menu_yesno('confirmdelete', false, '', true);*/
|
||||
?>
|
||||
|
||||
<p><?php print_string('deletegroupingconfirm', 'group', $strname); ?></p>
|
||||
<input type="hidden" name="delete" value="1" />
|
||||
<input type="submit" name="confirmdelete" value="<?php print_string('yes'); ?>" />
|
||||
<input type="submit" name="cancel" value="<?php print_string('no'); ?>" />
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<div class="f-item">
|
||||
@ -139,6 +163,9 @@ if ($success) {
|
||||
<input type="submit" name="cancel" value="<?php print_string('cancel', 'group'); ?>" />
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<?php } //IF($delete) ?>
|
||||
|
||||
<span class="clearer"> </span>
|
||||
|
||||
</form>
|
||||
|
@ -32,6 +32,9 @@ $string['showgroupsingrouping'] = 'Show groups in grouping';
|
||||
$string['showmembersforgroup'] = 'Show members for group';
|
||||
$string['databaseupgradegroups'] = 'Groups version is now $a';
|
||||
|
||||
$string['deletegroupingconfirm'] = 'Are you sure you want to delete grouping \'$a\'? (Groups in the grouping are not deleted.)';
|
||||
$string['deletegroupconfirm'] = 'Are you sure you want to delete group \'$a\'?';
|
||||
|
||||
$string['editgroupingsettings'] = 'Edit grouping settings';
|
||||
$string['editgroupingpermissions'] = 'Edit grouping permissions';
|
||||
$string['deletegrouping'] = 'Delete grouping';
|
||||
|
Loading…
x
Reference in New Issue
Block a user