Completed
Push — 1.11.x ( 81dbf4...6ab6ac )
by José
86:12 queued 55:54
created
main/exercise/exercise_submit.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     if (!$objExercise->read($exerciseId) ||
124 124
         (!$objExercise->selectStatus() && !$is_allowedToEdit && $origin != 'learnpath')
125 125
     ) {
126
-    	if ($debug) {error_log('1.1. Error while reading the exercise'); };
126
+        if ($debug) {error_log('1.1. Error while reading the exercise'); };
127 127
         unset ($objExercise);
128 128
         $error = get_lang('ExerciseNotFound');
129 129
     } else {
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 }
137 137
 //2. Checking if $objExercise is set
138 138
 if (!isset($objExercise) && isset($exerciseInSession)) {
139
-	if ($debug) { error_log('2. Loading $objExercise from session'); };
139
+    if ($debug) { error_log('2. Loading $objExercise from session'); };
140 140
     $objExercise = $exerciseInSession;
141 141
 }
142 142
 
143 143
 //3. $objExercise is not set, then return to the exercise list
144 144
 if (!is_object($objExercise)) {
145
-	if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
145
+    if ($debug) {error_log('3. $objExercise was not set, kill the script'); };
146 146
     header('Location: exercise.php');
147 147
     exit;
148 148
 }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 $time_control = false;
165 165
 if ($objExercise->expired_time != 0) {
166
-	$time_control = true;
166
+    $time_control = true;
167 167
 }
168 168
 
169 169
 // Generating the time control key for the user
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp;
173 173
 
174 174
 if ($time_control) {
175
-	// Get the expired time of the current exercise in track_e_exercises
176
-	$total_seconds = $objExercise->expired_time*60;
175
+    // Get the expired time of the current exercise in track_e_exercises
176
+    $total_seconds = $objExercise->expired_time*60;
177 177
 }
178 178
 
179 179
 $show_clock = true;
180 180
 $user_id = api_get_user_id();
181 181
 if ($objExercise->selectAttempts() > 0) {
182
-	$attempt_html = '';
182
+    $attempt_html = '';
183 183
     $attempt_count = Event::get_attempt_count(
184 184
         $user_id,
185 185
         $exerciseId,
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
         $learnpath_item_view_id
189 189
     );
190 190
 
191
-	if ($attempt_count >= $objExercise->selectAttempts()) {
192
-		$show_clock = false;
193
-		if (!api_is_allowed_to_edit(null,true)) {
191
+    if ($attempt_count >= $objExercise->selectAttempts()) {
192
+        $show_clock = false;
193
+        if (!api_is_allowed_to_edit(null,true)) {
194 194
             if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
195 195
 
196 196
                 // Showing latest attempt according with task BT#1628
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
                             $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore'));
230 230
                         }
231 231
                     }
232
-					$score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
233
-					$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
234
-				} else {
235
-					$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
236
-				}
237
-			} else {
238
-				$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
239
-			}
240
-		} else {
241
-			$attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
242
-		}
232
+                    $score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
233
+                    $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
234
+                } else {
235
+                    $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
236
+                }
237
+            } else {
238
+                $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
239
+            }
240
+        } else {
241
+            $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
242
+        }
243 243
 
244
-		if ($origin == 'learnpath') {
245
-			Display :: display_reduced_header();
246
-		} else {
247
-			Display :: display_header(get_lang('Exercises'));
248
-		}
244
+        if ($origin == 'learnpath') {
245
+            Display :: display_reduced_header();
246
+        } else {
247
+            Display :: display_header(get_lang('Exercises'));
248
+        }
249 249
 
250
-		echo $attempt_html;
250
+        echo $attempt_html;
251 251
 
252 252
         if ($origin != 'learnpath') {
253 253
             Display:: display_footer();
254 254
         }
255
-		exit;
256
-	}
255
+        exit;
256
+    }
257 257
 }
258 258
 
