From 8033a70237a9486f1ab4fbec594ea309f54bb969 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 4 Sep 2003 22:18:14 +0000 Subject: [PATCH] Included choice_get_participants() function. --- mod/choice/lib.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mod/choice/lib.php b/mod/choice/lib.php index ea4a85761d..25ba513acd 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -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); +} + ?> -- 2.39.5