Test Setup Failed
Push — master ( 4b65d4...a1d720 )
by Angel Fernando Quiroz
129:03 queued 65:02
created
main/newscorm/lp_move_item.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
         $('#previous').selectpicker('refresh');
46 46
     }
47 47
 " .
48
-"\n" .
49
-'$().ready(function() {'."\n" .
50
-  'if ($(\'#previous\')) {'."\n" .
48
+"\n".
49
+'$().ready(function() {'."\n".
50
+  'if ($(\'#previous\')) {'."\n".
51 51
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
52
-      'load_cbo($(\'#idParent\').val());'."\n" .
53
-  '}}'."\n" .
54
-'});</script>'."\n" ;
52
+      'load_cbo($(\'#idParent\').val());'."\n".
53
+  '}}'."\n".
54
+'});</script>'."\n";
55 55
 
56 56
 /* Constants and variables */
57 57
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 /* SHOWING THE ADMIN TOOLS */
86 86
 
87 87
 if (api_is_in_gradebook()) {
88
-    $interbreadcrumb[]= array(
88
+    $interbreadcrumb[] = array(
89 89
         'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(),
90 90
         'name' => get_lang('ToolGradebook')
91 91
     );
Please login to merge, or discard this patch.
main/newscorm/lp_add_item.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 $htmlHeadXtra[] = '<script>'.
26 26
 
27
-$learnPath->get_js_dropdown_array() .
27
+$learnPath->get_js_dropdown_array().
28 28
 "
29 29
     function load_cbo(id) {
30 30
         if (!id) {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 $isStudentView  = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null;
76 76
 $learnpath_id   = isset($_REQUEST['lp_id']) ? intval($_REQUEST['lp_id']) : null;
77
-$submit			= isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
77
+$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
78 78
 
79 79
 $type = isset($_GET['type']) ? $_GET['type'] : null;
80 80
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 /* SHOWING THE ADMIN TOOLS */
88 88
 
89 89
 if (api_is_in_gradebook()) {
90
-    $interbreadcrumb[]= array(
90
+    $interbreadcrumb[] = array(
91 91
         'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(),
92 92
         'name' => get_lang('ToolGradebook')
93 93
     );
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 
105 105
 switch ($type) {
106 106
     case 'chapter':
107
-        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
108
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewChapter'));
107
+        $interbreadcrumb[] = array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
108
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewChapter'));
109 109
         break;
110 110
     case 'document':
111
-        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
111
+        $interbreadcrumb[] = array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
112 112
         break;
113 113
     default:
114
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));
114
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep'));
115 115
         break;
116 116
 }
117 117
 
118
-if ($action == 'add_item' && $type == 'document' ) {
119
-    $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated'));
118
+if ($action == 'add_item' && $type == 'document') {
119
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated'));
120 120
 }
121 121
 
122 122
 // Theme calls.
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 2 patches
Spacing   +618 added lines, -618 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;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $res = Database::query($sql);
245 245
 
246 246
         if ($this->debug > 2) {
247
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
247
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
248 248
             error_log('-- Start while--', 0);
249 249
         }
250 250
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                         $this->refs_list[$oItem->ref] = $my_item_id;
265 265
                         if ($this->debug > 2) {
266 266
                             error_log(
267
-                                'New LP - learnpath::__construct() - ' .
268
-                                'aicc object with id ' . $my_item_id .
267
+                                'New LP - learnpath::__construct() - '.
268
+                                'aicc object with id '.$my_item_id.
269 269
                                 ' set in items[]', 0);
270 270
                         }
271 271
                     }
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 
283 283
                         $this->refs_list[$oItem->ref] = $my_item_id;
284 284
                         if ($this->debug > 2) {
285
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
285
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
286 286
                         }
287 287
                     }
288 288
                     break;
289 289
                 case 1:
290 290
                 default:
291 291
                     if ($this->debug > 2) {
292
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
292
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
293 293
                     }
294 294
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
295 295
 
296 296
                     if ($this->debug > 2) {
297
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
297
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
298 298
                     }
299 299
                     if (is_object($oItem)) {
300 300
                         $my_item_id = $oItem->get_id();
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
                         $this->refs_list[$my_item_id] = $my_item_id;
306 306
                         if ($this->debug > 2) {
307 307
                             error_log(
308
-                                'New LP - learnpath::__construct() ' . __LINE__ .
309
-                                ' - object with id ' . $my_item_id . ' set in items[]',
308
+                                'New LP - learnpath::__construct() '.__LINE__.
309
+                                ' - object with id '.$my_item_id.' set in items[]',
310 310
                                 0);
311 311
                         }
312 312
                     }
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
325 325
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
326 326
                     $this->items[$row['id']]->current_start_time = 0;
327
-                    $this->items[$row['id']]->current_stop_time	= 0;
327
+                    $this->items[$row['id']]->current_stop_time = 0;
328 328
                 }
329 329
             }
330 330
         }
331 331
 
332 332
         if ($this->debug > 2) {
333
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
333
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
334 334
         }
335 335
 
