]> git.mjollnir.org Git - moodle.git/commitdiff
Included choice_get_participants() function.
authorstronk7 <stronk7>
Thu, 4 Sep 2003 22:18:14 +0000 (22:18 +0000)
committerstronk7 <stronk7>
Thu, 4 Sep 2003 22:18:14 +0000 (22:18 +0000)
mod/choice/lib.php

index ea4a85761d1e592d3706d729deea00876d9a8ddc..25ba513acd0d15ff8034edcee12217c1b7a7e672 100644 (file)
@@ -119,4 +119,21 @@ function choice_get_choice($choiceid) {
     }
 }
 
+function choice_get_participants($choiceid) {
+//Returns the users with data in one choice
+//(users with records in choice_answers, students)
+
+    global $CFG;
+
+    //Get students
+    $students = get_records_sql("SELECT DISTINCT u.*
+                                 FROM {$CFG->prefix}user u,
+                                      {$CFG->prefix}choice_answers c
+                                 WHERE c.choice = '$choiceid' and
+                                       u.id = c.userid");
+
+    //Return students array (it contains an array of unique users)
+    return ($students);
+}
+
 ?>