Completed
Push — master ( 27d75c...8dedcf )
by Angel Fernando Quiroz
60:16 queued 06:22
created
main/inc/lib/formvalidator/Element/DatePicker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
         return '
48 48
             <div class="input-group">
49 49
                 <span class="input-group-addon">
50
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
50
+                    <input ' . $this->_getAttrString($this->_attributes).'>
51 51
                 </span>
52
-                <input class="form-control" type="text" disabled id="' . $id . '_alt" value="' . $value . '">
52
+                <input class="form-control" type="text" disabled id="' . $id.'_alt" value="'.$value.'">
53 53
                 <span class="input-group-btn">
54 54
                     <button class="btn btn-default" type="button">
55 55
                         <span class="fa fa-times text-danger" aria-hidden="true"></span>
56
-                        <span class="sr-only">' . get_lang('Reset') . '</span>
56
+                        <span class="sr-only">' . get_lang('Reset').'</span>
57 57
                     </button>
58 58
                 </span>
59 59
             </div>
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
                 txtDate
91 91
                     .hide()
92 92
                     .datepicker({
93
-                        defaultDate: '" . $this->getValue() . "',
93
+                        defaultDate: '".$this->getValue()."',
94 94
                         dateFormat: 'yy-mm-dd',
95 95
                         altField: '#{$id}_alt',
96
-                        altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
96
+                        altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
97 97
                         showOn: 'both',
98
-                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
98
+                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
99 99
                         buttonImageOnly: true,
100
-                        buttonText: '" . get_lang('SelectDate') . "',
100
+                        buttonText: '" . get_lang('SelectDate')."',
101 101
                         changeMonth: true,
102 102
                         changeYear: true,
103 103
                         yearRange: 'c-60y:c+5y'
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/DateTimePicker.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
         return '
41 41
             <div class="input-group">
42 42
                 <span class="input-group-addon">
43
-                    <input ' . $this->_getAttrString($this->_attributes) . '>
43
+                    <input ' . $this->_getAttrString($this->_attributes).'>
44 44
                 </span>
45
-                <input class="form-control" type="text" disabled id="' . $id . '_alt" value="' . $value . '">
45
+                <input class="form-control" type="text" disabled id="' . $id.'_alt" value="'.$value.'">
46 46
                 <span class="input-group-btn">
47 47
                     <button class="btn btn-default" type="button">
48 48
                         <span class="fa fa-times text-danger" aria-hidden="true"></span>
49
-                        <span class="sr-only">' . get_lang('Reset') . '</span>
49
+                        <span class="sr-only">' . get_lang('Reset').'</span>
50 50
                     </button>
51 51
                 </span>
52 52
             </div>
@@ -83,18 +83,18 @@  discard block
 block discarded – undo
83 83
                 txtDateTime
84 84
                     .hide()
85 85
                     .datetimepicker({
86
-                        defaultDate: '" . $this->getValue() . "',
86
+                        defaultDate: '".$this->getValue()."',
87 87
                         dateFormat: 'yy-mm-dd',
88 88
                         timeFormat: 'HH:mm',
89 89
                         altField: '#{$id}_alt',
90
-                        altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
91
-                        altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",
92
-                        altSeparator: \" " . get_lang('AtTime') . " \",
90
+                        altFormat: \"".get_lang('DateFormatLongNoDayJS')."\",
91
+                        altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\",
92
+                        altSeparator: \" " . get_lang('AtTime')." \",
93 93
                         altFieldTimeOnly: false,
94 94
                         showOn: 'both',
95
-                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
95
+                        buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."',
96 96
                         buttonImageOnly: true,
97
-                        buttonText: '" . get_lang('SelectDate') . "',
97
+                        buttonText: '" . get_lang('SelectDate')."',
98 98
                         changeMonth: true,
99 99
                         changeYear: true
100 100
                     });
Please login to merge, or discard this patch.
main/exercise/exercise_submit.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 */
30 30
 
31 31
 require_once __DIR__.'/../inc/global.inc.php';
32
-$current_course_tool  = TOOL_QUIZ;
32
+$current_course_tool = TOOL_QUIZ;
33 33
 $this_section = SECTION_COURSES;
34 34
 $debug = false;
35 35
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 $origin = isset($_REQUEST['origin']) ? Security::remove_XSS($_REQUEST['origin']) : '';
40 40
 
41
-$is_allowedToEdit = api_is_allowed_to_edit(null,true);
41
+$is_allowedToEdit = api_is_allowed_to_edit(null, true);
42 42
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
43 43
 
44 44
 $showGlossary = in_array($glossaryExtraTools, array('true', 'exercise', 'exercise_and_lp'));
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
61 61
 $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
62 62
 $htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
63
-$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">';
64
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>';
63
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">';
64
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>';
65 65
 
66 66
 if (api_get_setting('enable_record_audio') === 'true') {
67
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>';
68
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>';
69
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>';
70
-    $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>';
67
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
68
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
69
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
70
+    $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
71 71
 }
72 72
 
73 73
 $template = new Template();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 $learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0;
78 78
 $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0;
79
-$learnpath_item_view_id	= isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0;
79
+$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0;
80 80
 
81 81
 $reminder = isset($_REQUEST['reminder']) ? intval($_REQUEST['reminder']) : 0;
82 82
 $remind_question_id = isset($_REQUEST['remind_question_id']) ? intval($_REQUEST['remind_question_id']) : 0;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 /*  Teacher takes an exam and want to see a preview,
104 104
     we delete the objExercise from the session in order to get the latest
105 105
     changes in the exercise */
106
-if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1 ) {
106
+if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1) {
107 107
     Session::erase('objExercise');
108 108
 }
109 109
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 if ($time_control) {
176 176
 	// Get the expired time of the current exercise in track_e_exercises
177
-	$total_seconds = $objExercise->expired_time*60;
177
+	$total_seconds = $objExercise->expired_time * 60;
178 178
 }
179 179
 
180 180
 $show_clock = true;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 	if ($attempt_count >= $objExercise->selectAttempts()) {
193 193
 		$show_clock = false;
194
-		if (!api_is_allowed_to_edit(null,true)) {
194
+		if (!api_is_allowed_to_edit(null, true)) {
195 195
             if ($objExercise->results_disabled == 0 && $origin != 'learnpath') {
196 196
 
197 197
                 // Showing latest attempt according with task BT#1628
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     );
222 222
 
223 223
                     if (!empty($last_attempt_info['question_list'])) {
224
-                        foreach($last_attempt_info['question_list'] as $questions) {
224
+                        foreach ($last_attempt_info['question_list'] as $questions) {
225 225
                             foreach ($questions as $question_data) {
226 226
                                 $question_id = $question_data['question_id'];
227 227
                                 $marks       = $question_data['marks'];
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                             }
233 233
                         }
234 234
                     }
235
-					$score =  ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
235
+					$score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']);
236 236
 					$attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score'));
237 237
 				} else {
238 238
 					$attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false);
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 		if ($debug)  error_log('5.1. $current_timestamp '.$current_timestamp);
294 294
 		if ($debug)  error_log('5.2. $expected_time '.$expected_time);
295 295
 
296
-		$clock_expired_time 	= api_get_utc_datetime($expected_time);
296
+		$clock_expired_time = api_get_utc_datetime($expected_time);
297 297
 		if ($debug) error_log('5.3. $expected_time '.$clock_expired_time);
298 298
 
299 299
 		//Sessions  that contain the expired time
300
-		$_SESSION['expired_time'][$current_expired_time_key] 	 = $clock_expired_time;
301
-		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
300
+		$_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
301
+		if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); };
302 302
 	}
303 303
 
304 304
     $exe_id = $objExercise->save_stat_track_exercise_info(
@@ -412,22 +412,22 @@  discard block
 block discarded – undo
412 412
 	    	   the track_et_attempt see #2069 */
413 413
 	    	if (empty($last_attempt_date)) {
414 414
 	    		$diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC');
415
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff);
415
+	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'], 'UTC') + $diff);
416 416
 	    	} else {
417 417
 	    		//Recalculate the time control due #2069
418
-	    		$diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC');
419
-	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff);
418
+	    		$diff = $current_timestamp - api_strtotime($last_attempt_date, 'UTC');
419
+	    		$last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date, 'UTC') + $diff);
420 420
 	    	}
