Quiz: Show button to close embeddable quiz result - refs BT#15389

pull/2901/head
Angel Fernando Quiroz Campos 7 years ago
parent b966e60034
commit 966c18c751
  1. 33
      main/exercise/exercise_result.php

@ -177,7 +177,13 @@ if (!empty($exercise_stat_info)) {
$max_score = $objExercise->get_max_score();
echo Display::return_message(get_lang('Saved').'<br />', 'normal', false);
if ($origin !== 'embeddable') {
echo Display::return_message(get_lang('Saved').'<br />', 'normal', false);
}
if ($origin == 'embeddable') {
showEmbeddableFinishButton();
}
// Display and save questions
ExerciseLib::displayQuestionListByAttempt(
@ -224,6 +230,8 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
Session::write('attempt_remaining', $remainingMessage);
showEmbeddableFinishButton();
Display::display_reduced_footer();
} else {
$lp_mode = Session::read('lp_mode');
@ -245,3 +253,26 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
Display::display_reduced_footer();
}
function showEmbeddableFinishButton()
{
echo '<script>
$(function () {
$(\'.btn-close-quiz\').on(\'click\', function () {
window.parent.$(\'video:not(.skip), audio:not(.skip)\').get(0).play();
});
});
</script>';
echo Display::tag(
'p',
Display::toolbarButton(
get_lang('EndTest'),
'#',
'times',
'warning',
['role' => 'button', 'class' => 'btn-close-quiz']
),
['class' => 'text-right']
);
}

Loading…
Cancel
Save