336 336
         if (!empty($lp_item_id_list)) {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         // TODO: Define the current item better.
423 423
         $this->first();
424 424
         if ($this->debug > 2) {
425
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
425
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
426 426
         }
427 427
         return true;
428 428
     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     ) {
497 497
         $course_id = $this->course_info['real_id'];
498 498
         if ($this->debug > 0) {
499
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
499
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
500 500
         }
501 501
         if (empty($course_id)) {
502 502
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 FROM $tbl_lp_item
517 517
                 WHERE
518 518
                     c_id = $course_id AND
519
-                    lp_id = " . $this->get_id() . " AND
519
+                    lp_id = ".$this->get_id()." AND
520 520
                     parent_item_id = " . $parent;
521 521
 
522 522
         $res_count = Database::query($sql);
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
         if ($num > 0) {
527 527
             if ($previous == 0) {
528 528
                 $sql = "SELECT id, next_item_id, display_order
529
-                        FROM " . $tbl_lp_item . "
529
+                        FROM " . $tbl_lp_item."
530 530
                         WHERE
531 531
                             c_id = $course_id AND
532
-                            lp_id = " . $this->get_id() . " AND
533
-                            parent_item_id = " . $parent . " AND
532
+                            lp_id = ".$this->get_id()." AND
533
+                            parent_item_id = " . $parent." AND
534 534
                             previous_item_id = 0 OR
535 535
                             previous_item_id=" . $parent;
536 536
                 $result = Database::query($sql);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 						FROM $tbl_lp_item
546 546
                         WHERE
547 547
                             c_id = $course_id AND
548
-                            lp_id = " . $this->get_id() . " AND
548
+                            lp_id = ".$this->get_id()." AND
549 549
                             id = " . $previous;
550 550
 
551 551
                 $result = Database::query($sql);
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
         $typeCleaned = Database::escape_string($type);
566 566
         if ($type == 'quiz') {
567 567
             $sql = 'SELECT SUM(ponderation)
568
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
569
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
568
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
569
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
570 570
                     ON
571 571
                         quiz_question.id = quiz_rel_question.question_id AND
572 572
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
         $params = array(
590 590
             "c_id" => $course_id,
591 591
             "lp_id" => $this->get_id(),
592
-            "item_type" =>$typeCleaned ,
592
+            "item_type" =>$typeCleaned,
593 593
             "ref" => '',
594
-            "title" =>$title ,
594
+            "title" =>$title,
595 595
             "description" => $description,
596 596
             "path" => $id,
597 597
             "max_score" => $max_score,
598 598
             "parent_item_id" => $parent,
599 599
             "previous_item_id" => $previous,
600 600
             "next_item_id" => intval($next),
601
-            "display_order" => $display_order +1,
601
+            "display_order" => $display_order + 1,
602 602
             "prerequisite" => $prerequisites,
603 603
             "max_time_allowed" => $max_time_allowed,
604 604
             'min_score' => 0,
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         $new_item_id = Database::insert($tbl_lp_item, $params);
613 613
 
614 614
         if ($this->debug > 2) {
615
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
615
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
616 616
         }
617 617
 
618 618
         if ($new_item_id) {
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
             Database::query($sql);
630 630
 
631 631
             // Update all the items after the new item.
632
-            $sql = "UPDATE " . $tbl_lp_item . "
632
+            $sql = "UPDATE ".$tbl_lp_item."
633 633
                         SET display_order = display_order + 1
634 634
                     WHERE
635 635
                         c_id = $course_id AND
636
-                        lp_id = " . $this->get_id() . " AND
637
-                        id <> " . $new_item_id . " AND
638
-                        parent_item_id = " . $parent . " AND
636
+                        lp_id = ".$this->get_id()." AND
637
+                        id <> " . $new_item_id." AND
638
+                        parent_item_id = " . $parent." AND
639 639
                         display_order > " . $display_order;
640 640
             Database::query($sql);
641 641
 
642 642
             // Update the item that should come after the new item.
643
-            $sql = "UPDATE " . $tbl_lp_item . "
644
-                    SET ref = " . $new_item_id . "
645
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
643
+            $sql = "UPDATE ".$tbl_lp_item."
644
+                    SET ref = " . $new_item_id."
645
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
646 646
             Database::query($sql);
647 647
 
648 648
             // Upload audio.
649 649
             if (!empty($_FILES['mp3']['name'])) {
650 650
                 // Create the audio folder if it does not exist yet.
651
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
652
-                if (!is_dir($filepath . 'audio')) {
653
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
651
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
652
+                if (!is_dir($filepath.'audio')) {
653
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
654 654
                     $audio_id = add_document(
655 655
                         $_course,
656 656
                         '/audio',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                 $file_path = handle_uploaded_document(
688 688
                     $_course,
689 689
                     $_FILES['mp3'],
690
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
690
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
691 691
                     '/audio',
692 692
                     api_get_user_id(),
693 693
                     '',
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 
704 704
                 // Store the mp3 file in the lp_item table.
705 705
                 $sql = "UPDATE $tbl_lp_item SET
706
-                            audio = '" . Database::escape_string($file) . "'
707
-                        WHERE id = '" . intval($new_item_id) . "'";
706
+                            audio = '".Database::escape_string($file)."'
707
+                        WHERE id = '" . intval($new_item_id)."'";
708 708
                 Database::query($sql);
709 709
             }
710 710
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         while (Database :: num_rows($res_name)) {
781 781
             // There is already one such name, update the current one a bit.
782 782
             $i++;
783
-            $name = $name . ' - ' . $i;
783
+            $name = $name.' - '.$i;
784 784
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
785 785
             $res_name = Database::query($check_name);
786 786
         }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
                 // if $item points to an object and there is a parent.
893 893
                 if ($debug) {
894 894
                     error_log(
895
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
895
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
896 896
                         0
897 897
                     );
898 898
                 }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
                         if ($childItemId != $item) {
921 921
                             if ($debug) {
922 922
                                 error_log(
923
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
923
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
924 924
                                     0
925 925
                                 );
926 926
                             }
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                             } else {
941 941
                                 if ($debug > 2) {
942 942
                                     error_log(
943
-                                        '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,
943
+                                        '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,
944 944
                                         0
945 945
                                     );
946 946
                                 }
@@ -1045,15 +1045,15 @@  discard block
 block discarded – undo
1045 1045
         // Delete lp item id.
1046 1046
         foreach ($this->items as $id => $dummy) {
1047 1047
             $sql = "DELETE FROM $lp_item_view
1048
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1048
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1049 1049
             Database::query($sql);
1050 1050
         }
1051 1051
 
1052 1052
         // Proposed by Christophe (nickname: clefevre)
1053
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1053
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1054 1054
         Database::query($sql);
1055 1055
 
1056
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1056
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1057 1057
         Database::query($sql);
1058 1058
 
1059 1059
         self::toggle_publish($this->lp_id, 'i');
@@ -1061,32 +1061,32 @@  discard block
 block discarded – undo
1061 1061
         if ($this->type == 2 || $this->type == 3) {
1062 1062
             // This is a scorm learning path, delete the files as well.
1063 1063
             $sql = "SELECT path FROM $lp
1064
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1064
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1065 1065
             $res = Database::query($sql);
1066 1066
             if (Database :: num_rows($res) > 0) {
1067 1067
                 $row = Database :: fetch_array($res);
1068 1068
                 $path = $row['path'];
1069 1069
                 $sql = "SELECT id FROM $lp
1070
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1070
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1071 1071
                 $res = Database::query($sql);
1072 1072
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1073 1073
                     if ($this->debug > 2) {
1074
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1074
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1075 1075
                     }
1076 1076
                 } else {
1077 1077
                     // No other LP uses that directory, delete it.
1078
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1079
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1080
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1078
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1079
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1080
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1081 1081
                         if ($this->debug > 2) {
1082
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1082
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1083 1083
                         }
1084 1084
                         // Proposed by Christophe (clefevre).
1085 1085
                         if (strcmp(substr($path, -2), "/.") == 0) {
1086 1086
                             $path = substr($path, 0, -1); // Remove "." at the end.
1087 1087
                         }
1088 1088
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1089
-                        rmdirr($course_scorm_dir . $path);
1089
+                        rmdirr($course_scorm_dir.$path);
1090 1090
                     }
1091 1091
                 }
1092 1092
             }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1100 1100
         Database::query($sql);
1101 1101
 
1102
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1102
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1103 1103
         Database::query($sql);
1104 1104
         // Updates the display order of all lps.
1105 1105
         $this->update_display_order();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
             api_get_user_id()
1113 1113
         );
1114 1114
 
1115
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1115
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1116 1116
         if ($link_info) {
1117 1117
             GradebookUtils::remove_resource_from_course_gradebook($link_info->getId());
1118 1118
         }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
     {
1133 1133
         $course_id = $this->course_info['real_id'];
1134 1134
         if ($this->debug > 0) {
1135
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1135
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1136 1136
         }
1137 1137
         $num = 0;
1138 1138
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
         $res = Database::query($sql);
1144 1144
         while ($row = Database :: fetch_array($res)) {
1145 1145
             $num += $this->delete_children_items($row['id']);
1146
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1146
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1147 1147
             Database::query($sql_del);
1148 1148
             $num++;
1149 1149
         }
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
         }
1174 1174
         // First select item to get previous, next, and display order.
1175 1175
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1176
-        $sql_sel = "SELECT * FROM $lp_item WHERE c_id = " . $course->getId() . " AND id = $id";
1176
+        $sql_sel = "SELECT * FROM $lp_item WHERE c_id = ".$course->getId()." AND id = $id";
1177 1177
         $res_sel = Database::query($sql_sel);
1178 1178
         if (Database :: num_rows($res_sel) < 1) {
1179 1179
             return false;
@@ -1187,28 +1187,28 @@  discard block
 block discarded – undo
1187 1187
         // Delete children items.
1188 1188
         $num = $this->delete_children_items($id);
1189 1189
         if ($this->debug > 2) {
1190
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1190
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1191 1191
         }
1192 1192
         // Now delete the item.
1193 1193
         $sql_del = "DELETE FROM $lp_item WHERE c_id = {$course->getId()} AND id = $id";
1194 1194
         if ($this->debug > 2) {
1195
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1195
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1196 1196
         }
1197 1197
         Database::query($sql_del);
1198 1198
         // Now update surrounding items.
1199 1199
         $sql_upd = "UPDATE $lp_item SET next_item_id = $next
1200
-                    WHERE c_id = " . $course->getId() . " AND id = $previous";
1200
+                    WHERE c_id = ".$course->getId()." AND id = $previous";
1201 1201
         Database::query($sql_upd);
1202 1202
         $sql_upd = "UPDATE $lp_item SET previous_item_id = $previous
1203
-                    WHERE c_id = " . $course->getId() . " AND id = $next";
1203
+                    WHERE c_id = ".$course->getId()." AND id = $next";
1204 1204
         Database::query($sql_upd);
1205 1205
         // Now update all following items with new display order.
1206 1206
         $sql_all = "UPDATE $lp_item SET display_order = display_order-1
1207
-                    WHERE c_id = " . $course->getId() . " AND lp_id = $lp AND parent_item_id = $parent AND display_order > $display";
1207
+                    WHERE c_id = ".$course->getId()." AND lp_id = $lp AND parent_item_id = $parent AND display_order > $display";
1208 1208
         Database::query($sql_all);
1209 1209
 
1210 1210
         //Removing prerequisites since the item will not longer exist
1211
-        $sql_all = "UPDATE $lp_item SET prerequisite = '' WHERE c_id = " . $course->getId() . " AND prerequisite = $id";
1211
+        $sql_all = "UPDATE $lp_item SET prerequisite = '' WHERE c_id = ".$course->getId()." AND prerequisite = $id";
1212 1212
         Database::query($sql_all);
1213 1213
 
1214 1214
         // Remove from search engine if enabled.
@@ -1276,15 +1276,15 @@  discard block
 block discarded – undo
1276 1276
         }
1277 1277
 
1278 1278
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1279
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1279
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1280 1280
         $res_select = Database::query($sql_select);
1281 1281
         $row_select = Database :: fetch_array($res_select);
1282 1282
         $audio_update_sql = '';
1283 1283
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1284 1284
             // Create the audio folder if it does not exist yet.
1285
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1286
-            if (!is_dir($filepath . 'audio')) {
1287
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1285
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1286
+            if (!is_dir($filepath.'audio')) {
1287
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1288 1288
                 $audio_id = add_document(
1289 1289
                     $_course,
1290 1290
                     '/audio',
@@ -1322,11 +1322,11 @@  discard block
 block discarded – undo
1322 1322
             $pi = pathinfo($audio['name']);
1323 1323
             if ($pi['extension'] == 'mp3') {
1324 1324
                 $c_det = api_get_course_info($this->cc);
1325
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1325
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1326 1326
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1327 1327
                 $path = substr($path, 7);
1328 1328
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1329
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1329
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1330 1330
             }
1331 1331
         }
1332 1332
 
@@ -1336,13 +1336,13 @@  discard block
 block discarded – undo
1336 1336
         // TODO: htmlspecialchars to be checked for encoding related problems.
1337 1337
         if ($same_parent && $same_previous) {
1338 1338
             // Only update title and description.
1339
-            $sql = "UPDATE " . $tbl_lp_item . "
1340
-                    SET title = '" . Database::escape_string($title) . "',
1341
-                        prerequisite = '" . $prerequisites . "',
1342
-                        description = '" . Database::escape_string($description) . "'
1343
-                        " . $audio_update_sql . ",
1344
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1345
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1339
+            $sql = "UPDATE ".$tbl_lp_item."
1340
+                    SET title = '" . Database::escape_string($title)."',
1341
+                        prerequisite = '" . $prerequisites."',
1342
+                        description = '" . Database::escape_string($description)."'
1343
+                        " . $audio_update_sql.",
1344
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1345
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1346 1346
             Database::query($sql);
1347 1347
         } else {
1348 1348
             $old_parent = $row_select['parent_item_id'];
@@ -1357,27 +1357,27 @@  discard block
 block discarded – undo
1357 1357
 
1358 1358
             if ($old_previous != 0) {
1359 1359
                 // Next
1360
-                $sql = "UPDATE " . $tbl_lp_item . "
1361
-                        SET next_item_id = " . $old_next . "
1362
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1360
+                $sql = "UPDATE ".$tbl_lp_item."
1361
+                        SET next_item_id = " . $old_next."
1362
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1363 1363
                 Database::query($sql);
1364 1364
             }
1365 1365
 
1366 1366
             if ($old_next != 0) {
1367 1367
                 // Previous
1368
-                $sql = "UPDATE " . $tbl_lp_item . "
1369
-                        SET previous_item_id = " . $old_previous . "
1370
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1368
+                $sql = "UPDATE ".$tbl_lp_item."
1369
+                        SET previous_item_id = " . $old_previous."
1370
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1371 1371
                 Database::query($sql);
1372 1372
             }
1373 1373
 
1374 1374
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1375
-            $sql = "UPDATE " . $tbl_lp_item . "
1375
+            $sql = "UPDATE ".$tbl_lp_item."
1376 1376
                     SET display_order = display_order - 1
1377 1377
                     WHERE
1378 1378
                         c_id = ".$course_id." AND
1379
-                        display_order > " . $old_order . " AND
1380
-                        lp_id = " . $this->lp_id . " AND
1379
+                        display_order > " . $old_order." AND
1380
+                        lp_id = " . $this->lp_id." AND
1381 1381
                         parent_item_id = " . $old_parent;
1382 1382
             Database::query($sql);
1383 1383
             /* END -- virtually remove the current item id */
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
             if ($previous == 0) {
1388 1388
                 // Select the data of the item that should come after the current item.
1389 1389
                 $sql = "SELECT id, display_order
1390
-                        FROM " . $tbl_lp_item . "
1390
+                        FROM " . $tbl_lp_item."
1391 1391
                         WHERE
1392 1392
                             c_id = ".$course_id." AND
1393
-                            lp_id = " . $this->lp_id . " AND
1394
-                            parent_item_id = " . $parent . " AND
1393
+                            lp_id = " . $this->lp_id." AND
1394
+                            parent_item_id = " . $parent." AND
1395 1395
                             previous_item_id = " . $previous;
1396 1396
                 $res_select_old = Database::query($sql);
1397 1397
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1407,8 +1407,8 @@  discard block
 block discarded – undo
1407 1407
             } else {
1408 1408
                 // Select the data of the item that should come before the current item.
1409 1409
                 $sql = "SELECT next_item_id, display_order
1410
-                        FROM " . $tbl_lp_item . "
1411
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1410
+                        FROM " . $tbl_lp_item."
1411
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1412 1412
                 $res_select_old = Database::query($sql);
1413 1413
                 $row_select_old = Database :: fetch_array($res_select_old);
1414 1414
                 $new_next = $row_select_old['next_item_id'];
@@ -1417,57 +1417,57 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
             // TODO: htmlspecialchars to be checked for encoding related problems.
1419 1419
             // Update the current item with the new data.
1420
-            $sql = "UPDATE " . $tbl_lp_item . "
1420
+            $sql = "UPDATE ".$tbl_lp_item."
1421 1421
                     SET
1422
-                        title = '" . Database::escape_string($title) . "',
1423
-                        description = '" . Database::escape_string($description) . "',
1424
-                        parent_item_id = " . $parent . ",
1425
-                        previous_item_id = " . $previous . ",
1426
-                        next_item_id = " . $new_next . ",
1427
-                        display_order = " . $new_order . "
1428
-                        " . $audio_update_sql . "
1429
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1422
+                        title = '" . Database::escape_string($title)."',
1423
+                        description = '" . Database::escape_string($description)."',
1424
+                        parent_item_id = " . $parent.",
1425
+                        previous_item_id = " . $previous.",
1426
+                        next_item_id = " . $new_next.",
1427
+                        display_order = " . $new_order."
1428
+                        " . $audio_update_sql."
1429
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1430 1430
             Database::query($sql);
1431 1431
 
1432 1432
             if ($previous != 0) {
1433 1433
                 // Update the previous item's next_item_id.
1434
-                $sql = "UPDATE " . $tbl_lp_item . "
1435
-                        SET next_item_id = " . $id . "
1436
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1434
+                $sql = "UPDATE ".$tbl_lp_item."
1435
+                        SET next_item_id = " . $id."
1436
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1437 1437
                 Database::query($sql);
1438 1438
             }
1439 1439
 
1440 1440
             if ($new_next != 0) {
1441 1441
                 // Update the next item's previous_item_id.
1442
-                $sql = "UPDATE " . $tbl_lp_item . "
1443
-                        SET previous_item_id = " . $id . "
1444
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1442
+                $sql = "UPDATE ".$tbl_lp_item."
1443
+                        SET previous_item_id = " . $id."
1444
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1445 1445
                 Database::query($sql);
1446 1446
             }
1447 1447
 
1448 1448
             if ($old_prerequisite != $prerequisites) {
1449
-                $sql = "UPDATE " . $tbl_lp_item . "
1450
-                        SET prerequisite = '" . $prerequisites . "'
1451
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1449
+                $sql = "UPDATE ".$tbl_lp_item."
1450
+                        SET prerequisite = '" . $prerequisites."'
1451
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1452 1452
                 Database::query($sql);
1453 1453
             }
1454 1454
 
1455 1455
             if ($old_max_time_allowed != $max_time_allowed) {
1456 1456
                 // update max time allowed
1457
-                $sql = "UPDATE " . $tbl_lp_item . "
1458
-                        SET max_time_allowed = " . $max_time_allowed . "
1459
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1457
+                $sql = "UPDATE ".$tbl_lp_item."
1458
+                        SET max_time_allowed = " . $max_time_allowed."
1459
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1460 1460
                 Database::query($sql);
1461 1461
             }
1462 1462
 
1463 1463
             // Update all the items with the same or a bigger display_order than the current item.
1464
-            $sql = "UPDATE " . $tbl_lp_item . "
1464
+            $sql = "UPDATE ".$tbl_lp_item."
1465 1465
                     SET display_order = display_order + 1
1466 1466
                     WHERE
1467 1467
                        c_id = ".$course_id." AND
1468
-                       lp_id = " . $this->get_id() . " AND
1469
-                       id <> " . $id . " AND
1470
-                       parent_item_id = " . $parent . " AND
1468
+                       lp_id = " . $this->get_id()." AND
1469
+                       id <> " . $id." AND
1470
+                       parent_item_id = " . $parent." AND
1471 1471
                        display_order >= " . $new_order;
1472 1472
 
1473 1473
             Database::query($sql);
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
     {
1494 1494
         $course_id = api_get_course_int_id();
1495 1495
         if ($this->debug > 0) {
1496
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1496
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1497 1497
         }
1498 1498
 
1499 1499
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1591,8 +1591,8 @@  discard block
 block discarded – undo
1591 1591
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1592 1592
         }
1593 1593
 
1594
-        if (empty($id)|| $id != strval(intval($id))) {
1595
-            return array ();
1594
+        if (empty($id) || $id != strval(intval($id))) {
1595
+            return array();
1596 1596
         }
1597 1597
 
1598 1598
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1610,13 +1610,13 @@  discard block
 block discarded – undo
1610 1610
                             item_type='dokeos_chapter'
1611 1611
                         ORDER BY display_order";
1612 1612
             $res_bros = Database::query($sql_bros);
1613
-            $list = array ();
1613
+            $list = array();
1614 1614
             while ($row_bro = Database :: fetch_array($res_bros)) {
1615 1615
                 $list[] = $row_bro;
1616 1616
             }
1617 1617
             return $list;
1618 1618
         }
1619
-        return array ();
1619
+        return array();
1620 1620
     }
1621 1621
 
1622 1622
     /**
@@ -1629,11 +1629,11 @@  discard block
 block discarded – undo
1629 1629
     {
1630 1630
         $course_id = api_get_course_int_id();
1631 1631
         if ($this->debug > 0) {
1632
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1632
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1633 1633
         }
1634 1634
 
1635 1635
         if (empty ($id) || $id != strval(intval($id))) {
1636
-            return array ();
1636
+            return array();
1637 1637
         }
1638 1638
 
1639 1639
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1645,13 +1645,13 @@  discard block
 block discarded – undo
1645 1645
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1646 1646
                          ORDER BY display_order";
1647 1647
             $res_bros = Database::query($sql_bros);
1648
-            $list = array ();
1648
+            $list = array();
1649 1649
             while ($row_bro = Database :: fetch_array($res_bros)) {
1650 1650
                 $list[] = $row_bro;
1651 1651
             }
1652 1652
             return $list;
1653 1653
         }
1654
-        return array ();
1654
+        return array();
1655 1655
     }
1656 1656
 
1657 1657
     /**
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
             $current = $this->current;
1722 1722
         }
1723 1723
         if ($this->debug > 2) {
1724
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1724
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1725 1725
         }
1726 1726
         return $current;
1727 1727
     }
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
         ) {
1803 1803
 
1804 1804
             if ($this->debug > 2) {
1805
-                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);
1805
+                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);
1806 1806
             }
1807 1807
             $index = -1;
1808 1808
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
             if ($index == -1) {
1815 1815
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1816 1816
                 if ($this->debug > 2) {
1817
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1817
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1818 1818
                 }
1819 1819
                 return false;
1820 1820
             } else {
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
             $index = 0;
1830 1830
             // Loop through all ordered items and stop at the first item that is
1831 1831
             // not a directory *and* that has not been completed yet.
1832
-            while ( !empty($this->ordered_items[$index]) AND
1832
+            while (!empty($this->ordered_items[$index]) AND
1833 1833
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1834 1834
                 (
1835 1835
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1843,14 +1843,14 @@  discard block
 block discarded – undo
1843 1843
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1844 1844
             $this->index    = $index;
1845 1845
             if ($this->debug > 2) {
1846
-                error_log('$index ' . $index);
1846
+                error_log('$index '.$index);
1847 1847
             }
1848 1848
             if ($this->debug > 2) {
1849
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1849
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1850 1850
             }
1851 1851
         }
1852 1852
         if ($this->debug > 2) {
1853
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1853
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1854 1854
         }
1855 1855
     }
1856 1856
 
@@ -1863,7 +1863,7 @@  discard block
 block discarded – undo
1863 1863
     public function get_js_info($item_id = '')
1864 1864
     {
1865 1865
         if ($this->debug > 0) {
1866
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1866
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1867 1867
         }
1868 1868
 
1869 1869
         $info = '';
@@ -1873,17 +1873,17 @@  discard block
 block discarded – undo
1873 1873
             //if item is defined, return values from DB
1874 1874
             $oItem = $this->items[$item_id];
1875 1875
             $info .= '<script language="javascript">';
1876
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1877
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1878
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1879
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1880
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1881
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1882
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1876
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1877
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1878
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1879
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1880
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1881
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1882
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1883 1883
             $info .= "top.set_flag_synchronized();";
1884 1884
             $info .= '</script>';
1885 1885
             if ($this->debug > 2) {
1886
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1886
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1887 1887
             }
1888 1888
             return $info;
1889 1889
 
@@ -1891,17 +1891,17 @@  discard block
 block discarded – undo
1891 1891
 
1892 1892
             // If item_id is empty, just update to default SCORM data.
1893 1893
             $info .= '<script language="javascript">';
1894
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1895
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1896
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1897
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1898
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1899
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1900
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1894
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1895
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1896
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1897
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1898
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1899
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1900
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1901 1901
             $info .= "top.set_flag_synchronized();";
1902 1902
             $info .= '</script>';
1903 1903
             if ($this->debug > 2) {
1904
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1904
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1905 1905
             }
1906 1906
             return $info;
1907 1907
         }
@@ -1960,8 +1960,8 @@  discard block
 block discarded – undo
1960 1960
         if ($this->debug > 0) {
1961 1961
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1962 1962
         }
1963
-        if(empty($idBar)){
1964
-            $idBar='control-top';
1963
+        if (empty($idBar)) {
1964
+            $idBar = 'control-top';
1965 1965
         }
1966 1966
         /* if(empty($display)){
1967 1967
             $display='display:block';
@@ -1974,16 +1974,16 @@  discard block
 block discarded – undo
1974 1974
             $navbar = '
1975 1975
                   <span id="'.$idBar.'" class="buttons">
1976 1976
                     <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">
1977
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1977
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1978 1978
                     </a>
1979
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1980
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1979
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1980
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1981 1981
                     </a>
1982
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1983
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1982
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1983
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1984 1984
                     </a>
1985 1985
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1986
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1986
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1987 1987
                     </a>
1988 1988
                   </span>';
1989 1989
 
@@ -1991,13 +1991,13 @@  discard block
 block discarded – undo
1991 1991
             $navbar = '
1992 1992
                 <span id="'.$idBar.'" class="buttons text-right">
1993 1993
                     <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">
1994
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1994
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1995 1995
                     </a>
1996
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1997
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1996
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1997
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1998 1998
                     </a>
1999
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2000
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1999
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2000
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2001 2001
                     </a>
2002 2002
                 </span>';
2003 2003
         }
@@ -2018,11 +2018,11 @@  discard block
 block discarded – undo
2018 2018
         $index = $this->index;
2019 2019
         $index++;
2020 2020
         if ($this->debug > 2) {
2021
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2021
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2022 2022
         }
2023 2023
         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) {
2024 2024
             $index++;
2025
-            if ($index == $this->max_ordered_items){
2025
+            if ($index == $this->max_ordered_items) {
2026 2026
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2027 2027
                     return $this->index;
2028 2028
                 } else {
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
             return $this->index;
2035 2035
         }
2036 2036
         if ($this->debug > 2) {
2037
-            error_log('New LP - index is now ' . $index, 0);
2037
+            error_log('New LP - index is now '.$index, 0);
2038 2038
         }
2039 2039
         return $index;
2040 2040
     }
@@ -2052,7 +2052,7 @@  discard block
 block discarded – undo
2052 2052
         if (!empty ($new_index)) {
2053 2053
             if (isset ($this->ordered_items[$new_index])) {
2054 2054
                 if ($this->debug > 2) {
2055
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2055
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2056 2056
                 }
2057 2057
                 return $this->ordered_items[$new_index];
2058 2058
             }
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
         }
2095 2095
 
2096 2096
         // Filename without its extension.
2097
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2097
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2098 2098
 
2099 2099
         $zipFile = new PclZip($file_path);
2100 2100
         // Check the zip content (real size and file extension).
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
                     break; // Exit the foreach loop.
2119 2119
                 } elseif (
2120 2120
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2121
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2121
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2122 2122
                 ) {
2123 2123
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2124 2124
                     switch ($ext) {
@@ -2160,7 +2160,7 @@  discard block
 block discarded – undo
2160 2160
             error_log('New LP - In learnpath::get_previous_index()', 0);
2161 2161
         }
2162 2162
         $index = $this->index;
2163
-        if (isset ($this->ordered_items[$index -1])) {
2163
+        if (isset ($this->ordered_items[$index - 1])) {
2164 2164
             $index--;
2165 2165
             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')) {
2166 2166
                 $index--;
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
             }
2171 2171
         } else {
2172 2172
             if ($this->debug > 2) {
2173
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2173
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2174 2174
             }
2175 2175
             // There is no previous item.
2176 2176
         }
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
                     lp.c_id = $course_id AND
2244 2244
                     lp_view.c_id = $course_id";
2245 2245
         $result = Database::query($sql);
2246
-        $row 	= Database::fetch_assoc($result);
2246
+        $row = Database::fetch_assoc($result);
2247 2247
         $output = '';
2248 2248
 
2249 2249
         if (!empty ($row['audio'])) {
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
             $list = $learnPath->get_toc();
2252 2252
             $type_quiz = false;
2253 2253
 
2254
-            foreach($list as $toc) {
2254
+            foreach ($list as $toc) {
2255 2255
                 if ($toc['id'] == $learnPath->current && ($toc['type'] == 'quiz')) {
2256 2256
                     $type_quiz = true;
2257 2257
                 }
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
         $courseCode = null,
2317 2317
         $sessionId = null
2318 2318
     ) {
2319
-        $lp_id = (int)$lp_id;
2319
+        $lp_id = (int) $lp_id;
2320 2320
         $courseInfo = api_get_course_info($courseCode);
2321 2321
         $sessionId = intval($sessionId);
2322 2322
 
@@ -2482,10 +2482,10 @@  discard block
 block discarded – undo
2482 2482
      */
2483 2483
     public static function get_progress_bar($percentage = -1, $text_add = '')
2484 2484
     {
2485
-        $text = $percentage . $text_add;
2485
+        $text = $percentage.$text_add;
2486 2486
         $output = '<div class="progress">
2487
-                        <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.';">
2488
-                        '. $text .'
2487
+                        <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.';">
2488
+                        '. $text.'
2489 2489
                         </div>
2490 2490
                     </div>';
2491 2491
 
@@ -2521,16 +2521,16 @@  discard block
 block discarded – undo
2521 2521
         }
2522 2522
         $total_items = $this->get_total_items_count_without_chapters();
2523 2523
         if ($this->debug > 2) {
2524
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2524
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2525 2525
         }
2526 2526
         $completeItems = $this->get_complete_items_count();
2527 2527
         if ($this->debug > 2) {
2528
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2528
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2529 2529
         }
2530 2530
         if ($add != 0) {
2531 2531
             $completeItems += $add;
2532 2532
             if ($this->debug > 2) {
2533
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2533
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2534 2534
             }
2535 2535
         }
2536 2536
         $text = '';
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
             $text = '%';
2549 2549
         } elseif ($mode == 'abs') {
2550 2550
             $percentage = $completeItems;
2551
-            $text = '/' . $total_items;
2551
+            $text = '/'.$total_items;
2552 2552
         }
2553 2553
 
2554 2554
         return array(
@@ -2744,7 +2744,7 @@  discard block
 block discarded – undo
2744 2744
                 // and replace them, one by one, by the internal IDs (chamilo db)
2745 2745
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2746 2746
                 // by a space as well.
2747
-                $find = array (
2747
+                $find = array(
2748 2748
                     '&',
2749 2749
                     '|',
2750 2750
                     '~',
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                     '(',
2757 2757
                     ')'
2758 2758
                 );
2759
-                $replace = array (
2759
+                $replace = array(
2760 2760
                     ' ',
2761 2761
                     ' ',
2762 2762
                     ' ',
@@ -2773,7 +2773,7 @@  discard block
 block discarded – undo
2773 2773
                 foreach ($ids as $id) {
2774 2774
                     $id = trim($id);
2775 2775
                     if (isset ($this->refs_list[$id])) {
2776
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2776
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2777 2777
                     }
2778 2778
                 }
2779 2779
 
@@ -2881,9 +2881,9 @@  discard block
 block discarded – undo
2881 2881
         if ($this->debug > 0) {
2882 2882
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2883 2883
         }
2884
-        $list = array ();
2884
+        $list = array();
2885 2885
         foreach ($this->ordered_items as $item_id) {
2886
-            $list[] = array (
2886
+            $list[] = array(
2887 2887
                 $item_id => $this->items[$item_id]->get_status()
2888 2888
             );
2889 2889
         }
@@ -2937,7 +2937,7 @@  discard block
 block discarded – undo
2937 2937
         $res = Database::query($sql);
2938 2938
         $num = Database :: num_rows($res);
2939 2939
         if ($num > 0) {
2940
-            $list[] = array (
2940
+            $list[] = array(
2941 2941
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2942 2942
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2943 2943
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2949 2949
             );
2950 2950
             while ($row = Database :: fetch_array($res)) {
2951
-                $list[] = array (
2951
+                $list[] = array(
2952 2952
                     'order_id' => ($row['order_id'] + 1),
2953 2953
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2954 2954
                     'type' => $row['interaction_type'],
@@ -3016,7 +3016,7 @@  discard block
 block discarded – undo
3016 3016
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3017 3017
             );
3018 3018
             while ($row = Database :: fetch_array($res)) {
3019
-                $list[] = array (
3019
+                $list[] = array(
3020 3020
                     'order_id' => ($row['order_id'] + 1),
3021 3021
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3022 3022
                     'score_raw' => $row['score_raw'],
@@ -3043,10 +3043,10 @@  discard block
 block discarded – undo
3043 3043
         $toc = array();
3044 3044
         foreach ($this->ordered_items as $item_id) {
3045 3045
             if ($this->debug > 2) {
3046
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3046
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3047 3047
             }
3048 3048
             // TODO: Change this link generation and use new function instead.
3049
-            $toc[] = array (
3049
+            $toc[] = array(
3050 3050
                 'id'            => $item_id,
3051 3051
                 'title'         => $this->items[$item_id]->get_title(),
3052 3052
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3057,7 +3057,7 @@  discard block
 block discarded – undo
3057 3057
             );
3058 3058
         }
3059 3059
         if ($this->debug > 2) {
3060
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3060
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3061 3061
         }
3062 3062
         return $toc;
3063 3063
     }
@@ -3074,10 +3074,10 @@  discard block
 block discarded – undo
3074 3074
         }
3075 3075
         $toc = $varname.' = new Array();';
3076 3076
         foreach ($this->ordered_items as $item_id) {
3077
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3077
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3078 3078
         }
3079 3079
         if ($this->debug > 2) {
3080
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3080
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3081 3081
         }
3082 3082
         return $toc;
3083 3083
     }
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
             }
3102 3102
         }
3103 3103
         if ($this->debug > 2) {
3104
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3104
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3105 3105
         }
3106 3106
         return $res;
3107 3107
     }
@@ -3117,7 +3117,7 @@  discard block
 block discarded – undo
3117 3117
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3118 3118
         $lp_id = intval($lp_id);
3119 3119
         $sql = "SELECT lp_type FROM $tbl_lp
3120
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3120
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3121 3121
         $res = Database::query($sql);
3122 3122
         if ($res === false) {
3123 3123
             return null;
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
             $dirTypes = self::getChapterTypes();
3230 3230
 
3231 3231
             if (in_array($item['type'], $dirTypes)) {
3232
-                $scorm_color_background ='scorm_item_section ';
3232
+                $scorm_color_background = 'scorm_item_section ';
3233 3233
                 $style_item = '';
3234 3234
             }
3235 3235
             if ($item['id'] == $this->current) {
@@ -3238,7 +3238,7 @@  discard block
 block discarded – undo
3238 3238
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3239 3239
             }
3240 3240
 
3241
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3241
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3242 3242
 
3243 3243
             // Learning path title
3244 3244
             $title = $item['title'];
@@ -3268,7 +3268,7 @@  discard block
 block discarded – undo
3268 3268
                 $html .= stripslashes($title);
3269 3269
             } else {
3270 3270
                 $this->get_link('http', $item['id'], $toc_list);
3271
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3271
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3272 3272
             }
3273 3273
             $html .= "</div>";
3274 3274
 
@@ -3298,12 +3298,12 @@  discard block
 block discarded – undo
3298 3298
             if ($this->get_lp_session_id() == api_get_session_id()) {
3299 3299
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3300 3300
                 $html .= '<div class="btn-group">';
3301
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=build&lp_id=" . $this->lp_id . "' target='_parent'>" .
3302
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3303
-                $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 . "' target='_parent'>" .
3304
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3305
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&action=edit&lp_id=" . $this->lp_id.'">' .
3306
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3301
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=build&lp_id=".$this->lp_id."' target='_parent'>".
3302
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3303
+                $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."' target='_parent'>".
3304
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3305
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&action=edit&lp_id=".$this->lp_id.'">'.
3306
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3307 3307
                 $html .= '</div>';
3308 3308
                 $html .= '</div>';
3309 3309
             }
@@ -3355,11 +3355,11 @@  discard block
 block discarded – undo
3355 3355
         $course_id = $this->get_course_int_id();
3356 3356
 
3357 3357
         if ($this->debug > 0) {
3358
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3358
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3359 3359
         }
3360 3360
         if (empty($item_id)) {
3361 3361
             if ($this->debug > 2) {
3362
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3362
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3363 3363
             }
3364 3364
             $item_id = $this->get_current_item_id();
3365 3365
         }
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3392 3392
         		WHERE li.id = $item_id ";
3393 3393
         if ($this->debug > 2) {
3394
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3394
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3395 3395
         }
3396 3396
         $res = Database::query($sql);
3397 3397
         if (Database :: num_rows($res) > 0) {
@@ -3405,9 +3405,9 @@  discard block
 block discarded – undo
3405 3405
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3406 3406
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3407 3407
             }
3408
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3408
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3409 3409
             if ($type == 'http') {
3410
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3410
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3411 3411
             } else {
3412 3412
                 $course_path = $sys_course_path; //system path
3413 3413
             }
@@ -3418,8 +3418,8 @@  discard block
 block discarded – undo
3418 3418
             }
3419 3419
 
3420 3420
             if ($this->debug > 2) {
3421
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3422
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3421
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3422
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3423 3423
             }
3424 3424
 
3425 3425
             // Now go through the specific cases to get the end of the path
@@ -3434,7 +3434,7 @@  discard block
 block discarded – undo
3434 3434
                     );
3435 3435
 
3436 3436
                     if ($this->debug > 0) {
3437
-                        error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3437
+                        error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3438 3438
                     }
3439 3439
 
3440 3440
                     switch ($lp_item_type) {
@@ -3506,7 +3506,7 @@  discard block
 block discarded – undo
3506 3506
                                             status='completed'";
3507 3507
                                 $result = Database::query($sql);
3508 3508
                                 $row_count = Database:: fetch_row($result);
3509
-                                $count_item_view = (int)$row_count[0];
3509
+                                $count_item_view = (int) $row_count[0];
3510 3510
                                 $not_multiple_attempt = 0;
3511 3511
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3512 3512
                                     $not_multiple_attempt = 1;
@@ -3525,7 +3525,7 @@  discard block
 block discarded – undo
3525 3525
                     break;
3526 3526
                 case 2 :
3527 3527
                     if ($this->debug > 2) {
3528
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3528
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3529 3529
                     }
3530 3530
 
3531 3531
                     if ($lp_item_type != 'dir') {
@@ -3539,19 +3539,19 @@  discard block
 block discarded – undo
3539 3539
                         //if ($this->prerequisites_match($item_id)) {
3540 3540
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3541 3541
                             if ($this->debug > 2) {
3542
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3542
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3543 3543
                             }
3544 3544
                             // Distant url, return as is.
3545 3545
                             $file = $lp_item_path;
3546 3546
                         } else {
3547 3547
                             if ($this->debug > 2) {
3548
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3548
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3549 3549
                             }
3550 3550
                             // Prevent getting untranslatable urls.
3551 3551
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3552 3552
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3553 3553
                             // Prepare the path.
3554
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3554
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3555 3555
                             // TODO: Fix this for urls with protocol header.
3556 3556
                             $file = str_replace('//', '/', $file);
3557 3557
                             $file = str_replace(':/', '://', $file);
@@ -3559,11 +3559,11 @@  discard block
 block discarded – undo
3559 3559
                                 $lp_path = substr($lp_path, 0, -1);
3560 3560
                             }
3561 3561
 
3562
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3562
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3563 3563
                                 // if file not found.
3564 3564
                                 $decoded = html_entity_decode($lp_item_path);
3565 3565
                                 list ($decoded) = explode('?', $decoded);
3566
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3566
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3567 3567
                                     $file = self::rl_get_resource_link_for_learnpath(
3568 3568
                                         $course_id,
3569 3569
                                         $this->get_id(),
@@ -3582,14 +3582,14 @@  discard block
 block discarded – undo
3582 3582
                                         }
3583 3583
                                     }
3584 3584
                                 } else {
3585
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3585
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3586 3586
                                 }
3587 3587
                             }
3588 3588
                         }
3589 3589
 
3590 3590
                         // We want to use parameters if they were defined in the imsmanifest
3591 3591
                         if (strpos($file, 'blank.php') === false) {
3592
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3592
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3593 3593
                         }
3594 3594
                     } else {
3595 3595
                         $file = 'lp_content.php?type=dir';
@@ -3597,12 +3597,12 @@  discard block
 block discarded – undo
3597 3597
                     break;
3598 3598
                 case 3 :
3599 3599
                     if ($this->debug > 2) {
3600
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3600
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3601 3601
                     }
3602 3602
                     // Formatting AICC HACP append URL.
3603
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3603
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3604 3604
                     if (!empty($lp_item_params)) {
3605
-                        $aicc_append .= $lp_item_params . '&';
3605
+                        $aicc_append .= $lp_item_params.'&';
3606 3606
                     }
3607 3607
                     if ($lp_item_type != 'dir') {
3608 3608
                         // Quite complex here:
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 
3615 3615
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3616 3616
                             if ($this->debug > 2) {
3617
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3617
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3618 3618
                             }
3619 3619
                             // Distant url, return as is.
3620 3620
                             $file = $lp_item_path;
@@ -3627,19 +3627,19 @@  discard block
 block discarded – undo
3627 3627
                             if (stripos($file, '<servername>') !== false) {
3628 3628
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3629 3629
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3630
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3630
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3631 3631
                             }
3632 3632
                             //
3633 3633
                             $file .= $aicc_append;
3634 3634
                         } else {
3635 3635
                             if ($this->debug > 2) {
3636
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3636
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3637 3637
                             }
3638 3638
                             // Prevent getting untranslatable urls.
3639 3639
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3640 3640
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3641 3641
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3642
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3642
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3643 3643
                             // TODO: Fix this for urls with protocol header.
3644 3644
                             $file = str_replace('//', '/', $file);
3645 3645
                             $file = str_replace(':/', '://', $file);
@@ -3658,7 +3658,7 @@  discard block
 block discarded – undo
3658 3658
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3659 3659
         }
3660 3660
         if ($this->debug > 2) {
3661
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3661
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3662 3662
         }
3663 3663
         return $file;
3664 3664
     }
@@ -3676,7 +3676,7 @@  discard block
 block discarded – undo
3676 3676
         $search = '';
3677 3677
         // Use $attempt_num to enable multi-views management (disabled so far).
3678 3678
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3679
-            $search = 'AND view_count = ' . $attempt_num;
3679
+            $search = 'AND view_count = '.$attempt_num;
3680 3680
         }
3681 3681
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3682 3682
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3686,9 +3686,9 @@  discard block
 block discarded – undo
3686 3686
 
3687 3687
         $sql = "SELECT id, view_count FROM $lp_view_table
3688 3688
         		WHERE
3689
-        		    c_id = " . $course_id . " AND
3690
-        		    lp_id = " . $this->get_id() . " AND
3691
-        		    user_id = " . $this->get_user_id() . " AND
3689
+        		    c_id = ".$course_id." AND
3690
+        		    lp_id = " . $this->get_id()." AND
3691
+        		    user_id = " . $this->get_user_id()." AND
3692 3692
         		    session_id = $sessionId
3693 3693
         		    $search
3694 3694
                 ORDER BY view_count DESC";
@@ -3699,7 +3699,7 @@  discard block
 block discarded – undo
3699 3699
         } else if (!api_is_invitee()) {
3700 3700
             // There is no database record, create one.
3701 3701
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3702
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3702
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3703 3703
             Database::query($sql);
3704 3704
             $id = Database :: insert_id();
3705 3705
             $this->lp_view_id = $id;
@@ -3799,15 +3799,15 @@  discard block
 block discarded – undo
3799 3799
     {
3800 3800
         $course_id = api_get_course_int_id();
3801 3801
         if ($this->debug > 0) {
3802
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3802
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3803 3803
         }
3804 3804
         if (empty($id) || empty($direction)) {
3805 3805
             return false;
3806 3806
         }
3807 3807
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3808 3808
         $sql_sel = "SELECT *
3809
-                    FROM " . $tbl_lp_item . "
3810
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3809
+                    FROM " . $tbl_lp_item."
3810
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3811 3811
         $res_sel = Database::query($sql_sel);
3812 3812
         // Check if elem exists.
3813 3813
         if (Database :: num_rows($res_sel) < 1) {
@@ -3832,7 +3832,7 @@  discard block
 block discarded – undo
3832 3832
                                  WHERE c_id = ".$course_id." AND id = $previous";
3833 3833
 
3834 3834
                     if ($this->debug > 2) {
3835
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3835
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3836 3836
                     }
3837 3837
                     $res_sel2 = Database::query($sql_sel2);
3838 3838
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3885,7 +3885,7 @@  discard block
 block discarded – undo
3885 3885
                         }
3886 3886
                         Database::query($sql_upd2);
3887 3887
                     }
3888
-                    $display = $display -1;
3888
+                    $display = $display - 1;
3889 3889
                 }
3890 3890
                 break;
3891 3891
             case 'down':
@@ -3896,7 +3896,7 @@  discard block
 block discarded – undo
3896 3896
                 } else {
3897 3897
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3898 3898
                     if ($this->debug > 2) {
3899
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3899
+                        error_log('Selecting next: '.$sql_sel2, 0);
3900 3900
                     }
3901 3901
                     $res_sel2 = Database::query($sql_sel2);
3902 3902
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3934,7 +3934,7 @@  discard block
 block discarded – undo
3934 3934
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3935 3935
                         Database::query($sql_upd2);
3936 3936
                     }
3937
-                    $display = $display +1;
3937
+                    $display = $display + 1;
3938 3938
                 }
3939 3939
                 break;
3940 3940
             default :
@@ -3957,8 +3957,8 @@  discard block
 block discarded – undo
3957 3957
         $res = Database::query($sql);
3958 3958
         if ($res === false)
3959 3959
             return false;
3960
-        $lps = array ();
3961
-        $lp_order = array ();
3960
+        $lps = array();
3961
+        $lp_order = array();
3962 3962
         $num = Database :: num_rows($res);
3963 3963
         // First check the order is correct, globally (might be wrong because
3964 3964
         // of versions < 1.8.4)
@@ -3968,7 +3968,7 @@  discard block
 block discarded – undo
3968 3968
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3969 3969
                     $need_fix = true;
3970 3970
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3971
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3971
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3972 3972
                     Database::query($sql_u);
3973 3973
                 }
3974 3974
                 $row['display_order'] = $i;
@@ -3981,10 +3981,10 @@  discard block
 block discarded – undo
3981 3981
             $order = $lps[$lp_id]['display_order'];
3982 3982
             if ($order > 1) { // If it's the first element, no need to move up.
3983 3983
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3984
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3984
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3985 3985
                 Database::query($sql_u1);
3986
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3987
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3986
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3987
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3988 3988
                 Database::query($sql_u2);
3989 3989
             }
3990 3990
         }
@@ -4005,8 +4005,8 @@  discard block
 block discarded – undo
4005 4005
         if ($res === false) {
4006 4006
             return false;
4007 4007
         }
4008
-        $lps = array ();
4009
-        $lp_order = array ();
4008
+        $lps = array();
4009
+        $lp_order = array();
4010 4010
         $num = Database :: num_rows($res);
4011 4011
         $max = 0;
4012 4012
         // First check the order is correct, globally (might be wrong because
@@ -4018,7 +4018,7 @@  discard block
 block discarded – undo
4018 4018
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4019 4019
                     $need_fix = true;
4020 4020
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4021
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4021
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4022 4022
                     Database::query($sql_u);
4023 4023
                 }
4024 4024
                 $row['display_order'] = $i;
@@ -4031,10 +4031,10 @@  discard block
 block discarded – undo
4031 4031
             $order = $lps[$lp_id]['display_order'];
4032 4032
             if ($order < $max) { // If it's the first element, no need to move up.
4033 4033
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4034
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4034
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4035 4035
                 Database::query($sql_u1);
4036
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4037
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4036
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4037
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4038 4038
                 Database::query($sql_u2);
4039 4039
             }
4040 4040
         }
@@ -4054,15 +4054,15 @@  discard block
 block discarded – undo
4054 4054
         $this->autocomplete_parents($this->last);
4055 4055
         $new_index = $this->get_next_index();
4056 4056
         if ($this->debug > 2) {
4057
-            error_log('New LP - New index: ' . $new_index, 0);
4057
+            error_log('New LP - New index: '.$new_index, 0);
4058 4058
         }
4059 4059
         $this->index = $new_index;
4060 4060
         if ($this->debug > 2) {
4061
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4061
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4062 4062
         }
4063 4063
         $this->current = $this->ordered_items[$new_index];
4064 4064
         if ($this->debug > 2) {
4065
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4065
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4066 4066
         }
4067 4067
     }
4068 4068
 
@@ -4126,7 +4126,7 @@  discard block
 block discarded – undo
4126 4126
             // Clean spaces.
4127 4127
             $prereq_string = str_replace(' ', '', $prereq_string);
4128 4128
             if ($debug > 0) {
4129
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4129
+                error_log('Found prereq_string: '.$prereq_string, 0);
4130 4130
             }
4131 4131
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4132 4132
             $result = $currentItem->parse_prereq(
@@ -4142,12 +4142,12 @@  discard block
 block discarded – undo
4142 4142
         } else {
4143 4143
             $result = true;
4144 4144
             if ($debug > 1) {
4145
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4145
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4146 4146
             }
4147 4147
         }
4148 4148
 
4149 4149
         if ($debug > 1) {
4150
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4150
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4151 4151
         }
4152 4152
         return $result;
4153 4153
     }
@@ -4213,12 +4213,12 @@  discard block
 block discarded – undo
4213 4213
             $row = Database :: fetch_array($result);
4214 4214
             $name = domesticate($row['name']);
4215 4215
             if ($set_visibility == 'i') {
4216
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4216
+                $s = $name." ".get_lang('LearnpathNotPublished');
4217 4217
                 $dialogBox = $s;
4218 4218
                 $v = 0;
4219 4219
             }
4220 4220
             if ($set_visibility == 'v') {
4221
-                $s = $name . " " . get_lang('LearnpathPublished');
4221
+                $s = $name." ".get_lang('LearnpathPublished');
4222 4222
                 $dialogBox = $s;
4223 4223
                 $v = 1;
4224 4224
             }
@@ -4301,9 +4301,9 @@  discard block
 block discarded – undo
4301 4301
         $course_id = api_get_course_int_id();
4302 4302
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4303 4303
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4304
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4304
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4305 4305
         if ($this->debug > 2) {
4306
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4306
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4307 4307
         }
4308 4308
         $res = Database::query($sql);
4309 4309
         $view_id = Database::insert_id();
@@ -4341,10 +4341,10 @@  discard block
 block discarded – undo
4341 4341
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4342 4342
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4343 4343
         if ($this->debug > 2) {
4344
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4344
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4345 4345
         }
4346 4346
         if ($this->debug > 2) {
4347
-            error_log('' . print_r($this->items, true), 0);
4347
+            error_log(''.print_r($this->items, true), 0);
4348 4348
         }
4349 4349
         if (isset($this->items[$this->current]) &&
4350 4350
             is_object($this->items[$this->current])
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
     {
4369 4369
         $debug = $this->debug;
4370 4370
         if ($debug) {
4371
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4371
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4372 4372
         }
4373 4373
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4374 4374
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4391,7 +4391,7 @@  discard block
 block discarded – undo
4391 4391
 
4392 4392
             if ($debug) {
4393 4393
                 error_log('update_queue before:');
4394
-                error_log(print_r($this->update_queue,1));
4394
+                error_log(print_r($this->update_queue, 1));
4395 4395
             }
4396 4396
             $this->autocomplete_parents($item_id);
4397 4397
 
@@ -4399,9 +4399,9 @@  discard block
 block discarded – undo
4399 4399
             $this->update_queue[$item_id] = $status;
4400 4400
 
4401 4401
             if ($debug) {
4402
-                error_log('get_status(): ' . $status);
4402
+                error_log('get_status(): '.$status);
4403 4403
                 error_log('update_queue after:');
4404
-                error_log(print_r($this->update_queue,1));
4404
+                error_log(print_r($this->update_queue, 1));
4405 4405
             }
4406 4406
             return $res;
4407 4407
         }
@@ -4422,17 +4422,17 @@  discard block
 block discarded – undo
4422 4422
 
4423 4423
         if (isset($this->current) && !api_is_invitee()) {
4424 4424
             if ($this->debug > 2) {
4425
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4425
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4426 4426
             }
4427 4427
             $sql = "UPDATE $table SET
4428
-                        last_item = " . intval($this->get_current_item_id()). "
4428
+                        last_item = ".intval($this->get_current_item_id())."
4429 4429
                     WHERE
4430 4430
                         c_id = $course_id AND
4431
-                        lp_id = " . $this->get_id() . " AND
4431
+                        lp_id = ".$this->get_id()." AND
4432 4432
                         user_id = " . $this->get_user_id()." ".$session_condition;
4433 4433
 
4434 4434
             if ($this->debug > 2) {
4435
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4435
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4436 4436
             }
4437 4437
             Database::query($sql);
4438 4438
         }
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
                             progress = $progress
4447 4447
                         WHERE
4448 4448
                             c_id = ".$course_id." AND
4449
-                            lp_id = " . $this->get_id() . " AND
4449
+                            lp_id = " . $this->get_id()." AND
4450 4450
                             user_id = " . $this->get_user_id()." ".$session_condition;
4451 4451
                 // Ignore errors as some tables might not have the progress field just yet.
4452 4452
                 Database::query($sql);
@@ -4462,7 +4462,7 @@  discard block
 block discarded – undo
4462 4462
     public function set_current_item($item_id = null)
4463 4463
     {
4464 4464
         if ($this->debug > 0) {
4465
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4465
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4466 4466
         }
4467 4467
         if (empty ($item_id)) {
4468 4468
             if ($this->debug > 2) {
@@ -4471,7 +4471,7 @@  discard block
 block discarded – undo
4471 4471
             // Do nothing.
4472 4472
         } else {
4473 4473
             if ($this->debug > 2) {
4474
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4474
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4475 4475
             }
4476 4476
             if (is_numeric($item_id)) {
4477 4477
                 $item_id = intval($item_id);
@@ -4486,10 +4486,10 @@  discard block
 block discarded – undo
4486 4486
                     }
4487 4487
                 }
4488 4488
                 if ($this->debug > 2) {
4489
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4489
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4490 4490
                 }
4491 4491
             } else {
4492
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4492
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4493 4493
             }
4494 4494
         }
4495 4495
     }
@@ -4538,7 +4538,7 @@  discard block
 block discarded – undo
4538 4538
 
4539 4539
         if ($lp != 0) {
4540 4540
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4541
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4541
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4542 4542
             $res = Database::query($sql);
4543 4543
             return $res;
4544 4544
         } else {
@@ -4563,10 +4563,10 @@  discard block
 block discarded – undo
4563 4563
         $course_id = api_get_course_int_id();
4564 4564
         $lp_id = $this->get_id();
4565 4565
         $sql = "UPDATE $lp_table SET
4566
-                content_maker = '" . Database::escape_string($this->maker) . "'
4566
+                content_maker = '".Database::escape_string($this->maker)."'
4567 4567
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4568 4568
         if ($this->debug > 2) {
4569
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4569
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4570 4570
         }
4571 4571
         Database::query($sql);
4572 4572
         return true;
@@ -4590,10 +4590,10 @@  discard block
 block discarded – undo
4590 4590
         $lp_id = $this->get_id();
4591 4591
         $course_id = $this->course_info['real_id'];
4592 4592
         $sql = "UPDATE $lp_table SET
4593
-                name = '" . Database::escape_string($this->name). "'
4593
+                name = '".Database::escape_string($this->name)."'
4594 4594
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4595 4595
         if ($this->debug > 2) {
4596
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4596
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4597 4597
         }
4598 4598
         $result = Database::query($sql);
4599 4599
         // If the lp is visible on the homepage, change his name there.
@@ -4601,7 +4601,7 @@  discard block
 block discarded – undo
4601 4601
             $session_id = api_get_session_id();
4602 4602
             $session_condition = api_get_session_condition($session_id);
4603 4603
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4604
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4604
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4605 4605
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4606 4606
             	    WHERE
4607 4607
             	        c_id = $course_id AND
@@ -4680,10 +4680,10 @@  discard block
 block discarded – undo
4680 4680
 
4681 4681
                 // Save it to search engine.
4682 4682
                 foreach ($missing_terms as $term) {
4683
-                    $doc->add_term($prefix . $term, 1);
4683
+                    $doc->add_term($prefix.$term, 1);
4684 4684
                 }
4685 4685
                 foreach ($deprecated_terms as $term) {
4686
-                    $doc->remove_term($prefix . $term);
4686
+                    $doc->remove_term($prefix.$term);
4687 4687
                 }
4688 4688
                 $di->getDb()->replace_document($se_ref->getSearchDid(), $doc);
4689 4689
                 $di->getDb()->flush();
@@ -4708,10 +4708,10 @@  discard block
 block discarded – undo
4708 4708
         $this->theme = $name;
4709 4709
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4710 4710
         $lp_id = $this->get_id();
4711
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4711
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4712 4712
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4713 4713
         if ($this->debug > 2) {
4714
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4714
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4715 4715
         }
4716 4716
         Database::query($sql);
4717 4717
 
@@ -4734,10 +4734,10 @@  discard block
 block discarded – undo
4734 4734
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4735 4735
         $lp_id = $this->get_id();
4736 4736
         $sql = "UPDATE $lp_table SET
4737
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4737
+                preview_image = '".Database::escape_string($this->preview_image)."'
4738 4738
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4739 4739
         if ($this->debug > 2) {
4740
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4740
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4741 4741
         }
4742 4742
         Database::query($sql);
4743 4743
         return true;
@@ -4757,10 +4757,10 @@  discard block
 block discarded – undo
4757 4757
         $this->author = $name;
4758 4758
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4759 4759
         $lp_id = $this->get_id();
4760
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4760
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4761 4761
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4762 4762
         if ($this->debug > 2) {
4763
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4763
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4764 4764
         }
4765 4765
         Database::query($sql);
4766 4766
 
@@ -4778,15 +4778,15 @@  discard block
 block discarded – undo
4778 4778
         if ($this->debug > 0) {
4779 4779
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4780 4780
         }
4781
-        if (intval($hide) == $hide){
4781
+        if (intval($hide) == $hide) {
4782 4782
             $this->hide_toc_frame = $hide;
4783 4783
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4784 4784
             $lp_id = $this->get_id();
4785 4785
             $sql = "UPDATE $lp_table SET
4786
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4786
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4787 4787
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4788 4788
             if ($this->debug > 2) {
4789
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4789
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4790 4790
             }
4791 4791
             Database::query($sql);
4792 4792
 
@@ -4813,7 +4813,7 @@  discard block
 block discarded – undo
4813 4813
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4814 4814
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4815 4815
         if ($this->debug > 2) {
4816
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4816
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4817 4817
         }
4818 4818
         Database::query($sql);
4819 4819
         return true;
@@ -4837,10 +4837,10 @@  discard block
 block discarded – undo
4837 4837
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4838 4838
         $lp_id = $this->get_id();
4839 4839
         $sql = "UPDATE $lp_table SET
4840
-                    content_local = '" . Database::escape_string($name) . "'
4840
+                    content_local = '".Database::escape_string($name)."'
4841 4841
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4842 4842
         if ($this->debug > 2) {
4843
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4843
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4844 4844
         }
4845 4845
         Database::query($sql);
4846 4846
         return true;
@@ -4874,11 +4874,11 @@  discard block
 block discarded – undo
4874 4874
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4875 4875
         $lp_id = $this->get_id();
4876 4876
         $sql = "UPDATE $lp_table SET
4877
-                    use_max_score = '" . $this->use_max_score . "'
4877
+                    use_max_score = '".$this->use_max_score."'
4878 4878
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4879 4879
 
4880 4880
         if ($this->debug > 2) {
4881
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4881
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4882 4882
         }
4883 4883
         Database::query($sql);
4884 4884
 
@@ -4905,10 +4905,10 @@  discard block
 block discarded – undo
4905 4905
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4906 4906
         $lp_id = $this->get_id();
4907 4907
         $sql = "UPDATE $lp_table SET
4908
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4908
+                expired_on = '".Database::escape_string($this->expired_on)."'
4909 4909
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4910 4910
         if ($this->debug > 2) {
4911
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4911
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4912 4912
         }
4913 4913
         Database::query($sql);
4914 4914
 
@@ -4934,10 +4934,10 @@  discard block
 block discarded – undo
4934 4934
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4935 4935
         $lp_id = $this->get_id();
4936 4936
         $sql = "UPDATE $lp_table SET
4937
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4937
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4938 4938
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4939 4939
         if ($this->debug > 2) {
4940
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4940
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4941 4941
         }
4942 4942
         Database::query($sql);
4943 4943
 
@@ -4957,10 +4957,10 @@  discard block
 block discarded – undo
4957 4957
         $this->modified_on = api_get_utc_datetime();
4958 4958
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4959 4959
         $lp_id = $this->get_id();
4960
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4960
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4961 4961
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4962 4962
         if ($this->debug > 2) {
4963
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4963
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4964 4964
         }
4965 4965
         Database::query($sql);
4966 4966
         return true;
@@ -5031,13 +5031,13 @@  discard block
 block discarded – undo
5031 5031
 
5032 5032
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5033 5033
             if ($this->debug > 2) {
5034
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5034
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5035 5035
             }
5036 5036
             switch ($this->get_type()) {
5037 5037
                 case '3' :
5038 5038
                     if ($this->items[$this->last]->get_type() != 'au') {
5039 5039
                         if ($this->debug > 2) {
5040
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5040
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5041 5041
                         }
5042 5042
                         $this->items[$this->last]->close();
5043 5043
                         //$this->autocomplete_parents($this->last);
@@ -5050,7 +5050,7 @@  discard block
 block discarded – undo
5050 5050
                 case '2' :
5051 5051
                     if ($this->items[$this->last]->get_type() != 'sco') {
5052 5052
                         if ($this->debug > 2) {
5053
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5053
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5054 5054
                         }
5055 5055
                         $this->items[$this->last]->close();
5056 5056
                         //$this->autocomplete_parents($this->last);
@@ -5064,7 +5064,7 @@  discard block
 block discarded – undo
5064 5064
                 case '1' :
5065 5065
                 default :
5066 5066
                     if ($this->debug > 2) {
5067
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5067
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5068 5068
                     }
5069 5069
                     $this->items[$this->last]->close();
5070 5070
                     break;
@@ -5090,7 +5090,7 @@  discard block
 block discarded – undo
5090 5090
         }
5091 5091
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5092 5092
         $sql = "SELECT * FROM $lp_table
5093
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5093
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5094 5094
         $res = Database::query($sql);
5095 5095
         if (Database :: num_rows($res) > 0) {
5096 5096
             $row = Database :: fetch_array($res);
@@ -5111,14 +5111,14 @@  discard block
 block discarded – undo
5111 5111
                     break;
5112 5112
             }
5113 5113
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5114
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5114
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5115 5115
             Database::query($sql);
5116 5116
             $this->mode = $view_mode;
5117 5117
 
5118 5118
             return $view_mode;
5119 5119
         } else {
5120 5120
             if ($this->debug > 2) {
5121
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5121
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5122 5122
             }
5123 5123
         }
5124 5124
         return -1;
@@ -5136,7 +5136,7 @@  discard block
 block discarded – undo
5136 5136
         }
5137 5137
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5138 5138
         $sql = "SELECT * FROM $lp_table
5139
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5139
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5140 5140
         $res = Database::query($sql);
5141 5141
         if (Database :: num_rows($res) > 0) {
5142 5142
             $row = Database :: fetch_array($res);
@@ -5149,14 +5149,14 @@  discard block
 block discarded – undo
5149 5149
                 $force_return = true;
5150 5150
             }
5151 5151
             $sql = "UPDATE $lp_table SET force_commit = $force
5152
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5152
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5153 5153
             Database::query($sql);
5154 5154
             $this->force_commit = $force_return;
5155 5155
 
5156 5156
             return $force_return;
5157 5157
         } else {
5158 5158
             if ($this->debug > 2) {
5159
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5159
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5160 5160
             }
5161 5161
         }
5162 5162
         return -1;
@@ -5185,7 +5185,7 @@  discard block
 block discarded – undo
5185 5185
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5186 5186
                     $need_fix = true;
5187 5187
                     $sql = "UPDATE $lp_table SET display_order = $i
5188
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5188
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5189 5189
                     Database::query($sql);
5190 5190
                 }
5191 5191
                 $i++;
@@ -5206,7 +5206,7 @@  discard block
 block discarded – undo
5206 5206
         }
5207 5207
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5208 5208
         $sql = "SELECT * FROM $lp_table
5209
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5209
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5210 5210
         $res = Database::query($sql);
5211 5211
         if (Database :: num_rows($res) > 0) {
5212 5212
             $row = Database :: fetch_array($res);
@@ -5217,13 +5217,13 @@  discard block
 block discarded – undo
5217 5217
                 $force = 1;
5218 5218
             }
5219 5219
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5220
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5220
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5221 5221
             Database::query($sql);
5222 5222
             $this->prevent_reinit = $force;
5223 5223
             return $force;
5224 5224
         } else {
5225 5225
             if ($this->debug > 2) {
5226
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5226
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5227 5227
             }
5228 5228
         }
5229 5229
         return -1;
@@ -5239,11 +5239,11 @@  discard block
 block discarded – undo
5239 5239
     {
5240 5240
         //Set default value for seriousgame_mode
5241 5241
         if (!isset($this->seriousgame_mode)) {
5242
-            $this->seriousgame_mode=0;
5242
+            $this->seriousgame_mode = 0;
5243 5243
         }
5244 5244
         // Set default value for prevent_reinit
5245 5245
         if (!isset($this->prevent_reinit)) {
5246
-            $this->prevent_reinit =1;
5246
+            $this->prevent_reinit = 1;
5247 5247
         }
5248 5248
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5249 5249
             return 'seriousgame';
@@ -5291,7 +5291,7 @@  discard block
 block discarded – undo
5291 5291
         $sql = "UPDATE $lp_table SET
5292 5292
                 prevent_reinit = $prevent_reinit ,
5293 5293
                 seriousgame_mode = $sg_mode
5294
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5294
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5295 5295
         $res = Database::query($sql);
5296 5296
         if ($res) {
5297 5297
             return true;
@@ -5343,7 +5343,7 @@  discard block
 block discarded – undo
5343 5343
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5344 5344
         }
5345 5345
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5346
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5346
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5347 5347
         $res = Database::query($sql);
5348 5348
         if (Database :: num_rows($res) > 0) {
5349 5349
             $row = Database :: fetch_array($res);
@@ -5354,13 +5354,13 @@  discard block
 block discarded – undo
5354 5354
                 $force = 1;
5355 5355
             }
5356 5356
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5357
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5357
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5358 5358
             Database::query($sql);
5359 5359
             $this->seriousgame_mode = $force;
5360 5360
             return $force;
5361 5361
         } else {
5362 5362
             if ($this->debug > 2) {
5363
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5363
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5364 5364
             }
5365 5365
         }
5366 5366
         return -1;
@@ -5378,7 +5378,7 @@  discard block
 block discarded – undo
5378 5378
         }
5379 5379
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5380 5380
         $sql = "SELECT * FROM $lp_table
5381
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5381
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5382 5382
         $res = Database::query($sql);
5383 5383
         if (Database :: num_rows($res) > 0) {
5384 5384
             $row = Database :: fetch_array($res);
@@ -5389,13 +5389,13 @@  discard block
 block discarded – undo
5389 5389
                 $force = 1;
5390 5390
             }
5391 5391
             $sql = "UPDATE $lp_table SET debug = $force
5392
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5392
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5393 5393
             $res = Database::query($sql);
5394 5394
             $this->scorm_debug = $force;
5395 5395
             return $force;
5396 5396
         } else {
5397 5397
             if ($this->debug > 2) {
5398
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5398
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5399 5399
             }
5400 5400
         }
