Passed
Push — 1.10.x ( 615a12...380db0 )
by Angel Fernando Quiroz
53:36
created
main/newscorm/lp_add.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     Course admin section
69 69
     - all the functions not available for students - always available in this case (page only shown to admin)
70 70
 */
71
-if (isset($_SESSION['gradebook'])){
71
+if (isset($_SESSION['gradebook'])) {
72 72
     $gradebook = $_SESSION['gradebook'];
73 73
 }
74 74
 
75
-if (!empty($gradebook) && $gradebook=='view') {
76
-    $interbreadcrumb[]= array (
75
+if (!empty($gradebook) && $gradebook == 'view') {
76
+    $interbreadcrumb[] = array(
77 77
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
78 78
         'name' => get_lang('ToolGradebook')
79 79
     );
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 echo '<div class="actions">';
87 87
 echo '<a href="lp_controller.php?cidReq='.$_course['sysCode'].'">'.
88
-        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
88
+        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
89 89
 echo '</div>';
90 90
 
91 91
 Display::display_normal_message(get_lang('AddLpIntro'), false);
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
 
120 120
 // Start date
121 121
 $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
122
-$form->addElement('html','<div id="start_date_div" style="display:block;">');
122
+$form->addElement('html', '<div id="start_date_div" style="display:block;">');
123 123
 $form->addElement('DatePicker', 'publicated_on', get_lang('PublicationDate'));
124
-$form->addElement('html','</div>');
124
+$form->addElement('html', '</div>');
125 125
 
126 126
 //End date
127 127
 $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
128
-$form->addElement('html','<div id="end_date_div" style="display:none;">');
128
+$form->addElement('html', '<div id="end_date_div" style="display:none;">');
129 129
 $form->addElement('DatePicker', 'expired_on', get_lang('ExpirationDate'));
130
-$form->addElement('html','</div>');
130
+$form->addElement('html', '</div>');
131 131
 
132
-$form->addElement('html','</div>');
132
+$form->addElement('html', '</div>');
133 133
 
134
-$defaults['activate_start_date_check']  = 1;
134
+$defaults['activate_start_date_check'] = 1;
135 135
 
136 136
 $defaults['publicated_on'] = date('Y-m-d 08:00:00');
137
-$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400);
137
+$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400);
138 138
 
139 139
 $form->setDefaults($defaults);
140 140
 $form->addButtonCreate(get_lang('CreateLearningPath'));
Please login to merge, or discard this patch.
main/newscorm/audiorecorder.inc.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@
 block discarded – undo
58 58
 if (!empty($path_to_lzx)) {
59 59
     $recorder_content = sprintf("<object type=\"application/x-shockwave-flash\" data=\"%s\" ".
60 60
             "width='$width' height='$height'>".
61
-             "<param name=\"movie\" value=\"%s\">".
62
-         "<param name=\"quality\" value=\"high\">".
63
-         "<param name=\"scale\" value=\"noscale\">".
64
-         "<param name=\"salign\" value=\"LT\">".
65
-         "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
61
+                "<param name=\"movie\" value=\"%s\">".
62
+            "<param name=\"quality\" value=\"high\">".
63
+            "<param name=\"scale\" value=\"noscale\">".
64
+            "<param name=\"salign\" value=\"LT\">".
65
+            "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
66 66
     if ($audio_recorder_studentview == 'false') {
67 67
         echo '<script type="text/javascript">
68 68
         function show_audiorecorder() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 if ($audio_recorder_studentview == 'false') {
32 32
     $width = 295;
33
-    $height= 90;
33
+    $height = 90;
34 34
     $player = 'recorder2.swf';
35 35
     $server = (api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? 'rtmpt://' : 'rtmp://').api_get_setting('service_visio', 'visio_host').':'.(api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? '80' : api_get_setting('service_visio', 'visio_port')).'/recorder';
36 36
     $post_uri = urlencode($web_path.'conference/audiopost.php?course_code='.api_get_course_id().'&user_id='.api_get_user_id().'&checker='.md5(api_get_course_id().api_get_user_id().gmdate('Ymd').$_configuration['security_key']));
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $player = 'player2.swf';
43 43
     $cp = api_get_course_path();
44 44
     $docs = Database::get_course_table(TABLE_DOCUMENT);
45
-    $select = "SELECT * FROM $docs " .
46
-            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' " .
45
+    $select = "SELECT * FROM $docs ".
46
+            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' ".
47 47
             " ORDER BY path DESC";
48 48
     $res = Database::query($select);
49 49
     if (Database::num_rows($res) > 0) {
Please login to merge, or discard this patch.
main/newscorm/lp_add_item.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 $learnPath->get_js_dropdown_array() .
28 28
 
29 29
 'function load_cbo(id){' ."\n" .
30
-  'if (!id) {return false;}'.
31
-  'var cbo = document.getElementById(\'previous\');' .
32
-  'for(var i = cbo.length - 1; i > 0; i--) {' .
30
+    'if (!id) {return false;}'.
31
+    'var cbo = document.getElementById(\'previous\');' .
32
+    'for(var i = cbo.length - 1; i > 0; i--) {' .
33 33
     'cbo.options[i] = null;' .
34
-  '}' ."\n" .
35
-  'var k=0;' .
36
-  'for(var i = 1; i <= child_name[id].length; i++){' ."\n" .
37
-  '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);' ."\n" .
38
-  '  k=i;' ."\n" .
39
-  '}' ."\n" .
40
-  //'if( typeof cbo != "undefined" ) {'."\n" .
41
-  'cbo.options[k].selected = true;'."\n" .
42
-   //'}'."\n" .
43
-
44
-   '$(\'#previous\').selectpicker(\'refresh\');' .
34
+    '}' ."\n" .
35
+    'var k=0;' .
36
+    'for(var i = 1; i <= child_name[id].length; i++){' ."\n" .
37
+    '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);' ."\n" .
38
+    '  k=i;' ."\n" .
39
+    '}' ."\n" .
40
+    //'if( typeof cbo != "undefined" ) {'."\n" .
41
+    'cbo.options[k].selected = true;'."\n" .
42
+    //'}'."\n" .
43
+
44
+    '$(\'#previous\').selectpicker(\'refresh\');' .
45 45
 '}
46 46
 
47 47
 $(function() {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 // Using the resource linker as a tool for adding resources to the learning path.
75 75
 if ($action == 'add' && $type == 'learnpathitem') {
76
-     $htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
76
+        $htmlHeadXtra[] = "<script type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
77 77
 }
78 78
 if ((!$is_allowed_to_edit)) {
79 79
     error_log('New LP - User not authorized in lp_add_item.php');
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
 
25 25
 $htmlHeadXtra[] = '<script>'.
26 26
 
27
-$learnPath->get_js_dropdown_array() .
27
+$learnPath->get_js_dropdown_array().
28 28
 
29
-'function load_cbo(id){' ."\n" .
29
+'function load_cbo(id){'."\n".
30 30
   'if (!id) {return false;}'.
31
-  'var cbo = document.getElementById(\'previous\');' .
32
-  'for(var i = cbo.length - 1; i > 0; i--) {' .
33
-    'cbo.options[i] = null;' .
34
-  '}' ."\n" .
35
-  'var k=0;' .
36
-  'for(var i = 1; i <= child_name[id].length; i++){' ."\n" .
37
-  '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);' ."\n" .
38
-  '  k=i;' ."\n" .
39
-  '}' ."\n" .
31
+  'var cbo = document.getElementById(\'previous\');'.
32
+  'for(var i = cbo.length - 1; i > 0; i--) {'.
33
+    'cbo.options[i] = null;'.
34
+  '}'."\n".
35
+  'var k=0;'.
36
+  'for(var i = 1; i <= child_name[id].length; i++){'."\n".
37
+  '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);'."\n".
38
+  '  k=i;'."\n".
39
+  '}'."\n".
40 40
   //'if( typeof cbo != "undefined" ) {'."\n" .
41
-  'cbo.options[k].selected = true;'."\n" .
41
+  'cbo.options[k].selected = true;'."\n".
42 42
    //'}'."\n" .
43 43
 
44
-   '$(\'#previous\').selectpicker(\'refresh\');' .
44
+   '$(\'#previous\').selectpicker(\'refresh\');'.
45 45
 '}
46 46
 
47 47
 $(function() {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 $isStudentView  = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null;
68 68
 $learnpath_id   = isset($_REQUEST['lp_id']) ? intval($_REQUEST['lp_id']) : null;
69
-$submit			= isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
69
+$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
70 70
 
71 71
 $type = isset($_GET['type']) ? $_GET['type'] : null;
72 72
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 }
88 88
 
89 89
 if (!empty($gradebook) && $gradebook == 'view') {
90
-    $interbreadcrumb[] = array (
90
+    $interbreadcrumb[] = array(
91 91
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
92 92
         'name' => get_lang('ToolGradebook')
93 93
     );
@@ -98,19 +98,19 @@  discard block
 block discarded – undo
98 98
 
99 99
 switch ($type) {
100 100
     case 'chapter':
101
-        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
102
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewChapter'));
101
+        $interbreadcrumb[] = array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
102
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewChapter'));
103 103
         break;
104 104
     case 'document':
105
-        $interbreadcrumb[]= array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
105
+        $interbreadcrumb[] = array('url' => 'lp_controller.php?action=add_item&type=step&lp_id='.$learnPath->get_id(), 'name' => get_lang('NewStep'));
106 106
         break;
107 107
     default:
108
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));
108
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep'));
109 109
         break;
110 110
 }
111 111
 
112
-if ($action == 'add_item' && $type == 'document' ) {
113
-    $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated'));
112
+if ($action == 'add_item' && $type == 'document') {
113
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated'));
114 114
 }
115 115
 
116 116
 // Theme calls.
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 3 patches
Braces   +167 added lines, -117 removed lines patch added patch discarded remove patch
@@ -3935,8 +3935,9 @@  discard block
 block discarded – undo
3935 3935
                 WHERE c_id = ".$course_id."
3936 3936
                 ORDER BY display_order";
3937 3937
         $res = Database::query($sql);
3938
-        if ($res === false)
3939
-            return false;
3938
+        if ($res === false) {
3939
+                    return false;
3940
+        }
3940 3941
         $lps = array ();
3941 3942
         $lp_order = array ();
3942 3943
         $num = Database :: num_rows($res);
@@ -4536,8 +4537,9 @@  discard block
 block discarded – undo
4536 4537
         if ($this->debug > 0) {
4537 4538
             error_log('New LP - In learnpath::set_maker()', 0);
4538 4539
         }
4539
-        if (empty ($name))
4540
-            return false;
4540
+        if (empty ($name)) {
4541
+                    return false;
4542
+        }
4541 4543
         $this->maker = $name;
4542 4544
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4543 4545
         $course_id = api_get_course_int_id();
@@ -4602,8 +4604,9 @@  discard block
 block discarded – undo
4602 4604
     public function set_terms_by_prefix($terms_string, $prefix)
4603 4605
     {
4604 4606
         $course_id = api_get_course_int_id();
4605
-        if (api_get_setting('search_enabled') !== 'true')
4606
-            return false;
4607
+        if (api_get_setting('search_enabled') !== 'true') {
4608
+                    return false;
4609
+        }
4607 4610
 
4608 4611
         if (!extension_loaded('xapian')) {
4609 4612
             return false;
@@ -4616,8 +4619,9 @@  discard block
 block discarded – undo
4616 4619
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4617 4620
 
4618 4621
         // Don't do anything if no change, verify only at DB, not the search engine.
4619
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4620
-            return false;
4622
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4623
+                    return false;
4624
+        }
4621 4625
 
4622 4626
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4623 4627
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4809,8 +4813,9 @@  discard block
 block discarded – undo
4809 4813
         if ($this->debug > 0) {
4810 4814
             error_log('New LP - In learnpath::set_proximity()', 0);
4811 4815
         }
4812
-        if (empty ($name))
4813
-            return false;
4816
+        if (empty ($name)) {
4817
+                    return false;
4818
+        }
4814 4819
 
4815 4820
         $this->proximity = $name;
4816 4821
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5152,8 +5157,9 @@  discard block
 block discarded – undo
5152 5157
 
5153 5158
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5154 5159
         $res = Database::query($sql);
5155
-        if ($res === false)
5156
-            return false;
5160
+        if ($res === false) {
5161
+                    return false;
5162
+        }
5157 5163
 
5158 5164
         $num = Database :: num_rows($res);
5159 5165
         // First check the order is correct, globally (might be wrong because
@@ -5464,8 +5470,9 @@  discard block
 block discarded – undo
5464 5470
             $position[$key] = $row['display_order'];
5465 5471
         }
5466 5472
 
5467
-        if (count($array) > 0)
5468
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5473
+        if (count($array) > 0) {
5474
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5475
+        }
5469 5476
 
5470 5477
         return $array;
5471 5478
     }
@@ -6021,8 +6028,9 @@  discard block
 block discarded – undo
6021 6028
         $tmp_filename = $filename;
6022 6029
 
6023 6030
         $i = 0;
6024
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6025
-            $tmp_filename = $filename . '_' . ++ $i;
6031
+        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6032
+                    $tmp_filename = $filename . '_' . ++ $i;
6033
+        }
6026 6034
 
6027 6035
         $filename = $tmp_filename . '.'.$extension;
6028 6036
         if ($extension == 'html') {
@@ -6095,10 +6103,12 @@  discard block
 block discarded – undo
6095 6103
                     if ($new_comment || $new_title) {
6096 6104
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6097 6105
                         $ct = '';
6098
-                        if ($new_comment)
6099
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6100
-                        if ($new_title)
6101
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6106
+                        if ($new_comment) {
6107
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6108
+                        }
6109
+                        if ($new_title) {
6110
+                                                    $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6111
+                        }
6102 6112
 
6103 6113
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6104 6114
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6122,17 +6132,21 @@  discard block
 block discarded – undo
6122 6132
         // Please, do not modify this dirname formatting.
6123 6133
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6124 6134
 
6125
-        if (strstr($dir, '..'))
6126
-            $dir = '/';
6135
+        if (strstr($dir, '..')) {
6136
+                    $dir = '/';
6137
+        }
6127 6138
 
6128
-        if ($dir[0] == '.')
6129
-            $dir = substr($dir, 1);
6139
+        if ($dir[0] == '.') {
6140
+                    $dir = substr($dir, 1);
6141
+        }
6130 6142
 
6131
-        if ($dir[0] != '/')
6132
-            $dir = '/' . $dir;
6143
+        if ($dir[0] != '/') {
6144
+                    $dir = '/' . $dir;
6145
+        }
6133 6146
 
6134
-        if ($dir[strlen($dir) - 1] != '/')
6135
-            $dir .= '/';
6147
+        if ($dir[strlen($dir) - 1] != '/') {
6148
+                    $dir .= '/';
6149
+        }
6136 6150
 
6137 6151
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6138 6152
 
@@ -6198,8 +6212,9 @@  discard block
 block discarded – undo
6198 6212
                 }
6199 6213
                 $return .= '<div style="padding:10px;">';
6200 6214
 
6201
-                if ($msg != '')
6202
-                    $return .= $msg;
6215
+                if ($msg != '') {
6216
+                                    $return .= $msg;
6217
+                }
6203 6218
 
6204 6219
                 $return .= '<h3>'.$row['title'].'</h3>';
6205 6220
                 switch ($row['item_type']) {
@@ -6446,10 +6461,11 @@  discard block
 block discarded – undo
6446 6461
         $item_description 	= Security::remove_XSS($item_description);
6447 6462
 
6448 6463
         $legend = '<legend>';
6449
-        if ($id != 0 && is_array($extra_info))
6450
-            $parent = $extra_info['parent_item_id'];
6451
-        else
6452
-            $parent = 0;
6464
+        if ($id != 0 && is_array($extra_info)) {
6465
+                    $parent = $extra_info['parent_item_id'];
6466
+        } else {
6467
+                    $parent = 0;
6468
+        }
6453 6469
 
6454 6470
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6455 6471
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6527,8 +6543,9 @@  discard block
 block discarded – undo
6527 6543
                     $arrHide[] = $arrLP[$i]['id'];
6528 6544
                 }
6529 6545
             } else {
6530
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6531
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
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>';
6548
+                }
6532 6549
             }
6533 6550
         }
6534 6551
         if (is_array($arrLP)) {
@@ -6717,11 +6734,13 @@  discard block
 block discarded – undo
6717 6734
         }
6718 6735
 
6719 6736
         $legend = '<legend>';
6720
-        if ($action == 'add')
6721
-            $legend .= get_lang('CreateTheExercise');
6722
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6723
-        else
6724
-            $legend .= get_lang('EditCurrentExecice');
6737
+        if ($action == 'add') {
6738
+                    $legend .= get_lang('CreateTheExercise');
6739
+        } elseif ($action == 'move') {
6740
+            $legend .= get_lang('MoveTheCurrentExercise');
6741
+        } else {
6742
+                    $legend .= get_lang('EditCurrentExecice');
6743
+        }
6725 6744
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6726 6745
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6727 6746
         }
@@ -6748,8 +6767,9 @@  discard block
 block discarded – undo
6748 6767
                         $arrHide[] = $arrLP[$i]['id'];
6749 6768
                     }
6750 6769
                 } else {
6751
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6752
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6770
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6771
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6772
+                    }
6753 6773
                 }
6754 6774
             }
6755 6775
 
@@ -6767,11 +6787,13 @@  discard block
 block discarded – undo
6767 6787
 
6768 6788
         for ($i = 0; $i < count($arrLP); $i++) {
6769 6789
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6770
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6790
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6791
+                                    $selected = 'selected="selected" ';
6792
+                } elseif ($action == 'add') {
6771 6793
                     $selected = 'selected="selected" ';
6772
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6773
-                else
6774
-                    $selected = '';
6794
+                } else {
6795
+                                    $selected = '';
6796
+                }
6775 6797
 
6776 6798
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6777 6799
             }
@@ -6798,9 +6820,11 @@  discard block
 block discarded – undo
6798 6820
                 $arrHide = array ();
6799 6821
                 for ($i = 0; $i < count($arrLP); $i++) {
6800 6822
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6801
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6802
-                            $s_selected_position = $arrLP[$i]['id'];
6803
-                        elseif ($action == 'add') $s_selected_position = 0;
6823
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6824
+                                                    $s_selected_position = $arrLP[$i]['id'];
6825
+                        } elseif ($action == 'add') {
6826
+                            $s_selected_position = 0;
6827
+                        }
6804 6828
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6805 6829
 
6806 6830
                     }
@@ -6897,11 +6921,13 @@  discard block
 block discarded – undo
6897 6921
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6898 6922
         unset($this->arrMenu);
6899 6923
 
6900
-        if ($action == 'add')
6901
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6902
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6903
-        else
6904
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6924
+        if ($action == 'add') {
6925
+                    $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6926
+        } elseif ($action == 'move') {
6927
+            $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6928
+        } else {
6929
+                    $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6930
+        }
6905 6931
 
6906 6932
         $legend .= '</legend>';
6907 6933
         $return = '<div class="sectioncomment">';
@@ -6934,8 +6960,9 @@  discard block
 block discarded – undo
6934 6960
                     $arrHide[] = $arrLP[$i]['id'];
6935 6961
                 }
6936 6962
             } else {
6937
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6938
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6963
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6964
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6965
+                }
6939 6966
             }
6940 6967
         }
6941 6968
         if (is_array($arrLP)) {
@@ -6953,11 +6980,13 @@  discard block
 block discarded – undo
6953 6980
 
6954 6981
         for ($i = 0; $i < count($arrLP); $i++) {
6955 6982
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6956
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6983
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6984
+                                    $selected = 'selected="selected" ';
6985
+                } elseif ($action == 'add') {
6957 6986
                     $selected = 'selected="selected" ';
6958
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6959
-                else
6960
-                    $selected = '';
6987
+                } else {
6988
+                                    $selected = '';
6989
+                }
6961 6990
 
6962 6991
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6963 6992
                     get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
@@ -6983,9 +7012,11 @@  discard block
 block discarded – undo
6983 7012
             $arrHide = array();
6984 7013
             for ($i = 0; $i < count($arrLP); $i++) {
6985 7014
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6986
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6987
-                        $s_selected_position = $arrLP[$i]['id'];
6988
-                    elseif ($action == 'add') $s_selected_position = 0;
7015
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7016
+                                            $s_selected_position = $arrLP[$i]['id'];
7017
+                    } elseif ($action == 'add') {
7018
+                        $s_selected_position = 0;
7019
+                    }
6989 7020
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6990 7021
                 }
6991 7022
             }
@@ -7089,11 +7120,13 @@  discard block
 block discarded – undo
7089 7120
         unset ($this->arrMenu);
7090 7121
 
7091 7122
         $return .= '<form method="POST">';
7092
-        if ($action == 'add')
7093
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7094
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7095
-        else
7096
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7123
+        if ($action == 'add') {
7124
+                    $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7125
+        } elseif ($action == 'move') {
7126
+            $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7127
+        } else {
7128
+                    $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7129
+        }
7097 7130
 
7098 7131
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7099 7132
         $return .= '<tr>';
@@ -7113,8 +7146,9 @@  discard block
 block discarded – undo
7113 7146
                     $arrHide[] = $arrLP[$i]['id'];
7114 7147
                 }
7115 7148
             } else {
7116
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7117
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7149
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7150
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7151
+                }
7118 7152
             }
7119 7153
         }
7120 7154
 
@@ -7132,11 +7166,13 @@  discard block
 block discarded – undo
7132 7166
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7133 7167
         for ($i = 0; $i < count($arrLP); $i++) {
7134 7168
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7135
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7170
+                                    $selected = 'selected="selected" ';
7171
+                } elseif ($action == 'add') {
7136 7172
                     $selected = 'selected="selected" ';
7137
-                elseif ($action == 'add') $selected = 'selected="selected" ';
7138
-                else
7139
-                    $selected = '';
7173
+                } else {
7174
+                                    $selected = '';
7175
+                }
7140 7176
 
7141 7177
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7142 7178
             }
@@ -7165,9 +7201,11 @@  discard block
 block discarded – undo
7165 7201
             $arrHide = array();
7166 7202
             for ($i = 0; $i < count($arrLP); $i++) {
7167 7203
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7168
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
-                        $s_selected_position = $arrLP[$i]['id'];
7170
-                    elseif ($action == 'add') $s_selected_position = 0;
7204
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7205
+                                            $s_selected_position = $arrLP[$i]['id'];
7206
+                    } elseif ($action == 'add') {
7207
+                        $s_selected_position = 0;
7208
+                    }
7171 7209
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7172 7210
 
7173 7211
                 }
@@ -7180,8 +7218,7 @@  discard block
 block discarded – undo
7180 7218
             foreach ($arrHide as $key => $value) {
7181 7219
                 if ($key == $s_selected_position && $action == 'add') {
7182 7220
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7183
-                }
7184
-                elseif ($key == $id_prerequisite && $action == 'edit') {
7221
+                } elseif ($key == $id_prerequisite && $action == 'edit') {
7185 7222
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7186 7223
                 } else {
7187 7224
                     $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
@@ -7204,8 +7241,7 @@  discard block
 block discarded – undo
7204 7241
 
7205 7242
         if (is_numeric($extra_info)) {
7206 7243
             $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7207
-        }
7208
-        elseif (is_array($extra_info)) {
7244
+        } elseif (is_array($extra_info)) {
7209 7245
             $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7210 7246
         }
7211 7247
 
@@ -7259,8 +7295,9 @@  discard block
 block discarded – undo
7259 7295
                     lp_id = " . $this->lp_id . " AND
7260 7296
                     id != $id";
7261 7297
 
7262
-        if ($item_type == 'module')
7263
-            $sql .= " AND parent_item_id = 0";
7298
+        if ($item_type == 'module') {
7299
+                    $sql .= " AND parent_item_id = 0";
7300
+        }
7264 7301
 
7265 7302
         $result = Database::query($sql);
7266 7303
         $arrLP = array ();
@@ -7610,9 +7647,11 @@  discard block
 block discarded – undo
7610 7647
         //POSITION
7611 7648
         for ($i = 0; $i < count($arrLP); $i++) {
7612 7649
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7613
-                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7650
+                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7651
+                                    $s_selected_position = $arrLP[$i]['id'];
7652
+                } elseif ($action == 'add') {
7614 7653
                     $s_selected_position = $arrLP[$i]['id'];
7615
-                elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7654
+                }
7616 7655
                 $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7617 7656
             }
7618 7657
         }
