mirror of
https://github.com/moodle/moodle.git
synced 2025-01-21 23:48:45 +01:00
Included choice_get_participants() function.
This commit is contained in:
parent
c8c9cb7bb7
commit
8033a70237
@ -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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user