Completed
Push — 1.10.x ( 761be6...ae816c )
by
unknown
52:23
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
     /**
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
             $current = $this->current;
1729 1729
         }
1730 1730
         if ($this->debug > 2) {
1731
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1731
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1732 1732
         }
1733 1733
         return $current;
1734 1734
     }
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
         ) {
1810 1810
 
1811 1811
             if ($this->debug > 2) {
1812
-                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);
1812
+                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);
1813 1813
             }
1814 1814
             $index = -1;
1815 1815
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1821,7 +1821,7 @@  discard block
 block discarded – undo
1821 1821
             if ($index == -1) {
1822 1822
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1823 1823
                 if ($this->debug > 2) {
1824
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1824
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1825 1825
                 }
1826 1826
                 return false;
1827 1827
             } else {
@@ -1836,7 +1836,7 @@  discard block
 block discarded – undo
1836 1836
             $index = 0;
1837 1837
             // Loop through all ordered items and stop at the first item that is
1838 1838
             // not a directory *and* that has not been completed yet.
1839
-            while ( !empty($this->ordered_items[$index]) AND
1839
+            while (!empty($this->ordered_items[$index]) AND
1840 1840
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1841 1841
                 (
1842 1842
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1850,14 +1850,14 @@  discard block
 block discarded – undo
1850 1850
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1851 1851
             $this->index    = $index;
1852 1852
             if ($this->debug > 2) {
1853
-                error_log('$index ' . $index);
1853
+                error_log('$index '.$index);
1854 1854
             }
1855 1855
             if ($this->debug > 2) {
1856
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1856
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1857 1857
             }
1858 1858
         }
1859 1859
         if ($this->debug > 2) {
1860
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1860
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1861 1861
         }
1862 1862
     }
1863 1863
 
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
     public function get_js_info($item_id = '')
1871 1871
     {
1872 1872
         if ($this->debug > 0) {
1873
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1873
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1874 1874
         }
1875 1875
 
1876 1876
         $info = '';
@@ -1880,17 +1880,17 @@  discard block
 block discarded – undo
1880 1880
             //if item is defined, return values from DB
1881 1881
             $oItem = $this->items[$item_id];
1882 1882
             $info .= '<script language="javascript">';
1883
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1884
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1885
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1886
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1887
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1888
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1889
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1883
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1884
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1885
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1886
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1887
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1888
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1889
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1890 1890
             $info .= "top.set_flag_synchronized();";
1891 1891
             $info .= '</script>';
1892 1892
             if ($this->debug > 2) {
1893
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1893
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1894 1894
             }
1895 1895
             return $info;
1896 1896
 
@@ -1898,17 +1898,17 @@  discard block
 block discarded – undo
1898 1898
 
1899 1899
             // If item_id is empty, just update to default SCORM data.
1900 1900
             $info .= '<script language="javascript">';
1901
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1902
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1903
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1904
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1905
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1906
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1907
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1901
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1902
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1903
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1904
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1905
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1906
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1907
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1908 1908
             $info .= "top.set_flag_synchronized();";
1909 1909
             $info .= '</script>';
1910 1910
             if ($this->debug > 2) {
1911
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1911
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1912 1912
             }
1913 1913
             return $info;
1914 1914
         }
@@ -1966,8 +1966,8 @@  discard block
 block discarded – undo
1966 1966
         if ($this->debug > 0) {
1967 1967
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1968 1968
         }
1969
-        if(empty($idBar)){
1970
-            $idBar='control-top';
1969
+        if (empty($idBar)) {
1970
+            $idBar = 'control-top';
1971 1971
         }
1972 1972
         /* if(empty($display)){
1973 1973
             $display='display:block';
@@ -1980,16 +1980,16 @@  discard block
 block discarded – undo
1980 1980
             $navbar = '
1981 1981
                   <span id="'.$idBar.'" class="buttons">
1982 1982
                     <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">
1983
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1983
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1984 1984
                     </a>
1985
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1986
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1985
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1986
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1987 1987
                     </a>
1988
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1989
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1988
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1989
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1990 1990
                     </a>
1991 1991
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1992
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1992
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1993 1993
                     </a>
1994 1994
                   </span>';
1995 1995
 
@@ -1997,13 +1997,13 @@  discard block
 block discarded – undo
1997 1997
             $navbar = '
1998 1998
                 <span id="'.$idBar.'" class="buttons text-right">
1999 1999
                     <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">
2000
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
2000
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
2001 2001
                     </a>
2002
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
2003
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
2002
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
2003
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
2004 2004
                     </a>
2005
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2006
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
2005
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2006
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2007 2007
                     </a>
2008 2008
                 </span>';
2009 2009
         }
@@ -2024,11 +2024,11 @@  discard block
 block discarded – undo
2024 2024
         $index = $this->index;
2025 2025
         $index++;
2026 2026
         if ($this->debug > 2) {
2027
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2027
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2028 2028
         }
2029 2029
         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) {
2030 2030
             $index++;
2031
-            if ($index == $this->max_ordered_items){
2031
+            if ($index == $this->max_ordered_items) {
2032 2032
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2033 2033
                     return $this->index;
2034 2034
                 } else {
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
             return $this->index;
2041 2041
         }
2042 2042
         if ($this->debug > 2) {
2043
-            error_log('New LP - index is now ' . $index, 0);
2043
+            error_log('New LP - index is now '.$index, 0);
2044 2044
         }
2045 2045
         return $index;
2046 2046
     }
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
         if (!empty ($new_index)) {
2059 2059
             if (isset ($this->ordered_items[$new_index])) {
2060 2060
                 if ($this->debug > 2) {
2061
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2061
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2062 2062
                 }
2063 2063
                 return $this->ordered_items[$new_index];
2064 2064
             }
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
         }
2101 2101
 
2102 2102
         // Filename without its extension.
2103
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2103
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2104 2104
 
2105 2105
         $zipFile = new PclZip($file_path);
2106 2106
         // Check the zip content (real size and file extension).
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
                     break; // Exit the foreach loop.
2125 2125
                 } elseif (
2126 2126
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2127
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2127
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2128 2128
                 ) {
2129 2129
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2130 2130
                     switch ($ext) {
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
             error_log('New LP - In learnpath::get_previous_index()', 0);
2167 2167
         }
2168 2168
         $index = $this->index;
2169
-        if (isset ($this->ordered_items[$index -1])) {
2169
+        if (isset ($this->ordered_items[$index - 1])) {
2170 2170
             $index--;
2171 2171
             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')) {
2172 2172
                 $index--;
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
             }
2177 2177
         } else {
2178 2178
             if ($this->debug > 2) {
2179
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2179
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2180 2180
             }
2181 2181
             // There is no previous item.
2182 2182
         }
@@ -2219,8 +2219,8 @@  discard block
 block discarded – undo
2219 2219
     {
2220 2220
         $course_id = api_get_course_int_id();
2221 2221
         $_course = api_get_course_info();
2222
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2223
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2222
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2223
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2224 2224
 
2225 2225
         // Getting all the information about the item.
2226 2226
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
                     lp.c_id = $course_id AND
2232 2232
                     lp_view.c_id = $course_id";
2233 2233
         $result = Database::query($sql);
2234
-        $row 	= Database::fetch_assoc($result);
2234
+        $row = Database::fetch_assoc($result);
2235 2235
         $output = '';
2236 2236
 
2237 2237
         if (!empty ($row['audio'])) {
@@ -2239,8 +2239,8 @@  discard block
 block discarded – undo
2239 2239
             $list = $_SESSION['oLP']->get_toc();
2240 2240
             $type_quiz = false;
2241 2241
 
2242
-            foreach($list as $toc) {
2243
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2242
+            foreach ($list as $toc) {
2243
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2244 2244
                     $type_quiz = true;
2245 2245
                 }
2246 2246
             }
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
         $courseCode = null,
2304 2304
         $sessionId = null
2305 2305
     ) {
2306
-        $lp_id = (int)$lp_id;
2306
+        $lp_id = (int) $lp_id;
2307 2307
         $courseInfo = api_get_course_info($courseCode);
2308 2308
         $sessionId = intval($sessionId);
2309 2309
 
@@ -2469,10 +2469,10 @@  discard block
 block discarded – undo
2469 2469
      */
2470 2470
     public static function get_progress_bar($percentage = -1, $text_add = '')
2471 2471
     {
2472
-        $text = $percentage . $text_add;
2472
+        $text = $percentage.$text_add;
2473 2473
         $output = '<div class="progress">
2474
-                        <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.';">
2475
-                        '. $text .'
2474
+                        <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.';">
2475
+                        '. $text.'
2476 2476
                         </div>
2477 2477
                     </div>';
2478 2478
 
@@ -2508,16 +2508,16 @@  discard block
 block discarded – undo
2508 2508
         }
2509 2509
         $total_items = $this->get_total_items_count_without_chapters();
2510 2510
         if ($this->debug > 2) {
2511
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2511
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2512 2512
         }
2513 2513
         $completeItems = $this->get_complete_items_count();
2514 2514
         if ($this->debug > 2) {
2515
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2515
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2516 2516
         }
2517 2517
         if ($add != 0) {
2518 2518
             $completeItems += $add;
2519 2519
             if ($this->debug > 2) {
2520
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2520
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2521 2521
             }
2522 2522
         }
2523 2523
         $text = '';
@@ -2535,7 +2535,7 @@  discard block
 block discarded – undo
2535 2535
             $text = '%';
2536 2536
         } elseif ($mode == 'abs') {
2537 2537
             $percentage = $completeItems;
2538
-            $text = '/' . $total_items;
2538
+            $text = '/'.$total_items;
2539 2539
         }
2540 2540
 