@@ -7645,9 +7684,11 @@  discard block
 block discarded – undo
7645 7684
 
7646 7685
             for ($i = 0; $i < count($arrLP); $i++) {
7647 7686
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7648
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7687
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7688
+                                            $s_selected_position = $arrLP[$i]['id'];
7689
+                    } elseif ($action == 'add') {
7649 7690
                         $s_selected_position = $arrLP[$i]['id'];
7650
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7691
+                    }
7651 7692
 
7652 7693
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7653 7694
 
@@ -7658,17 +7699,18 @@  discard block
 block discarded – undo
7658 7699
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7659 7700
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7660 7701
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) {
7661
-                    if (isset ($_POST['content']))
7662
-                        $content = stripslashes($_POST['content']);
7663
-                    elseif (is_array($extra_info)) {
7702
+                    if (isset ($_POST['content'])) {
7703
+                                            $content = stripslashes($_POST['content']);
7704
+                    } elseif (is_array($extra_info)) {
7664 7705
                         //If it's an html document or a text file
7665 7706
                         if (!$no_display_edit_textarea) {
7666 7707
                             $content = $this->display_document($extra_info['path'], false, false);
7667 7708
                         }
7668
-                    } elseif (is_numeric($extra_info))
7669
-                        $content = $this->display_document($extra_info, false, false);
7670
-                    else
7671
-                        $content = '';
7709
+                    } elseif (is_numeric($extra_info)) {
7710
+                                            $content = $this->display_document($extra_info, false, false);
7711
+                    } else {
7712
+                                            $content = '';
7713
+                    }
7672 7714
 
7673 7715
                     if (!$no_display_edit_textarea) {
7674 7716
                         // We need to calculate here some specific settings for the online editor.
@@ -7822,11 +7864,13 @@  discard block
 block discarded – undo
7822 7864
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7823 7865
         unset ($this->arrMenu);
7824 7866
 
7825
-        if ($action == 'add')
7826
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7827
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7828
-        else
7829
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7867
+        if ($action == 'add') {
7868
+                    $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7869
+        } elseif ($action == 'move') {
7870
+            $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7871
+        } else {
7872
+                    $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7873
+        }
7830 7874
 
7831 7875
         $legend .= '</legend>';
7832 7876
 
@@ -7861,8 +7905,9 @@  discard block
 block discarded – undo
7861 7905
                     $arrHide[] = $arrLP[$i]['id'];
7862 7906
                 }
7863 7907
             } else {
7864
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7865
-                    $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>';
7908
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7909
+                                    $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>';
7910
+                }
7866 7911
             }
7867 7912
         }
7868 7913
 
@@ -7881,12 +7926,13 @@  discard block
 block discarded – undo
7881 7926
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7882 7927
         for ($i = 0; $i < count($arrLP); $i++) {
7883 7928
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7884
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7885
-                    $selected = 'selected="selected" ';
7886
-                elseif ($action == 'add')
7887
-                    $selected = 'selected="selected" ';
7888
-                else
7889
-                    $selected = '';
7929
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7930
+                                    $selected = 'selected="selected" ';
7931
+                } elseif ($action == 'add') {
7932
+                                    $selected = 'selected="selected" ';
7933
+                } else {
7934
+                                    $selected = '';
7935
+                }
7890 7936
 
7891 7937
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7892 7938
             }
@@ -7913,9 +7959,11 @@  discard block
 block discarded – undo
7913 7959
             $arrHide = array();
7914 7960
             for ($i = 0; $i < count($arrLP); $i++) {
7915 7961
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7916
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7917
-                        $s_selected_position = $arrLP[$i]['id'];
7918
-                    elseif ($action == 'add') $s_selected_position = 0;
7962
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7963
+                                            $s_selected_position = $arrLP[$i]['id'];
7964
+                    } elseif ($action == 'add') {
7965
+                        $s_selected_position = 0;
7966
+                    }
7919 7967
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7920 7968
 
7921 7969
                 }
@@ -8122,9 +8170,11 @@  discard block
 block discarded – undo
8122 8170
             $arrHide = array ();
8123 8171
             for ($i = 0; $i < count($arrLP); $i++) {
8124 8172
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8125
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8126
-                        $s_selected_position = $arrLP[$i]['id'];
8127
-                    elseif ($action == 'add') $s_selected_position = 0;
8173
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8174
+                                            $s_selected_position = $arrLP[$i]['id'];
8175
+                    } elseif ($action == 'add') {
8176
+                        $s_selected_position = 0;
8177
+                    }
8128 8178
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8129 8179
 
8130 8180
                 }
@@ -9683,9 +9733,9 @@  discard block
 block discarded – undo
9683 9733
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9684 9734
         $extra_files = scandir($main_code_path);
9685 9735
         foreach ($extra_files as $extra_file) {
9686
-            if (strpos($extra_file, '.') === 0)
9687
-                continue;
9688
-            else {
9736
+            if (strpos($extra_file, '.') === 0) {
9737
+                            continue;
9738
+            } else {
9689 9739
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9690 9740
                 $this->create_path($dest_file);
9691 9741
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.
Spacing   +683 added lines, -683 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $res = Database::query($sql);
245 245
 
246 246
         if ($this->debug > 2) {
247
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
247
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
248 248
             error_log('-- Start while--', 0);
249 249
         }
250 250
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                         $this->refs_list[$oItem->ref] = $my_item_id;
265 265
                         if ($this->debug > 2) {
266 266
                             error_log(
267
-                                'New LP - learnpath::__construct() - ' .
268
-                                'aicc object with id ' . $my_item_id .
267
+                                'New LP - learnpath::__construct() - '.
268
+                                'aicc object with id '.$my_item_id.
269 269
                                 ' set in items[]',
270 270
                                 0
271 271
                             );
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 
285 285
                         $this->refs_list[$oItem->ref] = $my_item_id;
286 286
                         if ($this->debug > 2) {
287
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
287
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
288 288
                         }
289 289
                     }
290 290
                     break;
291 291
                 case 1:
292 292
                 default:
293 293
                     if ($this->debug > 2) {
294
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
294
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
295 295
                     }
296 296
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
297 297
 
298 298
                     if ($this->debug > 2) {
299
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
299
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
300 300
                     }
301 301
                     if (is_object($oItem)) {
302 302
                         $my_item_id = $oItem->get_id();
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
                         $this->refs_list[$my_item_id] = $my_item_id;
308 308
                         if ($this->debug > 2) {
309 309
                             error_log(
310
-                                'New LP - learnpath::__construct() ' . __LINE__ .
311
-                                ' - object with id ' . $my_item_id . ' set in items[]',
310
+                                'New LP - learnpath::__construct() '.__LINE__.
311
+                                ' - object with id '.$my_item_id.' set in items[]',
312 312
                                 0);
313 313
                         }
314 314
                     }
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
327 327
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
328 328
                     $this->items[$row['id']]->current_start_time = 0;
329
-                    $this->items[$row['id']]->current_stop_time	= 0;
329
+                    $this->items[$row['id']]->current_stop_time = 0;
330 330
                 }
331 331
             }
332 332
         }
333 333
 
334 334
         if ($this->debug > 2) {
335
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
335
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
336 336
         }
337 337
 
338 338
         if (!empty($lp_item_id_list)) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         // TODO: Define the current item better.
425 425
         $this->first();
426 426
         if ($this->debug > 2) {
427
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
427
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
428 428
         }
429 429
         return true;
