You are here

function qcollection_view in Quiz 6.6

Implemention of hook_view().

File

includes/qcollection/qcollection.module, line 162
The main file for qcollection.

Code

function qcollection_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
  $node = node_prepare($node, $teaser);
  $collection_nid = $node->nid;
  $info = _qcollection_get_info($node);
  $node->content['info'] = array(
    // TODO theme the info block
    '#value' => "<em>{$info['questions_count']} questions</em><br/>",
    '#weight' => 0,
  );
  if (!$teaser) {
    $questions = _quiz_get_questions($node->nid, $node->vid);
    $output = theme('qcollection_question_table', $questions, $collection_nid);
    $node->content['questions'] = array(
      '#value' => $output,
      '#weight' => 1,
    );
  }
  if (user_access('create quiz')) {
    $node->content['export-quiz'] = array(
      '#value' => l(t('Export as quiz'), 'node/' . $collection_nid . '/export-quiz'),
      '#weight' => 2,
    );
  }
  return $node;
}