5401 5401
         return -1;
@@ -5424,7 +5424,7 @@  discard block
 block discarded – undo
5424 5424
      * @param int $depth
5425 5425
      * @param array $tmp
5426 5426
      */
5427
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5427
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5428 5428
     {
5429 5429
         if ($this->debug > 1) {
5430 5430
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5523,14 +5523,14 @@  discard block
 block discarded – undo
5523 5523
         } else {
5524 5524
             $return_audio = '<table class="data_table">';
5525 5525
             $return_audio .= '<tr>';
5526
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5527
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5526
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5527
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5528 5528
             $return_audio .= '</tr>';
5529 5529
 
5530 5530
             if ($update_audio != 'true') {
5531 5531
                 $return .= '<div class="col-md-12">';
5532 5532
                 $return .= self::return_new_tree($update_audio);
5533
-                $return .='</div>';
5533
+                $return .= '</div>';
5534 5534
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5535 5535
             } else {
5536 5536
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5540,7 +5540,7 @@  discard block
 block discarded – undo
5540 5540
             // We need to close the form when we are updating the mp3 files.
5541 5541
             if ($update_audio == 'true') {
5542 5542
                 $return .= '<div class="footer-audio">';
5543
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5543
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5544 5544
                 $return .= '</div>';
5545 5545
                 //$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?
5546 5546
             }
@@ -5564,7 +5564,7 @@  discard block
 block discarded – undo
5564 5564
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5565 5565
     {
5566 5566
     $return = '';
5567
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5567
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5568 5568
 
5569 5569
         $course_id = api_get_course_int_id();
5570 5570
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5610,7 +5610,7 @@  discard block
 block discarded – undo
5610 5610
 
5611 5611
             $title_cut = cut($arrLP[$i]['title'], 25);
5612 5612
 
5613
-            $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5613
+            $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5614 5614
             $title_cut = Display::url(
5615 5615
                 $title_cut,
5616 5616
                 $url,
@@ -5625,22 +5625,22 @@  discard block
 block discarded – undo
5625 5625
             } else {
5626 5626
                 $oddClass = 'row_even';
5627 5627
             }
5628
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5628
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5629 5629
 
5630 5630
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5631 5631
 
5632
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5633
-                $icon = Display::return_icon('lp_' . $icon_name . '.png');
5632
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5633
+                $icon = Display::return_icon('lp_'.$icon_name.'.png');
5634 5634
             } else {
5635
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5636
-                    $icon = Display::return_icon('lp_' . $icon_name . '.gif');
5635
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5636
+                    $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5637 5637
                 } else {
5638 5638
                     $icon = Display::return_icon('folder_document.gif');
5639 5639
                 }
5640 5640
             }
5641 5641
 
5642 5642
             // The audio column.
5643
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5643
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5644 5644
             $audio = '';
5645 5645
             if (!$update_audio || $update_audio <> 'true') {
5646 5646
                 if (!empty($arrLP[$i]['audio'])) {
@@ -5650,10 +5650,10 @@  discard block
 block discarded – undo
5650 5650
             } else {
5651 5651
                 $types = self::getChapterTypes();
5652 5652
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5653
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5653
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5654 5654
                     if (!empty ($arrLP[$i]['audio'])) {
5655 5655
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5656
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5656
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5657 5657
                     }
5658 5658
                 }
5659 5659
             }
@@ -5679,7 +5679,7 @@  discard block
 block discarded – undo
5679 5679
                 // No edit for this item types
5680 5680
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5681 5681
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5682
-                        $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">';
5682
+                        $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">';
5683 5683
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5684 5684
                         $edit_icon .= '</a>';
5685 5685
 
@@ -5690,7 +5690,7 @@  discard block
 block discarded – undo
5690 5690
                                 $this->lp_session_id
5691 5691
                             )
5692 5692
                             ) {
5693
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5693
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5694 5694
                                     'action' => 'dissociate_forum',
5695 5695
                                     'id' => $arrLP[$i]['id'],
5696 5696
                                     'lp_id' => $this->lp_id
@@ -5701,7 +5701,7 @@  discard block
 block discarded – undo
5701 5701
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5702 5702
                                 );
