}
// 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.
$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
}
// 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.
$output[$outkey]->cmid = $module->id;
-
- } else if($event->courseid == 1) { // Site event
+ } else if($event->courseid == SITEID) { // Site event
$output[$outkey]->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/site.gif" alt="" style="vertical-align: middle;" />';
$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 = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/course.gif" alt="" style="vertical-align: middle;" />';
$output[$outkey]->courselink = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$event->courseid.'">'.$coursecache[$event->courseid]->fullname.'</a>';
-
} else if ($event->groupid) { // Group event
$output[$outkey]->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/group.gif" alt="" style="vertical-align: middle;" />';
$output[$outkey]->time = $eventtime;
-
} else if($event->userid) { // User event
$output[$outkey]->icon = '<img height="16" width="16" src="'.$CFG->pixpath.'/c/user.gif" alt="" style="vertical-align: middle;" />';
$output[$outkey]->time = $eventtime;
$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) {
// 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) {
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) {
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;
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)) {