2541 2541
         return array(
@@ -2731,7 +2731,7 @@  discard block
 block discarded – undo
2731 2731
                 // and replace them, one by one, by the internal IDs (chamilo db)
2732 2732
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2733 2733
                 // by a space as well.
2734
-                $find = array (
2734
+                $find = array(
2735 2735
                     '&',
2736 2736
                     '|',
2737 2737
                     '~',
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                     '(',
2744 2744
                     ')'
2745 2745
                 );
2746
-                $replace = array (
2746
+                $replace = array(
2747 2747
                     ' ',
2748 2748
                     ' ',
2749 2749
                     ' ',
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
                 foreach ($ids as $id) {
2761 2761
                     $id = trim($id);
2762 2762
                     if (isset ($this->refs_list[$id])) {
2763
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2763
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2764 2764
                     }
2765 2765
                 }
2766 2766
 
@@ -2868,9 +2868,9 @@  discard block
 block discarded – undo
2868 2868
         if ($this->debug > 0) {
2869 2869
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2870 2870
         }
2871
-        $list = array ();
2871
+        $list = array();
2872 2872
         foreach ($this->ordered_items as $item_id) {
2873
-            $list[] = array (
2873
+            $list[] = array(
2874 2874
                 $item_id => $this->items[$item_id]->get_status()
2875 2875
             );
2876 2876
         }
@@ -2924,7 +2924,7 @@  discard block
 block discarded – undo
2924 2924
         $res = Database::query($sql);
2925 2925
         $num = Database :: num_rows($res);
2926 2926
         if ($num > 0) {
2927
-            $list[] = array (
2927
+            $list[] = array(
2928 2928
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2929 2929
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2930 2930
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2935,7 +2935,7 @@  discard block
 block discarded – undo
2935 2935
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2936 2936
             );
2937 2937
             while ($row = Database :: fetch_array($res)) {
2938
-                $list[] = array (
2938
+                $list[] = array(
2939 2939
                     'order_id' => ($row['order_id'] + 1),
2940 2940
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2941 2941
                     'type' => $row['interaction_type'],
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3004 3004
             );
3005 3005
             while ($row = Database :: fetch_array($res)) {
3006
-                $list[] = array (
3006
+                $list[] = array(
3007 3007
                     'order_id' => ($row['order_id'] + 1),
3008 3008
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3009 3009
                     'score_raw' => $row['score_raw'],
@@ -3030,10 +3030,10 @@  discard block
 block discarded – undo
3030 3030
         $toc = array();
3031 3031
         foreach ($this->ordered_items as $item_id) {
3032 3032
             if ($this->debug > 2) {
3033
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3033
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3034 3034
             }
3035 3035
             // TODO: Change this link generation and use new function instead.
3036
-            $toc[] = array (
3036
+            $toc[] = array(
3037 3037
                 'id'            => $item_id,
3038 3038
                 'title'         => $this->items[$item_id]->get_title(),
3039 3039
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3044,7 +3044,7 @@  discard block
 block discarded – undo
3044 3044
             );
3045 3045
         }
3046 3046
         if ($this->debug > 2) {
3047
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3047
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3048 3048
         }
3049 3049
         return $toc;
3050 3050
     }
@@ -3061,10 +3061,10 @@  discard block
 block discarded – undo
3061 3061
         }
3062 3062
         $toc = $varname.' = new Array();';
3063 3063
         foreach ($this->ordered_items as $item_id) {
3064
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3064
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3065 3065
         }
3066 3066
         if ($this->debug > 2) {
3067
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3067
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3068 3068
         }
3069 3069
         return $toc;
3070 3070
     }
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
             }
3089 3089
         }
3090 3090
         if ($this->debug > 2) {
3091
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3091
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3092 3092
         }
3093 3093
         return $res;
3094 3094
     }
@@ -3104,7 +3104,7 @@  discard block
 block discarded – undo
3104 3104
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3105 3105
         $lp_id = intval($lp_id);
3106 3106
         $sql = "SELECT lp_type FROM $tbl_lp
3107
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3107
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3108 3108
         $res = Database::query($sql);
3109 3109
         if ($res === false) {
3110 3110
             return null;
@@ -3217,7 +3217,7 @@  discard block
 block discarded – undo
3217 3217
             $dirTypes = self::getChapterTypes();
3218 3218
 
3219 3219
             if (in_array($item['type'], $dirTypes)) {
3220
-                $scorm_color_background ='scorm_item_section ';
3220
+                $scorm_color_background = 'scorm_item_section ';
3221 3221
                 $style_item = '';
3222 3222
             }
3223 3223
             if ($item['id'] == $this->current) {
@@ -3226,7 +3226,7 @@  discard block
 block discarded – undo
3226 3226
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3227 3227
             }
3228 3228
 
3229
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3229
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3230 3230
 
3231 3231
             // Learning path title
3232 3232
             $title = $item['title'];
@@ -3256,7 +3256,7 @@  discard block
 block discarded – undo
3256 3256
                 $html .= stripslashes($title);
3257 3257
             } else {
3258 3258
                 $this->get_link('http', $item['id'], $toc_list);
3259
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3259
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3260 3260
             }
3261 3261
             $html .= "</div>";
3262 3262
 
@@ -3290,12 +3290,12 @@  discard block
 block discarded – undo
3290 3290
             if ($this->get_lp_session_id() == api_get_session_id()) {
3291 3291
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3292 3292
                 $html .= '<div class="btn-group">';
3293
-                $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'>" .
3294
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3295
-                $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'>" .
3296
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3297
-                $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">' .
3298
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3293
+                $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'>".
3294
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3295
+                $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'>".
3296
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3297
+                $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">'.
3298
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3299 3299
                 $html .= '</div>';
3300 3300
                 $html .= '</div>';
3301 3301
             }
@@ -3347,11 +3347,11 @@  discard block
 block discarded – undo
3347 3347
         $course_id = $this->get_course_int_id();
3348 3348
 
3349 3349
         if ($this->debug > 0) {
3350
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3350
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3351 3351
         }
3352 3352
         if (empty($item_id)) {
3353 3353
             if ($this->debug > 2) {
3354
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3354
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3355 3355
             }
3356 3356
             $item_id = $this->get_current_item_id();
3357 3357
         }
@@ -3383,7 +3383,7 @@  discard block
 block discarded – undo
3383 3383
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3384 3384
         		WHERE li.id = $item_id ";
3385 3385
         if ($this->debug > 2) {
3386
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3386
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3387 3387
         }
3388 3388
         $res = Database::query($sql);
3389 3389
         if (Database :: num_rows($res) > 0) {
@@ -3397,9 +3397,9 @@  discard block
 block discarded – undo
3397 3397
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3398 3398
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3399 3399
             }
3400
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3400
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3401 3401
             if ($type == 'http') {
3402
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3402
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3403 3403
             } else {
3404 3404
                 $course_path = $sys_course_path; //system path
3405 3405
             }
@@ -3410,8 +3410,8 @@  discard block
 block discarded – undo
3410 3410
             }
3411 3411
 
3412 3412
             if ($this->debug > 2) {
3413
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3414
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3413
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3414
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3415 3415
             }
3416 3416
 
3417 3417
             // Now go through the specific cases to get the end of the path
@@ -3430,7 +3430,7 @@  discard block
 block discarded – undo
3430 3430
                         );
3431 3431
 
3432 3432
                         if ($this->debug > 0) {
3433
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3433
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3434 3434
                         }
3435 3435
 
3436 3436
                         if ($lp_item_type == 'link') {
@@ -3450,7 +3450,7 @@  discard block
 block discarded – undo
3450 3450
                                     $linkProtocol = substr($file, 0, 5);
3451 3451
                                     if ($linkProtocol === 'http:') {
3452 3452
                                         //this is the special intervention case
3453
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3453
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3454 3454
                                     }
3455 3455
                                 }
3456 3456
                             }
@@ -3490,8 +3490,8 @@  discard block
 block discarded – undo
3490 3490
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3491 3491
                                         WHERE
3492 3492
                                             c_id = $course_id AND
3493
-                                            lp_item_id='" . $lp_item_id . "' AND
3494
-                                            lp_view_id ='" . $lp_view_id . "' AND
3493
+                                            lp_item_id='".$lp_item_id."' AND
3494
+                                            lp_view_id ='" . $lp_view_id."' AND
3495 3495
                                             status='completed'";
3496 3496
                                 $result = Database::query($sql);
3497 3497
                                 $row_count = Database :: fetch_row($result);
@@ -3500,7 +3500,7 @@  discard block
 block discarded – undo
3500 3500
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3501 3501
                                     $not_multiple_attempt = 1;
3502 3502
                                 }
3503
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3503
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3504 3504
                             }
3505 3505
 
3506 3506
                             $tmp_array = explode('/', $file);
@@ -3513,7 +3513,7 @@  discard block
 block discarded – undo
3513 3513
                     break;
3514 3514
                 case 2 :
3515 3515
                     if ($this->debug > 2) {
3516
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3516
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3517 3517
                     }
3518 3518
 
3519 3519
                     if ($lp_item_type != 'dir') {
@@ -3527,19 +3527,19 @@  discard block
 block discarded – undo
3527 3527
                         //if ($this->prerequisites_match($item_id)) {
3528 3528
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3529 3529
                             if ($this->debug > 2) {
3530
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3530
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3531 3531
                             }
3532 3532
                             // Distant url, return as is.
3533 3533
                             $file = $lp_item_path;
3534 3534
                         } else {
3535 3535
                             if ($this->debug > 2) {
3536
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3536
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3537 3537
                             }
3538 3538
                             // Prevent getting untranslatable urls.
3539 3539
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3540 3540
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3541 3541
                             // Prepare the path.
3542
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3542
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3543 3543
                             // TODO: Fix this for urls with protocol header.
3544 3544
                             $file = str_replace('//', '/', $file);
3545 3545
                             $file = str_replace(':/', '://', $file);
@@ -3547,11 +3547,11 @@  discard block
 block discarded – undo
3547 3547
                                 $lp_path = substr($lp_path, 0, -1);
3548 3548
                             }
3549 3549
 
3550
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3550
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3551 3551
                                 // if file not found.
3552 3552
                                 $decoded = html_entity_decode($lp_item_path);
3553 3553
                                 list ($decoded) = explode('?', $decoded);
3554
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3554
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3555 3555
                                     require_once 'resourcelinker.inc.php';
3556 3556
                                     $file = rl_get_resource_link_for_learnpath(
3557 3557
                                         $course_id,
@@ -3571,14 +3571,14 @@  discard block
 block discarded – undo
3571 3571
                                         }
3572 3572
                                     }
3573 3573
                                 } else {
3574
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3574
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3575 3575
                                 }
3576 3576
                             }
3577 3577
                         }
3578 3578
 
3579 3579
                         // We want to use parameters if they were defined in the imsmanifest
3580 3580
                         if (strpos($file, 'blank.php') === false) {
3581
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3581
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3582 3582
                         }
3583 3583
                     } else {
3584 3584
                         $file = 'lp_content.php?type=dir';
@@ -3586,12 +3586,12 @@  discard block
 block discarded – undo
3586 3586
                     break;
3587 3587
                 case 3 :
3588 3588
                     if ($this->debug > 2) {
3589
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3589
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3590 3590
                     }
3591 3591
                     // Formatting AICC HACP append URL.
3592
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3592
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3593 3593
                     if (!empty($lp_item_params)) {
3594
-                        $aicc_append .= $lp_item_params . '&';
3594
+                        $aicc_append .= $lp_item_params.'&';
3595 3595
                     }
3596 3596
                     if ($lp_item_type != 'dir') {
3597 3597
                         // Quite complex here:
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 
3604 3604
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3605 3605
                             if ($this->debug > 2) {
3606
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3606
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3607 3607
                             }
3608 3608
                             // Distant url, return as is.
3609 3609
                             $file = $lp_item_path;
@@ -3616,19 +3616,19 @@  discard block
 block discarded – undo
3616 3616
                             if (stripos($file, '<servername>') !== false) {
3617 3617
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3618 3618
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3619
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3619
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3620 3620
                             }
3621 3621
                             //
3622 3622
                             $file .= $aicc_append;
3623 3623
                         } else {
3624 3624
                             if ($this->debug > 2) {
3625
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3625
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3626 3626
                             }
3627 3627
                             // Prevent getting untranslatable urls.
3628 3628
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3629 3629
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3630 3630
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3631
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3631
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3632 3632
                             // TODO: Fix this for urls with protocol header.
3633 3633
                             $file = str_replace('//', '/', $file);
3634 3634
                             $file = str_replace(':/', '://', $file);
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3648 3648
         }
3649 3649
         if ($this->debug > 2) {
3650
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3650
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3651 3651
         }
3652 3652
         return $file;
3653 3653
     }
@@ -3665,7 +3665,7 @@  discard block
 block discarded – undo
3665 3665
         $search = '';
3666 3666
         // Use $attempt_num to enable multi-views management (disabled so far).
3667 3667
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3668
-            $search = 'AND view_count = ' . $attempt_num;
3668
+            $search = 'AND view_count = '.$attempt_num;
3669 3669
         }
3670 3670
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3671 3671
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3675,9 +3675,9 @@  discard block
 block discarded – undo
3675 3675
 
3676 3676
         $sql = "SELECT id, view_count FROM $lp_view_table
3677 3677
         		WHERE
3678
-        		    c_id = " . $course_id . " AND
3679
-        		    lp_id = " . $this->get_id() . " AND
3680
-        		    user_id = " . $this->get_user_id() . " AND
3678
+        		    c_id = ".$course_id." AND
3679
+        		    lp_id = " . $this->get_id()." AND
3680
+        		    user_id = " . $this->get_user_id()." AND
3681 3681
         		    session_id = $sessionId
3682 3682
         		    $search
3683 3683
                 ORDER BY view_count DESC";
@@ -3688,7 +3688,7 @@  discard block
 block discarded – undo
3688 3688
         } else if (!api_is_invitee()) {
3689 3689
             // There is no database record, create one.
3690 3690
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3691
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3691
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3692 3692
             Database::query($sql);
3693 3693
             $id = Database :: insert_id();
3694 3694
             $this->lp_view_id = $id;
@@ -3788,15 +3788,15 @@  discard block
 block discarded – undo
3788 3788
     {
3789 3789
         $course_id = api_get_course_int_id();
3790 3790
         if ($this->debug > 0) {
3791
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3791
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3792 3792
         }
3793 3793
         if (empty($id) || empty($direction)) {
3794 3794
             return false;
3795 3795
         }
3796 3796
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3797 3797
         $sql_sel = "SELECT *
3798
-                    FROM " . $tbl_lp_item . "
3799
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3798
+                    FROM " . $tbl_lp_item."
3799
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3800 3800
         $res_sel = Database::query($sql_sel);
3801 3801
         // Check if elem exists.
3802 3802
         if (Database :: num_rows($res_sel) < 1) {
@@ -3821,7 +3821,7 @@  discard block
 block discarded – undo
3821 3821
                                  WHERE c_id = ".$course_id." AND id = $previous";
3822 3822
 
3823 3823
                     if ($this->debug > 2) {
3824
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3824
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3825 3825
                     }
3826 3826
                     $res_sel2 = Database::query($sql_sel2);
3827 3827
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3874,7 +3874,7 @@  discard block
 block discarded – undo
3874 3874
                         }
3875 3875
                         Database::query($sql_upd2);
3876 3876
                     }
3877
-                    $display = $display -1;
3877
+                    $display = $display - 1;
3878 3878
                 }
3879 3879
                 break;
3880 3880
             case 'down':
@@ -3885,7 +3885,7 @@  discard block
 block discarded – undo
3885 3885
                 } else {
3886 3886
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3887 3887
                     if ($this->debug > 2) {
3888
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3888
+                        error_log('Selecting next: '.$sql_sel2, 0);
3889 3889
                     }
3890 3890
                     $res_sel2 = Database::query($sql_sel2);
3891 3891
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3924 3924
                         Database::query($sql_upd2);
3925 3925
                     }
3926
-                    $display = $display +1;
3926
+                    $display = $display + 1;
3927 3927
                 }
3928 3928
                 break;
3929 3929
             default :
@@ -3946,8 +3946,8 @@  discard block
 block discarded – undo
3946 3946
         $res = Database::query($sql);
3947 3947
         if ($res === false)
3948 3948
             return false;
3949
-        $lps = array ();
3950
-        $lp_order = array ();
3949
+        $lps = array();
3950
+        $lp_order = array();
3951 3951
         $num = Database :: num_rows($res);
3952 3952
         // First check the order is correct, globally (might be wrong because
3953 3953
         // of versions < 1.8.4)
@@ -3957,7 +3957,7 @@  discard block
 block discarded – undo
3957 3957
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3958 3958
                     $need_fix = true;
3959 3959
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3960
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3960
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3961 3961
                     Database::query($sql_u);
3962 3962
                 }
3963 3963
                 $row['display_order'] = $i;
@@ -3970,10 +3970,10 @@  discard block
 block discarded – undo
3970 3970
             $order = $lps[$lp_id]['display_order'];
3971 3971
             if ($order > 1) { // If it's the first element, no need to move up.
3972 3972
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3973
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3973
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3974 3974
                 Database::query($sql_u1);
3975
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3976
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3975
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3976
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3977 3977
                 Database::query($sql_u2);
3978 3978
             }
3979 3979
         }
@@ -3994,8 +3994,8 @@  discard block
 block discarded – undo
3994 3994
         if ($res === false) {
3995 3995
             return false;
3996 3996
         }
3997
-        $lps = array ();
3998
-        $lp_order = array ();
3997
+        $lps = array();
3998
+        $lp_order = array();
3999 3999
         $num = Database :: num_rows($res);
4000 4000
         $max = 0;
4001 4001
         // First check the order is correct, globally (might be wrong because
@@ -4007,7 +4007,7 @@  discard block
 block discarded – undo
4007 4007
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4008 4008
                     $need_fix = true;
4009 4009
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4010
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4010
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4011 4011
                     Database::query($sql_u);
4012 4012
                 }
4013 4013
                 $row['display_order'] = $i;
@@ -4020,10 +4020,10 @@  discard block
 block discarded – undo
4020 4020
             $order = $lps[$lp_id]['display_order'];
4021 4021
             if ($order < $max) { // If it's the first element, no need to move up.
4022 4022
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4023
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4023
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4024 4024
                 Database::query($sql_u1);
4025
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4026
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4025
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4026
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4027 4027
                 Database::query($sql_u2);
4028 4028
             }
4029 4029
         }
@@ -4043,15 +4043,15 @@  discard block
 block discarded – undo
