You are here

function theme_quiz_question_table in Quiz 5

Same name and namespace in other branches
  1. 5.2 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 to output table

2 theme calls to theme_quiz_question_table()
quiz_questions_form in ./quiz.module
Handles "Manage questions" tab
theme_quiz_view in ./quiz.module
Theme the node view for quizzes

File

./quiz.module, line 1646
Quiz Module

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],
      check_markup($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;
}