Merge branch 'preprodparkur' of github.com:chamilo/chamilo-lms into preprodparkur

pull/4101/head
Julio Montoya 6 years ago
commit f5cdf49b99
  1. 8
      app/Resources/public/css/base.css
  2. 15
      main/exercise/exercise_result.php
  3. 57
      main/exercise/exercise_submit.php
  4. 1
      main/inc/lib/template.lib.php
  5. 2
      main/template/default/layout/page.tpl
  6. 2
      main/template/default/layout/show_header.tpl

@ -36,6 +36,14 @@ body {
margin-bottom: 10px;
}
body.page_origin_embeddable {
padding-top: 10px;
}
body.page_origin_embeddable #cm-content > .container {
margin-bottom: 0px;
padding-bottom: 0px;
}
.footer > .container {
padding-right: 15px;
padding-left: 15px;

@ -89,11 +89,6 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
// So we are not in learnpath tool
Display::display_header($nameTools, get_lang('Exercise'));
} else {
$htmlHeadXtra[] = "
<style>
body { background: none;}
</style>
";
Display::display_reduced_header();
}
@ -229,7 +224,7 @@ if (!in_array($origin, ['learnpath', 'embeddable'])) {
}
Session::write('attempt_remaining', $remainingMessage);
showEmbeddableFinishButton();
//showEmbeddableFinishButton();
Display::display_reduced_footer();
} else {
$lp_mode = Session::read('lp_mode');
@ -251,7 +246,7 @@ function showEmbeddableFinishButton()
{
echo '<script>
$(function () {
$(\'.btn-close-quiz\').on(\'click\', function () {
$(\'.btn-close-quiz\').on(\'click\', function () {
window.parent.$(\'video:not(.skip), audio:not(.skip)\').get(0).play();
});
});
@ -260,12 +255,12 @@ function showEmbeddableFinishButton()
echo Display::tag(
'p',
Display::toolbarButton(
get_lang('EndTest'),
get_lang('GoBackToVideo'),
'#',
'times',
'undo',
'warning',
['role' => 'button', 'class' => 'btn-close-quiz']
),
['class' => 'text-right']
['class' => 'text-center']
);
}

@ -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">&nbsp;</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

@ -984,6 +984,7 @@ class Template
*/
public function display($template, $clearFlashMessages = true)
{
$this->assign('page_origin', api_get_origin());
$this->assign('flash_messages', Display::getFlashToString());
if ($clearFlashMessages) {

@ -9,7 +9,7 @@
{% include 'layout/head.tpl'|get_template %}
{% endblock %}
</head>
<body>
<body class="{{ 'page_origin' ? ('page_origin_' ~ page_origin) : '' }}">
<!-- START MAIN -->
<main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">
<noscript>{{ "NoJavascript"|get_lang }}</noscript>

@ -9,7 +9,7 @@
{% include 'layout/head.tpl'|get_template %}
{% endblock %}
</head>
<body>
<body class="{{ 'page_origin' ? ('page_origin_' ~ page_origin) : '' }}">
<!-- START MAIN -->
<main id="main" dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">

Loading…
Cancel
Save