430 430
     }
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     ) {
499 499
         $course_id = $this->course_info['real_id'];
500 500
         if ($this->debug > 0) {
501
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
501
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
502 502
         }
503 503
         if (empty($course_id)) {
504 504
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 FROM $tbl_lp_item
519 519
                 WHERE
520 520
                     c_id = $course_id AND
521
-                    lp_id = " . $this->get_id() . " AND
521
+                    lp_id = ".$this->get_id()." AND
522 522
                     parent_item_id = " . $parent;
523 523
 
524 524
         $res_count = Database::query($sql);
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
         if ($num > 0) {
529 529
             if ($previous == 0) {
530 530
                 $sql = "SELECT id, next_item_id, display_order
531
-                        FROM " . $tbl_lp_item . "
531
+                        FROM " . $tbl_lp_item."
532 532
                         WHERE
533 533
                             c_id = $course_id AND
534
-                            lp_id = " . $this->get_id() . " AND
535
-                            parent_item_id = " . $parent . " AND
534
+                            lp_id = ".$this->get_id()." AND
535
+                            parent_item_id = " . $parent." AND
536 536
                             previous_item_id = 0 OR
537 537
                             previous_item_id=" . $parent;
538 538
                 $result = Database::query($sql);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 						FROM $tbl_lp_item
548 548
                         WHERE
549 549
                             c_id = $course_id AND
550
-                            lp_id = " . $this->get_id() . " AND
550
+                            lp_id = ".$this->get_id()." AND
551 551
                             id = " . $previous;
552 552
 
553 553
                 $result = Database::query($sql);
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
         $typeCleaned = Database::escape_string($type);
568 568
         if ($type == 'quiz') {
569 569
             $sql = 'SELECT SUM(ponderation)
570
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
571
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
570
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
571
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
572 572
                     ON
573 573
                         quiz_question.id = quiz_rel_question.question_id AND
574 574
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         $new_item_id = Database::insert($tbl_lp_item, $params);
615 615
 
616 616
         if ($this->debug > 2) {
617
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
617
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
618 618
         }
619 619
 
620 620
         if ($new_item_id) {
@@ -631,28 +631,28 @@  discard block
 block discarded – undo
631 631
             Database::query($sql);
632 632
 
633 633
             // Update all the items after the new item.
634
-            $sql = "UPDATE " . $tbl_lp_item . "
634
+            $sql = "UPDATE ".$tbl_lp_item."
635 635
                         SET display_order = display_order + 1
636 636
                     WHERE
637 637
                         c_id = $course_id AND
638
-                        lp_id = " . $this->get_id() . " AND
639
-                        id <> " . $new_item_id . " AND
640
-                        parent_item_id = " . $parent . " AND
638
+                        lp_id = ".$this->get_id()." AND
639
+                        id <> " . $new_item_id." AND
640
+                        parent_item_id = " . $parent." AND
641 641
                         display_order > " . $display_order;
642 642
             Database::query($sql);
643 643
 
644 644
             // Update the item that should come after the new item.
645
-            $sql = "UPDATE " . $tbl_lp_item . "
646
-                    SET ref = " . $new_item_id . "
647
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
645
+            $sql = "UPDATE ".$tbl_lp_item."
646
+                    SET ref = " . $new_item_id."
647
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
648 648
             Database::query($sql);
649 649
 
650 650
             // Upload audio.
651 651
             if (!empty($_FILES['mp3']['name'])) {
652 652
                 // Create the audio folder if it does not exist yet.
653
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
654
-                if (!is_dir($filepath . 'audio')) {
655
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
653
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
654
+                if (!is_dir($filepath.'audio')) {
655
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
656 656
                     $audio_id = add_document(
657 657
                         $_course,
658 658
                         '/audio',
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 $file_path = handle_uploaded_document(
690 690
                     $_course,
691 691
                     $_FILES['mp3'],
692
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
692
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
693 693
                     '/audio',
694 694
                     api_get_user_id(),
695 695
                     '',
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 
706 706
                 // Store the mp3 file in the lp_item table.
707 707
                 $sql = "UPDATE $tbl_lp_item SET
708
-                            audio = '" . Database::escape_string($file) . "'
709
-                        WHERE id = '" . intval($new_item_id) . "'";
708
+                            audio = '".Database::escape_string($file)."'
709
+                        WHERE id = '" . intval($new_item_id)."'";
710 710
                 Database::query($sql);
711 711
             }
712 712
         }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         while (Database :: num_rows($res_name)) {
783 783
             // There is already one such name, update the current one a bit.
784 784
             $i++;
785
-            $name = $name . ' - ' . $i;
785
+            $name = $name.' - '.$i;
786 786
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
787 787
             $res_name = Database::query($check_name);
788 788
         }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                 // if $item points to an object and there is a parent.
895 895
                 if ($debug) {
896 896
                     error_log(
897
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
897
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
898 898
                         0
899 899
                     );
900 900
                 }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
                         if ($childItemId != $item) {
923 923
                             if ($debug) {
924 924
                                 error_log(
925
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
925
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
926 926
                                     0
927 927
                                 );
928 928
                             }
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                             } else {
943 943
                                 if ($debug > 2) {
944 944
                                     error_log(
945
-                                        '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,
945
+                                        '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,
946 946
                                         0
947 947
                                     );
948 948
                                 }
@@ -1047,15 +1047,15 @@  discard block
 block discarded – undo
1047 1047
         // Delete lp item id.
1048 1048
         foreach ($this->items as $id => $dummy) {
1049 1049
             $sql = "DELETE FROM $lp_item_view
1050
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1050
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1051 1051
             Database::query($sql);
1052 1052
         }
1053 1053
 
1054 1054
         // Proposed by Christophe (nickname: clefevre)
1055
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1055
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1056 1056
         Database::query($sql);
1057 1057
 
1058
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1058
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1059 1059
         Database::query($sql);
1060 1060
 
1061 1061
         self::toggle_publish($this->lp_id, 'i');
@@ -1063,32 +1063,32 @@  discard block
 block discarded – undo
1063 1063
         if ($this->type == 2 || $this->type == 3) {
1064 1064
             // This is a scorm learning path, delete the files as well.
1065 1065
             $sql = "SELECT path FROM $lp
1066
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1066
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1067 1067
             $res = Database::query($sql);
1068 1068
             if (Database :: num_rows($res) > 0) {
1069 1069
                 $row = Database :: fetch_array($res);
1070 1070
                 $path = $row['path'];
1071 1071
                 $sql = "SELECT id FROM $lp
1072
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1072
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1073 1073
                 $res = Database::query($sql);
1074 1074
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1075 1075
                     if ($this->debug > 2) {
1076
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1076
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1077 1077
                     }
1078 1078
                 } else {
1079 1079
                     // No other LP uses that directory, delete it.
1080
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1081
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1082
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1080
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1081
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1082
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1083 1083
                         if ($this->debug > 2) {
1084
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1084
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1085 1085
                         }
1086 1086
                         // Proposed by Christophe (clefevre).
1087 1087
                         if (strcmp(substr($path, -2), "/.") == 0) {
1088 1088
                             $path = substr($path, 0, -1); // Remove "." at the end.
1089 1089
                         }
1090 1090
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1091
-                        rmdirr($course_scorm_dir . $path);
1091
+                        rmdirr($course_scorm_dir.$path);
1092 1092
                     }
1093 1093
                 }
1094 1094
             }
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1102 1102
         Database::query($sql);
1103 1103
 
1104
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1104
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1105 1105
         Database::query($sql);
1106 1106
         // Updates the display order of all lps.
1107 1107
         $this->update_display_order();
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
             api_get_user_id()
1115 1115
         );
1116 1116
 
1117
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1117
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1118 1118
         if ($link_info !== false) {
1119 1119
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1120 1120
         }
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     {
1135 1135
         $course_id = $this->course_info['real_id'];
1136 1136
         if ($this->debug > 0) {
1137
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1137
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1138 1138
         }
1139 1139
         $num = 0;
1140 1140
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
         $res = Database::query($sql);
1146 1146
         while ($row = Database :: fetch_array($res)) {
1147 1147
             $num += $this->delete_children_items($row['id']);
1148
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1148
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1149 1149
             Database::query($sql_del);
1150 1150
             $num++;
1151 1151
         }
@@ -1186,12 +1186,12 @@  discard block
 block discarded – undo
1186 1186
         // Delete children items.
1187 1187
         $num = $this->delete_children_items($id);
1188 1188
         if ($this->debug > 2) {
1189
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1189
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1190 1190
         }
1191 1191
         // Now delete the item.
1192 1192
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1193 1193
         if ($this->debug > 2) {
1194
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1194
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1195 1195
         }
1196 1196
         Database::query($sql_del);
1197 1197
         // Now update surrounding items.
@@ -1266,15 +1266,15 @@  discard block
 block discarded – undo
1266 1266
         }
1267 1267
 
1268 1268
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1269
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1269
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1270 1270
         $res_select = Database::query($sql_select);
1271 1271
         $row_select = Database :: fetch_array($res_select);
1272 1272
         $audio_update_sql = '';
1273 1273
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1274 1274
             // Create the audio folder if it does not exist yet.
1275
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1276
-            if (!is_dir($filepath . 'audio')) {
1277
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1275
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1276
+            if (!is_dir($filepath.'audio')) {
1277
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1278 1278
                 $audio_id = add_document(
1279 1279
                     $_course,
1280 1280
                     '/audio',
@@ -1312,11 +1312,11 @@  discard block
 block discarded – undo
1312 1312
             $pi = pathinfo($audio['name']);
1313 1313
             if ($pi['extension'] == 'mp3') {
1314 1314
                 $c_det = api_get_course_info($this->cc);
1315
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1315
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1316 1316
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1317 1317
                 $path = substr($path, 7);
1318 1318
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1319
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1319
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1320 1320
             }
1321 1321
         }
1322 1322
 
@@ -1326,13 +1326,13 @@  discard block
 block discarded – undo
1326 1326
         // TODO: htmlspecialchars to be checked for encoding related problems.
1327 1327
         if ($same_parent && $same_previous) {
1328 1328
             // Only update title and description.
1329
-            $sql = "UPDATE " . $tbl_lp_item . "
1330
-                    SET title = '" . Database::escape_string($title) . "',
1331
-                        prerequisite = '" . $prerequisites . "',
1332
-                        description = '" . Database::escape_string($description) . "'
1333
-                        " . $audio_update_sql . ",
1334
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1335
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1329
+            $sql = "UPDATE ".$tbl_lp_item."
1330
+                    SET title = '" . Database::escape_string($title)."',
1331
+                        prerequisite = '" . $prerequisites."',
1332
+                        description = '" . Database::escape_string($description)."'
1333
+                        " . $audio_update_sql.",
1334
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1335
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1336 1336
             Database::query($sql);
1337 1337
         } else {
1338 1338
             $old_parent = $row_select['parent_item_id'];
@@ -1347,27 +1347,27 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
             if ($old_previous != 0) {
1349 1349
                 // Next
1350
-                $sql = "UPDATE " . $tbl_lp_item . "
1351
-                        SET next_item_id = " . $old_next . "
1352
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1350
+                $sql = "UPDATE ".$tbl_lp_item."
1351
+                        SET next_item_id = " . $old_next."
1352
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1353 1353
                 Database::query($sql);
1354 1354
             }
1355 1355
 
1356 1356
             if ($old_next != 0) {
1357 1357
                 // Previous
1358
-                $sql = "UPDATE " . $tbl_lp_item . "
1359
-                        SET previous_item_id = " . $old_previous . "
1360
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1358
+                $sql = "UPDATE ".$tbl_lp_item."
1359
+                        SET previous_item_id = " . $old_previous."
1360
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1361 1361
                 Database::query($sql);
1362 1362
             }
1363 1363
 
1364 1364
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1365
-            $sql = "UPDATE " . $tbl_lp_item . "
1365
+            $sql = "UPDATE ".$tbl_lp_item."
1366 1366
                     SET display_order = display_order - 1
1367 1367
                     WHERE
1368 1368
                         c_id = ".$course_id." AND
1369
-                        display_order > " . $old_order . " AND
1370
-                        lp_id = " . $this->lp_id . " AND
1369
+                        display_order > " . $old_order." AND
1370
+                        lp_id = " . $this->lp_id." AND
1371 1371
                         parent_item_id = " . $old_parent;
1372 1372
             Database::query($sql);
1373 1373
             /* END -- virtually remove the current item id */
@@ -1377,11 +1377,11 @@  discard block
 block discarded – undo
1377 1377
             if ($previous == 0) {
1378 1378
                 // Select the data of the item that should come after the current item.
1379 1379
                 $sql = "SELECT id, display_order
1380
-                        FROM " . $tbl_lp_item . "
1380
+                        FROM " . $tbl_lp_item."
1381 1381
                         WHERE
1382 1382
                             c_id = ".$course_id." AND
1383
-                            lp_id = " . $this->lp_id . " AND
1384
-                            parent_item_id = " . $parent . " AND
1383
+                            lp_id = " . $this->lp_id." AND
1384
+                            parent_item_id = " . $parent." AND
1385 1385
                             previous_item_id = " . $previous;
1386 1386
                 $res_select_old = Database::query($sql);
1387 1387
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
             } else {
1398 1398
                 // Select the data of the item that should come before the current item.
1399 1399
                 $sql = "SELECT next_item_id, display_order
1400
-                        FROM " . $tbl_lp_item . "
1401
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1400
+                        FROM " . $tbl_lp_item."
1401
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1402 1402
                 $res_select_old = Database::query($sql);
1403 1403
                 $row_select_old = Database :: fetch_array($res_select_old);
1404 1404
                 $new_next = $row_select_old['next_item_id'];
@@ -1407,57 +1407,57 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
             // TODO: htmlspecialchars to be checked for encoding related problems.
1409 1409
             // Update the current item with the new data.
1410
-            $sql = "UPDATE " . $tbl_lp_item . "
1410
+            $sql = "UPDATE ".$tbl_lp_item."
1411 1411
                     SET
1412
-                        title = '" . Database::escape_string($title) . "',
1413
-                        description = '" . Database::escape_string($description) . "',
1414
-                        parent_item_id = " . $parent . ",
1415
-                        previous_item_id = " . $previous . ",
1416
-                        next_item_id = " . $new_next . ",
1417
-                        display_order = " . $new_order . "
1418
-                        " . $audio_update_sql . "
1419
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1412
+                        title = '" . Database::escape_string($title)."',
1413
+                        description = '" . Database::escape_string($description)."',
1414
+                        parent_item_id = " . $parent.",
1415
+                        previous_item_id = " . $previous.",
1416
+                        next_item_id = " . $new_next.",
1417
+                        display_order = " . $new_order."
1418
+                        " . $audio_update_sql."
1419
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1420 1420
             Database::query($sql);
1421 1421
 
1422 1422
             if ($previous != 0) {
1423 1423
                 // Update the previous item's next_item_id.
1424
-                $sql = "UPDATE " . $tbl_lp_item . "
1425
-                        SET next_item_id = " . $id . "
1426
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1424
+                $sql = "UPDATE ".$tbl_lp_item."
1425
+                        SET next_item_id = " . $id."
1426
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1427 1427
                 Database::query($sql);
1428 1428
             }
1429 1429
 
1430 1430
             if ($new_next != 0) {
1431 1431
                 // Update the next item's previous_item_id.
1432
-                $sql = "UPDATE " . $tbl_lp_item . "
1433
-                        SET previous_item_id = " . $id . "
1434
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1432
+                $sql = "UPDATE ".$tbl_lp_item."
1433
+                        SET previous_item_id = " . $id."
1434
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1435 1435
                 Database::query($sql);
1436 1436
             }
1437 1437
 
1438 1438
             if ($old_prerequisite != $prerequisites) {
1439
-                $sql = "UPDATE " . $tbl_lp_item . "
1440
-                        SET prerequisite = '" . $prerequisites . "'
1441
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1439
+                $sql = "UPDATE ".$tbl_lp_item."
1440
+                        SET prerequisite = '" . $prerequisites."'
1441
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1442 1442
                 Database::query($sql);
1443 1443
             }
1444 1444
 
1445 1445
             if ($old_max_time_allowed != $max_time_allowed) {
1446 1446
                 // update max time allowed
1447
-                $sql = "UPDATE " . $tbl_lp_item . "
1448
-                        SET max_time_allowed = " . $max_time_allowed . "
1449
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1447
+                $sql = "UPDATE ".$tbl_lp_item."
1448
+                        SET max_time_allowed = " . $max_time_allowed."
1449
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1450 1450
                 Database::query($sql);
1451 1451
             }
1452 1452
 
1453 1453
             // Update all the items with the same or a bigger display_order than the current item.
1454
-            $sql = "UPDATE " . $tbl_lp_item . "
1454
+            $sql = "UPDATE ".$tbl_lp_item."
1455 1455
                     SET display_order = display_order + 1
1456 1456
                     WHERE
1457 1457
                        c_id = ".$course_id." AND
1458
-                       lp_id = " . $this->get_id() . " AND
1459
-                       id <> " . $id . " AND
1460
-                       parent_item_id = " . $parent . " AND
1458
+                       lp_id = " . $this->get_id()." AND
1459
+                       id <> " . $id." AND
1460
+                       parent_item_id = " . $parent." AND
1461 1461
                        display_order >= " . $new_order;
1462 1462
 
1463 1463
             Database::query($sql);
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
     {
1484 1484
         $course_id = api_get_course_int_id();
1485 1485
         if ($this->debug > 0) {
1486
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1486
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1487 1487
         }
1488 1488
 
1489 1489
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1581,8 +1581,8 @@  discard block
 block discarded – undo
1581 1581
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1582 1582
         }
1583 1583
 
1584
-        if (empty($id)|| $id != strval(intval($id))) {
1585
-            return array ();
1584
+        if (empty($id) || $id != strval(intval($id))) {
1585
+            return array();
1586 1586
         }
1587 1587
 
1588 1588
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1600,13 +1600,13 @@  discard block
 block discarded – undo
1600 1600
                             item_type='dokeos_chapter'
1601 1601
                         ORDER BY display_order";
1602 1602
             $res_bros = Database::query($sql_bros);
1603
-            $list = array ();
1603
+            $list = array();
1604 1604
             while ($row_bro = Database :: fetch_array($res_bros)) {
1605 1605
                 $list[] = $row_bro;
1606 1606
             }
1607 1607
             return $list;
1608 1608
         }
1609
-        return array ();
1609
+        return array();
1610 1610
     }
1611 1611
 
1612 1612
     /**
@@ -1619,11 +1619,11 @@  discard block
 block discarded – undo
1619 1619
     {
1620 1620
         $course_id = api_get_course_int_id();
1621 1621
         if ($this->debug > 0) {
1622
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1622
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1623 1623
         }
1624 1624
 
1625 1625
         if (empty ($id) || $id != strval(intval($id))) {
1626
-            return array ();
1626
+            return array();
1627 1627
         }
1628 1628
 
1629 1629
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1635,13 +1635,13 @@  discard block
 block discarded – undo
1635 1635
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1636 1636
                          ORDER BY display_order";
1637 1637
             $res_bros = Database::query($sql_bros);
1638
-            $list = array ();
1638
+            $list = array();
1639 1639
             while ($row_bro = Database :: fetch_array($res_bros)) {
1640 1640
                 $list[] = $row_bro;
1641 1641
             }
1642 1642
             return $list;
1643 1643
         }
1644
-        return array ();
1644
+        return array();
1645 1645
     }
1646 1646
 
1647 1647
     /**
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
             $current = $this->current;
1712 1712
         }
1713 1713
         if ($this->debug > 2) {
1714
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1714
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1715 1715
         }
1716 1716
         return $current;
1717 1717
     }
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
         ) {
1793 1793
 
1794 1794
             if ($this->debug > 2) {
1795
-                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);
1795
+                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);
1796 1796
             }
1797 1797
             $index = -1;
1798 1798
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
             if ($index == -1) {
1805 1805
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1806 1806
                 if ($this->debug > 2) {
1807
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1807
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1808 1808
                 }
1809 1809
                 return false;
1810 1810
             } else {
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
             $index = 0;
1820 1820
             // Loop through all ordered items and stop at the first item that is
1821 1821
             // not a directory *and* that has not been completed yet.
1822
-            while ( !empty($this->ordered_items[$index]) AND
1822
+            while (!empty($this->ordered_items[$index]) AND
1823 1823
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1824 1824
                 (
1825 1825
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1833,14 +1833,14 @@  discard block
 block discarded – undo
1833 1833
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1834 1834
             $this->index    = $index;
1835 1835
             if ($this->debug > 2) {
1836
-                error_log('$index ' . $index);
1836
+                error_log('$index '.$index);
1837 1837
             }
1838 1838
             if ($this->debug > 2) {
1839
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1839
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1840 1840
             }
1841 1841
         }
1842 1842
         if ($this->debug > 2) {
1843
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1843
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1844 1844
         }
1845 1845
     }
1846 1846
 
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
     public function get_js_info($item_id = '')
1854 1854
     {
1855 1855
         if ($this->debug > 0) {
1856
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1856
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1857 1857
         }
1858 1858
 
1859 1859
         $info = '';
@@ -1863,17 +1863,17 @@  discard block
 block discarded – undo
1863 1863
             //if item is defined, return values from DB
1864 1864
             $oItem = $this->items[$item_id];
1865 1865
             $info .= '<script language="javascript">';
1866
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1867
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1868
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1869
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1870
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1871
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1872
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1866
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1867
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1868
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1869
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1870
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1871
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1872
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1873 1873
             $info .= "top.set_flag_synchronized();";
1874 1874
             $info .= '</script>';
1875 1875
             if ($this->debug > 2) {
1876
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1876
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1877 1877
             }
1878 1878
             return $info;
1879 1879
 
@@ -1881,17 +1881,17 @@  discard block
 block discarded – undo
1881 1881
 
1882 1882
             // If item_id is empty, just update to default SCORM data.
1883 1883
             $info .= '<script language="javascript">';
1884
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1885
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1886
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1887
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1888
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1889
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1890
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1884
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1885
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1886
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1887
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1888
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1889
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1890
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1891 1891
             $info .= "top.set_flag_synchronized();";
1892 1892
             $info .= '</script>';
1893 1893
             if ($this->debug > 2) {
1894
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1894
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1895 1895
             }
1896 1896
             return $info;
1897 1897
         }
@@ -1945,12 +1945,12 @@  discard block
 block discarded – undo
1945 1945
      * Gets the navigation bar for the learnpath display screen
1946 1946
      * @return	string	The HTML string to use as a navigation bar
1947 1947
      */
1948
-    public function get_navigation_bar($idBar = null, $display=null) {
1948
+    public function get_navigation_bar($idBar = null, $display = null) {
1949 1949
         if ($this->debug > 0) {
1950 1950
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1951 1951
         }
1952
-        if(empty($idBar)){
1953
-            $idBar='control-top';
1952
+        if (empty($idBar)) {
1953
+            $idBar = 'control-top';
1954 1954
         }
1955 1955
         /* if(empty($display)){
1956 1956
             $display='display:block';
@@ -1963,16 +1963,16 @@  discard block
 block discarded – undo
1963 1963
             $navbar = '
1964 1964
                   <span id="'.$idBar.'" class="buttons">
1965 1965
                     <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">
1966
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1966
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1967 1967
                     </a>
1968
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1969
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1968
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1969
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1970 1970
                     </a>
1971
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1972
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1971
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1972
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1973 1973
                     </a>
1974 1974
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1975
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1975
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1976 1976
                     </a>
1977 1977
                   </span>';
1978 1978
 
@@ -1980,13 +1980,13 @@  discard block
 block discarded – undo
1980 1980
             $navbar = '
1981 1981
                 <span id="'.$idBar.'" class="buttons text-right">
1982 1982
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1983
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1983
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1984 1984
                     </a>
1985
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1986
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1985
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1986
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1987 1987
                     </a>
1988
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1989
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1988
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1989
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1990 1990
                     </a>
1991 1991
                 </span>';
1992 1992
         }
@@ -2007,11 +2007,11 @@  discard block
 block discarded – undo
2007 2007
         $index = $this->index;
2008 2008
         $index++;
2009 2009
         if ($this->debug > 2) {
2010
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2010
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2011 2011
         }
2012 2012
         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) {
2013 2013
             $index++;
2014
-            if ($index == $this->max_ordered_items){
2014
+            if ($index == $this->max_ordered_items) {
2015 2015
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2016 2016
                     return $this->index;
2017 2017
                 } else {
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
             return $this->index;
2024 2024
         }
2025 2025
         if ($this->debug > 2) {
2026
-            error_log('New LP - index is now ' . $index, 0);
2026
+            error_log('New LP - index is now '.$index, 0);
2027 2027
         }
2028 2028
         return $index;
2029 2029
     }
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
         if (!empty ($new_index)) {
2042 2042
             if (isset ($this->ordered_items[$new_index])) {
2043 2043
                 if ($this->debug > 2) {
2044
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2044
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2045 2045
                 }
2046 2046
                 return $this->ordered_items[$new_index];
2047 2047
             }
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
         }
2084 2084
 
2085 2085
         // Filename without its extension.
2086
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2086
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2087 2087
 
2088 2088
         $zipFile = new PclZip($file_path);
2089 2089
         // Check the zip content (real size and file extension).
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
                     break; // Exit the foreach loop.
2108 2108
                 } elseif (
2109 2109
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2110
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2110
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2111 2111
                 ) {
2112 2112
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2113 2113
                     switch ($ext) {
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
             error_log('New LP - In learnpath::get_previous_index()', 0);
2150 2150
         }
2151 2151
         $index = $this->index;
2152
-        if (isset ($this->ordered_items[$index -1])) {
2152
+        if (isset ($this->ordered_items[$index - 1])) {
2153 2153
             $index--;
2154 2154
             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')) {
2155 2155
                 $index--;
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
             }
2160 2160
         } else {
2161 2161
             if ($this->debug > 2) {
2162
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2162
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2163 2163
             }
2164 2164
             // There is no previous item.
2165 2165
         }
@@ -2202,8 +2202,8 @@  discard block
 block discarded – undo
2202 2202
     {
2203 2203
         $course_id = api_get_course_int_id();
2204 2204
         $_course = api_get_course_info();
2205
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2206
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2205
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2206
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2207 2207
 
2208 2208
         // Getting all the information about the item.
2209 2209
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
                     lp.c_id = $course_id AND
2215 2215
                     lp_view.c_id = $course_id";
2216 2216
         $result = Database::query($sql);
2217
-        $row 	= Database::fetch_assoc($result);
2217
+        $row = Database::fetch_assoc($result);
2218 2218
         $output = '';
2219 2219
 
2220 2220
         if (!empty ($row['audio'])) {
@@ -2222,8 +2222,8 @@  discard block
 block discarded – undo
2222 2222
             $list = $_SESSION['oLP']->get_toc();
2223 2223
             $type_quiz = false;
2224 2224
 
2225
-            foreach($list as $toc) {
2226
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2225
+            foreach ($list as $toc) {
2226
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2227 2227
                     $type_quiz = true;
2228 2228
                 }
2229 2229
             }
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
         $courseCode = null,
2287 2287
         $sessionId = null
2288 2288
     ) {
2289
-        $lp_id = (int)$lp_id;
2289
+        $lp_id = (int) $lp_id;
2290 2290
         $courseInfo = api_get_course_info($courseCode);
2291 2291
         $sessionId = intval($sessionId);
2292 2292
 
@@ -2452,10 +2452,10 @@  discard block
 block discarded – undo
2452 2452
      */
2453 2453
     public static function get_progress_bar($percentage = -1, $text_add = '')
2454 2454
     {
2455
-        $text = $percentage . $text_add;
2455
+        $text = $percentage.$text_add;
2456 2456
         $output = '<div class="progress">
2457
-                        <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.';">
2458
-                        '. $text .'
2457
+                        <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.';">
2458
+                        '. $text.'
2459 2459
                         </div>
2460 2460
                     </div>';
2461 2461
 
@@ -2491,16 +2491,16 @@  discard block
 block discarded – undo
2491 2491
         }
2492 2492
         $total_items = $this->get_total_items_count_without_chapters();
2493 2493
         if ($this->debug > 2) {
2494
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2494
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2495 2495
         }
2496 2496
         $completeItems = $this->get_complete_items_count();
2497 2497
         if ($this->debug > 2) {
2498
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2498
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2499 2499
         }
2500 2500
         if ($add != 0) {
2501 2501
             $completeItems += $add;
2502 2502
             if ($this->debug > 2) {
2503
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2503
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2504 2504
             }
2505 2505
         }
2506 2506
         $text = '';
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
             $text = '%';
2519 2519
         } elseif ($mode == 'abs') {
2520 2520
             $percentage = $completeItems;
2521
-            $text = '/' . $total_items;
2521
+            $text = '/'.$total_items;
2522 2522
         }
2523 2523
 
2524 2524
         return array(
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
                 // and replace them, one by one, by the internal IDs (chamilo db)
2715 2715
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2716 2716
                 // by a space as well.
2717
-                $find = array (
2717
+                $find = array(
2718 2718
                     '&',
2719 2719
                     '|',
2720 2720
                     '~',
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                     '(',
2727 2727
                     ')'
2728 2728
                 );
2729
-                $replace = array (
2729
+                $replace = array(
2730 2730
                     ' ',
2731 2731
                     ' ',
2732 2732
                     ' ',
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 foreach ($ids as $id) {
2744 2744
                     $id = trim($id);
2745 2745
                     if (isset ($this->refs_list[$id])) {
2746
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2746
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2747 2747
                     }
2748 2748
                 }
2749 2749
 
@@ -2851,9 +2851,9 @@  discard block
 block discarded – undo
2851 2851
         if ($this->debug > 0) {
2852 2852
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2853 2853
         }
2854
-        $list = array ();
2854
+        $list = array();
2855 2855
         foreach ($this->ordered_items as $item_id) {
2856
-            $list[] = array (
2856
+            $list[] = array(
2857 2857
                 $item_id => $this->items[$item_id]->get_status()
2858 2858
             );
2859 2859
         }
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         $res = Database::query($sql);
2908 2908
         $num = Database :: num_rows($res);
2909 2909
         if ($num > 0) {
2910
-            $list[] = array (
2910
+            $list[] = array(
2911 2911
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2912 2912
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2913 2913
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2919 2919
             );
2920 2920
             while ($row = Database :: fetch_array($res)) {
2921
-                $list[] = array (
2921
+                $list[] = array(
2922 2922
                     'order_id' => ($row['order_id'] + 1),
2923 2923
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2924 2924
                     'type' => $row['interaction_type'],
@@ -2986,7 +2986,7 @@  discard block
 block discarded – undo
2986 2986
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
2987 2987
             );
2988 2988
             while ($row = Database :: fetch_array($res)) {
2989
-                $list[] = array (
2989
+                $list[] = array(
2990 2990
                     'order_id' => ($row['order_id'] + 1),
2991 2991
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
2992 2992
                     'score_raw' => $row['score_raw'],
@@ -3013,10 +3013,10 @@  discard block
 block discarded – undo
3013 3013
         $toc = array();
3014 3014
         foreach ($this->ordered_items as $item_id) {
3015 3015
             if ($this->debug > 2) {
3016
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3016
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3017 3017
             }
3018 3018
             // TODO: Change this link generation and use new function instead.
3019
-            $toc[] = array (
3019
+            $toc[] = array(
3020 3020
                 'id'            => $item_id,
3021 3021
                 'title'         => $this->items[$item_id]->get_title(),
3022 3022
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3027,7 +3027,7 @@  discard block
 block discarded – undo
3027 3027
             );
3028 3028
         }
3029 3029
         if ($this->debug > 2) {
3030
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3030
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3031 3031
         }
3032 3032
         return $toc;
3033 3033
     }
@@ -3044,10 +3044,10 @@  discard block
 block discarded – undo
3044 3044
         }
3045 3045
         $toc = $varname.' = new Array();';
3046 3046
         foreach ($this->ordered_items as $item_id) {
3047
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3047
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3048 3048
         }
3049 3049
         if ($this->debug > 2) {
3050
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3050
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3051 3051
         }
3052 3052
         return $toc;
3053 3053
     }
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
             }
3072 3072
         }
3073 3073
         if ($this->debug > 2) {
3074
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3074
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3075 3075
         }
3076 3076
         return $res;
3077 3077
     }
@@ -3087,7 +3087,7 @@  discard block
 block discarded – undo
3087 3087
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3088 3088
         $lp_id = intval($lp_id);
3089 3089
         $sql = "SELECT lp_type FROM $tbl_lp
3090
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3090
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3091 3091
         $res = Database::query($sql);
3092 3092
         if ($res === false) {
3093 3093
             return null;
@@ -3200,7 +3200,7 @@  discard block
 block discarded – undo
3200 3200
             $dirTypes = self::getChapterTypes();
3201 3201
 
3202 3202
             if (in_array($item['type'], $dirTypes)) {
3203
-                $scorm_color_background ='scorm_item_section ';
3203
+                $scorm_color_background = 'scorm_item_section ';
3204 3204
                 $style_item = '';
3205 3205
             }
3206 3206
             if ($item['id'] == $this->current) {
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3210 3210
             }
3211 3211
 
3212
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3212
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3213 3213
 
3214 3214
             // Learning path title
3215 3215
             $title = $item['title'];
@@ -3239,7 +3239,7 @@  discard block
 block discarded – undo
3239 3239
                 $html .= stripslashes($title);
3240 3240
             } else {
3241 3241
                 $this->get_link('http', $item['id'], $toc_list);
3242
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3242
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3243 3243
             }
3244 3244
             $html .= "</div>";
3245 3245
 
@@ -3273,12 +3273,12 @@  discard block
 block discarded – undo
3273 3273
             if ($this->get_lp_session_id() == api_get_session_id()) {
3274 3274
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3275 3275
                 $html .= '<div class="btn-group">';
3276
-                $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'>" .
3277
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3278
-                $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'>" .
3279
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3280
-                $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">' .
3281
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3276
+                $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'>".
3277
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3278
+                $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'>".
3279
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3280
+                $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">'.
3281
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3282 3282
                 $html .= '</div>';
3283 3283
                 $html .= '</div>';
3284 3284
             }
@@ -3329,11 +3329,11 @@  discard block
 block discarded – undo
3329 3329
         $course_id = $this->get_course_int_id();
3330 3330
 
3331 3331
         if ($this->debug > 0) {
3332
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3332
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3333 3333
         }
3334 3334
         if (empty($item_id)) {
3335 3335
             if ($this->debug > 2) {
3336
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3336
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3337 3337
             }
3338 3338
             $item_id = $this->get_current_item_id();
3339 3339
         }
@@ -3365,7 +3365,7 @@  discard block
 block discarded – undo
3365 3365
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3366 3366
         		WHERE li.id = $item_id ";
3367 3367
         if ($this->debug > 2) {
3368
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3368
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3369 3369
         }
3370 3370
         $res = Database::query($sql);
3371 3371
         if (Database :: num_rows($res) > 0) {
@@ -3379,9 +3379,9 @@  discard block
 block discarded – undo
3379 3379
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3380 3380
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3381 3381
             }
3382
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3382
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3383 3383
             if ($type == 'http') {
3384
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3384
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3385 3385
             } else {
3386 3386
                 $course_path = $sys_course_path; //system path
3387 3387
             }
@@ -3392,8 +3392,8 @@  discard block
 block discarded – undo
3392 3392
             }
3393 3393
 
3394 3394
             if ($this->debug > 2) {
3395
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3396
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3395
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3396
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3397 3397
             }
3398 3398
 
3399 3399
             // Now go through the specific cases to get the end of the path
@@ -3412,7 +3412,7 @@  discard block
 block discarded – undo
3412 3412
                         );
3413 3413
 
3414 3414
                         if ($this->debug > 0) {
3415
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3415
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3416 3416
                         }
3417 3417
 
3418 3418
                         if ($lp_item_type == 'link') {
@@ -3432,7 +3432,7 @@  discard block
 block discarded – undo
3432 3432
                                     $linkProtocol = substr($file, 0, 5);
3433 3433
                                     if ($linkProtocol === 'http:') {
3434 3434
                                         //this is the special intervention case
3435
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3435
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3436 3436
                                     }
3437 3437
                                 }
3438 3438
                             }
@@ -3472,8 +3472,8 @@  discard block
 block discarded – undo
3472 3472
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3473 3473
                                         WHERE
3474 3474
                                             c_id = $course_id AND
3475
-                                            lp_item_id='" . $lp_item_id . "' AND
3476
-                                            lp_view_id ='" . $lp_view_id . "' AND
3475
+                                            lp_item_id='".$lp_item_id."' AND
3476
+                                            lp_view_id ='" . $lp_view_id."' AND
3477 3477
                                             status='completed'";
3478 3478
                                 $result = Database::query($sql);
3479 3479
                                 $row_count = Database :: fetch_row($result);
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3483 3483
                                     $not_multiple_attempt = 1;
3484 3484
                                 }
3485
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3485
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3486 3486
                             }
3487 3487
 
3488 3488
                             $tmp_array = explode('/', $file);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                     break;
3496 3496
                 case 2 :
3497 3497
                     if ($this->debug > 2) {
3498
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3498
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3499 3499
                     }
3500 3500
 
3501 3501
                     if ($lp_item_type != 'dir') {
@@ -3509,19 +3509,19 @@  discard block
 block discarded – undo
3509 3509
                         //if ($this->prerequisites_match($item_id)) {
3510 3510
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3511 3511
                             if ($this->debug > 2) {
3512
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3512
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3513 3513
                             }
3514 3514
                             // Distant url, return as is.
3515 3515
                             $file = $lp_item_path;
3516 3516
                         } else {
3517 3517
                             if ($this->debug > 2) {
3518
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3518
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3519 3519
                             }
3520 3520
                             // Prevent getting untranslatable urls.
3521 3521
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3522 3522
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3523 3523
                             // Prepare the path.
3524
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3524
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3525 3525
                             // TODO: Fix this for urls with protocol header.
3526 3526
                             $file = str_replace('//', '/', $file);
3527 3527
                             $file = str_replace(':/', '://', $file);
@@ -3529,11 +3529,11 @@  discard block
 block discarded – undo
3529 3529
                                 $lp_path = substr($lp_path, 0, -1);
3530 3530
                             }
3531 3531
 
3532
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3532
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3533 3533
                                 // if file not found.
3534 3534
                                 $decoded = html_entity_decode($lp_item_path);
3535 3535
                                 list ($decoded) = explode('?', $decoded);
3536
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3536
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3537 3537
                                     require_once 'resourcelinker.inc.php';
3538 3538
                                     $file = rl_get_resource_link_for_learnpath(
3539 3539
                                         $course_id,
@@ -3553,14 +3553,14 @@  discard block
 block discarded – undo
3553 3553
                                         }
3554 3554
                                     }
3555 3555
                                 } else {
3556
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3556
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3557 3557
                                 }
3558 3558
                             }
3559 3559
                         }
3560 3560
 
3561 3561
                         // We want to use parameters if they were defined in the imsmanifest
3562 3562
                         if (strpos($file, 'blank.php') === false) {
3563
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3563
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3564 3564
                         }
3565 3565
                     } else {
3566 3566
                         $file = 'lp_content.php?type=dir';
@@ -3568,12 +3568,12 @@  discard block
 block discarded – undo
3568 3568
                     break;
3569 3569
                 case 3 :
3570 3570
                     if ($this->debug > 2) {
3571
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3571
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3572 3572
                     }
3573 3573
                     // Formatting AICC HACP append URL.
3574
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3574
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3575 3575
                     if (!empty($lp_item_params)) {
3576
-                        $aicc_append .= $lp_item_params . '&';
3576
+                        $aicc_append .= $lp_item_params.'&';
3577 3577
                     }
3578 3578
                     if ($lp_item_type != 'dir') {
3579 3579
                         // Quite complex here:
@@ -3585,7 +3585,7 @@  discard block
 block discarded – undo
3585 3585
 
3586 3586
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3587 3587
                             if ($this->debug > 2) {
3588
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3588
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3589 3589
                             }
3590 3590
                             // Distant url, return as is.
3591 3591
                             $file = $lp_item_path;
@@ -3598,19 +3598,19 @@  discard block
 block discarded – undo
3598 3598
                             if (stripos($file, '<servername>') !== false) {
3599 3599
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3600 3600
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3601
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3601
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3602 3602
                             }
3603 3603
                             //
3604 3604
                             $file .= $aicc_append;
3605 3605
                         } else {
3606 3606
                             if ($this->debug > 2) {
3607
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3607
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3608 3608
                             }
3609 3609
                             // Prevent getting untranslatable urls.
3610 3610
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3611 3611
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3612 3612
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3613
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3613
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3614 3614
                             // TODO: Fix this for urls with protocol header.
3615 3615
                             $file = str_replace('//', '/', $file);
3616 3616
                             $file = str_replace(':/', '://', $file);
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3630 3630
         }
3631 3631
         if ($this->debug > 2) {
3632
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3632
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3633 3633
         }
3634 3634
         return $file;
3635 3635
     }
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
         $search = '';
3648 3648
         // Use $attempt_num to enable multi-views management (disabled so far).
3649 3649
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3650
-            $search = 'AND view_count = ' . $attempt_num;
3650
+            $search = 'AND view_count = '.$attempt_num;
3651 3651
         }
3652 3652
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3653 3653
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3657,9 +3657,9 @@  discard block
 block discarded – undo
3657 3657
 
3658 3658
         $sql = "SELECT id, view_count FROM $lp_view_table
3659 3659
         		WHERE
3660
-        		    c_id = " . $course_id . " AND
3661
-        		    lp_id = " . $this->get_id() . " AND
3662
-        		    user_id = " . $this->get_user_id() . " AND
3660
+        		    c_id = ".$course_id." AND
3661
+        		    lp_id = " . $this->get_id()." AND
3662
+        		    user_id = " . $this->get_user_id()." AND
3663 3663
         		    session_id = $sessionId
3664 3664
         		    $search
3665 3665
                 ORDER BY view_count DESC";
@@ -3670,7 +3670,7 @@  discard block
 block discarded – undo
3670 3670
         } else if (!api_is_invitee()) {
3671 3671
             // There is no database record, create one.
3672 3672
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3673
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3673
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3674 3674
             Database::query($sql);
3675 3675
             $id = Database :: insert_id();
3676 3676
             $this->lp_view_id = $id;
@@ -3770,15 +3770,15 @@  discard block
 block discarded – undo
3770 3770
     {
3771 3771
         $course_id = api_get_course_int_id();
3772 3772
         if ($this->debug > 0) {
3773
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3773
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3774 3774
         }
3775 3775
         if (empty($id) || empty($direction)) {
3776 3776
             return false;
3777 3777
         }
3778 3778
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3779 3779
         $sql_sel = "SELECT *
3780
-                    FROM " . $tbl_lp_item . "
3781
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3780
+                    FROM " . $tbl_lp_item."
3781
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3782 3782
         $res_sel = Database::query($sql_sel);
3783 3783
         // Check if elem exists.
3784 3784
         if (Database :: num_rows($res_sel) < 1) {
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
                                  WHERE c_id = ".$course_id." AND id = $previous";
3804 3804
 
3805 3805
                     if ($this->debug > 2) {
3806
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3806
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3807 3807
                     }
3808 3808
                     $res_sel2 = Database::query($sql_sel2);
3809 3809
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3856,7 +3856,7 @@  discard block
 block discarded – undo
3856 3856
                         }
3857 3857
                         Database::query($sql_upd2);
3858 3858
                     }
3859
-                    $display = $display -1;
3859
+                    $display = $display - 1;
3860 3860
                 }
3861 3861
                 break;
3862 3862
             case 'down':
@@ -3867,7 +3867,7 @@  discard block
 block discarded – undo
3867 3867
                 } else {
3868 3868
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3869 3869
                     if ($this->debug > 2) {
3870
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3870
+                        error_log('Selecting next: '.$sql_sel2, 0);
3871 3871
                     }
3872 3872
                     $res_sel2 = Database::query($sql_sel2);
3873 3873
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3905,7 +3905,7 @@  discard block
 block discarded – undo
3905 3905
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3906 3906
                         Database::query($sql_upd2);
3907 3907
                     }
3908
-                    $display = $display +1;
3908
+                    $display = $display + 1;
3909 3909
                 }
3910 3910
                 break;
3911 3911
             default :
@@ -3928,8 +3928,8 @@  discard block
 block discarded – undo
3928 3928
         $res = Database::query($sql);
3929 3929
         if ($res === false)
3930 3930
             return false;
3931
-        $lps = array ();
3932
-        $lp_order = array ();
3931
+        $lps = array();
3932
+        $lp_order = array();
3933 3933
         $num = Database :: num_rows($res);
3934 3934
         // First check the order is correct, globally (might be wrong because
3935 3935
         // of versions < 1.8.4)
@@ -3939,7 +3939,7 @@  discard block
 block discarded – undo
3939 3939
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3940 3940
                     $need_fix = true;
3941 3941
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3942
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3942
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3943 3943
                     Database::query($sql_u);
3944 3944
                 }
3945 3945
                 $row['display_order'] = $i;
@@ -3952,10 +3952,10 @@  discard block
 block discarded – undo
3952 3952
             $order = $lps[$lp_id]['display_order'];
3953 3953
             if ($order > 1) { // If it's the first element, no need to move up.
3954 3954
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3955
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3955
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3956 3956
                 Database::query($sql_u1);
3957
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3958
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3957
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3958
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3959 3959
                 Database::query($sql_u2);
3960 3960
             }
3961 3961
         }
@@ -3976,8 +3976,8 @@  discard block
 block discarded – undo
3976 3976
         if ($res === false) {
3977 3977
             return false;
3978 3978
         }
3979
-        $lps = array ();
3980
-        $lp_order = array ();
3979
+        $lps = array();
3980
+        $lp_order = array();
3981 3981
         $num = Database :: num_rows($res);
3982 3982
         $max = 0;
3983 3983
         // First check the order is correct, globally (might be wrong because
@@ -3989,7 +3989,7 @@  discard block
 block discarded – undo
3989 3989
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3990 3990
                     $need_fix = true;
3991 3991
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3992
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3992
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3993 3993
                     Database::query($sql_u);
3994 3994
                 }
3995 3995
                 $row['display_order'] = $i;
@@ -4002,10 +4002,10 @@  discard block
 block discarded – undo
4002 4002
             $order = $lps[$lp_id]['display_order'];
4003 4003
             if ($order < $max) { // If it's the first element, no need to move up.
4004 4004
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4005
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4005
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4006 4006
                 Database::query($sql_u1);
4007
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4008
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4007
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4008
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4009 4009
                 Database::query($sql_u2);
4010 4010
             }
4011 4011
         }
@@ -4025,15 +4025,15 @@  discard block
 block discarded – undo
4025 4025
         $this->autocomplete_parents($this->last);
4026 4026
         $new_index = $this->get_next_index();
4027 4027
         if ($this->debug > 2) {
4028
-            error_log('New LP - New index: ' . $new_index, 0);
4028
+            error_log('New LP - New index: '.$new_index, 0);
4029 4029
         }
4030 4030
         $this->index = $new_index;
4031 4031
         if ($this->debug > 2) {
4032
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4032
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4033 4033
         }
4034 4034
         $this->current = $this->ordered_items[$new_index];
4035 4035
         if ($this->debug > 2) {
4036
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4036
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4037 4037
         }
4038 4038
     }
4039 4039
 
@@ -4097,7 +4097,7 @@  discard block
 block discarded – undo
4097 4097
             // Clean spaces.
4098 4098
             $prereq_string = str_replace(' ', '', $prereq_string);
4099 4099
             if ($debug > 0) {
4100
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4100
+                error_log('Found prereq_string: '.$prereq_string, 0);
4101 4101
             }
4102 4102
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4103 4103
             $result = $currentItem->parse_prereq(
@@ -4113,12 +4113,12 @@  discard block
 block discarded – undo
4113 4113
         } else {
4114 4114
             $result = true;
4115 4115
             if ($debug > 1) {
4116
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4116
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4117 4117
             }
4118 4118
         }
4119 4119
 
4120 4120
         if ($debug > 1) {
4121
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4121
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4122 4122
         }
4123 4123
         return $result;
4124 4124
     }
