diff --git a/calendar/lib.php b/calendar/lib.php
index 3b4b9b12118..185daa00a61 100644
--- a/calendar/lib.php
+++ b/calendar/lib.php
@@ -116,7 +116,7 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
}
// This is either a genius idea or an idiot idea: in order to not complicate things, we use this rule: if, after
- // possibly removing courseid 1 from $courses, there is only one course left, then clicking on a day in the month
+ // possibly removing SITEID from $courses, there is only one course left, then clicking on a day in the month
// will also set the $SESSION->cal_courses_shown variable to that one course. Otherwise, we 'd need to add extra
// arguments to this function.
@@ -190,10 +190,10 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
$popupicon = $CFG->modpixpath.'/'.$event->modulename.'/icon.gif';
$popupalt = $event->modulename;
- } else if ($event->courseid == 1) { // Site event
+ } else if ($event->courseid == SITEID) { // Site event
$popupicon = $CFG->pixpath.'/c/site.gif';
$popupalt = '';
- } else if ($event->courseid > 1 and empty($event->groupid)) { // Course event
+ } else if ($event->courseid != SITEID && empty($event->groupid)) { // Course event
$popupicon = $CFG->pixpath.'/c/course.gif';
$popupalt = '';
} else if ($event->groupid) { // Group event
@@ -302,7 +302,7 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
}
// This is either a genius idea or an idiot idea: in order to not complicate things, we use this rule: if, after
- // possibly removing courseid 1 from $courses, there is only one course left, then clicking on a day in the month
+ // possibly removing SITEID from $courses, there is only one course left, then clicking on a day in the month
// will also set the $SESSION->cal_courses_shown variable to that one course. Otherwise, we 'd need to add extra
// arguments to this function.
@@ -355,14 +355,12 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
$output[$outkey]->cmid = $module->id;
-
- } else if($event->courseid == 1) { // Site event
+ } else if($event->courseid == SITEID) { // Site event
$output[$outkey]->icon = '
';
$output[$outkey]->time = $eventtime;
-
- } else if($event->courseid > 1 and !$event->groupid) { // Course event
+ } else if($event->courseid != SITEID && !$event->groupid) { // Course event
calendar_get_course_cached($coursecache, $event->courseid);
$output[$outkey]->icon = '
';
@@ -370,13 +368,11 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve
$output[$outkey]->courselink = ''.$coursecache[$event->courseid]->fullname.'';
-
} else if ($event->groupid) { // Group event
$output[$outkey]->icon = '
';
$output[$outkey]->time = $eventtime;
-
} else if($event->userid) { // User event
$output[$outkey]->icon = '
';
$output[$outkey]->time = $eventtime;
@@ -802,10 +798,10 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio
$eventsbyday[$eventdaystart][] = $event->id;
// Mark the day as having such an event
- if($event->courseid == 1 && $event->groupid == 0) {
+ if($event->courseid == SITEID && $event->groupid == 0) {
$typesbyday[$eventdaystart]['startglobal'] = true;
}
- else if($event->courseid > 1 && $event->groupid == 0) {
+ else if($event->courseid != SITEID && $event->groupid == 0) {
$typesbyday[$eventdaystart]['startcourse'] = true;
}
else if($event->groupid) {
@@ -830,10 +826,10 @@ function calendar_events_by_day($events, $month, $year, &$eventsbyday, &$duratio
// Mark all days between $lowerbound and $upperbound (inclusive) as duration
for($i = $lowerbound + 1; $i <= $upperbound; ++$i) {
$durationbyday[$i][] = $event->id;
- if($event->courseid == 1 && $event->groupid == 0) {
+ if($event->courseid == SITEID && $event->groupid == 0) {
$typesbyday[$i]['durationglobal'] = true;
}
- else if($event->courseid > 1 && $event->groupid == 0) {
+ else if($event->courseid != SITEID && $event->groupid == 0) {
$typesbyday[$i]['durationcourse'] = true;
}
else if($event->groupid) {
@@ -932,11 +928,11 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
if(($SESSION->cal_show_course && $SESSION->cal_show_global) || $ignorefilters) {
if(is_int($courseeventsfrom)) {
- $courses = array(1, $courseeventsfrom);
+ $courses = array(SITEID, $courseeventsfrom);
}
else if(is_array($courseeventsfrom)) {
$courses = array_keys($courseeventsfrom);
- $courses[] = 1;
+ $courses[] = SITEID;
}
}
else if($SESSION->cal_show_course) {
@@ -1007,7 +1003,7 @@ function calendar_edit_event_allowed($event) {
if (isadmin($USER->id)) return true; // Admins are allowed anything
- if ($event->courseid > 1) {
+ if ($event->courseid != SITEID) {
// Course event, only editing teachers may... edit :P
if(isteacheredit($event->courseid)) {
return true;
@@ -1033,7 +1029,7 @@ function calendar_get_default_courses($ignoreref = false) {
global $USER, $CFG, $SESSION;
if(!empty($SESSION->cal_course_referer) && !$ignoreref) {
- return array($SESSION->cal_course_referer => 1);
+ return array($SESSION->cal_course_referer => SITEID);
}
if(empty($USER)) {