]> git.mjollnir.org Git - moodle.git/commitdiff
Added attendace_get_participants(). Needed to implement
authorstronk7 <stronk7>
Thu, 18 Sep 2003 18:08:49 +0000 (18:08 +0000)
committerstronk7 <stronk7>
Thu, 18 Sep 2003 18:08:49 +0000 (18:08 +0000)
backup & restore.

mod/attendance/lib.php

index a4a0dc4380135ac130fbf0fdd1cb99f3d0bd4cd7..5b1983de042b660c349de538c4d61cdc9f8efc6d 100755 (executable)
@@ -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);
+}
+
 ?>