|
@ -1135,7 +1135,12 @@ class attendance { |
|
|
$where = "ats.attendanceid = :aid AND ats.sessdate >= :csdate"; |
|
|
$where = "ats.attendanceid = :aid AND ats.sessdate >= :csdate"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$sql = "SELECT ats.id, ats.groupid, ats.sessdate, ats.duration, ats.description, al.statusid, al.remarks |
|
|
// We need to add this concatination so that moodle will use it as the array index that is a string. |
|
|
|
|
|
// If the array's index is a number it will not merge entries. |
|
|
|
|
|
// It would be better as a UNION query butunfortunatly MS SQL does not seem to support doing a DISTINCT on a the description field. |
|
|
|
|
|
$id = $DB->sql_concat(':value', 'ats.id'); |
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT $id, ats.id, ats.groupid, ats.sessdate, ats.duration, ats.description, al.statusid, al.remarks |
|
|
FROM {attendance_sessions} ats |
|
|
FROM {attendance_sessions} ats |
|
|
RIGHT JOIN {attendance_log} al |
|
|
RIGHT JOIN {attendance_log} al |
|
|
ON ats.id = al.sessionid AND al.studentid = :uid |
|
|
ON ats.id = al.sessionid AND al.studentid = :uid |
|
@ -1147,7 +1152,8 @@ class attendance { |
|
|
'aid' => $this->id, |
|
|
'aid' => $this->id, |
|
|
'csdate' => $this->course->startdate, |
|
|
'csdate' => $this->course->startdate, |
|
|
'sdate' => $this->pageparams->startdate, |
|
|
'sdate' => $this->pageparams->startdate, |
|
|
'edate' => $this->pageparams->enddate); |
|
|
'edate' => $this->pageparams->enddate, |
|
|
|
|
|
'value' => 'c'); |
|
|
$sessions = $DB->get_records_sql($sql, $params); |
|
|
$sessions = $DB->get_records_sql($sql, $params); |
|
|
|
|
|
|
|
|
// All sessions for current groups. |
|
|
// All sessions for current groups. |
|
@ -1163,7 +1169,7 @@ class attendance { |
|
|
$where = "ats.attendanceid = :aid AND ats.sessdate >= :csdate AND ats.groupid $gsql"; |
|
|
$where = "ats.attendanceid = :aid AND ats.sessdate >= :csdate AND ats.groupid $gsql"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$sql = "SELECT ats.id, ats.groupid, ats.sessdate, ats.duration, ats.description, al.statusid, al.remarks |
|
|
$sql = "SELECT $id, ats.id, ats.groupid, ats.sessdate, ats.duration, ats.description, al.statusid, al.remarks |
|
|
FROM {attendance_sessions} ats |
|
|
FROM {attendance_sessions} ats |
|
|
LEFT JOIN {attendance_log} al |
|
|
LEFT JOIN {attendance_log} al |
|
|
ON ats.id = al.sessionid AND al.studentid = :uid |
|
|
ON ats.id = al.sessionid AND al.studentid = :uid |
|
|