function theme_question_selection_table in Quiz 6.5
Same name and namespace in other branches
- 8.4 quiz.admin.inc \theme_question_selection_table()
- 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()
- 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 876 - Administrator interface for Quiz module.
Code
function theme_question_selection_table($form) {
// This is a temporary hack.
static $table_counter = 0;
++$table_counter;
$question_types = _quiz_get_question_types();
//drupal_add_tabledrag('questions-order-' . $table_counter, 'order', 'sibling', 'question-order-weight', 'question-order-weight-' . $table_counter, NULL, TRUE);
drupal_add_tabledrag('questions-order-' . $table_counter, 'order', 'sibling', 'question-order-weight-' . $table_counter, NULL, NULL, TRUE);
$headers = array(
t('Question'),
t('Type'),
t('Actions'),
t('Weight'),
);
$rows = array();
if (!empty($form['titles'])) {
foreach (element_children($form['titles']) as $nid) {
$form['weights'][$nid]['#attributes']['class'] = 'question-order-weight question-order-weight-' . $table_counter;
$type = $form['types'][$nid]['#value'];
$rows[] = array(
'class' => 'draggable',
'data' => array(
drupal_render($form['titles'][$nid]),
$question_types[$type]['name'],
$form['view_links'][$nid]['#value'] . ' | ' . $form['remove_links'][$nid]['#value'],
drupal_render($form['weights'][$nid]),
),
);
unset($form['types'][$nid], $form['view_links'][$nid], $form['remove_links'][$nid]);
}
}
$table = theme('table', $headers, $rows, array(
'id' => 'questions-order-' . $table_counter,
));
return $table . drupal_render($form);
}