function theme_multichoice_form in Quiz 5.2
Same name and namespace in other branches
- 5 multichoice.module \theme_multichoice_form()
 - 6.6 question_types/multichoice/multichoice.module \theme_multichoice_form()
 - 6.2 multichoice.module \theme_multichoice_form()
 - 6.3 question_types/multichoice/multichoice.module \theme_multichoice_form()
 - 6.5 question_types/multichoice/multichoice.module \theme_multichoice_form()
 
Theme function for multichoice form.
Lays out answer field elements into a table.
Return value
string HTML output.
1 theme call to theme_multichoice_form()
- multichoice_form in ./
multichoice.module  - Implementation of hook_form().
 
File
- ./
multichoice.module, line 759  - Multiple choice question type for the Quiz module.
 
Code
function theme_multichoice_form($form) {
  // Format table header.
  $scored_quiz = isset($form[0]['result_option']) ? FALSE : TRUE;
  $deleteable = isset($form[0]['aid']) ? TRUE : FALSE;
  if (user_access('allow multiple correct answers')) {
    $header = array(
      'data' => $scored_quiz ? t('Correct') : t('Result Option'),
    );
  }
  $header[] = array(
    'data' => t('Answer'),
  );
  if (user_access('allow feedback')) {
    $header[] = array(
      'data' => t('Feedback'),
      'style' => 'width:250px;',
    );
  }
  if ($deleteable) {
    $header[] = array(
      'data' => t('Delete'),
    );
  }
  // Format table rows.
  $rows = array();
  foreach (element_children($form) as $key) {
    $score_col = $scored_quiz ? $form[$key]['correct'] : $form[$key]['result_option'];
    $row = array();
    if ($score_col) {
      $row[] = drupal_render($score_col);
    }
    $row[] = drupal_render($form[$key]['answer']);
    if (user_access('allow feedback')) {
      $row[] = drupal_render($form[$key]['feedback']);
    }
    if ($deleteable) {
      drupal_render($form[$key]['delete']);
    }
    $rows[] = $row;
  }
  // Theme output and display to screen.
  $output = theme('table', $header, $rows);
  return $output;
}