2004-03-29 15:28:15 +00:00
|
|
|
<?php // $Id$
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// //
|
|
|
|
// NOTICE OF COPYRIGHT //
|
|
|
|
// //
|
|
|
|
// Moodle - Calendar extension //
|
|
|
|
// //
|
|
|
|
// Copyright (C) 2003-2004 Greek School Network www.sch.gr //
|
|
|
|
// //
|
|
|
|
// Designed by: //
|
2007-02-27 13:49:43 +00:00
|
|
|
// Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
|
|
|
|
// Jon Papaioannou (pj@moodle.org) //
|
2004-03-29 15:28:15 +00:00
|
|
|
// //
|
|
|
|
// Programming and development: //
|
2007-02-27 13:49:43 +00:00
|
|
|
// Jon Papaioannou (pj@moodle.org) //
|
2004-03-29 15:28:15 +00:00
|
|
|
// //
|
|
|
|
// For bugs, suggestions, etc contact: //
|
2007-02-27 13:49:43 +00:00
|
|
|
// Jon Papaioannou (pj@moodle.org) //
|
2004-03-29 15:28:15 +00:00
|
|
|
// //
|
|
|
|
// The current module was developed at the University of Macedonia //
|
|
|
|
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
|
|
|
|
// The aim of this project is to provide additional and improved //
|
|
|
|
// functionality to the Asynchronous Distance Education service that the //
|
|
|
|
// Greek School Network deploys. //
|
|
|
|
// //
|
|
|
|
// This program 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 2 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program 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: //
|
|
|
|
// //
|
|
|
|
// http://www.gnu.org/copyleft/gpl.html //
|
|
|
|
// //
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-05-21 10:54:46 +00:00
|
|
|
require_once('../config.php');
|
2004-06-02 08:13:26 +00:00
|
|
|
require_once($CFG->dirroot.'/calendar/lib.php');
|
2004-03-29 15:28:15 +00:00
|
|
|
|
2005-06-15 14:58:17 +00:00
|
|
|
$from = required_param('from');
|
|
|
|
$var = required_param('var');
|
|
|
|
$value = optional_param('value');
|
|
|
|
$id = optional_param('id');
|
|
|
|
$cal_d = optional_param('cal_d');
|
|
|
|
$cal_m = optional_param('cal_m');
|
|
|
|
$cal_y = optional_param('cal_y');
|
2004-03-29 15:28:15 +00:00
|
|
|
|
2005-06-15 14:58:17 +00:00
|
|
|
switch($var) {
|
2004-05-28 10:53:54 +00:00
|
|
|
case 'setuser':
|
|
|
|
// Not implemented yet (or possibly at all)
|
|
|
|
break;
|
2004-05-21 10:54:46 +00:00
|
|
|
case 'setcourse':
|
2005-06-15 14:58:17 +00:00
|
|
|
$id = intval($id);
|
2004-05-21 10:54:46 +00:00
|
|
|
if($id == 0) {
|
|
|
|
$SESSION->cal_courses_shown = array();
|
2004-05-24 11:40:34 +00:00
|
|
|
calendar_set_referring_course(0);
|
2004-05-21 10:54:46 +00:00
|
|
|
}
|
|
|
|
else if($id == 1) {
|
|
|
|
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
|
2004-05-24 11:40:34 +00:00
|
|
|
calendar_set_referring_course(0);
|
2004-05-21 10:54:46 +00:00
|
|
|
}
|
|
|
|
else {
|
2004-05-24 11:40:34 +00:00
|
|
|
if(get_record('course', 'id', $id) === false) {
|
|
|
|
// There is no such course
|
|
|
|
$SESSION->cal_courses_shown = array();
|
|
|
|
calendar_set_referring_course(0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
calendar_set_referring_course($id);
|
|
|
|
$SESSION->cal_courses_shown = $id;
|
|
|
|
}
|
2004-05-21 10:54:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'showgroups':
|
|
|
|
$SESSION->cal_show_groups = !$SESSION->cal_show_groups;
|
2005-01-12 11:55:01 +00:00
|
|
|
set_user_preference('calendar_savedflt', calendar_get_filters_status());
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'showcourses':
|
|
|
|
$SESSION->cal_show_course = !$SESSION->cal_show_course;
|
2005-01-12 11:55:01 +00:00
|
|
|
set_user_preference('calendar_savedflt', calendar_get_filters_status());
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'showglobal':
|
|
|
|
$SESSION->cal_show_global = !$SESSION->cal_show_global;
|
2005-01-12 11:55:01 +00:00
|
|
|
set_user_preference('calendar_savedflt', calendar_get_filters_status());
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'showuser':
|
2004-05-28 10:53:54 +00:00
|
|
|
$SESSION->cal_show_user = !$SESSION->cal_show_user;
|
2005-01-12 11:55:01 +00:00
|
|
|
set_user_preference('calendar_savedflt', calendar_get_filters_status());
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-03-29 15:28:15 +00:00
|
|
|
|
2005-06-15 14:58:17 +00:00
|
|
|
switch($from) {
|
2004-05-24 12:12:41 +00:00
|
|
|
case 'event':
|
2005-06-15 14:58:17 +00:00
|
|
|
redirect(CALENDAR_URL.'event.php?action='.$action.'&type='.$type.'&id='.intval($id));
|
2004-05-24 12:12:41 +00:00
|
|
|
break;
|
2004-05-21 10:54:46 +00:00
|
|
|
case 'month':
|
2005-06-15 14:58:17 +00:00
|
|
|
redirect(CALENDAR_URL.'view.php?view=month&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'upcoming':
|
2004-05-24 12:12:41 +00:00
|
|
|
redirect(CALENDAR_URL.'view.php?view=upcoming');
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'day':
|
2005-06-15 14:58:17 +00:00
|
|
|
redirect(CALENDAR_URL.'view.php?view=day&cal_d='.$cal_d.'&cal_m='.$cal_m.'&cal_y='.$cal_y);
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
case 'course':
|
2005-06-15 14:58:17 +00:00
|
|
|
redirect($CFG->wwwroot.'/course/view.php?id='.intval($id));
|
2004-05-21 10:54:46 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-03-29 15:28:15 +00:00
|
|
|
|
2004-05-21 10:54:46 +00:00
|
|
|
}
|
2004-03-29 15:28:15 +00:00
|
|
|
?>
|