259 259
 if ($debug) {
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
 
278 278
 if (empty($exercise_stat_info)) {
279 279
     if ($debug)  error_log('5  $exercise_stat_info is empty ');
280
-	$total_weight = 0;
281
-	$questionList = $objExercise->get_validated_question_list();
282
-	foreach ($questionListUncompressed as $question_id) {
283
-		$objQuestionTmp = Question::read($question_id);
284
-		$total_weight += floatval($objQuestionTmp->weighting);
285
-	}
280
+    $total_weight = 0;
281
+    $questionList = $objExercise->get_validated_question_list();
282
+    foreach ($questionListUncompressed as $question_id) {
283
+        $objQuestionTmp = Question::read($question_id);
284
+        $total_weight += floatval($objQuestionTmp->weighting);
285
+    }
286 286
 
287
-	if ($time_control) {
288
-		$expected_time = $current_timestamp + $total_seconds;
287
+    if ($time_control) {
288
+        $expected_time = $current_timestamp + $total_seconds;
289 289
 
290
-		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
291
-		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
290
+        if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
291
+        if ($debug)  error_log('5.2. $expected_time '.$expected_time);
292 292
 
293
-		$clock_expired_time 	= api_get_utc_datetime($expected_time);
294
-		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
293
+        $clock_expired_time 	= api_get_utc_datetime($expected_time);
294
+        if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
295 295
 
296
-		//Sessions  that contain the expired time
297
-		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
298
-		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
299
-	}
296
+        //Sessions  that contain the expired time
297
+        $_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
298
+        if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
299
+    }
300 300
 
301 301
     $exe_id = $objExercise->save_stat_track_exercise_info(
302 302
         $clock_expired_time,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
     );
314 314
     if ($debug)  error_log("5.5  exercise_stat_info[] exists getting exe_id $exe_id");
315 315
 } else {
316
-	$exe_id = $exercise_stat_info['exe_id'];
316
+    $exe_id = $exercise_stat_info['exe_id'];
317 317
     // Remember last question id position.
318 318
     $isFirstTime = Session::read('firstTime');
319 319
     if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) {
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called::  '.print_r($exercise_stat_info, 1)); };
373 373
 
374 374
 if (!empty($exercise_stat_info['questions_to_check'])) {
375
-	$my_remind_list = $exercise_stat_info['questions_to_check'];
376
-	$my_remind_list = explode(',', $my_remind_list);
377
-	$my_remind_list = array_filter($my_remind_list);
375
+    $my_remind_list = $exercise_stat_info['questions_to_check'];
376
+    $my_remind_list = explode(',', $my_remind_list);
377
+    $my_remind_list = array_filter($my_remind_list);
378 378
 }
379 379
 
380 380
 $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();
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 
383 383
 if ($reminder == 2 && empty($my_remind_list)) {
384 384
     if ($debug) { error_log("6.2 calling the exercise_reminder.php "); };
385
-	header('Location: exercise_reminder.php?'.$params);
386
-	exit;
385
+    header('Location: exercise_reminder.php?'.$params);
386
+    exit;
387 387
 }
388 388
 
389 389
 /*
@@ -391,56 +391,56 @@  discard block
 block discarded – undo
391 391
  * If the expired time is major that zero(0) then the expired time is compute on this time.
392 392
  */
393 393
 if ($time_control) {
394
-	if ($debug) error_log('7.1. Time control is enabled');
395
-	if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
396
-	if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
394
+    if ($debug) error_log('7.1. Time control is enabled');
395
+    if ($debug) error_log('7.2. $current_expired_time_key  '.$current_expired_time_key);
396
+    if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key]  '.$_SESSION['expired_time'][$current_expired_time_key]);
397 397
 
398 398
     if (!isset($_SESSION['expired_time'][$current_expired_time_key])) {
399 399
         //Timer - Get expired_time for a student
400 400
         if (!empty($exercise_stat_info)) {
401
-        	if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
402
-	        $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
403
-			if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
404
-	        // Get the last attempt of an exercise
405
-	    	$last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
401
+            if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); };
402
+            $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control'];
403
+            if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); }
404
+            // Get the last attempt of an exercise
405
+            $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']);
406 406
 
407
-	    	/* This means that the user enters the exam but do not answer the
407
+            /* This means that the user enters the exam but do not answer the
408 408
 	    	   first question we get the date from the track_e_exercises not from
409 409
 	    	   the track_et_attempt see #2069 */
