Fix for 3-month pane event filters, now you don't get a "missing required parameter"

error when you click on them. Reported by Ger Tielemans in the forums.
This commit is contained in:
defacer
2004-05-06 07:45:10 +00:00
parent 319b472958
commit d715f7c4c0
2 changed files with 31 additions and 24 deletions
+29 -23
View File
@@ -569,32 +569,38 @@ function calendar_top_controls($type, $data) {
return $content;
}
function calendar_filter_controls($type) {
function calendar_filter_controls($type, $vars = NULL) {
global $CFG, $SESSION;
$groupevents = true;
switch($type) {
case 'upcoming':
$getvars = '';
break;
case 'prefs':
$getvars = '&from=prefs&pref='.$_GET['edit'];
break;
case 'event':
global $day, $mon, $yr;
$getvars = '&from=event&id='.$_GET['id'];
break;
case 'day':
global $day, $mon, $yr;
$getvars = '&from=day&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr;
break;
case 'course':
global $course;
$getvars = '&from=course&id='.$course->id;
if($course->groupmode == NOGROUPS && $course->groupmodeforce) {
$groupevents = false;
}
break;
if($vars === NULL) {
switch($type) {
case 'upcoming':
$getvars = '';
break;
case 'prefs':
$getvars = '&from=prefs&pref='.$_GET['edit'];
break;
case 'event':
global $day, $mon, $yr;
$getvars = '&from=event&id='.$_GET['id'];
break;
case 'day':
global $day, $mon, $yr;
$getvars = '&from=day&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr;
break;
case 'course':
global $course;
$getvars = '&from=course&id='.$course->id;
if($course->groupmode == NOGROUPS && $course->groupmodeforce) {
$groupevents = false;
}
break;
}
}
else {
$getvars = '&'.$vars;
}
$content = '<table class="cal_controls" style="width: 98%;">';
+2 -1
View File
@@ -171,7 +171,8 @@
print_side_block_start(get_string('monthlyview', 'calendar'), '', 'sideblockmain');
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
echo calendar_filter_controls($_GET['view']);
$getvars = 'from=month&amp;cal_d='.$day.'&amp;cal_m='.$mon.'&amp;cal_y='.$yr; // For filtering
echo calendar_filter_controls($_GET['view'], $getvars);
echo '<p>';
echo calendar_top_controls('display', array('m' => $prevmon, 'y' => $prevyr));
echo calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);