@@ -3267,7 +3267,9 @@ discard block |
||
3267 | 3267 | ); |
3268 | 3268 | } |
3269 | 3269 | |
3270 | - if ($debug) error_log('Start answer loop '); |
|
3270 | + if ($debug) { |
|
3271 | + error_log('Start answer loop '); |
|
3272 | + } |
|
3271 | 3273 | |
3272 | 3274 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
3273 | 3275 | $answer = $objAnswerTmp->selectAnswer($answerId); |
@@ -3381,7 +3383,9 @@ discard block |
||
3381 | 3383 | } |
3382 | 3384 | $totalScore += $answerWeighting; |
3383 | 3385 | |
3384 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3386 | + if ($debug) { |
|
3387 | + error_log("studentChoice: $studentChoice"); |
|
3388 | + } |
|
3385 | 3389 | break; |
3386 | 3390 | case GLOBAL_MULTIPLE_ANSWER: |
3387 | 3391 | if ($from_database) { |
@@ -3406,7 +3410,9 @@ discard block |
||
3406 | 3410 | $real_answers[$answerId] = (bool)$studentChoice; |
3407 | 3411 | } |
3408 | 3412 | $totalScore += $answerWeighting; |
3409 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3413 | + if ($debug) { |
|
3414 | + error_log("studentChoice: $studentChoice"); |
|
3415 | + } |
|
3410 | 3416 | break; |
3411 | 3417 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
3412 | 3418 | if ($from_database) { |
@@ -4201,7 +4207,9 @@ discard block |
||
4201 | 4207 | } // end switch Answertype |
4202 | 4208 | |
4203 | 4209 | if ($show_result) { |
4204 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4210 | + if ($debug) { |
|
4211 | + error_log('Showing questions $from '.$from); |
|
4212 | + } |
|
4205 | 4213 | if ($from == 'exercise_result') { |
4206 | 4214 | //display answers (if not matching type, or if the answer is correct) |
4207 | 4215 | if ( |
@@ -4499,7 +4507,9 @@ discard block |
||
4499 | 4507 | } |
4500 | 4508 | } |
4501 | 4509 | } else { |
4502 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4510 | + if ($debug) { |
|
4511 | + error_log('Showing questions $from '.$from); |
|
4512 | + } |
|
4503 | 4513 | |
4504 | 4514 | switch ($answerType) { |
4505 | 4515 | case UNIQUE_ANSWER: |
@@ -4846,10 +4856,14 @@ discard block |
||
4846 | 4856 | } |
4847 | 4857 | } |
4848 | 4858 | } |
4849 | - if ($debug) error_log(' ------ '); |
|
4859 | + if ($debug) { |
|
4860 | + error_log(' ------ '); |
|
4861 | + } |
|
4850 | 4862 | } // end for that loops over all answers of the current question |
4851 | 4863 | |
4852 | - if ($debug) error_log('-- end answer loop --'); |
|
4864 | + if ($debug) { |
|
4865 | + error_log('-- end answer loop --'); |
|
4866 | + } |
|
4853 | 4867 | |
4854 | 4868 | $final_answer = true; |
4855 | 4869 | |
@@ -4922,7 +4936,9 @@ discard block |
||
4922 | 4936 | // some results that haven't been stored in the database yet |
4923 | 4937 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
4924 | 4938 | |
4925 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
4939 | + if ($debug) { |
|
4940 | + error_log('$from AND this is a hotspot kind of question '); |
|
4941 | + } |
|
4926 | 4942 | |
4927 | 4943 | $my_exe_id = 0; |
4928 | 4944 | $from_database = 0; |
@@ -5109,8 +5125,12 @@ discard block |
||
5109 | 5125 | // stored by exercise_results.php (using the session) |
5110 | 5126 | |
5111 | 5127 | if ($saved_results) { |
5112 | - if ($debug) error_log("Save question results $saved_results"); |
|
5113 | - if ($debug) error_log(print_r($choice ,1 )); |
|
5128 | + if ($debug) { |
|
5129 | + error_log("Save question results $saved_results"); |
|
5130 | + } |
|
5131 | + if ($debug) { |
|
5132 | + error_log(print_r($choice ,1 )); |
|
5133 | + } |
|
5114 | 5134 | |
5115 | 5135 | if (empty($choice)) { |
5116 | 5136 | $choice = 0; |
@@ -7,7 +7,9 @@ |
||
7 | 7 | * @package chamilo.exercise |
8 | 8 | */ |
9 | 9 | |
10 | -if ( count( get_included_files() ) == 1 ) die( '---' ); |
|
10 | +if ( count( get_included_files() ) == 1 ) { |
|
11 | + die( '---' ); |
|
12 | +} |
|
11 | 13 | |
12 | 14 | if (!function_exists('mime_content_type')) { |
13 | 15 |
@@ -48,8 +48,7 @@ |
||
48 | 48 | foreach($items as $item) { /** @var $item MenuItemModel */ |
49 | 49 | if($item->hasChildren()) { |
50 | 50 | $this->activateByRoute($route, $item->getChildren()); |
51 | - } |
|
52 | - else { |
|
51 | + } else { |
|
53 | 52 | if($item->getRoute() == $route) { |
54 | 53 | $item->setIsActive(true); |
55 | 54 | } |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | // Mark folders to import which are not selected by the user to import, |
536 | 536 | // but in which a document was selected. |
537 | 537 | $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
538 | - if (!empty($resources) && is_array($resources)) |
|
539 | - foreach ($resources as $id => $obj) { |
|
538 | + if (!empty($resources) && is_array($resources)) { |
|
539 | + foreach ($resources as $id => $obj) { |
|
540 | 540 | if (isset($obj->file_type) && $obj->file_type == 'folder' && |
541 | 541 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
542 | 542 | is_array($documents) |
@@ -544,6 +544,7 @@ discard block |
||
544 | 544 | foreach ($documents as $id_to_check => $post_value) { |
545 | 545 | if (isset($resources[$id_to_check])) { |
546 | 546 | $obj_to_check = $resources[$id_to_check]; |
547 | + } |
|
547 | 548 | $shared_path_part = substr( |
548 | 549 | $obj_to_check->path, |
549 | 550 | 0, |
@@ -314,7 +314,9 @@ discard block |
||
314 | 314 | |
315 | 315 | $clock_expired_time = null; |
316 | 316 | if (empty($exercise_stat_info)) { |
317 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
317 | + if ($debug) { |
|
318 | + error_log('5 $exercise_stat_info is empty '); |
|
319 | + } |
|
318 | 320 | $total_weight = 0; |
319 | 321 | $questionList = $objExercise->get_validated_question_list(); |
320 | 322 | foreach ($questionListUncompressed as $question_id) { |
@@ -325,11 +327,17 @@ discard block |
||
325 | 327 | if ($time_control) { |
326 | 328 | $expected_time = $current_timestamp + $total_seconds; |
327 | 329 | |
328 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
329 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
330 | + if ($debug) { |
|
331 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
332 | + } |
|
333 | + if ($debug) { |
|
334 | + error_log('5.2. $expected_time '.$expected_time); |
|
335 | + } |
|
330 | 336 | |
331 | 337 | $clock_expired_time = api_get_utc_datetime($expected_time); |
332 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
338 | + if ($debug) { |
|
339 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
340 | + } |
|
333 | 341 | |
334 | 342 | //Sessions that contain the expired time |
335 | 343 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -349,8 +357,10 @@ discard block |
||
349 | 357 | $learnpath_item_id, |
350 | 358 | $learnpath_item_view_id |
351 | 359 | ); |
352 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
353 | -} else { |
|
360 | + if ($debug) { |
|
361 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
362 | + } |
|
363 | + } else { |
|
354 | 364 | $exe_id = $exercise_stat_info['exe_id']; |
355 | 365 | // Remember last question id position. |
356 | 366 | $isFirstTime = Session::read('firstTime'); |
@@ -373,8 +383,10 @@ discard block |
||
373 | 383 | } |
374 | 384 | } |
375 | 385 | |
376 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
377 | -} |
|
386 | + if ($debug) { |
|
387 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
388 | + } |
|
389 | + } |
|
378 | 390 | |
379 | 391 | $questionListInSession = Session::read('questionList'); |
380 | 392 | |
@@ -430,9 +442,15 @@ discard block |
||
430 | 442 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
431 | 443 | */ |
432 | 444 | if ($time_control) { |
433 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
434 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
435 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
445 | + if ($debug) { |
|
446 | + error_log('7.1. Time control is enabled'); |
|
447 | + } |
|
448 | + if ($debug) { |
|
449 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
450 | + } |
|
451 | + if ($debug) { |
|
452 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
453 | + } |
|
436 | 454 | |
437 | 455 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
438 | 456 | //Timer - Get expired_time for a student |
@@ -514,7 +532,9 @@ discard block |
||
514 | 532 | } |
515 | 533 | } |
516 | 534 | |
517 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
535 | +if ($debug) { |
|
536 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
537 | +} |
|
518 | 538 | |
519 | 539 | //Real question count |
520 | 540 | $question_count = 0; |
@@ -523,7 +523,7 @@ |
||
523 | 523 | ) { |
524 | 524 | if($btnBing){ |
525 | 525 | $btnBing = 'btn-lg'; |
526 | - }else{ |
|
526 | + } else{ |
|
527 | 527 | $btnBing = 'btn-sm'; |
528 | 528 | } |
529 | 529 | if ($checkRequirements) { |