5703 5703
                             } else {
5704
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5704
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5705 5705
                                     'action' => 'create_forum',
5706 5706
                                     'id' => $arrLP[$i]['id'],
5707 5707
                                     'lp_id' => $this->lp_id
@@ -5714,17 +5714,17 @@  discard block
 block discarded – undo
5714 5714
                             }
5715 5715
                         }
5716 5716
                     } else {
5717
-                        $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">';
5717
+                        $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">';
5718 5718
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5719 5719
                         $edit_icon .= '</a>';
5720 5720
                     }
5721 5721
                 }
5722 5722
 
5723
-                $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">';
5723
+                $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">';
5724 5724
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5725 5725
                 $delete_icon .= '</a>';
5726 5726
 
5727
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5727
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5728 5728
 
5729 5729
                 if ($arrLP[$i]['item_type'] == 'document') {
5730 5730
                     $urlPreviewLink = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
@@ -5761,8 +5761,8 @@  discard block
 block discarded – undo
5761 5761
                 }
5762 5762
             }
5763 5763
             if ($update_audio != 'true') {
5764
-                $row = $move_icon . ' ' . $icon .
5765
-                    Display::span($title_cut) .
5764
+                $row = $move_icon.' '.$icon.
5765
+                    Display::span($title_cut).
5766 5766
                     Display::tag(
5767 5767
                         'div',
5768 5768
                         "<div class=\"btn-group btn-group-xs\">$previewIcon $audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5783,8 +5783,8 @@  discard block
 block discarded – undo
5783 5783
                 $parent_arrays = array();
5784 5784
                 if ($arrLP[$i]['depth'] > 1) {
5785 5785
                     //Getting list of parents
5786
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5787
-                        foreach($arrLP as $item) {
5786
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5787
+                        foreach ($arrLP as $item) {
5788 5788
                             if ($item['id'] == $parent_id) {
5789 5789
                                 if ($item['parent_item_id'] == 0) {
5790 5790
                                     $parent_id = $item['id'];
@@ -5806,8 +5806,8 @@  discard block
 block discarded – undo
5806 5806
                     $parent_arrays = array_reverse($parent_arrays);
5807 5807
                     $val = '$elements';
5808 5808
                     $x = 0;
5809
-                    foreach($parent_arrays as $item) {
5810
-                        if ($x != count($parent_arrays) -1) {
5809
+                    foreach ($parent_arrays as $item) {
5810
+                        if ($x != count($parent_arrays) - 1) {
5811 5811
                             $val .= '["'.$item.'"]["children"]';
5812 5812
                         } else {
5813 5813
                             $val .= '["'.$item.'"]["children"]';
@@ -5876,7 +5876,7 @@  discard block
 block discarded – undo
5876 5876
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5877 5877
                     $active = 'active';
5878 5878
                 }
5879
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5879
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5880 5880
             } else {
5881 5881
                 // Sections
5882 5882
                 if (isset($item['children'])) {
@@ -5950,7 +5950,7 @@  discard block
 block discarded – undo
5950 5950
     {
5951 5951
         // Creating learning_path folder
5952 5952
         $dir = '/learning_path';
5953
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5953
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5954 5954
         $folder = false;
5955 5955
         if (!is_dir($filepath.'/'.$dir)) {
5956 5956
             $folderData = create_unexisting_directory(
@@ -5989,14 +5989,14 @@  discard block
 block discarded – undo
5989 5989
 
5990 5990
         $folder = self::generate_learning_path_folder($course);
5991 5991
         // Limits title size
5992
-        $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5992
+        $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5993 5993
         $dir = $dir.$title;
5994 5994
 
5995 5995
         // Creating LP folder
5996 5996
         $documentId = null;
5997 5997
 
5998 5998
         if ($folder) {
5999
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5999
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
6000 6000
             if (!is_dir($filepath.'/'.$dir)) {
6001 6001
                 $folderData = create_unexisting_directory(
6002 6002
                     $course,
@@ -6018,7 +6018,7 @@  discard block
 block discarded – undo
6018 6018
             }
6019 6019
             $dir = $dir.'/';
6020 6020
             if ($folder) {
6021
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
6021
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
6022 6022
             }
6023 6023
         }
6024 6024
 
@@ -6071,7 +6071,7 @@  discard block
 block discarded – undo
6071 6071
             $dir = substr($dir, 1);
6072 6072
             }
6073 6073
             if (!empty($dir[0]) && $dir[0] != '/') {
6074
-            $dir = '/' . $dir;
6074
+            $dir = '/'.$dir;
6075 6075
             }
6076 6076
             if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
6077 6077
             $dir .= '/';
@@ -6083,11 +6083,11 @@  discard block
 block discarded – undo
6083 6083
             }
6084 6084
         }
6085 6085
 
6086
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
6086
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6087 6087
 
6088 6088
         if (!is_dir($filepath)) {
6089 6089
             $dir = '/';
6090
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'.$dir;
6090
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6091 6091
         }
6092 6092
 
6093 6093
         // stripslashes() before calling api_replace_dangerous_char() because $_POST['title']
@@ -6106,11 +6106,11 @@  discard block
 block discarded – undo
6106 6106
         $tmp_filename = $filename;
6107 6107
 
6108 6108
         $i = 0;
6109
-        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6110
-            $tmp_filename = $filename . '_' . ++ $i;
6109
+        while (file_exists($filepath.$tmp_filename.'.'.$extension)) {
6110
+            $tmp_filename = $filename.'_'.++ $i;
6111 6111
         }
6112 6112
 
6113
-        $filename = $tmp_filename . '.'.$extension;
6113
+        $filename = $tmp_filename.'.'.$extension;
6114 6114
         if ($extension == 'html') {
6115 6115
             $content = stripslashes($content);
6116 6116
             $content = str_replace(
@@ -6145,12 +6145,12 @@  discard block
 block discarded – undo
6145 6145
             );
6146 6146
         }
6147 6147
 
6148
-        if (!file_exists($filepath . $filename)) {
6149
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6148
+        if (!file_exists($filepath.$filename)) {
6149
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6150 6150
                 fputs($fp, $content);
6151 6151
                 fclose($fp);
6152 6152
 
6153
-                $file_size = filesize($filepath . $filename);
6153
+                $file_size = filesize($filepath.$filename);
6154 6154
                 $save_file_path = $dir.$filename;
6155 6155
 
6156 6156
                 $document_id = add_document(
@@ -6182,9 +6182,9 @@  discard block
 block discarded – undo
6182 6182
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6183 6183
                         $ct = '';
6184 6184
                         if ($new_comment)
6185
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6185
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6186 6186
                         if ($new_title)
6187
-                            $ct .= ", title='" . Database::escape_string($new_title)."' ";
6187
+                            $ct .= ", title='".Database::escape_string($new_title)."' ";
6188 6188
 
6189 6189
                         $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6190 6190
                                 WHERE c_id = ".$course_id." AND id = ".$document_id;
@@ -6216,42 +6216,42 @@  discard block
 block discarded – undo
6216 6216
             $dir = substr($dir, 1);
6217 6217
 
6218 6218
         if ($dir[0] != '/')
6219
-            $dir = '/' . $dir;
6219
+            $dir = '/'.$dir;
6220 6220
 
6221 6221
         if ($dir[strlen($dir) - 1] != '/')
6222 6222
             $dir .= '/';
6223 6223
 
6224
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6224
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6225 6225
 
6226 6226
         if (!is_dir($filepath)) {
6227
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6227
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6228 6228
             $dir = '/';
6229 6229
         }
6230 6230
 
6231 6231
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6232 6232
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6233 6233
             $document_id = intval($_POST['path']);
6234
-            $sql = "SELECT path FROM " . $table_doc . "
6235
-                    WHERE c_id = $course_id AND id = " . $document_id;
6234
+            $sql = "SELECT path FROM ".$table_doc."
6235
+                    WHERE c_id = $course_id AND id = ".$document_id;
6236 6236
             $res = Database::query($sql);
6237 6237
             $row = Database :: fetch_array($res);
6238 6238
             $content = stripslashes($_POST['content_lp']);
6239
-            $file = $filepath . $row['path'];
6239
+            $file = $filepath.$row['path'];
6240 6240
 
6241 6241
             if ($fp = @ fopen($file, 'w')) {
6242
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $urlAppend . '/courses/', $content);
6242
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $urlAppend.'/courses/', $content);
6243 6243
 
6244 6244
                 // Change the path of mp3 to absolute.
6245 6245
                 // The first regexp deals with :// urls.
6246
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6246
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6247 6247
                 // The second regexp deals with audio/ urls.
6248
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6248
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6249 6249
                 fputs($fp, $content);
6250 6250
                 fclose($fp);
6251 6251
 
6252
-                $sql = "UPDATE " . $table_doc ." SET
6252
+                $sql = "UPDATE ".$table_doc." SET
6253 6253
                             title='".Database::escape_string($_POST['title'])."'
6254
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6254
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6255 6255
                 Database::query($sql);
6256 6256
             }
6257 6257
         }
@@ -6269,10 +6269,10 @@  discard block
 block discarded – undo
6269 6269
         $return = '';
6270 6270
         if (is_numeric($item_id)) {
6271 6271
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6272
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6273
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6272
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6273
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6274 6274
             $result = Database::query($sql);
6275
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6275
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6276 6276
                 $valueId = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6277 6277
                 Session::write('parent_item_id', $valueId);
6278 6278
 
@@ -6305,8 +6305,8 @@  discard block
 block discarded – undo
6305 6305
                         break;
6306 6306
                     case TOOL_DOCUMENT:
6307 6307
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6308
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6309
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6308
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6309
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6310 6310
                         $result = Database::query($sql_doc);
6311 6311
                         $path_file = Database::result($result, 0, 0);
6312 6312
                         $path_parts = pathinfo($path_file);
@@ -6345,7 +6345,7 @@  discard block
 block discarded – undo
6345 6345
         if (is_numeric($item_id)) {
6346 6346
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6347 6347
             $sql = "SELECT * FROM $tbl_lp_item
6348
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6348
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6349 6349
             $res = Database::query($sql);
6350 6350
             $row = Database::fetch_array($res);
6351 6351
 
@@ -6356,21 +6356,21 @@  discard block
 block discarded – undo
6356 6356
                 case 'sco' :
6357 6357
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6358 6358
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6359
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6359
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6360 6360
                     } else {
6361
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6361
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6362 6362
                     }
6363 6363
                     break;
6364 6364
                 case TOOL_DOCUMENT :
6365 6365
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6366 6366
                     $sql = "SELECT lp.*, doc.path as dir
6367
-                            FROM " . $tbl_lp_item . " as lp
6368
-                            LEFT JOIN " . $tbl_doc . " as doc
6367
+                            FROM " . $tbl_lp_item." as lp
6368
+                            LEFT JOIN " . $tbl_doc." as doc
6369 6369
                             ON doc.id = lp.path
6370 6370
                             WHERE
6371 6371
                                 lp.c_id = $course_id AND
6372 6372
                                 doc.c_id = $course_id AND
6373
-                                lp.id = " . intval($item_id);
6373
+                                lp.id = ".intval($item_id);
6374 6374
                     $res_step = Database::query($sql);
6375 6375
                     $row_step = Database :: fetch_array($res_step);
6376 6376
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6380,8 +6380,8 @@  discard block
 block discarded – undo
6380 6380
                     $link_id = (string) $row['path'];
6381 6381
                     if (ctype_digit($link_id)) {
6382 6382
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6383
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6384
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6383
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6384
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6385 6385
                         $res_link = Database::query($sql_select);
6386 6386
                         $row_link = Database :: fetch_array($res_link);
6387 6387
                         if (is_array($row_link)) {
@@ -6394,9 +6394,9 @@  discard block
 block discarded – undo
6394 6394
                 case 'dokeos_module' :
6395 6395
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6396 6396
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6397
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6397
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6398 6398
                     } else {
6399
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6399
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6400 6400
                     }
6401 6401
                     break;
6402 6402
                 case TOOL_QUIZ :
@@ -6451,7 +6451,7 @@  discard block
 block discarded – undo
6451 6451
 
6452 6452
         $headers = array(
6453 6453
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6454
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6454
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6455 6455
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6456 6456
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6457 6457
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6495,16 +6495,16 @@  discard block
 block discarded – undo
6495 6495
         $course_id = api_get_course_int_id();
6496 6496
         $return = '';
6497 6497
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6498
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6499
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6498
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6499
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6500 6500
         $res_doc = Database::query($sql_doc);
6501 6501
         $row_doc = Database :: fetch_array($res_doc);
6502 6502
 
6503 6503
         // TODO: Add a path filter.
6504 6504
         if ($iframe) {
6505
-            $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>';
6505
+            $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>';
6506 6506
         } else {
6507
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6507
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6508 6508
         }
6509 6509
 
6510 6510
         return $return;
@@ -6528,8 +6528,8 @@  discard block
 block discarded – undo
6528 6528
             $item_description = $extra_info['description'];
6529 6529
         } elseif (is_numeric($extra_info)) {
6530 6530
             $sql = "SELECT title, description
6531
-                    FROM " . $tbl_quiz . "
6532
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6531
+                    FROM " . $tbl_quiz."
6532
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6533 6533
 
6534 6534
             $result = Database::query($sql);
6535 6535
             $row = Database::fetch_array($result);
@@ -6539,21 +6539,21 @@  discard block
 block discarded – undo
6539 6539
             $item_title = '';
6540 6540
             $item_description = '';
6541 6541
         }
6542
-        $item_title			= Security::remove_XSS($item_title);
6543
-        $item_description 	= Security::remove_XSS($item_description);
6542
+        $item_title = Security::remove_XSS($item_title);
6543
+        $item_description = Security::remove_XSS($item_description);
6544 6544
 
6545 6545
         if ($id != 0 && is_array($extra_info))
6546 6546
             $parent = $extra_info['parent_item_id'];
6547 6547
         else
6548 6548
             $parent = 0;
6549 6549
 
6550
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6551
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6550
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6551
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6552 6552
 
6553 6553
         $result = Database::query($sql);
6554
-        $arrLP = array ();
6554
+        $arrLP = array();
6555 6555
         while ($row = Database :: fetch_array($result)) {
6556
-            $arrLP[] = array (
6556
+            $arrLP[] = array(
6557 6557
                 'id' => $row['id'],
6558 6558
                 'item_type' => $row['item_type'],
6559 6559
                 'title' => $row['title'],
@@ -6575,7 +6575,7 @@  discard block
 block discarded – undo
6575 6575
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6576 6576
         unset ($this->arrMenu);
6577 6577
 
6578
-        $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6578
+        $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6579 6579
         $defaults = [];
6580 6580
 
6581 6581
         if ($action == 'add') {
@@ -6587,7 +6587,7 @@  discard block
 block discarded – undo
6587 6587
         }
6588 6588
 
6589 6589
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6590
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6590
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6591 6591
         }
6592 6592
 
6593 6593
         $form->addHeader($legend);
@@ -6606,7 +6606,7 @@  discard block
 block discarded – undo
6606 6606
         );
6607 6607
         $selectParent->addOption($this->name, 0);
6608 6608
 
6609
-        $arrHide = array (
6609
+        $arrHide = array(
6610 6610
             $id
6611 6611
         );
6612 6612
         for ($i = 0; $i < count($arrLP); $i++) {
@@ -6623,7 +6623,7 @@  discard block
 block discarded – undo
6623 6623
                     $selectParent->addOption(
6624 6624
                         $arrLP[$i]['title'],
6625 6625
                         $arrLP[$i]['id'],
6626
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6626
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6627 6627
                     );
6628 6628
 
6629 6629
                     if ($parent == $arrLP[$i]['id']) {
@@ -6640,7 +6640,7 @@  discard block
 block discarded – undo
6640 6640
                 ) {
6641 6641
                     $selectParent->addOption(
6642 6642
                         $arrLP[$i]['title'],
6643
-                        $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6643
+                        $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6644 6644
                     );
6645 6645
 
6646 6646
                     if ($parent == $arrLP[$i]['id']) {
@@ -6658,7 +6658,7 @@  discard block
 block discarded – undo
6658 6658
 
6659 6659
         for ($i = 0; $i < count($arrLP); $i++) {
6660 6660
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6661
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
6661
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
6662 6662
 
6663 6663
                 if (is_array($extra_info)) {
6664 6664
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
@@ -6680,7 +6680,7 @@  discard block
 block discarded – undo
6680 6680
                     }
6681 6681
                 }
6682 6682
             }
6683
-            $arrHide = array ();
6683
+            $arrHide = array();
6684 6684
             for ($i = 0; $i < count($arrLP); $i++) {
6685 6685
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6686 6686
                     if (is_array($extra_info)) {
@@ -6745,7 +6745,7 @@  discard block
 block discarded – undo
6745 6745
 
6746 6746
         $form->setDefaults($defaults);
6747 6747
 
6748
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
6748
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
6749 6749
     }
6750 6750
 
6751 6751
     /**
@@ -6767,11 +6767,11 @@  discard block
 block discarded – undo
6767 6767
         } elseif (is_numeric($extra_info)) {
6768 6768
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6769 6769
 
6770
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6770
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6771 6771
                     WHERE
6772 6772
                         c_id = ".$course_id." AND
6773
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6774
-                        id = " . (int) $extra_info . "
6773
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6774
+                        id = " . (int) $extra_info."
6775 6775
                     ORDER BY id ASC";
6776 6776
 
6777 6777
             $res_hot = Database::query($sql);
@@ -6795,11 +6795,11 @@  discard block
 block discarded – undo
6795 6795
         }
6796 6796
 
6797 6797
         $sql = "SELECT * FROM $tbl_lp_item
6798
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6798
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6799 6799
         $result = Database::query($sql);
6800
-        $arrLP = array ();
6800
+        $arrLP = array();
6801 6801
         while ($row = Database :: fetch_array($result)) {
6802
-            $arrLP[] = array (
6802
+            $arrLP[] = array(
6803 6803
                 'id' => $row['id'],
6804 6804
                 'item_type' => $row['item_type'],
6805 6805
                 'title' => $row['title'],
@@ -6824,7 +6824,7 @@  discard block
 block discarded – undo
6824 6824
         else
6825 6825
             $legend .= get_lang('EditCurrentExecice');
6826 6826
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6827
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6827
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6828 6828
         }
6829 6829
         $legend .= '</legend>';
6830 6830
 
@@ -6832,11 +6832,11 @@  discard block
 block discarded – undo
6832 6832
         $return .= $legend;
6833 6833
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6834 6834
         $return .= '<tr>';
6835
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6835
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6836 6836
         $return .= '<td class="input">';
6837 6837
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6838
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6839
-        $arrHide = array (
6838
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6839
+        $arrHide = array(
6840 6840
             $id
6841 6841
         );
6842 6842
 
@@ -6844,13 +6844,13 @@  discard block
 block discarded – undo
6844 6844
             for ($i = 0; $i < count($arrLP); $i++) {
6845 6845
                 if ($action != 'add') {
6846 6846
                     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)) {
6847
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6847
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6848 6848
                     } else {
6849 6849
                         $arrHide[] = $arrLP[$i]['id'];
6850 6850
                     }
6851 6851
                 } else {
6852 6852
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6853
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6853
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6854 6854
                 }
6855 6855
             }
6856 6856
 
@@ -6861,10 +6861,10 @@  discard block
 block discarded – undo
6861 6861
         $return .= '</td>';
6862 6862
         $return .= '</tr>';
6863 6863
         $return .= '<tr>';
6864
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6864
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6865 6865
         $return .= '<td class="input">';
6866 6866
         $return .= '<select id="previous" name="previous" size="1">';
6867
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6867
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6868 6868
 
6869 6869
         for ($i = 0; $i < count($arrLP); $i++) {
6870 6870
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6874,7 +6874,7 @@  discard block
 block discarded – undo
6874 6874
                 else
6875 6875
                     $selected = '';
6876 6876
 
6877
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6877
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6878 6878
             }
6879 6879
         }
6880 6880
 
@@ -6884,8 +6884,8 @@  discard block
 block discarded – undo
6884 6884
 
6885 6885
         if ($action != 'move') {
6886 6886
             $return .= '<tr>';
6887
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6888
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6887
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6888
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6889 6889
             $return .= '</tr>';
6890 6890
             $id_prerequisite = 0;
6891 6891
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6896,7 +6896,7 @@  discard block
 block discarded – undo
6896 6896
                     }
6897 6897
                 }
6898 6898
 
6899
-                $arrHide = array ();
6899
+                $arrHide = array();
6900 6900
                 for ($i = 0; $i < count($arrLP); $i++) {
6901 6901
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6902 6902
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6910,22 +6910,22 @@  discard block
 block discarded – undo
6910 6910
         }
6911 6911
 
6912 6912
         $return .= '<tr>';
6913
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6913
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6914 6914
         $return .= '</tr>';
6915 6915
         $return .= '</table>';
6916 6916
 
6917 6917
         if ($action == 'move') {
6918
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6919
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6918
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6919
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6920 6920
         }
6921 6921
 
6922 6922
         if (is_numeric($extra_info)) {
6923
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6923
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6924 6924
         } elseif (is_array($extra_info)) {
6925
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6925
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6926 6926
         }
6927
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6928
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6927
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6928
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6929 6929
         $return .= '</form>';
6930 6930
 
6931 6931
         return $return;
@@ -6948,8 +6948,8 @@  discard block
 block discarded – undo
6948 6948
             $item_title = stripslashes($extra_info['title']);
6949 6949
         } elseif (is_numeric($extra_info)) {
6950 6950
             $sql = "SELECT forum_title as title, forum_comment as comment
6951
-                    FROM " . $tbl_forum . "
6952
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6951
+                    FROM " . $tbl_forum."
6952
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6953 6953
 
6954 6954
             $result = Database::query($sql);
6955 6955
             $row = Database :: fetch_array($result);
@@ -6967,7 +6967,7 @@  discard block
 block discarded – undo
6967 6967
             $parent = 0;
6968 6968
         }
6969 6969
 
6970
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6970
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6971 6971
                 WHERE
6972 6972
                     c_id = ".$course_id." AND
6973 6973
                     lp_id = " . $this->lp_id;
@@ -6975,7 +6975,7 @@  discard block
 block discarded – undo
6975 6975
         $arrLP = array();
6976 6976
 
6977 6977
         while ($row = Database :: fetch_array($result)) {
6978
-            $arrLP[] = array (
6978
+            $arrLP[] = array(
6979 6979
                 'id' => $row['id'],
6980 6980
                 'item_type' => $row['item_type'],
6981 6981
                 'title' => $row['title'],
@@ -7004,7 +7004,7 @@  discard block
 block discarded – undo
7004 7004
             $legend = get_lang('EditCurrentForum');
7005 7005
         }
7006 7006
 
7007
-        $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7007
+        $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7008 7008
         $defaults = [];
7009 7009
 
7010 7010
         $form->addHeader($legend);
@@ -7032,7 +7032,7 @@  discard block
 block discarded – undo
7032 7032
                     $selectParent->addOption(
7033 7033
                         $arrLP[$i]['title'],
7034 7034
                         $arrLP[$i]['id'],
7035
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7035
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7036 7036
                     );
7037 7037
 
7038 7038
                     if ($parent == $arrLP[$i]['id']) {
@@ -7050,7 +7050,7 @@  discard block
 block discarded – undo
7050 7050
                     $selectParent->addOption(
7051 7051
                         $arrLP[$i]['title'],
7052 7052
                         $arrLP[$i]['id'],
7053
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7053
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7054 7054
                     );
7055 7055
 
7056 7056
                     if ($parent == $arrLP[$i]['id']) {
@@ -7073,7 +7073,7 @@  discard block
 block discarded – undo
7073 7073
 
7074 7074
         for ($i = 0; $i < count($arrLP); $i++) {
7075 7075
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7076
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
7076
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
7077 7077
 
7078 7078
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7079 7079
                     $selectPrevious->setSelected($arrLP[$i]['id']);
@@ -7125,7 +7125,7 @@  discard block
 block discarded – undo
7125 7125
         $form->addHidden('post_time', time());
7126 7126
         $form->setDefaults($defaults);
7127 7127
 
7128
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
7128
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
7129 7129
     }
7130 7130
 
7131 7131
     /**
@@ -7148,7 +7148,7 @@  discard block
 block discarded – undo
7148 7148
             $item_title = stripslashes($extra_info['title']);
7149 7149
         } elseif (is_numeric($extra_info)) {
7150 7150
             $sql = "SELECT thread_title as title FROM $tbl_forum
7151
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7151
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7152 7152
 
7153 7153
             $result = Database::query($sql);
7154 7154
             $row = Database :: fetch_array($result);
@@ -7166,15 +7166,15 @@  discard block
 block discarded – undo
7166 7166
             $parent = 0;
7167 7167
         }
7168 7168
 
7169
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7170
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7169
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7170
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7171 7171
 
7172 7172
         $result = Database::query($sql);
7173 7173
 
7174
-        $arrLP = array ();
7174
+        $arrLP = array();
7175 7175
 
7176 7176
         while ($row = Database :: fetch_array($result)) {
7177
-            $arrLP[] = array (
7177
+            $arrLP[] = array(
7178 7178
                 'id' => $row['id'],
7179 7179
                 'item_type' => $row['item_type'],
7180 7180
                 'title' => $row['title'],
@@ -7195,7 +7195,7 @@  discard block
 block discarded – undo
7195 7195
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7196 7196
         unset ($this->arrMenu);
7197 7197
 
7198
-        $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7198
+        $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7199 7199
         $defaults = [];
7200 7200
 
7201 7201
         if ($action == 'add') {
@@ -7215,7 +7215,7 @@  discard block
 block discarded – undo
7215 7215
         );
7216 7216
         $selectParent->addOption($this->name, 0);
7217 7217
 
7218
-        $arrHide = array (
7218
+        $arrHide = array(
7219 7219
             $id
7220 7220
         );
7221 7221
 
@@ -7233,7 +7233,7 @@  discard block
 block discarded – undo
7233 7233
                     $selectParent->addOption(
7234 7234
                         $arrLP[$i]['title'],
7235 7235
                         $arrLP[$i]['id'],
7236
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7236
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7237 7237
                     );
7238 7238
 
7239 7239
                     if ($parent == $arrLP[$i]['id']) {
@@ -7251,7 +7251,7 @@  discard block
 block discarded – undo
7251 7251
                     $selectParent->addOption(
7252 7252
                         $arrLP[$i]['title'],
7253 7253
                         $arrLP[$i]['id'],
7254
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7254
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7255 7255
                     );
7256 7256
 
7257 7257
                     if ($parent == $arrLP[$i]['id']) {
@@ -7271,7 +7271,7 @@  discard block
 block discarded – undo
7271 7271
         for ($i = 0; $i < count($arrLP); $i++) {
7272 7272
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7273 7273
                 $selectPrevious->addOption(
7274
-                    get_lang('After')  . ' "' . $arrLP[$i]['title'] . '"',
7274
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
7275 7275
                     $arrLP[$i]['id']
7276 7276
                 );
7277 7277
 
@@ -7369,10 +7369,10 @@  discard block
 block discarded – undo
7369 7369
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7370 7370
 
7371 7371
         if ($id != 0 && is_array($extra_info)) {
7372
-            $item_title 		= $extra_info['title'];
7373
-            $item_description 	= $extra_info['description'];
7374
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7375
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7372
+            $item_title = $extra_info['title'];
7373
+            $item_description = $extra_info['description'];
7374
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7375
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7376 7376
         } else {
7377 7377
             $item_title = '';
7378 7378
             $item_description = '';
@@ -7386,17 +7386,17 @@  discard block
 block discarded – undo
7386 7386
         }
7387 7387
 
7388 7388
         $id  = intval($id);
7389
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7389
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7390 7390
                 WHERE
7391 7391
                     c_id = ".$course_id." AND
7392
-                    lp_id = " . $this->lp_id . " AND
7392
+                    lp_id = " . $this->lp_id." AND
7393 7393
                     id != $id";
7394 7394
 
7395 7395
         if ($item_type == 'module')
7396 7396
             $sql .= " AND parent_item_id = 0";
7397 7397
 
7398 7398
         $result = Database::query($sql);
7399
-        $arrLP = array ();
7399
+        $arrLP = array();
7400 7400
 
7401 7401
         while ($row = Database :: fetch_array($result)) {
7402 7402
             $arrLP[] = array(
@@ -7422,9 +7422,9 @@  discard block
 block discarded – undo
7422 7422
 
7423 7423
         unset ($this->arrMenu);
7424 7424
 
7425
-        $url = api_get_self() . '?' .api_get_cidreq().'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7425
+        $url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7426 7426
 
7427
-        $form = new FormValidator('form', 'POST',  $url);
7427
+        $form = new FormValidator('form', 'POST', $url);
7428 7428
 
7429 7429
         $defaults['title'] = !empty($item_title) ? api_html_entity_decode($item_title, ENT_QUOTES, $charset) : '';
7430 7430
         $defaults['description'] = $item_description;
@@ -7477,7 +7477,7 @@  discard block
 block discarded – undo
7477 7477
             );
7478 7478
 
7479 7479
             foreach ($arrHide as $key => $value) {
7480
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7480
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7481 7481
             }
7482 7482
             if (!empty($s_selected_parent)) {
7483 7483
                 $parent_select->setSelected($s_selected_parent);
@@ -7499,16 +7499,16 @@  discard block
 block discarded – undo
7499 7499
                     $s_selected_position = $arrLP[$i]['id'];
7500 7500
                 }
7501 7501
 
7502
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7502
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7503 7503
             }
7504 7504
         }
7505 7505
 
7506 7506
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7507 7507
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7508
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7508
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7509 7509
 
7510 7510
         foreach ($arrHide as $key => $value) {
7511
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7511
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7512 7512
         }
7513 7513
 
7514 7514
         if (!empty ($s_selected_position)) {
@@ -7537,10 +7537,10 @@  discard block
 block discarded – undo
7537 7537
         //assets can't be modified
7538 7538
 
7539 7539
         //$item_type == 'asset' ||
7540
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7540
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7541 7541
 
7542 7542
             if ($item_type == 'sco') {
7543
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7543
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7544 7544
             }
7545 7545
             $renderer = $form->defaultRenderer();
7546 7546
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
@@ -7563,7 +7563,7 @@  discard block
 block discarded – undo
7563 7563
             $defaults['content_lp'] = file_get_contents($content_path);
7564 7564
         }
7565 7565
 
7566
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7566
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7567 7567
         $form->addElement('hidden', 'post_time', time());
7568 7568
         $form->setDefaults($defaults);
7569 7569
         return $form->return_form();
@@ -7601,8 +7601,8 @@  discard block
 block discarded – undo
7601 7601
         // We don't display the document form if it's not an editable document (html or txt file).
7602 7602
         if ($action == "add") {
7603 7603
             if (is_numeric($extra_info)) {
7604
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7605
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7604
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7605
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7606 7606
                 $result = Database::query($sql_doc);
7607 7607
                 $path_file = Database :: result($result, 0, 0);
7608 7608
                 $path_parts = pathinfo($path_file);
@@ -7620,13 +7620,13 @@  discard block
 block discarded – undo
7620 7620
                 $item_title = stripslashes($path_parts['filename']);
7621 7621
             }
7622 7622
         } elseif (is_numeric($extra_info)) {
7623
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7623
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7624 7624
                         WHERE
7625 7625
                             c_id = ".$course_id." AND
7626 7626
                             id = " . intval($extra_info);
7627 7627
 
7628 7628
             $result = Database::query($sql_doc);
7629
-            $row 	= Database::fetch_array($result);
7629
+            $row = Database::fetch_array($result);
7630 7630
             $item_title = $row['title'];
7631 7631
             $item_title = str_replace('_', ' ', $item_title);
7632 7632
             if (empty ($item_title)) {
@@ -7645,11 +7645,11 @@  discard block
 block discarded – undo
7645 7645
             $parent = 0;
7646 7646
         }
7647 7647
 
7648
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7649
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7648
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7649
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7650 7650
 
7651 7651
         $result = Database::query($sql);
7652
-        $arrLP = array ();
7652
+        $arrLP = array();
7653 7653
         while ($row = Database :: fetch_array($result)) {
7654 7654
             $arrLP[] = array(
7655 7655
                 'id' => $row['id'],
@@ -7683,9 +7683,9 @@  discard block
 block discarded – undo
7683 7683
         $return .= '</legend>';
7684 7684
 
7685 7685
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7686
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7686
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7687 7687
         }
7688
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7688
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7689 7689
         $defaults['title'] = Security :: remove_XSS($item_title);
7690 7690
         if (empty($item_title)) {
7691 7691
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7741,15 +7741,15 @@  discard block
 block discarded – undo
7741 7741
         }
7742 7742
 
7743 7743
         $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']);
7744
-        $my_count=0;
7744
+        $my_count = 0;
7745 7745
         foreach ($arrHide as $key => $value) {
7746
-            if ($my_count!=0) {
7746
+            if ($my_count != 0) {
7747 7747
                 // The LP name is also the first section and is not in the same charset like the other sections.
7748 7748
                 $value['value'] = Security :: remove_XSS($value['value']);
7749
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7749
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7750 7750
             } else {
7751 7751
                 $value['value'] = Security :: remove_XSS($value['value']);
7752
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7752
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7753 7753
             }
7754 7754
             $my_count++;
7755 7755
         }
@@ -7774,7 +7774,7 @@  discard block
 block discarded – undo
7774 7774
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7775 7775
                     $s_selected_position = $arrLP[$i]['id'];
7776 7776
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7777
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7777
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7778 7778
             }
7779 7779
         }
7780 7780
 
@@ -7782,8 +7782,8 @@  discard block
 block discarded – undo
7782 7782
         $position->addOption(get_lang('FirstPosition'), 0);
7783 7783
 
7784 7784
         foreach ($arrHide as $key => $value) {
7785
-            $padding = isset($value['padding']) ? $value['padding']: 20;
7786
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7785
+            $padding = isset($value['padding']) ? $value['padding'] : 20;
7786
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7787 7787
         }
7788 7788
         $position->setSelected($s_selected_position);
7789 7789
 
@@ -7853,7 +7853,7 @@  discard block
 block discarded – undo
7853 7853
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7854 7854
                             $relative_path 	 = implode('/', $relative_path);
7855 7855
                             if (strlen($relative_path) > 0) {
7856
-                                $relative_path = $relative_path . '/';
7856
+                                $relative_path = $relative_path.'/';
7857 7857
                             }
7858 7858
                         } else {
7859 7859
                             $result = $this->generate_lp_folder($_course);
@@ -7932,8 +7932,8 @@  discard block
 block discarded – undo
7932 7932
             $item_url = stripslashes($extra_info['url']);
7933 7933
         } elseif (is_numeric($extra_info)) {
7934 7934
             $extra_info = intval($extra_info);
7935
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7936
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7935
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7936
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7937 7937
             $result = Database::query($sql);
7938 7938
             $row = Database :: fetch_array($result);
7939 7939
             $item_title       = $row['title'];
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
             $item_url = '';
7946 7946
         }
7947 7947
 
7948
-        $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7948
+        $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7949 7949
         $defaults = [];
7950 7950
 
7951 7951
         if ($id != 0 && is_array($extra_info)) {
@@ -7954,8 +7954,8 @@  discard block
 block discarded – undo
7954 7954
             $parent = 0;
7955 7955
         }
7956 7956
 
7957
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7958
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7957
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7958
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7959 7959
         $result = Database::query($sql);
7960 7960
         $arrLP = array();
7961 7961
 
@@ -8023,7 +8023,7 @@  discard block
 block discarded – undo
8023 8023
                     $selectParent->addOption(
8024 8024
                         $arrLP[$i]['title'],
8025 8025
                         $arrLP[$i]['id'],
8026
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;']
8026
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;']
8027 8027
                     );
8028 8028
 
8029 8029
                     if ($parent == $arrLP[$i]['id']) {
@@ -8037,7 +8037,7 @@  discard block
 block discarded – undo
8037 8037
                     $selectParent->addOption(
8038 8038
                         $arrLP[$i]['title'],
8039 8039
                         $arrLP[$i]['id'],
8040
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
8040
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
8041 8041
                     );
8042 8042
 
8043 8043
                     if ($parent_item_id == $arrLP[$i]['id']) {
@@ -8124,7 +8124,7 @@  discard block
 block discarded – undo
8124 8124
 
8125 8125
         $form->setDefaults($defaults);
8126 8126
 
8127
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
8127
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
8128 8128
     }
8129 8129
 
8130 8130
     /**
@@ -8146,8 +8146,8 @@  discard block
 block discarded – undo
8146 8146
         } elseif (is_numeric($extra_info)) {
8147 8147
             $extra_info = intval($extra_info);
8148 8148
             $sql = "SELECT title, description
8149
-                    FROM " . $tbl_publication . "
8150
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
8149
+                    FROM " . $tbl_publication."
8150
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
8151 8151
 
8152 8152
             $result = Database::query($sql);
8153 8153
             $row = Database :: fetch_array($result);
@@ -8163,13 +8163,13 @@  discard block
 block discarded – undo
8163 8163
             $parent = 0;
8164 8164
         }
8165 8165
 
8166
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8167
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8166
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8167
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8168 8168
 
8169 8169
         $result = Database::query($sql);
8170 8170
         $arrLP = array();
8171 8171
         while ($row = Database :: fetch_array($result)) {
8172
-            $arrLP[] = array (
8172
+            $arrLP[] = array(
8173 8173
                 'id' => $row['id'],
8174 8174
                 'item_type' => $row['item_type'],
8175 8175
                 'title' => $row['title'],
@@ -8215,7 +8215,7 @@  discard block
 block discarded – undo
8215 8215
             ]
8216 8216
         );
8217 8217
 
8218
-        $arrHide = array (
8218
+        $arrHide = array(
8219 8219
             $id
8220 8220
         );
8221 8221
 
@@ -8233,7 +8233,7 @@  discard block
 block discarded – undo
8233 8233
                     $parentSelect->addOption(
8234 8234
                         $arrLP[$i]['title'],
8235 8235
                         $arrLP[$i]['id'],
8236
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8236
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8237 8237
                     );
8238 8238
 
8239 8239
                     if ($parent == $arrLP[$i]['id']) {
@@ -8250,7 +8250,7 @@  discard block
 block discarded – undo
8250 8250
                     $parentSelect->addOption(
8251 8251
                         $arrLP[$i]['title'],
8252 8252
                         $arrLP[$i]['id'],
8253
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8253
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8254 8254
                     );
8255 8255
 
8256 8256
                     if ($parent == $arrLP[$i]['id']) {
@@ -8274,7 +8274,7 @@  discard block
 block discarded – undo
8274 8274
         for ($i = 0; $i < count($arrLP); $i++) {
8275 8275
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8276 8276
                 $previousSelect->addOption(
8277
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8277
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8278 8278
                     $arrLP[$i]['id']
8279 8279
                 );
8280 8280
 
@@ -8296,7 +8296,7 @@  discard block
 block discarded – undo
8296 8296
                     }
8297 8297
                 }
8298 8298
             }
8299
-            $arrHide = array ();
8299
+            $arrHide = array();
8300 8300
             for ($i = 0; $i < count($arrLP); $i++) {
8301 8301
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8302 8302
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8388,8 +8388,8 @@  discard block
 block discarded – undo
8388 8388
 
8389 8389
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8390 8390
         $item_id = intval($item_id);
8391
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8392
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8391
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8392
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8393 8393
         $result = Database::query($sql);
8394 8394
         $row = Database::fetch_assoc($result);
8395 8395
 
@@ -8403,16 +8403,16 @@  discard block
 block discarded – undo
8403 8403
             $audio_player .= '<script>
8404 8404
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8405 8405
                                 s1.addParam("allowscriptaccess","always");
8406
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8406
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8407 8407
                                 s1.write("container");
8408 8408
                             </script>';
8409 8409
         }
8410 8410
 
8411
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8411
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8412 8412
 
8413 8413
         $return .= Display::url(
8414 8414
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8415
-            $url.'&action=edit_item&path_item=' . $row['path']
8415
+            $url.'&action=edit_item&path_item='.$row['path']
8416 8416
         );
8417 8417
 
8418 8418
         $return .= Display::url(
@@ -8432,12 +8432,12 @@  discard block
 block discarded – undo
8432 8432
             $url.'&action=delete_item'
8433 8433
         );
8434 8434
 
8435
-        if ($item_type == TOOL_HOTPOTATOES ) {
8435
+        if ($item_type == TOOL_HOTPOTATOES) {
8436 8436
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8437 8437
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8438 8438
         }
8439 8439
 
8440
-        if ($item_type == TOOL_DOCUMENT ) {
8440
+        if ($item_type == TOOL_DOCUMENT) {
8441 8441
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8442 8442
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8443 8443
         }
@@ -8458,13 +8458,13 @@  discard block
 block discarded – undo
8458 8458
     public function get_js_dropdown_array()
8459 8459
     {
8460 8460
         $course_id = api_get_course_int_id();
8461
-        $return = 'var child_name = new Array();' . "\n";
8462
-        $return .= 'var child_value = new Array();' . "\n\n";
8463
-        $return .= 'child_name[0] = new Array();' . "\n";
8464
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8461
+        $return = 'var child_name = new Array();'."\n";
8462
+        $return .= 'var child_value = new Array();'."\n\n";
8463
+        $return .= 'child_name[0] = new Array();'."\n";
8464
+        $return .= 'child_value[0] = new Array();'."\n\n";
8465 8465
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8466
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8467
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8466
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8467
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8468 8468
                     ORDER BY display_order ASC";
8469 8469
         $res_zero = Database::query($sql_zero);
8470 8470
         $i = 0;
@@ -8474,28 +8474,28 @@  discard block
 block discarded – undo
8474 8474
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8475 8475
             }
8476 8476
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8477
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8478
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8477
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8478
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8479 8479
         }
8480 8480
         $return .= "\n";
8481
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8482
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8481
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8482
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8483 8483
         $res = Database::query($sql);
8484 8484
         while ($row = Database :: fetch_array($res)) {
8485
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8485
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8486 8486
                            WHERE
8487 8487
                                 c_id = ".$course_id." AND
8488
-                                parent_item_id = " . $row['id'] . "
8488
+                                parent_item_id = " . $row['id']."
8489 8489
                            ORDER BY display_order ASC";
8490 8490
             $res_parent = Database::query($sql_parent);
8491 8491
             $i = 0;
8492
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8493
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8492
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8493
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8494 8494
 
8495 8495
             while ($row_parent = Database :: fetch_array($res_parent)) {
8496 8496
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8497
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8498
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8497
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8498
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8499 8499
             }
8500 8500
             $return .= "\n";
8501 8501
         }
@@ -8516,8 +8516,8 @@  discard block
 block discarded – undo
8516 8516
         if (is_numeric($item_id)) {
8517 8517
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8518 8518
 
8519
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8520
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8519
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8520
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8521 8521
 
8522 8522
             $res = Database::query($sql);
8523 8523
             $row = Database :: fetch_array($res);
@@ -8576,7 +8576,7 @@  discard block
 block discarded – undo
8576 8576
      */
8577 8577
     public function display_item_small_form($item_type, $title = '', $data = array())
8578 8578
     {
8579
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8579
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8580 8580
         $form = new FormValidator('small_form', 'post', $url);
8581 8581
         $form->addElement('header', $title);
8582 8582
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8602,7 +8602,7 @@  discard block
 block discarded – undo
8602 8602
         $item_id = intval($item_id);
8603 8603
         /* Current prerequisite */
8604 8604
         $sql = "SELECT * FROM $tbl_lp_item
8605
-                WHERE c_id = $course_id AND id = " . $item_id;
8605
+                WHERE c_id = $course_id AND id = ".$item_id;
8606 8606
         $result = Database::query($sql);
8607 8607
         $row    = Database::fetch_array($result);
8608 8608
         $prerequisiteId = $row['prerequisite'];
@@ -8612,20 +8612,20 @@  discard block
 block discarded – undo
8612 8612
         $return .= '<form method="POST">';
8613 8613
         $return .= '<table class="data_table">';
8614 8614
         $return .= '<tr>';
8615
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8616
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8617
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8615
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8616
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8617
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8618 8618
         $return .= '</tr>';
8619 8619
 
8620 8620
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8621 8621
         $return .= '<tr >';
8622 8622
         $return .= '<td colspan="3" class="radio">';
8623 8623
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8624
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8624
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8625 8625
         $return .= '</tr>';
8626 8626
 
8627 8627
         $sql = "SELECT * FROM $tbl_lp_item
8628
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8628
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8629 8629
         $result = Database::query($sql);
8630 8630
         $arrLP = array();
8631 8631
 
@@ -8668,25 +8668,25 @@  discard block
 block discarded – undo
8668 8668
             }
8669 8669
 
8670 8670
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8671
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8671
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8672 8672
 
8673 8673
             $return .= '<tr>';
8674
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8675
-            $return .= '<label for="id' . $item['id'] . '">';
8676
-            $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'] . '" />';
8674
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8675
+            $return .= '<label for="id'.$item['id'].'">';
8676
+            $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'].'" />';
8677 8677
             $icon_name = str_replace(' ', '', $item['item_type']);
8678 8678
 
8679
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8680
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8679
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8680
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8681 8681
             } else {
8682
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8683
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8682
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8683
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8684 8684
                 } else {
8685
-                    $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;'));
8685
+                    $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8686 8686
                 }
8687 8687
             }
8688 8688
 
8689
-            $return .=  $item['title'] . '</label>';
8689
+            $return .= $item['title'].'</label>';
8690 8690
             $return .= '</td>';
8691 8691
 
8692 8692
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8700,19 +8700,19 @@  discard block
 block discarded – undo
8700 8700
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8701 8701
 
8702 8702
                 $return .= '<td class="exercise">';
8703
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8703
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8704 8704
                 $return .= '</td>';
8705 8705
                 $return .= '<td class="exercise">';
8706
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8706
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8707 8707
                 $return .= '</td>';
8708 8708
             }
8709 8709
 
8710 8710
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8711 8711
                 $return .= '<td class="exercise">';
8712
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8712
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8713 8713
                 $return .= '</td>';
8714 8714
                 $return .= '<td class="exercise"">';
8715
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8715
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8716 8716
                 $return .= '</td>';
8717 8717
             }
8718 8718
             $return .= '</tr>';
@@ -8721,7 +8721,7 @@  discard block
 block discarded – undo
8721 8721
         $return .= '</tr>';
8722 8722
         $return .= '</table>';
8723 8723
         $return .= '<div style="padding-top:3px;">';
8724
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8724
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8725 8725
         $return .= '</form>';
8726 8726
 
8727 8727
         return $return;
@@ -8757,7 +8757,7 @@  discard block
 block discarded – undo
8757 8757
                 if ($row['id'] == $lp_id) {
8758 8758
                     continue;
8759 8759
                 }
8760
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8760
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8761 8761
             }
8762 8762
         }
8763 8763
         $return .= '</select>';
@@ -8865,8 +8865,8 @@  discard block
 block discarded – undo
8865 8865
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8866 8866
                      ORDER BY title ASC";
8867 8867
 
8868
-        $sql_hot  = "SELECT * FROM $tbl_doc
8869
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8868
+        $sql_hot = "SELECT * FROM $tbl_doc
8869
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8870 8870
                      ORDER BY id ASC";
8871 8871
 
8872 8872
         $res_quiz = Database::query($sql_quiz);
@@ -8876,8 +8876,8 @@  discard block
 block discarded – undo
8876 8876
 
8877 8877
         $return .= '<li class="lp_resource_element">';
8878 8878
         $return .= Display::return_icon('new_test_small.gif');
8879
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8880
-                    get_lang('NewExercise') . '</a>';
8879
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8880
+                    get_lang('NewExercise').'</a>';
8881 8881
         $return .= '</li>';
8882 8882
 
8883 8883
         // Display hotpotatoes
@@ -8889,8 +8889,8 @@  discard block
 block discarded – undo
8889 8889
             $return .= '</a> ';
8890 8890
 
8891 8891
             $return .= Display::return_icon('hotpotatoes_s.png');
8892
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8893
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8892
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8893
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8894 8894
             $return .= '</li>';
8895 8895
         }
8896 8896
 
@@ -8905,7 +8905,7 @@  discard block
 block discarded – undo
8905 8905
                 array(),
8906 8906
                 ICON_SIZE_TINY
8907 8907
             );
8908
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8908
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8909 8909
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8910 8910
                 '</a>';
8911 8911
             $return .= '</li>';
@@ -8987,7 +8987,7 @@  discard block
 block discarded – undo
8987 8987
                     ['target' => '_blank']
8988 8988
                 );
8989 8989
 
8990
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8990
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8991 8991
                     $linkNodes .=
8992 8992
                     '<li class="lp_resource_element" data_id="'.$key.
8993 8993
                         '" data_type="'.TOOL_LINK.'" title="'.$title.'" >
@@ -9031,8 +9031,8 @@  discard block
 block discarded – undo
9031 9031
         $return = '<ul class="lp_resource" >';
9032 9032
         $return .= '<li class="lp_resource_element">';
9033 9033
         $return .= Display::return_icon('works_new.gif');
9034
-        $return .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' .
9035
-            get_lang('AddAssignmentPage') . '</a>';
9034
+        $return .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.
9035
+            get_lang('AddAssignmentPage').'</a>';
9036 9036
         $return .= '</li>';
9037 9037
         $sessionId = api_get_session_id();
9038 9038
 
@@ -9054,7 +9054,7 @@  discard block
 block discarded – undo
9054 9054
                     $return .= '</a> ';
9055 9055
 
9056 9056
                     $return .= Display::return_icon('works.gif');
9057
-                    $return .= ' <a class="moved" href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&file=' . $work['iid'] . '&lp_id=' . $this->lp_id . '">' .
9057
+                    $return .= ' <a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&file='.$work['iid'].'&lp_id='.$this->lp_id.'">'.
9058 9058
                         Security :: remove_XSS(cut(strip_tags($work['title']), 80)).' '.$link.'
9059 9059
                     </a>';
9060 9060
 
@@ -9091,7 +9091,7 @@  discard block
 block discarded – undo
9091 9091
         );
9092 9092
         $return .= Display::url(
9093 9093
             get_lang('CreateANewForum'),
9094
-            api_get_path(REL_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
9094
+            api_get_path(REL_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
9095 9095
                 'action' => 'add',
9096 9096
                 'content' => 'forum',
9097 9097
                 'lp_id' => $this->lp_id
@@ -9127,15 +9127,15 @@  discard block
 block discarded – undo
9127 9127
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
9128 9128
                 $return .= ' </a>';
9129 9129
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
9130
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
9131
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
9130
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
9131
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
9132 9132
                             </a>
9133
-                            <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">' .
9134
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
9133
+                            <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">'.
9134
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
9135 9135
 
9136 9136
                 $return .= '</li>';
9137 9137
 
9138
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
9138
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
9139 9139
                 $a_threads = get_threads($forum['forum_id']);
9140 9140
                 if (is_array($a_threads)) {
9141 9141
                     foreach ($a_threads as $thread) {
@@ -9151,8 +9151,8 @@  discard block
 block discarded – undo
9151 9151
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
9152 9152
                         $return .= ' </a>';
9153 9153
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
9154
-                        $return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' .
9155
-                            Security :: remove_XSS($thread['thread_title']) . ' '.$link.'</a>';
9154
+                        $return .= '<a class="moved" href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
9155
+                            Security :: remove_XSS($thread['thread_title']).' '.$link.'</a>';
9156 9156
                         $return .= '</li>';
9157 9157
                     }
9158 9158
                 }
@@ -9223,7 +9223,7 @@  discard block
 block discarded – undo
9223 9223
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
9224 9224
             // Remove the possible . at the end of the path.
9225 9225
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
9226
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9226
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9227 9227
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
9228 9228
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
9229 9229
         }
@@ -9291,7 +9291,7 @@  discard block
 block discarded – undo
9291 9291
                 if ($item->type == 'sco') {
9292 9292
                     $inc_docs = $item->get_resources_from_source(
9293 9293
                         null,
9294
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9294
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9295 9295
                     );
9296 9296
                 } else {
9297 9297
                     $inc_docs = $item->get_resources_from_source();
@@ -9507,7 +9507,7 @@  discard block
 block discarded – undo
9507 9507
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9508 9508
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9509 9509
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9510
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9510
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9511 9511
                                         $my_dep->setAttribute('xml:base', '');
9512 9512
                                     }
9513 9513
                                 }
@@ -9638,7 +9638,7 @@  discard block
 block discarded – undo
9638 9638
                         //$my_item->appendChild($my_max_score);
9639 9639
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9640 9640
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9641
-                        $my_prereqs->setAttribute('type','aicc_script');
9641
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9642 9642
                         $my_item->appendChild($my_prereqs);
9643 9643
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9644 9644
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9691,7 +9691,7 @@  discard block
 block discarded – undo
9691 9691
                         $my_resource->appendChild($my_file);
9692 9692
 
9693 9693
                         // Get included docs.
9694
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9694
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9695 9695
                         // Dependency to other files - not yet supported.
9696 9696
                         $i = 1;
9697 9697
                         foreach ($inc_docs as $doc_info) {
@@ -9752,7 +9752,7 @@  discard block
 block discarded – undo
9752 9752
                                         $my_dep_file->setAttribute('href', $file_path);
9753 9753
                                         $my_dep->setAttribute('xml:base', '');
9754 9754
 
9755
-                                        if (strstr($file_path,$main_path) !== false) {
9755
+                                        if (strstr($file_path, $main_path) !== false) {
9756 9756
                                             // The calculated real path is really inside the chamilo root path.
9757 9757
                                             // Reduce file path to what's under the DocumentRoot.
9758 9758
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9770,7 +9770,7 @@  discard block
 block discarded – undo
9770 9770
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9771 9771
                                             $file_path = str_replace('//', '/', $file_path);
9772 9772
                                             if (file_exists($file_path)) {
9773
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9773
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9774 9774
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9775 9775
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9776 9776
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9999,7 +9999,7 @@  discard block
 block discarded – undo
9999 9999
             if (strpos($extra_file, '.') === 0)
10000 10000
                 continue;
10001 10001
             else {
10002
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
10002
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
10003 10003
                 $this->create_path($dest_file);
10004 10004
                 copy($main_code_path.$extra_file, $dest_file);
10005 10005
             }
@@ -10052,7 +10052,7 @@  discard block
 block discarded – undo
10052 10052
                             }
10053 10053
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
10054 10054
                             if (file_exists($file_path)) {
10055
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
10055
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
10056 10056
                             }
10057 10057
                             break;
10058 10058
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -10092,12 +10092,12 @@  discard block
 block discarded – undo
10092 10092
 
10093 10093
         foreach ($path_bits as $bit) {
10094 10094
             if (!empty ($bit)) {
10095
-                $new_path = $path_built . $bit;
10095
+                $new_path = $path_built.$bit;
10096 10096
                 if (is_dir($new_path)) {
10097
-                    $path_built = $new_path . '/';
10097
+                    $path_built = $new_path.'/';
10098 10098
                 } else {
10099 10099
                     mkdir($new_path, api_get_permissions_for_new_directories());
10100
-                    $path_built = $new_path . '/';
10100
+                    $path_built = $new_path.'/';
10101 10101
                 }
10102 10102
             }
10103 10103
         }
@@ -10141,9 +10141,9 @@  discard block
 block discarded – undo
10141 10141
 
10142 10142
         if ($upload_ok) {
10143 10143
             if ($has_attachment) {
10144
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
10144
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
10145 10145
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
10146
-                $updir = $sys_course_path . $courseDir;
10146
+                $updir = $sys_course_path.$courseDir;
10147 10147
                 // Try to add an extension to the file if it hasn't one.
10148 10148
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
10149 10149
 
@@ -10198,7 +10198,7 @@  discard block
 block discarded – undo
10198 10198
             //Setting my lp_id to autolaunch = 1
10199 10199
             $attributes['autolaunch'] = 1;
10200 10200
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
10201
-            Database::update($lp_table, $attributes, $where );
10201
+            Database::update($lp_table, $attributes, $where);
10202 10202
         }
10203 10203
     }
10204 10204
 
@@ -10217,13 +10217,13 @@  discard block
 block discarded – undo
10217 10217
 
10218 10218
         // Get the max order of the items
10219 10219
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
10220
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
10220
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
10221 10221
         $rs_max_order = Database::query($sql_max_order);
10222 10222
         $row_max_order = Database::fetch_object($rs_max_order);
10223 10223
         $max_order = $row_max_order->display_order;
10224 10224
         // Get the previous item ID
10225 10225
         $sql = "SELECT id as previous FROM $table_lp_item
10226
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
10226
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
10227 10227
         $rs_max = Database::query($sql);
10228 10228
         $row_max = Database::fetch_object($rs_max);
10229 10229
 
@@ -10279,9 +10279,9 @@  discard block
 block discarded – undo
10279 10279
         $documents_total_space = DocumentManager::documents_total_space();
10280 10280
         $course_max_space = DocumentManager::get_course_quota();
10281 10281
         $total_size = filesize($s) + $documents_total_space;
10282
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10282
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10283 10283
             return true;
10284
-        } else{
10284
+        } else {
10285 10285
             return false;
10286 10286
         }
10287 10287
     }
@@ -10621,7 +10621,7 @@  discard block
 block discarded – undo
10621 10621
         if ($this->debug > 0) {
10622 10622
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10623 10623
         }
10624
-        $this->subscribeUsers = intval($value);;
10624
+        $this->subscribeUsers = intval($value); ;
10625 10625
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10626 10626
         $lp_id = $this->get_id();
10627 10627
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -11053,8 +11053,8 @@  discard block
 block discarded – undo
11053 11053
                 if (!empty($id)) {
11054 11054
                     $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
11055 11055
                     $sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id";
11056
-                    $result= Database::query($sql);
11057
-                    $myrow=Database::fetch_array($result);
11056
+                    $result = Database::query($sql);
11057
+                    $myrow = Database::fetch_array($result);
11058 11058
                     if ($row_item['title'] != '') {
11059 11059
                         $myrow['title'] = $row_item['title'];
11060 11060
                     }
@@ -11066,8 +11066,8 @@  discard block
 block discarded – undo
11066 11066
                 $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id");
11067 11067
                 $myrow = Database::fetch_array($result);
11068 11068
                 $path = $myrow['path'];
11069
-                $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.'' .
11070
-                    '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' .
11069
+                $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.''.
11070
+                    '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().''.
11071 11071
                     '&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId;
11072 11072
                 break;
11073 11073
             case TOOL_FORUM:
@@ -11079,7 +11079,7 @@  discard block
 block discarded – undo
11079 11079
                     $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id";
11080 11080
                     $result = Database::query($sql);
11081 11081
                     $myrow = Database::fetch_array($result);
11082
-                    $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' .
11082
+                    $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.''.
11083 11083
                         '&forum='.$myrow['forum_id'].'&lp=true';
11084 11084
                 }
11085 11085
                 break;
@@ -11095,8 +11095,8 @@  discard block
 block discarded – undo
11095 11095
                 $posttitle = $title;
11096 11096
                 $posttext = str_replace('"', "'", $posttext);
11097 11097
 
11098
-                $link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' .
11099
-                    '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' .
11098
+                $link .= $main_dir_path.'forum/viewthread.php?post='.$id.''.
11099
+                    '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].''.
11100 11100
                     '&lp=true';
11101 11101
                 break;
11102 11102
             case TOOL_DOCUMENT:
@@ -11112,16 +11112,16 @@  discard block
 block discarded – undo
11112 11112
                 $showDirectUrl = !in_array($documentPathInfo['extension'], $jplayer_supported_files);
11113 11113
 
11114 11114
                 if ($showDirectUrl) {
11115
-                    $link = $documentInfo['direct_url'] . '?';
11115
+                    $link = $documentInfo['direct_url'].'?';
11116 11116
                     $link .= http_build_query(['cidReq' => $course_code, 'id_session' => $session_id]);
11117 11117
                 } else {
11118
-                    $link = $documentInfo['url'] . '&' . http_build_query(['origin' => 'learnpathitem']);
11118
+                    $link = $documentInfo['url'].'&'.http_build_query(['origin' => 'learnpathitem']);
11119 11119
                 }
11120 11120
 
11121 11121
                 $openmethod = 2;
11122 11122
                 $officedoc = false;
11123
-                Session::write('openmethod',$openmethod);
11124
-                Session::write('officedoc',$officedoc);
11123
+                Session::write('openmethod', $openmethod);
11124
+                Session::write('officedoc', $officedoc);
11125 11125
                 break;
11126 11126
             case 'assignments':
11127 11127
                 $link .= $main_dir_path.'work/work.php?origin='.$origin;
@@ -11246,8 +11246,8 @@  discard block
 block discarded – undo
11246 11246
                 $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id");
11247 11247
                 $myrow = Database::fetch_array($result);
11248 11248
                 $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
11249
-                $last = count($pathname) - 1;  // Making a correct name for the link.
11250
-                $filename = $pathname[$last];  // Making a correct name for the link.
11249
+                $last = count($pathname) - 1; // Making a correct name for the link.
11250
+                $filename = $pathname[$last]; // Making a correct name for the link.
11251 11251
                 $image = choose_image($filename);
11252 11252
                 $ext = explode('.', $filename);
11253 11253
                 $ext = strtolower($ext[sizeof($ext) - 1]);
Please login to merge, or discard this patch.
Braces   +111 added lines, -76 removed lines patch added patch discarded remove patch
@@ -3955,8 +3955,9 @@  discard block
 block discarded – undo
3955 3955
                 WHERE c_id = ".$course_id."
3956 3956
                 ORDER BY display_order";
3957 3957
         $res = Database::query($sql);
3958
-        if ($res === false)
3959
-            return false;
3958
+        if ($res === false) {
3959
+                    return false;
3960
+        }
3960 3961
         $lps = array ();
3961 3962
         $lp_order = array ();
3962 3963
         $num = Database :: num_rows($res);
@@ -4556,8 +4557,9 @@  discard block
 block discarded – undo
4556 4557
         if ($this->debug > 0) {
4557 4558
             error_log('New LP - In learnpath::set_maker()', 0);
4558 4559
         }
4559
-        if (empty ($name))
4560
-            return false;
4560
+        if (empty ($name)) {
4561
+                    return false;
4562
+        }
4561 4563
         $this->maker = $name;
4562 4564
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4563 4565
         $course_id = api_get_course_int_id();
@@ -4624,8 +4626,9 @@  discard block
 block discarded – undo
4624 4626
         $em = Database::getManager();
4625 4627
 
4626 4628
         $course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id());
4627
-        if (api_get_setting('search.search_enabled') !== 'true')
4628
-            return false;
4629
+        if (api_get_setting('search.search_enabled') !== 'true') {
4630
+                    return false;
4631
+        }
4629 4632
 
4630 4633
         if (!extension_loaded('xapian')) {
4631 4634
             return false;
@@ -4638,8 +4641,9 @@  discard block
 block discarded – undo
4638 4641
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4639 4642
 
4640 4643
         // Don't do anything if no change, verify only at DB, not the search engine.
4641
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4642
-            return false;
4644
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4645
+                    return false;
4646
+        }
4643 4647
 
4644 4648
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4645 4649
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4830,8 +4834,9 @@  discard block
 block discarded – undo
4830 4834
         if ($this->debug > 0) {
4831 4835
             error_log('New LP - In learnpath::set_proximity()', 0);
4832 4836
         }
4833
-        if (empty ($name))
4834
-            return false;
4837
+        if (empty ($name)) {
4838
+                    return false;
4839
+        }
4835 4840
 
4836 4841
         $this->proximity = $name;
4837 4842
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5173,8 +5178,9 @@  discard block
 block discarded – undo
5173 5178
 
5174 5179
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5175 5180
         $res = Database::query($sql);
5176
-        if ($res === false)
5177
-            return false;
5181
+        if ($res === false) {
5182
+                    return false;
5183
+        }
5178 5184
 
5179 5185
         $num = Database :: num_rows($res);
5180 5186
         // First check the order is correct, globally (might be wrong because
@@ -5485,8 +5491,9 @@  discard block
 block discarded – undo
5485 5491
             $position[$key] = $row['display_order'];
5486 5492
         }
5487 5493
 
5488
-        if (count($array) > 0)
5489
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5494
+        if (count($array) > 0) {
5495
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5496
+        }
5490 5497
 
5491 5498
         return $array;
5492 5499
     }
@@ -6181,10 +6188,12 @@  discard block
 block discarded – undo
6181 6188
                     if ($new_comment || $new_title) {
6182 6189
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6183 6190
                         $ct = '';
6184
-                        if ($new_comment)
6185
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6186
-                        if ($new_title)
6187
-                            $ct .= ", title='" . Database::escape_string($new_title)."' ";
6191
+                        if ($new_comment) {
6192
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6193
+                        }
6194
+                        if ($new_title) {
6195
+                                                    $ct .= ", title='" . Database::escape_string($new_title)."' ";
6196
+                        }
6188 6197
 
6189 6198
                         $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6190 6199
                                 WHERE c_id = ".$course_id." AND id = ".$document_id;
@@ -6209,17 +6218,21 @@  discard block
 block discarded – undo
6209 6218
         // Please, do not modify this dirname formatting.
6210 6219
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6211 6220
 
6212
-        if (strstr($dir, '..'))
6213
-            $dir = '/';
6221
+        if (strstr($dir, '..')) {
6222
+                    $dir = '/';
6223
+        }
6214 6224
 
6215
-        if ($dir[0] == '.')
6216
-            $dir = substr($dir, 1);
6225
+        if ($dir[0] == '.') {
6226
+                    $dir = substr($dir, 1);
6227
+        }
6217 6228
 
6218
-        if ($dir[0] != '/')
6219
-            $dir = '/' . $dir;
6229
+        if ($dir[0] != '/') {
6230
+                    $dir = '/' . $dir;
6231
+        }
6220 6232
 
6221
-        if ($dir[strlen($dir) - 1] != '/')
6222
-            $dir .= '/';
6233
+        if ($dir[strlen($dir) - 1] != '/') {
6234
+                    $dir .= '/';
6235
+        }
6223 6236
 
6224 6237
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6225 6238
 
@@ -6286,8 +6299,9 @@  discard block
 block discarded – undo
6286 6299
                 }
6287 6300
                 $return .= '<div style="padding:10px;">';
6288 6301
 
6289
-                if ($msg != '')
6290
-                    $return .= $msg;
6302
+                if ($msg != '') {
6303
+                                    $return .= $msg;
6304
+                }
6291 6305
 
6292 6306
                 $return .= '<h3>'.$row['title'].'</h3>';
6293 6307
                 switch ($row['item_type']) {
@@ -6542,10 +6556,11 @@  discard block
 block discarded – undo
6542 6556
         $item_title			= Security::remove_XSS($item_title);
6543 6557
         $item_description 	= Security::remove_XSS($item_description);
6544 6558
 
6545
-        if ($id != 0 && is_array($extra_info))
6546
-            $parent = $extra_info['parent_item_id'];
6547
-        else
6548
-            $parent = 0;
6559
+        if ($id != 0 && is_array($extra_info)) {
6560
+                    $parent = $extra_info['parent_item_id'];
6561
+        } else {
6562
+                    $parent = 0;
6563
+        }
6549 6564
 
6550 6565
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6551 6566
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6818,11 +6833,13 @@  discard block
 block discarded – undo
6818 6833
         }
6819 6834
 
6820 6835
         $legend = '<legend>';
6821
-        if ($action == 'add')
6822
-            $legend .= get_lang('CreateTheExercise');
6823
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6824
-        else
6825
-            $legend .= get_lang('EditCurrentExecice');
6836
+        if ($action == 'add') {
6837
+                    $legend .= get_lang('CreateTheExercise');
6838
+        } elseif ($action == 'move') {
6839
+            $legend .= get_lang('MoveTheCurrentExercise');
6840
+        } else {
6841
+                    $legend .= get_lang('EditCurrentExecice');
6842
+        }
6826 6843
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6827 6844
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6828 6845
         }
@@ -6849,8 +6866,9 @@  discard block
 block discarded – undo
6849 6866
                         $arrHide[] = $arrLP[$i]['id'];
6850 6867
                     }
6851 6868
                 } else {
6852
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6853
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6869
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6870
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6871
+                    }
6854 6872
                 }
6855 6873
             }
6856 6874
 
@@ -6868,11 +6886,13 @@  discard block
 block discarded – undo
6868 6886
 
6869 6887
         for ($i = 0; $i < count($arrLP); $i++) {
6870 6888
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6871
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6889
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6890
+                                    $selected = 'selected="selected" ';
6891
+                } elseif ($action == 'add') {
6872 6892
                     $selected = 'selected="selected" ';
6873
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6874
-                else
6875
-                    $selected = '';
6893
+                } else {
6894
+                                    $selected = '';
6895
+                }
6876 6896
 
6877 6897
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6878 6898
             }
@@ -6899,9 +6919,11 @@  discard block
 block discarded – undo
6899 6919
                 $arrHide = array ();
6900 6920
                 for ($i = 0; $i < count($arrLP); $i++) {
6901 6921
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6902
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6903
-                            $s_selected_position = $arrLP[$i]['id'];
6904
-                        elseif ($action == 'add') $s_selected_position = 0;
6922
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6923
+                                                    $s_selected_position = $arrLP[$i]['id'];
6924
+                        } elseif ($action == 'add') {
6925
+                            $s_selected_position = 0;
6926
+                        }
6905 6927
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6906 6928
 
6907 6929
                     }
@@ -7097,9 +7119,11 @@  discard block
 block discarded – undo
7097 7119
             $arrHide = array();
7098 7120
             for ($i = 0; $i < count($arrLP); $i++) {
7099 7121
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7100
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7101
-                        $s_selected_position = $arrLP[$i]['id'];
7102
-                    elseif ($action == 'add') $s_selected_position = 0;
7122
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7123
+                                            $s_selected_position = $arrLP[$i]['id'];
7124
+                    } elseif ($action == 'add') {
7125
+                        $s_selected_position = 0;
7126
+                    }
7103 7127
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7104 7128
                 }
