From: stronk7 Date: Thu, 18 Sep 2003 18:08:49 +0000 (+0000) Subject: Added attendace_get_participants(). Needed to implement X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5735794924da8dab33a49f5b3e7a0b47a5fe7cf3;p=moodle.git Added attendace_get_participants(). Needed to implement backup & restore. --- diff --git a/mod/attendance/lib.php b/mod/attendance/lib.php index a4a0dc4380..5b1983de04 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); +} + ?>