]> git.mjollnir.org Git - moodle.git/commitdiff
Included quiz_get_participants() function.
authorstronk7 <stronk7>
Sun, 7 Sep 2003 21:56:46 +0000 (21:56 +0000)
committerstronk7 <stronk7>
Sun, 7 Sep 2003 21:56:46 +0000 (21:56 +0000)
mod/quiz/lib.php

index 80d8e3059318a3eea9004f4cc5fda0be6ad8399e..82ca768146d0053a967261f9c78e67177aab1aa9 100644 (file)
@@ -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);
+}
+
 ?>