From 8792061c5582a0d950861d606dc9af29623dd7d1 Mon Sep 17 00:00:00 2001 From: defacer Date: Fri, 21 May 2004 13:03:59 +0000 Subject: [PATCH] Modified to use popup_form() instead of custom code --- calendar/view.php | 49 ++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/calendar/view.php b/calendar/view.php index 7102b92234..8867e2d81f 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -631,46 +631,31 @@ function calendar_print_event_table($event, $starttime, $endtime, &$coursecache, function calendar_course_filter_selector($getvars = '') { global $USER, $SESSION; + if(isguest($USER->id)) { + return ''; + } + if(isadmin($USER->id)) { $coursesdata = get_courses('all', 'c.shortname'); } - elseif(!isguest($USER->id)) { - $coursesdata = get_my_courses($USER->id, 'shortname'); - } else { - $coursesdata = get_record('course', 'id', $SESSION->cal_course_referer); + $coursesdata = get_my_courses($USER->id, 'shortname'); } - $coursesdata = array_diff_assoc($coursesdata, array(1 => 1)); - $selector = ''; + $coursesdata = array_diff_assoc($coursesdata, array(1 => 1)); + $courseoptions = array(1 => get_string('fulllistofcourses')); - if(!isguest($USER->id)) { - $selector .= '
'; - $selector .= ''; - if(!empty($getvars)) { - $getarray = explode('&', $getvars); - foreach($getarray as $getvar) { - $selector .= ''; - } - } - $selector .= ''; - $selector .= ''; - $selector .= ''; - $selector .= '
'; + foreach($coursesdata as $cdata) { + $courseoptions[$cdata->id] = $cdata->shortname; } - - return $selector; + if(is_numeric($SESSION->cal_courses_shown)) { + $selected = $SESSION->cal_courses_shown; + } + else { + $selected = ''; + } + $form = popup_form(CALENDAR_URL.'set.php?var=setcourse&'.$getvars.'&id=', $courseoptions, 'cal_course_flt', $selected, '', '', '', true); + return str_replace(' -- 2.39.5