7105 7129
             }
@@ -7302,9 +7326,11 @@  discard block
 block discarded – undo
7302 7326
 
7303 7327
             for ($i = 0; $i < count($arrLP); $i++) {
7304 7328
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7305
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7306
-                        $s_selected_position = $arrLP[$i]['id'];
7307
-                    elseif ($action == 'add') $s_selected_position = 0;
7329
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7330
+                                            $s_selected_position = $arrLP[$i]['id'];
7331
+                    } elseif ($action == 'add') {
7332
+                        $s_selected_position = 0;
7333
+                    }
7308 7334
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7309 7335
 
7310 7336
                 }
@@ -7338,8 +7364,7 @@  discard block
 block discarded – undo
7338 7364
 
7339 7365
         if (is_numeric($extra_info)) {
7340 7366
             $form->addHidden('path', $extra_info);
7341
-        }
7342
-        elseif (is_array($extra_info)) {
7367
+        } elseif (is_array($extra_info)) {
7343 7368
             $form->addHidden('path', $extra_info['path']);
7344 7369
         }
7345 7370
 
@@ -7392,8 +7417,9 @@  discard block
 block discarded – undo
7392 7417
                     lp_id = " . $this->lp_id . " AND
7393 7418
                     id != $id";
7394 7419
 
7395
-        if ($item_type == 'module')
7396
-            $sql .= " AND parent_item_id = 0";
7420
+        if ($item_type == 'module') {
7421
+                    $sql .= " AND parent_item_id = 0";
7422
+        }
7397 7423
 