421 421
 	        if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); }
422 422
 
423 423
 	        //New expired time - it is due to the possible closure of session
424
-	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC');
424
+	        $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date, 'UTC');
425 425
 	        if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); }
426 426
 
427
-	        $expected_time	= $current_timestamp + $new_expired_time_in_seconds;
427
+	        $expected_time = $current_timestamp + $new_expired_time_in_seconds;
428 428
 	        if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); }
429 429
 
430
-	        $clock_expired_time  = api_get_utc_datetime($expected_time);
430
+	        $clock_expired_time = api_get_utc_datetime($expected_time);
431 431
 	        if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); }
432 432
 
433 433
 			// First we update the attempt to today
@@ -443,17 +443,17 @@  discard block
 block discarded – undo
443 443
 
444 444
 	        //Sessions  that contain the expired time
445 445
 	        $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time;
446
-	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); };
446
+	        if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); };
447 447
         }
448 448
     } else {
449
-        $clock_expired_time =  $_SESSION['expired_time'][$current_expired_time_key];
449
+        $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key];
450 450
     }
451 451
 } else {
452 452
     if ($debug) { error_log("7 No time control"); };
453 453
 }
454 454
 
455 455
 // Get time left for expiring time
456
-$time_left = api_strtotime($clock_expired_time,'UTC') - time();
456
+$time_left = api_strtotime($clock_expired_time, 'UTC') - time();
457 457
 
