function quiz_view in Quiz 7.6
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 quiz.module \quiz_view()
- 7.4 quiz.module \quiz_view()
- 7.5 quiz.module \quiz_view()
Implements hook_view().
File
- ./
quiz.module, line 919 - quiz.module Main file for the Quiz module.
Code
function quiz_view($node) {
// 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.
$node->content['take'] = array(
'#markup' => l(t('Start @quiz', array(
'@quiz' => QUIZ_NAME,
)), 'node/' . $node->nid . '/take', array(
'attributes' => array(
'class' => array(
'quiz-start-link',
),
),
)),
'#weight' => 2,
);
}
}
else {
$node->content['take'] = array(
'#markup' => '<div class="quiz-not-available">' . $available . '</div>',
'#weight' => 2,
);
}
return $node;
}