2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Sets the events filter for the calendar view.
20 * @package core_calendar
21 * @copyright 2003 Jon Papaioannou (pj@moodle.org)
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 require_once('../config.php');
25 require_once($CFG->dirroot
.'/calendar/lib.php');
27 $var = required_param('var', PARAM_ALPHA
);
28 $return = clean_param(base64_decode(required_param('return', PARAM_RAW
)), PARAM_LOCALURL
);
29 $courseid = optional_param('id', -1, PARAM_INT
);
30 if ($courseid != -1) {
31 $return = new moodle_url($return, array('course' => $courseid));
33 $return = new moodle_url($return);
36 if (!confirm_sesskey()) {
37 // Do not call require_sesskey() since this page may be accessed without session (for example by bots).
41 $url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return->out_as_local_url(false)), 'course' => $courseid, 'var'=>$var, 'sesskey'=>sesskey()));
43 $PAGE->set_context(context_system
::instance());
47 calendar_set_event_type_display(CALENDAR_EVENT_GROUP
);
50 calendar_set_event_type_display(CALENDAR_EVENT_COURSE
);
53 calendar_set_event_type_display(CALENDAR_EVENT_GLOBAL
);
56 calendar_set_event_type_display(CALENDAR_EVENT_USER
);