function _quiz_question_browser_submit in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.admin.inc \_quiz_question_browser_submit()
- 6.4 quiz.admin.inc \_quiz_question_browser_submit()
- 7.6 quiz.admin.inc \_quiz_question_browser_submit()
- 7.4 quiz.admin.inc \_quiz_question_browser_submit()
- 7.5 quiz.admin.inc \_quiz_question_browser_submit()
Takes care of the browser part of the submitted form values.
This function changes the form_state to reflect questions added via the browser. (Especially if js is disabled)
Parameters
$form: FAPI form(array)
$form_state: FAPI form_state(array)
1 call to _quiz_question_browser_submit()
- quiz_questions_form_submit in ./
quiz.admin.inc - Submit function for quiz_questions.
File
- ./
quiz.admin.inc, line 1752 - Administrator interface for Quiz module.
Code
function _quiz_question_browser_submit($form, &$form_state) {
// Find the biggest weight:
$next_weight = max($form_state['values']['weights']);
// Save the active filters in $_SESSION
$filters = $form_state['values']['browser']['table']['filters'];
_quiz_browser_store_filters($filters);
// If a question is chosen in the browser, add it to the question list if it isn't already there
if (is_array($form_state['values']['browser']['table']['titles'])) {
foreach ($form_state['values']['browser']['table']['titles'] as $id) {
if ($id !== 0) {
if ($form_state['values']['stayers'][$id] == 1) {
continue;
}
$matches = array();
preg_match('/([0-9]+)-([0-9]+)/', $id, $matches);
$nid = $matches[1];
$vid = $matches[2];
$form_state['values']['weights'][$id] = ++$next_weight;
$form_state['values']['max_scores'][$id] = quiz_question_get_max_score($nid, $vid);
$form_state['values']['stayers'][$id] = 1;
}
}
}
}