From: stronk7 Date: Thu, 4 Sep 2003 22:18:14 +0000 (+0000) Subject: Included choice_get_participants() function. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8033a70237a9486f1ab4fbec594ea309f54bb969;p=moodle.git Included choice_get_participants() function. --- 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); +} + ?>