@@ -4184,12 +4184,12 @@  discard block
 block discarded – undo
4184 4184
             $row = Database :: fetch_array($result);
4185 4185
             $name = domesticate($row['name']);
4186 4186
             if ($set_visibility == 'i') {
4187
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4187
+                $s = $name." ".get_lang('LearnpathNotPublished');
4188 4188
                 $dialogBox = $s;
4189 4189
                 $v = 0;
4190 4190
             }
4191 4191
             if ($set_visibility == 'v') {
4192
-                $s = $name . " " . get_lang('LearnpathPublished');
4192
+                $s = $name." ".get_lang('LearnpathPublished');
4193 4193
                 $dialogBox = $s;
4194 4194
                 $v = 1;
4195 4195
             }
@@ -4272,9 +4272,9 @@  discard block
 block discarded – undo
4272 4272
         $course_id = api_get_course_int_id();
4273 4273
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4274 4274
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4275
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4275
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4276 4276
         if ($this->debug > 2) {
4277
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4277
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4278 4278
         }
4279 4279
         $res = Database::query($sql);
4280 4280
         $view_id = Database::insert_id();
@@ -4312,10 +4312,10 @@  discard block
 block discarded – undo
4312 4312
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4313 4313
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4314 4314
         if ($this->debug > 2) {
4315
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4315
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4316 4316
         }
4317 4317
         if ($this->debug > 2) {
4318
-            error_log('' . print_r($this->items, true), 0);
4318
+            error_log(''.print_r($this->items, true), 0);
4319 4319
         }
4320 4320
         if (isset($this->items[$this->current]) &&
4321 4321
             is_object($this->items[$this->current])
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
     {
4340 4340
         $debug = $this->debug;
4341 4341
         if ($debug) {
4342
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4342
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4343 4343
         }
4344 4344
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4345 4345
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4362,7 +4362,7 @@  discard block
 block discarded – undo
4362 4362
 
4363 4363
             if ($debug) {
4364 4364
                 error_log('update_queue before:');
4365
-                error_log(print_r($this->update_queue,1));
4365
+                error_log(print_r($this->update_queue, 1));
4366 4366
             }
4367 4367
             $this->autocomplete_parents($item_id);
4368 4368
 
@@ -4370,9 +4370,9 @@  discard block
 block discarded – undo
4370 4370
             $this->update_queue[$item_id] = $status;
4371 4371
 
4372 4372
             if ($debug) {
4373
-                error_log('get_status(): ' . $status);
4373
+                error_log('get_status(): '.$status);
4374 4374
                 error_log('update_queue after:');
4375
-                error_log(print_r($this->update_queue,1));
4375
+                error_log(print_r($this->update_queue, 1));
4376 4376
             }
4377 4377
             return $res;
4378 4378
         }
@@ -4393,17 +4393,17 @@  discard block
 block discarded – undo
4393 4393
 
4394 4394
         if (isset($this->current) && !api_is_invitee()) {
4395 4395
             if ($this->debug > 2) {
4396
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4396
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4397 4397
             }
4398 4398
             $sql = "UPDATE $table SET
4399
-                        last_item = " . intval($this->get_current_item_id()). "
4399
+                        last_item = ".intval($this->get_current_item_id())."
4400 4400
                     WHERE
4401 4401
                         c_id = $course_id AND
4402
-                        lp_id = " . $this->get_id() . " AND
4402
+                        lp_id = ".$this->get_id()." AND
4403 4403
                         user_id = " . $this->get_user_id()." ".$session_condition;
4404 4404
 
4405 4405
             if ($this->debug > 2) {
4406
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4406
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4407 4407
             }
4408 4408
             Database::query($sql);
4409 4409
         }
@@ -4417,7 +4417,7 @@  discard block
 block discarded – undo
4417 4417
                             progress = $progress
4418 4418
                         WHERE
4419 4419
                             c_id = ".$course_id." AND
4420
-                            lp_id = " . $this->get_id() . " AND
4420
+                            lp_id = " . $this->get_id()." AND
4421 4421
                             user_id = " . $this->get_user_id()." ".$session_condition;
4422 4422
                 // Ignore errors as some tables might not have the progress field just yet.
4423 4423
                 Database::query($sql);
@@ -4433,7 +4433,7 @@  discard block
 block discarded – undo
4433 4433
     public function set_current_item($item_id = null)
4434 4434
     {
4435 4435
         if ($this->debug > 0) {
4436
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4436
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4437 4437
         }
4438 4438
         if (empty ($item_id)) {
4439 4439
             if ($this->debug > 2) {
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
             // Do nothing.
4443 4443
         } else {
4444 4444
             if ($this->debug > 2) {
4445
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4445
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4446 4446
             }
4447 4447
             if (is_numeric($item_id)) {
4448 4448
                 $item_id = intval($item_id);
@@ -4457,10 +4457,10 @@  discard block
 block discarded – undo
4457 4457
                     }
4458 4458
                 }
4459 4459
                 if ($this->debug > 2) {
4460
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4460
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4461 4461
                 }
4462 4462
             } else {
4463
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4463
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4464 4464
             }
4465 4465
         }
4466 4466
     }
@@ -4485,7 +4485,7 @@  discard block
 block discarded – undo
4485 4485
             $lp = $this->get_id();
4486 4486
             if ($lp != 0) {
4487 4487
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4488
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4488
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4489 4489
                 $res = Database::query($sql);
4490 4490
                 return $res;
4491 4491
             }
@@ -4509,7 +4509,7 @@  discard block
 block discarded – undo
4509 4509
 
4510 4510
         if ($lp != 0) {
4511 4511
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4512
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4512
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4513 4513
             $res = Database::query($sql);
4514 4514
             return $res;
4515 4515
         } else {
@@ -4534,10 +4534,10 @@  discard block
 block discarded – undo
4534 4534
         $course_id = api_get_course_int_id();
4535 4535
         $lp_id = $this->get_id();
4536 4536
         $sql = "UPDATE $lp_table SET
4537
-                content_maker = '" . Database::escape_string($this->maker) . "'
4537
+                content_maker = '".Database::escape_string($this->maker)."'
4538 4538
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4539 4539
         if ($this->debug > 2) {
4540
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4540
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4541 4541
         }
4542 4542
         Database::query($sql);
4543 4543
         return true;
@@ -4561,10 +4561,10 @@  discard block
 block discarded – undo
4561 4561
         $lp_id = $this->get_id();
4562 4562
         $course_id = $this->course_info['real_id'];
4563 4563
         $sql = "UPDATE $lp_table SET
4564
-                name = '" . Database::escape_string($this->name). "'
4564
+                name = '".Database::escape_string($this->name)."'
4565 4565
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4566 4566
         if ($this->debug > 2) {
4567
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4567
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4568 4568
         }
4569 4569
         $result = Database::query($sql);
4570 4570
         // If the lp is visible on the homepage, change his name there.
@@ -4572,7 +4572,7 @@  discard block
 block discarded – undo
4572 4572
             $session_id = api_get_session_id();
4573 4573
             $session_condition = api_get_session_condition($session_id);
4574 4574
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4575
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4575
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4576 4576
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4577 4577
             	    WHERE
4578 4578
             	        c_id = $course_id AND
@@ -4650,10 +4650,10 @@  discard block
 block discarded – undo
4650 4650
 
4651 4651
                 // Save it to search engine.
4652 4652
                 foreach ($missing_terms as $term) {
4653
-                    $doc->add_term($prefix . $term, 1);
4653
+                    $doc->add_term($prefix.$term, 1);
4654 4654
                 }
4655 4655
                 foreach ($deprecated_terms as $term) {
4656
-                    $doc->remove_term($prefix . $term);
4656
+                    $doc->remove_term($prefix.$term);
4657 4657
                 }
4658 4658
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4659 4659
                 $di->getDb()->flush();
@@ -4678,10 +4678,10 @@  discard block
 block discarded – undo
4678 4678
         $this->theme = $name;
4679 4679
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4680 4680
         $lp_id = $this->get_id();
4681
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4681
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4682 4682
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4683 4683
         if ($this->debug > 2) {
4684
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4684
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4685 4685
         }
4686 4686
         Database::query($sql);
4687 4687
 
@@ -4704,10 +4704,10 @@  discard block
 block discarded – undo
4704 4704
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4705 4705
         $lp_id = $this->get_id();
4706 4706
         $sql = "UPDATE $lp_table SET
4707
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4707
+                preview_image = '".Database::escape_string($this->preview_image)."'
4708 4708
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4709 4709
         if ($this->debug > 2) {
4710
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4710
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4711 4711
         }
4712 4712
         Database::query($sql);
4713 4713
         return true;
@@ -4727,10 +4727,10 @@  discard block
 block discarded – undo
4727 4727
         $this->author = $name;
4728 4728
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4729 4729
         $lp_id = $this->get_id();
4730
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4730
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4731 4731
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4732 4732
         if ($this->debug > 2) {
4733
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4733
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4734 4734
         }
4735 4735
         Database::query($sql);
4736 4736
 
@@ -4748,15 +4748,15 @@  discard block
 block discarded – undo
4748 4748
         if ($this->debug > 0) {
4749 4749
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4750 4750
         }
4751
-        if (intval($hide) == $hide){
4751
+        if (intval($hide) == $hide) {
4752 4752
             $this->hide_toc_frame = $hide;
4753 4753
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4754 4754
             $lp_id = $this->get_id();
4755 4755
             $sql = "UPDATE $lp_table SET
4756
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4756
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4757 4757
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4758 4758
             if ($this->debug > 2) {
4759
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4759
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4760 4760
             }
4761 4761
             Database::query($sql);
4762 4762
 
@@ -4783,7 +4783,7 @@  discard block
 block discarded – undo
4783 4783
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4784 4784
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4785 4785
         if ($this->debug > 2) {
4786
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4786
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4787 4787
         }
4788 4788
         Database::query($sql);
4789 4789
         return true;
@@ -4807,10 +4807,10 @@  discard block
 block discarded – undo
4807 4807
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4808 4808
         $lp_id = $this->get_id();
4809 4809
         $sql = "UPDATE $lp_table SET
4810
-                    content_local = '" . Database::escape_string($name) . "'
4810
+                    content_local = '".Database::escape_string($name)."'
4811 4811
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4812 4812
         if ($this->debug > 2) {
4813
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4813
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4814 4814
         }
4815 4815
         Database::query($sql);
4816 4816
         return true;
@@ -4844,11 +4844,11 @@  discard block
 block discarded – undo
4844 4844
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4845 4845
         $lp_id = $this->get_id();
4846 4846
         $sql = "UPDATE $lp_table SET
4847
-                    use_max_score = '" . $this->use_max_score . "'
4847
+                    use_max_score = '".$this->use_max_score."'
4848 4848
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4849 4849
 
4850 4850
         if ($this->debug > 2) {
4851
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4851
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4852 4852
         }
4853 4853
         Database::query($sql);
4854 4854
 
@@ -4875,10 +4875,10 @@  discard block
 block discarded – undo
4875 4875
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4876 4876
         $lp_id = $this->get_id();
4877 4877
         $sql = "UPDATE $lp_table SET
4878
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4878
+                expired_on = '".Database::escape_string($this->expired_on)."'
4879 4879
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4880 4880
         if ($this->debug > 2) {
4881
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4881
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4882 4882
         }
4883 4883
         Database::query($sql);
4884 4884
 
@@ -4904,10 +4904,10 @@  discard block
 block discarded – undo
4904 4904
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4905 4905
         $lp_id = $this->get_id();
4906 4906
         $sql = "UPDATE $lp_table SET
4907
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4907
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4908 4908
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4909 4909
         if ($this->debug > 2) {
4910
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4910
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4911 4911
         }
4912 4912
         Database::query($sql);
4913 4913
 
@@ -4927,10 +4927,10 @@  discard block
 block discarded – undo
4927 4927
         $this->modified_on = api_get_utc_datetime();
4928 4928
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4929 4929
         $lp_id = $this->get_id();
4930
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4930
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4931 4931
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4932 4932
         if ($this->debug > 2) {
4933
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4933
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4934 4934
         }
4935 4935
         Database::query($sql);
4936 4936
         return true;
@@ -5001,13 +5001,13 @@  discard block
 block discarded – undo
5001 5001
 
5002 5002
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5003 5003
             if ($this->debug > 2) {
5004
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5004
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5005 5005
             }
5006 5006
             switch ($this->get_type()) {
5007 5007
                 case '3' :
5008 5008
                     if ($this->items[$this->last]->get_type() != 'au') {
5009 5009
                         if ($this->debug > 2) {
5010
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5010
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5011 5011
                         }
5012 5012
                         $this->items[$this->last]->close();
5013 5013
                         //$this->autocomplete_parents($this->last);
@@ -5020,7 +5020,7 @@  discard block
 block discarded – undo
5020 5020
                 case '2' :
5021 5021
                     if ($this->items[$this->last]->get_type() != 'sco') {
5022 5022
                         if ($this->debug > 2) {
5023
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5023
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5024 5024
                         }
5025 5025
                         $this->items[$this->last]->close();
5026 5026
                         //$this->autocomplete_parents($this->last);
@@ -5034,7 +5034,7 @@  discard block
 block discarded – undo
5034 5034
                 case '1' :
5035 5035
                 default :
5036 5036
                     if ($this->debug > 2) {
5037
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5037
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5038 5038
                     }
5039 5039
                     $this->items[$this->last]->close();
5040 5040
                     break;
@@ -5060,7 +5060,7 @@  discard block
 block discarded – undo
5060 5060
         }
5061 5061
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5062 5062
         $sql = "SELECT * FROM $lp_table
5063
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5063
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5064 5064
         $res = Database::query($sql);
5065 5065
         if (Database :: num_rows($res) > 0) {
5066 5066
             $row = Database :: fetch_array($res);
@@ -5081,14 +5081,14 @@  discard block
 block discarded – undo
5081 5081
                     break;
5082 5082
             }
5083 5083
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5084
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5084
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5085 5085
             Database::query($sql);
5086 5086
             $this->mode = $view_mode;
5087 5087
 
5088 5088
             return $view_mode;
5089 5089
         } else {
5090 5090
             if ($this->debug > 2) {
5091
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5091
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5092 5092
             }
5093 5093
         }
5094 5094
         return -1;
@@ -5106,7 +5106,7 @@  discard block
 block discarded – undo
5106 5106
         }
5107 5107
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5108 5108
         $sql = "SELECT * FROM $lp_table
5109
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5109
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5110 5110
         $res = Database::query($sql);
5111 5111
         if (Database :: num_rows($res) > 0) {
5112 5112
             $row = Database :: fetch_array($res);
@@ -5119,14 +5119,14 @@  discard block
 block discarded – undo
5119 5119
                 $force_return = true;
5120 5120
             }
5121 5121
             $sql = "UPDATE $lp_table SET force_commit = $force
5122
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5122
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5123 5123
             Database::query($sql);
5124 5124
             $this->force_commit = $force_return;
5125 5125
 
5126 5126
             return $force_return;
5127 5127
         } else {
5128 5128
             if ($this->debug > 2) {
5129
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5129
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5130 5130
             }
5131 5131
         }
5132 5132
         return -1;
@@ -5155,7 +5155,7 @@  discard block
 block discarded – undo
5155 5155
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5156 5156
                     $need_fix = true;
5157 5157
                     $sql = "UPDATE $lp_table SET display_order = $i
5158
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5158
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5159 5159
                     Database::query($sql);
5160 5160
                 }
5161 5161
                 $i++;
@@ -5176,7 +5176,7 @@  discard block
 block discarded – undo
5176 5176
         }
5177 5177
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5178 5178
         $sql = "SELECT * FROM $lp_table
5179
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5179
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5180 5180
         $res = Database::query($sql);
5181 5181
         if (Database :: num_rows($res) > 0) {
5182 5182
             $row = Database :: fetch_array($res);
@@ -5187,13 +5187,13 @@  discard block
 block discarded – undo
5187 5187
                 $force = 1;
5188 5188
             }
5189 5189
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5190
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5190
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5191 5191
             Database::query($sql);
5192 5192
             $this->prevent_reinit = $force;
5193 5193
             return $force;
5194 5194
         } else {
5195 5195
             if ($this->debug > 2) {
5196
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5196
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5197 5197
             }
5198 5198
         }
5199 5199
         return -1;
@@ -5209,11 +5209,11 @@  discard block
 block discarded – undo
