From 5735794924da8dab33a49f5b3e7a0b47a5fe7cf3 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 18 Sep 2003 18:08:49 +0000 Subject: [PATCH] Added attendace_get_participants(). Needed to implement backup & restore. --- mod/attendance/lib.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mod/attendance/lib.php b/mod/attendance/lib.php index a4a0dc43801..5b1983de042 100755 --- a/mod/attendance/lib.php +++ b/mod/attendance/lib.php @@ -391,4 +391,21 @@ function attendance_get_records($table, $field1="", $value1="", $field2="", $val return get_records_sql("SELECT $fields FROM $CFG->prefix$table $select $sort $limit"); } +function attendance_get_participants($attendanceid) { +//Returns the users with data in one attendance +//(users with records in attendance_roll, students) + + global $CFG; + + //Get students + $students = get_records_sql("SELECT DISTINCT u.* + FROM {$CFG->prefix}user u, + {$CFG->prefix}attendance_roll a + WHERE a.dayid = '$attendanceid' and + u.id = a.userid"); + + //Return students array (it contains an array of unique users) + return ($students); +} + ?>