MDL-51579 course: Bump version to update mobile service
[moodle.git] / calendar / set.php
blobfab8aa54c02f16767e6b01077230e4d3b3c0d063
1 <?php
3 /////////////////////////////////////////////////////////////////////////////
4 // //
5 // NOTICE OF COPYRIGHT //
6 // //
7 // Moodle - Calendar extension //
8 // //
9 // Copyright (C) 2003-2004 Greek School Network www.sch.gr //
10 // //
11 // Designed by: //
12 // Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
13 // Jon Papaioannou (pj@moodle.org) //
14 // //
15 // Programming and development: //
16 // Jon Papaioannou (pj@moodle.org) //
17 // //
18 // For bugs, suggestions, etc contact: //
19 // Jon Papaioannou (pj@moodle.org) //
20 // //
21 // The current module was developed at the University of Macedonia //
22 // (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
23 // The aim of this project is to provide additional and improved //
24 // functionality to the Asynchronous Distance Education service that the //
25 // Greek School Network deploys. //
26 // //
27 // This program is free software; you can redistribute it and/or modify //
28 // it under the terms of the GNU General Public License as published by //
29 // the Free Software Foundation; either version 2 of the License, or //
30 // (at your option) any later version. //
31 // //
32 // This program is distributed in the hope that it will be useful, //
33 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
34 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
35 // GNU General Public License for more details: //
36 // //
37 // http://www.gnu.org/copyleft/gpl.html //
38 // //
39 /////////////////////////////////////////////////////////////////////////////
41 require_once('../config.php');
42 require_once($CFG->dirroot.'/calendar/lib.php');
44 $var = required_param('var', PARAM_ALPHA);
45 $return = clean_param(base64_decode(required_param('return', PARAM_RAW)), PARAM_LOCALURL);
46 $courseid = optional_param('id', -1, PARAM_INT);
47 if ($courseid != -1) {
48 $return = new moodle_url($return, array('course' => $courseid));
49 } else {
50 $return = new moodle_url($return);
53 if (!confirm_sesskey()) {
54 // Do not call require_sesskey() since this page may be accessed without session (for example by bots).
55 redirect($return);
58 $url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return->out_as_local_url(false)), 'course' => $courseid, 'var'=>$var, 'sesskey'=>sesskey()));
59 $PAGE->set_url($url);
60 $PAGE->set_context(context_system::instance());
62 switch($var) {
63 case 'showgroups':
64 calendar_set_event_type_display(CALENDAR_EVENT_GROUP);
65 break;
66 case 'showcourses':
67 calendar_set_event_type_display(CALENDAR_EVENT_COURSE);
68 break;
69 case 'showglobal':
70 calendar_set_event_type_display(CALENDAR_EVENT_GLOBAL);
71 break;
72 case 'showuser':
73 calendar_set_event_type_display(CALENDAR_EVENT_USER);
74 break;
77 redirect($return);