|
|
|
|
@ -863,7 +863,6 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) { //so we are not in learnp |
|
|
|
|
|
|
|
|
|
Display::display_header(null, 'Exercises'); |
|
|
|
|
} else { |
|
|
|
|
$htmlHeadXtra[] = "<style> body { background: none;} </style> "; |
|
|
|
|
Display::display_reduced_header(); |
|
|
|
|
echo '<div style="height:10px"> </div>'; |
|
|
|
|
} |
|
|
|
|
@ -1039,8 +1038,8 @@ if (!empty($error)) { |
|
|
|
|
echo Display::return_message($error, 'error', false); |
|
|
|
|
} else { |
|
|
|
|
if (!empty($exercise_sound)) { |
|
|
|
|
echo "<a |
|
|
|
|
href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\" |
|
|
|
|
echo "<a |
|
|
|
|
href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\" |
|
|
|
|
target=\"_blank\">"; |
|
|
|
|
echo "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound')."\" /></a>"; |
|
|
|
|
} |
|
|
|
|
@ -1094,27 +1093,27 @@ if (!empty($error)) { |
|
|
|
|
elm.attachEvent(\'on\' + evType, fn); |
|
|
|
|
} else{ |
|
|
|
|
elm[\'on\'+evType] = fn; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var calledUpdateDuration = false; |
|
|
|
|
|
|
|
|
|
var calledUpdateDuration = false; |
|
|
|
|
function updateDuration() { |
|
|
|
|
if (calledUpdateDuration === false) { |
|
|
|
|
var saveDurationUrl = "'.$saveDurationUrl.'"; |
|
|
|
|
// Logout of course just in case |
|
|
|
|
$.ajax({ |
|
|
|
|
async: false, |
|
|
|
|
async: false, |
|
|
|
|
url: saveDurationUrl, |
|
|
|
|
success: function (data) { |
|
|
|
|
calledUpdateDuration = true; |
|
|
|
|
return; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
//This pre-load the save.png icon |
|
|
|
|
var saveImage = new Image(); |
|
|
|
|
@ -1125,6 +1124,16 @@ if (!empty($error)) { |
|
|
|
|
return event.keyCode != 13; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(".checkCalculatedQuestionOnEnter").keypress(function(event) { |
|
|
|
|
if (event.keyCode === 13) { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
var id = $(this).attr("id"); |
|
|
|
|
var parts = id.split("_"); |
|
|
|
|
var buttonId = "button_" + parts[1]; |
|
|
|
|
document.getElementById(buttonId).click(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(".main_question").mouseover(function() { |
|
|
|
|
//$(this).find(".exercise_save_now_button").show(); |
|
|
|
|
//$(this).addClass("question_highlight"); |
|
|
|
|
@ -1137,7 +1146,7 @@ if (!empty($error)) { |
|
|
|
|
|
|
|
|
|
$(".no_remind_highlight").hide(); |
|
|
|
|
|
|
|
|
|
// if the users validates the form using return key, |
|
|
|
|
// if the users validates the form using return key, |
|
|
|
|
// prevent form action and simulates click on validation button |
|
|
|
|
/*$("#exercise_form").submit(function(){ |
|
|
|
|
$(".question-validate-btn").first().trigger("click"); |
|
|
|
|
@ -1145,10 +1154,10 @@ if (!empty($error)) { |
|
|
|
|
});*/ |
|
|
|
|
|
|
|
|
|
$("form#exercise_form").prepend($("#exercise-description")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(\'button[name="previous_question_and_save"]\').on("touchstart click", function (e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
var |
|
|
|
|
$this = $(this), |
|
|
|
|
previousId = parseInt($this.data(\'prev\')) || 0, |
|
|
|
|
@ -1169,7 +1178,7 @@ if (!empty($error)) { |
|
|
|
|
$(\'button[name="save_now"]\').on(\'touchstart click\', function (e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var |
|
|
|
|
$this = $(this), |
|
|
|
|
questionId = parseInt($this.data(\'question\')) || 0, |
|
|
|
|
@ -1181,13 +1190,13 @@ if (!empty($error)) { |
|
|
|
|
$(\'button[name="validate_all"]\').on(\'touchstart click\', function (e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
e.stopPropagation(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
validate_all(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Save attempt duration |
|
|
|
|
addExerciseEvent(window, \'unload\', updateDuration , false); |
|
|
|
|
addExerciseEvent(window, \'beforeunload\', updateDuration , false); |
|
|
|
|
addExerciseEvent(window, \'unload\', updateDuration , false); |
|
|
|
|
addExerciseEvent(window, \'beforeunload\', updateDuration , false); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function previous_question(question_num) { |
|
|
|
|
@ -1217,8 +1226,8 @@ if (!empty($error)) { |
|
|
|
|
//$("#save_for_now_"+question_id).html(\''.Display::return_icon('save.png', get_lang('Saved'), [], ICON_SIZE_SMALL).'\'); |
|
|
|
|
window.location = url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function redirectExerciseToResult() |
|
|
|
|
|
|
|
|
|
function redirectExerciseToResult() |
|
|
|
|
{ |
|
|
|
|
window.location = "'.$script_php.'?'.$params.'"; |
|
|
|
|
} |
|
|
|
|
@ -1245,7 +1254,7 @@ if (!empty($error)) { |
|
|
|
|
my_choice = $.param(my_choice); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($(\'input[name="remind_list[\'+question_id+\']"]\').is(\':checked\')) { |
|
|
|
|
$("#question_div_"+question_id).addClass("remind_highlight"); |
|
|
|
|
} else { |
|
|
|
|
@ -1255,7 +1264,7 @@ if (!empty($error)) { |
|
|
|
|
// Only for the first time |
|
|
|
|
var dataparam = "'.$params.'&type=simple&question_id="+question_id; |
|
|
|
|
dataparam += "&"+my_choice+"&"+hotspot+"&"+remind_list+"&"+my_choiceDc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#save_for_now_"+question_id).html(\''. |
|
|
|
|
Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\'); |
|
|
|
|
$.ajax({ |
|
|
|
|
@ -1266,7 +1275,7 @@ if (!empty($error)) { |
|
|
|
|
success: function(return_value) { |
|
|
|
|
if (return_value == "ok") { |
|
|
|
|
$("#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).'\'); |
|
|
|
|
} else if (return_value == "error") { |
|
|
|
|
$("#save_for_now_"+question_id).html(\''. |
|
|
|
|
Display::return_icon('error.png', get_lang('Error'), [], ICON_SIZE_SMALL).'\'); |
|
|
|
|
@ -1308,7 +1317,7 @@ if (!empty($error)) { |
|
|
|
|
|
|
|
|
|
// 3. Hotspots. |
|
|
|
|
var hotspot = $(\'*[name*="hotspot"]\').serialize(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Question list. |
|
|
|
|
var question_list = ['.implode(',', $questionList).']; |
|
|
|
|
var free_answers = {}; |
|
|
|
|
@ -1361,7 +1370,7 @@ if (!empty($error)) { |
|
|
|
|
<input type="hidden" name="origin" value="'.$origin.'" /> |
|
|
|
|
<input type="hidden" name="reminder" value="'.$reminder.'" /> |
|
|
|
|
<input type="hidden" name="learnpath_id" value="'.$learnpath_id.'" /> |
|
|
|
|
<input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id.'" /> |
|
|
|
|
<input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id.'" /> |
|
|
|
|
<input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />'; |
|
|
|
|
|
|
|
|
|
// Show list of questions |
|
|
|
|
|