function _quiz_question_browser_add_filter_fields in Quiz 6.4
Same name and namespace in other branches
- 8.4 quiz.admin.inc \_quiz_question_browser_add_filter_fields()
- 7 quiz.admin.inc \_quiz_question_browser_add_filter_fields()
- 7.4 quiz.admin.inc \_quiz_question_browser_add_filter_fields()
adds filter fields to the question browser form
Parameters
$browser: FAPI form(array)
$question_types: Array of question types
1 call to _quiz_question_browser_add_filter_fields()
- _quiz_question_browser_form in ./
quiz.admin.inc - Creates the browser part of the quiz_questions_form
File
- ./
quiz.admin.inc, line 1348 - Administrator interface for Quiz module.
Code
function _quiz_question_browser_add_filter_fields(&$browser, &$question_types, $quiz) {
$ahah_path = "node/{$quiz->nid}/questions/browser_ahah";
// Create options array for the type filter(select field)
$type_options = array(
t('No filter'),
);
foreach (array_keys($question_types) as $type) {
$type_options[$type] = $question_types[$type]['name'];
}
// Create options array for the changed filter
$changed_options = _quiz_get_time_interval_options();
// Create the filter form items
$browser['filters'] = array();
$filters =& $browser['filters'];
$filters['all'] = array(
'#type' => 'checkbox',
);
$pre = 'quiz_question_browser_';
$filters['title'] = array(
'#type' => 'textfield',
'#size' => 20,
'#default_value' => isset($_SESSION[$pre . 'title']) ? $_SESSION[$pre . 'title'] : '',
'#ahah' => array(
'path' => $ahah_path,
'wrapper' => 'ahah-target',
'method' => 'replace',
'event' => 'doneTyping',
),
);
$filters['type'] = array(
'#type' => 'select',
'#options' => $type_options,
'#default_value' => isset($_SESSION[$pre . 'type']) ? $_SESSION[$pre . 'type'] : '',
'#ahah' => array(
'path' => $ahah_path,
'wrapper' => 'ahah-target',
'method' => 'replace',
),
);
$filters['changed'] = array(
'#type' => 'select',
'#options' => $changed_options,
'#default_value' => isset($_SESSION[$pre . 'changed']) ? $_SESSION[$pre . 'changed'] : '',
'#ahah' => array(
'path' => $ahah_path,
'wrapper' => 'ahah-target',
'method' => 'replace',
),
);
$filters['name'] = array(
'#type' => 'textfield',
'#size' => 10,
'#default_value' => isset($_SESSION[$pre . 'name']) ? $_SESSION[$pre . 'name'] : '',
'#ahah' => array(
'path' => $ahah_path,
'wrapper' => 'ahah-target',
'method' => 'replace',
'event' => 'doneTyping',
),
);
}