function theme_quiz_categorized_form in Quiz 7
Same name and namespace in other branches
- 8.6 quiz.theme.inc \theme_quiz_categorized_form()
- 8.4 quiz.admin.inc \theme_quiz_categorized_form()
- 8.5 quiz.theme.inc \theme_quiz_categorized_form()
- 6.4 quiz.admin.inc \theme_quiz_categorized_form()
- 7.6 quiz.admin.inc \theme_quiz_categorized_form()
- 7.4 quiz.admin.inc \theme_quiz_categorized_form()
- 7.5 quiz.theme.inc \theme_quiz_categorized_form()
Themes a categorized quiz form
File
- ./
quiz.admin.inc, line 2953 - Administrator interface for Quiz module.
Code
function theme_quiz_categorized_form($variables) {
$form = $variables['form'];
$output = '';
$rows = array();
foreach ($form as $key => &$existing) {
if (!is_numeric($key)) {
continue;
}
$cols = array();
$cols[] = drupal_render($existing['name']);
$cols[] = drupal_render($existing['number']);
$cols[] = drupal_render($existing['max_score']);
$cols[] = drupal_render($existing['remove']);
$cols[] = drupal_render($existing['weight']);
$rows[] = array(
'data' => $cols,
'class' => 'draggable',
);
}
if (!empty($rows)) {
$header = array(
t('Category'),
t('Number of questions'),
t('Max score per question'),
t('Remove'),
t('Weight'),
);
drupal_add_tabledrag('existing-terms', 'order', 'sibling', 'term-weight', NULL, NULL, TRUE);
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'existing-terms',
),
));
}
$output .= drupal_render_children($form);
drupal_add_js("\n Drupal.behaviors.quiz_categorized = function() {\n \$('#browse-for-term:not(.quiz-processed)').click(function(event) {\n event.preventDefault();\n \$('#edit-term').focus().val('*').trigger('keyup');\n }).addClass('quiz-processed');\n \$('#edit-term').click(function(){\n if (\$(this).val() == '*') {\n \$(this).val('');\n }\n });\n };", array(
'type' => 'inline',
'scope' => JS_DEFAULT,
));
return $output;
}