Passed
Push — 1.10.x ( 1f0c91...36635d )
by Angel Fernando Quiroz
43:44
created
main/newscorm/lp_controller.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Including the global initialization file.
27 27
 require_once '../inc/global.inc.php';
28
-$current_course_tool  = TOOL_LEARNPATH;
28
+$current_course_tool = TOOL_LEARNPATH;
29 29
 $_course = api_get_course_info();
30 30
 
31 31
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
     ) {
38 38
         $htmlHeadXtra[] = '<script>
39 39
     <!--
40
-        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\';
40
+        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\';
41 41
     -->
42 42
     </script>';
43
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
43
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
45 45
     }
46 46
 }
47 47
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
 $course_id = api_get_course_int_id();
270 270
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
271
+if ($debug > 0) error_log('New LP - Passed data remains check', 0);
272 272
 
273 273
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274 274
     if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             if (Database::num_rows($res)) {
293 293
                 $row = Database::fetch_array($res);
294 294
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
295
+                if ($debug > 0) error_log('New LP - found row - type '.$type.' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296 296
                 switch ($type) {
297 297
                     case 1:
298 298
                         if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                 $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
690 690
                     $_GET['id'],
691 691
                     $_POST['prerequisites'],
692
-                    $_POST['min_' . $_POST['prerequisites']],
693
-                    $_POST['max_' . $_POST['prerequisites']]
692
+                    $_POST['min_'.$_POST['prerequisites']],
693
+                    $_POST['max_'.$_POST['prerequisites']]
694 694
                 );
695 695
 
696 696
                 if ($editPrerequisite) {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
940 940
 
941 941
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
942
-            	$publicated_on  = $_REQUEST['publicated_on'];
942
+            	$publicated_on = $_REQUEST['publicated_on'];
943 943
             } else {
944 944
             	$publicated_on = null;
945 945
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         else {
1011 1011
             $_SESSION['refresh'] = 1;
1012 1012
             if (!empty($_REQUEST['parent_item_id'])) {
1013
-                $_SESSION['from_learnpath']='yes';
1013
+                $_SESSION['from_learnpath'] = 'yes';
1014 1014
                 $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1015 1015
                 require 'resourcelinker.php';
1016 1016
             } else {
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
             error_log('New LP - No learnpath given for view', 0);
1112 1112
             require 'lp_list.php';
1113 1113
         } else {
1114
-            if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1115
-            if ( !empty($_REQUEST['item_id']) ) {
1114
+            if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); }
1115
+            if (!empty($_REQUEST['item_id'])) {
1116 1116
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1117 1117
             }
1118 1118
             require 'lp_view.php';
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 		break;
1193 1193
      */
1194 1194
 	case 'switch_attempt_mode':
1195
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1196
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
+		if ($debug > 0) error_log('New LP - switch_reinit action triggered', 0);
1196
+		if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1197 1197
 		$_SESSION['refresh'] = 1;
1198 1198
 		$_SESSION['oLP']->switch_attempt_mode();
1199 1199
         require 'lp_list.php';
@@ -1243,8 +1243,8 @@  discard block
 block discarded – undo
1243 1243
             error_log('New LP - No learnpath given for view', 0);
1244 1244
             require 'lp_list.php';
1245 1245
         } else {
1246
-            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1247
-            if (!empty($_REQUEST['item_id']) ) {
1246
+            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); }
1247
+            if (!empty($_REQUEST['item_id'])) {
1248 1248
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1249 1249
             }
1250 1250
             require 'lp_impress.php';
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                     $_SESSION['oLP']->lp_session_id
1308 1308
                 );
1309 1309
 
1310
-                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1310
+                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0;
1311 1311
 
1312 1312
                 if (empty($forumCategoryId)) {
1313 1313
                     $forumCategoryId = store_forumcategory(
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
             }
1340 1340
         }
1341 1341
 
1342
-        header('Location:' . api_get_self() . '?' . http_build_query([
1342
+        header('Location:'.api_get_self().'?'.http_build_query([
1343 1343
             'action' => 'add_item',
1344 1344
             'type' => 'step',
1345 1345
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
             }
1382 1382
         }
1383 1383
 
1384
-        header('Location:' . api_get_self() . '?' . http_build_query([
1384
+        header('Location:'.api_get_self().'?'.http_build_query([
1385 1385
             'action' => 'add_item',
1386 1386
             'type' => 'step',
1387 1387
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
         $_SESSION['oLP']->getFinalItemForm();
1406 1406
 
1407
-        $redirectTo = api_get_self() . '?' . http_build_query([
1407
+        $redirectTo = api_get_self().'?'.http_build_query([
1408 1408
             'action' => 'add_item',
1409 1409
             'type' => 'step',
1410 1410
             'lp_id' => intval($_SESSION['oLP']->lp_id)
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 1 patch
Spacing   +687 added lines, -687 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $res = Database::query($sql);
244 244
 
245 245
         if ($this->debug > 2) {
246
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
246
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
247 247
             error_log('-- Start while--', 0);
248 248
         }
249 249
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
                         $this->refs_list[$oItem->ref] = $my_item_id;
264 264
                         if ($this->debug > 2) {
265 265
                             error_log(
266
-                                'New LP - learnpath::__construct() - ' .
267
-                                'aicc object with id ' . $my_item_id .
266
+                                'New LP - learnpath::__construct() - '.
267
+                                'aicc object with id '.$my_item_id.
268 268
                                 ' set in items[]',
269 269
                                 0
270 270
                             );
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 
284 284
                         $this->refs_list[$oItem->ref] = $my_item_id;
285 285
                         if ($this->debug > 2) {
286
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
286
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
287 287
                         }
288 288
                     }
289 289
                     break;
290 290
                 case 1:
291 291
                 default:
292 292
                     if ($this->debug > 2) {
293
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
293
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
294 294
                     }
295 295
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
296 296
 
297 297
                     if ($this->debug > 2) {
298
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
298
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
299 299
                     }
300 300
                     if (is_object($oItem)) {
301 301
                         $my_item_id = $oItem->get_id();
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
                         $this->refs_list[$my_item_id] = $my_item_id;
307 307
                         if ($this->debug > 2) {
308 308
                             error_log(
309
-                                'New LP - learnpath::__construct() ' . __LINE__ .
310
-                                ' - object with id ' . $my_item_id . ' set in items[]',
309
+                                'New LP - learnpath::__construct() '.__LINE__.
310
+                                ' - object with id '.$my_item_id.' set in items[]',
311 311
                                 0);
312 312
                         }
313 313
                     }
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
326 326
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
327 327
                     $this->items[$row['id']]->current_start_time = 0;
328
-                    $this->items[$row['id']]->current_stop_time	= 0;
328
+                    $this->items[$row['id']]->current_stop_time = 0;
329 329
                 }
330 330
             }
331 331
         }
332 332
 
333 333
         if ($this->debug > 2) {
334
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
334
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
335 335
         }
336 336
 
337 337
         if (!empty($lp_item_id_list)) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         // TODO: Define the current item better.
424 424
         $this->first();
425 425
         if ($this->debug > 2) {
426
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
426
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
427 427
         }
428 428
         return true;
429 429
     }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     ) {
501 501
         $course_id = $this->course_info['real_id'];
502 502
         if ($this->debug > 0) {
503
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
503
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
504 504
         }
505 505
         if (empty($course_id)) {
506 506
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                 FROM $tbl_lp_item
523 523
                 WHERE
524 524
                     c_id = $course_id AND
525
-                    lp_id = " . $this->get_id() . " AND
525
+                    lp_id = ".$this->get_id()." AND
526 526
                     parent_item_id = " . $parent;
527 527
 
528 528
         $res_count = Database::query($sql);
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
         if ($num > 0) {
533 533
             if ($previous == 0) {
534 534
                 $sql = "SELECT id, next_item_id, display_order
535
-                        FROM " . $tbl_lp_item . "
535
+                        FROM " . $tbl_lp_item."
536 536
                         WHERE
537 537
                             c_id = $course_id AND
538
-                            lp_id = " . $this->get_id() . " AND
539
-                            parent_item_id = " . $parent . " AND
538
+                            lp_id = ".$this->get_id()." AND
539
+                            parent_item_id = " . $parent." AND
540 540
                             previous_item_id = 0 OR
541 541
                             previous_item_id=" . $parent;
542 542
                 $result = Database::query($sql);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 						FROM $tbl_lp_item
552 552
                         WHERE
553 553
                             c_id = $course_id AND
554
-                            lp_id = " . $this->get_id() . " AND
554
+                            lp_id = ".$this->get_id()." AND
555 555
                             id = " . $previous;
556 556
 
557 557
                 $result = Database::query($sql);
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
         $typeCleaned = Database::escape_string($type);
572 572
         if ($type == 'quiz') {
573 573
             $sql = 'SELECT SUM(ponderation)
574
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
575
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
574
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
575
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
576 576
                     ON
577 577
                         quiz_question.id = quiz_rel_question.question_id AND
578 578
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $new_item_id = Database::insert($tbl_lp_item, $params);
619 619
 
620 620
         if ($this->debug > 2) {
621
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
621
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
622 622
         }
623 623
 
624 624
         if ($new_item_id) {
@@ -635,28 +635,28 @@  discard block
 block discarded – undo
635 635
             Database::query($sql);
636 636
 
637 637
             // Update all the items after the new item.
638
-            $sql = "UPDATE " . $tbl_lp_item . "
638
+            $sql = "UPDATE ".$tbl_lp_item."
639 639
                         SET display_order = display_order + 1
640 640
                     WHERE
641 641
                         c_id = $course_id AND
642
-                        lp_id = " . $this->get_id() . " AND
643
-                        id <> " . $new_item_id . " AND
644
-                        parent_item_id = " . $parent . " AND
642
+                        lp_id = ".$this->get_id()." AND
643
+                        id <> " . $new_item_id." AND
644
+                        parent_item_id = " . $parent." AND
645 645
                         display_order > " . $display_order;
646 646
             Database::query($sql);
647 647
 
648 648
             // Update the item that should come after the new item.
649
-            $sql = "UPDATE " . $tbl_lp_item . "
650
-                    SET ref = " . $new_item_id . "
651
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
649
+            $sql = "UPDATE ".$tbl_lp_item."
650
+                    SET ref = " . $new_item_id."
651
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
652 652
             Database::query($sql);
653 653
 
654 654
             // Upload audio.
655 655
             if (!empty($_FILES['mp3']['name'])) {
656 656
                 // Create the audio folder if it does not exist yet.
657
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
658
-                if (!is_dir($filepath . 'audio')) {
659
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
657
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
658
+                if (!is_dir($filepath.'audio')) {
659
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
660 660
                     $audio_id = add_document(
661 661
                         $_course,
662 662
                         '/audio',
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                 $file_path = handle_uploaded_document(
700 700
                     $_course,
701 701
                     $_FILES['mp3'],
702
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
702
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
703 703
                     '/audio',
704 704
                     $userId,
705 705
                     '',
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 
716 716
                 // Store the mp3 file in the lp_item table.
717 717
                 $sql = "UPDATE $tbl_lp_item SET
718
-                            audio = '" . Database::escape_string($file) . "'
719
-                        WHERE id = '" . intval($new_item_id) . "'";
718
+                            audio = '".Database::escape_string($file)."'
719
+                        WHERE id = '" . intval($new_item_id)."'";
720 720
                 Database::query($sql);
721 721
             }
722 722
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         while (Database :: num_rows($res_name)) {
796 796
             // There is already one such name, update the current one a bit.
797 797
             $i++;
798
-            $name = $name . ' - ' . $i;
798
+            $name = $name.' - '.$i;
799 799
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
800 800
             $res_name = Database::query($check_name);
801 801
         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                 // if $item points to an object and there is a parent.
908 908
                 if ($debug) {
909 909
                     error_log(
910
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
910
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
911 911
                         0
912 912
                     );
913 913
                 }
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                         if ($childItemId != $item) {
936 936
                             if ($debug) {
937 937
                                 error_log(
938
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
938
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
939 939
                                     0
940 940
                                 );
941 941
                             }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                             } else {
956 956
                                 if ($debug > 2) {
957 957
                                     error_log(
958
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
958
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
959 959
                                         0
960 960
                                     );
961 961
                                 }
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
         // Delete lp item id.
1061 1061
         foreach ($this->items as $id => $dummy) {
1062 1062
             $sql = "DELETE FROM $lp_item_view
1063
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1063
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1064 1064
             Database::query($sql);
1065 1065
         }
1066 1066
 
1067 1067
         // Proposed by Christophe (nickname: clefevre)
1068
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1068
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1069 1069
         Database::query($sql);
1070 1070
 
1071
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1071
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1072 1072
         Database::query($sql);
1073 1073
 
1074 1074
         self::toggle_publish($this->lp_id, 'i');
@@ -1076,32 +1076,32 @@  discard block
 block discarded – undo
1076 1076
         if ($this->type == 2 || $this->type == 3) {
1077 1077
             // This is a scorm learning path, delete the files as well.
1078 1078
             $sql = "SELECT path FROM $lp
1079
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1079
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1080 1080
             $res = Database::query($sql);
1081 1081
             if (Database :: num_rows($res) > 0) {
1082 1082
                 $row = Database :: fetch_array($res);
1083 1083
                 $path = $row['path'];
1084 1084
                 $sql = "SELECT id FROM $lp
1085
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1085
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1086 1086
                 $res = Database::query($sql);
1087 1087
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1088 1088
                     if ($this->debug > 2) {
1089
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1089
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1090 1090
                     }
1091 1091
                 } else {
1092 1092
                     // No other LP uses that directory, delete it.
1093
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1094
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1095
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1093
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1094
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1095
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1096 1096
                         if ($this->debug > 2) {
1097
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1097
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1098 1098
                         }
1099 1099
                         // Proposed by Christophe (clefevre).
1100 1100
                         if (strcmp(substr($path, -2), "/.") == 0) {
1101 1101
                             $path = substr($path, 0, -1); // Remove "." at the end.
1102 1102
                         }
1103 1103
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1104
-                        rmdirr($course_scorm_dir . $path);
1104
+                        rmdirr($course_scorm_dir.$path);
1105 1105
                     }
1106 1106
                 }
1107 1107
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1115 1115
         Database::query($sql);
1116 1116
 
1117
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1117
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1118 1118
         Database::query($sql);
1119 1119
         // Updates the display order of all lps.
1120 1120
         $this->update_display_order();
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
             api_get_user_id()
1128 1128
         );
1129 1129
 
1130
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1130
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1131 1131
         if ($link_info !== false) {
1132 1132
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1133 1133
         }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
     {
1148 1148
         $course_id = $this->course_info['real_id'];
1149 1149
         if ($this->debug > 0) {
1150
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1150
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1151 1151
         }
1152 1152
         $num = 0;
1153 1153
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         $res = Database::query($sql);
1159 1159
         while ($row = Database :: fetch_array($res)) {
1160 1160
             $num += $this->delete_children_items($row['id']);
1161
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1161
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1162 1162
             Database::query($sql_del);
1163 1163
             $num++;
1164 1164
         }
@@ -1199,12 +1199,12 @@  discard block
 block discarded – undo
1199 1199
         // Delete children items.
1200 1200
         $num = $this->delete_children_items($id);
1201 1201
         if ($this->debug > 2) {
1202
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1202
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1203 1203
         }
1204 1204
         // Now delete the item.
1205 1205
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1206 1206
         if ($this->debug > 2) {
1207
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1207
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1208 1208
         }
1209 1209
         Database::query($sql_del);
1210 1210
         // Now update surrounding items.
@@ -1279,15 +1279,15 @@  discard block
 block discarded – undo
1279 1279
         }
1280 1280
 
1281 1281
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1282
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1282
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1283 1283
         $res_select = Database::query($sql_select);
1284 1284
         $row_select = Database :: fetch_array($res_select);
1285 1285
         $audio_update_sql = '';
1286 1286
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1287 1287
             // Create the audio folder if it does not exist yet.
1288
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1289
-            if (!is_dir($filepath . 'audio')) {
1290
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1288
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1289
+            if (!is_dir($filepath.'audio')) {
1290
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1291 1291
                 $audio_id = add_document(
1292 1292
                     $_course,
1293 1293
                     '/audio',
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
             $pi = pathinfo($audio['name']);
1326 1326
             if ($pi['extension'] == 'mp3') {
1327 1327
                 $c_det = api_get_course_info($this->cc);
1328
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1328
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1329 1329
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1330 1330
                 $path = substr($path, 7);
1331 1331
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1332
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1332
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1333 1333
             }
1334 1334
         }
1335 1335
 
@@ -1339,13 +1339,13 @@  discard block
 block discarded – undo
1339 1339
         // TODO: htmlspecialchars to be checked for encoding related problems.
1340 1340
         if ($same_parent && $same_previous) {
1341 1341
             // Only update title and description.
1342
-            $sql = "UPDATE " . $tbl_lp_item . "
1343
-                    SET title = '" . Database::escape_string($title) . "',
1344
-                        prerequisite = '" . $prerequisites . "',
1345
-                        description = '" . Database::escape_string($description) . "'
1346
-                        " . $audio_update_sql . ",
1347
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1348
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1342
+            $sql = "UPDATE ".$tbl_lp_item."
1343
+                    SET title = '" . Database::escape_string($title)."',
1344
+                        prerequisite = '" . $prerequisites."',
1345
+                        description = '" . Database::escape_string($description)."'
1346
+                        " . $audio_update_sql.",
1347
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1348
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1349 1349
             Database::query($sql);
1350 1350
         } else {
1351 1351
             $old_parent = $row_select['parent_item_id'];
@@ -1360,27 +1360,27 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
             if ($old_previous != 0) {
1362 1362
                 // Next
1363
-                $sql = "UPDATE " . $tbl_lp_item . "
1364
-                        SET next_item_id = " . $old_next . "
1365
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1363
+                $sql = "UPDATE ".$tbl_lp_item."
1364
+                        SET next_item_id = " . $old_next."
1365
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1366 1366
                 Database::query($sql);
1367 1367
             }
1368 1368
 
1369 1369
             if ($old_next != 0) {
1370 1370
                 // Previous
1371
-                $sql = "UPDATE " . $tbl_lp_item . "
1372
-                        SET previous_item_id = " . $old_previous . "
1373
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1371
+                $sql = "UPDATE ".$tbl_lp_item."
1372
+                        SET previous_item_id = " . $old_previous."
1373
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1374 1374
                 Database::query($sql);
1375 1375
             }
1376 1376
 
1377 1377
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1378
-            $sql = "UPDATE " . $tbl_lp_item . "
1378
+            $sql = "UPDATE ".$tbl_lp_item."
1379 1379
                     SET display_order = display_order - 1
1380 1380
                     WHERE
1381 1381
                         c_id = ".$course_id." AND
1382
-                        display_order > " . $old_order . " AND
1383
-                        lp_id = " . $this->lp_id . " AND
1382
+                        display_order > " . $old_order." AND
1383
+                        lp_id = " . $this->lp_id." AND
1384 1384
                         parent_item_id = " . $old_parent;
1385 1385
             Database::query($sql);
1386 1386
             /* END -- virtually remove the current item id */
@@ -1390,11 +1390,11 @@  discard block
 block discarded – undo
1390 1390
             if ($previous == 0) {
1391 1391
                 // Select the data of the item that should come after the current item.
1392 1392
                 $sql = "SELECT id, display_order
1393
-                        FROM " . $tbl_lp_item . "
1393
+                        FROM " . $tbl_lp_item."
1394 1394
                         WHERE
1395 1395
                             c_id = ".$course_id." AND
1396
-                            lp_id = " . $this->lp_id . " AND
1397
-                            parent_item_id = " . $parent . " AND
1396
+                            lp_id = " . $this->lp_id." AND
1397
+                            parent_item_id = " . $parent." AND
1398 1398
                             previous_item_id = " . $previous;
1399 1399
                 $res_select_old = Database::query($sql);
1400 1400
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
             } else {
1411 1411
                 // Select the data of the item that should come before the current item.
1412 1412
                 $sql = "SELECT next_item_id, display_order
1413
-                        FROM " . $tbl_lp_item . "
1414
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1413
+                        FROM " . $tbl_lp_item."
1414
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1415 1415
                 $res_select_old = Database::query($sql);
1416 1416
                 $row_select_old = Database :: fetch_array($res_select_old);
1417 1417
                 $new_next = $row_select_old['next_item_id'];
@@ -1420,57 +1420,57 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
             // TODO: htmlspecialchars to be checked for encoding related problems.
1422 1422
             // Update the current item with the new data.
1423
-            $sql = "UPDATE " . $tbl_lp_item . "
1423
+            $sql = "UPDATE ".$tbl_lp_item."
1424 1424
                     SET
1425
-                        title = '" . Database::escape_string($title) . "',
1426
-                        description = '" . Database::escape_string($description) . "',
1427
-                        parent_item_id = " . $parent . ",
1428
-                        previous_item_id = " . $previous . ",
1429
-                        next_item_id = " . $new_next . ",
1430
-                        display_order = " . $new_order . "
1431
-                        " . $audio_update_sql . "
1432
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1425
+                        title = '" . Database::escape_string($title)."',
1426
+                        description = '" . Database::escape_string($description)."',
1427
+                        parent_item_id = " . $parent.",
1428
+                        previous_item_id = " . $previous.",
1429
+                        next_item_id = " . $new_next.",
1430
+                        display_order = " . $new_order."
1431
+                        " . $audio_update_sql."
1432
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1433 1433
             Database::query($sql);
1434 1434
 
1435 1435
             if ($previous != 0) {
1436 1436
                 // Update the previous item's next_item_id.
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET next_item_id = " . $id . "
1439
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET next_item_id = " . $id."
1439
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($new_next != 0) {
1444 1444
                 // Update the next item's previous_item_id.
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET previous_item_id = " . $id . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET previous_item_id = " . $id."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             if ($old_prerequisite != $prerequisites) {
1452
-                $sql = "UPDATE " . $tbl_lp_item . "
1453
-                        SET prerequisite = '" . $prerequisites . "'
1454
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1452
+                $sql = "UPDATE ".$tbl_lp_item."
1453
+                        SET prerequisite = '" . $prerequisites."'
1454
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1455 1455
                 Database::query($sql);
1456 1456
             }
1457 1457
 
1458 1458
             if ($old_max_time_allowed != $max_time_allowed) {
1459 1459
                 // update max time allowed
1460
-                $sql = "UPDATE " . $tbl_lp_item . "
1461
-                        SET max_time_allowed = " . $max_time_allowed . "
1462
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1460
+                $sql = "UPDATE ".$tbl_lp_item."
1461
+                        SET max_time_allowed = " . $max_time_allowed."
1462
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1463 1463
                 Database::query($sql);
1464 1464
             }
1465 1465
 
1466 1466
             // Update all the items with the same or a bigger display_order than the current item.
1467
-            $sql = "UPDATE " . $tbl_lp_item . "
1467
+            $sql = "UPDATE ".$tbl_lp_item."
1468 1468
                     SET display_order = display_order + 1
1469 1469
                     WHERE
1470 1470
                        c_id = ".$course_id." AND
1471
-                       lp_id = " . $this->get_id() . " AND
1472
-                       id <> " . $id . " AND
1473
-                       parent_item_id = " . $parent . " AND
1471
+                       lp_id = " . $this->get_id()." AND
1472
+                       id <> " . $id." AND
1473
+                       parent_item_id = " . $parent." AND
1474 1474
                        display_order >= " . $new_order;
1475 1475
 
1476 1476
             Database::query($sql);
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
     {
1497 1497
         $course_id = api_get_course_int_id();
1498 1498
         if ($this->debug > 0) {
1499
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1499
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1500 1500
         }
1501 1501
 
1502 1502
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1594,8 +1594,8 @@  discard block
 block discarded – undo
1594 1594
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1595 1595
         }
1596 1596
 
1597
-        if (empty($id)|| $id != strval(intval($id))) {
1598
-            return array ();
1597
+        if (empty($id) || $id != strval(intval($id))) {
1598
+            return array();
1599 1599
         }
1600 1600
 
1601 1601
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1613,13 +1613,13 @@  discard block
 block discarded – undo
1613 1613
                             item_type='dokeos_chapter'
1614 1614
                         ORDER BY display_order";
1615 1615
             $res_bros = Database::query($sql_bros);
1616
-            $list = array ();
1616
+            $list = array();
1617 1617
             while ($row_bro = Database :: fetch_array($res_bros)) {
1618 1618
                 $list[] = $row_bro;
1619 1619
             }
1620 1620
             return $list;
1621 1621
         }
1622
-        return array ();
1622
+        return array();
1623 1623
     }
1624 1624
 
1625 1625
     /**
@@ -1632,11 +1632,11 @@  discard block
 block discarded – undo
1632 1632
     {
1633 1633
         $course_id = api_get_course_int_id();
1634 1634
         if ($this->debug > 0) {
1635
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1635
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1636 1636
         }
1637 1637
 
1638 1638
         if (empty ($id) || $id != strval(intval($id))) {
1639
-            return array ();
1639
+            return array();
1640 1640
         }
1641 1641
 
1642 1642
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1649 1649
                          ORDER BY display_order";
1650 1650
             $res_bros = Database::query($sql_bros);
1651
-            $list = array ();
1651
+            $list = array();
1652 1652
             while ($row_bro = Database :: fetch_array($res_bros)) {
1653 1653
                 $list[] = $row_bro;
1654 1654
             }
1655 1655
             return $list;
1656 1656
         }
1657
-        return array ();
1657
+        return array();
1658 1658
     }
1659 1659
 
1660 1660
     /**
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             $current = $this->current;
1725 1725
         }
1726 1726
         if ($this->debug > 2) {
1727
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1727
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1728 1728
         }
1729 1729
         return $current;
1730 1730
     }
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
         ) {
1806 1806
 
1807 1807
             if ($this->debug > 2) {
1808
-                error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1808
+                error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1809 1809
             }
1810 1810
             $index = -1;
1811 1811
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
             if ($index == -1) {
1818 1818
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1819 1819
                 if ($this->debug > 2) {
1820
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1820
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1821 1821
                 }
1822 1822
                 return false;
1823 1823
             } else {
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
             $index = 0;
1833 1833
             // Loop through all ordered items and stop at the first item that is
1834 1834
             // not a directory *and* that has not been completed yet.
1835
-            while ( !empty($this->ordered_items[$index]) AND
1835
+            while (!empty($this->ordered_items[$index]) AND
1836 1836
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1837 1837
                 (
1838 1838
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1846,14 +1846,14 @@  discard block
 block discarded – undo
1846 1846
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1847 1847
             $this->index    = $index;
1848 1848
             if ($this->debug > 2) {
1849
-                error_log('$index ' . $index);
1849
+                error_log('$index '.$index);
1850 1850
             }
1851 1851
             if ($this->debug > 2) {
1852
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1852
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1853 1853
             }
1854 1854
         }
1855 1855
         if ($this->debug > 2) {
1856
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1856
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1857 1857
         }
1858 1858
     }
1859 1859
 
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
     public function get_js_info($item_id = '')
1867 1867
     {
1868 1868
         if ($this->debug > 0) {
1869
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1869
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1870 1870
         }
1871 1871
 
1872 1872
         $info = '';
@@ -1876,17 +1876,17 @@  discard block
 block discarded – undo
1876 1876
             //if item is defined, return values from DB
1877 1877
             $oItem = $this->items[$item_id];
1878 1878
             $info .= '<script language="javascript">';
1879
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1880
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1881
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1882
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1883
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1884
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1885
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1879
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1880
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1881
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1882
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1883
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1884
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1885
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1886 1886
             $info .= "top.set_flag_synchronized();";
1887 1887
             $info .= '</script>';
1888 1888
             if ($this->debug > 2) {
1889
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1889
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1890 1890
             }
1891 1891
             return $info;
1892 1892
 
@@ -1894,17 +1894,17 @@  discard block
 block discarded – undo
1894 1894
 
1895 1895
             // If item_id is empty, just update to default SCORM data.
1896 1896
             $info .= '<script language="javascript">';
1897
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1898
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1899
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1900
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1901
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1902
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1903
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1897
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1898
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1899
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1900
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1901
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1902
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1903
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1904 1904
             $info .= "top.set_flag_synchronized();";
1905 1905
             $info .= '</script>';
1906 1906
             if ($this->debug > 2) {
1907
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1907
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1908 1908
             }
1909 1909
             return $info;
1910 1910
         }
@@ -1958,12 +1958,12 @@  discard block
 block discarded – undo
1958 1958
      * Gets the navigation bar for the learnpath display screen
1959 1959
      * @return	string	The HTML string to use as a navigation bar
1960 1960
      */
1961
-    public function get_navigation_bar($idBar = null, $display=null) {
1961
+    public function get_navigation_bar($idBar = null, $display = null) {
1962 1962
         if ($this->debug > 0) {
1963 1963
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1964 1964
         }
1965
-        if(empty($idBar)){
1966
-            $idBar='control-top';
1965
+        if (empty($idBar)) {
1966
+            $idBar = 'control-top';
1967 1967
         }
1968 1968
         /* if(empty($display)){
1969 1969
             $display='display:block';
@@ -1976,16 +1976,16 @@  discard block
 block discarded – undo
1976 1976
             $navbar = '
1977 1977
                   <span id="'.$idBar.'" class="buttons">
1978 1978
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1979
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1979
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1980 1980
                     </a>
1981
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1982
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1981
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1982
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1983 1983
                     </a>
1984
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1985
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1984
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1985
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1986 1986
                     </a>
1987 1987
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1988
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1988
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1989 1989
                     </a>
1990 1990
                   </span>';
1991 1991
 
@@ -1993,13 +1993,13 @@  discard block
 block discarded – undo
1993 1993
             $navbar = '
1994 1994
                 <span id="'.$idBar.'" class="buttons text-right">
1995 1995
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1996
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1996
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1997 1997
                     </a>
1998
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1999
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1998
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1999
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
2000 2000
                     </a>
2001
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2002
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
2001
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2002
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2003 2003
                     </a>
2004 2004
                 </span>';
2005 2005
         }
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
         $index = $this->index;
2021 2021
         $index++;
2022 2022
         if ($this->debug > 2) {
2023
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2023
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2024 2024
         }
2025 2025
         while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items) {
2026 2026
             $index++;
2027
-            if ($index == $this->max_ordered_items){
2027
+            if ($index == $this->max_ordered_items) {
2028 2028
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2029 2029
                     return $this->index;
2030 2030
                 } else {
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
             return $this->index;
2037 2037
         }
2038 2038
         if ($this->debug > 2) {
2039
-            error_log('New LP - index is now ' . $index, 0);
2039
+            error_log('New LP - index is now '.$index, 0);
2040 2040
         }
2041 2041
         return $index;
2042 2042
     }
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
         if (!empty ($new_index)) {
2055 2055
             if (isset ($this->ordered_items[$new_index])) {
2056 2056
                 if ($this->debug > 2) {
2057
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2057
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2058 2058
                 }
2059 2059
                 return $this->ordered_items[$new_index];
2060 2060
             }
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
         }
2097 2097
 
2098 2098
         // Filename without its extension.
2099
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2099
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2100 2100
 
2101 2101
         $zipFile = new PclZip($file_path);
2102 2102
         // Check the zip content (real size and file extension).
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
                     break; // Exit the foreach loop.
2121 2121
                 } elseif (
2122 2122
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2123
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2123
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2124 2124
                 ) {
2125 2125
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2126 2126
                     switch ($ext) {
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
             error_log('New LP - In learnpath::get_previous_index()', 0);
2163 2163
         }
2164 2164
         $index = $this->index;
2165
-        if (isset ($this->ordered_items[$index -1])) {
2165
+        if (isset ($this->ordered_items[$index - 1])) {
2166 2166
             $index--;
2167 2167
             while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
2168 2168
                 $index--;
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
             }
2173 2173
         } else {
2174 2174
             if ($this->debug > 2) {
2175
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2175
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2176 2176
             }
2177 2177
             // There is no previous item.
2178 2178
         }
@@ -2215,8 +2215,8 @@  discard block
 block discarded – undo
2215 2215
     {
2216 2216
         $course_id = api_get_course_int_id();
2217 2217
         $_course = api_get_course_info();
2218
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2219
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2218
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2219
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2220 2220
 
2221 2221
         // Getting all the information about the item.
2222 2222
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                     lp.c_id = $course_id AND
2228 2228
                     lp_view.c_id = $course_id";
2229 2229
         $result = Database::query($sql);
2230
-        $row 	= Database::fetch_assoc($result);
2230
+        $row = Database::fetch_assoc($result);
2231 2231
         $output = '';
2232 2232
 
2233 2233
         if (!empty ($row['audio'])) {
@@ -2235,8 +2235,8 @@  discard block
 block discarded – undo
2235 2235
             $list = $_SESSION['oLP']->get_toc();
2236 2236
             $type_quiz = false;
2237 2237
 
2238
-            foreach($list as $toc) {
2239
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2238
+            foreach ($list as $toc) {
2239
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2240 2240
                     $type_quiz = true;
2241 2241
                 }
2242 2242
             }
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
         $courseCode = null,
2300 2300
         $sessionId = null
2301 2301
     ) {
2302
-        $lp_id = (int)$lp_id;
2302
+        $lp_id = (int) $lp_id;
2303 2303
         $courseInfo = api_get_course_info($courseCode);
2304 2304
         $sessionId = intval($sessionId);
2305 2305
 
@@ -2465,10 +2465,10 @@  discard block
 block discarded – undo
2465 2465
      */
2466 2466
     public static function get_progress_bar($percentage = -1, $text_add = '')
2467 2467
     {
2468
-        $text = $percentage . $text_add;
2468
+        $text = $percentage.$text_add;
2469 2469
         $output = '<div class="progress">
2470
-                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
-                        '. $text .'
2470
+                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
+                        '. $text.'
2472 2472
                         </div>
2473 2473
                     </div>';
2474 2474
 
@@ -2504,16 +2504,16 @@  discard block
 block discarded – undo
2504 2504
         }
2505 2505
         $total_items = $this->get_total_items_count_without_chapters();
2506 2506
         if ($this->debug > 2) {
2507
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2507
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2508 2508
         }
2509 2509
         $completeItems = $this->get_complete_items_count();
2510 2510
         if ($this->debug > 2) {
2511
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2511
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2512 2512
         }
2513 2513
         if ($add != 0) {
2514 2514
             $completeItems += $add;
2515 2515
             if ($this->debug > 2) {
2516
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2516
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2517 2517
             }
2518 2518
         }
2519 2519
         $text = '';
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
             $text = '%';
2532 2532
         } elseif ($mode == 'abs') {
2533 2533
             $percentage = $completeItems;
2534
-            $text = '/' . $total_items;
2534
+            $text = '/'.$total_items;
2535 2535
         }
2536 2536
 
2537 2537
         return array(
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                 // and replace them, one by one, by the internal IDs (chamilo db)
2728 2728
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2729 2729
                 // by a space as well.
2730
-                $find = array (
2730
+                $find = array(
2731 2731
                     '&',
2732 2732
                     '|',
2733 2733
                     '~',
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
                     '(',
2740 2740
                     ')'
2741 2741
                 );
2742
-                $replace = array (
2742
+                $replace = array(
2743 2743
                     ' ',
2744 2744
                     ' ',
2745 2745
                     ' ',
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                 foreach ($ids as $id) {
2757 2757
                     $id = trim($id);
2758 2758
                     if (isset ($this->refs_list[$id])) {
2759
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2759
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2760 2760
                     }
2761 2761
                 }
2762 2762
 
@@ -2864,9 +2864,9 @@  discard block
 block discarded – undo
2864 2864
         if ($this->debug > 0) {
2865 2865
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2866 2866
         }
2867
-        $list = array ();
2867
+        $list = array();
2868 2868
         foreach ($this->ordered_items as $item_id) {
2869
-            $list[] = array (
2869
+            $list[] = array(
2870 2870
                 $item_id => $this->items[$item_id]->get_status()
2871 2871
             );
2872 2872
         }
@@ -2920,7 +2920,7 @@  discard block
 block discarded – undo
2920 2920
         $res = Database::query($sql);
2921 2921
         $num = Database :: num_rows($res);
2922 2922
         if ($num > 0) {
2923
-            $list[] = array (
2923
+            $list[] = array(
2924 2924
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2925 2925
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2926 2926
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2932 2932
             );
2933 2933
             while ($row = Database :: fetch_array($res)) {
2934
-                $list[] = array (
2934
+                $list[] = array(
2935 2935
                     'order_id' => ($row['order_id'] + 1),
2936 2936
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2937 2937
                     'type' => $row['interaction_type'],
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3000 3000
             );
3001 3001
             while ($row = Database :: fetch_array($res)) {
3002
-                $list[] = array (
3002
+                $list[] = array(
3003 3003
                     'order_id' => ($row['order_id'] + 1),
3004 3004
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3005 3005
                     'score_raw' => $row['score_raw'],
@@ -3026,10 +3026,10 @@  discard block
 block discarded – undo
3026 3026
         $toc = array();
3027 3027
         foreach ($this->ordered_items as $item_id) {
3028 3028
             if ($this->debug > 2) {
3029
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3029
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3030 3030
             }
3031 3031
             // TODO: Change this link generation and use new function instead.
3032
-            $toc[] = array (
3032
+            $toc[] = array(
3033 3033
                 'id'            => $item_id,
3034 3034
                 'title'         => $this->items[$item_id]->get_title(),
3035 3035
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
             );
3041 3041
         }
3042 3042
         if ($this->debug > 2) {
3043
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3043
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3044 3044
         }
3045 3045
         return $toc;
3046 3046
     }
@@ -3057,10 +3057,10 @@  discard block
 block discarded – undo
3057 3057
         }
3058 3058
         $toc = $varname.' = new Array();';
3059 3059
         foreach ($this->ordered_items as $item_id) {
3060
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3060
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3061 3061
         }
3062 3062
         if ($this->debug > 2) {
3063
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3063
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3064 3064
         }
3065 3065
         return $toc;
3066 3066
     }
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
             }
3085 3085
         }
3086 3086
         if ($this->debug > 2) {
3087
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3087
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3088 3088
         }
3089 3089
         return $res;
3090 3090
     }
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3101 3101
         $lp_id = intval($lp_id);
3102 3102
         $sql = "SELECT lp_type FROM $tbl_lp
3103
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3103
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3104 3104
         $res = Database::query($sql);
3105 3105
         if ($res === false) {
3106 3106
             return null;
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
             $dirTypes = self::getChapterTypes();
3214 3214
 
3215 3215
             if (in_array($item['type'], $dirTypes)) {
3216
-                $scorm_color_background ='scorm_item_section ';
3216
+                $scorm_color_background = 'scorm_item_section ';
3217 3217
                 $style_item = '';
3218 3218
             }
3219 3219
             if ($item['id'] == $this->current) {
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3223 3223
             }
3224 3224
 
3225
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3225
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3226 3226
 
3227 3227
             // Learning path title
3228 3228
             $title = $item['title'];
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
                 $html .= stripslashes($title);
3253 3253
             } else {
3254 3254
                 $this->get_link('http', $item['id'], $toc_list);
3255
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3255
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3256 3256
             }
3257 3257
             $html .= "</div>";
3258 3258
 
@@ -3286,12 +3286,12 @@  discard block
 block discarded – undo
3286 3286
             if ($this->get_lp_session_id() == api_get_session_id()) {
3287 3287
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3288 3288
                 $html .= '<div class="btn-group">';
3289
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3290
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3291
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3292
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3293
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' .
3294
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3289
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3290
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3291
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3292
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3293
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'.
3294
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3295 3295
                 $html .= '</div>';
3296 3296
                 $html .= '</div>';
3297 3297
             }
@@ -3342,11 +3342,11 @@  discard block
 block discarded – undo
3342 3342
         $course_id = $this->get_course_int_id();
3343 3343
 
3344 3344
         if ($this->debug > 0) {
3345
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3345
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3346 3346
         }
3347 3347
         if (empty($item_id)) {
3348 3348
             if ($this->debug > 2) {
3349
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3349
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3350 3350
             }
3351 3351
             $item_id = $this->get_current_item_id();
3352 3352
         }
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3379 3379
         		WHERE li.id = $item_id ";
3380 3380
         if ($this->debug > 2) {
3381
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3381
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3382 3382
         }
3383 3383
         $res = Database::query($sql);
3384 3384
         if (Database :: num_rows($res) > 0) {
@@ -3392,9 +3392,9 @@  discard block
 block discarded – undo
3392 3392
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3393 3393
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3394 3394
             }
3395
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3395
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3396 3396
             if ($type == 'http') {
3397
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3397
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3398 3398
             } else {
3399 3399
                 $course_path = $sys_course_path; //system path
3400 3400
             }
@@ -3405,8 +3405,8 @@  discard block
 block discarded – undo
3405 3405
             }
3406 3406
 
3407 3407
             if ($this->debug > 2) {
3408
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3409
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3408
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3409
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3410 3410
             }
3411 3411
 
3412 3412
             // Now go through the specific cases to get the end of the path
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
                         );
3426 3426
 
3427 3427
                         if ($this->debug > 0) {
3428
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3428
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3429 3429
                         }
3430 3430
 
3431 3431
                         if ($lp_item_type == 'link') {
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
                                     $linkProtocol = substr($file, 0, 5);
3446 3446
                                     if ($linkProtocol === 'http:') {
3447 3447
                                         //this is the special intervention case
3448
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3448
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3449 3449
                                     }
3450 3450
                                 }
3451 3451
                             }
@@ -3485,8 +3485,8 @@  discard block
 block discarded – undo
3485 3485
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3486 3486
                                         WHERE
3487 3487
                                             c_id = $course_id AND
3488
-                                            lp_item_id='" . $lp_item_id . "' AND
3489
-                                            lp_view_id ='" . $lp_view_id . "' AND
3488
+                                            lp_item_id='".$lp_item_id."' AND
3489
+                                            lp_view_id ='" . $lp_view_id."' AND
3490 3490
                                             status='completed'";
3491 3491
                                 $result = Database::query($sql);
3492 3492
                                 $row_count = Database :: fetch_row($result);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3496 3496
                                     $not_multiple_attempt = 1;
3497 3497
                                 }
3498
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3498
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3499 3499
                             }
3500 3500
 
3501 3501
                             $tmp_array = explode('/', $file);
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
                     break;
3509 3509
                 case 2 :
3510 3510
                     if ($this->debug > 2) {
3511
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3511
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3512 3512
                     }
3513 3513
 
3514 3514
                     if ($lp_item_type != 'dir') {
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
                         //if ($this->prerequisites_match($item_id)) {
3523 3523
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3524 3524
                             if ($this->debug > 2) {
3525
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3525
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3526 3526
                             }
3527 3527
                             // Distant url, return as is.
3528 3528
                             $file = $lp_item_path;
3529 3529
                         } else {
3530 3530
                             if ($this->debug > 2) {
3531
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3531
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3532 3532
                             }
3533 3533
                             // Prevent getting untranslatable urls.
3534 3534
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3535 3535
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3536 3536
                             // Prepare the path.
3537
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3537
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3538 3538
                             // TODO: Fix this for urls with protocol header.
3539 3539
                             $file = str_replace('//', '/', $file);
3540 3540
                             $file = str_replace(':/', '://', $file);
@@ -3542,11 +3542,11 @@  discard block
 block discarded – undo
3542 3542
                                 $lp_path = substr($lp_path, 0, -1);
3543 3543
                             }
3544 3544
 
3545
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3545
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3546 3546
                                 // if file not found.
3547 3547
                                 $decoded = html_entity_decode($lp_item_path);
3548 3548
                                 list ($decoded) = explode('?', $decoded);
3549
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3549
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3550 3550
                                     require_once 'resourcelinker.inc.php';
3551 3551
                                     $file = rl_get_resource_link_for_learnpath(
3552 3552
                                         $course_id,
@@ -3566,14 +3566,14 @@  discard block
 block discarded – undo
3566 3566
                                         }
3567 3567
                                     }
3568 3568
                                 } else {
3569
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3569
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3570 3570
                                 }
3571 3571
                             }
3572 3572
                         }
3573 3573
 
3574 3574
                         // We want to use parameters if they were defined in the imsmanifest
3575 3575
                         if (strpos($file, 'blank.php') === false) {
3576
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3576
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3577 3577
                         }
3578 3578
                     } else {
3579 3579
                         $file = 'lp_content.php?type=dir';
@@ -3581,12 +3581,12 @@  discard block
 block discarded – undo
3581 3581
                     break;
3582 3582
                 case 3 :
3583 3583
                     if ($this->debug > 2) {
3584
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3584
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3585 3585
                     }
3586 3586
                     // Formatting AICC HACP append URL.
3587
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3587
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3588 3588
                     if (!empty($lp_item_params)) {
3589
-                        $aicc_append .= $lp_item_params . '&';
3589
+                        $aicc_append .= $lp_item_params.'&';
3590 3590
                     }
3591 3591
                     if ($lp_item_type != 'dir') {
3592 3592
                         // Quite complex here:
@@ -3598,7 +3598,7 @@  discard block
 block discarded – undo
3598 3598
 
3599 3599
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3600 3600
                             if ($this->debug > 2) {
3601
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3601
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3602 3602
                             }
3603 3603
                             // Distant url, return as is.
3604 3604
                             $file = $lp_item_path;
@@ -3611,19 +3611,19 @@  discard block
 block discarded – undo
3611 3611
                             if (stripos($file, '<servername>') !== false) {
3612 3612
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3613 3613
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3614
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3614
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3615 3615
                             }
3616 3616
                             //
3617 3617
                             $file .= $aicc_append;
3618 3618
                         } else {
3619 3619
                             if ($this->debug > 2) {
3620
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3620
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3621 3621
                             }
3622 3622
                             // Prevent getting untranslatable urls.
3623 3623
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3624 3624
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3625 3625
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3626
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3626
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3627 3627
                             // TODO: Fix this for urls with protocol header.
3628 3628
                             $file = str_replace('//', '/', $file);
3629 3629
                             $file = str_replace(':/', '://', $file);
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3643 3643
         }
3644 3644
         if ($this->debug > 2) {
3645
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3645
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3646 3646
         }
3647 3647
         return $file;
3648 3648
     }
@@ -3660,7 +3660,7 @@  discard block
 block discarded – undo
3660 3660
         $search = '';
3661 3661
         // Use $attempt_num to enable multi-views management (disabled so far).
3662 3662
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3663
-            $search = 'AND view_count = ' . $attempt_num;
3663
+            $search = 'AND view_count = '.$attempt_num;
3664 3664
         }
3665 3665
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3666 3666
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3670,9 +3670,9 @@  discard block
 block discarded – undo
3670 3670
 
3671 3671
         $sql = "SELECT id, view_count FROM $lp_view_table
3672 3672
         		WHERE
3673
-        		    c_id = " . $course_id . " AND
3674
-        		    lp_id = " . $this->get_id() . " AND
3675
-        		    user_id = " . $this->get_user_id() . " AND
3673
+        		    c_id = ".$course_id." AND
3674
+        		    lp_id = " . $this->get_id()." AND
3675
+        		    user_id = " . $this->get_user_id()." AND
3676 3676
         		    session_id = $sessionId
3677 3677
         		    $search
3678 3678
                 ORDER BY view_count DESC";
@@ -3683,7 +3683,7 @@  discard block
 block discarded – undo
3683 3683
         } else if (!api_is_invitee()) {
3684 3684
             // There is no database record, create one.
3685 3685
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3686
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3686
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3687 3687
             Database::query($sql);
3688 3688
             $id = Database :: insert_id();
3689 3689
             $this->lp_view_id = $id;
@@ -3783,15 +3783,15 @@  discard block
 block discarded – undo
3783 3783
     {
3784 3784
         $course_id = api_get_course_int_id();
3785 3785
         if ($this->debug > 0) {
3786
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3786
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3787 3787
         }
3788 3788
         if (empty($id) || empty($direction)) {
3789 3789
             return false;
3790 3790
         }
3791 3791
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3792 3792
         $sql_sel = "SELECT *
3793
-                    FROM " . $tbl_lp_item . "
3794
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3793
+                    FROM " . $tbl_lp_item."
3794
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3795 3795
         $res_sel = Database::query($sql_sel);
3796 3796
         // Check if elem exists.
3797 3797
         if (Database :: num_rows($res_sel) < 1) {
@@ -3816,7 +3816,7 @@  discard block
 block discarded – undo
3816 3816
                                  WHERE c_id = ".$course_id." AND id = $previous";
3817 3817
 
3818 3818
                     if ($this->debug > 2) {
3819
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3819
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3820 3820
                     }
3821 3821
                     $res_sel2 = Database::query($sql_sel2);
3822 3822
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
                         }
3870 3870
                         Database::query($sql_upd2);
3871 3871
                     }
3872
-                    $display = $display -1;
3872
+                    $display = $display - 1;
3873 3873
                 }
3874 3874
                 break;
3875 3875
             case 'down':
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
                 } else {
3881 3881
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3882 3882
                     if ($this->debug > 2) {
3883
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3883
+                        error_log('Selecting next: '.$sql_sel2, 0);
3884 3884
                     }
3885 3885
                     $res_sel2 = Database::query($sql_sel2);
3886 3886
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3919 3919
                         Database::query($sql_upd2);
3920 3920
                     }
3921
-                    $display = $display +1;
3921
+                    $display = $display + 1;
3922 3922
                 }
3923 3923
                 break;
3924 3924
             default :
@@ -3941,8 +3941,8 @@  discard block
 block discarded – undo
3941 3941
         $res = Database::query($sql);
3942 3942
         if ($res === false)
3943 3943
             return false;
3944
-        $lps = array ();
3945
-        $lp_order = array ();
3944
+        $lps = array();
3945
+        $lp_order = array();
3946 3946
         $num = Database :: num_rows($res);
3947 3947
         // First check the order is correct, globally (might be wrong because
3948 3948
         // of versions < 1.8.4)
@@ -3952,7 +3952,7 @@  discard block
 block discarded – undo
3952 3952
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3953 3953
                     $need_fix = true;
3954 3954
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3955
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3955
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3956 3956
                     Database::query($sql_u);
3957 3957
                 }
3958 3958
                 $row['display_order'] = $i;
@@ -3965,10 +3965,10 @@  discard block
 block discarded – undo
3965 3965
             $order = $lps[$lp_id]['display_order'];
3966 3966
             if ($order > 1) { // If it's the first element, no need to move up.
3967 3967
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3968
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3968
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3969 3969
                 Database::query($sql_u1);
3970
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3971
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3970
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3971
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3972 3972
                 Database::query($sql_u2);
3973 3973
             }
3974 3974
         }
@@ -3989,8 +3989,8 @@  discard block
 block discarded – undo
3989 3989
         if ($res === false) {
3990 3990
             return false;
3991 3991
         }
3992
-        $lps = array ();
3993
-        $lp_order = array ();
3992
+        $lps = array();
3993
+        $lp_order = array();
3994 3994
         $num = Database :: num_rows($res);
3995 3995
         $max = 0;
3996 3996
         // First check the order is correct, globally (might be wrong because
@@ -4002,7 +4002,7 @@  discard block
 block discarded – undo
4002 4002
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4003 4003
                     $need_fix = true;
4004 4004
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4005
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4005
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4006 4006
                     Database::query($sql_u);
4007 4007
                 }
4008 4008
                 $row['display_order'] = $i;
@@ -4015,10 +4015,10 @@  discard block
 block discarded – undo
4015 4015
             $order = $lps[$lp_id]['display_order'];
4016 4016
             if ($order < $max) { // If it's the first element, no need to move up.
4017 4017
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4018
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4018
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4019 4019
                 Database::query($sql_u1);
4020
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4021
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4020
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4021
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4022 4022
                 Database::query($sql_u2);
4023 4023
             }
4024 4024
         }
@@ -4038,15 +4038,15 @@  discard block
 block discarded – undo
4038 4038
         $this->autocomplete_parents($this->last);
4039 4039
         $new_index = $this->get_next_index();
4040 4040
         if ($this->debug > 2) {
4041
-            error_log('New LP - New index: ' . $new_index, 0);
4041
+            error_log('New LP - New index: '.$new_index, 0);
4042 4042
         }
4043 4043
         $this->index = $new_index;
4044 4044
         if ($this->debug > 2) {
4045
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4045
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4046 4046
         }
4047 4047
         $this->current = $this->ordered_items[$new_index];
4048 4048
         if ($this->debug > 2) {
4049
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4049
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4050 4050
         }
4051 4051
     }
4052 4052
 
@@ -4110,7 +4110,7 @@  discard block
 block discarded – undo
4110 4110
             // Clean spaces.
4111 4111
             $prereq_string = str_replace(' ', '', $prereq_string);
4112 4112
             if ($debug > 0) {
4113
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4113
+                error_log('Found prereq_string: '.$prereq_string, 0);
4114 4114
             }
4115 4115
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4116 4116
             $result = $currentItem->parse_prereq(
@@ -4126,12 +4126,12 @@  discard block
 block discarded – undo
4126 4126
         } else {
4127 4127
             $result = true;
4128 4128
             if ($debug > 1) {
4129
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4129
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4130 4130
             }
4131 4131
         }
4132 4132
 
4133 4133
         if ($debug > 1) {
4134
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4134
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4135 4135
         }
4136 4136
         return $result;
4137 4137
     }
@@ -4197,12 +4197,12 @@  discard block
 block discarded – undo
4197 4197
             $row = Database :: fetch_array($result);
4198 4198
             $name = domesticate($row['name']);
4199 4199
             if ($set_visibility == 'i') {
4200
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4200
+                $s = $name." ".get_lang('LearnpathNotPublished');
4201 4201
                 $dialogBox = $s;
4202 4202
                 $v = 0;
4203 4203
             }
4204 4204
             if ($set_visibility == 'v') {
4205
-                $s = $name . " " . get_lang('LearnpathPublished');
4205
+                $s = $name." ".get_lang('LearnpathPublished');
4206 4206
                 $dialogBox = $s;
4207 4207
                 $v = 1;
4208 4208
             }
@@ -4285,9 +4285,9 @@  discard block
 block discarded – undo
4285 4285
         $course_id = api_get_course_int_id();
4286 4286
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4287 4287
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4288
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4288
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4289 4289
         if ($this->debug > 2) {
4290
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4290
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4291 4291
         }
4292 4292
         $res = Database::query($sql);
4293 4293
         $view_id = Database::insert_id();
@@ -4325,10 +4325,10 @@  discard block
 block discarded – undo
4325 4325
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4326 4326
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4327 4327
         if ($this->debug > 2) {
4328
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4328
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4329 4329
         }
4330 4330
         if ($this->debug > 2) {
4331
-            error_log('' . print_r($this->items, true), 0);
4331
+            error_log(''.print_r($this->items, true), 0);
4332 4332
         }
4333 4333
         if (isset($this->items[$this->current]) &&
4334 4334
             is_object($this->items[$this->current])
@@ -4352,7 +4352,7 @@  discard block
 block discarded – undo
4352 4352
     {
4353 4353
         $debug = $this->debug;
4354 4354
         if ($debug) {
4355
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4355
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4356 4356
         }
4357 4357
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4358 4358
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
 
4376 4376
             if ($debug) {
4377 4377
                 error_log('update_queue before:');
4378
-                error_log(print_r($this->update_queue,1));
4378
+                error_log(print_r($this->update_queue, 1));
4379 4379
             }
4380 4380
             $this->autocomplete_parents($item_id);
4381 4381
 
@@ -4383,9 +4383,9 @@  discard block
 block discarded – undo
4383 4383
             $this->update_queue[$item_id] = $status;
4384 4384
 
4385 4385
             if ($debug) {
4386
-                error_log('get_status(): ' . $status);
4386
+                error_log('get_status(): '.$status);
4387 4387
                 error_log('update_queue after:');
4388
-                error_log(print_r($this->update_queue,1));
4388
+                error_log(print_r($this->update_queue, 1));
4389 4389
             }
4390 4390
             return $res;
4391 4391
         }
@@ -4406,17 +4406,17 @@  discard block
 block discarded – undo
4406 4406
 
4407 4407
         if (isset($this->current) && !api_is_invitee()) {
4408 4408
             if ($this->debug > 2) {
4409
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4409
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4410 4410
             }
4411 4411
             $sql = "UPDATE $table SET
4412
-                        last_item = " . intval($this->get_current_item_id()). "
4412
+                        last_item = ".intval($this->get_current_item_id())."
4413 4413
                     WHERE
4414 4414
                         c_id = $course_id AND
4415
-                        lp_id = " . $this->get_id() . " AND
4415
+                        lp_id = ".$this->get_id()." AND
4416 4416
                         user_id = " . $this->get_user_id()." ".$session_condition;
4417 4417
 
4418 4418
             if ($this->debug > 2) {
4419
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4419
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4420 4420
             }
4421 4421
             Database::query($sql);
4422 4422
         }
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
                             progress = $progress
4431 4431
                         WHERE
4432 4432
                             c_id = ".$course_id." AND
4433
-                            lp_id = " . $this->get_id() . " AND
4433
+                            lp_id = " . $this->get_id()." AND
4434 4434
                             user_id = " . $this->get_user_id()." ".$session_condition;
4435 4435
                 // Ignore errors as some tables might not have the progress field just yet.
4436 4436
                 Database::query($sql);
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
     public function set_current_item($item_id = null)
4447 4447
     {
4448 4448
         if ($this->debug > 0) {
4449
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4449
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4450 4450
         }
4451 4451
         if (empty ($item_id)) {
4452 4452
             if ($this->debug > 2) {
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
             // Do nothing.
4456 4456
         } else {
4457 4457
             if ($this->debug > 2) {
4458
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4458
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4459 4459
             }
4460 4460
             if (is_numeric($item_id)) {
4461 4461
                 $item_id = intval($item_id);
@@ -4470,10 +4470,10 @@  discard block
 block discarded – undo
4470 4470
                     }
4471 4471
                 }
4472 4472
                 if ($this->debug > 2) {
4473
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4473
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4474 4474
                 }
4475 4475
             } else {
4476
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4476
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4477 4477
             }
4478 4478
         }
4479 4479
     }
@@ -4498,7 +4498,7 @@  discard block
 block discarded – undo
4498 4498
             $lp = $this->get_id();
4499 4499
             if ($lp != 0) {
4500 4500
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4501
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4501
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4502 4502
                 $res = Database::query($sql);
4503 4503
                 return $res;
4504 4504
             }
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
 
4523 4523
         if ($lp != 0) {
4524 4524
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4525
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4525
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4526 4526
             $res = Database::query($sql);
4527 4527
             return $res;
4528 4528
         } else {
@@ -4547,10 +4547,10 @@  discard block
 block discarded – undo
4547 4547
         $course_id = api_get_course_int_id();
4548 4548
         $lp_id = $this->get_id();
4549 4549
         $sql = "UPDATE $lp_table SET
4550
-                content_maker = '" . Database::escape_string($this->maker) . "'
4550
+                content_maker = '".Database::escape_string($this->maker)."'
4551 4551
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4552 4552
         if ($this->debug > 2) {
4553
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4553
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4554 4554
         }
4555 4555
         Database::query($sql);
4556 4556
         return true;
@@ -4574,10 +4574,10 @@  discard block
 block discarded – undo
4574 4574
         $lp_id = $this->get_id();
4575 4575
         $course_id = $this->course_info['real_id'];
4576 4576
         $sql = "UPDATE $lp_table SET
4577
-                name = '" . Database::escape_string($this->name). "'
4577
+                name = '".Database::escape_string($this->name)."'
4578 4578
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4579 4579
         if ($this->debug > 2) {
4580
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4580
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4581 4581
         }
4582 4582
         $result = Database::query($sql);
4583 4583
         // If the lp is visible on the homepage, change his name there.
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
             $session_id = api_get_session_id();
4586 4586
             $session_condition = api_get_session_condition($session_id);
4587 4587
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4588
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4588
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4589 4589
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4590 4590
             	    WHERE
4591 4591
             	        c_id = $course_id AND
@@ -4663,10 +4663,10 @@  discard block
 block discarded – undo
4663 4663
 
4664 4664
                 // Save it to search engine.
4665 4665
                 foreach ($missing_terms as $term) {
4666
-                    $doc->add_term($prefix . $term, 1);
4666
+                    $doc->add_term($prefix.$term, 1);
4667 4667
                 }
4668 4668
                 foreach ($deprecated_terms as $term) {
4669
-                    $doc->remove_term($prefix . $term);
4669
+                    $doc->remove_term($prefix.$term);
4670 4670
                 }
4671 4671
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4672 4672
                 $di->getDb()->flush();
@@ -4691,10 +4691,10 @@  discard block
 block discarded – undo
4691 4691
         $this->theme = $name;
4692 4692
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4693 4693
         $lp_id = $this->get_id();
4694
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4694
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4695 4695
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4696 4696
         if ($this->debug > 2) {
4697
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4697
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4698 4698
         }
4699 4699
         Database::query($sql);
4700 4700
 
@@ -4717,10 +4717,10 @@  discard block
 block discarded – undo
4717 4717
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4718 4718
         $lp_id = $this->get_id();
4719 4719
         $sql = "UPDATE $lp_table SET
4720
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4720
+                preview_image = '".Database::escape_string($this->preview_image)."'
4721 4721
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4722 4722
         if ($this->debug > 2) {
4723
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4723
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4724 4724
         }
4725 4725
         Database::query($sql);
4726 4726
         return true;
@@ -4740,10 +4740,10 @@  discard block
 block discarded – undo
4740 4740
         $this->author = $name;
4741 4741
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4742 4742
         $lp_id = $this->get_id();
4743
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4743
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4744 4744
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4745 4745
         if ($this->debug > 2) {
4746
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4746
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4747 4747
         }
4748 4748
         Database::query($sql);
4749 4749
 
@@ -4761,15 +4761,15 @@  discard block
 block discarded – undo
4761 4761
         if ($this->debug > 0) {
4762 4762
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4763 4763
         }
4764
-        if (intval($hide) == $hide){
4764
+        if (intval($hide) == $hide) {
4765 4765
             $this->hide_toc_frame = $hide;
4766 4766
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4767 4767
             $lp_id = $this->get_id();
4768 4768
             $sql = "UPDATE $lp_table SET
4769
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4769
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4770 4770
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4771 4771
             if ($this->debug > 2) {
4772
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4772
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4773 4773
             }
4774 4774
             Database::query($sql);
4775 4775
 
@@ -4796,7 +4796,7 @@  discard block
 block discarded – undo
4796 4796
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4797 4797
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4798 4798
         if ($this->debug > 2) {
4799
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4799
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4800 4800
         }
4801 4801
         Database::query($sql);
4802 4802
         return true;
@@ -4820,10 +4820,10 @@  discard block
 block discarded – undo
4820 4820
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4821 4821
         $lp_id = $this->get_id();
4822 4822
         $sql = "UPDATE $lp_table SET
4823
-                    content_local = '" . Database::escape_string($name) . "'
4823
+                    content_local = '".Database::escape_string($name)."'
4824 4824
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4825 4825
         if ($this->debug > 2) {
4826
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4826
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4827 4827
         }
4828 4828
         Database::query($sql);
4829 4829
         return true;
@@ -4857,11 +4857,11 @@  discard block
 block discarded – undo
4857 4857
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4858 4858
         $lp_id = $this->get_id();
4859 4859
         $sql = "UPDATE $lp_table SET
4860
-                    use_max_score = '" . $this->use_max_score . "'
4860
+                    use_max_score = '".$this->use_max_score."'
4861 4861
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4862 4862
 
4863 4863
         if ($this->debug > 2) {
4864
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4864
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4865 4865
         }
4866 4866
         Database::query($sql);
4867 4867
 
@@ -4888,10 +4888,10 @@  discard block
 block discarded – undo
4888 4888
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4889 4889
         $lp_id = $this->get_id();
4890 4890
         $sql = "UPDATE $lp_table SET
4891
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4891
+                expired_on = '".Database::escape_string($this->expired_on)."'
4892 4892
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4893 4893
         if ($this->debug > 2) {
4894
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4894
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4895 4895
         }
4896 4896
         Database::query($sql);
4897 4897
 
@@ -4917,10 +4917,10 @@  discard block
 block discarded – undo
4917 4917
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4918 4918
         $lp_id = $this->get_id();
4919 4919
         $sql = "UPDATE $lp_table SET
4920
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4920
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4921 4921
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4922 4922
         if ($this->debug > 2) {
4923
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4923
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4924 4924
         }
4925 4925
         Database::query($sql);
4926 4926
 
@@ -4940,10 +4940,10 @@  discard block
 block discarded – undo
4940 4940
         $this->modified_on = api_get_utc_datetime();
4941 4941
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4942 4942
         $lp_id = $this->get_id();
4943
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4943
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4944 4944
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4945 4945
         if ($this->debug > 2) {
4946
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4946
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4947 4947
         }
4948 4948
         Database::query($sql);
4949 4949
         return true;
@@ -5014,13 +5014,13 @@  discard block
 block discarded – undo
5014 5014
 
5015 5015
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5016 5016
             if ($this->debug > 2) {
5017
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5017
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5018 5018
             }
5019 5019
             switch ($this->get_type()) {
5020 5020
                 case '3' :
5021 5021
                     if ($this->items[$this->last]->get_type() != 'au') {
5022 5022
                         if ($this->debug > 2) {
5023
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5023
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5024 5024
                         }
5025 5025
                         $this->items[$this->last]->close();
5026 5026
                         //$this->autocomplete_parents($this->last);
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
                 case '2' :
5034 5034
                     if ($this->items[$this->last]->get_type() != 'sco') {
5035 5035
                         if ($this->debug > 2) {
5036
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5036
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5037 5037
                         }
5038 5038
                         $this->items[$this->last]->close();
5039 5039
                         //$this->autocomplete_parents($this->last);
@@ -5047,7 +5047,7 @@  discard block
 block discarded – undo
5047 5047
                 case '1' :
5048 5048
                 default :
5049 5049
                     if ($this->debug > 2) {
5050
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5050
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5051 5051
                     }
5052 5052
                     $this->items[$this->last]->close();
5053 5053
                     break;
@@ -5073,7 +5073,7 @@  discard block
 block discarded – undo
5073 5073
         }
5074 5074
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5075 5075
         $sql = "SELECT * FROM $lp_table
5076
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5076
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5077 5077
         $res = Database::query($sql);
5078 5078
         if (Database :: num_rows($res) > 0) {
5079 5079
             $row = Database :: fetch_array($res);
@@ -5094,14 +5094,14 @@  discard block
 block discarded – undo
5094 5094
                     break;
5095 5095
             }
5096 5096
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5097
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5097
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5098 5098
             Database::query($sql);
5099 5099
             $this->mode = $view_mode;
5100 5100
 
5101 5101
             return $view_mode;
5102 5102
         } else {
5103 5103
             if ($this->debug > 2) {
5104
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5104
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5105 5105
             }
5106 5106
         }
5107 5107
         return -1;
@@ -5119,7 +5119,7 @@  discard block
 block discarded – undo
5119 5119
         }
5120 5120
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5121 5121
         $sql = "SELECT * FROM $lp_table
5122
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5122
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5123 5123
         $res = Database::query($sql);
5124 5124
         if (Database :: num_rows($res) > 0) {
5125 5125
             $row = Database :: fetch_array($res);
@@ -5132,14 +5132,14 @@  discard block
 block discarded – undo
5132 5132
                 $force_return = true;
5133 5133
             }
5134 5134
             $sql = "UPDATE $lp_table SET force_commit = $force
5135
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5135
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5136 5136
             Database::query($sql);
5137 5137
             $this->force_commit = $force_return;
5138 5138
 
5139 5139
             return $force_return;
5140 5140
         } else {
5141 5141
             if ($this->debug > 2) {
5142
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5142
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5143 5143
             }
5144 5144
         }
5145 5145
         return -1;
@@ -5168,7 +5168,7 @@  discard block
 block discarded – undo
5168 5168
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5169 5169
                     $need_fix = true;
5170 5170
                     $sql = "UPDATE $lp_table SET display_order = $i
5171
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5171
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5172 5172
                     Database::query($sql);
5173 5173
                 }
5174 5174
                 $i++;
@@ -5189,7 +5189,7 @@  discard block
 block discarded – undo
5189 5189
         }
5190 5190
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5191 5191
         $sql = "SELECT * FROM $lp_table
5192
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5192
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5193 5193
         $res = Database::query($sql);
5194 5194
         if (Database :: num_rows($res) > 0) {
5195 5195
             $row = Database :: fetch_array($res);
@@ -5200,13 +5200,13 @@  discard block
 block discarded – undo
5200 5200
                 $force = 1;
5201 5201
             }
5202 5202
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5203
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5203
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5204 5204
             Database::query($sql);
5205 5205
             $this->prevent_reinit = $force;
5206 5206
             return $force;
5207 5207
         } else {
5208 5208
             if ($this->debug > 2) {
5209
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5209
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5210 5210
             }
5211 5211
         }
5212 5212
         return -1;
@@ -5222,11 +5222,11 @@  discard block
 block discarded – undo
5222 5222
     {
5223 5223
         //Set default value for seriousgame_mode
5224 5224
         if (!isset($this->seriousgame_mode)) {
5225
-            $this->seriousgame_mode=0;
5225
+            $this->seriousgame_mode = 0;
5226 5226
         }
5227 5227
         // Set default value for prevent_reinit
5228 5228
         if (!isset($this->prevent_reinit)) {
5229
-            $this->prevent_reinit =1;
5229
+            $this->prevent_reinit = 1;
5230 5230
         }
5231 5231
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5232 5232
             return 'seriousgame';
@@ -5274,7 +5274,7 @@  discard block
 block discarded – undo
5274 5274
         $sql = "UPDATE $lp_table SET
5275 5275
                 prevent_reinit = $prevent_reinit ,
5276 5276
                 seriousgame_mode = $sg_mode
5277
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5277
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5278 5278
         $res = Database::query($sql);
5279 5279
         if ($res) {
5280 5280
             return true;
@@ -5326,7 +5326,7 @@  discard block
 block discarded – undo
5326 5326
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5327 5327
         }
5328 5328
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5329
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5329
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5330 5330
         $res = Database::query($sql);
5331 5331
         if (Database :: num_rows($res) > 0) {
5332 5332
             $row = Database :: fetch_array($res);
@@ -5337,13 +5337,13 @@  discard block
 block discarded – undo
5337 5337
                 $force = 1;
5338 5338
             }
5339 5339
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5340
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5340
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5341 5341
             Database::query($sql);
5342 5342
             $this->seriousgame_mode = $force;
5343 5343
             return $force;
5344 5344
         } else {
5345 5345
             if ($this->debug > 2) {
5346
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5346
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5347 5347
             }
5348 5348
         }
5349 5349
         return -1;
@@ -5361,7 +5361,7 @@  discard block
 block discarded – undo
5361 5361
         }
5362 5362
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5363 5363
         $sql = "SELECT * FROM $lp_table
5364
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5364
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5365 5365
         $res = Database::query($sql);
5366 5366
         if (Database :: num_rows($res) > 0) {
5367 5367
             $row = Database :: fetch_array($res);
@@ -5372,13 +5372,13 @@  discard block
 block discarded – undo
5372 5372
                 $force = 1;
5373 5373
             }
5374 5374
             $sql = "UPDATE $lp_table SET debug = $force
5375
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5375
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5376 5376
             $res = Database::query($sql);
5377 5377
             $this->scorm_debug = $force;
5378 5378
             return $force;
5379 5379
         } else {
5380 5380
             if ($this->debug > 2) {
5381
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5381
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5382 5382
             }
5383 5383
         }
5384 5384
         return -1;
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
      * @param int $depth
5408 5408
      * @param array $tmp
5409 5409
      */
5410
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5410
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5411 5411
     {
5412 5412
         if ($this->debug > 1) {
5413 5413
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5493,7 +5493,7 @@  discard block
 block discarded – undo
5493 5493
 
5494 5494
         // we need to start a form when we want to update all the mp3 files
5495 5495
         if ($update_audio == 'true') {
5496
-            $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5496
+            $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5497 5497
         }
5498 5498
         $return .= '<div id="message"></div>';
5499 5499
         if (count($this->items) == 0) {
@@ -5501,14 +5501,14 @@  discard block
 block discarded – undo
5501 5501
         } else {
5502 5502
             $return_audio = '<table class="data_table">';
5503 5503
             $return_audio .= '<tr>';
5504
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5505
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5504
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5505
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5506 5506
             $return_audio .= '</tr>';
5507 5507
 
5508 5508
             if ($update_audio != 'true') {
5509 5509
                 $return .= '<div class="col-md-12">';
5510 5510
                 $return .= self::return_new_tree($update_audio);
5511
-                $return .='</div>';
5511
+                $return .= '</div>';
5512 5512
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5513 5513
             } else {
5514 5514
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5518,7 +5518,7 @@  discard block
 block discarded – undo
5518 5518
             // We need to close the form when we are updating the mp3 files.
5519 5519
             if ($update_audio == 'true') {
5520 5520
                 $return .= '<div class="footer-audio">';
5521
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5521
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5522 5522
                 $return .= '</div>';
5523 5523
                 //$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this?
5524 5524
             }
@@ -5539,7 +5539,7 @@  discard block
 block discarded – undo
5539 5539
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5540 5540
     {
5541 5541
         $return = '';
5542
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5542
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5543 5543
 
5544 5544
         $course_id = api_get_course_int_id();
5545 5545
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5587,7 +5587,7 @@  discard block
 block discarded – undo
5587 5587
 
5588 5588
             // Link for the documents
5589 5589
             if ($arrLP[$i]['item_type'] == 'document') {
5590
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5590
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5591 5591
                 $title_cut = Display::url(
5592 5592
                     $title_cut,
5593 5593
                     $url,
@@ -5603,14 +5603,14 @@  discard block
 block discarded – undo
5603 5603
             } else {
5604 5604
                 $oddClass = 'row_even';
5605 5605
             }
5606
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5606
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5607 5607
 
5608 5608
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5609 5609
 
5610
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5610
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5611 5611
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5612 5612
             } else {
5613
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5613
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5614 5614
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5615 5615
                 } else {
5616 5616
                     if ($arrLP[$i]['item_type'] === 'final_item') {
@@ -5622,7 +5622,7 @@  discard block
 block discarded – undo
5622 5622
             }
5623 5623
 
5624 5624
             // The audio column.
5625
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5625
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5626 5626
             $audio = '';
5627 5627
 
5628 5628
             if (!$update_audio || $update_audio <> 'true') {
@@ -5633,10 +5633,10 @@  discard block
 block discarded – undo
5633 5633
             } else {
5634 5634
                 $types = self::getChapterTypes();
5635 5635
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5636
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5636
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5637 5637
                     if (!empty ($arrLP[$i]['audio'])) {
5638 5638
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5639
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5639
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5640 5640
                     }
5641 5641
                 }
5642 5642
             }
@@ -5660,7 +5660,7 @@  discard block
 block discarded – undo
5660 5660
                 // No edit for this item types
5661 5661
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5662 5662
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5663
-                        $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">';
5663
+                        $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">';
5664 5664
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5665 5665
                         $edit_icon .= '</a>';
5666 5666
 
@@ -5673,7 +5673,7 @@  discard block
 block discarded – undo
5673 5673
                                 $this->lp_session_id
5674 5674
                             )
5675 5675
                             ) {
5676
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5676
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5677 5677
                                     'action' => 'dissociate_forum',
5678 5678
                                     'id' => $arrLP[$i]['id'],
5679 5679
                                     'lp_id' => $this->lp_id
@@ -5684,7 +5684,7 @@  discard block
 block discarded – undo
5684 5684
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5685 5685
                                 );
5686 5686
                             } else {
5687
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5687
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5688 5688
                                     'action' => 'create_forum',
5689 5689
                                     'id' => $arrLP[$i]['id'],
5690 5690
                                     'lp_id' => $this->lp_id
@@ -5697,17 +5697,17 @@  discard block
 block discarded – undo
5697 5697
                             }
5698 5698
                         }
5699 5699
                     } else {
5700
-                        $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">';
5700
+                        $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">';
5701 5701
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5702 5702
                         $edit_icon .= '</a>';
5703 5703
                     }
5704 5704
                 }
5705 5705
 
5706
-                $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">';
5706
+                $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">';
5707 5707
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5708 5708
                 $delete_icon .= '</a>';
5709 5709
 
5710
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5710
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5711 5711
 
5712 5712
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5713 5713
                     $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']);
@@ -5716,8 +5716,8 @@  discard block
 block discarded – undo
5716 5716
                 }
5717 5717
             }
5718 5718
             if ($update_audio != 'true') {
5719
-                $row = $move_icon . ' ' . $icon .
5720
-                    Display::span($title_cut) .
5719
+                $row = $move_icon.' '.$icon.
5720
+                    Display::span($title_cut).
5721 5721
                     Display::tag(
5722 5722
                         'div',
5723 5723
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5738,8 +5738,8 @@  discard block
 block discarded – undo
5738 5738
                 $parent_arrays = array();
5739 5739
                 if ($arrLP[$i]['depth'] > 1) {
5740 5740
                     //Getting list of parents
5741
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5742
-                        foreach($arrLP as $item) {
5741
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5742
+                        foreach ($arrLP as $item) {
5743 5743
                             if ($item['id'] == $parent_id) {
5744 5744
                                 if ($item['parent_item_id'] == 0) {
5745 5745
                                     $parent_id = $item['id'];
@@ -5761,8 +5761,8 @@  discard block
 block discarded – undo
5761 5761
                     $parent_arrays = array_reverse($parent_arrays);
5762 5762
                     $val = '$elements';
5763 5763
                     $x = 0;
5764
-                    foreach($parent_arrays as $item) {
5765
-                        if ($x != count($parent_arrays) -1) {
5764
+                    foreach ($parent_arrays as $item) {
5765
+                        if ($x != count($parent_arrays) - 1) {
5766 5766
                             $val .= '["'.$item.'"]["children"]';
5767 5767
                         } else {
5768 5768
                             $val .= '["'.$item.'"]["children"]';
@@ -5825,7 +5825,7 @@  discard block
 block discarded – undo
5825 5825
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5826 5826
                     $active = 'active';
5827 5827
                 }
5828
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5828
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5829 5829
             } else {
5830 5830
                 //sections
5831 5831
                 if (isset($item['children'])) {
@@ -5848,17 +5848,17 @@  discard block
 block discarded – undo
5848 5848
     {
5849 5849
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5850 5850
         $return = '<div class="actions">';
5851
-        $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> ';
5852
-        $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>';
5853
-        $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>';
5851
+        $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> ';
5852
+        $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>';
5853
+        $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>';
5854 5854
         $buttons = array(
5855 5855
             array(
5856 5856
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5857
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5857
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5858 5858
             ),
5859 5859
             array(
5860 5860
                 'title' => get_lang('ClearAllPrerequisites'),
5861
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5861
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5862 5862
             ),
5863 5863
         );
5864 5864
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5881,7 +5881,7 @@  discard block
 block discarded – undo
5881 5881
     {
5882 5882
         // Creating learning_path folder
5883 5883
         $dir = '/learning_path';
5884
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5884
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5885 5885
         $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5886 5886
 
5887 5887
         $folder = false;
@@ -5928,9 +5928,9 @@  discard block
 block discarded – undo
5928 5928
         // Creating LP folder
5929 5929
         if ($folder) {
5930 5930
             //Limits title size
5931
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5931
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5932 5932
             $dir   = $dir.$title;
5933
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5933
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5934 5934
             if (!is_dir($filepath.'/'.$dir)) {
5935 5935
                 $folderData = create_unexisting_directory(
5936 5936
                     $course,
@@ -5950,7 +5950,7 @@  discard block
 block discarded – undo
5950 5950
             }
5951 5951
             $dir = $dir.'/';
5952 5952
             if ($folder) {
5953
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5953
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5954 5954
             }
5955 5955
         }
5956 5956
         $array = array(
@@ -5992,12 +5992,12 @@  discard block
 block discarded – undo
5992 5992
             $dir = substr($dir, 1);
5993 5993
         }
5994 5994
         if (!empty($dir[0]) && $dir[0] != '/') {
5995
-            $dir = '/' . $dir;
5995
+            $dir = '/'.$dir;
5996 5996
         }
5997 5997
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5998 5998
             $dir .= '/';
5999 5999
         }
6000
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
6000
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6001 6001
 
6002 6002
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
6003 6003
             //Generates folder
@@ -6007,7 +6007,7 @@  discard block
 block discarded – undo
6007 6007
         }
6008 6008
 
6009 6009
         if (!is_dir($filepath)) {
6010
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6010
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6011 6011
             $dir = '/';
6012 6012
         }
6013 6013
 
@@ -6027,10 +6027,10 @@  discard block
 block discarded – undo
6027 6027
         $tmp_filename = $filename;
6028 6028
 
6029 6029
         $i = 0;
6030
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6031
-            $tmp_filename = $filename . '_' . ++ $i;
6030
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6031
+            $tmp_filename = $filename.'_'.++ $i;
6032 6032
 
6033
-        $filename = $tmp_filename . '.'.$extension;
6033
+        $filename = $tmp_filename.'.'.$extension;
6034 6034
         if ($extension == 'html') {
6035 6035
             $content = stripslashes($content);
6036 6036
             $content = str_replace(
@@ -6065,12 +6065,12 @@  discard block
 block discarded – undo
6065 6065
             );
6066 6066
         }
6067 6067
 
6068
-        if (!file_exists($filepath . $filename)) {
6069
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6068
+        if (!file_exists($filepath.$filename)) {
6069
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6070 6070
                 fputs($fp, $content);
6071 6071
                 fclose($fp);
6072 6072
 
6073
-                $file_size = filesize($filepath . $filename);
6073
+                $file_size = filesize($filepath.$filename);
6074 6074
                 $save_file_path = $dir.$filename;
6075 6075
 
6076 6076
                 $document_id = add_document(
@@ -6108,12 +6108,12 @@  discard block
 block discarded – undo
6108 6108
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6109 6109
                         $ct = '';
6110 6110
                         if ($new_comment)
6111
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6111
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6112 6112
                         if ($new_title)
6113
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6113
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6114 6114
 
6115
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6116
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6115
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6116
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6117 6117
                         Database::query($sql);
6118 6118
                     }
6119 6119
                 }
@@ -6141,42 +6141,42 @@  discard block
 block discarded – undo
6141 6141
             $dir = substr($dir, 1);
6142 6142
 
6143 6143
         if ($dir[0] != '/')
6144
-            $dir = '/' . $dir;
6144
+            $dir = '/'.$dir;
6145 6145
 
6146 6146
         if ($dir[strlen($dir) - 1] != '/')
6147 6147
             $dir .= '/';
6148 6148
 
6149
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6149
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6150 6150
 
6151 6151
         if (!is_dir($filepath)) {
6152
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6152
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6153 6153
             $dir = '/';
6154 6154
         }
6155 6155
 
6156 6156
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6157 6157
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6158 6158
             $document_id = intval($_POST['path']);
6159
-            $sql = "SELECT path FROM " . $table_doc . "
6160
-                    WHERE c_id = $course_id AND id = " . $document_id;
6159
+            $sql = "SELECT path FROM ".$table_doc."
6160
+                    WHERE c_id = $course_id AND id = ".$document_id;
6161 6161
             $res = Database::query($sql);
6162 6162
             $row = Database :: fetch_array($res);
6163 6163
             $content = stripslashes($_POST['content_lp']);
6164
-            $file = $filepath . $row['path'];
6164
+            $file = $filepath.$row['path'];
6165 6165
 
6166 6166
             if ($fp = @ fopen($file, 'w')) {
6167
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6167
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6168 6168
 
6169 6169
                 // Change the path of mp3 to absolute.
6170 6170
                 // The first regexp deals with :// urls.
6171
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6171
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6172 6172
                 // The second regexp deals with audio/ urls.
6173
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6173
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6174 6174
                 fputs($fp, $content);
6175 6175
                 fclose($fp);
6176 6176
 
6177
-                $sql = "UPDATE " . $table_doc ." SET
6177
+                $sql = "UPDATE ".$table_doc." SET
6178 6178
                             title='".Database::escape_string($_POST['title'])."'
6179
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6179
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6180 6180
                 Database::query($sql);
6181 6181
             }
6182 6182
         }
@@ -6194,10 +6194,10 @@  discard block
 block discarded – undo
6194 6194
         $return = '';
6195 6195
         if (is_numeric($item_id)) {
6196 6196
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6197
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6198
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6197
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6198
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6199 6199
             $result = Database::query($sql);
6200
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6200
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6201 6201
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6202 6202
 
6203 6203
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6224,8 +6224,8 @@  discard block
 block discarded – undo
6224 6224
                         break;
6225 6225
                     case TOOL_DOCUMENT:
6226 6226
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6227
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6228
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6227
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6228
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6229 6229
                         $result = Database::query($sql_doc);
6230 6230
                         $path_file = Database::result($result, 0, 0);
6231 6231
                         $path_parts = pathinfo($path_file);
@@ -6264,7 +6264,7 @@  discard block
 block discarded – undo
6264 6264
         if (is_numeric($item_id)) {
6265 6265
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6266 6266
             $sql = "SELECT * FROM $tbl_lp_item
6267
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6267
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6268 6268
             $res = Database::query($sql);
6269 6269
             $row = Database::fetch_array($res);
6270 6270
 
@@ -6275,21 +6275,21 @@  discard block
 block discarded – undo
6275 6275
                 case 'sco' :
6276 6276
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6277 6277
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6278
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6278
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6279 6279
                     } else {
6280
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6280
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6281 6281
                     }
6282 6282
                     break;
6283 6283
                 case TOOL_DOCUMENT :
6284 6284
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6285 6285
                     $sql = "SELECT lp.*, doc.path as dir
6286
-                            FROM " . $tbl_lp_item . " as lp
6287
-                            LEFT JOIN " . $tbl_doc . " as doc
6286
+                            FROM " . $tbl_lp_item." as lp
6287
+                            LEFT JOIN " . $tbl_doc." as doc
6288 6288
                             ON doc.id = lp.path
6289 6289
                             WHERE
6290 6290
                                 lp.c_id = $course_id AND
6291 6291
                                 doc.c_id = $course_id AND
6292
-                                lp.id = " . intval($item_id);
6292
+                                lp.id = ".intval($item_id);
6293 6293
                     $res_step = Database::query($sql);
6294 6294
                     $row_step = Database :: fetch_array($res_step);
6295 6295
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6300,8 +6300,8 @@  discard block
 block discarded – undo
6300 6300
                     $link_id = (string) $row['path'];
6301 6301
                     if (ctype_digit($link_id)) {
6302 6302
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6303
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6304
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6303
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6304
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6305 6305
                         $res_link = Database::query($sql_select);
6306 6306
                         $row_link = Database :: fetch_array($res_link);
6307 6307
                         if (is_array($row_link)) {
@@ -6314,9 +6314,9 @@  discard block
 block discarded – undo
6314 6314
                 case 'dokeos_module' :
6315 6315
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6316 6316
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6317
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6317
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6318 6318
                     } else {
6319
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6319
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6320 6320
                     }
6321 6321
                     break;
6322 6322
                 case TOOL_QUIZ :
@@ -6373,7 +6373,7 @@  discard block
 block discarded – undo
6373 6373
 
6374 6374
         $headers = array(
6375 6375
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6376
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6376
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6377 6377
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6378 6378
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6379 6379
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6414,16 +6414,16 @@  discard block
 block discarded – undo
6414 6414
         $course_id = api_get_course_int_id();
6415 6415
         $return = '';
6416 6416
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6417
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6418
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6417
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6418
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6419 6419
         $res_doc = Database::query($sql_doc);
6420 6420
         $row_doc = Database :: fetch_array($res_doc);
6421 6421
 
6422 6422
         // TODO: Add a path filter.
6423 6423
         if ($iframe) {
6424
-            $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>';
6424
+            $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>';
6425 6425
         } else {
6426
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6426
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6427 6427
         }
6428 6428
 
6429 6429
         return $return;
@@ -6447,8 +6447,8 @@  discard block
 block discarded – undo
6447 6447
             $item_description = $extra_info['description'];
6448 6448
         } elseif (is_numeric($extra_info)) {
6449 6449
             $sql = "SELECT title, description
6450
-                    FROM " . $tbl_quiz . "
6451
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6450
+                    FROM " . $tbl_quiz."
6451
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6452 6452
 
6453 6453
             $result = Database::query($sql);
6454 6454
             $row = Database::fetch_array($result);
@@ -6458,8 +6458,8 @@  discard block
 block discarded – undo
6458 6458
             $item_title = '';
6459 6459
             $item_description = '';
6460 6460
         }
6461
-        $item_title			= Security::remove_XSS($item_title);
6462
-        $item_description 	= Security::remove_XSS($item_description);
6461
+        $item_title = Security::remove_XSS($item_title);
6462
+        $item_description = Security::remove_XSS($item_description);
6463 6463
 
6464 6464
         $legend = '<legend>';
6465 6465
         if ($id != 0 && is_array($extra_info))
@@ -6467,13 +6467,13 @@  discard block
 block discarded – undo
6467 6467
         else
6468 6468
             $parent = 0;
6469 6469
 
6470
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6471
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6470
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6471
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6472 6472
 
6473 6473
         $result = Database::query($sql);
6474
-        $arrLP = array ();
6474
+        $arrLP = array();
6475 6475
         while ($row = Database :: fetch_array($result)) {
6476
-            $arrLP[] = array (
6476
+            $arrLP[] = array(
6477 6477
                 'id' => $row['id'],
6478 6478
                 'item_type' => $row['item_type'],
6479 6479
                 'title' => $row['title'],
@@ -6496,15 +6496,15 @@  discard block
 block discarded – undo
6496 6496
         unset ($this->arrMenu);
6497 6497
 
6498 6498
         if ($action == 'add') {
6499
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6499
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6500 6500
         } elseif ($action == 'move') {
6501
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6501
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6502 6502
         } else {
6503
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6503
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6504 6504
         }
6505 6505
 
6506 6506
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6507
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6507
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6508 6508
         }
6509 6509
 
6510 6510
         $legend .= '</legend>';
@@ -6517,34 +6517,34 @@  discard block
 block discarded – undo
6517 6517
 
6518 6518
         if ($action != 'move') {
6519 6519
             $return .= '<tr>';
6520
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6521
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6520
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6521
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6522 6522
             $return .= '</tr>';
6523 6523
         }
6524 6524
 
6525 6525
         $return .= '<tr>';
6526 6526
 
6527
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6527
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6528 6528
         $return .= '<td class="input">';
6529 6529
 
6530 6530
         // Select for Parent item, root or chapter
6531 6531
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6532 6532
 
6533
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6533
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6534 6534
 
6535
-        $arrHide = array (
6535
+        $arrHide = array(
6536 6536
             $id
6537 6537
         );
6538 6538
         for ($i = 0; $i < count($arrLP); $i++) {
6539 6539
             if ($action != 'add') {
6540 6540
                 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)) {
6541
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6541
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6542 6542
                 } else {
6543 6543
                     $arrHide[] = $arrLP[$i]['id'];
6544 6544
                 }
6545 6545
             } else {
6546 6546
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6547
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6547
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6548 6548
             }
6549 6549
         }
6550 6550
         if (is_array($arrLP)) {
@@ -6556,11 +6556,11 @@  discard block
 block discarded – undo
6556 6556
         $return .= '</tr>';
6557 6557
         $return .= '<tr>';
6558 6558
 
6559
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6559
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6560 6560
         $return .= '<td class="input">';
6561 6561
 
6562 6562
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6563
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6563
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6564 6564
         for ($i = 0; $i < count($arrLP); $i++) {
6565 6565
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6566 6566
                 if (is_array($extra_info)) {
@@ -6572,7 +6572,7 @@  discard block
 block discarded – undo
6572 6572
                 } else {
6573 6573
                     $selected = '';
6574 6574
                 }
6575
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6575
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6576 6576
             }
6577 6577
         }
6578 6578
         $return .= '</select>';
@@ -6589,7 +6589,7 @@  discard block
 block discarded – undo
6589 6589
                     }
6590 6590
                 }
6591 6591
             }
6592
-            $arrHide = array ();
6592
+            $arrHide = array();
6593 6593
             for ($i = 0; $i < count($arrLP); $i++) {
6594 6594
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6595 6595
                     if (is_array($extra_info)) {
@@ -6635,27 +6635,27 @@  discard block
 block discarded – undo
6635 6635
 
6636 6636
         $return .= '<tr>';
6637 6637
         if ($action == 'add') {
6638
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6638
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6639 6639
         } else {
6640
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6640
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6641 6641
         }
6642 6642
 
6643 6643
         $return .= '</tr>';
6644 6644
         $return .= '</table>';
6645 6645
 
6646 6646
         if ($action == 'move') {
6647
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6648
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6647
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6648
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6649 6649
         }
6650 6650
 
6651 6651
         if (is_numeric($extra_info)) {
6652
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6652
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6653 6653
         } elseif (is_array($extra_info)) {
6654
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6654
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6655 6655
         }
6656 6656
 
6657
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6658
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6657
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6658
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6659 6659
 
6660 6660
         $return .= '</form>';
6661 6661
         $return .= '</div>';
@@ -6682,11 +6682,11 @@  discard block
 block discarded – undo
6682 6682
         } elseif (is_numeric($extra_info)) {
6683 6683
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6684 6684
 
6685
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6685
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6686 6686
                     WHERE
6687 6687
                         c_id = ".$course_id." AND
6688
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6689
-                        id = " . (int) $extra_info . "
6688
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6689
+                        id = " . (int) $extra_info."
6690 6690
                     ORDER BY id ASC";
6691 6691
 
6692 6692
             $res_hot = Database::query($sql);
@@ -6710,11 +6710,11 @@  discard block
 block discarded – undo
6710 6710
         }
6711 6711
 
6712 6712
         $sql = "SELECT * FROM $tbl_lp_item
6713
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6713
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6714 6714
         $result = Database::query($sql);
6715
-        $arrLP = array ();
6715
+        $arrLP = array();
6716 6716
         while ($row = Database :: fetch_array($result)) {
6717
-            $arrLP[] = array (
6717
+            $arrLP[] = array(
6718 6718
                 'id' => $row['id'],
6719 6719
                 'item_type' => $row['item_type'],
6720 6720
                 'title' => $row['title'],
@@ -6739,7 +6739,7 @@  discard block
 block discarded – undo
6739 6739
         else
6740 6740
             $legend .= get_lang('EditCurrentExecice');
6741 6741
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6742
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6742
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6743 6743
         }
6744 6744
         $legend .= '</legend>';
6745 6745
 
@@ -6747,11 +6747,11 @@  discard block
 block discarded – undo
6747 6747
         $return .= $legend;
6748 6748
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6749 6749
         $return .= '<tr>';
6750
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6750
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6751 6751
         $return .= '<td class="input">';
6752 6752
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6753
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6754
-        $arrHide = array (
6753
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6754
+        $arrHide = array(
6755 6755
             $id
6756 6756
         );
6757 6757
 
@@ -6759,13 +6759,13 @@  discard block
 block discarded – undo
6759 6759
             for ($i = 0; $i < count($arrLP); $i++) {
6760 6760
                 if ($action != 'add') {
6761 6761
                     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)) {
6762
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6762
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6763 6763
                     } else {
6764 6764
                         $arrHide[] = $arrLP[$i]['id'];
6765 6765
                     }
6766 6766
                 } else {
6767 6767
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6768
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6768
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6769 6769
                 }
6770 6770
             }
6771 6771
 
@@ -6776,10 +6776,10 @@  discard block
 block discarded – undo
6776 6776
         $return .= '</td>';
6777 6777
         $return .= '</tr>';
6778 6778
         $return .= '<tr>';
6779
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6779
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6780 6780
         $return .= '<td class="input">';
6781 6781
         $return .= '<select id="previous" name="previous" size="1">';
6782
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6782
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6783 6783
 
6784 6784
         for ($i = 0; $i < count($arrLP); $i++) {
6785 6785
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6789,7 +6789,7 @@  discard block
 block discarded – undo
6789 6789
                 else
6790 6790
                     $selected = '';
6791 6791
 
6792
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6792
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6793 6793
             }
6794 6794
         }
6795 6795
 
@@ -6799,8 +6799,8 @@  discard block
 block discarded – undo
6799 6799
 
6800 6800
         if ($action != 'move') {
6801 6801
             $return .= '<tr>';
6802
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6803
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6802
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6803
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6804 6804
             $return .= '</tr>';
6805 6805
             $id_prerequisite = 0;
6806 6806
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6811,7 +6811,7 @@  discard block
 block discarded – undo
6811 6811
                     }
6812 6812
                 }
6813 6813
 
6814
-                $arrHide = array ();
6814
+                $arrHide = array();
6815 6815
                 for ($i = 0; $i < count($arrLP); $i++) {
6816 6816
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6817 6817
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6825,22 +6825,22 @@  discard block
 block discarded – undo
6825 6825
         }
6826 6826
 
6827 6827
         $return .= '<tr>';
6828
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6828
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6829 6829
         $return .= '</tr>';
6830 6830
         $return .= '</table>';
6831 6831
 
6832 6832
         if ($action == 'move') {
6833
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6834
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6833
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6834
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6835 6835
         }
6836 6836
 
6837 6837
         if (is_numeric($extra_info)) {
6838
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6838
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6839 6839
         } elseif (is_array($extra_info)) {
6840
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6840
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6841 6841
         }
6842
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6843
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6842
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6843
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6844 6844
         $return .= '</form>';
6845 6845
 
6846 6846
         return $return;
@@ -6863,8 +6863,8 @@  discard block
 block discarded – undo
6863 6863
             $item_title = stripslashes($extra_info['title']);
6864 6864
         } elseif (is_numeric($extra_info)) {
6865 6865
             $sql = "SELECT forum_title as title, forum_comment as comment
6866
-                    FROM " . $tbl_forum . "
6867
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6866
+                    FROM " . $tbl_forum."
6867
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6868 6868
 
6869 6869
             $result = Database::query($sql);
6870 6870
             $row = Database :: fetch_array($result);
@@ -6884,7 +6884,7 @@  discard block
 block discarded – undo
6884 6884
             $parent = 0;
6885 6885
         }
6886 6886
 
6887
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6887
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6888 6888
                 WHERE
6889 6889
                     c_id = ".$course_id." AND
6890 6890
                     lp_id = " . $this->lp_id;
@@ -6892,7 +6892,7 @@  discard block
 block discarded – undo
6892 6892
         $arrLP = array();
6893 6893
 
6894 6894
         while ($row = Database :: fetch_array($result)) {
6895
-            $arrLP[] = array (
6895
+            $arrLP[] = array(
6896 6896
                 'id' => $row['id'],
6897 6897
                 'item_type' => $row['item_type'],
6898 6898
                 'title' => $row['title'],
@@ -6914,10 +6914,10 @@  discard block
 block discarded – undo
6914 6914
         unset($this->arrMenu);
6915 6915
 
6916 6916
         if ($action == 'add')
6917
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6918
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6917
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6918
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6919 6919
         else
6920
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6920
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6921 6921
 
6922 6922
         $legend .= '</legend>';
6923 6923
         $return = '<div class="sectioncomment">';
@@ -6927,16 +6927,16 @@  discard block
 block discarded – undo
6927 6927
 
6928 6928
         if ($action != 'move') {
6929 6929
             $return .= '<tr>';
6930
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6931
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6930
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6931
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6932 6932
             $return .= '</tr>';
6933 6933
         }
6934 6934
 
6935 6935
         $return .= '<tr>';
6936
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6936
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6937 6937
         $return .= '<td class="input">';
6938 6938
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6939
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6939
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6940 6940
         $arrHide = array(
6941 6941
             $id
6942 6942
         );
@@ -6945,13 +6945,13 @@  discard block
 block discarded – undo
6945 6945
         for ($i = 0; $i < count($arrLP); $i++) {
6946 6946
             if ($action != 'add') {
6947 6947
                 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)) {
6948
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6948
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6949 6949
                 } else {
6950 6950
                     $arrHide[] = $arrLP[$i]['id'];
6951 6951
                 }
6952 6952
             } else {
6953 6953
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6954
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6954
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6955 6955
             }
6956 6956
         }
6957 6957
         if (is_array($arrLP)) {
@@ -6962,10 +6962,10 @@  discard block
 block discarded – undo
6962 6962
         $return .= '</td>';
6963 6963
         $return .= '</tr>';
6964 6964
         $return .= '<tr>';
6965
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6965
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6966 6966
         $return .= '<td class="input">';
6967 6967
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6968
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6968
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6969 6969
 
6970 6970
         for ($i = 0; $i < count($arrLP); $i++) {
6971 6971
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6975,8 +6975,8 @@  discard block
 block discarded – undo
6975 6975
                 else
6976 6976
                     $selected = '';
6977 6977
 
6978
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6979
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6978
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6979
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6980 6980
             }
6981 6981
         }
6982 6982
 
@@ -7010,25 +7010,25 @@  discard block
 block discarded – undo
7010 7010
         $return .= '<tr>';
7011 7011
 
7012 7012
         if ($action == 'add') {
7013
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
7013
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
7014 7014
         } else {
7015
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
7015
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
7016 7016
         }
7017 7017
         $return .= '</tr>';
7018 7018
         $return .= '</table>';
7019 7019
 
7020 7020
         if ($action == 'move') {
7021
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7022
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7021
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7022
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7023 7023
         }
7024 7024
 
7025 7025
         if (is_numeric($extra_info)) {
7026
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7026
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7027 7027
         } elseif (is_array($extra_info)) {
7028
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7028
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7029 7029
         }
7030
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7031
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7030
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7031
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7032 7032
         $return .= '</form>';
7033 7033
         $return .= '</div>';
7034 7034
 
@@ -7055,7 +7055,7 @@  discard block
 block discarded – undo
7055 7055
             $item_title = stripslashes($extra_info['title']);
7056 7056
         } elseif (is_numeric($extra_info)) {
7057 7057
             $sql = "SELECT thread_title as title FROM $tbl_forum
7058
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7058
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7059 7059
 
7060 7060
             $result = Database::query($sql);
7061 7061
             $row = Database :: fetch_array($result);
@@ -7075,15 +7075,15 @@  discard block
 block discarded – undo
7075 7075
             $parent = 0;
7076 7076
         }
7077 7077
 
7078
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7079
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7078
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7079
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7080 7080
 
7081 7081
         $result = Database::query($sql);
7082 7082
 
7083
-        $arrLP = array ();
7083
+        $arrLP = array();
7084 7084
 
7085 7085
         while ($row = Database :: fetch_array($result)) {
7086
-            $arrLP[] = array (
7086
+            $arrLP[] = array(
7087 7087
                 'id' => $row['id'],
7088 7088
                 'item_type' => $row['item_type'],
7089 7089
                 'title' => $row['title'],
@@ -7106,31 +7106,31 @@  discard block
 block discarded – undo
7106 7106
 
7107 7107
         $return .= '<form method="POST">';
7108 7108
         if ($action == 'add')
7109
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7110
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7109
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7110
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7111 7111
         else
7112
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7112
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7113 7113
 
7114 7114
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7115 7115
         $return .= '<tr>';
7116
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7116
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7117 7117
         $return .= '<td class="input">';
7118 7118
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7119
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7120
-        $arrHide = array (
7119
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7120
+        $arrHide = array(
7121 7121
             $id
7122 7122
         );
7123 7123
 
7124 7124
         for ($i = 0; $i < count($arrLP); $i++) {
7125 7125
             if ($action != 'add') {
7126 7126
                 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)) {
7127
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7127
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7128 7128
                 } else {
7129 7129
                     $arrHide[] = $arrLP[$i]['id'];
7130 7130
                 }
7131 7131
             } else {
7132 7132
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7133
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7133
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7134 7134
             }
7135 7135
         }
7136 7136
 
@@ -7142,10 +7142,10 @@  discard block
 block discarded – undo
7142 7142
         $return .= '</td>';
7143 7143
         $return .= '</tr>';
7144 7144
         $return .= '<tr>';
7145
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7145
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7146 7146
         $return .= '<td class="input">';
7147 7147
         $return .= '<select id="previous" name="previous" size="1">';
7148
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7148
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7149 7149
         for ($i = 0; $i < count($arrLP); $i++) {
7150 7150
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7151 7151
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7154,7 +7154,7 @@  discard block
 block discarded – undo
7154 7154
                 else
7155 7155
                     $selected = '';
7156 7156
 
7157
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7157
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7158 7158
             }
7159 7159
         }
7160 7160
         $return .= '</select>';
@@ -7162,8 +7162,8 @@  discard block
 block discarded – undo
7162 7162
         $return .= '</tr>';
7163 7163
         if ($action != 'move') {
7164 7164
             $return .= '<tr>';
7165
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7166
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7165
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7166
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7167 7167
             $return .= '</tr>';
7168 7168
             $return .= '<tr>';
7169 7169
             $return .= '</tr>';
@@ -7190,17 +7190,17 @@  discard block
 block discarded – undo
7190 7190
             }
7191 7191
 
7192 7192
             $return .= '<tr>';
7193
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7194
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7193
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7194
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7195 7195
 
7196 7196
             foreach ($arrHide as $key => $value) {
7197 7197
                 if ($key == $s_selected_position && $action == 'add') {
7198
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7198
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7199 7199
                 }
7200 7200
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7201
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7201
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7202 7202
                 } else {
7203
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7203
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7204 7204
                 }
7205 7205
             }
7206 7206
             $return .= "</select></td>";
@@ -7214,19 +7214,19 @@  discard block
 block discarded – undo
7214 7214
         $return .= '</table>';
7215 7215
 
7216 7216
         if ($action == 'move') {
7217
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7218
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7217
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7218
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7219 7219
         }
7220 7220
 
7221 7221
         if (is_numeric($extra_info)) {
7222
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7222
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7223 7223
         }
7224 7224
         elseif (is_array($extra_info)) {
7225
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7225
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7226 7226
         }
7227 7227
 
7228
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7229
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7228
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7229
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7230 7230
         $return .= '</form>';
7231 7231
         $return .= '</div>';
7232 7232
 
@@ -7252,10 +7252,10 @@  discard block
 block discarded – undo
7252 7252
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7253 7253
 
7254 7254
         if ($id != 0 && is_array($extra_info)) {
7255
-            $item_title 		= $extra_info['title'];
7256
-            $item_description 	= $extra_info['description'];
7257
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7258
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7255
+            $item_title = $extra_info['title'];
7256
+            $item_description = $extra_info['description'];
7257
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7258
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7259 7259
         } else {
7260 7260
             $item_title = '';
7261 7261
             $item_description = '';
@@ -7269,17 +7269,17 @@  discard block
 block discarded – undo
7269 7269
         }
7270 7270
 
7271 7271
         $id  = intval($id);
7272
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7272
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7273 7273
                 WHERE
7274 7274
                     c_id = ".$course_id." AND
7275
-                    lp_id = " . $this->lp_id . " AND
7275
+                    lp_id = " . $this->lp_id." AND
7276 7276
                     id != $id";
7277 7277
 
7278 7278
         if ($item_type == 'module')
7279 7279
             $sql .= " AND parent_item_id = 0";
7280 7280
 
7281 7281
         $result = Database::query($sql);
7282
-        $arrLP = array ();
7282
+        $arrLP = array();
7283 7283
 
7284 7284
         while ($row = Database :: fetch_array($result)) {
7285 7285
             $arrLP[] = array(
@@ -7307,9 +7307,9 @@  discard block
 block discarded – undo
7307 7307
 
7308 7308
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7309 7309
 
7310
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7310
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7311 7311
 
7312
-        $form = new FormValidator('form', 'POST',  $url);
7312
+        $form = new FormValidator('form', 'POST', $url);
7313 7313
 
7314 7314
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7315 7315
         $defaults['description'] = $item_description;
@@ -7353,7 +7353,7 @@  discard block
 block discarded – undo
7353 7353
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7354 7354
 
7355 7355
             foreach ($arrHide as $key => $value) {
7356
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7356
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7357 7357
             }
7358 7358
             if (!empty($s_selected_parent)) {
7359 7359
                 $parent_select->setSelected($s_selected_parent);
@@ -7375,16 +7375,16 @@  discard block
 block discarded – undo
7375 7375
                     $s_selected_position = $arrLP[$i]['id'];
7376 7376
                 }
7377 7377
 
7378
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7378
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7379 7379
             }
7380 7380
         }
7381 7381
 
7382 7382
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7383 7383
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7384
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7384
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7385 7385
 
7386 7386
         foreach ($arrHide as $key => $value) {
7387
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7387
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7388 7388
         }
7389 7389
 
7390 7390
         if (!empty ($s_selected_position)) {
@@ -7413,23 +7413,23 @@  discard block
 block discarded – undo
7413 7413
         //assets can't be modified
7414 7414
 
7415 7415
         //$item_type == 'asset' ||
7416
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7416
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7417 7417
 
7418 7418
             if ($item_type == 'sco') {
7419
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7419
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7420 7420
             }
7421 7421
             $renderer = $form->defaultRenderer();
7422 7422
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7423 7423
 
7424 7424
             $relative_prefix = '';
7425 7425
 
7426
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7426
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7427 7427
                 'Width' 				=> '100%',
7428 7428
                 'Height' 				=> '500',
7429 7429
                 'FullPage' 				=> true,
7430 7430
                 'CreateDocumentDir' 	=> $relative_prefix,
7431
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7432
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7431
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7432
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7433 7433
             );
7434 7434
 
7435 7435
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7438,7 +7438,7 @@  discard block
 block discarded – undo
7438 7438
             $defaults['content_lp'] = file_get_contents($content_path);
7439 7439
         }
7440 7440
 
7441
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7441
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7442 7442
         $form->addElement('hidden', 'post_time', time());
7443 7443
         $form->setDefaults($defaults);
7444 7444
         return $form->return_form();
@@ -7476,8 +7476,8 @@  discard block
 block discarded – undo
7476 7476
         // We don't display the document form if it's not an editable document (html or txt file).
7477 7477
         if ($action == "add") {
7478 7478
             if (is_numeric($extra_info)) {
7479
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7480
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7479
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7480
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7481 7481
                 $result = Database::query($sql_doc);
7482 7482
                 $path_file = Database :: result($result, 0, 0);
7483 7483
                 $path_parts = pathinfo($path_file);
@@ -7495,13 +7495,13 @@  discard block
 block discarded – undo
7495 7495
                 $item_title = stripslashes($path_parts['filename']);
7496 7496
             }
7497 7497
         } elseif (is_numeric($extra_info)) {
7498
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7498
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7499 7499
                         WHERE
7500 7500
                             c_id = ".$course_id." AND
7501 7501
                             id = " . intval($extra_info);
7502 7502
 
7503 7503
             $result = Database::query($sql_doc);
7504
-            $row 	= Database::fetch_array($result);
7504
+            $row = Database::fetch_array($result);
7505 7505
             $item_title = $row['title'];
7506 7506
             $item_title = str_replace('_', ' ', $item_title);
7507 7507
             if (empty ($item_title)) {
@@ -7520,11 +7520,11 @@  discard block
 block discarded – undo
7520 7520
             $parent = 0;
7521 7521
         }
7522 7522
 
7523
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7524
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7523
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7524
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7525 7525
 
7526 7526
         $result = Database::query($sql);
7527
-        $arrLP = array ();
7527
+        $arrLP = array();
7528 7528
         while ($row = Database :: fetch_array($result)) {
7529 7529
             $arrLP[] = array(
7530 7530
                 'id' => $row['id'],
@@ -7558,9 +7558,9 @@  discard block
 block discarded – undo
7558 7558
         $return .= '</legend>';
7559 7559
 
7560 7560
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7561
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7561
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7562 7562
         }
7563
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7563
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7564 7564
         $defaults['title'] = Security :: remove_XSS($item_title);
7565 7565
         if (empty($item_title)) {
7566 7566
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7596,15 +7596,15 @@  discard block
 block discarded – undo
7596 7596
         }
7597 7597
 
7598 7598
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7599
-        $my_count=0;
7599
+        $my_count = 0;
7600 7600
         foreach ($arrHide as $key => $value) {
7601
-            if ($my_count!=0) {
7601
+            if ($my_count != 0) {
7602 7602
                 // The LP name is also the first section and is not in the same charset like the other sections.
7603 7603
                 $value['value'] = Security :: remove_XSS($value['value']);
7604
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7604
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7605 7605
             } else {
7606 7606
                 $value['value'] = Security :: remove_XSS($value['value']);
7607
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7607
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7608 7608
             }
7609 7609
             $my_count++;
7610 7610
         }
@@ -7612,7 +7612,7 @@  discard block
 block discarded – undo
7612 7612
         if (!empty($id)) {
7613 7613
             $parent_select->setSelected($parent);
7614 7614
         } else {
7615
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7615
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7616 7616
             $parent_select->setSelected($parent_item_id);
7617 7617
         }
7618 7618
 
@@ -7629,7 +7629,7 @@  discard block
 block discarded – undo
7629 7629
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7630 7630
                     $s_selected_position = $arrLP[$i]['id'];
7631 7631
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7632
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7632
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7633 7633
             }
7634 7634
         }
7635 7635
 
@@ -7637,8 +7637,8 @@  discard block
 block discarded – undo
7637 7637
         $position->addOption(get_lang('FirstPosition'), 0);
7638 7638
 
7639 7639
         foreach ($arrHide as $key => $value) {
7640
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7641
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7640
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7641
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7642 7642
         }
7643 7643
         $position->setSelected($s_selected_position);
7644 7644
 
@@ -7708,7 +7708,7 @@  discard block
 block discarded – undo
7708 7708
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7709 7709
                             $relative_path 	 = implode('/', $relative_path);
7710 7710
                             if (strlen($relative_path) > 0) {
7711
-                                $relative_path = $relative_path . '/';
7711
+                                $relative_path = $relative_path.'/';
7712 7712
                             }
7713 7713
                         } else {
7714 7714
                             $result = $this->generate_lp_folder($_course);
@@ -7722,8 +7722,8 @@  discard block
 block discarded – undo
7722 7722
                             'Height' 				=> '500',
7723 7723
                             'FullPage' 				=> true,
7724 7724
                             'CreateDocumentDir' 	=> $relative_prefix,
7725
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7726
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7725
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7726
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7727 7727
                         );
7728 7728
 
7729 7729
                         if ($_GET['action'] == 'add_item') {
@@ -7790,8 +7790,8 @@  discard block
 block discarded – undo
7790 7790
             $item_url = stripslashes($extra_info['url']);
7791 7791
         } elseif (is_numeric($extra_info)) {
7792 7792
             $extra_info = intval($extra_info);
7793
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7794
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7793
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7794
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7795 7795
             $result = Database::query($sql);
7796 7796
             $row = Database :: fetch_array($result);
7797 7797
             $item_title       = $row['title'];
@@ -7811,8 +7811,8 @@  discard block
 block discarded – undo
7811 7811
             $parent = 0;
7812 7812
         }
7813 7813
 
7814
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7815
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7814
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7815
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7816 7816
         $result = Database::query($sql);
7817 7817
         $arrLP = array();
7818 7818
 
@@ -7839,10 +7839,10 @@  discard block
 block discarded – undo
7839 7839
         unset ($this->arrMenu);
7840 7840
 
7841 7841
         if ($action == 'add')
7842
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7843
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7842
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7843
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7844 7844
         else
7845
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7845
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7846 7846
 
7847 7847
         $legend .= '</legend>';
7848 7848
 
@@ -7853,16 +7853,16 @@  discard block
 block discarded – undo
7853 7853
 
7854 7854
         if ($action != 'move') {
7855 7855
             $return .= '<tr>';
7856
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7857
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7856
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7857
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7858 7858
             $return .= '</tr>';
7859 7859
         }
7860 7860
 
7861 7861
         $return .= '<tr>';
7862
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7862
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7863 7863
         $return .= '<td class="input">';
7864 7864
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7865
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7865
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7866 7866
         $arrHide = array(
7867 7867
             $id
7868 7868
         );
@@ -7872,13 +7872,13 @@  discard block
 block discarded – undo
7872 7872
         for ($i = 0; $i < count($arrLP); $i++) {
7873 7873
             if ($action != 'add') {
7874 7874
                 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)) {
7875
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7875
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7876 7876
                 } else {
7877 7877
                     $arrHide[] = $arrLP[$i]['id'];
7878 7878
                 }
7879 7879
             } else {
7880 7880
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7881
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7881
+                    $return .= '<option '.(($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7882 7882
             }
7883 7883
         }
7884 7884
 
@@ -7890,11 +7890,11 @@  discard block
 block discarded – undo
7890 7890
         $return .= '</td>';
7891 7891
         $return .= '</tr>';
7892 7892
         $return .= '<tr>';
7893
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7893
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7894 7894
         $return .= '<td class="input">';
7895 7895
 
7896 7896
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7897
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7897
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7898 7898
         for ($i = 0; $i < count($arrLP); $i++) {
7899 7899
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7900 7900
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7904,7 +7904,7 @@  discard block
 block discarded – undo
7904 7904
                 else
7905 7905
                     $selected = '';
7906 7906
 
7907
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7907
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7908 7908
             }
7909 7909
         }
7910 7910
         $return .= '</select>';
@@ -7913,8 +7913,8 @@  discard block
 block discarded – undo
7913 7913
 
7914 7914
         if ($action != 'move') {
7915 7915
             $return .= '<tr>';
7916
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7917
-            $return .= '<td class="input"><input' . (is_numeric($extra_info) ? ' disabled="disabled"' : '') . ' id="idURL" name="url" style="width:99%;" type="text" value="' . $item_url . '" class="learnpath_item_form" /></td>';
7916
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7917
+            $return .= '<td class="input"><input'.(is_numeric($extra_info) ? ' disabled="disabled"' : '').' id="idURL" name="url" style="width:99%;" type="text" value="'.$item_url.'" class="learnpath_item_form" /></td>';
7918 7918
             $return .= '</tr>';
7919 7919
             $id_prerequisite = 0;
7920 7920
             if (is_array($arrLP)) {
@@ -7941,25 +7941,25 @@  discard block
 block discarded – undo
7941 7941
 
7942 7942
         $return .= '<tr>';
7943 7943
         if ($action == 'add') {
7944
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7944
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7945 7945
         } else {
7946
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7946
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7947 7947
         }
7948 7948
         $return .= '</tr>';
7949 7949
         $return .= '</table>';
7950 7950
 
7951 7951
         if ($action == 'move') {
7952
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7953
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7952
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7953
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7954 7954
         }
7955 7955
 
7956 7956
         if (is_numeric($extra_info)) {
7957
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7957
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7958 7958
         } elseif (is_array($extra_info)) {
7959
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7959
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7960 7960
         }
7961
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7962
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7961
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7962
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7963 7963
         $return .= '</form>';
7964 7964
         $return .= '</div>';
7965 7965
 
@@ -7985,8 +7985,8 @@  discard block
 block discarded – undo
7985 7985
         } elseif (is_numeric($extra_info)) {
7986 7986
             $extra_info = intval($extra_info);
7987 7987
             $sql = "SELECT title, description
7988
-                    FROM " . $tbl_publication . "
7989
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7988
+                    FROM " . $tbl_publication."
7989
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7990 7990
 
7991 7991
             $result = Database::query($sql);
7992 7992
             $row = Database :: fetch_array($result);
@@ -8002,13 +8002,13 @@  discard block
 block discarded – undo
8002 8002
             $parent = 0;
8003 8003
         }
8004 8004
 
8005
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8006
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8005
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8006
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8007 8007
 
8008 8008
         $result = Database::query($sql);
8009 8009
         $arrLP = array();
8010 8010
         while ($row = Database :: fetch_array($result)) {
8011
-            $arrLP[] = array (
8011
+            $arrLP[] = array(
8012 8012
                 'id' => $row['id'],
8013 8013
                 'item_type' => $row['item_type'],
8014 8014
                 'title' => $row['title'],
@@ -8054,7 +8054,7 @@  discard block
 block discarded – undo
8054 8054
             ]
8055 8055
         );
8056 8056
 
8057
-        $arrHide = array (
8057
+        $arrHide = array(
8058 8058
             $id
8059 8059
         );
8060 8060
 
@@ -8072,7 +8072,7 @@  discard block
 block discarded – undo
8072 8072
                     $parentSelect->addOption(
8073 8073
                         $arrLP[$i]['title'],
8074 8074
                         $arrLP[$i]['id'],
8075
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8075
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8076 8076
                     );
8077 8077
 
8078 8078
                     if ($parent == $arrLP[$i]['id']) {
@@ -8089,7 +8089,7 @@  discard block
 block discarded – undo
8089 8089
                     $parentSelect->addOption(
8090 8090
                         $arrLP[$i]['title'],
8091 8091
                         $arrLP[$i]['id'],
8092
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8092
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8093 8093
                     );
8094 8094
 
8095 8095
                     if ($parent == $arrLP[$i]['id']) {
@@ -8113,7 +8113,7 @@  discard block
 block discarded – undo
8113 8113
         for ($i = 0; $i < count($arrLP); $i++) {
8114 8114
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8115 8115
                 $previousSelect->addOption(
8116
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8116
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8117 8117
                     $arrLP[$i]['id']
8118 8118
                 );
8119 8119
 
@@ -8135,7 +8135,7 @@  discard block
 block discarded – undo
8135 8135
                     }
8136 8136
                 }
8137 8137
             }
8138
-            $arrHide = array ();
8138
+            $arrHide = array();
8139 8139
             for ($i = 0; $i < count($arrLP); $i++) {
8140 8140
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8141 8141
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8227,8 +8227,8 @@  discard block
 block discarded – undo
8227 8227
 
8228 8228
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8229 8229
         $item_id = intval($item_id);
8230
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8231
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8230
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8231
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8232 8232
         $result = Database::query($sql);
8233 8233
         $row = Database::fetch_assoc($result);
8234 8234
 
@@ -8242,16 +8242,16 @@  discard block
 block discarded – undo
8242 8242
             $audio_player .= '<script>
8243 8243
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8244 8244
                                 s1.addParam("allowscriptaccess","always");
8245
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8245
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8246 8246
                                 s1.write("container");
8247 8247
                             </script>';
8248 8248
         }
8249 8249
 
8250
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8250
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8251 8251
 
8252 8252
         $return .= Display::url(
8253 8253
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8254
-            $url.'&action=edit_item&path_item=' . $row['path']
8254
+            $url.'&action=edit_item&path_item='.$row['path']
8255 8255
         );
8256 8256
 
8257 8257
         $return .= Display::url(
@@ -8271,12 +8271,12 @@  discard block
 block discarded – undo
8271 8271
             $url.'&action=delete_item'
8272 8272
         );
8273 8273
 
8274
-        if ($item_type == TOOL_HOTPOTATOES ) {
8274
+        if ($item_type == TOOL_HOTPOTATOES) {
8275 8275
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8276 8276
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8277 8277
         }
8278 8278
 
8279
-        if ($item_type == TOOL_DOCUMENT ) {
8279
+        if ($item_type == TOOL_DOCUMENT) {
8280 8280
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8281 8281
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8282 8282
         }
@@ -8297,13 +8297,13 @@  discard block
 block discarded – undo
8297 8297
     public function get_js_dropdown_array()
8298 8298
     {
8299 8299
         $course_id = api_get_course_int_id();
8300
-        $return = 'var child_name = new Array();' . "\n";
8301
-        $return .= 'var child_value = new Array();' . "\n\n";
8302
-        $return .= 'child_name[0] = new Array();' . "\n";
8303
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8300
+        $return = 'var child_name = new Array();'."\n";
8301
+        $return .= 'var child_value = new Array();'."\n\n";
8302
+        $return .= 'child_name[0] = new Array();'."\n";
8303
+        $return .= 'child_value[0] = new Array();'."\n\n";
8304 8304
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8305
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8306
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8305
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8306
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8307 8307
                     ORDER BY display_order ASC";
8308 8308
         $res_zero = Database::query($sql_zero);
8309 8309
         $i = 0;
@@ -8313,28 +8313,28 @@  discard block
 block discarded – undo
8313 8313
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8314 8314
             }
8315 8315
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8316
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8317
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8316
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8317
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8318 8318
         }
8319 8319
         $return .= "\n";
8320
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8321
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8320
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8321
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8322 8322
         $res = Database::query($sql);
8323 8323
         while ($row = Database :: fetch_array($res)) {
8324
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8324
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8325 8325
                            WHERE
8326 8326
                                 c_id = ".$course_id." AND
8327
-                                parent_item_id = " . $row['id'] . "
8327
+                                parent_item_id = " . $row['id']."
8328 8328
                            ORDER BY display_order ASC";
8329 8329
             $res_parent = Database::query($sql_parent);
8330 8330
             $i = 0;
8331
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8332
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8331
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8332
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8333 8333
 
8334 8334
             while ($row_parent = Database :: fetch_array($res_parent)) {
8335 8335
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8336
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8337
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8336
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8337
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8338 8338
             }
8339 8339
             $return .= "\n";
8340 8340
         }
@@ -8355,8 +8355,8 @@  discard block
 block discarded – undo
8355 8355
         if (is_numeric($item_id)) {
8356 8356
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8357 8357
 
8358
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8359
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8358
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8359
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8360 8360
 
8361 8361
             $res = Database::query($sql);
8362 8362
             $row = Database :: fetch_array($res);
@@ -8415,7 +8415,7 @@  discard block
 block discarded – undo
8415 8415
      */
8416 8416
     public function display_item_small_form($item_type, $title = '', $data = array())
8417 8417
     {
8418
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8418
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8419 8419
         $form = new FormValidator('small_form', 'post', $url);
8420 8420
         $form->addElement('header', $title);
8421 8421
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8441,7 +8441,7 @@  discard block
 block discarded – undo
8441 8441
         $item_id = intval($item_id);
8442 8442
         /* Current prerequisite */
8443 8443
         $sql = "SELECT * FROM $tbl_lp_item
8444
-                WHERE c_id = $course_id AND id = " . $item_id;
8444
+                WHERE c_id = $course_id AND id = ".$item_id;
8445 8445
         $result = Database::query($sql);
8446 8446
         $row    = Database::fetch_array($result);
8447 8447
         $prerequisiteId = $row['prerequisite'];
@@ -8451,20 +8451,20 @@  discard block
 block discarded – undo
8451 8451
         $return .= '<form method="POST">';
8452 8452
         $return .= '<table class="data_table">';
8453 8453
         $return .= '<tr>';
8454
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8455
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8456
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8454
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8455
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8456
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8457 8457
         $return .= '</tr>';
8458 8458
 
8459 8459
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8460 8460
         $return .= '<tr >';
8461 8461
         $return .= '<td colspan="3" class="radio">';
8462 8462
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8463
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8463
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8464 8464
         $return .= '</tr>';
8465 8465
 
8466 8466
         $sql = "SELECT * FROM $tbl_lp_item
8467
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8467
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8468 8468
         $result = Database::query($sql);
8469 8469
         $arrLP = array();
8470 8470
 
@@ -8507,25 +8507,25 @@  discard block
 block discarded – undo
8507 8507
             }
8508 8508
 
8509 8509
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8510
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8510
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8511 8511
 
8512 8512
             $return .= '<tr>';
8513
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8514
-            $return .= '<label for="id' . $item['id'] . '">';
8515
-            $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'] . '" />';
8513
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8514
+            $return .= '<label for="id'.$item['id'].'">';
8515
+            $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'].'" />';
8516 8516
             $icon_name = str_replace(' ', '', $item['item_type']);
8517 8517
 
8518
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8519
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8518
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8519
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8520 8520
             } else {
8521
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8522
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8521
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8522
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8523 8523
                 } else {
8524 8524
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8525 8525
                 }
8526 8526
             }
8527 8527
 
8528
-            $return .=  $item['title'] . '</label>';
8528
+            $return .= $item['title'].'</label>';
8529 8529
             $return .= '</td>';
8530 8530
 
8531 8531
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8539,19 +8539,19 @@  discard block
 block discarded – undo
8539 8539
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8540 8540
 
8541 8541
                 $return .= '<td class="exercise">';
8542
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8542
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8543 8543
                 $return .= '</td>';
8544 8544
                 $return .= '<td class="exercise">';
8545
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8545
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8546 8546
                 $return .= '</td>';
8547 8547
             }
8548 8548
 
8549 8549
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8550 8550
                 $return .= '<td class="exercise">';
8551
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8551
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8552 8552
                 $return .= '</td>';
8553 8553
                 $return .= '<td class="exercise"">';
8554
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8554
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8555 8555
                 $return .= '</td>';
8556 8556
             }
8557 8557
             $return .= '</tr>';
@@ -8560,7 +8560,7 @@  discard block
 block discarded – undo
8560 8560
         $return .= '</tr>';
8561 8561
         $return .= '</table>';
8562 8562
         $return .= '<div style="padding-top:3px;">';
8563
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8563
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8564 8564
         $return .= '</form>';
8565 8565
 
8566 8566
         return $return;
@@ -8596,7 +8596,7 @@  discard block
 block discarded – undo
8596 8596
                 if ($row['id'] == $lp_id) {
8597 8597
                     continue;
8598 8598
                 }
8599
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8599
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8600 8600
             }
8601 8601
         }
8602 8602
         $return .= '</select>';
@@ -8656,8 +8656,8 @@  discard block
 block discarded – undo
8656 8656
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8657 8657
                      ORDER BY title ASC";
8658 8658
 
8659
-        $sql_hot  = "SELECT * FROM $tbl_doc
8660
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8659
+        $sql_hot = "SELECT * FROM $tbl_doc
8660
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8661 8661
                      ORDER BY id ASC";
8662 8662
 
8663 8663
         $res_quiz = Database::query($sql_quiz);
@@ -8666,8 +8666,8 @@  discard block
 block discarded – undo
8666 8666
         $return = '<ul class="lp_resource">';
8667 8667
         $return .= '<li class="lp_resource_element">';
8668 8668
         $return .= Display::return_icon('new_test_small.gif');
8669
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8670
-            get_lang('NewExercise') . '</a>';
8669
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8670
+            get_lang('NewExercise').'</a>';
8671 8671
         $return .= '</li>';
8672 8672
 
8673 8673
         // Display hotpotatoes
@@ -8679,8 +8679,8 @@  discard block
 block discarded – undo
8679 8679
             $return .= '</a> ';
8680 8680
 
8681 8681
             $return .= Display::return_icon('hotpotatoes_s.png');
8682
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8683
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8682
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8683
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8684 8684
             $return .= '</li>';
8685 8685
         }
8686 8686
 
@@ -8690,7 +8690,7 @@  discard block
 block discarded – undo
8690 8690
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8691 8691
             $return .= '</a> ';
8692 8692
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8693
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8693
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8694 8694
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8695 8695
                 '</a>';
8696 8696
             $return .= '</li>';
@@ -8764,7 +8764,7 @@  discard block
 block discarded – undo
8764 8764
         foreach ($categorizedLinks as $categoryId => $links) {
8765 8765
             $linkNodes = null;
8766 8766
             foreach ($links as $key => $title) {
8767
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8767
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8768 8768
                     $linkNodes .=
8769 8769
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8770 8770
                         <a class="moved" href="#">'.
@@ -8802,7 +8802,7 @@  discard block
 block discarded – undo
8802 8802
         $return = '<div class="lp_resource" >';
8803 8803
         $return .= '<div class="lp_resource_element">';
8804 8804
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8805
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8805
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8806 8806
         $return .= '</div>';
8807 8807
         $return .= '</div>';
8808 8808
         return $return;
@@ -8825,7 +8825,7 @@  discard block
 block discarded – undo
8825 8825
         $return .= Display::return_icon('forum_new_small.gif');
8826 8826
         $return .= Display::url(
8827 8827
             get_lang('CreateANewForum'),
8828
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8828
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8829 8829
                 'action' => 'add',
8830 8830
                 'content' => 'forum',
8831 8831
                 'lp_id' => $this->lp_id
@@ -8853,15 +8853,15 @@  discard block
 block discarded – undo
8853 8853
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8854 8854
                 $return .= ' </a>';
8855 8855
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8856
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8857
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8856
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8857
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8858 8858
                             </a>
8859
-                            <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">' .
8860
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8859
+                            <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">'.
8860
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8861 8861
 
8862 8862
                 $return .= '</li>';
8863 8863
 
8864
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8864
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8865 8865
                 $a_threads = get_threads($forum['forum_id']);
8866 8866
                 if (is_array($a_threads)) {
8867 8867
                     foreach ($a_threads as $thread) {
@@ -8870,8 +8870,8 @@  discard block
 block discarded – undo
8870 8870
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8871 8871
                         $return .= ' </a>';
8872 8872
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8873
-                        $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 . '">' .
8874
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8873
+                        $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.'">'.
8874
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8875 8875
                         $return .= '</li>';
8876 8876
                     }
8877 8877
                 }
@@ -8942,7 +8942,7 @@  discard block
 block discarded – undo
8942 8942
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8943 8943
             // Remove the possible . at the end of the path.
8944 8944
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8945
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8945
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8946 8946
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8947 8947
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8948 8948
         }
@@ -9010,7 +9010,7 @@  discard block
 block discarded – undo
9010 9010
                 if ($item->type == 'sco') {
9011 9011
                     $inc_docs = $item->get_resources_from_source(
9012 9012
                         null,
9013
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9013
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9014 9014
                     );
9015 9015
                 } else {
9016 9016
                     $inc_docs = $item->get_resources_from_source();
@@ -9226,7 +9226,7 @@  discard block
 block discarded – undo
9226 9226
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9227 9227
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9228 9228
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9229
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9229
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9230 9230
                                         $my_dep->setAttribute('xml:base', '');
9231 9231
                                     }
9232 9232
                                 }
@@ -9357,7 +9357,7 @@  discard block
 block discarded – undo
9357 9357
                         //$my_item->appendChild($my_max_score);
9358 9358
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9359 9359
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9360
-                        $my_prereqs->setAttribute('type','aicc_script');
9360
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9361 9361
                         $my_item->appendChild($my_prereqs);
9362 9362
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9363 9363
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9410,7 +9410,7 @@  discard block
 block discarded – undo
9410 9410
                         $my_resource->appendChild($my_file);
9411 9411
 
9412 9412
                         // Get included docs.
9413
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9413
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9414 9414
                         // Dependency to other files - not yet supported.
9415 9415
                         $i = 1;
9416 9416
                         foreach ($inc_docs as $doc_info) {
@@ -9471,7 +9471,7 @@  discard block
 block discarded – undo
9471 9471
                                         $my_dep_file->setAttribute('href', $file_path);
9472 9472
                                         $my_dep->setAttribute('xml:base', '');
9473 9473
 
9474
-                                        if (strstr($file_path,$main_path) !== false) {
9474
+                                        if (strstr($file_path, $main_path) !== false) {
9475 9475
                                             // The calculated real path is really inside the chamilo root path.
9476 9476
                                             // Reduce file path to what's under the DocumentRoot.
9477 9477
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9489,7 +9489,7 @@  discard block
 block discarded – undo
9489 9489
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9490 9490
                                             $file_path = str_replace('//', '/', $file_path);
9491 9491
                                             if (file_exists($file_path)) {
9492
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9492
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9493 9493
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9494 9494
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9495 9495
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9718,7 +9718,7 @@  discard block
 block discarded – undo
9718 9718
             if (strpos($extra_file, '.') === 0)
9719 9719
                 continue;
9720 9720
             else {
9721
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9721
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9722 9722
                 $this->create_path($dest_file);
9723 9723
                 copy($main_code_path.$extra_file, $dest_file);
9724 9724
             }
@@ -9771,7 +9771,7 @@  discard block
 block discarded – undo
9771 9771
                             }
9772 9772
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9773 9773
                             if (file_exists($file_path)) {
9774
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9774
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9775 9775
                             }
9776 9776
                             break;
9777 9777
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9811,12 +9811,12 @@  discard block
 block discarded – undo
9811 9811
 
9812 9812
         foreach ($path_bits as $bit) {
9813 9813
             if (!empty ($bit)) {
9814
-                $new_path = $path_built . $bit;
9814
+                $new_path = $path_built.$bit;
9815 9815
                 if (is_dir($new_path)) {
9816
-                    $path_built = $new_path . '/';
9816
+                    $path_built = $new_path.'/';
9817 9817
                 } else {
9818 9818
                     mkdir($new_path, api_get_permissions_for_new_directories());
9819
-                    $path_built = $new_path . '/';
9819
+                    $path_built = $new_path.'/';
9820 9820
                 }
9821 9821
             }
9822 9822
         }
@@ -9860,9 +9860,9 @@  discard block
 block discarded – undo
9860 9860
 
9861 9861
         if ($upload_ok) {
9862 9862
             if ($has_attachment) {
9863
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9863
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9864 9864
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9865
-                $updir = $sys_course_path . $courseDir;
9865
+                $updir = $sys_course_path.$courseDir;
9866 9866
                 // Try to add an extension to the file if it hasn't one.
9867 9867
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9868 9868
 
@@ -9917,7 +9917,7 @@  discard block
 block discarded – undo
9917 9917
             //Setting my lp_id to autolaunch = 1
9918 9918
             $attributes['autolaunch'] = 1;
9919 9919
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9920
-            Database::update($lp_table, $attributes, $where );
9920
+            Database::update($lp_table, $attributes, $where);
9921 9921
         }
9922 9922
     }
9923 9923
 
@@ -9936,13 +9936,13 @@  discard block
 block discarded – undo
9936 9936
 
9937 9937
         // Get the max order of the items
9938 9938
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9939
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9939
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9940 9940
         $rs_max_order = Database::query($sql_max_order);
9941 9941
         $row_max_order = Database::fetch_object($rs_max_order);
9942 9942
         $max_order = $row_max_order->display_order;
9943 9943
         // Get the previous item ID
9944 9944
         $sql = "SELECT id as previous FROM $table_lp_item
9945
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9945
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9946 9946
         $rs_max = Database::query($sql);
9947 9947
         $row_max = Database::fetch_object($rs_max);
9948 9948
 
@@ -9998,9 +9998,9 @@  discard block
 block discarded – undo
9998 9998
         $documents_total_space = DocumentManager::documents_total_space();
9999 9999
         $course_max_space = DocumentManager::get_course_quota();
10000 10000
         $total_size = filesize($s) + $documents_total_space;
10001
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10001
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10002 10002
             return true;
10003
-        } else{
10003
+        } else {
10004 10004
             return false;
10005 10005
         }
10006 10006
     }
@@ -10340,7 +10340,7 @@  discard block
 block discarded – undo
10340 10340
         if ($this->debug > 0) {
10341 10341
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10342 10342
         }
10343
-        $this->subscribeUsers = intval($value);;
10343
+        $this->subscribeUsers = intval($value); ;
10344 10344
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10345 10345
         $lp_id = $this->get_id();
10346 10346
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10686,7 +10686,7 @@  discard block
 block discarded – undo
10686 10686
      */
10687 10687
     public function createForum($forumCategoryId)
10688 10688
     {
10689
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10689
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10690 10690
 
10691 10691
         $forumId = store_forum(
10692 10692
             [
@@ -10727,7 +10727,7 @@  discard block
 block discarded – undo
10727 10727
         $finalItem = $this->getFinalItem();
10728 10728
 
10729 10729
         if (!$finalItem) {
10730
-            return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html');
10730
+            return file_get_contents(api_get_path(SYS_CODE_PATH).'newscorm/final_item_template/template.html');
10731 10731
         }
10732 10732
 
10733 10733
         $doc = DocumentManager::get_document_data_by_id($finalItem->path, $this->cc);
@@ -10761,11 +10761,11 @@  discard block
 block discarded – undo
10761 10761
             'Height' => '500',
10762 10762
             'FullPage' => true,
10763 10763
             'CreateDocumentDir' => $relative_prefix,
10764
-            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
10765
-            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
10764
+            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
10765
+            'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
10766 10766
         ];
10767 10767
 
10768
-        $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
10768
+        $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
10769 10769
             'type' => 'document',
10770 10770
             'lp_id' => $this->lp_id
10771 10771
         ]);
Please login to merge, or discard this patch.