Exercises: Adding a popup before sending the user to the results page see #5263

skala
Julio Montoya 14 years ago
parent 4c2111093f
commit bc12de9f7b
  1. 8
      main/css/base.css
  2. 92
      main/exercice/exercise.class.php
  3. 12
      main/exercice/exercise_submit.php
  4. 17
      main/lang/english/trad4all.inc.php

@ -2454,10 +2454,6 @@ div.admin_section h4 {
background-color: #FFF7C0;
}
.main_question {
}
.exercise_header {
border-bottom: 1px dotted #ccc;
margin-bottom:20px;
@ -2540,6 +2536,7 @@ div.admin_section h4 {
border:1px solid #B8860B;
}
/* Exercise clock*/
.count_down {
padding: 3px;
font-size:22px;
@ -2552,8 +2549,7 @@ div.admin_section h4 {
.red_alert {
color:red;
font-weight: bold;
color:red;
font-weight: bold;
}
#question_feedback {

@ -286,7 +286,6 @@ class Exercise {
$this->text_when_finished = $in_txt;
}
/**
* return 1 or 2 if randomByCat
* @author - hubert borderiou
@ -363,7 +362,6 @@ class Exercise {
return $this->random_answers;
}
/**
* Same as isRandom() but has a name applied to values different than 0 or 1
*/
@ -408,7 +406,6 @@ class Exercise {
return $this->questionList;
}
/**
* returns the number of questions in this exercise
*
@ -1631,33 +1628,70 @@ class Exercise {
public function show_time_control_js($time_left) {
$time_left = intval($time_left);
return "<script>
$(document).ready(function() {
function get_expired_date_string(expired_time) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var day, month, year, hours, minutes, seconds, date_string;
var obj_date = new Date(expired_time);
day = obj_date.getDate();
if (day < 10) day = '0' + day;
month = obj_date.getMonth();
year = obj_date.getFullYear();
hours = obj_date.getHours();
if (hours < 10) hours = '0' + hours;
minutes = obj_date.getMinutes();
if (minutes < 10) minutes = '0' + minutes;
seconds = obj_date.getSeconds();
if (seconds < 10) seconds = '0' + seconds;
date_string = months[month] +' ' + day + ', ' + year + ' ' + hours + ':' + minutes + ':' + seconds;
return date_string;
}
function open_clock_warning() {
$('#clock_warning').dialog({
modal:true,
height:250,
closeOnEscape: false,
resizable: false,
buttons: {
'".addslashes(get_lang("EndTest"))."': function() {
$('#clock_warning').dialog('close');
},
},
close: function() {
send_form();
}
});
$('#clock_warning').dialog('open');
function get_expired_date_string(expired_time) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var day, month, year, hours, minutes, seconds, date_string;
var obj_date = new Date(expired_time);
day = obj_date.getDate();
if (day < 10) day = '0' + day;
month = obj_date.getMonth();
year = obj_date.getFullYear();
hours = obj_date.getHours();
if (hours < 10) hours = '0' + hours;
minutes = obj_date.getMinutes();
if (minutes < 10) minutes = '0' + minutes;
seconds = obj_date.getSeconds();
if (seconds < 10) seconds = '0' + seconds;
date_string = months[month] +' ' + day + ', ' + year + ' ' + hours + ':' + minutes + ':' + seconds;
return date_string;
}
function onExpiredTimeExercise() {
$('#wrapper-clock').hide();
$('#exercise_form').hide();
$('#expired-message-id').show();
$('#exercise_form').submit();
}
$('#counter_to_redirect').epiclock({
mode: $.epiclock.modes.countdown,
offset: {seconds: 5},
format: 's'
}).bind('timer', function () {
send_form();
});
}
function send_form() {
//console.log('send_form');
$('#exercise_form').submit();
}
function onExpiredTimeExercise() {
$('#wrapper-clock').hide();
$('#exercise_form').hide();
$('#expired-message-id').show();
//Fixes bug #5263
$('#num_current_id').attr('value', '".$this->selectNbrQuestions()."');
open_clock_warning();
}
$(document).ready(function() {
var current_time = new Date().getTime();
var time_left = parseInt(".$time_left."); // time in seconds when using minutes there are some seconds lost
var expired_time = current_time + (time_left*1000);

@ -93,7 +93,6 @@ $current_question = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : null;
$error = '';
//Table calls
$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$exercice_attemp_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
/* Teacher takes an exam and want to see a preview, we delete the objExercise from the session in order to get the latest changes in the exercise */
@ -160,7 +159,7 @@ if ($time_control) {
//Get the expired time of the current exercice in track_e_exercices
$total_seconds = $objExercise->expired_time*60;
}
$objExercise->questionList;
$show_clock = true;
$user_id = api_get_user_id();
if ($objExercise->selectAttempts() > 0) {
@ -275,7 +274,7 @@ if ($reminder == 2 && empty($my_remind_list)) {
/*
* 7. Loading Time control parameters
* If the expired time is major that zero(0) then the expired time is compute on this time. Disable for learning path
* If the expired time is major that zero(0) then the expired time is compute on this time.
*/
if ($time_control) {
@ -470,6 +469,7 @@ if ($formSent && isset($_POST)) {
}
/*
//Clean incomplete - @todo why setting to blank the status?
$stat_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$update_query = "UPDATE $stat_table SET status = '', exe_date = '".api_get_utc_datetime() ."' , orig_lp_item_view_id = '$learnpath_item_view_id' $sql_exe_result WHERE exe_id = ".$exe_id;
if ($debug) { error_log('Updating track_e_exercises '.$update_query); }
@ -918,11 +918,13 @@ if (!empty($error)) {
return false;
}
</script>';
echo '<div id="clock_warning" style="display:none">'.Display::return_message(get_lang('ReachedTimeLimit'), 'warning').' '.sprintf(get_lang('YouWillBeRedirectedInXSeconds'), '<span id="counter_to_redirect" class="red_alert"></span>').'</div>';
echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&gradebook='.$gradebook."&exerciseId=" . $exerciseId .'" name="frm_exercise" '.$onsubmit.'>
<input type="hidden" name="formSent" value="1" />
<input type="hidden" name="exerciseId" value="'.$exerciseId . '" />
<input type="hidden" name="num" value="'.$current_question . '" />
<input type="hidden" name="num" value="'.$current_question.'" id="num_current_id" />
<input type="hidden" name="exe_id" value="'.$exe_id . '" />
<input type="hidden" name="origin" value="'.$origin . '" />
<input type="hidden" name="learnpath_id" value="'.$learnpath_id . '" />

@ -957,13 +957,13 @@ $SendInformation = "Send information";
$YouMustAcceptLicence = "You must accept the licence";
$SelectOne = "Select one";
$ContactInformationHasBeenSent = "Contact information has been sent";
$ContactInformationDescription = "Dear user,<br />
<br />You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.<br />
<br />
By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.<br />
<br />
By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.<br />
<br />
$ContactInformationDescription = "Dear user,<br />
<br />You are about to start using one of the best open-source e-learning platform on the market. Like many other open-source project, this project is backed up by a large community of students, teachers, developers and content creators who would like to promote the project better.<br />
<br />
By knowing a little bit more about you, one of our most important users, who will manage this e-learning system, we will be able to let people know that our software is used and let you know when we organize events that might be relevant to you.<br />
<br />
By filling this form, you accept that the Chamilo association or its members might send you information by e-mail about important events or updates in the Chamilo software or community. This will help the community grow as an organized entity where information flow, with a permanent respect of your time and your privacy.<br />
<br />
Please note that you are <b>not required</b> to fill this form. If you want to remain anonymous, we will loose the opportunity to offer you all the privileges of being a registered portal administrator, but we will respect your decision. Simply leave this form empty and click \"Next\".<br /><br />";
$CompanyActivity = "Your company's activity";
$DateUnLock = "Unlock date";
@ -1169,7 +1169,7 @@ $SaveForNow = "Save and continue later";
$NoQuicktime = "Your browser does not have the QuickTime plugin installed. You can still use the platform, but to run a larger number of media file types, we suggest you might want to install it.";
$NoJavaSun = "Your browser doesn't seem to have the Sun Java plugin installed. You can still use the platform, but you will lose a few of its capabilities.";
$NoJava = "Your browser does not support Java";
$JavaSun24 = "Your browser has a Java version not supported by this tool.
$JavaSun24 = "Your browser has a Java version not supported by this tool.
To use it you have to install a Java Sun version higher than 24";
$NoMessageAnywere = "If you do not want to see this message again during this session, click here";
$Attempts = "Attempts";
@ -1333,4 +1333,5 @@ $DataTableSearch = "Search";
$HideColumn = "Hide column";
$DisplayColumn = "Show column";
$LegalAgreementAccepted = "Legal agreement accepted";
$YouWillBeRedirectedInXSeconds = "You will be redirected in %s seconds";
?>
Loading…
Cancel
Save