4043 4043
         $this->autocomplete_parents($this->last);
4044 4044
         $new_index = $this->get_next_index();
4045 4045
         if ($this->debug > 2) {
4046
-            error_log('New LP - New index: ' . $new_index, 0);
4046
+            error_log('New LP - New index: '.$new_index, 0);
4047 4047
         }
4048 4048
         $this->index = $new_index;
4049 4049
         if ($this->debug > 2) {
4050
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4050
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4051 4051
         }
4052 4052
         $this->current = $this->ordered_items[$new_index];
4053 4053
         if ($this->debug > 2) {
4054
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4054
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4055 4055
         }
4056 4056
     }
4057 4057
 
@@ -4115,7 +4115,7 @@  discard block
 block discarded – undo
4115 4115
             // Clean spaces.
4116 4116
             $prereq_string = str_replace(' ', '', $prereq_string);
4117 4117
             if ($debug > 0) {
4118
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4118
+                error_log('Found prereq_string: '.$prereq_string, 0);
4119 4119
             }
4120 4120
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4121 4121
             $result = $currentItem->parse_prereq(
@@ -4131,12 +4131,12 @@  discard block
 block discarded – undo
4131 4131
         } else {
4132 4132
             $result = true;
4133 4133
             if ($debug > 1) {
4134
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4134
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4135 4135
             }
4136 4136
         }
4137 4137
 
4138 4138
         if ($debug > 1) {
4139
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4139
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4140 4140
         }
4141 4141
         return $result;
4142 4142
     }
@@ -4202,12 +4202,12 @@  discard block
 block discarded – undo
4202 4202
             $row = Database :: fetch_array($result);
4203 4203
             $name = domesticate($row['name']);
4204 4204
             if ($set_visibility == 'i') {
4205
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4205
+                $s = $name." ".get_lang('LearnpathNotPublished');
4206 4206
                 $dialogBox = $s;
4207 4207
                 $v = 0;
4208 4208
             }
4209 4209
             if ($set_visibility == 'v') {
4210
-                $s = $name . " " . get_lang('LearnpathPublished');
4210
+                $s = $name." ".get_lang('LearnpathPublished');
4211 4211
                 $dialogBox = $s;
4212 4212
                 $v = 1;
4213 4213
             }
@@ -4290,9 +4290,9 @@  discard block
 block discarded – undo
4290 4290
         $course_id = api_get_course_int_id();
4291 4291
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4292 4292
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4293
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4293
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4294 4294
         if ($this->debug > 2) {
4295
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4295
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4296 4296
         }
4297 4297
         $res = Database::query($sql);
4298 4298
         $view_id = Database::insert_id();
@@ -4330,10 +4330,10 @@  discard block
 block discarded – undo
4330 4330
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4331 4331
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4332 4332
         if ($this->debug > 2) {
4333
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4333
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4334 4334
         }
4335 4335
         if ($this->debug > 2) {
4336
-            error_log('' . print_r($this->items, true), 0);
4336
+            error_log(''.print_r($this->items, true), 0);
4337 4337
         }
4338 4338
         if (isset($this->items[$this->current]) &&
4339 4339
             is_object($this->items[$this->current])
@@ -4357,7 +4357,7 @@  discard block
 block discarded – undo
4357 4357
     {
4358 4358
         $debug = $this->debug;
4359 4359
         if ($debug) {
4360
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4360
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4361 4361
         }
4362 4362
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4363 4363
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4380,7 +4380,7 @@  discard block
 block discarded – undo
4380 4380
 
4381 4381
             if ($debug) {
4382 4382
                 error_log('update_queue before:');
4383
-                error_log(print_r($this->update_queue,1));
4383
+                error_log(print_r($this->update_queue, 1));
4384 4384
             }
4385 4385
             $this->autocomplete_parents($item_id);
4386 4386
 
@@ -4388,9 +4388,9 @@  discard block
 block discarded – undo
4388 4388
             $this->update_queue[$item_id] = $status;
4389 4389
 
4390 4390
             if ($debug) {
4391
-                error_log('get_status(): ' . $status);
4391
+                error_log('get_status(): '.$status);
4392 4392
                 error_log('update_queue after:');
4393
-                error_log(print_r($this->update_queue,1));
4393
+                error_log(print_r($this->update_queue, 1));
4394 4394
             }
4395 4395
             return $res;
4396 4396
         }
@@ -4411,17 +4411,17 @@  discard block
 block discarded – undo
4411 4411
 
4412 4412
         if (isset($this->current) && !api_is_invitee()) {
4413 4413
             if ($this->debug > 2) {
4414
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4414
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4415 4415
             }
4416 4416
             $sql = "UPDATE $table SET
4417
-                        last_item = " . intval($this->get_current_item_id()). "
4417
+                        last_item = ".intval($this->get_current_item_id())."
4418 4418
                     WHERE
4419 4419
                         c_id = $course_id AND
4420
-                        lp_id = " . $this->get_id() . " AND
4420
+                        lp_id = ".$this->get_id()." AND
4421 4421
                         user_id = " . $this->get_user_id()." ".$session_condition;
4422 4422
 
4423 4423
             if ($this->debug > 2) {
4424
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4424
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4425 4425
             }
4426 4426
             Database::query($sql);
4427 4427
         }
@@ -4435,7 +4435,7 @@  discard block
 block discarded – undo
4435 4435
                             progress = $progress
4436 4436
                         WHERE
4437 4437
                             c_id = ".$course_id." AND
4438
-                            lp_id = " . $this->get_id() . " AND
4438
+                            lp_id = " . $this->get_id()." AND
4439 4439
                             user_id = " . $this->get_user_id()." ".$session_condition;
4440 4440
                 // Ignore errors as some tables might not have the progress field just yet.
4441 4441
                 Database::query($sql);
@@ -4451,7 +4451,7 @@  discard block
 block discarded – undo
4451 4451
     public function set_current_item($item_id = null)
4452 4452
     {
4453 4453
         if ($this->debug > 0) {
4454
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4454
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4455 4455
         }
4456 4456
         if (empty ($item_id)) {
4457 4457
             if ($this->debug > 2) {
@@ -4460,7 +4460,7 @@  discard block
 block discarded – undo
4460 4460
             // Do nothing.
4461 4461
         } else {
4462 4462
             if ($this->debug > 2) {
4463
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4463
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4464 4464
             }
4465 4465
             if (is_numeric($item_id)) {
4466 4466
                 $item_id = intval($item_id);
@@ -4475,10 +4475,10 @@  discard block
 block discarded – undo
4475 4475
                     }
4476 4476
                 }
4477 4477
                 if ($this->debug > 2) {
4478
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4478
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4479 4479
                 }
4480 4480
             } else {
4481
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4481
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4482 4482
             }
4483 4483
         }
4484 4484
     }
@@ -4503,7 +4503,7 @@  discard block
 block discarded – undo
4503 4503
             $lp = $this->get_id();
4504 4504
             if ($lp != 0) {
4505 4505
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4506
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4506
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4507 4507
                 $res = Database::query($sql);
4508 4508
                 return $res;
4509 4509
             }
@@ -4527,7 +4527,7 @@  discard block
 block discarded – undo
4527 4527
 
4528 4528
         if ($lp != 0) {
4529 4529
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4530
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4530
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4531 4531
             $res = Database::query($sql);
4532 4532
             return $res;
4533 4533
         } else {
@@ -4552,10 +4552,10 @@  discard block
 block discarded – undo
4552 4552
         $course_id = api_get_course_int_id();
4553 4553
         $lp_id = $this->get_id();
4554 4554
         $sql = "UPDATE $lp_table SET
4555
-                content_maker = '" . Database::escape_string($this->maker) . "'
4555
+                content_maker = '".Database::escape_string($this->maker)."'
4556 4556
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4557 4557
         if ($this->debug > 2) {
4558
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4558
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4559 4559
         }
4560 4560
         Database::query($sql);
4561 4561
         return true;
@@ -4579,10 +4579,10 @@  discard block
 block discarded – undo
4579 4579
         $lp_id = $this->get_id();
4580 4580
         $course_id = $this->course_info['real_id'];
4581 4581
         $sql = "UPDATE $lp_table SET
4582
-                name = '" . Database::escape_string($this->name). "'
4582
+                name = '".Database::escape_string($this->name)."'
4583 4583
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4584 4584
         if ($this->debug > 2) {
4585
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4585
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4586 4586
         }
4587 4587
         $result = Database::query($sql);
4588 4588
         // If the lp is visible on the homepage, change his name there.
@@ -4590,7 +4590,7 @@  discard block
 block discarded – undo
4590 4590
             $session_id = api_get_session_id();
4591 4591
             $session_condition = api_get_session_condition($session_id);
4592 4592
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4593
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4593
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4594 4594
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4595 4595
             	    WHERE
4596 4596
             	        c_id = $course_id AND
@@ -4668,10 +4668,10 @@  discard block
 block discarded – undo
4668 4668
 
4669 4669
                 // Save it to search engine.
4670 4670
                 foreach ($missing_terms as $term) {
4671
-                    $doc->add_term($prefix . $term, 1);
4671
+                    $doc->add_term($prefix.$term, 1);
4672 4672
                 }
4673 4673
                 foreach ($deprecated_terms as $term) {
4674
-                    $doc->remove_term($prefix . $term);
4674
+                    $doc->remove_term($prefix.$term);
4675 4675
                 }
4676 4676
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4677 4677
                 $di->getDb()->flush();
@@ -4696,10 +4696,10 @@  discard block
 block discarded – undo
4696 4696
         $this->theme = $name;
4697 4697
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4698 4698
         $lp_id = $this->get_id();
4699
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4699
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4700 4700
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4701 4701
         if ($this->debug > 2) {
4702
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4702
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4703 4703
         }
4704 4704
         Database::query($sql);
4705 4705
 
@@ -4722,10 +4722,10 @@  discard block
 block discarded – undo
4722 4722
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4723 4723
         $lp_id = $this->get_id();
4724 4724
         $sql = "UPDATE $lp_table SET
4725
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4725
+                preview_image = '".Database::escape_string($this->preview_image)."'
4726 4726
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4727 4727
         if ($this->debug > 2) {
4728
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4728
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4729 4729
         }
4730 4730
         Database::query($sql);
4731 4731
         return true;
@@ -4745,10 +4745,10 @@  discard block
 block discarded – undo
4745 4745
         $this->author = $name;
4746 4746
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4747 4747
         $lp_id = $this->get_id();
4748
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4748
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4749 4749
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4750 4750
         if ($this->debug > 2) {
4751
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4751
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4752 4752
         }
4753 4753
         Database::query($sql);
4754 4754
 
@@ -4766,15 +4766,15 @@  discard block
 block discarded – undo
4766 4766
         if ($this->debug > 0) {
4767 4767
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4768 4768
         }
4769
-        if (intval($hide) == $hide){
4769
+        if (intval($hide) == $hide) {
4770 4770
             $this->hide_toc_frame = $hide;
4771 4771
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4772 4772
             $lp_id = $this->get_id();
4773 4773
             $sql = "UPDATE $lp_table SET
4774
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4774
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4775 4775
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4776 4776
             if ($this->debug > 2) {
4777
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4777
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4778 4778
             }
4779 4779
             Database::query($sql);
4780 4780
 
@@ -4801,7 +4801,7 @@  discard block
 block discarded – undo
4801 4801
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4802 4802
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4803 4803
         if ($this->debug > 2) {
4804
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4804
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4805 4805
         }
4806 4806
         Database::query($sql);
4807 4807
         return true;
@@ -4825,10 +4825,10 @@  discard block
 block discarded – undo
4825 4825
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4826 4826
         $lp_id = $this->get_id();
4827 4827
         $sql = "UPDATE $lp_table SET
4828
-                    content_local = '" . Database::escape_string($name) . "'
4828
+                    content_local = '".Database::escape_string($name)."'
4829 4829
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4830 4830
         if ($this->debug > 2) {
4831
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4831
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4832 4832
         }
4833 4833
         Database::query($sql);
4834 4834
         return true;
@@ -4862,11 +4862,11 @@  discard block
 block discarded – undo
4862 4862
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4863 4863
         $lp_id = $this->get_id();
4864 4864
         $sql = "UPDATE $lp_table SET
4865
-                    use_max_score = '" . $this->use_max_score . "'
4865
+                    use_max_score = '".$this->use_max_score."'
4866 4866
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4867 4867
 
4868 4868
         if ($this->debug > 2) {
4869
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4869
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4870 4870
         }
4871 4871
         Database::query($sql);
4872 4872
 
@@ -4893,10 +4893,10 @@  discard block
 block discarded – undo
4893 4893
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4894 4894
         $lp_id = $this->get_id();
4895 4895
         $sql = "UPDATE $lp_table SET
4896
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4896
+                expired_on = '".Database::escape_string($this->expired_on)."'
4897 4897
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4898 4898
         if ($this->debug > 2) {
4899
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4899
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4900 4900
         }
4901 4901
         Database::query($sql);
4902 4902
 
@@ -4922,10 +4922,10 @@  discard block
 block discarded – undo
4922 4922
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4923 4923
         $lp_id = $this->get_id();
4924 4924
         $sql = "UPDATE $lp_table SET
4925
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4925
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4926 4926
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4927 4927
         if ($this->debug > 2) {
4928
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4928
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4929 4929
         }
4930 4930
         Database::query($sql);
4931 4931
 
@@ -4945,10 +4945,10 @@  discard block
 block discarded – undo
4945 4945
         $this->modified_on = api_get_utc_datetime();
4946 4946
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4947 4947
         $lp_id = $this->get_id();
4948
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4948
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4949 4949
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4950 4950
         if ($this->debug > 2) {
4951
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4951
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4952 4952
         }
4953 4953
         Database::query($sql);
4954 4954
         return true;
@@ -5019,13 +5019,13 @@  discard block
 block discarded – undo
5019 5019
 
5020 5020
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5021 5021
             if ($this->debug > 2) {
5022
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5022
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5023 5023
             }
5024 5024
             switch ($this->get_type()) {
5025 5025
                 case '3' :
5026 5026
                     if ($this->items[$this->last]->get_type() != 'au') {
5027 5027
                         if ($this->debug > 2) {
5028
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5028
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5029 5029
                         }
5030 5030
                         $this->items[$this->last]->close();
5031 5031
                         //$this->autocomplete_parents($this->last);
@@ -5038,7 +5038,7 @@  discard block
 block discarded – undo
5038 5038
                 case '2' :
5039 5039
                     if ($this->items[$this->last]->get_type() != 'sco') {
5040 5040
                         if ($this->debug > 2) {
5041
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5041
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5042 5042
                         }
5043 5043
                         $this->items[$this->last]->close();
5044 5044
                         //$this->autocomplete_parents($this->last);
@@ -5052,7 +5052,7 @@  discard block
 block discarded – undo
5052 5052
                 case '1' :
5053 5053
                 default :
5054 5054
                     if ($this->debug > 2) {
5055
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5055
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5056 5056
                     }
5057 5057
                     $this->items[$this->last]->close();
5058 5058
                     break;
@@ -5078,7 +5078,7 @@  discard block
 block discarded – undo
5078 5078
         }
5079 5079
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5080 5080
         $sql = "SELECT * FROM $lp_table
5081
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5081
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5082 5082
         $res = Database::query($sql);
5083 5083
         if (Database :: num_rows($res) > 0) {
5084 5084
             $row = Database :: fetch_array($res);
@@ -5099,14 +5099,14 @@  discard block
 block discarded – undo
5099 5099
                     break;
5100 5100
             }
5101 5101
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5102
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5102
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5103 5103
             Database::query($sql);
5104 5104
             $this->mode = $view_mode;
5105 5105
 
5106 5106
             return $view_mode;
5107 5107
         } else {
5108 5108
             if ($this->debug > 2) {
5109
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5109
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5110 5110
             }
5111 5111
         }
5112 5112
         return -1;
@@ -5124,7 +5124,7 @@  discard block
 block discarded – undo
5124 5124
         }
5125 5125
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5126 5126
         $sql = "SELECT * FROM $lp_table
5127
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5127
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5128 5128
         $res = Database::query($sql);
5129 5129
         if (Database :: num_rows($res) > 0) {
5130 5130
             $row = Database :: fetch_array($res);
@@ -5137,14 +5137,14 @@  discard block
 block discarded – undo
5137 5137
                 $force_return = true;
5138 5138
             }
5139 5139
             $sql = "UPDATE $lp_table SET force_commit = $force
5140
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5140
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5141 5141
             Database::query($sql);
5142 5142
             $this->force_commit = $force_return;
5143 5143
 
5144 5144
             return $force_return;
5145 5145
         } else {
5146 5146
             if ($this->debug > 2) {
5147
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5147
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5148 5148
             }
5149 5149
         }
5150 5150
         return -1;
@@ -5173,7 +5173,7 @@  discard block
 block discarded – undo
5173 5173
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5174 5174
                     $need_fix = true;
5175 5175
                     $sql = "UPDATE $lp_table SET display_order = $i
5176
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5176
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5177 5177
                     Database::query($sql);
5178 5178
                 }
5179 5179
                 $i++;
@@ -5194,7 +5194,7 @@  discard block
 block discarded – undo
5194 5194
         }