410
-	    	if (empty($last_attempt_date)) {
411
-	    		$diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
412
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
413
-	    	} else {
414
-	    		//Recalculate the time control due #2069
415
-	    		$diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
416
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
417
-	    	}
418
-	        if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
419
-
420
-	        //New expired time - it is due to the possible closure of session
421
-	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
422
-	        if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
423
-
424
-	        $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
425
-	        if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
426
-
427
-	        $clock_expired_time  = api_get_utc_datetime($expected_time);
428
-	        if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
429
-
430
-			// First we update the attempt to today
431
-			/* How the expired time is changed into "track_e_exercises" table,
410
+            if (empty($last_attempt_date)) {
411
+                $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
412
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
413
+            } else {
414
+                //Recalculate the time control due #2069
415
+                $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
416
+                $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
417
+            }
418
+            if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
419
+
420
+            //New expired time - it is due to the possible closure of session
421
+            $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
422
+            if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
423
+
424
+            $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
425
+            if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
426
+
427
+            $clock_expired_time  = api_get_utc_datetime($expected_time);
428
+            if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
429
+
430
+            // First we update the attempt to today
431
+            /* How the expired time is changed into "track_e_exercises" table,
432 432
                then the last attempt for this student should be changed too */
433
-	        $sql = "UPDATE $exercise_attempt_table SET
433
+            $sql = "UPDATE $exercise_attempt_table SET
434 434
 	                tms = '".api_get_utc_datetime()."'
435 435
 	                WHERE
436 436
 	                    exe_id = '".$exercise_stat_info['exe_id']."' AND
437 437
 	                    tms = '".$last_attempt_date."' ";
438
-	        if ($debug) {error_log('7.10. $sql: '.$sql); }
439
-	        Database::query($sql);
438
+            if ($debug) {error_log('7.10. $sql: '.$sql); }
439
+            Database::query($sql);
440 440
 
441
-	        //Sessions  that contain the expired time
442
-	        $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
443
-	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
441
+            //Sessions  that contain the expired time
442
+            $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
443
+            if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
444 444
         }
445 445
     } else {
446 446
         $clock_expired_time =  $_SESSION['expired_time'][$current_expired_time_key];
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
  * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock
458 458
  */
459 459
 if ($time_control) { //Sends the exercise form when the expired time is finished
460
-	$htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
460
+    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
461 461
 }
462 462
 
463 463
 // if the user has submitted the form
@@ -470,14 +470,14 @@  discard block
 block discarded – undo
470 470
     // selects the list of question ID
471 471
     $questionList = $objExercise->get_validated_question_list();
472 472
     if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) {
473
-    	$questionList = explode(',', $exercise_stat_info['data_tracking']);
473
+        $questionList = explode(',', $exercise_stat_info['data_tracking']);
474 474
     }
475 475
     Session::write('questionList', $questionList);
476 476
     if ($debug > 0) { error_log('$_SESSION[questionList] was set'); }
477 477
 } else {
478
-	if (isset($objExercise) && isset($_SESSION['objExercise'])) {
479
-    	$questionList = $_SESSION['questionList'];
480
-	}
478
+    if (isset($objExercise) && isset($_SESSION['objExercise'])) {
479
+        $questionList = $_SESSION['questionList'];
480
+    }
481 481
 }
482 482
 
483 483
 if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1));
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 //Real question count
486 486
 $question_count = 0;
487 487
 if (!empty($questionList)) {
488
-	$question_count = count($questionList);
488
+    $question_count = count($questionList);
489 489
 }
490 490
 
491 491
 if ($formSent && isset($_POST)) {
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
                 //saving each question
528 528
                 if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) {
529 529
                     $nro_question = $current_question; // - 1;
530
-                 	$questionId   = $key;
530
+                        $questionId   = $key;
531 531
                     // gets the student choice for this question
532 532
                     $choice = $exerciseResult[$questionId];
533 533
                     if (isset($exe_id)) {
534
-                    	// Manage the question and answer attempts
534
+                        // Manage the question and answer attempts
535 535
                         if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); }
536 536
                         $objExercise->manage_answer(
537 537
                             $exe_id,
@@ -620,58 +620,58 @@  discard block
 block discarded – undo
620 620
 }
621 621
 
