Index: questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/randomsamatch/questiontype.php,v retrieving revision 1.4 diff -u -r1.4 questiontype.php --- questiontype.php 19 Mar 2007 22:23:55 -0000 1.4 +++ questiontype.php 11 Jan 2008 14:19:36 -0000 @@ -246,6 +246,26 @@ "AND hidden = '0'" . "AND id NOT IN ($questionsinuse)"); } + function get_all_responses($question, $state) { + $answers = array(); + if (is_array($question->options->subquestions)) { + foreach ($question->options->subquestions as $aid => $answer) { + if ($answer->questiontext) { + foreach($answer->options->answers as $ans ){ + $answer->answertext = $ans->answer ; + } + $r = new stdClass; + $r->answer = $answer->questiontext . ": " . $answer->answertext; + $r->credit = 1; + $answers[$aid] = $r; + } + } + } + $result = new stdClass; + $result->id = $question->id; + $result->responses = $answers; + return $result; + } /// BACKUP FUNCTIONS ////////////////////////////