$yr = optional_param('cal_y', 0, PARAM_INT);
if ($courseid = optional_param('course', 0, PARAM_INT)) {
$course = $DB->get_record('course', array('id'=>$courseid));
+} else {
+ $course = NULL;
}
require_login();
$navlinks = array();
$now = usergetdate(time());
-if ($course->id != SITEID) {
+if (!empty($courseid) && $course->id != SITEID) {
$navlinks[] = array('name' => $course->shortname,
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
'type' => 'misc');
continue;
}
}
+ $hostaddress = str_replace('http://', '', $CFG->wwwroot);
+ $hostaddress = str_replace('https://', '', $hostaddress);
+
$ev = new iCalendar_event;
- $ev->add_property('uid', $event->id.'@'.$_SERVER['HTTP_HOST']);
+ $ev->add_property('uid', $event->id.'@'.$hostaddress);
$ev->add_property('summary', $event->name);
$ev->add_property('description', $event->description);
$ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL