Completed
Push — 1.10.x ( a4c63c...6eac94 )
by Julito
29:37
created
main/newscorm/learnpath.class.php 1 patch
Spacing   +617 added lines, -617 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $res = Database::query($sql);
244 244
 
245 245
         if ($this->debug > 2) {
246
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
246
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
247 247
             error_log('-- Start while--', 0);
248 248
         }
249 249
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
                         $this->refs_list[$oItem->ref] = $my_item_id;
264 264
                         if ($this->debug > 2) {
265 265
                             error_log(
266
-                                'New LP - learnpath::__construct() - ' .
267
-                                'aicc object with id ' . $my_item_id .
266
+                                'New LP - learnpath::__construct() - '.
267
+                                'aicc object with id '.$my_item_id.
268 268
                                 ' set in items[]',
269 269
                                 0
270 270
                             );
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 
284 284
                         $this->refs_list[$oItem->ref] = $my_item_id;
285 285
                         if ($this->debug > 2) {
286
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
286
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
287 287
                         }
288 288
                     }
289 289
                     break;
290 290
                 case 1:
291 291
                 default:
292 292
                     if ($this->debug > 2) {
293
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
293
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
294 294
                     }
295 295
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
296 296
 
297 297
                     if ($this->debug > 2) {
298
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
298
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
299 299
                     }
300 300
                     if (is_object($oItem)) {
301 301
                         $my_item_id = $oItem->get_id();
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
                         $this->refs_list[$my_item_id] = $my_item_id;
307 307
                         if ($this->debug > 2) {
308 308
                             error_log(
309
-                                'New LP - learnpath::__construct() ' . __LINE__ .
310
-                                ' - object with id ' . $my_item_id . ' set in items[]',
309
+                                'New LP - learnpath::__construct() '.__LINE__.
310
+                                ' - object with id '.$my_item_id.' set in items[]',
311 311
                                 0);
312 312
                         }
313 313
                     }
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
326 326
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
327 327
                     $this->items[$row['id']]->current_start_time = 0;
328
-                    $this->items[$row['id']]->current_stop_time	= 0;
328
+                    $this->items[$row['id']]->current_stop_time = 0;
329 329
                 }
330 330
             }
331 331
         }
332 332
 
333 333
         if ($this->debug > 2) {
334
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
334
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
335 335
         }
336 336
 
337 337
         if (!empty($lp_item_id_list)) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         // TODO: Define the current item better.
424 424
         $this->first();
425 425
         if ($this->debug > 2) {
426
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
426
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
427 427
         }
428 428
         return true;
