You are here

function theme_qcollection_question_table in Quiz 6.6

Theme a table containing array of questions and options.

Parameters

$questions: Array of question nodes.

Return value

HTML for a table.

1 theme call to theme_qcollection_question_table()
qcollection_view in includes/qcollection/qcollection.module
Implemention of hook_view().

File

includes/qcollection/qcollection.pages.inc, line 19
User pages.

Code

function theme_qcollection_question_table($questions, $quiz_id = NULL) {
  $output = '';
  $question_types = _quiz_get_question_types();
  $rows = array();
  while (list($key, $question) = each($questions)) {

    // TODO include comment counts
    $info = '<div class="question_info"><div class="question_type">' . $question_types[$question->type]['name'] . '</div>' . _question_rating_snip($question) . '<div class="question_actions">' . l(t('View'), 'node/' . $question->nid) . '</div></div>';
    $rows[] = array(
      $question->question,
      $info,
    );
  }
  $header = array(
    t('Question prompt'),
    t('Info'),
  );
  if (!empty($rows)) {
    $output .= theme('table', $header, $rows);
  }
  else {
    $output .= t('No questions in collection.');
  }
  return "<div>{$output}</div>";
}