622 622
 if ($question_count != 0) {
623
-	if (($objExercise->type == ALL_ON_ONE_PAGE ||
623
+    if (($objExercise->type == ALL_ON_ONE_PAGE ||
624 624
         $current_question > $question_count)
625 625
     ) {
626
-	    if (api_is_allowed_to_session_edit()) {
627
-	        // goes to the script that will show the result of the exercise
628
-	        if ($objExercise->type == ALL_ON_ONE_PAGE) {
629
-	            if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
630
-
631
-	            //We check if the user attempts before sending to the exercise_result.php
632
-	            if ($objExercise->selectAttempts() > 0) {
633
-	                $attempt_count = Event::get_attempt_count(
626
+        if (api_is_allowed_to_session_edit()) {
627
+            // goes to the script that will show the result of the exercise
628
+            if ($objExercise->type == ALL_ON_ONE_PAGE) {
629
+                if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); }
630
+
631
+                //We check if the user attempts before sending to the exercise_result.php
632
+                if ($objExercise->selectAttempts() > 0) {
633
+                    $attempt_count = Event::get_attempt_count(
634 634
                         api_get_user_id(),
635 635
                         $exerciseId,
636 636
                         $learnpath_id,
637 637
                         $learnpath_item_id,
638 638
                         $learnpath_item_view_id
639 639
                     );
640
-	                if ($attempt_count >= $objExercise->selectAttempts()) {
641
-	                    Display :: display_warning_message(
640
+                    if ($attempt_count >= $objExercise->selectAttempts()) {
641
+                        Display :: display_warning_message(
642 642
                             sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()),
643 643
                             false
644 644
                         );
645
-	                    if ($origin != 'learnpath') {
646
-	                        //so we are not in learnpath tool
647
-	                        echo '</div>'; //End glossary div
648
-	                        Display :: display_footer();
649
-	                    } else {
650
-	                        echo '</body></html>';
651
-	                    }
652
-	                    exit;
653
-	                }
654
-	            }
655
-	        } else {
656
-	            if ($objExercise->review_answers) {
657
-	            	header('Location: exercise_reminder.php?'.$params);
658
-	            	exit;
659
-	            } else {
645
+                        if ($origin != 'learnpath') {
646
+                            //so we are not in learnpath tool
647
+                            echo '</div>'; //End glossary div
648
+                            Display :: display_footer();
649
+                        } else {
650
+                            echo '</body></html>';
651
+                        }
652
+                        exit;
653
+                    }
654
+                }
655
+            } else {
656
+                if ($objExercise->review_answers) {
657
+                    header('Location: exercise_reminder.php?'.$params);
658
+                    exit;
659
+                } else {
660 660
                     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");
661 661
                     exit;
662
-	            }
663
-	        }
664
-	    } else {
665
-	        if ($debug) { error_log('Redirecting to exercise_submit.php'); }
666
-	        exit;
667
-	    }
668
-	}
662
+                }
663
+            }
664
+        } else {
665
+            if ($debug) { error_log('Redirecting to exercise_submit.php'); }
666
+            exit;
667
+        }
668
+    }
669 669
 } else {
670
-	$error = get_lang('ThereAreNoQuestionsForThisExercise');
671
-	// if we are in the case where user select random by category, but didn't choose the number of random question
672
-	if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
673
-		$error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
674
-	}
670
+    $error = get_lang('ThereAreNoQuestionsForThisExercise');
671
+    // if we are in the case where user select random by category, but didn't choose the number of random question
672
+    if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) {
673
+        $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion');
674
+    }
675 675
 }
676 676
 
677 677
 if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
 if (api_is_course_admin() && $origin != 'learnpath') {
711 711
     echo '<div class="actions">';
712 712
     if ($show_quiz_edition == false) {
713
-    	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>';
713
+        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>';
714 714
     } else {
715
-    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
715
+        echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
716 716
     }
717 717
     echo '</div>';
718 718
 }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
756 756
             Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts()));
757 757
             if ($origin != 'learnpath') {
758
-            	Display :: display_footer();
758
+                Display :: display_footer();
759 759
             }
760 760
             exit;