458 458
 /*
459 459
  * The time control feature is enable here - this feature is enable for a jquery plugin called epiclock
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 
507 507
     //Only for hotspot
508 508
     if (!isset($choice) && isset($_REQUEST['hidden_hotspot_id'])) {
509
-        $hotspot_id = (int)($_REQUEST['hidden_hotspot_id']);
509
+        $hotspot_id = (int) ($_REQUEST['hidden_hotspot_id']);
510 510
         $choice     = array($hotspot_id => '');
511 511
     }
512 512
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
                     if (isset($exe_id)) {
541 541
                     	// Manage the question and answer attempts
542 542
                         if ($debug) {
543
-                            error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1));
543
+                            error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice, 1));
544 544
                         }
545 545
                         $objExercise->manage_answer(
546 546
                             $exe_id,
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
             }
561 561
         }
562 562
         if ($debug) { error_log('9.3.  $choice is an array - end'); }
563
-        if ($debug) { error_log('9.4.  $exerciseResult '.print_r($exerciseResult,1)); }
563
+        if ($debug) { error_log('9.4.  $exerciseResult '.print_r($exerciseResult, 1)); }
564 564
     }
565 565
 
566 566
     // the script "exercise_result.php" will take the variable $exerciseResult from the session
567 567
     Session::write('exerciseResult', $exerciseResult);
568 568
     Session::write('remind_list', $remind_list);
569
-    Session::write('exerciseResultCoordinates',$exerciseResultCoordinates);
569
+    Session::write('exerciseResultCoordinates', $exerciseResultCoordinates);
570 570
 
571 571
     // if all questions on one page OR if it is the last question (only for an exercise with one question per page)
572 572
     if ($objExercise->type == ALL_ON_ONE_PAGE || $current_question >= $question_count) {
@@ -692,15 +692,15 @@  discard block
 block discarded – undo
692 692
 }
693 693
 
694 694
 if (!empty ($gradebook) && $gradebook == 'view') {
695
-    $interbreadcrumb[] = array ('url' => '../gradebook/' . Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
695
+    $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
696 696
 }
697 697
 
698
-$interbreadcrumb[] = array ("url" => "exercise.php?".api_get_cidreq(),	"name" => get_lang('Exercises'));
699
-$interbreadcrumb[] = array ("url" => "#", "name" => $objExercise->name);
698
+$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises'));
699
+$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name);
700 700
 
701 701
 if ($origin != 'learnpath') { //so we are not in learnpath tool
702
-    Display :: display_header(null,'Exercises');
703
-    if (!api_is_allowed_to_session_edit() ) {
702
+    Display :: display_header(null, 'Exercises');
703
+    if (!api_is_allowed_to_session_edit()) {
704 704
         Display :: display_warning_message(get_lang('SessionIsReadOnly'));
705 705
     }
706 706
 } else {
@@ -719,9 +719,9 @@  discard block
 block discarded – undo
719 719
 if (api_is_course_admin() && $origin != 'learnpath') {
720 720
     echo '<div class="actions">';
721 721
     if ($show_quiz_edition == false) {
722
-    	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>';
722
+    	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>';
723 723
     } else {
724
-    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>';
724
+    	echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>';
725 725
     }
726 726
     echo '</div>';
727 727
 }
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
     }
761 761
 
762 762
     if (!$permission_to_start || $exercise_timeover) {
763
-        if (!api_is_allowed_to_edit(null,true)) {
763
+        if (!api_is_allowed_to_edit(null, true)) {
764 764
             $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet');
765 765
             Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts()));
766 766
             if ($origin != 'learnpath') {
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
    echo '<div id="highlight-plugin" class="glossary-content">';
804 804
 }
805 805
 
806
-if ($reminder == 2)  {
806
+if ($reminder == 2) {
807 807
     if ($debug) { error_log(' $reminder == 2'); }
808 808
 
809 809
     $data_tracking  = $exercise_stat_info['data_tracking'];
@@ -814,14 +814,14 @@  discard block
 block discarded – undo
814 814
     if (!empty($my_remind_list)) {
815 815
     	//Checking which questions we are going to call from the remind list
816 816
 		for ($i = 0; $i < count($data_tracking); $i++) {
817
-			for($j = 0; $j < count($my_remind_list); $j++) {
817
+			for ($j = 0; $j < count($my_remind_list); $j++) {
818 818
 
819 819
 				if (!empty($remind_question_id)) {
820 820
 					if ($remind_question_id == $my_remind_list[$j]) {
821 821
 
822 822
 			        	if ($remind_question_id == $data_tracking[$i]) {
823
-			        		if (isset($my_remind_list[$j+1])) {
824
-			        			$remind_question_id = $my_remind_list[$j+1];
823
+			        		if (isset($my_remind_list[$j + 1])) {
824
+			        			$remind_question_id = $my_remind_list[$j + 1];
825 825
 			        			$current_question = $i + 1;
826 826
 			        		} else {
827 827
                                 // We end the remind list we go to the exercise_reminder.php please
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 					}
834 834
 				} else {
835 835
 					if ($my_remind_list[$j] == $data_tracking[$i]) {
836
-						if (isset($my_remind_list[$j+1])) {
837
-							$remind_question_id = $my_remind_list[$j+1];
836
+						if (isset($my_remind_list[$j + 1])) {
837
+							$remind_question_id = $my_remind_list[$j + 1];
838 838
 							$current_question = $i + 1; // last question
839 839
 						} else {
840 840
                             // We end the remind list we go to the exercise_reminder.php please
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
     Display :: display_error_message($error, false);
866 866
 } else {
867 867
     if (!empty ($exercise_sound)) {
868
-        echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F" . Security::remove_XSS($exercise_sound) . "\" target=\"_blank\">", "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound') . "\" /></a>";
868
+        echo "<a href=\"../document/download.php?doc_url=%2Faudio%2F".Security::remove_XSS($exercise_sound)."\" target=\"_blank\">", "<img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=", get_lang('Sound')."\" /></a>";
869 869
     }
870 870
     // Get number of hotspot questions for javascript validation
871 871
     $number_of_hotspot_questions = 0;
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
     }
897 897
 
898 898
     if ($number_of_hotspot_questions > 0) {
899
-        $onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\"";
899
+        $onsubmit = "onsubmit=\"return validateFlashVar('".$number_of_hotspot_questions."', '".get_lang('HotspotValidateError1')."', '".get_lang('HotspotValidateError2')."');\"";
900 900
     }
901 901
 
902 902
     echo '<script>
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
                 ICON_SIZE_SMALL,
911 911
                 false,
912 912
                 true
913
-            ) . '\';
913
+            ).'\';
914 914
 
915 915
             // Block form submition on enter
916 916
             $(".block_on_enter").keypress(function(event) {
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
             } else {
963 963
                 url = "exercise_submit.php?'.$params.'&num='.$current_question.'&remind_question_id='.$remind_question_id.'";
964 964
             }
965
-            //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
965
+            //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
966 966
             window.location = url;
967 967
         }
968 968
 
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
             // Only for the first time
996 996
 
997
-            $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin') . '\');
997
+            $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\');
998 998
             $.ajax({
999 999
                 type:"post",
1000 1000
                 async: false,
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
                 data: "'.$params.'&type=simple&question_id="+question_id+"&"+my_choice+"&"+hotspot+"&"+remind_list,
1003 1003
                 success: function(return_value) {
1004 1004
                     if (return_value == "ok") {
1005
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
1005
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
1006 1006
                     } else if (return_value == "error") {
1007
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\');
1007
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\');
1008 1008
                     } else if (return_value == "one_per_page") {
1009 1009
                         var url = "";
1010 1010
                         if ('.$reminder.' == 1 ) {
@@ -1019,13 +1019,13 @@  discard block
 block discarded – undo
1019 1019
                             url = url_extra;
1020 1020
                         }
1021 1021
 
1022
-                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\');
1022
+                        $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\');
1023 1023
 
1024 1024
                         window.location = url;
1025 1025
                     }
1026 1026
                 },
1027 1027
                 error: function() {
1028
-                    $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\');
1028
+                    $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\');
1029 1029
                 }
1030 1030
             });
1031 1031
             return false;
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
             free_answers = $.param(free_answers);
1060 1060
 
1061
-            $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin') . '\');
1061
+            $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', null, true, 'fa-spin').'\');
1062 1062
 
1063 1063
             $.ajax({
1064 1064
                 type:"post",
@@ -1067,14 +1067,14 @@  discard block
 block discarded – undo
1067 1067
                 data: "'.$params.'&type=all&"+my_choice+"&"+hotspot+"&"+free_answers+"&"+remind_list,
1068 1068
                 success: function(return_value) {
1069 1069
                     if (return_value == "ok") {
1070
-                        //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\');
1070
+                        //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\');
1071 1071
                         if (validate == "validate") {
1072 1072
                             window.location = "'.$script_php.'?'.$params.'";
1073 1073
                         } else {
1074
-                            $("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\');
1074
+                            $("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\');
1075 1075
                         }
1076 1076
                     } else {
1077
-                        $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif') . '\');
1077
+                        $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif').'\');
1078 1078
                     }
1079 1079
                 }
1080 1080
             });
@@ -1087,16 +1087,16 @@  discard block
 block discarded – undo
1087 1087
         }
1088 1088
     </script>';
1089 1089
 
1090
-    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId .'" name="frm_exercise" '.$onsubmit.'>
1090
+    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId.'" name="frm_exercise" '.$onsubmit.'>
1091 1091
          <input type="hidden" name="formSent"				value="1" />
1092
-         <input type="hidden" name="exerciseId" 			value="'.$exerciseId . '" />
1092
+         <input type="hidden" name="exerciseId" 			value="'.$exerciseId.'" />
1093 1093
          <input type="hidden" name="num" 					value="'.$current_question.'" id="num_current_id" />
1094 1094
          <input type="hidden" name="num_answer"             value="'.$currentAnswer.'" id="num_current_answer_id" />
1095
-         <input type="hidden" name="exe_id" 				value="'.$exe_id . '" />
1096
-         <input type="hidden" name="origin" 				value="'.$origin . '" />
1097
-         <input type="hidden" name="learnpath_id" 			value="'.$learnpath_id . '" />
1098
-         <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id . '" />
1099
-         <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />';
1095
+         <input type="hidden" name="exe_id" 				value="'.$exe_id.'" />
1096
+         <input type="hidden" name="origin" 				value="'.$origin.'" />
1097
+         <input type="hidden" name="learnpath_id" 			value="'.$learnpath_id.'" />
1098
+         <input type="hidden" name="learnpath_item_id" 		value="'.$learnpath_item_id.'" />
1099
+         <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />';
1100 1100
 
1101 1101
 	// Show list of questions
1102 1102
     $i = 1;
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
         $attempt_list = Event::getAllExerciseEventByExeId($exe_id);
1106 1106
     }
1107 1107
 
1108
-    $remind_list  = array();
1108
+    $remind_list = array();
1109 1109
     if (isset($exercise_stat_info['questions_to_check']) && !empty($exercise_stat_info['questions_to_check'])) {
1110 1110
         $remind_list = explode(',', $exercise_stat_info['questions_to_check']);
1111 1111
     }
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
             $remind_highlight = 'no_remind_highlight';
1154 1154
         }
1155 1155
 
1156
-        $exercise_actions  = '';
1156
+        $exercise_actions = '';
1157 1157
         $is_remind_on = false;
1158 1158
 
1159 1159
         $attributes = array('id' =>'remind_list['.$questionId.']');
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
         }
1166 1166
 
1167 1167
         // Showing the exercise description
1168
-        if (!empty($objExercise->description)){
1169
-            if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i==1)) {
1168
+        if (!empty($objExercise->description)) {
1169
+            if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i == 1)) {
1170 1170
                 echo Display::panelCollapse('<span>'.
1171 1171
                     get_lang('ExerciseDescriptionLabel').'</span>',
1172 1172
                     $objExercise->description,
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
             case ALL_ON_ONE_PAGE :
1203 1203
                 $button  = '<a href="javascript://" class="btn btn-info" onclick="save_now(\''.$questionId.'\'); ">'.get_lang('SaveForNow').'</a>';
1204 1204
                 $button .= '<span id="save_for_now_'.$questionId.'"></span>&nbsp;';
1205
-                $exercise_actions  .= Display::div($button, array('class'=>'exercise_save_now_button'));
1205
+                $exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button'));
1206 1206
                 break;
1207 1207
         }
1208 1208
 
@@ -1212,13 +1212,13 @@  discard block
 block discarded – undo
1212 1212
                 'label',
1213 1213
                 Display::input(
1214 1214
                     'checkbox',
1215
-                    'remind_list[' . $questionId . ']',
1215
+                    'remind_list['.$questionId.']',
1216 1216
                     '',
1217 1217
                     $attributes
1218
-                ) . get_lang('ReviewQuestionLater'),
1218
+                ).get_lang('ReviewQuestionLater'),
1219 1219
                 array(
1220 1220
                     'class' => 'checkbox',
1221
-                    'for' => 'remind_list[' . $questionId . ']'
1221
+                    'for' => 'remind_list['.$questionId.']'
1222 1222
                 )
1223 1223
             );
1224 1224
             $exercise_actions .= Display::div($remind_question_div, array('class'=>'exercise_save_now_button'));
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
     }
1236 1236
     // end foreach()
1237 1237
     if ($objExercise->type == ALL_ON_ONE_PAGE) {
1238
-    	$exercise_actions =  $objExercise->show_button($questionId, $current_question);
1238
+    	$exercise_actions = $objExercise->show_button($questionId, $current_question);
1239 1239
     	echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
1240 1240
         echo '<br>';
1241 1241
     }
Please login to merge, or discard this patch.