-<?php // $Id$
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* Add/remove group from grouping.
+ *
+ * @copyright 1999 Martin Dougiamas http://dougiamas.com
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package groups
*/
+
require_once('../config.php');
require_once('lib.php');
$groupingid = required_param('id', PARAM_INT);
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/group/assign.php', array('id'=>$groupingid)));
+
if (!$grouping = $DB->get_record('groupings', array('id'=>$groupingid))) {
print_error('invalidgroupid');
}
$groupids = required_param('groups', PARAM_SEQUENCE);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/group/delete.php', array('courseid'=>$courseid,'groups'=>$groupids)));
+
// Make sure course is OK and user has access to manage groups
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('invalidcourseid');
$delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
+$url = new moodle_url($CFG->wwwroot.'/group/grouping.php');
if ($id) {
+ $url->param('id', $id);
if (!$grouping = $DB->get_record('groupings', array('id'=>$id))) {
print_error('invalidgroupid');
}
$grouping->description = clean_text($grouping->description);
if (empty($courseid)) {
$courseid = $grouping->courseid;
-
} else if ($courseid != $grouping->courseid) {
print_error('invalidcourseid');
+ } else {
+ $url->param('courseid', $courseid);
}
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
}
} else {
+ $url->param('courseid', $courseid);
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
}
$grouping->courseid = $course->id;
}
+$PAGE->set_url($url);
+
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:managegroups', $context);
-<?php // $Id$
- // Allows a creator to edit groupings
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Allows a creator to edit groupings
+ *
+ * @copyright 1999 Martin Dougiamas http://dougiamas.com
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package groups
+ */
require_once '../config.php';
require_once $CFG->dirroot.'/group/lib.php';
$courseid = required_param('id', PARAM_INT);
+$PAGE->set_url(new moodle_url($CFG->wwwroot.'/group/groupings.php', array('id'=>$courseid)));
+
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('nocourseid');
}