From 6df1e8beb53eff41455a35938acc9f5df39b5205 Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Sat, 16 Oct 2010 18:07:43 +0400 Subject: [PATCH] Fixed bug with using filter controls on page with attendance report for single user (in teacher mode) --- locallib.php | 10 ++++++---- manage.php | 2 +- report.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/locallib.php b/locallib.php index 9556c4a..f70e78e 100644 --- a/locallib.php +++ b/locallib.php @@ -239,7 +239,7 @@ function print_attendance_table($user, $course, $attforblock) { } function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing = null) { - global $CFG, $COURSE, $mode, $current, $view, $id; + global $CFG, $COURSE, $mode, $current, $view, $id, $studentid; echo ''; if (!$printing) { @@ -300,7 +300,7 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing set_current_date ($course->id, $current); list($startdate, $enddate) = - print_filter_controls("view.php", $id); + print_filter_controls("view.php", $id, $studentid); if ($startdate && $enddate) { $where = "ats.courseid={$course->id} AND al.studentid = {$user->id} AND ats.sessdate >= $startdate AND ats.sessdate < $enddate"; @@ -339,7 +339,7 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing echo '
 
'; } -function print_filter_controls($url, $id, $sort=NULL, $printselector=WITHOUT_SELECTOR) { +function print_filter_controls($url, $id, $studentid=0, $sort=NULL, $printselector=WITHOUT_SELECTOR) { global $SESSION, $current, $view, $cm; @@ -385,7 +385,7 @@ function print_filter_controls($url, $id, $sort=NULL, $printselector=WITHOUT_SEL break; } - $link = $url . "?id=$id" . ($sort ? "&sort=$sort" : ""); + $link = $url . "?id=$id" . ($sort ? "&sort=$sort" : "") . ($studentid ? "&student=$studentid" : ""); if ($printselector === GROUP_SELECTOR) { $groupmode = groups_get_activity_groupmode($cm); @@ -506,6 +506,8 @@ function print_filter_controls($url, $id, $sort=NULL, $printselector=WITHOUT_SEL $curdatecontrols .= ""; if ($sort) $curdatecontrols .= ""; + if ($studentid) + $curdatecontrols .= ""; $curdatecontrols .= ""; $curdatecontrols .= ""; $curdatecontrols .= ""; diff --git a/manage.php b/manage.php index 518124e..84af654 100644 --- a/manage.php +++ b/manage.php @@ -104,7 +104,7 @@ function print_sessions_list($course) { set_current_date ($course->id, $current); list($startdate, $enddate, $currentgroup) = - print_filter_controls("manage.php", $id, NULL, SESSION_TYPE_SELECTOR); + print_filter_controls("manage.php", $id, 0, NULL, SESSION_TYPE_SELECTOR); if ($startdate && $enddate) { $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate"; diff --git a/report.php b/report.php index 5ac5d05..70088f4 100644 --- a/report.php +++ b/report.php @@ -69,7 +69,7 @@ set_current_date ($course->id, $current); list($startdate, $enddate, $currentgroup) = - print_filter_controls("report.php", $id, $sort, GROUP_SELECTOR); + print_filter_controls("report.php", $id, 0, $sort, GROUP_SELECTOR); if ($startdate && $enddate) { $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";