Passed
Push — 1.10.x ( 36635d...62de0e )
by Angel Fernando Quiroz
156:32 queued 106:39
created
main/newscorm/lp_controller.php 2 patches
Switch Indentation   +886 added lines, -886 removed lines patch added patch discarded remove patch
@@ -365,815 +365,815 @@  discard block
 block discarded – undo
365 365
 }
366 366
 
367 367
 switch ($action) {
368
-    case 'add_item':
369
-        if (!$is_allowed_to_edit) {
370
-            api_not_allowed(true);
371
-        }
372
-        if ($debug > 0) error_log('New LP - add item action triggered', 0);
373
-
374
-        if (!$lp_found) {
375
-            //check if the learnpath ID was defined, otherwise send back to list
376
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
377
-            require 'lp_list.php';
378
-        } else {
379
-            $_SESSION['refresh'] = 1;
368
+        case 'add_item':
369
+            if (!$is_allowed_to_edit) {
370
+                api_not_allowed(true);
371
+            }
372
+            if ($debug > 0) error_log('New LP - add item action triggered', 0);
380 373
 
381
-            if (isset($_POST['submit_button']) && !empty($post_title)) {
382
-                // If a title was sumbitted:
374
+            if (!$lp_found) {
375
+                //check if the learnpath ID was defined, otherwise send back to list
376
+                if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
377
+                require 'lp_list.php';
378
+            } else {
379
+                $_SESSION['refresh'] = 1;
383 380
 
384
-                //Updating the lp.modified_on
385
-                $_SESSION['oLP']->set_modified_on();
381
+                if (isset($_POST['submit_button']) && !empty($post_title)) {
382
+                    // If a title was sumbitted:
386 383
 
387
-                if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_POST['post_time']) {
388
-                    // Check post_time to ensure ??? (counter-hacking measure?)
389
-                    require 'lp_add_item.php';
390
-                } else {
384
+                    //Updating the lp.modified_on
385
+                    $_SESSION['oLP']->set_modified_on();
391 386
 
392
-                    $_SESSION['post_time'] = $_POST['post_time'];
387
+                    if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_POST['post_time']) {
388
+                        // Check post_time to ensure ??? (counter-hacking measure?)
389
+                        require 'lp_add_item.php';
390
+                    } else {
393 391
 
394
-                    $parent = isset($_POST['parent']) ? $_POST['parent'] : '';
395
-                    $previous = isset($_POST['previous']) ? $_POST['previous'] : '';
396
-                    $type = isset($_POST['type']) ? $_POST['type'] : '';
397
-                    $path = isset($_POST['path']) ? $_POST['path'] : '';
398
-                    $description = isset($_POST['description']) ? $_POST['description'] : '';
399
-                    $prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
400
-                    $maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
392
+                        $_SESSION['post_time'] = $_POST['post_time'];
393
+
394
+                        $parent = isset($_POST['parent']) ? $_POST['parent'] : '';
395
+                        $previous = isset($_POST['previous']) ? $_POST['previous'] : '';
396
+                        $type = isset($_POST['type']) ? $_POST['type'] : '';
397
+                        $path = isset($_POST['path']) ? $_POST['path'] : '';
398
+                        $description = isset($_POST['description']) ? $_POST['description'] : '';
399
+                        $prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
400
+                        $maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
401
+
402
+                        if ($_POST['type'] == TOOL_DOCUMENT) {
403
+                            if (isset($_POST['path']) && $_GET['edit'] != 'true') {
404
+                                $document_id = $_POST['path'];
405
+                            } else {
406
+                                if ($_POST['content_lp']) {
407
+                                    $document_id = $_SESSION['oLP']->create_document(
408
+                                        $_course,
409
+                                        $_POST['content_lp'],
410
+                                        $_POST['title']
411
+                                    );
412
+                                }
413
+                            }
401 414
 
402
-                    if ($_POST['type'] == TOOL_DOCUMENT) {
403
-                        if (isset($_POST['path']) && $_GET['edit'] != 'true') {
404
-                            $document_id = $_POST['path'];
415
+                            $new_item_id = $_SESSION['oLP']->add_item(
416
+                                $parent,
417
+                                $previous,
418
+                                $type,
419
+                                $document_id,
420
+                                $post_title,
421
+                                $description,
422
+                                $prerequisites
423
+                            );
405 424
                         } else {
406
-                            if ($_POST['content_lp']) {
407
-                                $document_id = $_SESSION['oLP']->create_document(
408
-                                    $_course,
409
-                                    $_POST['content_lp'],
410
-                                    $_POST['title']
411
-                                );
412
-                            }
425
+                            // For all other item types than documents, load the item using the item type and path rather than its ID.
426
+                            $new_item_id = $_SESSION['oLP']->add_item(
427
+                                $parent,
428
+                                $previous,
429
+                                $type,
430
+                                $path,
431
+                                $post_title,
432
+                                $description,
433
+                                $prerequisites,
434
+                                $maxTimeAllowed
435
+                            );
413 436
                         }
414
-
415
-                        $new_item_id = $_SESSION['oLP']->add_item(
416
-                            $parent,
417
-                            $previous,
418
-                            $type,
419
-                            $document_id,
420
-                            $post_title,
421
-                            $description,
422
-                            $prerequisites
423
-                        );
424
-                    } else {
425
-                        // For all other item types than documents, load the item using the item type and path rather than its ID.
426
-                        $new_item_id = $_SESSION['oLP']->add_item(
427
-                            $parent,
428
-                            $previous,
429
-                            $type,
430
-                            $path,
431
-                            $post_title,
432
-                            $description,
433
-                            $prerequisites,
434
-                            $maxTimeAllowed
435
-                        );
437
+                        $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
438
+                        header('Location: '.$url);
439
+                        exit;
436 440
                     }
437
-                    $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
438
-                    header('Location: '.$url);
439
-                    exit;
441
+                } else {
442
+                    require 'lp_add_item.php';
440 443
                 }
441
-            } else {
442
-                require 'lp_add_item.php';
443 444
             }
444
-        }
445
-        break;
446
-    case 'add_audio':
447
-        if (!$is_allowed_to_edit) {
448
-            api_not_allowed(true);
449
-        }
450
-        if ($debug > 0) error_log('New LP - add audio action triggered', 0);
451
-
452
-        if (!$lp_found) {
453
-            //check if the learnpath ID was defined, otherwise send back to list
454
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
455
-            require 'lp_list.php';
456
-        } else {
457
-            $_SESSION['refresh'] = 1;
458
-
459
-            if (isset($_REQUEST['id'])) {
460
-                $lp_item_obj = new learnpathItem($_REQUEST['id']);
445
+            break;
446
+        case 'add_audio':
447
+            if (!$is_allowed_to_edit) {
448
+                api_not_allowed(true);
449
+            }
450
+            if ($debug > 0) error_log('New LP - add audio action triggered', 0);
461 451
 
462
-                // Remove audio
463
-                if (isset($_GET['delete_file']) && $_GET['delete_file'] == 1) {
464
-                    $lp_item_obj->remove_audio();
452
+            if (!$lp_found) {
453
+                //check if the learnpath ID was defined, otherwise send back to list
454
+                if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
455
+                require 'lp_list.php';
456
+            } else {
457
+                $_SESSION['refresh'] = 1;
465 458
 
466
-                    $url = api_get_self().'?action=add_audio&lp_id='.intval($_SESSION['oLP']->lp_id).'&id='.$lp_item_obj->get_id().'&'.api_get_cidreq();
467
-                    header('Location: '.$url);
468
-                    exit;
469
-                }
459
+                if (isset($_REQUEST['id'])) {
460
+                    $lp_item_obj = new learnpathItem($_REQUEST['id']);
470 461
 
471
-                // Upload audio
472
-                if (isset($_FILES['file']) && !empty($_FILES['file'])) {
473
-                    // Updating the lp.modified_on
474
-                    $_SESSION['oLP']->set_modified_on();
475
-                    $lp_item_obj->add_audio();
476
-                }
462
+                    // Remove audio
463
+                    if (isset($_GET['delete_file']) && $_GET['delete_file'] == 1) {
464
+                        $lp_item_obj->remove_audio();
477 465
 
478
-                //Add audio file from documents
479
-                if (isset($_REQUEST['document_id']) && !empty($_REQUEST['document_id'])) {
480
-                    $_SESSION['oLP']->set_modified_on();
481
-                    $lp_item_obj->add_audio_from_documents($_REQUEST['document_id']);
482
-                }
466
+                        $url = api_get_self().'?action=add_audio&lp_id='.intval($_SESSION['oLP']->lp_id).'&id='.$lp_item_obj->get_id().'&'.api_get_cidreq();
467
+                        header('Location: '.$url);
468
+                        exit;
469
+                    }
483 470
 
484
-                // Display.
485
-                require 'lp_add_audio.php';
486
-            } else {
487
-                require 'lp_add_audio.php';
488
-            }
489
-        }
490
-        break;
491
-    case 'add_lp_category':
492
-        if (!$is_allowed_to_edit) {
493
-            api_not_allowed(true);
494
-        }
495
-        require 'lp_add_category.php';
496
-        break;
497
-    case 'move_up_category':
498
-        if (!$is_allowed_to_edit) {
499
-            api_not_allowed(true);
500
-        }
501
-        if (isset($_REQUEST['id'])) {
502
-            learnpath::moveUpCategory($_REQUEST['id']);
503
-        }
504
-        require 'lp_list.php';
505
-        break;
506
-    case 'move_down_category':
507
-        if (!$is_allowed_to_edit) {
508
-            api_not_allowed(true);
509
-        }
510
-        if (isset($_REQUEST['id'])) {
511
-            learnpath::moveDownCategory($_REQUEST['id']);
512
-        }
513
-        require 'lp_list.php';
514
-        break;
515
-    case 'delete_lp_category':
516
-        if (!$is_allowed_to_edit) {
517
-            api_not_allowed(true);
518
-        }
519
-        if (isset($_REQUEST['id'])) {
520
-            learnpath::deleteCategory($_REQUEST['id']);
521
-        }
522
-        require 'lp_list.php';
523
-        break;
524
-    case 'add_lp':
525
-        if (!$is_allowed_to_edit) {
526
-            api_not_allowed(true);
527
-        }
528
-        if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
529
-        if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
530
-            $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
531
-            $_SESSION['refresh'] = 1;
471
+                    // Upload audio
472
+                    if (isset($_FILES['file']) && !empty($_FILES['file'])) {
473
+                        // Updating the lp.modified_on
474
+                        $_SESSION['oLP']->set_modified_on();
475
+                        $lp_item_obj->add_audio();
476
+                    }
532 477
 
533
-            if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_REQUEST['post_time']) {
534
-                require 'lp_add.php';
535
-            } else {
536
-                $_SESSION['post_time'] = $_REQUEST['post_time'];
478
+                    //Add audio file from documents
479
+                    if (isset($_REQUEST['document_id']) && !empty($_REQUEST['document_id'])) {
480
+                        $_SESSION['oLP']->set_modified_on();
481
+                        $lp_item_obj->add_audio_from_documents($_REQUEST['document_id']);
482
+                    }
537 483
 
538
-                if (isset($_REQUEST['activate_start_date_check']) &&
539
-                    $_REQUEST['activate_start_date_check'] == 1
540
-                ) {
541
-                	$publicated_on = $_REQUEST['publicated_on'];
484
+                    // Display.
485
+                    require 'lp_add_audio.php';
542 486
                 } else {
543
-                	$publicated_on = null;
487
+                    require 'lp_add_audio.php';
544 488
                 }
489
+            }
490
+            break;
491
+        case 'add_lp_category':
492
+            if (!$is_allowed_to_edit) {
493
+                api_not_allowed(true);
494
+            }
495
+            require 'lp_add_category.php';
496
+            break;
497
+        case 'move_up_category':
498
+            if (!$is_allowed_to_edit) {
499
+                api_not_allowed(true);
500
+            }
501
+            if (isset($_REQUEST['id'])) {
502
+                learnpath::moveUpCategory($_REQUEST['id']);
503
+            }
504
+            require 'lp_list.php';
505
+            break;
506
+        case 'move_down_category':
507
+            if (!$is_allowed_to_edit) {
508
+                api_not_allowed(true);
509
+            }
510
+            if (isset($_REQUEST['id'])) {
511
+                learnpath::moveDownCategory($_REQUEST['id']);
512
+            }
513
+            require 'lp_list.php';
514
+            break;
515
+        case 'delete_lp_category':
516
+            if (!$is_allowed_to_edit) {
517
+                api_not_allowed(true);
518
+            }
519
+            if (isset($_REQUEST['id'])) {
520
+                learnpath::deleteCategory($_REQUEST['id']);
521
+            }
522
+            require 'lp_list.php';
523
+            break;
524
+        case 'add_lp':
525
+            if (!$is_allowed_to_edit) {
526
+                api_not_allowed(true);
527
+            }
528
+            if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
529
+            if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
530
+                $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
531
+                $_SESSION['refresh'] = 1;
545 532
 
546
-                if (isset($_REQUEST['activate_end_date_check']) &&
547
-                    $_REQUEST['activate_end_date_check'] == 1
548
-                ) {
549
-                	$expired_on = $_REQUEST['expired_on'];
533
+                if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_REQUEST['post_time']) {
534
+                    require 'lp_add.php';
550 535
                 } else {
551
-                	$expired_on = null;
552
-                }
536
+                    $_SESSION['post_time'] = $_REQUEST['post_time'];
553 537
 
554
-                $new_lp_id = learnpath::add_lp(
555
-                    api_get_course_id(),
556
-                    Security::remove_XSS($_REQUEST['lp_name']),
557
-                    '',
558
-                    'chamilo',
559
-                    'manual',
560
-                    '',
561
-                    $publicated_on,
562
-                    $expired_on,
563
-                    $_REQUEST['category_id']
564
-                );
538
+                    if (isset($_REQUEST['activate_start_date_check']) &&
539
+                        $_REQUEST['activate_start_date_check'] == 1
540
+                    ) {
541
+                	    $publicated_on = $_REQUEST['publicated_on'];
542
+                    } else {
543
+                	    $publicated_on = null;
544
+                    }
565 545
 
566
-                if (is_numeric($new_lp_id)) {
567
-                    // TODO: Maybe create a first module directly to avoid bugging the user with useless queries
568
-                    $_SESSION['oLP'] = new learnpath(
546
+                    if (isset($_REQUEST['activate_end_date_check']) &&
547
+                        $_REQUEST['activate_end_date_check'] == 1
548
+                    ) {
549
+                	    $expired_on = $_REQUEST['expired_on'];
550
+                    } else {
551
+                	    $expired_on = null;
552
+                    }
553
+
554
+                    $new_lp_id = learnpath::add_lp(
569 555
                         api_get_course_id(),
570
-                        $new_lp_id,
571
-                        api_get_user_id()
556
+                        Security::remove_XSS($_REQUEST['lp_name']),
557
+                        '',
558
+                        'chamilo',
559
+                        'manual',
560
+                        '',
561
+                        $publicated_on,
562
+                        $expired_on,
563
+                        $_REQUEST['category_id']
572 564
                     );
573
-                    //require 'lp_build.php';
574
-                    $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($new_lp_id).'&'.api_get_cidreq();
575
-                    header("Location: $url&isStudentView=false");
565
+
566
+                    if (is_numeric($new_lp_id)) {
567
+                        // TODO: Maybe create a first module directly to avoid bugging the user with useless queries
568
+                        $_SESSION['oLP'] = new learnpath(
569
+                            api_get_course_id(),
570
+                            $new_lp_id,
571
+                            api_get_user_id()
572
+                        );
573
+                        //require 'lp_build.php';
574
+                        $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($new_lp_id).'&'.api_get_cidreq();
575
+                        header("Location: $url&isStudentView=false");
576
+                        exit;
577
+                    }
578
+                }
579
+            } else {
580
+                require 'lp_add.php';
581
+            }
582
+            break;
583
+        case 'admin_view':
584
+            if (!$is_allowed_to_edit) {
585
+                api_not_allowed(true);
586
+            }
587
+            if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
588
+            if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
589
+            else {
590
+                $_SESSION['refresh'] = 1;
591
+                require 'lp_admin_view.php';
592
+            }
593
+            break;
594
+        case 'auto_launch':
595
+            if (api_get_course_setting('enable_lp_auto_launch') == 1) { //Redirect to a specific LP
596
+                if (!$is_allowed_to_edit) {
597
+                    api_not_allowed(true);
598
+                }
599
+                if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
600
+                if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
601
+                else {
602
+                    $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
603
+                    require 'lp_list.php';
576 604
                     exit;
577 605
                 }
578 606
             }
579
-        } else {
580
-            require 'lp_add.php';
581
-        }
582
-        break;
583
-    case 'admin_view':
584
-        if (!$is_allowed_to_edit) {
585
-            api_not_allowed(true);
586
-        }
587
-        if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
588
-        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
589
-        else {
590
-            $_SESSION['refresh'] = 1;
591
-            require 'lp_admin_view.php';
592
-        }
593
-        break;
594
-    case 'auto_launch':
595
-        if (api_get_course_setting('enable_lp_auto_launch') == 1) { //Redirect to a specific LP
607
+            break;
608
+        case 'build':
596 609
             if (!$is_allowed_to_edit) {
597 610
                 api_not_allowed(true);
598 611
             }
599
-            if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
600
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
612
+            if ($debug > 0) error_log('New LP - build action triggered', 0);
613
+
614
+            if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
601 615
             else {
602
-                $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
603
-                require 'lp_list.php';
616
+                $_SESSION['refresh'] = 1;
617
+                //require 'lp_build.php';
618
+                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
619
+                header('Location: '.$url);
604 620
                 exit;
605 621
             }
606
-        }
607
-        break;
608
-    case 'build':
609
-        if (!$is_allowed_to_edit) {
610
-            api_not_allowed(true);
611
-        }
612
-        if ($debug > 0) error_log('New LP - build action triggered', 0);
622
+            break;
623
+        case 'edit_item':
624
+            if (!$is_allowed_to_edit) {
625
+                api_not_allowed(true);
626
+            }
627
+            if ($debug > 0) error_log('New LP - edit item action triggered', 0);
613 628
 
614
-        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
615
-        else {
616
-            $_SESSION['refresh'] = 1;
617
-            //require 'lp_build.php';
618
-            $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
619
-            header('Location: '.$url);
620
-            exit;
621
-        }
622
-        break;
623
-    case 'edit_item':
624
-        if (!$is_allowed_to_edit) {
625
-            api_not_allowed(true);
626
-        }
627
-        if ($debug > 0) error_log('New LP - edit item action triggered', 0);
629
+            if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
630
+            else {
631
+                $_SESSION['refresh'] = 1;
632
+                if (isset($_POST['submit_button']) && !empty($post_title)) {
628 633
 
629
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
630
-        else {
631
-            $_SESSION['refresh'] = 1;
632
-            if (isset($_POST['submit_button']) && !empty($post_title)) {
634
+                    //Updating the lp.modified_on
635
+                    $_SESSION['oLP']->set_modified_on();
633 636
 
634
-                //Updating the lp.modified_on
635
-                $_SESSION['oLP']->set_modified_on();
637
+                    // TODO: mp3 edit
638
+                    $audio = array();
639
+                    if (isset($_FILES['mp3'])) {
640
+                        $audio = $_FILES['mp3'];
641
+                    }
636 642
 
637
-                // TODO: mp3 edit
638
-                $audio = array();
639
-                if (isset($_FILES['mp3'])) {
640
-                    $audio = $_FILES['mp3'];
641
-                }
643
+                    $description = isset($_POST['description']) ? $_POST['description'] : '';
644
+                    $prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
645
+                    $maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
646
+                    $url = isset($_POST['url']) ? $_POST['url'] : '';
647
+
648
+                    $_SESSION['oLP']->edit_item(
649
+                        $_REQUEST['id'],
650
+                        $_POST['parent'],
651
+                        $_POST['previous'],
652
+                        $post_title,
653
+                        $description,
654
+                        $prerequisites,
655
+                        $audio,
656
+                        $maxTimeAllowed,
657
+                        $url
658
+                    );
642 659
 
643
-                $description = isset($_POST['description']) ? $_POST['description'] : '';
644
-                $prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
645
-                $maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
646
-                $url = isset($_POST['url']) ? $_POST['url'] : '';
647
-
648
-                $_SESSION['oLP']->edit_item(
649
-                    $_REQUEST['id'],
650
-                    $_POST['parent'],
651
-                    $_POST['previous'],
652
-                    $post_title,
653
-                    $description,
654
-                    $prerequisites,
655
-                    $audio,
656
-                    $maxTimeAllowed,
657
-                    $url
658
-                );
660
+                    if (isset($_POST['content_lp'])) {
661
+                        $_SESSION['oLP']->edit_document($_course);
662
+                    }
663
+                    $is_success = true;
659 664
 
660
-                if (isset($_POST['content_lp'])) {
661
-                    $_SESSION['oLP']->edit_document($_course);
665
+                    $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
666
+                    header('Location: '.$url);
667
+                    exit;
662 668
                 }
663
-                $is_success = true;
669
+                if (isset($_GET['view']) && $_GET['view'] == 'build') {
670
+                    require 'lp_edit_item.php';
671
+                } else {
672
+                    require 'lp_admin_view.php';
673
+                }
674
+            }
675
+            break;
676
+        case 'edit_item_prereq':
677
+            if (!$is_allowed_to_edit) {
678
+                api_not_allowed(true);
679
+            }
680
+            if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
681
+            if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
682
+            else {
683
+                if (isset($_POST['submit_button'])) {
684
+                    //Updating the lp.modified_on
685
+                    $_SESSION['oLP']->set_modified_on();
686
+                    $_SESSION['refresh'] = 1;
687
+                    $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
688
+                        $_GET['id'],
689
+                        $_POST['prerequisites'],
690
+                        $_POST['min_' . $_POST['prerequisites']],
691
+                        $_POST['max_' . $_POST['prerequisites']]
692
+                    );
664 693
 
665
-                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
666
-                header('Location: '.$url);
667
-                exit;
694
+                    if ($editPrerequisite) {
695
+                        $is_success = true;
696
+                    }
697
+
698
+                    $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
699
+                    header('Location: '.$url);
700
+                    exit;
701
+                } else {
702
+                    require 'lp_edit_item_prereq.php';
703
+                }
668 704
             }
669
-            if (isset($_GET['view']) && $_GET['view'] == 'build') {
670
-                require 'lp_edit_item.php';
671
-            } else {
672
-                require 'lp_admin_view.php';
705
+            break;
706
+        case 'move_item':
707
+            if (!$is_allowed_to_edit) {
708
+                api_not_allowed(true);
673 709
             }
674
-        }
675
-        break;
676
-    case 'edit_item_prereq':
677
-        if (!$is_allowed_to_edit) {
678
-            api_not_allowed(true);
679
-        }
680
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
681
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
682
-        else {
683
-            if (isset($_POST['submit_button'])) {
684
-                //Updating the lp.modified_on
685
-                $_SESSION['oLP']->set_modified_on();
710
+            if ($debug > 0) error_log('New LP - move item action triggered', 0);
711
+            if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
712
+            else {
686 713
                 $_SESSION['refresh'] = 1;
687
-                $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
688
-                    $_GET['id'],
689
-                    $_POST['prerequisites'],
690
-                    $_POST['min_' . $_POST['prerequisites']],
691
-                    $_POST['max_' . $_POST['prerequisites']]
692
-                );
693
-
694
-                if ($editPrerequisite) {
714
+                if (isset($_POST['submit_button'])) {
715
+                    //Updating the lp.modified_on
716
+                    $_SESSION['oLP']->set_modified_on();
717
+                    $_SESSION['oLP']->edit_item(
718
+                        $_GET['id'],
719
+                        $_POST['parent'],
720
+                        $_POST['previous'],
721
+                        $post_title,
722
+                        $_POST['description']
723
+                    );
695 724
                     $is_success = true;
725
+                    $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
726
+                    header('Location: '.$url);
727
+                }
728
+                if (isset($_GET['view']) && $_GET['view'] == 'build') {
729
+                    require 'lp_move_item.php';
730
+                } else {
731
+                    // Avoids weird behaviours see CT#967.
732
+                    $check = Security::check_token('get');
733
+                    if ($check) {
734
+                        $_SESSION['oLP']->move_item($_GET['id'], $_GET['direction']);
735
+                    }
736
+                    Security::clear_token();
737
+                    require 'lp_admin_view.php';
696 738
                 }
697
-
698
-                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
699
-                header('Location: '.$url);
700
-                exit;
701
-            } else {
702
-                require 'lp_edit_item_prereq.php';
703 739
             }
704
-        }
705
-        break;
706
-    case 'move_item':
707
-        if (!$is_allowed_to_edit) {
708
-            api_not_allowed(true);
709
-        }
710
-        if ($debug > 0) error_log('New LP - move item action triggered', 0);
711
-        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
712
-        else {
713
-            $_SESSION['refresh'] = 1;
714
-            if (isset($_POST['submit_button'])) {
715
-                //Updating the lp.modified_on
716
-                $_SESSION['oLP']->set_modified_on();
717
-                $_SESSION['oLP']->edit_item(
718
-                    $_GET['id'],
719
-                    $_POST['parent'],
720
-                    $_POST['previous'],
721
-                    $post_title,
722
-                    $_POST['description']
723
-                );
724
-                $is_success = true;
725
-                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
726
-                header('Location: '.$url);
740
+            break;
741
+        case 'view_item':
742
+            if (!$is_allowed_to_edit) {
743
+                api_not_allowed(true);
727 744
             }
728
-            if (isset($_GET['view']) && $_GET['view'] == 'build') {
729
-                require 'lp_move_item.php';
745
+            if ($debug > 0) error_log('New LP - view_item action triggered', 0);
746
+            if (!$lp_found) {
747
+                error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
730 748
             } else {
731
-                // Avoids weird behaviours see CT#967.
732
-                $check = Security::check_token('get');
733
-                if ($check) {
734
-                    $_SESSION['oLP']->move_item($_GET['id'], $_GET['direction']);
735
-                }
736
-                Security::clear_token();
737
-                require 'lp_admin_view.php';
749
+                $_SESSION['refresh'] = 1;
750
+                require 'lp_view_item.php';
751
+            }
752
+            break;
753
+        case 'upload':
754
+            if (!$is_allowed_to_edit) {
755
+                api_not_allowed(true);
756
+            }
757
+            if ($debug > 0) error_log('New LP - upload action triggered', 0);
758
+            $cwdir = getcwd();
759
+            require 'lp_upload.php';
760
+            // Reinit current working directory as many functions in upload change it.
761
+            chdir($cwdir);
762
+            require 'lp_list.php';
763
+            break;
764
+        case 'copy':
765
+            if (!$is_allowed_to_edit) {
766
+                api_not_allowed(true);
738 767
             }
739
-        }
740
-        break;
741
-    case 'view_item':
742
-        if (!$is_allowed_to_edit) {
743
-            api_not_allowed(true);
744
-        }
745
-        if ($debug > 0) error_log('New LP - view_item action triggered', 0);
746
-        if (!$lp_found) {
747
-            error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
748
-        } else {
749
-            $_SESSION['refresh'] = 1;
750
-            require 'lp_view_item.php';
751
-        }
752
-        break;
753
-    case 'upload':
754
-        if (!$is_allowed_to_edit) {
755
-            api_not_allowed(true);
756
-        }
757
-        if ($debug > 0) error_log('New LP - upload action triggered', 0);
758
-        $cwdir = getcwd();
759
-        require 'lp_upload.php';
760
-        // Reinit current working directory as many functions in upload change it.
761
-        chdir($cwdir);
762
-        require 'lp_list.php';
763
-        break;
764
-    case 'copy':
765
-        if (!$is_allowed_to_edit) {
766
-            api_not_allowed(true);
767
-        }
768 768
 
769
-        $hideScormCopyLink = api_get_setting('hide_scorm_copy_link');
770
-        if ($hideScormCopyLink === 'true') {
771
-            api_not_allowed(true);
772
-        }
769
+            $hideScormCopyLink = api_get_setting('hide_scorm_copy_link');
770
+            if ($hideScormCopyLink === 'true') {
771
+                api_not_allowed(true);
772
+            }
773 773
 
774
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
775
-        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
776
-        else {
777
-            $_SESSION['oLP']->copy();
778
-        }
779
-        require 'lp_list.php';
780
-        break;
781
-    case 'export':
782
-        if (!$is_allowed_to_edit) {
783
-            api_not_allowed(true);
784
-        }
785
-        $hideScormExportLink = api_get_setting('hide_scorm_export_link');
786
-        if ($hideScormExportLink === 'true') {
787
-            api_not_allowed(true);
788
-        }
789
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
790
-        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
791
-        else {
792
-            $_SESSION['oLP']->scorm_export();
793
-            exit();
794
-            //require 'lp_list.php';
795
-        }
796
-        break;
797
-    case 'export_to_pdf':
798
-        if (!learnpath::is_lp_visible_for_student($_SESSION['oLP']->lp_id, api_get_user_id())) {
799
-            api_not_allowed();
800
-        }
801
-        $hideScormPdfLink = api_get_setting('hide_scorm_pdf_link');
802
-        if ($hideScormPdfLink === 'true') {
803
-            api_not_allowed(true);
804
-        }
774
+            if ($debug > 0) error_log('New LP - export action triggered', 0);
775
+            if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
776
+            else {
777
+                $_SESSION['oLP']->copy();
778
+            }
779
+            require 'lp_list.php';
780
+            break;
781
+        case 'export':
782
+            if (!$is_allowed_to_edit) {
783
+                api_not_allowed(true);
784
+            }
785
+            $hideScormExportLink = api_get_setting('hide_scorm_export_link');
786
+            if ($hideScormExportLink === 'true') {
787
+                api_not_allowed(true);
788
+            }
789
+            if ($debug > 0) error_log('New LP - export action triggered', 0);
790
+            if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
791
+            else {
792
+                $_SESSION['oLP']->scorm_export();
793
+                exit();
794
+                //require 'lp_list.php';
795
+            }
796
+            break;
797
+        case 'export_to_pdf':
798
+            if (!learnpath::is_lp_visible_for_student($_SESSION['oLP']->lp_id, api_get_user_id())) {
799
+                api_not_allowed();
800
+            }
801
+            $hideScormPdfLink = api_get_setting('hide_scorm_pdf_link');
802
+            if ($hideScormPdfLink === 'true') {
803
+                api_not_allowed(true);
804
+            }
805 805
 
806
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
807
-        if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
808
-        } else {
809
-            $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
810
-            if (!$result) {
806
+            if ($debug > 0) error_log('New LP - export action triggered', 0);
807
+            if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
808
+            } else {
809
+                $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
810
+                if (!$result) {
811
+                    require 'lp_list.php';
812
+                }
813
+                exit;
814
+            }
815
+            break;
816
+        case 'delete':
817
+            if (!$is_allowed_to_edit) {
818
+                api_not_allowed(true);
819
+            }
820
+            if ($debug > 0) error_log('New LP - delete action triggered', 0);
821
+            if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
822
+            else {
823
+                $_SESSION['refresh'] = 1;
824
+                $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
825
+                Session::erase('oLP');
811 826
                 require 'lp_list.php';
812 827
             }
813
-            exit;
814
-        }
815
-        break;
816
-    case 'delete':
817
-        if (!$is_allowed_to_edit) {
818
-            api_not_allowed(true);
819
-        }
820
-        if ($debug > 0) error_log('New LP - delete action triggered', 0);
821
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
822
-        else {
823
-            $_SESSION['refresh'] = 1;
824
-            $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
825
-            Session::erase('oLP');
826
-            require 'lp_list.php';
827
-        }
828
-        break;
829
-    case 'toggle_visible':
830
-        // Change lp visibility (inside lp tool).
831
-        if (!$is_allowed_to_edit) {
832
-            api_not_allowed(true);
833
-        }
834
-        if ($debug > 0) error_log('New LP - visibility action triggered', 0);
835
-        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
836
-        else {
837
-            learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
838
-            require 'lp_list.php';
839
-        }
840
-        break;
841
-    case 'toggle_publish':
842
-        // Change lp published status (visibility on homepage).
843
-        if (!$is_allowed_to_edit) {
844
-            api_not_allowed(true);
845
-        }
846
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
847
-        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
848
-        else {
849
-            learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
850
-            require 'lp_list.php';
851
-        }
852
-        break;
853
-    case 'move_lp_up':
854
-        // Change lp published status (visibility on homepage)
855
-        if (!$is_allowed_to_edit) {
856
-            api_not_allowed(true);
857
-        }
858
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
859
-        if (!$lp_found) {
860
-            error_log('New LP - No learnpath given for publish', 0);
861
-            require 'lp_list.php';
862
-        } else {
863
-            learnpath::move_up($_REQUEST['lp_id']);
864
-            require 'lp_list.php';
865
-        }
866
-        break;
867
-    case 'move_lp_down':
868
-        // Change lp published status (visibility on homepage)
869
-        if (!$is_allowed_to_edit) {
870
-            api_not_allowed(true);
871
-        }
872
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
873
-        if (!$lp_found) {
874
-            error_log('New LP - No learnpath given for publish', 0);
875
-            require 'lp_list.php';
876
-        } else {
877
-            learnpath::move_down($_REQUEST['lp_id']);
878
-            require 'lp_list.php';
879
-        }
880
-        break;
881
-    case 'edit':
882
-        if (!$is_allowed_to_edit) {
883
-            api_not_allowed(true);
884
-        }
885
-        if ($debug > 0) error_log('New LP - edit action triggered', 0);
886
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
887
-        else {
888
-            $_SESSION['refresh'] = 1;
889
-            require 'lp_edit.php';
890
-        }
891
-        break;
892
-    case 'update_lp':
893
-        if (!$is_allowed_to_edit) {
894
-            api_not_allowed(true);
895
-        }
896
-        if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
897
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
898
-        else {
899
-            $_SESSION['refresh'] = 1;
900
-            $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
901
-            $_SESSION['oLP']->set_name($lp_name);
902
-            $author = $_REQUEST['lp_author'];
903
-            // Fixing the author name (no body or html tags).
904
-            $auth_init = stripos($author, '<p>');
905
-            if ($auth_init === false) {
906
-                $auth_init = stripos($author, '<body>');
907
-                $auth_end = $auth_init + stripos(substr($author, $auth_init + 6), '</body>') + 7;
908
-                $len = $auth_end - $auth_init + 6;
828
+            break;
829
+        case 'toggle_visible':
830
+            // Change lp visibility (inside lp tool).
831
+            if (!$is_allowed_to_edit) {
832
+                api_not_allowed(true);
833
+            }
834
+            if ($debug > 0) error_log('New LP - visibility action triggered', 0);
835
+            if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
836
+            else {
837
+                learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
838
+                require 'lp_list.php';
839
+            }
840
+            break;
841
+        case 'toggle_publish':
842
+            // Change lp published status (visibility on homepage).
843
+            if (!$is_allowed_to_edit) {
844
+                api_not_allowed(true);
845
+            }
846
+            if ($debug > 0) error_log('New LP - publish action triggered', 0);
847
+            if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
848
+            else {
849
+                learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
850
+                require 'lp_list.php';
851
+            }
852
+            break;
853
+        case 'move_lp_up':
854
+            // Change lp published status (visibility on homepage)
855
+            if (!$is_allowed_to_edit) {
856
+                api_not_allowed(true);
857
+            }
858
+            if ($debug > 0) error_log('New LP - publish action triggered', 0);
859
+            if (!$lp_found) {
860
+                error_log('New LP - No learnpath given for publish', 0);
861
+                require 'lp_list.php';
862
+            } else {
863
+                learnpath::move_up($_REQUEST['lp_id']);
864
+                require 'lp_list.php';
865
+            }
866
+            break;
867
+        case 'move_lp_down':
868
+            // Change lp published status (visibility on homepage)
869
+            if (!$is_allowed_to_edit) {
870
+                api_not_allowed(true);
871
+            }
872
+            if ($debug > 0) error_log('New LP - publish action triggered', 0);
873
+            if (!$lp_found) {
874
+                error_log('New LP - No learnpath given for publish', 0);
875
+                require 'lp_list.php';
909 876
             } else {
910
-                $auth_end = strripos($author, '</p>');
911
-                $len = $auth_end - $auth_init + 4;
877
+                learnpath::move_down($_REQUEST['lp_id']);
878
+                require 'lp_list.php';
879
+            }
880
+            break;
881
+        case 'edit':
882
+            if (!$is_allowed_to_edit) {
883
+                api_not_allowed(true);
884
+            }
885
+            if ($debug > 0) error_log('New LP - edit action triggered', 0);
886
+            if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
887
+            else {
888
+                $_SESSION['refresh'] = 1;
889
+                require 'lp_edit.php';
890
+            }
891
+            break;
892
+        case 'update_lp':
893
+            if (!$is_allowed_to_edit) {
894
+                api_not_allowed(true);
912 895
             }
896
+            if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
897
+            if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
898
+            else {
899
+                $_SESSION['refresh'] = 1;
900
+                $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
901
+                $_SESSION['oLP']->set_name($lp_name);
902
+                $author = $_REQUEST['lp_author'];
903
+                // Fixing the author name (no body or html tags).
904
+                $auth_init = stripos($author, '<p>');
905
+                if ($auth_init === false) {
906
+                    $auth_init = stripos($author, '<body>');
907
+                    $auth_end = $auth_init + stripos(substr($author, $auth_init + 6), '</body>') + 7;
908
+                    $len = $auth_end - $auth_init + 6;
909
+                } else {
910
+                    $auth_end = strripos($author, '</p>');
911
+                    $len = $auth_end - $auth_init + 4;
912
+                }
913 913
 
914
-            $author_fixed = substr($author, $auth_init, $len);
915
-            //$author_fixed = $author;
914
+                $author_fixed = substr($author, $auth_init, $len);
915
+                //$author_fixed = $author;
916 916
 
917
-            $_SESSION['oLP']->set_author($author_fixed);
918
-            // TODO (as of Chamilo 1.8.8): Check in the future whether this field is needed.
919
-            $_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']);
917
+                $_SESSION['oLP']->set_author($author_fixed);
918
+                // TODO (as of Chamilo 1.8.8): Check in the future whether this field is needed.
919
+                $_SESSION['oLP']->set_encoding($_REQUEST['lp_encoding']);
920 920
 
921
-            if (isset($_REQUEST['lp_maker'])) {
922
-                $_SESSION['oLP']->set_maker($_REQUEST['lp_maker']);
923
-            }
924
-            if (isset($_REQUEST['lp_proximity'])) {
925
-                $_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']);
926
-            }
927
-            $_SESSION['oLP']->set_theme($_REQUEST['lp_theme']);
921
+                if (isset($_REQUEST['lp_maker'])) {
922
+                    $_SESSION['oLP']->set_maker($_REQUEST['lp_maker']);
923
+                }
924
+                if (isset($_REQUEST['lp_proximity'])) {
925
+                    $_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']);
926
+                }
927
+                $_SESSION['oLP']->set_theme($_REQUEST['lp_theme']);
928 928
 
929
-            if (isset($_REQUEST['hide_toc_frame']) && $_REQUEST['hide_toc_frame'] == 1) {
930
-                $hide_toc_frame = $_REQUEST['hide_toc_frame'];
931
-            } else {
932
-                $hide_toc_frame = null;
933
-            }
934
-            $_SESSION['oLP']->set_hide_toc_frame($hide_toc_frame);
935
-            $_SESSION['oLP']->set_prerequisite($_REQUEST['prerequisites']);
936
-            $_SESSION['oLP']->set_use_max_score($_REQUEST['use_max_score']);
937
-            $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
929
+                if (isset($_REQUEST['hide_toc_frame']) && $_REQUEST['hide_toc_frame'] == 1) {
930
+                    $hide_toc_frame = $_REQUEST['hide_toc_frame'];
931
+                } else {
932
+                    $hide_toc_frame = null;
933
+                }
934
+                $_SESSION['oLP']->set_hide_toc_frame($hide_toc_frame);
935
+                $_SESSION['oLP']->set_prerequisite($_REQUEST['prerequisites']);
936
+                $_SESSION['oLP']->set_use_max_score($_REQUEST['use_max_score']);
937
+                $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
938 938
 
939
-            if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
940
-            	$publicated_on  = $_REQUEST['publicated_on'];
941
-            } else {
942
-            	$publicated_on = null;
943
-            }
939
+                if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
940
+            	    $publicated_on  = $_REQUEST['publicated_on'];
941
+                } else {
942
+            	    $publicated_on = null;
943
+                }
944 944
 
945
-            if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
946
-                $expired_on = $_REQUEST['expired_on'];
947
-            } else {
948
-                $expired_on = null;
949
-            }
950
-            $_SESSION['oLP']->setCategoryId($_REQUEST['category_id']);
951
-            $_SESSION['oLP']->set_modified_on();
952
-            $_SESSION['oLP']->set_publicated_on($publicated_on);
953
-            $_SESSION['oLP']->set_expired_on($expired_on);
954
-
955
-            if (isset($_REQUEST['remove_picture']) && $_REQUEST['remove_picture']) {
956
-                $_SESSION['oLP']->delete_lp_image();
957
-            }
958
-
959
-            $extraFieldValue = new ExtraFieldValue('lp');
960
-            $params = array(
961
-                'lp_id' => $_SESSION['oLP']->id
962
-            );
963
-            $extraFieldValue->saveFieldValues($_REQUEST);
964
-
965
-            if ($_FILES['lp_preview_image']['size'] > 0)
966
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
967
-
968
-            if (api_get_setting('search_enabled') === 'true') {
969
-                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
970
-                $specific_fields = get_specific_field_list();
971
-                foreach ($specific_fields as $specific_field) {
972
-                    $_SESSION['oLP']->set_terms_by_prefix($_REQUEST[$specific_field['code']], $specific_field['code']);
973
-                    $new_values = explode(',', trim($_REQUEST[$specific_field['code']]));
974
-                    if (!empty($new_values)) {
975
-                        array_walk($new_values, 'trim');
976
-                        delete_all_specific_field_value(
977
-                            api_get_course_id(),
978
-                            $specific_field['id'],
979
-                            TOOL_LEARNPATH,
980
-                            $_SESSION['oLP']->lp_id
981
-                        );
945
+                if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
946
+                    $expired_on = $_REQUEST['expired_on'];
947
+                } else {
948
+                    $expired_on = null;
949
+                }
950
+                $_SESSION['oLP']->setCategoryId($_REQUEST['category_id']);
951
+                $_SESSION['oLP']->set_modified_on();
952
+                $_SESSION['oLP']->set_publicated_on($publicated_on);
953
+                $_SESSION['oLP']->set_expired_on($expired_on);
954
+
955
+                if (isset($_REQUEST['remove_picture']) && $_REQUEST['remove_picture']) {
956
+                    $_SESSION['oLP']->delete_lp_image();
957
+                }
982 958
 
983
-                        foreach ($new_values as $value) {
984
-                            if (!empty($value)) {
985
-                                add_specific_field_value(
986
-                                    $specific_field['id'],
987
-                                    api_get_course_id(),
988
-                                    TOOL_LEARNPATH,
989
-                                    $_SESSION['oLP']->lp_id,
990
-                                    $value
991
-                                );
959
+                $extraFieldValue = new ExtraFieldValue('lp');
960
+                $params = array(
961
+                    'lp_id' => $_SESSION['oLP']->id
962
+                );
963
+                $extraFieldValue->saveFieldValues($_REQUEST);
964
+
965
+                if ($_FILES['lp_preview_image']['size'] > 0)
966
+                    $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
967
+
968
+                if (api_get_setting('search_enabled') === 'true') {
969
+                    require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
970
+                    $specific_fields = get_specific_field_list();
971
+                    foreach ($specific_fields as $specific_field) {
972
+                        $_SESSION['oLP']->set_terms_by_prefix($_REQUEST[$specific_field['code']], $specific_field['code']);
973
+                        $new_values = explode(',', trim($_REQUEST[$specific_field['code']]));
974
+                        if (!empty($new_values)) {
975
+                            array_walk($new_values, 'trim');
976
+                            delete_all_specific_field_value(
977
+                                api_get_course_id(),
978
+                                $specific_field['id'],
979
+                                TOOL_LEARNPATH,
980
+                                $_SESSION['oLP']->lp_id
981
+                            );
982
+
983
+                            foreach ($new_values as $value) {
984
+                                if (!empty($value)) {
985
+                                    add_specific_field_value(
986
+                                        $specific_field['id'],
987
+                                        api_get_course_id(),
988
+                                        TOOL_LEARNPATH,
989
+                                        $_SESSION['oLP']->lp_id,
990
+                                        $value
991
+                                    );
992
+                                }
992 993
                             }
993 994
                         }
994 995
                     }
995 996
                 }
997
+                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
998
+                header('Location: '.$url);
999
+                exit;
996 1000
             }
997
-            $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq();
998
-            header('Location: '.$url);
999
-            exit;
1000
-        }
1001
-        break;
1002
-    case 'add_sub_item': // Add an item inside a chapter.
1003
-        if (!$is_allowed_to_edit) {
1004
-            api_not_allowed(true);
1005
-        }
1006
-        if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1007
-        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1008
-        else {
1009
-            $_SESSION['refresh'] = 1;
1010
-            if (!empty($_REQUEST['parent_item_id'])) {
1011
-                $_SESSION['from_learnpath']='yes';
1012
-                $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1013
-                require 'resourcelinker.php';
1014
-            } else {
1001
+            break;
1002
+        case 'add_sub_item': // Add an item inside a chapter.
1003
+            if (!$is_allowed_to_edit) {
1004
+                api_not_allowed(true);
1005
+            }
1006
+            if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1007
+            if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1008
+            else {
1009
+                $_SESSION['refresh'] = 1;
1010
+                if (!empty($_REQUEST['parent_item_id'])) {
1011
+                    $_SESSION['from_learnpath']='yes';
1012
+                    $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1013
+                    require 'resourcelinker.php';
1014
+                } else {
1015
+                    require 'lp_admin_view.php';
1016
+                }
1017
+            }
1018
+            break;
1019
+        case 'deleteitem':
1020
+        case 'delete_item':
1021
+            if (!$is_allowed_to_edit) {
1022
+                api_not_allowed(true);
1023
+            }
1024
+            if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1025
+            if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1026
+            else {
1027
+                //$_SESSION['refresh'] = 1;
1028
+                if (!empty($_REQUEST['id'])) {
1029
+                    $_SESSION['oLP']->delete_item($_REQUEST['id']);
1030
+                }
1031
+                $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_REQUEST['lp_id']).api_get_cidreq();
1032
+                header('Location: '.$url);
1033
+                exit;
1034
+            }
1035
+            break;
1036
+        case 'edititemprereq':
1037
+        case 'edit_item_prereq':
1038
+            if (!$is_allowed_to_edit) {
1039
+                api_not_allowed(true);
1040
+            }
1041
+            if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1042
+            if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1043
+            else {
1044
+                if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1045
+                    $_SESSION['refresh'] = 1;
1046
+                    $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
1047
+                }
1015 1048
                 require 'lp_admin_view.php';
1016 1049
             }
1017
-        }
1018
-        break;
1019
-    case 'deleteitem':
1020
-    case 'delete_item':
1021
-        if (!$is_allowed_to_edit) {
1022
-            api_not_allowed(true);
1023
-        }
1024
-        if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1025
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1026
-        else {
1027
-            //$_SESSION['refresh'] = 1;
1028
-            if (!empty($_REQUEST['id'])) {
1029
-                $_SESSION['oLP']->delete_item($_REQUEST['id']);
1030
-            }
1031
-            $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_REQUEST['lp_id']).api_get_cidreq();
1032
-            header('Location: '.$url);
1033
-            exit;
1034
-        }
1035
-        break;
1036
-    case 'edititemprereq':
1037
-    case 'edit_item_prereq':
1038
-        if (!$is_allowed_to_edit) {
1039
-            api_not_allowed(true);
1040
-        }
1041
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1042
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1043
-        else {
1044
-            if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1050
+            break;
1051
+        case 'restart':
1052
+            if ($debug > 0) error_log('New LP - restart action triggered', 0);
1053
+            if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1054
+            else {
1055
+                $_SESSION['oLP']->restart();
1056
+                require 'lp_view.php';
1057
+            }
1058
+            break;
1059
+        case 'last':
1060
+            if ($debug > 0) error_log('New LP - last action triggered', 0);
1061
+            if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1062
+            else {
1063
+                $_SESSION['oLP']->last();
1064
+                require 'lp_view.php';
1065
+            }
1066
+            break;
1067
+        case 'first':
1068
+            if ($debug > 0) error_log('New LP - first action triggered', 0);
1069
+            if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1070
+            else {
1071
+                $_SESSION['oLP']->first();
1072
+                require 'lp_view.php';
1073
+            }
1074
+            break;
1075
+        case 'next':
1076
+            if ($debug > 0) error_log('New LP - next action triggered', 0);
1077
+            if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1078
+            else {
1079
+                $_SESSION['oLP']->next();
1080
+                require 'lp_view.php';
1081
+            }
1082
+            break;
1083
+        case 'previous':
1084
+            if ($debug > 0) error_log('New LP - previous action triggered', 0);
1085
+            if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1086
+            else {
1087
+                $_SESSION['oLP']->previous();
1088
+                require 'lp_view.php';
1089
+            }
1090
+            break;
1091
+        case 'content':
1092
+            if ($debug > 0) error_log('New LP - content action triggered', 0);
1093
+            if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1094
+            if (!$lp_found) {
1095
+                error_log('New LP - No learnpath given for content', 0);
1096
+                require 'lp_list.php';
1097
+            }
1098
+            else {
1099
+                $_SESSION['oLP']->save_last();
1100
+                $_SESSION['oLP']->set_current_item($_GET['item_id']);
1101
+                $_SESSION['oLP']->start_current_item();
1102
+                require 'lp_content.php';
1103
+            }
1104
+            break;
1105
+        case 'view':
1106
+            if ($debug > 0)
1107
+                error_log('New LP - view action triggered', 0);
1108
+            if (!$lp_found) {
1109
+                error_log('New LP - No learnpath given for view', 0);
1110
+                require 'lp_list.php';
1111
+            } else {
1112
+                if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1113
+                if ( !empty($_REQUEST['item_id']) ) {
1114
+                    $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1115
+                }
1116
+                require 'lp_view.php';
1117
+            }
1118
+            break;
1119
+        case 'save':
1120
+            if ($debug > 0) error_log('New LP - save action triggered', 0);
1121
+            if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1122
+            else {
1123
+                $_SESSION['oLP']->save_item();
1124
+                require 'lp_save.php';
1125
+            }
1126
+            break;
1127
+        case 'stats':
1128
+            if ($debug > 0) error_log('New LP - stats action triggered', 0);
1129
+            if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1130
+            else {
1131
+                $_SESSION['oLP']->save_current();
1132
+                $_SESSION['oLP']->save_last();
1133
+                $output = require 'lp_stats.php';
1134
+                echo $output;
1135
+            }
1136
+            break;
1137
+        case 'list':
1138
+            if ($debug > 0) error_log('New LP - list action triggered', 0);
1139
+            if ($lp_found) {
1045 1140
                 $_SESSION['refresh'] = 1;
1046
-                $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
1141
+                $_SESSION['oLP']->save_last();
1047 1142
             }
1048
-            require 'lp_admin_view.php';
1049
-        }
1050
-        break;
1051
-    case 'restart':
1052
-        if ($debug > 0) error_log('New LP - restart action triggered', 0);
1053
-        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1054
-        else {
1055
-            $_SESSION['oLP']->restart();
1056
-            require 'lp_view.php';
1057
-        }
1058
-        break;
1059
-    case 'last':
1060
-        if ($debug > 0) error_log('New LP - last action triggered', 0);
1061
-        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1062
-        else {
1063
-            $_SESSION['oLP']->last();
1064
-            require 'lp_view.php';
1065
-        }
1066
-        break;
1067
-    case 'first':
1068
-        if ($debug > 0) error_log('New LP - first action triggered', 0);
1069
-        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1070
-        else {
1071
-            $_SESSION['oLP']->first();
1072
-            require 'lp_view.php';
1073
-        }
1074
-        break;
1075
-    case 'next':
1076
-        if ($debug > 0) error_log('New LP - next action triggered', 0);
1077
-        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1078
-        else {
1079
-            $_SESSION['oLP']->next();
1080
-            require 'lp_view.php';
1081
-        }
1082
-        break;
1083
-    case 'previous':
1084
-        if ($debug > 0) error_log('New LP - previous action triggered', 0);
1085
-        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1086
-        else {
1087
-            $_SESSION['oLP']->previous();
1088
-            require 'lp_view.php';
1089
-        }
1090
-        break;
1091
-    case 'content':
1092
-        if ($debug > 0) error_log('New LP - content action triggered', 0);
1093
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1094
-        if (!$lp_found) {
1095
-            error_log('New LP - No learnpath given for content', 0);
1096
-            require 'lp_list.php';
1097
-        }
1098
-        else {
1099
-            $_SESSION['oLP']->save_last();
1100
-            $_SESSION['oLP']->set_current_item($_GET['item_id']);
1101
-            $_SESSION['oLP']->start_current_item();
1102
-            require 'lp_content.php';
1103
-        }
1104
-        break;
1105
-    case 'view':
1106
-        if ($debug > 0)
1107
-            error_log('New LP - view action triggered', 0);
1108
-        if (!$lp_found) {
1109
-            error_log('New LP - No learnpath given for view', 0);
1110 1143
             require 'lp_list.php';
1111
-        } else {
1112
-            if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1113
-            if ( !empty($_REQUEST['item_id']) ) {
1114
-                $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1144
+            break;
1145
+        case 'mode':
1146
+            // Switch between fullscreen and embedded mode.
1147
+            if ($debug > 0) error_log('New LP - mode change triggered', 0);
1148
+            $mode = $_REQUEST['mode'];
1149
+            if ($mode == 'fullscreen') {
1150
+                $_SESSION['oLP']->mode = 'fullscreen';
1151
+            } elseif ($mode == 'embedded') {
1152
+                $_SESSION['oLP']->mode = 'embedded';
1153
+            } elseif ($mode == 'embedframe') {
1154
+        	    $_SESSION['oLP']->mode = 'embedframe';
1155
+            } elseif ($mode == 'impress') {
1156
+                $_SESSION['oLP']->mode = 'impress';
1115 1157
             }
1116 1158
             require 'lp_view.php';
1117
-        }
1118
-        break;
1119
-    case 'save':
1120
-        if ($debug > 0) error_log('New LP - save action triggered', 0);
1121
-        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1122
-        else {
1123
-            $_SESSION['oLP']->save_item();
1124
-            require 'lp_save.php';
1125
-        }
1126
-        break;
1127
-    case 'stats':
1128
-        if ($debug > 0) error_log('New LP - stats action triggered', 0);
1129
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1130
-        else {
1131
-            $_SESSION['oLP']->save_current();
1132
-            $_SESSION['oLP']->save_last();
1133
-            $output = require 'lp_stats.php';
1134
-            echo $output;
1135
-        }
1136
-        break;
1137
-    case 'list':
1138
-        if ($debug > 0) error_log('New LP - list action triggered', 0);
1139
-        if ($lp_found) {
1140
-            $_SESSION['refresh'] = 1;
1141
-            $_SESSION['oLP']->save_last();
1142
-        }
1143
-        require 'lp_list.php';
1144
-        break;
1145
-    case 'mode':
1146
-        // Switch between fullscreen and embedded mode.
1147
-        if ($debug > 0) error_log('New LP - mode change triggered', 0);
1148
-        $mode = $_REQUEST['mode'];
1149
-        if ($mode == 'fullscreen') {
1150
-            $_SESSION['oLP']->mode = 'fullscreen';
1151
-        } elseif ($mode == 'embedded') {
1152
-            $_SESSION['oLP']->mode = 'embedded';
1153
-        } elseif ($mode == 'embedframe') {
1154
-        	$_SESSION['oLP']->mode = 'embedframe';
1155
-        } elseif ($mode == 'impress') {
1156
-            $_SESSION['oLP']->mode = 'impress';
1157
-        }
1158
-        require 'lp_view.php';
1159
-        break;
1160
-    case 'switch_view_mode':
1161
-        if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1162
-        if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1163
-        if (Security::check_token('get')) {
1159
+            break;
1160
+        case 'switch_view_mode':
1161
+            if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1162
+            if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1163
+            if (Security::check_token('get')) {
1164
+                $_SESSION['refresh'] = 1;
1165
+                $_SESSION['oLP']->update_default_view_mode();
1166
+            }
1167
+            require 'lp_list.php';
1168
+            break;
1169
+        case 'switch_force_commit':
1170
+            if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1171
+            if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1164 1172
             $_SESSION['refresh'] = 1;
1165
-            $_SESSION['oLP']->update_default_view_mode();
1166
-        }
1167
-        require 'lp_list.php';
1168
-        break;
1169
-    case 'switch_force_commit':
1170
-        if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1171
-        if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1172
-        $_SESSION['refresh'] = 1;
1173
-        $_SESSION['oLP']->update_default_scorm_commit();
1174
-        require 'lp_list.php';
1175
-        break;
1176
-    /* Those 2 switches have been replaced by switc_attempt_mode switch
1173
+            $_SESSION['oLP']->update_default_scorm_commit();
1174
+            require 'lp_list.php';
1175
+            break;
1176
+        /* Those 2 switches have been replaced by switc_attempt_mode switch
1177 1177
     case 'switch_reinit':
1178 1178
         if ($debug > 0) error_log('New LP - switch_reinit action triggered', 0);
1179 1179
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
@@ -1196,199 +1196,199 @@  discard block
 block discarded – undo
1196 1196
 		$_SESSION['oLP']->switch_attempt_mode();
1197 1197
         require 'lp_list.php';
1198 1198
         break;
1199
-    case 'switch_scorm_debug':
1200
-        if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1201
-        if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1202
-        $_SESSION['refresh'] = 1;
1203
-        $_SESSION['oLP']->update_scorm_debug();
1204
-        require 'lp_list.php';
1205
-        break;
1206
-    case 'intro_cmdAdd':
1207
-        if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1208
-        // Add introduction section page.
1209
-        break;
1210
-    case 'js_api_refresh':
1211
-        if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1212
-        if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1213
-        if (isset($_REQUEST['item_id'])) {
1214
-            $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
1215
-        }
1216
-        require 'lp_message.php';
1217
-        break;
1218
-    case 'return_to_course_homepage':
1219
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1220
-        else {
1221
-            $_SESSION['oLP']->save_current();
1222
-            $_SESSION['oLP']->save_last();
1223
-            $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
1224
-            if (isset($_GET['redirectTo']) && $_GET['redirectTo'] == 'lp_list') {
1225
-                $url = 'lp_controller.php?'.api_get_cidreq();
1226
-            }
1227
-            header('location: '.$url);
1228
-            exit;
1229
-        }
1230
-        break;
1231
-    case 'search':
1232
-        /* Include the search script, it's smart enough to know when we are
1199
+        case 'switch_scorm_debug':
1200
+            if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1201
+            if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1202
+            $_SESSION['refresh'] = 1;
1203
+            $_SESSION['oLP']->update_scorm_debug();
1204
+            require 'lp_list.php';
1205
+            break;
1206
+        case 'intro_cmdAdd':
1207
+            if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1208
+            // Add introduction section page.
1209
+            break;
1210
+        case 'js_api_refresh':
1211
+            if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1212
+            if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1213
+            if (isset($_REQUEST['item_id'])) {
1214
+                $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
1215
+            }
1216
+            require 'lp_message.php';
1217
+            break;
1218
+        case 'return_to_course_homepage':
1219
+            if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1220
+            else {
1221
+                $_SESSION['oLP']->save_current();
1222
+                $_SESSION['oLP']->save_last();
1223
+                $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
1224
+                if (isset($_GET['redirectTo']) && $_GET['redirectTo'] == 'lp_list') {
1225
+                    $url = 'lp_controller.php?'.api_get_cidreq();
1226
+                }
1227
+                header('location: '.$url);
1228
+                exit;
1229
+            }
1230
+            break;
1231
+        case 'search':
1232
+            /* Include the search script, it's smart enough to know when we are
1233 1233
          * searching or not.
1234 1234
          */
1235
-        require 'lp_list_search.php';
1236
-        break;
1237
-    case 'impress':
1238
-        if ($debug > 0)
1239
-            error_log('New LP - view action triggered', 0);
1240
-        if (!$lp_found) {
1241
-            error_log('New LP - No learnpath given for view', 0);
1242
-            require 'lp_list.php';
1243
-        } else {
1244
-            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1245
-            if (!empty($_REQUEST['item_id']) ) {
1246
-                $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1235
+            require 'lp_list_search.php';
1236
+            break;
1237
+        case 'impress':
1238
+            if ($debug > 0)
1239
+                error_log('New LP - view action triggered', 0);
1240
+            if (!$lp_found) {
1241
+                error_log('New LP - No learnpath given for view', 0);
1242
+                require 'lp_list.php';
1243
+            } else {
1244
+                if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1245
+                if (!empty($_REQUEST['item_id']) ) {
1246
+                    $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1247
+                }
1248
+                require 'lp_impress.php';
1249
+            }
1250
+            break;
1251
+        case 'set_previous_step_as_prerequisite':
1252
+            $_SESSION['oLP']->set_previous_step_as_prerequisite_for_all_items();
1253
+            $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
1254
+            header('Location: '.$url);
1255
+            break;
1256
+        case 'clear_prerequisites':
1257
+            $_SESSION['oLP']->clear_prerequisites();
1258
+            $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
1259
+            header('Location: '.$url);
1260
+            break;
1261
+        case 'toggle_seriousgame': //activate/deactive seriousgame_mode
1262
+            if (!$is_allowed_to_edit) {
1263
+                api_not_allowed(true);
1247 1264
             }
1248
-            require 'lp_impress.php';
1249
-        }
1250
-        break;
1251
-    case 'set_previous_step_as_prerequisite':
1252
-        $_SESSION['oLP']->set_previous_step_as_prerequisite_for_all_items();
1253
-        $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
1254
-        header('Location: '.$url);
1255
-        break;
1256
-    case 'clear_prerequisites':
1257
-        $_SESSION['oLP']->clear_prerequisites();
1258
-        $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id)."&message=ItemUpdated";
1259
-        header('Location: '.$url);
1260
-        break;
1261
-    case 'toggle_seriousgame': //activate/deactive seriousgame_mode
1262
-        if (!$is_allowed_to_edit) {
1263
-            api_not_allowed(true);
1264
-        }
1265 1265
 
1266
-        if ($debug > 0) {
1267
-            error_log('New LP - seriousgame_mode action triggered');
1268
-        }
1266
+            if ($debug > 0) {
1267
+                error_log('New LP - seriousgame_mode action triggered');
1268
+            }
1269 1269
 
1270
-        if (!$lp_found) {
1271
-            error_log('New LP - No learnpath given for visibility');
1270
+            if (!$lp_found) {
1271
+                error_log('New LP - No learnpath given for visibility');
1272 1272
 
1273
-            require 'lp_list.php';
1274
-        }
1273
+                require 'lp_list.php';
1274
+            }
1275 1275
 
1276
-        $_SESSION['refresh'] = 1;
1277
-        $_SESSION['oLP']->set_seriousgame_mode();
1278
-        require 'lp_list.php';
1279
-        break;
1280
-    case 'create_forum':
1281
-        if (!isset($_GET['id'])) {
1276
+            $_SESSION['refresh'] = 1;
1277
+            $_SESSION['oLP']->set_seriousgame_mode();
1278
+            require 'lp_list.php';
1282 1279
             break;
1283
-        }
1284
-
1285
-        $selectedItem = null;
1286
-
1287
-        foreach ($_SESSION['oLP']->items as $item) {
1288
-            if ($item->db_id == $_GET['id']) {
1289
-                $selectedItem = $item;
1280
+        case 'create_forum':
1281
+            if (!isset($_GET['id'])) {
1282
+                break;
1290 1283
             }
1291
-        }
1292 1284
 
1293
-        if (!empty($selectedItem)) {
1294
-            $forumThread = $selectedItem->getForumThread(
1295
-                $_SESSION['oLP']->course_int_id,
1296
-                $_SESSION['oLP']->lp_session_id
1297
-            );
1285
+            $selectedItem = null;
1298 1286
 
1299
-            if (empty($forumThread)) {
1300
-                require '../forum/forumfunction.inc.php';
1287
+            foreach ($_SESSION['oLP']->items as $item) {
1288
+                if ($item->db_id == $_GET['id']) {
1289
+                    $selectedItem = $item;
1290
+                }
1291
+            }
1301 1292
 
1302
-                $forumCategory = getForumCategoryByTitle(
1303
-                    get_lang('LearningPaths'),
1293
+            if (!empty($selectedItem)) {
1294
+                $forumThread = $selectedItem->getForumThread(
1304 1295
                     $_SESSION['oLP']->course_int_id,
1305 1296
                     $_SESSION['oLP']->lp_session_id
1306 1297
                 );
1307 1298
 
1308
-                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1309
-
1310
-                if (empty($forumCategoryId)) {
1311
-                    $forumCategoryId = store_forumcategory(
1312
-                        [
1313
-                            'lp_id' => 0,
1314
-                            'forum_category_title' => get_lang('LearningPaths'),
1315
-                            'forum_category_comment' => null
1316
-                        ],
1317
-                        [],
1318
-                        false
1319
-                    );
1320
-                }
1299
+                if (empty($forumThread)) {
1300
+                    require '../forum/forumfunction.inc.php';
1321 1301
 
1322
-                if (!empty($forumCategoryId)) {
1323
-                    $forum = $_SESSION['oLP']->getForum(
1302
+                    $forumCategory = getForumCategoryByTitle(
1303
+                        get_lang('LearningPaths'),
1304
+                        $_SESSION['oLP']->course_int_id,
1324 1305
                         $_SESSION['oLP']->lp_session_id
1325 1306
                     );
1326 1307
 
1327
-                    $forumId = !empty($forum) ? $forum['forum_id'] : 0;
1328
-
1329
-                    if (empty($forumId)) {
1330
-                        $forumId = $_SESSION['oLP']->createForum($forumCategoryId);
1308
+                    $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1309
+
1310
+                    if (empty($forumCategoryId)) {
1311
+                        $forumCategoryId = store_forumcategory(
1312
+                            [
1313
+                                'lp_id' => 0,
1314
+                                'forum_category_title' => get_lang('LearningPaths'),
1315
+                                'forum_category_comment' => null
1316
+                            ],
1317
+                            [],
1318
+                            false
1319
+                        );
1331 1320
                     }
1332 1321
 
1333
-                    if (!empty($forumId)) {
1334
-                        $selectedItem->createForumThread($forumId);
1322
+                    if (!empty($forumCategoryId)) {
1323
+                        $forum = $_SESSION['oLP']->getForum(
1324
+                            $_SESSION['oLP']->lp_session_id
1325
+                        );
1326
+
1327
+                        $forumId = !empty($forum) ? $forum['forum_id'] : 0;
1328
+
1329
+                        if (empty($forumId)) {
1330
+                            $forumId = $_SESSION['oLP']->createForum($forumCategoryId);
1331
+                        }
1332
+
1333
+                        if (!empty($forumId)) {
1334
+                            $selectedItem->createForumThread($forumId);
1335
+                        }
1335 1336
                     }
1336 1337
                 }
1337 1338
             }
1338
-        }
1339 1339
 
1340
-        header('Location:' . api_get_self() . '?' . http_build_query([
1341
-            'action' => 'add_item',
1342
-            'type' => 'step',
1343
-            'lp_id' => $_SESSION['oLP']->lp_id
1344
-        ]));
1340
+            header('Location:' . api_get_self() . '?' . http_build_query([
1341
+                'action' => 'add_item',
1342
+                'type' => 'step',
1343
+                'lp_id' => $_SESSION['oLP']->lp_id
1344
+            ]));
1345 1345
 
1346
-        break;
1347
-    case 'report':
1348
-        require 'lp_report.php';
1349
-        break;
1350
-    case 'dissociate_forum':
1351
-        if (!isset($_GET['id'])) {
1352 1346
             break;
1353
-        }
1347
+        case 'report':
1348
+            require 'lp_report.php';
1349
+            break;
1350
+        case 'dissociate_forum':
1351
+            if (!isset($_GET['id'])) {
1352
+                break;
1353
+            }
1354 1354
 
1355
-        $selectedItem = null;
1355
+            $selectedItem = null;
1356 1356
 
1357
-        foreach ($_SESSION['oLP']->items as $item) {
1358
-            if ($item->db_id != $_GET['id']) {
1359
-                continue;
1360
-            }
1357
+            foreach ($_SESSION['oLP']->items as $item) {
1358
+                if ($item->db_id != $_GET['id']) {
1359
+                    continue;
1360
+                }
1361 1361
 
1362
-            $selectedItem = $item;
1363
-        }
1362
+                $selectedItem = $item;
1363
+            }
1364 1364
 
1365
-        if (!empty($selectedItem)) {
1366
-            $forumThread = $selectedItem->getForumThread(
1367
-                $_SESSION['oLP']->course_int_id,
1368
-                $_SESSION['oLP']->lp_session_id
1369
-            );
1365
+            if (!empty($selectedItem)) {
1366
+                $forumThread = $selectedItem->getForumThread(
1367
+                    $_SESSION['oLP']->course_int_id,
1368
+                    $_SESSION['oLP']->lp_session_id
1369
+                );
1370 1370
 
1371
-            if (!empty($forumThread)) {
1372
-                $dissoaciated = $selectedItem->dissociateForumThread($forumThread['iid']);
1371
+                if (!empty($forumThread)) {
1372
+                    $dissoaciated = $selectedItem->dissociateForumThread($forumThread['iid']);
1373 1373
 
1374
-                if ($dissoaciated) {
1375
-                    Display::addFlash(
1376
-                        Display::return_message(get_lang('ForumDissociate'), 'success')
1377
-                    );
1374
+                    if ($dissoaciated) {
1375
+                        Display::addFlash(
1376
+                            Display::return_message(get_lang('ForumDissociate'), 'success')
1377
+                        );
1378
+                    }
1378 1379
                 }
1379 1380
             }
1380
-        }
1381 1381
 
1382
-        header('Location:' . api_get_self() . '?' . http_build_query([
1383
-            'action' => 'add_item',
1384
-            'type' => 'step',
1385
-            'lp_id' => $_SESSION['oLP']->lp_id
1386
-        ]));
1387
-        break;
1388
-    default:
1389
-        if ($debug > 0) error_log('New LP - default action triggered', 0);
1390
-        require 'lp_list.php';
1391
-        break;
1382
+            header('Location:' . api_get_self() . '?' . http_build_query([
1383
+                'action' => 'add_item',
1384
+                'type' => 'step',
1385
+                'lp_id' => $_SESSION['oLP']->lp_id
1386
+            ]));
1387
+            break;
1388
+        default:
1389
+            if ($debug > 0) error_log('New LP - default action triggered', 0);
1390
+            require 'lp_list.php';
1391
+            break;
1392 1392
 }
1393 1393
 
1394 1394
 if (!empty($_SESSION['oLP'])) {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Including the global initialization file.
27 27
 require_once '../inc/global.inc.php';
28
-$current_course_tool  = TOOL_LEARNPATH;
28
+$current_course_tool = TOOL_LEARNPATH;
29 29
 $_course = api_get_course_info();
30 30
 
31 31
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
     ) {
38 38
         $htmlHeadXtra[] = '<script>
39 39
     <!--
40
-        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\';
40
+        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\';
41 41
     -->
42 42
     </script>';
43
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
43
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
45 45
     }
46 46
 }
47 47
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
 $course_id = api_get_course_int_id();
270 270
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
271
+if ($debug > 0) error_log('New LP - Passed data remains check', 0);
272 272
 
273 273
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274 274
     if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             if (Database::num_rows($res)) {
293 293
                 $row = Database::fetch_array($res);
294 294
                 $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);
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);
296 296
                 switch ($type) {
297 297
                     case 1:
298 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);
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
                 $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
688 688
                     $_GET['id'],
689 689
                     $_POST['prerequisites'],
690
-                    $_POST['min_' . $_POST['prerequisites']],
691
-                    $_POST['max_' . $_POST['prerequisites']]
690
+                    $_POST['min_'.$_POST['prerequisites']],
691
+                    $_POST['max_'.$_POST['prerequisites']]
692 692
                 );
693 693
 
694 694
                 if ($editPrerequisite) {
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
938 938
 
939 939
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
940
-            	$publicated_on  = $_REQUEST['publicated_on'];
940
+            	$publicated_on = $_REQUEST['publicated_on'];
941 941
             } else {
942 942
             	$publicated_on = null;
943 943
             }
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
         else {
1009 1009
             $_SESSION['refresh'] = 1;
1010 1010
             if (!empty($_REQUEST['parent_item_id'])) {
1011
-                $_SESSION['from_learnpath']='yes';
1011
+                $_SESSION['from_learnpath'] = 'yes';
1012 1012
                 $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1013 1013
                 require 'resourcelinker.php';
1014 1014
             } else {
@@ -1109,8 +1109,8 @@  discard block
 block discarded – undo
1109 1109
             error_log('New LP - No learnpath given for view', 0);
1110 1110
             require 'lp_list.php';
1111 1111
         } else {
1112
-            if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1113
-            if ( !empty($_REQUEST['item_id']) ) {
1112
+            if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); }
1113
+            if (!empty($_REQUEST['item_id'])) {
1114 1114
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1115 1115
             }
1116 1116
             require 'lp_view.php';
@@ -1190,8 +1190,8 @@  discard block
 block discarded – undo
1190 1190
 		break;
1191 1191
      */
1192 1192
 	case 'switch_attempt_mode':
1193
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1194
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1193
+		if ($debug > 0) error_log('New LP - switch_reinit action triggered', 0);
1194
+		if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1195 1195
 		$_SESSION['refresh'] = 1;
1196 1196
 		$_SESSION['oLP']->switch_attempt_mode();
1197 1197
         require 'lp_list.php';
@@ -1241,8 +1241,8 @@  discard block
 block discarded – undo
1241 1241
             error_log('New LP - No learnpath given for view', 0);
1242 1242
             require 'lp_list.php';
1243 1243
         } else {
1244
-            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1245
-            if (!empty($_REQUEST['item_id']) ) {
1244
+            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); }
1245
+            if (!empty($_REQUEST['item_id'])) {
1246 1246
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1247 1247
             }
1248 1248
             require 'lp_impress.php';
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
                     $_SESSION['oLP']->lp_session_id
1306 1306
                 );
1307 1307
 
1308
-                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1308
+                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0;
1309 1309
 
1310 1310
                 if (empty($forumCategoryId)) {
1311 1311
                     $forumCategoryId = store_forumcategory(
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
             }
1338 1338
         }
1339 1339
 
1340
-        header('Location:' . api_get_self() . '?' . http_build_query([
1340
+        header('Location:'.api_get_self().'?'.http_build_query([
1341 1341
             'action' => 'add_item',
1342 1342
             'type' => 'step',
1343 1343
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
             }
1380 1380
         }
1381 1381
 
1382
-        header('Location:' . api_get_self() . '?' . http_build_query([
1382
+        header('Location:'.api_get_self().'?'.http_build_query([
1383 1383
             'action' => 'add_item',
1384 1384
             'type' => 'step',
1385 1385
             'lp_id' => $_SESSION['oLP']->lp_id
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 2 patches
Doc Comments   +29 added lines, -24 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param	string	$course Course code
85 85
      * @param	integer	$lp_id
86 86
      * @param	integer	$user_id
87
-     * @return mixed True on success, false on error
87
+     * @return boolean True on success, false on error
88 88
      */
89 89
     public function __construct($course, $lp_id, $user_id)
90 90
     {
@@ -484,8 +484,9 @@  discard block
 block discarded – undo
484 484
      * @param int $prerequisites
485 485
      * @param int $max_time_allowed
486 486
      * @param int $userId
487
+     * @param string $id
487 488
      *
488
-     * @return int
489
+     * @return false|string
489 490
      */
490 491
     public function add_item(
491 492
         $parent,
@@ -1036,7 +1037,7 @@  discard block
 block discarded – undo
1036 1037
      * @param	array $courseInfo
1037 1038
      * @param	integer	Learnpath ID
1038 1039
      * @param	string	Whether to delete data or keep it (default: 'keep', others: 'remove')
1039
-     * @return	boolean	True on success, false on failure (might change that to return number of elements deleted)
1040
+     * @return	false|null	True on success, false on failure (might change that to return number of elements deleted)
1040 1041
      */
1041 1042
     public function delete($courseInfo = null, $id = null, $delete = 'keep')
1042 1043
     {
@@ -1170,7 +1171,7 @@  discard block
 block discarded – undo
1170 1171
      * @param	integer	$id Elem ID (0 if first)
1171 1172
      * @param	integer	$remove Whether to remove the resource/data from the
1172 1173
      * system or leave it (default: 'keep', others 'remove')
1173
-     * @return	integer	Number of elements moved
1174
+     * @return	false|null	Number of elements moved
1174 1175
      * @todo implement resource removal
1175 1176
      */
1176 1177
     public function delete_item($id, $remove = 'keep')
@@ -1252,7 +1253,7 @@  discard block
 block discarded – undo
1252 1253
      * @param   array   $audio The array resulting of the $_FILES[mp3] element
1253 1254
      * @param   int     $max_time_allowed
1254 1255
      * @param   string  $url
1255
-     * @return  boolean True on success, false on error
1256
+     * @return  false|null True on success, false on error
1256 1257
      */
1257 1258
     public function edit_item(
1258 1259
         $id,
@@ -1775,7 +1776,7 @@  discard block
 block discarded – undo
1775 1776
 
1776 1777
     /**
1777 1778
      * Gets the first element URL.
1778
-     * @return	string	URL to load into the viewer
1779
+     * @return	false|null	URL to load into the viewer
1779 1780
      */
1780 1781
     public function first()
1781 1782
     {
@@ -2291,6 +2292,7 @@  discard block
 block discarded – undo
2291 2292
      * @param int $student_id
2292 2293
      * @param string Course code (optional)
2293 2294
      * @param int $sessionId
2295
+     * @param string $courseCode
2294 2296
      * @return	bool
2295 2297
      */
2296 2298
     public static function is_lp_visible_for_student(
@@ -2590,7 +2592,7 @@  discard block
 block discarded – undo
2590 2592
 
2591 2593
     /**
2592 2594
      * Gets the learnpath session id
2593
-     * @return	string	Learnpath theme
2595
+     * @return	integer	Learnpath theme
2594 2596
      */
2595 2597
     public function get_lp_session_id()
2596 2598
     {
@@ -2623,7 +2625,7 @@  discard block
 block discarded – undo
2623 2625
     /**
2624 2626
      * @param string $size
2625 2627
      * @param string $path_type
2626
-     * @return bool|string
2628
+     * @return string|false
2627 2629
      */
2628 2630
     public function get_preview_image_path($size = null, $path_type = 'web')
2629 2631
     {
@@ -2769,6 +2771,8 @@  discard block
 block discarded – undo
2769 2771
      * Returns the XML DOM document's node
2770 2772
      * @param	resource	Reference to a list of objects to search for the given ITEM_*
2771 2773
      * @param	string		The identifier to look for
2774
+     * @param DOMNodeList $children
2775
+     * @param string $id
2772 2776
      * @return	mixed		The reference to the element found with that identifier. False if not found
2773 2777
      */
2774 2778
     public function get_scorm_xml_node(& $children, $id)
@@ -3016,7 +3020,7 @@  discard block
 block discarded – undo
3016 3020
     /**
3017 3021
      * Generate and return the table of contents for this learnpath. The (flat) table returned can be
3018 3022
      * used by get_html_toc() to be ready to display
3019
-     * @return	array	TOC as a table with 4 elements per row: title, link, status and level
3023
+     * @return	boolean	TOC as a table with 4 elements per row: title, link, status and level
3020 3024
      */
3021 3025
     public function get_toc()
3022 3026
     {
@@ -3152,7 +3156,7 @@  discard block
 block discarded – undo
3152 3156
     }
3153 3157
 
3154 3158
     /**
3155
-     * @return array
3159
+     * @return string[]
3156 3160
      */
3157 3161
     public static function getChapterTypes()
3158 3162
     {
@@ -4054,7 +4058,7 @@  discard block
 block discarded – undo
4054 4058
      * Open a resource = initialise all local variables relative to this resource. Depending on the child
4055 4059
      * class, this might be redefined to allow several behaviours depending on the document type.
4056 4060
      * @param integer Resource ID
4057
-     * @return boolean True on success, false otherwise
4061
+     * @return boolean|null True on success, false otherwise
4058 4062
      */
4059 4063
     public function open($id)
4060 4064
     {
@@ -4183,7 +4187,7 @@  discard block
 block discarded – undo
4183 4187
      * Can be used as abstract
4184 4188
      * @param	integer	$lp_id Learnpath id
4185 4189
      * @param	string	$set_visibility New visibility (v/i - visible/invisible)
4186
-     * @return bool
4190
+     * @return false|null
4187 4191
      */
4188 4192
     public static function toggle_publish($lp_id, $set_visibility = 'v')
4189 4193
     {
@@ -4268,7 +4272,7 @@  discard block
 block discarded – undo
4268 4272
      * Make sure the results are saved with anoter method. This method should probably be
4269 4273
      * redefined in children classes.
4270 4274
      * To use a similar method  statically, use the create_new_attempt() method
4271
-     * @return string URL to load in the viewer
4275
+     * @return boolean URL to load in the viewer
4272 4276
      */
4273 4277
     public function restart()
4274 4278
     {
@@ -4346,6 +4350,7 @@  discard block
 block discarded – undo
4346 4350
      * Saves the given item
4347 4351
      * @param	integer	$item_id. Optional (will take from $_REQUEST if null)
4348 4352
      * @param	boolean	$from_outside Save from url params (true) or from current attributes (false). Optional. Defaults to true
4353
+     * @param integer $item_id
4349 4354
      * @return	boolean
4350 4355
      */
4351 4356
     public function save_item($item_id = null, $from_outside = true)
@@ -4843,7 +4848,7 @@  discard block
 block discarded – undo
4843 4848
 
4844 4849
     /**
4845 4850
      * Sets use_max_score
4846
-     * @param   string  $use_max_score Optional string giving the new location of this learnpath
4851
+     * @param   integer  $use_max_score Optional string giving the new location of this learnpath
4847 4852
      * @return  boolean True on success / False on error
4848 4853
      */
4849 4854
     public function set_use_max_score($use_max_score = 1)
@@ -5244,6 +5249,7 @@  discard block
 block discarded – undo
5244 5249
      * Register the attempt mode into db thanks to flags prevent_reinit and seriousgame_mode flags
5245 5250
      *
5246 5251
      * @param string 'seriousgame', 'single' or 'multiple'
5252
+     * @param string $mode
5247 5253
      * @return boolean
5248 5254
      * @author ndiechburg <[email protected]>
5249 5255
      **/
@@ -5286,7 +5292,7 @@  discard block
 block discarded – undo
5286 5292
     /**
5287 5293
      * Switch between multiple attempt, single attempt or serious_game mode (only for scorm)
5288 5294
      *
5289
-     * @return boolean
5295
+     * @return boolean|null
5290 5296
      * @author ndiechburg <[email protected]>
5291 5297
      **/
5292 5298
     public function switch_attempt_mode()
@@ -5477,7 +5483,6 @@  discard block
 block discarded – undo
5477 5483
     /**
5478 5484
      * Function that creates a html list of learning path items so that we can add audio files to them
5479 5485
      * @author Kevin Van Den Haute
5480
-     * @param int $lp_id
5481 5486
      * @return string
5482 5487
      */
5483 5488
     public function overview()
@@ -5838,7 +5843,7 @@  discard block
 block discarded – undo
5838 5843
     /**
5839 5844
      * This function builds the action menu
5840 5845
      * @param bool $returnContent
5841
-     * @return void
5846
+     * @return string|null
5842 5847
      */
5843 5848
     public function build_action_menu($returnContent = false)
5844 5849
     {
@@ -6335,7 +6340,7 @@  discard block
 block discarded – undo
6335 6340
     /**
6336 6341
      * Function that displays a list with al the resources that
6337 6342
      * could be added to the learning path
6338
-     * @return string
6343
+     * @return boolean
6339 6344
      */
6340 6345
     public function display_resources()
6341 6346
     {
@@ -8779,7 +8784,7 @@  discard block
 block discarded – undo
8779 8784
 
8780 8785
     /**
8781 8786
      * Creates a list with all the student publications in it
8782
-     * @return unknown
8787
+     * @return string
8783 8788
      */
8784 8789
     public function get_student_publications()
8785 8790
     {
@@ -9723,7 +9728,7 @@  discard block
 block discarded – undo
9723 9728
 
9724 9729
     /**
9725 9730
      * @param int $lp_id
9726
-     * @return bool
9731
+     * @return false|null
9727 9732
      */
9728 9733
     public function scorm_export_to_pdf($lp_id)
9729 9734
     {
@@ -10240,6 +10245,7 @@  discard block
 block discarded – undo
10240 10245
     }
10241 10246
 
10242 10247
     /**
10248
+     * @param string $courseCode
10243 10249
      * @return \learnpath
10244 10250
      */
10245 10251
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
@@ -10259,7 +10265,7 @@  discard block
 block discarded – undo
10259 10265
 
10260 10266
     /**
10261 10267
      * @param int $itemId
10262
-     * @return learnpathItem|false
10268
+     * @return string
10263 10269
      */
10264 10270
     public function getItem($itemId)
10265 10271
     {
@@ -10309,7 +10315,6 @@  discard block
 block discarded – undo
10309 10315
     /**
10310 10316
      * Set whether this is a learning path with the possibility to subscribe
10311 10317
      * users or not
10312
-     * @param int $subscribeUsers (0 = false, 1 = true)
10313 10318
      */
10314 10319
     public function setSubscribeUsers($value)
10315 10320
     {
@@ -10434,7 +10439,7 @@  discard block
 block discarded – undo
10434 10439
 
10435 10440
     /**
10436 10441
      * Get the item of exercise type (evaluation type)
10437
-     * @return array The final evaluation. Otherwise return false
10442
+     * @return integer The final evaluation. Otherwise return false
10438 10443
      */
10439 10444
     public function getFinalEvaluationItem()
10440 10445
     {
@@ -10658,7 +10663,7 @@  discard block
 block discarded – undo
10658 10663
     /**
10659 10664
      * Create a forum for this learning path
10660 10665
      * @param type $forumCategoryId
10661
-     * @return int The forum ID if was created. Otherwise return false
10666
+     * @return false|string The forum ID if was created. Otherwise return false
10662 10667
      */
10663 10668
     public function createForum($forumCategoryId)
10664 10669
     {
Please login to merge, or discard this patch.
Spacing   +683 added lines, -683 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $res = Database::query($sql);
244 244
 
245 245
         if ($this->debug > 2) {
246
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
246
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
247 247
             error_log('-- Start while--', 0);
248 248
         }
249 249
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
                         $this->refs_list[$oItem->ref] = $my_item_id;
264 264
                         if ($this->debug > 2) {
265 265
                             error_log(
266
-                                'New LP - learnpath::__construct() - ' .
267
-                                'aicc object with id ' . $my_item_id .
266
+                                'New LP - learnpath::__construct() - '.
267
+                                'aicc object with id '.$my_item_id.
268 268
                                 ' set in items[]',
269 269
                                 0
270 270
                             );
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 
284 284
                         $this->refs_list[$oItem->ref] = $my_item_id;
285 285
                         if ($this->debug > 2) {
286
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
286
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
287 287
                         }
288 288
                     }
289 289
                     break;
290 290
                 case 1:
291 291
                 default:
292 292
                     if ($this->debug > 2) {
293
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
293
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
294 294
                     }
295 295
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
296 296
 
297 297
                     if ($this->debug > 2) {
298
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
298
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
299 299
                     }
300 300
                     if (is_object($oItem)) {
301 301
                         $my_item_id = $oItem->get_id();
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
                         $this->refs_list[$my_item_id] = $my_item_id;
307 307
                         if ($this->debug > 2) {
308 308
                             error_log(
309
-                                'New LP - learnpath::__construct() ' . __LINE__ .
310
-                                ' - object with id ' . $my_item_id . ' set in items[]',
309
+                                'New LP - learnpath::__construct() '.__LINE__.
310
+                                ' - object with id '.$my_item_id.' set in items[]',
311 311
                                 0);
312 312
                         }
313 313
                     }
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
326 326
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
327 327
                     $this->items[$row['id']]->current_start_time = 0;
328
-                    $this->items[$row['id']]->current_stop_time	= 0;
328
+                    $this->items[$row['id']]->current_stop_time = 0;
329 329
                 }
330 330
             }
331 331
         }
332 332
 
333 333
         if ($this->debug > 2) {
334
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
334
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
335 335
         }
336 336
 
337 337
         if (!empty($lp_item_id_list)) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         // TODO: Define the current item better.
424 424
         $this->first();
425 425
         if ($this->debug > 2) {
426
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
426
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
427 427
         }
428 428
         return true;
429 429
     }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     ) {
501 501
         $course_id = $this->course_info['real_id'];
502 502
         if ($this->debug > 0) {
503
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
503
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
504 504
         }
505 505
         if (empty($course_id)) {
506 506
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                 FROM $tbl_lp_item
523 523
                 WHERE
524 524
                     c_id = $course_id AND
525
-                    lp_id = " . $this->get_id() . " AND
525
+                    lp_id = ".$this->get_id()." AND
526 526
                     parent_item_id = " . $parent;
527 527
 
528 528
         $res_count = Database::query($sql);
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
         if ($num > 0) {
533 533
             if ($previous == 0) {
534 534
                 $sql = "SELECT id, next_item_id, display_order
535
-                        FROM " . $tbl_lp_item . "
535
+                        FROM " . $tbl_lp_item."
536 536
                         WHERE
537 537
                             c_id = $course_id AND
538
-                            lp_id = " . $this->get_id() . " AND
539
-                            parent_item_id = " . $parent . " AND
538
+                            lp_id = ".$this->get_id()." AND
539
+                            parent_item_id = " . $parent." AND
540 540
                             previous_item_id = 0 OR
541 541
                             previous_item_id=" . $parent;
542 542
                 $result = Database::query($sql);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 						FROM $tbl_lp_item
552 552
                         WHERE
553 553
                             c_id = $course_id AND
554
-                            lp_id = " . $this->get_id() . " AND
554
+                            lp_id = ".$this->get_id()." AND
555 555
                             id = " . $previous;
556 556
 
557 557
                 $result = Database::query($sql);
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
         $typeCleaned = Database::escape_string($type);
572 572
         if ($type == 'quiz') {
573 573
             $sql = 'SELECT SUM(ponderation)
574
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
575
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
574
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
575
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
576 576
                     ON
577 577
                         quiz_question.id = quiz_rel_question.question_id AND
578 578
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $new_item_id = Database::insert($tbl_lp_item, $params);
619 619
 
620 620
         if ($this->debug > 2) {
621
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
621
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
622 622
         }
623 623
 
624 624
         if ($new_item_id) {
@@ -635,28 +635,28 @@  discard block
 block discarded – undo
635 635
             Database::query($sql);
636 636
 
637 637
             // Update all the items after the new item.
638
-            $sql = "UPDATE " . $tbl_lp_item . "
638
+            $sql = "UPDATE ".$tbl_lp_item."
639 639
                         SET display_order = display_order + 1
640 640
                     WHERE
641 641
                         c_id = $course_id AND
642
-                        lp_id = " . $this->get_id() . " AND
643
-                        id <> " . $new_item_id . " AND
644
-                        parent_item_id = " . $parent . " AND
642
+                        lp_id = ".$this->get_id()." AND
643
+                        id <> " . $new_item_id." AND
644
+                        parent_item_id = " . $parent." AND
645 645
                         display_order > " . $display_order;
646 646
             Database::query($sql);
647 647
 
648 648
             // Update the item that should come after the new item.
649
-            $sql = "UPDATE " . $tbl_lp_item . "
650
-                    SET ref = " . $new_item_id . "
651
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
649
+            $sql = "UPDATE ".$tbl_lp_item."
650
+                    SET ref = " . $new_item_id."
651
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
652 652
             Database::query($sql);
653 653
 
654 654
             // Upload audio.
655 655
             if (!empty($_FILES['mp3']['name'])) {
656 656
                 // Create the audio folder if it does not exist yet.
657
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
658
-                if (!is_dir($filepath . 'audio')) {
659
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
657
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
658
+                if (!is_dir($filepath.'audio')) {
659
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
660 660
                     $audio_id = add_document(
661 661
                         $_course,
662 662
                         '/audio',
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                 $file_path = handle_uploaded_document(
700 700
                     $_course,
701 701
                     $_FILES['mp3'],
702
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
702
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
703 703
                     '/audio',
704 704
                     $userId,
705 705
                     '',
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 
716 716
                 // Store the mp3 file in the lp_item table.
717 717
                 $sql = "UPDATE $tbl_lp_item SET
718
-                            audio = '" . Database::escape_string($file) . "'
719
-                        WHERE id = '" . intval($new_item_id) . "'";
718
+                            audio = '".Database::escape_string($file)."'
719
+                        WHERE id = '" . intval($new_item_id)."'";
720 720
                 Database::query($sql);
721 721
             }
722 722
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         while (Database :: num_rows($res_name)) {
796 796
             // There is already one such name, update the current one a bit.
797 797
             $i++;
798
-            $name = $name . ' - ' . $i;
798
+            $name = $name.' - '.$i;
799 799
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
800 800
             $res_name = Database::query($check_name);
801 801
         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                 // if $item points to an object and there is a parent.
908 908
                 if ($debug) {
909 909
                     error_log(
910
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
910
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
911 911
                         0
912 912
                     );
913 913
                 }
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                         if ($childItemId != $item) {
936 936
                             if ($debug) {
937 937
                                 error_log(
938
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
938
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
939 939
                                     0
940 940
                                 );
941 941
                             }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                             } else {
956 956
                                 if ($debug > 2) {
957 957
                                     error_log(
958
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
958
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
959 959
                                         0
960 960
                                     );
961 961
                                 }
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
         // Delete lp item id.
1061 1061
         foreach ($this->items as $id => $dummy) {
1062 1062
             $sql = "DELETE FROM $lp_item_view
1063
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1063
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1064 1064
             Database::query($sql);
1065 1065
         }
1066 1066
 
1067 1067
         // Proposed by Christophe (nickname: clefevre)
1068
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1068
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1069 1069
         Database::query($sql);
1070 1070
 
1071
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1071
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1072 1072
         Database::query($sql);
1073 1073
 
1074 1074
         self::toggle_publish($this->lp_id, 'i');
@@ -1076,32 +1076,32 @@  discard block
 block discarded – undo
1076 1076
         if ($this->type == 2 || $this->type == 3) {
1077 1077
             // This is a scorm learning path, delete the files as well.
1078 1078
             $sql = "SELECT path FROM $lp
1079
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1079
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1080 1080
             $res = Database::query($sql);
1081 1081
             if (Database :: num_rows($res) > 0) {
1082 1082
                 $row = Database :: fetch_array($res);
1083 1083
                 $path = $row['path'];
1084 1084
                 $sql = "SELECT id FROM $lp
1085
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1085
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1086 1086
                 $res = Database::query($sql);
1087 1087
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1088 1088
                     if ($this->debug > 2) {
1089
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1089
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1090 1090
                     }
1091 1091
                 } else {
1092 1092
                     // No other LP uses that directory, delete it.
1093
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1094
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1095
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1093
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1094
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1095
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1096 1096
                         if ($this->debug > 2) {
1097
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1097
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1098 1098
                         }
1099 1099
                         // Proposed by Christophe (clefevre).
1100 1100
                         if (strcmp(substr($path, -2), "/.") == 0) {
1101 1101
                             $path = substr($path, 0, -1); // Remove "." at the end.
1102 1102
                         }
1103 1103
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1104
-                        rmdirr($course_scorm_dir . $path);
1104
+                        rmdirr($course_scorm_dir.$path);
1105 1105
                     }
1106 1106
                 }
1107 1107
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1115 1115
         Database::query($sql);
1116 1116
 
1117
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1117
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1118 1118
         Database::query($sql);
1119 1119
         // Updates the display order of all lps.
1120 1120
         $this->update_display_order();
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
             api_get_user_id()
1128 1128
         );
1129 1129
 
1130
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1130
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1131 1131
         if ($link_info !== false) {
1132 1132
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1133 1133
         }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
     {
1148 1148
         $course_id = $this->course_info['real_id'];
1149 1149
         if ($this->debug > 0) {
1150
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1150
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1151 1151
         }
1152 1152
         $num = 0;
1153 1153
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         $res = Database::query($sql);
1159 1159
         while ($row = Database :: fetch_array($res)) {
1160 1160
             $num += $this->delete_children_items($row['id']);
1161
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1161
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1162 1162
             Database::query($sql_del);
1163 1163
             $num++;
1164 1164
         }
@@ -1199,12 +1199,12 @@  discard block
 block discarded – undo
1199 1199
         // Delete children items.
1200 1200
         $num = $this->delete_children_items($id);
1201 1201
         if ($this->debug > 2) {
1202
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1202
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1203 1203
         }
1204 1204
         // Now delete the item.
1205 1205
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1206 1206
         if ($this->debug > 2) {
1207
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1207
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1208 1208
         }
1209 1209
         Database::query($sql_del);
1210 1210
         // Now update surrounding items.
@@ -1279,15 +1279,15 @@  discard block
 block discarded – undo
1279 1279
         }
1280 1280
 
1281 1281
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1282
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1282
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1283 1283
         $res_select = Database::query($sql_select);
1284 1284
         $row_select = Database :: fetch_array($res_select);
1285 1285
         $audio_update_sql = '';
1286 1286
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1287 1287
             // Create the audio folder if it does not exist yet.
1288
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1289
-            if (!is_dir($filepath . 'audio')) {
1290
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1288
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1289
+            if (!is_dir($filepath.'audio')) {
1290
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1291 1291
                 $audio_id = add_document(
1292 1292
                     $_course,
1293 1293
                     '/audio',
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
             $pi = pathinfo($audio['name']);
1326 1326
             if ($pi['extension'] == 'mp3') {
1327 1327
                 $c_det = api_get_course_info($this->cc);
1328
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1328
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1329 1329
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1330 1330
                 $path = substr($path, 7);
1331 1331
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1332
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1332
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1333 1333
             }
1334 1334
         }
1335 1335
 
@@ -1339,13 +1339,13 @@  discard block
 block discarded – undo
1339 1339
         // TODO: htmlspecialchars to be checked for encoding related problems.
1340 1340
         if ($same_parent && $same_previous) {
1341 1341
             // Only update title and description.
1342
-            $sql = "UPDATE " . $tbl_lp_item . "
1343
-                    SET title = '" . Database::escape_string($title) . "',
1344
-                        prerequisite = '" . $prerequisites . "',
1345
-                        description = '" . Database::escape_string($description) . "'
1346
-                        " . $audio_update_sql . ",
1347
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1348
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1342
+            $sql = "UPDATE ".$tbl_lp_item."
1343
+                    SET title = '" . Database::escape_string($title)."',
1344
+                        prerequisite = '" . $prerequisites."',
1345
+                        description = '" . Database::escape_string($description)."'
1346
+                        " . $audio_update_sql.",
1347
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1348
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1349 1349
             Database::query($sql);
1350 1350
         } else {
1351 1351
             $old_parent = $row_select['parent_item_id'];
@@ -1360,27 +1360,27 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
             if ($old_previous != 0) {
1362 1362
                 // Next
1363
-                $sql = "UPDATE " . $tbl_lp_item . "
1364
-                        SET next_item_id = " . $old_next . "
1365
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1363
+                $sql = "UPDATE ".$tbl_lp_item."
1364
+                        SET next_item_id = " . $old_next."
1365
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1366 1366
                 Database::query($sql);
1367 1367
             }
1368 1368
 
1369 1369
             if ($old_next != 0) {
1370 1370
                 // Previous
1371
-                $sql = "UPDATE " . $tbl_lp_item . "
1372
-                        SET previous_item_id = " . $old_previous . "
1373
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1371
+                $sql = "UPDATE ".$tbl_lp_item."
1372
+                        SET previous_item_id = " . $old_previous."
1373
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1374 1374
                 Database::query($sql);
1375 1375
             }
1376 1376
 
1377 1377
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1378
-            $sql = "UPDATE " . $tbl_lp_item . "
1378
+            $sql = "UPDATE ".$tbl_lp_item."
1379 1379
                     SET display_order = display_order - 1
1380 1380
                     WHERE
1381 1381
                         c_id = ".$course_id." AND
1382
-                        display_order > " . $old_order . " AND
1383
-                        lp_id = " . $this->lp_id . " AND
1382
+                        display_order > " . $old_order." AND
1383
+                        lp_id = " . $this->lp_id." AND
1384 1384
                         parent_item_id = " . $old_parent;
1385 1385
             Database::query($sql);
1386 1386
             /* END -- virtually remove the current item id */
@@ -1390,11 +1390,11 @@  discard block
 block discarded – undo
1390 1390
             if ($previous == 0) {
1391 1391
                 // Select the data of the item that should come after the current item.
1392 1392
                 $sql = "SELECT id, display_order
1393
-                        FROM " . $tbl_lp_item . "
1393
+                        FROM " . $tbl_lp_item."
1394 1394
                         WHERE
1395 1395
                             c_id = ".$course_id." AND
1396
-                            lp_id = " . $this->lp_id . " AND
1397
-                            parent_item_id = " . $parent . " AND
1396
+                            lp_id = " . $this->lp_id." AND
1397
+                            parent_item_id = " . $parent." AND
1398 1398
                             previous_item_id = " . $previous;
1399 1399
                 $res_select_old = Database::query($sql);
1400 1400
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
             } else {
1411 1411
                 // Select the data of the item that should come before the current item.
1412 1412
                 $sql = "SELECT next_item_id, display_order
1413
-                        FROM " . $tbl_lp_item . "
1414
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1413
+                        FROM " . $tbl_lp_item."
1414
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1415 1415
                 $res_select_old = Database::query($sql);
1416 1416
                 $row_select_old = Database :: fetch_array($res_select_old);
1417 1417
                 $new_next = $row_select_old['next_item_id'];
@@ -1420,57 +1420,57 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
             // TODO: htmlspecialchars to be checked for encoding related problems.
1422 1422
             // Update the current item with the new data.
1423
-            $sql = "UPDATE " . $tbl_lp_item . "
1423
+            $sql = "UPDATE ".$tbl_lp_item."
1424 1424
                     SET
1425
-                        title = '" . Database::escape_string($title) . "',
1426
-                        description = '" . Database::escape_string($description) . "',
1427
-                        parent_item_id = " . $parent . ",
1428
-                        previous_item_id = " . $previous . ",
1429
-                        next_item_id = " . $new_next . ",
1430
-                        display_order = " . $new_order . "
1431
-                        " . $audio_update_sql . "
1432
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1425
+                        title = '" . Database::escape_string($title)."',
1426
+                        description = '" . Database::escape_string($description)."',
1427
+                        parent_item_id = " . $parent.",
1428
+                        previous_item_id = " . $previous.",
1429
+                        next_item_id = " . $new_next.",
1430
+                        display_order = " . $new_order."
1431
+                        " . $audio_update_sql."
1432
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1433 1433
             Database::query($sql);
1434 1434
 
1435 1435
             if ($previous != 0) {
1436 1436
                 // Update the previous item's next_item_id.
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET next_item_id = " . $id . "
1439
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET next_item_id = " . $id."
1439
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($new_next != 0) {
1444 1444
                 // Update the next item's previous_item_id.
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET previous_item_id = " . $id . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET previous_item_id = " . $id."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             if ($old_prerequisite != $prerequisites) {
1452
-                $sql = "UPDATE " . $tbl_lp_item . "
1453
-                        SET prerequisite = '" . $prerequisites . "'
1454
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1452
+                $sql = "UPDATE ".$tbl_lp_item."
1453
+                        SET prerequisite = '" . $prerequisites."'
1454
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1455 1455
                 Database::query($sql);
1456 1456
             }
1457 1457
 
1458 1458
             if ($old_max_time_allowed != $max_time_allowed) {
1459 1459
                 // update max time allowed
1460
-                $sql = "UPDATE " . $tbl_lp_item . "
1461
-                        SET max_time_allowed = " . $max_time_allowed . "
1462
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1460
+                $sql = "UPDATE ".$tbl_lp_item."
1461
+                        SET max_time_allowed = " . $max_time_allowed."
1462
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1463 1463
                 Database::query($sql);
1464 1464
             }
1465 1465
 
1466 1466
             // Update all the items with the same or a bigger display_order than the current item.
1467
-            $sql = "UPDATE " . $tbl_lp_item . "
1467
+            $sql = "UPDATE ".$tbl_lp_item."
1468 1468
                     SET display_order = display_order + 1
1469 1469
                     WHERE
1470 1470
                        c_id = ".$course_id." AND
1471
-                       lp_id = " . $this->get_id() . " AND
1472
-                       id <> " . $id . " AND
1473
-                       parent_item_id = " . $parent . " AND
1471
+                       lp_id = " . $this->get_id()." AND
1472
+                       id <> " . $id." AND
1473
+                       parent_item_id = " . $parent." AND
1474 1474
                        display_order >= " . $new_order;
1475 1475
 
1476 1476
             Database::query($sql);
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
     {
1497 1497
         $course_id = api_get_course_int_id();
1498 1498
         if ($this->debug > 0) {
1499
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1499
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1500 1500
         }
1501 1501
 
1502 1502
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1594,8 +1594,8 @@  discard block
 block discarded – undo
1594 1594
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1595 1595
         }
1596 1596
 
1597
-        if (empty($id)|| $id != strval(intval($id))) {
1598
-            return array ();
1597
+        if (empty($id) || $id != strval(intval($id))) {
1598
+            return array();
1599 1599
         }
1600 1600
 
1601 1601
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1613,13 +1613,13 @@  discard block
 block discarded – undo
1613 1613
                             item_type='dokeos_chapter'
1614 1614
                         ORDER BY display_order";
1615 1615
             $res_bros = Database::query($sql_bros);
1616
-            $list = array ();
1616
+            $list = array();
1617 1617
             while ($row_bro = Database :: fetch_array($res_bros)) {
1618 1618
                 $list[] = $row_bro;
1619 1619
             }
1620 1620
             return $list;
1621 1621
         }
1622
-        return array ();
1622
+        return array();
1623 1623
     }
1624 1624
 
1625 1625
     /**
@@ -1632,11 +1632,11 @@  discard block
 block discarded – undo
1632 1632
     {
1633 1633
         $course_id = api_get_course_int_id();
1634 1634
         if ($this->debug > 0) {
1635
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1635
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1636 1636
         }
1637 1637
 
1638 1638
         if (empty ($id) || $id != strval(intval($id))) {
1639
-            return array ();
1639
+            return array();
1640 1640
         }
1641 1641
 
1642 1642
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1649 1649
                          ORDER BY display_order";
1650 1650
             $res_bros = Database::query($sql_bros);
1651
-            $list = array ();
1651
+            $list = array();
1652 1652
             while ($row_bro = Database :: fetch_array($res_bros)) {
1653 1653
                 $list[] = $row_bro;
1654 1654
             }
1655 1655
             return $list;
1656 1656
         }
1657
-        return array ();
1657
+        return array();
1658 1658
     }
1659 1659
 
1660 1660
     /**
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             $current = $this->current;
1725 1725
         }
1726 1726
         if ($this->debug > 2) {
1727
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1727
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1728 1728
         }
1729 1729
         return $current;
1730 1730
     }
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
         ) {
1806 1806
 
1807 1807
             if ($this->debug > 2) {
1808
-                error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1808
+                error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1809 1809
             }
1810 1810
             $index = -1;
1811 1811
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
             if ($index == -1) {
1818 1818
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1819 1819
                 if ($this->debug > 2) {
1820
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1820
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1821 1821
                 }
1822 1822
                 return false;
1823 1823
             } else {
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
             $index = 0;
1833 1833
             // Loop through all ordered items and stop at the first item that is
1834 1834
             // not a directory *and* that has not been completed yet.
1835
-            while ( !empty($this->ordered_items[$index]) AND
1835
+            while (!empty($this->ordered_items[$index]) AND
1836 1836
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1837 1837
                 (
1838 1838
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1846,14 +1846,14 @@  discard block
 block discarded – undo
1846 1846
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1847 1847
             $this->index    = $index;
1848 1848
             if ($this->debug > 2) {
1849
-                error_log('$index ' . $index);
1849
+                error_log('$index '.$index);
1850 1850
             }
1851 1851
             if ($this->debug > 2) {
1852
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1852
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1853 1853
             }
1854 1854
         }
1855 1855
         if ($this->debug > 2) {
1856
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1856
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1857 1857
         }
1858 1858
     }
1859 1859
 
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
     public function get_js_info($item_id = '')
1867 1867
     {
1868 1868
         if ($this->debug > 0) {
1869
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1869
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1870 1870
         }
1871 1871
 
1872 1872
         $info = '';
@@ -1876,17 +1876,17 @@  discard block
 block discarded – undo
1876 1876
             //if item is defined, return values from DB
1877 1877
             $oItem = $this->items[$item_id];
1878 1878
             $info .= '<script language="javascript">';
1879
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1880
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1881
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1882
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1883
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1884
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1885
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1879
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1880
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1881
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1882
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1883
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1884
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1885
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1886 1886
             $info .= "top.set_flag_synchronized();";
1887 1887
             $info .= '</script>';
1888 1888
             if ($this->debug > 2) {
1889
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1889
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1890 1890
             }
1891 1891
             return $info;
1892 1892
 
@@ -1894,17 +1894,17 @@  discard block
 block discarded – undo
1894 1894
 
1895 1895
             // If item_id is empty, just update to default SCORM data.
1896 1896
             $info .= '<script language="javascript">';
1897
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1898
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1899
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1900
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1901
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1902
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1903
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1897
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1898
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1899
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1900
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1901
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1902
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1903
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1904 1904
             $info .= "top.set_flag_synchronized();";
1905 1905
             $info .= '</script>';
1906 1906
             if ($this->debug > 2) {
1907
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1907
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1908 1908
             }
1909 1909
             return $info;
1910 1910
         }
@@ -1958,12 +1958,12 @@  discard block
 block discarded – undo
1958 1958
      * Gets the navigation bar for the learnpath display screen
1959 1959
      * @return	string	The HTML string to use as a navigation bar
1960 1960
      */
1961
-    public function get_navigation_bar($idBar = null, $display=null) {
1961
+    public function get_navigation_bar($idBar = null, $display = null) {
1962 1962
         if ($this->debug > 0) {
1963 1963
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1964 1964
         }
1965
-        if(empty($idBar)){
1966
-            $idBar='control-top';
1965
+        if (empty($idBar)) {
1966
+            $idBar = 'control-top';
1967 1967
         }
1968 1968
         /* if(empty($display)){
1969 1969
             $display='display:block';
@@ -1976,16 +1976,16 @@  discard block
 block discarded – undo
1976 1976
             $navbar = '
1977 1977
                   <span id="'.$idBar.'" class="buttons">
1978 1978
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1979
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1979
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1980 1980
                     </a>
1981
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1982
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1981
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1982
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1983 1983
                     </a>
1984
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1985
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1984
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1985
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1986 1986
                     </a>
1987 1987
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1988
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1988
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1989 1989
                     </a>
1990 1990
                   </span>';
1991 1991
 
@@ -1993,13 +1993,13 @@  discard block
 block discarded – undo
1993 1993
             $navbar = '
1994 1994
                 <span id="'.$idBar.'" class="buttons text-right">
1995 1995
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1996
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1996
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1997 1997
                     </a>
1998
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1999
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1998
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1999
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
2000 2000
                     </a>
2001
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2002
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
2001
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2002
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2003 2003
                     </a>
2004 2004
                 </span>';
2005 2005
         }
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
         $index = $this->index;
2021 2021
         $index++;
2022 2022
         if ($this->debug > 2) {
2023
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2023
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2024 2024
         }
2025 2025
         while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items) {
2026 2026
             $index++;
2027
-            if ($index == $this->max_ordered_items){
2027
+            if ($index == $this->max_ordered_items) {
2028 2028
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2029 2029
                     return $this->index;
2030 2030
                 } else {
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
             return $this->index;
2037 2037
         }
2038 2038
         if ($this->debug > 2) {
2039
-            error_log('New LP - index is now ' . $index, 0);
2039
+            error_log('New LP - index is now '.$index, 0);
2040 2040
         }
2041 2041
         return $index;
2042 2042
     }
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
         if (!empty ($new_index)) {
2055 2055
             if (isset ($this->ordered_items[$new_index])) {
2056 2056
                 if ($this->debug > 2) {
2057
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2057
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2058 2058
                 }
2059 2059
                 return $this->ordered_items[$new_index];
2060 2060
             }
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
         }
2097 2097
 
2098 2098
         // Filename without its extension.
2099
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2099
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2100 2100
 
2101 2101
         $zipFile = new PclZip($file_path);
2102 2102
         // Check the zip content (real size and file extension).
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
                     break; // Exit the foreach loop.
2121 2121
                 } elseif (
2122 2122
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2123
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2123
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2124 2124
                 ) {
2125 2125
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2126 2126
                     switch ($ext) {
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
             error_log('New LP - In learnpath::get_previous_index()', 0);
2163 2163
         }
2164 2164
         $index = $this->index;
2165
-        if (isset ($this->ordered_items[$index -1])) {
2165
+        if (isset ($this->ordered_items[$index - 1])) {
2166 2166
             $index--;
2167 2167
             while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
2168 2168
                 $index--;
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
             }
2173 2173
         } else {
2174 2174
             if ($this->debug > 2) {
2175
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2175
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2176 2176
             }
2177 2177
             // There is no previous item.
2178 2178
         }
@@ -2215,8 +2215,8 @@  discard block
 block discarded – undo
2215 2215
     {
2216 2216
         $course_id = api_get_course_int_id();
2217 2217
         $_course = api_get_course_info();
2218
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2219
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2218
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2219
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2220 2220
 
2221 2221
         // Getting all the information about the item.
2222 2222
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                     lp.c_id = $course_id AND
2228 2228
                     lp_view.c_id = $course_id";
2229 2229
         $result = Database::query($sql);
2230
-        $row 	= Database::fetch_assoc($result);
2230
+        $row = Database::fetch_assoc($result);
2231 2231
         $output = '';
2232 2232
 
2233 2233
         if (!empty ($row['audio'])) {
@@ -2235,8 +2235,8 @@  discard block
 block discarded – undo
2235 2235
             $list = $_SESSION['oLP']->get_toc();
2236 2236
             $type_quiz = false;
2237 2237
 
2238
-            foreach($list as $toc) {
2239
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2238
+            foreach ($list as $toc) {
2239
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2240 2240
                     $type_quiz = true;
2241 2241
                 }
2242 2242
             }
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
         $courseCode = null,
2300 2300
         $sessionId = null
2301 2301
     ) {
2302
-        $lp_id = (int)$lp_id;
2302
+        $lp_id = (int) $lp_id;
2303 2303
         $courseInfo = api_get_course_info($courseCode);
2304 2304
         $sessionId = intval($sessionId);
2305 2305
 
@@ -2465,10 +2465,10 @@  discard block
 block discarded – undo
2465 2465
      */
2466 2466
     public static function get_progress_bar($percentage = -1, $text_add = '')
2467 2467
     {
2468
-        $text = $percentage . $text_add;
2468
+        $text = $percentage.$text_add;
2469 2469
         $output = '<div class="progress">
2470
-                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
-                        '. $text .'
2470
+                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
+                        '. $text.'
2472 2472
                         </div>
2473 2473
                     </div>';
2474 2474
 
@@ -2504,16 +2504,16 @@  discard block
 block discarded – undo
2504 2504
         }
2505 2505
         $total_items = $this->get_total_items_count_without_chapters();
2506 2506
         if ($this->debug > 2) {
2507
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2507
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2508 2508
         }
2509 2509
         $completeItems = $this->get_complete_items_count();
2510 2510
         if ($this->debug > 2) {
2511
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2511
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2512 2512
         }
2513 2513
         if ($add != 0) {
2514 2514
             $completeItems += $add;
2515 2515
             if ($this->debug > 2) {
2516
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2516
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2517 2517
             }
2518 2518
         }
2519 2519
         $text = '';
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
             $text = '%';
2532 2532
         } elseif ($mode == 'abs') {
2533 2533
             $percentage = $completeItems;
2534
-            $text = '/' . $total_items;
2534
+            $text = '/'.$total_items;
2535 2535
         }
2536 2536
 
2537 2537
         return array(
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                 // and replace them, one by one, by the internal IDs (chamilo db)
2728 2728
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2729 2729
                 // by a space as well.
2730
-                $find = array (
2730
+                $find = array(
2731 2731
                     '&',
2732 2732
                     '|',
2733 2733
                     '~',
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
                     '(',
2740 2740
                     ')'
2741 2741
                 );
2742
-                $replace = array (
2742
+                $replace = array(
2743 2743
                     ' ',
2744 2744
                     ' ',
2745 2745
                     ' ',
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                 foreach ($ids as $id) {
2757 2757
                     $id = trim($id);
2758 2758
                     if (isset ($this->refs_list[$id])) {
2759
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2759
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2760 2760
                     }
2761 2761
                 }
2762 2762
 
@@ -2864,9 +2864,9 @@  discard block
 block discarded – undo
2864 2864
         if ($this->debug > 0) {
2865 2865
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2866 2866
         }
2867
-        $list = array ();
2867
+        $list = array();
2868 2868
         foreach ($this->ordered_items as $item_id) {
2869
-            $list[] = array (
2869
+            $list[] = array(
2870 2870
                 $item_id => $this->items[$item_id]->get_status()
2871 2871
             );
2872 2872
         }
@@ -2920,7 +2920,7 @@  discard block
 block discarded – undo
2920 2920
         $res = Database::query($sql);
2921 2921
         $num = Database :: num_rows($res);
2922 2922
         if ($num > 0) {
2923
-            $list[] = array (
2923
+            $list[] = array(
2924 2924
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2925 2925
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2926 2926
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2932 2932
             );
2933 2933
             while ($row = Database :: fetch_array($res)) {
2934
-                $list[] = array (
2934
+                $list[] = array(
2935 2935
                     'order_id' => ($row['order_id'] + 1),
2936 2936
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2937 2937
                     'type' => $row['interaction_type'],
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3000 3000
             );
3001 3001
             while ($row = Database :: fetch_array($res)) {
3002
-                $list[] = array (
3002
+                $list[] = array(
3003 3003
                     'order_id' => ($row['order_id'] + 1),
3004 3004
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3005 3005
                     'score_raw' => $row['score_raw'],
@@ -3026,10 +3026,10 @@  discard block
 block discarded – undo
3026 3026
         $toc = array();
3027 3027
         foreach ($this->ordered_items as $item_id) {
3028 3028
             if ($this->debug > 2) {
3029
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3029
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3030 3030
             }
3031 3031
             // TODO: Change this link generation and use new function instead.
3032
-            $toc[] = array (
3032
+            $toc[] = array(
3033 3033
                 'id'            => $item_id,
3034 3034
                 'title'         => $this->items[$item_id]->get_title(),
3035 3035
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
             );
3041 3041
         }
3042 3042
         if ($this->debug > 2) {
3043
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3043
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3044 3044
         }
3045 3045
         return $toc;
3046 3046
     }
@@ -3057,10 +3057,10 @@  discard block
 block discarded – undo
3057 3057
         }
3058 3058
         $toc = $varname.' = new Array();';
3059 3059
         foreach ($this->ordered_items as $item_id) {
3060
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3060
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3061 3061
         }
3062 3062
         if ($this->debug > 2) {
3063
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3063
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3064 3064
         }
3065 3065
         return $toc;
3066 3066
     }
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
             }
3085 3085
         }
3086 3086
         if ($this->debug > 2) {
3087
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3087
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3088 3088
         }
3089 3089
         return $res;
3090 3090
     }
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3101 3101
         $lp_id = intval($lp_id);
3102 3102
         $sql = "SELECT lp_type FROM $tbl_lp
3103
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3103
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3104 3104
         $res = Database::query($sql);
3105 3105
         if ($res === false) {
3106 3106
             return null;
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
             $dirTypes = self::getChapterTypes();
3214 3214
 
3215 3215
             if (in_array($item['type'], $dirTypes)) {
3216
-                $scorm_color_background ='scorm_item_section ';
3216
+                $scorm_color_background = 'scorm_item_section ';
3217 3217
                 $style_item = '';
3218 3218
             }
3219 3219
             if ($item['id'] == $this->current) {
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3223 3223
             }
3224 3224
 
3225
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3225
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3226 3226
 
3227 3227
             // Learning path title
3228 3228
             $title = $item['title'];
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
                 $html .= stripslashes($title);
3253 3253
             } else {
3254 3254
                 $this->get_link('http', $item['id'], $toc_list);
3255
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3255
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3256 3256
             }
3257 3257
             $html .= "</div>";
3258 3258
 
@@ -3286,12 +3286,12 @@  discard block
 block discarded – undo
3286 3286
             if ($this->get_lp_session_id() == api_get_session_id()) {
3287 3287
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3288 3288
                 $html .= '<div class="btn-group">';
3289
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3290
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3291
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3292
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3293
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' .
3294
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3289
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3290
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3291
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3292
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3293
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'.
3294
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3295 3295
                 $html .= '</div>';
3296 3296
                 $html .= '</div>';
3297 3297
             }
@@ -3342,11 +3342,11 @@  discard block
 block discarded – undo
3342 3342
         $course_id = $this->get_course_int_id();
3343 3343
 
3344 3344
         if ($this->debug > 0) {
3345
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3345
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3346 3346
         }
3347 3347
         if (empty($item_id)) {
3348 3348
             if ($this->debug > 2) {
3349
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3349
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3350 3350
             }
3351 3351
             $item_id = $this->get_current_item_id();
3352 3352
         }
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3379 3379
         		WHERE li.id = $item_id ";
3380 3380
         if ($this->debug > 2) {
3381
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3381
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3382 3382
         }
3383 3383
         $res = Database::query($sql);
3384 3384
         if (Database :: num_rows($res) > 0) {
@@ -3392,9 +3392,9 @@  discard block
 block discarded – undo
3392 3392
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3393 3393
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3394 3394
             }
3395
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3395
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3396 3396
             if ($type == 'http') {
3397
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3397
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3398 3398
             } else {
3399 3399
                 $course_path = $sys_course_path; //system path
3400 3400
             }
@@ -3405,8 +3405,8 @@  discard block
 block discarded – undo
3405 3405
             }
3406 3406
 
3407 3407
             if ($this->debug > 2) {
3408
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3409
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3408
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3409
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3410 3410
             }
3411 3411
 
3412 3412
             // Now go through the specific cases to get the end of the path
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
                         );
3426 3426
 
3427 3427
                         if ($this->debug > 0) {
3428
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3428
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3429 3429
                         }
3430 3430
 
3431 3431
                         if ($lp_item_type == 'link') {
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
                                     $linkProtocol = substr($file, 0, 5);
3446 3446
                                     if ($linkProtocol === 'http:') {
3447 3447
                                         //this is the special intervention case
3448
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3448
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3449 3449
                                     }
3450 3450
                                 }
3451 3451
                             }
@@ -3485,8 +3485,8 @@  discard block
 block discarded – undo
3485 3485
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3486 3486
                                         WHERE
3487 3487
                                             c_id = $course_id AND
3488
-                                            lp_item_id='" . $lp_item_id . "' AND
3489
-                                            lp_view_id ='" . $lp_view_id . "' AND
3488
+                                            lp_item_id='".$lp_item_id."' AND
3489
+                                            lp_view_id ='" . $lp_view_id."' AND
3490 3490
                                             status='completed'";
3491 3491
                                 $result = Database::query($sql);
3492 3492
                                 $row_count = Database :: fetch_row($result);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3496 3496
                                     $not_multiple_attempt = 1;
3497 3497
                                 }
3498
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3498
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3499 3499
                             }
3500 3500
 
3501 3501
                             $tmp_array = explode('/', $file);
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
                     break;
3509 3509
                 case 2 :
3510 3510
                     if ($this->debug > 2) {
3511
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3511
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3512 3512
                     }
3513 3513
 
3514 3514
                     if ($lp_item_type != 'dir') {
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
                         //if ($this->prerequisites_match($item_id)) {
3523 3523
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3524 3524
                             if ($this->debug > 2) {
3525
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3525
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3526 3526
                             }
3527 3527
                             // Distant url, return as is.
3528 3528
                             $file = $lp_item_path;
3529 3529
                         } else {
3530 3530
                             if ($this->debug > 2) {
3531
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3531
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3532 3532
                             }
3533 3533
                             // Prevent getting untranslatable urls.
3534 3534
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3535 3535
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3536 3536
                             // Prepare the path.
3537
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3537
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3538 3538
                             // TODO: Fix this for urls with protocol header.
3539 3539
                             $file = str_replace('//', '/', $file);
3540 3540
                             $file = str_replace(':/', '://', $file);
@@ -3542,11 +3542,11 @@  discard block
 block discarded – undo
3542 3542
                                 $lp_path = substr($lp_path, 0, -1);
3543 3543
                             }
3544 3544
 
3545
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3545
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3546 3546
                                 // if file not found.
3547 3547
                                 $decoded = html_entity_decode($lp_item_path);
3548 3548
                                 list ($decoded) = explode('?', $decoded);
3549
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3549
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3550 3550
                                     require_once 'resourcelinker.inc.php';
3551 3551
                                     $file = rl_get_resource_link_for_learnpath(
3552 3552
                                         $course_id,
@@ -3566,14 +3566,14 @@  discard block
 block discarded – undo
3566 3566
                                         }
3567 3567
                                     }
3568 3568
                                 } else {
3569
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3569
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3570 3570
                                 }
3571 3571
                             }
3572 3572
                         }
3573 3573
 
3574 3574
                         // We want to use parameters if they were defined in the imsmanifest
3575 3575
                         if (strpos($file, 'blank.php') === false) {
3576
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3576
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3577 3577
                         }
3578 3578
                     } else {
3579 3579
                         $file = 'lp_content.php?type=dir';
@@ -3581,12 +3581,12 @@  discard block
 block discarded – undo
3581 3581
                     break;
3582 3582
                 case 3 :
3583 3583
                     if ($this->debug > 2) {
3584
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3584
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3585 3585
                     }
3586 3586
                     // Formatting AICC HACP append URL.
3587
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3587
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3588 3588
                     if (!empty($lp_item_params)) {
3589
-                        $aicc_append .= $lp_item_params . '&';
3589
+                        $aicc_append .= $lp_item_params.'&';
3590 3590
                     }
3591 3591
                     if ($lp_item_type != 'dir') {
3592 3592
                         // Quite complex here:
@@ -3598,7 +3598,7 @@  discard block
 block discarded – undo
3598 3598
 
3599 3599
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3600 3600
                             if ($this->debug > 2) {
3601
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3601
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3602 3602
                             }
3603 3603
                             // Distant url, return as is.
3604 3604
                             $file = $lp_item_path;
@@ -3611,19 +3611,19 @@  discard block
 block discarded – undo
3611 3611
                             if (stripos($file, '<servername>') !== false) {
3612 3612
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3613 3613
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3614
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3614
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3615 3615
                             }
3616 3616
                             //
3617 3617
                             $file .= $aicc_append;
3618 3618
                         } else {
3619 3619
                             if ($this->debug > 2) {
3620
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3620
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3621 3621
                             }
3622 3622
                             // Prevent getting untranslatable urls.
3623 3623
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3624 3624
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3625 3625
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3626
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3626
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3627 3627
                             // TODO: Fix this for urls with protocol header.
3628 3628
                             $file = str_replace('//', '/', $file);
3629 3629
                             $file = str_replace(':/', '://', $file);
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3643 3643
         }
3644 3644
         if ($this->debug > 2) {
3645
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3645
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3646 3646
         }
3647 3647
         return $file;
3648 3648
     }
@@ -3660,7 +3660,7 @@  discard block
 block discarded – undo
3660 3660
         $search = '';
3661 3661
         // Use $attempt_num to enable multi-views management (disabled so far).
3662 3662
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3663
-            $search = 'AND view_count = ' . $attempt_num;
3663
+            $search = 'AND view_count = '.$attempt_num;
3664 3664
         }
3665 3665
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3666 3666
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3670,9 +3670,9 @@  discard block
 block discarded – undo
3670 3670
 
3671 3671
         $sql = "SELECT id, view_count FROM $lp_view_table
3672 3672
         		WHERE
3673
-        		    c_id = " . $course_id . " AND
3674
-        		    lp_id = " . $this->get_id() . " AND
3675
-        		    user_id = " . $this->get_user_id() . " AND
3673
+        		    c_id = ".$course_id." AND
3674
+        		    lp_id = " . $this->get_id()." AND
3675
+        		    user_id = " . $this->get_user_id()." AND
3676 3676
         		    session_id = $sessionId
3677 3677
         		    $search
3678 3678
                 ORDER BY view_count DESC";
@@ -3683,7 +3683,7 @@  discard block
 block discarded – undo
3683 3683
         } else if (!api_is_invitee()) {
3684 3684
             // There is no database record, create one.
3685 3685
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3686
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3686
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3687 3687
             Database::query($sql);
3688 3688
             $id = Database :: insert_id();
3689 3689
             $this->lp_view_id = $id;
@@ -3783,15 +3783,15 @@  discard block
 block discarded – undo
3783 3783
     {
3784 3784
         $course_id = api_get_course_int_id();
3785 3785
         if ($this->debug > 0) {
3786
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3786
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3787 3787
         }
3788 3788
         if (empty($id) || empty($direction)) {
3789 3789
             return false;
3790 3790
         }
3791 3791
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3792 3792
         $sql_sel = "SELECT *
3793
-                    FROM " . $tbl_lp_item . "
3794
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3793
+                    FROM " . $tbl_lp_item."
3794
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3795 3795
         $res_sel = Database::query($sql_sel);
3796 3796
         // Check if elem exists.
3797 3797
         if (Database :: num_rows($res_sel) < 1) {
@@ -3816,7 +3816,7 @@  discard block
 block discarded – undo
3816 3816
                                  WHERE c_id = ".$course_id." AND id = $previous";
3817 3817
 
3818 3818
                     if ($this->debug > 2) {
3819
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3819
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3820 3820
                     }
3821 3821
                     $res_sel2 = Database::query($sql_sel2);
3822 3822
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
                         }
3870 3870
                         Database::query($sql_upd2);
3871 3871
                     }
3872
-                    $display = $display -1;
3872
+                    $display = $display - 1;
3873 3873
                 }
3874 3874
                 break;
3875 3875
             case 'down':
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
                 } else {
3881 3881
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3882 3882
                     if ($this->debug > 2) {
3883
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3883
+                        error_log('Selecting next: '.$sql_sel2, 0);
3884 3884
                     }
3885 3885
                     $res_sel2 = Database::query($sql_sel2);
3886 3886
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3919 3919
                         Database::query($sql_upd2);
3920 3920
                     }
3921
-                    $display = $display +1;
3921
+                    $display = $display + 1;
3922 3922
                 }
3923 3923
                 break;
3924 3924
             default :
@@ -3941,8 +3941,8 @@  discard block
 block discarded – undo
3941 3941
         $res = Database::query($sql);
3942 3942
         if ($res === false)
3943 3943
             return false;
3944
-        $lps = array ();
3945
-        $lp_order = array ();
3944
+        $lps = array();
3945
+        $lp_order = array();
3946 3946
         $num = Database :: num_rows($res);
3947 3947
         // First check the order is correct, globally (might be wrong because
3948 3948
         // of versions < 1.8.4)
@@ -3952,7 +3952,7 @@  discard block
 block discarded – undo
3952 3952
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3953 3953
                     $need_fix = true;
3954 3954
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3955
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3955
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3956 3956
                     Database::query($sql_u);
3957 3957
                 }
3958 3958
                 $row['display_order'] = $i;
@@ -3965,10 +3965,10 @@  discard block
 block discarded – undo
3965 3965
             $order = $lps[$lp_id]['display_order'];
3966 3966
             if ($order > 1) { // If it's the first element, no need to move up.
3967 3967
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3968
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3968
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3969 3969
                 Database::query($sql_u1);
3970
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3971
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3970
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3971
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3972 3972
                 Database::query($sql_u2);
3973 3973
             }
3974 3974
         }
@@ -3989,8 +3989,8 @@  discard block
 block discarded – undo
3989 3989
         if ($res === false) {
3990 3990
             return false;
3991 3991
         }
3992
-        $lps = array ();
3993
-        $lp_order = array ();
3992
+        $lps = array();
3993
+        $lp_order = array();
3994 3994
         $num = Database :: num_rows($res);
3995 3995
         $max = 0;
3996 3996
         // First check the order is correct, globally (might be wrong because
@@ -4002,7 +4002,7 @@  discard block
 block discarded – undo
4002 4002
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4003 4003
                     $need_fix = true;
4004 4004
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4005
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4005
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4006 4006
                     Database::query($sql_u);
4007 4007
                 }
4008 4008
                 $row['display_order'] = $i;
@@ -4015,10 +4015,10 @@  discard block
 block discarded – undo
4015 4015
             $order = $lps[$lp_id]['display_order'];
4016 4016
             if ($order < $max) { // If it's the first element, no need to move up.
4017 4017
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4018
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4018
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4019 4019
                 Database::query($sql_u1);
4020
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4021
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4020
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4021
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4022 4022
                 Database::query($sql_u2);
4023 4023
             }
4024 4024
         }
@@ -4038,15 +4038,15 @@  discard block
 block discarded – undo
4038 4038
         $this->autocomplete_parents($this->last);
4039 4039
         $new_index = $this->get_next_index();
4040 4040
         if ($this->debug > 2) {
4041
-            error_log('New LP - New index: ' . $new_index, 0);
4041
+            error_log('New LP - New index: '.$new_index, 0);
4042 4042
         }
4043 4043
         $this->index = $new_index;
4044 4044
         if ($this->debug > 2) {
4045
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4045
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4046 4046
         }
4047 4047
         $this->current = $this->ordered_items[$new_index];
4048 4048
         if ($this->debug > 2) {
4049
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4049
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4050 4050
         }
4051 4051
     }
4052 4052
 
@@ -4110,7 +4110,7 @@  discard block
 block discarded – undo
4110 4110
             // Clean spaces.
4111 4111
             $prereq_string = str_replace(' ', '', $prereq_string);
4112 4112
             if ($debug > 0) {
4113
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4113
+                error_log('Found prereq_string: '.$prereq_string, 0);
4114 4114
             }
4115 4115
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4116 4116
             $result = $currentItem->parse_prereq(
@@ -4126,12 +4126,12 @@  discard block
 block discarded – undo
4126 4126
         } else {
4127 4127
             $result = true;
4128 4128
             if ($debug > 1) {
4129
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4129
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4130 4130
             }
4131 4131
         }
4132 4132
 
4133 4133
         if ($debug > 1) {
4134
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4134
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4135 4135
         }
4136 4136
         return $result;
4137 4137
     }
@@ -4197,12 +4197,12 @@  discard block
 block discarded – undo
4197 4197
             $row = Database :: fetch_array($result);
4198 4198
             $name = domesticate($row['name']);
4199 4199
             if ($set_visibility == 'i') {
4200
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4200
+                $s = $name." ".get_lang('LearnpathNotPublished');
4201 4201
                 $dialogBox = $s;
4202 4202
                 $v = 0;
4203 4203
             }
4204 4204
             if ($set_visibility == 'v') {
4205
-                $s = $name . " " . get_lang('LearnpathPublished');
4205
+                $s = $name." ".get_lang('LearnpathPublished');
4206 4206
                 $dialogBox = $s;
4207 4207
                 $v = 1;
4208 4208
             }
@@ -4285,9 +4285,9 @@  discard block
 block discarded – undo
4285 4285
         $course_id = api_get_course_int_id();
4286 4286
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4287 4287
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4288
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4288
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4289 4289
         if ($this->debug > 2) {
4290
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4290
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4291 4291
         }
4292 4292
         $res = Database::query($sql);
4293 4293
         $view_id = Database::insert_id();
@@ -4325,10 +4325,10 @@  discard block
 block discarded – undo
4325 4325
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4326 4326
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4327 4327
         if ($this->debug > 2) {
4328
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4328
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4329 4329
         }
4330 4330
         if ($this->debug > 2) {
4331
-            error_log('' . print_r($this->items, true), 0);
4331
+            error_log(''.print_r($this->items, true), 0);
4332 4332
         }
4333 4333
         if (isset($this->items[$this->current]) &&
4334 4334
             is_object($this->items[$this->current])
@@ -4352,7 +4352,7 @@  discard block
 block discarded – undo
4352 4352
     {
4353 4353
         $debug = $this->debug;
4354 4354
         if ($debug) {
4355
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4355
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4356 4356
         }
4357 4357
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4358 4358
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
 
4376 4376
             if ($debug) {
4377 4377
                 error_log('update_queue before:');
4378
-                error_log(print_r($this->update_queue,1));
4378
+                error_log(print_r($this->update_queue, 1));
4379 4379
             }
4380 4380
             $this->autocomplete_parents($item_id);
4381 4381
 
@@ -4383,9 +4383,9 @@  discard block
 block discarded – undo
4383 4383
             $this->update_queue[$item_id] = $status;
4384 4384
 
4385 4385
             if ($debug) {
4386
-                error_log('get_status(): ' . $status);
4386
+                error_log('get_status(): '.$status);
4387 4387
                 error_log('update_queue after:');
4388
-                error_log(print_r($this->update_queue,1));
4388
+                error_log(print_r($this->update_queue, 1));
4389 4389
             }
4390 4390
             return $res;
4391 4391
         }
@@ -4406,17 +4406,17 @@  discard block
 block discarded – undo
4406 4406
 
4407 4407
         if (isset($this->current) && !api_is_invitee()) {
4408 4408
             if ($this->debug > 2) {
4409
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4409
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4410 4410
             }
4411 4411
             $sql = "UPDATE $table SET
4412
-                        last_item = " . intval($this->get_current_item_id()). "
4412
+                        last_item = ".intval($this->get_current_item_id())."
4413 4413
                     WHERE
4414 4414
                         c_id = $course_id AND
4415
-                        lp_id = " . $this->get_id() . " AND
4415
+                        lp_id = ".$this->get_id()." AND
4416 4416
                         user_id = " . $this->get_user_id()." ".$session_condition;
4417 4417
 
4418 4418
             if ($this->debug > 2) {
4419
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4419
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4420 4420
             }
4421 4421
             Database::query($sql);
4422 4422
         }
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
                             progress = $progress
4431 4431
                         WHERE
4432 4432
                             c_id = ".$course_id." AND
4433
-                            lp_id = " . $this->get_id() . " AND
4433
+                            lp_id = " . $this->get_id()." AND
4434 4434
                             user_id = " . $this->get_user_id()." ".$session_condition;
4435 4435
                 // Ignore errors as some tables might not have the progress field just yet.
4436 4436
                 Database::query($sql);
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
     public function set_current_item($item_id = null)
4447 4447
     {
4448 4448
         if ($this->debug > 0) {
4449
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4449
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4450 4450
         }
4451 4451
         if (empty ($item_id)) {
4452 4452
             if ($this->debug > 2) {
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
             // Do nothing.
4456 4456
         } else {
4457 4457
             if ($this->debug > 2) {
4458
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4458
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4459 4459
             }
4460 4460
             if (is_numeric($item_id)) {
4461 4461
                 $item_id = intval($item_id);
@@ -4470,10 +4470,10 @@  discard block
 block discarded – undo
4470 4470
                     }
4471 4471
                 }
4472 4472
                 if ($this->debug > 2) {
4473
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4473
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4474 4474
                 }
4475 4475
             } else {
4476
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4476
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4477 4477
             }
4478 4478
         }
4479 4479
     }
@@ -4498,7 +4498,7 @@  discard block
 block discarded – undo
4498 4498
             $lp = $this->get_id();
4499 4499
             if ($lp != 0) {
4500 4500
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4501
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4501
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4502 4502
                 $res = Database::query($sql);
4503 4503
                 return $res;
4504 4504
             }
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
 
4523 4523
         if ($lp != 0) {
4524 4524
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4525
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4525
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4526 4526
             $res = Database::query($sql);
4527 4527
             return $res;
4528 4528
         } else {
@@ -4547,10 +4547,10 @@  discard block
 block discarded – undo
4547 4547
         $course_id = api_get_course_int_id();
4548 4548
         $lp_id = $this->get_id();
4549 4549
         $sql = "UPDATE $lp_table SET
4550
-                content_maker = '" . Database::escape_string($this->maker) . "'
4550
+                content_maker = '".Database::escape_string($this->maker)."'
4551 4551
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4552 4552
         if ($this->debug > 2) {
4553
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4553
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4554 4554
         }
4555 4555
         Database::query($sql);
4556 4556
         return true;
@@ -4574,10 +4574,10 @@  discard block
 block discarded – undo
4574 4574
         $lp_id = $this->get_id();
4575 4575
         $course_id = $this->course_info['real_id'];
4576 4576
         $sql = "UPDATE $lp_table SET
4577
-                name = '" . Database::escape_string($this->name). "'
4577
+                name = '".Database::escape_string($this->name)."'
4578 4578
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4579 4579
         if ($this->debug > 2) {
4580
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4580
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4581 4581
         }
4582 4582
         $result = Database::query($sql);
4583 4583
         // If the lp is visible on the homepage, change his name there.
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
             $session_id = api_get_session_id();
4586 4586
             $session_condition = api_get_session_condition($session_id);
4587 4587
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4588
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4588
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4589 4589
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4590 4590
             	    WHERE
4591 4591
             	        c_id = $course_id AND
@@ -4663,10 +4663,10 @@  discard block
 block discarded – undo
4663 4663
 
4664 4664
                 // Save it to search engine.
4665 4665
                 foreach ($missing_terms as $term) {
4666
-                    $doc->add_term($prefix . $term, 1);
4666
+                    $doc->add_term($prefix.$term, 1);
4667 4667
                 }
4668 4668
                 foreach ($deprecated_terms as $term) {
4669
-                    $doc->remove_term($prefix . $term);
4669
+                    $doc->remove_term($prefix.$term);
4670 4670
                 }
4671 4671
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4672 4672
                 $di->getDb()->flush();
@@ -4691,10 +4691,10 @@  discard block
 block discarded – undo
4691 4691
         $this->theme = $name;
4692 4692
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4693 4693
         $lp_id = $this->get_id();
4694
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4694
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4695 4695
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4696 4696
         if ($this->debug > 2) {
4697
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4697
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4698 4698
         }
4699 4699
         Database::query($sql);
4700 4700
 
@@ -4717,10 +4717,10 @@  discard block
 block discarded – undo
4717 4717
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4718 4718
         $lp_id = $this->get_id();
4719 4719
         $sql = "UPDATE $lp_table SET
4720
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4720
+                preview_image = '".Database::escape_string($this->preview_image)."'
4721 4721
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4722 4722
         if ($this->debug > 2) {
4723
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4723
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4724 4724
         }
4725 4725
         Database::query($sql);
4726 4726
         return true;
@@ -4740,10 +4740,10 @@  discard block
 block discarded – undo
4740 4740
         $this->author = $name;
4741 4741
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4742 4742
         $lp_id = $this->get_id();
4743
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4743
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4744 4744
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4745 4745
         if ($this->debug > 2) {
4746
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4746
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4747 4747
         }
4748 4748
         Database::query($sql);
4749 4749
 
@@ -4761,15 +4761,15 @@  discard block
 block discarded – undo
4761 4761
         if ($this->debug > 0) {
4762 4762
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4763 4763
         }
4764
-        if (intval($hide) == $hide){
4764
+        if (intval($hide) == $hide) {
4765 4765
             $this->hide_toc_frame = $hide;
4766 4766
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4767 4767
             $lp_id = $this->get_id();
4768 4768
             $sql = "UPDATE $lp_table SET
4769
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4769
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4770 4770
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4771 4771
             if ($this->debug > 2) {
4772
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4772
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4773 4773
             }
4774 4774
             Database::query($sql);
4775 4775
 
@@ -4796,7 +4796,7 @@  discard block
 block discarded – undo
4796 4796
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4797 4797
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4798 4798
         if ($this->debug > 2) {
4799
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4799
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4800 4800
         }
4801 4801
         Database::query($sql);
4802 4802
         return true;
@@ -4820,10 +4820,10 @@  discard block
 block discarded – undo
4820 4820
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4821 4821
         $lp_id = $this->get_id();
4822 4822
         $sql = "UPDATE $lp_table SET
4823
-                    content_local = '" . Database::escape_string($name) . "'
4823
+                    content_local = '".Database::escape_string($name)."'
4824 4824
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4825 4825
         if ($this->debug > 2) {
4826
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4826
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4827 4827
         }
4828 4828
         Database::query($sql);
4829 4829
         return true;
@@ -4857,11 +4857,11 @@  discard block
 block discarded – undo
4857 4857
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4858 4858
         $lp_id = $this->get_id();
4859 4859
         $sql = "UPDATE $lp_table SET
4860
-                    use_max_score = '" . $this->use_max_score . "'
4860
+                    use_max_score = '".$this->use_max_score."'
4861 4861
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4862 4862
 
4863 4863
         if ($this->debug > 2) {
4864
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4864
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4865 4865
         }
4866 4866
         Database::query($sql);
4867 4867
 
@@ -4888,10 +4888,10 @@  discard block
 block discarded – undo
4888 4888
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4889 4889
         $lp_id = $this->get_id();
4890 4890
         $sql = "UPDATE $lp_table SET
4891
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4891
+                expired_on = '".Database::escape_string($this->expired_on)."'
4892 4892
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4893 4893
         if ($this->debug > 2) {
4894
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4894
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4895 4895
         }
4896 4896
         Database::query($sql);
4897 4897
 
@@ -4917,10 +4917,10 @@  discard block
 block discarded – undo
4917 4917
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4918 4918
         $lp_id = $this->get_id();
4919 4919
         $sql = "UPDATE $lp_table SET
4920
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4920
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4921 4921
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4922 4922
         if ($this->debug > 2) {
4923
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4923
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4924 4924
         }
4925 4925
         Database::query($sql);
4926 4926
 
@@ -4940,10 +4940,10 @@  discard block
 block discarded – undo
4940 4940
         $this->modified_on = api_get_utc_datetime();
4941 4941
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4942 4942
         $lp_id = $this->get_id();
4943
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4943
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4944 4944
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4945 4945
         if ($this->debug > 2) {
4946
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4946
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4947 4947
         }
4948 4948
         Database::query($sql);
4949 4949
         return true;
@@ -5014,13 +5014,13 @@  discard block
 block discarded – undo
5014 5014
 
5015 5015
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5016 5016
             if ($this->debug > 2) {
5017
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5017
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5018 5018
             }
5019 5019
             switch ($this->get_type()) {
5020 5020
                 case '3' :
5021 5021
                     if ($this->items[$this->last]->get_type() != 'au') {
5022 5022
                         if ($this->debug > 2) {
5023
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5023
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5024 5024
                         }
5025 5025
                         $this->items[$this->last]->close();
5026 5026
                         //$this->autocomplete_parents($this->last);
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
                 case '2' :
5034 5034
                     if ($this->items[$this->last]->get_type() != 'sco') {
5035 5035
                         if ($this->debug > 2) {
5036
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5036
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5037 5037
                         }
5038 5038
                         $this->items[$this->last]->close();
5039 5039
                         //$this->autocomplete_parents($this->last);
@@ -5047,7 +5047,7 @@  discard block
 block discarded – undo
5047 5047
                 case '1' :
5048 5048
                 default :
5049 5049
                     if ($this->debug > 2) {
5050
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5050
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5051 5051
                     }
5052 5052
                     $this->items[$this->last]->close();
5053 5053
                     break;
@@ -5073,7 +5073,7 @@  discard block
 block discarded – undo
5073 5073
         }
5074 5074
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5075 5075
         $sql = "SELECT * FROM $lp_table
5076
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5076
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5077 5077
         $res = Database::query($sql);
5078 5078
         if (Database :: num_rows($res) > 0) {
5079 5079
             $row = Database :: fetch_array($res);
@@ -5094,14 +5094,14 @@  discard block
 block discarded – undo
5094 5094
                     break;
5095 5095
             }
5096 5096
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5097
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5097
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5098 5098
             Database::query($sql);
5099 5099
             $this->mode = $view_mode;
5100 5100
 
5101 5101
             return $view_mode;
5102 5102
         } else {
5103 5103
             if ($this->debug > 2) {
5104
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5104
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5105 5105
             }
5106 5106
         }
5107 5107
         return -1;
@@ -5119,7 +5119,7 @@  discard block
 block discarded – undo
5119 5119
         }
5120 5120
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5121 5121
         $sql = "SELECT * FROM $lp_table
5122
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5122
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5123 5123
         $res = Database::query($sql);
5124 5124
         if (Database :: num_rows($res) > 0) {
5125 5125
             $row = Database :: fetch_array($res);
@@ -5132,14 +5132,14 @@  discard block
 block discarded – undo
5132 5132
                 $force_return = true;
5133 5133
             }
5134 5134
             $sql = "UPDATE $lp_table SET force_commit = $force
5135
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5135
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5136 5136
             Database::query($sql);
5137 5137
             $this->force_commit = $force_return;
5138 5138
 
5139 5139
             return $force_return;
5140 5140
         } else {
5141 5141
             if ($this->debug > 2) {
5142
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5142
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5143 5143
             }
5144 5144
         }
5145 5145
         return -1;
@@ -5168,7 +5168,7 @@  discard block
 block discarded – undo
5168 5168
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5169 5169
                     $need_fix = true;
5170 5170
                     $sql = "UPDATE $lp_table SET display_order = $i
5171
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5171
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5172 5172
                     Database::query($sql);
5173 5173
                 }
5174 5174
                 $i++;
@@ -5189,7 +5189,7 @@  discard block
 block discarded – undo
5189 5189
         }
5190 5190
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5191 5191
         $sql = "SELECT * FROM $lp_table
5192
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5192
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5193 5193
         $res = Database::query($sql);
5194 5194
         if (Database :: num_rows($res) > 0) {
5195 5195
             $row = Database :: fetch_array($res);
@@ -5200,13 +5200,13 @@  discard block
 block discarded – undo
5200 5200
                 $force = 1;
5201 5201
             }
5202 5202
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5203
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5203
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5204 5204
             Database::query($sql);
5205 5205
             $this->prevent_reinit = $force;
5206 5206
             return $force;
5207 5207
         } else {
5208 5208
             if ($this->debug > 2) {
5209
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5209
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5210 5210
             }
5211 5211
         }
5212 5212
         return -1;
@@ -5222,11 +5222,11 @@  discard block
 block discarded – undo
5222 5222
     {
5223 5223
         //Set default value for seriousgame_mode
5224 5224
         if (!isset($this->seriousgame_mode)) {
5225
-            $this->seriousgame_mode=0;
5225
+            $this->seriousgame_mode = 0;
5226 5226
         }
5227 5227
         // Set default value for prevent_reinit
5228 5228
         if (!isset($this->prevent_reinit)) {
5229
-            $this->prevent_reinit =1;
5229
+            $this->prevent_reinit = 1;
5230 5230
         }
5231 5231
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5232 5232
             return 'seriousgame';
@@ -5274,7 +5274,7 @@  discard block
 block discarded – undo
5274 5274
         $sql = "UPDATE $lp_table SET
5275 5275
                 prevent_reinit = $prevent_reinit ,
5276 5276
                 seriousgame_mode = $sg_mode
5277
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5277
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5278 5278
         $res = Database::query($sql);
5279 5279
         if ($res) {
5280 5280
             return true;
@@ -5326,7 +5326,7 @@  discard block
 block discarded – undo
5326 5326
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5327 5327
         }
5328 5328
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5329
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5329
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5330 5330
         $res = Database::query($sql);
5331 5331
         if (Database :: num_rows($res) > 0) {
5332 5332
             $row = Database :: fetch_array($res);
@@ -5337,13 +5337,13 @@  discard block
 block discarded – undo
5337 5337
                 $force = 1;
5338 5338
             }
5339 5339
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5340
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5340
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5341 5341
             Database::query($sql);
5342 5342
             $this->seriousgame_mode = $force;
5343 5343
             return $force;
5344 5344
         } else {
5345 5345
             if ($this->debug > 2) {
5346
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5346
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5347 5347
             }
5348 5348
         }
5349 5349
         return -1;
@@ -5361,7 +5361,7 @@  discard block
 block discarded – undo
5361 5361
         }
5362 5362
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5363 5363
         $sql = "SELECT * FROM $lp_table
5364
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5364
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5365 5365
         $res = Database::query($sql);
5366 5366
         if (Database :: num_rows($res) > 0) {
5367 5367
             $row = Database :: fetch_array($res);
@@ -5372,13 +5372,13 @@  discard block
 block discarded – undo
5372 5372
                 $force = 1;
5373 5373
             }
5374 5374
             $sql = "UPDATE $lp_table SET debug = $force
5375
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5375
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5376 5376
             $res = Database::query($sql);
5377 5377
             $this->scorm_debug = $force;
5378 5378
             return $force;
5379 5379
         } else {
5380 5380
             if ($this->debug > 2) {
5381
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5381
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5382 5382
             }
5383 5383
         }
5384 5384
         return -1;
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
      * @param int $depth
5408 5408
      * @param array $tmp
5409 5409
      */
5410
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5410
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5411 5411
     {
5412 5412
         if ($this->debug > 1) {
5413 5413
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5493,7 +5493,7 @@  discard block
 block discarded – undo
5493 5493
 
5494 5494
         // we need to start a form when we want to update all the mp3 files
5495 5495
         if ($update_audio == 'true') {
5496
-            $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5496
+            $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5497 5497
         }
5498 5498
         $return .= '<div id="message"></div>';
5499 5499
         if (count($this->items) == 0) {
@@ -5501,14 +5501,14 @@  discard block
 block discarded – undo
5501 5501
         } else {
5502 5502
             $return_audio = '<table class="data_table">';
5503 5503
             $return_audio .= '<tr>';
5504
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5505
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5504
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5505
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5506 5506
             $return_audio .= '</tr>';
5507 5507
 
5508 5508
             if ($update_audio != 'true') {
5509 5509
                 $return .= '<div class="col-md-12">';
5510 5510
                 $return .= self::return_new_tree($update_audio);
5511
-                $return .='</div>';
5511
+                $return .= '</div>';
5512 5512
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5513 5513
             } else {
5514 5514
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5518,7 +5518,7 @@  discard block
 block discarded – undo
5518 5518
             // We need to close the form when we are updating the mp3 files.
5519 5519
             if ($update_audio == 'true') {
5520 5520
                 $return .= '<div class="footer-audio">';
5521
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5521
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5522 5522
                 $return .= '</div>';
5523 5523
                 //$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this?
5524 5524
             }
@@ -5539,7 +5539,7 @@  discard block
 block discarded – undo
5539 5539
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5540 5540
     {
5541 5541
         $return = '';
5542
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5542
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5543 5543
 
5544 5544
         $course_id = api_get_course_int_id();
5545 5545
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5587,7 +5587,7 @@  discard block
 block discarded – undo
5587 5587
 
5588 5588
             // Link for the documents
5589 5589
             if ($arrLP[$i]['item_type'] == 'document') {
5590
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5590
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5591 5591
                 $title_cut = Display::url(
5592 5592
                     $title_cut,
5593 5593
                     $url,
@@ -5603,14 +5603,14 @@  discard block
 block discarded – undo
5603 5603
             } else {
5604 5604
                 $oddClass = 'row_even';
5605 5605
             }
5606
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5606
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5607 5607
 
5608 5608
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5609 5609
 
5610
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5610
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5611 5611
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5612 5612
             } else {
5613
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5613
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5614 5614
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5615 5615
                 } else {
5616 5616
                     $icon = Display::return_icon('folder_document.gif');
@@ -5618,7 +5618,7 @@  discard block
 block discarded – undo
5618 5618
             }
5619 5619
 
5620 5620
             // The audio column.
5621
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5621
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5622 5622
             $audio = '';
5623 5623
 
5624 5624
             if (!$update_audio || $update_audio <> 'true') {
@@ -5629,10 +5629,10 @@  discard block
 block discarded – undo
5629 5629
             } else {
5630 5630
                 $types = self::getChapterTypes();
5631 5631
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5632
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5632
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5633 5633
                     if (!empty ($arrLP[$i]['audio'])) {
5634 5634
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5635
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5635
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5636 5636
                     }
5637 5637
                 }
5638 5638
             }
@@ -5656,7 +5656,7 @@  discard block
 block discarded – undo
5656 5656
                 // No edit for this item types
5657 5657
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5658 5658
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5659
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5659
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5660 5660
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5661 5661
                         $edit_icon .= '</a>';
5662 5662
 
@@ -5669,7 +5669,7 @@  discard block
 block discarded – undo
5669 5669
                                 $this->lp_session_id
5670 5670
                             )
5671 5671
                             ) {
5672
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5672
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5673 5673
                                     'action' => 'dissociate_forum',
5674 5674
                                     'id' => $arrLP[$i]['id'],
5675 5675
                                     'lp_id' => $this->lp_id
@@ -5680,7 +5680,7 @@  discard block
 block discarded – undo
5680 5680
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5681 5681
                                 );
5682 5682
                             } else {
5683
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5683
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5684 5684
                                     'action' => 'create_forum',
5685 5685
                                     'id' => $arrLP[$i]['id'],
5686 5686
                                     'lp_id' => $this->lp_id
@@ -5693,17 +5693,17 @@  discard block
 block discarded – undo
5693 5693
                             }
5694 5694
                         }
5695 5695
                     } else {
5696
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5696
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5697 5697
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5698 5698
                         $edit_icon .= '</a>';
5699 5699
                     }
5700 5700
                 }
5701 5701
 
5702
-                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
5702
+                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'" onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">';
5703 5703
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5704 5704
                 $delete_icon .= '</a>';
5705 5705
 
5706
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5706
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5707 5707
 
5708 5708
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5709 5709
                     $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq', ['class' => 'btn btn-default']);
@@ -5712,8 +5712,8 @@  discard block
 block discarded – undo
5712 5712
                 }
5713 5713
             }
5714 5714
             if ($update_audio != 'true') {
5715
-                $row = $move_icon . ' ' . $icon .
5716
-                    Display::span($title_cut) .
5715
+                $row = $move_icon.' '.$icon.
5716
+                    Display::span($title_cut).
5717 5717
                     Display::tag(
5718 5718
                         'div',
5719 5719
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5734,8 +5734,8 @@  discard block
 block discarded – undo
5734 5734
                 $parent_arrays = array();
5735 5735
                 if ($arrLP[$i]['depth'] > 1) {
5736 5736
                     //Getting list of parents
5737
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5738
-                        foreach($arrLP as $item) {
5737
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5738
+                        foreach ($arrLP as $item) {
5739 5739
                             if ($item['id'] == $parent_id) {
5740 5740
                                 if ($item['parent_item_id'] == 0) {
5741 5741
                                     $parent_id = $item['id'];
@@ -5757,8 +5757,8 @@  discard block
 block discarded – undo
5757 5757
                     $parent_arrays = array_reverse($parent_arrays);
5758 5758
                     $val = '$elements';
5759 5759
                     $x = 0;
5760
-                    foreach($parent_arrays as $item) {
5761
-                        if ($x != count($parent_arrays) -1) {
5760
+                    foreach ($parent_arrays as $item) {
5761
+                        if ($x != count($parent_arrays) - 1) {
5762 5762
                             $val .= '["'.$item.'"]["children"]';
5763 5763
                         } else {
5764 5764
                             $val .= '["'.$item.'"]["children"]';
@@ -5821,7 +5821,7 @@  discard block
 block discarded – undo
5821 5821
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5822 5822
                     $active = 'active';
5823 5823
                 }
5824
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5824
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5825 5825
             } else {
5826 5826
                 //sections
5827 5827
                 if (isset($item['children'])) {
@@ -5844,17 +5844,17 @@  discard block
 block discarded – undo
5844 5844
     {
5845 5845
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5846 5846
         $return = '<div class="actions">';
5847
-        $return .=  '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '&isStudentView=true">' . Display :: return_icon('preview_view.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'</a> ';
5848
-        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id=' . $_SESSION['oLP']->lp_id . '&updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM).'</a>';
5849
-        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM).'</a>';
5847
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'&isStudentView=true">'.Display :: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM).'</a> ';
5848
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id='.$_SESSION['oLP']->lp_id.'&updateaudio=true">'.Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM).'</a>';
5849
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM).'</a>';
5850 5850
         $buttons = array(
5851 5851
             array(
5852 5852
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5853
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5853
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5854 5854
             ),
5855 5855
             array(
5856 5856
                 'title' => get_lang('ClearAllPrerequisites'),
5857
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5857
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5858 5858
             ),
5859 5859
         );
5860 5860
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5877,7 +5877,7 @@  discard block
 block discarded – undo
5877 5877
     {
5878 5878
         // Creating learning_path folder
5879 5879
         $dir = '/learning_path';
5880
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5880
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5881 5881
         $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5882 5882
 
5883 5883
         $folder = false;
@@ -5924,9 +5924,9 @@  discard block
 block discarded – undo
5924 5924
         // Creating LP folder
5925 5925
         if ($folder) {
5926 5926
             //Limits title size
5927
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5927
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5928 5928
             $dir   = $dir.$title;
5929
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5929
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5930 5930
             if (!is_dir($filepath.'/'.$dir)) {
5931 5931
                 $folderData = create_unexisting_directory(
5932 5932
                     $course,
@@ -5946,7 +5946,7 @@  discard block
 block discarded – undo
5946 5946
             }
5947 5947
             $dir = $dir.'/';
5948 5948
             if ($folder) {
5949
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5949
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5950 5950
             }
5951 5951
         }
5952 5952
         $array = array(
@@ -5988,12 +5988,12 @@  discard block
 block discarded – undo
5988 5988
             $dir = substr($dir, 1);
5989 5989
         }
5990 5990
         if (!empty($dir[0]) && $dir[0] != '/') {
5991
-            $dir = '/' . $dir;
5991
+            $dir = '/'.$dir;
5992 5992
         }
5993 5993
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5994 5994
             $dir .= '/';
5995 5995
         }
5996
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5996
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5997 5997
 
5998 5998
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5999 5999
             //Generates folder
@@ -6003,7 +6003,7 @@  discard block
 block discarded – undo
6003 6003
         }
6004 6004
 
6005 6005
         if (!is_dir($filepath)) {
6006
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6006
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6007 6007
             $dir = '/';
6008 6008
         }
6009 6009
 
@@ -6023,10 +6023,10 @@  discard block
 block discarded – undo
6023 6023
         $tmp_filename = $filename;
6024 6024
 
6025 6025
         $i = 0;
6026
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6027
-            $tmp_filename = $filename . '_' . ++ $i;
6026
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6027
+            $tmp_filename = $filename.'_'.++ $i;
6028 6028
 
6029
-        $filename = $tmp_filename . '.'.$extension;
6029
+        $filename = $tmp_filename.'.'.$extension;
6030 6030
         if ($extension == 'html') {
6031 6031
             $content = stripslashes($content);
6032 6032
             $content = str_replace(
@@ -6061,12 +6061,12 @@  discard block
 block discarded – undo
6061 6061
             );
6062 6062
         }
6063 6063
 
6064
-        if (!file_exists($filepath . $filename)) {
6065
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6064
+        if (!file_exists($filepath.$filename)) {
6065
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6066 6066
                 fputs($fp, $content);
6067 6067
                 fclose($fp);
6068 6068
 
6069
-                $file_size = filesize($filepath . $filename);
6069
+                $file_size = filesize($filepath.$filename);
6070 6070
                 $save_file_path = $dir.$filename;
6071 6071
 
6072 6072
                 $document_id = add_document(
@@ -6104,12 +6104,12 @@  discard block
 block discarded – undo
6104 6104
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6105 6105
                         $ct = '';
6106 6106
                         if ($new_comment)
6107
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6107
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6108 6108
                         if ($new_title)
6109
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6109
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6110 6110
 
6111
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6112
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6111
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6112
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6113 6113
                         Database::query($sql);
6114 6114
                     }
6115 6115
                 }
@@ -6137,42 +6137,42 @@  discard block
 block discarded – undo
6137 6137
             $dir = substr($dir, 1);
6138 6138
 
6139 6139
         if ($dir[0] != '/')
6140
-            $dir = '/' . $dir;
6140
+            $dir = '/'.$dir;
6141 6141
 
6142 6142
         if ($dir[strlen($dir) - 1] != '/')
6143 6143
             $dir .= '/';
6144 6144
 
6145
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6145
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6146 6146
 
6147 6147
         if (!is_dir($filepath)) {
6148
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6148
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6149 6149
             $dir = '/';
6150 6150
         }
6151 6151
 
6152 6152
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6153 6153
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6154 6154
             $document_id = intval($_POST['path']);
6155
-            $sql = "SELECT path FROM " . $table_doc . "
6156
-                    WHERE c_id = $course_id AND id = " . $document_id;
6155
+            $sql = "SELECT path FROM ".$table_doc."
6156
+                    WHERE c_id = $course_id AND id = ".$document_id;
6157 6157
             $res = Database::query($sql);
6158 6158
             $row = Database :: fetch_array($res);
6159 6159
             $content = stripslashes($_POST['content_lp']);
6160
-            $file = $filepath . $row['path'];
6160
+            $file = $filepath.$row['path'];
6161 6161
 
6162 6162
             if ($fp = @ fopen($file, 'w')) {
6163
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6163
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6164 6164
 
6165 6165
                 // Change the path of mp3 to absolute.
6166 6166
                 // The first regexp deals with :// urls.
6167
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6167
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6168 6168
                 // The second regexp deals with audio/ urls.
6169
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6169
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6170 6170
                 fputs($fp, $content);
6171 6171
                 fclose($fp);
6172 6172
 
6173
-                $sql = "UPDATE " . $table_doc ." SET
6173
+                $sql = "UPDATE ".$table_doc." SET
6174 6174
                             title='".Database::escape_string($_POST['title'])."'
6175
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6175
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6176 6176
                 Database::query($sql);
6177 6177
             }
6178 6178
         }
@@ -6190,10 +6190,10 @@  discard block
 block discarded – undo
6190 6190
         $return = '';
6191 6191
         if (is_numeric($item_id)) {
6192 6192
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6193
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6194
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6193
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6194
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6195 6195
             $result = Database::query($sql);
6196
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6196
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6197 6197
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6198 6198
 
6199 6199
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6220,8 +6220,8 @@  discard block
 block discarded – undo
6220 6220
                         break;
6221 6221
                     case TOOL_DOCUMENT:
6222 6222
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6223
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6224
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6223
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6224
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6225 6225
                         $result = Database::query($sql_doc);
6226 6226
                         $path_file = Database::result($result, 0, 0);
6227 6227
                         $path_parts = pathinfo($path_file);
@@ -6260,7 +6260,7 @@  discard block
 block discarded – undo
6260 6260
         if (is_numeric($item_id)) {
6261 6261
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6262 6262
             $sql = "SELECT * FROM $tbl_lp_item
6263
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6263
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6264 6264
             $res = Database::query($sql);
6265 6265
             $row = Database::fetch_array($res);
6266 6266
 
@@ -6271,21 +6271,21 @@  discard block
 block discarded – undo
6271 6271
                 case 'sco' :
6272 6272
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6273 6273
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6274
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6274
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6275 6275
                     } else {
6276
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6276
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6277 6277
                     }
6278 6278
                     break;
6279 6279
                 case TOOL_DOCUMENT :
6280 6280
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6281 6281
                     $sql = "SELECT lp.*, doc.path as dir
6282
-                            FROM " . $tbl_lp_item . " as lp
6283
-                            LEFT JOIN " . $tbl_doc . " as doc
6282
+                            FROM " . $tbl_lp_item." as lp
6283
+                            LEFT JOIN " . $tbl_doc." as doc
6284 6284
                             ON doc.id = lp.path
6285 6285
                             WHERE
6286 6286
                                 lp.c_id = $course_id AND
6287 6287
                                 doc.c_id = $course_id AND
6288
-                                lp.id = " . intval($item_id);
6288
+                                lp.id = ".intval($item_id);
6289 6289
                     $res_step = Database::query($sql);
6290 6290
                     $row_step = Database :: fetch_array($res_step);
6291 6291
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6295,8 +6295,8 @@  discard block
 block discarded – undo
6295 6295
                     $link_id = (string) $row['path'];
6296 6296
                     if (ctype_digit($link_id)) {
6297 6297
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6298
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6299
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6298
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6299
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6300 6300
                         $res_link = Database::query($sql_select);
6301 6301
                         $row_link = Database :: fetch_array($res_link);
6302 6302
                         if (is_array($row_link)) {
@@ -6309,9 +6309,9 @@  discard block
 block discarded – undo
6309 6309
                 case 'dokeos_module' :
6310 6310
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6311 6311
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6312
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6312
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6313 6313
                     } else {
6314
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6314
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6315 6315
                     }
6316 6316
                     break;
6317 6317
                 case TOOL_QUIZ :
@@ -6366,7 +6366,7 @@  discard block
 block discarded – undo
6366 6366
 
6367 6367
         $headers = array(
6368 6368
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6369
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6369
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6370 6370
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6371 6371
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6372 6372
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6406,16 +6406,16 @@  discard block
 block discarded – undo
6406 6406
         $course_id = api_get_course_int_id();
6407 6407
         $return = '';
6408 6408
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6409
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6410
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6409
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6410
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6411 6411
         $res_doc = Database::query($sql_doc);
6412 6412
         $row_doc = Database :: fetch_array($res_doc);
6413 6413
 
6414 6414
         // TODO: Add a path filter.
6415 6415
         if ($iframe) {
6416
-            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . str_replace('%2F', '/', urlencode($row_doc['path'])) . '?' . api_get_cidreq() . '"></iframe>';
6416
+            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.str_replace('%2F', '/', urlencode($row_doc['path'])).'?'.api_get_cidreq().'"></iframe>';
6417 6417
         } else {
6418
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6418
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6419 6419
         }
6420 6420
 
6421 6421
         return $return;
@@ -6439,8 +6439,8 @@  discard block
 block discarded – undo
6439 6439
             $item_description = $extra_info['description'];
6440 6440
         } elseif (is_numeric($extra_info)) {
6441 6441
             $sql = "SELECT title, description
6442
-                    FROM " . $tbl_quiz . "
6443
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6442
+                    FROM " . $tbl_quiz."
6443
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6444 6444
 
6445 6445
             $result = Database::query($sql);
6446 6446
             $row = Database::fetch_array($result);
@@ -6450,8 +6450,8 @@  discard block
 block discarded – undo
6450 6450
             $item_title = '';
6451 6451
             $item_description = '';
6452 6452
         }
6453
-        $item_title			= Security::remove_XSS($item_title);
6454
-        $item_description 	= Security::remove_XSS($item_description);
6453
+        $item_title = Security::remove_XSS($item_title);
6454
+        $item_description = Security::remove_XSS($item_description);
6455 6455
 
6456 6456
         $legend = '<legend>';
6457 6457
         if ($id != 0 && is_array($extra_info))
@@ -6459,13 +6459,13 @@  discard block
 block discarded – undo
6459 6459
         else
6460 6460
             $parent = 0;
6461 6461
 
6462
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6463
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6462
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6463
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6464 6464
 
6465 6465
         $result = Database::query($sql);
6466
-        $arrLP = array ();
6466
+        $arrLP = array();
6467 6467
         while ($row = Database :: fetch_array($result)) {
6468
-            $arrLP[] = array (
6468
+            $arrLP[] = array(
6469 6469
                 'id' => $row['id'],
6470 6470
                 'item_type' => $row['item_type'],
6471 6471
                 'title' => $row['title'],
@@ -6488,15 +6488,15 @@  discard block
 block discarded – undo
6488 6488
         unset ($this->arrMenu);
6489 6489
 
6490 6490
         if ($action == 'add') {
6491
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6491
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6492 6492
         } elseif ($action == 'move') {
6493
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6493
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6494 6494
         } else {
6495
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6495
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6496 6496
         }
6497 6497
 
6498 6498
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6499
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6499
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6500 6500
         }
6501 6501
 
6502 6502
         $legend .= '</legend>';
@@ -6509,34 +6509,34 @@  discard block
 block discarded – undo
6509 6509
 
6510 6510
         if ($action != 'move') {
6511 6511
             $return .= '<tr>';
6512
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6513
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6512
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6513
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6514 6514
             $return .= '</tr>';
6515 6515
         }
6516 6516
 
6517 6517
         $return .= '<tr>';
6518 6518
 
6519
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6519
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6520 6520
         $return .= '<td class="input">';
6521 6521
 
6522 6522
         // Select for Parent item, root or chapter
6523 6523
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6524 6524
 
6525
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6525
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6526 6526
 
6527
-        $arrHide = array (
6527
+        $arrHide = array(
6528 6528
             $id
6529 6529
         );
6530 6530
         for ($i = 0; $i < count($arrLP); $i++) {
6531 6531
             if ($action != 'add') {
6532 6532
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6533
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6533
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6534 6534
                 } else {
6535 6535
                     $arrHide[] = $arrLP[$i]['id'];
6536 6536
                 }
6537 6537
             } else {
6538 6538
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6539
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6539
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6540 6540
             }
6541 6541
         }
6542 6542
         if (is_array($arrLP)) {
@@ -6548,11 +6548,11 @@  discard block
 block discarded – undo
6548 6548
         $return .= '</tr>';
6549 6549
         $return .= '<tr>';
6550 6550
 
6551
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6551
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6552 6552
         $return .= '<td class="input">';
6553 6553
 
6554 6554
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6555
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6555
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6556 6556
         for ($i = 0; $i < count($arrLP); $i++) {
6557 6557
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6558 6558
                 if (is_array($extra_info)) {
@@ -6564,7 +6564,7 @@  discard block
 block discarded – undo
6564 6564
                 } else {
6565 6565
                     $selected = '';
6566 6566
                 }
6567
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6567
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6568 6568
             }
6569 6569
         }
6570 6570
         $return .= '</select>';
@@ -6581,7 +6581,7 @@  discard block
 block discarded – undo
6581 6581
                     }
6582 6582
                 }
6583 6583
             }
6584
-            $arrHide = array ();
6584
+            $arrHide = array();
6585 6585
             for ($i = 0; $i < count($arrLP); $i++) {
6586 6586
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6587 6587
                     if (is_array($extra_info)) {
@@ -6627,27 +6627,27 @@  discard block
 block discarded – undo
6627 6627
 
6628 6628
         $return .= '<tr>';
6629 6629
         if ($action == 'add') {
6630
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6630
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6631 6631
         } else {
6632
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6632
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6633 6633
         }
6634 6634
 
6635 6635
         $return .= '</tr>';
6636 6636
         $return .= '</table>';
6637 6637
 
6638 6638
         if ($action == 'move') {
6639
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6640
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6639
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6640
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6641 6641
         }
6642 6642
 
6643 6643
         if (is_numeric($extra_info)) {
6644
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6644
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6645 6645
         } elseif (is_array($extra_info)) {
6646
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6646
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6647 6647
         }
6648 6648
 
6649
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6650
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6649
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6650
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6651 6651
 
6652 6652
         $return .= '</form>';
6653 6653
         $return .= '</div>';
@@ -6674,11 +6674,11 @@  discard block
 block discarded – undo
6674 6674
         } elseif (is_numeric($extra_info)) {
6675 6675
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6676 6676
 
6677
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6677
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6678 6678
                     WHERE
6679 6679
                         c_id = ".$course_id." AND
6680
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6681
-                        id = " . (int) $extra_info . "
6680
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6681
+                        id = " . (int) $extra_info."
6682 6682
                     ORDER BY id ASC";
6683 6683
 
6684 6684
             $res_hot = Database::query($sql);
@@ -6702,11 +6702,11 @@  discard block
 block discarded – undo
6702 6702
         }
6703 6703
 
6704 6704
         $sql = "SELECT * FROM $tbl_lp_item
6705
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6705
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6706 6706
         $result = Database::query($sql);
6707
-        $arrLP = array ();
6707
+        $arrLP = array();
6708 6708
         while ($row = Database :: fetch_array($result)) {
6709
-            $arrLP[] = array (
6709
+            $arrLP[] = array(
6710 6710
                 'id' => $row['id'],
6711 6711
                 'item_type' => $row['item_type'],
6712 6712
                 'title' => $row['title'],
@@ -6731,7 +6731,7 @@  discard block
 block discarded – undo
6731 6731
         else
6732 6732
             $legend .= get_lang('EditCurrentExecice');
6733 6733
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6734
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6734
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6735 6735
         }
6736 6736
         $legend .= '</legend>';
6737 6737
 
@@ -6739,11 +6739,11 @@  discard block
 block discarded – undo
6739 6739
         $return .= $legend;
6740 6740
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6741 6741
         $return .= '<tr>';
6742
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6742
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6743 6743
         $return .= '<td class="input">';
6744 6744
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6745
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6746
-        $arrHide = array (
6745
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6746
+        $arrHide = array(
6747 6747
             $id
6748 6748
         );
6749 6749
 
@@ -6751,13 +6751,13 @@  discard block
 block discarded – undo
6751 6751
             for ($i = 0; $i < count($arrLP); $i++) {
6752 6752
                 if ($action != 'add') {
6753 6753
                     if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6754
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6754
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6755 6755
                     } else {
6756 6756
                         $arrHide[] = $arrLP[$i]['id'];
6757 6757
                     }
6758 6758
                 } else {
6759 6759
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6760
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6760
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6761 6761
                 }
6762 6762
             }
6763 6763
 
@@ -6768,10 +6768,10 @@  discard block
 block discarded – undo
6768 6768
         $return .= '</td>';
6769 6769
         $return .= '</tr>';
6770 6770
         $return .= '<tr>';
6771
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6771
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6772 6772
         $return .= '<td class="input">';
6773 6773
         $return .= '<select id="previous" name="previous" size="1">';
6774
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6774
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6775 6775
 
6776 6776
         for ($i = 0; $i < count($arrLP); $i++) {
6777 6777
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6781,7 +6781,7 @@  discard block
 block discarded – undo
6781 6781
                 else
6782 6782
                     $selected = '';
6783 6783
 
6784
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6784
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6785 6785
             }
6786 6786
         }
6787 6787
 
@@ -6791,8 +6791,8 @@  discard block
 block discarded – undo
6791 6791
 
6792 6792
         if ($action != 'move') {
6793 6793
             $return .= '<tr>';
6794
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6795
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6794
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6795
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6796 6796
             $return .= '</tr>';
6797 6797
             $id_prerequisite = 0;
6798 6798
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6803,7 +6803,7 @@  discard block
 block discarded – undo
6803 6803
                     }
6804 6804
                 }
6805 6805
 
6806
-                $arrHide = array ();
6806
+                $arrHide = array();
6807 6807
                 for ($i = 0; $i < count($arrLP); $i++) {
6808 6808
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6809 6809
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6817,22 +6817,22 @@  discard block
 block discarded – undo
6817 6817
         }
6818 6818
 
6819 6819
         $return .= '<tr>';
6820
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6820
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6821 6821
         $return .= '</tr>';
6822 6822
         $return .= '</table>';
6823 6823
 
6824 6824
         if ($action == 'move') {
6825
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6826
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6825
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6826
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6827 6827
         }
6828 6828
 
6829 6829
         if (is_numeric($extra_info)) {
6830
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6830
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6831 6831
         } elseif (is_array($extra_info)) {
6832
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6832
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6833 6833
         }
6834
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6835
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6834
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6835
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6836 6836
         $return .= '</form>';
6837 6837
 
6838 6838
         return $return;
@@ -6855,8 +6855,8 @@  discard block
 block discarded – undo
6855 6855
             $item_title = stripslashes($extra_info['title']);
6856 6856
         } elseif (is_numeric($extra_info)) {
6857 6857
             $sql = "SELECT forum_title as title, forum_comment as comment
6858
-                    FROM " . $tbl_forum . "
6859
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6858
+                    FROM " . $tbl_forum."
6859
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6860 6860
 
6861 6861
             $result = Database::query($sql);
6862 6862
             $row = Database :: fetch_array($result);
@@ -6876,7 +6876,7 @@  discard block
 block discarded – undo
6876 6876
             $parent = 0;
6877 6877
         }
6878 6878
 
6879
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6879
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6880 6880
                 WHERE
6881 6881
                     c_id = ".$course_id." AND
6882 6882
                     lp_id = " . $this->lp_id;
@@ -6884,7 +6884,7 @@  discard block
 block discarded – undo
6884 6884
         $arrLP = array();
6885 6885
 
6886 6886
         while ($row = Database :: fetch_array($result)) {
6887
-            $arrLP[] = array (
6887
+            $arrLP[] = array(
6888 6888
                 'id' => $row['id'],
6889 6889
                 'item_type' => $row['item_type'],
6890 6890
                 'title' => $row['title'],
@@ -6906,10 +6906,10 @@  discard block
 block discarded – undo
6906 6906
         unset($this->arrMenu);
6907 6907
 
6908 6908
         if ($action == 'add')
6909
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6910
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6909
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6910
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6911 6911
         else
6912
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6912
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6913 6913
 
6914 6914
         $legend .= '</legend>';
6915 6915
         $return = '<div class="sectioncomment">';
@@ -6919,16 +6919,16 @@  discard block
 block discarded – undo
6919 6919
 
6920 6920
         if ($action != 'move') {
6921 6921
             $return .= '<tr>';
6922
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6923
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6922
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6923
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6924 6924
             $return .= '</tr>';
6925 6925
         }
6926 6926
 
6927 6927
         $return .= '<tr>';
6928
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6928
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6929 6929
         $return .= '<td class="input">';
6930 6930
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6931
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6931
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6932 6932
         $arrHide = array(
6933 6933
             $id
6934 6934
         );
@@ -6937,13 +6937,13 @@  discard block
 block discarded – undo
6937 6937
         for ($i = 0; $i < count($arrLP); $i++) {
6938 6938
             if ($action != 'add') {
6939 6939
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6940
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6940
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6941 6941
                 } else {
6942 6942
                     $arrHide[] = $arrLP[$i]['id'];
6943 6943
                 }
6944 6944
             } else {
6945 6945
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6946
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6946
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6947 6947
             }
6948 6948
         }
6949 6949
         if (is_array($arrLP)) {
@@ -6954,10 +6954,10 @@  discard block
 block discarded – undo
6954 6954
         $return .= '</td>';
6955 6955
         $return .= '</tr>';
6956 6956
         $return .= '<tr>';
6957
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6957
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6958 6958
         $return .= '<td class="input">';
6959 6959
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6960
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6960
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6961 6961
 
6962 6962
         for ($i = 0; $i < count($arrLP); $i++) {
6963 6963
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6967,8 +6967,8 @@  discard block
 block discarded – undo
6967 6967
                 else
6968 6968
                     $selected = '';
6969 6969
 
6970
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6971
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6970
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6971
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6972 6972
             }
6973 6973
         }
6974 6974
 
@@ -7002,25 +7002,25 @@  discard block
 block discarded – undo
7002 7002
         $return .= '<tr>';
7003 7003
 
7004 7004
         if ($action == 'add') {
7005
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
7005
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
7006 7006
         } else {
7007
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
7007
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
7008 7008
         }
7009 7009
         $return .= '</tr>';
7010 7010
         $return .= '</table>';
7011 7011
 
7012 7012
         if ($action == 'move') {
7013
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7014
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7013
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7014
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7015 7015
         }
7016 7016
 
7017 7017
         if (is_numeric($extra_info)) {
7018
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7018
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7019 7019
         } elseif (is_array($extra_info)) {
7020
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7020
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7021 7021
         }
7022
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7023
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7022
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7023
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7024 7024
         $return .= '</form>';
7025 7025
         $return .= '</div>';
7026 7026
 
@@ -7047,7 +7047,7 @@  discard block
 block discarded – undo
7047 7047
             $item_title = stripslashes($extra_info['title']);
7048 7048
         } elseif (is_numeric($extra_info)) {
7049 7049
             $sql = "SELECT thread_title as title FROM $tbl_forum
7050
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7050
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7051 7051
 
7052 7052
             $result = Database::query($sql);
7053 7053
             $row = Database :: fetch_array($result);
@@ -7067,15 +7067,15 @@  discard block
 block discarded – undo
7067 7067
             $parent = 0;
7068 7068
         }
7069 7069
 
7070
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7071
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7070
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7071
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7072 7072
 
7073 7073
         $result = Database::query($sql);
7074 7074
 
7075
-        $arrLP = array ();
7075
+        $arrLP = array();
7076 7076
 
7077 7077
         while ($row = Database :: fetch_array($result)) {
7078
-            $arrLP[] = array (
7078
+            $arrLP[] = array(
7079 7079
                 'id' => $row['id'],
7080 7080
                 'item_type' => $row['item_type'],
7081 7081
                 'title' => $row['title'],
@@ -7098,31 +7098,31 @@  discard block
 block discarded – undo
7098 7098
 
7099 7099
         $return .= '<form method="POST">';
7100 7100
         if ($action == 'add')
7101
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7102
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7101
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7102
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7103 7103
         else
7104
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7104
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7105 7105
 
7106 7106
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7107 7107
         $return .= '<tr>';
7108
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7108
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7109 7109
         $return .= '<td class="input">';
7110 7110
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7111
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7112
-        $arrHide = array (
7111
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7112
+        $arrHide = array(
7113 7113
             $id
7114 7114
         );
7115 7115
 
7116 7116
         for ($i = 0; $i < count($arrLP); $i++) {
7117 7117
             if ($action != 'add') {
7118 7118
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
7119
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7119
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7120 7120
                 } else {
7121 7121
                     $arrHide[] = $arrLP[$i]['id'];
7122 7122
                 }
7123 7123
             } else {
7124 7124
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7125
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7125
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7126 7126
             }
7127 7127
         }
7128 7128
 
@@ -7134,10 +7134,10 @@  discard block
 block discarded – undo
7134 7134
         $return .= '</td>';
7135 7135
         $return .= '</tr>';
7136 7136
         $return .= '<tr>';
7137
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7137
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7138 7138
         $return .= '<td class="input">';
7139 7139
         $return .= '<select id="previous" name="previous" size="1">';
7140
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7140
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7141 7141
         for ($i = 0; $i < count($arrLP); $i++) {
7142 7142
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7143 7143
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7146,7 +7146,7 @@  discard block
 block discarded – undo
7146 7146
                 else
7147 7147
                     $selected = '';
7148 7148
 
7149
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7149
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7150 7150
             }
7151 7151
         }
7152 7152
         $return .= '</select>';
@@ -7154,8 +7154,8 @@  discard block
 block discarded – undo
7154 7154
         $return .= '</tr>';
7155 7155
         if ($action != 'move') {
7156 7156
             $return .= '<tr>';
7157
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7158
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7157
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7158
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7159 7159
             $return .= '</tr>';
7160 7160
             $return .= '<tr>';
7161 7161
             $return .= '</tr>';
@@ -7182,17 +7182,17 @@  discard block
 block discarded – undo
7182 7182
             }
7183 7183
 
7184 7184
             $return .= '<tr>';
7185
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7186
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7185
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7186
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7187 7187
 
7188 7188
             foreach ($arrHide as $key => $value) {
7189 7189
                 if ($key == $s_selected_position && $action == 'add') {
7190
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7190
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7191 7191
                 }
7192 7192
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7193
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7193
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7194 7194
                 } else {
7195
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7195
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7196 7196
                 }
7197 7197
             }
7198 7198
             $return .= "</select></td>";
@@ -7206,19 +7206,19 @@  discard block
 block discarded – undo
7206 7206
         $return .= '</table>';
7207 7207
 
7208 7208
         if ($action == 'move') {
7209
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7210
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7209
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7210
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7211 7211
         }
7212 7212
 
7213 7213
         if (is_numeric($extra_info)) {
7214
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7214
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7215 7215
         }
7216 7216
         elseif (is_array($extra_info)) {
7217
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7217
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7218 7218
         }
7219 7219
 
7220
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7221
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7220
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7221
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7222 7222
         $return .= '</form>';
7223 7223
         $return .= '</div>';
7224 7224
 
@@ -7244,10 +7244,10 @@  discard block
 block discarded – undo
7244 7244
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7245 7245
 
7246 7246
         if ($id != 0 && is_array($extra_info)) {
7247
-            $item_title 		= $extra_info['title'];
7248
-            $item_description 	= $extra_info['description'];
7249
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7250
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7247
+            $item_title = $extra_info['title'];
7248
+            $item_description = $extra_info['description'];
7249
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7250
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7251 7251
         } else {
7252 7252
             $item_title = '';
7253 7253
             $item_description = '';
@@ -7261,17 +7261,17 @@  discard block
 block discarded – undo
7261 7261
         }
7262 7262
 
7263 7263
         $id  = intval($id);
7264
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7264
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7265 7265
                 WHERE
7266 7266
                     c_id = ".$course_id." AND
7267
-                    lp_id = " . $this->lp_id . " AND
7267
+                    lp_id = " . $this->lp_id." AND
7268 7268
                     id != $id";
7269 7269
 
7270 7270
         if ($item_type == 'module')
7271 7271
             $sql .= " AND parent_item_id = 0";
7272 7272
 
7273 7273
         $result = Database::query($sql);
7274
-        $arrLP = array ();
7274
+        $arrLP = array();
7275 7275
 
7276 7276
         while ($row = Database :: fetch_array($result)) {
7277 7277
             $arrLP[] = array(
@@ -7299,9 +7299,9 @@  discard block
 block discarded – undo
7299 7299
 
7300 7300
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7301 7301
 
7302
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7302
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7303 7303
 
7304
-        $form = new FormValidator('form', 'POST',  $url);
7304
+        $form = new FormValidator('form', 'POST', $url);
7305 7305
 
7306 7306
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7307 7307
         $defaults['description'] = $item_description;
@@ -7345,7 +7345,7 @@  discard block
 block discarded – undo
7345 7345
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7346 7346
 
7347 7347
             foreach ($arrHide as $key => $value) {
7348
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7348
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7349 7349
             }
7350 7350
             if (!empty($s_selected_parent)) {
7351 7351
                 $parent_select->setSelected($s_selected_parent);
@@ -7367,16 +7367,16 @@  discard block
 block discarded – undo
7367 7367
                     $s_selected_position = $arrLP[$i]['id'];
7368 7368
                 }
7369 7369
 
7370
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7370
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7371 7371
             }
7372 7372
         }
7373 7373
 
7374 7374
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7375 7375
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7376
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7376
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7377 7377
 
7378 7378
         foreach ($arrHide as $key => $value) {
7379
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7379
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7380 7380
         }
7381 7381
 
7382 7382
         if (!empty ($s_selected_position)) {
@@ -7405,23 +7405,23 @@  discard block
 block discarded – undo
7405 7405
         //assets can't be modified
7406 7406
 
7407 7407
         //$item_type == 'asset' ||
7408
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7408
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7409 7409
 
7410 7410
             if ($item_type == 'sco') {
7411
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7411
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7412 7412
             }
7413 7413
             $renderer = $form->defaultRenderer();
7414 7414
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7415 7415
 
7416 7416
             $relative_prefix = '';
7417 7417
 
7418
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7418
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7419 7419
                 'Width' 				=> '100%',
7420 7420
                 'Height' 				=> '500',
7421 7421
                 'FullPage' 				=> true,
7422 7422
                 'CreateDocumentDir' 	=> $relative_prefix,
7423
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7424
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7423
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7424
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7425 7425
             );
7426 7426
 
7427 7427
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7430,7 +7430,7 @@  discard block
 block discarded – undo
7430 7430
             $defaults['content_lp'] = file_get_contents($content_path);
7431 7431
         }
7432 7432
 
7433
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7433
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7434 7434
         $form->addElement('hidden', 'post_time', time());
7435 7435
         $form->setDefaults($defaults);
7436 7436
         return $form->return_form();
@@ -7468,8 +7468,8 @@  discard block
 block discarded – undo
7468 7468
         // We don't display the document form if it's not an editable document (html or txt file).
7469 7469
         if ($action == "add") {
7470 7470
             if (is_numeric($extra_info)) {
7471
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7472
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7471
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7472
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7473 7473
                 $result = Database::query($sql_doc);
7474 7474
                 $path_file = Database :: result($result, 0, 0);
7475 7475
                 $path_parts = pathinfo($path_file);
@@ -7487,13 +7487,13 @@  discard block
 block discarded – undo
7487 7487
                 $item_title = stripslashes($path_parts['filename']);
7488 7488
             }
7489 7489
         } elseif (is_numeric($extra_info)) {
7490
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7490
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7491 7491
                         WHERE
7492 7492
                             c_id = ".$course_id." AND
7493 7493
                             id = " . intval($extra_info);
7494 7494
 
7495 7495
             $result = Database::query($sql_doc);
7496
-            $row 	= Database::fetch_array($result);
7496
+            $row = Database::fetch_array($result);
7497 7497
             $item_title = $row['title'];
7498 7498
             $item_title = str_replace('_', ' ', $item_title);
7499 7499
             if (empty ($item_title)) {
@@ -7512,11 +7512,11 @@  discard block
 block discarded – undo
7512 7512
             $parent = 0;
7513 7513
         }
7514 7514
 
7515
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7516
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7515
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7516
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7517 7517
 
7518 7518
         $result = Database::query($sql);
7519
-        $arrLP = array ();
7519
+        $arrLP = array();
7520 7520
         while ($row = Database :: fetch_array($result)) {
7521 7521
             $arrLP[] = array(
7522 7522
                 'id' => $row['id'],
@@ -7550,9 +7550,9 @@  discard block
 block discarded – undo
7550 7550
         $return .= '</legend>';
7551 7551
 
7552 7552
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7553
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7553
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7554 7554
         }
7555
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7555
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7556 7556
         $defaults['title'] = Security :: remove_XSS($item_title);
7557 7557
         if (empty($item_title)) {
7558 7558
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7588,15 +7588,15 @@  discard block
 block discarded – undo
7588 7588
         }
7589 7589
 
7590 7590
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7591
-        $my_count=0;
7591
+        $my_count = 0;
7592 7592
         foreach ($arrHide as $key => $value) {
7593
-            if ($my_count!=0) {
7593
+            if ($my_count != 0) {
7594 7594
                 // The LP name is also the first section and is not in the same charset like the other sections.
7595 7595
                 $value['value'] = Security :: remove_XSS($value['value']);
7596
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7596
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7597 7597
             } else {
7598 7598
                 $value['value'] = Security :: remove_XSS($value['value']);
7599
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7599
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7600 7600
             }
7601 7601
             $my_count++;
7602 7602
         }
@@ -7604,7 +7604,7 @@  discard block
 block discarded – undo
7604 7604
         if (!empty($id)) {
7605 7605
             $parent_select->setSelected($parent);
7606 7606
         } else {
7607
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7607
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7608 7608
             $parent_select->setSelected($parent_item_id);
7609 7609
         }
7610 7610
 
@@ -7621,7 +7621,7 @@  discard block
 block discarded – undo
7621 7621
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7622 7622
                     $s_selected_position = $arrLP[$i]['id'];
7623 7623
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7624
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7624
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7625 7625
             }
7626 7626
         }
7627 7627
 
@@ -7629,8 +7629,8 @@  discard block
 block discarded – undo
7629 7629
         $position->addOption(get_lang('FirstPosition'), 0);
7630 7630
 
7631 7631
         foreach ($arrHide as $key => $value) {
7632
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7633
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7632
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7633
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7634 7634
         }
7635 7635
         $position->setSelected($s_selected_position);
7636 7636
 
@@ -7700,7 +7700,7 @@  discard block
 block discarded – undo
7700 7700
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7701 7701
                             $relative_path 	 = implode('/', $relative_path);
7702 7702
                             if (strlen($relative_path) > 0) {
7703
-                                $relative_path = $relative_path . '/';
7703
+                                $relative_path = $relative_path.'/';
7704 7704
                             }
7705 7705
                         } else {
7706 7706
                             $result = $this->generate_lp_folder($_course);
@@ -7714,8 +7714,8 @@  discard block
 block discarded – undo
7714 7714
                             'Height' 				=> '500',
7715 7715
                             'FullPage' 				=> true,
7716 7716
                             'CreateDocumentDir' 	=> $relative_prefix,
7717
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7718
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7717
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7718
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7719 7719
                         );
7720 7720
 
7721 7721
                         if ($_GET['action'] == 'add_item') {
@@ -7782,8 +7782,8 @@  discard block
 block discarded – undo
7782 7782
             $item_url = stripslashes($extra_info['url']);
7783 7783
         } elseif (is_numeric($extra_info)) {
7784 7784
             $extra_info = intval($extra_info);
7785
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7786
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7785
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7786
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7787 7787
             $result = Database::query($sql);
7788 7788
             $row = Database :: fetch_array($result);
7789 7789
             $item_title       = $row['title'];
@@ -7803,8 +7803,8 @@  discard block
 block discarded – undo
7803 7803
             $parent = 0;
7804 7804
         }
7805 7805
 
7806
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7807
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7806
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7807
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7808 7808
         $result = Database::query($sql);
7809 7809
         $arrLP = array();
7810 7810
 
@@ -7831,10 +7831,10 @@  discard block
 block discarded – undo
7831 7831
         unset ($this->arrMenu);
7832 7832
 
7833 7833
         if ($action == 'add')
7834
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7835
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7834
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7835
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7836 7836
         else
7837
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7837
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7838 7838
 
7839 7839
         $legend .= '</legend>';
7840 7840
 
@@ -7845,16 +7845,16 @@  discard block
 block discarded – undo
7845 7845
 
7846 7846
         if ($action != 'move') {
7847 7847
             $return .= '<tr>';
7848
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7849
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7848
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7849
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7850 7850
             $return .= '</tr>';
7851 7851
         }
7852 7852
 
7853 7853
         $return .= '<tr>';
7854
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7854
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7855 7855
         $return .= '<td class="input">';
7856 7856
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7857
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7857
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7858 7858
         $arrHide = array(
7859 7859
             $id
7860 7860
         );
@@ -7864,13 +7864,13 @@  discard block
 block discarded – undo
7864 7864
         for ($i = 0; $i < count($arrLP); $i++) {
7865 7865
             if ($action != 'add') {
7866 7866
                 if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
7867
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7867
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7868 7868
                 } else {
7869 7869
                     $arrHide[] = $arrLP[$i]['id'];
7870 7870
                 }
7871 7871
             } else {
7872 7872
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7873
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7873
+                    $return .= '<option '.(($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7874 7874
             }
7875 7875
         }
7876 7876
 
@@ -7882,11 +7882,11 @@  discard block
 block discarded – undo
7882 7882
         $return .= '</td>';
7883 7883
         $return .= '</tr>';
7884 7884
         $return .= '<tr>';
7885
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7885
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7886 7886
         $return .= '<td class="input">';
7887 7887
 
7888 7888
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7889
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7889
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7890 7890
         for ($i = 0; $i < count($arrLP); $i++) {
7891 7891
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7892 7892
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7896,7 +7896,7 @@  discard block
 block discarded – undo
7896 7896
                 else
7897 7897
                     $selected = '';
7898 7898
 
7899
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7899
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7900 7900
             }
7901 7901
         }
7902 7902
         $return .= '</select>';
@@ -7905,8 +7905,8 @@  discard block
 block discarded – undo
7905 7905
 
7906 7906
         if ($action != 'move') {
7907 7907
             $return .= '<tr>';
7908
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7909
-            $return .= '<td class="input"><input' . (is_numeric($extra_info) ? ' disabled="disabled"' : '') . ' id="idURL" name="url" style="width:99%;" type="text" value="' . $item_url . '" class="learnpath_item_form" /></td>';
7908
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7909
+            $return .= '<td class="input"><input'.(is_numeric($extra_info) ? ' disabled="disabled"' : '').' id="idURL" name="url" style="width:99%;" type="text" value="'.$item_url.'" class="learnpath_item_form" /></td>';
7910 7910
             $return .= '</tr>';
7911 7911
             $id_prerequisite = 0;
7912 7912
             if (is_array($arrLP)) {
@@ -7933,25 +7933,25 @@  discard block
 block discarded – undo
7933 7933
 
7934 7934
         $return .= '<tr>';
7935 7935
         if ($action == 'add') {
7936
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7936
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7937 7937
         } else {
7938
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7938
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7939 7939
         }
7940 7940
         $return .= '</tr>';
7941 7941
         $return .= '</table>';
7942 7942
 
7943 7943
         if ($action == 'move') {
7944
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7945
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7944
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7945
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7946 7946
         }
7947 7947
 
7948 7948
         if (is_numeric($extra_info)) {
7949
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7949
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7950 7950
         } elseif (is_array($extra_info)) {
7951
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7951
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7952 7952
         }
7953
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7954
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7953
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7954
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7955 7955
         $return .= '</form>';
7956 7956
         $return .= '</div>';
7957 7957
 
@@ -7977,8 +7977,8 @@  discard block
 block discarded – undo
7977 7977
         } elseif (is_numeric($extra_info)) {
7978 7978
             $extra_info = intval($extra_info);
7979 7979
             $sql = "SELECT title, description
7980
-                    FROM " . $tbl_publication . "
7981
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7980
+                    FROM " . $tbl_publication."
7981
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7982 7982
 
7983 7983
             $result = Database::query($sql);
7984 7984
             $row = Database :: fetch_array($result);
@@ -7994,13 +7994,13 @@  discard block
 block discarded – undo
7994 7994
             $parent = 0;
7995 7995
         }
7996 7996
 
7997
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7998
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7997
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7998
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7999 7999
 
8000 8000
         $result = Database::query($sql);
8001 8001
         $arrLP = array();
8002 8002
         while ($row = Database :: fetch_array($result)) {
8003
-            $arrLP[] = array (
8003
+            $arrLP[] = array(
8004 8004
                 'id' => $row['id'],
8005 8005
                 'item_type' => $row['item_type'],
8006 8006
                 'title' => $row['title'],
@@ -8046,7 +8046,7 @@  discard block
 block discarded – undo
8046 8046
             ]
8047 8047
         );
8048 8048
 
8049
-        $arrHide = array (
8049
+        $arrHide = array(
8050 8050
             $id
8051 8051
         );
8052 8052
 
@@ -8064,7 +8064,7 @@  discard block
 block discarded – undo
8064 8064
                     $parentSelect->addOption(
8065 8065
                         $arrLP[$i]['title'],
8066 8066
                         $arrLP[$i]['id'],
8067
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8067
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8068 8068
                     );
8069 8069
 
8070 8070
                     if ($parent == $arrLP[$i]['id']) {
@@ -8081,7 +8081,7 @@  discard block
 block discarded – undo
8081 8081
                     $parentSelect->addOption(
8082 8082
                         $arrLP[$i]['title'],
8083 8083
                         $arrLP[$i]['id'],
8084
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8084
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8085 8085
                     );
8086 8086
 
8087 8087
                     if ($parent == $arrLP[$i]['id']) {
@@ -8105,7 +8105,7 @@  discard block
 block discarded – undo
8105 8105
         for ($i = 0; $i < count($arrLP); $i++) {
8106 8106
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8107 8107
                 $previousSelect->addOption(
8108
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8108
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8109 8109
                     $arrLP[$i]['id']
8110 8110
                 );
8111 8111
 
@@ -8127,7 +8127,7 @@  discard block
 block discarded – undo
8127 8127
                     }
8128 8128
                 }
8129 8129
             }
8130
-            $arrHide = array ();
8130
+            $arrHide = array();
8131 8131
             for ($i = 0; $i < count($arrLP); $i++) {
8132 8132
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8133 8133
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8219,8 +8219,8 @@  discard block
 block discarded – undo
8219 8219
 
8220 8220
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8221 8221
         $item_id = intval($item_id);
8222
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8223
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8222
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8223
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8224 8224
         $result = Database::query($sql);
8225 8225
         $row = Database::fetch_assoc($result);
8226 8226
 
@@ -8234,16 +8234,16 @@  discard block
 block discarded – undo
8234 8234
             $audio_player .= '<script>
8235 8235
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8236 8236
                                 s1.addParam("allowscriptaccess","always");
8237
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8237
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8238 8238
                                 s1.write("container");
8239 8239
                             </script>';
8240 8240
         }
8241 8241
 
8242
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8242
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8243 8243
 
8244 8244
         $return .= Display::url(
8245 8245
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8246
-            $url.'&action=edit_item&path_item=' . $row['path']
8246
+            $url.'&action=edit_item&path_item='.$row['path']
8247 8247
         );
8248 8248
 
8249 8249
         $return .= Display::url(
@@ -8263,12 +8263,12 @@  discard block
 block discarded – undo
8263 8263
             $url.'&action=delete_item'
8264 8264
         );
8265 8265
 
8266
-        if ($item_type == TOOL_HOTPOTATOES ) {
8266
+        if ($item_type == TOOL_HOTPOTATOES) {
8267 8267
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8268 8268
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8269 8269
         }
8270 8270
 
8271
-        if ($item_type == TOOL_DOCUMENT ) {
8271
+        if ($item_type == TOOL_DOCUMENT) {
8272 8272
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8273 8273
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8274 8274
         }
@@ -8289,13 +8289,13 @@  discard block
 block discarded – undo
8289 8289
     public function get_js_dropdown_array()
8290 8290
     {
8291 8291
         $course_id = api_get_course_int_id();
8292
-        $return = 'var child_name = new Array();' . "\n";
8293
-        $return .= 'var child_value = new Array();' . "\n\n";
8294
-        $return .= 'child_name[0] = new Array();' . "\n";
8295
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8292
+        $return = 'var child_name = new Array();'."\n";
8293
+        $return .= 'var child_value = new Array();'."\n\n";
8294
+        $return .= 'child_name[0] = new Array();'."\n";
8295
+        $return .= 'child_value[0] = new Array();'."\n\n";
8296 8296
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8297
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8298
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8297
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8298
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8299 8299
                     ORDER BY display_order ASC";
8300 8300
         $res_zero = Database::query($sql_zero);
8301 8301
         $i = 0;
@@ -8305,28 +8305,28 @@  discard block
 block discarded – undo
8305 8305
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8306 8306
             }
8307 8307
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8308
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8309
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8308
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8309
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8310 8310
         }
8311 8311
         $return .= "\n";
8312
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8313
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8312
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8313
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8314 8314
         $res = Database::query($sql);
8315 8315
         while ($row = Database :: fetch_array($res)) {
8316
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8316
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8317 8317
                            WHERE
8318 8318
                                 c_id = ".$course_id." AND
8319
-                                parent_item_id = " . $row['id'] . "
8319
+                                parent_item_id = " . $row['id']."
8320 8320
                            ORDER BY display_order ASC";
8321 8321
             $res_parent = Database::query($sql_parent);
8322 8322
             $i = 0;
8323
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8324
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8323
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8324
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8325 8325
 
8326 8326
             while ($row_parent = Database :: fetch_array($res_parent)) {
8327 8327
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8328
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8329
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8328
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8329
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8330 8330
             }
8331 8331
             $return .= "\n";
8332 8332
         }
@@ -8347,8 +8347,8 @@  discard block
 block discarded – undo
8347 8347
         if (is_numeric($item_id)) {
8348 8348
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8349 8349
 
8350
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8351
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8350
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8351
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8352 8352
 
8353 8353
             $res = Database::query($sql);
8354 8354
             $row = Database :: fetch_array($res);
@@ -8407,7 +8407,7 @@  discard block
 block discarded – undo
8407 8407
      */
8408 8408
     public function display_item_small_form($item_type, $title = '', $data = array())
8409 8409
     {
8410
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8410
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8411 8411
         $form = new FormValidator('small_form', 'post', $url);
8412 8412
         $form->addElement('header', $title);
8413 8413
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8433,7 +8433,7 @@  discard block
 block discarded – undo
8433 8433
         $item_id = intval($item_id);
8434 8434
         /* Current prerequisite */
8435 8435
         $sql = "SELECT * FROM $tbl_lp_item
8436
-                WHERE c_id = $course_id AND id = " . $item_id;
8436
+                WHERE c_id = $course_id AND id = ".$item_id;
8437 8437
         $result = Database::query($sql);
8438 8438
         $row    = Database::fetch_array($result);
8439 8439
         $prerequisiteId = $row['prerequisite'];
@@ -8443,20 +8443,20 @@  discard block
 block discarded – undo
8443 8443
         $return .= '<form method="POST">';
8444 8444
         $return .= '<table class="data_table">';
8445 8445
         $return .= '<tr>';
8446
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8447
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8448
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8446
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8447
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8448
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8449 8449
         $return .= '</tr>';
8450 8450
 
8451 8451
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8452 8452
         $return .= '<tr >';
8453 8453
         $return .= '<td colspan="3" class="radio">';
8454 8454
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8455
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8455
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8456 8456
         $return .= '</tr>';
8457 8457
 
8458 8458
         $sql = "SELECT * FROM $tbl_lp_item
8459
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8459
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8460 8460
         $result = Database::query($sql);
8461 8461
         $arrLP = array();
8462 8462
 
@@ -8499,25 +8499,25 @@  discard block
 block discarded – undo
8499 8499
             }
8500 8500
 
8501 8501
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8502
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8502
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8503 8503
 
8504 8504
             $return .= '<tr>';
8505
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8506
-            $return .= '<label for="id' . $item['id'] . '">';
8507
-            $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . (($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />';
8505
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8506
+            $return .= '<label for="id'.$item['id'].'">';
8507
+            $return .= '<input'.(in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '').(($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" style="margin-left:'.$item['depth'] * 10.'px; margin-right:10px;" type="radio" value="'.$item['id'].'" />';
8508 8508
             $icon_name = str_replace(' ', '', $item['item_type']);
8509 8509
 
8510
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8511
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8510
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8511
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8512 8512
             } else {
8513
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8514
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8513
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8514
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8515 8515
                 } else {
8516 8516
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8517 8517
                 }
8518 8518
             }
8519 8519
 
8520
-            $return .=  $item['title'] . '</label>';
8520
+            $return .= $item['title'].'</label>';
8521 8521
             $return .= '</td>';
8522 8522
 
8523 8523
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8531,19 +8531,19 @@  discard block
 block discarded – undo
8531 8531
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8532 8532
 
8533 8533
                 $return .= '<td class="exercise">';
8534
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8534
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8535 8535
                 $return .= '</td>';
8536 8536
                 $return .= '<td class="exercise">';
8537
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8537
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8538 8538
                 $return .= '</td>';
8539 8539
             }
8540 8540
 
8541 8541
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8542 8542
                 $return .= '<td class="exercise">';
8543
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8543
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8544 8544
                 $return .= '</td>';
8545 8545
                 $return .= '<td class="exercise"">';
8546
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8546
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8547 8547
                 $return .= '</td>';
8548 8548
             }
8549 8549
             $return .= '</tr>';
@@ -8552,7 +8552,7 @@  discard block
 block discarded – undo
8552 8552
         $return .= '</tr>';
8553 8553
         $return .= '</table>';
8554 8554
         $return .= '<div style="padding-top:3px;">';
8555
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8555
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8556 8556
         $return .= '</form>';
8557 8557
 
8558 8558
         return $return;
@@ -8588,7 +8588,7 @@  discard block
 block discarded – undo
8588 8588
                 if ($row['id'] == $lp_id) {
8589 8589
                     continue;
8590 8590
                 }
8591
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8591
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8592 8592
             }
8593 8593
         }
8594 8594
         $return .= '</select>';
@@ -8648,8 +8648,8 @@  discard block
 block discarded – undo
8648 8648
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8649 8649
                      ORDER BY title ASC";
8650 8650
 
8651
-        $sql_hot  = "SELECT * FROM $tbl_doc
8652
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8651
+        $sql_hot = "SELECT * FROM $tbl_doc
8652
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8653 8653
                      ORDER BY id ASC";
8654 8654
 
8655 8655
         $res_quiz = Database::query($sql_quiz);
@@ -8658,8 +8658,8 @@  discard block
 block discarded – undo
8658 8658
         $return = '<ul class="lp_resource">';
8659 8659
         $return .= '<li class="lp_resource_element">';
8660 8660
         $return .= Display::return_icon('new_test_small.gif');
8661
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8662
-            get_lang('NewExercise') . '</a>';
8661
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8662
+            get_lang('NewExercise').'</a>';
8663 8663
         $return .= '</li>';
8664 8664
 
8665 8665
         // Display hotpotatoes
@@ -8671,8 +8671,8 @@  discard block
 block discarded – undo
8671 8671
             $return .= '</a> ';
8672 8672
 
8673 8673
             $return .= Display::return_icon('hotpotatoes_s.png');
8674
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8675
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8674
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8675
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8676 8676
             $return .= '</li>';
8677 8677
         }
8678 8678
 
@@ -8682,7 +8682,7 @@  discard block
 block discarded – undo
8682 8682
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8683 8683
             $return .= '</a> ';
8684 8684
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8685
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8685
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8686 8686
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8687 8687
                 '</a>';
8688 8688
             $return .= '</li>';
@@ -8756,7 +8756,7 @@  discard block
 block discarded – undo
8756 8756
         foreach ($categorizedLinks as $categoryId => $links) {
8757 8757
             $linkNodes = null;
8758 8758
             foreach ($links as $key => $title) {
8759
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8759
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8760 8760
                     $linkNodes .=
8761 8761
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8762 8762
                         <a class="moved" href="#">'.
@@ -8794,7 +8794,7 @@  discard block
 block discarded – undo
8794 8794
         $return = '<div class="lp_resource" >';
8795 8795
         $return .= '<div class="lp_resource_element">';
8796 8796
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8797
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8797
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8798 8798
         $return .= '</div>';
8799 8799
         $return .= '</div>';
8800 8800
         return $return;
@@ -8817,7 +8817,7 @@  discard block
 block discarded – undo
8817 8817
         $return .= Display::return_icon('forum_new_small.gif');
8818 8818
         $return .= Display::url(
8819 8819
             get_lang('CreateANewForum'),
8820
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8820
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8821 8821
                 'action' => 'add',
8822 8822
                 'content' => 'forum',
8823 8823
                 'lp_id' => $this->lp_id
@@ -8845,15 +8845,15 @@  discard block
 block discarded – undo
8845 8845
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8846 8846
                 $return .= ' </a>';
8847 8847
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8848
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8849
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8848
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8849
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8850 8850
                             </a>
8851
-                            <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' .
8852
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8851
+                            <a href="' . api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_FORUM.'&forum_id='.$forum['forum_id'].'&lp_id='.$this->lp_id.'" style="vertical-align:middle">'.
8852
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8853 8853
 
8854 8854
                 $return .= '</li>';
8855 8855
 
8856
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8856
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8857 8857
                 $a_threads = get_threads($forum['forum_id']);
8858 8858
                 if (is_array($a_threads)) {
8859 8859
                     foreach ($a_threads as $thread) {
@@ -8862,8 +8862,8 @@  discard block
 block discarded – undo
8862 8862
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8863 8863
                         $return .= ' </a>';
8864 8864
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8865
-                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' .
8866
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8865
+                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
8866
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8867 8867
                         $return .= '</li>';
8868 8868
                     }
8869 8869
                 }
@@ -8934,7 +8934,7 @@  discard block
 block discarded – undo
8934 8934
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8935 8935
             // Remove the possible . at the end of the path.
8936 8936
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8937
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8937
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8938 8938
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8939 8939
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8940 8940
         }
@@ -9002,7 +9002,7 @@  discard block
 block discarded – undo
9002 9002
                 if ($item->type == 'sco') {
9003 9003
                     $inc_docs = $item->get_resources_from_source(
9004 9004
                         null,
9005
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9005
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9006 9006
                     );
9007 9007
                 } else {
9008 9008
                     $inc_docs = $item->get_resources_from_source();
@@ -9218,7 +9218,7 @@  discard block
 block discarded – undo
9218 9218
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9219 9219
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9220 9220
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9221
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9221
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9222 9222
                                         $my_dep->setAttribute('xml:base', '');
9223 9223
                                     }
9224 9224
                                 }
@@ -9349,7 +9349,7 @@  discard block
 block discarded – undo
9349 9349
                         //$my_item->appendChild($my_max_score);
9350 9350
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9351 9351
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9352
-                        $my_prereqs->setAttribute('type','aicc_script');
9352
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9353 9353
                         $my_item->appendChild($my_prereqs);
9354 9354
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9355 9355
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9402,7 +9402,7 @@  discard block
 block discarded – undo
9402 9402
                         $my_resource->appendChild($my_file);
9403 9403
 
9404 9404
                         // Get included docs.
9405
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9405
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9406 9406
                         // Dependency to other files - not yet supported.
9407 9407
                         $i = 1;
9408 9408
                         foreach ($inc_docs as $doc_info) {
@@ -9463,7 +9463,7 @@  discard block
 block discarded – undo
9463 9463
                                         $my_dep_file->setAttribute('href', $file_path);
9464 9464
                                         $my_dep->setAttribute('xml:base', '');
9465 9465
 
9466
-                                        if (strstr($file_path,$main_path) !== false) {
9466
+                                        if (strstr($file_path, $main_path) !== false) {
9467 9467
                                             // The calculated real path is really inside the chamilo root path.
9468 9468
                                             // Reduce file path to what's under the DocumentRoot.
9469 9469
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9481,7 +9481,7 @@  discard block
 block discarded – undo
9481 9481
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9482 9482
                                             $file_path = str_replace('//', '/', $file_path);
9483 9483
                                             if (file_exists($file_path)) {
9484
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9484
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9485 9485
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9486 9486
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9487 9487
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9710,7 +9710,7 @@  discard block
 block discarded – undo
9710 9710
             if (strpos($extra_file, '.') === 0)
9711 9711
                 continue;
9712 9712
             else {
9713
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9713
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9714 9714
                 $this->create_path($dest_file);
9715 9715
                 copy($main_code_path.$extra_file, $dest_file);
9716 9716
             }
@@ -9763,7 +9763,7 @@  discard block
 block discarded – undo
9763 9763
                             }
9764 9764
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9765 9765
                             if (file_exists($file_path)) {
9766
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9766
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9767 9767
                             }
9768 9768
                             break;
9769 9769
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9803,12 +9803,12 @@  discard block
 block discarded – undo
9803 9803
 
9804 9804
         foreach ($path_bits as $bit) {
9805 9805
             if (!empty ($bit)) {
9806
-                $new_path = $path_built . $bit;
9806
+                $new_path = $path_built.$bit;
9807 9807
                 if (is_dir($new_path)) {
9808
-                    $path_built = $new_path . '/';
9808
+                    $path_built = $new_path.'/';
9809 9809
                 } else {
9810 9810
                     mkdir($new_path, api_get_permissions_for_new_directories());
9811
-                    $path_built = $new_path . '/';
9811
+                    $path_built = $new_path.'/';
9812 9812
                 }
9813 9813
             }
9814 9814
         }
@@ -9852,9 +9852,9 @@  discard block
 block discarded – undo
9852 9852
 
9853 9853
         if ($upload_ok) {
9854 9854
             if ($has_attachment) {
9855
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9855
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9856 9856
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9857
-                $updir = $sys_course_path . $courseDir;
9857
+                $updir = $sys_course_path.$courseDir;
9858 9858
                 // Try to add an extension to the file if it hasn't one.
9859 9859
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9860 9860
 
@@ -9909,7 +9909,7 @@  discard block
 block discarded – undo
9909 9909
             //Setting my lp_id to autolaunch = 1
9910 9910
             $attributes['autolaunch'] = 1;
9911 9911
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9912
-            Database::update($lp_table, $attributes, $where );
9912
+            Database::update($lp_table, $attributes, $where);
9913 9913
         }
9914 9914
     }
9915 9915
 
@@ -9928,13 +9928,13 @@  discard block
 block discarded – undo
9928 9928
 
9929 9929
         // Get the max order of the items
9930 9930
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9931
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9931
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9932 9932
         $rs_max_order = Database::query($sql_max_order);
9933 9933
         $row_max_order = Database::fetch_object($rs_max_order);
9934 9934
         $max_order = $row_max_order->display_order;
9935 9935
         // Get the previous item ID
9936 9936
         $sql = "SELECT id as previous FROM $table_lp_item
9937
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9937
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9938 9938
         $rs_max = Database::query($sql);
9939 9939
         $row_max = Database::fetch_object($rs_max);
9940 9940
 
@@ -9990,9 +9990,9 @@  discard block
 block discarded – undo
9990 9990
         $documents_total_space = DocumentManager::documents_total_space();
9991 9991
         $course_max_space = DocumentManager::get_course_quota();
9992 9992
         $total_size = filesize($s) + $documents_total_space;
9993
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9993
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9994 9994
             return true;
9995
-        } else{
9995
+        } else {
9996 9996
             return false;
9997 9997
         }
9998 9998
     }
@@ -10332,7 +10332,7 @@  discard block
 block discarded – undo
10332 10332
         if ($this->debug > 0) {
10333 10333
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10334 10334
         }
10335
-        $this->subscribeUsers = intval($value);;
10335
+        $this->subscribeUsers = intval($value); ;
10336 10336
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10337 10337
         $lp_id = $this->get_id();
10338 10338
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10678,7 +10678,7 @@  discard block
 block discarded – undo
10678 10678
      */
10679 10679
     public function createForum($forumCategoryId)
10680 10680
     {
10681
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10681
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10682 10682
 
10683 10683
         $forumId = store_forum(
10684 10684
             [
Please login to merge, or discard this patch.