@@ -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 { |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | } |
130 | 130 | //2. Checking if $objExercise is set |
131 | 131 | if (!isset($objExercise) && isset($exerciseInSession)) { |
132 | - if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
132 | + if ($debug) { error_log('2. Loading $objExercise from session'); }; |
|
133 | 133 | $objExercise = $exerciseInSession; |
134 | 134 | } |
135 | 135 | |
136 | 136 | //3. $objExercise is not set, then return to the exercise list |
137 | 137 | if (!is_object($objExercise)) { |
138 | - if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
138 | + if ($debug) {error_log('3. $objExercise was not set, kill the script'); }; |
|
139 | 139 | header('Location: exercise.php'); |
140 | 140 | exit; |
141 | 141 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $time_control = false; |
158 | 158 | if ($objExercise->expired_time != 0) { |
159 | - $time_control = true; |
|
159 | + $time_control = true; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Generating the time control key for the user |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | $_SESSION['duration_time'][$current_expired_time_key] = $current_timestamp; |
166 | 166 | |
167 | 167 | if ($time_control) { |
168 | - // Get the expired time of the current exercise in track_e_exercises |
|
169 | - $total_seconds = $objExercise->expired_time*60; |
|
168 | + // Get the expired time of the current exercise in track_e_exercises |
|
169 | + $total_seconds = $objExercise->expired_time*60; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $show_clock = true; |
173 | 173 | $user_id = api_get_user_id(); |
174 | 174 | if ($objExercise->selectAttempts() > 0) { |
175 | - $attempt_html = ''; |
|
175 | + $attempt_html = ''; |
|
176 | 176 | $attempt_count = Event::get_attempt_count( |
177 | 177 | $user_id, |
178 | 178 | $exerciseId, |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $learnpath_item_view_id |
182 | 182 | ); |
183 | 183 | |
184 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
185 | - $show_clock = false; |
|
186 | - if (!api_is_allowed_to_edit(null,true)) { |
|
184 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
185 | + $show_clock = false; |
|
186 | + if (!api_is_allowed_to_edit(null,true)) { |
|
187 | 187 | if ($objExercise->results_disabled == 0 && $origin != 'learnpath') { |
188 | 188 | |
189 | 189 | // Showing latest attempt according with task BT#1628 |
@@ -222,31 +222,31 @@ discard block |
||
222 | 222 | $attempt_html .= Display::div(get_lang('Score').' '.$marks, array('id'=>'question_question_titlescore')); |
223 | 223 | } |
224 | 224 | } |
225 | - $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
226 | - $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
227 | - } else { |
|
228 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
229 | - } |
|
230 | - } else { |
|
231 | - $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
232 | - } |
|
233 | - } else { |
|
234 | - $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
235 | - } |
|
225 | + $score = ExerciseLib::show_score($last_attempt_info['exe_result'], $last_attempt_info['exe_weighting']); |
|
226 | + $attempt_html .= Display::div(get_lang('YourTotalScore').' '.$score, array('id'=>'question_score')); |
|
227 | + } else { |
|
228 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
229 | + } |
|
230 | + } else { |
|
231 | + $attempt_html .= Display::return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
232 | + } |
|
233 | + } else { |
|
234 | + $attempt_html .= Display :: return_message(sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), 'warning', false); |
|
235 | + } |
|
236 | 236 | |
237 | - if ($origin == 'learnpath') { |
|
238 | - Display :: display_reduced_header(); |
|
239 | - } else { |
|
240 | - Display :: display_header(get_lang('Exercises')); |
|
241 | - } |
|
237 | + if ($origin == 'learnpath') { |
|
238 | + Display :: display_reduced_header(); |
|
239 | + } else { |
|
240 | + Display :: display_header(get_lang('Exercises')); |
|
241 | + } |
|
242 | 242 | |
243 | - echo $attempt_html; |
|
243 | + echo $attempt_html; |
|
244 | 244 | |
245 | 245 | if ($origin != 'learnpath') { |
246 | 246 | Display:: display_footer(); |
247 | 247 | } |
248 | - exit; |
|
249 | - } |
|
248 | + exit; |
|
249 | + } |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($debug) { |
@@ -270,26 +270,26 @@ discard block |
||
270 | 270 | |
271 | 271 | if (empty($exercise_stat_info)) { |
272 | 272 | if ($debug) error_log('5 $exercise_stat_info is empty '); |
273 | - $total_weight = 0; |
|
274 | - $questionList = $objExercise->get_validated_question_list(); |
|
275 | - foreach ($questionListUncompressed as $question_id) { |
|
276 | - $objQuestionTmp = Question::read($question_id); |
|
277 | - $total_weight += floatval($objQuestionTmp->weighting); |
|
278 | - } |
|
273 | + $total_weight = 0; |
|
274 | + $questionList = $objExercise->get_validated_question_list(); |
|
275 | + foreach ($questionListUncompressed as $question_id) { |
|
276 | + $objQuestionTmp = Question::read($question_id); |
|
277 | + $total_weight += floatval($objQuestionTmp->weighting); |
|
278 | + } |
|
279 | 279 | |
280 | - if ($time_control) { |
|
281 | - $expected_time = $current_timestamp + $total_seconds; |
|
280 | + if ($time_control) { |
|
281 | + $expected_time = $current_timestamp + $total_seconds; |
|
282 | 282 | |
283 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
284 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
283 | + if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
284 | + if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
285 | 285 | |
286 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
287 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
286 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
287 | + if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
288 | 288 | |
289 | - //Sessions that contain the expired time |
|
290 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
291 | - if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
292 | - } |
|
289 | + //Sessions that contain the expired time |
|
290 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
291 | + if ($debug) { error_log('5.4. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
292 | + } |
|
293 | 293 | |
294 | 294 | $exe_id = $objExercise->save_stat_track_exercise_info( |
295 | 295 | $clock_expired_time, |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | ); |
307 | 307 | if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
308 | 308 | } else { |
309 | - $exe_id = $exercise_stat_info['exe_id']; |
|
309 | + $exe_id = $exercise_stat_info['exe_id']; |
|
310 | 310 | // Remember last question id position. |
311 | 311 | $isFirstTime = Session::read('firstTime'); |
312 | 312 | if ($isFirstTime && $objExercise->type == ONE_PER_PAGE) { |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | if ($debug) { error_log('6. $objExercise->get_stat_track_exercise_info function called:: '.print_r($exercise_stat_info, 1)); }; |
366 | 366 | |
367 | 367 | if (!empty($exercise_stat_info['questions_to_check'])) { |
368 | - $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
369 | - $my_remind_list = explode(',', $my_remind_list); |
|
370 | - $my_remind_list = array_filter($my_remind_list); |
|
368 | + $my_remind_list = $exercise_stat_info['questions_to_check']; |
|
369 | + $my_remind_list = explode(',', $my_remind_list); |
|
370 | + $my_remind_list = array_filter($my_remind_list); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | $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(); |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | |
376 | 376 | if ($reminder == 2 && empty($my_remind_list)) { |
377 | 377 | if ($debug) { error_log("6.2 calling the exercise_reminder.php "); }; |
378 | - header('Location: exercise_reminder.php?'.$params); |
|
379 | - exit; |
|
378 | + header('Location: exercise_reminder.php?'.$params); |
|
379 | + exit; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /* |
@@ -384,56 +384,56 @@ discard block |
||
384 | 384 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
385 | 385 | */ |
386 | 386 | if ($time_control) { |
387 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
388 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
389 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
387 | + if ($debug) error_log('7.1. Time control is enabled'); |
|
388 | + if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
389 | + if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
390 | 390 | |
391 | 391 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
392 | 392 | //Timer - Get expired_time for a student |
393 | 393 | if (!empty($exercise_stat_info)) { |
394 | - if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
395 | - $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
396 | - if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
397 | - // Get the last attempt of an exercise |
|
398 | - $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
394 | + if ($debug) {error_log('7.4 Seems that the session ends and the user want to retake the exam'); }; |
|
395 | + $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; |
|
396 | + if ($debug) {error_log('7.5 $expired_time_of_this_attempt: '.$expired_time_of_this_attempt); } |
|
397 | + // Get the last attempt of an exercise |
|
398 | + $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); |
|
399 | 399 | |
400 | - /* This means that the user enters the exam but do not answer the |
|
400 | + /* This means that the user enters the exam but do not answer the |
|
401 | 401 | first question we get the date from the track_e_exercises not from |
402 | 402 | the track_et_attempt see #2069 */ |
403 | - if (empty($last_attempt_date)) { |
|
404 | - $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
405 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
406 | - } else { |
|
407 | - //Recalculate the time control due #2069 |
|
408 | - $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
409 | - $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
410 | - } |
|
411 | - if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
412 | - |
|
413 | - //New expired time - it is due to the possible closure of session |
|
414 | - $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
415 | - if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
416 | - |
|
417 | - $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
418 | - if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
419 | - |
|
420 | - $clock_expired_time = api_get_utc_datetime($expected_time); |
|
421 | - if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
422 | - |
|
423 | - // First we update the attempt to today |
|
424 | - /* How the expired time is changed into "track_e_exercises" table, |
|
403 | + if (empty($last_attempt_date)) { |
|
404 | + $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); |
|
405 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'],'UTC') + $diff); |
|
406 | + } else { |
|
407 | + //Recalculate the time control due #2069 |
|
408 | + $diff = $current_timestamp - api_strtotime($last_attempt_date,'UTC'); |
|
409 | + $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date,'UTC') + $diff); |
|
410 | + } |
|
411 | + if ($debug) {error_log('7.6. $last_attempt_date: '.$last_attempt_date); } |
|
412 | + |
|
413 | + //New expired time - it is due to the possible closure of session |
|
414 | + $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date,'UTC'); |
|
415 | + if ($debug) {error_log('7.7. $new_expired_time_in_seconds: '.$new_expired_time_in_seconds); } |
|
416 | + |
|
417 | + $expected_time = $current_timestamp + $new_expired_time_in_seconds; |
|
418 | + if ($debug) {error_log('7.8. $expected_time1: '.$expected_time); } |
|
419 | + |
|
420 | + $clock_expired_time = api_get_utc_datetime($expected_time); |
|
421 | + if ($debug) {error_log('7.9. $clock_expired_time: '.$clock_expired_time); } |
|
422 | + |
|
423 | + // First we update the attempt to today |
|
424 | + /* How the expired time is changed into "track_e_exercises" table, |
|
425 | 425 | then the last attempt for this student should be changed too */ |
426 | - $sql = "UPDATE $exercise_attempt_table SET |
|
426 | + $sql = "UPDATE $exercise_attempt_table SET |
|
427 | 427 | tms = '".api_get_utc_datetime()."' |
428 | 428 | WHERE |
429 | 429 | exe_id = '".$exercise_stat_info['exe_id']."' AND |
430 | 430 | tms = '".$last_attempt_date."' "; |
431 | - if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
432 | - Database::query($sql); |
|
431 | + if ($debug) {error_log('7.10. $sql: '.$sql); } |
|
432 | + Database::query($sql); |
|
433 | 433 | |
434 | - //Sessions that contain the expired time |
|
435 | - $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
436 | - if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
434 | + //Sessions that contain the expired time |
|
435 | + $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
|
436 | + if ($debug) {error_log('7.11. Setting the $_SESSION[expired_time]: '.$_SESSION['expired_time'][$current_expired_time_key] ); }; |
|
437 | 437 | } |
438 | 438 | } else { |
439 | 439 | $clock_expired_time = $_SESSION['expired_time'][$current_expired_time_key]; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * for more details of how it works see this link : http://eric.garside.name/docs.html?p=epiclock |
451 | 451 | */ |
452 | 452 | if ($time_control) { //Sends the exercise form when the expired time is finished |
453 | - $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
453 | + $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | // if the user has submitted the form |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | // selects the list of question ID |
464 | 464 | $questionList = $objExercise->get_validated_question_list(); |
465 | 465 | if ($objExercise->isRandom() && !empty($exercise_stat_info['data_tracking'])) { |
466 | - $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
466 | + $questionList = explode(',', $exercise_stat_info['data_tracking']); |
|
467 | 467 | } |
468 | 468 | Session::write('questionList', $questionList); |
469 | 469 | if ($debug > 0) { error_log('$_SESSION[questionList] was set'); } |
470 | 470 | } else { |
471 | - if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
472 | - $questionList = $_SESSION['questionList']; |
|
473 | - } |
|
471 | + if (isset($objExercise) && isset($_SESSION['objExercise'])) { |
|
472 | + $questionList = $_SESSION['questionList']; |
|
473 | + } |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | //Real question count |
479 | 479 | $question_count = 0; |
480 | 480 | if (!empty($questionList)) { |
481 | - $question_count = count($questionList); |
|
481 | + $question_count = count($questionList); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | if ($formSent && isset($_POST)) { |
@@ -520,11 +520,11 @@ discard block |
||
520 | 520 | //saving each question |
521 | 521 | if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_DIRECT) { |
522 | 522 | $nro_question = $current_question; // - 1; |
523 | - $questionId = $key; |
|
523 | + $questionId = $key; |
|
524 | 524 | // gets the student choice for this question |
525 | 525 | $choice = $exerciseResult[$questionId]; |
526 | 526 | if (isset($exe_id)) { |
527 | - // Manage the question and answer attempts |
|
527 | + // Manage the question and answer attempts |
|
528 | 528 | if ($debug) { error_log('8.3. manage_answer exe_id: '.$exe_id.' - $questionId: '.$questionId.' Choice'.print_r($choice,1)); } |
529 | 529 | $objExercise->manage_answer( |
530 | 530 | $exe_id, |
@@ -613,58 +613,58 @@ discard block |
||
613 | 613 | } |
614 | 614 | |
615 | 615 | if ($question_count != 0) { |
616 | - if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
616 | + if (($objExercise->type == ALL_ON_ONE_PAGE || |
|
617 | 617 | $current_question > $question_count) |
618 | 618 | ) { |
619 | - if (api_is_allowed_to_session_edit()) { |
|
620 | - // goes to the script that will show the result of the exercise |
|
621 | - if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
622 | - if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
623 | - |
|
624 | - //We check if the user attempts before sending to the exercise_result.php |
|
625 | - if ($objExercise->selectAttempts() > 0) { |
|
626 | - $attempt_count = Event::get_attempt_count( |
|
619 | + if (api_is_allowed_to_session_edit()) { |
|
620 | + // goes to the script that will show the result of the exercise |
|
621 | + if ($objExercise->type == ALL_ON_ONE_PAGE) { |
|
622 | + if ($debug) { error_log('12. Exercise ALL_ON_ONE_PAGE -> Redirecting to exercise_result.php'); } |
|
623 | + |
|
624 | + //We check if the user attempts before sending to the exercise_result.php |
|
625 | + if ($objExercise->selectAttempts() > 0) { |
|
626 | + $attempt_count = Event::get_attempt_count( |
|
627 | 627 | api_get_user_id(), |
628 | 628 | $exerciseId, |
629 | 629 | $learnpath_id, |
630 | 630 | $learnpath_item_id, |
631 | 631 | $learnpath_item_view_id |
632 | 632 | ); |
633 | - if ($attempt_count >= $objExercise->selectAttempts()) { |
|
634 | - Display :: display_warning_message( |
|
633 | + if ($attempt_count >= $objExercise->selectAttempts()) { |
|
634 | + Display :: display_warning_message( |
|
635 | 635 | sprintf(get_lang('ReachedMaxAttempts'), $exercise_title, $objExercise->selectAttempts()), |
636 | 636 | false |
637 | 637 | ); |
638 | - if ($origin != 'learnpath') { |
|
639 | - //so we are not in learnpath tool |
|
640 | - echo '</div>'; //End glossary div |
|
641 | - Display :: display_footer(); |
|
642 | - } else { |
|
643 | - echo '</body></html>'; |
|
644 | - } |
|
645 | - exit; |
|
646 | - } |
|
647 | - } |
|
648 | - } else { |
|
649 | - if ($objExercise->review_answers) { |
|
650 | - header('Location: exercise_reminder.php?'.$params); |
|
651 | - exit; |
|
652 | - } else { |
|
638 | + if ($origin != 'learnpath') { |
|
639 | + //so we are not in learnpath tool |
|
640 | + echo '</div>'; //End glossary div |
|
641 | + Display :: display_footer(); |
|
642 | + } else { |
|
643 | + echo '</body></html>'; |
|
644 | + } |
|
645 | + exit; |
|
646 | + } |
|
647 | + } |
|
648 | + } else { |
|
649 | + if ($objExercise->review_answers) { |
|
650 | + header('Location: exercise_reminder.php?'.$params); |
|
651 | + exit; |
|
652 | + } else { |
|
653 | 653 | 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"); |
654 | 654 | exit; |
655 | - } |
|
656 | - } |
|
657 | - } else { |
|
658 | - if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
659 | - exit; |
|
660 | - } |
|
661 | - } |
|
655 | + } |
|
656 | + } |
|
657 | + } else { |
|
658 | + if ($debug) { error_log('Redirecting to exercise_submit.php'); } |
|
659 | + exit; |
|
660 | + } |
|
661 | + } |
|
662 | 662 | } else { |
663 | - $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
664 | - // if we are in the case where user select random by category, but didn't choose the number of random question |
|
665 | - if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
666 | - $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
667 | - } |
|
663 | + $error = get_lang('ThereAreNoQuestionsForThisExercise'); |
|
664 | + // if we are in the case where user select random by category, but didn't choose the number of random question |
|
665 | + if ($objExercise->selectRandomByCat() > 0 && $objExercise->random <= 0) { |
|
666 | + $error .= "<br/>".get_lang('PleaseSelectSomeRandomQuestion'); |
|
667 | + } |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | if (!empty ($_GET['gradebook']) && $_GET['gradebook'] == 'view') { |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | if (api_is_course_admin() && $origin != 'learnpath') { |
704 | 704 | echo '<div class="actions">'; |
705 | 705 | if ($show_quiz_edition == false) { |
706 | - 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>'; |
|
706 | + 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>'; |
|
707 | 707 | } else { |
708 | - echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
708 | + echo '<a href="#">'.Display::return_icon('settings_na.png', get_lang('ModifyExercise'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
709 | 709 | } |
710 | 710 | echo '</div>'; |
711 | 711 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $message_warning = $permission_to_start ? get_lang('ReachedTimeLimit') : get_lang('ExerciseNoStartedYet'); |
749 | 749 | Display :: display_warning_message(sprintf($message_warning, $exercise_title, $objExercise->selectAttempts())); |
750 | 750 | if ($origin != 'learnpath') { |
751 | - Display :: display_footer(); |
|
751 | + Display :: display_footer(); |
|
752 | 752 | } |
753 | 753 | exit; |
754 | 754 | } else { |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | if (isset($_custom['exercises_hidden_when_no_start_date']) && |
764 | 764 | $_custom['exercises_hidden_when_no_start_date'] |
765 | 765 | ) { |
766 | - if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
766 | + if (empty($objExercise->start_time) || $objExercise->start_time == '0000-00-00 00:00:00') { |
|
767 | 767 | Display:: display_warning_message( |
768 | 768 | sprintf( |
769 | 769 | get_lang('ExerciseNoStartedYet'), |
@@ -771,20 +771,20 @@ discard block |
||
771 | 771 | $objExercise->selectAttempts() |
772 | 772 | ) |
773 | 773 | ); |
774 | - if ($origin != 'learnpath') { |
|
775 | - Display :: display_footer(); |
|
776 | - } |
|
777 | - } |
|
774 | + if ($origin != 'learnpath') { |
|
775 | + Display :: display_footer(); |
|
776 | + } |
|
777 | + } |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | //Timer control |
781 | 781 | if ($time_control) { |
782 | 782 | echo $objExercise->return_time_left_div(); |
783 | - echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
783 | + echo '<div style="display:none" class="warning-message" id="expired-message-id">'.get_lang('ExerciseExpiredTimeMessage').'</div>'; |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | if ($origin != 'learnpath') { |
787 | - echo '<div id="highlight-plugin" class="glossary-content">'; |
|
787 | + echo '<div id="highlight-plugin" class="glossary-content">'; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | if ($reminder == 2) { |
@@ -796,53 +796,53 @@ discard block |
||
796 | 796 | $current_question = 1; //set by default the 1st question |
797 | 797 | |
798 | 798 | if (!empty($my_remind_list)) { |
799 | - // Checking which questions we are going to call from the remind list |
|
800 | - for ($i = 0; $i < count($data_tracking); $i++) { |
|
801 | - for($j = 0; $j < count($my_remind_list); $j++) { |
|
802 | - |
|
803 | - if (!empty($remind_question_id)) { |
|
804 | - if ($remind_question_id == $my_remind_list[$j]) { |
|
805 | - |
|
806 | - if ($remind_question_id == $data_tracking[$i]) { |
|
807 | - if (isset($my_remind_list[$j+1])) { |
|
808 | - $remind_question_id = $my_remind_list[$j+1]; |
|
809 | - $current_question = $i + 1; |
|
810 | - } else { |
|
799 | + // Checking which questions we are going to call from the remind list |
|
800 | + for ($i = 0; $i < count($data_tracking); $i++) { |
|
801 | + for($j = 0; $j < count($my_remind_list); $j++) { |
|
802 | + |
|
803 | + if (!empty($remind_question_id)) { |
|
804 | + if ($remind_question_id == $my_remind_list[$j]) { |
|
805 | + |
|
806 | + if ($remind_question_id == $data_tracking[$i]) { |
|
807 | + if (isset($my_remind_list[$j+1])) { |
|
808 | + $remind_question_id = $my_remind_list[$j+1]; |
|
809 | + $current_question = $i + 1; |
|
810 | + } else { |
|
811 | 811 | // We end the remind list we go to the exercise_reminder.php please |
812 | - $remind_question_id = -1; |
|
813 | - $current_question = $i + 1; // last question |
|
814 | - } |
|
815 | - break 2; |
|
816 | - } |
|
817 | - } |
|
818 | - } else { |
|
819 | - if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
820 | - if (isset($my_remind_list[$j+1])) { |
|
821 | - $remind_question_id = $my_remind_list[$j+1]; |
|
822 | - $current_question = $i + 1; // last question |
|
823 | - } else { |
|
812 | + $remind_question_id = -1; |
|
813 | + $current_question = $i + 1; // last question |
|
814 | + } |
|
815 | + break 2; |
|
816 | + } |
|
817 | + } |
|
818 | + } else { |
|
819 | + if ($my_remind_list[$j] == $data_tracking[$i]) { |
|
820 | + if (isset($my_remind_list[$j+1])) { |
|
821 | + $remind_question_id = $my_remind_list[$j+1]; |
|
822 | + $current_question = $i + 1; // last question |
|
823 | + } else { |
|
824 | 824 | // We end the remind list we go to the exercise_reminder.php please |
825 | - $remind_question_id = -1; |
|
826 | - $current_question = $i + 1; // last question |
|
827 | - } |
|
828 | - break 2; |
|
829 | - } |
|
830 | - } |
|
831 | - } |
|
825 | + $remind_question_id = -1; |
|
826 | + $current_question = $i + 1; // last question |
|
827 | + } |
|
828 | + break 2; |
|
829 | + } |
|
830 | + } |
|
831 | + } |
|
832 | 832 | } |
833 | 833 | } else { |
834 | - if ($objExercise->review_answers) { |
|
834 | + if ($objExercise->review_answers) { |
|
835 | 835 | if ($debug) { error_log('. redirecting to exercise_reminder.php '); } |
836 | - header("Location: exercise_reminder.php?$params"); |
|
837 | - exit; |
|
838 | - } |
|
836 | + header("Location: exercise_reminder.php?$params"); |
|
837 | + exit; |
|
838 | + } |
|
839 | 839 | } |
840 | 840 | } |
841 | 841 | |
842 | 842 | if ($objExercise->review_answers) { |
843 | - $script_php = 'exercise_reminder.php'; |
|
843 | + $script_php = 'exercise_reminder.php'; |
|
844 | 844 | } else { |
845 | - $script_php = 'exercise_result.php'; |
|
845 | + $script_php = 'exercise_result.php'; |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if (!empty($error)) { |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | <input type="hidden" name="learnpath_item_id" value="'.$learnpath_item_id . '" /> |
1087 | 1087 | <input type="hidden" name="learnpath_item_view_id" value="'.$learnpath_item_view_id . '" />'; |
1088 | 1088 | |
1089 | - // Show list of questions |
|
1089 | + // Show list of questions |
|
1090 | 1090 | $i = 1; |
1091 | 1091 | $attempt_list = array(); |
1092 | 1092 | if (isset($exe_id)) { |
@@ -1136,10 +1136,10 @@ discard block |
||
1136 | 1136 | |
1137 | 1137 | $attributes = array('id' =>'remind_list['.$questionId.']'); |
1138 | 1138 | if (in_array($questionId, $remind_list)) { |
1139 | - $is_remind_on = true; |
|
1140 | - $attributes['checked'] = 1; |
|
1141 | - $remind_question = true; |
|
1142 | - $remind_highlight = ' remind_highlight '; |
|
1139 | + $is_remind_on = true; |
|
1140 | + $attributes['checked'] = 1; |
|
1141 | + $remind_question = true; |
|
1142 | + $remind_highlight = ' remind_highlight '; |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | // Showing the exercise description |
@@ -1213,8 +1213,8 @@ discard block |
||
1213 | 1213 | } |
1214 | 1214 | // end foreach() |
1215 | 1215 | if ($objExercise->type == ALL_ON_ONE_PAGE) { |
1216 | - $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1217 | - echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1216 | + $exercise_actions = $objExercise->show_button($questionId, $current_question); |
|
1217 | + echo Display::div($exercise_actions, array('class'=>'exercise_actions')); |
|
1218 | 1218 | echo '<br>'; |
1219 | 1219 | } |
1220 | 1220 | echo '</form>'; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | 'jpeg' => 'image/jpeg', |
7 | 7 | 'bmp' => 'image/bmp', |
8 | 8 | 'webp' => 'image/webp', |
9 | - 'pdf' => 'application/pdf' |
|
9 | + 'pdf' => 'application/pdf' |
|
10 | 10 | ); |
11 | 11 | |
12 | 12 | ?> |
13 | 13 | \ No newline at end of file |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | - // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | - // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | - // files to your server which may cause disk space or possibly security problems |
|
5 | - require('savefile_config.php'); |
|
6 | - if (!isset($_POST['output_svg'])) { |
|
7 | - print "You must supply output_svg"; |
|
8 | - exit; |
|
9 | - } |
|
10 | - $svg = $_POST['output_svg']; |
|
11 | - $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
2 | + // You must first create a file "savefile_config.php" in this extensions directory and do whatever |
|
3 | + // checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG |
|
4 | + // files to your server which may cause disk space or possibly security problems |
|
5 | + require('savefile_config.php'); |
|
6 | + if (!isset($_POST['output_svg'])) { |
|
7 | + print "You must supply output_svg"; |
|
8 | + exit; |
|
9 | + } |
|
10 | + $svg = $_POST['output_svg']; |
|
11 | + $filename = (isset($_POST['filename']) && !empty($_POST['filename']) ? preg_replace('@[\\\\/:*?"<>|]@u', '_', $_POST['filename']) : 'saved') . '.svg'; // These characters are indicated as prohibited by Windows |
|
12 | 12 | |
13 | - $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | - fwrite($fh, $svg); |
|
15 | - fclose($fh); |
|
13 | + $fh = fopen($filename, 'w') or die("Can't open file"); |
|
14 | + fwrite($fh, $svg); |
|
15 | + fclose($fh); |
|
16 | 16 | ?> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | //get all files and folders |
17 | 17 | $scan_files = []; |
18 | 18 | if (is_dir($user_disk_path)) { |
19 | - $scan_files = scandir($user_disk_path); |
|
19 | + $scan_files = scandir($user_disk_path); |
|
20 | 20 | } |
21 | 21 | //get all svg and png files |
22 | 22 | $accepted_extensions = array('.svg', '.png'); |
23 | 23 | |
24 | 24 | if (is_array($scan_files) && count($scan_files) > 0) { |
25 | - foreach ($scan_files as & $file) { |
|
26 | - $slideshow_extension = strrchr($file, '.'); |
|
27 | - $slideshow_extension = strtolower($slideshow_extension); |
|
28 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | - $png_svg_files[] =$file; |
|
30 | - } |
|
31 | - } |
|
25 | + foreach ($scan_files as & $file) { |
|
26 | + $slideshow_extension = strrchr($file, '.'); |
|
27 | + $slideshow_extension = strtolower($slideshow_extension); |
|
28 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | + $png_svg_files[] =$file; |
|
30 | + } |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | $style = '<style>'; |
34 | 34 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>'; |
48 | 48 | |
49 | 49 | if (!empty($png_svg_files)) { |
50 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | - echo '<ul>'; |
|
52 | - foreach($png_svg_files as $filename) { |
|
53 | - $image = $user_disk_path.$filename; |
|
50 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | + echo '<ul>'; |
|
52 | + foreach($png_svg_files as $filename) { |
|
53 | + $image = $user_disk_path.$filename; |
|
54 | 54 | |
55 | - if (strpos($filename, "svg")){ |
|
56 | - $new_sizes['width'] = 60; |
|
57 | - $new_sizes['height'] = 60; |
|
58 | - } else { |
|
59 | - $new_sizes = api_resize_image($image, 60, 60); |
|
60 | - } |
|
55 | + if (strpos($filename, "svg")){ |
|
56 | + $new_sizes['width'] = 60; |
|
57 | + $new_sizes['height'] = 60; |
|
58 | + } else { |
|
59 | + $new_sizes = api_resize_image($image, 60, 60); |
|
60 | + } |
|
61 | 61 | |
62 | - echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | - } |
|
64 | - echo '</ul>'; |
|
62 | + echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | + } |
|
64 | + echo '</ul>'; |
|
65 | 65 | } else { |
66 | - Display::display_warning_message(get_lang('NoSVGImages')); |
|
66 | + Display::display_warning_message(get_lang('NoSVGImages')); |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | </body> |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array(); |
35 | 35 | |
36 | 36 | if (count($array_to_search) > 0) { |
37 | - while (list($key) = each($array_to_search)) { |
|
38 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
39 | - } |
|
37 | + while (list($key) = each($array_to_search)) { |
|
38 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | //get all svg and png group files |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $groupId))) || $group_properties['doc_state'] == 1 |
71 | 71 | ){ |
72 | 72 | |
73 | - if (!empty($png_svg_files)) { |
|
74 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
75 | - echo '<ul>'; |
|
76 | - foreach($png_svg_files as $filename) { |
|
77 | - $image = $group_disk_path.$filename; |
|
78 | - |
|
79 | - if (strpos($filename, "svg")){ |
|
80 | - $new_sizes['width'] = 60; |
|
81 | - $new_sizes['height'] = 60; |
|
82 | - } else { |
|
83 | - $new_sizes = api_resize_image($image, 60, 60); |
|
84 | - } |
|
73 | + if (!empty($png_svg_files)) { |
|
74 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
75 | + echo '<ul>'; |
|
76 | + foreach($png_svg_files as $filename) { |
|
77 | + $image = $group_disk_path.$filename; |
|
78 | + |
|
79 | + if (strpos($filename, "svg")){ |
|
80 | + $new_sizes['width'] = 60; |
|
81 | + $new_sizes['height'] = 60; |
|
82 | + } else { |
|
83 | + $new_sizes = api_resize_image($image, 60, 60); |
|
84 | + } |
|
85 | 85 | echo '<li style="display:inline; padding:8px;">'; |
86 | 86 | echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">'; |
87 | 87 | echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
88 | - } |
|
89 | - echo '</ul>'; |
|
90 | - } |
|
88 | + } |
|
89 | + echo '</ul>'; |
|
90 | + } |
|
91 | 91 | } else { |
92 | - echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup')); |
|
92 | + echo Display::display_warning_message(get_lang('OnlyAccessFromYourGroup')); |
|
93 | 93 | } |
94 | 94 | ?> |
95 | 95 | </body> |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | $array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array(); |
24 | 24 | |
25 | 25 | if (count($array_to_search) > 0) { |
26 | - while (list($key) = each($array_to_search)) { |
|
27 | - $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | - } |
|
26 | + while (list($key) = each($array_to_search)) { |
|
27 | + $all_files[] = basename($array_to_search[$key]['path']); |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | //get all svg and png files |
32 | 32 | $accepted_extensions = array('.svg', '.png'); |
33 | 33 | |
34 | 34 | if (is_array($all_files) && count($all_files) > 0) { |
35 | - foreach ($all_files as & $file) { |
|
36 | - $slideshow_extension = strrchr($file, '.'); |
|
37 | - $slideshow_extension = strtolower($slideshow_extension); |
|
38 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | - $png_svg_files[] =$file; |
|
40 | - } |
|
41 | - } |
|
35 | + foreach ($all_files as & $file) { |
|
36 | + $slideshow_extension = strrchr($file, '.'); |
|
37 | + $slideshow_extension = strtolower($slideshow_extension); |
|
38 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
39 | + $png_svg_files[] =$file; |
|
40 | + } |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/'; |
@@ -57,24 +57,24 @@ discard block |
||
57 | 57 | <?php |
58 | 58 | echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>'; |
59 | 59 | if (!empty($png_svg_files)) { |
60 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | - echo '<ul>'; |
|
62 | - foreach($png_svg_files as $filename) { |
|
63 | - $image=$disk_path.$filename; |
|
64 | - |
|
65 | - if (strpos($filename, "svg")){ |
|
66 | - $new_sizes['width'] = 60; |
|
67 | - $new_sizes['height'] = 60; |
|
68 | - } |
|
69 | - else { |
|
70 | - $new_sizes = api_resize_image($image, 60, 60); |
|
71 | - } |
|
72 | - |
|
73 | - echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | - } |
|
75 | - echo '</ul>'; |
|
60 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
61 | + echo '<ul>'; |
|
62 | + foreach($png_svg_files as $filename) { |
|
63 | + $image=$disk_path.$filename; |
|
64 | + |
|
65 | + if (strpos($filename, "svg")){ |
|
66 | + $new_sizes['width'] = 60; |
|
67 | + $new_sizes['height'] = 60; |
|
68 | + } |
|
69 | + else { |
|
70 | + $new_sizes = api_resize_image($image, 60, 60); |
|
71 | + } |
|
72 | + |
|
73 | + echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
74 | + } |
|
75 | + echo '</ul>'; |
|
76 | 76 | } else { |
77 | - Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
77 | + Display::display_warning_message(get_lang('NoSVGImagesInImagesGalleryPath')); |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </body> |
@@ -16,19 +16,19 @@ discard block |
||
16 | 16 | //get all files and folders |
17 | 17 | $scan_files = []; |
18 | 18 | if (is_dir($user_disk_path)) { |
19 | - $scan_files = scandir($user_disk_path); |
|
19 | + $scan_files = scandir($user_disk_path); |
|
20 | 20 | } |
21 | 21 | //get all svg and png files |
22 | 22 | $accepted_extensions = array('.svg', '.png'); |
23 | 23 | |
24 | 24 | if (is_array($scan_files) && count($scan_files) > 0) { |
25 | - foreach ($scan_files as & $file) { |
|
26 | - $slideshow_extension = strrchr($file, '.'); |
|
27 | - $slideshow_extension = strtolower($slideshow_extension); |
|
28 | - if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | - $png_svg_files[] =$file; |
|
30 | - } |
|
31 | - } |
|
25 | + foreach ($scan_files as & $file) { |
|
26 | + $slideshow_extension = strrchr($file, '.'); |
|
27 | + $slideshow_extension = strtolower($slideshow_extension); |
|
28 | + if (in_array($slideshow_extension, $accepted_extensions)) { |
|
29 | + $png_svg_files[] =$file; |
|
30 | + } |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | $style = '<style>'; |
34 | 34 | $style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";'; |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | echo '<h2>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h2>'; |
48 | 48 | |
49 | 49 | if (!empty($png_svg_files)) { |
50 | - echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | - echo '<ul>'; |
|
52 | - foreach($png_svg_files as $filename) { |
|
53 | - $image = $user_disk_path.$filename; |
|
50 | + echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>'; |
|
51 | + echo '<ul>'; |
|
52 | + foreach($png_svg_files as $filename) { |
|
53 | + $image = $user_disk_path.$filename; |
|
54 | 54 | |
55 | - if (strpos($filename, "svg")){ |
|
56 | - $new_sizes['width'] = 60; |
|
57 | - $new_sizes['height'] = 60; |
|
58 | - } else { |
|
59 | - $new_sizes = api_resize_image($image, 60, 60); |
|
60 | - } |
|
55 | + if (strpos($filename, "svg")){ |
|
56 | + $new_sizes['width'] = 60; |
|
57 | + $new_sizes['height'] = 60; |
|
58 | + } else { |
|
59 | + $new_sizes = api_resize_image($image, 60, 60); |
|
60 | + } |
|
61 | 61 | |
62 | - echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | - } |
|
64 | - echo '</ul>'; |
|
62 | + echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>'; |
|
63 | + } |
|
64 | + echo '</ul>'; |
|
65 | 65 | } else { |
66 | - Display::display_warning_message(get_lang('NoSVGImages')); |
|
66 | + Display::display_warning_message(get_lang('NoSVGImages')); |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | </body> |
@@ -59,44 +59,44 @@ discard block |
||
59 | 59 | /* Please, do not modify this dirname formatting */ |
60 | 60 | |
61 | 61 | if (strstr($dir, '..')) { |
62 | - $dir = '/'; |
|
62 | + $dir = '/'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if ($dir[0] == '.') { |
66 | - $dir = substr($dir, 1); |
|
66 | + $dir = substr($dir, 1); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($dir[0] != '/') { |
70 | - $dir = '/'.$dir; |
|
70 | + $dir = '/'.$dir; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($dir[strlen($dir) - 1] != '/') { |
74 | - $dir .= '/'; |
|
74 | + $dir .= '/'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
78 | 78 | |
79 | 79 | if (!is_dir($filepath)) { |
80 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
81 | - $dir = '/'; |
|
80 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
81 | + $dir = '/'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | //groups //TODO:clean |
85 | 85 | if (!empty($group_id)) { |
86 | - $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace')); |
|
87 | - $group_document = true; |
|
88 | - $noPHP_SELF = true; |
|
86 | + $interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace')); |
|
87 | + $group_document = true; |
|
88 | + $noPHP_SELF = true; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
92 | 92 | |
93 | 93 | if (!$is_certificate_mode) |
94 | - $interbreadcrumb[] = array( |
|
95 | - "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
|
96 | - "name" => get_lang('Documents') |
|
97 | - ); |
|
94 | + $interbreadcrumb[] = array( |
|
95 | + "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
|
96 | + "name" => get_lang('Documents') |
|
97 | + ); |
|
98 | 98 | else |
99 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
99 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
|
100 | 100 | |
101 | 101 | // Interbreadcrumb for the current directory root path |
102 | 102 | if (empty($document_data['parents'])) { |
@@ -111,28 +111,28 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | $is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || |
114 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
114 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); |
|
115 | 115 | |
116 | 116 | if (!$is_allowedToEdit) { |
117 | - api_not_allowed(true); |
|
117 | + api_not_allowed(true); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | Event::event_access_tool(TOOL_DOCUMENT); |
121 | 121 | |
122 | 122 | Display :: display_header($nameTools, 'Doc'); |
123 | 123 | echo '<div class="actions">'; |
124 | - echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
125 | - echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
124 | + echo '<a href="document.php?id='.$parent_id.'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
125 | + echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&origin=editdraw">'.Display::return_icon('edit.png',get_lang('Rename').'/'.get_lang('Comments'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
126 | 126 | echo '</div>'; |
127 | 127 | |
128 | 128 | if (api_browser_support('svg')) { |
129 | - // Automatic loading the course language |
|
130 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
131 | - $langsvgedit = api_get_language_isocode(); |
|
132 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
133 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
134 | - $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
135 | - ?> |
|
129 | + // Automatic loading the course language |
|
130 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
131 | + $langsvgedit = api_get_language_isocode(); |
|
132 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
133 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
134 | + $svg_url = api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?url=../../../../../courses/'.$courseDir.$dir.$file.'&lang='.$langsvgedit; |
|
135 | + ?> |
|
136 | 136 | <script> |
137 | 137 | document.write('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); |
138 | 138 | function resizeIframe() { |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | |
151 | 151 | <?php |
152 | 152 | echo '<noscript>'; |
153 | - echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
154 | - echo '</noscript>'; |
|
153 | + echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0\' src="'.$svg_url.'"<noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
154 | + echo '</noscript>'; |
|
155 | 155 | } else { |
156 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
156 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
157 | 157 | } |
158 | 158 | Display::display_footer(); |
@@ -46,59 +46,59 @@ discard block |
||
46 | 46 | // Please, do not modify this dirname formatting |
47 | 47 | |
48 | 48 | if (strstr($dir, '..')) { |
49 | - $dir = '/'; |
|
49 | + $dir = '/'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($dir[0] == '.') { |
53 | - $dir = substr($dir, 1); |
|
53 | + $dir = substr($dir, 1); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($dir[0] != '/') { |
57 | - $dir = '/'.$dir; |
|
57 | + $dir = '/'.$dir; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($dir[strlen($dir) - 1] != '/') { |
61 | - $dir .= '/'; |
|
61 | + $dir .= '/'; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
65 | 65 | |
66 | 66 | if (!is_dir($filepath)) { |
67 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
68 | - $dir = '/'; |
|
67 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
68 | + $dir = '/'; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $groupId = api_get_group_id(); |
72 | 72 | |
73 | 73 | if (!empty($groupId)) { |
74 | - $interbreadcrumb[] = array ( |
|
74 | + $interbreadcrumb[] = array ( |
|
75 | 75 | "url" => "../group/group_space.php?".api_get_cidreq(), |
76 | 76 | "name" => get_lang('GroupSpace') |
77 | 77 | ); |
78 | - $noPHP_SELF = true; |
|
79 | - $group = GroupManager :: get_group_properties($groupId); |
|
80 | - $path = explode('/', $dir); |
|
81 | - if ('/'.$path[1] != $group['directory']) { |
|
82 | - api_not_allowed(true); |
|
83 | - } |
|
78 | + $noPHP_SELF = true; |
|
79 | + $group = GroupManager :: get_group_properties($groupId); |
|
80 | + $path = explode('/', $dir); |
|
81 | + if ('/'.$path[1] != $group['directory']) { |
|
82 | + api_not_allowed(true); |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $interbreadcrumb[] = array( |
87 | - "url" => "./document.php?".api_get_cidreq(), |
|
88 | - "name" => get_lang('Documents') |
|
87 | + "url" => "./document.php?".api_get_cidreq(), |
|
88 | + "name" => get_lang('Documents') |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | if (!$is_allowed_in_course) { |
92 | - api_not_allowed(true); |
|
92 | + api_not_allowed(true); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || |
96 | - DocumentManager::is_my_shared_folder( |
|
97 | - api_get_user_id(), |
|
98 | - Security::remove_XSS($dir), |
|
99 | - api_get_session_id())) |
|
96 | + DocumentManager::is_my_shared_folder( |
|
97 | + api_get_user_id(), |
|
98 | + Security::remove_XSS($dir), |
|
99 | + api_get_session_id())) |
|
100 | 100 | ) { |
101 | - api_not_allowed(true); |
|
101 | + api_not_allowed(true); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | Event::event_access_tool(TOOL_DOCUMENT); |
107 | 107 | $display_dir = $dir; |
108 | 108 | if (isset ($group)) { |
109 | - $display_dir = explode('/', $dir); |
|
110 | - unset ($display_dir[0]); |
|
111 | - unset ($display_dir[1]); |
|
112 | - $display_dir = implode('/', $display_dir); |
|
109 | + $display_dir = explode('/', $dir); |
|
110 | + unset ($display_dir[0]); |
|
111 | + unset ($display_dir[1]); |
|
112 | + $display_dir = implode('/', $display_dir); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Interbreadcrumb for the current directory root path |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | } else { |
124 | 124 | foreach ($document_data['parents'] as $document_sub_data) { |
125 | 125 | $interbreadcrumb[] = array( |
126 | - 'url' => $document_sub_data['document_url'], |
|
127 | - 'name' => $document_sub_data['title'] |
|
128 | - ); |
|
126 | + 'url' => $document_sub_data['document_url'], |
|
127 | + 'name' => $document_sub_data['title'] |
|
128 | + ); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | Display :: display_header($nameTools, 'Doc'); |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | |
138 | 138 | if (api_browser_support('svg')) { |
139 | 139 | |
140 | - //automatic loading the course language |
|
141 | - $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
142 | - $langsvgedit = api_get_language_isocode(); |
|
143 | - $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
144 | - $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
145 | - $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
146 | - ?> |
|
140 | + //automatic loading the course language |
|
141 | + $svgedit_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
|
142 | + $langsvgedit = api_get_language_isocode(); |
|
143 | + $langsvgedit = isset($svgedit_code_translation_table[$langsvgedit]) ? $svgedit_code_translation_table[$langsvgedit] : $langsvgedit; |
|
144 | + $langsvgedit = file_exists(api_get_path(LIBRARY_PATH).'javascript/svgedit/locale/lang.'.$langsvgedit.'.js') ? $langsvgedit : 'en'; |
|
145 | + $svg_url= api_get_path(WEB_LIBRARY_PATH).'javascript/svgedit/svg-editor.php?lang='.$langsvgedit; |
|
146 | + ?> |
|
147 | 147 | <script> |
148 | 148 | document.write ('<iframe id="frame" frameborder="0" scrolling="no" src="<?php echo $svg_url; ?>" width="100%" height="100%"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'); |
149 | 149 | function resizeIframe() { |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | |
162 | 162 | <?php |
163 | 163 | echo '<noscript>'; |
164 | - echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0" src="'.$svg_url.'"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
165 | - echo '</noscript>'; |
|
164 | + echo '<iframe style="height: 550px; width: 100%;" scrolling="no" frameborder="0" src="'.$svg_url.'"><noframes><p>Sorry, your browser does not handle frames</p></noframes></iframe>'; |
|
165 | + echo '</noscript>'; |
|
166 | 166 | } else { |
167 | - Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
167 | + Display::display_error_message(get_lang('BrowserDontSupportsSVG')); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | Display :: display_footer(); |