429 429
     }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     ) {
501 501
         $course_id = $this->course_info['real_id'];
502 502
         if ($this->debug > 0) {
503
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
503
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
504 504
         }
505 505
         if (empty($course_id)) {
506 506
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                 FROM $tbl_lp_item
523 523
                 WHERE
524 524
                     c_id = $course_id AND
525
-                    lp_id = " . $this->get_id() . " AND
525
+                    lp_id = ".$this->get_id()." AND
526 526
                     parent_item_id = " . $parent;
527 527
 
528 528
         $res_count = Database::query($sql);
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
         if ($num > 0) {
533 533
             if ($previous == 0) {
534 534
                 $sql = "SELECT id, next_item_id, display_order
535
-                        FROM " . $tbl_lp_item . "
535
+                        FROM " . $tbl_lp_item."
536 536
                         WHERE
537 537
                             c_id = $course_id AND
538
-                            lp_id = " . $this->get_id() . " AND
539
-                            parent_item_id = " . $parent . " AND
538
+                            lp_id = ".$this->get_id()." AND
539
+                            parent_item_id = " . $parent." AND
540 540
                             previous_item_id = 0 OR
541 541
                             previous_item_id=" . $parent;
542 542
                 $result = Database::query($sql);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 						FROM $tbl_lp_item
552 552
                         WHERE
553 553
                             c_id = $course_id AND
554
-                            lp_id = " . $this->get_id() . " AND
554
+                            lp_id = ".$this->get_id()." AND
555 555
                             id = " . $previous;
556 556
 
557 557
                 $result = Database::query($sql);
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
         $typeCleaned = Database::escape_string($type);
572 572
         if ($type == 'quiz') {
573 573
             $sql = 'SELECT SUM(ponderation)
574
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
575
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
574
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
575
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
576 576
                     ON
577 577
                         quiz_question.id = quiz_rel_question.question_id AND
578 578
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $new_item_id = Database::insert($tbl_lp_item, $params);
619 619
 
620 620
         if ($this->debug > 2) {
621
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
621
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
622 622
         }
623 623
 
624 624
         if ($new_item_id) {
@@ -635,28 +635,28 @@  discard block
 block discarded – undo
635 635
             Database::query($sql);
636 636
 
637 637
             // Update all the items after the new item.
638
-            $sql = "UPDATE " . $tbl_lp_item . "
638
+            $sql = "UPDATE ".$tbl_lp_item."
639 639
                         SET display_order = display_order + 1
640 640
                     WHERE
641 641
                         c_id = $course_id AND
642
-                        lp_id = " . $this->get_id() . " AND
643
-                        id <> " . $new_item_id . " AND
644
-                        parent_item_id = " . $parent . " AND
642
+                        lp_id = ".$this->get_id()." AND
643
+                        id <> " . $new_item_id." AND
644
+                        parent_item_id = " . $parent." AND
645 645
                         display_order > " . $display_order;
646 646
             Database::query($sql);
647 647
 
648 648
             // Update the item that should come after the new item.
649
-            $sql = "UPDATE " . $tbl_lp_item . "
650
-                    SET ref = " . $new_item_id . "
651
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
649
+            $sql = "UPDATE ".$tbl_lp_item."
650
+                    SET ref = " . $new_item_id."
651
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
652 652
             Database::query($sql);
653 653
 
654 654
             // Upload audio.
655 655
             if (!empty($_FILES['mp3']['name'])) {
656 656
                 // Create the audio folder if it does not exist yet.
657
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
658
-                if (!is_dir($filepath . 'audio')) {
659
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
657
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
658
+                if (!is_dir($filepath.'audio')) {
659
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
660 660
                     $audio_id = add_document(
661 661
                         $_course,
662 662
                         '/audio',
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                 $file_path = handle_uploaded_document(
700 700
                     $_course,
701 701
                     $_FILES['mp3'],
702
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
702
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
703 703
                     '/audio',
704 704
                     $userId,
705 705
                     '',
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 
716 716
                 // Store the mp3 file in the lp_item table.
717 717
                 $sql = "UPDATE $tbl_lp_item SET
718
-                            audio = '" . Database::escape_string($file) . "'
719
-                        WHERE id = '" . intval($new_item_id) . "'";
718
+                            audio = '".Database::escape_string($file)."'
719
+                        WHERE id = '" . intval($new_item_id)."'";
720 720
                 Database::query($sql);
721 721
             }
722 722
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         while (Database :: num_rows($res_name)) {
796 796
             // There is already one such name, update the current one a bit.
797 797
             $i++;
798
-            $name = $name . ' - ' . $i;
798
+            $name = $name.' - '.$i;
799 799
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
800 800
             $res_name = Database::query($check_name);
801 801
         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                 // if $item points to an object and there is a parent.
908 908
                 if ($debug) {
909 909
                     error_log(
910
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
910
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
911 911
                         0
912 912
                     );
913 913
                 }
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                         if ($childItemId != $item) {
936 936
                             if ($debug) {
937 937
                                 error_log(
938
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
938
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
939 939
                                     0
940 940
                                 );
941 941
                             }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                             } else {
956 956
                                 if ($debug > 2) {
957 957
                                     error_log(
958
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
958
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
959 959
                                         0
960 960
                                     );
961 961
                                 }
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
         // Delete lp item id.
1061 1061
         foreach ($this->items as $id => $dummy) {
1062 1062
             $sql = "DELETE FROM $lp_item_view
1063
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1063
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1064 1064
             Database::query($sql);
1065 1065
         }
1066 1066
 
1067 1067
         // Proposed by Christophe (nickname: clefevre)
1068
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1068
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1069 1069
         Database::query($sql);
1070 1070
 
1071
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1071
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1072 1072
         Database::query($sql);
1073 1073
 
1074 1074
         self::toggle_publish($this->lp_id, 'i');
@@ -1076,32 +1076,32 @@  discard block
 block discarded – undo
1076 1076
         if ($this->type == 2 || $this->type == 3) {
1077 1077
             // This is a scorm learning path, delete the files as well.
1078 1078
             $sql = "SELECT path FROM $lp
1079
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1079
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1080 1080
             $res = Database::query($sql);
1081 1081
             if (Database :: num_rows($res) > 0) {
1082 1082
                 $row = Database :: fetch_array($res);
1083 1083
                 $path = $row['path'];
1084 1084
                 $sql = "SELECT id FROM $lp
1085
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1085
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1086 1086
                 $res = Database::query($sql);
1087 1087
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1088 1088
                     if ($this->debug > 2) {
1089
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1089
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1090 1090
                     }
1091 1091
                 } else {
1092 1092
                     // No other LP uses that directory, delete it.
1093
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1094
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1095
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1093
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1094
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1095
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1096 1096
                         if ($this->debug > 2) {
1097
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1097
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1098 1098
                         }
1099 1099
                         // Proposed by Christophe (clefevre).
1100 1100
                         if (strcmp(substr($path, -2), "/.") == 0) {
1101 1101
                             $path = substr($path, 0, -1); // Remove "." at the end.
1102 1102
                         }
1103 1103
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1104
-                        rmdirr($course_scorm_dir . $path);
1104
+                        rmdirr($course_scorm_dir.$path);
1105 1105
                     }
1106 1106
                 }
1107 1107
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1115 1115
         Database::query($sql);
1116 1116
 
1117
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1117
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1118 1118
         Database::query($sql);
1119 1119
         // Updates the display order of all lps.
1120 1120
         $this->update_display_order();
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
             api_get_user_id()
1128 1128
         );
1129 1129
 
1130
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1130
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1131 1131
         if ($link_info !== false) {
1132 1132
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1133 1133
         }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
     {
1148 1148
         $course_id = $this->course_info['real_id'];
1149 1149
         if ($this->debug > 0) {
1150
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1150
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1151 1151
         }
1152 1152
         $num = 0;
1153 1153
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         $res = Database::query($sql);
1159 1159
         while ($row = Database :: fetch_array($res)) {
1160 1160
             $num += $this->delete_children_items($row['id']);
1161
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1161
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1162 1162
             Database::query($sql_del);
1163 1163
             $num++;
1164 1164
         }
@@ -1199,12 +1199,12 @@  discard block
 block discarded – undo
1199 1199
         // Delete children items.
1200 1200
         $num = $this->delete_children_items($id);
1201 1201
         if ($this->debug > 2) {
1202
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1202
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1203 1203
         }
1204 1204
         // Now delete the item.
1205 1205
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1206 1206
         if ($this->debug > 2) {
1207
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1207
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1208 1208
         }
1209 1209
         Database::query($sql_del);
1210 1210
         // Now update surrounding items.
@@ -1279,15 +1279,15 @@  discard block
 block discarded – undo
1279 1279
         }
1280 1280
 
1281 1281
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1282
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1282
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1283 1283
         $res_select = Database::query($sql_select);
1284 1284
         $row_select = Database :: fetch_array($res_select);
1285 1285
         $audio_update_sql = '';
1286 1286
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1287 1287
             // Create the audio folder if it does not exist yet.
1288
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1289
-            if (!is_dir($filepath . 'audio')) {
1290
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1288
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1289
+            if (!is_dir($filepath.'audio')) {
1290
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1291 1291
                 $audio_id = add_document(
1292 1292
                     $_course,
1293 1293
                     '/audio',
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
             $pi = pathinfo($audio['name']);
1326 1326
             if ($pi['extension'] == 'mp3') {
1327 1327
                 $c_det = api_get_course_info($this->cc);
1328
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1328
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1329 1329
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1330 1330
                 $path = substr($path, 7);
1331 1331
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1332
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1332
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1333 1333
             }
1334 1334
         }
1335 1335
 
@@ -1339,13 +1339,13 @@  discard block
 block discarded – undo
1339 1339
         // TODO: htmlspecialchars to be checked for encoding related problems.
1340 1340
         if ($same_parent && $same_previous) {
1341 1341
             // Only update title and description.
1342
-            $sql = "UPDATE " . $tbl_lp_item . "
1343
-                    SET title = '" . Database::escape_string($title) . "',
1344
-                        prerequisite = '" . $prerequisites . "',
1345
-                        description = '" . Database::escape_string($description) . "'
1346
-                        " . $audio_update_sql . ",
1347
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1348
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1342
+            $sql = "UPDATE ".$tbl_lp_item."
1343
+                    SET title = '" . Database::escape_string($title)."',
1344
+                        prerequisite = '" . $prerequisites."',
1345
+                        description = '" . Database::escape_string($description)."'
1346
+                        " . $audio_update_sql.",
1347
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1348
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1349 1349
             Database::query($sql);
1350 1350
         } else {
1351 1351
             $old_parent = $row_select['parent_item_id'];
@@ -1360,27 +1360,27 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
             if ($old_previous != 0) {
1362 1362
                 // Next
1363
-                $sql = "UPDATE " . $tbl_lp_item . "
1364
-                        SET next_item_id = " . $old_next . "
1365
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1363
+                $sql = "UPDATE ".$tbl_lp_item."
1364
+                        SET next_item_id = " . $old_next."
1365
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1366 1366
                 Database::query($sql);
1367 1367
             }
1368 1368
 
1369 1369
             if ($old_next != 0) {
1370 1370
                 // Previous
1371
-                $sql = "UPDATE " . $tbl_lp_item . "
1372
-                        SET previous_item_id = " . $old_previous . "
1373
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1371
+                $sql = "UPDATE ".$tbl_lp_item."
1372
+                        SET previous_item_id = " . $old_previous."
1373
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1374 1374
                 Database::query($sql);
1375 1375
             }
1376 1376
 
1377 1377
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1378
-            $sql = "UPDATE " . $tbl_lp_item . "
1378
+            $sql = "UPDATE ".$tbl_lp_item."
1379 1379
                     SET display_order = display_order - 1
1380 1380
                     WHERE
1381 1381
                         c_id = ".$course_id." AND
1382
-                        display_order > " . $old_order . " AND
1383
-                        lp_id = " . $this->lp_id . " AND
1382
+                        display_order > " . $old_order." AND
1383
+                        lp_id = " . $this->lp_id." AND
1384 1384
                         parent_item_id = " . $old_parent;
1385 1385
             Database::query($sql);
1386 1386
             /* END -- virtually remove the current item id */
@@ -1390,11 +1390,11 @@  discard block
 block discarded – undo
1390 1390
             if ($previous == 0) {
1391 1391
                 // Select the data of the item that should come after the current item.
1392 1392
                 $sql = "SELECT id, display_order
1393
-                        FROM " . $tbl_lp_item . "
1393
+                        FROM " . $tbl_lp_item."
1394 1394
                         WHERE
1395 1395
                             c_id = ".$course_id." AND
1396
-                            lp_id = " . $this->lp_id . " AND
1397
-                            parent_item_id = " . $parent . " AND
1396
+                            lp_id = " . $this->lp_id." AND
1397
+                            parent_item_id = " . $parent." AND
1398 1398
                             previous_item_id = " . $previous;
1399 1399
                 $res_select_old = Database::query($sql);
1400 1400
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
             } else {
1411 1411
                 // Select the data of the item that should come before the current item.
1412 1412
                 $sql = "SELECT next_item_id, display_order
1413
-                        FROM " . $tbl_lp_item . "
1414
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1413
+                        FROM " . $tbl_lp_item."
1414
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1415 1415
                 $res_select_old = Database::query($sql);
1416 1416
                 $row_select_old = Database :: fetch_array($res_select_old);
1417 1417
                 $new_next = $row_select_old['next_item_id'];
@@ -1420,57 +1420,57 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
             // TODO: htmlspecialchars to be checked for encoding related problems.
1422 1422
             // Update the current item with the new data.
1423
-            $sql = "UPDATE " . $tbl_lp_item . "
1423
+            $sql = "UPDATE ".$tbl_lp_item."
1424 1424
                     SET
1425
-                        title = '" . Database::escape_string($title) . "',
1426
-                        description = '" . Database::escape_string($description) . "',
1427
-                        parent_item_id = " . $parent . ",
1428
-                        previous_item_id = " . $previous . ",
1429
-                        next_item_id = " . $new_next . ",
1430
-                        display_order = " . $new_order . "
1431
-                        " . $audio_update_sql . "
1432
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1425
+                        title = '" . Database::escape_string($title)."',
1426
+                        description = '" . Database::escape_string($description)."',
1427
+                        parent_item_id = " . $parent.",
1428
+                        previous_item_id = " . $previous.",
1429
+                        next_item_id = " . $new_next.",
1430
+                        display_order = " . $new_order."
1431
+                        " . $audio_update_sql."
1432
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1433 1433
             Database::query($sql);
1434 1434
 
1435 1435
             if ($previous != 0) {
1436 1436
                 // Update the previous item's next_item_id.
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET next_item_id = " . $id . "
1439
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET next_item_id = " . $id."
1439
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($new_next != 0) {
1444 1444
                 // Update the next item's previous_item_id.
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET previous_item_id = " . $id . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET previous_item_id = " . $id."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             if ($old_prerequisite != $prerequisites) {
1452
-                $sql = "UPDATE " . $tbl_lp_item . "
1453
-                        SET prerequisite = '" . $prerequisites . "'
1454
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1452
+                $sql = "UPDATE ".$tbl_lp_item."
1453
+                        SET prerequisite = '" . $prerequisites."'
1454
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1455 1455
                 Database::query($sql);
1456 1456
             }
1457 1457
 
1458 1458
             if ($old_max_time_allowed != $max_time_allowed) {
1459 1459
                 // update max time allowed
1460
-                $sql = "UPDATE " . $tbl_lp_item . "
1461
-                        SET max_time_allowed = " . $max_time_allowed . "
1462
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1460
+                $sql = "UPDATE ".$tbl_lp_item."
1461
+                        SET max_time_allowed = " . $max_time_allowed."
1462
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1463 1463
                 Database::query($sql);
1464 1464
             }
1465 1465
 
1466 1466
             // Update all the items with the same or a bigger display_order than the current item.
1467
-            $sql = "UPDATE " . $tbl_lp_item . "
1467
+            $sql = "UPDATE ".$tbl_lp_item."
1468 1468
                     SET display_order = display_order + 1
1469 1469
                     WHERE
1470 1470
                        c_id = ".$course_id." AND
1471
-                       lp_id = " . $this->get_id() . " AND
1472
-                       id <> " . $id . " AND
1473
-                       parent_item_id = " . $parent . " AND
1471
+                       lp_id = " . $this->get_id()." AND
1472
+                       id <> " . $id." AND
1473
+                       parent_item_id = " . $parent." AND
1474 1474
                        display_order >= " . $new_order;
1475 1475
 
1476 1476
             Database::query($sql);
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
     {
1497 1497
         $course_id = api_get_course_int_id();
1498 1498
         if ($this->debug > 0) {
1499
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1499
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1500 1500
         }
1501 1501
 
1502 1502
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
 
1597 1597
         if (empty($id) || $id != strval(intval($id))) {
1598 1598
 
1599
-            return array ();
1599
+            return array();
1600 1600
         }
1601 1601
 
1602 1602
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1636,11 +1636,11 @@  discard block
 block discarded – undo
1636 1636
     {
1637 1637
         $course_id = api_get_course_int_id();
1638 1638
         if ($this->debug > 0) {
1639
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1639
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1640 1640
         }
1641 1641
 
1642 1642
         if (empty ($id) || $id != strval(intval($id))) {
1643
-            return array ();
1643
+            return array();
1644 1644
         }
1645 1645
 
1646 1646
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1652,13 +1652,13 @@  discard block
 block discarded – undo
1652 1652
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1653 1653
                          ORDER BY display_order";
1654 1654
             $res_bros = Database::query($sql_bros);
1655
-            $list = array ();
1655
+            $list = array();
1656 1656
             while ($row_bro = Database :: fetch_array($res_bros)) {
1657 1657
                 $list[] = $row_bro;
1658 1658
             }
1659 1659
             return $list;
1660 1660
         }
1661
-        return array ();
1661
+        return array();
1662 1662
     }
1663 1663
 
1664 1664
     /**
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
             $current = $this->current;
1733 1733
         }
1734 1734
         if ($this->debug > 2) {
1735
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1735
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1736 1736
         }
1737 1737
         return $current;
1738 1738
     }
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
         ) {
1814 1814
 
1815 1815
             if ($this->debug > 2) {
1816
-                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);
1816
+                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);
1817 1817
             }
1818 1818
             $index = -1;
1819 1819
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
             if ($index == -1) {
1826 1826
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1827 1827
                 if ($this->debug > 2) {
1828
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1828
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1829 1829
                 }
1830 1830
                 return false;
1831 1831
             } else {
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
             $index = 0;
1841 1841
             // Loop through all ordered items and stop at the first item that is
1842 1842
             // not a directory *and* that has not been completed yet.
1843
-            while ( !empty($this->ordered_items[$index]) AND
1843
+            while (!empty($this->ordered_items[$index]) AND
1844 1844
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1845 1845
                 (
1846 1846
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1854,14 +1854,14 @@  discard block
 block discarded – undo
1854 1854
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1855 1855
             $this->index    = $index;
1856 1856
             if ($this->debug > 2) {
1857
-                error_log('$index ' . $index);
1857
+                error_log('$index '.$index);
1858 1858
             }
1859 1859
             if ($this->debug > 2) {
1860
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1860
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1861 1861
             }
1862 1862
         }
1863 1863
         if ($this->debug > 2) {
1864
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1864
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1865 1865
         }
1866 1866
     }
1867 1867
 
@@ -1874,7 +1874,7 @@  discard block
 block discarded – undo
1874 1874
     public function get_js_info($item_id = '')
1875 1875
     {
1876 1876
         if ($this->debug > 0) {
1877
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1877
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1878 1878
         }
1879 1879
 
1880 1880
         $info = '';
@@ -1884,17 +1884,17 @@  discard block
 block discarded – undo
1884 1884
             //if item is defined, return values from DB
1885 1885
             $oItem = $this->items[$item_id];
1886 1886
             $info .= '<script language="javascript">';
1887
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1888
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1889
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1890
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1891
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1892
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1893
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1887
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1888
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1889
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1890
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1891
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1892
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1893
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1894 1894
             $info .= "top.set_flag_synchronized();";
1895 1895
             $info .= '</script>';
1896 1896
             if ($this->debug > 2) {
1897
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1897
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1898 1898
             }
1899 1899
             return $info;
1900 1900
 
@@ -1902,17 +1902,17 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
             // If item_id is empty, just update to default SCORM data.
1904 1904
             $info .= '<script language="javascript">';
1905
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1906
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1907
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1908
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1909
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1910
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1911
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1905
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1906
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1907
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1908
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1909
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1910
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1911
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1912 1912
             $info .= "top.set_flag_synchronized();";
1913 1913
             $info .= '</script>';
1914 1914
             if ($this->debug > 2) {
1915
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1915
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1916 1916
             }
1917 1917
             return $info;
1918 1918
         }
@@ -1970,8 +1970,8 @@  discard block
 block discarded – undo
1970 1970
         if ($this->debug > 0) {
1971 1971
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1972 1972
         }
1973
-        if(empty($idBar)){
1974
-            $idBar='control-top';
1973
+        if (empty($idBar)) {
1974
+            $idBar = 'control-top';
1975 1975
         }
1976 1976
         /* if(empty($display)){
1977 1977
             $display='display:block';
@@ -1984,16 +1984,16 @@  discard block
 block discarded – undo
1984 1984
             $navbar = '
1985 1985
                   <span id="'.$idBar.'" class="buttons">
1986 1986
                     <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">
1987
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1987
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1988 1988
                     </a>
1989
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1990
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1989
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1990
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1991 1991
                     </a>
1992
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1993
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1992
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1993
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1994 1994
                     </a>
1995 1995
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1996
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1996
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1997 1997
                     </a>
1998 1998
                   </span>';
1999 1999
 
@@ -2001,13 +2001,13 @@  discard block
 block discarded – undo
2001 2001
             $navbar = '
2002 2002
                 <span id="'.$idBar.'" class="buttons text-right">
2003 2003
                     <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">
2004
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
2004
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
2005 2005
                     </a>
2006
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
2007
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
2006
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
2007
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
2008 2008
                     </a>
2009
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2010
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
2009
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2010
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2011 2011
                     </a>
2012 2012
                 </span>';
2013 2013
         }
@@ -2028,11 +2028,11 @@  discard block
 block discarded – undo
2028 2028
         $index = $this->index;
2029 2029
         $index++;
2030 2030
         if ($this->debug > 2) {
2031
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2031
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2032 2032
         }
2033 2033
         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) {
2034 2034
             $index++;
2035
-            if ($index == $this->max_ordered_items){
2035
+            if ($index == $this->max_ordered_items) {
2036 2036
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2037 2037
                     return $this->index;
2038 2038
                 } else {
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
             return $this->index;
2045 2045
         }
2046 2046
         if ($this->debug > 2) {
2047
-            error_log('New LP - index is now ' . $index, 0);
2047
+            error_log('New LP - index is now '.$index, 0);
2048 2048
         }
2049 2049
         return $index;
2050 2050
     }
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
         if (!empty ($new_index)) {
2063 2063
             if (isset ($this->ordered_items[$new_index])) {
2064 2064
                 if ($this->debug > 2) {
2065
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2065
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2066 2066
                 }
2067 2067
                 return $this->ordered_items[$new_index];
2068 2068
             }
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
         }
2105 2105
 
2106 2106
         // Filename without its extension.
2107
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2107
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2108 2108
 
2109 2109
         $zipFile = new PclZip($file_path);
2110 2110
         // Check the zip content (real size and file extension).
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
                     break; // Exit the foreach loop.
2129 2129
                 } elseif (
2130 2130
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2131
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2131
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2132 2132
                 ) {
2133 2133
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2134 2134
                     switch ($ext) {
@@ -2170,7 +2170,7 @@  discard block
 block discarded – undo
2170 2170
             error_log('New LP - In learnpath::get_previous_index()', 0);
2171 2171
         }
2172 2172
         $index = $this->index;
2173
-        if (isset ($this->ordered_items[$index -1])) {
2173
+        if (isset ($this->ordered_items[$index - 1])) {
2174 2174
             $index--;
2175 2175
             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')) {
2176 2176
                 $index--;
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
             }
2181 2181
         } else {
2182 2182
             if ($this->debug > 2) {
2183
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2183
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2184 2184
             }
2185 2185
             // There is no previous item.
2186 2186
         }
@@ -2223,8 +2223,8 @@  discard block
 block discarded – undo
2223 2223
     {
2224 2224
         $course_id = api_get_course_int_id();
2225 2225
         $_course = api_get_course_info();
2226
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2227
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2226
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2227
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2228 2228
 
2229 2229
         // Getting all the information about the item.
2230 2230
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2235,7 +2235,7 @@  discard block
 block discarded – undo
2235 2235
                     lp.c_id = $course_id AND
2236 2236
                     lp_view.c_id = $course_id";
2237 2237
         $result = Database::query($sql);
2238
-        $row 	= Database::fetch_assoc($result);
2238
+        $row = Database::fetch_assoc($result);
2239 2239
         $output = '';
2240 2240
 
2241 2241
         if (!empty ($row['audio'])) {
@@ -2243,8 +2243,8 @@  discard block
 block discarded – undo
2243 2243
             $list = $_SESSION['oLP']->get_toc();
2244 2244
             $type_quiz = false;
2245 2245
 
2246
-            foreach($list as $toc) {
2247
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2246
+            foreach ($list as $toc) {
2247
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2248 2248
                     $type_quiz = true;
2249 2249
                 }
2250 2250
             }
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
         $courseCode = null,
2308 2308
         $sessionId = null
2309 2309
     ) {
2310
-        $lp_id = (int)$lp_id;
2310
+        $lp_id = (int) $lp_id;
2311 2311
         $courseInfo = api_get_course_info($courseCode);
2312 2312
         $sessionId = intval($sessionId);
2313 2313
 
@@ -2473,10 +2473,10 @@  discard block
 block discarded – undo
2473 2473
      */
2474 2474
     public static function get_progress_bar($percentage = -1, $text_add = '')
2475 2475
     {
2476
-        $text = $percentage . $text_add;
2476
+        $text = $percentage.$text_add;
2477 2477
         $output = '<div class="progress">
2478
-                        <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.';">
2479
-                        '. $text .'
2478
+                        <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.';">
2479
+                        '. $text.'
2480 2480
                         </div>
2481 2481
                     </div>';
2482 2482
 
@@ -2512,16 +2512,16 @@  discard block
 block discarded – undo
2512 2512
         }
2513 2513
         $total_items = $this->get_total_items_count_without_chapters();
2514 2514
         if ($this->debug > 2) {
2515
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2515
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2516 2516
         }
2517 2517
         $completeItems = $this->get_complete_items_count();
2518 2518
         if ($this->debug > 2) {
2519
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2519
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2520 2520
         }
2521 2521
         if ($add != 0) {
2522 2522
             $completeItems += $add;
2523 2523
             if ($this->debug > 2) {
2524
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2524
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2525 2525
             }
2526 2526
         }
2527 2527
         $text = '';
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
             $text = '%';
2540 2540
         } elseif ($mode == 'abs') {
2541 2541
             $percentage = $completeItems;
2542
-            $text = '/' . $total_items;
2542
+            $text = '/'.$total_items;
2543 2543
         }
2544 2544
 
2545 2545
         return array(
@@ -2735,7 +2735,7 @@  discard block
 block discarded – undo
2735 2735
                 // and replace them, one by one, by the internal IDs (chamilo db)
2736 2736
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2737 2737
                 // by a space as well.
2738
-                $find = array (
2738
+                $find = array(
2739 2739
                     '&',
2740 2740
                     '|',
2741 2741
                     '~',
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
                     '(',
2748 2748
                     ')'
2749 2749
                 );
2750
-                $replace = array (
2750
+                $replace = array(
2751 2751
                     ' ',
2752 2752
                     ' ',
2753 2753
                     ' ',
@@ -2764,7 +2764,7 @@  discard block
 block discarded – undo
2764 2764
                 foreach ($ids as $id) {
2765 2765
                     $id = trim($id);
2766 2766
                     if (isset ($this->refs_list[$id])) {
2767
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2767
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2768 2768
                     }
2769 2769
                 }
2770 2770
 
@@ -2872,9 +2872,9 @@  discard block
 block discarded – undo
2872 2872
         if ($this->debug > 0) {
2873 2873
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2874 2874
         }
2875
-        $list = array ();
2875
+        $list = array();
2876 2876
         foreach ($this->ordered_items as $item_id) {
2877
-            $list[] = array (
2877
+            $list[] = array(
2878 2878
                 $item_id => $this->items[$item_id]->get_status()
2879 2879
             );
2880 2880
         }
@@ -2928,7 +2928,7 @@  discard block
 block discarded – undo
2928 2928
         $res = Database::query($sql);
2929 2929
         $num = Database :: num_rows($res);
2930 2930
         if ($num > 0) {
2931
-            $list[] = array (
2931
+            $list[] = array(
2932 2932
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2933 2933
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2934 2934
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2939,7 +2939,7 @@  discard block
 block discarded – undo
2939 2939
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2940 2940
             );
2941 2941
             while ($row = Database :: fetch_array($res)) {
2942
-                $list[] = array (
2942
+                $list[] = array(
2943 2943
                     'order_id' => ($row['order_id'] + 1),
2944 2944
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2945 2945
                     'type' => $row['interaction_type'],
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3008 3008
             );
3009 3009
             while ($row = Database :: fetch_array($res)) {
3010
-                $list[] = array (
3010
+                $list[] = array(
3011 3011
                     'order_id' => ($row['order_id'] + 1),
3012 3012
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3013 3013
                     'score_raw' => $row['score_raw'],
@@ -3034,10 +3034,10 @@  discard block
 block discarded – undo
3034 3034
         $toc = array();
3035 3035
         foreach ($this->ordered_items as $item_id) {
3036 3036
             if ($this->debug > 2) {
3037
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3037
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3038 3038
             }
3039 3039
             // TODO: Change this link generation and use new function instead.
3040
-            $toc[] = array (
3040
+            $toc[] = array(
3041 3041
                 'id'            => $item_id,
3042 3042
                 'title'         => $this->items[$item_id]->get_title(),
3043 3043
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
             );
3049 3049
         }
3050 3050
         if ($this->debug > 2) {
3051
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3051
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3052 3052
         }
3053 3053
         return $toc;
3054 3054
     }
@@ -3065,10 +3065,10 @@  discard block
 block discarded – undo
3065 3065
         }
3066 3066
         $toc = $varname.' = new Array();';
3067 3067
         foreach ($this->ordered_items as $item_id) {
3068
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3068
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3069 3069
         }
3070 3070
         if ($this->debug > 2) {
3071
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3071
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3072 3072
         }
3073 3073
         return $toc;
3074 3074
     }
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
             }
3093 3093
         }
3094 3094
         if ($this->debug > 2) {
3095
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3095
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3096 3096
         }
3097 3097
         return $res;
3098 3098
     }
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3109 3109
         $lp_id = intval($lp_id);
3110 3110
         $sql = "SELECT lp_type FROM $tbl_lp
3111
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3111
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3112 3112
         $res = Database::query($sql);
3113 3113
         if ($res === false) {
3114 3114
             return null;
@@ -3221,7 +3221,7 @@  discard block
 block discarded – undo
3221 3221
             $dirTypes = self::getChapterTypes();
3222 3222
 
3223 3223
             if (in_array($item['type'], $dirTypes)) {
3224
-                $scorm_color_background ='scorm_item_section ';
3224
+                $scorm_color_background = 'scorm_item_section ';
3225 3225
                 $style_item = '';
3226 3226
             }
3227 3227
             if ($item['id'] == $this->current) {
@@ -3230,7 +3230,7 @@  discard block
 block discarded – undo
3230 3230
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3231 3231
             }
3232 3232
 
3233
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3233
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3234 3234
 
3235 3235
             // Learning path title
3236 3236
             $title = $item['title'];
@@ -3260,7 +3260,7 @@  discard block
 block discarded – undo
3260 3260
                 $html .= stripslashes($title);
3261 3261
             } else {
3262 3262
                 $this->get_link('http', $item['id'], $toc_list);
3263
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3263
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3264 3264
             }
3265 3265
             $html .= "</div>";
3266 3266
 
@@ -3294,12 +3294,12 @@  discard block
 block discarded – undo
3294 3294
             if ($this->get_lp_session_id() == api_get_session_id()) {
3295 3295
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3296 3296
                 $html .= '<div class="btn-group">';
3297
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3298
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3299
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3300
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3301
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' .
3302
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3297
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3298
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3299
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3300
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3301
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'.
3302
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3303 3303
                 $html .= '</div>';
3304 3304
                 $html .= '</div>';
3305 3305
             }
@@ -3351,11 +3351,11 @@  discard block
 block discarded – undo
3351 3351
         $course_id = $this->get_course_int_id();
3352 3352
 
3353 3353
         if ($this->debug > 0) {
3354
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3354
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3355 3355
         }
3356 3356
         if (empty($item_id)) {
3357 3357
             if ($this->debug > 2) {
3358
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3358
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3359 3359
             }
3360 3360
             $item_id = $this->get_current_item_id();
3361 3361
         }
@@ -3387,7 +3387,7 @@  discard block
 block discarded – undo
3387 3387
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3388 3388
         		WHERE li.id = $item_id ";
3389 3389
         if ($this->debug > 2) {
3390
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3390
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3391 3391
         }
3392 3392
         $res = Database::query($sql);
3393 3393
         if (Database :: num_rows($res) > 0) {
@@ -3401,9 +3401,9 @@  discard block
 block discarded – undo
3401 3401
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3402 3402
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3403 3403
             }
3404
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3404
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3405 3405
             if ($type == 'http') {
3406
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3406
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3407 3407
             } else {
3408 3408
                 $course_path = $sys_course_path; //system path
3409 3409
             }
@@ -3414,8 +3414,8 @@  discard block
 block discarded – undo
3414 3414
             }
3415 3415
 
3416 3416
             if ($this->debug > 2) {
3417
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3418
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3417
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3418
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3419 3419
             }
3420 3420
 
3421 3421
             // 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
                         if ($lp_item_type == 'link') {
@@ -3454,7 +3454,7 @@  discard block
 block discarded – undo
3454 3454
                                     $linkProtocol = substr($file, 0, 5);
3455 3455
                                     if ($linkProtocol === 'http:') {
3456 3456
                                         //this is the special intervention case
3457
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3457
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3458 3458
                                     }
3459 3459
                                 }
3460 3460
                             }
@@ -3494,8 +3494,8 @@  discard block
 block discarded – undo
3494 3494
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3495 3495
                                         WHERE
3496 3496
                                             c_id = $course_id AND
3497
-                                            lp_item_id='" . $lp_item_id . "' AND
3498
-                                            lp_view_id ='" . $lp_view_id . "' AND
3497
+                                            lp_item_id='".$lp_item_id."' AND
3498
+                                            lp_view_id ='" . $lp_view_id."' AND
3499 3499
                                             status='completed'";
3500 3500
                                 $result = Database::query($sql);
3501 3501
                                 $row_count = Database :: fetch_row($result);
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3505 3505
                                     $not_multiple_attempt = 1;
3506 3506
                                 }
3507
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3507
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3508 3508
                             }
3509 3509
 
3510 3510
                             $tmp_array = explode('/', $file);
@@ -3517,7 +3517,7 @@  discard block
 block discarded – undo
3517 3517
                     break;
3518 3518
                 case 2 :
3519 3519
                     if ($this->debug > 2) {
3520
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3520
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3521 3521
                     }
3522 3522
 
3523 3523
                     if ($lp_item_type != 'dir') {
@@ -3531,19 +3531,19 @@  discard block
 block discarded – undo
3531 3531
                         //if ($this->prerequisites_match($item_id)) {
3532 3532
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3533 3533
                             if ($this->debug > 2) {
3534
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3534
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3535 3535
                             }
3536 3536
                             // Distant url, return as is.
3537 3537
                             $file = $lp_item_path;
3538 3538
                         } else {
3539 3539
                             if ($this->debug > 2) {
3540
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3540
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3541 3541
                             }
3542 3542
                             // Prevent getting untranslatable urls.
3543 3543
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3544 3544
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3545 3545
                             // Prepare the path.
3546
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3546
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3547 3547
                             // TODO: Fix this for urls with protocol header.
3548 3548
                             $file = str_replace('//', '/', $file);
3549 3549
                             $file = str_replace(':/', '://', $file);
@@ -3551,11 +3551,11 @@  discard block
 block discarded – undo
3551 3551
                                 $lp_path = substr($lp_path, 0, -1);
3552 3552
                             }
3553 3553
 
3554
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3554
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3555 3555
                                 // if file not found.
3556 3556
                                 $decoded = html_entity_decode($lp_item_path);
3557 3557
                                 list ($decoded) = explode('?', $decoded);
3558
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3558
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3559 3559
                                     require_once 'resourcelinker.inc.php';
3560 3560
                                     $file = rl_get_resource_link_for_learnpath(
3561 3561
                                         $course_id,
@@ -3575,14 +3575,14 @@  discard block
 block discarded – undo
3575 3575
                                         }
3576 3576
                                     }
3577 3577
                                 } else {
3578
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3578
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3579 3579
                                 }
3580 3580
                             }
3581 3581
                         }
3582 3582
 
3583 3583
                         // We want to use parameters if they were defined in the imsmanifest
3584 3584
                         if (strpos($file, 'blank.php') === false) {
3585
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3585
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3586 3586
                         }
3587 3587
                     } else {
3588 3588
                         $file = 'lp_content.php?type=dir';
@@ -3590,12 +3590,12 @@  discard block
 block discarded – undo
3590 3590
                     break;
3591 3591
                 case 3 :
3592 3592
                     if ($this->debug > 2) {
3593
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3593
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3594 3594
                     }
3595 3595
                     // Formatting AICC HACP append URL.
3596
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3596
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3597 3597
                     if (!empty($lp_item_params)) {
3598
-                        $aicc_append .= $lp_item_params . '&';
3598
+                        $aicc_append .= $lp_item_params.'&';
3599 3599
                     }
3600 3600
                     if ($lp_item_type != 'dir') {
3601 3601
                         // Quite complex here:
@@ -3607,7 +3607,7 @@  discard block
 block discarded – undo
3607 3607
 
3608 3608
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3609 3609
                             if ($this->debug > 2) {
3610
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3610
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3611 3611
                             }
3612 3612
                             // Distant url, return as is.
3613 3613
                             $file = $lp_item_path;
@@ -3620,19 +3620,19 @@  discard block
 block discarded – undo
3620 3620
                             if (stripos($file, '<servername>') !== false) {
3621 3621
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3622 3622
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3623
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3623
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3624 3624
                             }
3625 3625
                             //
3626 3626
                             $file .= $aicc_append;
3627 3627
                         } else {
3628 3628
                             if ($this->debug > 2) {
3629
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3629
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3630 3630
                             }
3631 3631
                             // Prevent getting untranslatable urls.
3632 3632
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3633 3633
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3634 3634
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3635
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3635
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3636 3636
                             // TODO: Fix this for urls with protocol header.
3637 3637
                             $file = str_replace('//', '/', $file);
3638 3638
                             $file = str_replace(':/', '://', $file);
@@ -3651,7 +3651,7 @@  discard block
 block discarded – undo
3651 3651
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3652 3652
         }
3653 3653
         if ($this->debug > 2) {
3654
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3654
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3655 3655
         }
3656 3656
         return $file;
3657 3657
     }
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
         $search = '';
3670 3670
         // Use $attempt_num to enable multi-views management (disabled so far).
3671 3671
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3672
-            $search = 'AND view_count = ' . $attempt_num;
3672
+            $search = 'AND view_count = '.$attempt_num;
3673 3673
         }
3674 3674
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3675 3675
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3679,9 +3679,9 @@  discard block
 block discarded – undo
3679 3679
 
3680 3680
         $sql = "SELECT id, view_count FROM $lp_view_table
3681 3681
         		WHERE
3682
-        		    c_id = " . $course_id . " AND
3683
-        		    lp_id = " . $this->get_id() . " AND
3684
-        		    user_id = " . $this->get_user_id() . " AND
3682
+        		    c_id = ".$course_id." AND
3683
+        		    lp_id = " . $this->get_id()." AND
3684
+        		    user_id = " . $this->get_user_id()." AND
3685 3685
         		    session_id = $sessionId
3686 3686
         		    $search
3687 3687
                 ORDER BY view_count DESC";
@@ -3692,7 +3692,7 @@  discard block
 block discarded – undo
3692 3692
         } else if (!api_is_invitee()) {
3693 3693
             // There is no database record, create one.
3694 3694
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3695
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3695
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3696 3696
             Database::query($sql);
3697 3697
             $id = Database :: insert_id();
3698 3698
             $this->lp_view_id = $id;
@@ -3792,15 +3792,15 @@  discard block
 block discarded – undo
3792 3792
     {
3793 3793
         $course_id = api_get_course_int_id();
3794 3794
         if ($this->debug > 0) {
3795
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3795
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3796 3796
         }
3797 3797
         if (empty($id) || empty($direction)) {
3798 3798
             return false;
3799 3799
         }
3800 3800
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3801 3801
         $sql_sel = "SELECT *
3802
-                    FROM " . $tbl_lp_item . "
3803
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3802
+                    FROM " . $tbl_lp_item."
3803
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3804 3804
         $res_sel = Database::query($sql_sel);
3805 3805
         // Check if elem exists.
3806 3806
         if (Database :: num_rows($res_sel) < 1) {
@@ -3825,7 +3825,7 @@  discard block
 block discarded – undo
3825 3825
                                  WHERE c_id = ".$course_id." AND id = $previous";
3826 3826
 
3827 3827
                     if ($this->debug > 2) {
3828
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3828
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3829 3829
                     }
3830 3830
                     $res_sel2 = Database::query($sql_sel2);
3831 3831
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
                         }
3879 3879
                         Database::query($sql_upd2);
3880 3880
                     }
3881
-                    $display = $display -1;
3881
+                    $display = $display - 1;
3882 3882
                 }
3883 3883
                 break;
3884 3884
             case 'down':
@@ -3889,7 +3889,7 @@  discard block
 block discarded – undo
3889 3889
                 } else {
3890 3890
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3891 3891
                     if ($this->debug > 2) {
3892
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3892
+                        error_log('Selecting next: '.$sql_sel2, 0);
3893 3893
                     }
3894 3894
                     $res_sel2 = Database::query($sql_sel2);
3895 3895
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3928 3928
                         Database::query($sql_upd2);
3929 3929
                     }
3930
-                    $display = $display +1;
3930
+                    $display = $display + 1;
3931 3931
                 }
3932 3932
                 break;
3933 3933
             default :
@@ -3950,8 +3950,8 @@  discard block
 block discarded – undo
3950 3950
         $res = Database::query($sql);
3951 3951
         if ($res === false)
3952 3952
             return false;
3953
-        $lps = array ();
3954
-        $lp_order = array ();
3953
+        $lps = array();
3954
+        $lp_order = array();
3955 3955
         $num = Database :: num_rows($res);
3956 3956
         // First check the order is correct, globally (might be wrong because
3957 3957
         // of versions < 1.8.4)
@@ -3961,7 +3961,7 @@  discard block
 block discarded – undo
3961 3961
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3962 3962
                     $need_fix = true;
3963 3963
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3964
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3964
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3965 3965
                     Database::query($sql_u);
3966 3966
                 }
3967 3967
                 $row['display_order'] = $i;
@@ -3974,10 +3974,10 @@  discard block
 block discarded – undo
3974 3974
             $order = $lps[$lp_id]['display_order'];
3975 3975
             if ($order > 1) { // If it's the first element, no need to move up.
3976 3976
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3977
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3977
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3978 3978
                 Database::query($sql_u1);
3979
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3980
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3979
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3980
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3981 3981
                 Database::query($sql_u2);
3982 3982
             }
3983 3983
         }
@@ -3998,8 +3998,8 @@  discard block
 block discarded – undo
3998 3998
         if ($res === false) {
3999 3999
             return false;
4000 4000
         }
4001
-        $lps = array ();
4002
-        $lp_order = array ();
4001
+        $lps = array();
4002
+        $lp_order = array();
4003 4003
         $num = Database :: num_rows($res);
4004 4004
         $max = 0;
4005 4005
         // First check the order is correct, globally (might be wrong because
@@ -4011,7 +4011,7 @@  discard block
 block discarded – undo
4011 4011
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4012 4012
                     $need_fix = true;
4013 4013
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4014
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4014
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4015 4015
                     Database::query($sql_u);
4016 4016
                 }
4017 4017
                 $row['display_order'] = $i;
@@ -4024,10 +4024,10 @@  discard block
 block discarded – undo
4024 4024
             $order = $lps[$lp_id]['display_order'];
4025 4025
             if ($order < $max) { // If it's the first element, no need to move up.
4026 4026
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4027
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4027
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4028 4028
                 Database::query($sql_u1);
4029
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4030
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4029
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4030
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4031 4031
                 Database::query($sql_u2);
4032 4032
             }
4033 4033
         }
@@ -4047,15 +4047,15 @@  discard block
 block discarded – undo
4047 4047
         $this->autocomplete_parents($this->last);
4048 4048
         $new_index = $this->get_next_index();
4049 4049
         if ($this->debug > 2) {
4050
-            error_log('New LP - New index: ' . $new_index, 0);
4050
+            error_log('New LP - New index: '.$new_index, 0);
4051 4051
         }
4052 4052
         $this->index = $new_index;
4053 4053
         if ($this->debug > 2) {
4054
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4054
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4055 4055
         }
4056 4056
         $this->current = $this->ordered_items[$new_index];
4057 4057
         if ($this->debug > 2) {
4058
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4058
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4059 4059
         }
4060 4060
     }
4061 4061
 
@@ -4119,7 +4119,7 @@  discard block
 block discarded – undo
4119 4119
             // Clean spaces.
4120 4120
             $prereq_string = str_replace(' ', '', $prereq_string);
4121 4121
             if ($debug > 0) {
4122
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4122
+                error_log('Found prereq_string: '.$prereq_string, 0);
4123 4123
             }
4124 4124
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4125 4125
             $result = $currentItem->parse_prereq(
@@ -4135,12 +4135,12 @@  discard block
 block discarded – undo
4135 4135
         } else {
4136 4136
             $result = true;
4137 4137
             if ($debug > 1) {
4138
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4138
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4139 4139
             }
4140 4140
         }
4141 4141
 
4142 4142
         if ($debug > 1) {
4143
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4143
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4144 4144
         }
4145 4145
         return $result;
4146 4146
     }
@@ -4206,12 +4206,12 @@  discard block
 block discarded – undo
4206 4206
             $row = Database :: fetch_array($result);
4207 4207
             $name = domesticate($row['name']);
4208 4208
             if ($set_visibility == 'i') {
4209
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4209
+                $s = $name." ".get_lang('LearnpathNotPublished');
4210 4210
                 $dialogBox = $s;
4211 4211
                 $v = 0;
4212 4212
             }
4213 4213
             if ($set_visibility == 'v') {
4214
-                $s = $name . " " . get_lang('LearnpathPublished');
4214
+                $s = $name." ".get_lang('LearnpathPublished');
4215 4215
                 $dialogBox = $s;
4216 4216
                 $v = 1;
4217 4217
             }
@@ -4294,9 +4294,9 @@  discard block
 block discarded – undo
4294 4294
         $course_id = api_get_course_int_id();
4295 4295
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4296 4296
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4297
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4297
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4298 4298
         if ($this->debug > 2) {
4299
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4299
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4300 4300
         }
4301 4301
         $res = Database::query($sql);
4302 4302
         $view_id = Database::insert_id();
@@ -4334,10 +4334,10 @@  discard block
 block discarded – undo
4334 4334
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4335 4335
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4336 4336
         if ($this->debug > 2) {
4337
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4337
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4338 4338
         }
4339 4339
         if ($this->debug > 2) {
4340
-            error_log('' . print_r($this->items, true), 0);
4340
+            error_log(''.print_r($this->items, true), 0);
4341 4341
         }
4342 4342
         if (isset($this->items[$this->current]) &&
4343 4343
             is_object($this->items[$this->current])
@@ -4361,7 +4361,7 @@  discard block
 block discarded – undo
4361 4361
     {
4362 4362
         $debug = $this->debug;
4363 4363
         if ($debug) {
4364
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4364
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4365 4365
         }
4366 4366
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4367 4367
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4384,7 +4384,7 @@  discard block
 block discarded – undo
4384 4384
 
4385 4385
             if ($debug) {
4386 4386
                 error_log('update_queue before:');
4387
-                error_log(print_r($this->update_queue,1));
4387
+                error_log(print_r($this->update_queue, 1));
4388 4388
             }
4389 4389
             $this->autocomplete_parents($item_id);
4390 4390
 
@@ -4392,9 +4392,9 @@  discard block
 block discarded – undo
4392 4392
             $this->update_queue[$item_id] = $status;
4393 4393
 
4394 4394
             if ($debug) {
4395
-                error_log('get_status(): ' . $status);
4395
+                error_log('get_status(): '.$status);
4396 4396
                 error_log('update_queue after:');
4397
-                error_log(print_r($this->update_queue,1));
4397
+                error_log(print_r($this->update_queue, 1));
4398 4398
             }
4399 4399
             return $res;
4400 4400
         }
@@ -4415,17 +4415,17 @@  discard block
 block discarded – undo
4415 4415
 
4416 4416
         if (isset($this->current) && !api_is_invitee()) {
4417 4417
             if ($this->debug > 2) {
4418
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4418
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4419 4419
             }
4420 4420
             $sql = "UPDATE $table SET
4421
-                        last_item = " . intval($this->get_current_item_id()). "
4421
+                        last_item = ".intval($this->get_current_item_id())."
4422 4422
                     WHERE
4423 4423
                         c_id = $course_id AND
4424
-                        lp_id = " . $this->get_id() . " AND
4424
+                        lp_id = ".$this->get_id()." AND
4425 4425
                         user_id = " . $this->get_user_id()." ".$session_condition;
4426 4426
 
4427 4427
             if ($this->debug > 2) {
4428
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4428
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4429 4429
             }
4430 4430
             Database::query($sql);
4431 4431
         }
@@ -4439,7 +4439,7 @@  discard block
 block discarded – undo
4439 4439
                             progress = $progress
4440 4440
                         WHERE
4441 4441
                             c_id = ".$course_id." AND
4442
-                            lp_id = " . $this->get_id() . " AND
4442
+                            lp_id = " . $this->get_id()." AND
4443 4443
                             user_id = " . $this->get_user_id()." ".$session_condition;
4444 4444
                 // Ignore errors as some tables might not have the progress field just yet.
4445 4445
                 Database::query($sql);
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
     public function set_current_item($item_id = null)
4456 4456
     {
4457 4457
         if ($this->debug > 0) {
4458
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4458
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4459 4459
         }
4460 4460
         if (empty ($item_id)) {
4461 4461
             if ($this->debug > 2) {
@@ -4464,7 +4464,7 @@  discard block
 block discarded – undo
4464 4464
             // Do nothing.
4465 4465
         } else {
4466 4466
             if ($this->debug > 2) {
4467
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4467
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4468 4468
             }
4469 4469
             if (is_numeric($item_id)) {
4470 4470
                 $item_id = intval($item_id);
@@ -4479,10 +4479,10 @@  discard block
 block discarded – undo
4479 4479
                     }
4480 4480
                 }
4481 4481
                 if ($this->debug > 2) {
4482
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4482
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4483 4483
                 }
4484 4484
             } else {
4485
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4485
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4486 4486
             }
4487 4487
         }
4488 4488
     }
@@ -4507,7 +4507,7 @@  discard block
 block discarded – undo
4507 4507
             $lp = $this->get_id();
4508 4508
             if ($lp != 0) {
4509 4509
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4510
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4510
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4511 4511
                 $res = Database::query($sql);
4512 4512
                 return $res;
4513 4513
             }
@@ -4531,7 +4531,7 @@  discard block
 block discarded – undo
4531 4531
 
4532 4532
         if ($lp != 0) {
4533 4533
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4534
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4534
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4535 4535
             $res = Database::query($sql);
4536 4536
             return $res;
4537 4537
         } else {
@@ -4556,10 +4556,10 @@  discard block
 block discarded – undo
4556 4556
         $course_id = api_get_course_int_id();
4557 4557
         $lp_id = $this->get_id();
4558 4558
         $sql = "UPDATE $lp_table SET
4559
-                content_maker = '" . Database::escape_string($this->maker) . "'
4559
+                content_maker = '".Database::escape_string($this->maker)."'
4560 4560
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4561 4561
         if ($this->debug > 2) {
4562
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4562
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4563 4563
         }
4564 4564
         Database::query($sql);
4565 4565
         return true;
@@ -4583,10 +4583,10 @@  discard block
 block discarded – undo
4583 4583
         $lp_id = $this->get_id();
4584 4584
         $course_id = $this->course_info['real_id'];
4585 4585
         $sql = "UPDATE $lp_table SET
4586
-                name = '" . Database::escape_string($this->name). "'
4586
+                name = '".Database::escape_string($this->name)."'
4587 4587
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4588 4588
         if ($this->debug > 2) {
4589
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4589
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4590 4590
         }
4591 4591
         $result = Database::query($sql);
4592 4592
         // If the lp is visible on the homepage, change his name there.
@@ -4594,7 +4594,7 @@  discard block
 block discarded – undo
4594 4594
             $session_id = api_get_session_id();
4595 4595
             $session_condition = api_get_session_condition($session_id);
4596 4596
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4597
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4597
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4598 4598
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4599 4599
             	    WHERE
4600 4600
             	        c_id = $course_id AND
@@ -4672,10 +4672,10 @@  discard block
 block discarded – undo
4672 4672
 
4673 4673
                 // Save it to search engine.
4674 4674
                 foreach ($missing_terms as $term) {
4675
-                    $doc->add_term($prefix . $term, 1);
4675
+                    $doc->add_term($prefix.$term, 1);
4676 4676
                 }
4677 4677
                 foreach ($deprecated_terms as $term) {
4678
-                    $doc->remove_term($prefix . $term);
4678
+                    $doc->remove_term($prefix.$term);
4679 4679
                 }
4680 4680
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4681 4681
                 $di->getDb()->flush();
@@ -4700,10 +4700,10 @@  discard block
 block discarded – undo
4700 4700
         $this->theme = $name;
4701 4701
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4702 4702
         $lp_id = $this->get_id();
4703
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4703
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4704 4704
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4705 4705
         if ($this->debug > 2) {
4706
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4706
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4707 4707
         }
4708 4708
         Database::query($sql);
4709 4709
 
@@ -4726,10 +4726,10 @@  discard block
 block discarded – undo
4726 4726
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4727 4727
         $lp_id = $this->get_id();
4728 4728
         $sql = "UPDATE $lp_table SET
4729
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4729
+                preview_image = '".Database::escape_string($this->preview_image)."'
4730 4730
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4731 4731
         if ($this->debug > 2) {
4732
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4732
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4733 4733
         }
4734 4734
         Database::query($sql);
4735 4735
         return true;
@@ -4749,10 +4749,10 @@  discard block
 block discarded – undo
4749 4749
         $this->author = $name;
4750 4750
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4751 4751
         $lp_id = $this->get_id();
4752
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4752
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4753 4753
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4754 4754
         if ($this->debug > 2) {
4755
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4755
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4756 4756
         }
4757 4757
         Database::query($sql);
4758 4758
 
@@ -4770,15 +4770,15 @@  discard block
 block discarded – undo
4770 4770
         if ($this->debug > 0) {
4771 4771
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4772 4772
         }
4773
-        if (intval($hide) == $hide){
4773
+        if (intval($hide) == $hide) {
4774 4774
             $this->hide_toc_frame = $hide;
4775 4775
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4776 4776
             $lp_id = $this->get_id();
4777 4777
             $sql = "UPDATE $lp_table SET
4778
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4778
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4779 4779
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4780 4780
             if ($this->debug > 2) {
4781
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4781
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4782 4782
             }
4783 4783
             Database::query($sql);
4784 4784
 
@@ -4805,7 +4805,7 @@  discard block
 block discarded – undo
4805 4805
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4806 4806
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4807 4807
         if ($this->debug > 2) {
4808
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4808
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4809 4809
         }
4810 4810
         Database::query($sql);
4811 4811
         return true;
@@ -4829,10 +4829,10 @@  discard block
 block discarded – undo
4829 4829
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4830 4830
         $lp_id = $this->get_id();
4831 4831
         $sql = "UPDATE $lp_table SET
4832
-                    content_local = '" . Database::escape_string($name) . "'
4832
+                    content_local = '".Database::escape_string($name)."'
4833 4833
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4834 4834
         if ($this->debug > 2) {
4835
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4835
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4836 4836
         }
4837 4837
         Database::query($sql);
4838 4838
         return true;
@@ -4866,11 +4866,11 @@  discard block
 block discarded – undo
4866 4866
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4867 4867
         $lp_id = $this->get_id();
4868 4868
         $sql = "UPDATE $lp_table SET
4869
-                    use_max_score = '" . $this->use_max_score . "'
4869
+                    use_max_score = '".$this->use_max_score."'
4870 4870
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4871 4871
 
4872 4872
         if ($this->debug > 2) {
4873
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4873
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4874 4874
         }
4875 4875
         Database::query($sql);
4876 4876
 
@@ -4897,10 +4897,10 @@  discard block
 block discarded – undo
4897 4897
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4898 4898
         $lp_id = $this->get_id();
4899 4899
         $sql = "UPDATE $lp_table SET
4900
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4900
+                expired_on = '".Database::escape_string($this->expired_on)."'
4901 4901
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4902 4902
         if ($this->debug > 2) {
4903
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4903
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4904 4904
         }
4905 4905
         Database::query($sql);
4906 4906
 
@@ -4926,10 +4926,10 @@  discard block
 block discarded – undo
4926 4926
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4927 4927
         $lp_id = $this->get_id();
4928 4928
         $sql = "UPDATE $lp_table SET
4929
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4929
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4930 4930
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4931 4931
         if ($this->debug > 2) {
4932
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4932
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4933 4933
         }
4934 4934
         Database::query($sql);
4935 4935
 
@@ -4949,10 +4949,10 @@  discard block
 block discarded – undo
4949 4949
         $this->modified_on = api_get_utc_datetime();
4950 4950
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4951 4951
         $lp_id = $this->get_id();
4952
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4952
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4953 4953
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4954 4954
         if ($this->debug > 2) {
4955
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4955
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4956 4956
         }
4957 4957
         Database::query($sql);
4958 4958
         return true;
@@ -5023,13 +5023,13 @@  discard block
 block discarded – undo
5023 5023
 
5024 5024
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5025 5025
             if ($this->debug > 2) {
5026
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5026
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5027 5027
             }
5028 5028
             switch ($this->get_type()) {
5029 5029
                 case '3' :
5030 5030
                     if ($this->items[$this->last]->get_type() != 'au') {
5031 5031
                         if ($this->debug > 2) {
5032
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5032
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5033 5033
                         }
5034 5034
                         $this->items[$this->last]->close();
5035 5035
                         //$this->autocomplete_parents($this->last);
@@ -5042,7 +5042,7 @@  discard block
 block discarded – undo
5042 5042
                 case '2' :
5043 5043
                     if ($this->items[$this->last]->get_type() != 'sco') {
5044 5044
                         if ($this->debug > 2) {
5045
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5045
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5046 5046
                         }
5047 5047
                         $this->items[$this->last]->close();
5048 5048
                         //$this->autocomplete_parents($this->last);
@@ -5056,7 +5056,7 @@  discard block
 block discarded – undo
5056 5056
                 case '1' :
5057 5057
                 default :
5058 5058
                     if ($this->debug > 2) {
5059
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5059
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5060 5060
                     }
5061 5061
                     $this->items[$this->last]->close();
5062 5062
                     break;
@@ -5082,7 +5082,7 @@  discard block
 block discarded – undo
5082 5082
         }
5083 5083
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5084 5084
         $sql = "SELECT * FROM $lp_table
5085
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5085
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5086 5086
         $res = Database::query($sql);
5087 5087
         if (Database :: num_rows($res) > 0) {
5088 5088
             $row = Database :: fetch_array($res);
@@ -5103,14 +5103,14 @@  discard block
 block discarded – undo
5103 5103
                     break;
5104 5104
             }
5105 5105
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5106
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5106
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5107 5107
             Database::query($sql);
5108 5108
             $this->mode = $view_mode;
5109 5109
 
5110 5110
             return $view_mode;
5111 5111
         } else {
5112 5112
             if ($this->debug > 2) {
5113
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5113
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5114 5114
             }
5115 5115
         }
5116 5116
         return -1;
@@ -5128,7 +5128,7 @@  discard block
 block discarded – undo
5128 5128
         }
5129 5129
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5130 5130
         $sql = "SELECT * FROM $lp_table
5131
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5131
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5132 5132
         $res = Database::query($sql);
5133 5133
         if (Database :: num_rows($res) > 0) {
5134 5134
             $row = Database :: fetch_array($res);
@@ -5141,14 +5141,14 @@  discard block
 block discarded – undo
5141 5141
                 $force_return = true;
5142 5142
             }
5143 5143
             $sql = "UPDATE $lp_table SET force_commit = $force
5144
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5144
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5145 5145
             Database::query($sql);
5146 5146
             $this->force_commit = $force_return;
5147 5147
 
5148 5148
             return $force_return;
5149 5149
         } else {
5150 5150
             if ($this->debug > 2) {
5151
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5151
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5152 5152
             }
5153 5153
         }
5154 5154
         return -1;
@@ -5177,7 +5177,7 @@  discard block
 block discarded – undo
5177 5177
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5178 5178
                     $need_fix = true;
5179 5179
                     $sql = "UPDATE $lp_table SET display_order = $i
5180
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5180
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5181 5181
                     Database::query($sql);
5182 5182
                 }
5183 5183
                 $i++;
@@ -5198,7 +5198,7 @@  discard block
 block discarded – undo
5198 5198
         }
5199 5199
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5200 5200
         $sql = "SELECT * FROM $lp_table
5201
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5201
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5202 5202
         $res = Database::query($sql);
5203 5203
         if (Database :: num_rows($res) > 0) {
5204 5204
             $row = Database :: fetch_array($res);
@@ -5209,13 +5209,13 @@  discard block
 block discarded – undo
5209 5209
                 $force = 1;
5210 5210
             }
5211 5211
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5212
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5212
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5213 5213
             Database::query($sql);
5214 5214
             $this->prevent_reinit = $force;
5215 5215
             return $force;
5216 5216
         } else {
5217 5217
             if ($this->debug > 2) {
5218
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5218
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5219 5219
             }
5220 5220
         }
5221 5221
         return -1;
@@ -5231,11 +5231,11 @@  discard block
 block discarded – undo
5231 5231
     {
5232 5232
         //Set default value for seriousgame_mode
5233 5233
         if (!isset($this->seriousgame_mode)) {
5234
-            $this->seriousgame_mode=0;
5234
+            $this->seriousgame_mode = 0;
5235 5235
         }
5236 5236
         // Set default value for prevent_reinit
5237 5237
         if (!isset($this->prevent_reinit)) {
5238
-            $this->prevent_reinit =1;
5238
+            $this->prevent_reinit = 1;
5239 5239
         }
5240 5240
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5241 5241
             return 'seriousgame';
@@ -5283,7 +5283,7 @@  discard block
 block discarded – undo
5283 5283
         $sql = "UPDATE $lp_table SET
5284 5284
                 prevent_reinit = $prevent_reinit ,
5285 5285
                 seriousgame_mode = $sg_mode
5286
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5286
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5287 5287
         $res = Database::query($sql);
5288 5288
         if ($res) {
5289 5289
             return true;
@@ -5335,7 +5335,7 @@  discard block
 block discarded – undo
5335 5335
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5336 5336
         }
5337 5337
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5338
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5338
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5339 5339
         $res = Database::query($sql);
5340 5340
         if (Database :: num_rows($res) > 0) {
5341 5341
             $row = Database :: fetch_array($res);
@@ -5346,13 +5346,13 @@  discard block
 block discarded – undo
5346 5346
                 $force = 1;
5347 5347
             }
5348 5348
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5349
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5349
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5350 5350
             Database::query($sql);
5351 5351
             $this->seriousgame_mode = $force;
5352 5352
             return $force;
5353 5353
         } else {
5354 5354
             if ($this->debug > 2) {
5355
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5355
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5356 5356
             }
5357 5357
         }
5358 5358
         return -1;
@@ -5370,7 +5370,7 @@  discard block
 block discarded – undo
5370 5370
         }
5371 5371
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5372 5372
         $sql = "SELECT * FROM $lp_table
5373
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5373
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5374 5374
         $res = Database::query($sql);
5375 5375
         if (Database :: num_rows($res) > 0) {
5376 5376
             $row = Database :: fetch_array($res);
@@ -5381,13 +5381,13 @@  discard block
 block discarded – undo
5381 5381
                 $force = 1;
5382 5382
             }
5383 5383
             $sql = "UPDATE $lp_table SET debug = $force
5384
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5384
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5385 5385
             $res = Database::query($sql);
5386 5386
             $this->scorm_debug = $force;
5387 5387
             return $force;
5388 5388
         } else {
5389 5389
             if ($this->debug > 2) {
5390
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5390
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5391 5391
             }
5392 5392
         }
