MDL12932 -Random Short-Answer Matching does not display correctly in Item analysis report

This commit is contained in:
pichetp 2008-01-11 14:24:10 +00:00
parent fffa8b358f
commit fa1661c27c
2 changed files with 23 additions and 0 deletions

View File

@ -154,6 +154,9 @@ class quiz_report extends quiz_default_report {
continue;
}
$qtype = ($quizquestions[$i]->qtype=='random') ? $states[$i]->options->question->qtype : $quizquestions[$i]->qtype;
if($quizquestions[$i]->qtype =='randomsamatch'){
$quizquestions[$i]->options =$states[$i]->options ;
}
$q = get_question_responses($quizquestions[$i], $states[$i]);
if (empty($q)){
continue;

View File

@ -246,6 +246,26 @@ class question_randomsamatch_qtype extends question_match_qtype {
"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 ////////////////////////////