Quiz: Save question when time ending - refs BT#17599 #3044

pull/3425/head
Angel Fernando Quiroz Campos 5 years ago
parent b4ffb12ff2
commit eaba449198
  1. 3
      main/exercise/exercise.class.php
  2. 7
      main/exercise/exercise_submit.php

@ -3422,6 +3422,9 @@ class Exercise
$script = 'redirectExerciseToResult();'; $script = 'redirectExerciseToResult();';
if (ALL_ON_ONE_PAGE == $this->type) { if (ALL_ON_ONE_PAGE == $this->type) {
$script = "save_now_all('validate');"; $script = "save_now_all('validate');";
} elseif (ONE_PER_PAGE == $this->type) {
$script = 'window.quizTimeEnding = true;
$(\'[name="save_now"]\').trigger(\'click\');';
} }
return "<script> return "<script>

@ -1323,8 +1323,13 @@ if (!empty($error)) {
$("#save_for_now_"+question_id).html(\''. $("#save_for_now_"+question_id).html(\''.
Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\'); Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\');
// window.quizTimeEnding will be reset in exercise.class.php
if (window.quizTimeEnding) {
redirectExerciseToResult();
} else {
window.location = url; window.location = url;
} }
}
}, },
error: function() { error: function() {
$("#save_for_now_"+question_id).html(\''. $("#save_for_now_"+question_id).html(\''.
@ -1387,6 +1392,8 @@ if (!empty($error)) {
function validate_all() { function validate_all() {
save_now_all("validate"); save_now_all("validate");
} }
window.quizTimeEnding = false;
</script>'; </script>';
echo '<form id="exercise_form" method="post" action="'. echo '<form id="exercise_form" method="post" action="'.

Loading…
Cancel
Save