From: moodler Date: Sun, 28 Sep 2003 14:57:16 +0000 (+0000) Subject: MOved quiz_get_participants from the bottom to the standard functions area X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d061d88381432d7f6e45823991a7238cf32e19bb;p=moodle.git MOved quiz_get_participants from the bottom to the standard functions area --- diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index c6dc4a4cd4..d4765f0413 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -220,6 +220,18 @@ function quiz_grades($quizid) { return $return; } +function quiz_get_participants($quizid) { +/// Returns an array of users who have data in a given quiz +/// (users with records in quiz_attempts, students) + + global $CFG; + + return get_records_sql("SELECT DISTINCT u.* + FROM {$CFG->prefix}user u, + {$CFG->prefix}quiz_attempts a + WHERE a.quiz = '$quizid' and + u.id = a.userid"); +} /// SQL FUNCTIONS //////////////////////////////////////////////////////////////////// @@ -2406,21 +2418,5 @@ $oldalternativeids); return $answers; } -function quiz_get_participants($quizid) { -//Returns the users with data in one quiz -//(users with records in quiz_attempts, students) - - global $CFG; - - //Get students - $students = get_records_sql("SELECT DISTINCT u.* - FROM {$CFG->prefix}user u, - {$CFG->prefix}quiz_attempts a - WHERE a.quiz = '$quizid' and - u.id = a.userid"); - - //Return students array (it contains an array of unique users) - return ($students); -} ?>