7398 7424
         $result = Database::query($sql);
7399 7425
         $arrLP = array ();
@@ -7771,9 +7797,11 @@  discard block
 block discarded – undo
7771 7797
         //POSITION
7772 7798
         for ($i = 0; $i < count($arrLP); $i++) {
7773 7799
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7774
-                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7800
+                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7801
+                                    $s_selected_position = $arrLP[$i]['id'];
7802
+                } elseif ($action == 'add') {
7775 7803
                     $s_selected_position = $arrLP[$i]['id'];
7776
-                elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7804
+                }
7777 7805
                 $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7778 7806
             }
7779 7807
         }
@@ -7806,9 +7834,11 @@  discard block
 block discarded – undo
7806 7834
 
7807 7835
             for ($i = 0; $i < count($arrLP); $i++) {
7808 7836
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7809
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7837
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7838
+                                            $s_selected_position = $arrLP[$i]['id'];
7839
+                    } elseif ($action == 'add') {
7810 7840
                         $s_selected_position = $arrLP[$i]['id'];
7811
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7841
+                    }
7812 7842
 
7813 7843
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7814 7844
 
@@ -7819,17 +7849,18 @@  discard block
 block discarded – undo
7819 7849
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7820 7850
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7821 7851
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) {
7822
-                    if (isset ($_POST['content']))
7823
-                        $content = stripslashes($_POST['content']);
7824
-                    elseif (is_array($extra_info)) {
7852
+                    if (isset ($_POST['content'])) {
7853
+                                            $content = stripslashes($_POST['content']);
7854
+                    } elseif (is_array($extra_info)) {
7825 7855
                         //If it's an html document or a text file
7826 7856
                         if (!$no_display_edit_textarea) {
7827 7857
                             $content = $this->display_document($extra_info['path'], false, false);
7828 7858
                         }
7829
-                    } elseif (is_numeric($extra_info))
7830
-                        $content = $this->display_document($extra_info, false, false);
7831
-                    else
7832
-                        $content = '';
7859
+                    } elseif (is_numeric($extra_info)) {
7860
+                                            $content = $this->display_document($extra_info, false, false);
7861
+                    } else {
7862
+                                            $content = '';
7863
+                    }
7833 7864
 
7834 7865
                     if (!$no_display_edit_textarea) {
7835 7866
                         // We need to calculate here some specific settings for the online editor.
@@ -8094,9 +8125,11 @@  discard block
 block discarded – undo
8094 8125
             $arrHide = array();
8095 8126
             for ($i = 0; $i < count($arrLP); $i++) {
8096 8127
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8097
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8098
-                        $s_selected_position = $arrLP[$i]['id'];
8099
-                    elseif ($action == 'add') $s_selected_position = 0;
8128
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8129
+                                            $s_selected_position = $arrLP[$i]['id'];
8130
+                    } elseif ($action == 'add') {
8131
+                        $s_selected_position = 0;
8132
+                    }
8100 8133
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8101 8134
 
8102 8135
                 }
@@ -8299,9 +8332,11 @@  discard block
 block discarded – undo
8299 8332
             $arrHide = array ();
8300 8333
             for ($i = 0; $i < count($arrLP); $i++) {
8301 8334
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8302
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8303
-                        $s_selected_position = $arrLP[$i]['id'];
8304
-                    elseif ($action == 'add') $s_selected_position = 0;
8335
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8336
+                                            $s_selected_position = $arrLP[$i]['id'];
8337
+                    } elseif ($action == 'add') {
8338
+                        $s_selected_position = 0;
8339
+                    }
8305 8340
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8306 8341
 
8307 8342
                 }
@@ -9996,9 +10031,9 @@  discard block
 block discarded – undo
9996 10031
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9997 10032
         $extra_files = scandir($main_code_path);
9998 10033
         foreach ($extra_files as $extra_file) {
9999
-            if (strpos($extra_file, '.') === 0)
10000
-                continue;
10001
-            else {
10034
+            if (strpos($extra_file, '.') === 0) {
10035
+                            continue;
10036
+            } else {
10002 10037
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
10003 10038
                 $this->create_path($dest_file);
10004 10039
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.