@@ -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 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | if (!$objExercise->read($exerciseId) || |
115 | 115 | (!$objExercise->selectStatus() && !$is_allowedToEdit && $origin != 'learnpath') |
116 | 116 | ) { |
117 | - if ($debug) {error_log('1.1. Error while reading the exercise'); }; |
|
117 | + if ($debug) {error_log('1.1. Error while reading the exercise'); }; |
|
118 | 118 | unset ($objExercise); |
119 | 119 | $error = get_lang('ExerciseNotFound'); |
120 | 120 | } else { |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | |
129 | 129 | //2. Checking if $objExercise is set |
130 | 130 | if (!isset($objExercise) && isset($_SESSION['objExercise'])) { |
131 | - if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
131 | + if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
132 | 132 | $objExercise = $_SESSION['objExercise']; |
133 | 133 | } |
134 | 134 | |
135 | 135 | //3. $objExercise is not set, then return to the exercise list |
136 | 136 | if (!is_object($objExercise)) { |
137 | - if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
137 | + if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
138 | 138 | header('Location: exercise.php'); |
139 | 139 | exit; |
140 | 140 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $time_control = false; |
156 | 156 | if ($objExercise->expired_time != 0) { |
157 | - $time_control = true; |
|
157 | + $time_control = true; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | // Generating the time control key for the user |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp; |
164 | 164 | |
165 | 165 | if ($time_control) { |
166 | - // Get the expired time of the current exercise in track_e_exercises |
|
167 | - $total_seconds = $objExercise->expired_time*60; |
|
166 | + // Get the expired time of the current exercise in track_e_exercises |
|
167 | + $total_seconds = $objExercise->expired_time*60; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $show_clock = true; |
171 | 171 | $user_id = api_get_user_id(); |
172 | 172 | if ($objExercise->selectAttempts() > 0) { |
173 | - $attempt_html = ''; |
|
173 | + $attempt_html = ''; |
|
174 | 174 | $attempt_count = Event::get_attempt_count( |
175 | 175 | $user_id, |
176 | 176 | $exerciseId, |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | $learnpath_item_view_id |
180 | 180 | ); |
181 | 181 | |
182 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
183 | - $show_clock = false; |
|
184 | - if (!api_is_allowed_to_edit(null,true)) { |
|
182 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
183 | + $show_clock = false; |
|
184 | + if (!api_is_allowed_to_edit(null,true)) { |
|
185 | 185 | if ($objExercise->results_disabled == 0 && $origin != 'learnpath') { |
186 | 186 | |
187 | 187 | // Showing latest attempt according with task BT#1628 |
@@ -220,29 +220,29 @@ discard block |
||
220 | 220 | $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore')); |
221 | 221 | } |
222 | 222 | } |
223 | - $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
224 | - $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
225 | - } else { |
|
226 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
227 | - } |
|
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 | - } |
|
223 | + $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
224 | + $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
225 | + } else { |
|
226 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
227 | + } |
|
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 | 234 | |
235 | - if ($origin == 'learnpath') { |
|
236 | - Display :: display_reduced_header(); |
|
237 | - } else { |
|
238 | - Display :: display_header($nameTools,'Exercises'); |
|
239 | - } |
|
235 | + if ($origin == 'learnpath') { |
|
236 | + Display :: display_reduced_header(); |
|
237 | + } else { |
|
238 | + Display :: display_header($nameTools,'Exercises'); |
|
239 | + } |
|
240 | 240 | |
241 | - echo $attempt_html; |
|
242 | - if ($origin != 'learnpath') |
|
243 | - Display :: display_footer(); |
|
244 | - exit; |
|
245 | - } |
|
241 | + echo $attempt_html; |
|
242 | + if ($origin != 'learnpath') |
|
243 | + Display :: display_footer(); |
|
244 | + exit; |
|
245 | + } |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | if ($debug) { |
@@ -261,26 +261,26 @@ discard block |
||
261 | 261 | |
262 | 262 | if (empty($exercise_stat_info)) { |
263 | 263 | if ($debug) error_log('5 $exercise_stat_info is empty '); |
264 | - $total_weight = 0; |
|
265 | - $questionList = $objExercise->get_validated_question_list(); |
|
266 | - foreach ($questionList as $question_id) { |
|
267 | - $objQuestionTmp = Question::read($question_id); |
|
268 | - $total_weight += floatval($objQuestionTmp->weighting); |
|
269 | - } |
|
264 | + $total_weight = 0; |
|
265 | + $questionList = $objExercise->get_validated_question_list(); |
|
266 | + foreach ($questionList as $question_id) { |
|
267 | + $objQuestionTmp = Question::read($question_id); |
|
268 | + $total_weight += floatval($objQuestionTmp->weighting); |
|
269 | + } |
|
270 | 270 | |
271 | - if ($time_control) { |
|
272 | - $expected_time = $current_timestamp + $total_seconds; |
|
271 | + if ($time_control) { |
|
272 | + $expected_time = $current_timestamp + $total_seconds; |
|
273 | 273 | |
274 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
275 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
274 | + if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
275 | + if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
276 | 276 | |
277 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
278 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
277 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
278 | + if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
279 | 279 | |
280 | - //Sessions that contain the expired time |
|
281 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
282 | - if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
283 | - } |
|
280 | + //Sessions that contain the expired time |
|
281 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
282 | + if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
283 | + } |
|
284 | 284 | |
285 | 285 | $exe_id = $objExercise->save_stat_track_exercise_info( |
286 | 286 | $clock_expired_time, |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | ); |
298 | 298 | if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
299 | 299 | } else { |
300 | - $exe_id = $exercise_stat_info['exe_id']; |
|
300 | + $exe_id = $exercise_stat_info['exe_id']; |
|
301 | 301 | // Remember last question id position. |
302 | 302 | $isFirstTime = Session::read('firstTime'); |
303 | 303 | if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) { |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called:: '.print_r($exercise_stat_info, 1)); }; |
328 | 328 | |
329 | 329 | if (!empty($exercise_stat_info['questions_to_check'])) { |
330 | - $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
331 | - $my_remind_list = explode(',', $my_remind_list); |
|
332 | - $my_remind_list = array_filter($my_remind_list); |
|
330 | + $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
331 | + $my_remind_list = explode(',', $my_remind_list); |
|
332 | + $my_remind_list = array_filter($my_remind_list); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | $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(); |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | |
338 | 338 | if ($reminder == 2 && empty($my_remind_list)) { |
339 | 339 | if ($debug) { error_log("6.2 calling the exercise_reminder.php "); }; |
340 | - header('Location: exercise_reminder.php?'.$params); |
|
341 | - exit; |
|
340 | + header('Location: exercise_reminder.php?'.$params); |
|
341 | + exit; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /* |
@@ -346,56 +346,56 @@ discard block |
||
346 | 346 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
347 | 347 | */ |
348 | 348 | 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]); |
|
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]); |
|
352 | 352 | |
353 | 353 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
354 | 354 | //Timer - Get expired_time for a student |
355 | 355 | if (!empty($exercise_stat_info)) { |
356 | - if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
357 | - $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
358 | - if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
359 | - // Get the last attempt of an exercise |
|
360 | - $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
356 | + if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
357 | + $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
358 | + if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
359 | + // Get the last attempt of an exercise |
|
360 | + $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
361 | 361 | |
362 | - /* This means that the user enters the exam but do not answer the |
|
362 | + /* This means that the user enters the exam but do not answer the |
|
363 | 363 | first question we get the date from the track_e_exercises not from |
364 | 364 | the track_et_attempt see #2069 */ |
365 | - if (empty($last_attempt_date)) { |
|
366 | - $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
367 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
368 | - } else { |
|
369 | - //Recalculate the time control due #2069 |
|
370 | - $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
371 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
372 | - } |
|
373 | - if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
374 | - |
|
375 | - //New expired time - it is due to the possible closure of session |
|
376 | - $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
377 | - if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
378 | - |
|
379 | - $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
380 | - if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
381 | - |
|
382 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
383 | - if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
384 | - |
|
385 | - // First we update the attempt to today |
|
386 | - /* How the expired time is changed into "track_e_exercises" table, |
|
365 | + if (empty($last_attempt_date)) { |
|
366 | + $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
367 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
368 | + } else { |
|
369 | + //Recalculate the time control due #2069 |
|
370 | + $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
371 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
372 | + } |
|
373 | + if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
374 | + |
|
375 | + //New expired time - it is due to the possible closure of session |
|
376 | + $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
377 | + if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
378 | + |
|
379 | + $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
380 | + if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
381 | + |
|
382 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
383 | + if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
384 | + |
|
385 | + // First we update the attempt to today |
|
386 | + /* How the expired time is changed into "track_e_exercises" table, |
|
387 | 387 | then the last attempt for this student should be changed too */ |
388 | - $sql = "UPDATE $exercise_attempt_table SET |
|
388 | + $sql = "UPDATE $exercise_attempt_table SET |
|
389 | 389 | tms = '".api_get_utc_datetime()."' |
390 | 390 | WHERE |
391 | 391 | exe_id = '".$exercise_stat_info['exe_id']."' AND |
392 | 392 | tms = '".$last_attempt_date."' "; |
393 | - if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
394 | - Database::query($sql); |
|
393 | + if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
394 | + Database::query($sql); |
|
395 | 395 | |
396 | - //Sessions that contain the expired time |
|
397 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
398 | - if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
396 | + //Sessions that contain the expired time |
|
397 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
398 | + if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
399 | 399 | } |
400 | 400 | } else { |
401 | 401 | $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock |
413 | 413 | */ |
414 | 414 | if ($time_control) { //Sends the exercise form when the expired time is finished |
415 | - $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
415 | + $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | // if the user has submitted the form |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | // selects the list of question ID |
427 | 427 | $questionList = $objExercise->get_validated_question_list(); |
428 | 428 | if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) { |
429 | - $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
429 | + $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
430 | 430 | } |
431 | 431 | Session::write('questionList', $questionList); |
432 | 432 | if ($debug > 0) { error_log('$_SESSION[questionList] was set'); } |
433 | 433 | } else { |
434 | - if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
435 | - $questionList = $_SESSION['questionList']; |
|
436 | - } |
|
434 | + if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
435 | + $questionList = $_SESSION['questionList']; |
|
436 | + } |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | //Real question count |
442 | 442 | $question_count = 0; |
443 | 443 | if (!empty($questionList)) { |
444 | - $question_count = count($questionList); |
|
444 | + $question_count = count($questionList); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | if ($formSent && isset($_POST)) { |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | //saving each question |
484 | 484 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) { |
485 | 485 | $nro_question = $current_question; // - 1; |
486 | - $questionId = $key; |
|
486 | + $questionId = $key; |
|
487 | 487 | // gets the student choice for this question |
488 | 488 | $choice = $exerciseResult[$questionId]; |
489 | 489 | if (isset($exe_id)) { |
490 | - // Manage the question and answer attempts |
|
490 | + // Manage the question and answer attempts |
|
491 | 491 | if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); } |
492 | 492 | $objExercise->manage_answer( |
493 | 493 | $exe_id, |
@@ -573,58 +573,58 @@ discard block |
||
573 | 573 | } |
574 | 574 | |
575 | 575 | if ($question_count != 0) { |
576 | - if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
576 | + if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
577 | 577 | $current_question > $question_count) |
578 | 578 | ) { |
579 | - if (api_is_allowed_to_session_edit()) { |
|
580 | - // goes to the script that will show the result of the exercise |
|
581 | - if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
582 | - if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
583 | - |
|
584 | - //We check if the user attempts before sending to the exercise_result.php |
|
585 | - if ($objExercise->selectAttempts() > 0) { |
|
586 | - $attempt_count = Event::get_attempt_count( |
|
579 | + if (api_is_allowed_to_session_edit()) { |
|
580 | + // goes to the script that will show the result of the exercise |
|
581 | + if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
582 | + if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
583 | + |
|
584 | + //We check if the user attempts before sending to the exercise_result.php |
|
585 | + if ($objExercise->selectAttempts() > 0) { |
|
586 | + $attempt_count = Event::get_attempt_count( |
|
587 | 587 | api_get_user_id(), |
588 | 588 | $exerciseId, |
589 | 589 | $learnpath_id, |
590 | 590 | $learnpath_item_id, |
591 | 591 | $learnpath_item_view_id |
592 | 592 | ); |
593 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
594 | - Display :: display_warning_message( |
|
593 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
594 | + Display :: display_warning_message( |
|
595 | 595 | sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), |
596 | 596 | false |
597 | 597 | ); |
598 | - if ($origin != 'learnpath') { |
|
599 | - //so we are not in learnpath tool |
|
600 | - echo '</div>'; //End glossary div |
|
601 | - Display :: display_footer(); |
|
602 | - } else { |
|
603 | - echo '</body></html>'; |
|
604 | - } |
|
605 | - exit; |
|
606 | - } |
|
607 | - } |
|
608 | - } else { |
|
609 | - if ($objExercise->review_answers) { |
|
610 | - header('Location: exercise_reminder.php?'.$params); |
|
611 | - exit; |
|
612 | - } else { |
|
598 | + if ($origin != 'learnpath') { |
|
599 | + //so we are not in learnpath tool |
|
600 | + echo '</div>'; //End glossary div |
|
601 | + Display :: display_footer(); |
|
602 | + } else { |
|
603 | + echo '</body></html>'; |
|
604 | + } |
|
605 | + exit; |
|
606 | + } |
|
607 | + } |
|
608 | + } else { |
|
609 | + if ($objExercise->review_answers) { |
|
610 | + header('Location: exercise_reminder.php?'.$params); |
|
611 | + exit; |
|
612 | + } else { |
|
613 | 613 | 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"); |
614 | 614 | exit; |
615 | - } |
|
616 | - } |
|
617 | - } else { |
|
618 | - if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
619 | - exit; |
|
620 | - } |
|
621 | - } |
|
615 | + } |
|
616 | + } |
|
617 | + } else { |
|
618 | + if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
619 | + exit; |
|
620 | + } |
|
621 | + } |
|
622 | 622 | } else { |
623 | - $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
624 | - // if we are in the case where user select random by category, but didn't choose the number of random question |
|
625 | - if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
626 | - $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
627 | - } |
|
623 | + $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
624 | + // if we are in the case where user select random by category, but didn't choose the number of random question |
|
625 | + if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
626 | + $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
627 | + } |
|
628 | 628 | } |
629 | 629 | |
630 | 630 | if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
@@ -658,9 +658,9 @@ discard block |
||
658 | 658 | if (api_is_course_admin() && $origin != 'learnpath') { |
659 | 659 | echo '<div class="actions">'; |
660 | 660 | if ($show_quiz_edition == false) { |
661 | - 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>'; |
|
661 | + 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>'; |
|
662 | 662 | } else { |
663 | - echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
663 | + echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
664 | 664 | } |
665 | 665 | echo '</div>'; |
666 | 666 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet'); |
704 | 704 | Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts())); |
705 | 705 | if ($origin != 'learnpath') { |
706 | - Display :: display_footer(); |
|
706 | + Display :: display_footer(); |
|
707 | 707 | } |
708 | 708 | exit; |
709 | 709 | } else { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | if (isset($_custom['exercises_hidden_when_no_start_date']) && |
719 | 719 | $_custom['exercises_hidden_when_no_start_date'] |
720 | 720 | ) { |
721 | - if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
721 | + if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
722 | 722 | Display:: display_warning_message( |
723 | 723 | sprintf( |
724 | 724 | get_lang('ExerciseNoStartedYet'), |
@@ -726,20 +726,20 @@ discard block |
||
726 | 726 | $objExercise->selectAttempts() |
727 | 727 | ) |
728 | 728 | ); |
729 | - if ($origin != 'learnpath') { |
|
730 | - Display :: display_footer(); |
|
731 | - } |
|
732 | - } |
|
729 | + if ($origin != 'learnpath') { |
|
730 | + Display :: display_footer(); |
|
731 | + } |
|
732 | + } |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | //Timer control |
736 | 736 | if ($time_control) { |
737 | 737 | echo $objExercise->return_time_left_div(); |
738 | - echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
738 | + echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
739 | 739 | } |
740 | 740 | |
741 | 741 | if ($origin != 'learnpath') { |
742 | - echo '<div id="highlight-plugin" class="glossary-content">'; |
|
742 | + echo '<div id="highlight-plugin" class="glossary-content">'; |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | if ($reminder == 2) { |
@@ -751,53 +751,53 @@ discard block |
||
751 | 751 | $current_question = 1; //set by default the 1st question |
752 | 752 | |
753 | 753 | if (!empty($my_remind_list)) { |
754 | - //Checking which questions we are going to call from the remind list |
|
755 | - for ($i = 0; $i < count($data_tracking); $i++) { |
|
756 | - for($j = 0; $j < count($my_remind_list); $j++) { |
|
757 | - |
|
758 | - if (!empty($remind_question_id)) { |
|
759 | - if ($remind_question_id == $my_remind_list[$j]) { |
|
760 | - |
|
761 | - if ($remind_question_id == $data_tracking[$i]) { |
|
762 | - if (isset($my_remind_list[$j+1])) { |
|
763 | - $remind_question_id = $my_remind_list[$j+1]; |
|
764 | - $current_question = $i + 1; |
|
765 | - } else { |
|
754 | + //Checking which questions we are going to call from the remind list |
|
755 | + for ($i = 0; $i < count($data_tracking); $i++) { |
|
756 | + for($j = 0; $j < count($my_remind_list); $j++) { |
|
757 | + |
|
758 | + if (!empty($remind_question_id)) { |
|
759 | + if ($remind_question_id == $my_remind_list[$j]) { |
|
760 | + |
|
761 | + if ($remind_question_id == $data_tracking[$i]) { |
|
762 | + if (isset($my_remind_list[$j+1])) { |
|
763 | + $remind_question_id = $my_remind_list[$j+1]; |
|
764 | + $current_question = $i + 1; |
|
765 | + } else { |
|
766 | 766 | // We end the remind list we go to the exercise_reminder.php please |
767 | - $remind_question_id = -1; |
|
768 | - $current_question = $i + 1; // last question |
|
769 | - } |
|
770 | - break 2; |
|
771 | - } |
|
772 | - } |
|
773 | - } else { |
|
774 | - if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
775 | - if (isset($my_remind_list[$j+1])) { |
|
776 | - $remind_question_id = $my_remind_list[$j+1]; |
|
777 | - $current_question = $i + 1; // last question |
|
778 | - } else { |
|
767 | + $remind_question_id = -1; |
|
768 | + $current_question = $i + 1; // last question |
|
769 | + } |
|
770 | + break 2; |
|
771 | + } |
|
772 | + } |
|
773 | + } else { |
|
774 | + if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
775 | + if (isset($my_remind_list[$j+1])) { |
|
776 | + $remind_question_id = $my_remind_list[$j+1]; |
|
777 | + $current_question = $i + 1; // last question |
|
778 | + } else { |
|
779 | 779 | // We end the remind list we go to the exercise_reminder.php please |
780 | - $remind_question_id = -1; |
|
781 | - $current_question = $i + 1; // last question |
|
782 | - } |
|
783 | - break 2; |
|
784 | - } |
|
785 | - } |
|
786 | - } |
|
780 | + $remind_question_id = -1; |
|
781 | + $current_question = $i + 1; // last question |
|
782 | + } |
|
783 | + break 2; |
|
784 | + } |
|
785 | + } |
|
786 | + } |
|
787 | 787 | } |
788 | 788 | } else { |
789 | - if ($objExercise->review_answers) { |
|
789 | + if ($objExercise->review_answers) { |
|
790 | 790 | if ($debug) { error_log('. redirecting to exercise_reminder.php '); } |
791 | - header("Location: exercise_reminder.php?$params"); |
|
792 | - exit; |
|
793 | - } |
|
791 | + header("Location: exercise_reminder.php?$params"); |
|
792 | + exit; |
|
793 | + } |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | 797 | if ($objExercise->review_answers) { |
798 | - $script_php = 'exercise_reminder.php'; |
|
798 | + $script_php = 'exercise_reminder.php'; |
|
799 | 799 | } else { |
800 | - $script_php = 'exercise_result.php'; |
|
800 | + $script_php = 'exercise_result.php'; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | if (!empty($error)) { |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id . '" /> |
1038 | 1038 | <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />'; |
1039 | 1039 | |
1040 | - // Show list of questions |
|
1040 | + // Show list of questions |
|
1041 | 1041 | $i = 1; |
1042 | 1042 | |
1043 | 1043 | $attempt_list = array(); |
@@ -1089,10 +1089,10 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | $attributes = array('id' =>'remind_list['.$questionId.']'); |
1091 | 1091 | if (in_array($questionId, $remind_list)) { |
1092 | - $is_remind_on = true; |
|
1093 | - $attributes['checked'] = 1; |
|
1094 | - $remind_question = true; |
|
1095 | - $remind_highlight = ' remind_highlight '; |
|
1092 | + $is_remind_on = true; |
|
1093 | + $attributes['checked'] = 1; |
|
1094 | + $remind_question = true; |
|
1095 | + $remind_highlight = ' remind_highlight '; |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | // Showing the question |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | } |
1153 | 1153 | // end foreach() |
1154 | 1154 | if ($objExercise->type == ALL_ON_ONE_PAGE) { |
1155 | - $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1156 | - echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1155 | + $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1156 | + echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1157 | 1157 | echo '<br>'; |
1158 | 1158 | } |
1159 | 1159 | echo '</form>'; |
@@ -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 | } |
@@ -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() { |
@@ -344,7 +344,7 @@ |
||
344 | 344 | if (is_dir($full_name)) { |
345 | 345 | $filelist[] = $file; |
346 | 346 | } |
347 | - } |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class UniqueAnswerNoOption extends Question |
14 | 14 | { |
15 | - static $typePicture = 'mcuao.png'; |
|
16 | - static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
15 | + static $typePicture = 'mcuao.png'; |
|
16 | + static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor |
|
20 | - */ |
|
21 | - public function __construct() |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | 22 | { |
23 | - //this is highly important |
|
24 | - parent::__construct(); |
|
25 | - $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | - $this -> isContent = $this-> getIsContent(); |
|
27 | - } |
|
23 | + //this is highly important |
|
24 | + parent::__construct(); |
|
25 | + $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | + $this -> isContent = $this-> getIsContent(); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * function which redifines Question::createAnswersForm |
31 | 31 | * @param the formvalidator instance |
32 | 32 | * @param the answers number to display |
@@ -283,37 +283,37 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * Function which creates the form to create / edit the answers of the question |
|
287 | - * @param the formvalidator instance |
|
288 | - * @param the answers number to display |
|
289 | - */ |
|
290 | - function processAnswersCreation($form) |
|
286 | + * Function which creates the form to create / edit the answers of the question |
|
287 | + * @param the formvalidator instance |
|
288 | + * @param the answers number to display |
|
289 | + */ |
|
290 | + function processAnswersCreation($form) |
|
291 | 291 | { |
292 | - $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | - $correct = $form -> getSubmitValue('correct'); |
|
294 | - $objAnswer = new Answer($this->id); |
|
295 | - $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | - $minus = 1; |
|
297 | - if ($form -> getSubmitValue('new_question')) { |
|
298 | - $minus = 0; |
|
299 | - } |
|
300 | - |
|
301 | - for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | - $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | - $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
292 | + $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | + $correct = $form -> getSubmitValue('correct'); |
|
294 | + $objAnswer = new Answer($this->id); |
|
295 | + $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | + $minus = 1; |
|
297 | + if ($form -> getSubmitValue('new_question')) { |
|
298 | + $minus = 0; |
|
299 | + } |
|
300 | + |
|
301 | + for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | + $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | + $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
304 | 304 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
305 | 305 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
306 | 306 | $scenario = $form -> getSubmitValue('scenario'); |
307 | 307 | |
308 | - //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | - //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
308 | + //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | + //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
310 | 310 | |
311 | - $try = $scenario['try'.$i]; |
|
311 | + $try = $scenario['try'.$i]; |
|
312 | 312 | $lp = $scenario['lp'.$i]; |
313 | - $destination = $scenario['destination'.$i]; |
|
314 | - $url = trim($scenario['url'.$i]); |
|
313 | + $destination = $scenario['destination'.$i]; |
|
314 | + $url = trim($scenario['url'.$i]); |
|
315 | 315 | |
316 | - /* |
|
316 | + /* |
|
317 | 317 | How we are going to parse the destination value |
318 | 318 | |
319 | 319 | here we parse the destination value which is a string |
@@ -326,41 +326,41 @@ discard block |
||
326 | 326 | selected_questions= ids of questions |
327 | 327 | url= an url |
328 | 328 | */ |
329 | - /* |
|
329 | + /* |
|
330 | 330 | $destination_str=''; |
331 | 331 | foreach ($list_destination as $destination_id) |
332 | 332 | { |
333 | 333 | $destination_str.=$destination_id.';'; |
334 | 334 | }*/ |
335 | 335 | |
336 | - $goodAnswer= ($correct == $i) ? true : false; |
|
336 | + $goodAnswer= ($correct == $i) ? true : false; |
|
337 | 337 | |
338 | - if ($goodAnswer) { |
|
339 | - $nbrGoodAnswers++; |
|
340 | - $weighting = abs($weighting); |
|
341 | - if($weighting > 0) { |
|
338 | + if ($goodAnswer) { |
|
339 | + $nbrGoodAnswers++; |
|
340 | + $weighting = abs($weighting); |
|
341 | + if($weighting > 0) { |
|
342 | 342 | $questionWeighting += $weighting; |
343 | 343 | } |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
346 | + if (empty($try)) |
|
347 | + $try=0; |
|
348 | 348 | |
349 | - if (empty($lp)) { |
|
350 | - $lp=0; |
|
351 | - } |
|
349 | + if (empty($lp)) { |
|
350 | + $lp=0; |
|
351 | + } |
|
352 | 352 | |
353 | - if (empty($destination)) { |
|
354 | - $destination=0; |
|
355 | - } |
|
353 | + if (empty($destination)) { |
|
354 | + $destination=0; |
|
355 | + } |
|
356 | 356 | |
357 | - if ($url=='') { |
|
358 | - $url=0; |
|
359 | - } |
|
357 | + if ($url=='') { |
|
358 | + $url=0; |
|
359 | + } |
|
360 | 360 | |
361 | - //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | - $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
361 | + //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | + $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | + $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | //Create 666 answer |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | |
374 | 374 | $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
375 | 375 | |
376 | - // saves the answers into the data base |
|
376 | + // saves the answers into the data base |
|
377 | 377 | $objAnswer -> save(); |
378 | 378 | |
379 | 379 | // sets the total weighting of the question |
380 | 380 | $this -> updateWeighting($questionWeighting); |
381 | 381 | $this -> save(); |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
384 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
385 | 385 | { |
386 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
386 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
388 | 388 | <tr> |
389 | 389 | <th>'.get_lang("Choice").'</th> |
390 | 390 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -392,5 +392,5 @@ discard block |
||
392 | 392 | $header .= '<th>'.get_lang("Comment").'</th>'; |
393 | 393 | $header .= '</tr>'; |
394 | 394 | return $header; |
395 | - } |
|
395 | + } |
|
396 | 396 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | if (isset($_SESSION['gradebook'])){ |
175 | - $gradebook= $_SESSION['gradebook']; |
|
175 | + $gradebook= $_SESSION['gradebook']; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if (!empty($gradebook) && $gradebook=='view') { |
179 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); |
|
179 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // if admin of course |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | echo '</div>'; |
228 | 228 | |
229 | 229 | if ($displayMessage != "") { |
230 | - Display::display_confirmation_message($displayMessage); |
|
231 | - $displayMessage = ""; |
|
230 | + Display::display_confirmation_message($displayMessage); |
|
231 | + $displayMessage = ""; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | // Form |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | // Title |
237 | 237 | echo '<legend>'.$nameTools.' - '.$titleAdd.'</legend>'; |
238 | 238 | if (isset($type)) { |
239 | - echo '<input type="hidden" name="type" value="1">'; |
|
239 | + echo '<input type="hidden" name="type" value="1">'; |
|
240 | 240 | } |
241 | 241 | echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">'; |
242 | 242 | |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | foreach ($course_list as $item) { |
284 | 284 | $courseItemId = $item['real_id']; |
285 | 285 | $courseInfo = api_get_course_info_by_id($courseItemId); |
286 | - $course_select_list[$courseItemId] = ""; |
|
287 | - if ($courseItemId == api_get_course_int_id()) { |
|
288 | - $course_select_list[$courseItemId] = "> "; |
|
289 | - } |
|
290 | - $course_select_list[$courseItemId] .= $courseInfo['title']; |
|
286 | + $course_select_list[$courseItemId] = ""; |
|
287 | + if ($courseItemId == api_get_course_int_id()) { |
|
288 | + $course_select_list[$courseItemId] = "> "; |
|
289 | + } |
|
290 | + $course_select_list[$courseItemId] .= $courseInfo['title']; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $select_course_html = Display::select( |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | // no course selected, reset menu test / difficult� / type de reponse |
305 | 305 | reset_menu_exo_lvl_type(); |
306 | 306 | } else { |
307 | - $course_info = api_get_course_info_by_id($selected_course); |
|
307 | + $course_info = api_get_course_info_by_id($selected_course); |
|
308 | 308 | } |
309 | 309 | // If course has changed, reset the menu default |
310 | 310 | if ($course_id_changed) { |
311 | - reset_menu_exo_lvl_type(); |
|
311 | + reset_menu_exo_lvl_type(); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $course_id = $course_info['real_id']; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | if ($exercise_id_changed == 1) { |
359 | - reset_menu_lvl_type(); |
|
359 | + reset_menu_lvl_type(); |
|
360 | 360 | } |
361 | 361 | $select_exercise_html = Display::select( |
362 | 362 | 'exerciseId', |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | // if we have selected an exercise in the list-box 'Filter' |
435 | 435 | |
436 | 436 | if ($exerciseId > 0) { |
437 | - $where = ''; |
|
438 | - $from = ''; |
|
439 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
440 | - $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
441 | - $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId"; |
|
442 | - } |
|
443 | - if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
444 | - $where .= ' AND level='.$exerciseLevel; |
|
445 | - } |
|
446 | - if (isset($answerType) && $answerType > 0) { |
|
447 | - $where .= ' AND type='.$answerType; |
|
448 | - } |
|
449 | - $sql = "SELECT DISTINCT |
|
437 | + $where = ''; |
|
438 | + $from = ''; |
|
439 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
440 | + $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
441 | + $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId"; |
|
442 | + } |
|
443 | + if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
444 | + $where .= ' AND level='.$exerciseLevel; |
|
445 | + } |
|
446 | + if (isset($answerType) && $answerType > 0) { |
|
447 | + $where .= ' AND type='.$answerType; |
|
448 | + } |
|
449 | + $sql = "SELECT DISTINCT |
|
450 | 450 | id, |
451 | 451 | question, |
452 | 452 | type, |
@@ -468,22 +468,22 @@ discard block |
||
468 | 468 | $mainQuestionList[] = $row; |
469 | 469 | } |
470 | 470 | } elseif ($exerciseId == -1) { |
471 | - // If we have selected the option 'Orphan questions' in the list-box 'Filter' |
|
472 | - $level_where = ''; |
|
473 | - $from = ''; |
|
474 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
475 | - $from = " INNER JOIN $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id "; |
|
476 | - $level_where .= " AND |
|
471 | + // If we have selected the option 'Orphan questions' in the list-box 'Filter' |
|
472 | + $level_where = ''; |
|
473 | + $from = ''; |
|
474 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
475 | + $from = " INNER JOIN $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id "; |
|
476 | + $level_where .= " AND |
|
477 | 477 | crc.c_id = $selected_course AND |
478 | 478 | crc.category_id = $courseCategoryId"; |
479 | - } |
|
480 | - if (isset($exerciseLevel) && $exerciseLevel!= -1 ) { |
|
481 | - $level_where = ' AND level='.$exerciseLevel; |
|
482 | - } |
|
483 | - $answer_where = ''; |
|
484 | - if (isset($answerType) && $answerType >0 -1 ) { |
|
485 | - $answer_where = ' AND type='.$answerType; |
|
486 | - } |
|
479 | + } |
|
480 | + if (isset($exerciseLevel) && $exerciseLevel!= -1 ) { |
|
481 | + $level_where = ' AND level='.$exerciseLevel; |
|
482 | + } |
|
483 | + $answer_where = ''; |
|
484 | + if (isset($answerType) && $answerType >0 -1 ) { |
|
485 | + $answer_where = ' AND type='.$answerType; |
|
486 | + } |
|
487 | 487 | |
488 | 488 | // @todo fix this query with the new id field |
489 | 489 | $sql = " ( |
@@ -525,24 +525,24 @@ discard block |
||
525 | 525 | $mainQuestionList[] = $row; |
526 | 526 | } |
527 | 527 | } else { |
528 | - // All tests for selected course |
|
528 | + // All tests for selected course |
|
529 | 529 | // If we have not selected any option in the list-box 'Filter' |
530 | - $filter = ''; |
|
531 | - $from = ''; |
|
530 | + $filter = ''; |
|
531 | + $from = ''; |
|
532 | 532 | |
533 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
534 | - $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
535 | - $filter .= " AND |
|
533 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
534 | + $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
535 | + $filter .= " AND |
|
536 | 536 | crc.c_id = $selected_course AND |
537 | 537 | crc.question_id = qu.id AND |
538 | 538 | crc.category_id = $courseCategoryId"; |
539 | - } |
|
540 | - if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
541 | - $filter .= ' AND level='.$exerciseLevel.' '; |
|
542 | - } |
|
543 | - if (isset($answerType) && $answerType > 0) { |
|
544 | - $filter .= ' AND qu.type='.$answerType.' '; |
|
545 | - } |
|
539 | + } |
|
540 | + if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
541 | + $filter .= ' AND level='.$exerciseLevel.' '; |
|
542 | + } |
|
543 | + if (isset($answerType) && $answerType > 0) { |
|
544 | + $filter .= ' AND qu.type='.$answerType.' '; |
|
545 | + } |
|
546 | 546 | |
547 | 547 | if (!empty($session_id) && $session_id != '-1') { |
548 | 548 | $mainQuestionList = array(); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $mainQuestionList[] = $row; |
645 | 645 | } |
646 | 646 | } |
647 | - // forces the value to 0 |
|
647 | + // forces the value to 0 |
|
648 | 648 | $exerciseId = 0; |
649 | 649 | } |
650 | 650 | |
@@ -670,33 +670,33 @@ discard block |
||
670 | 670 | // |
671 | 671 | if ($fromExercise <= 0) { |
672 | 672 | // NOT IN A TEST - IN THE COURSE |
673 | - if ($selected_course == api_get_course_int_id()) { |
|
674 | - $actionLabel = get_lang('Modify'); |
|
675 | - $actionIcon1 = "edit"; |
|
676 | - $actionIcon2 = "delete"; |
|
673 | + if ($selected_course == api_get_course_int_id()) { |
|
674 | + $actionLabel = get_lang('Modify'); |
|
675 | + $actionIcon1 = "edit"; |
|
676 | + $actionIcon2 = "delete"; |
|
677 | 677 | // We are in the course, question title can be a link to the question edit page |
678 | - $questionTagA = 1; |
|
678 | + $questionTagA = 1; |
|
679 | 679 | } else { // NOT IN A TEST - NOT IN THE COURSE |
680 | - $actionLabel = get_lang('Reuse'); |
|
681 | - $actionIcon1 = get_lang('MustBeInATest'); |
|
682 | - $actionIcon2 = ""; |
|
680 | + $actionLabel = get_lang('Reuse'); |
|
681 | + $actionIcon1 = get_lang('MustBeInATest'); |
|
682 | + $actionIcon2 = ""; |
|
683 | 683 | // We are not in this course, to messy if we link to the question in another course |
684 | - $questionTagA = 0; |
|
685 | - } |
|
684 | + $questionTagA = 0; |
|
685 | + } |
|
686 | 686 | } else { |
687 | 687 | // IN A TEST - IN THE COURSE |
688 | - if ($selected_course == api_get_course_int_id()) { |
|
689 | - $actionLabel = get_lang('Reuse'); |
|
690 | - $actionIcon1 = "add"; |
|
691 | - $actionIcon2 = ""; |
|
692 | - $questionTagA = 1; |
|
688 | + if ($selected_course == api_get_course_int_id()) { |
|
689 | + $actionLabel = get_lang('Reuse'); |
|
690 | + $actionIcon1 = "add"; |
|
691 | + $actionIcon2 = ""; |
|
692 | + $questionTagA = 1; |
|
693 | 693 | } else { |
694 | 694 | // IN A TEST - NOT IN THE COURSE |
695 | - $actionLabel = get_lang('Reuse'); |
|
696 | - $actionIcon1 = "clone"; |
|
697 | - $actionIcon2 = ""; |
|
698 | - $questionTagA = 0; |
|
699 | - } |
|
695 | + $actionLabel = get_lang('Reuse'); |
|
696 | + $actionIcon1 = "clone"; |
|
697 | + $actionIcon2 = ""; |
|
698 | + $questionTagA = 0; |
|
699 | + } |
|
700 | 700 | } |
701 | 701 | // Display table |
702 | 702 | $header = array( |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | ); |
790 | 790 | |
791 | 791 | if (!$nbrQuestions) { |
792 | - echo get_lang('NoQuestion'); |
|
792 | + echo get_lang('NoQuestion'); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | Display::display_footer(); |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | */ |
802 | 802 | function reset_menu_lvl_type() |
803 | 803 | { |
804 | - global $exerciseLevel, $answerType; |
|
805 | - $answerType = -1; |
|
806 | - $exerciseLevel = -1; |
|
804 | + global $exerciseLevel, $answerType; |
|
805 | + $answerType = -1; |
|
806 | + $exerciseLevel = -1; |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | */ |
814 | 814 | function reset_menu_exo_lvl_type() |
815 | 815 | { |
816 | - global $exerciseId, $courseCategoryId; |
|
817 | - reset_menu_lvl_type(); |
|
818 | - $exerciseId = 0; |
|
819 | - $courseCategoryId = 0; |
|
816 | + global $exerciseId, $courseCategoryId; |
|
817 | + reset_menu_lvl_type(); |
|
818 | + $exerciseId = 0; |
|
819 | + $courseCategoryId = 0; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | /** |
@@ -838,17 +838,17 @@ discard block |
||
838 | 838 | $in_questionname, |
839 | 839 | $sessionId |
840 | 840 | ) { |
841 | - $res = $in_questionname; |
|
841 | + $res = $in_questionname; |
|
842 | 842 | $sessionIcon = null; |
843 | - if ($in_addA) { |
|
843 | + if ($in_addA) { |
|
844 | 844 | if (!empty($sessionId) && $sessionId != -1) { |
845 | 845 | $sessionIcon = ' '.Display::return_icon('star.png', get_lang('Session')); |
846 | 846 | } |
847 | - $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>". |
|
847 | + $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>". |
|
848 | 848 | $res.$sessionIcon. |
849 | 849 | "</a>"; |
850 | - } |
|
851 | - return $res; |
|
850 | + } |
|
851 | + return $res; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | /** |
@@ -878,16 +878,16 @@ discard block |
||
878 | 878 | $in_session_id, |
879 | 879 | $in_exercise_id |
880 | 880 | ) { |
881 | - $res = ""; |
|
882 | - $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
|
883 | - switch ($in_action) { |
|
884 | - case "delete" : |
|
885 | - $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>"; |
|
886 | - $res .= Display::return_icon("delete.png", get_lang('Delete')); |
|
887 | - $res .= "</a>"; |
|
888 | - break; |
|
889 | - case "edit" : |
|
890 | - $res = get_a_tag_for_question( |
|
881 | + $res = ""; |
|
882 | + $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
|
883 | + switch ($in_action) { |
|
884 | + case "delete" : |
|
885 | + $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>"; |
|
886 | + $res .= Display::return_icon("delete.png", get_lang('Delete')); |
|
887 | + $res .= "</a>"; |
|
888 | + break; |
|
889 | + case "edit" : |
|
890 | + $res = get_a_tag_for_question( |
|
891 | 891 | 1, |
892 | 892 | $from_exercise, |
893 | 893 | $in_questionid, |
@@ -895,33 +895,33 @@ discard block |
||
895 | 895 | Display::return_icon("edit.png", get_lang('Modify')), |
896 | 896 | $in_session_id |
897 | 897 | ); |
898 | - break; |
|
899 | - case "add": |
|
900 | - // add if question is not already in test |
|
901 | - $myObjEx = new Exercise(); |
|
902 | - $myObjEx->read($from_exercise); |
|
903 | - if (!$myObjEx->isInList($in_questionid)) { |
|
904 | - $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>"; |
|
905 | - $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise')); |
|
906 | - $res .= "</a>"; |
|
898 | + break; |
|
899 | + case "add": |
|
900 | + // add if question is not already in test |
|
901 | + $myObjEx = new Exercise(); |
|
902 | + $myObjEx->read($from_exercise); |
|
903 | + if (!$myObjEx->isInList($in_questionid)) { |
|
904 | + $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>"; |
|
905 | + $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise')); |
|
906 | + $res .= "</a>"; |
|
907 | 907 | } else { |
908 | - $res = "-"; |
|
909 | - } |
|
910 | - unset($myObjEx); |
|
911 | - break; |
|
912 | - case "clone": |
|
908 | + $res = "-"; |
|
909 | + } |
|
910 | + unset($myObjEx); |
|
911 | + break; |
|
912 | + case "clone": |
|
913 | 913 | $url = api_get_self()."?".api_get_cidreq().$getParams."&question_copy=$in_questionid&course_id=$in_selected_course&fromExercise=$from_exercise"; |
914 | 914 | $res = Display::url( |
915 | 915 | Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')), |
916 | 916 | $url |
917 | 917 | ); |
918 | - break; |
|
919 | - default : |
|
920 | - $res = $in_action; |
|
921 | - break; |
|
922 | - } |
|
918 | + break; |
|
919 | + default : |
|
920 | + $res = $in_action; |
|
921 | + break; |
|
922 | + } |
|
923 | 923 | |
924 | - return $res; |
|
924 | + return $res; |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | /** |
@@ -930,14 +930,14 @@ discard block |
||
930 | 930 | */ |
931 | 931 | function get_question_type_for_question($in_selectedcourse, $in_questionid) |
932 | 932 | { |
933 | - $myObjQuestion = Question::read($in_questionid, $in_selectedcourse); |
|
933 | + $myObjQuestion = Question::read($in_questionid, $in_selectedcourse); |
|
934 | 934 | $questionType = null; |
935 | 935 | if (!empty($myObjQuestion)) { |
936 | 936 | list($typeImg, $typeExpl) = $myObjQuestion->get_type_icon_html(); |
937 | 937 | $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), 32), array()); |
938 | 938 | unset($myObjQuestion); |
939 | 939 | } |
940 | - return $questionType; |
|
940 | + return $questionType; |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | /** |
@@ -946,6 +946,6 @@ discard block |
||
946 | 946 | */ |
947 | 947 | function get_question_categorie_for_question($in_courseid, $in_questionid) |
948 | 948 | { |
949 | - $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid); |
|
950 | - return $cat; |
|
949 | + $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid); |
|
950 | + return $cat; |
|
951 | 951 | } |
@@ -162,17 +162,17 @@ |
||
162 | 162 | |
163 | 163 | if ($form->validate()) { |
164 | 164 | $officialCode = $form->getSubmitValue('filter'); |
165 | - if ($officialCode == 'all') { |
|
165 | + if ($officialCode == 'all') { |
|
166 | 166 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
167 | 167 | } else { |
168 | - $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
169 | - if (!empty($userList)) { |
|
170 | - $certificate_list = GradebookUtils::get_list_users_certificates( |
|
171 | - $cat_id, |
|
172 | - $userList |
|
173 | - ); |
|
174 | - } |
|
175 | - } |
|
168 | + $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
169 | + if (!empty($userList)) { |
|
170 | + $certificate_list = GradebookUtils::get_list_users_certificates( |
|
171 | + $cat_id, |
|
172 | + $userList |
|
173 | + ); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | } else { |
177 | 177 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
178 | 178 | } |
@@ -18,53 +18,53 @@ |
||
18 | 18 | $newstudents = $evaluation[0]->get_not_subscribed_students(); |
19 | 19 | |
20 | 20 | if (count($newstudents) == '0') { |
21 | - header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()); |
|
22 | - exit; |
|
21 | + header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()); |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | $add_user_form= new EvalForm(EvalForm :: TYPE_ADD_USERS_TO_EVAL, |
25 | - $evaluation[0], |
|
26 | - null, |
|
27 | - 'add_users_to_evaluation', |
|
28 | - null, |
|
29 | - api_get_self() . '?selecteval=' . Security::remove_XSS($_GET['selecteval']), |
|
30 | - Security::remove_XSS($_GET['firstletter']), |
|
31 | - $newstudents); |
|
25 | + $evaluation[0], |
|
26 | + null, |
|
27 | + 'add_users_to_evaluation', |
|
28 | + null, |
|
29 | + api_get_self() . '?selecteval=' . Security::remove_XSS($_GET['selecteval']), |
|
30 | + Security::remove_XSS($_GET['firstletter']), |
|
31 | + $newstudents); |
|
32 | 32 | |
33 | 33 | if ( isset($_POST['submit_button']) ) { |
34 | - $users= is_array($_POST['add_users']) ? $_POST['add_users'] : array (); |
|
35 | - foreach ($users as $key => $value){ |
|
36 | - $users[$key]= intval($value); |
|
37 | - } |
|
34 | + $users= is_array($_POST['add_users']) ? $_POST['add_users'] : array (); |
|
35 | + foreach ($users as $key => $value){ |
|
36 | + $users[$key]= intval($value); |
|
37 | + } |
|
38 | 38 | |
39 | - if (count($users) == 0) { |
|
40 | - header('Location: ' . api_get_self() . '?erroroneuser=&selecteval=' .Security::remove_XSS($_GET['selecteval'])); |
|
41 | - exit; |
|
42 | - } else { |
|
43 | - foreach ($users as $user_id) { |
|
44 | - $result= new Result(); |
|
45 | - $result->set_user_id($user_id); |
|
46 | - $result->set_evaluation_id($_GET['selecteval']); |
|
47 | - $result->add(); |
|
48 | - } |
|
49 | - } |
|
50 | - header('Location: gradebook_view_result.php?adduser=&selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()); |
|
51 | - exit; |
|
52 | - } elseif ($_POST['firstLetterUser']) { |
|
53 | - $firstletter= $_POST['firstLetterUser']; |
|
54 | - if (!empty ($firstletter)) { |
|
55 | - header('Location: ' . api_get_self() . '?firstletter=' . Security::remove_XSS($firstletter) . '&selecteval=' . Security::remove_XSS($_GET['selecteval'])); |
|
56 | - exit; |
|
57 | - } |
|
39 | + if (count($users) == 0) { |
|
40 | + header('Location: ' . api_get_self() . '?erroroneuser=&selecteval=' .Security::remove_XSS($_GET['selecteval'])); |
|
41 | + exit; |
|
42 | + } else { |
|
43 | + foreach ($users as $user_id) { |
|
44 | + $result= new Result(); |
|
45 | + $result->set_user_id($user_id); |
|
46 | + $result->set_evaluation_id($_GET['selecteval']); |
|
47 | + $result->add(); |
|
48 | + } |
|
49 | + } |
|
50 | + header('Location: gradebook_view_result.php?adduser=&selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()); |
|
51 | + exit; |
|
52 | + } elseif ($_POST['firstLetterUser']) { |
|
53 | + $firstletter= $_POST['firstLetterUser']; |
|
54 | + if (!empty ($firstletter)) { |
|
55 | + header('Location: ' . api_get_self() . '?firstletter=' . Security::remove_XSS($firstletter) . '&selecteval=' . Security::remove_XSS($_GET['selecteval'])); |
|
56 | + exit; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook')); |
61 | 61 | $interbreadcrumb[]= array( |
62 | - 'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(), |
|
63 | - 'name' => get_lang('ViewResult') |
|
62 | + 'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(), |
|
63 | + 'name' => get_lang('ViewResult') |
|
64 | 64 | ); |
65 | 65 | Display :: display_header(get_lang('AddUserToEval')); |
66 | 66 | if (isset ($_GET['erroroneuser'])){ |
67 | - Display :: display_warning_message(get_lang('AtLeastOneUser'),false); |
|
67 | + Display :: display_warning_message(get_lang('AtLeastOneUser'),false); |
|
68 | 68 | } |
69 | 69 | DisplayGradebook :: display_header_result($evaluation[0], null, 0,0); |
70 | 70 | echo '<div class="main">'; |