Permalink
Browse files

Included choice_get_participants() function.

  • Loading branch information...
1 parent c8c9cb7 commit 8033a70237a9486f1ab4fbec594ea309f54bb969 stronk7 committed Sep 4, 2003
Showing with 17 additions and 0 deletions.
  1. +17 −0 mod/choice/lib.php
View
@@ -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);
+}
+
?>

0 comments on commit 8033a70

Please sign in to comment.