1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

group MDL-19798 Added set_url calls

This commit is contained in:
samhemelryk 2009-10-16 03:16:38 +00:00
parent 6e08d1f1af
commit bbe0bd9899
4 changed files with 58 additions and 4 deletions

@ -1,13 +1,35 @@
<?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');
}

@ -16,6 +16,8 @@ $courseid = required_param('courseid', PARAM_INT);
$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');

@ -18,16 +18,19 @@ $id = optional_param('id', 0, PARAM_INT);
$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))) {
@ -35,6 +38,7 @@ if ($id) {
}
} else {
$url->param('courseid', $courseid);
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
}
@ -42,6 +46,8 @@ if ($id) {
$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);

@ -1,11 +1,35 @@
<?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');
}