@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if (!$objExercise->read($exerciseId) || |
| 117 | 117 | (!$objExercise->selectStatus() && !$is_allowedToEdit && $origin != 'learnpath') |
| 118 | 118 | ) { |
| 119 | - if ($debug) {error_log('1.1. Error while reading the exercise'); }; |
|
| 119 | + if ($debug) {error_log('1.1. Error while reading the exercise'); }; |
|
| 120 | 120 | unset ($objExercise); |
| 121 | 121 | $error = get_lang('ExerciseNotFound'); |
| 122 | 122 | } else { |
@@ -129,13 +129,13 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | //2. Checking if $objExercise is set |
| 131 | 131 | if (!isset($objExercise) && isset($exerciseInSession)) { |
| 132 | - if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
| 132 | + if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
| 133 | 133 | $objExercise = $exerciseInSession; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //3. $objExercise is not set, then return to the exercise list |
| 137 | 137 | if (!is_object($objExercise)) { |
| 138 | - if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
| 138 | + if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
| 139 | 139 | header('Location: exercise.php'); |
| 140 | 140 | exit; |
| 141 | 141 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $time_control = false; |
| 158 | 158 | if ($objExercise->expired_time != 0) { |
| 159 | - $time_control = true; |
|
| 159 | + $time_control = true; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // Generating the time control key for the user |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp; |
| 166 | 166 | |
| 167 | 167 | if ($time_control) { |
| 168 | - // Get the expired time of the current exercise in track_e_exercises |
|
| 169 | - $total_seconds = $objExercise->expired_time*60; |
|
| 168 | + // Get the expired time of the current exercise in track_e_exercises |
|
| 169 | + $total_seconds = $objExercise->expired_time*60; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $show_clock = true; |
| 173 | 173 | $user_id = api_get_user_id(); |
| 174 | 174 | if ($objExercise->selectAttempts() > 0) { |
| 175 | - $attempt_html = ''; |
|
| 175 | + $attempt_html = ''; |
|
| 176 | 176 | $attempt_count = Event::get_attempt_count( |
| 177 | 177 | $user_id, |
| 178 | 178 | $exerciseId, |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | $learnpath_item_view_id |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
| 185 | - $show_clock = false; |
|
| 186 | - if (!api_is_allowed_to_edit(null,true)) { |
|
| 184 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
| 185 | + $show_clock = false; |
|
| 186 | + if (!api_is_allowed_to_edit(null,true)) { |
|
| 187 | 187 | if ($objExercise->results_disabled == 0 && $origin != 'learnpath') { |
| 188 | 188 | |
| 189 | 189 | // Showing latest attempt according with task BT#1628 |
@@ -222,31 +222,31 @@ discard block |
||
| 222 | 222 | $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore')); |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | - $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
| 226 | - $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
| 227 | - } else { |
|
| 228 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 229 | - } |
|
| 230 | - } else { |
|
| 231 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 232 | - } |
|
| 233 | - } else { |
|
| 234 | - $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 235 | - } |
|
| 225 | + $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
| 226 | + $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
| 227 | + } else { |
|
| 228 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 229 | + } |
|
| 230 | + } else { |
|
| 231 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 232 | + } |
|
| 233 | + } else { |
|
| 234 | + $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | - if ($origin == 'learnpath') { |
|
| 238 | - Display :: display_reduced_header(); |
|
| 239 | - } else { |
|
| 240 | - Display :: display_header(get_lang('Exercises')); |
|
| 241 | - } |
|
| 237 | + if ($origin == 'learnpath') { |
|
| 238 | + Display :: display_reduced_header(); |
|
| 239 | + } else { |
|
| 240 | + Display :: display_header(get_lang('Exercises')); |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - echo $attempt_html; |
|
| 243 | + echo $attempt_html; |
|
| 244 | 244 | |
| 245 | 245 | if ($origin != 'learnpath') { |
| 246 | 246 | Display:: display_footer(); |
| 247 | 247 | } |
| 248 | - exit; |
|
| 249 | - } |
|
| 248 | + exit; |
|
| 249 | + } |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | if ($debug) { |
@@ -270,26 +270,26 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | if (empty($exercise_stat_info)) { |
| 272 | 272 | if ($debug) error_log('5 $exercise_stat_info is empty '); |
| 273 | - $total_weight = 0; |
|
| 274 | - $questionList = $objExercise->get_validated_question_list(); |
|
| 275 | - foreach ($questionListUncompressed as $question_id) { |
|
| 276 | - $objQuestionTmp = Question::read($question_id); |
|
| 277 | - $total_weight += floatval($objQuestionTmp->weighting); |
|
| 278 | - } |
|
| 273 | + $total_weight = 0; |
|
| 274 | + $questionList = $objExercise->get_validated_question_list(); |
|
| 275 | + foreach ($questionListUncompressed as $question_id) { |
|
| 276 | + $objQuestionTmp = Question::read($question_id); |
|
| 277 | + $total_weight += floatval($objQuestionTmp->weighting); |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - if ($time_control) { |
|
| 281 | - $expected_time = $current_timestamp + $total_seconds; |
|
| 280 | + if ($time_control) { |
|
| 281 | + $expected_time = $current_timestamp + $total_seconds; |
|
| 282 | 282 | |
| 283 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
| 284 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
| 283 | + if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
| 284 | + if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
| 285 | 285 | |
| 286 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
| 287 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
| 286 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
| 287 | + if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
| 288 | 288 | |
| 289 | - //Sessions that contain the expired time |
|
| 290 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
| 291 | - if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
| 292 | - } |
|
| 289 | + //Sessions that contain the expired time |
|
| 290 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
| 291 | + if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | 294 | $exe_id = $objExercise->save_stat_track_exercise_info( |
| 295 | 295 | $clock_expired_time, |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
| 308 | 308 | } else { |
| 309 | - $exe_id = $exercise_stat_info['exe_id']; |
|
| 309 | + $exe_id = $exercise_stat_info['exe_id']; |
|
| 310 | 310 | // Remember last question id position. |
| 311 | 311 | $isFirstTime = Session::read('firstTime'); |
| 312 | 312 | if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) { |
@@ -365,9 +365,9 @@ discard block |
||
| 365 | 365 | if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called:: '.print_r($exercise_stat_info, 1)); }; |
| 366 | 366 | |
| 367 | 367 | if (!empty($exercise_stat_info['questions_to_check'])) { |
| 368 | - $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
| 369 | - $my_remind_list = explode(',', $my_remind_list); |
|
| 370 | - $my_remind_list = array_filter($my_remind_list); |
|
| 368 | + $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
| 369 | + $my_remind_list = explode(',', $my_remind_list); |
|
| 370 | + $my_remind_list = array_filter($my_remind_list); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | $params = "exe_id=$exe_id&exerciseId=$exerciseId&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id&".api_get_cidreq(); |
@@ -375,8 +375,8 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | if ($reminder == 2 && empty($my_remind_list)) { |
| 377 | 377 | if ($debug) { error_log("6.2 calling the exercise_reminder.php "); }; |
| 378 | - header('Location: exercise_reminder.php?'.$params); |
|
| 379 | - exit; |
|
| 378 | + header('Location: exercise_reminder.php?'.$params); |
|
| 379 | + exit; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /* |
@@ -384,56 +384,56 @@ discard block |
||
| 384 | 384 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
| 385 | 385 | */ |
| 386 | 386 | if ($time_control) { |
| 387 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
| 388 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
| 389 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
| 387 | + if ($debug) error_log('7.1. Time control is enabled'); |
|
| 388 | + if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
| 389 | + if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
| 390 | 390 | |
| 391 | 391 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
| 392 | 392 | //Timer - Get expired_time for a student |
| 393 | 393 | if (!empty($exercise_stat_info)) { |
| 394 | - if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
| 395 | - $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
| 396 | - if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
| 397 | - // Get the last attempt of an exercise |
|
| 398 | - $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
| 394 | + if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
| 395 | + $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
| 396 | + if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
| 397 | + // Get the last attempt of an exercise |
|
| 398 | + $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
| 399 | 399 | |
| 400 | - /* This means that the user enters the exam but do not answer the |
|
| 400 | + /* This means that the user enters the exam but do not answer the |
|
| 401 | 401 | first question we get the date from the track_e_exercises not from |
| 402 | 402 | the track_et_attempt see #2069 */ |
| 403 | - if (empty($last_attempt_date)) { |
|
| 404 | - $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
| 405 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
| 406 | - } else { |
|
| 407 | - //Recalculate the time control due #2069 |
|
| 408 | - $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
| 409 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
| 410 | - } |
|
| 411 | - if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
| 412 | - |
|
| 413 | - //New expired time - it is due to the possible closure of session |
|
| 414 | - $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
| 415 | - if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
| 416 | - |
|
| 417 | - $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
| 418 | - if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
| 419 | - |
|
| 420 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
| 421 | - if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
| 422 | - |
|
| 423 | - // First we update the attempt to today |
|
| 424 | - /* How the expired time is changed into "track_e_exercises" table, |
|
| 403 | + if (empty($last_attempt_date)) { |
|
| 404 | + $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
| 405 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
| 406 | + } else { |
|
| 407 | + //Recalculate the time control due #2069 |
|
| 408 | + $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
| 409 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
| 410 | + } |
|
| 411 | + if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
| 412 | + |
|
| 413 | + //New expired time - it is due to the possible closure of session |
|
| 414 | + $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
| 415 | + if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
| 416 | + |
|
| 417 | + $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
| 418 | + if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
| 419 | + |
|
| 420 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
| 421 | + if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
| 422 | + |
|
| 423 | + // First we update the attempt to today |
|
| 424 | + /* How the expired time is changed into "track_e_exercises" table, |
|
| 425 | 425 | then the last attempt for this student should be changed too */ |
| 426 | - $sql = "UPDATE $exercise_attempt_table SET |
|
| 426 | + $sql = "UPDATE $exercise_attempt_table SET |
|
| 427 | 427 | tms = '".api_get_utc_datetime()."' |
| 428 | 428 | WHERE |
| 429 | 429 | exe_id = '".$exercise_stat_info['exe_id']."' AND |
| 430 | 430 | tms = '".$last_attempt_date."' "; |
| 431 | - if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
| 432 | - Database::query($sql); |
|
| 431 | + if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
| 432 | + Database::query($sql); |
|
| 433 | 433 | |
| 434 | - //Sessions that contain the expired time |
|
| 435 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
| 436 | - if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
| 434 | + //Sessions that contain the expired time |
|
| 435 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
| 436 | + if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
| 437 | 437 | } |
| 438 | 438 | } else { |
| 439 | 439 | $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock |
| 451 | 451 | */ |
| 452 | 452 | if ($time_control) { //Sends the exercise form when the expired time is finished |
| 453 | - $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
| 453 | + $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | // if the user has submitted the form |
@@ -463,14 +463,14 @@ discard block |
||
| 463 | 463 | // selects the list of question ID |
| 464 | 464 | $questionList = $objExercise->get_validated_question_list(); |
| 465 | 465 | if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) { |
| 466 | - $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
| 466 | + $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
| 467 | 467 | } |
| 468 | 468 | Session::write('questionList', $questionList); |
| 469 | 469 | if ($debug > 0) { error_log('$_SESSION[questionList] was set'); } |
| 470 | 470 | } else { |
| 471 | - if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
| 472 | - $questionList = $_SESSION['questionList']; |
|
| 473 | - } |
|
| 471 | + if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
| 472 | + $questionList = $_SESSION['questionList']; |
|
| 473 | + } |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | //Real question count |
| 479 | 479 | $question_count = 0; |
| 480 | 480 | if (!empty($questionList)) { |
| 481 | - $question_count = count($questionList); |
|
| 481 | + $question_count = count($questionList); |
|
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | if ($formSent && isset($_POST)) { |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | //saving each question |
| 521 | 521 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) { |
| 522 | 522 | $nro_question = $current_question; // - 1; |
| 523 | - $questionId = $key; |
|
| 523 | + $questionId = $key; |
|
| 524 | 524 | // gets the student choice for this question |
| 525 | 525 | $choice = $exerciseResult[$questionId]; |
| 526 | 526 | if (isset($exe_id)) { |
| 527 | - // Manage the question and answer attempts |
|
| 527 | + // Manage the question and answer attempts |
|
| 528 | 528 | if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); } |
| 529 | 529 | $objExercise->manage_answer( |
| 530 | 530 | $exe_id, |
@@ -613,58 +613,58 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($question_count != 0) { |
| 616 | - if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
| 616 | + if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
| 617 | 617 | $current_question > $question_count) |
| 618 | 618 | ) { |
| 619 | - if (api_is_allowed_to_session_edit()) { |
|
| 620 | - // goes to the script that will show the result of the exercise |
|
| 621 | - if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
| 622 | - if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
| 623 | - |
|
| 624 | - //We check if the user attempts before sending to the exercise_result.php |
|
| 625 | - if ($objExercise->selectAttempts() > 0) { |
|
| 626 | - $attempt_count = Event::get_attempt_count( |
|
| 619 | + if (api_is_allowed_to_session_edit()) { |
|
| 620 | + // goes to the script that will show the result of the exercise |
|
| 621 | + if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
| 622 | + if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
| 623 | + |
|
| 624 | + //We check if the user attempts before sending to the exercise_result.php |
|
| 625 | + if ($objExercise->selectAttempts() > 0) { |
|
| 626 | + $attempt_count = Event::get_attempt_count( |
|
| 627 | 627 | api_get_user_id(), |
| 628 | 628 | $exerciseId, |
| 629 | 629 | $learnpath_id, |
| 630 | 630 | $learnpath_item_id, |
| 631 | 631 | $learnpath_item_view_id |
| 632 | 632 | ); |
| 633 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
| 634 | - Display :: display_warning_message( |
|
| 633 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
| 634 | + Display :: display_warning_message( |
|
| 635 | 635 | sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), |
| 636 | 636 | false |
| 637 | 637 | ); |
| 638 | - if ($origin != 'learnpath') { |
|
| 639 | - //so we are not in learnpath tool |
|
| 640 | - echo '</div>'; //End glossary div |
|
| 641 | - Display :: display_footer(); |
|
| 642 | - } else { |
|
| 643 | - echo '</body></html>'; |
|
| 644 | - } |
|
| 645 | - exit; |
|
| 646 | - } |
|
| 647 | - } |
|
| 648 | - } else { |
|
| 649 | - if ($objExercise->review_answers) { |
|
| 650 | - header('Location: exercise_reminder.php?'.$params); |
|
| 651 | - exit; |
|
| 652 | - } else { |
|
| 638 | + if ($origin != 'learnpath') { |
|
| 639 | + //so we are not in learnpath tool |
|
| 640 | + echo '</div>'; //End glossary div |
|
| 641 | + Display :: display_footer(); |
|
| 642 | + } else { |
|
| 643 | + echo '</body></html>'; |
|
| 644 | + } |
|
| 645 | + exit; |
|
| 646 | + } |
|
| 647 | + } |
|
| 648 | + } else { |
|
| 649 | + if ($objExercise->review_answers) { |
|
| 650 | + header('Location: exercise_reminder.php?'.$params); |
|
| 651 | + exit; |
|
| 652 | + } else { |
|
| 653 | 653 | header("Location: exercise_result.php?".api_get_cidreq()."&exe_id=$exe_id&origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id"); |
| 654 | 654 | exit; |
| 655 | - } |
|
| 656 | - } |
|
| 657 | - } else { |
|
| 658 | - if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
| 659 | - exit; |
|
| 660 | - } |
|
| 661 | - } |
|
| 655 | + } |
|
| 656 | + } |
|
| 657 | + } else { |
|
| 658 | + if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
| 659 | + exit; |
|
| 660 | + } |
|
| 661 | + } |
|
| 662 | 662 | } else { |
| 663 | - $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
| 664 | - // if we are in the case where user select random by category, but didn't choose the number of random question |
|
| 665 | - if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
| 666 | - $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
| 667 | - } |
|
| 663 | + $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
| 664 | + // if we are in the case where user select random by category, but didn't choose the number of random question |
|
| 665 | + if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
| 666 | + $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
| 667 | + } |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
@@ -703,9 +703,9 @@ discard block |
||
| 703 | 703 | if (api_is_course_admin() && $origin != 'learnpath') { |
| 704 | 704 | echo '<div class="actions">'; |
| 705 | 705 | if ($show_quiz_edition == false) { |
| 706 | - echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 706 | + echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">'.Display :: return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 707 | 707 | } else { |
| 708 | - echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 708 | + echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 709 | 709 | } |
| 710 | 710 | echo '</div>'; |
| 711 | 711 | } |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet'); |
| 749 | 749 | Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts())); |
| 750 | 750 | if ($origin != 'learnpath') { |
| 751 | - Display :: display_footer(); |
|
| 751 | + Display :: display_footer(); |
|
| 752 | 752 | } |
| 753 | 753 | exit; |
| 754 | 754 | } else { |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | if (isset($_custom['exercises_hidden_when_no_start_date']) && |
| 764 | 764 | $_custom['exercises_hidden_when_no_start_date'] |
| 765 | 765 | ) { |
| 766 | - if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
| 766 | + if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
| 767 | 767 | Display:: display_warning_message( |
| 768 | 768 | sprintf( |
| 769 | 769 | get_lang('ExerciseNoStartedYet'), |
@@ -771,20 +771,20 @@ discard block |
||
| 771 | 771 | $objExercise->selectAttempts() |
| 772 | 772 | ) |
| 773 | 773 | ); |
| 774 | - if ($origin != 'learnpath') { |
|
| 775 | - Display :: display_footer(); |
|
| 776 | - } |
|
| 777 | - } |
|
| 774 | + if ($origin != 'learnpath') { |
|
| 775 | + Display :: display_footer(); |
|
| 776 | + } |
|
| 777 | + } |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | //Timer control |
| 781 | 781 | if ($time_control) { |
| 782 | 782 | echo $objExercise->return_time_left_div(); |
| 783 | - echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
| 783 | + echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | if ($origin != 'learnpath') { |
| 787 | - echo '<div id="highlight-plugin" class="glossary-content">'; |
|
| 787 | + echo '<div id="highlight-plugin" class="glossary-content">'; |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | if ($reminder == 2) { |
@@ -796,53 +796,53 @@ discard block |
||
| 796 | 796 | $current_question = 1; //set by default the 1st question |
| 797 | 797 | |
| 798 | 798 | if (!empty($my_remind_list)) { |
| 799 | - // Checking which questions we are going to call from the remind list |
|
| 800 | - for ($i = 0; $i < count($data_tracking); $i++) { |
|
| 801 | - for($j = 0; $j < count($my_remind_list); $j++) { |
|
| 802 | - |
|
| 803 | - if (!empty($remind_question_id)) { |
|
| 804 | - if ($remind_question_id == $my_remind_list[$j]) { |
|
| 805 | - |
|
| 806 | - if ($remind_question_id == $data_tracking[$i]) { |
|
| 807 | - if (isset($my_remind_list[$j+1])) { |
|
| 808 | - $remind_question_id = $my_remind_list[$j+1]; |
|
| 809 | - $current_question = $i + 1; |
|
| 810 | - } else { |
|
| 799 | + // Checking which questions we are going to call from the remind list |
|
| 800 | + for ($i = 0; $i < count($data_tracking); $i++) { |
|
| 801 | + for($j = 0; $j < count($my_remind_list); $j++) { |
|
| 802 | + |
|
| 803 | + if (!empty($remind_question_id)) { |
|
| 804 | + if ($remind_question_id == $my_remind_list[$j]) { |
|
| 805 | + |
|
| 806 | + if ($remind_question_id == $data_tracking[$i]) { |
|
| 807 | + if (isset($my_remind_list[$j+1])) { |
|
| 808 | + $remind_question_id = $my_remind_list[$j+1]; |
|
| 809 | + $current_question = $i + 1; |
|
| 810 | + } else { |
|
| 811 | 811 | // We end the remind list we go to the exercise_reminder.php please |
| 812 | - $remind_question_id = -1; |
|
| 813 | - $current_question = $i + 1; // last question |
|
| 814 | - } |
|
| 815 | - break 2; |
|
| 816 | - } |
|
| 817 | - } |
|
| 818 | - } else { |
|
| 819 | - if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
| 820 | - if (isset($my_remind_list[$j+1])) { |
|
| 821 | - $remind_question_id = $my_remind_list[$j+1]; |
|
| 822 | - $current_question = $i + 1; // last question |
|
| 823 | - } else { |
|
| 812 | + $remind_question_id = -1; |
|
| 813 | + $current_question = $i + 1; // last question |
|
| 814 | + } |
|
| 815 | + break 2; |
|
| 816 | + } |
|
| 817 | + } |
|
| 818 | + } else { |
|
| 819 | + if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
| 820 | + if (isset($my_remind_list[$j+1])) { |
|
| 821 | + $remind_question_id = $my_remind_list[$j+1]; |
|
| 822 | + $current_question = $i + 1; // last question |
|
| 823 | + } else { |
|
| 824 | 824 | // We end the remind list we go to the exercise_reminder.php please |
| 825 | - $remind_question_id = -1; |
|
| 826 | - $current_question = $i + 1; // last question |
|
| 827 | - } |
|
| 828 | - break 2; |
|
| 829 | - } |
|
| 830 | - } |
|
| 831 | - } |
|
| 825 | + $remind_question_id = -1; |
|
| 826 | + $current_question = $i + 1; // last question |
|
| 827 | + } |
|
| 828 | + break 2; |
|
| 829 | + } |
|
| 830 | + } |
|
| 831 | + } |
|
| 832 | 832 | } |
| 833 | 833 | } else { |
| 834 | - if ($objExercise->review_answers) { |
|
| 834 | + if ($objExercise->review_answers) { |
|
| 835 | 835 | if ($debug) { error_log('. redirecting to exercise_reminder.php '); } |
| 836 | - header("Location: exercise_reminder.php?$params"); |
|
| 837 | - exit; |
|
| 838 | - } |
|
| 836 | + header("Location: exercise_reminder.php?$params"); |
|
| 837 | + exit; |
|
| 838 | + } |
|
| 839 | 839 | } |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | if ($objExercise->review_answers) { |
| 843 | - $script_php = 'exercise_reminder.php'; |
|
| 843 | + $script_php = 'exercise_reminder.php'; |
|
| 844 | 844 | } else { |
| 845 | - $script_php = 'exercise_result.php'; |
|
| 845 | + $script_php = 'exercise_result.php'; |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | if (!empty($error)) { |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id . '" /> |
| 1087 | 1087 | <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />'; |
| 1088 | 1088 | |
| 1089 | - // Show list of questions |
|
| 1089 | + // Show list of questions |
|
| 1090 | 1090 | $i = 1; |
| 1091 | 1091 | $attempt_list = array(); |
| 1092 | 1092 | if (isset($exe_id)) { |
@@ -1136,10 +1136,10 @@ discard block |
||
| 1136 | 1136 | |
| 1137 | 1137 | $attributes = array('id' =>'remind_list['.$questionId.']'); |
| 1138 | 1138 | if (in_array($questionId, $remind_list)) { |
| 1139 | - $is_remind_on = true; |
|
| 1140 | - $attributes['checked'] = 1; |
|
| 1141 | - $remind_question = true; |
|
| 1142 | - $remind_highlight = ' remind_highlight '; |
|
| 1139 | + $is_remind_on = true; |
|
| 1140 | + $attributes['checked'] = 1; |
|
| 1141 | + $remind_question = true; |
|
| 1142 | + $remind_highlight = ' remind_highlight '; |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | // Showing the exercise description |
@@ -1213,8 +1213,8 @@ discard block |
||
| 1213 | 1213 | } |
| 1214 | 1214 | // end foreach() |
| 1215 | 1215 | if ($objExercise->type == ALL_ON_ONE_PAGE) { |
| 1216 | - $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
| 1217 | - echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
| 1216 | + $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
| 1217 | + echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
| 1218 | 1218 | echo '<br>'; |
| 1219 | 1219 | } |
| 1220 | 1220 | echo '</form>'; |