5209 5209
     {
5210 5210
         //Set default value for seriousgame_mode
5211 5211
         if (!isset($this->seriousgame_mode)) {
5212
-            $this->seriousgame_mode=0;
5212
+            $this->seriousgame_mode = 0;
5213 5213
         }
5214 5214
         // Set default value for prevent_reinit
5215 5215
         if (!isset($this->prevent_reinit)) {
5216
-            $this->prevent_reinit =1;
5216
+            $this->prevent_reinit = 1;
5217 5217
         }
5218 5218
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5219 5219
             return 'seriousgame';
@@ -5261,7 +5261,7 @@  discard block
 block discarded – undo
5261 5261
         $sql = "UPDATE $lp_table SET
5262 5262
                 prevent_reinit = $prevent_reinit ,
5263 5263
                 seriousgame_mode = $sg_mode
5264
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5264
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5265 5265
         $res = Database::query($sql);
5266 5266
         if ($res) {
5267 5267
             return true;
@@ -5313,7 +5313,7 @@  discard block
 block discarded – undo
5313 5313
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5314 5314
         }
5315 5315
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5316
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5316
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5317 5317
         $res = Database::query($sql);
5318 5318
         if (Database :: num_rows($res) > 0) {
5319 5319
             $row = Database :: fetch_array($res);
@@ -5324,13 +5324,13 @@  discard block
 block discarded – undo
5324 5324
                 $force = 1;
5325 5325
             }
5326 5326
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5327
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5327
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5328 5328
             Database::query($sql);
5329 5329
             $this->seriousgame_mode = $force;
5330 5330
             return $force;
5331 5331
         } else {
5332 5332
             if ($this->debug > 2) {
5333
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5333
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5334 5334
             }
5335 5335
         }
5336 5336
         return -1;
@@ -5348,7 +5348,7 @@  discard block
 block discarded – undo
5348 5348
         }
5349 5349
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5350 5350
         $sql = "SELECT * FROM $lp_table
5351
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5351
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5352 5352
         $res = Database::query($sql);
5353 5353
         if (Database :: num_rows($res) > 0) {
5354 5354
             $row = Database :: fetch_array($res);
@@ -5359,13 +5359,13 @@  discard block
 block discarded – undo
5359 5359
                 $force = 1;
5360 5360
             }
5361 5361
             $sql = "UPDATE $lp_table SET debug = $force
5362
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5362
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5363 5363
             $res = Database::query($sql);
5364 5364
             $this->scorm_debug = $force;
5365 5365
             return $force;
5366 5366
         } else {
5367 5367
             if ($this->debug > 2) {
5368
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5368
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5369 5369
             }
5370 5370
         }
5371 5371
         return -1;
@@ -5394,7 +5394,7 @@  discard block
 block discarded – undo
5394 5394
      * @param int $depth
5395 5395
      * @param array $tmp
5396 5396
      */
5397
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5397
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5398 5398
     {
5399 5399
         if ($this->debug > 1) {
5400 5400
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5480,7 +5480,7 @@  discard block
 block discarded – undo
5480 5480
 
5481 5481
         // we need to start a form when we want to update all the mp3 files
5482 5482
         if ($update_audio == 'true') {
5483
-            $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">';
5483
+            $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">';
5484 5484
         }
5485 5485
         $return .= '<div id="message"></div>';
5486 5486
         if (count($this->items) == 0) {
@@ -5488,14 +5488,14 @@  discard block
 block discarded – undo
5488 5488
         } else {
5489 5489
             $return_audio = '<table class="data_table">';
5490 5490
             $return_audio .= '<tr>';
5491
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5492
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5491
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5492
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5493 5493
             $return_audio .= '</tr>';
5494 5494
 
5495 5495
             if ($update_audio != 'true') {
5496 5496
                 $return .= '<div class="col-md-12">';
5497 5497
                 $return .= self::return_new_tree($update_audio);
5498
-                $return .='</div>';
5498
+                $return .= '</div>';
5499 5499
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5500 5500
             } else {
5501 5501
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5505,7 +5505,7 @@  discard block
 block discarded – undo
5505 5505
             // We need to close the form when we are updating the mp3 files.
5506 5506
             if ($update_audio == 'true') {
5507 5507
                 $return .= '<div class="footer-audio">';
5508
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5508
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5509 5509
                 $return .= '</div>';
5510 5510
                 //$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?
5511 5511
             }
@@ -5526,7 +5526,7 @@  discard block
 block discarded – undo
5526 5526
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5527 5527
     {
5528 5528
         $return = '';
5529
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5529
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5530 5530
 
5531 5531
         $course_id = api_get_course_int_id();
5532 5532
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5574,7 +5574,7 @@  discard block
 block discarded – undo
5574 5574
 
5575 5575
             // Link for the documents
5576 5576
             if ($arrLP[$i]['item_type'] == 'document') {
5577
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5577
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5578 5578
                 $title_cut = Display::url(
5579 5579
                     $title_cut,
5580 5580
                     $url,
@@ -5590,14 +5590,14 @@  discard block
 block discarded – undo
5590 5590
             } else {
5591 5591
                 $oddClass = 'row_even';
5592 5592
             }
5593
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5593
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5594 5594
 
5595 5595
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5596 5596
 
5597
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5597
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5598 5598
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5599 5599
             } else {
5600
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5600
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5601 5601
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5602 5602
                 } else {
5603 5603
                     $icon = Display::return_icon('folder_document.gif');
@@ -5605,7 +5605,7 @@  discard block
 block discarded – undo
5605 5605
             }
5606 5606
 
5607 5607
             // The audio column.
5608
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5608
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5609 5609
             $audio = '';
5610 5610
 
5611 5611
             if (!$update_audio || $update_audio <> 'true') {
@@ -5616,10 +5616,10 @@  discard block
 block discarded – undo
5616 5616
             } else {
5617 5617
                 $types = self::getChapterTypes();
5618 5618
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5619
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5619
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5620 5620
                     if (!empty ($arrLP[$i]['audio'])) {
5621 5621
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5622
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5622
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5623 5623
                     }
5624 5624
                 }
5625 5625
             }
@@ -5643,7 +5643,7 @@  discard block
 block discarded – undo
5643 5643
                 // No edit for this item types
5644 5644
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5645 5645
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5646
-                        $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">';
5646
+                        $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">';
5647 5647
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5648 5648
                         $edit_icon .= '</a>';
5649 5649
 
@@ -5656,7 +5656,7 @@  discard block
 block discarded – undo
5656 5656
                                 $this->lp_session_id
5657 5657
                             )
5658 5658
                             ) {
5659
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5659
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5660 5660
                                     'action' => 'dissociate_forum',
5661 5661
                                     'id' => $arrLP[$i]['id'],
5662 5662
                                     'lp_id' => $this->lp_id
@@ -5667,7 +5667,7 @@  discard block
 block discarded – undo
5667 5667
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5668 5668
                                 );
5669 5669
                             } else {
5670
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5670
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5671 5671
                                     'action' => 'create_forum',
5672 5672
                                     'id' => $arrLP[$i]['id'],
5673 5673
                                     'lp_id' => $this->lp_id
@@ -5680,17 +5680,17 @@  discard block
 block discarded – undo
5680 5680
                             }
5681 5681
                         }
5682 5682
                     } else {
5683
-                        $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">';
5683
+                        $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">';
5684 5684
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5685 5685
                         $edit_icon .= '</a>';
5686 5686
                     }
5687 5687
                 }
5688 5688
 
5689
-                $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">';
5689
+                $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">';
5690 5690
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5691 5691
                 $delete_icon .= '</a>';
5692 5692
 
5693
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5693
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5694 5694
 
5695 5695
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5696 5696
                     $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']);
@@ -5699,8 +5699,8 @@  discard block
 block discarded – undo
5699 5699
                 }
5700 5700
             }
