function theme_multichoice_answer_node_view in Quiz 7
Same name and namespace in other branches
- 8.6 question_types/quiz_multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 8.4 question_types/multichoice/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 8.5 question_types/quiz_multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 6.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.6 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.5 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
Theme the answer part of the node view
Parameters
$alternatives: Array of alternatives. Each alternative is also an array with all the data for each alternative.
$show_correct: True if the user is allowed to view the solution
1 theme call to theme_multichoice_answer_node_view()
- MultichoiceQuestion::getNodeView in question_types/
multichoice/ multichoice.classes.inc - Implementation of getNodeView
File
- question_types/
multichoice/ theme/ multichoice.theme.inc, line 48 - The theme file for multichoice.
Code
function theme_multichoice_answer_node_view($variables) {
$alternatives = $variables['alternatives'];
$show_correct = $variables['show_correct'];
$header = array(
'',
'',
);
foreach ($alternatives as $i => $short) {
$answer_markup = check_markup($short['answer'], $short['answer_format'], $langcode = '', FALSE);
// Find the is_correct status
$is_correct = $short['score_if_chosen'] > $short['score_if_not_chosen'];
$p = drupal_get_path('module', 'multichoice');
$image = $is_correct ? 'correct' : 'wrong';
if (!$show_correct) {
$image = 'unknown';
}
$rows[] = array(
array(
'data' => theme('image', array(
'path' => "{$p}/theme/images/{$image}.png",
'width' => t($image),
'height' => $show_correct ? t('Score if chosen: @sc Score if not chosen: @nc', array(
'@sc' => $short['score_if_chosen'],
'@nc' => $short['score_if_not_chosen'],
)) : t('You are not allowed to view the solution for this question'),
)),
'width' => 35,
),
$answer_markup,
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}