Fix for bug 5379: Item analysis report should not have a hard coded list of question types.

Please test this if you have a moodle install with some unusual question types. Thanks.
This commit is contained in:
tjhunt
2006-05-31 15:53:12 +00:00
parent ee16e98eb1
commit d86503c7cf
2 changed files with 10 additions and 10 deletions
+8 -7
View File
@@ -353,20 +353,21 @@ class default_questiontype {
*/
// ULPGC ecastro
function get_all_responses(&$question, &$state) {
unset($answers);
if (is_array($question->options->answers)) {
if (isset($question->options->answers) && is_array($question->options->answers)) {
$answers = array();
foreach ($question->options->answers as $aid=>$answer) {
unset ($r);
$r = new stdClass;
$r->answer = $answer->answer;
$r->credit = $answer->fraction;
$answers[$aid] = $r;
}
$result = new stdClass;
$result->id = $question->id;
$result->responses = $answers;
return $result;
} else {
$answers[]="error"; // just for debugging, eliminate
return null;
}
$result->id = $question->id;
$result->responses = $answers;
return $result;
}
/**