|
|
|
|
@ -339,6 +339,7 @@ we delete the objExercise from the session in order to get the latest changes in |
|
|
|
|
if (api_is_allowed_to_edit(null,true) && isset($_GET['preview']) && $_GET['preview'] == 1) { |
|
|
|
|
Session::erase('objExercise'); |
|
|
|
|
} |
|
|
|
|
/** @var \Exercise $exerciseInSession */ |
|
|
|
|
$exerciseInSession = Session::read('objExercise'); |
|
|
|
|
|
|
|
|
|
// 1. Loading the $objExercise variable |
|
|
|
|
@ -371,7 +372,9 @@ if (!isset($exerciseInSession) || isset($exerciseInSession) && ($exerciseInSessi |
|
|
|
|
|
|
|
|
|
//2. Checking if $objExercise is set |
|
|
|
|
if (!isset($objExercise) && isset($exerciseInSession)) { |
|
|
|
|
if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('2. Loading $objExercise from session'); |
|
|
|
|
} |
|
|
|
|
$objExercise = $exerciseInSession; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -401,7 +404,7 @@ if ($objExercise->expired_time != 0) { |
|
|
|
|
$time_control = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Generating the time control key for the user |
|
|
|
|
// Generating the time control key for the user. |
|
|
|
|
$current_expired_time_key = ExerciseLib::get_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id); |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log("4. current_expired_time_key: $current_expired_time_key "); |
|
|
|
|
@ -540,18 +543,20 @@ if (empty($exercise_stat_info)) { |
|
|
|
|
if ($time_control) { |
|
|
|
|
$expected_time = $current_timestamp + $total_seconds; |
|
|
|
|
|
|
|
|
|
if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
|
|
|
if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
|
|
|
|
|
|
|
|
$clock_expired_time = api_get_utc_datetime($expected_time); |
|
|
|
|
if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
|
|
|
|
|
|
|
|
//Sessions that contain the expired time |
|
|
|
|
$expiredTime = array( |
|
|
|
|
$current_expired_time_key => $clock_expired_time |
|
|
|
|
); |
|
|
|
|
Session::write('expired_time', $expiredTime); |
|
|
|
|
if ($debug) { error_log('5.4. Setting the $expiredTime: '.$expiredTime[$current_expired_time_key] ); }; |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('5.1. $current_timestamp '.$current_timestamp); |
|
|
|
|
error_log('5.2. $expected_time '.$expected_time); |
|
|
|
|
error_log('5.3. $expected_time '.$clock_expired_time); |
|
|
|
|
error_log('5.4. Setting the $expiredTime: '.$expiredTime[$current_expired_time_key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$exe_id = $objExercise->save_stat_track_exercise_info($clock_expired_time, $learnpath_id, $learnpath_item_id, $learnpath_item_view_id, $questionListUncompressed, $total_weight); |
|
|
|
|
$exercise_stat_info = $objExercise->getStatTrackExerciseInfo($learnpath_id, $learnpath_item_id, $learnpath_item_view_id); |
|
|
|
|
@ -564,7 +569,9 @@ if (empty($exercise_stat_info)) { |
|
|
|
|
// Array to check in order to block the chat |
|
|
|
|
ExerciseLib::create_chat_exercise_session($exe_id); |
|
|
|
|
|
|
|
|
|
if ($debug) { error_log('6. $objExercise->getStatTrackExerciseInfo function called:: '.print_r($exercise_stat_info, 1)); }; |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('6. $objExercise->getStatTrackExerciseInfo function called:: '.print_r($exercise_stat_info, 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($exercise_stat_info['questions_to_check'])) { |
|
|
|
|
$my_remind_list = $exercise_stat_info['questions_to_check']; |
|
|
|
|
@ -589,8 +596,10 @@ if ($reminder == 2 && empty($my_remind_list)) { |
|
|
|
|
if ($time_control) { |
|
|
|
|
$expiredTimeInSession = Session::read('expired_time'); |
|
|
|
|
|
|
|
|
|
if ($debug) error_log('7.1. Time control is enabled.'); |
|
|
|
|
if ($debug) error_log('7.2. $current_expired_time_key:'.$current_expired_time_key); |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('7.1. Time control is enabled.'); |
|
|
|
|
error_log('7.2. $current_expired_time_key:'.$current_expired_time_key); |
|
|
|
|
} |
|
|
|
|
if (!isset($expiredTimeInSession[$current_expired_time_key])) { |
|
|
|
|
if ($debug) error_log('7.3. $expiredTimeInSession[$current_expired_time_key] not set.'); |
|
|
|
|
//Timer - Get expired_time for a student |
|
|
|
|
@ -711,8 +720,10 @@ if ($formSent && isset($_POST)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($debug) { error_log('9.3. $choice is an array - end'); } |
|
|
|
|
if ($debug) { error_log('9.4. $exerciseResult '.print_r($exerciseResult,1)); } |
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('9.3. $choice is an array - end'); |
|
|
|
|
error_log('9.4. $exerciseResult '.print_r($exerciseResult,1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// the script "exercise_result.php" will take the variable $exerciseResult from the session |
|
|
|
|
@ -944,7 +955,7 @@ if (isset($_custom['exercises_hidden_when_no_start_date']) && $_custom['exercise |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Timer control |
|
|
|
|
// Timer control. |
|
|
|
|
if ($time_control) { |
|
|
|
|
echo $objExercise->returnTimeLeftDiv(); |
|
|
|
|
echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciceExpiredTimeMessage').'</div>'; |
|
|
|
|
|