@@ -98,10 +98,10 @@ |
||
98 | 98 | }*/ |
99 | 99 | } |
100 | 100 | |
101 | - // This is a good answer, count + 1 for nmbr of clicks |
|
102 | - if ($answers['weighting'][$i] > 0) { |
|
103 | - $nmbrTries++; |
|
104 | - } |
|
101 | + // This is a good answer, count + 1 for nmbr of clicks |
|
102 | + if ($answers['weighting'][$i] > 0) { |
|
103 | + $nmbrTries++; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | $hotSpot['coord'] = $answers['hotspot_coordinates'][$i]; |
107 | 107 | $data['hotspots'][] = $hotSpot; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | api_protect_course_script(false); |
12 | 12 | |
13 | -$isAllowedToEdit = api_is_allowed_to_edit(null,true); |
|
13 | +$isAllowedToEdit = api_is_allowed_to_edit(null, true); |
|
14 | 14 | |
15 | 15 | if (!$isAllowedToEdit) { |
16 | 16 | api_not_allowed(true); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $objQuestion = Question::read($questionId); |
23 | 23 | $_course = api_get_course_info(); |
24 | 24 | |
25 | -$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
25 | +$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
26 | 26 | |
27 | 27 | $picturePath = $documentPath.'/images'; |
28 | 28 | $pictureName = $objQuestion->selectPicture(); |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | $answers = $_SESSION['tmp_answers']; |
66 | 66 | $nbrAnswers = count($answers['answer']); |
67 | 67 | |
68 | -for ($i=1;$i <= $nbrAnswers; $i++) { |
|
68 | +for ($i = 1; $i <= $nbrAnswers; $i++) { |
|
69 | 69 | $hotSpot = []; |
70 | 70 | $hotSpot['id'] = null; |
71 | - $hotSpot['answer']= $answers['answer'][$i]; |
|
71 | + $hotSpot['answer'] = $answers['answer'][$i]; |
|
72 | 72 | |
73 | 73 | if ($answer_type == HOT_SPOT_DELINEATION) { |
74 | - if ($i==1) { |
|
74 | + if ($i == 1) { |
|
75 | 75 | $hotSpot['type'] = 'delineation'; |
76 | 76 | } else { |
77 | 77 | $hotSpot['type'] = 'oar'; |
@@ -7,4 +7,4 @@ |
||
7 | 7 | // directly to exercise.php. This redirection is enabled for 1.10.x (2015-04-21) |
8 | 8 | // The final goal of this file is to be removed in a few years time, if |
9 | 9 | // considered realistically not harmful |
10 | -require __DIR__ . '/exercise.php'; |
|
10 | +require __DIR__.'/exercise.php'; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id |
18 | 18 | |
19 | 19 | if ($origin == 'learnpath') { |
20 | - $show_headers = false; |
|
20 | + $show_headers = false; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | api_protect_course_script($show_headers); |
24 | 24 | |
25 | 25 | if (empty($id)) { |
26 | - api_not_allowed($show_headers); |
|
26 | + api_not_allowed($show_headers); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // Only users can see their own results |
50 | 50 | if (!$is_allowedToEdit) { |
51 | 51 | if ($student_id != $current_user_id) { |
52 | - api_not_allowed($show_headers); |
|
52 | + api_not_allowed($show_headers); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | "name" => get_lang('Exercises'), |
63 | 63 | ); |
64 | 64 | $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
65 | - $this_section = SECTION_COURSES; |
|
66 | - Display::display_header(); |
|
65 | + $this_section = SECTION_COURSES; |
|
66 | + Display::display_header(); |
|
67 | 67 | } else { |
68 | 68 | $htmlHeadXtra[] = " |
69 | 69 | <style> |
70 | 70 | body { background: none;} |
71 | 71 | </style> |
72 | 72 | "; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | ExerciseLib::display_question_list_by_attempt($objExercise, $id, false); |
77 | 77 | |
78 | 78 | if ($show_headers) { |
79 | - Display::display_footer(); |
|
79 | + Display::display_footer(); |
|
80 | 80 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | api_not_allowed($show_headers); |
27 | 27 | } |
28 | 28 | |
29 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
|
29 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor; |
|
30 | 30 | |
31 | 31 | //Getting results from the exe_id. This variable also contain all the information about the exercise |
32 | 32 | $track_exercise_info = ExerciseLib::get_exercise_track_exercise_info($id); |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
57 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
56 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
57 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
58 | 58 | |
59 | 59 | if ($show_headers) { |
60 | 60 | $interbreadcrumb[] = array( |
@@ -7,7 +7,7 @@ |
||
7 | 7 | get_lang('MultiplicationStar')."\n". |
8 | 8 | get_lang('DivisionSlash')."\n". |
9 | 9 | get_lang('ExponentiationCircumflex')."\n". |
10 | -get_lang('ModuloPercentage') . "\n" . |
|
10 | +get_lang('ModuloPercentage')."\n". |
|
11 | 11 | "\n". |
12 | 12 | get_lang('SquareRootSqrt')."\n". |
13 | 13 | get_lang('AbsoluteValueAbs')."\n". |
@@ -239,8 +239,9 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | echo $attempt_html; |
242 | - if ($origin != 'learnpath') |
|
243 | - Display :: display_footer(); |
|
242 | + if ($origin != 'learnpath') { |
|
243 | + Display :: display_footer(); |
|
244 | + } |
|
244 | 245 | exit; |
245 | 246 | } |
246 | 247 | } |
@@ -260,7 +261,9 @@ discard block |
||
260 | 261 | $clock_expired_time = null; |
261 | 262 | |
262 | 263 | if (empty($exercise_stat_info)) { |
263 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
264 | + if ($debug) { |
|
265 | + error_log('5 $exercise_stat_info is empty '); |
|
266 | + } |
|
264 | 267 | $total_weight = 0; |
265 | 268 | $questionList = $objExercise->get_validated_question_list(); |
266 | 269 | foreach ($questionList as $question_id) { |
@@ -271,11 +274,17 @@ discard block |
||
271 | 274 | if ($time_control) { |
272 | 275 | $expected_time = $current_timestamp + $total_seconds; |
273 | 276 | |
274 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
275 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
277 | + if ($debug) { |
|
278 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
279 | + } |
|
280 | + if ($debug) { |
|
281 | + error_log('5.2. $expected_time '.$expected_time); |
|
282 | + } |
|
276 | 283 | |
277 | 284 | $clock_expired_time = api_get_utc_datetime($expected_time); |
278 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
285 | + if ($debug) { |
|
286 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
287 | + } |
|
279 | 288 | |
280 | 289 | //Sessions that contain the expired time |
281 | 290 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -295,8 +304,10 @@ discard block |
||
295 | 304 | $learnpath_item_id, |
296 | 305 | $learnpath_item_view_id |
297 | 306 | ); |
298 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
299 | -} else { |
|
307 | + if ($debug) { |
|
308 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
309 | + } |
|
310 | + } else { |
|
300 | 311 | $exe_id = $exercise_stat_info['exe_id']; |
301 | 312 | // Remember last question id position. |
302 | 313 | $isFirstTime = Session::read('firstTime'); |
@@ -318,8 +329,10 @@ discard block |
||
318 | 329 | } |
319 | 330 | } |
320 | 331 | |
321 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
322 | -} |
|
332 | + if ($debug) { |
|
333 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
334 | + } |
|
335 | + } |
|
323 | 336 | |
324 | 337 | // Array to check in order to block the chat |
325 | 338 | ExerciseLib::create_chat_exercise_session($exe_id); |
@@ -346,9 +359,15 @@ discard block |
||
346 | 359 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
347 | 360 | */ |
348 | 361 | if ($time_control) { |
349 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
350 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
351 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
362 | + if ($debug) { |
|
363 | + error_log('7.1. Time control is enabled'); |
|
364 | + } |
|
365 | + if ($debug) { |
|
366 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
367 | + } |
|
368 | + if ($debug) { |
|
369 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
370 | + } |
|
352 | 371 | |
353 | 372 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
354 | 373 | //Timer - Get expired_time for a student |
@@ -436,7 +455,9 @@ discard block |
||
436 | 455 | } |
437 | 456 | } |
438 | 457 | |
439 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
458 | +if ($debug) { |
|
459 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
460 | +} |
|
440 | 461 | |
441 | 462 | //Real question count |
442 | 463 | $question_count = 0; |
@@ -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 { |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | |
131 | 131 | //2. Checking if $objExercise is set |
132 | 132 | if (!isset($objExercise) && isset($exerciseInSession)) { |
133 | - if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
133 | + if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
134 | 134 | $objExercise = $exerciseInSession; |
135 | 135 | } |
136 | 136 | |
137 | 137 | //3. $objExercise is not set, then return to the exercise list |
138 | 138 | if (!is_object($objExercise)) { |
139 | - if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
139 | + if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
140 | 140 | header('Location: exercise.php'); |
141 | 141 | exit; |
142 | 142 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $time_control = false; |
159 | 159 | if ($objExercise->expired_time != 0) { |
160 | - $time_control = true; |
|
160 | + $time_control = true; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // Generating the time control key for the user |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp; |
167 | 167 | |
168 | 168 | if ($time_control) { |
169 | - // Get the expired time of the current exercise in track_e_exercises |
|
170 | - $total_seconds = $objExercise->expired_time*60; |
|
169 | + // Get the expired time of the current exercise in track_e_exercises |
|
170 | + $total_seconds = $objExercise->expired_time*60; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $show_clock = true; |
174 | 174 | $user_id = api_get_user_id(); |
175 | 175 | if ($objExercise->selectAttempts() > 0) { |
176 | - $attempt_html = ''; |
|
176 | + $attempt_html = ''; |
|
177 | 177 | $attempt_count = Event::get_attempt_count( |
178 | 178 | $user_id, |
179 | 179 | $exerciseId, |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | $learnpath_item_view_id |
183 | 183 | ); |
184 | 184 | |
185 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
186 | - $show_clock = false; |
|
187 | - if (!api_is_allowed_to_edit(null,true)) { |
|
185 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
186 | + $show_clock = false; |
|
187 | + if (!api_is_allowed_to_edit(null,true)) { |
|
188 | 188 | if ($objExercise->results_disabled == 0 && $origin != 'learnpath') { |
189 | 189 | |
190 | 190 | // Showing latest attempt according with task BT#1628 |
@@ -223,29 +223,29 @@ discard block |
||
223 | 223 | $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore')); |
224 | 224 | } |
225 | 225 | } |
226 | - $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
227 | - $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
228 | - } else { |
|
229 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
230 | - } |
|
231 | - } else { |
|
232 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
233 | - } |
|
234 | - } else { |
|
235 | - $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
236 | - } |
|
226 | + $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
227 | + $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
228 | + } else { |
|
229 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
230 | + } |
|
231 | + } else { |
|
232 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
233 | + } |
|
234 | + } else { |
|
235 | + $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
236 | + } |
|
237 | 237 | |
238 | - if ($origin == 'learnpath') { |
|
239 | - Display :: display_reduced_header(); |
|
240 | - } else { |
|
241 | - Display :: display_header($nameTools,'Exercises'); |
|
242 | - } |
|
238 | + if ($origin == 'learnpath') { |
|
239 | + Display :: display_reduced_header(); |
|
240 | + } else { |
|
241 | + Display :: display_header($nameTools,'Exercises'); |
|
242 | + } |
|
243 | 243 | |
244 | - echo $attempt_html; |
|
245 | - if ($origin != 'learnpath') |
|
246 | - Display :: display_footer(); |
|
247 | - exit; |
|
248 | - } |
|
244 | + echo $attempt_html; |
|
245 | + if ($origin != 'learnpath') |
|
246 | + Display :: display_footer(); |
|
247 | + exit; |
|
248 | + } |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | if ($debug) { |
@@ -296,26 +296,26 @@ discard block |
||
296 | 296 | |
297 | 297 | if (empty($exercise_stat_info)) { |
298 | 298 | if ($debug) error_log('5 $exercise_stat_info is empty '); |
299 | - $total_weight = 0; |
|
300 | - $questionList = $objExercise->get_validated_question_list(); |
|
301 | - foreach ($questionListUncompressed as $question_id) { |
|
302 | - $objQuestionTmp = Question::read($question_id); |
|
303 | - $total_weight += floatval($objQuestionTmp->weighting); |
|
304 | - } |
|
299 | + $total_weight = 0; |
|
300 | + $questionList = $objExercise->get_validated_question_list(); |
|
301 | + foreach ($questionListUncompressed as $question_id) { |
|
302 | + $objQuestionTmp = Question::read($question_id); |
|
303 | + $total_weight += floatval($objQuestionTmp->weighting); |
|
304 | + } |
|
305 | 305 | |
306 | - if ($time_control) { |
|
307 | - $expected_time = $current_timestamp + $total_seconds; |
|
306 | + if ($time_control) { |
|
307 | + $expected_time = $current_timestamp + $total_seconds; |
|
308 | 308 | |
309 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
310 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
309 | + if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
310 | + if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
311 | 311 | |
312 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
313 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
312 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
313 | + if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
314 | 314 | |
315 | - //Sessions that contain the expired time |
|
316 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
317 | - if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
318 | - } |
|
315 | + //Sessions that contain the expired time |
|
316 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
317 | + if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
318 | + } |
|
319 | 319 | |
320 | 320 | $exe_id = $objExercise->save_stat_track_exercise_info( |
321 | 321 | $clock_expired_time, |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | ); |
333 | 333 | if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
334 | 334 | } else { |
335 | - $exe_id = $exercise_stat_info['exe_id']; |
|
335 | + $exe_id = $exercise_stat_info['exe_id']; |
|
336 | 336 | // Remember last question id position. |
337 | 337 | $isFirstTime = Session::read('firstTime'); |
338 | 338 | if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) { |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called:: '.print_r($exercise_stat_info, 1)); }; |
363 | 363 | |
364 | 364 | if (!empty($exercise_stat_info['questions_to_check'])) { |
365 | - $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
366 | - $my_remind_list = explode(',', $my_remind_list); |
|
367 | - $my_remind_list = array_filter($my_remind_list); |
|
365 | + $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
366 | + $my_remind_list = explode(',', $my_remind_list); |
|
367 | + $my_remind_list = array_filter($my_remind_list); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | $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(); |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | |
373 | 373 | if ($reminder == 2 && empty($my_remind_list)) { |
374 | 374 | if ($debug) { error_log("6.2 calling the exercise_reminder.php "); }; |
375 | - header('Location: exercise_reminder.php?'.$params); |
|
376 | - exit; |
|
375 | + header('Location: exercise_reminder.php?'.$params); |
|
376 | + exit; |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /* |
@@ -381,56 +381,56 @@ discard block |
||
381 | 381 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
382 | 382 | */ |
383 | 383 | if ($time_control) { |
384 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
385 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
386 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
384 | + if ($debug) error_log('7.1. Time control is enabled'); |
|
385 | + if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
386 | + if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
387 | 387 | |
388 | 388 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
389 | 389 | //Timer - Get expired_time for a student |
390 | 390 | if (!empty($exercise_stat_info)) { |
391 | - if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
392 | - $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
393 | - if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
394 | - // Get the last attempt of an exercise |
|
395 | - $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
391 | + if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
392 | + $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
393 | + if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
394 | + // Get the last attempt of an exercise |
|
395 | + $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
396 | 396 | |
397 | - /* This means that the user enters the exam but do not answer the |
|
397 | + /* This means that the user enters the exam but do not answer the |
|
398 | 398 | first question we get the date from the track_e_exercises not from |
399 | 399 | the track_et_attempt see #2069 */ |
400 | - if (empty($last_attempt_date)) { |
|
401 | - $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
402 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
403 | - } else { |
|
404 | - //Recalculate the time control due #2069 |
|
405 | - $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
406 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
407 | - } |
|
408 | - if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
409 | - |
|
410 | - //New expired time - it is due to the possible closure of session |
|
411 | - $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
412 | - if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
413 | - |
|
414 | - $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
415 | - if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
416 | - |
|
417 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
418 | - if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
419 | - |
|
420 | - // First we update the attempt to today |
|
421 | - /* How the expired time is changed into "track_e_exercises" table, |
|
400 | + if (empty($last_attempt_date)) { |
|
401 | + $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
402 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
403 | + } else { |
|
404 | + //Recalculate the time control due #2069 |
|
405 | + $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
406 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
407 | + } |
|
408 | + if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
409 | + |
|
410 | + //New expired time - it is due to the possible closure of session |
|
411 | + $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
412 | + if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
413 | + |
|
414 | + $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
415 | + if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
416 | + |
|
417 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
418 | + if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
419 | + |
|
420 | + // First we update the attempt to today |
|
421 | + /* How the expired time is changed into "track_e_exercises" table, |
|
422 | 422 | then the last attempt for this student should be changed too */ |
423 | - $sql = "UPDATE $exercise_attempt_table SET |
|
423 | + $sql = "UPDATE $exercise_attempt_table SET |
|
424 | 424 | tms = '".api_get_utc_datetime()."' |
425 | 425 | WHERE |
426 | 426 | exe_id = '".$exercise_stat_info['exe_id']."' AND |
427 | 427 | tms = '".$last_attempt_date."' "; |
428 | - if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
429 | - Database::query($sql); |
|
428 | + if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
429 | + Database::query($sql); |
|
430 | 430 | |
431 | - //Sessions that contain the expired time |
|
432 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
433 | - if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
431 | + //Sessions that contain the expired time |
|
432 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
433 | + if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
434 | 434 | } |
435 | 435 | } else { |
436 | 436 | $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock |
448 | 448 | */ |
449 | 449 | if ($time_control) { //Sends the exercise form when the expired time is finished |
450 | - $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
450 | + $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | // if the user has submitted the form |
@@ -461,14 +461,14 @@ discard block |
||
461 | 461 | // selects the list of question ID |
462 | 462 | $questionList = $objExercise->get_validated_question_list(); |
463 | 463 | if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) { |
464 | - $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
464 | + $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
465 | 465 | } |
466 | 466 | Session::write('questionList', $questionList); |
467 | 467 | if ($debug > 0) { error_log('$_SESSION[questionList] was set'); } |
468 | 468 | } else { |
469 | - if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
470 | - $questionList = $_SESSION['questionList']; |
|
471 | - } |
|
469 | + if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
470 | + $questionList = $_SESSION['questionList']; |
|
471 | + } |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | //Real question count |
477 | 477 | $question_count = 0; |
478 | 478 | if (!empty($questionList)) { |
479 | - $question_count = count($questionList); |
|
479 | + $question_count = count($questionList); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | if ($formSent && isset($_POST)) { |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | //saving each question |
519 | 519 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) { |
520 | 520 | $nro_question = $current_question; // - 1; |
521 | - $questionId = $key; |
|
521 | + $questionId = $key; |
|
522 | 522 | // gets the student choice for this question |
523 | 523 | $choice = $exerciseResult[$questionId]; |
524 | 524 | if (isset($exe_id)) { |
525 | - // Manage the question and answer attempts |
|
525 | + // Manage the question and answer attempts |
|
526 | 526 | if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); } |
527 | 527 | $objExercise->manage_answer( |
528 | 528 | $exe_id, |
@@ -611,58 +611,58 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | if ($question_count != 0) { |
614 | - if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
614 | + if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
615 | 615 | $current_question > $question_count) |
616 | 616 | ) { |
617 | - if (api_is_allowed_to_session_edit()) { |
|
618 | - // goes to the script that will show the result of the exercise |
|
619 | - if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
620 | - if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
621 | - |
|
622 | - //We check if the user attempts before sending to the exercise_result.php |
|
623 | - if ($objExercise->selectAttempts() > 0) { |
|
624 | - $attempt_count = Event::get_attempt_count( |
|
617 | + if (api_is_allowed_to_session_edit()) { |
|
618 | + // goes to the script that will show the result of the exercise |
|
619 | + if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
620 | + if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
621 | + |
|
622 | + //We check if the user attempts before sending to the exercise_result.php |
|
623 | + if ($objExercise->selectAttempts() > 0) { |
|
624 | + $attempt_count = Event::get_attempt_count( |
|
625 | 625 | api_get_user_id(), |
626 | 626 | $exerciseId, |
627 | 627 | $learnpath_id, |
628 | 628 | $learnpath_item_id, |
629 | 629 | $learnpath_item_view_id |
630 | 630 | ); |
631 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
632 | - Display :: display_warning_message( |
|
631 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
632 | + Display :: display_warning_message( |
|
633 | 633 | sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), |
634 | 634 | false |
635 | 635 | ); |
636 | - if ($origin != 'learnpath') { |
|
637 | - //so we are not in learnpath tool |
|
638 | - echo '</div>'; //End glossary div |
|
639 | - Display :: display_footer(); |
|
640 | - } else { |
|
641 | - echo '</body></html>'; |
|
642 | - } |
|
643 | - exit; |
|
644 | - } |
|
645 | - } |
|
646 | - } else { |
|
647 | - if ($objExercise->review_answers) { |
|
648 | - header('Location: exercise_reminder.php?'.$params); |
|
649 | - exit; |
|
650 | - } else { |
|
636 | + if ($origin != 'learnpath') { |
|
637 | + //so we are not in learnpath tool |
|
638 | + echo '</div>'; //End glossary div |
|
639 | + Display :: display_footer(); |
|
640 | + } else { |
|
641 | + echo '</body></html>'; |
|
642 | + } |
|
643 | + exit; |
|
644 | + } |
|
645 | + } |
|
646 | + } else { |
|
647 | + if ($objExercise->review_answers) { |
|
648 | + header('Location: exercise_reminder.php?'.$params); |
|
649 | + exit; |
|
650 | + } else { |
|
651 | 651 | 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"); |
652 | 652 | exit; |
653 | - } |
|
654 | - } |
|
655 | - } else { |
|
656 | - if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
657 | - exit; |
|
658 | - } |
|
659 | - } |
|
653 | + } |
|
654 | + } |
|
655 | + } else { |
|
656 | + if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
657 | + exit; |
|
658 | + } |
|
659 | + } |
|
660 | 660 | } else { |
661 | - $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
662 | - // if we are in the case where user select random by category, but didn't choose the number of random question |
|
663 | - if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
664 | - $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
665 | - } |
|
661 | + $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
662 | + // if we are in the case where user select random by category, but didn't choose the number of random question |
|
663 | + if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
664 | + $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
665 | + } |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | if (api_is_course_admin() && $origin != 'learnpath') { |
702 | 702 | echo '<div class="actions">'; |
703 | 703 | if ($show_quiz_edition == false) { |
704 | - 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>'; |
|
704 | + 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>'; |
|
705 | 705 | } else { |
706 | - echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
706 | + echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
707 | 707 | } |
708 | 708 | echo '</div>'; |
709 | 709 | } |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet'); |
747 | 747 | Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts())); |
748 | 748 | if ($origin != 'learnpath') { |
749 | - Display :: display_footer(); |
|
749 | + Display :: display_footer(); |
|
750 | 750 | } |
751 | 751 | exit; |
752 | 752 | } else { |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | if (isset($_custom['exercises_hidden_when_no_start_date']) && |
762 | 762 | $_custom['exercises_hidden_when_no_start_date'] |
763 | 763 | ) { |
764 | - if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
764 | + if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
765 | 765 | Display:: display_warning_message( |
766 | 766 | sprintf( |
767 | 767 | get_lang('ExerciseNoStartedYet'), |
@@ -769,20 +769,20 @@ discard block |
||
769 | 769 | $objExercise->selectAttempts() |
770 | 770 | ) |
771 | 771 | ); |
772 | - if ($origin != 'learnpath') { |
|
773 | - Display :: display_footer(); |
|
774 | - } |
|
775 | - } |
|
772 | + if ($origin != 'learnpath') { |
|
773 | + Display :: display_footer(); |
|
774 | + } |
|
775 | + } |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | //Timer control |
779 | 779 | if ($time_control) { |
780 | 780 | echo $objExercise->return_time_left_div(); |
781 | - echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
781 | + echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | if ($origin != 'learnpath') { |
785 | - echo '<div id="highlight-plugin" class="glossary-content">'; |
|
785 | + echo '<div id="highlight-plugin" class="glossary-content">'; |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | if ($reminder == 2) { |
@@ -794,53 +794,53 @@ discard block |
||
794 | 794 | $current_question = 1; //set by default the 1st question |
795 | 795 | |
796 | 796 | if (!empty($my_remind_list)) { |
797 | - // Checking which questions we are going to call from the remind list |
|
798 | - for ($i = 0; $i < count($data_tracking); $i++) { |
|
799 | - for($j = 0; $j < count($my_remind_list); $j++) { |
|
800 | - |
|
801 | - if (!empty($remind_question_id)) { |
|
802 | - if ($remind_question_id == $my_remind_list[$j]) { |
|
803 | - |
|
804 | - if ($remind_question_id == $data_tracking[$i]) { |
|
805 | - if (isset($my_remind_list[$j+1])) { |
|
806 | - $remind_question_id = $my_remind_list[$j+1]; |
|
807 | - $current_question = $i + 1; |
|
808 | - } else { |
|
797 | + // Checking which questions we are going to call from the remind list |
|
798 | + for ($i = 0; $i < count($data_tracking); $i++) { |
|
799 | + for($j = 0; $j < count($my_remind_list); $j++) { |
|
800 | + |
|
801 | + if (!empty($remind_question_id)) { |
|
802 | + if ($remind_question_id == $my_remind_list[$j]) { |
|
803 | + |
|
804 | + if ($remind_question_id == $data_tracking[$i]) { |
|
805 | + if (isset($my_remind_list[$j+1])) { |
|
806 | + $remind_question_id = $my_remind_list[$j+1]; |
|
807 | + $current_question = $i + 1; |
|
808 | + } else { |
|
809 | 809 | // We end the remind list we go to the exercise_reminder.php please |
810 | - $remind_question_id = -1; |
|
811 | - $current_question = $i + 1; // last question |
|
812 | - } |
|
813 | - break 2; |
|
814 | - } |
|
815 | - } |
|
816 | - } else { |
|
817 | - if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
818 | - if (isset($my_remind_list[$j+1])) { |
|
819 | - $remind_question_id = $my_remind_list[$j+1]; |
|
820 | - $current_question = $i + 1; // last question |
|
821 | - } else { |
|
810 | + $remind_question_id = -1; |
|
811 | + $current_question = $i + 1; // last question |
|
812 | + } |
|
813 | + break 2; |
|
814 | + } |
|
815 | + } |
|
816 | + } else { |
|
817 | + if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
818 | + if (isset($my_remind_list[$j+1])) { |
|
819 | + $remind_question_id = $my_remind_list[$j+1]; |
|
820 | + $current_question = $i + 1; // last question |
|
821 | + } else { |
|
822 | 822 | // We end the remind list we go to the exercise_reminder.php please |
823 | - $remind_question_id = -1; |
|
824 | - $current_question = $i + 1; // last question |
|
825 | - } |
|
826 | - break 2; |
|
827 | - } |
|
828 | - } |
|
829 | - } |
|
823 | + $remind_question_id = -1; |
|
824 | + $current_question = $i + 1; // last question |
|
825 | + } |
|
826 | + break 2; |
|
827 | + } |
|
828 | + } |
|
829 | + } |
|
830 | 830 | } |
831 | 831 | } else { |
832 | - if ($objExercise->review_answers) { |
|
832 | + if ($objExercise->review_answers) { |
|
833 | 833 | if ($debug) { error_log('. redirecting to exercise_reminder.php '); } |
834 | - header("Location: exercise_reminder.php?$params"); |
|
835 | - exit; |
|
836 | - } |
|
834 | + header("Location: exercise_reminder.php?$params"); |
|
835 | + exit; |
|
836 | + } |
|
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
840 | 840 | if ($objExercise->review_answers) { |
841 | - $script_php = 'exercise_reminder.php'; |
|
841 | + $script_php = 'exercise_reminder.php'; |
|
842 | 842 | } else { |
843 | - $script_php = 'exercise_result.php'; |
|
843 | + $script_php = 'exercise_result.php'; |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | if (!empty($error)) { |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id . '" /> |
1085 | 1085 | <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />'; |
1086 | 1086 | |
1087 | - // Show list of questions |
|
1087 | + // Show list of questions |
|
1088 | 1088 | $i = 1; |
1089 | 1089 | $attempt_list = array(); |
1090 | 1090 | if (isset($exe_id)) { |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | $attributes = array('id' =>'remind_list['.$questionId.']'); |
1136 | 1136 | if (in_array($questionId, $remind_list)) { |
1137 | - $is_remind_on = true; |
|
1138 | - $attributes['checked'] = 1; |
|
1139 | - $remind_question = true; |
|
1140 | - $remind_highlight = ' remind_highlight '; |
|
1137 | + $is_remind_on = true; |
|
1138 | + $attributes['checked'] = 1; |
|
1139 | + $remind_question = true; |
|
1140 | + $remind_highlight = ' remind_highlight '; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Showing the exercise description |
@@ -1211,8 +1211,8 @@ discard block |
||
1211 | 1211 | } |
1212 | 1212 | // end foreach() |
1213 | 1213 | if ($objExercise->type == ALL_ON_ONE_PAGE) { |
1214 | - $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1215 | - echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1214 | + $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1215 | + echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1216 | 1216 | echo '<br>'; |
1217 | 1217 | } |
1218 | 1218 | echo '</form>'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | use ChamiloSession as Session; |
30 | 30 | |
31 | 31 | require_once '../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 |
||
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,8 +60,8 @@ discard block |
||
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 | $template = new Template(); |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $learnpath_id = isset($_REQUEST['learnpath_id']) ? intval($_REQUEST['learnpath_id']) : 0; |
71 | 71 | $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? intval($_REQUEST['learnpath_item_id']) : 0; |
72 | -$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0; |
|
72 | +$learnpath_item_view_id = isset($_REQUEST['learnpath_item_view_id']) ? intval($_REQUEST['learnpath_item_view_id']) : 0; |
|
73 | 73 | |
74 | 74 | $reminder = isset($_REQUEST['reminder']) ? intval($_REQUEST['reminder']) : 0; |
75 | 75 | $remind_question_id = isset($_REQUEST['remind_question_id']) ? intval($_REQUEST['remind_question_id']) : 0; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /* Teacher takes an exam and want to see a preview, |
97 | 97 | we delete the objExercise from the session in order to get the latest |
98 | 98 | changes in the exercise */ |
99 | -if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1 ) { |
|
99 | +if (api_is_allowed_to_edit(null, true) && isset($_GET['preview']) && $_GET['preview'] == 1) { |
|
100 | 100 | Session::erase('objExercise'); |
101 | 101 | } |
102 | 102 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | if ($time_control) { |
169 | 169 | // Get the expired time of the current exercise in track_e_exercises |
170 | - $total_seconds = $objExercise->expired_time*60; |
|
170 | + $total_seconds = $objExercise->expired_time * 60; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $show_clock = true; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | if ($attempt_count >= $objExercise->selectAttempts()) { |
186 | 186 | $show_clock = false; |
187 | - if (!api_is_allowed_to_edit(null,true)) { |
|
187 | + if (!api_is_allowed_to_edit(null, true)) { |
|
188 | 188 | if ($objExercise->results_disabled == 0 && $origin != 'learnpath') { |
189 | 189 | |
190 | 190 | // Showing latest attempt according with task BT#1628 |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ); |
215 | 215 | |
216 | 216 | if (!empty($last_attempt_info['question_list'])) { |
217 | - foreach($last_attempt_info['question_list'] as $question_data) { |
|
217 | + foreach ($last_attempt_info['question_list'] as $question_data) { |
|
218 | 218 | $question_id = $question_data['question_id']; |
219 | 219 | $marks = $question_data['marks']; |
220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore')); |
224 | 224 | } |
225 | 225 | } |
226 | - $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
226 | + $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
227 | 227 | $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
228 | 228 | } else { |
229 | 229 | $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if ($origin == 'learnpath') { |
239 | 239 | Display :: display_reduced_header(); |
240 | 240 | } else { |
241 | - Display :: display_header($nameTools,'Exercises'); |
|
241 | + Display :: display_header($nameTools, 'Exercises'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | echo $attempt_html; |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
310 | 310 | if ($debug) error_log('5.2. $expected_time '.$expected_time); |
311 | 311 | |
312 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
312 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
313 | 313 | if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
314 | 314 | |
315 | 315 | //Sessions that contain the expired time |
316 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
317 | - if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
316 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
317 | + if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); }; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | $exe_id = $objExercise->save_stat_track_exercise_info( |
@@ -399,22 +399,22 @@ discard block |
||
399 | 399 | the track_et_attempt see #2069 */ |
400 | 400 | if (empty($last_attempt_date)) { |
401 | 401 | $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
402 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
402 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'], 'UTC') + $diff); |
|
403 | 403 | } else { |
404 | 404 | //Recalculate the time control due #2069 |
405 | - $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
406 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
405 | + $diff = $current_timestamp - api_strtotime($last_attempt_date, 'UTC'); |
|
406 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date, 'UTC') + $diff); |
|
407 | 407 | } |
408 | 408 | if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
409 | 409 | |
410 | 410 | //New expired time - it is due to the possible closure of session |
411 | - $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
411 | + $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date, 'UTC'); |
|
412 | 412 | if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
413 | 413 | |
414 | - $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
414 | + $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
415 | 415 | if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
416 | 416 | |
417 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
417 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
418 | 418 | if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
419 | 419 | |
420 | 420 | // First we update the attempt to today |
@@ -430,17 +430,17 @@ discard block |
||
430 | 430 | |
431 | 431 | //Sessions that contain the expired time |
432 | 432 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
433 | - if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
433 | + if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key]); }; |
|
434 | 434 | } |
435 | 435 | } else { |
436 | - $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
|
436 | + $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
|
437 | 437 | } |
438 | 438 | } else { |
439 | 439 | if ($debug) { error_log("7 No time control"); }; |
440 | 440 | } |
441 | 441 | |
442 | 442 | // Get time left for expiring time |
443 | -$time_left = api_strtotime($clock_expired_time,'UTC') - time(); |
|
443 | +$time_left = api_strtotime($clock_expired_time, 'UTC') - time(); |
|
444 | 444 | |
445 | 445 | /* |
446 | 446 | * The time control feature is enable here - this feature is enable for a jquery plugin called epiclock |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | |
491 | 491 | //Only for hotspot |
492 | 492 | if (!isset($choice) && isset($_REQUEST['hidden_hotspot_id'])) { |
493 | - $hotspot_id = (int)($_REQUEST['hidden_hotspot_id']); |
|
493 | + $hotspot_id = (int) ($_REQUEST['hidden_hotspot_id']); |
|
494 | 494 | $choice = array($hotspot_id => ''); |
495 | 495 | } |
496 | 496 | |
@@ -518,12 +518,12 @@ discard block |
||
518 | 518 | //saving each question |
519 | 519 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) { |
520 | 520 | $nro_question = $current_question; // - 1; |
521 | - $questionId = $key; |
|
521 | + $questionId = $key; |
|
522 | 522 | // gets the student choice for this question |
523 | 523 | $choice = $exerciseResult[$questionId]; |
524 | 524 | if (isset($exe_id)) { |
525 | 525 | // Manage the question and answer attempts |
526 | - if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); } |
|
526 | + if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice, 1)); } |
|
527 | 527 | $objExercise->manage_answer( |
528 | 528 | $exe_id, |
529 | 529 | $questionId, |
@@ -542,13 +542,13 @@ discard block |
||
542 | 542 | } |
543 | 543 | } |
544 | 544 | if ($debug) { error_log('9.3. $choice is an array - end'); } |
545 | - if ($debug) { error_log('9.4. $exerciseResult '.print_r($exerciseResult,1)); } |
|
545 | + if ($debug) { error_log('9.4. $exerciseResult '.print_r($exerciseResult, 1)); } |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | // the script "exercise_result.php" will take the variable $exerciseResult from the session |
549 | 549 | Session::write('exerciseResult', $exerciseResult); |
550 | 550 | Session::write('remind_list', $remind_list); |
551 | - Session::write('exerciseResultCoordinates',$exerciseResultCoordinates); |
|
551 | + Session::write('exerciseResultCoordinates', $exerciseResultCoordinates); |
|
552 | 552 | |
553 | 553 | // if all questions on one page OR if it is the last question (only for an exercise with one question per page) |
554 | 554 | if ($objExercise->type == ALL_ON_ONE_PAGE || $current_question >= $question_count) { |
@@ -674,15 +674,15 @@ discard block |
||
674 | 674 | } |
675 | 675 | |
676 | 676 | if (!empty ($gradebook) && $gradebook == 'view') { |
677 | - $interbreadcrumb[] = array ('url' => '../gradebook/' . Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); |
|
677 | + $interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook')); |
|
678 | 678 | } |
679 | 679 | |
680 | -$interbreadcrumb[] = array ("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
681 | -$interbreadcrumb[] = array ("url" => "#", "name" => $objExercise->name); |
|
680 | +$interbreadcrumb[] = array("url" => "exercise.php?".api_get_cidreq(), "name" => get_lang('Exercises')); |
|
681 | +$interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name); |
|
682 | 682 | |
683 | 683 | if ($origin != 'learnpath') { //so we are not in learnpath tool |
684 | - Display :: display_header(null,'Exercises'); |
|
685 | - if (!api_is_allowed_to_session_edit() ) { |
|
684 | + Display :: display_header(null, 'Exercises'); |
|
685 | + if (!api_is_allowed_to_session_edit()) { |
|
686 | 686 | Display :: display_warning_message(get_lang('SessionIsReadOnly')); |
687 | 687 | } |
688 | 688 | } else { |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | if (api_is_course_admin() && $origin != 'learnpath') { |
702 | 702 | echo '<div class="actions">'; |
703 | 703 | if ($show_quiz_edition == false) { |
704 | - 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>'; |
|
704 | + 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>'; |
|
705 | 705 | } else { |
706 | - echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
706 | + echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
707 | 707 | } |
708 | 708 | echo '</div>'; |
709 | 709 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | } |
743 | 743 | |
744 | 744 | if (!$permission_to_start || $exercise_timeover) { |
745 | - if (!api_is_allowed_to_edit(null,true)) { |
|
745 | + if (!api_is_allowed_to_edit(null, true)) { |
|
746 | 746 | $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet'); |
747 | 747 | Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts())); |
748 | 748 | if ($origin != 'learnpath') { |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | echo '<div id="highlight-plugin" class="glossary-content">'; |
786 | 786 | } |
787 | 787 | |
788 | -if ($reminder == 2) { |
|
788 | +if ($reminder == 2) { |
|
789 | 789 | if ($debug) { error_log(' $reminder == 2'); } |
790 | 790 | |
791 | 791 | $data_tracking = $exercise_stat_info['data_tracking']; |
@@ -796,14 +796,14 @@ discard block |
||
796 | 796 | if (!empty($my_remind_list)) { |
797 | 797 | // Checking which questions we are going to call from the remind list |
798 | 798 | for ($i = 0; $i < count($data_tracking); $i++) { |
799 | - for($j = 0; $j < count($my_remind_list); $j++) { |
|
799 | + for ($j = 0; $j < count($my_remind_list); $j++) { |
|
800 | 800 | |
801 | 801 | if (!empty($remind_question_id)) { |
802 | 802 | if ($remind_question_id == $my_remind_list[$j]) { |
803 | 803 | |
804 | 804 | if ($remind_question_id == $data_tracking[$i]) { |
805 | - if (isset($my_remind_list[$j+1])) { |
|
806 | - $remind_question_id = $my_remind_list[$j+1]; |
|
805 | + if (isset($my_remind_list[$j + 1])) { |
|
806 | + $remind_question_id = $my_remind_list[$j + 1]; |
|
807 | 807 | $current_question = $i + 1; |
808 | 808 | } else { |
809 | 809 | // We end the remind list we go to the exercise_reminder.php please |
@@ -815,8 +815,8 @@ discard block |
||
815 | 815 | } |
816 | 816 | } else { |
817 | 817 | if ($my_remind_list[$j] == $data_tracking[$i]) { |
818 | - if (isset($my_remind_list[$j+1])) { |
|
819 | - $remind_question_id = $my_remind_list[$j+1]; |
|
818 | + if (isset($my_remind_list[$j + 1])) { |
|
819 | + $remind_question_id = $my_remind_list[$j + 1]; |
|
820 | 820 | $current_question = $i + 1; // last question |
821 | 821 | } else { |
822 | 822 | // We end the remind list we go to the exercise_reminder.php please |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | Display :: display_error_message($error, false); |
848 | 848 | } else { |
849 | 849 | if (!empty ($exercise_sound)) { |
850 | - 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>"; |
|
850 | + 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>"; |
|
851 | 851 | } |
852 | 852 | // Get number of hotspot questions for javascript validation |
853 | 853 | $number_of_hotspot_questions = 0; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | } |
883 | 883 | |
884 | 884 | if ($number_of_hotspot_questions > 0) { |
885 | - $onsubmit = "onsubmit=\"return validateFlashVar('" . $number_of_hotspot_questions . "', '" . get_lang('HotspotValidateError1') . "', '" . get_lang('HotspotValidateError2') . "');\""; |
|
885 | + $onsubmit = "onsubmit=\"return validateFlashVar('".$number_of_hotspot_questions."', '".get_lang('HotspotValidateError1')."', '".get_lang('HotspotValidateError2')."');\""; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | echo '<script> |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | ICON_SIZE_SMALL, |
897 | 897 | false, |
898 | 898 | true |
899 | - ) . '\'; |
|
899 | + ).'\'; |
|
900 | 900 | |
901 | 901 | // Block form submition on enter |
902 | 902 | $(".block_on_enter").keypress(function(event) { |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | } else { |
949 | 949 | url = "exercise_submit.php?'.$params.'&num='.$current_question.'&remind_question_id='.$remind_question_id.'"; |
950 | 950 | } |
951 | - //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\'); |
|
951 | + //$("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\'); |
|
952 | 952 | window.location = url; |
953 | 953 | } |
954 | 954 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | |
981 | 981 | // Only for the first time |
982 | 982 | |
983 | - $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', true, null, 'fa-spin') . '\'); |
|
983 | + $("#save_for_now_"+question_id).html(\'' . Display::returnFontAwesomeIcon('spinner', true, null, 'fa-spin').'\'); |
|
984 | 984 | $.ajax({ |
985 | 985 | type:"post", |
986 | 986 | async: false, |
@@ -988,9 +988,9 @@ discard block |
||
988 | 988 | data: "'.$params.'&type=simple&question_id="+question_id+"&"+my_choice+"&"+hotspot+"&"+remind_list, |
989 | 989 | success: function(return_value) { |
990 | 990 | if (return_value == "ok") { |
991 | - $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\'); |
|
991 | + $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\'); |
|
992 | 992 | } else if (return_value == "error") { |
993 | - $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\'); |
|
993 | + $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\'); |
|
994 | 994 | } else if (return_value == "one_per_page") { |
995 | 995 | var url = ""; |
996 | 996 | if ('.$reminder.' == 1 ) { |
@@ -1005,13 +1005,13 @@ discard block |
||
1005 | 1005 | url = url_extra; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL) . '\'); |
|
1008 | + $("#save_for_now_"+question_id).html(\'' . Display::return_icon('save.png', get_lang('Saved'), array(), ICON_SIZE_SMALL).'\'); |
|
1009 | 1009 | |
1010 | 1010 | window.location = url; |
1011 | 1011 | } |
1012 | 1012 | }, |
1013 | 1013 | error: function() { |
1014 | - $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL) . '\'); |
|
1014 | + $("#save_for_now_"+question_id).html(\'' . Display::return_icon('error.png', get_lang('Error'), array(), ICON_SIZE_SMALL).'\'); |
|
1015 | 1015 | } |
1016 | 1016 | }); |
1017 | 1017 | return false; |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | |
1045 | 1045 | free_answers = $.param(free_answers); |
1046 | 1046 | |
1047 | - $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', true, null, 'fa-spin') . '\'); |
|
1047 | + $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', true, null, 'fa-spin').'\'); |
|
1048 | 1048 | |
1049 | 1049 | $.ajax({ |
1050 | 1050 | type:"post", |
@@ -1053,14 +1053,14 @@ discard block |
||
1053 | 1053 | data: "'.$params.'&type=all&"+my_choice+"&"+hotspot+"&"+free_answers+"&"+remind_list, |
1054 | 1054 | success: function(return_value) { |
1055 | 1055 | if (return_value == "ok") { |
1056 | - //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\'); |
|
1056 | + //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\'); |
|
1057 | 1057 | if (validate == "validate") { |
1058 | 1058 | window.location = "'.$script_php.'?'.$params.'"; |
1059 | 1059 | } else { |
1060 | - $("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\'); |
|
1060 | + $("#save_all_reponse").html(\'' . Display::return_icon('accept.png').'\'); |
|
1061 | 1061 | } |
1062 | 1062 | } else { |
1063 | - $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif') . '\'); |
|
1063 | + $("#save_all_reponse").html(\'' . Display::return_icon('wrong.gif').'\'); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | }); |
@@ -1073,16 +1073,16 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | </script>'; |
1075 | 1075 | |
1076 | - echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId .'" name="frm_exercise" '.$onsubmit.'> |
|
1076 | + echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId.'" name="frm_exercise" '.$onsubmit.'> |
|
1077 | 1077 | <input type="hidden" name="formSent" value="1" /> |
1078 | - <input type="hidden" name="exerciseId" value="'.$exerciseId . '" /> |
|
1078 | + <input type="hidden" name="exerciseId" value="'.$exerciseId.'" /> |
|
1079 | 1079 | <input type="hidden" name="num" value="'.$current_question.'" id="num_current_id" /> |
1080 | 1080 | <input type="hidden" name="num_answer" value="'.$currentAnswer.'" id="num_current_answer_id" /> |
1081 | - <input type="hidden" name="exe_id" value="'.$exe_id . '" /> |
|
1082 | - <input type="hidden" name="origin" value="'.$origin . '" /> |
|
1083 | - <input type="hidden" name="learnpath_id" value="'.$learnpath_id . '" /> |
|
1084 | - <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id . '" /> |
|
1085 | - <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />'; |
|
1081 | + <input type="hidden" name="exe_id" value="'.$exe_id.'" /> |
|
1082 | + <input type="hidden" name="origin" value="'.$origin.'" /> |
|
1083 | + <input type="hidden" name="learnpath_id" value="'.$learnpath_id.'" /> |
|
1084 | + <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id.'" /> |
|
1085 | + <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id.'" />'; |
|
1086 | 1086 | |
1087 | 1087 | // Show list of questions |
1088 | 1088 | $i = 1; |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | $attempt_list = Event::getAllExerciseEventByExeId($exe_id); |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $remind_list = array(); |
|
1094 | + $remind_list = array(); |
|
1095 | 1095 | if (isset($exercise_stat_info['questions_to_check']) && !empty($exercise_stat_info['questions_to_check'])) { |
1096 | 1096 | $remind_list = explode(',', $exercise_stat_info['questions_to_check']); |
1097 | 1097 | } |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | $remind_highlight = 'no_remind_highlight'; |
1130 | 1130 | } |
1131 | 1131 | |
1132 | - $exercise_actions = ''; |
|
1132 | + $exercise_actions = ''; |
|
1133 | 1133 | $is_remind_on = false; |
1134 | 1134 | |
1135 | 1135 | $attributes = array('id' =>'remind_list['.$questionId.']'); |
@@ -1141,10 +1141,10 @@ discard block |
||
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Showing the exercise description |
1144 | - if (!empty($objExercise->description)){ |
|
1145 | - if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i==1)) { |
|
1146 | - echo Display::panelCollapse('<span>' . |
|
1147 | - get_lang('ExerciseDescriptionLabel') . '</span>', |
|
1144 | + if (!empty($objExercise->description)) { |
|
1145 | + if ($objExercise->type == ONE_PER_PAGE || ($objExercise->type != ONE_PER_PAGE && $i == 1)) { |
|
1146 | + echo Display::panelCollapse('<span>'. |
|
1147 | + get_lang('ExerciseDescriptionLabel').'</span>', |
|
1148 | 1148 | $objExercise->description, |
1149 | 1149 | 'exercise-description', |
1150 | 1150 | [], |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | case ALL_ON_ONE_PAGE : |
1179 | 1179 | $button = '<a href="javascript://" class="btn btn-info" onclick="save_now(\''.$questionId.'\'); ">'.get_lang('SaveForNow').'</a>'; |
1180 | 1180 | $button .= '<span id="save_for_now_'.$questionId.'"></span> '; |
1181 | - $exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button')); |
|
1181 | + $exercise_actions .= Display::div($button, array('class'=>'exercise_save_now_button')); |
|
1182 | 1182 | break; |
1183 | 1183 | } |
1184 | 1184 | |
@@ -1188,13 +1188,13 @@ discard block |
||
1188 | 1188 | 'label', |
1189 | 1189 | Display::input( |
1190 | 1190 | 'checkbox', |
1191 | - 'remind_list[' . $questionId . ']', |
|
1191 | + 'remind_list['.$questionId.']', |
|
1192 | 1192 | '', |
1193 | 1193 | $attributes |
1194 | - ) . get_lang('ReviewQuestionLater'), |
|
1194 | + ).get_lang('ReviewQuestionLater'), |
|
1195 | 1195 | array( |
1196 | 1196 | 'class' => 'checkbox', |
1197 | - 'for' => 'remind_list[' . $questionId . ']' |
|
1197 | + 'for' => 'remind_list['.$questionId.']' |
|
1198 | 1198 | ) |
1199 | 1199 | ); |
1200 | 1200 | $exercise_actions .= Display::div($remind_question_div, array('class'=>'exercise_save_now_button')); |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | } |
1212 | 1212 | // end foreach() |
1213 | 1213 | if ($objExercise->type == ALL_ON_ONE_PAGE) { |
1214 | - $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1214 | + $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1215 | 1215 | echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
1216 | 1216 | echo '<br>'; |
1217 | 1217 | } |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * abstract function which creates the form to create / edit the answers of the question |
|
171 | - * @param the formvalidator instance |
|
172 | - * @param the answers number to display |
|
173 | - */ |
|
174 | - function processAnswersCreation($form) |
|
169 | + /** |
|
170 | + * abstract function which creates the form to create / edit the answers of the question |
|
171 | + * @param the formvalidator instance |
|
172 | + * @param the answers number to display |
|
173 | + */ |
|
174 | + function processAnswersCreation($form) |
|
175 | 175 | { |
176 | 176 | $questionWeighting = $nbrGoodAnswers = 0; |
177 | 177 | $objAnswer = new Answer($this->id); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | // sets the total weighting of the question |
202 | 202 | $this->updateWeighting($questionWeighting); |
203 | 203 | $this->save(); |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
206 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
207 | 207 | { |
208 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
208 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $header .= '<th>'.get_lang("Comment").'</th>'; |
215 | 215 | $header .= '</tr>'; |
216 | 216 | return $header; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | 220 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'Height' => '125' |
39 | 39 | ); |
40 | 40 | |
41 | - $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
41 | + $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4; // The previous default value was 2. See task #1759. |
|
42 | 42 | $nb_answers += (isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0)); |
43 | 43 | |
44 | 44 | $obj_ex = $_SESSION['objExercise']; |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $html = '<table class="table table-striped table-hover"> |
49 | 49 | <thead> |
50 | 50 | <tr> |
51 | - <th width="10">' . get_lang('Number') . '</th> |
|
52 | - <th width="10">' . get_lang('True') . '</th> |
|
53 | - <th width="50%">' . get_lang('Answer') . '</th> |
|
54 | - <th width="50%">' . get_lang('Comment') . '</th> |
|
55 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
51 | + <th width="10">' . get_lang('Number').'</th> |
|
52 | + <th width="10">' . get_lang('True').'</th> |
|
53 | + <th width="50%">' . get_lang('Answer').'</th> |
|
54 | + <th width="50%">' . get_lang('Comment').'</th> |
|
55 | + <th width="10">' . get_lang('Weighting').'</th> |
|
56 | 56 | </tr> |
57 | 57 | </thead> |
58 | 58 | <tbody>'; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $form->addHtml('<tr>'); |
83 | 83 | |
84 | 84 | if (is_object($answer)) { |
85 | - $defaults['answer[' . $i . ']'] = $answer->answer[$i]; |
|
86 | - $defaults['comment[' . $i . ']'] = $answer->comment[$i]; |
|
87 | - $defaults['weighting[' . $i . ']'] = float_format($answer->weighting[$i], 1); |
|
88 | - $defaults['correct[' . $i . ']'] = $answer->correct[$i]; |
|
85 | + $defaults['answer['.$i.']'] = $answer->answer[$i]; |
|
86 | + $defaults['comment['.$i.']'] = $answer->comment[$i]; |
|
87 | + $defaults['weighting['.$i.']'] = float_format($answer->weighting[$i], 1); |
|
88 | + $defaults['correct['.$i.']'] = $answer->correct[$i]; |
|
89 | 89 | } else { |
90 | 90 | $defaults['answer[1]'] = get_lang('DefaultMultipleAnswer2'); |
91 | 91 | $defaults['comment[1]'] = get_lang('DefaultMultipleComment2'); |
@@ -101,38 +101,38 @@ discard block |
||
101 | 101 | |
102 | 102 | $renderer->setElementTemplate( |
103 | 103 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
104 | - 'correct[' . $i . ']' |
|
104 | + 'correct['.$i.']' |
|
105 | 105 | ); |
106 | 106 | $renderer->setElementTemplate( |
107 | 107 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
108 | - 'counter[' . $i . ']' |
|
108 | + 'counter['.$i.']' |
|
109 | 109 | ); |
110 | 110 | $renderer->setElementTemplate( |
111 | 111 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
112 | - 'answer[' . $i . ']' |
|
112 | + 'answer['.$i.']' |
|
113 | 113 | ); |
114 | 114 | $renderer->setElementTemplate( |
115 | 115 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
116 | - 'comment[' . $i . ']' |
|
116 | + 'comment['.$i.']' |
|
117 | 117 | ); |
118 | 118 | $renderer->setElementTemplate( |
119 | 119 | '<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', |
120 | - 'weighting[' . $i . ']' |
|
120 | + 'weighting['.$i.']' |
|
121 | 121 | ); |
122 | 122 | |
123 | - $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"'); |
|
123 | + $answer_number = $form->addElement('text', 'counter['.$i.']', null, 'value="'.$i.'"'); |
|
124 | 124 | $answer_number->freeze(); |
125 | 125 | |
126 | - $form->addElement('checkbox', 'correct[' . $i . ']', null, null, |
|
126 | + $form->addElement('checkbox', 'correct['.$i.']', null, null, |
|
127 | 127 | 'class="checkbox" style="margin-left: 0em;"'); |
128 | - $boxes_names[] = 'correct[' . $i . ']'; |
|
128 | + $boxes_names[] = 'correct['.$i.']'; |
|
129 | 129 | |
130 | 130 | $form->addHtmlEditor("answer[$i]", null, null, true, $editorConfig); |
131 | - $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required'); |
|
131 | + $form->addRule('answer['.$i.']', get_lang('ThisFieldIsRequired'), 'required'); |
|
132 | 132 | |
133 | 133 | $form->addHtmlEditor("comment[$i]", null, null, true, $editorConfig); |
134 | 134 | |
135 | - $form->addElement('text', 'weighting[' . $i . ']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
135 | + $form->addElement('text', 'weighting['.$i.']', null, array('style' => "width: 60px;", 'value' => '0')); |
|
136 | 136 | $form->addHtml('</tr>'); |
137 | 137 | } |
138 | 138 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $objAnswer = new Answer($this->id); |
178 | 178 | $nb_answers = $form->getSubmitValue('nb_answers'); |
179 | 179 | |
180 | - for($i=1 ; $i <= $nb_answers ; $i++) { |
|
180 | + for ($i = 1; $i <= $nb_answers; $i++) { |
|
181 | 181 | $answer = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('answer['.$i.']'))); |
182 | 182 | $comment = trim(str_replace(['<p>', '</p>'], '', $form -> getSubmitValue('comment['.$i.']'))); |
183 | 183 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | $weighting = abs($weighting); |
190 | 190 | $weighting = -$weighting; |
191 | 191 | } |
192 | - if($weighting > 0) { |
|
192 | + if ($weighting > 0) { |
|
193 | 193 | $questionWeighting += $weighting; |
194 | 194 | } |
195 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i); |
|
195 | + $objAnswer -> createAnswer($answer, $goodAnswer, $comment, $weighting, $i); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // saves the answers into the data base |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | function return_header($feedback_type = null, $counter = null, $score = null) |
207 | 207 | { |
208 | 208 | $header = parent::return_header($feedback_type, $counter, $score); |
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
209 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -28,10 +28,10 @@ |
||
28 | 28 | $content = ReadFileCont($full_file_path.$user_id.'.t.html'); |
29 | 29 | |
30 | 30 | if ($content == '') { |
31 | - $content = ReadFileCont($full_file_path); |
|
31 | + $content = ReadFileCont($full_file_path); |
|
32 | 32 | // Do not move this like: |
33 | - $mit = "function Finish(){"; |
|
34 | - $js_content = " |
|
33 | + $mit = "function Finish(){"; |
|
34 | + $js_content = " |
|
35 | 35 | // Code added - start |
36 | 36 | var SaveScoreVariable = 0; |
37 | 37 | function mySaveScore() { |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | $time = time(); |
15 | 15 | $doc_url = str_replace(array('../', '\\', '\\0', '..'), array('', '', '', ''), urldecode($_GET['file'])); |
16 | 16 | $cid = api_get_course_id(); |
17 | -$document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; |
|
18 | -$document_web_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document'; |
|
17 | +$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
|
18 | +$document_web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'; |
|
19 | 19 | $origin = isset($_REQUEST['origin']) ? $_REQUEST['origin'] : null; |
20 | 20 | $learnpath_id = isset($_REQUEST['learnpath_id']) ? $_REQUEST['learnpath_id'] : null; |
21 | 21 | $learnpath_item_id = isset($_REQUEST['learnpath_item_id']) ? $_REQUEST['learnpath_item_id'] : null; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $my_file = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($my_file)); |
70 | 70 | |
71 | 71 | $title = GetQuizName($my_file, $documentPath); |
72 | -if ($title =='') { |
|
72 | +if ($title == '') { |
|
73 | 73 | $title = basename($my_file); |
74 | 74 | } |
75 | 75 | $nameTools = $title; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | }); |
87 | 87 | </script>'; |
88 | 88 | |
89 | -$interbreadcrumb[]= array ("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
89 | +$interbreadcrumb[] = array("url"=>"./exercise.php", "name"=> get_lang('Exercises')); |
|
90 | 90 | if ($origin == 'learnpath') { |
91 | 91 | Display::display_reduced_header($nameTools, "Exercise"); |
92 | 92 | } else { |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | use ChamiloSession as Session; |
48 | 48 | |
49 | 49 | require_once '../inc/global.inc.php'; |
50 | -$current_course_tool = TOOL_QUIZ; |
|
50 | +$current_course_tool = TOOL_QUIZ; |
|
51 | 51 | $this_section = SECTION_COURSES; |
52 | 52 | |
53 | 53 | // Access control |
54 | 54 | api_protect_course_script(true); |
55 | 55 | |
56 | -$is_allowedToEdit = api_is_allowed_to_edit(null,true); |
|
56 | +$is_allowedToEdit = api_is_allowed_to_edit(null, true); |
|
57 | 57 | $sessionId = api_get_session_id(); |
58 | 58 | |
59 | 59 | if (!$is_allowedToEdit) { |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /* stripslashes POST data */ |
64 | -if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
65 | - foreach($_POST as $key=>$val) { |
|
66 | - if(is_string($val)) { |
|
67 | - $_POST[$key]=stripslashes($val); |
|
68 | - } elseif(is_array($val)) { |
|
69 | - foreach($val as $key2=>$val2) { |
|
70 | - $_POST[$key][$key2]=stripslashes($val2); |
|
64 | +if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
65 | + foreach ($_POST as $key=>$val) { |
|
66 | + if (is_string($val)) { |
|
67 | + $_POST[$key] = stripslashes($val); |
|
68 | + } elseif (is_array($val)) { |
|
69 | + foreach ($val as $key2=>$val2) { |
|
70 | + $_POST[$key][$key2] = stripslashes($val2); |
|
71 | 71 | } |
72 | 72 | } |
73 | - $GLOBALS[$key]=$_POST[$key]; |
|
73 | + $GLOBALS[$key] = $_POST[$key]; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | 77 | if (empty($exerciseId)) { |
78 | - $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']):'0'; |
|
78 | + $exerciseId = isset($_GET['exerciseId']) ? intval($_GET['exerciseId']) : '0'; |
|
79 | 79 | } |
80 | 80 | if (empty($newQuestion)) { |
81 | 81 | $newQuestion = isset($_GET['newQuestion']) ? $_GET['newQuestion'] : 0; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $objQuestion = $objQuestion->swapSimpleAnswerTypes(); |
124 | 124 | $_SESSION['objQuestion'] = $objQuestion; |
125 | 125 | } |
126 | -$objAnswer = isset($_SESSION['objAnswer']) ? $_SESSION['objAnswer'] : null; |
|
126 | +$objAnswer = isset($_SESSION['objAnswer']) ? $_SESSION['objAnswer'] : null; |
|
127 | 127 | |
128 | 128 | // document path |
129 | 129 | $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (!empty($_GET['action']) && $_GET['action'] == 'exportqti2' && !empty($_GET['questionId'])) { |
149 | 149 | require_once 'export/qti2/qti2_export.php'; |
150 | 150 | $export = export_question_qti($_GET['questionId'], true); |
151 | - $qid = (int)$_GET['questionId']; |
|
151 | + $qid = (int) $_GET['questionId']; |
|
152 | 152 | $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
153 | 153 | $temp_dir_short = uniqid(); |
154 | 154 | $temp_zip_dir = $archive_path."/".$temp_dir_short; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if (!$fromExercise) { |
195 | 195 | // gets the right exercise ID, and if 0 creates a new exercise |
196 | 196 | if (!$exerciseId = $objExercise->selectId()) { |
197 | - $modifyExercise='yes'; |
|
197 | + $modifyExercise = 'yes'; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | exit(); |
245 | 245 | } else { |
246 | 246 | // goes back to the question viewing |
247 | - $editQuestion=$modifyQuestion; |
|
248 | - unset($newQuestion,$modifyQuestion); |
|
247 | + $editQuestion = $modifyQuestion; |
|
248 | + unset($newQuestion, $modifyQuestion); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | // if cancelling answer creation/modification |
273 | 273 | if ($cancelAnswers) { |
274 | 274 | // goes back to the question viewing |
275 | - $editQuestion=$modifyAnswers; |
|
275 | + $editQuestion = $modifyAnswers; |
|
276 | 276 | unset($modifyAnswers); |
277 | 277 | } |
278 | 278 | $nameTools = null; |
@@ -281,27 +281,27 @@ discard block |
||
281 | 281 | $nameTools = get_lang('QuestionManagement'); |
282 | 282 | } |
283 | 283 | |
284 | -if (isset($_SESSION['gradebook'])){ |
|
285 | - $gradebook= $_SESSION['gradebook']; |
|
284 | +if (isset($_SESSION['gradebook'])) { |
|
285 | + $gradebook = $_SESSION['gradebook']; |
|
286 | 286 | } |
287 | 287 | |
288 | -if (!empty($gradebook) && $gradebook=='view') { |
|
289 | - $interbreadcrumb[]= array( |
|
288 | +if (!empty($gradebook) && $gradebook == 'view') { |
|
289 | + $interbreadcrumb[] = array( |
|
290 | 290 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
291 | 291 | 'name' => get_lang('ToolGradebook') |
292 | 292 | ); |
293 | 293 | } |
294 | 294 | |
295 | -$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises')); |
|
296 | -if (isset($_GET['newQuestion']) || isset($_GET['editQuestion']) ) { |
|
295 | +$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); |
|
296 | +if (isset($_GET['newQuestion']) || isset($_GET['editQuestion'])) { |
|
297 | 297 | $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$objExercise->id, "name" => $objExercise->name); |
298 | 298 | } else { |
299 | 299 | $interbreadcrumb[] = array("url" => "#", "name" => $objExercise->name); |
300 | 300 | } |
301 | 301 | |
302 | 302 | // shows a link to go back to the question pool |
303 | -if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')){ |
|
304 | - $interbreadcrumb[]=array( |
|
303 | +if (!$exerciseId && $nameTools != get_lang('ExerciseManagement')) { |
|
304 | + $interbreadcrumb[] = array( |
|
305 | 305 | "url" => api_get_path(WEB_CODE_PATH)."exercice/question_pool.php?fromExercise=$fromExercise&".api_get_cidreq(), |
306 | 306 | "name" => get_lang('QuestionPool') |
307 | 307 | ); |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | |
310 | 310 | // if the question is duplicated, disable the link of tool name |
311 | 311 | if ($modifyIn == 'thisExercise') { |
312 | - if($buttonBack) { |
|
313 | - $modifyIn='allExercises'; |
|
312 | + if ($buttonBack) { |
|
313 | + $modifyIn = 'allExercises'; |
|
314 | 314 | } else { |
315 | - $noPHP_SELF=true; |
|
315 | + $noPHP_SELF = true; |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | $htmlHeadXtra[] = '<script> |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | $htmlHeadXtra[] = $template->fetch('default/exercise/submit.js.tpl'); |
345 | 345 | $htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js'); |
346 | 346 | |
347 | -$htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
|
348 | -$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/js/hotspot.js"></script>'; |
|
347 | +$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/css/hotspot.css">'; |
|
348 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
349 | 349 | |
350 | -Display::display_header($nameTools,'Exercise'); |
|
350 | +Display::display_header($nameTools, 'Exercise'); |
|
351 | 351 | /* |
352 | 352 | if ($objExercise->exercise_was_added_in_lp) { |
353 | 353 | if ($objExercise->force_edit_exercise_in_lp == true) { |
@@ -364,22 +364,22 @@ discard block |
||
364 | 364 | echo '<div class="actions">'; |
365 | 365 | if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) |
366 | 366 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
367 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
367 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
368 | 368 | |
369 | - if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
|
369 | + if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
|
370 | 370 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidReq().'">'. |
371 | - Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
371 | + Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
372 | 372 | } |
373 | 373 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/overview.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&preview=1">'. |
374 | - Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
374 | + Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
375 | 375 | |
376 | 376 | echo Display::url( |
377 | - Display::return_icon('test_results.png', get_lang('Results'),'',ICON_SIZE_MEDIUM), |
|
377 | + Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_MEDIUM), |
|
378 | 378 | api_get_path(WEB_CODE_PATH).'exercice/exercise_report.php?'.api_get_cidReq().'&exerciseId='.$objExercise->id |
379 | 379 | ); |
380 | 380 | |
381 | 381 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
382 | - Display::return_icon('settings.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
382 | + Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
383 | 383 | |
384 | 384 | $maxScoreAllQuestions = 0; |
385 | 385 | if (!empty($objExercise->questionList)) { |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | // we are in create a new question from question pool not in a test |
398 | 398 | echo '<div class="actions">'; |
399 | 399 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'">'. |
400 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
400 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
401 | 401 | echo '</div>'; |
402 | 402 | } else { |
403 | 403 | // If we are in question_pool but not in an test, go back to question create in pool |
404 | 404 | echo '<div class="actions">'; |
405 | 405 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/question_pool.php?'.api_get_cidreq().'">'. |
406 | - Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM). |
|
406 | + Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM). |
|
407 | 407 | '</a>'; |
408 | 408 | echo '</div>'; |
409 | 409 | } |
@@ -362,9 +362,10 @@ |
||
362 | 362 | |
363 | 363 | if ($inATest) { |
364 | 364 | echo '<div class="actions">'; |
365 | - if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) |
|
366 | - echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
|
365 | + if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) { |
|
366 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidReq().'">'. |
|
367 | 367 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
368 | + } |
|
368 | 369 | |
369 | 370 | if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) && !isset($_GET['editQuestion'])) { |
370 | 371 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise.php?'.api_get_cidReq().'">'. |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | for ($i = 1; $i <= $answer->nbrAnswers; $i++) { |
68 | 68 | if ($answer->isCorrect($i)) { |
69 | 69 | $nb_matches++; |
70 | - $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i); |
|
71 | - $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1); |
|
72 | - $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i]; |
|
70 | + $defaults['answer['.$nb_matches.']'] = $answer->selectAnswer($i); |
|
71 | + $defaults['weighting['.$nb_matches.']'] = float_format($answer->selectWeighting($i), 1); |
|
72 | + $defaults['matches['.$nb_matches.']'] = $answer->correct[$i]; |
|
73 | 73 | } else { |
74 | 74 | $nb_options++; |
75 | - $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i); |
|
75 | + $defaults['option['.$nb_options.']'] = $answer->selectAnswer($i); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | $html = '<table class="table table-striped table-hover"> |
104 | 104 | <thead> |
105 | 105 | <tr> |
106 | - <th width="10">' . get_lang('Number') . '</th> |
|
107 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
108 | - <th width="15%">' . get_lang('MatchesTo') . '</th> |
|
109 | - <th width="10">' . get_lang('Weighting') . '</th> |
|
106 | + <th width="10">' . get_lang('Number').'</th> |
|
107 | + <th width="85%">' . get_lang('Answer').'</th> |
|
108 | + <th width="15%">' . get_lang('MatchesTo').'</th> |
|
109 | + <th width="10">' . get_lang('Weighting').'</th> |
|
110 | 110 | </tr> |
111 | 111 | </thead> |
112 | 112 | <tbody>'; |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | $html = '<table class="table table-striped table-hover"> |
155 | 155 | <thead> |
156 | 156 | <tr> |
157 | - <th width="15%">' . get_lang('Number') . '</th> |
|
158 | - <th width="85%">' . get_lang('Answer') . '</th> |
|
157 | + <th width="15%">' . get_lang('Number').'</th> |
|
158 | + <th width="85%">' . get_lang('Answer').'</th> |
|
159 | 159 | </tr> |
160 | 160 | </thead> |
161 | 161 | <tbody>'; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | $form->addHtml('<tr>'); |
179 | - $form->addHtml('<td>' . chr(64 + $i) . '</td>'); |
|
179 | + $form->addHtml('<td>'.chr(64 + $i).'</td>'); |
|
180 | 180 | $form->addText("option[$i]", null); |
181 | 181 | $form->addHtml('</tr>'); |
182 | 182 | } |
@@ -258,10 +258,10 @@ discard block |
||
258 | 258 | public function return_header($feedback_type = null, $counter = null, $score = null) |
259 | 259 | { |
260 | 260 | $header = parent::return_header($feedback_type, $counter, $score); |
261 | - $header .= '<table class="' . $this->question_table_class . '"> |
|
261 | + $header .= '<table class="'.$this->question_table_class.'"> |
|
262 | 262 | <tr> |
263 | - <th>' . get_lang('ElementList') . '</th> |
|
264 | - <th>' . get_lang('CorrespondsTo') . '</th> |
|
263 | + <th>' . get_lang('ElementList').'</th> |
|
264 | + <th>' . get_lang('CorrespondsTo').'</th> |
|
265 | 265 | </tr>'; |
266 | 266 | |
267 | 267 | return $header; |