function theme_question_selection_table in Quiz 8.4
Same name and namespace in other branches
- 6.6 quiz.admin.inc \theme_question_selection_table()
- 6.3 quiz.admin.inc \theme_question_selection_table()
- 6.4 quiz.admin.inc \theme_question_selection_table()
- 6.5 quiz.admin.inc \theme_question_selection_table()
- 7.6 quiz.admin.inc \theme_question_selection_table()
- 7 quiz.admin.inc \theme_question_selection_table()
- 7.4 quiz.admin.inc \theme_question_selection_table()
- 7.5 quiz.theme.inc \theme_question_selection_table()
Theme a question selection table, adding drag and drop support.
1 theme call to theme_question_selection_table()
- quiz_questions_form in ./
quiz.admin.inc - Handles "manage questions" tab.
File
- ./
quiz.admin.inc, line 1607 - Administrator interface for Quiz module.
Code
function theme_question_selection_table($variables) {
$form = $variables['form'];
drupal_add_tabledrag('question-list', 'order', 'sibling', 'question-list-weight', NULL, NULL, TRUE);
// Building headers
$headers = array(
t('Question'),
t('Type'),
t('Actions'),
t('Update'),
t('Max score'),
t('Auto update max score'),
);
if (isset($form['compulsories'])) {
$headers[] = t('Compulsory');
}
$headers[] = t('Weight');
// Building table body
$rows = array();
if (!empty($form['titles'])) {
foreach (element_children($form['titles']) as $id) {
$form['weights'][$id]['#attributes']['class'] = array(
'question-list-weight',
);
$rows[] = _quiz_get_question_row($form, $id);
}
// Make sure the same fields aren't rendered twice
unset($form['types'], $form['view_links'], $form['remove_links'], $form['stayers']);
unset($form['max_scores'], $form['auto_update_max_scores'], $form['revision'], $form['weights'], $form['titles'], $form['compulsories']);
}
$html_attr = array(
'id' => 'question-list',
);
// We hide the table if no questions have been added so that jQuery can show it the moment the first question is beeing added.
if (isset($form['no_questions'])) {
$html_attr['style'] = "display:none;";
}
$table = theme('table', array(
'header' => $headers,
'rows' => $rows,
'attributes' => $html_attr,
));
return drupal_render($form['random_settings']) . $table . drupal_render_children($form);
}