761 761
         } else {
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 if (isset($_custom['exercises_hidden_when_no_start_date']) &&
771 771
     $_custom['exercises_hidden_when_no_start_date']
772 772
 ) {
773
-	if (empty($objExercise->start_time)) {
773
+    if (empty($objExercise->start_time)) {
774 774
         Display:: display_warning_message(
775 775
             sprintf(
776 776
                 get_lang('ExerciseNoStartedYet'),
@@ -778,20 +778,20 @@  discard block
 block discarded – undo
778 778
                 $objExercise->selectAttempts()
779 779
             )
780 780
         );
781
-		if ($origin != 'learnpath') {
782
-			Display :: display_footer();
783
-		}
784
-	}
781
+        if ($origin != 'learnpath') {
782
+            Display :: display_footer();
783
+        }
784
+    }
785 785
 }
786 786
 
787 787
 //Timer control
788 788
 if ($time_control) {
789 789
     echo $objExercise->return_time_left_div();
790
-	echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
790
+    echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>';
791 791
 }
792 792
 
793 793
 if ($origin != 'learnpath') {
794
-   echo '<div id="highlight-plugin" class="glossary-content">';
794
+    echo '<div id="highlight-plugin" class="glossary-content">';
795 795
 }
796 796
 
797 797
 if ($reminder == 2)  {
@@ -803,53 +803,53 @@  discard block
 block discarded – undo
803 803
     $current_question = 1; //set by default the 1st question
804 804
 
805 805
     if (!empty($my_remind_list)) {
806
-    	//Checking which questions we are going to call from the remind list
807
-		for ($i = 0; $i < count($data_tracking); $i++) {
808
-			for($j = 0; $j < count($my_remind_list); $j++) {
809
-
810
-				if (!empty($remind_question_id)) {
811
-					if ($remind_question_id == $my_remind_list[$j]) {
812
-
813
-			        	if ($remind_question_id == $data_tracking[$i]) {
814
-			        		if (isset($my_remind_list[$j+1])) {
815
-			        			$remind_question_id = $my_remind_list[$j+1];
816
-			        			$current_question = $i + 1;
817
-			        		} else {
806
+        //Checking which questions we are going to call from the remind list
807
+        for ($i = 0; $i < count($data_tracking); $i++) {
808
+            for($j = 0; $j < count($my_remind_list); $j++) {
809
+
810
+                if (!empty($remind_question_id)) {
811
+                    if ($remind_question_id == $my_remind_list[$j]) {
812
+
813
+                        if ($remind_question_id == $data_tracking[$i]) {
814
+                            if (isset($my_remind_list[$j+1])) {
815
+                                $remind_question_id = $my_remind_list[$j+1];
816
+                                $current_question = $i + 1;
817
+                            } else {
818 818
                                 // We end the remind list we go to the exercise_reminder.php please
819
-			        			$remind_question_id = -1;
820
-			        			$current_question = $i + 1; // last question
821
-			        		}
822
-			        		break 2;
823
-			            }
824
-					}
825
-				} else {
826
-					if ($my_remind_list[$j] == $data_tracking[$i]) {
827
-						if (isset($my_remind_list[$j+1])) {
828
-							$remind_question_id = $my_remind_list[$j+1];
829
-							$current_question = $i + 1; // last question
830
-						} else {
819
+                                $remind_question_id = -1;
820
+                                $current_question = $i + 1; // last question
821
+                            }
822
+                            break 2;
823
+                        }
824
+                    }
825
+                } else {
826
+                    if ($my_remind_list[$j] == $data_tracking[$i]) {
827
+                        if (isset($my_remind_list[$j+1])) {
828
+                            $remind_question_id = $my_remind_list[$j+1];
829
+                            $current_question = $i + 1; // last question
830
+                        } else {
831 831
                             // We end the remind list we go to the exercise_reminder.php please
832
-							$remind_question_id = -1;
833
-							$current_question = $i + 1; // last question
834
-						}
835
-						break 2;
836
-					}
837
-				}
838
-			}
832
+                            $remind_question_id = -1;
833
+                            $current_question = $i + 1; // last question
834
+                        }
835
+                        break 2;
836
+                    }
837
+                }
838
+            }
839 839
         }
840 840
     } else {
841
-    	if ($objExercise->review_answers) {
841
+        if ($objExercise->review_answers) {
842 842
             if ($debug) { error_log('. redirecting to exercise_reminder.php '); }
843
-	    	header("Location: exercise_reminder.php?$params");
844
-	    	exit;
845
-    	}
843
+            header("Location: exercise_reminder.php?$params");
844
+            exit;
845
+        }
846 846
     }
847 847
 }
848 848
 
849 849
 if ($objExercise->review_answers) {
850
-	$script_php = 'exercise_reminder.php';
850
+    $script_php = 'exercise_reminder.php';
851 851
 } else {
852
-	$script_php = 'exercise_result.php';
852
+    $script_php = 'exercise_result.php';
853 853
 }
854 854
 
855 855
 if (!empty($error)) {
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
          <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id . '" />
1090 1090
          <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />';
1091 1091
 
1092
-	// Show list of questions
1092
+    // Show list of questions
1093 1093
     $i = 1;
1094 1094
     $attempt_list = array();
1095 1095
     if (isset($exe_id)) {
@@ -1149,10 +1149,10 @@  discard block
 block discarded – undo
1149 1149
 
1150 1150
         $attributes = array('id' =>'remind_list['.$questionId.']');
1151 1151
         if (in_array($questionId, $remind_list)) {
1152
-        	$is_remind_on = true;
1153
-        	$attributes['checked'] = 1;
1154
-        	$remind_question = true;
1155
-        	$remind_highlight = ' remind_highlight ';
1152
+            $is_remind_on = true;
1153
+            $attributes['checked'] = 1;
1154
+            $remind_question = true;
1155
+            $remind_highlight = ' remind_highlight ';
1156 1156
         }
1157 1157
 
1158 1158
         // Showing the exercise description
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
     }
1227 1227
     // end foreach()
1228 1228
     if ($objExercise->type == ALL_ON_ONE_PAGE) {
1229
-    	$exercise_actions =  $objExercise->show_button($questionId, $current_question);
1230
-    	echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1229
+        $exercise_actions =  $objExercise->show_button($questionId, $current_question);
1230
+        echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1231 1231
         echo '<br>';
1232 1232
     }
1233 1233
     echo '</form>';
Please login to merge, or discard this patch.
main/lp/lp_move_item.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 " .
48 48
 "\n" .
49 49
 '$().ready(function() {'."\n" .
50
-  'if ($(\'#previous\')) {'."\n" .
50
+    'if ($(\'#previous\')) {'."\n" .
51 51
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
52
-      'load_cbo($(\'#idParent\').val());'."\n" .
53
-  '}}'."\n" .
52
+        'load_cbo($(\'#idParent\').val());'."\n" .
53
+    '}}'."\n" .
54 54
 '});</script>'."\n" ;
55 55
 
56 56
 /* Constants and variables */
Please login to merge, or discard this patch.
main/lp/lp_ajax_save_item.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@
 block discarded – undo
458 458
     }
459 459
 
460 460
     if ($myLP->get_type() == 2) {
461
-         $return .= "update_stats();";
461
+            $return .= "update_stats();";
462 462
     }
463 463
 
464 464
     // To be sure progress is updated.
Please login to merge, or discard this patch.
main/lp/scorm_api.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -458,8 +458,8 @@
 block discarded – undo
458 458
     } else if(param == 'cmi.core.student_name'){
459 459
         // ---- cmi.core.student_name
460 460
         <?php
461
-          $who = addslashes($user['complete_name']);
462
-          echo "result='$who';";
461
+            $who = addslashes($user['complete_name']);
462
+            echo "result='$who';";
463 463
         ?>
464 464
     } else if(param == 'cmi.core.lesson_location'){
465 465
         // ---- cmi.core.lesson_location
Please login to merge, or discard this patch.
main/lp/content_makers.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
     'Accent',
14 14
     'Accenture',
15 15
     'ADLNet',
16
-      'Articulate',
17
-      'ATutor',
18
-      'Blackboard',
19
-      'Calfat',
20
-      'Captivate',
16
+        'Articulate',
17
+        'ATutor',
18
+        'Blackboard',
19
+        'Calfat',
20
+        'Captivate',
21 21
     'Chamilo',
22 22
     'Chamilo 2',
23 23
     'Claroline',
Please login to merge, or discard this patch.
main/lp/lp_ajax_initialize.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
         $myistring = substr($myistring, 1);
85 85
     }
86 86
 
87
-	// Obtention des donnees d'objectifs
88
-	$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
87
+    // Obtention des donnees d'objectifs
88
+    $mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
89 89
     $course_id = api_get_course_int_id();
90
-	$mylp_iv_id = $mylpi->db_item_view_id;
90
+    $mylp_iv_id = $mylpi->db_item_view_id;
91 91
 
92 92
     $phpobjectives = array();
93 93
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             $phpobjectives[] = $row;
102 102
         }