5195 5195
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5196 5196
         $sql = "SELECT * FROM $lp_table
5197
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5197
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5198 5198
         $res = Database::query($sql);
5199 5199
         if (Database :: num_rows($res) > 0) {
5200 5200
             $row = Database :: fetch_array($res);
@@ -5205,13 +5205,13 @@  discard block
 block discarded – undo
5205 5205
                 $force = 1;
5206 5206
             }
5207 5207
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5208
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5208
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5209 5209
             Database::query($sql);
5210 5210
             $this->prevent_reinit = $force;
5211 5211
             return $force;
5212 5212
         } else {
5213 5213
             if ($this->debug > 2) {
5214
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5214
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5215 5215
             }
5216 5216
         }
5217 5217
         return -1;
@@ -5227,11 +5227,11 @@  discard block
 block discarded – undo
5227 5227
     {
5228 5228
         //Set default value for seriousgame_mode
5229 5229
         if (!isset($this->seriousgame_mode)) {
5230
-            $this->seriousgame_mode=0;
5230
+            $this->seriousgame_mode = 0;
5231 5231
         }
5232 5232
         // Set default value for prevent_reinit
5233 5233
         if (!isset($this->prevent_reinit)) {
5234
-            $this->prevent_reinit =1;
5234
+            $this->prevent_reinit = 1;
5235 5235
         }
5236 5236
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5237 5237
             return 'seriousgame';
@@ -5279,7 +5279,7 @@  discard block
 block discarded – undo
5279 5279
         $sql = "UPDATE $lp_table SET
5280 5280
                 prevent_reinit = $prevent_reinit ,
5281 5281
                 seriousgame_mode = $sg_mode
5282
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5282
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5283 5283
         $res = Database::query($sql);
5284 5284
         if ($res) {
5285 5285
             return true;
@@ -5331,7 +5331,7 @@  discard block
 block discarded – undo
5331 5331
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5332 5332
         }
5333 5333
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5334
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5334
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5335 5335
         $res = Database::query($sql);
5336 5336
         if (Database :: num_rows($res) > 0) {
5337 5337
             $row = Database :: fetch_array($res);
@@ -5342,13 +5342,13 @@  discard block
 block discarded – undo
5342 5342
                 $force = 1;
5343 5343
             }
5344 5344
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5345
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5345
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5346 5346
             Database::query($sql);
5347 5347
             $this->seriousgame_mode = $force;
5348 5348
             return $force;
5349 5349
         } else {
5350 5350
             if ($this->debug > 2) {
5351
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5351
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5352 5352
             }
5353 5353
         }
5354 5354
         return -1;
@@ -5366,7 +5366,7 @@  discard block
 block discarded – undo
5366 5366
         }
5367 5367
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5368 5368
         $sql = "SELECT * FROM $lp_table
5369
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5369
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5370 5370
         $res = Database::query($sql);
5371 5371
         if (Database :: num_rows($res) > 0) {
5372 5372
             $row = Database :: fetch_array($res);
@@ -5377,13 +5377,13 @@  discard block
 block discarded – undo
5377 5377
                 $force = 1;
5378 5378
             }
5379 5379
             $sql = "UPDATE $lp_table SET debug = $force
5380
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5380
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5381 5381
             $res = Database::query($sql);
5382 5382
             $this->scorm_debug = $force;
5383 5383
             return $force;
5384 5384
         } else {
5385 5385
             if ($this->debug > 2) {
5386
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5386
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5387 5387
             }
5388 5388
         }
5389 5389
         return -1;
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
      * @param int $depth
5413 5413
      * @param array $tmp
5414 5414
      */
5415
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5415
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5416 5416
     {
5417 5417
         if ($this->debug > 1) {
5418 5418
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5498,7 +5498,7 @@  discard block
 block discarded – undo
5498 5498
 
5499 5499
         // we need to start a form when we want to update all the mp3 files
5500 5500
         if ($update_audio == 'true') {
5501
-            $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">';
5501
+            $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">';
5502 5502
         }
5503 5503
         $return .= '<div id="message"></div>';
5504 5504
         if (count($this->items) == 0) {
@@ -5506,14 +5506,14 @@  discard block
 block discarded – undo
5506 5506
         } else {
5507 5507
             $return_audio = '<table class="data_table">';
5508 5508
             $return_audio .= '<tr>';
5509
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5510
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5509
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5510
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5511 5511
             $return_audio .= '</tr>';
5512 5512
 
5513 5513
             if ($update_audio != 'true') {
5514 5514
                 $return .= '<div class="col-md-12">';
5515 5515
                 $return .= self::return_new_tree($update_audio);
5516
-                $return .='</div>';
5516
+                $return .= '</div>';
5517 5517
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5518 5518
             } else {
5519 5519
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5523,7 +5523,7 @@  discard block
 block discarded – undo
5523 5523
             // We need to close the form when we are updating the mp3 files.
5524 5524
             if ($update_audio == 'true') {
5525 5525
                 $return .= '<div class="footer-audio">';
5526
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5526
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5527 5527
                 $return .= '</div>';
5528 5528
                 //$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?
5529 5529
             }
@@ -5544,7 +5544,7 @@  discard block
 block discarded – undo
5544 5544
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5545 5545
     {
5546 5546
         $return = '';
5547
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5547
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5548 5548
 
5549 5549
         $course_id = api_get_course_int_id();
5550 5550
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5592,7 +5592,7 @@  discard block
 block discarded – undo
5592 5592
 
5593 5593
             // Link for the documents
5594 5594
             if ($arrLP[$i]['item_type'] == 'document') {
5595
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5595
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5596 5596
                 $title_cut = Display::url(
5597 5597
                     $title_cut,
5598 5598
                     $url,
@@ -5613,14 +5613,14 @@  discard block
 block discarded – undo
5613 5613
             } else {
5614 5614
                 $oddClass = 'row_even';
5615 5615
             }
5616
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5616
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5617 5617
 
5618 5618
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5619 5619
 
5620
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5620
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5621 5621
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5622 5622
             } else {
5623
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5623
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5624 5624
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5625 5625
                 } else {
5626 5626
                     if ($arrLP[$i]['item_type'] === TOOL_LP_FINAL_ITEM) {
@@ -5632,7 +5632,7 @@  discard block
 block discarded – undo
5632 5632
             }
5633 5633
 
5634 5634
             // The audio column.
5635
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5635
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5636 5636
             $audio = '';
5637 5637
 
5638 5638
             if (!$update_audio || $update_audio <> 'true') {
@@ -5643,10 +5643,10 @@  discard block
 block discarded – undo
5643 5643
             } else {
5644 5644
                 $types = self::getChapterTypes();
5645 5645
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5646
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5646
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5647 5647
                     if (!empty ($arrLP[$i]['audio'])) {
5648 5648
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5649
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5649
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5650 5650
                     }
5651 5651
                 }
5652 5652
             }
@@ -5672,7 +5672,7 @@  discard block
 block discarded – undo
5672 5672
                 // No edit for this item types
5673 5673
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset', 'final_item'))) {
5674 5674
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5675
-                        $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">';
5675
+                        $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">';
5676 5676
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5677 5677
                         $edit_icon .= '</a>';
5678 5678
 
@@ -5685,7 +5685,7 @@  discard block
 block discarded – undo
5685 5685
                                 $this->lp_session_id
5686 5686
                             )
5687 5687
                             ) {
5688
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5688
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5689 5689
                                     'action' => 'dissociate_forum',
5690 5690
                                     'id' => $arrLP[$i]['id'],
5691 5691
                                     'lp_id' => $this->lp_id
@@ -5696,7 +5696,7 @@  discard block
 block discarded – undo
5696 5696
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5697 5697
                                 );
5698 5698
                             } else {
5699
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5699
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5700 5700
                                     'action' => 'create_forum',
5701 5701
                                     'id' => $arrLP[$i]['id'],
5702 5702
                                     'lp_id' => $this->lp_id
@@ -5709,17 +5709,17 @@  discard block
 block discarded – undo
5709 5709
                             }
5710 5710
                         }
5711 5711
                     } else {
5712
-                        $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">';
5712
+                        $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">';
5713 5713
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5714 5714
                         $edit_icon .= '</a>';
5715 5715
                     }
5716 5716
                 }
5717 5717
 
5718
-                $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">';
5718
+                $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">';
5719 5719
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5720 5720
                 $delete_icon .= '</a>';
5721 5721
 
5722
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5722
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5723 5723
 
5724 5724
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5725 5725
                     $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']);
@@ -5728,8 +5728,8 @@  discard block
 block discarded – undo
5728 5728
                 }
5729 5729
             }
