You are here

function theme_quiz_question_table in Quiz 5.2

Same name and namespace in other branches
  1. 5 quiz.module \theme_quiz_question_table()
  2. 6.6 quiz.pages.inc \theme_quiz_question_table()
  3. 6.2 quiz.pages.inc \theme_quiz_question_table()
  4. 6.3 quiz.pages.inc \theme_quiz_question_table()
  5. 6.5 quiz.pages.inc \theme_quiz_question_table()

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_quiz_question_table()
theme_quiz_view in ./quiz.module
Theme the node view for quizzes.

File

./quiz.module, line 2227

Code

function theme_quiz_question_table($questions, $quiz_id = NULL) {
  $output = '';
  $rows = array();
  $status_descriptions = array(
    t('Random'),
    t('Always'),
    t('Never'),
  );
  while (list($key, $question) = each($questions)) {
    $rows[] = array(
      $status_descriptions[$question->status],
      $question->question,
      $question->type,
      l(t('Edit'), 'node/' . $question->nid . '/edit/' . $quiz_id),
    );
  }
  $header = array(
    t('Status'),
    t('Question'),
    t('Type'),
    t('Edit'),
  );
  if (!empty($rows)) {
    $output .= theme('table', $header, $rows);
  }
  else {
    $output .= t('No questions found.');
  }
  return $output;
}