MDL-15693 - print_question_icon does not cope with missing question types

This commit is contained in:
tjhunt
2008-07-17 12:49:28 +00:00
parent 1be35acd87
commit 9db58d015f
+5 -1
View File
@@ -1292,7 +1292,11 @@ function question_apply_penalty_and_timelimit(&$question, &$state, $attempt, $cm
function print_question_icon($question, $return = false) {
global $QTYPES, $CFG;
$namestr = $QTYPES[$question->qtype]->menu_name();
if (array_key_exists($question->qtype, $QTYPES)) {
$namestr = $QTYPES[$question->qtype]->menu_name();
} else {
$namestr = 'missingtype';
}
$html = '<img src="' . $CFG->wwwroot . '/question/type/' .
$question->qtype . '/icon.gif" alt="' .
$namestr . '" title="' . $namestr . '" />';