5730 5730
             if ($update_audio != 'true') {
5731
-                $row = $move_icon . ' ' . $icon .
5732
-                    Display::span($title_cut) .
5731
+                $row = $move_icon.' '.$icon.
5732
+                    Display::span($title_cut).
5733 5733
                     Display::tag(
5734 5734
                         'div',
5735 5735
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5750,8 +5750,8 @@  discard block
 block discarded – undo
5750 5750
                 $parent_arrays = array();
5751 5751
                 if ($arrLP[$i]['depth'] > 1) {
5752 5752
                     //Getting list of parents
5753
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5754
-                        foreach($arrLP as $item) {
5753
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5754
+                        foreach ($arrLP as $item) {
5755 5755
                             if ($item['id'] == $parent_id) {
5756 5756
                                 if ($item['parent_item_id'] == 0) {
5757 5757
                                     $parent_id = $item['id'];
@@ -5773,8 +5773,8 @@  discard block
 block discarded – undo
5773 5773
                     $parent_arrays = array_reverse($parent_arrays);
5774 5774
                     $val = '$elements';
5775 5775
                     $x = 0;
5776
-                    foreach($parent_arrays as $item) {
5777
-                        if ($x != count($parent_arrays) -1) {
5776
+                    foreach ($parent_arrays as $item) {
5777
+                        if ($x != count($parent_arrays) - 1) {
5778 5778
                             $val .= '["'.$item.'"]["children"]';
5779 5779
                         } else {
5780 5780
                             $val .= '["'.$item.'"]["children"]';
@@ -5837,7 +5837,7 @@  discard block
 block discarded – undo
5837 5837
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5838 5838
                     $active = 'active';
5839 5839
                 }
5840
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5840
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5841 5841
             } else {
5842 5842
                 //sections
5843 5843
                 if (isset($item['children'])) {
@@ -5860,17 +5860,17 @@  discard block
 block discarded – undo
5860 5860
     {
5861 5861
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5862 5862
         $return = '<div class="actions">';
5863
-        $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> ';
5864
-        $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>';
5865
-        $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>';
5863
+        $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> ';
5864
+        $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>';
5865
+        $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>';
5866 5866
         $buttons = array(
5867 5867
             array(
5868 5868
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5869
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5869
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5870 5870
             ),
5871 5871
             array(
5872 5872
                 'title' => get_lang('ClearAllPrerequisites'),
5873
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5873
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5874 5874
             ),
5875 5875
         );
5876 5876
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5893,7 +5893,7 @@  discard block
 block discarded – undo
5893 5893
     {
5894 5894
         // Creating learning_path folder
5895 5895
         $dir = '/learning_path';
5896
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5896
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5897 5897
         $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5898 5898
 
5899 5899
         $folder = false;
@@ -5940,9 +5940,9 @@  discard block
 block discarded – undo
5940 5940
         // Creating LP folder
5941 5941
         if ($folder) {
5942 5942
             //Limits title size
5943
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5943
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5944 5944
             $dir   = $dir.$title;
5945
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5945
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5946 5946
             if (!is_dir($filepath.'/'.$dir)) {
5947 5947
                 $folderData = create_unexisting_directory(
5948 5948
                     $course,
@@ -5962,7 +5962,7 @@  discard block
 block discarded – undo
5962 5962
             }
5963 5963
             $dir = $dir.'/';
5964 5964
             if ($folder) {
5965
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5965
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5966 5966
             }
5967 5967
         }
5968 5968
         $array = array(
@@ -6004,12 +6004,12 @@  discard block
 block discarded – undo
6004 6004
             $dir = substr($dir, 1);
6005 6005
         }
6006 6006
         if (!empty($dir[0]) && $dir[0] != '/') {
6007
-            $dir = '/' . $dir;
6007
+            $dir = '/'.$dir;
6008 6008
         }
6009 6009
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
6010 6010
             $dir .= '/';
6011 6011
         }
6012
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
6012
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6013 6013
 
6014 6014
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
6015 6015
             //Generates folder
@@ -6019,7 +6019,7 @@  discard block
 block discarded – undo
6019 6019
         }
6020 6020
 
6021 6021
         if (!is_dir($filepath)) {
6022
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6022
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6023 6023
             $dir = '/';
6024 6024
         }
6025 6025
 
@@ -6039,10 +6039,10 @@  discard block
 block discarded – undo
6039 6039
         $tmp_filename = $filename;
6040 6040
 
6041 6041
         $i = 0;
6042
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6043
-            $tmp_filename = $filename . '_' . ++ $i;
6042
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6043
+            $tmp_filename = $filename.'_'.++ $i;
6044 6044
 
6045
-        $filename = $tmp_filename . '.'.$extension;
6045
+        $filename = $tmp_filename.'.'.$extension;
6046 6046
         if ($extension == 'html') {
6047 6047
             $content = stripslashes($content);
6048 6048
             $content = str_replace(
@@ -6077,12 +6077,12 @@  discard block
 block discarded – undo
6077 6077
             );
6078 6078
         }
6079 6079
 
6080
-        if (!file_exists($filepath . $filename)) {
6081
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6080
+        if (!file_exists($filepath.$filename)) {
6081
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6082 6082
                 fputs($fp, $content);
6083 6083
                 fclose($fp);
6084 6084
 
6085
-                $file_size = filesize($filepath . $filename);
6085
+                $file_size = filesize($filepath.$filename);
6086 6086
                 $save_file_path = $dir.$filename;
6087 6087
 
6088 6088
                 $document_id = add_document(
@@ -6120,12 +6120,12 @@  discard block
 block discarded – undo
6120 6120
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6121 6121
                         $ct = '';
6122 6122
                         if ($new_comment)
6123
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6123
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6124 6124
                         if ($new_title)
6125
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6125
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6126 6126
 
6127
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6128
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6127
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6128
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6129 6129
                         Database::query($sql);
6130 6130
                     }
6131 6131
                 }
@@ -6153,41 +6153,41 @@  discard block
 block discarded – undo
6153 6153
             $dir = substr($dir, 1);
6154 6154
 
6155 6155
         if ($dir[0] != '/')
6156
-            $dir = '/' . $dir;
6156
+            $dir = '/'.$dir;
6157 6157
 
6158 6158
         if ($dir[strlen($dir) - 1] != '/')
6159 6159
             $dir .= '/';
6160 6160
 
6161
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6161
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6162 6162
 
6163 6163
         if (!is_dir($filepath)) {
6164
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6164
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6165 6165
         }
6166 6166
 
6167 6167
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6168 6168
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6169 6169
             $document_id = intval($_POST['path']);
6170
-            $sql = "SELECT path FROM " . $table_doc . "
6171
-                    WHERE c_id = $course_id AND id = " . $document_id;
6170
+            $sql = "SELECT path FROM ".$table_doc."
6171
+                    WHERE c_id = $course_id AND id = ".$document_id;
6172 6172
             $res = Database::query($sql);
6173 6173
             $row = Database :: fetch_array($res);
6174 6174
             $content = stripslashes($_POST['content_lp']);
6175
-            $file = $filepath . $row['path'];
6175
+            $file = $filepath.$row['path'];
6176 6176
 
6177 6177
             if ($fp = @ fopen($file, 'w')) {
6178
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6178
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6179 6179
 
6180 6180
                 // Change the path of mp3 to absolute.
6181 6181
                 // The first regexp deals with :// urls.
6182
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6182
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6183 6183
                 // The second regexp deals with audio/ urls.
6184
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6184
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6185 6185
                 fputs($fp, $content);
6186 6186
                 fclose($fp);
6187 6187
 
6188
-                $sql = "UPDATE " . $table_doc ." SET
6188
+                $sql = "UPDATE ".$table_doc." SET
6189 6189
                             title='".Database::escape_string($_POST['title'])."'
6190
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6190
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6191 6191
                 Database::query($sql);
6192 6192
             }
6193 6193
         }
@@ -6205,10 +6205,10 @@  discard block
 block discarded – undo
6205 6205
         $return = '';
6206 6206
         if (is_numeric($item_id)) {
6207 6207
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6208
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6209
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6208
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6209
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6210 6210
             $result = Database::query($sql);
6211
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6211
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6212 6212
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6213 6213
 
6214 6214
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6235,8 +6235,8 @@  discard block
 block discarded – undo
6235 6235
                         break;
6236 6236
                     case TOOL_DOCUMENT:
6237 6237
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6238
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6239
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6238
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6239
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6240 6240
                         $result = Database::query($sql_doc);
6241 6241
                         $path_file = Database::result($result, 0, 0);
6242 6242
                         $path_parts = pathinfo($path_file);
@@ -6275,7 +6275,7 @@  discard block
 block discarded – undo
6275 6275
         if (is_numeric($item_id)) {
6276 6276
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6277 6277
             $sql = "SELECT * FROM $tbl_lp_item
6278
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6278
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6279 6279
             $res = Database::query($sql);
6280 6280
             $row = Database::fetch_array($res);
6281 6281
             switch ($row['item_type']) {
@@ -6285,21 +6285,21 @@  discard block
 block discarded – undo
6285 6285
                 case 'sco':
6286 6286
                     if (isset($_GET['view']) && $_GET['view'] == 'build') {
6287 6287
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6288
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6288
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6289 6289
                     } else {
6290
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6290
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6291 6291
                     }
6292 6292
                     break;
6293 6293
                 case TOOL_DOCUMENT:
6294 6294
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6295 6295
                     $sql = "SELECT lp.*, doc.path as dir
6296
-                            FROM " . $tbl_lp_item . " as lp
6297
-                            LEFT JOIN " . $tbl_doc . " as doc
6296
+                            FROM " . $tbl_lp_item." as lp
6297
+                            LEFT JOIN " . $tbl_doc." as doc
6298 6298
                             ON doc.id = lp.path
6299 6299
                             WHERE
6300 6300
                                 lp.c_id = $course_id AND
6301 6301
                                 doc.c_id = $course_id AND
6302
-                                lp.id = " . intval($item_id);
6302
+                                lp.id = ".intval($item_id);
6303 6303
                     $res_step = Database::query($sql);
6304 6304
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6305 6305
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6309,8 +6309,8 @@  discard block
 block discarded – undo
6309 6309
                     $link_id = (string) $row['path'];
6310 6310
                     if (ctype_digit($link_id)) {
6311 6311
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6312
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6313
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6312
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6313
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6314 6314
                         $res_link = Database::query($sql_select);
6315 6315
                         $row_link = Database :: fetch_array($res_link);
6316 6316
                         if (is_array($row_link)) {
@@ -6324,13 +6324,13 @@  discard block
 block discarded – undo
6324 6324
                     $_SESSION['finalItem'] = true;
6325 6325
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6326 6326
                     $sql = "SELECT lp.*, doc.path as dir
6327
-                            FROM " . $tbl_lp_item . " as lp
6328
-                            LEFT JOIN " . $tbl_doc . " as doc
6327
+                            FROM " . $tbl_lp_item." as lp
6328
+                            LEFT JOIN " . $tbl_doc." as doc
6329 6329
                             ON doc.id = lp.path
6330 6330
                             WHERE
6331 6331
                                 lp.c_id = $course_id AND
6332 6332
                                 doc.c_id = $course_id AND
6333
-                                lp.id = " . intval($item_id);
6333
+                                lp.id = ".intval($item_id);
6334 6334
                     $res_step = Database::query($sql);
6335 6335
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6336 6336
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6339,9 +6339,9 @@  discard block
 block discarded – undo
6339 6339
                 case 'dokeos_module':
6340 6340
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6341 6341
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6342
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6342
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6343 6343
                     } else {
6344
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6344
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6345 6345
                     }
6346 6346
                     break;
6347 6347
                 case TOOL_QUIZ:
@@ -6399,7 +6399,7 @@  discard block
 block discarded – undo
6399 6399
 
6400 6400
         $headers = array(
6401 6401
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6402
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6402
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6403 6403
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6404 6404
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6405 6405
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6440,16 +6440,16 @@  discard block
 block discarded – undo
6440 6440
         $course_id = api_get_course_int_id();
6441 6441
         $return = '';
6442 6442
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6443
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6444
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6443
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6444
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6445 6445
         $res_doc = Database::query($sql_doc);
6446 6446
         $row_doc = Database :: fetch_array($res_doc);
6447 6447
 
6448 6448
         // TODO: Add a path filter.
6449 6449
         if ($iframe) {
6450
-            $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>';
6450
+            $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>';
6451 6451
         } else {
6452
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6452
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6453 6453
         }
6454 6454
 
6455 6455
         return $return;
@@ -6473,8 +6473,8 @@  discard block
 block discarded – undo
6473 6473
             $item_description = $extra_info['description'];
6474 6474
         } elseif (is_numeric($extra_info)) {
6475 6475
             $sql = "SELECT title, description
6476
-                    FROM " . $tbl_quiz . "
6477
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6476
+                    FROM " . $tbl_quiz."
6477
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6478 6478
 
6479 6479
             $result = Database::query($sql);
6480 6480
             $row = Database::fetch_array($result);
@@ -6484,21 +6484,21 @@  discard block
 block discarded – undo
6484 6484
             $item_title = '';
6485 6485
             $item_description = '';
6486 6486
         }
6487
-        $item_title			= Security::remove_XSS($item_title);
6488
-        $item_description 	= Security::remove_XSS($item_description);
6487
+        $item_title = Security::remove_XSS($item_title);
6488
+        $item_description = Security::remove_XSS($item_description);
6489 6489
 
6490 6490
         if ($id != 0 && is_array($extra_info))
6491 6491
             $parent = $extra_info['parent_item_id'];
6492 6492
         else
6493 6493
             $parent = 0;
6494 6494
 
6495
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6496
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6495
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6496
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6497 6497
 
6498 6498
         $result = Database::query($sql);
6499
-        $arrLP = array ();
6499
+        $arrLP = array();
6500 6500
         while ($row = Database :: fetch_array($result)) {
6501
-            $arrLP[] = array (
6501
+            $arrLP[] = array(
6502 6502
                 'id' => $row['id'],
6503 6503
                 'item_type' => $row['item_type'],
6504 6504
                 'title' => $row['title'],
@@ -6520,7 +6520,7 @@  discard block
 block discarded – undo
6520 6520
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6521 6521
         unset ($this->arrMenu);
6522 6522
 
6523
-        $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6523
+        $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6524 6524
         $defaults = [];
6525 6525
 
6526 6526
         if ($action == 'add') {
@@ -6532,7 +6532,7 @@  discard block
 block discarded – undo
6532 6532
         }
6533 6533
 
6534 6534
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6535
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6535
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6536 6536
         }
6537 6537
 
6538 6538
         $form->addHeader($legend);
@@ -6551,7 +6551,7 @@  discard block
 block discarded – undo
6551 6551
         );
6552 6552
         $selectParent->addOption($this->name, 0);
6553 6553
 
6554
-        $arrHide = array (
6554
+        $arrHide = array(
6555 6555
             $id
6556 6556
         );
6557 6557
         for ($i = 0; $i < count($arrLP); $i++) {
@@ -6568,7 +6568,7 @@  discard block
 block discarded – undo
6568 6568
                     $selectParent->addOption(
6569 6569
                         $arrLP[$i]['title'],
6570 6570
                         $arrLP[$i]['id'],
6571
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6571
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6572 6572
                     );
6573 6573
 
6574 6574
                     if ($parent == $arrLP[$i]['id']) {
@@ -6585,7 +6585,7 @@  discard block
 block discarded – undo
6585 6585
                 ) {
6586 6586
                     $selectParent->addOption(
6587 6587
                         $arrLP[$i]['title'],
6588
-                        $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6588
+                        $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6589 6589
                     );
6590 6590
 
6591 6591
                     if ($parent == $arrLP[$i]['id']) {
@@ -6603,7 +6603,7 @@  discard block
 block discarded – undo
6603 6603
 
6604 6604
         for ($i = 0; $i < count($arrLP); $i++) {
6605 6605
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6606
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
6606
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
6607 6607
 
6608 6608
                 if (is_array($extra_info)) {
6609 6609
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
@@ -6625,7 +6625,7 @@  discard block
 block discarded – undo
6625 6625
                     }
6626 6626
                 }
6627 6627
             }
6628
-            $arrHide = array ();
6628
+            $arrHide = array();
6629 6629
             for ($i = 0; $i < count($arrLP); $i++) {
6630 6630
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6631 6631
                     if (is_array($extra_info)) {
@@ -6690,7 +6690,7 @@  discard block
 block discarded – undo
6690 6690
 
6691 6691
         $form->setDefaults($defaults);
6692 6692
 
6693
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
6693
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
6694 6694
     }
6695 6695
 
6696 6696
     /**
@@ -6712,11 +6712,11 @@  discard block
 block discarded – undo
6712 6712
         } elseif (is_numeric($extra_info)) {
6713 6713
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6714 6714
 
6715
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6715
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6716 6716
                     WHERE
6717 6717
                         c_id = ".$course_id." AND
6718
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6719
-                        id = " . (int) $extra_info . "
6718
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6719
+                        id = " . (int) $extra_info."
6720 6720
                     ORDER BY id ASC";
6721 6721
 
6722 6722
             $res_hot = Database::query($sql);
@@ -6740,11 +6740,11 @@  discard block
 block discarded – undo
6740 6740
         }
6741 6741
 
6742 6742
         $sql = "SELECT * FROM $tbl_lp_item
6743
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6743
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6744 6744
         $result = Database::query($sql);
6745
-        $arrLP = array ();
6745
+        $arrLP = array();
6746 6746
         while ($row = Database :: fetch_array($result)) {
6747
-            $arrLP[] = array (
6747
+            $arrLP[] = array(
6748 6748
                 'id' => $row['id'],
6749 6749
                 'item_type' => $row['item_type'],
6750 6750
                 'title' => $row['title'],
@@ -6769,7 +6769,7 @@  discard block
 block discarded – undo
6769 6769
         else
6770 6770
             $legend .= get_lang('EditCurrentExecice');
6771 6771
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6772
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6772
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6773 6773
         }
6774 6774
         $legend .= '</legend>';
6775 6775
 
@@ -6777,11 +6777,11 @@  discard block
 block discarded – undo
6777 6777
         $return .= $legend;
6778 6778
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6779 6779
         $return .= '<tr>';
6780
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6780
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6781 6781
         $return .= '<td class="input">';
6782 6782
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6783
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6784
-        $arrHide = array (
6783
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6784
+        $arrHide = array(
6785 6785
             $id
6786 6786
         );
6787 6787
 
@@ -6789,13 +6789,13 @@  discard block
 block discarded – undo
6789 6789
             for ($i = 0; $i < count($arrLP); $i++) {
6790 6790
                 if ($action != 'add') {
6791 6791
                     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)) {
6792
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6792
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6793 6793
                     } else {
6794 6794
                         $arrHide[] = $arrLP[$i]['id'];
6795 6795
                     }
6796 6796
                 } else {
6797 6797
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6798
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6798
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6799 6799
                 }
6800 6800
             }
6801 6801
 
@@ -6806,10 +6806,10 @@  discard block
 block discarded – undo
6806 6806
         $return .= '</td>';
6807 6807
         $return .= '</tr>';
6808 6808
         $return .= '<tr>';
6809
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6809
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6810 6810
         $return .= '<td class="input">';
6811 6811
         $return .= '<select id="previous" name="previous" size="1">';
6812
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6812
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6813 6813
 
6814 6814
         for ($i = 0; $i < count($arrLP); $i++) {
6815 6815
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6819,7 +6819,7 @@  discard block
 block discarded – undo
6819 6819
                 else
6820 6820
                     $selected = '';
6821 6821
 
6822
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6822
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6823 6823
             }
6824 6824
         }
6825 6825
 
@@ -6829,8 +6829,8 @@  discard block
 block discarded – undo
6829 6829
 
6830 6830
         if ($action != 'move') {
6831 6831
             $return .= '<tr>';
6832
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6833
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6832
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6833
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6834 6834
             $return .= '</tr>';
6835 6835
             $id_prerequisite = 0;
6836 6836
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6841,7 +6841,7 @@  discard block
 block discarded – undo
6841 6841
                     }
6842 6842
                 }
6843 6843
 
6844
-                $arrHide = array ();
6844
+                $arrHide = array();
6845 6845
                 for ($i = 0; $i < count($arrLP); $i++) {
6846 6846
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6847 6847
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6855,22 +6855,22 @@  discard block
 block discarded – undo
6855 6855
         }
6856 6856
 
6857 6857
         $return .= '<tr>';
6858
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6858
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6859 6859
         $return .= '</tr>';
6860 6860
         $return .= '</table>';
6861 6861
 
6862 6862
         if ($action == 'move') {
6863
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6864
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6863
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6864
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6865 6865
         }
6866 6866
 
6867 6867
         if (is_numeric($extra_info)) {
6868
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6868
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6869 6869
         } elseif (is_array($extra_info)) {
6870
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6870
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6871 6871
         }
6872
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6873
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6872
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6873
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6874 6874
         $return .= '</form>';
6875 6875
 
6876 6876
         return $return;
@@ -6893,8 +6893,8 @@  discard block
 block discarded – undo
6893 6893
             $item_title = stripslashes($extra_info['title']);
6894 6894
         } elseif (is_numeric($extra_info)) {
6895 6895
             $sql = "SELECT forum_title as title, forum_comment as comment
6896
-                    FROM " . $tbl_forum . "
6897
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6896
+                    FROM " . $tbl_forum."
6897
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6898 6898
 
6899 6899
             $result = Database::query($sql);
6900 6900
             $row = Database :: fetch_array($result);
@@ -6912,7 +6912,7 @@  discard block
 block discarded – undo
6912 6912
             $parent = 0;
6913 6913
         }
6914 6914
 
6915
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6915
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6916 6916
                 WHERE
6917 6917
                     c_id = ".$course_id." AND
6918 6918
                     lp_id = " . $this->lp_id;
@@ -6920,7 +6920,7 @@  discard block
 block discarded – undo
6920 6920
         $arrLP = array();
6921 6921
 
6922 6922
         while ($row = Database :: fetch_array($result)) {
6923
-            $arrLP[] = array (
6923
+            $arrLP[] = array(
6924 6924
                 'id' => $row['id'],
6925 6925
                 'item_type' => $row['item_type'],
6926 6926
                 'title' => $row['title'],
@@ -6949,7 +6949,7 @@  discard block
 block discarded – undo
6949 6949
             $legend = get_lang('EditCurrentForum');
6950 6950
         }
6951 6951
 
6952
-        $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6952
+        $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6953 6953
         $defaults = [];
6954 6954
 
6955 6955
         $form->addHeader($legend);
@@ -6978,7 +6978,7 @@  discard block
 block discarded – undo
6978 6978
                     $selectParent->addOption(
6979 6979
                         $arrLP[$i]['title'],
6980 6980
                         $arrLP[$i]['id'],
6981
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6981
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6982 6982
                     );
6983 6983
 
6984 6984
                     if ($parent == $arrLP[$i]['id']) {
@@ -6996,7 +6996,7 @@  discard block
 block discarded – undo
6996 6996
                     $selectParent->addOption(
6997 6997
                         $arrLP[$i]['title'],
6998 6998
                         $arrLP[$i]['id'],
6999
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6999
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7000 7000
                     );
7001 7001
 
7002 7002
                     if ($parent == $arrLP[$i]['id']) {
@@ -7019,7 +7019,7 @@  discard block
 block discarded – undo
7019 7019
 
7020 7020
         for ($i = 0; $i < count($arrLP); $i++) {
7021 7021
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7022
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
7022
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
7023 7023
 
7024 7024
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7025 7025
                     $selectPrevious->setSelected($arrLP[$i]['id']);
@@ -7071,7 +7071,7 @@  discard block
 block discarded – undo
7071 7071
         $form->addHidden('post_time', time());
7072 7072
         $form->setDefaults($defaults);
7073 7073
 
7074
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
7074
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
7075 7075
     }
7076 7076
 
7077 7077
     /**
@@ -7094,7 +7094,7 @@  discard block
 block discarded – undo
7094 7094
             $item_title = stripslashes($extra_info['title']);
7095 7095
         } elseif (is_numeric($extra_info)) {
7096 7096
             $sql = "SELECT thread_title as title FROM $tbl_forum
7097
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7097
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7098 7098
 
7099 7099
             $result = Database::query($sql);
7100 7100
             $row = Database :: fetch_array($result);
@@ -7112,15 +7112,15 @@  discard block
 block discarded – undo
7112 7112
             $parent = 0;
7113 7113
         }
7114 7114
 
7115
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7116
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7115
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7116
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7117 7117
 
7118 7118
         $result = Database::query($sql);
7119 7119
 
7120
-        $arrLP = array ();
7120
+        $arrLP = array();
7121 7121
 
7122 7122
         while ($row = Database :: fetch_array($result)) {
7123
-            $arrLP[] = array (
7123
+            $arrLP[] = array(
7124 7124
                 'id' => $row['id'],
7125 7125
                 'item_type' => $row['item_type'],
7126 7126
                 'title' => $row['title'],
@@ -7141,7 +7141,7 @@  discard block
 block discarded – undo
7141 7141
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7142 7142
         unset ($this->arrMenu);
7143 7143
 
7144
-        $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7144
+        $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7145 7145
         $defaults = [];
7146 7146
 
7147 7147
         if ($action == 'add') {
@@ -7161,7 +7161,7 @@  discard block
 block discarded – undo
7161 7161
         );
7162 7162
         $selectParent->addOption($this->name, 0);
7163 7163
 
7164
-        $arrHide = array (
7164
+        $arrHide = array(
7165 7165
             $id
7166 7166
         );
7167 7167
 
@@ -7179,7 +7179,7 @@  discard block
 block discarded – undo
7179 7179
                     $selectParent->addOption(
7180 7180
                         $arrLP[$i]['title'],
7181 7181
                         $arrLP[$i]['id'],
7182
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7182
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7183 7183
                     );
7184 7184
 
7185 7185
                     if ($parent == $arrLP[$i]['id']) {
@@ -7197,7 +7197,7 @@  discard block
 block discarded – undo
7197 7197
                     $selectParent->addOption(
7198 7198
                         $arrLP[$i]['title'],
7199 7199
                         $arrLP[$i]['id'],
7200
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7200
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7201 7201
                     );
7202 7202
 
7203 7203
                     if ($parent == $arrLP[$i]['id']) {
@@ -7217,7 +7217,7 @@  discard block
 block discarded – undo
7217 7217
         for ($i = 0; $i < count($arrLP); $i++) {
7218 7218
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7219 7219
                 $selectPrevious->addOption(
7220
-                    get_lang('After')  . ' "' . $arrLP[$i]['title'] . '"',
7220
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
7221 7221
                     $arrLP[$i]['id']
7222 7222
                 );
7223 7223
 
@@ -7315,10 +7315,10 @@  discard block
 block discarded – undo
7315 7315
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7316 7316
 
7317 7317
         if ($id != 0 && is_array($extra_info)) {
7318
-            $item_title 		= $extra_info['title'];
7319
-            $item_description 	= $extra_info['description'];
7320
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7321
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7318
+            $item_title = $extra_info['title'];
7319
+            $item_description = $extra_info['description'];
7320
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7321
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7322 7322
         } else {
7323 7323
             $item_title = '';
7324 7324
             $item_description = '';
@@ -7332,17 +7332,17 @@  discard block
 block discarded – undo
7332 7332
         }
7333 7333
 
7334 7334
         $id  = intval($id);
7335
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7335
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7336 7336
                 WHERE
7337 7337
                     c_id = ".$course_id." AND
7338
-                    lp_id = " . $this->lp_id . " AND
7338
+                    lp_id = " . $this->lp_id." AND
7339 7339
                     id != $id";
7340 7340
 
7341 7341
         if ($item_type == 'module')
7342 7342
             $sql .= " AND parent_item_id = 0";
7343 7343
 
7344 7344
         $result = Database::query($sql);
7345
-        $arrLP = array ();
7345
+        $arrLP = array();
7346 7346
 
7347 7347
         while ($row = Database :: fetch_array($result)) {
7348 7348
             $arrLP[] = array(
@@ -7370,9 +7370,9 @@  discard block
 block discarded – undo
7370 7370
 
7371 7371
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7372 7372
 
7373
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7373
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7374 7374
 
7375
-        $form = new FormValidator('form', 'POST',  $url);
7375
+        $form = new FormValidator('form', 'POST', $url);
7376 7376
 
7377 7377
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7378 7378
         $defaults['description'] = $item_description;
@@ -7416,7 +7416,7 @@  discard block
 block discarded – undo
7416 7416
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7417 7417
 
7418 7418
             foreach ($arrHide as $key => $value) {
7419
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7419
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7420 7420
             }
7421 7421
             if (!empty($s_selected_parent)) {
7422 7422
                 $parent_select->setSelected($s_selected_parent);
@@ -7438,16 +7438,16 @@  discard block
 block discarded – undo
7438 7438
                     $s_selected_position = $arrLP[$i]['id'];
7439 7439
                 }
7440 7440
 
7441
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7441
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7442 7442
             }
7443 7443
         }
7444 7444
 
7445 7445
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7446 7446
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7447
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7447
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7448 7448
 
7449 7449
         foreach ($arrHide as $key => $value) {
7450
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7450
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7451 7451
         }
7452 7452
 
7453 7453
         if (!empty ($s_selected_position)) {
@@ -7476,23 +7476,23 @@  discard block
 block discarded – undo
7476 7476
         //assets can't be modified
7477 7477
 
7478 7478
         //$item_type == 'asset' ||
7479
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7479
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7480 7480
 
7481 7481
             if ($item_type == 'sco') {
7482
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7482
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7483 7483
             }
7484 7484
             $renderer = $form->defaultRenderer();
7485 7485
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7486 7486
 
7487 7487
             $relative_prefix = '';
7488 7488
 
7489
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7489
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7490 7490
                 'Width' 				=> '100%',
7491 7491
                 'Height' 				=> '500',
7492 7492
                 'FullPage' 				=> true,
7493 7493
                 'CreateDocumentDir' 	=> $relative_prefix,
7494
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7495
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7494
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7495
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7496 7496
             );
7497 7497
 
7498 7498
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7501,7 +7501,7 @@  discard block
 block discarded – undo
7501 7501
             $defaults['content_lp'] = file_get_contents($content_path);
7502 7502
         }
7503 7503
 
7504
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7504
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7505 7505
         $form->addElement('hidden', 'post_time', time());
7506 7506
         $form->setDefaults($defaults);
7507 7507
         return $form->return_form();
@@ -7539,8 +7539,8 @@  discard block
 block discarded – undo
7539 7539
         // We don't display the document form if it's not an editable document (html or txt file).
7540 7540
         if ($action == "add") {
7541 7541
             if (is_numeric($extra_info)) {
7542
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7543
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7542
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7543
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7544 7544
                 $result = Database::query($sql_doc);
7545 7545
                 $path_file = Database :: result($result, 0, 0);
7546 7546
                 $path_parts = pathinfo($path_file);
@@ -7558,13 +7558,13 @@  discard block
 block discarded – undo
7558 7558
                 $item_title = stripslashes($path_parts['filename']);
7559 7559
             }
7560 7560
         } elseif (is_numeric($extra_info)) {
7561
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7561
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7562 7562
                         WHERE
7563 7563
                             c_id = ".$course_id." AND
7564 7564
                             id = " . intval($extra_info);
7565 7565
 
7566 7566
             $result = Database::query($sql_doc);
7567
-            $row 	= Database::fetch_array($result);
7567
+            $row = Database::fetch_array($result);
7568 7568
             $item_title = $row['title'];
7569 7569
             $item_title = str_replace('_', ' ', $item_title);
7570 7570
             if (empty ($item_title)) {
@@ -7583,11 +7583,11 @@  discard block
 block discarded – undo
7583 7583
             $parent = 0;
7584 7584
         }
7585 7585
 
7586
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7587
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7586
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7587
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7588 7588
 
7589 7589
         $result = Database::query($sql);
7590
-        $arrLP = array ();
7590
+        $arrLP = array();
7591 7591
         while ($row = Database :: fetch_array($result)) {
7592 7592
             $arrLP[] = array(
7593 7593
                 'id' => $row['id'],
@@ -7621,9 +7621,9 @@  discard block
 block discarded – undo
7621 7621
         $return .= '</legend>';
7622 7622
 
7623 7623
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7624
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7624
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7625 7625
         }
7626
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7626
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7627 7627
         $defaults['title'] = Security :: remove_XSS($item_title);
7628 7628
         if (empty($item_title)) {
7629 7629
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7659,15 +7659,15 @@  discard block
 block discarded – undo
7659 7659
         }
7660 7660
 
7661 7661
         $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']);
7662
-        $my_count=0;
7662
+        $my_count = 0;
7663 7663
         foreach ($arrHide as $key => $value) {
7664
-            if ($my_count!=0) {
7664
+            if ($my_count != 0) {
7665 7665
                 // The LP name is also the first section and is not in the same charset like the other sections.
7666 7666
                 $value['value'] = Security :: remove_XSS($value['value']);
7667
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7667
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7668 7668
             } else {
7669 7669
                 $value['value'] = Security :: remove_XSS($value['value']);
7670
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7670
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7671 7671
             }
7672 7672
             $my_count++;
7673 7673
         }
@@ -7675,7 +7675,7 @@  discard block
 block discarded – undo
7675 7675
         if (!empty($id)) {
7676 7676
             $parent_select->setSelected($parent);
7677 7677
         } else {
7678
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7678
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7679 7679
             $parent_select->setSelected($parent_item_id);
7680 7680
         }
7681 7681
 
@@ -7692,7 +7692,7 @@  discard block
 block discarded – undo
7692 7692
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') {
7693 7693
                     $s_selected_position = $arrLP[$i]['id'];
7694 7694
                 }
7695
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7695
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7696 7696
             }
7697 7697
         }
7698 7698
 
@@ -7700,8 +7700,8 @@  discard block
 block discarded – undo
7700 7700
         $position->addOption(get_lang('FirstPosition'), 0);
7701 7701
 
7702 7702
         foreach ($arrHide as $key => $value) {
7703
-            $padding = isset($value['padding']) ? $value['padding']: 20;
7704
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7703
+            $padding = isset($value['padding']) ? $value['padding'] : 20;
7704
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7705 7705
         }
7706 7706
 
7707 7707
         $position->setSelected($s_selected_position);
@@ -7772,7 +7772,7 @@  discard block
 block discarded – undo
7772 7772
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7773 7773
                             $relative_path 	 = implode('/', $relative_path);
7774 7774
                             if (strlen($relative_path) > 0) {
7775
-                                $relative_path = $relative_path . '/';
7775
+                                $relative_path = $relative_path.'/';
7776 7776
                             }
7777 7777
                         } else {
7778 7778
                             $result = $this->generate_lp_folder($_course);
@@ -7786,8 +7786,8 @@  discard block
 block discarded – undo
7786 7786
                             'Height' 				=> '500',
7787 7787
                             'FullPage' 				=> true,
7788 7788
                             'CreateDocumentDir' 	=> $relative_prefix,
7789
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7790
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7789
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7790
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7791 7791
                         );
7792 7792
 
7793 7793
                         if ($_GET['action'] == 'add_item') {
@@ -7854,8 +7854,8 @@  discard block
 block discarded – undo
7854 7854
             $item_url = stripslashes($extra_info['url']);
7855 7855
         } elseif (is_numeric($extra_info)) {
7856 7856
             $extra_info = intval($extra_info);
7857
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7858
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7857
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7858
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7859 7859
             $result = Database::query($sql);
7860 7860
             $row = Database :: fetch_array($result);
7861 7861
             $item_title       = $row['title'];
@@ -7867,7 +7867,7 @@  discard block
 block discarded – undo
7867 7867
             $item_url = '';
7868 7868
         }
7869 7869
 
7870
-        $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7870
+        $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7871 7871
         $defaults = [];
7872 7872
 
7873 7873
         if ($id != 0 && is_array($extra_info)) {
@@ -7876,8 +7876,8 @@  discard block
 block discarded – undo
7876 7876
             $parent = 0;
7877 7877
         }
7878 7878
 
7879
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7880
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7879
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7880
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7881 7881
         $result = Database::query($sql);
7882 7882
         $arrLP = array();
7883 7883
 
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
                     $selectParent->addOption(
7946 7946
                         $arrLP[$i]['title'],
7947 7947
                         $arrLP[$i]['id'],
7948
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;']
7948
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;']
7949 7949
                     );
7950 7950
 
7951 7951
                     if ($parent == $arrLP[$i]['id']) {
@@ -7959,7 +7959,7 @@  discard block
 block discarded – undo
7959 7959
                     $selectParent->addOption(
7960 7960
                         $arrLP[$i]['title'],
7961 7961
                         $arrLP[$i]['id'],
7962
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7962
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7963 7963
                     );
7964 7964
 
7965 7965
                     if ($parent_item_id == $arrLP[$i]['id']) {
@@ -8046,7 +8046,7 @@  discard block
 block discarded – undo
8046 8046
 
8047 8047
         $form->setDefaults($defaults);
8048 8048
 
8049
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
8049
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
8050 8050
     }
8051 8051
 
8052 8052
     /**
@@ -8068,8 +8068,8 @@  discard block
 block discarded – undo
8068 8068
         } elseif (is_numeric($extra_info)) {
8069 8069
             $extra_info = intval($extra_info);
8070 8070
             $sql = "SELECT title, description
8071
-                    FROM " . $tbl_publication . "
8072
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
8071
+                    FROM " . $tbl_publication."
8072
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
8073 8073
 
8074 8074
             $result = Database::query($sql);
8075 8075
             $row = Database :: fetch_array($result);
@@ -8085,13 +8085,13 @@  discard block
 block discarded – undo
8085 8085
             $parent = 0;
8086 8086
         }
8087 8087
 
8088
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8089
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8088
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8089
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8090 8090
 
8091 8091
         $result = Database::query($sql);
8092 8092
         $arrLP = array();
8093 8093
         while ($row = Database :: fetch_array($result)) {
8094
-            $arrLP[] = array (
8094
+            $arrLP[] = array(
8095 8095
                 'id' => $row['id'],
8096 8096
                 'item_type' => $row['item_type'],
8097 8097
                 'title' => $row['title'],
@@ -8137,7 +8137,7 @@  discard block
 block discarded – undo
8137 8137
             ]
8138 8138
         );
8139 8139
 
8140
-        $arrHide = array (
8140
+        $arrHide = array(
8141 8141
             $id
8142 8142
         );
8143 8143
 
@@ -8155,7 +8155,7 @@  discard block
 block discarded – undo
8155 8155
                     $parentSelect->addOption(
8156 8156
                         $arrLP[$i]['title'],
8157 8157
                         $arrLP[$i]['id'],
8158
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8158
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8159 8159
                     );
8160 8160
 
8161 8161
                     if ($parent == $arrLP[$i]['id']) {
@@ -8172,7 +8172,7 @@  discard block
 block discarded – undo
8172 8172
                     $parentSelect->addOption(
8173 8173
                         $arrLP[$i]['title'],
8174 8174
                         $arrLP[$i]['id'],
8175
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8175
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8176 8176
                     );
8177 8177
 
8178 8178
                     if ($parent == $arrLP[$i]['id']) {
@@ -8196,7 +8196,7 @@  discard block
 block discarded – undo
8196 8196
         for ($i = 0; $i < count($arrLP); $i++) {
8197 8197
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8198 8198
                 $previousSelect->addOption(
8199
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8199
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8200 8200
                     $arrLP[$i]['id']
8201 8201
                 );
8202 8202
 
@@ -8218,7 +8218,7 @@  discard block
 block discarded – undo
8218 8218
                     }
8219 8219
                 }
8220 8220
             }
8221
-            $arrHide = array ();
8221
+            $arrHide = array();
8222 8222
             for ($i = 0; $i < count($arrLP); $i++) {
8223 8223
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8224 8224
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8310,8 +8310,8 @@  discard block
 block discarded – undo
8310 8310
 
8311 8311
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8312 8312
         $item_id = intval($item_id);
8313
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8314
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8313
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8314
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8315 8315
         $result = Database::query($sql);
8316 8316
         $row = Database::fetch_assoc($result);
8317 8317
 
@@ -8325,16 +8325,16 @@  discard block
 block discarded – undo
8325 8325
             $audio_player .= '<script>
8326 8326
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8327 8327
                                 s1.addParam("allowscriptaccess","always");
8328
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8328
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8329 8329
                                 s1.write("container");
8330 8330
                             </script>';
8331 8331
         }
8332 8332
 
8333
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8333
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8334 8334
 
8335 8335
         $return .= Display::url(
8336 8336
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8337
-            $url.'&action=edit_item&path_item=' . $row['path']
8337
+            $url.'&action=edit_item&path_item='.$row['path']
8338 8338
         );
8339 8339
 
8340 8340
         $return .= Display::url(
@@ -8354,7 +8354,7 @@  discard block
 block discarded – undo
8354 8354
             $url.'&action=delete_item'
8355 8355
         );
8356 8356
 
8357
-        if ($item_type == TOOL_HOTPOTATOES ) {
8357
+        if ($item_type == TOOL_HOTPOTATOES) {
8358 8358
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8359 8359
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8360 8360
         }
@@ -8380,13 +8380,13 @@  discard block
 block discarded – undo
8380 8380
     public function get_js_dropdown_array()
8381 8381
     {
8382 8382
         $course_id = api_get_course_int_id();
8383
-        $return = 'var child_name = new Array();' . "\n";
8384
-        $return .= 'var child_value = new Array();' . "\n\n";
8385
-        $return .= 'child_name[0] = new Array();' . "\n";
8386
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8383
+        $return = 'var child_name = new Array();'."\n";
8384
+        $return .= 'var child_value = new Array();'."\n\n";
8385
+        $return .= 'child_name[0] = new Array();'."\n";
8386
+        $return .= 'child_value[0] = new Array();'."\n\n";
8387 8387
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8388
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8389
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8388
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8389
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8390 8390
                     ORDER BY display_order ASC";
8391 8391
         $res_zero = Database::query($sql_zero);
8392 8392
         $i = 0;
@@ -8397,29 +8397,29 @@  discard block
 block discarded – undo
8397 8397
                     $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8398 8398
                 }
8399 8399
                 $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8400
-                $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8401
-                $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8400
+                $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8401
+                $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8402 8402
             }
8403 8403
         }
8404 8404
         $return .= "\n";
8405
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8406
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8405
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8406
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8407 8407
         $res = Database::query($sql);
8408 8408
         while ($row = Database :: fetch_array($res)) {
8409
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8409
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8410 8410
                            WHERE
8411 8411
                                 c_id = ".$course_id." AND
8412
-                                parent_item_id = " . $row['id'] . "
8412
+                                parent_item_id = " . $row['id']."
8413 8413
                            ORDER BY display_order ASC";
8414 8414
             $res_parent = Database::query($sql_parent);
8415 8415
             $i = 0;
8416
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8417
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8416
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8417
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8418 8418
 
8419 8419
             while ($row_parent = Database :: fetch_array($res_parent)) {
8420 8420
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8421
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8422
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8421
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8422
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8423 8423
             }
8424 8424
             $return .= "\n";
8425 8425
         }
@@ -8440,8 +8440,8 @@  discard block
 block discarded – undo
8440 8440
         if (is_numeric($item_id)) {
8441 8441
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8442 8442
 
8443
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8444
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8443
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8444
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8445 8445
 
8446 8446
             $res = Database::query($sql);
8447 8447
             $row = Database :: fetch_array($res);
@@ -8500,7 +8500,7 @@  discard block
 block discarded – undo
8500 8500
      */
8501 8501
     public function display_item_small_form($item_type, $title = '', $data = array())
8502 8502
     {
8503
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8503
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8504 8504
         $form = new FormValidator('small_form', 'post', $url);
8505 8505
         $form->addElement('header', $title);
8506 8506
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8526,7 +8526,7 @@  discard block
 block discarded – undo
8526 8526
         $item_id = intval($item_id);
8527 8527
         /* Current prerequisite */
8528 8528
         $sql = "SELECT * FROM $tbl_lp_item
8529
-                WHERE c_id = $course_id AND id = " . $item_id;
8529
+                WHERE c_id = $course_id AND id = ".$item_id;
8530 8530
         $result = Database::query($sql);
8531 8531
         $row    = Database::fetch_array($result);
8532 8532
         $prerequisiteId = $row['prerequisite'];
@@ -8536,20 +8536,20 @@  discard block
 block discarded – undo
8536 8536
         $return .= '<form method="POST">';
8537 8537
         $return .= '<table class="data_table">';
8538 8538
         $return .= '<tr>';
8539
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8540
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8541
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8539
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8540
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8541
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8542 8542
         $return .= '</tr>';
8543 8543
 
8544 8544
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8545 8545
         $return .= '<tr >';
8546 8546
         $return .= '<td colspan="3" class="radio">';
8547 8547
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8548
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8548
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8549 8549
         $return .= '</tr>';
8550 8550
 
8551 8551
         $sql = "SELECT * FROM $tbl_lp_item
8552
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8552
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8553 8553
         $result = Database::query($sql);
8554 8554
         $arrLP = array();
8555 8555
 
@@ -8592,25 +8592,25 @@  discard block
 block discarded – undo
8592 8592
             }
8593 8593
 
8594 8594
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8595
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8595
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8596 8596
 
8597 8597
             $return .= '<tr>';
8598
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8599
-            $return .= '<label for="id' . $item['id'] . '">';
8600
-            $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'] . '" />';
8598
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8599
+            $return .= '<label for="id'.$item['id'].'">';
8600
+            $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'].'" />';
8601 8601
             $icon_name = str_replace(' ', '', $item['item_type']);
8602 8602
 
8603
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8604
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8603
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8604
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8605 8605
             } else {
8606
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8607
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8606
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8607
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8608 8608
                 } else {
8609 8609
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8610 8610
                 }
8611 8611
             }
8612 8612
 
8613
-            $return .=  $item['title'] . '</label>';
8613
+            $return .= $item['title'].'</label>';
8614 8614
             $return .= '</td>';
8615 8615
 
8616 8616
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8624,19 +8624,19 @@  discard block
 block discarded – undo
8624 8624
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8625 8625
 
8626 8626
                 $return .= '<td class="exercise">';
8627
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8627
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8628 8628
                 $return .= '</td>';
8629 8629
                 $return .= '<td class="exercise">';
8630
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8630
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8631 8631
                 $return .= '</td>';
8632 8632
             }
8633 8633
 
8634 8634
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8635 8635
                 $return .= '<td class="exercise">';
8636
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8636
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8637 8637
                 $return .= '</td>';
8638 8638
                 $return .= '<td class="exercise"">';
8639
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8639
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8640 8640
                 $return .= '</td>';
8641 8641
             }
8642 8642
             $return .= '</tr>';
@@ -8645,7 +8645,7 @@  discard block
 block discarded – undo
8645 8645
         $return .= '</tr>';
8646 8646
         $return .= '</table>';
8647 8647
         $return .= '<div style="padding-top:3px;">';
8648
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8648
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8649 8649
         $return .= '</form>';
8650 8650
 
8651 8651
         return $return;
@@ -8681,7 +8681,7 @@  discard block
 block discarded – undo
8681 8681
                 if ($row['id'] == $lp_id) {
8682 8682
                     continue;
8683 8683
                 }
8684
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8684
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8685 8685
             }
8686 8686
         }
8687 8687
         $return .= '</select>';
@@ -8741,8 +8741,8 @@  discard block
 block discarded – undo
8741 8741
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8742 8742
                      ORDER BY title ASC";
8743 8743
 
8744
-        $sql_hot  = "SELECT * FROM $tbl_doc
8745
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8744
+        $sql_hot = "SELECT * FROM $tbl_doc
8745
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8746 8746
                      ORDER BY id ASC";
8747 8747
 
8748 8748
         $res_quiz = Database::query($sql_quiz);
@@ -8751,8 +8751,8 @@  discard block
 block discarded – undo
8751 8751
         $return = '<ul class="lp_resource">';
8752 8752
         $return .= '<li class="lp_resource_element">';
8753 8753
         $return .= Display::return_icon('new_test_small.gif');
8754
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8755
-            get_lang('NewExercise') . '</a>';
8754
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8755
+            get_lang('NewExercise').'</a>';
8756 8756
         $return .= '</li>';
8757 8757
 
8758 8758
         // Display hotpotatoes
@@ -8764,8 +8764,8 @@  discard block
 block discarded – undo
8764 8764
             $return .= '</a> ';
8765 8765
 
8766 8766
             $return .= Display::return_icon('hotpotatoes_s.png');
8767
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8768
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8767
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8768
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8769 8769
             $return .= '</li>';
8770 8770
         }
8771 8771
 
@@ -8775,7 +8775,7 @@  discard block
 block discarded – undo
8775 8775
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8776 8776
             $return .= '</a> ';
8777 8777
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8778
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8778
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8779 8779
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8780 8780
                 '</a>';
8781 8781
             $return .= '</li>';
@@ -8849,7 +8849,7 @@  discard block
 block discarded – undo
8849 8849
         foreach ($categorizedLinks as $categoryId => $links) {
8850 8850
             $linkNodes = null;
8851 8851
             foreach ($links as $key => $title) {
8852
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8852
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8853 8853
                     $linkNodes .=
8854 8854
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8855 8855
                         <a class="moved" href="#">'.
@@ -8887,7 +8887,7 @@  discard block
 block discarded – undo
8887 8887
         $return = '<div class="lp_resource" >';
8888 8888
         $return .= '<div class="lp_resource_element">';
8889 8889
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8890
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8890
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8891 8891
         $return .= '</div>';
8892 8892
         $return .= '</div>';
8893 8893
         return $return;
@@ -8910,7 +8910,7 @@  discard block
 block discarded – undo
8910 8910
         $return .= Display::return_icon('forum_new_small.gif');
8911 8911
         $return .= Display::url(
8912 8912
             get_lang('CreateANewForum'),
8913
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8913
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8914 8914
                 'action' => 'add',
8915 8915
                 'content' => 'forum',
8916 8916
                 'lp_id' => $this->lp_id
@@ -8938,15 +8938,15 @@  discard block
 block discarded – undo
8938 8938
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8939 8939
                 $return .= ' </a>';
8940 8940
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8941
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8942
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8941
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8942
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8943 8943
                             </a>
8944
-                            <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">' .
8945
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8944
+                            <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">'.
8945
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8946 8946
 
8947 8947
                 $return .= '</li>';
8948 8948
 
8949
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8949
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8950 8950
                 $a_threads = get_threads($forum['forum_id']);
8951 8951
                 if (is_array($a_threads)) {
8952 8952
                     foreach ($a_threads as $thread) {
@@ -8955,8 +8955,8 @@  discard block
 block discarded – undo
8955 8955
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8956 8956
                         $return .= ' </a>';
8957 8957
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8958
-                        $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 . '">' .
8959
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8958
+                        $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.'">'.
8959
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8960 8960
                         $return .= '</li>';
8961 8961
                     }
8962 8962
                 }
@@ -9027,7 +9027,7 @@  discard block
 block discarded – undo
9027 9027
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
9028 9028
             // Remove the possible . at the end of the path.
9029 9029
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
9030
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9030
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9031 9031
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
9032 9032
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
9033 9033
         }
@@ -9095,7 +9095,7 @@  discard block
 block discarded – undo
9095 9095
                 if ($item->type == 'sco') {
9096 9096
                     $inc_docs = $item->get_resources_from_source(
9097 9097
                         null,
9098
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9098
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9099 9099
                     );
9100 9100
                 } else {
9101 9101
                     $inc_docs = $item->get_resources_from_source();
@@ -9311,7 +9311,7 @@  discard block
 block discarded – undo
9311 9311
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9312 9312
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9313 9313
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9314
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9314
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9315 9315
                                         $my_dep->setAttribute('xml:base', '');
9316 9316
                                     }
9317 9317
                                 }
@@ -9442,7 +9442,7 @@  discard block
 block discarded – undo
9442 9442
                         //$my_item->appendChild($my_max_score);
9443 9443
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9444 9444
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9445
-                        $my_prereqs->setAttribute('type','aicc_script');
9445
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9446 9446
                         $my_item->appendChild($my_prereqs);
9447 9447
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9448 9448
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9495,7 +9495,7 @@  discard block
 block discarded – undo
9495 9495
                         $my_resource->appendChild($my_file);
9496 9496
 
9497 9497
                         // Get included docs.
9498
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9498
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9499 9499
                         // Dependency to other files - not yet supported.
9500 9500
                         $i = 1;
9501 9501
                         foreach ($inc_docs as $doc_info) {
@@ -9556,7 +9556,7 @@  discard block
 block discarded – undo
9556 9556
                                         $my_dep_file->setAttribute('href', $file_path);
9557 9557
                                         $my_dep->setAttribute('xml:base', '');
9558 9558
 
9559
-                                        if (strstr($file_path,$main_path) !== false) {
9559
+                                        if (strstr($file_path, $main_path) !== false) {
9560 9560
                                             // The calculated real path is really inside the chamilo root path.
9561 9561
                                             // Reduce file path to what's under the DocumentRoot.
9562 9562
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9574,7 +9574,7 @@  discard block
 block discarded – undo
9574 9574
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9575 9575
                                             $file_path = str_replace('//', '/', $file_path);
9576 9576
                                             if (file_exists($file_path)) {
9577
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9577
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9578 9578
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9579 9579
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9580 9580
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9803,7 +9803,7 @@  discard block
 block discarded – undo
9803 9803
             if (strpos($extra_file, '.') === 0)
9804 9804
                 continue;
9805 9805
             else {
9806
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9806
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9807 9807
                 $this->create_path($dest_file);
9808 9808
                 copy($main_code_path.$extra_file, $dest_file);
9809 9809
             }
@@ -9856,7 +9856,7 @@  discard block
 block discarded – undo
9856 9856
                             }
9857 9857
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9858 9858
                             if (file_exists($file_path)) {
9859
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9859
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9860 9860
                             }
9861 9861
                             break;
9862 9862
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9896,12 +9896,12 @@  discard block
 block discarded – undo
9896 9896
 
9897 9897
         foreach ($path_bits as $bit) {
9898 9898
             if (!empty ($bit)) {
9899
-                $new_path = $path_built . $bit;
9899
+                $new_path = $path_built.$bit;
9900 9900
                 if (is_dir($new_path)) {
9901
-                    $path_built = $new_path . '/';
9901
+                    $path_built = $new_path.'/';
9902 9902
                 } else {
9903 9903
                     mkdir($new_path, api_get_permissions_for_new_directories());
9904
-                    $path_built = $new_path . '/';
9904
+                    $path_built = $new_path.'/';
9905 9905
                 }
9906 9906
             }
9907 9907
         }
@@ -9945,9 +9945,9 @@  discard block
 block discarded – undo
9945 9945
 
9946 9946
         if ($upload_ok) {
9947 9947
             if ($has_attachment) {
9948
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9948
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9949 9949
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9950
-                $updir = $sys_course_path . $courseDir;
9950
+                $updir = $sys_course_path.$courseDir;
9951 9951
                 // Try to add an extension to the file if it hasn't one.
9952 9952
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9953 9953
 
@@ -10002,7 +10002,7 @@  discard block
 block discarded – undo
10002 10002
             //Setting my lp_id to autolaunch = 1
10003 10003
             $attributes['autolaunch'] = 1;
10004 10004
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
10005
-            Database::update($lp_table, $attributes, $where );
10005
+            Database::update($lp_table, $attributes, $where);
10006 10006
         }
10007 10007
     }
10008 10008
 
@@ -10021,13 +10021,13 @@  discard block
 block discarded – undo
10021 10021
 
10022 10022
         // Get the max order of the items
10023 10023
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
10024
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
10024
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
10025 10025
         $rs_max_order = Database::query($sql_max_order);
10026 10026
         $row_max_order = Database::fetch_object($rs_max_order);
10027 10027
         $max_order = $row_max_order->display_order;
10028 10028
         // Get the previous item ID
10029 10029
         $sql = "SELECT id as previous FROM $table_lp_item
10030
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
10030
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
10031 10031
         $rs_max = Database::query($sql);
10032 10032
         $row_max = Database::fetch_object($rs_max);
10033 10033
 
@@ -10083,9 +10083,9 @@  discard block
 block discarded – undo
10083 10083
         $documents_total_space = DocumentManager::documents_total_space();
10084 10084
         $course_max_space = DocumentManager::get_course_quota();
10085 10085
         $total_size = filesize($s) + $documents_total_space;
10086
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10086
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10087 10087
             return true;
10088
-        } else{
10088
+        } else {
10089 10089
             return false;
10090 10090
         }
10091 10091
     }
@@ -10425,7 +10425,7 @@  discard block
 block discarded – undo
10425 10425
         if ($this->debug > 0) {
10426 10426
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10427 10427
         }
10428
-        $this->subscribeUsers = intval($value);;
10428
+        $this->subscribeUsers = intval($value); ;
10429 10429
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10430 10430
         $lp_id = $this->get_id();
10431 10431
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10771,7 +10771,7 @@  discard block
 block discarded – undo
10771 10771
      */
10772 10772
     public function createForum($forumCategoryId)
10773 10773
     {
10774
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10774
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10775 10775
 
10776 10776
         $forumId = store_forum(
10777 10777
             [
@@ -10820,7 +10820,7 @@  discard block
 block discarded – undo
10820 10820
      */
10821 10821
     private function getFinalItemTemplate()
10822 10822
     {
10823
-        return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html');
10823
+        return file_get_contents(api_get_path(SYS_CODE_PATH).'newscorm/final_item_template/template.html');
10824 10824
     }
10825 10825
 
10826 10826
     /**
@@ -10867,11 +10867,11 @@  discard block
 block discarded – undo
10867 10867
             'Height' => '500',
10868 10868
             'FullPage' => true,
10869 10869
             'CreateDocumentDir' => $relative_prefix,
10870
-            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
10871
-            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
10870
+            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
10871
+            'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
10872 10872
         ];
10873 10873
 
10874
-        $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
10874
+        $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
10875 10875
             'type' => 'document',
10876 10876
             'lp_id' => $this->lp_id
10877 10877
         ]);
Please login to merge, or discard this patch.