function quiz_view in Quiz 7
Same name and namespace in other branches
- 5.2 quiz.module \quiz_view()
- 5 quiz.module \quiz_view()
- 6.6 quiz.module \quiz_view()
- 6.2 quiz.module \quiz_view()
- 6.3 quiz.module \quiz_view()
- 6.4 quiz.module \quiz_view()
- 6.5 quiz.module \quiz_view()
- 7.6 quiz.module \quiz_view()
- 7.4 quiz.module \quiz_view()
- 7.5 quiz.module \quiz_view()
File
- ./
quiz.module, line 906 - Quiz Module
Code
function quiz_view($node, $view_mode) {
drupal_alter('quiz_view', $node, $teaser, $page);
node_invoke($node, 'prepare');
// Number of questions is needed on the statistics page.
$node->number_of_questions = $node->number_of_random_questions + _quiz_get_num_always_questions($node->vid);
$node->content['stats'] = array(
'#markup' => theme('quiz_view_stats', array(
'node' => $node,
)),
'#weight' => -1,
);
$available = quiz_availability($node);
if ($available === TRUE) {
// Check the permission before displaying start button.
if (user_access('access quiz')) {
// Add a link to the take tab as a button if this isn't a teaser view.
if (!$teaser) {
$node->content['take'] = array(
'#markup' => drupal_render(drupal_get_form('quiz_start_quiz_button_form', $node)),
'#weight' => 2,
);
}
else {
$node->content['take'] = array(
'#markup' => l(t('Start quiz'), 'node/' . $node->nid . '/take'),
'#weight' => 2,
);
}
}
}
else {
$node->content['take'] = array(
'#markup' => '<div class="quiz-not-available">' . $available . '</div>',
'#weight' => 2,
);
}
return $node;
}