Browse Source

Fixed bug with using filter controls on page with attendance report for single user (in teacher mode)

MOODLE_23_STABLE
Artem Andreev 14 years ago
parent
commit
6df1e8beb5
  1. 10
      locallib.php
  2. 2
      manage.php
  3. 2
      report.php

10
locallib.php

@ -239,7 +239,7 @@ function print_attendance_table($user, $course, $attforblock) {
} }
function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing = null) { 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 '<table class="userinfobox">'; echo '<table class="userinfobox">';
if (!$printing) { if (!$printing) {
@ -300,7 +300,7 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate) = list($startdate, $enddate) =
print_filter_controls("view.php", $id); print_filter_controls("view.php", $id, $studentid);
if ($startdate && $enddate) { if ($startdate && $enddate) {
$where = "ats.courseid={$course->id} AND al.studentid = {$user->id} AND ats.sessdate >= $startdate AND ats.sessdate < $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 '</td></tr><tr><td>&nbsp;</td></tr></table></div>'; echo '</td></tr><tr><td>&nbsp;</td></tr></table></div>';
} }
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; global $SESSION, $current, $view, $cm;
@ -385,7 +385,7 @@ function print_filter_controls($url, $id, $sort=NULL, $printselector=WITHOUT_SEL
break; break;
} }
$link = $url . "?id=$id" . ($sort ? "&amp;sort=$sort" : ""); $link = $url . "?id=$id" . ($sort ? "&amp;sort=$sort" : "") . ($studentid ? "&amp;student=$studentid" : "");
if ($printselector === GROUP_SELECTOR) { if ($printselector === GROUP_SELECTOR) {
$groupmode = groups_get_activity_groupmode($cm); $groupmode = groups_get_activity_groupmode($cm);
@ -506,6 +506,8 @@ function print_filter_controls($url, $id, $sort=NULL, $printselector=WITHOUT_SEL
$curdatecontrols .= "<input type=\"hidden\" name=\"id\" value=\"$id\" />"; $curdatecontrols .= "<input type=\"hidden\" name=\"id\" value=\"$id\" />";
if ($sort) if ($sort)
$curdatecontrols .= "<input type=\"hidden\" name=\"sort\" value=\"$sort\" />"; $curdatecontrols .= "<input type=\"hidden\" name=\"sort\" value=\"$sort\" />";
if ($studentid)
$curdatecontrols .= "<input type=\"hidden\" name=\"student\" value=\"$studentid\" />";
$curdatecontrols .= "<input type=\"hidden\" id=\"current\" name=\"current\" value=\"\" />"; $curdatecontrols .= "<input type=\"hidden\" id=\"current\" name=\"current\" value=\"\" />";
$curdatecontrols .= "</form>"; $curdatecontrols .= "</form>";
$curdatecontrols .= "<a href=\"{$link}&amp;current=$nextcur\"><span class=\"arrow \"></span></a>"; $curdatecontrols .= "<a href=\"{$link}&amp;current=$nextcur\"><span class=\"arrow \"></span></a>";

2
manage.php

@ -104,7 +104,7 @@ function print_sessions_list($course) {
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate, $currentgroup) = 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) { if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate"; $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";

2
report.php

@ -69,7 +69,7 @@
set_current_date ($course->id, $current); set_current_date ($course->id, $current);
list($startdate, $enddate, $currentgroup) = 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) { if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate"; $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";

Loading…
Cancel
Save