function _quiz_question_browser_submit in Quiz 7.5
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 quiz.admin.inc \_quiz_question_browser_submit()
- 7.4 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 1212 - 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']);
// If a question is chosen in the browser, add it to the question list if it
// isn't already there.
if (isset($form_state['values']['browser']['table']['titles'])) {
foreach ($form_state['values']['browser']['table']['titles'] as $id) {
if ($id !== 0) {
$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;
}
}
}
}