redirect($afteractionurl); } $remove = optional_param('remove', false, PARAM_INT); if ($remove && confirm_sesskey()) { // Remove a question from the quiz. // We require the user to have the 'use' capability on the question, // so that then can add it back if they remove the wrong one by mistake. quiz_require_question_use($remove); quiz_remove_question($quiz, $remove); quiz_delete_previews($quiz); quiz_update_sumgrades($quiz); redirect($afteractionurl); } if (optional_param('quizdeleteselected', false, PARAM_BOOL) && !empty($selectedquestionids) && confirm_sesskey()) { foreach ($selectedquestionids as $questionid) { if (quiz_has_question_use($questionid)) { quiz_remove_question($quiz, $questionid); } } quiz_delete_previews($quiz); quiz_update_sumgrades($quiz); redirect($afteractionurl); } if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $deletepreviews = false; $recomputesummarks = false; $oldquestions = explode(',', $quiz->questions); // The questions in the old order. $questions = array(); // For questions in the new order. $rawdata = (array) data_submitted();
if ($remove && confirm_sesskey() && quiz_has_question_use($quiz, $remove)) { // Remove a question from the quiz. // We require the user to have the 'use' capability on the question, // so that then can add it back if they remove the wrong one by mistake, // but, if the question is missing, it can always be removed. quiz_remove_slot($quiz, $remove); quiz_delete_previews($quiz); quiz_update_sumgrades($quiz); redirect($afteractionurl); } if (optional_param('quizdeleteselected', false, PARAM_BOOL) && !empty($selectedslots) && confirm_sesskey()) { // Work backwards, since removing a question renumbers following slots. foreach (array_reverse($selectedslots) as $slot) { if (quiz_has_question_use($quiz, $slot)) { quiz_remove_slot($quiz, $slot); } } quiz_delete_previews($quiz); quiz_update_sumgrades($quiz); redirect($afteractionurl); } if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $deletepreviews = false; $recomputesummarks = false; $rawdata = (array) data_submitted(); $moveonpagequestions = array(); $moveselectedonpage = optional_param('moveselectedonpagetop', 0, PARAM_INT);