5393 5393
         return -1;
@@ -5416,7 +5416,7 @@  discard block
 block discarded – undo
5416 5416
      * @param int $depth
5417 5417
      * @param array $tmp
5418 5418
      */
5419
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5419
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5420 5420
     {
5421 5421
         if ($this->debug > 1) {
5422 5422
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5502,7 +5502,7 @@  discard block
 block discarded – undo
5502 5502
 
5503 5503
         // we need to start a form when we want to update all the mp3 files
5504 5504
         if ($update_audio == 'true') {
5505
-            $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5505
+            $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5506 5506
         }
5507 5507
         $return .= '<div id="message"></div>';
5508 5508
         if (count($this->items) == 0) {
@@ -5510,14 +5510,14 @@  discard block
 block discarded – undo
5510 5510
         } else {
5511 5511
             $return_audio = '<table class="data_table">';
5512 5512
             $return_audio .= '<tr>';
5513
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5514
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5513
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5514
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5515 5515
             $return_audio .= '</tr>';
5516 5516
 
5517 5517
             if ($update_audio != 'true') {
5518 5518
                 $return .= '<div class="col-md-12">';
5519 5519
                 $return .= self::return_new_tree($update_audio);
5520
-                $return .='</div>';
5520
+                $return .= '</div>';
5521 5521
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5522 5522
             } else {
5523 5523
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5527,7 +5527,7 @@  discard block
 block discarded – undo
5527 5527
             // We need to close the form when we are updating the mp3 files.
5528 5528
             if ($update_audio == 'true') {
5529 5529
                 $return .= '<div class="footer-audio">';
5530
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5530
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5531 5531
                 $return .= '</div>';
5532 5532
                 //$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?
5533 5533
             }
@@ -5548,7 +5548,7 @@  discard block
 block discarded – undo
5548 5548
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5549 5549
     {
5550 5550
         $return = '';
5551
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5551
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5552 5552
 
5553 5553
         $course_id = api_get_course_int_id();
5554 5554
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5596,7 +5596,7 @@  discard block
 block discarded – undo
5596 5596
 
5597 5597
             // Link for the documents
5598 5598
             if ($arrLP[$i]['item_type'] == 'document') {
5599
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5599
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5600 5600
                 $title_cut = Display::url(
5601 5601
                     $title_cut,
5602 5602
                     $url,
@@ -5617,14 +5617,14 @@  discard block
 block discarded – undo
5617 5617
             } else {
5618 5618
                 $oddClass = 'row_even';
5619 5619
             }
5620
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5620
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5621 5621
 
5622 5622
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5623 5623
 
5624
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5624
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5625 5625
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5626 5626
             } else {
5627
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5627
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5628 5628
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5629 5629
                 } else {
5630 5630
                     if ($arrLP[$i]['item_type'] === TOOL_LP_FINAL_ITEM) {
@@ -5636,7 +5636,7 @@  discard block
 block discarded – undo
5636 5636
             }
5637 5637
 
5638 5638
             // The audio column.
5639
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5639
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5640 5640
             $audio = '';
5641 5641
 
5642 5642
             if (!$update_audio || $update_audio <> 'true') {
@@ -5647,10 +5647,10 @@  discard block
 block discarded – undo
5647 5647
             } else {
5648 5648
                 $types = self::getChapterTypes();
5649 5649
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5650
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5650
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5651 5651
                     if (!empty ($arrLP[$i]['audio'])) {
5652 5652
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5653
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5653
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5654 5654
                     }
5655 5655
                 }
5656 5656
             }
@@ -5676,7 +5676,7 @@  discard block
 block discarded – undo
5676 5676
                 // No edit for this item types
5677 5677
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset', 'final_item'))) {
5678 5678
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5679
-                        $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">';
5679
+                        $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">';
5680 5680
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5681 5681
                         $edit_icon .= '</a>';
5682 5682
 
@@ -5689,7 +5689,7 @@  discard block
 block discarded – undo
5689 5689
                                 $this->lp_session_id
5690 5690
                             )
5691 5691
                             ) {
5692
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5692
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5693 5693
                                     'action' => 'dissociate_forum',
5694 5694
                                     'id' => $arrLP[$i]['id'],
5695 5695
                                     'lp_id' => $this->lp_id
@@ -5700,7 +5700,7 @@  discard block
 block discarded – undo
5700 5700
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5701 5701
                                 );
5702 5702
                             } else {
5703
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5703
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5704 5704
                                     'action' => 'create_forum',
5705 5705
                                     'id' => $arrLP[$i]['id'],
5706 5706
                                     'lp_id' => $this->lp_id
@@ -5713,17 +5713,17 @@  discard block
 block discarded – undo
5713 5713
                             }
5714 5714
                         }
5715 5715
                     } else {
5716
-                        $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">';
5716
+                        $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 5717
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5718 5718
                         $edit_icon .= '</a>';
5719 5719
                     }
