require_once($CFG->dirroot.'/calendar/lib.php');
- if($this->content !== NULL) {
+ if ($this->content !== NULL) {
return $this->content;
}
$this->content->text = '';
$this->content->footer = '';
- if($this->course === NULL) {
+ if ($this->course === NULL) {
// Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
- }
- else {
+
+ } else {
$courseshown = $this->course->id;
$filtercourse = array($courseshown => 1);
}
calendar_set_filters($courses, $group, $user, $filtercourse, $filtercourse);
- if($courseshown == 1) {
+ if ($courseshown == 1) {
// For the front page
$this->content->text .= calendar_overlib_html();
$this->content->text .= calendar_top_controls('frontpage', array('m' => $_GET['cal_m'], 'y' => $_GET['cal_y']));
$this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']);
// No filters for now
- }
- else {
+
+ } else {
// For any other course
$this->content->text .= calendar_overlib_html();
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $_GET['cal_m'], 'y' => $_GET['cal_y']));
$this->content->text .= calendar_get_mini($courses, $group, $user, $_GET['cal_m'], $_GET['cal_y']);
- $this->content->text .= calendar_filter_controls('course');
+ $this->content->text .= calendar_filter_controls('course', '', $this->course);
}
return $this->content;
return $content;
}
-function calendar_filter_controls($type, $vars = NULL) {
+function calendar_filter_controls($type, $vars = NULL, $course = NULL) {
global $CFG, $SESSION, $USER;
$groupevents = true;
+ $getvars = '';
switch($type) {
case 'upcoming':
break;
case 'course':
$getvars = '&from=course&id='.$_GET['id'];
- if($course->groupmode == NOGROUPS && $course->groupmodeforce) {
+ if (isset($course->groupmode) and !$course->groupmode and $course->groupmodeforce) {
$groupevents = false;
}
break;
}
- if(!empty($vars)) {
+ if (!empty($vars)) {
$getvars .= '&'.$vars;
}