Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Included quiz_get_participants() function.

  • Loading branch information...
commit eb452548f5fd1ed597298eb4e2789c47e92c9995 1 parent b32bbab
stronk7 authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 mod/quiz/lib.php
View
17 mod/quiz/lib.php
@@ -2391,4 +2391,21 @@ function quiz_save_multianswer_alternatives
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);
+}
+
?>
Please sign in to comment.
Something went wrong with that request. Please try again.