5701 5701
             if ($update_audio != 'true') {
5702
-                $row = $move_icon . ' ' . $icon .
5703
-                    Display::span($title_cut) .
5702
+                $row = $move_icon.' '.$icon.
5703
+                    Display::span($title_cut).
5704 5704
                     Display::tag(
5705 5705
                         'div',
5706 5706
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5721,8 +5721,8 @@  discard block
 block discarded – undo
5721 5721
                 $parent_arrays = array();
5722 5722
                 if ($arrLP[$i]['depth'] > 1) {
5723 5723
                     //Getting list of parents
5724
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5725
-                        foreach($arrLP as $item) {
5724
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5725
+                        foreach ($arrLP as $item) {
5726 5726
                             if ($item['id'] == $parent_id) {
5727 5727
                                 if ($item['parent_item_id'] == 0) {
5728 5728
                                     $parent_id = $item['id'];
@@ -5744,8 +5744,8 @@  discard block
 block discarded – undo
5744 5744
                     $parent_arrays = array_reverse($parent_arrays);
5745 5745
                     $val = '$elements';
5746 5746
                     $x = 0;
5747
-                    foreach($parent_arrays as $item) {
5748
-                        if ($x != count($parent_arrays) -1) {
5747
+                    foreach ($parent_arrays as $item) {
5748
+                        if ($x != count($parent_arrays) - 1) {
5749 5749
                             $val .= '["'.$item.'"]["children"]';
5750 5750
                         } else {
5751 5751
                             $val .= '["'.$item.'"]["children"]';
@@ -5808,7 +5808,7 @@  discard block
 block discarded – undo
5808 5808
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5809 5809
                     $active = 'active';
5810 5810
                 }
5811
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5811
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5812 5812
             } else {
5813 5813
                 //sections
5814 5814
                 if (isset($item['children'])) {
@@ -5831,17 +5831,17 @@  discard block
 block discarded – undo
5831 5831
     {
5832 5832
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5833 5833
         $return = '<div class="actions">';
5834
-        $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> ';
5835
-        $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>';
5836
-        $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>';
5834
+        $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> ';
5835
+        $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>';
5836
+        $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>';
5837 5837
         $buttons = array(
5838 5838
             array(
5839 5839
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5840
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5840
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5841 5841
             ),
5842 5842
             array(
5843 5843
                 'title' => get_lang('ClearAllPrerequisites'),
5844
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5844
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5845 5845
             ),
5846 5846
         );
5847 5847
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5862,7 +5862,7 @@  discard block
 block discarded – undo
5862 5862
     {
5863 5863
         // Creating learning_path folder
5864 5864
         $dir = '/learning_path';
5865
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5865
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5866 5866
         $folder = false;
5867 5867
         if (!is_dir($filepath.'/'.$dir)) {
5868 5868
             $folderData = create_unexisting_directory(
@@ -5903,9 +5903,9 @@  discard block
 block discarded – undo
5903 5903
         // Creating LP folder
5904 5904
         if ($folder) {
5905 5905
             //Limits title size
5906
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5906
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5907 5907
             $dir   = $dir.$title;
5908
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5908
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5909 5909
             if (!is_dir($filepath.'/'.$dir)) {
5910 5910
                 $folderData = create_unexisting_directory(
5911 5911
                     $course,
@@ -5925,7 +5925,7 @@  discard block
 block discarded – undo
5925 5925
             }
5926 5926
             $dir = $dir.'/';
5927 5927
             if ($folder) {
5928
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5928
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5929 5929
             }
5930 5930
         }
5931 5931
         $array = array(
@@ -5964,12 +5964,12 @@  discard block
 block discarded – undo
5964 5964
             $dir = substr($dir, 1);
5965 5965
         }
5966 5966
         if (!empty($dir[0]) && $dir[0] != '/') {
5967
-            $dir = '/' . $dir;
5967
+            $dir = '/'.$dir;
5968 5968
         }
5969 5969
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5970 5970
             $dir .= '/';
5971 5971
         }
5972
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5972
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5973 5973
 
5974 5974
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5975 5975
             //Generates folder
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
         }
5980 5980
 
5981 5981
         if (!is_dir($filepath)) {
5982
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
5982
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
5983 5983
             $dir = '/';
5984 5984
         }
5985 5985
 
@@ -6002,10 +6002,10 @@  discard block
 block discarded – undo
6002 6002
         $tmp_filename = $filename;
6003 6003
 
6004 6004
         $i = 0;
6005
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6006
-            $tmp_filename = $filename . '_' . ++ $i;
6005
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6006
+            $tmp_filename = $filename.'_'.++ $i;
6007 6007
 
6008
-        $filename = $tmp_filename . '.'.$extension;
6008
+        $filename = $tmp_filename.'.'.$extension;
6009 6009
         if ($extension == 'html') {
6010 6010
             $content = stripslashes($content);
6011 6011
             $content = str_replace(
@@ -6040,12 +6040,12 @@  discard block
 block discarded – undo
6040 6040
             );
6041 6041
         }
6042 6042
 
6043
-        if (!file_exists($filepath . $filename)) {
6044
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6043
+        if (!file_exists($filepath.$filename)) {
6044
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6045 6045
                 fputs($fp, $content);
6046 6046
                 fclose($fp);
6047 6047
 
6048
-                $file_size = filesize($filepath . $filename);
6048
+                $file_size = filesize($filepath.$filename);
6049 6049
                 $save_file_path = $dir.$filename;
6050 6050
 
6051 6051
                 $document_id = add_document(
@@ -6077,12 +6077,12 @@  discard block
 block discarded – undo
6077 6077
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6078 6078
                         $ct = '';
6079 6079
                         if ($new_comment)
6080
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6080
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6081 6081
                         if ($new_title)
6082
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6082
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6083 6083
 
6084
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6085
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6084
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6085
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6086 6086
                         Database::query($sql);
6087 6087
                     }
6088 6088
                 }
@@ -6110,42 +6110,42 @@  discard block
 block discarded – undo
6110 6110
             $dir = substr($dir, 1);
6111 6111
 
6112 6112
         if ($dir[0] != '/')
6113
-            $dir = '/' . $dir;
6113
+            $dir = '/'.$dir;
6114 6114
 
6115 6115
         if ($dir[strlen($dir) - 1] != '/')
6116 6116
             $dir .= '/';
6117 6117
 
6118
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6118
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6119 6119
 
6120 6120
         if (!is_dir($filepath)) {
6121
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6121
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6122 6122
             $dir = '/';
6123 6123
         }
6124 6124
 
6125 6125
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6126 6126
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6127 6127
             $document_id = intval($_POST['path']);
6128
-            $sql = "SELECT path FROM " . $table_doc . "
6129
-                    WHERE c_id = $course_id AND id = " . $document_id;
6128
+            $sql = "SELECT path FROM ".$table_doc."
6129
+                    WHERE c_id = $course_id AND id = ".$document_id;
6130 6130
             $res = Database::query($sql);
6131 6131
             $row = Database :: fetch_array($res);
6132 6132
             $content = stripslashes($_POST['content_lp']);
6133
-            $file = $filepath . $row['path'];
6133
+            $file = $filepath.$row['path'];
6134 6134
 
6135 6135
             if ($fp = @ fopen($file, 'w')) {
6136
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6136
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6137 6137
 
6138 6138
                 // Change the path of mp3 to absolute.
6139 6139
                 // The first regexp deals with :// urls.
6140
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6140
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6141 6141
                 // The second regexp deals with audio/ urls.
6142
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6142
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6143 6143
                 fputs($fp, $content);
6144 6144
                 fclose($fp);
6145 6145
 
6146
-                $sql = "UPDATE " . $table_doc ." SET
6146
+                $sql = "UPDATE ".$table_doc." SET
6147 6147
                             title='".Database::escape_string($_POST['title'])."'
6148
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6148
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6149 6149
                 Database::query($sql);
6150 6150
             }
6151 6151
         }
@@ -6163,10 +6163,10 @@  discard block
 block discarded – undo
6163 6163
         $return = '';
6164 6164
         if (is_numeric($item_id)) {
6165 6165
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6166
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6167
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6166
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6167
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6168 6168
             $result = Database::query($sql);
6169
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6169
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6170 6170
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6171 6171
 
6172 6172
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6193,8 +6193,8 @@  discard block
 block discarded – undo
6193 6193
                         break;
6194 6194
                     case TOOL_DOCUMENT:
6195 6195
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6196
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6197
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6196
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6197
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6198 6198
                         $result = Database::query($sql_doc);
6199 6199
                         $path_file = Database::result($result, 0, 0);
6200 6200
                         $path_parts = pathinfo($path_file);
@@ -6233,7 +6233,7 @@  discard block
 block discarded – undo
6233 6233
         if (is_numeric($item_id)) {
6234 6234
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6235 6235
             $sql = "SELECT * FROM $tbl_lp_item
6236
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6236
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6237 6237
             $res = Database::query($sql);
6238 6238
             $row = Database::fetch_array($res);
6239 6239
 
@@ -6244,21 +6244,21 @@  discard block
 block discarded – undo
6244 6244
                 case 'sco' :
6245 6245
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6246 6246
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6247
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6247
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6248 6248
                     } else {
6249
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6249
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6250 6250
                     }
6251 6251
                     break;
6252 6252
                 case TOOL_DOCUMENT :
6253 6253
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6254 6254
                     $sql = "SELECT lp.*, doc.path as dir
6255
-                            FROM " . $tbl_lp_item . " as lp
6256
-                            LEFT JOIN " . $tbl_doc . " as doc
6255
+                            FROM " . $tbl_lp_item." as lp
6256
+                            LEFT JOIN " . $tbl_doc." as doc
6257 6257
                             ON doc.id = lp.path
6258 6258
                             WHERE
6259 6259
                                 lp.c_id = $course_id AND
6260 6260
                                 doc.c_id = $course_id AND
6261
-                                lp.id = " . intval($item_id);
6261
+                                lp.id = ".intval($item_id);
6262 6262
                     $res_step = Database::query($sql);
6263 6263
                     $row_step = Database :: fetch_array($res_step);
6264 6264
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6268,8 +6268,8 @@  discard block
 block discarded – undo
6268 6268
                     $link_id = (string) $row['path'];
6269 6269
                     if (ctype_digit($link_id)) {
6270 6270
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6271
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6272
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6271
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6272
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6273 6273
                         $res_link = Database::query($sql_select);
6274 6274
                         $row_link = Database :: fetch_array($res_link);
6275 6275
                         if (is_array($row_link)) {
@@ -6282,9 +6282,9 @@  discard block
 block discarded – undo
6282 6282
                 case 'dokeos_module' :
6283 6283
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6284 6284
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6285
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6285
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6286 6286
                     } else {
6287
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6287
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6288 6288
                     }
6289 6289
                     break;
6290 6290
                 case TOOL_QUIZ :
@@ -6339,7 +6339,7 @@  discard block
 block discarded – undo
6339 6339
 
6340 6340
         $headers = array(
6341 6341
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6342
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6342
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6343 6343
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6344 6344
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6345 6345
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6379,16 +6379,16 @@  discard block
 block discarded – undo
6379 6379
         $course_id = api_get_course_int_id();
6380 6380
         $return = '';
6381 6381
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6382
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6383
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6382
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6383
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6384 6384
         $res_doc = Database::query($sql_doc);
6385 6385
         $row_doc = Database :: fetch_array($res_doc);
6386 6386
 
6387 6387
         // TODO: Add a path filter.
6388 6388
         if ($iframe) {
6389
-            $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>';
6389
+            $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>';
6390 6390
         } else {
6391
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6391
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6392 6392
         }
6393 6393
 
6394 6394
         return $return;
@@ -6412,8 +6412,8 @@  discard block
 block discarded – undo
6412 6412
             $item_description = $extra_info['description'];
6413 6413
         } elseif (is_numeric($extra_info)) {
6414 6414
             $sql = "SELECT title, description
6415
-                    FROM " . $tbl_quiz . "
6416
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6415
+                    FROM " . $tbl_quiz."
6416
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6417 6417
 
6418 6418
             $result = Database::query($sql);
6419 6419
             $row = Database::fetch_array($result);
@@ -6423,8 +6423,8 @@  discard block
 block discarded – undo
6423 6423
             $item_title = '';
6424 6424
             $item_description = '';
6425 6425
         }
6426
-        $item_title			= Security::remove_XSS($item_title);
6427
-        $item_description 	= Security::remove_XSS($item_description);
6426
+        $item_title = Security::remove_XSS($item_title);
6427
+        $item_description = Security::remove_XSS($item_description);
6428 6428
 
6429 6429
         $legend = '<legend>';
6430 6430
         if ($id != 0 && is_array($extra_info))
@@ -6432,13 +6432,13 @@  discard block
 block discarded – undo
6432 6432
         else
6433 6433
             $parent = 0;
6434 6434
 
6435
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6436
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6435
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6436
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6437 6437
 
6438 6438
         $result = Database::query($sql);
6439
-        $arrLP = array ();
6439
+        $arrLP = array();
6440 6440
         while ($row = Database :: fetch_array($result)) {
6441
-            $arrLP[] = array (
6441
+            $arrLP[] = array(
6442 6442
                 'id' => $row['id'],
6443 6443
                 'item_type' => $row['item_type'],
6444 6444
                 'title' => $row['title'],
@@ -6461,15 +6461,15 @@  discard block
 block discarded – undo
6461 6461
         unset ($this->arrMenu);
6462 6462
 
6463 6463
         if ($action == 'add') {
6464
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6464
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6465 6465
         } elseif ($action == 'move') {
6466
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6466
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6467 6467
         } else {
6468
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6468
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6469 6469
         }
6470 6470
 
6471 6471
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6472
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6472
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6473 6473
         }
6474 6474
 
6475 6475
         $legend .= '</legend>';
@@ -6482,34 +6482,34 @@  discard block
 block discarded – undo
6482 6482
 
6483 6483
         if ($action != 'move') {
6484 6484
             $return .= '<tr>';
6485
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6486
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6485
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6486
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6487 6487
             $return .= '</tr>';
6488 6488
         }
6489 6489
 
6490 6490
         $return .= '<tr>';
6491 6491
 
6492
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6492
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6493 6493
         $return .= '<td class="input">';
6494 6494
 
6495 6495
         // Select for Parent item, root or chapter
6496 6496
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6497 6497
 
6498
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6498
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6499 6499
 
6500
-        $arrHide = array (
6500
+        $arrHide = array(
6501 6501
             $id
6502 6502
         );
6503 6503
         for ($i = 0; $i < count($arrLP); $i++) {
6504 6504
             if ($action != 'add') {
6505 6505
                 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)) {
6506
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6506
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6507 6507
                 } else {
6508 6508
                     $arrHide[] = $arrLP[$i]['id'];
6509 6509
                 }
6510 6510
             } else {
6511 6511
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6512
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6512
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6513 6513
             }
6514 6514
         }
6515 6515
         if (is_array($arrLP)) {
@@ -6521,11 +6521,11 @@  discard block
 block discarded – undo
6521 6521
         $return .= '</tr>';
6522 6522
         $return .= '<tr>';
6523 6523
 
6524
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6524
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6525 6525
         $return .= '<td class="input">';
6526 6526
 
6527 6527
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6528
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6528
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6529 6529
         for ($i = 0; $i < count($arrLP); $i++) {
6530 6530
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6531 6531
                 if (is_array($extra_info)) {
@@ -6537,7 +6537,7 @@  discard block
 block discarded – undo
6537 6537
                 } else {
6538 6538
                     $selected = '';
6539 6539
                 }
6540
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6540
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6541 6541
             }
6542 6542
         }
6543 6543
         $return .= '</select>';
@@ -6554,7 +6554,7 @@  discard block
 block discarded – undo
6554 6554
                     }
6555 6555
                 }
6556 6556
             }
6557
-            $arrHide = array ();
6557
+            $arrHide = array();
6558 6558
             for ($i = 0; $i < count($arrLP); $i++) {
6559 6559
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6560 6560
                     if (is_array($extra_info)) {
@@ -6600,27 +6600,27 @@  discard block
 block discarded – undo
6600 6600
 
6601 6601
         $return .= '<tr>';
6602 6602
         if ($action == 'add') {
6603
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6603
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6604 6604
         } else {
6605
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6605
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6606 6606
         }
6607 6607
 
6608 6608
         $return .= '</tr>';
6609 6609
         $return .= '</table>';
6610 6610
 
6611 6611
         if ($action == 'move') {
6612
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6613
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6612
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6613
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6614 6614
         }
6615 6615
 
6616 6616
         if (is_numeric($extra_info)) {
6617
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6617
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6618 6618
         } elseif (is_array($extra_info)) {
6619
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6619
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6620 6620
         }
6621 6621
 
6622
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6623
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6622
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6623
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6624 6624
 
6625 6625
         $return .= '</form>';
6626 6626
         $return .= '</div>';
@@ -6647,11 +6647,11 @@  discard block
 block discarded – undo
6647 6647
         } elseif (is_numeric($extra_info)) {
6648 6648
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6649 6649
 
6650
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6650
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6651 6651
                     WHERE
6652 6652
                         c_id = ".$course_id." AND
6653
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6654
-                        id = " . (int) $extra_info . "
6653
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6654
+                        id = " . (int) $extra_info."
6655 6655
                     ORDER BY id ASC";
6656 6656
 
6657 6657
             $res_hot = Database::query($sql);
@@ -6675,11 +6675,11 @@  discard block
 block discarded – undo
6675 6675
         }
6676 6676
 
6677 6677
         $sql = "SELECT * FROM $tbl_lp_item
6678
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6678
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6679 6679
         $result = Database::query($sql);
6680
-        $arrLP = array ();
6680
+        $arrLP = array();
6681 6681
         while ($row = Database :: fetch_array($result)) {
6682
-            $arrLP[] = array (
6682
+            $arrLP[] = array(
6683 6683
                 'id' => $row['id'],
6684 6684
                 'item_type' => $row['item_type'],
6685 6685
                 'title' => $row['title'],
@@ -6704,7 +6704,7 @@  discard block
 block discarded – undo
6704 6704
         else
6705 6705
             $legend .= get_lang('EditCurrentExecice');
6706 6706
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6707
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6707
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6708 6708
         }
6709 6709
         $legend .= '</legend>';
6710 6710
 
@@ -6712,11 +6712,11 @@  discard block
 block discarded – undo
6712 6712
         $return .= $legend;
6713 6713
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6714 6714
         $return .= '<tr>';
6715
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6715
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6716 6716
         $return .= '<td class="input">';
6717 6717
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6718
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6719
-        $arrHide = array (
6718
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6719
+        $arrHide = array(
6720 6720
             $id
6721 6721
         );
6722 6722
 
@@ -6724,13 +6724,13 @@  discard block
 block discarded – undo
6724 6724
             for ($i = 0; $i < count($arrLP); $i++) {
6725 6725
                 if ($action != 'add') {
6726 6726
                     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)) {
6727
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6727
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6728 6728
                     } else {
6729 6729
                         $arrHide[] = $arrLP[$i]['id'];
6730 6730
                     }
6731 6731
                 } else {
6732 6732
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6733
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6733
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6734 6734
                 }
6735 6735
             }
6736 6736
 
@@ -6741,10 +6741,10 @@  discard block
 block discarded – undo
6741 6741
         $return .= '</td>';
6742 6742
         $return .= '</tr>';
6743 6743
         $return .= '<tr>';
6744
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6744
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6745 6745
         $return .= '<td class="input">';
6746 6746
         $return .= '<select id="previous" name="previous" size="1">';
6747
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6747
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6748 6748
 
6749 6749
         for ($i = 0; $i < count($arrLP); $i++) {
6750 6750
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6754,7 +6754,7 @@  discard block
 block discarded – undo
6754 6754
                 else
6755 6755
                     $selected = '';
6756 6756
 
6757
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6757
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6758 6758
             }
6759 6759
         }
6760 6760
 
@@ -6764,8 +6764,8 @@  discard block
 block discarded – undo
6764 6764
 
6765 6765
         if ($action != 'move') {
6766 6766
             $return .= '<tr>';
6767
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6768
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6767
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6768
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6769 6769
             $return .= '</tr>';
6770 6770
             $id_prerequisite = 0;
6771 6771
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6776,7 +6776,7 @@  discard block
 block discarded – undo
6776 6776
                     }
6777 6777
                 }
6778 6778
 
6779
-                $arrHide = array ();
6779
+                $arrHide = array();
6780 6780
                 for ($i = 0; $i < count($arrLP); $i++) {
6781 6781
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6782 6782
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6790,22 +6790,22 @@  discard block
 block discarded – undo
6790 6790
         }
6791 6791
 
6792 6792
         $return .= '<tr>';
6793
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6793
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6794 6794
         $return .= '</tr>';
6795 6795
         $return .= '</table>';
6796 6796
 
6797 6797
         if ($action == 'move') {
6798
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6799
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6798
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6799
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6800 6800
         }
6801 6801
 
6802 6802
         if (is_numeric($extra_info)) {
6803
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6803
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6804 6804
         } elseif (is_array($extra_info)) {
6805
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6805
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6806 6806
         }
6807
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6808
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6807
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6808
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6809 6809
         $return .= '</form>';
6810 6810
 
6811 6811
         return $return;
@@ -6828,8 +6828,8 @@  discard block
 block discarded – undo
6828 6828
             $item_title = stripslashes($extra_info['title']);
6829 6829
         } elseif (is_numeric($extra_info)) {
6830 6830
             $sql = "SELECT forum_title as title, forum_comment as comment
6831
-                    FROM " . $tbl_forum . "
6832
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6831
+                    FROM " . $tbl_forum."
6832
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6833 6833
 
6834 6834
             $result = Database::query($sql);
6835 6835
             $row = Database :: fetch_array($result);
@@ -6849,7 +6849,7 @@  discard block
 block discarded – undo
6849 6849
             $parent = 0;
6850 6850
         }
6851 6851
 
6852
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6852
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6853 6853
                 WHERE
6854 6854
                     c_id = ".$course_id." AND
6855 6855
                     lp_id = " . $this->lp_id;
@@ -6857,7 +6857,7 @@  discard block
 block discarded – undo
6857 6857
         $arrLP = array();
6858 6858
 
6859 6859
         while ($row = Database :: fetch_array($result)) {
6860
-            $arrLP[] = array (
6860
+            $arrLP[] = array(
6861 6861
                 'id' => $row['id'],
6862 6862
                 'item_type' => $row['item_type'],
6863 6863
                 'title' => $row['title'],
@@ -6879,10 +6879,10 @@  discard block
 block discarded – undo
6879 6879
         unset($this->arrMenu);
6880 6880
 
6881 6881
         if ($action == 'add')
6882
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6883
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6882
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6883
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6884 6884
         else
6885
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6885
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6886 6886
 
6887 6887
         $legend .= '</legend>';
6888 6888
         $return = '<div class="sectioncomment">';
@@ -6892,16 +6892,16 @@  discard block
 block discarded – undo
6892 6892
 
6893 6893
         if ($action != 'move') {
6894 6894
             $return .= '<tr>';
6895
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6896
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6895
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6896
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6897 6897
             $return .= '</tr>';
6898 6898
         }
6899 6899
 
6900 6900
         $return .= '<tr>';
6901
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6901
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6902 6902
         $return .= '<td class="input">';
6903 6903
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6904
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6904
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6905 6905
         $arrHide = array(
6906 6906
             $id
6907 6907
         );
@@ -6910,13 +6910,13 @@  discard block
 block discarded – undo
6910 6910
         for ($i = 0; $i < count($arrLP); $i++) {
6911 6911
             if ($action != 'add') {
6912 6912
                 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)) {
6913
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6913
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6914 6914
                 } else {
6915 6915
                     $arrHide[] = $arrLP[$i]['id'];
6916 6916
                 }
6917 6917
             } else {
6918 6918
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6919
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6919
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6920 6920
             }
6921 6921
         }
6922 6922
         if (is_array($arrLP)) {
@@ -6927,10 +6927,10 @@  discard block
 block discarded – undo
6927 6927
         $return .= '</td>';
6928 6928
         $return .= '</tr>';
6929 6929
         $return .= '<tr>';
6930
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6930
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6931 6931
         $return .= '<td class="input">';
6932 6932
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6933
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6933
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6934 6934
 
6935 6935
         for ($i = 0; $i < count($arrLP); $i++) {
6936 6936
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6940,8 +6940,8 @@  discard block
 block discarded – undo
6940 6940
                 else
6941 6941
                     $selected = '';
6942 6942
 
6943
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6944
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6943
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6944
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6945 6945
             }
6946 6946
         }
6947 6947
 
@@ -6975,25 +6975,25 @@  discard block
 block discarded – undo
6975 6975
         $return .= '<tr>';
6976 6976
 
6977 6977
         if ($action == 'add') {
6978
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6978
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6979 6979
         } else {
6980
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6980
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
6981 6981
         }
6982 6982
         $return .= '</tr>';
6983 6983
         $return .= '</table>';
6984 6984
 
6985 6985
         if ($action == 'move') {
6986
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6987
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6986
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6987
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6988 6988
         }
6989 6989
 
6990 6990
         if (is_numeric($extra_info)) {
6991
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6991
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6992 6992
         } elseif (is_array($extra_info)) {
6993
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6993
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6994 6994
         }
6995
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
6996
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6995
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
6996
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6997 6997
         $return .= '</form>';
6998 6998
         $return .= '</div>';
6999 6999
 
@@ -7020,7 +7020,7 @@  discard block
 block discarded – undo
7020 7020
             $item_title = stripslashes($extra_info['title']);
7021 7021
         } elseif (is_numeric($extra_info)) {
7022 7022
             $sql = "SELECT thread_title as title FROM $tbl_forum
7023
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7023
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7024 7024
 
7025 7025
             $result = Database::query($sql);
7026 7026
             $row = Database :: fetch_array($result);
@@ -7040,15 +7040,15 @@  discard block
 block discarded – undo
7040 7040
             $parent = 0;
7041 7041
         }
7042 7042
 
7043
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7044
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7043
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7044
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7045 7045
 
7046 7046
         $result = Database::query($sql);
7047 7047
 
7048
-        $arrLP = array ();
7048
+        $arrLP = array();
7049 7049
 
7050 7050
         while ($row = Database :: fetch_array($result)) {
7051
-            $arrLP[] = array (
7051
+            $arrLP[] = array(
7052 7052
                 'id' => $row['id'],
7053 7053
                 'item_type' => $row['item_type'],
7054 7054
                 'title' => $row['title'],
@@ -7071,31 +7071,31 @@  discard block
 block discarded – undo
7071 7071
 
7072 7072
         $return .= '<form method="POST">';
7073 7073
         if ($action == 'add')
7074
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7075
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7074
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7075
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7076 7076
         else
7077
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7077
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7078 7078
 
7079 7079
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7080 7080
         $return .= '<tr>';
7081
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7081
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7082 7082
         $return .= '<td class="input">';
7083 7083
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7084
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7085
-        $arrHide = array (
7084
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7085
+        $arrHide = array(
7086 7086
             $id
7087 7087
         );
7088 7088
 
7089 7089
         for ($i = 0; $i < count($arrLP); $i++) {
7090 7090
             if ($action != 'add') {
7091 7091
                 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)) {
7092
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7092
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7093 7093
                 } else {
7094 7094
                     $arrHide[] = $arrLP[$i]['id'];
7095 7095
                 }
7096 7096
             } else {
7097 7097
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7098
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7098
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7099 7099
             }
7100 7100
         }
7101 7101
 
@@ -7107,10 +7107,10 @@  discard block
 block discarded – undo
7107 7107
         $return .= '</td>';
7108 7108
         $return .= '</tr>';
7109 7109
         $return .= '<tr>';
7110
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7110
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7111 7111
         $return .= '<td class="input">';
7112 7112
         $return .= '<select id="previous" name="previous" size="1">';
7113
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7113
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7114 7114
         for ($i = 0; $i < count($arrLP); $i++) {
7115 7115
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7116 7116
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7119,7 +7119,7 @@  discard block
 block discarded – undo
7119 7119
                 else
7120 7120
                     $selected = '';
7121 7121
 
7122
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7122
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7123 7123
             }
7124 7124
         }
7125 7125
         $return .= '</select>';
@@ -7127,8 +7127,8 @@  discard block
 block discarded – undo
7127 7127
         $return .= '</tr>';
7128 7128
         if ($action != 'move') {
7129 7129
             $return .= '<tr>';
7130
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7131
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7130
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7131
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7132 7132
             $return .= '</tr>';
7133 7133
             $return .= '<tr>';
7134 7134
             $return .= '</tr>';
@@ -7155,17 +7155,17 @@  discard block
 block discarded – undo
7155 7155
             }
7156 7156
 
7157 7157
             $return .= '<tr>';
7158
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7159
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7158
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7159
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7160 7160
 
7161 7161
             foreach ($arrHide as $key => $value) {
7162 7162
                 if ($key == $s_selected_position && $action == 'add') {
7163
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7163
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7164 7164
                 }
7165 7165
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7166
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7166
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7167 7167
                 } else {
7168
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7168
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7169 7169
                 }
7170 7170
             }
7171 7171
             $return .= "</select></td>";
@@ -7179,19 +7179,19 @@  discard block
 block discarded – undo
7179 7179
         $return .= '</table>';
7180 7180
 
7181 7181
         if ($action == 'move') {
7182
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7183
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7182
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7183
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7184 7184
         }
7185 7185
 
7186 7186
         if (is_numeric($extra_info)) {
7187
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7187
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7188 7188
         }
7189 7189
         elseif (is_array($extra_info)) {
7190
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7190
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7191 7191
         }
7192 7192
 
7193
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7194
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7193
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7194
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7195 7195
         $return .= '</form>';
7196 7196
         $return .= '</div>';
7197 7197
 
@@ -7217,10 +7217,10 @@  discard block
 block discarded – undo
7217 7217
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7218 7218
 
7219 7219
         if ($id != 0 && is_array($extra_info)) {
7220
-            $item_title 		= $extra_info['title'];
7221
-            $item_description 	= $extra_info['description'];
7222
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7223
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7220
+            $item_title = $extra_info['title'];
7221
+            $item_description = $extra_info['description'];
7222
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7223
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7224 7224
         } else {
7225 7225
             $item_title = '';
7226 7226
             $item_description = '';
@@ -7234,17 +7234,17 @@  discard block
 block discarded – undo
7234 7234
         }
7235 7235
 
7236 7236
         $id  = intval($id);
7237
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7237
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7238 7238
                 WHERE
7239 7239
                     c_id = ".$course_id." AND
7240
-                    lp_id = " . $this->lp_id . " AND
7240
+                    lp_id = " . $this->lp_id." AND
7241 7241
                     id != $id";
7242 7242
 
7243 7243
         if ($item_type == 'module')
7244 7244
             $sql .= " AND parent_item_id = 0";
7245 7245
 
7246 7246
         $result = Database::query($sql);
7247
-        $arrLP = array ();
7247
+        $arrLP = array();
7248 7248
 
7249 7249
         while ($row = Database :: fetch_array($result)) {
7250 7250
             $arrLP[] = array(
@@ -7272,9 +7272,9 @@  discard block
 block discarded – undo
7272 7272
 
7273 7273
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7274 7274
 
7275
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7275
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7276 7276
 
7277
-        $form = new FormValidator('form', 'POST',  $url);
7277
+        $form = new FormValidator('form', 'POST', $url);
7278 7278
 
7279 7279
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7280 7280
         $defaults['description'] = $item_description;
@@ -7318,7 +7318,7 @@  discard block
 block discarded – undo
7318 7318
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7319 7319
 
7320 7320
             foreach ($arrHide as $key => $value) {
7321
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7321
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7322 7322
             }
7323 7323
             if (!empty($s_selected_parent)) {
7324 7324
                 $parent_select->setSelected($s_selected_parent);
@@ -7340,16 +7340,16 @@  discard block
 block discarded – undo
7340 7340
                     $s_selected_position = $arrLP[$i]['id'];
7341 7341
                 }
7342 7342
 
7343
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7343
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7344 7344
             }
7345 7345
         }
7346 7346
 
7347 7347
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7348 7348
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7349
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7349
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7350 7350
 
7351 7351
         foreach ($arrHide as $key => $value) {
7352
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7352
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7353 7353
         }
7354 7354
 
7355 7355
         if (!empty ($s_selected_position)) {
@@ -7378,23 +7378,23 @@  discard block
 block discarded – undo
7378 7378
         //assets can't be modified
7379 7379
 
7380 7380
         //$item_type == 'asset' ||
7381
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7381
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7382 7382
 
7383 7383
             if ($item_type == 'sco') {
7384
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7384
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7385 7385
             }
7386 7386
             $renderer = $form->defaultRenderer();
7387 7387
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7388 7388
 
7389 7389
             $relative_prefix = '';
7390 7390
 
7391
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7391
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7392 7392
                 'Width' 				=> '100%',
7393 7393
                 'Height' 				=> '500',
7394 7394
                 'FullPage' 				=> true,
7395 7395
                 'CreateDocumentDir' 	=> $relative_prefix,
7396
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7397
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7396
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7397
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7398 7398
             );
7399 7399
 
7400 7400
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7403,7 +7403,7 @@  discard block
 block discarded – undo
7403 7403
             $defaults['content_lp'] = file_get_contents($content_path);
7404 7404
         }
7405 7405
 
7406
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7406
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7407 7407
         $form->addElement('hidden', 'post_time', time());
7408 7408
         $form->setDefaults($defaults);
7409 7409
         return $form->return_form();
@@ -7441,8 +7441,8 @@  discard block
 block discarded – undo
7441 7441
         // We don't display the document form if it's not an editable document (html or txt file).
7442 7442
         if ($action == "add") {
7443 7443
             if (is_numeric($extra_info)) {
7444
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7445
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7444
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7445
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7446 7446
                 $result = Database::query($sql_doc);
7447 7447
                 $path_file = Database :: result($result, 0, 0);
7448 7448
                 $path_parts = pathinfo($path_file);
@@ -7460,13 +7460,13 @@  discard block
 block discarded – undo
7460 7460
                 $item_title = stripslashes($path_parts['filename']);
7461 7461
             }
7462 7462
         } elseif (is_numeric($extra_info)) {
7463
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7463
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7464 7464
                         WHERE
7465 7465
                             c_id = ".$course_id." AND
7466 7466
                             id = " . intval($extra_info);
7467 7467
 
7468 7468
             $result = Database::query($sql_doc);
7469
-            $row 	= Database::fetch_array($result);
7469
+            $row = Database::fetch_array($result);
7470 7470
             $item_title = $row['title'];
7471 7471
             $item_title = str_replace('_', ' ', $item_title);
7472 7472
             if (empty ($item_title)) {
@@ -7485,11 +7485,11 @@  discard block
 block discarded – undo
7485 7485
             $parent = 0;
7486 7486
         }
7487 7487
 
7488
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7489
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7488
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7489
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7490 7490
 
7491 7491
         $result = Database::query($sql);
7492
-        $arrLP = array ();
7492
+        $arrLP = array();
7493 7493
         while ($row = Database :: fetch_array($result)) {
7494 7494
             $arrLP[] = array(
7495 7495
                 'id' => $row['id'],
@@ -7523,9 +7523,9 @@  discard block
 block discarded – undo
7523 7523
         $return .= '</legend>';
7524 7524
 
7525 7525
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7526
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7526
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7527 7527
         }
7528
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7528
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7529 7529
         $defaults['title'] = Security :: remove_XSS($item_title);
7530 7530
         if (empty($item_title)) {
7531 7531
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7561,15 +7561,15 @@  discard block
 block discarded – undo
7561 7561
         }
7562 7562
 
7563 7563
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7564
-        $my_count=0;
7564
+        $my_count = 0;
7565 7565
         foreach ($arrHide as $key => $value) {
7566
-            if ($my_count!=0) {
7566
+            if ($my_count != 0) {
7567 7567
                 // The LP name is also the first section and is not in the same charset like the other sections.
7568 7568
                 $value['value'] = Security :: remove_XSS($value['value']);
7569
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7569
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7570 7570
             } else {
7571 7571
                 $value['value'] = Security :: remove_XSS($value['value']);
7572
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7572
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7573 7573
             }
7574 7574
             $my_count++;
7575 7575
         }
@@ -7577,7 +7577,7 @@  discard block
 block discarded – undo
7577 7577
         if (!empty($id)) {
7578 7578
             $parent_select->setSelected($parent);
7579 7579
         } else {
7580
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7580
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7581 7581
             $parent_select->setSelected($parent_item_id);
7582 7582
         }
7583 7583
 
@@ -7594,7 +7594,7 @@  discard block
 block discarded – undo
7594 7594
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7595 7595
                     $s_selected_position = $arrLP[$i]['id'];
7596 7596
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7597
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7597
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7598 7598
             }
7599 7599
         }
7600 7600
 
@@ -7602,8 +7602,8 @@  discard block
 block discarded – undo
7602 7602
         $position->addOption(get_lang('FirstPosition'), 0);
7603 7603
 
7604 7604
         foreach ($arrHide as $key => $value) {
7605
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7606
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7605
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7606
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7607 7607
         }
7608 7608
         $position->setSelected($s_selected_position);
7609 7609
 
@@ -7673,7 +7673,7 @@  discard block
 block discarded – undo
7673 7673
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7674 7674
                             $relative_path 	 = implode('/', $relative_path);
7675 7675
                             if (strlen($relative_path) > 0) {
7676
-                                $relative_path = $relative_path . '/';
7676
+                                $relative_path = $relative_path.'/';
7677 7677
                             }
7678 7678
                         } else {
7679 7679
                             $result = $this->generate_lp_folder($_course);
@@ -7687,8 +7687,8 @@  discard block
 block discarded – undo
7687 7687
                             'Height' 				=> '500',
7688 7688
                             'FullPage' 				=> true,
7689 7689
                             'CreateDocumentDir' 	=> $relative_prefix,
7690
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7691
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7690
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7691
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7692 7692
                         );
7693 7693
 
7694 7694
                         if ($_GET['action'] == 'add_item') {
@@ -7755,8 +7755,8 @@  discard block
 block discarded – undo
7755 7755
             $item_url = stripslashes($extra_info['url']);
7756 7756
         } elseif (is_numeric($extra_info)) {
7757 7757
             $extra_info = intval($extra_info);
7758
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7759
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7758
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7759
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7760 7760
             $result = Database::query($sql);
7761 7761
             $row = Database :: fetch_array($result);
7762 7762
             $item_title       = $row['title'];
@@ -7776,8 +7776,8 @@  discard block
 block discarded – undo
7776 7776
             $parent = 0;
7777 7777
         }
7778 7778
 
7779
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7780
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7779
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7780
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7781 7781
         $result = Database::query($sql);
7782 7782
         $arrLP = array();
7783 7783
 
@@ -7804,10 +7804,10 @@  discard block
 block discarded – undo
7804 7804
         unset ($this->arrMenu);
7805 7805
 
7806 7806
         if ($action == 'add')
7807
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7808
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7807
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7808
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7809 7809
         else
7810
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7810
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7811 7811
 
7812 7812
         $legend .= '</legend>';
7813 7813
 
@@ -7818,16 +7818,16 @@  discard block
 block discarded – undo
7818 7818
 
7819 7819
         if ($action != 'move') {
7820 7820
             $return .= '<tr>';
7821
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7822
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7821
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7822
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7823 7823
             $return .= '</tr>';
7824 7824
         }
7825 7825
 
7826 7826
         $return .= '<tr>';
7827
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7827
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7828 7828
         $return .= '<td class="input">';
7829 7829
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7830
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7830
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7831 7831
         $arrHide = array(
7832 7832
             $id
7833 7833
         );
@@ -7837,13 +7837,13 @@  discard block
 block discarded – undo
7837 7837
         for ($i = 0; $i < count($arrLP); $i++) {
7838 7838
             if ($action != 'add') {
7839 7839
                 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)) {
7840
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7840
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7841 7841
                 } else {
7842 7842
                     $arrHide[] = $arrLP[$i]['id'];
7843 7843
                 }
7844 7844
             } else {
7845 7845
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7846
-                    $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>';
7846
+                    $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>';
7847 7847
             }
7848 7848
         }
7849 7849
 
@@ -7855,11 +7855,11 @@  discard block
 block discarded – undo
7855 7855
         $return .= '</td>';
7856 7856
         $return .= '</tr>';
7857 7857
         $return .= '<tr>';
7858
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7858
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7859 7859
         $return .= '<td class="input">';
7860 7860
 
7861 7861
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7862
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7862
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7863 7863
         for ($i = 0; $i < count($arrLP); $i++) {
7864 7864
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7865 7865
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7869,7 +7869,7 @@  discard block
 block discarded – undo
7869 7869
                 else
7870 7870
                     $selected = '';
7871 7871
 
7872
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7872
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7873 7873
             }
7874 7874
         }
7875 7875
         $return .= '</select>';
@@ -7878,8 +7878,8 @@  discard block
 block discarded – undo
7878 7878
 
7879 7879
         if ($action != 'move') {
7880 7880
             $return .= '<tr>';
7881
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7882
-            $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>';
7881
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7882
+            $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>';
7883 7883
             $return .= '</tr>';
7884 7884
             $id_prerequisite = 0;
7885 7885
             if (is_array($arrLP)) {
@@ -7906,25 +7906,25 @@  discard block
 block discarded – undo
7906 7906
 
7907 7907
         $return .= '<tr>';
7908 7908
         if ($action == 'add') {
7909
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7909
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7910 7910
         } else {
7911
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7911
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7912 7912
         }
7913 7913
         $return .= '</tr>';
7914 7914
         $return .= '</table>';
7915 7915
 
7916 7916
         if ($action == 'move') {
7917
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7918
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7917
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7918
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7919 7919
         }
7920 7920
 
7921 7921
         if (is_numeric($extra_info)) {
7922
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7922
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7923 7923
         } elseif (is_array($extra_info)) {
7924
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7924
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7925 7925
         }
7926
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7927
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7926
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7927
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7928 7928
         $return .= '</form>';
7929 7929
         $return .= '</div>';
7930 7930
 
@@ -7950,8 +7950,8 @@  discard block
 block discarded – undo
7950 7950
         } elseif (is_numeric($extra_info)) {
7951 7951
             $extra_info = intval($extra_info);
7952 7952
             $sql = "SELECT title, description
7953
-                    FROM " . $tbl_publication . "
7954
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7953
+                    FROM " . $tbl_publication."
7954
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7955 7955
 
7956 7956
             $result = Database::query($sql);
7957 7957
             $row = Database :: fetch_array($result);
@@ -7967,13 +7967,13 @@  discard block
 block discarded – undo
7967 7967
             $parent = 0;
7968 7968
         }
7969 7969
 
7970
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7971
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7970
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7971
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7972 7972
 
7973 7973
         $result = Database::query($sql);
7974 7974
         $arrLP = array();
7975 7975
         while ($row = Database :: fetch_array($result)) {
7976
-            $arrLP[] = array (
7976
+            $arrLP[] = array(
7977 7977
                 'id' => $row['id'],
7978 7978
                 'item_type' => $row['item_type'],
7979 7979
                 'title' => $row['title'],
@@ -8019,7 +8019,7 @@  discard block
 block discarded – undo
8019 8019
             ]
8020 8020
         );
8021 8021
 
8022
-        $arrHide = array (
8022
+        $arrHide = array(
8023 8023
             $id
8024 8024
         );
8025 8025
 
@@ -8037,7 +8037,7 @@  discard block
 block discarded – undo
8037 8037
                     $parentSelect->addOption(
8038 8038
                         $arrLP[$i]['title'],
8039 8039
                         $arrLP[$i]['id'],
8040
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8040
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8041 8041
                     );
8042 8042
 
8043 8043
                     if ($parent == $arrLP[$i]['id']) {
@@ -8054,7 +8054,7 @@  discard block
 block discarded – undo
8054 8054
                     $parentSelect->addOption(
8055 8055
                         $arrLP[$i]['title'],
8056 8056
                         $arrLP[$i]['id'],
8057
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8057
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8058 8058
                     );
8059 8059
 
8060 8060
                     if ($parent == $arrLP[$i]['id']) {
@@ -8078,7 +8078,7 @@  discard block
 block discarded – undo
8078 8078
         for ($i = 0; $i < count($arrLP); $i++) {
8079 8079
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8080 8080
                 $previousSelect->addOption(
8081
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8081
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8082 8082
                     $arrLP[$i]['id']
8083 8083
                 );
8084 8084
 
@@ -8100,7 +8100,7 @@  discard block
 block discarded – undo
8100 8100
                     }
8101 8101
                 }
8102 8102
             }
8103
-            $arrHide = array ();
8103
+            $arrHide = array();
8104 8104
             for ($i = 0; $i < count($arrLP); $i++) {
8105 8105
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8106 8106
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8192,8 +8192,8 @@  discard block
 block discarded – undo
8192 8192
 
8193 8193
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8194 8194
         $item_id = intval($item_id);
8195
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8196
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8195
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8196
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8197 8197
         $result = Database::query($sql);
8198 8198
         $row = Database::fetch_assoc($result);
8199 8199
 
@@ -8207,16 +8207,16 @@  discard block
 block discarded – undo
8207 8207
             $audio_player .= '<script>
8208 8208
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8209 8209
                                 s1.addParam("allowscriptaccess","always");
8210
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8210
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8211 8211
                                 s1.write("container");
8212 8212
                             </script>';
8213 8213
         }
8214 8214
 
8215
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8215
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8216 8216
 
8217 8217
         $return .= Display::url(
8218 8218
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8219
-            $url.'&action=edit_item&path_item=' . $row['path']
8219
+            $url.'&action=edit_item&path_item='.$row['path']
8220 8220
         );
8221 8221
 
8222 8222
         $return .= Display::url(
@@ -8236,12 +8236,12 @@  discard block
 block discarded – undo
8236 8236
             $url.'&action=delete_item'
8237 8237
         );
8238 8238
 
8239
-        if ($item_type == TOOL_HOTPOTATOES ) {
8239
+        if ($item_type == TOOL_HOTPOTATOES) {
8240 8240
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8241 8241
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8242 8242
         }
8243 8243
 
8244
-        if ($item_type == TOOL_DOCUMENT ) {
8244
+        if ($item_type == TOOL_DOCUMENT) {
8245 8245
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8246 8246
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8247 8247
         }
@@ -8262,13 +8262,13 @@  discard block
 block discarded – undo
8262 8262
     public function get_js_dropdown_array()
8263 8263
     {
8264 8264
         $course_id = api_get_course_int_id();
8265
-        $return = 'var child_name = new Array();' . "\n";
8266
-        $return .= 'var child_value = new Array();' . "\n\n";
8267
-        $return .= 'child_name[0] = new Array();' . "\n";
8268
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8265
+        $return = 'var child_name = new Array();'."\n";
8266
+        $return .= 'var child_value = new Array();'."\n\n";
8267
+        $return .= 'child_name[0] = new Array();'."\n";
8268
+        $return .= 'child_value[0] = new Array();'."\n\n";
8269 8269
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8270
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8271
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8270
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8271
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8272 8272
                     ORDER BY display_order ASC";
8273 8273
         $res_zero = Database::query($sql_zero);
8274 8274
         $i = 0;
@@ -8278,28 +8278,28 @@  discard block
 block discarded – undo
8278 8278
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8279 8279
             }
8280 8280
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8281
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8282
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8281
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8282
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8283 8283
         }
8284 8284
         $return .= "\n";
8285
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8286
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8285
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8286
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8287 8287
         $res = Database::query($sql);
8288 8288
         while ($row = Database :: fetch_array($res)) {
8289
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8289
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8290 8290
                            WHERE
8291 8291
                                 c_id = ".$course_id." AND
8292
-                                parent_item_id = " . $row['id'] . "
8292
+                                parent_item_id = " . $row['id']."
8293 8293
                            ORDER BY display_order ASC";
8294 8294
             $res_parent = Database::query($sql_parent);
8295 8295
             $i = 0;
8296
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8297
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8296
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8297
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8298 8298
 
8299 8299
             while ($row_parent = Database :: fetch_array($res_parent)) {
8300 8300
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8301
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8302
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8301
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8302
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8303 8303
             }
8304 8304
             $return .= "\n";
8305 8305
         }
@@ -8320,8 +8320,8 @@  discard block
 block discarded – undo
8320 8320
         if (is_numeric($item_id)) {
8321 8321
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8322 8322
 
8323
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8324
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8323
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8324
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8325 8325
 
8326 8326
             $res = Database::query($sql);
8327 8327
             $row = Database :: fetch_array($res);
@@ -8380,7 +8380,7 @@  discard block
 block discarded – undo
8380 8380
      */
8381 8381
     public function display_item_small_form($item_type, $title = '', $data = array())
8382 8382
     {
8383
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8383
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8384 8384
         $form = new FormValidator('small_form', 'post', $url);
8385 8385
         $form->addElement('header', $title);
8386 8386
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8406,7 +8406,7 @@  discard block
 block discarded – undo
8406 8406
         $item_id = intval($item_id);
8407 8407
         /* Current prerequisite */
8408 8408
         $sql = "SELECT * FROM $tbl_lp_item
8409
-                WHERE c_id = $course_id AND id = " . $item_id;
8409
+                WHERE c_id = $course_id AND id = ".$item_id;
8410 8410
         $result = Database::query($sql);
8411 8411
         $row    = Database::fetch_array($result);
8412 8412
         $prerequisiteId = $row['prerequisite'];
@@ -8416,20 +8416,20 @@  discard block
 block discarded – undo
8416 8416
         $return .= '<form method="POST">';
8417 8417
         $return .= '<table class="data_table">';
8418 8418
         $return .= '<tr>';
8419
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8420
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8421
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8419
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8420
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8421
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8422 8422
         $return .= '</tr>';
8423 8423
 
8424 8424
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8425 8425
         $return .= '<tr >';
8426 8426
         $return .= '<td colspan="3" class="radio">';
8427 8427
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8428
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8428
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8429 8429
         $return .= '</tr>';
8430 8430
 
8431 8431
         $sql = "SELECT * FROM $tbl_lp_item
8432
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8432
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8433 8433
         $result = Database::query($sql);
8434 8434
         $arrLP = array();
8435 8435
 
@@ -8472,25 +8472,25 @@  discard block
 block discarded – undo
8472 8472
             }
8473 8473
 
8474 8474
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8475
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8475
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8476 8476
 
8477 8477
             $return .= '<tr>';
8478
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8479
-            $return .= '<label for="id' . $item['id'] . '">';
8480
-            $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'] . '" />';
8478
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8479
+            $return .= '<label for="id'.$item['id'].'">';
8480
+            $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'].'" />';
8481 8481
             $icon_name = str_replace(' ', '', $item['item_type']);
8482 8482
 
8483
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8484
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8483
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8484
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8485 8485
             } else {
8486
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8487
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8486
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8487
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8488 8488
                 } else {
8489 8489
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8490 8490
                 }
8491 8491
             }
8492 8492
 
8493
-            $return .=  $item['title'] . '</label>';
8493
+            $return .= $item['title'].'</label>';
8494 8494
             $return .= '</td>';
8495 8495
 
8496 8496
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8504,19 +8504,19 @@  discard block
 block discarded – undo
8504 8504
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8505 8505
 
8506 8506
                 $return .= '<td class="exercise">';
8507
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8507
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8508 8508
                 $return .= '</td>';
8509 8509
                 $return .= '<td class="exercise">';
8510
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8510
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8511 8511
                 $return .= '</td>';
8512 8512
             }
8513 8513
 
8514 8514
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8515 8515
                 $return .= '<td class="exercise">';
8516
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8516
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8517 8517
                 $return .= '</td>';
8518 8518
                 $return .= '<td class="exercise"">';
8519
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8519
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8520 8520
                 $return .= '</td>';
8521 8521
             }
8522 8522
             $return .= '</tr>';
@@ -8525,7 +8525,7 @@  discard block
 block discarded – undo
8525 8525
         $return .= '</tr>';
8526 8526
         $return .= '</table>';
8527 8527
         $return .= '<div style="padding-top:3px;">';
8528
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8528
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8529 8529
         $return .= '</form>';
8530 8530
 
8531 8531
         return $return;
@@ -8561,7 +8561,7 @@  discard block
 block discarded – undo
8561 8561
                 if ($row['id'] == $lp_id) {
8562 8562
                     continue;
8563 8563
                 }
8564
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8564
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8565 8565
             }
8566 8566
         }
8567 8567
         $return .= '</select>';
@@ -8621,8 +8621,8 @@  discard block
 block discarded – undo
8621 8621
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8622 8622
                      ORDER BY title ASC";
8623 8623
 
8624
-        $sql_hot  = "SELECT * FROM $tbl_doc
8625
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8624
+        $sql_hot = "SELECT * FROM $tbl_doc
8625
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8626 8626
                      ORDER BY id ASC";
8627 8627
 
8628 8628
         $res_quiz = Database::query($sql_quiz);
@@ -8631,8 +8631,8 @@  discard block
 block discarded – undo
8631 8631
         $return = '<ul class="lp_resource">';
8632 8632
         $return .= '<li class="lp_resource_element">';
8633 8633
         $return .= Display::return_icon('new_test_small.gif');
8634
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8635
-            get_lang('NewExercise') . '</a>';
8634
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8635
+            get_lang('NewExercise').'</a>';
8636 8636
         $return .= '</li>';
8637 8637
 
8638 8638
         // Display hotpotatoes
@@ -8644,8 +8644,8 @@  discard block
 block discarded – undo
8644 8644
             $return .= '</a> ';
8645 8645
 
8646 8646
             $return .= Display::return_icon('hotpotatoes_s.png');
8647
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8648
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8647
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8648
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8649 8649
             $return .= '</li>';
8650 8650
         }
8651 8651
 
@@ -8655,7 +8655,7 @@  discard block
 block discarded – undo
8655 8655
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8656 8656
             $return .= '</a> ';
8657 8657
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8658
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8658
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8659 8659
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8660 8660
                 '</a>';
8661 8661
             $return .= '</li>';
@@ -8729,7 +8729,7 @@  discard block
 block discarded – undo
8729 8729
         foreach ($categorizedLinks as $categoryId => $links) {
8730 8730
             $linkNodes = null;
8731 8731
             foreach ($links as $key => $title) {
8732
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8732
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8733 8733
                     $linkNodes .=
8734 8734
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8735 8735
                         <a class="moved" href="#">'.
@@ -8767,7 +8767,7 @@  discard block
 block discarded – undo
8767 8767
         $return = '<div class="lp_resource" >';
8768 8768
         $return .= '<div class="lp_resource_element">';
8769 8769
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8770
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8770
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8771 8771
         $return .= '</div>';
8772 8772
         $return .= '</div>';
8773 8773
         return $return;
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
         //First add link
8789 8789
         $return .= '<li class="lp_resource_element">';
8790 8790
         $return .= Display::return_icon('forum_new_small.gif');
8791
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&content=forum&origin=learnpath&lp_id=' . $this->lp_id . '" title="' . get_lang('CreateANewForum') . '">' . get_lang('CreateANewForum') . '</a>';
8791
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&action=add&content=forum&origin=learnpath&lp_id='.$this->lp_id.'" title="'.get_lang('CreateANewForum').'">'.get_lang('CreateANewForum').'</a>';
8792 8792
         $return .= '</li>';
8793 8793
 
8794 8794
         $return .= '<script>
@@ -8810,15 +8810,15 @@  discard block
 block discarded – undo
8810 8810
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8811 8811
                 $return .= ' </a>';
8812 8812
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8813
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8814
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8813
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8814
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8815 8815
                             </a>
8816
-                            <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">' .
8817
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8816
+                            <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">'.
8817
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8818 8818
 
8819 8819
                 $return .= '</li>';
8820 8820
 
8821
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8821
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8822 8822
                 $a_threads = get_threads($forum['forum_id']);
8823 8823
                 if (is_array($a_threads)) {
8824 8824
                     foreach ($a_threads as $thread) {
@@ -8827,8 +8827,8 @@  discard block
 block discarded – undo
8827 8827
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8828 8828
                         $return .= ' </a>';
8829 8829
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8830
-                        $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 . '">' .
8831
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8830
+                        $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.'">'.
8831
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8832 8832
                         $return .= '</li>';
8833 8833
                     }
8834 8834
                 }
@@ -8899,7 +8899,7 @@  discard block
 block discarded – undo
8899 8899
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8900 8900
             // Remove the possible . at the end of the path.
8901 8901
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8902
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8902
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8903 8903
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8904 8904
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8905 8905
         }
@@ -8967,7 +8967,7 @@  discard block
 block discarded – undo
8967 8967
                 if ($item->type == 'sco') {
8968 8968
                     $inc_docs = $item->get_resources_from_source(
8969 8969
                         null,
8970
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8970
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8971 8971
                     );
8972 8972
                 } else {
8973 8973
                     $inc_docs = $item->get_resources_from_source();
@@ -9183,7 +9183,7 @@  discard block
 block discarded – undo
9183 9183
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9184 9184
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9185 9185
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9186
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9186
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9187 9187
                                         $my_dep->setAttribute('xml:base', '');
9188 9188
                                     }
9189 9189
                                 }
@@ -9314,7 +9314,7 @@  discard block
 block discarded – undo
9314 9314
                         //$my_item->appendChild($my_max_score);
9315 9315
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9316 9316
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9317
-                        $my_prereqs->setAttribute('type','aicc_script');
9317
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9318 9318
                         $my_item->appendChild($my_prereqs);
9319 9319
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9320 9320
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9367,7 +9367,7 @@  discard block
 block discarded – undo
9367 9367
                         $my_resource->appendChild($my_file);
9368 9368
 
9369 9369
                         // Get included docs.
9370
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9370
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9371 9371
                         // Dependency to other files - not yet supported.
9372 9372
                         $i = 1;
9373 9373
                         foreach ($inc_docs as $doc_info) {
@@ -9428,7 +9428,7 @@  discard block
 block discarded – undo
9428 9428
                                         $my_dep_file->setAttribute('href', $file_path);
9429 9429
                                         $my_dep->setAttribute('xml:base', '');
9430 9430
 
9431
-                                        if (strstr($file_path,$main_path) !== false) {
9431
+                                        if (strstr($file_path, $main_path) !== false) {
9432 9432
                                             // The calculated real path is really inside the chamilo root path.
9433 9433
                                             // Reduce file path to what's under the DocumentRoot.
9434 9434
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9446,7 +9446,7 @@  discard block
 block discarded – undo
9446 9446
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9447 9447
                                             $file_path = str_replace('//', '/', $file_path);
9448 9448
                                             if (file_exists($file_path)) {
9449
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9449
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9450 9450
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9451 9451
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9452 9452
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9675,7 +9675,7 @@  discard block
 block discarded – undo
9675 9675
             if (strpos($extra_file, '.') === 0)
9676 9676
                 continue;
9677 9677
             else {
9678
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9678
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9679 9679
                 $this->create_path($dest_file);
9680 9680
                 copy($main_code_path.$extra_file, $dest_file);
9681 9681
             }
@@ -9728,7 +9728,7 @@  discard block
 block discarded – undo
9728 9728
                             }
9729 9729
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9730 9730
                             if (file_exists($file_path)) {
9731
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9731
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9732 9732
                             }
9733 9733
                             break;
9734 9734
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9768,12 +9768,12 @@  discard block
 block discarded – undo
9768 9768
 
9769 9769
         foreach ($path_bits as $bit) {
9770 9770
             if (!empty ($bit)) {
9771
-                $new_path = $path_built . $bit;
9771
+                $new_path = $path_built.$bit;
9772 9772
                 if (is_dir($new_path)) {
9773
-                    $path_built = $new_path . '/';
9773
+                    $path_built = $new_path.'/';
9774 9774
                 } else {
9775 9775
                     mkdir($new_path, api_get_permissions_for_new_directories());
9776
-                    $path_built = $new_path . '/';
9776
+                    $path_built = $new_path.'/';
9777 9777
                 }
9778 9778
             }
9779 9779
         }
@@ -9817,9 +9817,9 @@  discard block
 block discarded – undo
9817 9817
 
9818 9818
         if ($upload_ok) {
9819 9819
             if ($has_attachment) {
9820
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9820
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9821 9821
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9822
-                $updir = $sys_course_path . $courseDir;
9822
+                $updir = $sys_course_path.$courseDir;
9823 9823
                 // Try to add an extension to the file if it hasn't one.
9824 9824
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9825 9825
 
@@ -9874,7 +9874,7 @@  discard block
 block discarded – undo
9874 9874
             //Setting my lp_id to autolaunch = 1
9875 9875
             $attributes['autolaunch'] = 1;
9876 9876
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9877
-            Database::update($lp_table, $attributes, $where );
9877
+            Database::update($lp_table, $attributes, $where);
9878 9878
         }
9879 9879
     }
9880 9880
 
@@ -9893,13 +9893,13 @@  discard block
 block discarded – undo
9893 9893
 
9894 9894
         // Get the max order of the items
9895 9895
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9896
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9896
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9897 9897
         $rs_max_order = Database::query($sql_max_order);
9898 9898
         $row_max_order = Database::fetch_object($rs_max_order);
9899 9899
         $max_order = $row_max_order->display_order;
9900 9900
         // Get the previous item ID
9901 9901
         $sql = "SELECT id as previous FROM $table_lp_item
9902
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9902
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9903 9903
         $rs_max = Database::query($sql);
9904 9904
         $row_max = Database::fetch_object($rs_max);
9905 9905
 
@@ -9955,9 +9955,9 @@  discard block
 block discarded – undo
9955 9955
         $documents_total_space = DocumentManager::documents_total_space();
9956 9956
         $course_max_space = DocumentManager::get_course_quota();
9957 9957
         $total_size = filesize($s) + $documents_total_space;
9958
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9958
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9959 9959
             return true;
9960
-        } else{
9960
+        } else {
9961 9961
             return false;
9962 9962
         }
9963 9963
     }
@@ -10297,7 +10297,7 @@  discard block
 block discarded – undo
10297 10297
         if ($this->debug > 0) {
10298 10298
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10299 10299
         }
10300
-        $this->subscribeUsers = intval($value);;
10300
+        $this->subscribeUsers = intval($value); ;
10301 10301
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10302 10302
         $lp_id = $this->get_id();
10303 10303
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10643,7 +10643,7 @@  discard block
 block discarded – undo
10643 10643
      */
10644 10644
     public function createForum($forumCategoryId)
10645 10645
     {
10646
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10646
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10647 10647
 
10648 10648
         $forumId = store_forum(
10649 10649
             [
Please login to merge, or discard this patch.
Doc Comments   +29 added lines, -24 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param	string	$course Course code
85 85
      * @param	integer	$lp_id
86 86
      * @param	integer	$user_id
87
-     * @return mixed True on success, false on error
87
+     * @return boolean True on success, false on error
88 88
      */
89 89
     public function __construct($course, $lp_id, $user_id)
90 90
     {
@@ -484,8 +484,9 @@  discard block
 block discarded – undo
484 484
      * @param int $prerequisites
485 485
      * @param int $max_time_allowed
486 486
      * @param int $userId
487
+     * @param string $id
487 488
      *
488
-     * @return int
489
+     * @return false|string
489 490
      */
490 491
     public function add_item(
491 492
         $parent,
@@ -1036,7 +1037,7 @@  discard block
 block discarded – undo
1036 1037
      * @param	array $courseInfo
1037 1038
      * @param	integer	Learnpath ID
1038 1039
      * @param	string	Whether to delete data or keep it (default: 'keep', others: 'remove')
1039
-     * @return	boolean	True on success, false on failure (might change that to return number of elements deleted)
1040
+     * @return	false|null	True on success, false on failure (might change that to return number of elements deleted)
1040 1041
      */
1041 1042
     public function delete($courseInfo = null, $id = null, $delete = 'keep')
1042 1043
     {
@@ -1170,7 +1171,7 @@  discard block
 block discarded – undo
1170 1171
      * @param	integer	$id Elem ID (0 if first)
1171 1172
      * @param	integer	$remove Whether to remove the resource/data from the
1172 1173
      * system or leave it (default: 'keep', others 'remove')
1173
-     * @return	integer	Number of elements moved
1174
+     * @return	false|null	Number of elements moved
1174 1175
      * @todo implement resource removal
1175 1176
      */
1176 1177
     public function delete_item($id, $remove = 'keep')
@@ -1252,7 +1253,7 @@  discard block
 block discarded – undo
1252 1253
      * @param   array   $audio The array resulting of the $_FILES[mp3] element
1253 1254
      * @param   int     $max_time_allowed
1254 1255
      * @param   string  $url
1255
-     * @return  boolean True on success, false on error
1256
+     * @return  false|null True on success, false on error
1256 1257
      */
1257 1258
     public function edit_item(
1258 1259
         $id,
@@ -1775,7 +1776,7 @@  discard block
 block discarded – undo
1775 1776
 
1776 1777
     /**
1777 1778
      * Gets the first element URL.
1778
-     * @return	string	URL to load into the viewer
1779
+     * @return	false|null	URL to load into the viewer
1779 1780
      */
1780 1781
     public function first()
1781 1782
     {
@@ -2291,6 +2292,7 @@  discard block
 block discarded – undo
2291 2292
      * @param int $student_id
2292 2293
      * @param string Course code (optional)
2293 2294
      * @param int $sessionId
2295
+     * @param string $courseCode
2294 2296
      * @return	bool
2295 2297
      */
2296 2298
     public static function is_lp_visible_for_student(
@@ -2590,7 +2592,7 @@  discard block
 block discarded – undo
2590 2592
 
2591 2593
     /**
2592 2594
      * Gets the learnpath session id
2593
-     * @return	string	Learnpath theme
2595
+     * @return	integer	Learnpath theme
2594 2596
      */
2595 2597
     public function get_lp_session_id()
2596 2598
     {
@@ -2623,7 +2625,7 @@  discard block
 block discarded – undo
2623 2625
     /**
2624 2626
      * @param string $size
2625 2627
      * @param string $path_type
2626
-     * @return bool|string
2628
+     * @return string|false
2627 2629
      */
2628 2630
     public function get_preview_image_path($size = null, $path_type = 'web')
2629 2631
     {
@@ -2769,6 +2771,8 @@  discard block
 block discarded – undo
2769 2771
      * Returns the XML DOM document's node
2770 2772
      * @param	resource	Reference to a list of objects to search for the given ITEM_*
2771 2773
      * @param	string		The identifier to look for
2774
+     * @param DOMNodeList $children
2775
+     * @param string $id
2772 2776
      * @return	mixed		The reference to the element found with that identifier. False if not found
2773 2777
      */
2774 2778
     public function get_scorm_xml_node(& $children, $id)
@@ -3016,7 +3020,7 @@  discard block
 block discarded – undo
3016 3020
     /**
3017 3021
      * Generate and return the table of contents for this learnpath. The (flat) table returned can be
3018 3022
      * used by get_html_toc() to be ready to display
3019
-     * @return	array	TOC as a table with 4 elements per row: title, link, status and level
3023
+     * @return	boolean	TOC as a table with 4 elements per row: title, link, status and level
3020 3024
      */
3021 3025
     public function get_toc()
3022 3026
     {
@@ -3152,7 +3156,7 @@  discard block
 block discarded – undo
3152 3156
     }
3153 3157
 
3154 3158
     /**
3155
-     * @return array
3159
+     * @return string[]
3156 3160
      */
3157 3161
     public static function getChapterTypes()
3158 3162
     {
@@ -4054,7 +4058,7 @@  discard block
 block discarded – undo
4054 4058
      * Open a resource = initialise all local variables relative to this resource. Depending on the child
4055 4059
      * class, this might be redefined to allow several behaviours depending on the document type.
4056 4060
      * @param integer Resource ID
4057
-     * @return boolean True on success, false otherwise
4061
+     * @return boolean|null True on success, false otherwise
4058 4062
      */
4059 4063
     public function open($id)
4060 4064
     {
@@ -4183,7 +4187,7 @@  discard block
 block discarded – undo
4183 4187
      * Can be used as abstract
4184 4188
      * @param	integer	$lp_id Learnpath id
4185 4189
      * @param	string	$set_visibility New visibility (v/i - visible/invisible)
4186
-     * @return bool
4190
+     * @return false|null
4187 4191
      */
4188 4192
     public static function toggle_publish($lp_id, $set_visibility = 'v')
4189 4193
     {
@@ -4268,7 +4272,7 @@  discard block
 block discarded – undo
4268 4272
      * Make sure the results are saved with anoter method. This method should probably be
4269 4273
      * redefined in children classes.
4270 4274
      * To use a similar method  statically, use the create_new_attempt() method
4271
-     * @return string URL to load in the viewer
4275
+     * @return boolean URL to load in the viewer
4272 4276
      */
4273 4277
     public function restart()
4274 4278
     {
@@ -4346,6 +4350,7 @@  discard block
 block discarded – undo
4346 4350
      * Saves the given item
4347 4351
      * @param	integer	$item_id. Optional (will take from $_REQUEST if null)
4348 4352
      * @param	boolean	$from_outside Save from url params (true) or from current attributes (false). Optional. Defaults to true
4353
+     * @param integer $item_id
4349 4354
      * @return	boolean
4350 4355
      */
4351 4356
     public function save_item($item_id = null, $from_outside = true)
@@ -4843,7 +4848,7 @@  discard block
 block discarded – undo
4843 4848
 
4844 4849
     /**
4845 4850
      * Sets use_max_score
4846
-     * @param   string  $use_max_score Optional string giving the new location of this learnpath
4851
+     * @param   integer  $use_max_score Optional string giving the new location of this learnpath
4847 4852
      * @return  boolean True on success / False on error
4848 4853
      */
4849 4854
     public function set_use_max_score($use_max_score = 1)
@@ -5244,6 +5249,7 @@  discard block
 block discarded – undo
5244 5249
      * Register the attempt mode into db thanks to flags prevent_reinit and seriousgame_mode flags
5245 5250
      *
5246 5251
      * @param string 'seriousgame', 'single' or 'multiple'
5252
+     * @param string $mode
5247 5253
      * @return boolean
5248 5254
      * @author ndiechburg <[email protected]>
5249 5255
      **/
@@ -5286,7 +5292,7 @@  discard block
 block discarded – undo
5286 5292
     /**
5287 5293
      * Switch between multiple attempt, single attempt or serious_game mode (only for scorm)
5288 5294
      *
5289
-     * @return boolean
5295
+     * @return boolean|null
5290 5296
      * @author ndiechburg <[email protected]>
5291 5297
      **/
5292 5298
     public function switch_attempt_mode()
@@ -5477,7 +5483,6 @@  discard block
 block discarded – undo
5477 5483
     /**
5478 5484
      * Function that creates a html list of learning path items so that we can add audio files to them
5479 5485
      * @author Kevin Van Den Haute
5480
-     * @param int $lp_id
5481 5486
      * @return string
5482 5487
      */
5483 5488
     public function overview()
@@ -5838,7 +5843,7 @@  discard block
 block discarded – undo
5838 5843
     /**
5839 5844
      * This function builds the action menu
5840 5845
      * @param bool $returnContent
5841
-     * @return void
5846
+     * @return string|null
5842 5847
      */
5843 5848
     public function build_action_menu($returnContent = false)
5844 5849
     {
@@ -6335,7 +6340,7 @@  discard block
 block discarded – undo
6335 6340
     /**
6336 6341
      * Function that displays a list with al the resources that
6337 6342
      * could be added to the learning path
6338
-     * @return string
6343
+     * @return boolean
6339 6344
      */
6340 6345
     public function display_resources()
6341 6346
     {
@@ -8779,7 +8784,7 @@  discard block
 block discarded – undo
8779 8784
 
8780 8785
     /**
8781 8786
      * Creates a list with all the student publications in it
8782
-     * @return unknown
8787
+     * @return string
8783 8788
      */
8784 8789
     public function get_student_publications()
8785 8790
     {
@@ -9723,7 +9728,7 @@  discard block
 block discarded – undo
9723 9728
 
9724 9729
     /**
9725 9730
      * @param int $lp_id
9726
-     * @return bool
9731
+     * @return false|null
9727 9732
      */
9728 9733
     public function scorm_export_to_pdf($lp_id)
9729 9734
     {
@@ -10240,6 +10245,7 @@  discard block
 block discarded – undo
10240 10245
     }
10241 10246
 
10242 10247
     /**
10248
+     * @param string $courseCode
10243 10249
      * @return \learnpath
10244 10250
      */
10245 10251
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
@@ -10259,7 +10265,7 @@  discard block
 block discarded – undo
10259 10265
 
10260 10266
     /**
10261 10267
      * @param int $itemId
10262
-     * @return learnpathItem|false
10268
+     * @return string
10263 10269
      */
10264 10270
     public function getItem($itemId)
10265 10271
     {
@@ -10309,7 +10315,6 @@  discard block
 block discarded – undo
10309 10315
     /**
10310 10316
      * Set whether this is a learning path with the possibility to subscribe
10311 10317
      * users or not
10312
-     * @param int $subscribeUsers (0 = false, 1 = true)
10313 10318
      */
10314 10319
     public function setSubscribeUsers($value)
10315 10320
     {
@@ -10434,7 +10439,7 @@  discard block
 block discarded – undo
10434 10439
 
10435 10440
     /**
10436 10441
      * Get the item of exercise type (evaluation type)
10437
-     * @return array The final evaluation. Otherwise return false
10442
+     * @return integer The final evaluation. Otherwise return false
10438 10443
      */
10439 10444
     public function getFinalEvaluationItem()
10440 10445
     {
@@ -10658,7 +10663,7 @@  discard block
 block discarded – undo
10658 10663
     /**
10659 10664
      * Create a forum for this learning path
10660 10665
      * @param type $forumCategoryId
10661
-     * @return int The forum ID if was created. Otherwise return false
10666
+     * @return false|string The forum ID if was created. Otherwise return false
10662 10667
      */
10663 10668
     public function createForum($forumCategoryId)
10664 10669
     {
Please login to merge, or discard this patch.
main/newscorm/lp_build.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
 // Using the resource linker as a tool for adding resources to the learning path.
37 37
 if ($action=="add" and $type=="learnpathitem") {
38
-     $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
38
+        $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
39 39
 }
40 40
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
41 41
     error_log('New LP - User not authorized in lp_build.php');
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
 $isStudentView  = (int) $_REQUEST['isStudentView'];
31 31
 $learnpath_id   = (int) $_REQUEST['lp_id'];
32
-$submit			= $_POST['submit_button'];
32
+$submit = $_POST['submit_button'];
33 33
 
34 34
 /* MAIN CODE */
35 35
 
36 36
 // Using the resource linker as a tool for adding resources to the learning path.
37
-if ($action=="add" and $type=="learnpathitem") {
37
+if ($action == "add" and $type == "learnpathitem") {
38 38
      $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
39 39
 }
40 40
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 if ($learnpath_id == 0) {
52 52
     $is_new = true;
53 53
 
54
-    $sql        = "SELECT id FROM " . $tbl_lp . " WHERE c_id = $course_id ORDER BY id DESC LIMIT 0, 1";
54
+    $sql        = "SELECT id FROM ".$tbl_lp." WHERE c_id = $course_id ORDER BY id DESC LIMIT 0, 1";
55 55
     $result     = Database::query($sql);
56 56
     $row        = Database::fetch_array($result);
57 57
     $learnpath_id = $row['id'];
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 }
74 74
 
75 75
 if (!empty($gradebook) && $gradebook == 'view') {
76
-    $interbreadcrumb[] = array (
77
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
76
+    $interbreadcrumb[] = array(
77
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
78 78
         'name' => get_lang('ToolGradebook')
79 79
     );
80 80
 }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 $interbreadcrumb[] = array('url' => '#', "name" => $therow['name']);
83 83
 
84 84
 // Theme calls.
85
-$lp_theme_css=$_SESSION['oLP']->get_theme();
85
+$lp_theme_css = $_SESSION['oLP']->get_theme();
86 86
 $show_learn_path = true;
87 87
 Display::display_header('', 'Path');
88 88
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 
133 133
     echo '<ul id="lp_overview" class="thumbnails">';
134 134
 
135
-    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
135
+    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id='.$_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
136 136
 
137 137
 //    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=admin_view&updateaudio=true&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png');
138 138
 
139
-    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
139
+    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
140 140
 
141 141
     //echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png');
142 142
 
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 
149 149
 function show_block($link, $title, $subtitle, $icon) {
150 150
     $html = '<li class="col-md-4">';
151
-        $html .=  '<div class="thumbnail">';
152
-        $html .=  '<a href="'.$link.'" title="'.$title.'">';
153
-        $html .=  Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
154
-        $html .=  '</a>';
155
-        $html .=  '<div class="caption">';
156
-        $html .=  '<strong>'.$title.'</strong></a> '.$subtitle;
157
-        $html .=  '</div>';
158
-        $html .=  '</div>';
159
-    $html .=  '</li>';
151
+        $html .= '<div class="thumbnail">';
152
+        $html .= '<a href="'.$link.'" title="'.$title.'">';
153
+        $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
154
+        $html .= '</a>';
155
+        $html .= '<div class="caption">';
156
+        $html .= '<strong>'.$title.'</strong></a> '.$subtitle;
157
+        $html .= '</div>';
158
+        $html .= '</div>';
159
+    $html .= '</li>';
160 160
     return $html;
161 161
 }
162 162
 
Please login to merge, or discard this patch.
main/newscorm/aicc_hacp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 //$_user							= $_SESSION['_user'];
56 56
 $file = $_SESSION['file'];
57 57
 $oLP = unserialize($_SESSION['lpobject']);
58
-$oItem =& $oLP->items[$oLP->current];
58
+$oItem = & $oLP->items[$oLP->current];
59 59
 if (!is_object($oItem)) {
60 60
     error_log('New LP - aicc_hacp - Could not load oItem item', 0);
61 61
     exit;
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     'evaluation' => array(),
70 70
     'student_data' => array(),
71 71
 );
72
-$convert_enc = array('%25','%0D','%0A','%09','%20','%2D','%2F','%3B','%3F','%7B','%7D','%7C','%5C','%5E','%7E','%5B','%5D','%60','%23','%3E','%3C','%22');
73
-$convert_dec = array('%',"\r","\n","\t",' ','-','/',';','?','{','}','|','\\','^','~','[',']','`','#','>','<','"');
72
+$convert_enc = array('%25', '%0D', '%0A', '%09', '%20', '%2D', '%2F', '%3B', '%3F', '%7B', '%7D', '%7C', '%5C', '%5E', '%7E', '%5B', '%5D', '%60', '%23', '%3E', '%3C', '%22');
73
+$convert_dec = array('%', "\r", "\n", "\t", ' ', '-', '/', ';', '?', '{', '}', '|', '\\', '^', '~', '[', ']', '`', '#', '>', '<', '"');
74 74
 $crlf = "\r\n";
75 75
 //$tab = "\t";
76 76
 $tab = "";
Please login to merge, or discard this patch.
main/newscorm/aiccItem.class.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 default:
49 49
                      //if($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function
50 50
                      foreach ($params as $a => $value) {
51
-                         switch ($a) {
51
+                            switch ($a) {
52 52
                             case 'system_id':
53 53
                                 $this->identifier = Database::escape_string(strtolower($value));
54 54
                                 break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                             case 'web_launch':
83 83
                                 $this->parameters = Database::escape_string($value);
84 84
                                 break;
85
-                         }
86
-                     }
85
+                            }
86
+                        }
87 87
 
88 88
                     return true;
89 89
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
         $abs_order++;
118 118
         $i = 1;
119 119
         foreach ($this->sub_items as $id => $dummy) {
120
-            $oSubitem =& $this->sub_items[$id];
120
+            $oSubitem = & $this->sub_items[$id];
121 121
             $oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
122 122
             $i++;
123 123
         }
Please login to merge, or discard this patch.
main/newscorm/lp_subscribe_users.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
     exit;
164 164
 } else {
165 165
     $headers = [get_lang('SubscribeUsersToLp'), get_lang('SubscribeGroupsToLp')];
166
-    $tabs = Display::tabs($headers, [$formUsers->toHtml(),$form->toHtml()]);
166
+    $tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
167 167
     $tpl->assign('tabs', $tabs);
168 168
 }
169 169
 
Please login to merge, or discard this patch.
main/newscorm/lp_view.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $this_section = SECTION_COURSES;
21 21
 
22 22
 if ($lp_controller_touched != 1) {
23
-    header('location: lp_controller.php?action=view&item_id=' . intval($_REQUEST['item_id']));
23
+    header('location: lp_controller.php?action=view&item_id='.intval($_REQUEST['item_id']));
24 24
     exit;
25 25
 }
26 26
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 //Impress js
101 101
 if ($_SESSION['oLP']->mode == 'impress') {
102 102
     $lp_id = $_SESSION['oLP']->get_id();
103
-    $url = api_get_path(WEB_CODE_PATH) . "newscorm/lp_impress.php?lp_id=$lp_id&" . api_get_cidreq();
103
+    $url = api_get_path(WEB_CODE_PATH)."newscorm/lp_impress.php?lp_id=$lp_id&".api_get_cidreq();
104 104
     header("Location: $url");
105 105
     exit;
106 106
 }
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 
119 119
 // additional APIs
120 120
 $htmlHeadXtra[] = '<script>
121
-chamilo_courseCode = "' . $course_code . '";
121
+chamilo_courseCode = "' . $course_code.'";
122 122
 </script>';
123 123
 // Document API
124 124
 $htmlHeadXtra[] = '<script src="js/documentapi.js" type="text/javascript" language="javascript"></script>';
125 125
 // Storage API
126 126
 $htmlHeadXtra[] = '<script>
127
-var sv_user = \'' . api_get_user_id() . '\';
127
+var sv_user = \'' . api_get_user_id().'\';
128 128
 var sv_course = chamilo_courseCode;
129
-var sv_sco = \'' . $lp_id . '\';
129
+var sv_sco = \'' . $lp_id.'\';
130 130
 </script>'; // FIXME fetch sco and userid from a more reliable source directly in sotrageapi.js
131 131
 $htmlHeadXtra[] = '<script type="text/javascript" src="js/storageapi.js"></script>';
132 132
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         case 3:
198 198
             // aicc
199 199
             $_SESSION['oLP']->stop_previous_item(); // save status manually if asset
200
-            $htmlHeadXtra[] = '<script src="' . $_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
200
+            $htmlHeadXtra[] = '<script src="'.$_SESSION['oLP']->get_js_lib().'" type="text/javascript" language="javascript"></script>';
201 201
             $preReqCheck = $_SESSION['oLP']->prerequisites_match($lp_item_id);
202 202
             if ($preReqCheck === true) {
203 203
                 $src = $_SESSION['oLP']->get_link(
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 // Update status, total_time from lp_item_view table when you finish the exercises in learning path.
220 220
 
221 221
 if ($debug) {
222
-    error_log('$type_quiz: ' . $type_quiz);
223
-    error_log('$_REQUEST[exeId]: ' . intval($_REQUEST['exeId']));
224
-    error_log('$lp_id: ' . $lp_id);
225
-    error_log('$_GET[lp_item_id]: ' . intval($_GET['lp_item_id']));
222
+    error_log('$type_quiz: '.$type_quiz);
223
+    error_log('$_REQUEST[exeId]: '.intval($_REQUEST['exeId']));
224
+    error_log('$lp_id: '.$lp_id);
225
+    error_log('$_GET[lp_item_id]: '.intval($_GET['lp_item_id']));
226 226
 }
227 227
 
228 228
 if (
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         $safe_item_id == strval(intval($safe_item_id))
246 246
     ) {
247 247
         $sql = 'SELECT start_date, exe_date, exe_result, exe_weighting, exe_exo_id
248
-                FROM ' . $TBL_TRACK_EXERCICES . '
248
+                FROM ' . $TBL_TRACK_EXERCICES.'
249 249
                 WHERE exe_id = ' . $safe_exe_id;
250 250
         $res = Database::query($sql);
251 251
         $row_dates = Database::fetch_array($res);
@@ -259,14 +259,14 @@  discard block
 block discarded – undo
259 259
 
260 260
         $sql = "UPDATE $TBL_LP_ITEM SET
261 261
                     max_score = '$max_score'
262
-                WHERE c_id = $course_id AND id = '" . $safe_item_id . "'";
262
+                WHERE c_id = $course_id AND id = '".$safe_item_id."'";
263 263
         Database::query($sql);
264 264
 
265 265
         $sql = "SELECT id FROM $TBL_LP_ITEM_VIEW
266 266
                 WHERE
267 267
                     c_id = $course_id AND
268 268
                     lp_item_id = '$safe_item_id' AND
269
-                    lp_view_id = '" . $_SESSION['oLP']->lp_view_id . "'
269
+                    lp_view_id = '".$_SESSION['oLP']->lp_view_id."'
270 270
                 ORDER BY id DESC
271 271
                 LIMIT 1";
272 272
         $res_last_attempt = Database::query($sql);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
                         status = '$status',
296 296
                         score = $score,
297 297
                         total_time = $mytime
298
-                    WHERE id='" . $lp_item_view_id . "' AND c_id = $course_id ";
298
+                    WHERE id='".$lp_item_view_id."' AND c_id = $course_id ";
299 299
 
300 300
             if ($debug) {
301 301
                 error_log($sql);
@@ -305,17 +305,17 @@  discard block
 block discarded – undo
305 305
 
306 306
             $sql = "UPDATE $TBL_TRACK_EXERCICES SET
307 307
                         orig_lp_item_view_id = $lp_item_view_id
308
-                    WHERE exe_id = " . $safe_exe_id;
308
+                    WHERE exe_id = ".$safe_exe_id;
309 309
             Database::query($sql);
310 310
         }
311 311
     }
312 312
     if (intval($_GET['fb_type']) > 0) {
313 313
         $src = 'blank.php?msg=exerciseFinished';
314 314
     } else {
315
-        $src = api_get_path(WEB_CODE_PATH) . 'exercice/result.php?origin=learnpath&id=' . $safe_exe_id.'&'.api_get_cidreq();
315
+        $src = api_get_path(WEB_CODE_PATH).'exercice/result.php?origin=learnpath&id='.$safe_exe_id.'&'.api_get_cidreq();
316 316
 
317 317
         if ($debug) {
318
-            error_log('Calling URL: ' . $src);
318
+            error_log('Calling URL: '.$src);
319 319
         }
320 320
     }
321 321
     $autostart = 'false';
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
374 374
 $show_audioplayer = false;
375 375
 // Getting all the information about the item.
376
-$sql = "SELECT audio FROM " . $tbl_lp_item . "
377
-        WHERE c_id = $course_id AND lp_id = '" . $_SESSION['oLP']->lp_id . "'";
376
+$sql = "SELECT audio FROM ".$tbl_lp_item."
377
+        WHERE c_id = $course_id AND lp_id = '".$_SESSION['oLP']->lp_id."'";
378 378
 $res_media = Database::query($sql);
379 379
 
380 380
 if (Database::num_rows($res_media) > 0) {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
         'name' => get_lang('LearningPaths')
398 398
     );
399 399
     $interbreadcrumb[] = array(
400
-        'url' => api_get_self() . "?action=add_item&type=step&lp_id={$_SESSION['oLP']->lp_id}&isStudentView=false",
400
+        'url' => api_get_self()."?action=add_item&type=step&lp_id={$_SESSION['oLP']->lp_id}&isStudentView=false",
401 401
         'name' => $_SESSION['oLP']->get_name()
402 402
     );
403 403
     $interbreadcrumb[] = array(
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 
410 410
 // Return to course home.
411 411
 if ($is_allowed_to_edit) {
412
-    $buttonHomeUrl = 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([
412
+    $buttonHomeUrl = 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([
413 413
         'isStudentView' => 'false',
414 414
         'action' => 'return_to_course_homepage'
415 415
     ]);
416 416
 } else {
417
-    $buttonHomeUrl = 'lp_controller.php?' . api_get_cidreq() . '&' . http_build_query([
417
+    $buttonHomeUrl = 'lp_controller.php?'.api_get_cidreq().'&'.http_build_query([
418 418
         'action' => 'return_to_course_homepage'
419 419
     ]);
420 420
 }
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 
520 520
 $template->assign('lp_author', $_SESSION['oLP']->get_author());
521 521
 $template->assign('lp_mode', $_SESSION['oLP']->mode);
522
-$template->assign('lp_title_scorm',$_SESSION['oLP']->name);
522
+$template->assign('lp_title_scorm', $_SESSION['oLP']->name);
523 523
 $template->assign(
524 524
     'lp_html_toc',
525 525
     $_SESSION['oLP']->get_html_toc($get_toc_list)
Please login to merge, or discard this patch.