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

This commit is contained in:
tjhunt 2008-07-17 12:49:25 +00:00
parent 38e554420b
commit b9d4b03134

View File

@ -1610,7 +1610,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 . '" />';