103 103
     }
104
-	$myobjectives = json_encode($phpobjectives);
104
+    $myobjectives = json_encode($phpobjectives);
105 105
 
106 106
     $return .=
107 107
             "olms.score=".$myscore.";" .
Please login to merge, or discard this patch.
main/lp/aiccItem.class.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 default:
49 49
                      //if($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function
50 50
                      foreach ($params as $a => $value) {
51
-                         switch ($a) {
51
+                            switch ($a) {
52 52
                             case 'system_id':
53 53
                                 $this->identifier = Database::escape_string(strtolower($value));
54 54
                                 break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                             case 'web_launch':
83 83
                                 $this->parameters = Database::escape_string($value);
84 84
                                 break;
85
-                         }
86
-                     }
85
+                            }
86
+                        }
87 87
 
88 88
                     return true;
89 89
             }
Please login to merge, or discard this patch.
main/lp/scormOrganization.class.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
                     //if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
39 39
                     $children = $element->childNodes;
40 40
                     foreach ($children as $child) {
41
-                         switch ($child->nodeType) {
41
+                            switch ($child->nodeType) {
42 42
                             case XML_ELEMENT_NODE:
43 43
                                 switch ($child->tagName) {
44 44
                                     case 'item':
45 45
                                          $oItem = new scormItem('manifest', $child);
46
-                                         if ($oItem->identifier != '') {
46
+                                            if ($oItem->identifier != '') {
47 47
                                             $this->items[$oItem->identifier] = $oItem;
48
-                                         }
48
+                                            }
49 49
                                         break;
50 50
                                     case 'metadata':
51 51
                                         $this->metadata = new scormMetadata('manifest', $child);
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
                                         break;
59 59
                                 }
60 60
                                 break;
61
-                             case XML_TEXT_NODE:
61
+                                case XML_TEXT_NODE:
62 62
                                  break;
63
-                         }
63
+                            }
64 64
                     }
