function quiz_results_mr_form_submit in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.admin.inc \quiz_results_mr_form_submit()
- 6.4 quiz.admin.inc \quiz_results_mr_form_submit()
- 7.4 quiz.admin.inc \quiz_results_mr_form_submit()
Submit function for the result browser form
1 string reference to 'quiz_results_mr_form_submit'
- quiz_results_manage_results_form in ./
quiz.admin.inc - Form for searching after and manipulating results for a quiz
File
- ./
quiz.admin.inc, line 2460 - Administrator interface for Quiz module.
Code
function quiz_results_mr_form_submit($form, &$form_state) {
// If we are confirming the deltion of results.
if ($form_state['values']['op'] == t('Delete all marked results')) {
foreach ($form_state['values']['table']['name'] as $value) {
if ($value !== 0) {
// Find nid and rid
$matches = array();
preg_match('/([0-9]+)-([0-9]+)/', $value, $matches);
$res_nid = $matches[1];
$res_rid = $matches[2];
// If we only showing the best results we still want to delete all results for this user
if ($form_state['values']['table']['filters']['best_results'] == 1) {
_quiz_delete_results($res_rid, $res_nid);
}
else {
_quiz_delete_results($res_rid);
}
}
}
if (isset($res_rid)) {
drupal_set_message(t('Results have been deleted.'));
}
}
else {
// If we are deleting quizzes
if ($form_state['values']['bulk_action'] == 'del') {
$form_state['storage']['del'] = $form_state['values']['table']['name'];
}
}
// We remember the filters for the next time the same user visits the result browser
_quiz_results_mr_store_filters($form_state['values']['table']['filters']);
}