5720 5720
                 }
5721 5721
 
5722
-                $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">';
5722
+                $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 5723
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5724 5724
                 $delete_icon .= '</a>';
5725 5725
 
5726
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5726
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5727 5727
 
5728 5728
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5729 5729
                     $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq', ['class' => 'btn btn-default']);
@@ -5732,8 +5732,8 @@  discard block
 block discarded – undo
5732 5732
                 }
5733 5733
             }
5734 5734
             if ($update_audio != 'true') {
5735
-                $row = $move_icon . ' ' . $icon .
5736
-                    Display::span($title_cut) .
5735
+                $row = $move_icon.' '.$icon.
5736
+                    Display::span($title_cut).
5737 5737
                     Display::tag(
5738 5738
                         'div',
5739 5739
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5754,8 +5754,8 @@  discard block
 block discarded – undo
5754 5754
                 $parent_arrays = array();
5755 5755
                 if ($arrLP[$i]['depth'] > 1) {
5756 5756
                     //Getting list of parents
5757
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5758
-                        foreach($arrLP as $item) {
5757
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5758
+                        foreach ($arrLP as $item) {
5759 5759
                             if ($item['id'] == $parent_id) {
5760 5760
                                 if ($item['parent_item_id'] == 0) {
5761 5761
                                     $parent_id = $item['id'];
@@ -5777,8 +5777,8 @@  discard block
 block discarded – undo
5777 5777
                     $parent_arrays = array_reverse($parent_arrays);
5778 5778
                     $val = '$elements';
5779 5779
                     $x = 0;
5780
-                    foreach($parent_arrays as $item) {
5781
-                        if ($x != count($parent_arrays) -1) {
5780
+                    foreach ($parent_arrays as $item) {
5781
+                        if ($x != count($parent_arrays) - 1) {
5782 5782
                             $val .= '["'.$item.'"]["children"]';
5783 5783
                         } else {
5784 5784
                             $val .= '["'.$item.'"]["children"]';
@@ -5841,7 +5841,7 @@  discard block
 block discarded – undo
5841 5841
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5842 5842
                     $active = 'active';
5843 5843
                 }
5844
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5844
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5845 5845
             } else {
5846 5846
                 //sections
5847 5847
                 if (isset($item['children'])) {
@@ -5864,17 +5864,17 @@  discard block
 block discarded – undo
5864 5864
     {
5865 5865
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5866 5866
         $return = '<div class="actions">';
5867
-        $return .=  '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '&isStudentView=true">' . Display :: return_icon('preview_view.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'</a> ';
5868
-        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id=' . $_SESSION['oLP']->lp_id . '&updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM).'</a>';
5869
-        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM).'</a>';
5867
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'&isStudentView=true">'.Display :: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM).'</a> ';
5868
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id='.$_SESSION['oLP']->lp_id.'&updateaudio=true">'.Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM).'</a>';
5869
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM).'</a>';
5870 5870
         $buttons = array(
5871 5871
             array(
5872 5872
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5873
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5873
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5874 5874
             ),
5875 5875
             array(
5876 5876
                 'title' => get_lang('ClearAllPrerequisites'),
5877
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5877
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5878 5878
             ),
5879 5879
         );
5880 5880
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5897,7 +5897,7 @@  discard block
 block discarded – undo
5897 5897
     {
5898 5898
         // Creating learning_path folder
5899 5899
         $dir = '/learning_path';
5900
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5900
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5901 5901
         $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5902 5902
 
5903 5903
         $folder = false;
@@ -5944,9 +5944,9 @@  discard block
 block discarded – undo
5944 5944
         // Creating LP folder
5945 5945
         if ($folder) {
5946 5946
             //Limits title size
5947
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5947
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5948 5948
             $dir   = $dir.$title;
5949
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5949
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5950 5950
             if (!is_dir($filepath.'/'.$dir)) {
5951 5951
                 $folderData = create_unexisting_directory(
5952 5952
                     $course,
@@ -5966,7 +5966,7 @@  discard block
 block discarded – undo
5966 5966
             }
5967 5967
             $dir = $dir.'/';
5968 5968
             if ($folder) {
5969
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5969
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5970 5970
             }
5971 5971
         }
5972 5972
         $array = array(
@@ -6008,12 +6008,12 @@  discard block
 block discarded – undo
6008 6008
             $dir = substr($dir, 1);
6009 6009
         }
6010 6010
         if (!empty($dir[0]) && $dir[0] != '/') {
6011
-            $dir = '/' . $dir;
6011
+            $dir = '/'.$dir;
6012 6012
         }
6013 6013
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
6014 6014
             $dir .= '/';
6015 6015
         }
6016
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
6016
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6017 6017
 
6018 6018
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
6019 6019
             //Generates folder
@@ -6023,7 +6023,7 @@  discard block
 block discarded – undo
6023 6023
         }
6024 6024
 
6025 6025
         if (!is_dir($filepath)) {
6026
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6026
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6027 6027
             $dir = '/';
6028 6028
         }
6029 6029
 
@@ -6043,10 +6043,10 @@  discard block
 block discarded – undo
6043 6043
         $tmp_filename = $filename;
6044 6044
 
6045 6045
         $i = 0;
6046
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6047
-            $tmp_filename = $filename . '_' . ++ $i;
6046
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6047
+            $tmp_filename = $filename.'_'.++ $i;
6048 6048
 
6049
-        $filename = $tmp_filename . '.'.$extension;
6049
+        $filename = $tmp_filename.'.'.$extension;
6050 6050
         if ($extension == 'html') {
6051 6051
             $content = stripslashes($content);
6052 6052
             $content = str_replace(
@@ -6081,12 +6081,12 @@  discard block
 block discarded – undo
6081 6081
             );
6082 6082
         }
6083 6083
 
6084
-        if (!file_exists($filepath . $filename)) {
6085
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6084
+        if (!file_exists($filepath.$filename)) {
6085
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6086 6086
                 fputs($fp, $content);
6087 6087
                 fclose($fp);
6088 6088
 
6089
-                $file_size = filesize($filepath . $filename);
6089
+                $file_size = filesize($filepath.$filename);
6090 6090
                 $save_file_path = $dir.$filename;
6091 6091
 
6092 6092
                 $document_id = add_document(
@@ -6124,12 +6124,12 @@  discard block
 block discarded – undo
6124 6124
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6125 6125
                         $ct = '';
6126 6126
                         if ($new_comment)
6127
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6127
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6128 6128
                         if ($new_title)
6129
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6129
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6130 6130
 
6131
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6132
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6131
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6132
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6133 6133
                         Database::query($sql);
6134 6134
                     }
6135 6135
                 }
@@ -6157,41 +6157,41 @@  discard block
 block discarded – undo
6157 6157
             $dir = substr($dir, 1);
6158 6158
 
6159 6159
         if ($dir[0] != '/')
6160
-            $dir = '/' . $dir;
6160
+            $dir = '/'.$dir;
6161 6161
 
6162 6162
         if ($dir[strlen($dir) - 1] != '/')
6163 6163
             $dir .= '/';
6164 6164
 
6165
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6165
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6166 6166
 
6167 6167
         if (!is_dir($filepath)) {
6168
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6168
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6169 6169
         }
6170 6170
 
6171 6171
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6172 6172
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6173 6173
             $document_id = intval($_POST['path']);
6174
-            $sql = "SELECT path FROM " . $table_doc . "
6175
-                    WHERE c_id = $course_id AND id = " . $document_id;
6174
+            $sql = "SELECT path FROM ".$table_doc."
6175
+                    WHERE c_id = $course_id AND id = ".$document_id;
6176 6176
             $res = Database::query($sql);
6177 6177
             $row = Database :: fetch_array($res);
6178 6178
             $content = stripslashes($_POST['content_lp']);
6179
-            $file = $filepath . $row['path'];
6179
+            $file = $filepath.$row['path'];
6180 6180
 
6181 6181
             if ($fp = @ fopen($file, 'w')) {
6182
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6182
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6183 6183
 
6184 6184
                 // Change the path of mp3 to absolute.
6185 6185
                 // The first regexp deals with :// urls.
6186
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6186
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6187 6187
                 // The second regexp deals with audio/ urls.
6188
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6188
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6189 6189
                 fputs($fp, $content);
6190 6190
                 fclose($fp);
6191 6191
 
6192
-                $sql = "UPDATE " . $table_doc ." SET
6192
+                $sql = "UPDATE ".$table_doc." SET
6193 6193
                             title='".Database::escape_string($_POST['title'])."'
6194
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6194
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6195 6195
                 Database::query($sql);
6196 6196
             }
6197 6197
         }
@@ -6209,10 +6209,10 @@  discard block
 block discarded – undo
6209 6209
         $return = '';
6210 6210
         if (is_numeric($item_id)) {
6211 6211
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6212
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6213
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6212
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6213
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6214 6214
             $result = Database::query($sql);
6215
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6215
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6216 6216
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6217 6217
 
6218 6218
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6239,8 +6239,8 @@  discard block
 block discarded – undo
6239 6239
                         break;
6240 6240
                     case TOOL_DOCUMENT:
6241 6241
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6242
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6243
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6242
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6243
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6244 6244
                         $result = Database::query($sql_doc);
6245 6245
                         $path_file = Database::result($result, 0, 0);
6246 6246
                         $path_parts = pathinfo($path_file);
@@ -6279,7 +6279,7 @@  discard block
 block discarded – undo
6279 6279
         if (is_numeric($item_id)) {
6280 6280
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6281 6281
             $sql = "SELECT * FROM $tbl_lp_item
6282
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6282
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6283 6283
             $res = Database::query($sql);
6284 6284
             $row = Database::fetch_array($res);
6285 6285
             switch ($row['item_type']) {
@@ -6289,21 +6289,21 @@  discard block
 block discarded – undo
6289 6289
                 case 'sco':
6290 6290
                     if (isset($_GET['view']) && $_GET['view'] == 'build') {
6291 6291
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6292
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6292
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6293 6293
                     } else {
6294
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6294
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6295 6295
                     }
6296 6296
                     break;
6297 6297
                 case TOOL_DOCUMENT:
6298 6298
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6299 6299
                     $sql = "SELECT lp.*, doc.path as dir
6300
-                            FROM " . $tbl_lp_item . " as lp
6301
-                            LEFT JOIN " . $tbl_doc . " as doc
6300
+                            FROM " . $tbl_lp_item." as lp
6301
+                            LEFT JOIN " . $tbl_doc." as doc
6302 6302
                             ON doc.id = lp.path
6303 6303
                             WHERE
6304 6304
                                 lp.c_id = $course_id AND
6305 6305
                                 doc.c_id = $course_id AND
6306
-                                lp.id = " . intval($item_id);
6306
+                                lp.id = ".intval($item_id);
6307 6307
                     $res_step = Database::query($sql);
6308 6308
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6309 6309
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6313,8 +6313,8 @@  discard block
 block discarded – undo
6313 6313
                     $link_id = (string) $row['path'];
6314 6314
                     if (ctype_digit($link_id)) {
6315 6315
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6316
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6317
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6316
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6317
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6318 6318
                         $res_link = Database::query($sql_select);
6319 6319
                         $row_link = Database :: fetch_array($res_link);
6320 6320
                         if (is_array($row_link)) {
@@ -6328,13 +6328,13 @@  discard block
 block discarded – undo
6328 6328
                     $_SESSION['finalItem'] = true;
6329 6329
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6330 6330
                     $sql = "SELECT lp.*, doc.path as dir
6331
-                            FROM " . $tbl_lp_item . " as lp
6332
-                            LEFT JOIN " . $tbl_doc . " as doc
6331
+                            FROM " . $tbl_lp_item." as lp
6332
+                            LEFT JOIN " . $tbl_doc." as doc
6333 6333
                             ON doc.id = lp.path
6334 6334
                             WHERE
6335 6335
                                 lp.c_id = $course_id AND
6336 6336
                                 doc.c_id = $course_id AND
6337
-                                lp.id = " . intval($item_id);
6337
+                                lp.id = ".intval($item_id);
6338 6338
                     $res_step = Database::query($sql);
6339 6339
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6340 6340
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6343,9 +6343,9 @@  discard block
 block discarded – undo
6343 6343
                 case 'dokeos_module':
6344 6344
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6345 6345
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6346
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6346
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6347 6347
                     } else {
6348
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6348
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6349 6349
                     }
6350 6350
                     break;
6351 6351
                 case TOOL_QUIZ:
@@ -6403,7 +6403,7 @@  discard block
 block discarded – undo
6403 6403
 
6404 6404
         $headers = array(
6405 6405
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6406
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6406
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6407 6407
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6408 6408
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6409 6409
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6444,16 +6444,16 @@  discard block
 block discarded – undo
6444 6444
         $course_id = api_get_course_int_id();
6445 6445
         $return = '';
6446 6446
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6447
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6448
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6447
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6448
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6449 6449
         $res_doc = Database::query($sql_doc);
6450 6450
         $row_doc = Database :: fetch_array($res_doc);
6451 6451
 
6452 6452
         // TODO: Add a path filter.
6453 6453
         if ($iframe) {
6454
-            $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>';
6454
+            $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>';
6455 6455
         } else {
6456
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6456
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6457 6457
         }
6458 6458
 
6459 6459
         return $return;
@@ -6477,8 +6477,8 @@  discard block
 block discarded – undo
6477 6477
             $item_description = $extra_info['description'];
6478 6478
         } elseif (is_numeric($extra_info)) {
6479 6479
             $sql = "SELECT title, description
6480
-                    FROM " . $tbl_quiz . "
6481
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6480
+                    FROM " . $tbl_quiz."
6481
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6482 6482
 
6483 6483
             $result = Database::query($sql);
6484 6484
             $row = Database::fetch_array($result);
@@ -6488,21 +6488,21 @@  discard block
 block discarded – undo
6488 6488
             $item_title = '';
6489 6489
             $item_description = '';
6490 6490
         }
6491
-        $item_title			= Security::remove_XSS($item_title);
6492
-        $item_description 	= Security::remove_XSS($item_description);
6491
+        $item_title = Security::remove_XSS($item_title);
6492
+        $item_description = Security::remove_XSS($item_description);
6493 6493
 
6494 6494
         if ($id != 0 && is_array($extra_info))
6495 6495
             $parent = $extra_info['parent_item_id'];
6496 6496
         else
6497 6497
             $parent = 0;
6498 6498
 
6499
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6500
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6499
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6500
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6501 6501
 
6502 6502
         $result = Database::query($sql);
6503
-        $arrLP = array ();
6503
+        $arrLP = array();
6504 6504
         while ($row = Database :: fetch_array($result)) {
6505
-            $arrLP[] = array (
6505
+            $arrLP[] = array(
6506 6506
                 'id' => $row['id'],
6507 6507
                 'item_type' => $row['item_type'],
6508 6508
                 'title' => $row['title'],
@@ -6524,7 +6524,7 @@  discard block
 block discarded – undo
6524 6524
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6525 6525
         unset ($this->arrMenu);
6526 6526
 
6527
-        $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6527
+        $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6528 6528
         $defaults = [];
6529 6529
 
6530 6530
         if ($action == 'add') {
@@ -6536,7 +6536,7 @@  discard block
 block discarded – undo
6536 6536
         }
6537 6537
 
6538 6538
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6539
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6539
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6540 6540
         }
6541 6541
 
6542 6542
         $form->addHeader($legend);
@@ -6555,7 +6555,7 @@  discard block
 block discarded – undo
6555 6555
         );
6556 6556
         $selectParent->addOption($this->name, 0);
6557 6557
 
6558
-        $arrHide = array (
6558
+        $arrHide = array(
6559 6559
             $id
6560 6560
         );
6561 6561
         for ($i = 0; $i < count($arrLP); $i++) {
@@ -6572,7 +6572,7 @@  discard block
 block discarded – undo
6572 6572
                     $selectParent->addOption(
6573 6573
                         $arrLP[$i]['title'],
6574 6574
                         $arrLP[$i]['id'],
6575
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6575
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6576 6576
                     );
6577 6577
 
6578 6578
                     if ($parent == $arrLP[$i]['id']) {
@@ -6589,7 +6589,7 @@  discard block
 block discarded – undo
6589 6589
                 ) {
6590 6590
                     $selectParent->addOption(
6591 6591
                         $arrLP[$i]['title'],
6592
-                        $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6592
+                        $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6593 6593
                     );
6594 6594
 
6595 6595
                     if ($parent == $arrLP[$i]['id']) {
@@ -6607,7 +6607,7 @@  discard block
 block discarded – undo
6607 6607
 
6608 6608
         for ($i = 0; $i < count($arrLP); $i++) {
6609 6609
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6610
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
6610
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
6611 6611
 
6612 6612
                 if (is_array($extra_info)) {
6613 6613
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
@@ -6629,7 +6629,7 @@  discard block
 block discarded – undo
6629 6629
                     }
6630 6630
                 }
6631 6631
             }
6632
-            $arrHide = array ();
6632
+            $arrHide = array();
6633 6633
             for ($i = 0; $i < count($arrLP); $i++) {
6634 6634
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6635 6635
                     if (is_array($extra_info)) {
@@ -6694,7 +6694,7 @@  discard block
 block discarded – undo
6694 6694
 
6695 6695
         $form->setDefaults($defaults);
6696 6696
 
6697
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
6697
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
6698 6698
     }
6699 6699
 
6700 6700
     /**
@@ -6716,11 +6716,11 @@  discard block
 block discarded – undo
6716 6716
         } elseif (is_numeric($extra_info)) {
6717 6717
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6718 6718
 
6719
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6719
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6720 6720
                     WHERE
6721 6721
                         c_id = ".$course_id." AND
6722
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6723
-                        id = " . (int) $extra_info . "
6722
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6723
+                        id = " . (int) $extra_info."
6724 6724
                     ORDER BY id ASC";
6725 6725
 
6726 6726
             $res_hot = Database::query($sql);
@@ -6744,11 +6744,11 @@  discard block
 block discarded – undo
6744 6744
         }
6745 6745
 
6746 6746
         $sql = "SELECT * FROM $tbl_lp_item
6747
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6747
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6748 6748
         $result = Database::query($sql);
6749
-        $arrLP = array ();
6749
+        $arrLP = array();
6750 6750
         while ($row = Database :: fetch_array($result)) {
6751
-            $arrLP[] = array (
6751
+            $arrLP[] = array(
6752 6752
                 'id' => $row['id'],
6753 6753
                 'item_type' => $row['item_type'],
6754 6754
                 'title' => $row['title'],
@@ -6773,7 +6773,7 @@  discard block
 block discarded – undo
6773 6773
         else
6774 6774
             $legend .= get_lang('EditCurrentExecice');
6775 6775
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6776
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6776
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6777 6777
         }
6778 6778
         $legend .= '</legend>';
6779 6779
 
@@ -6781,11 +6781,11 @@  discard block
 block discarded – undo
6781 6781
         $return .= $legend;
6782 6782
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6783 6783
         $return .= '<tr>';
6784
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6784
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6785 6785
         $return .= '<td class="input">';
6786 6786
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6787
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6788
-        $arrHide = array (
6787
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6788
+        $arrHide = array(
6789 6789
             $id
6790 6790
         );
6791 6791
 
@@ -6793,13 +6793,13 @@  discard block
 block discarded – undo
6793 6793
             for ($i = 0; $i < count($arrLP); $i++) {
6794 6794
                 if ($action != 'add') {
6795 6795
                     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)) {
6796
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6796
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6797 6797
                     } else {
6798 6798
                         $arrHide[] = $arrLP[$i]['id'];
6799 6799
                     }
6800 6800
                 } else {
6801 6801
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6802
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6802
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6803 6803
                 }
6804 6804
             }
6805 6805
 
@@ -6810,10 +6810,10 @@  discard block
 block discarded – undo
6810 6810
         $return .= '</td>';
6811 6811
         $return .= '</tr>';
6812 6812
         $return .= '<tr>';
6813
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6813
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6814 6814
         $return .= '<td class="input">';
6815 6815
         $return .= '<select id="previous" name="previous" size="1">';
6816
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6816
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6817 6817
 
6818 6818
         for ($i = 0; $i < count($arrLP); $i++) {
6819 6819
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6823,7 +6823,7 @@  discard block
 block discarded – undo
6823 6823
                 else
6824 6824
                     $selected = '';
6825 6825
 
6826
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6826
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6827 6827
             }
6828 6828
         }
6829 6829
 
@@ -6833,8 +6833,8 @@  discard block
 block discarded – undo
6833 6833
 
6834 6834
         if ($action != 'move') {
6835 6835
             $return .= '<tr>';
6836
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6837
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6836
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6837
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6838 6838
             $return .= '</tr>';
6839 6839
             $id_prerequisite = 0;
6840 6840
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6845,7 +6845,7 @@  discard block
 block discarded – undo
6845 6845
                     }
6846 6846
                 }
6847 6847
 
6848
-                $arrHide = array ();
6848
+                $arrHide = array();
6849 6849
                 for ($i = 0; $i < count($arrLP); $i++) {
6850 6850
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6851 6851
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6859,22 +6859,22 @@  discard block
 block discarded – undo
6859 6859
         }
6860 6860
 
6861 6861
         $return .= '<tr>';
6862
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6862
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6863 6863
         $return .= '</tr>';
6864 6864
         $return .= '</table>';
6865 6865
 
6866 6866
         if ($action == 'move') {
6867
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6868
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6867
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6868
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6869 6869
         }
6870 6870
 
6871 6871
         if (is_numeric($extra_info)) {
6872
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6872
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6873 6873
         } elseif (is_array($extra_info)) {
6874
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6874
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6875 6875
         }
6876
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6877
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6876
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6877
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6878 6878
         $return .= '</form>';
6879 6879
 
6880 6880
         return $return;
@@ -6897,8 +6897,8 @@  discard block
 block discarded – undo
6897 6897
             $item_title = stripslashes($extra_info['title']);
6898 6898
         } elseif (is_numeric($extra_info)) {
6899 6899
             $sql = "SELECT forum_title as title, forum_comment as comment
6900
-                    FROM " . $tbl_forum . "
6901
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6900
+                    FROM " . $tbl_forum."
6901
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6902 6902
 
6903 6903
             $result = Database::query($sql);
6904 6904
             $row = Database :: fetch_array($result);
@@ -6916,7 +6916,7 @@  discard block
 block discarded – undo
6916 6916
             $parent = 0;
6917 6917
         }
6918 6918
 
6919
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6919
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6920 6920
                 WHERE
6921 6921
                     c_id = ".$course_id." AND
6922 6922
                     lp_id = " . $this->lp_id;
@@ -6924,7 +6924,7 @@  discard block
 block discarded – undo
6924 6924
         $arrLP = array();
6925 6925
 
6926 6926
         while ($row = Database :: fetch_array($result)) {
6927
-            $arrLP[] = array (
6927
+            $arrLP[] = array(
6928 6928
                 'id' => $row['id'],
6929 6929
                 'item_type' => $row['item_type'],
6930 6930
                 'title' => $row['title'],
@@ -6953,7 +6953,7 @@  discard block
 block discarded – undo
6953 6953
             $legend = get_lang('EditCurrentForum');
6954 6954
         }
6955 6955
 
6956
-        $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6956
+        $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6957 6957
         $defaults = [];
6958 6958
 
6959 6959
         $form->addHeader($legend);
@@ -6982,7 +6982,7 @@  discard block
 block discarded – undo
6982 6982
                     $selectParent->addOption(
6983 6983
                         $arrLP[$i]['title'],
6984 6984
                         $arrLP[$i]['id'],
6985
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6985
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6986 6986
                     );
6987 6987
 
6988 6988
                     if ($parent == $arrLP[$i]['id']) {
@@ -7000,7 +7000,7 @@  discard block
 block discarded – undo
7000 7000
                     $selectParent->addOption(
7001 7001
                         $arrLP[$i]['title'],
7002 7002
                         $arrLP[$i]['id'],
7003
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7003
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7004 7004
                     );
7005 7005
 
7006 7006
                     if ($parent == $arrLP[$i]['id']) {
@@ -7023,7 +7023,7 @@  discard block
 block discarded – undo
7023 7023
 
7024 7024
         for ($i = 0; $i < count($arrLP); $i++) {
7025 7025
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7026
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
7026
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
7027 7027
 
7028 7028
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7029 7029
                     $selectPrevious->setSelected($arrLP[$i]['id']);
@@ -7075,7 +7075,7 @@  discard block
 block discarded – undo
7075 7075
         $form->addHidden('post_time', time());
7076 7076
         $form->setDefaults($defaults);
7077 7077
 
7078
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
7078
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
7079 7079
     }
7080 7080
 
7081 7081
     /**
@@ -7098,7 +7098,7 @@  discard block
 block discarded – undo
7098 7098
             $item_title = stripslashes($extra_info['title']);
7099 7099
         } elseif (is_numeric($extra_info)) {
7100 7100
             $sql = "SELECT thread_title as title FROM $tbl_forum
7101
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7101
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7102 7102
 
7103 7103
             $result = Database::query($sql);
7104 7104
             $row = Database :: fetch_array($result);
@@ -7116,15 +7116,15 @@  discard block
 block discarded – undo
7116 7116
             $parent = 0;
7117 7117
         }
7118 7118
 
7119
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7120
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7119
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7120
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7121 7121
 
7122 7122
         $result = Database::query($sql);
7123 7123
 
7124
-        $arrLP = array ();
7124
+        $arrLP = array();
7125 7125
 
7126 7126
         while ($row = Database :: fetch_array($result)) {
7127
-            $arrLP[] = array (
7127
+            $arrLP[] = array(
7128 7128
                 'id' => $row['id'],
7129 7129
                 'item_type' => $row['item_type'],
7130 7130
                 'title' => $row['title'],
@@ -7145,7 +7145,7 @@  discard block
 block discarded – undo
7145 7145
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7146 7146
         unset ($this->arrMenu);
7147 7147
 
7148
-        $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7148
+        $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7149 7149
         $defaults = [];
7150 7150
 
7151 7151
         if ($action == 'add') {
@@ -7165,7 +7165,7 @@  discard block
 block discarded – undo
7165 7165
         );
7166 7166
         $selectParent->addOption($this->name, 0);
7167 7167
 
7168
-        $arrHide = array (
7168
+        $arrHide = array(
7169 7169
             $id
7170 7170
         );
7171 7171
 
@@ -7183,7 +7183,7 @@  discard block
 block discarded – undo
7183 7183
                     $selectParent->addOption(
7184 7184
                         $arrLP[$i]['title'],
7185 7185
                         $arrLP[$i]['id'],
7186
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7186
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7187 7187
                     );
7188 7188
 
7189 7189
                     if ($parent == $arrLP[$i]['id']) {
@@ -7201,7 +7201,7 @@  discard block
 block discarded – undo
7201 7201
                     $selectParent->addOption(
7202 7202
                         $arrLP[$i]['title'],
7203 7203
                         $arrLP[$i]['id'],
7204
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7204
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7205 7205
                     );
7206 7206
 
7207 7207
                     if ($parent == $arrLP[$i]['id']) {
@@ -7221,7 +7221,7 @@  discard block
 block discarded – undo
7221 7221
         for ($i = 0; $i < count($arrLP); $i++) {
7222 7222
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7223 7223
                 $selectPrevious->addOption(
7224
-                    get_lang('After')  . ' "' . $arrLP[$i]['title'] . '"',
7224
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
7225 7225
                     $arrLP[$i]['id']
7226 7226
                 );
7227 7227
 
@@ -7319,10 +7319,10 @@  discard block
 block discarded – undo
7319 7319
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7320 7320
 
7321 7321
         if ($id != 0 && is_array($extra_info)) {
7322
-            $item_title 		= $extra_info['title'];
7323
-            $item_description 	= $extra_info['description'];
7324
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7325
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7322
+            $item_title = $extra_info['title'];
7323
+            $item_description = $extra_info['description'];
7324
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7325
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7326 7326
         } else {
7327 7327
             $item_title = '';
7328 7328
             $item_description = '';
@@ -7336,17 +7336,17 @@  discard block
 block discarded – undo
7336 7336
         }
7337 7337
 
7338 7338
         $id  = intval($id);
7339
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7339
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7340 7340
                 WHERE
7341 7341
                     c_id = ".$course_id." AND
7342
-                    lp_id = " . $this->lp_id . " AND
7342
+                    lp_id = " . $this->lp_id." AND
7343 7343
                     id != $id";
7344 7344
 
7345 7345
         if ($item_type == 'module')
7346 7346
             $sql .= " AND parent_item_id = 0";
7347 7347
 
7348 7348
         $result = Database::query($sql);
7349
-        $arrLP = array ();
7349
+        $arrLP = array();
7350 7350
 
7351 7351
         while ($row = Database :: fetch_array($result)) {
7352 7352
             $arrLP[] = array(
@@ -7374,9 +7374,9 @@  discard block
 block discarded – undo
7374 7374
 
7375 7375
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7376 7376
 
7377
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7377
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7378 7378
 
7379
-        $form = new FormValidator('form', 'POST',  $url);
7379
+        $form = new FormValidator('form', 'POST', $url);
7380 7380
 
7381 7381
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7382 7382
         $defaults['description'] = $item_description;
@@ -7420,7 +7420,7 @@  discard block
 block discarded – undo
7420 7420
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7421 7421
 
7422 7422
             foreach ($arrHide as $key => $value) {
7423
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7423
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7424 7424
             }
7425 7425
             if (!empty($s_selected_parent)) {
7426 7426
                 $parent_select->setSelected($s_selected_parent);
@@ -7442,16 +7442,16 @@  discard block
 block discarded – undo
7442 7442
                     $s_selected_position = $arrLP[$i]['id'];
7443 7443
                 }
7444 7444
 
7445
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7445
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7446 7446
             }
7447 7447
         }
7448 7448
 
7449 7449
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7450 7450
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7451
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7451
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7452 7452
 
7453 7453
         foreach ($arrHide as $key => $value) {
7454
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7454
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7455 7455
         }
7456 7456
 
7457 7457
         if (!empty ($s_selected_position)) {
@@ -7480,23 +7480,23 @@  discard block
 block discarded – undo
7480 7480
         //assets can't be modified
7481 7481
 
7482 7482
         //$item_type == 'asset' ||
7483
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7483
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7484 7484
 
7485 7485
             if ($item_type == 'sco') {
7486
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7486
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7487 7487
             }
7488 7488
             $renderer = $form->defaultRenderer();
7489 7489
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7490 7490
 
7491 7491
             $relative_prefix = '';
7492 7492
 
7493
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7493
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7494 7494
                 'Width' 				=> '100%',
7495 7495
                 'Height' 				=> '500',
7496 7496
                 'FullPage' 				=> true,
7497 7497
                 'CreateDocumentDir' 	=> $relative_prefix,
7498
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7499
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7498
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7499
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7500 7500
             );
7501 7501
 
7502 7502
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7505,7 +7505,7 @@  discard block
 block discarded – undo
7505 7505
             $defaults['content_lp'] = file_get_contents($content_path);
7506 7506
         }
7507 7507
 
7508
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7508
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7509 7509
         $form->addElement('hidden', 'post_time', time());
7510 7510
         $form->setDefaults($defaults);
7511 7511
         return $form->return_form();
@@ -7543,8 +7543,8 @@  discard block
 block discarded – undo
7543 7543
         // We don't display the document form if it's not an editable document (html or txt file).
7544 7544
         if ($action == "add") {
7545 7545
             if (is_numeric($extra_info)) {
7546
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7547
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7546
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7547
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7548 7548
                 $result = Database::query($sql_doc);
7549 7549
                 $path_file = Database :: result($result, 0, 0);
7550 7550
                 $path_parts = pathinfo($path_file);
@@ -7562,13 +7562,13 @@  discard block
 block discarded – undo
7562 7562
                 $item_title = stripslashes($path_parts['filename']);
7563 7563
             }
7564 7564
         } elseif (is_numeric($extra_info)) {
7565
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7565
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7566 7566
                         WHERE
7567 7567
                             c_id = ".$course_id." AND
7568 7568
                             id = " . intval($extra_info);
7569 7569
 
7570 7570
             $result = Database::query($sql_doc);
7571
-            $row 	= Database::fetch_array($result);
7571
+            $row = Database::fetch_array($result);
7572 7572
             $item_title = $row['title'];
7573 7573
             $item_title = str_replace('_', ' ', $item_title);
7574 7574
             if (empty ($item_title)) {
@@ -7587,11 +7587,11 @@  discard block
 block discarded – undo
7587 7587
             $parent = 0;
7588 7588
         }
7589 7589
 
7590
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7591
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7590
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7591
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7592 7592
 
7593 7593
         $result = Database::query($sql);
7594
-        $arrLP = array ();
7594
+        $arrLP = array();
7595 7595
         while ($row = Database :: fetch_array($result)) {
7596 7596
             $arrLP[] = array(
7597 7597
                 'id' => $row['id'],
@@ -7625,9 +7625,9 @@  discard block
 block discarded – undo
7625 7625
         $return .= '</legend>';
7626 7626
 
7627 7627
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7628
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7628
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7629 7629
         }
7630
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7630
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7631 7631
         $defaults['title'] = Security :: remove_XSS($item_title);
7632 7632
         if (empty($item_title)) {
7633 7633
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7663,15 +7663,15 @@  discard block
 block discarded – undo
7663 7663
         }
7664 7664
 
7665 7665
         $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']);
7666
-        $my_count=0;
7666
+        $my_count = 0;
7667 7667
         foreach ($arrHide as $key => $value) {
7668
-            if ($my_count!=0) {
7668
+            if ($my_count != 0) {
7669 7669
                 // The LP name is also the first section and is not in the same charset like the other sections.
7670 7670
                 $value['value'] = Security :: remove_XSS($value['value']);
7671
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7671
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7672 7672
             } else {
7673 7673
                 $value['value'] = Security :: remove_XSS($value['value']);
7674
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7674
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7675 7675
             }
7676 7676
             $my_count++;
7677 7677
         }
@@ -7679,7 +7679,7 @@  discard block
 block discarded – undo
7679 7679
         if (!empty($id)) {
7680 7680
             $parent_select->setSelected($parent);
7681 7681
         } else {
7682
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7682
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7683 7683
             $parent_select->setSelected($parent_item_id);
7684 7684
         }
7685 7685
 
@@ -7696,7 +7696,7 @@  discard block
 block discarded – undo
7696 7696
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') {
7697 7697
                     $s_selected_position = $arrLP[$i]['id'];
7698 7698
                 }
7699
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7699
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7700 7700
             }
7701 7701
         }
7702 7702
 
@@ -7704,8 +7704,8 @@  discard block
 block discarded – undo
7704 7704
         $position->addOption(get_lang('FirstPosition'), 0);
7705 7705
 
7706 7706
         foreach ($arrHide as $key => $value) {
7707
-            $padding = isset($value['padding']) ? $value['padding']: 20;
7708
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7707
+            $padding = isset($value['padding']) ? $value['padding'] : 20;
7708
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7709 7709
         }
7710 7710
 
7711 7711
         $position->setSelected($s_selected_position);
@@ -7776,7 +7776,7 @@  discard block
 block discarded – undo
7776 7776
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7777 7777
                             $relative_path 	 = implode('/', $relative_path);
7778 7778
                             if (strlen($relative_path) > 0) {
7779
-                                $relative_path = $relative_path . '/';
7779
+                                $relative_path = $relative_path.'/';
7780 7780
                             }
7781 7781
                         } else {
7782 7782
                             $result = $this->generate_lp_folder($_course);
@@ -7790,8 +7790,8 @@  discard block
 block discarded – undo
7790 7790
                             'Height' 				=> '500',
7791 7791
                             'FullPage' 				=> true,
7792 7792
                             'CreateDocumentDir' 	=> $relative_prefix,
7793
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7794
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7793
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7794
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7795 7795
                         );
7796 7796
 
7797 7797
                         if ($_GET['action'] == 'add_item') {
@@ -7858,8 +7858,8 @@  discard block
 block discarded – undo
7858 7858
             $item_url = stripslashes($extra_info['url']);
7859 7859
         } elseif (is_numeric($extra_info)) {
7860 7860
             $extra_info = intval($extra_info);
7861
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7862
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7861
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7862
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7863 7863
             $result = Database::query($sql);
7864 7864
             $row = Database :: fetch_array($result);
7865 7865
             $item_title       = $row['title'];
@@ -7871,7 +7871,7 @@  discard block
 block discarded – undo
7871 7871
             $item_url = '';
7872 7872
         }
7873 7873
 
7874
-        $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7874
+        $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7875 7875
         $defaults = [];
7876 7876
 
7877 7877
         if ($id != 0 && is_array($extra_info)) {
@@ -7880,8 +7880,8 @@  discard block
 block discarded – undo
7880 7880
             $parent = 0;
7881 7881
         }
7882 7882
 
7883
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7884
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7883
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7884
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7885 7885
         $result = Database::query($sql);
7886 7886
         $arrLP = array();
7887 7887
 
@@ -7949,7 +7949,7 @@  discard block
 block discarded – undo
7949 7949
                     $selectParent->addOption(
7950 7950
                         $arrLP[$i]['title'],
7951 7951
                         $arrLP[$i]['id'],
7952
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;']
7952
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;']
7953 7953
                     );
7954 7954
 
7955 7955
                     if ($parent == $arrLP[$i]['id']) {
@@ -7963,7 +7963,7 @@  discard block
 block discarded – undo
7963 7963
                     $selectParent->addOption(
7964 7964
                         $arrLP[$i]['title'],
7965 7965
                         $arrLP[$i]['id'],
7966
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7966
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7967 7967
                     );
7968 7968
 
7969 7969
                     if ($parent_item_id == $arrLP[$i]['id']) {
@@ -8050,7 +8050,7 @@  discard block
 block discarded – undo
8050 8050
 
8051 8051
         $form->setDefaults($defaults);
8052 8052
 
8053
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
8053
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
8054 8054
     }
8055 8055
 
8056 8056
     /**
@@ -8072,8 +8072,8 @@  discard block
 block discarded – undo
8072 8072
         } elseif (is_numeric($extra_info)) {
8073 8073
             $extra_info = intval($extra_info);
8074 8074
             $sql = "SELECT title, description
8075
-                    FROM " . $tbl_publication . "
8076
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
8075
+                    FROM " . $tbl_publication."
8076
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
8077 8077
 
8078 8078
             $result = Database::query($sql);
8079 8079
             $row = Database :: fetch_array($result);
@@ -8089,13 +8089,13 @@  discard block
 block discarded – undo
8089 8089
             $parent = 0;
8090 8090
         }
8091 8091
 
8092
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8093
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8092
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8093
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8094 8094
 
8095 8095
         $result = Database::query($sql);
8096 8096
         $arrLP = array();
8097 8097
         while ($row = Database :: fetch_array($result)) {
8098
-            $arrLP[] = array (
8098
+            $arrLP[] = array(
8099 8099
                 'id' => $row['id'],
8100 8100
                 'item_type' => $row['item_type'],
8101 8101
                 'title' => $row['title'],
@@ -8141,7 +8141,7 @@  discard block
 block discarded – undo
8141 8141
             ]
8142 8142
         );
8143 8143
 
8144
-        $arrHide = array (
8144
+        $arrHide = array(
8145 8145
             $id
8146 8146
         );
8147 8147
 
@@ -8159,7 +8159,7 @@  discard block
 block discarded – undo
8159 8159
                     $parentSelect->addOption(
8160 8160
                         $arrLP[$i]['title'],
8161 8161
                         $arrLP[$i]['id'],
8162
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8162
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8163 8163
                     );
8164 8164
 
8165 8165
                     if ($parent == $arrLP[$i]['id']) {
@@ -8176,7 +8176,7 @@  discard block
 block discarded – undo
8176 8176
                     $parentSelect->addOption(
8177 8177
                         $arrLP[$i]['title'],
8178 8178
                         $arrLP[$i]['id'],
8179
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8179
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8180 8180
                     );
8181 8181
 
8182 8182
                     if ($parent == $arrLP[$i]['id']) {
@@ -8200,7 +8200,7 @@  discard block
 block discarded – undo
8200 8200
         for ($i = 0; $i < count($arrLP); $i++) {
8201 8201
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8202 8202
                 $previousSelect->addOption(
8203
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8203
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8204 8204
                     $arrLP[$i]['id']
8205 8205
                 );
8206 8206
 
@@ -8222,7 +8222,7 @@  discard block
 block discarded – undo
8222 8222
                     }
8223 8223
                 }
8224 8224
             }
8225
-            $arrHide = array ();
8225
+            $arrHide = array();
8226 8226
             for ($i = 0; $i < count($arrLP); $i++) {
8227 8227
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8228 8228
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8314,8 +8314,8 @@  discard block
 block discarded – undo
8314 8314
 
8315 8315
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8316 8316
         $item_id = intval($item_id);
8317
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8318
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8317
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8318
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8319 8319
         $result = Database::query($sql);
8320 8320
         $row = Database::fetch_assoc($result);
8321 8321
 
@@ -8329,16 +8329,16 @@  discard block
 block discarded – undo
8329 8329
             $audio_player .= '<script>
8330 8330
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8331 8331
                                 s1.addParam("allowscriptaccess","always");
8332
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8332
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8333 8333
                                 s1.write("container");
8334 8334
                             </script>';
8335 8335
         }
8336 8336
 
8337
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8337
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8338 8338
 
8339 8339
         $return .= Display::url(
8340 8340
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8341
-            $url.'&action=edit_item&path_item=' . $row['path']
8341
+            $url.'&action=edit_item&path_item='.$row['path']
8342 8342
         );
8343 8343
 
8344 8344
         $return .= Display::url(
@@ -8358,7 +8358,7 @@  discard block
 block discarded – undo
8358 8358
             $url.'&action=delete_item'
8359 8359
         );
8360 8360
 
8361
-        if ($item_type == TOOL_HOTPOTATOES ) {
8361
+        if ($item_type == TOOL_HOTPOTATOES) {
8362 8362
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8363 8363
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8364 8364
         }
@@ -8384,13 +8384,13 @@  discard block
 block discarded – undo
8384 8384
     public function get_js_dropdown_array()
8385 8385
     {
8386 8386
         $course_id = api_get_course_int_id();
8387
-        $return = 'var child_name = new Array();' . "\n";
8388
-        $return .= 'var child_value = new Array();' . "\n\n";
8389
-        $return .= 'child_name[0] = new Array();' . "\n";
8390
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8387
+        $return = 'var child_name = new Array();'."\n";
8388
+        $return .= 'var child_value = new Array();'."\n\n";
8389
+        $return .= 'child_name[0] = new Array();'."\n";
8390
+        $return .= 'child_value[0] = new Array();'."\n\n";
8391 8391
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8392
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8393
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8392
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8393
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8394 8394
                     ORDER BY display_order ASC";
8395 8395
         $res_zero = Database::query($sql_zero);
8396 8396
         $i = 0;
@@ -8401,29 +8401,29 @@  discard block
 block discarded – undo
8401 8401
                     $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8402 8402
                 }
8403 8403
                 $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8404
-                $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8405
-                $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8404
+                $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8405
+                $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8406 8406
             }
8407 8407
         }
8408 8408
         $return .= "\n";
8409
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8410
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8409
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8410
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8411 8411
         $res = Database::query($sql);
8412 8412
         while ($row = Database :: fetch_array($res)) {
8413
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8413
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8414 8414
                            WHERE
8415 8415
                                 c_id = ".$course_id." AND
8416
-                                parent_item_id = " . $row['id'] . "
8416
+                                parent_item_id = " . $row['id']."
8417 8417
                            ORDER BY display_order ASC";
8418 8418
             $res_parent = Database::query($sql_parent);
8419 8419
             $i = 0;
8420
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8421
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8420
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8421
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8422 8422
 
8423 8423
             while ($row_parent = Database :: fetch_array($res_parent)) {
8424 8424
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8425
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8426
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8425
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8426
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8427 8427
             }
8428 8428
             $return .= "\n";
8429 8429
         }
@@ -8444,8 +8444,8 @@  discard block
 block discarded – undo
8444 8444
         if (is_numeric($item_id)) {
8445 8445
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8446 8446
 
8447
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8448
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8447
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8448
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8449 8449
 
8450 8450
             $res = Database::query($sql);
8451 8451
             $row = Database :: fetch_array($res);
@@ -8504,7 +8504,7 @@  discard block
 block discarded – undo
8504 8504
      */
8505 8505
     public function display_item_small_form($item_type, $title = '', $data = array())
8506 8506
     {
8507
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8507
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8508 8508
         $form = new FormValidator('small_form', 'post', $url);
8509 8509
         $form->addElement('header', $title);
8510 8510
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8530,7 +8530,7 @@  discard block
 block discarded – undo
8530 8530
         $item_id = intval($item_id);
8531 8531
         /* Current prerequisite */
8532 8532
         $sql = "SELECT * FROM $tbl_lp_item
8533
-                WHERE c_id = $course_id AND id = " . $item_id;
8533
+                WHERE c_id = $course_id AND id = ".$item_id;
8534 8534
         $result = Database::query($sql);
8535 8535
         $row    = Database::fetch_array($result);
8536 8536
         $prerequisiteId = $row['prerequisite'];
@@ -8540,20 +8540,20 @@  discard block
 block discarded – undo
8540 8540
         $return .= '<form method="POST">';
8541 8541
         $return .= '<table class="data_table">';
8542 8542
         $return .= '<tr>';
8543
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8544
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8545
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8543
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8544
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8545
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8546 8546
         $return .= '</tr>';
8547 8547
 
8548 8548
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8549 8549
         $return .= '<tr >';
8550 8550
         $return .= '<td colspan="3" class="radio">';
8551 8551
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8552
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8552
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8553 8553
         $return .= '</tr>';
8554 8554
 
8555 8555
         $sql = "SELECT * FROM $tbl_lp_item
8556
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8556
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8557 8557
         $result = Database::query($sql);
8558 8558
         $arrLP = array();
8559 8559
 
@@ -8596,25 +8596,25 @@  discard block
 block discarded – undo
8596 8596
             }
8597 8597
 
8598 8598
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8599
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8599
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8600 8600
 
8601 8601
             $return .= '<tr>';
8602
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8603
-            $return .= '<label for="id' . $item['id'] . '">';
8604
-            $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'] . '" />';
8602
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8603
+            $return .= '<label for="id'.$item['id'].'">';
8604
+            $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'].'" />';
8605 8605
             $icon_name = str_replace(' ', '', $item['item_type']);
8606 8606
 
8607
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8608
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8607
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8608
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8609 8609
             } else {
8610
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8611
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8610
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8611
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8612 8612
                 } else {
8613 8613
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8614 8614
                 }
8615 8615
             }
8616 8616
 
8617
-            $return .=  $item['title'] . '</label>';
8617
+            $return .= $item['title'].'</label>';
8618 8618
             $return .= '</td>';
8619 8619
 
8620 8620
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8628,19 +8628,19 @@  discard block
 block discarded – undo
8628 8628
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8629 8629
 
8630 8630
                 $return .= '<td class="exercise">';
8631
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8631
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8632 8632
                 $return .= '</td>';
8633 8633
                 $return .= '<td class="exercise">';
8634
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8634
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8635 8635
                 $return .= '</td>';
8636 8636
             }
8637 8637
 
8638 8638
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8639 8639
                 $return .= '<td class="exercise">';
8640
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8640
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8641 8641
                 $return .= '</td>';
8642 8642
                 $return .= '<td class="exercise"">';
8643
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8643
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8644 8644
                 $return .= '</td>';
8645 8645
             }
8646 8646
             $return .= '</tr>';
@@ -8649,7 +8649,7 @@  discard block
 block discarded – undo
8649 8649
         $return .= '</tr>';
8650 8650
         $return .= '</table>';
8651 8651
         $return .= '<div style="padding-top:3px;">';
8652
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8652
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8653 8653
         $return .= '</form>';
8654 8654
 
8655 8655
         return $return;
@@ -8685,7 +8685,7 @@  discard block
 block discarded – undo
8685 8685
                 if ($row['id'] == $lp_id) {
8686 8686
                     continue;
8687 8687
                 }
8688
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8688
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8689 8689
             }
8690 8690
         }
8691 8691
         $return .= '</select>';
@@ -8745,8 +8745,8 @@  discard block
 block discarded – undo
8745 8745
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8746 8746
                      ORDER BY title ASC";
8747 8747
 
8748
-        $sql_hot  = "SELECT * FROM $tbl_doc
8749
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8748
+        $sql_hot = "SELECT * FROM $tbl_doc
8749
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8750 8750
                      ORDER BY id ASC";
8751 8751
 
8752 8752
         $res_quiz = Database::query($sql_quiz);
@@ -8755,8 +8755,8 @@  discard block
 block discarded – undo
8755 8755
         $return = '<ul class="lp_resource">';
8756 8756
         $return .= '<li class="lp_resource_element">';
8757 8757
         $return .= Display::return_icon('new_test_small.gif');
8758
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8759
-            get_lang('NewExercise') . '</a>';
8758
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8759
+            get_lang('NewExercise').'</a>';
8760 8760
         $return .= '</li>';
8761 8761
 
8762 8762
         // Display hotpotatoes
@@ -8768,8 +8768,8 @@  discard block
 block discarded – undo
8768 8768
             $return .= '</a> ';
8769 8769
 
8770 8770
             $return .= Display::return_icon('hotpotatoes_s.png');
8771
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8772
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8771
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8772
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8773 8773
             $return .= '</li>';
8774 8774
         }
8775 8775
 
@@ -8779,7 +8779,7 @@  discard block
 block discarded – undo
8779 8779
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8780 8780
             $return .= '</a> ';
8781 8781
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8782
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8782
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8783 8783
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8784 8784
                 '</a>';
8785 8785
             $return .= '</li>';
@@ -8853,7 +8853,7 @@  discard block
 block discarded – undo
8853 8853
         foreach ($categorizedLinks as $categoryId => $links) {
8854 8854
             $linkNodes = null;
8855 8855
             foreach ($links as $key => $title) {
8856
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8856
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8857 8857
                     $linkNodes .=
8858 8858
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8859 8859
                         <a class="moved" href="#">'.
@@ -8891,7 +8891,7 @@  discard block
 block discarded – undo
8891 8891
         $return = '<div class="lp_resource" >';
8892 8892
         $return .= '<div class="lp_resource_element">';
8893 8893
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8894
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8894
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8895 8895
         $return .= '</div>';
8896 8896
         $return .= '</div>';
8897 8897
         return $return;
@@ -8943,7 +8943,7 @@  discard block
 block discarded – undo
8943 8943
         $return .= Display::return_icon('forum_new_small.gif');
8944 8944
         $return .= Display::url(
8945 8945
             get_lang('CreateANewForum'),
8946
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8946
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8947 8947
                 'action' => 'add',
8948 8948
                 'content' => 'forum',
8949 8949
                 'lp_id' => $this->lp_id
@@ -8971,15 +8971,15 @@  discard block
 block discarded – undo
8971 8971
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8972 8972
                 $return .= ' </a>';
8973 8973
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8974
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8975
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8974
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8975
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8976 8976
                             </a>
8977
-                            <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">' .
8978
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8977
+                            <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">'.
8978
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8979 8979
 
8980 8980
                 $return .= '</li>';
8981 8981
 
8982
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8982
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8983 8983
                 $a_threads = get_threads($forum['forum_id']);
8984 8984
                 if (is_array($a_threads)) {
8985 8985
                     foreach ($a_threads as $thread) {
@@ -8988,8 +8988,8 @@  discard block
 block discarded – undo
8988 8988
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8989 8989
                         $return .= ' </a>';
8990 8990
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8991
-                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' .
8992
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8991
+                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
8992
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8993 8993
                         $return .= '</li>';
8994 8994
                     }
8995 8995
                 }
@@ -9060,7 +9060,7 @@  discard block
 block discarded – undo
9060 9060
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
9061 9061
             // Remove the possible . at the end of the path.
9062 9062
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
9063
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9063
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9064 9064
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
9065 9065
             copyr(
9066 9066
                 $current_course_path.'/scorm/'.$this->path,
@@ -9133,7 +9133,7 @@  discard block
 block discarded – undo
9133 9133
                 if ($item->type === 'sco') {
9134 9134
                     $inc_docs = $item->get_resources_from_source(
9135 9135
                         null,
9136
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9136
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9137 9137
                     );
9138 9138
                 } else {
9139 9139
                     $inc_docs = $item->get_resources_from_source();
@@ -9310,7 +9310,7 @@  discard block
 block discarded – undo
9310 9310
 
9311 9311
                                             if ($distance) {
9312 9312
                                                 foreach ($distance as $relative) {
9313
-                                                    $fixDirRelative .=  '../';
9313
+                                                    $fixDirRelative .= '../';
9314 9314
                                                 }
9315 9315
                                             }
9316 9316
                                         }
@@ -9376,7 +9376,7 @@  discard block
 block discarded – undo
9376 9376
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9377 9377
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9378 9378
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9379
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9379
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9380 9380
                                         $my_dep->setAttribute('xml:base', '');
9381 9381
                                     }
9382 9382
                                 }
@@ -9507,7 +9507,7 @@  discard block
 block discarded – undo
9507 9507
                         //$my_item->appendChild($my_max_score);
9508 9508
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9509 9509
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9510
-                        $my_prereqs->setAttribute('type','aicc_script');
9510
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9511 9511
                         $my_item->appendChild($my_prereqs);
9512 9512
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9513 9513
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9560,7 +9560,7 @@  discard block
 block discarded – undo
9560 9560
                         $my_resource->appendChild($my_file);
9561 9561
 
9562 9562
                         // Get included docs.
9563
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9563
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9564 9564
                         // Dependency to other files - not yet supported.
9565 9565
                         $i = 1;
9566 9566
                         foreach ($inc_docs as $doc_info) {
@@ -9621,7 +9621,7 @@  discard block
 block discarded – undo
9621 9621
                                         $my_dep_file->setAttribute('href', $file_path);
9622 9622
                                         $my_dep->setAttribute('xml:base', '');
9623 9623
 
9624
-                                        if (strstr($file_path,$main_path) !== false) {
9624
+                                        if (strstr($file_path, $main_path) !== false) {
9625 9625
                                             // The calculated real path is really inside the chamilo root path.
9626 9626
                                             // Reduce file path to what's under the DocumentRoot.
9627 9627
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9639,7 +9639,7 @@  discard block
 block discarded – undo
9639 9639
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9640 9640
                                             $file_path = str_replace('//', '/', $file_path);
9641 9641
                                             if (file_exists($file_path)) {
9642
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9642
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9643 9643
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9644 9644
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9645 9645
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9925,7 +9925,7 @@  discard block
 block discarded – undo
9925 9925
                             }
9926 9926
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9927 9927
                             if (file_exists($file_path)) {
9928
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9928
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9929 9929
                             }
9930 9930
                             break;
9931 9931
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9965,12 +9965,12 @@  discard block
 block discarded – undo
9965 9965
 
9966 9966
         foreach ($path_bits as $bit) {
9967 9967
             if (!empty ($bit)) {
9968
-                $new_path = $path_built . $bit;
9968
+                $new_path = $path_built.$bit;
9969 9969
                 if (is_dir($new_path)) {
9970
-                    $path_built = $new_path . '/';
9970
+                    $path_built = $new_path.'/';
9971 9971
                 } else {
9972 9972
                     mkdir($new_path, api_get_permissions_for_new_directories());
9973
-                    $path_built = $new_path . '/';
9973
+                    $path_built = $new_path.'/';
9974 9974
                 }
9975 9975
             }
9976 9976
         }
@@ -10014,9 +10014,9 @@  discard block
 block discarded – undo
10014 10014
 
10015 10015
         if ($upload_ok) {
10016 10016
             if ($has_attachment) {
10017
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
10017
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
10018 10018
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
10019
-                $updir = $sys_course_path . $courseDir;
10019
+                $updir = $sys_course_path.$courseDir;
10020 10020
                 // Try to add an extension to the file if it hasn't one.
10021 10021
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
10022 10022
 
@@ -10071,7 +10071,7 @@  discard block
 block discarded – undo
10071 10071
             //Setting my lp_id to autolaunch = 1
10072 10072
             $attributes['autolaunch'] = 1;
10073 10073
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
10074
-            Database::update($lp_table, $attributes, $where );
10074
+            Database::update($lp_table, $attributes, $where);
10075 10075
         }
10076 10076
     }
10077 10077
 
@@ -10090,13 +10090,13 @@  discard block
 block discarded – undo
10090 10090
 
10091 10091
         // Get the max order of the items
10092 10092
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
10093
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
10093
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
10094 10094
         $rs_max_order = Database::query($sql_max_order);
10095 10095
         $row_max_order = Database::fetch_object($rs_max_order);
10096 10096
         $max_order = $row_max_order->display_order;
10097 10097
         // Get the previous item ID
10098 10098
         $sql = "SELECT id as previous FROM $table_lp_item
10099
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
10099
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
10100 10100
         $rs_max = Database::query($sql);
10101 10101
         $row_max = Database::fetch_object($rs_max);
10102 10102
 
@@ -10152,9 +10152,9 @@  discard block
 block discarded – undo
10152 10152
         $documents_total_space = DocumentManager::documents_total_space();
10153 10153
         $course_max_space = DocumentManager::get_course_quota();
10154 10154
         $total_size = filesize($s) + $documents_total_space;
10155
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10155
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10156 10156
             return true;
10157
-        } else{
10157
+        } else {
10158 10158
             return false;
10159 10159
         }
10160 10160
     }
@@ -10494,7 +10494,7 @@  discard block
 block discarded – undo
10494 10494
         if ($this->debug > 0) {
10495 10495
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10496 10496
         }
10497
-        $this->subscribeUsers = intval($value);;
10497
+        $this->subscribeUsers = intval($value); ;
10498 10498
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10499 10499
         $lp_id = $this->get_id();
10500 10500
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10840,7 +10840,7 @@  discard block
 block discarded – undo
10840 10840
      */
10841 10841
     public function createForum($forumCategoryId)
10842 10842
     {
10843
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10843
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10844 10844
 
10845 10845
         $forumId = store_forum(
10846 10846
             [
@@ -10889,7 +10889,7 @@  discard block
 block discarded – undo
10889 10889
      */
10890 10890
     private function getFinalItemTemplate()
10891 10891
     {
10892
-        return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html');
10892
+        return file_get_contents(api_get_path(SYS_CODE_PATH).'newscorm/final_item_template/template.html');
10893 10893
     }
10894 10894
 
10895 10895
     /**
@@ -10936,11 +10936,11 @@  discard block
 block discarded – undo
10936 10936
             'Height' => '500',
10937 10937
             'FullPage' => true,
10938 10938
             'CreateDocumentDir' => $relative_prefix,
10939
-            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
10940
-            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
10939
+            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
10940
+            'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
10941 10941
         ];
10942 10942
 
10943
-        $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
10943
+        $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
10944 10944
             'type' => 'document',
10945 10945
             'lp_id' => $this->lp_id
10946 10946
         ]);
Please login to merge, or discard this patch.