65 65
 
66 66
                     if ($element->hasAttributes()) {
67
-                         $attributes = $element->attributes;
68
-                         //$keep_href = '';
69
-                         foreach ($attributes as $attrib) {
70
-                             switch ($attrib->name) {
71
-                                 case 'identifier':
67
+                            $attributes = $element->attributes;
68
+                            //$keep_href = '';
69
+                            foreach ($attributes as $attrib) {
70
+                                switch ($attrib->name) {
71
+                                    case 'identifier':
72 72
                                      $this->identifier = $attrib->value;
73
-                                     break;
74
-                                 case 'structure':
73
+                                        break;
74
+                                    case 'structure':
75 75
                                      $this->structure = $attrib->value;
76
-                                     break;
77
-                             }
78
-                         }
76
+                                        break;
77
+                                }
78
+                            }
79 79
                     }
80 80
 
81 81
                     return true;
Please login to merge, or discard this patch.
main/lp/aicc.class.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
         }
321 321
     }
322 322
 
323
-     /**
324
-     * Intermediate to import_package only to allow import from local zip files
325
-     * @param	string	Path to the zip file, from the dokeos sys root
326
-     * @param	string	Current path (optional)
327
-     * @return string	Absolute path to the AICC description files or empty string on error
328
-     */
323
+        /**
324
+         * Intermediate to import_package only to allow import from local zip files
325
+         * @param	string	Path to the zip file, from the dokeos sys root
326
+         * @param	string	Current path (optional)
327
+         * @return string	Absolute path to the AICC description files or empty string on error
328
+         */
329 329
     function import_local_package($file_path, $current_dir = '')
330 330
     {
331 331
         // TODO: Prepare info as given by the $_FILES[''] vector.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
357 357
 
358
-         //$uploaded_filename = $_FILES['userFile']['name'];
358
+            //$uploaded_filename = $_FILES['userFile']['name'];
359 359
         // Get the name of the zip file without the extension.
360 360
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); }
361 361
         $file_info = pathinfo($zip_file_name);
Please login to merge, or discard this patch.