Bumping version for 1.8.9 release. Thinking we might have to go to x.x.10 for the...
[moodle.git] / calendar / view.php
blobc0326bd1eec0afe458cad416b7192d06b14ed7fe
1 <?php // $Id$
3 /////////////////////////////////////////////////////////////////////////////
4 // //
5 // NOTICE OF COPYRIGHT //
6 // //
7 // Moodle - Calendar extension //
8 // //
9 // Copyright (C) 2003-2004 Greek School Network www.sch.gr //
10 // //
11 // Designed by: //
12 // Avgoustos Tsinakos (tsinakos@teikav.edu.gr) //
13 // Jon Papaioannou (pj@moodle.org) //
14 // //
15 // Programming and development: //
16 // Jon Papaioannou (pj@moodle.org) //
17 // //
18 // For bugs, suggestions, etc contact: //
19 // Jon Papaioannou (pj@moodle.org) //
20 // //
21 // The current module was developed at the University of Macedonia //
22 // (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) //
23 // The aim of this project is to provide additional and improved //
24 // functionality to the Asynchronous Distance Education service that the //
25 // Greek School Network deploys. //
26 // //
27 // This program is free software; you can redistribute it and/or modify //
28 // it under the terms of the GNU General Public License as published by //
29 // the Free Software Foundation; either version 2 of the License, or //
30 // (at your option) any later version. //
31 // //
32 // This program is distributed in the hope that it will be useful, //
33 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
34 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
35 // GNU General Public License for more details: //
36 // //
37 // http://www.gnu.org/copyleft/gpl.html //
38 // //
39 /////////////////////////////////////////////////////////////////////////////
41 // Display the calendar page.
43 require_once('../config.php');
44 require_once($CFG->dirroot.'/course/lib.php');
45 require_once($CFG->dirroot.'/calendar/lib.php');
47 $courseid = optional_param('course', 0, PARAM_INT);
48 $view = optional_param('view', 'upcoming', PARAM_ALPHA);
49 $day = optional_param('cal_d', 0, PARAM_INT);
50 $mon = optional_param('cal_m', 0, PARAM_INT);
51 $yr = optional_param('cal_y', 0, PARAM_INT);
53 if(!$site = get_site()) {
54 redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php');
57 if ($courseid) {
58 require_login($courseid);
59 } else if ($CFG->forcelogin) {
60 require_login();
63 // Initialize the session variables
64 calendar_session_vars();
66 //add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id");
67 $now = usergetdate(time());
68 $pagetitle = '';
70 $nav = calendar_get_link_tag(get_string('calendar', 'calendar'), CALENDAR_URL.'view.php?view=upcoming&amp;course='.$courseid.'&amp;', $now['mday'], $now['mon'], $now['year']);
73 if(!checkdate($mon, $day, $yr)) {
74 $day = intval($now['mday']);
75 $mon = intval($now['mon']);
76 $yr = intval($now['year']);
78 $time = make_timestamp($yr, $mon, $day);
80 switch($view) {
81 case 'day':
82 $nav .= ' -> '.userdate($time, get_string('strftimedate'));
83 $pagetitle = get_string('dayview', 'calendar');
84 break;
85 case 'month':
86 $nav .= ' -> '.userdate($time, get_string('strftimemonthyear'));
87 $pagetitle = get_string('detailedmonthview', 'calendar');
88 break;
89 case 'upcoming':
90 $pagetitle = get_string('upcomingevents', 'calendar');
91 break;
94 // If a course has been supplied in the URL, change the filters to show that one
95 if (!empty($courseid)) {
96 if ($course = get_record('course', 'id', $courseid)) {
97 if ($course->id == SITEID) {
98 // If coming from the home page, show all courses
99 $SESSION->cal_courses_shown = calendar_get_default_courses(true);
100 calendar_set_referring_course(0);
102 } else {
103 // Otherwise show just this one
104 $SESSION->cal_courses_shown = $course->id;
105 calendar_set_referring_course($SESSION->cal_courses_shown);
108 } else {
109 $course = null;
112 if (empty($USER->id) or isguest()) {
113 $defaultcourses = calendar_get_default_courses();
114 calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses);
116 } else {
117 calendar_set_filters($courses, $groups, $users);
120 // Let's see if we are supposed to provide a referring course link
121 // but NOT for the "main page" course
122 if ($SESSION->cal_course_referer != SITEID &&
123 ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
124 // If we know about the referring course, show a return link and ALSO require login!
125 require_login();
126 $nav = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$SESSION->cal_course_referer.'">'.$shortname.'</a> -> '.$nav;
127 if (empty($course)) {
128 $course = get_record('course', 'id', $SESSION->cal_course_referer); // Useful to have around
132 $strcalendar = get_string('calendar', 'calendar');
133 $prefsbutton = calendar_preferences_button();
135 // Print title and header
136 print_header("$site->shortname: $strcalendar: $pagetitle", $strcalendar, $nav,
137 '', '', true, $prefsbutton, user_login_string($site));
139 echo calendar_overlib_html();
141 // Layout the whole page as three big columns.
142 echo '<table id="calendar" style="height:100%;">';
143 echo '<tr>';
145 // START: Main column
147 echo '<td class="maincalendar">';
148 echo '<div class="heightcontainer">';
150 switch($view) {
151 case 'day':
152 calendar_show_day($day, $mon, $yr, $courses, $groups, $users, $courseid);
153 break;
154 case 'month':
155 calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid);
156 break;
157 case 'upcoming':
158 calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS), $courseid);
159 break;
162 //Link to calendar export page
163 echo '<div class="bottom">';
164 print_single_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar'));
166 if (!empty($USER->id)) {
167 $authtoken = sha1($USER->username . $USER->password);
168 $usernameencoded = urlencode($USER->username);
170 echo "<a href=\"export_execute.php?preset_what=all&amp;preset_time=recentupcoming&amp;username=$usernameencoded&amp;authtoken=$authtoken\">"
171 .'<img src="'.$CFG->pixpath.'/i/ical.gif" height="14" width="36" '
172 .'alt="'.get_string('ical', 'calendar').'" '
173 .'title="'.get_string('quickdownloadcalendar', 'calendar').'" />'
174 .'</a>';
177 echo '</div>';
178 echo '</div>';
179 echo '</td>';
181 // END: Main column
183 // START: Last column (3-month display)
184 echo '<td class="sidecalendar">';
185 echo '<div class="header">'.get_string('monthlyview', 'calendar').'</div>';
187 list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
188 list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
189 $getvars = 'id='.$courseid.'&amp;cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
191 echo '<div class="filters">';
192 echo calendar_filter_controls($view, $getvars);
193 echo '</div>';
195 echo '<div class="minicalendarblock">';
196 echo calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
197 echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
198 echo '</div><div class="minicalendarblock">';
199 echo calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
200 echo calendar_get_mini($courses, $groups, $users, $mon, $yr);
201 echo '</div><div class="minicalendarblock">';
202 echo calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
203 echo calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
204 echo '</div>';
206 echo '</td>';
208 echo '</tr></table>';
210 print_footer();
214 function calendar_show_day($d, $m, $y, $courses, $groups, $users, $courseid) {
215 global $CFG, $USER;
217 if (!checkdate($m, $d, $y)) {
218 $now = usergetdate(time());
219 list($d, $m, $y) = array(intval($now['mday']), intval($now['mon']), intval($now['year']));
222 $getvars = 'from=day&amp;cal_d='.$d.'&amp;cal_m='.$m.'&amp;cal_y='.$y; // For filtering
224 $starttime = make_timestamp($y, $m, $d);
225 $endtime = make_timestamp($y, $m, $d + 1) - 1;
227 $events = calendar_get_upcoming($courses, $groups, $users, 1, 100, $starttime);
229 $text = '';
230 if (!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
231 $text.= '<div class="buttons">';
232 $text.= '<form action="'.CALENDAR_URL.'event.php" method="get">';
233 $text.= '<div>';
234 $text.= '<input type="hidden" name="action" value="new" />';
235 $text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
236 $text.= '<input type="hidden" name="cal_d" value="'.$d.'" />';
237 $text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
238 $text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
239 $text.= '<input type="submit" value="'.get_string('newevent', 'calendar').'" />';
240 $text.= '</div></form></div>';
243 $text .= get_string('dayview', 'calendar').': '.calendar_course_filter_selector($getvars);
245 echo '<div class="header">'.$text.'</div>';
247 echo '<div class="controls">'.calendar_top_controls('day', array('id' => $courseid, 'd' => $d, 'm' => $m, 'y' => $y)).'</div>';
249 if (empty($events)) {
250 // There is nothing to display today.
251 echo '<h3>'.get_string('daywithnoevents', 'calendar').'</h3>';
253 } else {
255 echo '<div class="eventlist">';
257 $underway = array();
259 // First, print details about events that start today
260 foreach ($events as $event) {
262 $event->calendarcourseid = $courseid;
264 if ($event->timestart >= $starttime && $event->timestart <= $endtime) { // Print it now
268 $dayend = calendar_day_representation($event->timestart + $event->timeduration);
269 $timeend = calendar_time_representation($event->timestart + $event->timeduration);
270 $enddate = usergetdate($event->timestart + $event->timeduration);
271 // Set printable representation
272 echo calendar_get_link_tag($dayend, CALENDAR_URL.'view.php?view=day'.$morehref.'&amp;', $enddate['mday'], $enddate['mon'], $enddate['year']).' ('.$timeend.')';
274 //unset($event->time);
275 $event->time = calendar_format_event_time($event, time(), '', false);
276 calendar_print_event($event);
278 } else { // Save this for later
279 $underway[] = $event;
283 // Then, show a list of all events that just span this day
284 if (!empty($underway)) {
285 echo '<h3>'.get_string('spanningevents', 'calendar').':</h3>';
286 foreach ($underway as $event) {
287 $event->time = calendar_format_event_time($event, time(), '', false);
288 calendar_print_event($event);
292 echo '</div>';
297 function calendar_show_month_detailed($m, $y, $courses, $groups, $users, $courseid) {
298 global $CFG, $SESSION, $USER, $CALENDARDAYS;
299 global $day, $mon, $yr;
301 $getvars = 'from=month&amp;cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
303 $display = &New stdClass;
304 $display->minwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY);
305 $display->maxwday = $display->minwday + 6;
307 if(!empty($m) && !empty($y)) {
308 $thisdate = usergetdate(time()); // Time and day at the user's location
309 if($m == $thisdate['mon'] && $y == $thisdate['year']) {
310 // Navigated to this month
311 $date = $thisdate;
312 $display->thismonth = true;
314 else {
315 // Navigated to other month, let's do a nice trick and save us a lot of work...
316 if(!checkdate($m, 1, $y)) {
317 $date = array('mday' => 1, 'mon' => $thisdate['mon'], 'year' => $thisdate['year']);
318 $display->thismonth = true;
320 else {
321 $date = array('mday' => 1, 'mon' => $m, 'year' => $y);
322 $display->thismonth = false;
326 else {
327 $date = usergetdate(time());
328 $display->thismonth = true;
331 // Fill in the variables we 're going to use, nice and tidy
332 list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display
333 $display->maxdays = calendar_days_in_month($m, $y);
335 $startwday = 0;
336 if (get_user_timezone_offset() < 99) {
337 // We 'll keep these values as GMT here, and offset them when the time comes to query the db
338 $display->tstart = gmmktime(0, 0, 0, $m, 1, $y); // This is GMT
339 $display->tend = gmmktime(23, 59, 59, $m, $display->maxdays, $y); // GMT
340 $startwday = gmdate('w', $display->tstart); // $display->tstart is already GMT, so don't use date(): messes with server's TZ
341 } else {
342 // no timezone info specified
343 $display->tstart = mktime(0, 0, 0, $m, 1, $y);
344 $display->tend = mktime(23, 59, 59, $m, $display->maxdays, $y);
345 $startwday = date('w', $display->tstart); // $display->tstart not necessarily GMT, so use date()
348 // Align the starting weekday to fall in our display range
349 if($startwday < $display->minwday) {
350 $startwday += 7;
353 // Get events from database
354 $whereclause = calendar_sql_where(usertime($display->tstart), usertime($display->tend), $users, $groups, $courses);
355 if($whereclause === false) {
356 $events = array();
358 else {
359 $events = get_records_select('event', $whereclause, 'timestart');
362 // Extract information: events vs. time
363 calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday);
365 $text = '';
366 if(!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
367 $text.= '<div class="buttons"><form action="'.CALENDAR_URL.'event.php" method="get">';
368 $text.= '<div>';
369 $text.= '<input type="hidden" name="action" value="new" />';
370 $text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
371 $text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
372 $text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
373 $text.= '<input type="submit" value="'.get_string('newevent', 'calendar').'" />';
374 $text.= '</div></form></div>';
377 $text .= get_string('detailedmonthview', 'calendar').': '.calendar_course_filter_selector($getvars);
379 echo '<div class="header">'.$text.'</div>';
381 echo '<div class="controls">';
382 echo calendar_top_controls('month', array('id' => $courseid, 'm' => $m, 'y' => $y));
383 echo '</div>';
385 // Start calendar display
386 echo '<table class="calendarmonth"><tr class="weekdays">'; // Begin table. First row: day names
388 // Print out the names of the weekdays
389 for($i = $display->minwday; $i <= $display->maxwday; ++$i) {
390 // This uses the % operator to get the correct weekday no matter what shift we have
391 // applied to the $display->minwday : $display->maxwday range from the default 0 : 6
392 echo '<th scope="col">'.get_string($CALENDARDAYS[$i % 7], 'calendar').'</th>';
395 echo '</tr><tr>'; // End of day names; prepare for day numbers
397 // For the table display. $week is the row; $dayweek is the column.
398 $week = 1;
399 $dayweek = $startwday;
401 // Paddding (the first week may have blank days in the beginning)
402 for($i = $display->minwday; $i < $startwday; ++$i) {
403 echo '<td>&nbsp;</td>'."\n";
406 // Now display all the calendar
407 for($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) {
408 if($dayweek > $display->maxwday) {
409 // We need to change week (table row)
410 echo "</tr>\n<tr>";
411 $dayweek = $display->minwday;
412 ++$week;
415 // Reset vars
416 $cell = '';
417 $dayhref = calendar_get_link_href(CALENDAR_URL.'view.php?view=day&amp;course='.$courseid.'&amp;', $day, $m, $y);
419 if(CALENDAR_WEEKEND & (1 << ($dayweek % 7))) {
420 // Weekend. This is true no matter what the exact range is.
421 $class = 'weekend';
423 else {
424 // Normal working day.
425 $class = '';
428 // Special visual fx if an event is defined
429 if(isset($eventsbyday[$day])) {
430 if(isset($typesbyday[$day]['startglobal'])) {
431 $class .= ' event_global';
433 else if(isset($typesbyday[$day]['startcourse'])) {
434 $class .= ' event_course';
436 else if(isset($typesbyday[$day]['startgroup'])) {
437 $class .= ' event_group';
439 else if(isset($typesbyday[$day]['startuser'])) {
440 $class .= ' event_user';
442 if(count($eventsbyday[$day]) == 1) {
443 $title = get_string('oneevent', 'calendar');
445 else {
446 $title = get_string('manyevents', 'calendar', count($eventsbyday[$day]));
448 $cell = '<div class="day"><a href="'.$dayhref.'" title="'.$title.'">'.$day.'</a></div>';
450 else {
451 $cell = '<div class="day">'.$day.'</div>';
454 // Special visual fx if an event spans many days
455 if(isset($typesbyday[$day]['durationglobal'])) {
456 $class .= ' duration_global';
458 else if(isset($typesbyday[$day]['durationcourse'])) {
459 $class .= ' duration_course';
461 else if(isset($typesbyday[$day]['durationgroup'])) {
462 $class .= ' duration_group';
464 else if(isset($typesbyday[$day]['durationuser'])) {
465 $class .= ' duration_user';
468 // Special visual fx for today
469 if($display->thismonth && $day == $d) {
470 $class .= ' today';
473 // Just display it
474 if(!empty($class)) {
475 $class = ' class="'.trim($class).'"';
477 echo '<td'.$class.'>'.$cell;
479 if(isset($eventsbyday[$day])) {
480 echo '<ul class="events-new">';
481 foreach($eventsbyday[$day] as $eventindex) {
482 echo '<li><a href="'.$dayhref.'#event_'.$events[$eventindex]->id.'">'.format_string($events[$eventindex]->name, true).'</a></li>';
484 echo '</ul>';
486 if(isset($durationbyday[$day])) {
487 echo '<ul class="events-underway">';
488 foreach($durationbyday[$day] as $eventindex) {
489 echo '<li>['.format_string($events[$eventindex]->name,true).']</li>';
491 echo '</ul>';
493 echo "</td>\n";
496 // Paddding (the last week may have blank days at the end)
497 for($i = $dayweek; $i <= $display->maxwday; ++$i) {
498 echo '<td>&nbsp;</td>';
500 echo "</tr>\n"; // Last row ends
502 echo "</table>\n"; // Tabular display of days ends
504 // OK, now for the filtering display
505 echo '<div class="filters"><table><tr>';
507 // Global events
508 if($SESSION->cal_show_global) {
509 echo '<td class="event_global" style="width: 8px;"></td><td><strong>'.get_string('globalevents', 'calendar').':</strong> ';
510 echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showglobal&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";
512 else {
513 echo '<td style="width: 8px;"></td><td><strong>'.get_string('globalevents', 'calendar').':</strong> ';
514 echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showglobal&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";
517 // Course events
518 if(!empty($SESSION->cal_show_course)) {
519 echo '<td class="event_course" style="width: 8px;"></td><td><strong>'.get_string('courseevents', 'calendar').':</strong> ';
520 echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showcourses&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";
522 else {
523 echo '<td style="width: 8px;"></td><td><strong>'.get_string('courseevents', 'calendar').':</strong> ';
524 echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showcourses&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";
527 echo "</tr>\n";
529 if(!empty($USER->id) && !isguest()) {
530 echo '<tr>';
531 // Group events
532 if($SESSION->cal_show_groups) {
533 echo '<td class="event_group" style="width: 8px;"></td><td><strong>'.get_string('groupevents', 'calendar').':</strong> ';
534 echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showgroups&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";
536 else {
537 echo '<td style="width: 8px;"></td><td><strong>'.get_string('groupevents', 'calendar').':</strong> ';
538 echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showgroups&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";
540 // User events
541 if($SESSION->cal_show_user) {
542 echo '<td class="event_user" style="width: 8px;"></td><td><strong>'.get_string('userevents', 'calendar').':</strong> ';
543 echo get_string('shown', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showuser&amp;'.$getvars.'">'.get_string('clickhide', 'calendar').'</a>)</td>'."\n";
545 else {
546 echo '<td style="width: 8px;"></td><td><strong>'.get_string('userevents', 'calendar').':</strong> ';
547 echo get_string('hidden', 'calendar').' (<a href="'.CALENDAR_URL.'set.php?var=showuser&amp;'.$getvars.'">'.get_string('clickshow', 'calendar').'</a>)</td>'."\n";
549 echo "</tr>\n";
552 echo '</table></div>';
555 function calendar_show_upcoming_events($courses, $groups, $users, $futuredays, $maxevents, $courseid) {
556 global $USER;
558 $events = calendar_get_upcoming($courses, $groups, $users, $futuredays, $maxevents);
560 $text = '';
562 if(!isguest() && !empty($USER->id) && calendar_user_can_add_event()) {
563 $text.= '<div class="buttons">';
564 $text.= '<form action="'.CALENDAR_URL.'event.php" method="get">';
565 $text.= '<div>';
566 $text.= '<input type="hidden" name="action" value="new" />';
567 $text.= '<input type="hidden" name="course" value="'.$courseid.'" />';
569 $text.= '<input type="hidden" name="cal_m" value="'.$m.'" />';
570 $text.= '<input type="hidden" name="cal_y" value="'.$y.'" />';
572 $text.= '<input type="submit" value="'.get_string('newevent', 'calendar').'" />';
573 $text.= '</div></form></div>';
576 $text .= get_string('upcomingevents', 'calendar').': '.calendar_course_filter_selector('from=upcoming');
578 echo '<div class="header">'.$text.'</div>';
580 if ($events) {
581 echo '<div class="eventlist">';
582 foreach ($events as $event) {
583 $event->calendarcourseid = $courseid;
584 calendar_print_event($event);
586 echo '</div>';
587 } else {
588 print_heading(get_string('noupcomingevents', 'calendar'));
592 function calendar_course_filter_selector($getvars = '') {
593 global $USER, $SESSION;
595 if (empty($USER->id) or isguest()) {
596 return '';
599 if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM, SITEID)) && !empty($CFG->calendar_adminseesall)) {
600 $courses = get_courses('all', 'c.shortname','c.id,c.shortname');
601 } else {
602 $courses = get_my_courses($USER->id, 'shortname');
605 unset($courses[SITEID]);
607 $courseoptions[SITEID] = get_string('fulllistofcourses');
608 foreach ($courses as $course) {
609 $courseoptions[$course->id] = format_string($course->shortname);
612 if (is_numeric($SESSION->cal_courses_shown)) {
613 $selected = $SESSION->cal_courses_shown;
614 } else {
615 $selected = '';
618 return popup_form(CALENDAR_URL.'set.php?var=setcourse&amp;'.$getvars.'&amp;id=',
619 $courseoptions, 'cal_course_flt', $selected, '', '', '', true);