function print_question_icon in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \print_question_icon()
 
Print the icon for the question type
Parameters
object $question The question object for which the icon is required:
boolean $return If true the functions returns the link as a string:
File
- includes/
moodle/ lib/ questionlib.php, line 1476  
Code
function print_question_icon($question, $return = false) {
  global $QTYPES, $CFG;
  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 . '" />';
  if ($return) {
    return $html;
  }
  else {
    echo $html;
  }
}