From eb452548f5fd1ed597298eb4e2789c47e92c9995 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 7 Sep 2003 21:56:46 +0000 Subject: [PATCH] Included quiz_get_participants() function. --- mod/quiz/lib.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 80d8e30593..82ca768146 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -2391,4 +2391,21 @@ $oldalternativeids); return $answers; } +function quiz_get_participants($quizid) { +//Returns the users with data in one quiz +//(users with records in quiz_attempts, students) + + global $CFG; + + //Get students + $students = get_records_sql("SELECT DISTINCT u.* + FROM {$CFG->prefix}user u, + {$CFG->prefix}quiz_attempts a + WHERE a.quiz = '$quizid' and + u.id = a.userid"); + + //Return students array (it contains an array of unique users) + return ($students); +} + ?> -- 2.39.5