@@ -269,7 +269,9 @@ discard block |
||
269 | 269 | $clock_expired_time = null; |
270 | 270 | |
271 | 271 | if (empty($exercise_stat_info)) { |
272 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
272 | + if ($debug) { |
|
273 | + error_log('5 $exercise_stat_info is empty '); |
|
274 | + } |
|
273 | 275 | $total_weight = 0; |
274 | 276 | $questionList = $objExercise->get_validated_question_list(); |
275 | 277 | foreach ($questionListUncompressed as $question_id) { |
@@ -280,11 +282,17 @@ discard block |
||
280 | 282 | if ($time_control) { |
281 | 283 | $expected_time = $current_timestamp + $total_seconds; |
282 | 284 | |
283 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
284 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
285 | + if ($debug) { |
|
286 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
287 | + } |
|
288 | + if ($debug) { |
|
289 | + error_log('5.2. $expected_time '.$expected_time); |
|
290 | + } |
|
285 | 291 | |
286 | 292 | $clock_expired_time = api_get_utc_datetime($expected_time); |
287 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
293 | + if ($debug) { |
|
294 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
295 | + } |
|
288 | 296 | |
289 | 297 | //Sessions that contain the expired time |
290 | 298 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -304,8 +312,10 @@ discard block |
||
304 | 312 | $learnpath_item_id, |
305 | 313 | $learnpath_item_view_id |
306 | 314 | ); |
307 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
308 | -} else { |
|
315 | + if ($debug) { |
|
316 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
317 | + } |
|
318 | + } else { |
|
309 | 319 | $exe_id = $exercise_stat_info['exe_id']; |
310 | 320 | // Remember last question id position. |
311 | 321 | $isFirstTime = Session::read('firstTime'); |
@@ -327,8 +337,10 @@ discard block |
||
327 | 337 | } |
328 | 338 | } |
329 | 339 | |
330 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
331 | -} |
|
340 | + if ($debug) { |
|
341 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
342 | + } |
|
343 | + } |
|
332 | 344 | |
333 | 345 | $questionListInSession = Session::read('questionList'); |
334 | 346 | |
@@ -384,9 +396,15 @@ discard block |
||
384 | 396 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
385 | 397 | */ |
386 | 398 | 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]); |
|
399 | + if ($debug) { |
|
400 | + error_log('7.1. Time control is enabled'); |
|
401 | + } |
|
402 | + if ($debug) { |
|
403 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
404 | + } |
|
405 | + if ($debug) { |
|
406 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
407 | + } |
|
390 | 408 | |
391 | 409 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
392 | 410 | //Timer - Get expired_time for a student |
@@ -473,7 +491,9 @@ discard block |
||
473 | 491 | } |
474 | 492 | } |
475 | 493 | |
476 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
494 | +if ($debug) { |
|
495 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
496 | +} |
|
477 | 497 | |
478 | 498 | //Real question count |
479 | 499 | $question_count = 0; |
@@ -171,10 +171,11 @@ |
||
171 | 171 | } |
172 | 172 | echo '</div>'; |
173 | 173 | |
174 | - if ($objExercise->feedback_type == 1) |
|
175 | - Display::display_normal_message( |
|
174 | + if ($objExercise->feedback_type == 1) { |
|
175 | + Display::display_normal_message( |
|
176 | 176 | get_lang('DirectFeedbackCantModifyTypeQuestion') |
177 | 177 | ); |
178 | + } |
|
178 | 179 | |
179 | 180 | if (api_get_setting('search_enabled')=='true' && !extension_loaded('xapian')) { |
180 | 181 | Display::display_error_message(get_lang('SearchXapianModuleNotInstalled')); |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | $use_anonymous = true; |
14 | 14 | |
15 | 15 | $debug = 0; |
16 | -if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
16 | +if ($debug > 0) { |
|
17 | + error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
18 | +} |
|
17 | 19 | |
18 | 20 | // Language files that needs to be included. |
19 | 21 | if (isset($_GET['action'])) { |
@@ -231,10 +233,14 @@ discard block |
||
231 | 233 | // If refresh is set, we regenerate the oLP object from the database (kind of flush). |
232 | 234 | Session::erase('refresh'); |
233 | 235 | $myrefresh = 1; |
234 | - if ($debug > 0) error_log('New LP - Refresh asked', 0); |
|
235 | -} |
|
236 | + if ($debug > 0) { |
|
237 | + error_log('New LP - Refresh asked', 0); |
|
238 | + } |
|
239 | + } |
|
236 | 240 | |
237 | -if ($debug > 0) error_log('New LP - Passed refresh check', 0); |
|
241 | +if ($debug > 0) { |
|
242 | + error_log('New LP - Passed refresh check', 0); |
|
243 | +} |
|
238 | 244 | |
239 | 245 | if (!empty($_REQUEST['dialog_box'])) { |
240 | 246 | $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box'])); |
@@ -244,17 +250,23 @@ discard block |
||
244 | 250 | $lp_found = false; |
245 | 251 | |
246 | 252 | if (isset($_SESSION['lpobject'])) { |
247 | - if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
253 | + if ($debug > 0) { |
|
254 | + error_log('New LP - SESSION[lpobject] is defined', 0); |
|
255 | + } |
|
248 | 256 | $oLP = unserialize($_SESSION['lpobject']); |
249 | 257 | if (isset($oLP) && is_object($oLP)) { |
250 | - if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
258 | + if ($debug > 0) { |
|
259 | + error_log('New LP - oLP is object', 0); |
|
260 | + } |
|
251 | 261 | if ($myrefresh == 1 OR |
252 | 262 | empty($oLP->cc) OR |
253 | 263 | $oLP->cc != api_get_course_id() OR |
254 | 264 | $oLP->lp_view_session_id != $session_id OR |
255 | 265 | $oLP->scorm_debug == '1' |
256 | 266 | ) { |
257 | - if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
267 | + if ($debug > 0) { |
|
268 | + error_log('New LP - Course has changed, discard lp object', 0); |
|
269 | + } |
|
258 | 270 | if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
259 | 271 | $oLP = null; |
260 | 272 | Session::erase('oLP'); |
@@ -268,13 +280,19 @@ discard block |
||
268 | 280 | |
269 | 281 | $course_id = api_get_course_int_id(); |
270 | 282 | |
271 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
283 | +if ($debug>0) { |
|
284 | + error_log('New LP - Passed data remains check', 0); |
|
285 | +} |
|
272 | 286 | |
273 | 287 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
274 | - if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
288 | + if ($debug > 0) { |
|
289 | + error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
290 | + } |
|
275 | 291 | // Regenerate a new lp object? Not always as some pages don't need the object (like upload?) |
276 | 292 | if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) { |
277 | - if ($debug > 0) error_log('New LP - lp_id is defined', 0); |
|
293 | + if ($debug > 0) { |
|
294 | + error_log('New LP - lp_id is defined', 0); |
|
295 | + } |
|
278 | 296 | // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the |
279 | 297 | // right object. |
280 | 298 | if (!empty($_REQUEST['lp_id'])) { |
@@ -286,49 +304,67 @@ discard block |
||
286 | 304 | $lp_table = Database::get_course_table(TABLE_LP_MAIN); |
287 | 305 | if (is_numeric($lp_id)) { |
288 | 306 | $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id"; |
289 | - if ($debug > 0) error_log('New LP - querying '.$sel, 0); |
|
307 | + if ($debug > 0) { |
|
308 | + error_log('New LP - querying '.$sel, 0); |
|
309 | + } |
|
290 | 310 | $res = Database::query($sel); |
291 | 311 | |
292 | 312 | if (Database::num_rows($res)) { |
293 | 313 | $row = Database::fetch_array($res); |
294 | 314 | $type = $row['lp_type']; |
295 | - if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
315 | + if ($debug > 0) { |
|
316 | + error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
317 | + } |
|
296 | 318 | switch ($type) { |
297 | 319 | case 1: |
298 | - if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
320 | + if ($debug > 0) { |
|
321 | + error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
322 | + } |
|
299 | 323 | |
300 | 324 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
301 | 325 | if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); } |
302 | 326 | break; |
303 | 327 | case 2: |
304 | - if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
328 | + if ($debug > 0) { |
|
329 | + error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
330 | + } |
|
305 | 331 | $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
306 | 332 | if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); } |
307 | 333 | break; |
308 | 334 | case 3: |
309 | - if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
335 | + if ($debug > 0) { |
|
336 | + error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
337 | + } |
|
310 | 338 | $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id()); |
311 | 339 | if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); } |
312 | 340 | break; |
313 | 341 | default: |
314 | - if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
342 | + if ($debug > 0) { |
|
343 | + error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
344 | + } |
|
315 | 345 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
316 | 346 | if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); } |
317 | 347 | break; |
318 | 348 | } |
319 | 349 | } |
320 | 350 | } else { |
321 | - if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0); |
|
351 | + if ($debug > 0) { |
|
352 | + error_log('New LP - Request[lp_id] is not numeric', 0); |
|
353 | + } |
|
322 | 354 | } |
323 | 355 | } else { |
324 | - if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
356 | + if ($debug > 0) { |
|
357 | + error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
358 | + } |
|
325 | 359 | } |
326 | 360 | if ($lp_found) { |
327 | 361 | $_SESSION['oLP'] = $oLP; |
328 | 362 | } |
329 | 363 | } |
330 | 364 | |
331 | -if ($debug > 0) error_log('New LP - Passed oLP creation check', 0); |
|
365 | +if ($debug > 0) { |
|
366 | + error_log('New LP - Passed oLP creation check', 0); |
|
367 | +} |
|
332 | 368 | |
333 | 369 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false); |
334 | 370 | |
@@ -372,11 +408,15 @@ discard block |
||
372 | 408 | if (!$is_allowed_to_edit) { |
373 | 409 | api_not_allowed(true); |
374 | 410 | } |
375 | - if ($debug > 0) error_log('New LP - add item action triggered', 0); |
|
411 | + if ($debug > 0) { |
|
412 | + error_log('New LP - add item action triggered', 0); |
|
413 | + } |
|
376 | 414 | |
377 | 415 | if (!$lp_found) { |
378 | 416 | //check if the learnpath ID was defined, otherwise send back to list |
379 | - if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); |
|
417 | + if ($debug > 0) { |
|
418 | + error_log('New LP - No learnpath given for add item', 0); |
|
419 | + } |
|
380 | 420 | require 'lp_list.php'; |
381 | 421 | } else { |
382 | 422 | $_SESSION['refresh'] = 1; |
@@ -465,11 +505,15 @@ discard block |
||
465 | 505 | api_not_allowed(true); |
466 | 506 | } |
467 | 507 | |
468 | - if ($debug > 0) error_log('New LP - add audio action triggered', 0); |
|
508 | + if ($debug > 0) { |
|
509 | + error_log('New LP - add audio action triggered', 0); |
|
510 | + } |
|
469 | 511 | |
470 | 512 | if (!$lp_found) { |
471 | 513 | //check if the learnpath ID was defined, otherwise send back to list |
472 | - if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0); |
|
514 | + if ($debug > 0) { |
|
515 | + error_log('New LP - No learnpath given for add audio', 0); |
|
516 | + } |
|
473 | 517 | require 'lp_list.php'; |
474 | 518 | } else { |
475 | 519 | $_SESSION['refresh'] = 1; |
@@ -543,7 +587,9 @@ discard block |
||
543 | 587 | if (!$is_allowed_to_edit) { |
544 | 588 | api_not_allowed(true); |
545 | 589 | } |
546 | - if ($debug > 0) error_log('New LP - add_lp action triggered', 0); |
|
590 | + if ($debug > 0) { |
|
591 | + error_log('New LP - add_lp action triggered', 0); |
|
592 | + } |
|
547 | 593 | if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) { |
548 | 594 | $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']); |
549 | 595 | $_SESSION['refresh'] = 1; |
@@ -602,7 +648,9 @@ discard block |
||
602 | 648 | if (!$is_allowed_to_edit) { |
603 | 649 | api_not_allowed(true); |
604 | 650 | } |
605 | - if ($debug > 0) error_log('New LP - admin_view action triggered', 0); |
|
651 | + if ($debug > 0) { |
|
652 | + error_log('New LP - admin_view action triggered', 0); |
|
653 | + } |
|
606 | 654 | if (!$lp_found) { |
607 | 655 | error_log('New LP - No learnpath given for admin_view', 0); |
608 | 656 | require 'lp_list.php'; |
@@ -616,9 +664,10 @@ discard block |
||
616 | 664 | if (!$is_allowed_to_edit) { |
617 | 665 | api_not_allowed(true); |
618 | 666 | } |
619 | - if ($debug > 0) error_log('New LP - auto_launch action triggered', 0); |
|
620 | - if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } |
|
621 | - else { |
|
667 | + if ($debug > 0) { |
|
668 | + error_log('New LP - auto_launch action triggered', 0); |
|
669 | + } |
|
670 | + if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else { |
|
622 | 671 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
623 | 672 | require 'lp_list.php'; |
624 | 673 | exit; |
@@ -629,10 +678,11 @@ discard block |
||
629 | 678 | if (!$is_allowed_to_edit) { |
630 | 679 | api_not_allowed(true); |
631 | 680 | } |
632 | - if ($debug > 0) error_log('New LP - build action triggered', 0); |
|
681 | + if ($debug > 0) { |
|
682 | + error_log('New LP - build action triggered', 0); |
|
683 | + } |
|
633 | 684 | |
634 | - if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } |
|
635 | - else { |
|
685 | + if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } else { |
|
636 | 686 | $_SESSION['refresh'] = 1; |
637 | 687 | //require 'lp_build.php'; |
638 | 688 | $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq(); |
@@ -644,7 +694,9 @@ discard block |
||
644 | 694 | if (!$is_allowed_to_edit) { |
645 | 695 | api_not_allowed(true); |
646 | 696 | } |
647 | - if ($debug > 0) error_log('New LP - edit item action triggered', 0); |
|
697 | + if ($debug > 0) { |
|
698 | + error_log('New LP - edit item action triggered', 0); |
|
699 | + } |
|
648 | 700 | |
649 | 701 | if (!$lp_found) { |
650 | 702 | error_log('New LP - No learnpath given for edit item', 0); |
@@ -699,9 +751,10 @@ discard block |
||
699 | 751 | if (!$is_allowed_to_edit) { |
700 | 752 | api_not_allowed(true); |
701 | 753 | } |
702 | - if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0); |
|
703 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } |
|
704 | - else { |
|
754 | + if ($debug > 0) { |
|
755 | + error_log('New LP - edit item prereq action triggered', 0); |
|
756 | + } |
|
757 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else { |
|
705 | 758 | if (isset($_POST['submit_button'])) { |
706 | 759 | //Updating the lp.modified_on |
707 | 760 | $_SESSION['oLP']->set_modified_on(); |
@@ -729,9 +782,10 @@ discard block |
||
729 | 782 | if (!$is_allowed_to_edit) { |
730 | 783 | api_not_allowed(true); |
731 | 784 | } |
732 | - if ($debug > 0) error_log('New LP - move item action triggered', 0); |
|
733 | - if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } |
|
734 | - else { |
|
785 | + if ($debug > 0) { |
|
786 | + error_log('New LP - move item action triggered', 0); |
|
787 | + } |
|
788 | + if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } else { |
|
735 | 789 | $_SESSION['refresh'] = 1; |
736 | 790 | if (isset($_POST['submit_button'])) { |
737 | 791 | //Updating the lp.modified_on |
@@ -764,7 +818,9 @@ discard block |
||
764 | 818 | if (!$is_allowed_to_edit) { |
765 | 819 | api_not_allowed(true); |
766 | 820 | } |
767 | - if ($debug > 0) error_log('New LP - view_item action triggered', 0); |
|
821 | + if ($debug > 0) { |
|
822 | + error_log('New LP - view_item action triggered', 0); |
|
823 | + } |
|
768 | 824 | if (!$lp_found) { |
769 | 825 | error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php'; |
770 | 826 | } else { |
@@ -776,7 +832,9 @@ discard block |
||
776 | 832 | if (!$is_allowed_to_edit) { |
777 | 833 | api_not_allowed(true); |
778 | 834 | } |
779 | - if ($debug > 0) error_log('New LP - upload action triggered', 0); |
|
835 | + if ($debug > 0) { |
|
836 | + error_log('New LP - upload action triggered', 0); |
|
837 | + } |
|
780 | 838 | $cwdir = getcwd(); |
781 | 839 | require 'lp_upload.php'; |
782 | 840 | // Reinit current working directory as many functions in upload change it. |
@@ -793,9 +851,10 @@ discard block |
||
793 | 851 | api_not_allowed(true); |
794 | 852 | } |
795 | 853 | |
796 | - if ($debug > 0) error_log('New LP - export action triggered', 0); |
|
797 | - if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } |
|
798 | - else { |
|
854 | + if ($debug > 0) { |
|
855 | + error_log('New LP - export action triggered', 0); |
|
856 | + } |
|
857 | + if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } else { |
|
799 | 858 | $_SESSION['oLP']->copy(); |
800 | 859 | } |
801 | 860 | require 'lp_list.php'; |
@@ -808,9 +867,10 @@ discard block |
||
808 | 867 | if ($hideScormExportLink === 'true') { |
809 | 868 | api_not_allowed(true); |
810 | 869 | } |
811 | - if ($debug > 0) error_log('New LP - export action triggered', 0); |
|
812 | - if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } |
|
813 | - else { |
|
870 | + if ($debug > 0) { |
|
871 | + error_log('New LP - export action triggered', 0); |
|
872 | + } |
|
873 | + if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } else { |
|
814 | 874 | $_SESSION['oLP']->scorm_export(); |
815 | 875 | exit(); |
816 | 876 | //require 'lp_list.php'; |
@@ -825,7 +885,9 @@ discard block |
||
825 | 885 | api_not_allowed(true); |
826 | 886 | } |
827 | 887 | |
828 | - if ($debug > 0) error_log('New LP - export action triggered', 0); |
|
888 | + if ($debug > 0) { |
|
889 | + error_log('New LP - export action triggered', 0); |
|
890 | + } |
|
829 | 891 | if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php'; |
830 | 892 | } else { |
831 | 893 | $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']); |
@@ -839,9 +901,10 @@ discard block |
||
839 | 901 | if (!$is_allowed_to_edit) { |
840 | 902 | api_not_allowed(true); |
841 | 903 | } |
842 | - if ($debug > 0) error_log('New LP - delete action triggered', 0); |
|
843 | - if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } |
|
844 | - else { |
|
904 | + if ($debug > 0) { |
|
905 | + error_log('New LP - delete action triggered', 0); |
|
906 | + } |
|
907 | + if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } else { |
|
845 | 908 | $_SESSION['refresh'] = 1; |
846 | 909 | $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove'); |
847 | 910 | Session::erase('oLP'); |
@@ -853,9 +916,10 @@ discard block |
||
853 | 916 | if (!$is_allowed_to_edit) { |
854 | 917 | api_not_allowed(true); |
855 | 918 | } |
856 | - if ($debug > 0) error_log('New LP - visibility action triggered', 0); |
|
857 | - if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } |
|
858 | - else { |
|
919 | + if ($debug > 0) { |
|
920 | + error_log('New LP - visibility action triggered', 0); |
|
921 | + } |
|
922 | + if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } else { |
|
859 | 923 | learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']); |
860 | 924 | require 'lp_list.php'; |
861 | 925 | } |
@@ -865,9 +929,10 @@ discard block |
||
865 | 929 | if (!$is_allowed_to_edit) { |
866 | 930 | api_not_allowed(true); |
867 | 931 | } |
868 | - if ($debug > 0) error_log('New LP - publish action triggered', 0); |
|
869 | - if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } |
|
870 | - else { |
|
932 | + if ($debug > 0) { |
|
933 | + error_log('New LP - publish action triggered', 0); |
|
934 | + } |
|
935 | + if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } else { |
|
871 | 936 | learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']); |
872 | 937 | require 'lp_list.php'; |
873 | 938 | } |
@@ -877,7 +942,9 @@ discard block |
||
877 | 942 | if (!$is_allowed_to_edit) { |
878 | 943 | api_not_allowed(true); |
879 | 944 | } |
880 | - if ($debug > 0) error_log('New LP - publish action triggered', 0); |
|
945 | + if ($debug > 0) { |
|
946 | + error_log('New LP - publish action triggered', 0); |
|
947 | + } |
|
881 | 948 | if (!$lp_found) { |
882 | 949 | error_log('New LP - No learnpath given for publish', 0); |
883 | 950 | require 'lp_list.php'; |
@@ -891,7 +958,9 @@ discard block |
||
891 | 958 | if (!$is_allowed_to_edit) { |
892 | 959 | api_not_allowed(true); |
893 | 960 | } |
894 | - if ($debug > 0) error_log('New LP - publish action triggered', 0); |
|
961 | + if ($debug > 0) { |
|
962 | + error_log('New LP - publish action triggered', 0); |
|
963 | + } |
|
895 | 964 | if (!$lp_found) { |
896 | 965 | error_log('New LP - No learnpath given for publish', 0); |
897 | 966 | require 'lp_list.php'; |
@@ -904,9 +973,10 @@ discard block |
||
904 | 973 | if (!$is_allowed_to_edit) { |
905 | 974 | api_not_allowed(true); |
906 | 975 | } |
907 | - if ($debug > 0) error_log('New LP - edit action triggered', 0); |
|
908 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } |
|
909 | - else { |
|
976 | + if ($debug > 0) { |
|
977 | + error_log('New LP - edit action triggered', 0); |
|
978 | + } |
|
979 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else { |
|
910 | 980 | $_SESSION['refresh'] = 1; |
911 | 981 | require 'lp_edit.php'; |
912 | 982 | } |
@@ -915,9 +985,10 @@ discard block |
||
915 | 985 | if (!$is_allowed_to_edit) { |
916 | 986 | api_not_allowed(true); |
917 | 987 | } |
918 | - if ($debug > 0) error_log('New LP - update_lp action triggered', 0); |
|
919 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } |
|
920 | - else { |
|
988 | + if ($debug > 0) { |
|
989 | + error_log('New LP - update_lp action triggered', 0); |
|
990 | + } |
|
991 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else { |
|
921 | 992 | $_SESSION['refresh'] = 1; |
922 | 993 | $lp_name = Security::remove_XSS($_REQUEST['lp_name']); |
923 | 994 | $_SESSION['oLP']->set_name($lp_name); |
@@ -987,8 +1058,9 @@ discard block |
||
987 | 1058 | ); |
988 | 1059 | $extraFieldValue->saveFieldValues($_REQUEST); |
989 | 1060 | |
990 | - if ($_FILES['lp_preview_image']['size'] > 0) |
|
991 | - $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1061 | + if ($_FILES['lp_preview_image']['size'] > 0) { |
|
1062 | + $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']); |
|
1063 | + } |
|
992 | 1064 | |
993 | 1065 | if (api_get_setting('search_enabled') === 'true') { |
994 | 1066 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
@@ -1028,9 +1100,10 @@ discard block |
||
1028 | 1100 | if (!$is_allowed_to_edit) { |
1029 | 1101 | api_not_allowed(true); |
1030 | 1102 | } |
1031 | - if ($debug > 0) error_log('New LP - add sub item action triggered', 0); |
|
1032 | - if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } |
|
1033 | - else { |
|
1103 | + if ($debug > 0) { |
|
1104 | + error_log('New LP - add sub item action triggered', 0); |
|
1105 | + } |
|
1106 | + if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } else { |
|
1034 | 1107 | $_SESSION['refresh'] = 1; |
1035 | 1108 | if (!empty($_REQUEST['parent_item_id'])) { |
1036 | 1109 | $_SESSION['from_learnpath']='yes'; |
@@ -1046,7 +1119,9 @@ discard block |
||
1046 | 1119 | if (!$is_allowed_to_edit) { |
1047 | 1120 | api_not_allowed(true); |
1048 | 1121 | } |
1049 | - if ($debug > 0) error_log('New LP - delete item action triggered', 0); |
|
1122 | + if ($debug > 0) { |
|
1123 | + error_log('New LP - delete item action triggered', 0); |
|
1124 | + } |
|
1050 | 1125 | if (!$lp_found) { |
1051 | 1126 | error_log('New LP - No learnpath given for delete item', 0); |
1052 | 1127 | require 'lp_list.php'; |
@@ -1065,9 +1140,10 @@ discard block |
||
1065 | 1140 | if (!$is_allowed_to_edit) { |
1066 | 1141 | api_not_allowed(true); |
1067 | 1142 | } |
1068 | - if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0); |
|
1069 | - if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } |
|
1070 | - else { |
|
1143 | + if ($debug > 0) { |
|
1144 | + error_log('New LP - edit item prereq action triggered', 0); |
|
1145 | + } |
|
1146 | + if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else { |
|
1071 | 1147 | if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) { |
1072 | 1148 | $_SESSION['refresh'] = 1; |
1073 | 1149 | $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']); |
@@ -1076,64 +1152,80 @@ discard block |
||
1076 | 1152 | } |
1077 | 1153 | break; |
1078 | 1154 | case 'restart': |
1079 | - if ($debug > 0) error_log('New LP - restart action triggered', 0); |
|
1080 | - if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } |
|
1081 | - else { |
|
1155 | + if ($debug > 0) { |
|
1156 | + error_log('New LP - restart action triggered', 0); |
|
1157 | + } |
|
1158 | + if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } else { |
|
1082 | 1159 | $_SESSION['oLP']->restart(); |
1083 | 1160 | require 'lp_view.php'; |
1084 | 1161 | } |
1085 | 1162 | break; |
1086 | 1163 | case 'last': |
1087 | - if ($debug > 0) error_log('New LP - last action triggered', 0); |
|
1088 | - if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } |
|
1089 | - else { |
|
1164 | + if ($debug > 0) { |
|
1165 | + error_log('New LP - last action triggered', 0); |
|
1166 | + } |
|
1167 | + if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } else { |
|
1090 | 1168 | $_SESSION['oLP']->last(); |
1091 | 1169 | require 'lp_view.php'; |
1092 | 1170 | } |
1093 | 1171 | break; |
1094 | 1172 | case 'first': |
1095 | - if ($debug > 0) error_log('New LP - first action triggered', 0); |
|
1096 | - if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } |
|
1097 | - else { |
|
1173 | + if ($debug > 0) { |
|
1174 | + error_log('New LP - first action triggered', 0); |
|
1175 | + } |
|
1176 | + if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } else { |
|
1098 | 1177 | $_SESSION['oLP']->first(); |
1099 | 1178 | require 'lp_view.php'; |
1100 | 1179 | } |
1101 | 1180 | break; |
1102 | 1181 | case 'next': |
1103 | - if ($debug > 0) error_log('New LP - next action triggered', 0); |
|
1104 | - if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } |
|
1105 | - else { |
|
1182 | + if ($debug > 0) { |
|
1183 | + error_log('New LP - next action triggered', 0); |
|
1184 | + } |
|
1185 | + if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } else { |
|
1106 | 1186 | $_SESSION['oLP']->next(); |
1107 | 1187 | require 'lp_view.php'; |
1108 | 1188 | } |
1109 | 1189 | break; |
1110 | 1190 | case 'previous': |
1111 | - if ($debug > 0) error_log('New LP - previous action triggered', 0); |
|
1112 | - if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } |
|
1113 | - else { |
|
1191 | + if ($debug > 0) { |
|
1192 | + error_log('New LP - previous action triggered', 0); |
|
1193 | + } |
|
1194 | + if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } else { |
|
1114 | 1195 | $_SESSION['oLP']->previous(); |
1115 | 1196 | require 'lp_view.php'; |
1116 | 1197 | } |
1117 | 1198 | break; |
1118 | 1199 | case 'content': |
1119 | - if ($debug > 0) error_log('New LP - content action triggered', 0); |
|
1120 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1200 | + if ($debug > 0) { |
|
1201 | + error_log('New LP - content action triggered', 0); |
|
1202 | + } |
|
1203 | + if ($debug > 0) { |
|
1204 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1205 | + } |
|
1121 | 1206 | if (!$lp_found) { |
1122 | 1207 | error_log('New LP - No learnpath given for content', 0); |
1123 | 1208 | require 'lp_list.php'; |
1124 | 1209 | } else { |
1125 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1210 | + if ($debug > 0) { |
|
1211 | + error_log('New LP - save_last()', 0); |
|
1212 | + } |
|
1126 | 1213 | $_SESSION['oLP']->save_last(); |
1127 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1214 | + if ($debug > 0) { |
|
1215 | + error_log('New LP - set_current_item()', 0); |
|
1216 | + } |
|
1128 | 1217 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1129 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1218 | + if ($debug > 0) { |
|
1219 | + error_log('New LP - start_current_item()', 0); |
|
1220 | + } |
|
1130 | 1221 | $_SESSION['oLP']->start_current_item(); |
1131 | 1222 | require 'lp_content.php'; |
1132 | 1223 | } |
1133 | 1224 | break; |
1134 | 1225 | case 'view': |
1135 | - if ($debug > 0) |
|
1136 | - error_log('New LP - view action triggered', 0); |
|
1226 | + if ($debug > 0) { |
|
1227 | + error_log('New LP - view action triggered', 0); |
|
1228 | + } |
|
1137 | 1229 | if (!$lp_found) { |
1138 | 1230 | error_log('New LP - No learnpath given for view', 0); |
1139 | 1231 | require 'lp_list.php'; |
@@ -1146,17 +1238,19 @@ discard block |
||
1146 | 1238 | } |
1147 | 1239 | break; |
1148 | 1240 | case 'save': |
1149 | - if ($debug > 0) error_log('New LP - save action triggered', 0); |
|
1150 | - if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } |
|
1151 | - else { |
|
1241 | + if ($debug > 0) { |
|
1242 | + error_log('New LP - save action triggered', 0); |
|
1243 | + } |
|
1244 | + if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } else { |
|
1152 | 1245 | $_SESSION['oLP']->save_item(); |
1153 | 1246 | require 'lp_save.php'; |
1154 | 1247 | } |
1155 | 1248 | break; |
1156 | 1249 | case 'stats': |
1157 | - if ($debug > 0) error_log('New LP - stats action triggered', 0); |
|
1158 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1159 | - else { |
|
1250 | + if ($debug > 0) { |
|
1251 | + error_log('New LP - stats action triggered', 0); |
|
1252 | + } |
|
1253 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1160 | 1254 | $_SESSION['oLP']->save_current(); |
1161 | 1255 | $_SESSION['oLP']->save_last(); |
1162 | 1256 | $output = require 'lp_stats.php'; |
@@ -1164,7 +1258,9 @@ discard block |
||
1164 | 1258 | } |
1165 | 1259 | break; |
1166 | 1260 | case 'list': |
1167 | - if ($debug > 0) error_log('New LP - list action triggered', 0); |
|
1261 | + if ($debug > 0) { |
|
1262 | + error_log('New LP - list action triggered', 0); |
|
1263 | + } |
|
1168 | 1264 | if ($lp_found) { |
1169 | 1265 | $_SESSION['refresh'] = 1; |
1170 | 1266 | $_SESSION['oLP']->save_last(); |
@@ -1173,7 +1269,9 @@ discard block |
||
1173 | 1269 | break; |
1174 | 1270 | case 'mode': |
1175 | 1271 | // Switch between fullscreen and embedded mode. |
1176 | - if ($debug > 0) error_log('New LP - mode change triggered', 0); |
|
1272 | + if ($debug > 0) { |
|
1273 | + error_log('New LP - mode change triggered', 0); |
|
1274 | + } |
|
1177 | 1275 | $mode = $_REQUEST['mode']; |
1178 | 1276 | if ($mode == 'fullscreen') { |
1179 | 1277 | $_SESSION['oLP']->mode = 'fullscreen'; |
@@ -1187,7 +1285,9 @@ discard block |
||
1187 | 1285 | require 'lp_view.php'; |
1188 | 1286 | break; |
1189 | 1287 | case 'switch_view_mode': |
1190 | - if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0); |
|
1288 | + if ($debug > 0) { |
|
1289 | + error_log('New LP - switch_view_mode action triggered', 0); |
|
1290 | + } |
|
1191 | 1291 | if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
1192 | 1292 | if (Security::check_token('get')) { |
1193 | 1293 | $_SESSION['refresh'] = 1; |
@@ -1196,7 +1296,9 @@ discard block |
||
1196 | 1296 | require 'lp_list.php'; |
1197 | 1297 | break; |
1198 | 1298 | case 'switch_force_commit': |
1199 | - if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0); |
|
1299 | + if ($debug > 0) { |
|
1300 | + error_log('New LP - switch_force_commit action triggered', 0); |
|
1301 | + } |
|
1200 | 1302 | if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
1201 | 1303 | $_SESSION['refresh'] = 1; |
1202 | 1304 | $_SESSION['oLP']->update_default_scorm_commit(); |
@@ -1219,25 +1321,33 @@ discard block |
||
1219 | 1321 | break; |
1220 | 1322 | */ |
1221 | 1323 | case 'switch_attempt_mode': |
1222 | - if($debug>0) error_log('New LP - switch_reinit action triggered',0); |
|
1324 | + if($debug>0) { |
|
1325 | + error_log('New LP - switch_reinit action triggered',0); |
|
1326 | + } |
|
1223 | 1327 | if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; } |
1224 | 1328 | $_SESSION['refresh'] = 1; |
1225 | 1329 | $_SESSION['oLP']->switch_attempt_mode(); |
1226 | 1330 | require 'lp_list.php'; |
1227 | 1331 | break; |
1228 | 1332 | case 'switch_scorm_debug': |
1229 | - if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0); |
|
1333 | + if ($debug > 0) { |
|
1334 | + error_log('New LP - switch_scorm_debug action triggered', 0); |
|
1335 | + } |
|
1230 | 1336 | if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
1231 | 1337 | $_SESSION['refresh'] = 1; |
1232 | 1338 | $_SESSION['oLP']->update_scorm_debug(); |
1233 | 1339 | require 'lp_list.php'; |
1234 | 1340 | break; |
1235 | 1341 | case 'intro_cmdAdd': |
1236 | - if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0); |
|
1342 | + if ($debug > 0) { |
|
1343 | + error_log('New LP - intro_cmdAdd action triggered', 0); |
|
1344 | + } |
|
1237 | 1345 | // Add introduction section page. |
1238 | 1346 | break; |
1239 | 1347 | case 'js_api_refresh': |
1240 | - if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0); |
|
1348 | + if ($debug > 0) { |
|
1349 | + error_log('New LP - js_api_refresh action triggered', 0); |
|
1350 | + } |
|
1241 | 1351 | if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; } |
1242 | 1352 | if (isset($_REQUEST['item_id'])) { |
1243 | 1353 | $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']); |
@@ -1245,8 +1355,7 @@ discard block |
||
1245 | 1355 | require 'lp_message.php'; |
1246 | 1356 | break; |
1247 | 1357 | case 'return_to_course_homepage': |
1248 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1249 | - else { |
|
1358 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1250 | 1359 | $_SESSION['oLP']->save_current(); |
1251 | 1360 | $_SESSION['oLP']->save_last(); |
1252 | 1361 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1264,8 +1373,9 @@ discard block |
||
1264 | 1373 | require 'lp_list_search.php'; |
1265 | 1374 | break; |
1266 | 1375 | case 'impress': |
1267 | - if ($debug > 0) |
|
1268 | - error_log('New LP - view action triggered', 0); |
|
1376 | + if ($debug > 0) { |
|
1377 | + error_log('New LP - view action triggered', 0); |
|
1378 | + } |
|
1269 | 1379 | if (!$lp_found) { |
1270 | 1380 | error_log('New LP - No learnpath given for view', 0); |
1271 | 1381 | require 'lp_list.php'; |
@@ -1439,15 +1549,19 @@ discard block |
||
1439 | 1549 | ]); |
1440 | 1550 | break; |
1441 | 1551 | default: |
1442 | - if ($debug > 0) error_log('New LP - default action triggered', 0); |
|
1552 | + if ($debug > 0) { |
|
1553 | + error_log('New LP - default action triggered', 0); |
|
1554 | + } |
|
1443 | 1555 | require 'lp_list.php'; |
1444 | 1556 | break; |
1445 | 1557 | } |
1446 | 1558 | |
1447 | 1559 | if (!empty($_SESSION['oLP'])) { |
1448 | 1560 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1449 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1450 | -} |
|
1561 | + if ($debug > 0) { |
|
1562 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1563 | + } |
|
1564 | + } |
|
1451 | 1565 | |
1452 | 1566 | if (!empty($redirectTo)) { |
1453 | 1567 | header("Location: $redirectTo"); |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | break; |
47 | 47 | case "stackgetall": |
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + } |
|
50 | 51 | break; |
51 | 52 | case "getposition": |
52 | 53 | print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
@@ -87,8 +88,7 @@ discard block |
||
87 | 88 | } else { |
88 | 89 | return $row['sv_value']; |
89 | 90 | } |
90 | - } |
|
91 | - else { |
|
91 | + } else { |
|
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | } |
@@ -144,8 +144,7 @@ discard block |
||
144 | 144 | if (Database::num_rows($res) > 0) { |
145 | 145 | $row = Database::fetch_assoc($res); |
146 | 146 | return $row['position']; |
147 | - } |
|
148 | - else { |
|
147 | + } else { |
|
149 | 148 | return null; |
150 | 149 | } |
151 | 150 | } |
@@ -198,8 +197,7 @@ discard block |
||
198 | 197 | if ($resorder && $resinsert) { |
199 | 198 | Database::query("commit"); |
200 | 199 | return 1; |
201 | - } |
|
202 | - else { |
|
200 | + } else { |
|
203 | 201 | Database::query("rollback"); |
204 | 202 | return 0; |
205 | 203 | } |
@@ -459,11 +459,12 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if ($package_type == '' || !$mandatory) |
|
463 | - // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
462 | + if ($package_type == '' || !$mandatory) { |
|
463 | + // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
464 | 464 | { |
465 | 465 | return api_failure::set_failure('not_aicc_content'); |
466 | 466 | } |
467 | + } |
|
467 | 468 | |
468 | 469 | if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) { |
469 | 470 | return api_failure::set_failure('not_enough_space'); |
@@ -511,7 +512,9 @@ discard block |
||
511 | 512 | if ($file != '.' && $file != '..') { |
512 | 513 | $filetype = 'file'; |
513 | 514 | |
514 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
515 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
516 | + $filetype = 'folder'; |
|
517 | + } |
|
515 | 518 | |
516 | 519 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
517 | 520 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -910,37 +913,43 @@ discard block |
||
910 | 913 | if ($enclosed && $data{$i+1} == $enclosure) { |
911 | 914 | $fldval .= $chr; |
912 | 915 | ++$i; // Skip the next character. |
913 | - } else |
|
914 | - $enclosed = !$enclosed; |
|
916 | + } else { |
|
917 | + $enclosed = !$enclosed; |
|
918 | + } |
|
915 | 919 | break; |
916 | 920 | case $delim: |
917 | 921 | if (!$enclosed) { |
918 | 922 | $ret_array[$linecount][$fldcount++] = $fldval; |
919 | 923 | $fldval = ''; |
920 | - } else |
|
921 | - $fldval .= $chr; |
|
924 | + } else { |
|
925 | + $fldval .= $chr; |
|
926 | + } |
|
922 | 927 | break; |
923 | 928 | case "\r": |
924 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
925 | - continue; |
|
929 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
930 | + continue; |
|
931 | + } |
|
926 | 932 | case "\n": |
927 | 933 | if (!$enclosed) { |
928 | 934 | $ret_array[$linecount++][$fldcount] = $fldval; |
929 | 935 | $fldcount = 0; |
930 | 936 | $fldval = ''; |
931 | - } else |
|
932 | - $fldval .= $chr; |
|
937 | + } else { |
|
938 | + $fldval .= $chr; |
|
939 | + } |
|
933 | 940 | break; |
934 | 941 | case "\\r": |
935 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
936 | - continue; |
|
942 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
943 | + continue; |
|
944 | + } |
|
937 | 945 | case "\\n": |
938 | 946 | if (!$enclosed) { |
939 | 947 | $ret_array[$linecount++][$fldcount] = $fldval; |
940 | 948 | $fldcount = 0; |
941 | 949 | $fldval = ''; |
942 | - } else |
|
943 | - $fldval .= $chr; |
|
950 | + } else { |
|
951 | + $fldval .= $chr; |
|
952 | + } |
|
944 | 953 | break; |
945 | 954 | default: |
946 | 955 | $fldval .= $chr; |
@@ -119,8 +119,9 @@ |
||
119 | 119 | |
120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
121 | 121 | |
122 | - if (empty($matches[1][$i])) |
|
123 | - continue; |
|
122 | + if (empty($matches[1][$i])) { |
|
123 | + continue; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
126 | 127 | if ($i + 1 !== count($matches[0])) { |
@@ -341,8 +341,7 @@ |
||
341 | 341 | case '1': // coming from Agenda |
342 | 342 | if ($action == 'edit') { |
343 | 343 | $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource"; |
344 | - } |
|
345 | - elseif ($action == 'add') { |
|
344 | + } elseif ($action == 'add') { |
|
346 | 345 | $url = "../calendar/agenda.php?action=add&originalresource=$originalresource"; |
347 | 346 | } else { |
348 | 347 | $url = "../calendar/agenda.php?action=add"; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | //just showing the src in a iframe ... |
82 | 82 | $html .= '<h2>'.$toc['title'].'</h2>'; |
83 | 83 | $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>'; |
84 | - }else{ |
|
84 | + } else{ |
|
85 | 85 | $html .= "<div class='impress-title'>"; |
86 | 86 | $html .= '<h1>'.$toc['title'].'</h1>'; |
87 | 87 | $html .= "</div>"; |
@@ -119,8 +119,9 @@ |
||
119 | 119 | |
120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
121 | 121 | |
122 | - if (empty($matches[1][$i])) |
|
123 | - continue; |
|
122 | + if (empty($matches[1][$i])) { |
|
123 | + continue; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
126 | 127 | if ($i + 1 !== count($matches[0])) { |