Passed
Push — 1.10.x ( 04397c...5e25f1 )
by Angel Fernando Quiroz
181:14 queued 130:00
created
main/newscorm/lp_edit_item.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 $htmlHeadXtra[] = '
28 28
 <script>'.$_SESSION['oLP']->get_js_dropdown_array().
29 29
 
30
-'function load_cbo(id){' ."\n" .
30
+'function load_cbo(id){'."\n".
31 31
   'if (!id) {return false;}'.
32
-  'var cbo = document.getElementById(\'previous\');' .
33
-  'for(var i = cbo.length - 1; i > 0; i--) {' .
34
-    'cbo.options[i] = null;' .
35
-  '}' ."\n" .
36
-  'var k=0;' .
37
-  'for(var i = 1; i <= child_name[id].length; i++){' ."\n" .
38
-  '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);' ."\n" .
39
-  '  k=i;' ."\n" .
40
-  '}' ."\n" .
32
+  'var cbo = document.getElementById(\'previous\');'.
33
+  'for(var i = cbo.length - 1; i > 0; i--) {'.
34
+    'cbo.options[i] = null;'.
35
+  '}'."\n".
36
+  'var k=0;'.
37
+  'for(var i = 1; i <= child_name[id].length; i++){'."\n".
38
+  '  cbo.options[i] = new Option(child_name[id][i-1], child_value[id][i-1]);'."\n".
39
+  '  k=i;'."\n".
40
+  '}'."\n".
41 41
   //'if( typeof cbo != "undefined" ) {'."\n" .
42
-  'cbo.options[k].selected = true;'."\n" .
42
+  'cbo.options[k].selected = true;'."\n".
43 43
    //'}'."\n" .
44 44
 
45
-   '$(\'#previous\').selectpicker(\'refresh\');' .
45
+   '$(\'#previous\').selectpicker(\'refresh\');'.
46 46
 '}
47 47
 
48 48
 $(document).on("ready", function() {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 if (!empty($gradebook) && $gradebook == 'view') {
94
-    $interbreadcrumb[] = array (
94
+    $interbreadcrumb[] = array(
95 95
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
96 96
         'name' => get_lang('ToolGradebook')
97 97
     );
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 $show_learn_path = true;
105 105
 $lp_theme_css = $_SESSION['oLP']->get_theme();
106 106
 
107
-Display::display_header(get_lang('Edit'),'Path');
107
+Display::display_header(get_lang('Edit'), 'Path');
108 108
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
109 109
 
110 110
 ?>
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0;
158 158
 $path_item = Database::escape_string($path_item);
159 159
 $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
160
-$sql_doc = "SELECT path FROM " . $tbl_doc . "
161
-            WHERE c_id = $course_id AND id = '". $path_item."' ";
160
+$sql_doc = "SELECT path FROM ".$tbl_doc."
161
+            WHERE c_id = $course_id AND id = '".$path_item."' ";
162 162
 
163 163
 $res_doc = Database::query($sql_doc);
164 164
 $path_file = Database::result($res_doc, 0, 0);
Please login to merge, or discard this patch.
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 1 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 1 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/lp_list_search.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
16 16
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
17 17
 
18
-$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'. api_get_path(WEB_PATH) .'main/newscorm/lp_list_search.css" />';
18
+$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_PATH).'main/newscorm/lp_list_search.css" />';
19 19
 Event::event_access_tool(TOOL_SEARCH);
20 20
 
21
-if (isset($_SESSION['gradebook'])){
21
+if (isset($_SESSION['gradebook'])) {
22 22
     $gradebook = $_SESSION['gradebook'];
23 23
 }
24 24
 
25 25
 if (!empty($gradebook) && $gradebook == 'view') {
26
-    $interbreadcrumb[]= array (
26
+    $interbreadcrumb[] = array(
27 27
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
28 28
         'name' => get_lang('ToolGradebook')
29 29
     );
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 $term_array = array();
60 60
 $specific_fields = get_specific_field_list();
61 61
 foreach ($specific_fields as $specific_field) {
62
-    if (!empty($_REQUEST[ 'sf_'. $specific_field['code'] ])) {
63
-        $values = $_REQUEST[ 'sf_'. $specific_field['code'] ];
62
+    if (!empty($_REQUEST['sf_'.$specific_field['code']])) {
63
+        $values = $_REQUEST['sf_'.$specific_field['code']];
64 64
         if (in_array('__all__', $values)) {
65 65
             $sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']);
66 66
             foreach ($sf_terms_for_code as $term) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             foreach ($values as $term) {
73 73
                 if (!empty($term)) {
74 74
                     $prefix = $specific_field['code'];
75
-                    $term_array[] = chamilo_get_boolean_query($prefix . $term);
75
+                    $term_array[] = chamilo_get_boolean_query($prefix.$term);
76 76
                 }
77 77
             }
78 78
         }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 // Get right group of terms to show on multiple select.
91 91
 $fixed_queries = array();
92 92
 $course_filter = null;
93
-if ( ($cid=api_get_course_id()) != -1 ) {
93
+if (($cid = api_get_course_id()) != -1) {
94 94
     // Results only from actual course.
95
-    $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
95
+    $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
96 96
 }
97 97
 
98 98
 if (count($term_array)) {
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         if ($mode == 'gallery') {
140
-            $title = $a_prefix.str_replace('_',' ',$result['title']). $a_sufix;
140
+            $title = $a_prefix.str_replace('_', ' ', $result['title']).$a_sufix;
141 141
             $blocks[] = array(
142
-                $a_prefix .'<img src="'.$result['thumbnail'].'" />'. $a_sufix .'<br />'.$title.'<br />'.$result['author'],
142
+                $a_prefix.'<img src="'.$result['thumbnail'].'" />'.$a_sufix.'<br />'.$title.'<br />'.$result['author'],
143 143
             );
144 144
         } else {
145
-            $title = '<div style="text-align:left;">'. $a_prefix . $result['title']. $a_sufix .(!empty($result['author']) ? ' '.$result['author'] : '').'<div>';
145
+            $title = '<div style="text-align:left;">'.$a_prefix.$result['title'].$a_sufix.(!empty($result['author']) ? ' '.$result['author'] : '').'<div>';
146 146
             $blocks[] = array($title);
147 147
         }
148 148
     }
@@ -154,19 +154,19 @@  discard block
 block discarded – undo
154 154
     $s->display_mode = $mode; // default
155 155
     $s->display_mode_params = 3;
156 156
     $s->per_page = 9;
157
-    $additional_parameters = array (
157
+    $additional_parameters = array(
158 158
         'mode' => $mode,
159 159
         'action' => 'search',
160 160
         'query' => Security::remove_XSS($_REQUEST['query']),
161 161
     );
162 162
     $get_params = '';
163 163
     foreach ($specific_fields as $specific_field) {
164
-        if (isset($_REQUEST[ 'sf_'. $specific_field['code'] ])) {
165
-            $values = $_REQUEST[ 'sf_'. $specific_field['code'] ];
164
+        if (isset($_REQUEST['sf_'.$specific_field['code']])) {
165
+            $values = $_REQUEST['sf_'.$specific_field['code']];
166 166
             //Sortable additional_parameters doesn't accept multi dimensional arrays
167 167
             //$additional_parameters[ 'sf_'. $specific_field['code'] ] = $values;
168
-            foreach ( $values as $value ) {
169
-                $get_params .= '&sf_' . $specific_field['code'] .'[]='. $value;
168
+            foreach ($values as $value) {
169
+                $get_params .= '&sf_'.$specific_field['code'].'[]='.$value;
170 170
             }
171 171
             $get_params .= '&';
172 172
         }
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
     $mode_selector = '<div id="mode-selector">';
185 185
     $mode_selector .= sprintf($search_link, api_get_path(WEB_CODE_PATH), 'gallery', $_REQUEST['query'], $get_params);
186
-    $mode_selector .= '<img src="../img/'. (($mode=='gallery')?'ButtonGallOn':'ButtonGallOff') .'.png" /></a>';
186
+    $mode_selector .= '<img src="../img/'.(($mode == 'gallery') ? 'ButtonGallOn' : 'ButtonGallOff').'.png" /></a>';
187 187
     $mode_selector .= sprintf($search_link, api_get_path(WEB_CODE_PATH), 'default', $_REQUEST['query'], $get_params);
188
-    $mode_selector .= '<img src="../img/'.(($mode=='default')?'ButtonListOn':'ButtonListOff').'.png" /></a>';
188
+    $mode_selector .= '<img src="../img/'.(($mode == 'default') ? 'ButtonListOn' : 'ButtonListOff').'.png" /></a>';
189 189
     $mode_selector .= '</div>';
190 190
 
191 191
     echo '<div id="search-results-container">';
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 1 patch
Spacing   +692 added lines, -692 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $res = Database::query($sql);
245 245
 
246 246
         if ($this->debug > 2) {
247
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
247
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
248 248
             error_log('-- Start while--', 0);
249 249
         }
250 250
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                         $this->refs_list[$oItem->ref] = $my_item_id;
265 265
                         if ($this->debug > 2) {
266 266
                             error_log(
267
-                                'New LP - learnpath::__construct() - ' .
268
-                                'aicc object with id ' . $my_item_id .
267
+                                'New LP - learnpath::__construct() - '.
268
+                                'aicc object with id '.$my_item_id.
269 269
                                 ' set in items[]', 0);
270 270
                         }
271 271
                     }
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 
283 283
                         $this->refs_list[$oItem->ref] = $my_item_id;
284 284
                         if ($this->debug > 2) {
285
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
285
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
286 286
                         }
287 287
                     }
288 288
                     break;
289 289
                 case 1:
290 290
                 default:
291 291
                     if ($this->debug > 2) {
292
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
292
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
293 293
                     }
294 294
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
295 295
 
296 296
                     if ($this->debug > 2) {
297
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
297
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
298 298
                     }
299 299
                     if (is_object($oItem)) {
300 300
                         $my_item_id = $oItem->get_id();
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
                         $this->refs_list[$my_item_id] = $my_item_id;
306 306
                         if ($this->debug > 2) {
307 307
                             error_log(
308
-                                'New LP - learnpath::__construct() ' . __LINE__ .
309
-                                ' - object with id ' . $my_item_id . ' set in items[]',
308
+                                'New LP - learnpath::__construct() '.__LINE__.
309
+                                ' - object with id '.$my_item_id.' set in items[]',
310 310
                                 0);
311 311
                         }
312 312
                     }
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
325 325
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
326 326
                     $this->items[$row['id']]->current_start_time = 0;
327
-                    $this->items[$row['id']]->current_stop_time	= 0;
327
+                    $this->items[$row['id']]->current_stop_time = 0;
328 328
                 }
329 329
             }
330 330
         }
331 331
 
332 332
         if ($this->debug > 2) {
333
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
333
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
334 334
         }
335 335
 
336 336
         if (!empty($lp_item_id_list)) {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         // TODO: Define the current item better.
423 423
         $this->first();
424 424
         if ($this->debug > 2) {
425
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
425
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
426 426
         }
427 427
         return true;
428 428
     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     ) {
497 497
         $course_id = $this->course_info['real_id'];
498 498
         if ($this->debug > 0) {
499
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
499
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
500 500
         }
501 501
         if (empty($course_id)) {
502 502
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                 FROM $tbl_lp_item
517 517
                 WHERE
518 518
                     c_id = $course_id AND
519
-                    lp_id = " . $this->get_id() . " AND
519
+                    lp_id = ".$this->get_id()." AND
520 520
                     parent_item_id = " . $parent;
521 521
 
522 522
         $res_count = Database::query($sql);
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
         if ($num > 0) {
527 527
             if ($previous == 0) {
528 528
                 $sql = "SELECT id, next_item_id, display_order
529
-                        FROM " . $tbl_lp_item . "
529
+                        FROM " . $tbl_lp_item."
530 530
                         WHERE
531 531
                             c_id = $course_id AND
532
-                            lp_id = " . $this->get_id() . " AND
533
-                            parent_item_id = " . $parent . " AND
532
+                            lp_id = ".$this->get_id()." AND
533
+                            parent_item_id = " . $parent." AND
534 534
                             previous_item_id = 0 OR
535 535
                             previous_item_id=" . $parent;
536 536
                 $result = Database::query($sql);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 						FROM $tbl_lp_item
546 546
                         WHERE
547 547
                             c_id = $course_id AND
548
-                            lp_id = " . $this->get_id() . " AND
548
+                            lp_id = ".$this->get_id()." AND
549 549
                             id = " . $previous;
550 550
 
551 551
                 $result = Database::query($sql);
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
         $typeCleaned = Database::escape_string($type);
566 566
         if ($type == 'quiz') {
567 567
             $sql = 'SELECT SUM(ponderation)
568
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
569
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
568
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
569
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
570 570
                     ON
571 571
                         quiz_question.id = quiz_rel_question.question_id AND
572 572
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         $new_item_id = Database::insert($tbl_lp_item, $params);
613 613
 
614 614
         if ($this->debug > 2) {
615
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
615
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
616 616
         }
617 617
 
618 618
         if ($new_item_id) {
@@ -629,28 +629,28 @@  discard block
 block discarded – undo
629 629
             Database::query($sql);
630 630
 
631 631
             // Update all the items after the new item.
632
-            $sql = "UPDATE " . $tbl_lp_item . "
632
+            $sql = "UPDATE ".$tbl_lp_item."
633 633
                         SET display_order = display_order + 1
634 634
                     WHERE
635 635
                         c_id = $course_id AND
636
-                        lp_id = " . $this->get_id() . " AND
637
-                        id <> " . $new_item_id . " AND
638
-                        parent_item_id = " . $parent . " AND
636
+                        lp_id = ".$this->get_id()." AND
637
+                        id <> " . $new_item_id." AND
638
+                        parent_item_id = " . $parent." AND
639 639
                         display_order > " . $display_order;
640 640
             Database::query($sql);
641 641
 
642 642
             // Update the item that should come after the new item.
643
-            $sql = "UPDATE " . $tbl_lp_item . "
644
-                    SET ref = " . $new_item_id . "
645
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
643
+            $sql = "UPDATE ".$tbl_lp_item."
644
+                    SET ref = " . $new_item_id."
645
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
646 646
             Database::query($sql);
647 647
 
648 648
             // Upload audio.
649 649
             if (!empty($_FILES['mp3']['name'])) {
650 650
                 // Create the audio folder if it does not exist yet.
651
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
652
-                if (!is_dir($filepath . 'audio')) {
653
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
651
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
652
+                if (!is_dir($filepath.'audio')) {
653
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
654 654
                     $audio_id = add_document(
655 655
                         $_course,
656 656
                         '/audio',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                 $file_path = handle_uploaded_document(
688 688
                     $_course,
689 689
                     $_FILES['mp3'],
690
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
690
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
691 691
                     '/audio',
692 692
                     api_get_user_id(),
693 693
                     '',
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 
704 704
                 // Store the mp3 file in the lp_item table.
705 705
                 $sql = "UPDATE $tbl_lp_item SET
706
-                            audio = '" . Database::escape_string($file) . "'
707
-                        WHERE id = '" . intval($new_item_id) . "'";
706
+                            audio = '".Database::escape_string($file)."'
707
+                        WHERE id = '" . intval($new_item_id)."'";
708 708
                 Database::query($sql);
709 709
             }
710 710
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         while (Database :: num_rows($res_name)) {
781 781
             // There is already one such name, update the current one a bit.
782 782
             $i++;
783
-            $name = $name . ' - ' . $i;
783
+            $name = $name.' - '.$i;
784 784
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
785 785
             $res_name = Database::query($check_name);
786 786
         }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
                 // if $item points to an object and there is a parent.
893 893
                 if ($debug) {
894 894
                     error_log(
895
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
895
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
896 896
                         0
897 897
                     );
898 898
                 }
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
                         if ($childItemId != $item) {
921 921
                             if ($debug) {
922 922
                                 error_log(
923
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
923
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
924 924
                                     0
925 925
                                 );
926 926
                             }
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                             } else {
941 941
                                 if ($debug > 2) {
942 942
                                     error_log(
943
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
943
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
944 944
                                         0
945 945
                                     );
946 946
                                 }
@@ -1045,15 +1045,15 @@  discard block
 block discarded – undo
1045 1045
         // Delete lp item id.
1046 1046
         foreach ($this->items as $id => $dummy) {
1047 1047
             $sql = "DELETE FROM $lp_item_view
1048
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1048
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1049 1049
             Database::query($sql);
1050 1050
         }
1051 1051
 
1052 1052
         // Proposed by Christophe (nickname: clefevre)
1053
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1053
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1054 1054
         Database::query($sql);
1055 1055
 
1056
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1056
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1057 1057
         Database::query($sql);
1058 1058
 
1059 1059
         self::toggle_publish($this->lp_id, 'i');
@@ -1061,32 +1061,32 @@  discard block
 block discarded – undo
1061 1061
         if ($this->type == 2 || $this->type == 3) {
1062 1062
             // This is a scorm learning path, delete the files as well.
1063 1063
             $sql = "SELECT path FROM $lp
1064
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1064
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1065 1065
             $res = Database::query($sql);
1066 1066
             if (Database :: num_rows($res) > 0) {
1067 1067
                 $row = Database :: fetch_array($res);
1068 1068
                 $path = $row['path'];
1069 1069
                 $sql = "SELECT id FROM $lp
1070
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1070
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1071 1071
                 $res = Database::query($sql);
1072 1072
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1073 1073
                     if ($this->debug > 2) {
1074
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1074
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1075 1075
                     }
1076 1076
                 } else {
1077 1077
                     // No other LP uses that directory, delete it.
1078
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1079
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1080
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1078
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1079
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1080
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1081 1081
                         if ($this->debug > 2) {
1082
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1082
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1083 1083
                         }
1084 1084
                         // Proposed by Christophe (clefevre).
1085 1085
                         if (strcmp(substr($path, -2), "/.") == 0) {
1086 1086
                             $path = substr($path, 0, -1); // Remove "." at the end.
1087 1087
                         }
1088 1088
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1089
-                        rmdirr($course_scorm_dir . $path);
1089
+                        rmdirr($course_scorm_dir.$path);
1090 1090
                     }
1091 1091
                 }
1092 1092
             }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1100 1100
         Database::query($sql);
1101 1101
 
1102
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1102
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1103 1103
         Database::query($sql);
1104 1104
         // Updates the display order of all lps.
1105 1105
         $this->update_display_order();
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
             api_get_user_id()
1113 1113
         );
1114 1114
 
1115
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1115
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1116 1116
         if ($link_info !== false) {
1117 1117
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1118 1118
         }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
     {
1133 1133
         $course_id = $this->course_info['real_id'];
1134 1134
         if ($this->debug > 0) {
1135
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1135
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1136 1136
         }
1137 1137
         $num = 0;
1138 1138
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
         $res = Database::query($sql);
1144 1144
         while ($row = Database :: fetch_array($res)) {
1145 1145
             $num += $this->delete_children_items($row['id']);
1146
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1146
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1147 1147
             Database::query($sql_del);
1148 1148
             $num++;
1149 1149
         }
@@ -1184,12 +1184,12 @@  discard block
 block discarded – undo
1184 1184
         // Delete children items.
1185 1185
         $num = $this->delete_children_items($id);
1186 1186
         if ($this->debug > 2) {
1187
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1187
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1188 1188
         }
1189 1189
         // Now delete the item.
1190 1190
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1191 1191
         if ($this->debug > 2) {
1192
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1192
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1193 1193
         }
1194 1194
         Database::query($sql_del);
1195 1195
         // Now update surrounding items.
@@ -1264,15 +1264,15 @@  discard block
 block discarded – undo
1264 1264
         }
1265 1265
 
1266 1266
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1267
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1267
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1268 1268
         $res_select = Database::query($sql_select);
1269 1269
         $row_select = Database :: fetch_array($res_select);
1270 1270
         $audio_update_sql = '';
1271 1271
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1272 1272
             // Create the audio folder if it does not exist yet.
1273
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1274
-            if (!is_dir($filepath . 'audio')) {
1275
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1273
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1274
+            if (!is_dir($filepath.'audio')) {
1275
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1276 1276
                 $audio_id = add_document(
1277 1277
                     $_course,
1278 1278
                     '/audio',
@@ -1310,11 +1310,11 @@  discard block
 block discarded – undo
1310 1310
             $pi = pathinfo($audio['name']);
1311 1311
             if ($pi['extension'] == 'mp3') {
1312 1312
                 $c_det = api_get_course_info($this->cc);
1313
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1313
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1314 1314
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1315 1315
                 $path = substr($path, 7);
1316 1316
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1317
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1317
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1318 1318
             }
1319 1319
         }
1320 1320
 
@@ -1324,13 +1324,13 @@  discard block
 block discarded – undo
1324 1324
         // TODO: htmlspecialchars to be checked for encoding related problems.
1325 1325
         if ($same_parent && $same_previous) {
1326 1326
             // Only update title and description.
1327
-            $sql = "UPDATE " . $tbl_lp_item . "
1328
-                    SET title = '" . Database::escape_string($title) . "',
1329
-                        prerequisite = '" . $prerequisites . "',
1330
-                        description = '" . Database::escape_string($description) . "'
1331
-                        " . $audio_update_sql . ",
1332
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1333
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1327
+            $sql = "UPDATE ".$tbl_lp_item."
1328
+                    SET title = '" . Database::escape_string($title)."',
1329
+                        prerequisite = '" . $prerequisites."',
1330
+                        description = '" . Database::escape_string($description)."'
1331
+                        " . $audio_update_sql.",
1332
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1333
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1334 1334
             Database::query($sql);
1335 1335
         } else {
1336 1336
             $old_parent = $row_select['parent_item_id'];
@@ -1345,27 +1345,27 @@  discard block
 block discarded – undo
1345 1345
 
1346 1346
             if ($old_previous != 0) {
1347 1347
                 // Next
1348
-                $sql = "UPDATE " . $tbl_lp_item . "
1349
-                        SET next_item_id = " . $old_next . "
1350
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1348
+                $sql = "UPDATE ".$tbl_lp_item."
1349
+                        SET next_item_id = " . $old_next."
1350
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1351 1351
                 Database::query($sql);
1352 1352
             }
1353 1353
 
1354 1354
             if ($old_next != 0) {
1355 1355
                 // Previous
1356
-                $sql = "UPDATE " . $tbl_lp_item . "
1357
-                        SET previous_item_id = " . $old_previous . "
1358
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1356
+                $sql = "UPDATE ".$tbl_lp_item."
1357
+                        SET previous_item_id = " . $old_previous."
1358
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1359 1359
                 Database::query($sql);
1360 1360
             }
1361 1361
 
1362 1362
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1363
-            $sql = "UPDATE " . $tbl_lp_item . "
1363
+            $sql = "UPDATE ".$tbl_lp_item."
1364 1364
                     SET display_order = display_order - 1
1365 1365
                     WHERE
1366 1366
                         c_id = ".$course_id." AND
1367
-                        display_order > " . $old_order . " AND
1368
-                        lp_id = " . $this->lp_id . " AND
1367
+                        display_order > " . $old_order." AND
1368
+                        lp_id = " . $this->lp_id." AND
1369 1369
                         parent_item_id = " . $old_parent;
1370 1370
             Database::query($sql);
1371 1371
             /* END -- virtually remove the current item id */
@@ -1375,11 +1375,11 @@  discard block
 block discarded – undo
1375 1375
             if ($previous == 0) {
1376 1376
                 // Select the data of the item that should come after the current item.
1377 1377
                 $sql = "SELECT id, display_order
1378
-                        FROM " . $tbl_lp_item . "
1378
+                        FROM " . $tbl_lp_item."
1379 1379
                         WHERE
1380 1380
                             c_id = ".$course_id." AND
1381
-                            lp_id = " . $this->lp_id . " AND
1382
-                            parent_item_id = " . $parent . " AND
1381
+                            lp_id = " . $this->lp_id." AND
1382
+                            parent_item_id = " . $parent." AND
1383 1383
                             previous_item_id = " . $previous;
1384 1384
                 $res_select_old = Database::query($sql);
1385 1385
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1395,8 +1395,8 @@  discard block
 block discarded – undo
1395 1395
             } else {
1396 1396
                 // Select the data of the item that should come before the current item.
1397 1397
                 $sql = "SELECT next_item_id, display_order
1398
-                        FROM " . $tbl_lp_item . "
1399
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1398
+                        FROM " . $tbl_lp_item."
1399
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1400 1400
                 $res_select_old = Database::query($sql);
1401 1401
                 $row_select_old = Database :: fetch_array($res_select_old);
1402 1402
                 $new_next = $row_select_old['next_item_id'];
@@ -1405,57 +1405,57 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
             // TODO: htmlspecialchars to be checked for encoding related problems.
1407 1407
             // Update the current item with the new data.
1408
-            $sql = "UPDATE " . $tbl_lp_item . "
1408
+            $sql = "UPDATE ".$tbl_lp_item."
1409 1409
                     SET
1410
-                        title = '" . Database::escape_string($title) . "',
1411
-                        description = '" . Database::escape_string($description) . "',
1412
-                        parent_item_id = " . $parent . ",
1413
-                        previous_item_id = " . $previous . ",
1414
-                        next_item_id = " . $new_next . ",
1415
-                        display_order = " . $new_order . "
1416
-                        " . $audio_update_sql . "
1417
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1410
+                        title = '" . Database::escape_string($title)."',
1411
+                        description = '" . Database::escape_string($description)."',
1412
+                        parent_item_id = " . $parent.",
1413
+                        previous_item_id = " . $previous.",
1414
+                        next_item_id = " . $new_next.",
1415
+                        display_order = " . $new_order."
1416
+                        " . $audio_update_sql."
1417
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1418 1418
             Database::query($sql);
1419 1419
 
1420 1420
             if ($previous != 0) {
1421 1421
                 // Update the previous item's next_item_id.
1422
-                $sql = "UPDATE " . $tbl_lp_item . "
1423
-                        SET next_item_id = " . $id . "
1424
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1422
+                $sql = "UPDATE ".$tbl_lp_item."
1423
+                        SET next_item_id = " . $id."
1424
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1425 1425
                 Database::query($sql);
1426 1426
             }
1427 1427
 
1428 1428
             if ($new_next != 0) {
1429 1429
                 // Update the next item's previous_item_id.
1430
-                $sql = "UPDATE " . $tbl_lp_item . "
1431
-                        SET previous_item_id = " . $id . "
1432
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1430
+                $sql = "UPDATE ".$tbl_lp_item."
1431
+                        SET previous_item_id = " . $id."
1432
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1433 1433
                 Database::query($sql);
1434 1434
             }
1435 1435
 
1436 1436
             if ($old_prerequisite != $prerequisites) {
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET prerequisite = '" . $prerequisites . "'
1439
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET prerequisite = '" . $prerequisites."'
1439
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($old_max_time_allowed != $max_time_allowed) {
1444 1444
                 // update max time allowed
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET max_time_allowed = " . $max_time_allowed . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET max_time_allowed = " . $max_time_allowed."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             // Update all the items with the same or a bigger display_order than the current item.
1452
-            $sql = "UPDATE " . $tbl_lp_item . "
1452
+            $sql = "UPDATE ".$tbl_lp_item."
1453 1453
                     SET display_order = display_order + 1
1454 1454
                     WHERE
1455 1455
                        c_id = ".$course_id." AND
1456
-                       lp_id = " . $this->get_id() . " AND
1457
-                       id <> " . $id . " AND
1458
-                       parent_item_id = " . $parent . " AND
1456
+                       lp_id = " . $this->get_id()." AND
1457
+                       id <> " . $id." AND
1458
+                       parent_item_id = " . $parent." AND
1459 1459
                        display_order >= " . $new_order;
1460 1460
 
1461 1461
             Database::query($sql);
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
     {
1482 1482
         $course_id = api_get_course_int_id();
1483 1483
         if ($this->debug > 0) {
1484
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1484
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1485 1485
         }
1486 1486
 
1487 1487
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1580 1580
         }
1581 1581
 
1582
-        if (empty($id)|| $id != strval(intval($id))) {
1583
-            return array ();
1582
+        if (empty($id) || $id != strval(intval($id))) {
1583
+            return array();
1584 1584
         }
1585 1585
 
1586 1586
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
                             item_type='dokeos_chapter'
1599 1599
                         ORDER BY display_order";
1600 1600
             $res_bros = Database::query($sql_bros);
1601
-            $list = array ();
1601
+            $list = array();
1602 1602
             while ($row_bro = Database :: fetch_array($res_bros)) {
1603 1603
                 $list[] = $row_bro;
1604 1604
             }
1605 1605
             return $list;
1606 1606
         }
1607
-        return array ();
1607
+        return array();
1608 1608
     }
1609 1609
 
1610 1610
     /**
@@ -1617,11 +1617,11 @@  discard block
 block discarded – undo
1617 1617
     {
1618 1618
         $course_id = api_get_course_int_id();
1619 1619
         if ($this->debug > 0) {
1620
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1620
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1621 1621
         }
1622 1622
 
1623 1623
         if (empty ($id) || $id != strval(intval($id))) {
1624
-            return array ();
1624
+            return array();
1625 1625
         }
1626 1626
 
1627 1627
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1633,13 +1633,13 @@  discard block
 block discarded – undo
1633 1633
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1634 1634
                          ORDER BY display_order";
1635 1635
             $res_bros = Database::query($sql_bros);
1636
-            $list = array ();
1636
+            $list = array();
1637 1637
             while ($row_bro = Database :: fetch_array($res_bros)) {
1638 1638
                 $list[] = $row_bro;
1639 1639
             }
1640 1640
             return $list;
1641 1641
         }
1642
-        return array ();
1642
+        return array();
1643 1643
     }
1644 1644
 
1645 1645
     /**
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             $current = $this->current;
1710 1710
         }
1711 1711
         if ($this->debug > 2) {
1712
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1712
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1713 1713
         }
1714 1714
         return $current;
1715 1715
     }
@@ -1790,7 +1790,7 @@  discard block
 block discarded – undo
1790 1790
         ) {
1791 1791
 
1792 1792
             if ($this->debug > 2) {
1793
-                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);
1793
+                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);
1794 1794
             }
1795 1795
             $index = -1;
1796 1796
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
             if ($index == -1) {
1803 1803
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1804 1804
                 if ($this->debug > 2) {
1805
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1805
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1806 1806
                 }
1807 1807
                 return false;
1808 1808
             } else {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
             $index = 0;
1818 1818
             // Loop through all ordered items and stop at the first item that is
1819 1819
             // not a directory *and* that has not been completed yet.
1820
-            while ( !empty($this->ordered_items[$index]) AND
1820
+            while (!empty($this->ordered_items[$index]) AND
1821 1821
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1822 1822
                 (
1823 1823
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1831,14 +1831,14 @@  discard block
 block discarded – undo
1831 1831
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1832 1832
             $this->index    = $index;
1833 1833
             if ($this->debug > 2) {
1834
-                error_log('$index ' . $index);
1834
+                error_log('$index '.$index);
1835 1835
             }
1836 1836
             if ($this->debug > 2) {
1837
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1837
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1838 1838
             }
1839 1839
         }
1840 1840
         if ($this->debug > 2) {
1841
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1841
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1842 1842
         }
1843 1843
     }
1844 1844
 
@@ -1851,7 +1851,7 @@  discard block
 block discarded – undo
1851 1851
     public function get_js_info($item_id = '')
1852 1852
     {
1853 1853
         if ($this->debug > 0) {
1854
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1854
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1855 1855
         }
1856 1856
 
1857 1857
         $info = '';
@@ -1861,17 +1861,17 @@  discard block
 block discarded – undo
1861 1861
             //if item is defined, return values from DB
1862 1862
             $oItem = $this->items[$item_id];
1863 1863
             $info .= '<script language="javascript">';
1864
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1865
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1866
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1867
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1868
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1869
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1870
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1864
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1865
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1866
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1867
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1868
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1869
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1870
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1871 1871
             $info .= "top.set_flag_synchronized();";
1872 1872
             $info .= '</script>';
1873 1873
             if ($this->debug > 2) {
1874
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1874
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1875 1875
             }
1876 1876
             return $info;
1877 1877
 
@@ -1879,17 +1879,17 @@  discard block
 block discarded – undo
1879 1879
 
1880 1880
             // If item_id is empty, just update to default SCORM data.
1881 1881
             $info .= '<script language="javascript">';
1882
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1883
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1884
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1885
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1886
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1887
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1888
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1882
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1883
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1884
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1885
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1886
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1887
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1888
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1889 1889
             $info .= "top.set_flag_synchronized();";
1890 1890
             $info .= '</script>';
1891 1891
             if ($this->debug > 2) {
1892
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1892
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1893 1893
             }
1894 1894
             return $info;
1895 1895
         }
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
      * Gets the navigation bar for the learnpath display screen
1944 1944
      * @return	string	The HTML string to use as a navigation bar
1945 1945
      */
1946
-    public function get_navigation_bar($idBar = null, $display=null) {
1946
+    public function get_navigation_bar($idBar = null, $display = null) {
1947 1947
         if ($this->debug > 0) {
1948 1948
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1949 1949
         }
1950
-        if(empty($idBar)){
1951
-            $idBar='control-top';
1950
+        if (empty($idBar)) {
1951
+            $idBar = 'control-top';
1952 1952
         }
1953 1953
         /* if(empty($display)){
1954 1954
             $display='display:block';
@@ -1961,16 +1961,16 @@  discard block
 block discarded – undo
1961 1961
             $navbar = '
1962 1962
                   <span id="'.$idBar.'" class="buttons">
1963 1963
                     <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">
1964
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1964
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1965 1965
                     </a>
1966
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1967
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1966
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1967
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1968 1968
                     </a>
1969
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1970
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1969
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1970
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1971 1971
                     </a>
1972 1972
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1973
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1973
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1974 1974
                     </a> 
1975 1975
                   </span>';
1976 1976
 
@@ -1978,13 +1978,13 @@  discard block
 block discarded – undo
1978 1978
             $navbar = '
1979 1979
                 <span id="'.$idBar.'" class="buttons text-right">
1980 1980
                     <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">
1981
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1981
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1982 1982
                     </a>
1983
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1984
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1983
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1984
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1985 1985
                     </a>
1986
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1987
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1986
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1987
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1988 1988
                     </a>
1989 1989
                 </span>';
1990 1990
         }
@@ -2005,11 +2005,11 @@  discard block
 block discarded – undo
2005 2005
         $index = $this->index;
2006 2006
         $index++;
2007 2007
         if ($this->debug > 2) {
2008
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2008
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2009 2009
         }
2010 2010
         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) {
2011 2011
             $index++;
2012
-            if ($index == $this->max_ordered_items){
2012
+            if ($index == $this->max_ordered_items) {
2013 2013
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2014 2014
                     return $this->index;
2015 2015
                 } else {
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
             return $this->index;
2022 2022
         }
2023 2023
         if ($this->debug > 2) {
2024
-            error_log('New LP - index is now ' . $index, 0);
2024
+            error_log('New LP - index is now '.$index, 0);
2025 2025
         }
2026 2026
         return $index;
2027 2027
     }
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
         if (!empty ($new_index)) {
2040 2040
             if (isset ($this->ordered_items[$new_index])) {
2041 2041
                 if ($this->debug > 2) {
2042
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2042
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2043 2043
                 }
2044 2044
                 return $this->ordered_items[$new_index];
2045 2045
             }
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
         }
2082 2082
 
2083 2083
         // Filename without its extension.
2084
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2084
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2085 2085
 
2086 2086
         $zipFile = new PclZip($file_path);
2087 2087
         // Check the zip content (real size and file extension).
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
                     break; // Exit the foreach loop.
2106 2106
                 } elseif (
2107 2107
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2108
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2108
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2109 2109
                 ) {
2110 2110
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2111 2111
                     switch ($ext) {
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
             error_log('New LP - In learnpath::get_previous_index()', 0);
2148 2148
         }
2149 2149
         $index = $this->index;
2150
-        if (isset ($this->ordered_items[$index -1])) {
2150
+        if (isset ($this->ordered_items[$index - 1])) {
2151 2151
             $index--;
2152 2152
             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')) {
2153 2153
                 $index--;
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
             }
2158 2158
         } else {
2159 2159
             if ($this->debug > 2) {
2160
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2160
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2161 2161
             }
2162 2162
             // There is no previous item.
2163 2163
         }
@@ -2200,8 +2200,8 @@  discard block
 block discarded – undo
2200 2200
     {
2201 2201
         $course_id = api_get_course_int_id();
2202 2202
         $_course = api_get_course_info();
2203
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2204
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2203
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2204
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2205 2205
 
2206 2206
         // Getting all the information about the item.
2207 2207
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
                     lp.c_id = $course_id AND
2213 2213
                     lp_view.c_id = $course_id";
2214 2214
         $result = Database::query($sql);
2215
-        $row 	= Database::fetch_assoc($result);
2215
+        $row = Database::fetch_assoc($result);
2216 2216
         $output = '';
2217 2217
 
2218 2218
         if (!empty ($row['audio'])) {
@@ -2220,8 +2220,8 @@  discard block
 block discarded – undo
2220 2220
             $list = $_SESSION['oLP']->get_toc();
2221 2221
             $type_quiz = false;
2222 2222
 
2223
-            foreach($list as $toc) {
2224
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2223
+            foreach ($list as $toc) {
2224
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2225 2225
                     $type_quiz = true;
2226 2226
                 }
2227 2227
             }
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
         $courseCode = null,
2285 2285
         $sessionId = null
2286 2286
     ) {
2287
-        $lp_id = (int)$lp_id;
2287
+        $lp_id = (int) $lp_id;
2288 2288
         $courseInfo = api_get_course_info($courseCode);
2289 2289
         $sessionId = intval($sessionId);
2290 2290
 
@@ -2450,10 +2450,10 @@  discard block
 block discarded – undo
2450 2450
      */
2451 2451
     public static function get_progress_bar($percentage = -1, $text_add = '')
2452 2452
     {
2453
-        $text = $percentage . $text_add;
2453
+        $text = $percentage.$text_add;
2454 2454
         $output = '<div class="progress">
2455
-                        <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.';">
2456
-                        '. $text .'
2455
+                        <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.';">
2456
+                        '. $text.'
2457 2457
                         </div>
2458 2458
                     </div>';
2459 2459
 
@@ -2489,16 +2489,16 @@  discard block
 block discarded – undo
2489 2489
         }
2490 2490
         $total_items = $this->get_total_items_count_without_chapters();
2491 2491
         if ($this->debug > 2) {
2492
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2492
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2493 2493
         }
2494 2494
         $completeItems = $this->get_complete_items_count();
2495 2495
         if ($this->debug > 2) {
2496
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2496
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2497 2497
         }
2498 2498
         if ($add != 0) {
2499 2499
             $completeItems += $add;
2500 2500
             if ($this->debug > 2) {
2501
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2501
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2502 2502
             }
2503 2503
         }
2504 2504
         $text = '';
@@ -2516,7 +2516,7 @@  discard block
 block discarded – undo
2516 2516
             $text = '%';
2517 2517
         } elseif ($mode == 'abs') {
2518 2518
             $percentage = $completeItems;
2519
-            $text = '/' . $total_items;
2519
+            $text = '/'.$total_items;
2520 2520
         }
2521 2521
 
2522 2522
         return array(
@@ -2712,7 +2712,7 @@  discard block
 block discarded – undo
2712 2712
                 // and replace them, one by one, by the internal IDs (chamilo db)
2713 2713
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2714 2714
                 // by a space as well.
2715
-                $find = array (
2715
+                $find = array(
2716 2716
                     '&',
2717 2717
                     '|',
2718 2718
                     '~',
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
                     '(',
2725 2725
                     ')'
2726 2726
                 );
2727
-                $replace = array (
2727
+                $replace = array(
2728 2728
                     ' ',
2729 2729
                     ' ',
2730 2730
                     ' ',
@@ -2741,7 +2741,7 @@  discard block
 block discarded – undo
2741 2741
                 foreach ($ids as $id) {
2742 2742
                     $id = trim($id);
2743 2743
                     if (isset ($this->refs_list[$id])) {
2744
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2744
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2745 2745
                     }
2746 2746
                 }
2747 2747
 
@@ -2849,9 +2849,9 @@  discard block
 block discarded – undo
2849 2849
         if ($this->debug > 0) {
2850 2850
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2851 2851
         }
2852
-        $list = array ();
2852
+        $list = array();
2853 2853
         foreach ($this->ordered_items as $item_id) {
2854
-            $list[] = array (
2854
+            $list[] = array(
2855 2855
                 $item_id => $this->items[$item_id]->get_status()
2856 2856
             );
2857 2857
         }
@@ -2905,7 +2905,7 @@  discard block
 block discarded – undo
2905 2905
         $res = Database::query($sql);
2906 2906
         $num = Database :: num_rows($res);
2907 2907
         if ($num > 0) {
2908
-            $list[] = array (
2908
+            $list[] = array(
2909 2909
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2910 2910
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2911 2911
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2917 2917
             );
2918 2918
             while ($row = Database :: fetch_array($res)) {
2919
-                $list[] = array (
2919
+                $list[] = array(
2920 2920
                     'order_id' => ($row['order_id'] + 1),
2921 2921
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2922 2922
                     'type' => $row['interaction_type'],
@@ -2984,7 +2984,7 @@  discard block
 block discarded – undo
2984 2984
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
2985 2985
             );
2986 2986
             while ($row = Database :: fetch_array($res)) {
2987
-                $list[] = array (
2987
+                $list[] = array(
2988 2988
                     'order_id' => ($row['order_id'] + 1),
2989 2989
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
2990 2990
                     'score_raw' => $row['score_raw'],
@@ -3011,10 +3011,10 @@  discard block
 block discarded – undo
3011 3011
         $toc = array();
3012 3012
         foreach ($this->ordered_items as $item_id) {
3013 3013
             if ($this->debug > 2) {
3014
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3014
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3015 3015
             }
3016 3016
             // TODO: Change this link generation and use new function instead.
3017
-            $toc[] = array (
3017
+            $toc[] = array(
3018 3018
                 'id'            => $item_id,
3019 3019
                 'title'         => $this->items[$item_id]->get_title(),
3020 3020
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3025,7 +3025,7 @@  discard block
 block discarded – undo
3025 3025
             );
3026 3026
         }
3027 3027
         if ($this->debug > 2) {
3028
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3028
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3029 3029
         }
3030 3030
         return $toc;
3031 3031
     }
@@ -3042,10 +3042,10 @@  discard block
 block discarded – undo
3042 3042
         }
3043 3043
         $toc = $varname.' = new Array();';
3044 3044
         foreach ($this->ordered_items as $item_id) {
3045
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3045
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3046 3046
         }
3047 3047
         if ($this->debug > 2) {
3048
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3048
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3049 3049
         }
3050 3050
         return $toc;
3051 3051
     }
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
             }
3070 3070
         }
3071 3071
         if ($this->debug > 2) {
3072
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3072
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3073 3073
         }
3074 3074
         return $res;
3075 3075
     }
@@ -3085,7 +3085,7 @@  discard block
 block discarded – undo
3085 3085
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3086 3086
         $lp_id = intval($lp_id);
3087 3087
         $sql = "SELECT lp_type FROM $tbl_lp
3088
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3088
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3089 3089
         $res = Database::query($sql);
3090 3090
         if ($res === false) {
3091 3091
             return null;
@@ -3177,7 +3177,7 @@  discard block
 block discarded – undo
3177 3177
 
3178 3178
         foreach ($toc_list as $item) {
3179 3179
             // TODO: Complete this
3180
-            $icon_name = array (
3180
+            $icon_name = array(
3181 3181
                 'not attempted' => '../img/notattempted.gif',
3182 3182
                 'incomplete'    => '../img/incomplete.png',
3183 3183
                 'failed'        => '../img/delete.png',
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
 
3190 3190
             // Style Status
3191 3191
 
3192
-            $class_name = array (
3192
+            $class_name = array(
3193 3193
                 'not attempted' => 'scorm_not_attempted',
3194 3194
                 'incomplete'    => 'scorm_not_attempted',
3195 3195
                 'failed'        => 'scorm_failed',
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
             $dirTypes = self::getChapterTypes();
3210 3210
 
3211 3211
             if (in_array($item['type'], $dirTypes)) {
3212
-                $scorm_color_background ='scorm_item_section ';
3212
+                $scorm_color_background = 'scorm_item_section ';
3213 3213
                 $style_item = '';
3214 3214
             }
3215 3215
             if ($item['id'] == $this->current) {
@@ -3218,7 +3218,7 @@  discard block
 block discarded – undo
3218 3218
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3219 3219
             }
3220 3220
 
3221
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3221
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3222 3222
 
3223 3223
             // Learning path title
3224 3224
             $title = $item['title'];
@@ -3248,7 +3248,7 @@  discard block
 block discarded – undo
3248 3248
                 $html .= stripslashes($title);
3249 3249
             } else {
3250 3250
                 $this->get_link('http', $item['id'], $toc_list);
3251
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3251
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3252 3252
             }
3253 3253
             $html .= "</div>";
3254 3254
 
@@ -3282,12 +3282,12 @@  discard block
 block discarded – undo
3282 3282
             if ($this->get_lp_session_id() == api_get_session_id()) {
3283 3283
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3284 3284
                 $html .= '<div class="btn-group">';
3285
-                $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'>" .
3286
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3287
-                $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'>" .
3288
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3289
-                $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">' .
3290
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3285
+                $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'>".
3286
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3287
+                $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'>".
3288
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3289
+                $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">'.
3290
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3291 3291
                 $html .= '</div>';
3292 3292
                 $html .= '</div>';
3293 3293
             }
@@ -3338,11 +3338,11 @@  discard block
 block discarded – undo
3338 3338
         $course_id = $this->get_course_int_id();
3339 3339
 
3340 3340
         if ($this->debug > 0) {
3341
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3341
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3342 3342
         }
3343 3343
         if (empty($item_id)) {
3344 3344
             if ($this->debug > 2) {
3345
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3345
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3346 3346
             }
3347 3347
             $item_id = $this->get_current_item_id();
3348 3348
         }
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3375 3375
         		WHERE li.id = $item_id ";
3376 3376
         if ($this->debug > 2) {
3377
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3377
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3378 3378
         }
3379 3379
         $res = Database::query($sql);
3380 3380
         if (Database :: num_rows($res) > 0) {
@@ -3388,9 +3388,9 @@  discard block
 block discarded – undo
3388 3388
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3389 3389
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3390 3390
             }
3391
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3391
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3392 3392
             if ($type == 'http') {
3393
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3393
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3394 3394
             } else {
3395 3395
                 $course_path = $sys_course_path; //system path
3396 3396
             }
@@ -3401,8 +3401,8 @@  discard block
 block discarded – undo
3401 3401
             }
3402 3402
 
3403 3403
             if ($this->debug > 2) {
3404
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3405
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3404
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3405
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3406 3406
             }
3407 3407
 
3408 3408
             // Now go through the specific cases to get the end of the path
@@ -3421,7 +3421,7 @@  discard block
 block discarded – undo
3421 3421
                         );
3422 3422
 
3423 3423
                         if ($this->debug > 0) {
3424
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3424
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3425 3425
                         }
3426 3426
 
3427 3427
                         if ($lp_item_type == 'link') {
@@ -3441,7 +3441,7 @@  discard block
 block discarded – undo
3441 3441
                                     $linkProtocol = substr($file, 0, 5);
3442 3442
                                     if ($linkProtocol === 'http:') {
3443 3443
                                         //this is the special intervention case
3444
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3444
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3445 3445
                                     }
3446 3446
                                 }
3447 3447
                             }
@@ -3481,8 +3481,8 @@  discard block
 block discarded – undo
3481 3481
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3482 3482
                                         WHERE
3483 3483
                                             c_id = $course_id AND
3484
-                                            lp_item_id='" . $lp_item_id . "' AND
3485
-                                            lp_view_id ='" . $lp_view_id . "' AND
3484
+                                            lp_item_id='".$lp_item_id."' AND
3485
+                                            lp_view_id ='" . $lp_view_id."' AND
3486 3486
                                             status='completed'";
3487 3487
                                 $result = Database::query($sql);
3488 3488
                                 $row_count = Database :: fetch_row($result);
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3492 3492
                                     $not_multiple_attempt = 1;
3493 3493
                                 }
3494
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3494
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3495 3495
                             }
3496 3496
 
3497 3497
                             $tmp_array = explode('/', $file);
@@ -3504,7 +3504,7 @@  discard block
 block discarded – undo
3504 3504
                     break;
3505 3505
                 case 2 :
3506 3506
                     if ($this->debug > 2) {
3507
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3507
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3508 3508
                     }
3509 3509
 
3510 3510
                     if ($lp_item_type != 'dir') {
@@ -3518,19 +3518,19 @@  discard block
 block discarded – undo
3518 3518
                         //if ($this->prerequisites_match($item_id)) {
3519 3519
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3520 3520
                             if ($this->debug > 2) {
3521
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3521
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3522 3522
                             }
3523 3523
                             // Distant url, return as is.
3524 3524
                             $file = $lp_item_path;
3525 3525
                         } else {
3526 3526
                             if ($this->debug > 2) {
3527
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3527
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3528 3528
                             }
3529 3529
                             // Prevent getting untranslatable urls.
3530 3530
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3531 3531
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3532 3532
                             // Prepare the path.
3533
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3533
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3534 3534
                             // TODO: Fix this for urls with protocol header.
3535 3535
                             $file = str_replace('//', '/', $file);
3536 3536
                             $file = str_replace(':/', '://', $file);
@@ -3538,11 +3538,11 @@  discard block
 block discarded – undo
3538 3538
                                 $lp_path = substr($lp_path, 0, -1);
3539 3539
                             }
3540 3540
 
3541
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3541
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3542 3542
                                 // if file not found.
3543 3543
                                 $decoded = html_entity_decode($lp_item_path);
3544 3544
                                 list ($decoded) = explode('?', $decoded);
3545
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3545
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3546 3546
                                     require_once 'resourcelinker.inc.php';
3547 3547
                                     $file = rl_get_resource_link_for_learnpath(
3548 3548
                                         $course_id,
@@ -3562,14 +3562,14 @@  discard block
 block discarded – undo
3562 3562
                                         }
3563 3563
                                     }
3564 3564
                                 } else {
3565
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3565
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3566 3566
                                 }
3567 3567
                             }
3568 3568
                         }
3569 3569
 
3570 3570
                         // We want to use parameters if they were defined in the imsmanifest
3571 3571
                         if (strpos($file, 'blank.php') === false) {
3572
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3572
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3573 3573
                         }
3574 3574
                     } else {
3575 3575
                         $file = 'lp_content.php?type=dir';
@@ -3577,12 +3577,12 @@  discard block
 block discarded – undo
3577 3577
                     break;
3578 3578
                 case 3 :
3579 3579
                     if ($this->debug > 2) {
3580
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3580
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3581 3581
                     }
3582 3582
                     // Formatting AICC HACP append URL.
3583
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3583
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3584 3584
                     if (!empty($lp_item_params)) {
3585
-                        $aicc_append .= $lp_item_params . '&';
3585
+                        $aicc_append .= $lp_item_params.'&';
3586 3586
                     }
3587 3587
                     if ($lp_item_type != 'dir') {
3588 3588
                         // Quite complex here:
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 
3595 3595
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3596 3596
                             if ($this->debug > 2) {
3597
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3597
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3598 3598
                             }
3599 3599
                             // Distant url, return as is.
3600 3600
                             $file = $lp_item_path;
@@ -3607,19 +3607,19 @@  discard block
 block discarded – undo
3607 3607
                             if (stripos($file, '<servername>') !== false) {
3608 3608
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3609 3609
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3610
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3610
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3611 3611
                             }
3612 3612
                             //
3613 3613
                             $file .= $aicc_append;
3614 3614
                         } else {
3615 3615
                             if ($this->debug > 2) {
3616
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3616
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3617 3617
                             }
3618 3618
                             // Prevent getting untranslatable urls.
3619 3619
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3620 3620
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3621 3621
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3622
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3622
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3623 3623
                             // TODO: Fix this for urls with protocol header.
3624 3624
                             $file = str_replace('//', '/', $file);
3625 3625
                             $file = str_replace(':/', '://', $file);
@@ -3638,7 +3638,7 @@  discard block
 block discarded – undo
3638 3638
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3639 3639
         }
3640 3640
         if ($this->debug > 2) {
3641
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3641
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3642 3642
         }
3643 3643
         return $file;
3644 3644
     }
@@ -3656,7 +3656,7 @@  discard block
 block discarded – undo
3656 3656
         $search = '';
3657 3657
         // Use $attempt_num to enable multi-views management (disabled so far).
3658 3658
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3659
-            $search = 'AND view_count = ' . $attempt_num;
3659
+            $search = 'AND view_count = '.$attempt_num;
3660 3660
         }
3661 3661
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3662 3662
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3666,9 +3666,9 @@  discard block
 block discarded – undo
3666 3666
 
3667 3667
         $sql = "SELECT id, view_count FROM $lp_view_table
3668 3668
         		WHERE
3669
-        		    c_id = " . $course_id . " AND
3670
-        		    lp_id = " . $this->get_id() . " AND
3671
-        		    user_id = " . $this->get_user_id() . " AND
3669
+        		    c_id = ".$course_id." AND
3670
+        		    lp_id = " . $this->get_id()." AND
3671
+        		    user_id = " . $this->get_user_id()." AND
3672 3672
         		    session_id = $sessionId
3673 3673
         		    $search
3674 3674
                 ORDER BY view_count DESC";
@@ -3679,7 +3679,7 @@  discard block
 block discarded – undo
3679 3679
         } else if (!api_is_invitee()) {
3680 3680
             // There is no database record, create one.
3681 3681
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3682
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3682
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3683 3683
             Database::query($sql);
3684 3684
             $id = Database :: insert_id();
3685 3685
             $this->lp_view_id = $id;
@@ -3779,15 +3779,15 @@  discard block
 block discarded – undo
3779 3779
     {
3780 3780
         $course_id = api_get_course_int_id();
3781 3781
         if ($this->debug > 0) {
3782
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3782
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3783 3783
         }
3784 3784
         if (empty($id) || empty($direction)) {
3785 3785
             return false;
3786 3786
         }
3787 3787
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3788 3788
         $sql_sel = "SELECT *
3789
-                    FROM " . $tbl_lp_item . "
3790
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3789
+                    FROM " . $tbl_lp_item."
3790
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3791 3791
         $res_sel = Database::query($sql_sel);
3792 3792
         // Check if elem exists.
3793 3793
         if (Database :: num_rows($res_sel) < 1) {
@@ -3812,7 +3812,7 @@  discard block
 block discarded – undo
3812 3812
                                  WHERE c_id = ".$course_id." AND id = $previous";
3813 3813
 
3814 3814
                     if ($this->debug > 2) {
3815
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3815
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3816 3816
                     }
3817 3817
                     $res_sel2 = Database::query($sql_sel2);
3818 3818
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3865,7 +3865,7 @@  discard block
 block discarded – undo
3865 3865
                         }
3866 3866
                         Database::query($sql_upd2);
3867 3867
                     }
3868
-                    $display = $display -1;
3868
+                    $display = $display - 1;
3869 3869
                 }
3870 3870
                 break;
3871 3871
             case 'down':
@@ -3876,7 +3876,7 @@  discard block
 block discarded – undo
3876 3876
                 } else {
3877 3877
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3878 3878
                     if ($this->debug > 2) {
3879
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3879
+                        error_log('Selecting next: '.$sql_sel2, 0);
3880 3880
                     }
3881 3881
                     $res_sel2 = Database::query($sql_sel2);
3882 3882
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3914,7 +3914,7 @@  discard block
 block discarded – undo
3914 3914
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3915 3915
                         Database::query($sql_upd2);
3916 3916
                     }
3917
-                    $display = $display +1;
3917
+                    $display = $display + 1;
3918 3918
                 }
3919 3919
                 break;
3920 3920
             default :
@@ -3937,8 +3937,8 @@  discard block
 block discarded – undo
3937 3937
         $res = Database::query($sql);
3938 3938
         if ($res === false)
3939 3939
             return false;
3940
-        $lps = array ();
3941
-        $lp_order = array ();
3940
+        $lps = array();
3941
+        $lp_order = array();
3942 3942
         $num = Database :: num_rows($res);
3943 3943
         // First check the order is correct, globally (might be wrong because
3944 3944
         // of versions < 1.8.4)
@@ -3948,7 +3948,7 @@  discard block
 block discarded – undo
3948 3948
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3949 3949
                     $need_fix = true;
3950 3950
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3951
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3951
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3952 3952
                     Database::query($sql_u);
3953 3953
                 }
3954 3954
                 $row['display_order'] = $i;
@@ -3961,10 +3961,10 @@  discard block
 block discarded – undo
3961 3961
             $order = $lps[$lp_id]['display_order'];
3962 3962
             if ($order > 1) { // If it's the first element, no need to move up.
3963 3963
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3964
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3964
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3965 3965
                 Database::query($sql_u1);
3966
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3967
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3966
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3967
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3968 3968
                 Database::query($sql_u2);
3969 3969
             }
3970 3970
         }
@@ -3985,8 +3985,8 @@  discard block
 block discarded – undo
3985 3985
         if ($res === false) {
3986 3986
             return false;
3987 3987
         }
3988
-        $lps = array ();
3989
-        $lp_order = array ();
3988
+        $lps = array();
3989
+        $lp_order = array();
3990 3990
         $num = Database :: num_rows($res);
3991 3991
         $max = 0;
3992 3992
         // First check the order is correct, globally (might be wrong because
@@ -3998,7 +3998,7 @@  discard block
 block discarded – undo
3998 3998
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3999 3999
                     $need_fix = true;
4000 4000
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4001
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4001
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4002 4002
                     Database::query($sql_u);
4003 4003
                 }
4004 4004
                 $row['display_order'] = $i;
@@ -4011,10 +4011,10 @@  discard block
 block discarded – undo
4011 4011
             $order = $lps[$lp_id]['display_order'];
4012 4012
             if ($order < $max) { // If it's the first element, no need to move up.
4013 4013
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4014
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4014
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4015 4015
                 Database::query($sql_u1);
4016
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4017
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4016
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4017
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4018 4018
                 Database::query($sql_u2);
4019 4019
             }
4020 4020
         }
@@ -4034,15 +4034,15 @@  discard block
 block discarded – undo
4034 4034
         $this->autocomplete_parents($this->last);
4035 4035
         $new_index = $this->get_next_index();
4036 4036
         if ($this->debug > 2) {
4037
-            error_log('New LP - New index: ' . $new_index, 0);
4037
+            error_log('New LP - New index: '.$new_index, 0);
4038 4038
         }
4039 4039
         $this->index = $new_index;
4040 4040
         if ($this->debug > 2) {
4041
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4041
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4042 4042
         }
4043 4043
         $this->current = $this->ordered_items[$new_index];
4044 4044
         if ($this->debug > 2) {
4045
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4045
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4046 4046
         }
4047 4047
     }
4048 4048
 
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
             // Clean spaces.
4107 4107
             $prereq_string = str_replace(' ', '', $prereq_string);
4108 4108
             if ($debug > 0) {
4109
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4109
+                error_log('Found prereq_string: '.$prereq_string, 0);
4110 4110
             }
4111 4111
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4112 4112
             $result = $currentItem->parse_prereq(
@@ -4122,12 +4122,12 @@  discard block
 block discarded – undo
4122 4122
         } else {
4123 4123
             $result = true;
4124 4124
             if ($debug > 1) {
4125
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4125
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4126 4126
             }
4127 4127
         }
4128 4128
 
4129 4129
         if ($debug > 1) {
4130
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4130
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4131 4131
         }
4132 4132
         return $result;
4133 4133
     }
@@ -4193,12 +4193,12 @@  discard block
 block discarded – undo
4193 4193
             $row = Database :: fetch_array($result);
4194 4194
             $name = domesticate($row['name']);
4195 4195
             if ($set_visibility == 'i') {
4196
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4196
+                $s = $name." ".get_lang('LearnpathNotPublished');
4197 4197
                 $dialogBox = $s;
4198 4198
                 $v = 0;
4199 4199
             }
4200 4200
             if ($set_visibility == 'v') {
4201
-                $s = $name . " " . get_lang('LearnpathPublished');
4201
+                $s = $name." ".get_lang('LearnpathPublished');
4202 4202
                 $dialogBox = $s;
4203 4203
                 $v = 1;
4204 4204
             }
@@ -4281,9 +4281,9 @@  discard block
 block discarded – undo
4281 4281
         $course_id = api_get_course_int_id();
4282 4282
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4283 4283
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4284
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4284
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4285 4285
         if ($this->debug > 2) {
4286
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4286
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4287 4287
         }
4288 4288
         $res = Database::query($sql);
4289 4289
         $view_id = Database::insert_id();
@@ -4321,10 +4321,10 @@  discard block
 block discarded – undo
4321 4321
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4322 4322
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4323 4323
         if ($this->debug > 2) {
4324
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4324
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4325 4325
         }
4326 4326
         if ($this->debug > 2) {
4327
-            error_log('' . print_r($this->items, true), 0);
4327
+            error_log(''.print_r($this->items, true), 0);
4328 4328
         }
4329 4329
         if (isset($this->items[$this->current]) &&
4330 4330
             is_object($this->items[$this->current])
@@ -4348,7 +4348,7 @@  discard block
 block discarded – undo
4348 4348
     {
4349 4349
         $debug = $this->debug;
4350 4350
         if ($debug) {
4351
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4351
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4352 4352
         }
4353 4353
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4354 4354
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4371,7 +4371,7 @@  discard block
 block discarded – undo
4371 4371
 
4372 4372
             if ($debug) {
4373 4373
                 error_log('update_queue before:');
4374
-                error_log(print_r($this->update_queue,1));
4374
+                error_log(print_r($this->update_queue, 1));
4375 4375
             }
4376 4376
             $this->autocomplete_parents($item_id);
4377 4377
 
@@ -4379,9 +4379,9 @@  discard block
 block discarded – undo
4379 4379
             $this->update_queue[$item_id] = $status;
4380 4380
 
4381 4381
             if ($debug) {
4382
-                error_log('get_status(): ' . $status);
4382
+                error_log('get_status(): '.$status);
4383 4383
                 error_log('update_queue after:');
4384
-                error_log(print_r($this->update_queue,1));
4384
+                error_log(print_r($this->update_queue, 1));
4385 4385
             }
4386 4386
             return $res;
4387 4387
         }
@@ -4402,17 +4402,17 @@  discard block
 block discarded – undo
4402 4402
 
4403 4403
         if (isset($this->current) && !api_is_invitee()) {
4404 4404
             if ($this->debug > 2) {
4405
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4405
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4406 4406
             }
4407 4407
             $sql = "UPDATE $table SET
4408
-                        last_item = " . intval($this->get_current_item_id()). "
4408
+                        last_item = ".intval($this->get_current_item_id())."
4409 4409
                     WHERE
4410 4410
                         c_id = $course_id AND
4411
-                        lp_id = " . $this->get_id() . " AND
4411
+                        lp_id = ".$this->get_id()." AND
4412 4412
                         user_id = " . $this->get_user_id()." ".$session_condition;
4413 4413
 
4414 4414
             if ($this->debug > 2) {
4415
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4415
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4416 4416
             }
4417 4417
             Database::query($sql);
4418 4418
         }
@@ -4426,7 +4426,7 @@  discard block
 block discarded – undo
4426 4426
                             progress = $progress
4427 4427
                         WHERE
4428 4428
                             c_id = ".$course_id." AND
4429
-                            lp_id = " . $this->get_id() . " AND
4429
+                            lp_id = " . $this->get_id()." AND
4430 4430
                             user_id = " . $this->get_user_id()." ".$session_condition;
4431 4431
                 // Ignore errors as some tables might not have the progress field just yet.
4432 4432
                 Database::query($sql);
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
     public function set_current_item($item_id = null)
4443 4443
     {
4444 4444
         if ($this->debug > 0) {
4445
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4445
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4446 4446
         }
4447 4447
         if (empty ($item_id)) {
4448 4448
             if ($this->debug > 2) {
@@ -4451,7 +4451,7 @@  discard block
 block discarded – undo
4451 4451
             // Do nothing.
4452 4452
         } else {
4453 4453
             if ($this->debug > 2) {
4454
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4454
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4455 4455
             }
4456 4456
             if (is_numeric($item_id)) {
4457 4457
                 $item_id = intval($item_id);
@@ -4466,10 +4466,10 @@  discard block
 block discarded – undo
4466 4466
                     }
4467 4467
                 }
4468 4468
                 if ($this->debug > 2) {
4469
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4469
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4470 4470
                 }
4471 4471
             } else {
4472
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4472
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4473 4473
             }
4474 4474
         }
4475 4475
     }
@@ -4494,7 +4494,7 @@  discard block
 block discarded – undo
4494 4494
             $lp = $this->get_id();
4495 4495
             if ($lp != 0) {
4496 4496
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4497
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4497
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4498 4498
                 $res = Database::query($sql);
4499 4499
                 return $res;
4500 4500
             }
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
 
4519 4519
         if ($lp != 0) {
4520 4520
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4521
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4521
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4522 4522
             $res = Database::query($sql);
4523 4523
             return $res;
4524 4524
         } else {
@@ -4543,10 +4543,10 @@  discard block
 block discarded – undo
4543 4543
         $course_id = api_get_course_int_id();
4544 4544
         $lp_id = $this->get_id();
4545 4545
         $sql = "UPDATE $lp_table SET
4546
-                content_maker = '" . Database::escape_string($this->maker) . "'
4546
+                content_maker = '".Database::escape_string($this->maker)."'
4547 4547
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4548 4548
         if ($this->debug > 2) {
4549
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4549
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4550 4550
         }
4551 4551
         Database::query($sql);
4552 4552
         return true;
@@ -4570,10 +4570,10 @@  discard block
 block discarded – undo
4570 4570
         $lp_id = $this->get_id();
4571 4571
         $course_id = $this->course_info['real_id'];
4572 4572
         $sql = "UPDATE $lp_table SET
4573
-                name = '" . Database::escape_string($this->name). "'
4573
+                name = '".Database::escape_string($this->name)."'
4574 4574
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4575 4575
         if ($this->debug > 2) {
4576
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4576
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4577 4577
         }
4578 4578
         $result = Database::query($sql);
4579 4579
         // If the lp is visible on the homepage, change his name there.
@@ -4581,7 +4581,7 @@  discard block
 block discarded – undo
4581 4581
             $session_id = api_get_session_id();
4582 4582
             $session_condition = api_get_session_condition($session_id);
4583 4583
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4584
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4584
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4585 4585
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4586 4586
             	    WHERE
4587 4587
             	        c_id = $course_id AND
@@ -4659,10 +4659,10 @@  discard block
 block discarded – undo
4659 4659
 
4660 4660
                 // Save it to search engine.
4661 4661
                 foreach ($missing_terms as $term) {
4662
-                    $doc->add_term($prefix . $term, 1);
4662
+                    $doc->add_term($prefix.$term, 1);
4663 4663
                 }
4664 4664
                 foreach ($deprecated_terms as $term) {
4665
-                    $doc->remove_term($prefix . $term);
4665
+                    $doc->remove_term($prefix.$term);
4666 4666
                 }
4667 4667
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4668 4668
                 $di->getDb()->flush();
@@ -4687,10 +4687,10 @@  discard block
 block discarded – undo
4687 4687
         $this->theme = $name;
4688 4688
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4689 4689
         $lp_id = $this->get_id();
4690
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4690
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4691 4691
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4692 4692
         if ($this->debug > 2) {
4693
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4693
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4694 4694
         }
4695 4695
         Database::query($sql);
4696 4696
 
@@ -4713,10 +4713,10 @@  discard block
 block discarded – undo
4713 4713
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4714 4714
         $lp_id = $this->get_id();
4715 4715
         $sql = "UPDATE $lp_table SET
4716
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4716
+                preview_image = '".Database::escape_string($this->preview_image)."'
4717 4717
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4718 4718
         if ($this->debug > 2) {
4719
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4719
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4720 4720
         }
4721 4721
         Database::query($sql);
4722 4722
         return true;
@@ -4736,10 +4736,10 @@  discard block
 block discarded – undo
4736 4736
         $this->author = $name;
4737 4737
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4738 4738
         $lp_id = $this->get_id();
4739
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4739
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4740 4740
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4741 4741
         if ($this->debug > 2) {
4742
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4742
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4743 4743
         }
4744 4744
         Database::query($sql);
4745 4745
 
@@ -4757,15 +4757,15 @@  discard block
 block discarded – undo
4757 4757
         if ($this->debug > 0) {
4758 4758
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4759 4759
         }
4760
-        if (intval($hide) == $hide){
4760
+        if (intval($hide) == $hide) {
4761 4761
             $this->hide_toc_frame = $hide;
4762 4762
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4763 4763
             $lp_id = $this->get_id();
4764 4764
             $sql = "UPDATE $lp_table SET
4765
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4765
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4766 4766
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4767 4767
             if ($this->debug > 2) {
4768
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4768
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4769 4769
             }
4770 4770
             Database::query($sql);
4771 4771
 
@@ -4792,7 +4792,7 @@  discard block
 block discarded – undo
4792 4792
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4793 4793
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4794 4794
         if ($this->debug > 2) {
4795
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4795
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4796 4796
         }
4797 4797
         Database::query($sql);
4798 4798
         return true;
@@ -4816,10 +4816,10 @@  discard block
 block discarded – undo
4816 4816
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4817 4817
         $lp_id = $this->get_id();
4818 4818
         $sql = "UPDATE $lp_table SET
4819
-                    content_local = '" . Database::escape_string($name) . "'
4819
+                    content_local = '".Database::escape_string($name)."'
4820 4820
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4821 4821
         if ($this->debug > 2) {
4822
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4822
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4823 4823
         }
4824 4824
         Database::query($sql);
4825 4825
         return true;
@@ -4853,11 +4853,11 @@  discard block
 block discarded – undo
4853 4853
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4854 4854
         $lp_id = $this->get_id();
4855 4855
         $sql = "UPDATE $lp_table SET
4856
-                    use_max_score = '" . $this->use_max_score . "'
4856
+                    use_max_score = '".$this->use_max_score."'
4857 4857
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4858 4858
 
4859 4859
         if ($this->debug > 2) {
4860
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4860
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4861 4861
         }
4862 4862
         Database::query($sql);
4863 4863
 
@@ -4884,10 +4884,10 @@  discard block
 block discarded – undo
4884 4884
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4885 4885
         $lp_id = $this->get_id();
4886 4886
         $sql = "UPDATE $lp_table SET
4887
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4887
+                expired_on = '".Database::escape_string($this->expired_on)."'
4888 4888
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4889 4889
         if ($this->debug > 2) {
4890
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4890
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4891 4891
         }
4892 4892
         Database::query($sql);
4893 4893
 
@@ -4913,10 +4913,10 @@  discard block
 block discarded – undo
4913 4913
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4914 4914
         $lp_id = $this->get_id();
4915 4915
         $sql = "UPDATE $lp_table SET
4916
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4916
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4917 4917
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4918 4918
         if ($this->debug > 2) {
4919
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4919
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4920 4920
         }
4921 4921
         Database::query($sql);
4922 4922
 
@@ -4936,10 +4936,10 @@  discard block
 block discarded – undo
4936 4936
         $this->modified_on = api_get_utc_datetime();
4937 4937
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4938 4938
         $lp_id = $this->get_id();
4939
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4939
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4940 4940
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4941 4941
         if ($this->debug > 2) {
4942
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4942
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4943 4943
         }
4944 4944
         Database::query($sql);
4945 4945
         return true;
@@ -5010,13 +5010,13 @@  discard block
 block discarded – undo
5010 5010
 
5011 5011
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5012 5012
             if ($this->debug > 2) {
5013
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5013
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5014 5014
             }
5015 5015
             switch ($this->get_type()) {
5016 5016
                 case '3' :
5017 5017
                     if ($this->items[$this->last]->get_type() != 'au') {
5018 5018
                         if ($this->debug > 2) {
5019
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5019
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5020 5020
                         }
5021 5021
                         $this->items[$this->last]->close();
5022 5022
                         //$this->autocomplete_parents($this->last);
@@ -5029,7 +5029,7 @@  discard block
 block discarded – undo
5029 5029
                 case '2' :
5030 5030
                     if ($this->items[$this->last]->get_type() != 'sco') {
5031 5031
                         if ($this->debug > 2) {
5032
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5032
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5033 5033
                         }
5034 5034
                         $this->items[$this->last]->close();
5035 5035
                         //$this->autocomplete_parents($this->last);
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
                 case '1' :
5044 5044
                 default :
5045 5045
                     if ($this->debug > 2) {
5046
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5046
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5047 5047
                     }
5048 5048
                     $this->items[$this->last]->close();
5049 5049
                     break;
@@ -5069,7 +5069,7 @@  discard block
 block discarded – undo
5069 5069
         }
5070 5070
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5071 5071
         $sql = "SELECT * FROM $lp_table
5072
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5072
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5073 5073
         $res = Database::query($sql);
5074 5074
         if (Database :: num_rows($res) > 0) {
5075 5075
             $row = Database :: fetch_array($res);
@@ -5090,14 +5090,14 @@  discard block
 block discarded – undo
5090 5090
                     break;
5091 5091
             }
5092 5092
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5093
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5093
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5094 5094
             Database::query($sql);
5095 5095
             $this->mode = $view_mode;
5096 5096
 
5097 5097
             return $view_mode;
5098 5098
         } else {
5099 5099
             if ($this->debug > 2) {
5100
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5100
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5101 5101
             }
5102 5102
         }
5103 5103
         return -1;
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
         }
5116 5116
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5117 5117
         $sql = "SELECT * FROM $lp_table
5118
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5118
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5119 5119
         $res = Database::query($sql);
5120 5120
         if (Database :: num_rows($res) > 0) {
5121 5121
             $row = Database :: fetch_array($res);
@@ -5128,14 +5128,14 @@  discard block
 block discarded – undo
5128 5128
                 $force_return = true;
5129 5129
             }
5130 5130
             $sql = "UPDATE $lp_table SET force_commit = $force
5131
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5131
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5132 5132
             Database::query($sql);
5133 5133
             $this->force_commit = $force_return;
5134 5134
 
5135 5135
             return $force_return;
5136 5136
         } else {
5137 5137
             if ($this->debug > 2) {
5138
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5138
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5139 5139
             }
5140 5140
         }
5141 5141
         return -1;
@@ -5164,7 +5164,7 @@  discard block
 block discarded – undo
5164 5164
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5165 5165
                     $need_fix = true;
5166 5166
                     $sql = "UPDATE $lp_table SET display_order = $i
5167
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5167
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5168 5168
                     Database::query($sql);
5169 5169
                 }
5170 5170
                 $i++;
@@ -5185,7 +5185,7 @@  discard block
 block discarded – undo
5185 5185
         }
5186 5186
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5187 5187
         $sql = "SELECT * FROM $lp_table
5188
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5188
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5189 5189
         $res = Database::query($sql);
5190 5190
         if (Database :: num_rows($res) > 0) {
5191 5191
             $row = Database :: fetch_array($res);
@@ -5196,13 +5196,13 @@  discard block
 block discarded – undo
5196 5196
                 $force = 1;
5197 5197
             }
5198 5198
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5199
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5199
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5200 5200
             Database::query($sql);
5201 5201
             $this->prevent_reinit = $force;
5202 5202
             return $force;
5203 5203
         } else {
5204 5204
             if ($this->debug > 2) {
5205
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5205
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5206 5206
             }
5207 5207
         }
5208 5208
         return -1;
@@ -5218,11 +5218,11 @@  discard block
 block discarded – undo
5218 5218
     {
5219 5219
         //Set default value for seriousgame_mode
5220 5220
         if (!isset($this->seriousgame_mode)) {
5221
-            $this->seriousgame_mode=0;
5221
+            $this->seriousgame_mode = 0;
5222 5222
         }
5223 5223
         // Set default value for prevent_reinit
5224 5224
         if (!isset($this->prevent_reinit)) {
5225
-            $this->prevent_reinit =1;
5225
+            $this->prevent_reinit = 1;
5226 5226
         }
5227 5227
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5228 5228
             return 'seriousgame';
@@ -5270,7 +5270,7 @@  discard block
 block discarded – undo
5270 5270
         $sql = "UPDATE $lp_table SET
5271 5271
                 prevent_reinit = $prevent_reinit ,
5272 5272
                 seriousgame_mode = $sg_mode
5273
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5273
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5274 5274
         $res = Database::query($sql);
5275 5275
         if ($res) {
5276 5276
             return true;
@@ -5322,7 +5322,7 @@  discard block
 block discarded – undo
5322 5322
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5323 5323
         }
5324 5324
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5325
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5325
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5326 5326
         $res = Database::query($sql);
5327 5327
         if (Database :: num_rows($res) > 0) {
5328 5328
             $row = Database :: fetch_array($res);
@@ -5333,13 +5333,13 @@  discard block
 block discarded – undo
5333 5333
                 $force = 1;
5334 5334
             }
5335 5335
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5336
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5336
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5337 5337
             Database::query($sql);
5338 5338
             $this->seriousgame_mode = $force;
5339 5339
             return $force;
5340 5340
         } else {
5341 5341
             if ($this->debug > 2) {
5342
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5342
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5343 5343
             }
5344 5344
         }
5345 5345
         return -1;
@@ -5357,7 +5357,7 @@  discard block
 block discarded – undo
5357 5357
         }
5358 5358
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5359 5359
         $sql = "SELECT * FROM $lp_table
5360
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5360
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5361 5361
         $res = Database::query($sql);
5362 5362
         if (Database :: num_rows($res) > 0) {
5363 5363
             $row = Database :: fetch_array($res);
@@ -5368,13 +5368,13 @@  discard block
 block discarded – undo
5368 5368
                 $force = 1;
5369 5369
             }
5370 5370
             $sql = "UPDATE $lp_table SET debug = $force
5371
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5371
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5372 5372
             $res = Database::query($sql);
5373 5373
             $this->scorm_debug = $force;
5374 5374
             return $force;
5375 5375
         } else {
5376 5376
             if ($this->debug > 2) {
5377
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5377
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5378 5378
             }
5379 5379
         }
5380 5380
         return -1;
@@ -5403,7 +5403,7 @@  discard block
 block discarded – undo
5403 5403
      * @param int $depth
5404 5404
      * @param array $tmp
5405 5405
      */
5406
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5406
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5407 5407
     {
5408 5408
         if ($this->debug > 1) {
5409 5409
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5489,7 +5489,7 @@  discard block
 block discarded – undo
5489 5489
 
5490 5490
         // we need to start a form when we want to update all the mp3 files
5491 5491
         if ($update_audio == 'true') {
5492
-            $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">';
5492
+            $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">';
5493 5493
         }
5494 5494
         $return .= '<div id="message"></div>';
5495 5495
         if (count($this->items) == 0) {
@@ -5497,14 +5497,14 @@  discard block
 block discarded – undo
5497 5497
         } else {
5498 5498
             $return_audio = '<table class="data_table">';
5499 5499
             $return_audio .= '<tr>';
5500
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5501
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5500
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5501
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5502 5502
             $return_audio .= '</tr>';
5503 5503
 
5504 5504
             if ($update_audio != 'true') {
5505 5505
                 $return .= '<div class="col-md-12">';
5506 5506
                 $return .= self::return_new_tree($update_audio);
5507
-                $return .='</div>';
5507
+                $return .= '</div>';
5508 5508
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5509 5509
             } else {
5510 5510
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5514,7 +5514,7 @@  discard block
 block discarded – undo
5514 5514
             // We need to close the form when we are updating the mp3 files.
5515 5515
             if ($update_audio == 'true') {
5516 5516
                 $return .= '<div class="footer-audio">';
5517
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5517
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5518 5518
                 $return .= '</div>';
5519 5519
                 //$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?
5520 5520
             }
@@ -5535,7 +5535,7 @@  discard block
 block discarded – undo
5535 5535
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5536 5536
     {
5537 5537
         $return = '';
5538
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5538
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5539 5539
 
5540 5540
         $course_id = api_get_course_int_id();
5541 5541
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5583,7 +5583,7 @@  discard block
 block discarded – undo
5583 5583
 
5584 5584
             //Link for the documents
5585 5585
             if ($arrLP[$i]['item_type'] == 'document') {
5586
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5586
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5587 5587
                 $title_cut = Display::url(
5588 5588
                     $title_cut,
5589 5589
                     $url,
@@ -5599,23 +5599,23 @@  discard block
 block discarded – undo
5599 5599
             } else {
5600 5600
                 $oddClass = 'row_even';
5601 5601
             }
5602
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5602
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5603 5603
 
5604 5604
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5605 5605
 
5606 5606
             $icon = '';
5607
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5608
-                $icon = '<img src="../img/lp_' . $icon_name . '.png" />';
5607
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5608
+                $icon = '<img src="../img/lp_'.$icon_name.'.png" />';
5609 5609
             } else {
5610
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5611
-                    $icon = '<img src="../img/lp_' . $icon_name . '.gif"  />';
5610
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5611
+                    $icon = '<img src="../img/lp_'.$icon_name.'.gif"  />';
5612 5612
                 } else {
5613 5613
                     $icon = '<img src="../img/folder_document.gif" />';
5614 5614
                 }
5615 5615
             }
5616 5616
 
5617 5617
             // The audio column.
5618
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5618
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5619 5619
 
5620 5620
             $audio = '';
5621 5621
 
@@ -5635,10 +5635,10 @@  discard block
 block discarded – undo
5635 5635
             } else {
5636 5636
                 $types = self::getChapterTypes();
5637 5637
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5638
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5638
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5639 5639
                     if (!empty ($arrLP[$i]['audio'])) {
5640 5640
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5641
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5641
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5642 5642
                     }
5643 5643
                 }
5644 5644
             }
@@ -5662,7 +5662,7 @@  discard block
 block discarded – undo
5662 5662
                 // No edit for this item types
5663 5663
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5664 5664
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5665
-                        $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">';
5665
+                        $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">';
5666 5666
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5667 5667
                         $edit_icon .= '</a>';
5668 5668
 
@@ -5675,7 +5675,7 @@  discard block
 block discarded – undo
5675 5675
                                 $this->lp_session_id
5676 5676
                             )
5677 5677
                             ) {
5678
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5678
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5679 5679
                                     'action' => 'dissociate_forum',
5680 5680
                                     'id' => $arrLP[$i]['id'],
5681 5681
                                     'lp_id' => $this->lp_id
@@ -5686,7 +5686,7 @@  discard block
 block discarded – undo
5686 5686
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5687 5687
                                 );
5688 5688
                             } else {
5689
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5689
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5690 5690
                                     'action' => 'create_forum',
5691 5691
                                     'id' => $arrLP[$i]['id'],
5692 5692
                                     'lp_id' => $this->lp_id
@@ -5699,17 +5699,17 @@  discard block
 block discarded – undo
5699 5699
                             }
5700 5700
                         }
5701 5701
                     } else {
5702
-                        $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">';
5702
+                        $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">';
5703 5703
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5704 5704
                         $edit_icon .= '</a>';
5705 5705
                     }
5706 5706
                 }
5707 5707
 
5708
-                $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">';
5708
+                $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">';
5709 5709
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5710 5710
                 $delete_icon .= '</a>';
5711 5711
 
5712
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5712
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5713 5713
 
5714 5714
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5715 5715
                     $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']);
@@ -5718,8 +5718,8 @@  discard block
 block discarded – undo
5718 5718
                 }
5719 5719
             }
5720 5720
             if ($update_audio != 'true') {
5721
-                $row = $move_icon . ' ' . $icon .
5722
-                    Display::span($title_cut) .
5721
+                $row = $move_icon.' '.$icon.
5722
+                    Display::span($title_cut).
5723 5723
                     Display::tag(
5724 5724
                         'div',
5725 5725
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5740,8 +5740,8 @@  discard block
 block discarded – undo
5740 5740
                 $parent_arrays = array();
5741 5741
                 if ($arrLP[$i]['depth'] > 1) {
5742 5742
                     //Getting list of parents
5743
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5744
-                        foreach($arrLP as $item) {
5743
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5744
+                        foreach ($arrLP as $item) {
5745 5745
                             if ($item['id'] == $parent_id) {
5746 5746
                                 if ($item['parent_item_id'] == 0) {
5747 5747
                                     $parent_id = $item['id'];
@@ -5763,8 +5763,8 @@  discard block
 block discarded – undo
5763 5763
                     $parent_arrays = array_reverse($parent_arrays);
5764 5764
                     $val = '$elements';
5765 5765
                     $x = 0;
5766
-                    foreach($parent_arrays as $item) {
5767
-                        if ($x != count($parent_arrays) -1) {
5766
+                    foreach ($parent_arrays as $item) {
5767
+                        if ($x != count($parent_arrays) - 1) {
5768 5768
                             $val .= '["'.$item.'"]["children"]';
5769 5769
                         } else {
5770 5770
                             $val .= '["'.$item.'"]["children"]';
@@ -5827,7 +5827,7 @@  discard block
 block discarded – undo
5827 5827
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5828 5828
                     $active = 'active';
5829 5829
                 }
5830
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5830
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5831 5831
             } else {
5832 5832
                 //sections
5833 5833
                 if (isset($item['children'])) {
@@ -5850,17 +5850,17 @@  discard block
 block discarded – undo
5850 5850
     {
5851 5851
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5852 5852
         $return = '<div class="actions">';
5853
-        $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> ';
5854
-        $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>';
5855
-        $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>';
5853
+        $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> ';
5854
+        $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>';
5855
+        $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>';
5856 5856
         $buttons = array(
5857 5857
             array(
5858 5858
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5859
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5859
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5860 5860
             ),
5861 5861
             array(
5862 5862
                 'title' => get_lang('ClearAllPrerequisites'),
5863
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5863
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5864 5864
             ),
5865 5865
         );
5866 5866
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5881,7 +5881,7 @@  discard block
 block discarded – undo
5881 5881
     {
5882 5882
         // Creating learning_path folder
5883 5883
         $dir = '/learning_path';
5884
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5884
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5885 5885
         $folder = false;
5886 5886
         if (!is_dir($filepath.'/'.$dir)) {
5887 5887
             $folderData = create_unexisting_directory(
@@ -5922,9 +5922,9 @@  discard block
 block discarded – undo
5922 5922
         // Creating LP folder
5923 5923
         if ($folder) {
5924 5924
             //Limits title size
5925
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5925
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5926 5926
             $dir   = $dir.$title;
5927
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5927
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5928 5928
             if (!is_dir($filepath.'/'.$dir)) {
5929 5929
                 $folderData = create_unexisting_directory(
5930 5930
                     $course,
@@ -5944,7 +5944,7 @@  discard block
 block discarded – undo
5944 5944
             }
5945 5945
             $dir = $dir.'/';
5946 5946
             if ($folder) {
5947
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5947
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5948 5948
             }
5949 5949
         }
5950 5950
         $array = array(
@@ -5983,12 +5983,12 @@  discard block
 block discarded – undo
5983 5983
             $dir = substr($dir, 1);
5984 5984
         }
5985 5985
         if (!empty($dir[0]) && $dir[0] != '/') {
5986
-            $dir = '/' . $dir;
5986
+            $dir = '/'.$dir;
5987 5987
         }
5988 5988
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5989 5989
             $dir .= '/';
5990 5990
         }
5991
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5991
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5992 5992
 
5993 5993
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5994 5994
             //Generates folder
@@ -5998,7 +5998,7 @@  discard block
 block discarded – undo
5998 5998
         }
5999 5999
 
6000 6000
         if (!is_dir($filepath)) {
6001
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6001
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6002 6002
             $dir = '/';
6003 6003
         }
6004 6004
 
@@ -6021,10 +6021,10 @@  discard block
 block discarded – undo
6021 6021
         $tmp_filename = $filename;
6022 6022
 
6023 6023
         $i = 0;
6024
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6025
-            $tmp_filename = $filename . '_' . ++ $i;
6024
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6025
+            $tmp_filename = $filename.'_'.++ $i;
6026 6026
 
6027
-        $filename = $tmp_filename . '.'.$extension;
6027
+        $filename = $tmp_filename.'.'.$extension;
6028 6028
         if ($extension == 'html') {
6029 6029
             $content = stripslashes($content);
6030 6030
             $content = str_replace(
@@ -6059,12 +6059,12 @@  discard block
 block discarded – undo
6059 6059
             );
6060 6060
         }
6061 6061
 
6062
-        if (!file_exists($filepath . $filename)) {
6063
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6062
+        if (!file_exists($filepath.$filename)) {
6063
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6064 6064
                 fputs($fp, $content);
6065 6065
                 fclose($fp);
6066 6066
 
6067
-                $file_size = filesize($filepath . $filename);
6067
+                $file_size = filesize($filepath.$filename);
6068 6068
                 $save_file_path = $dir.$filename;
6069 6069
 
6070 6070
                 $document_id = add_document(
@@ -6096,12 +6096,12 @@  discard block
 block discarded – undo
6096 6096
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6097 6097
                         $ct = '';
6098 6098
                         if ($new_comment)
6099
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6099
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6100 6100
                         if ($new_title)
6101
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6101
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6102 6102
 
6103
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6104
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6103
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6104
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6105 6105
                         Database::query($sql);
6106 6106
                     }
6107 6107
                 }
@@ -6129,42 +6129,42 @@  discard block
 block discarded – undo
6129 6129
             $dir = substr($dir, 1);
6130 6130
 
6131 6131
         if ($dir[0] != '/')
6132
-            $dir = '/' . $dir;
6132
+            $dir = '/'.$dir;
6133 6133
 
6134 6134
         if ($dir[strlen($dir) - 1] != '/')
6135 6135
             $dir .= '/';
6136 6136
 
6137
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6137
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6138 6138
 
6139 6139
         if (!is_dir($filepath)) {
6140
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6140
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6141 6141
             $dir = '/';
6142 6142
         }
6143 6143
 
6144 6144
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6145 6145
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6146 6146
             $document_id = intval($_POST['path']);
6147
-            $sql = "SELECT path FROM " . $table_doc . "
6148
-                    WHERE c_id = $course_id AND id = " . $document_id;
6147
+            $sql = "SELECT path FROM ".$table_doc."
6148
+                    WHERE c_id = $course_id AND id = ".$document_id;
6149 6149
             $res = Database::query($sql);
6150 6150
             $row = Database :: fetch_array($res);
6151 6151
             $content = stripslashes($_POST['content_lp']);
6152
-            $file = $filepath . $row['path'];
6152
+            $file = $filepath.$row['path'];
6153 6153
 
6154 6154
             if ($fp = @ fopen($file, 'w')) {
6155
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6155
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6156 6156
 
6157 6157
                 // Change the path of mp3 to absolute.
6158 6158
                 // The first regexp deals with :// urls.
6159
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6159
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6160 6160
                 // The second regexp deals with audio/ urls.
6161
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6161
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6162 6162
                 fputs($fp, $content);
6163 6163
                 fclose($fp);
6164 6164
 
6165
-                $sql = "UPDATE " . $table_doc ." SET
6165
+                $sql = "UPDATE ".$table_doc." SET
6166 6166
                             title='".Database::escape_string($_POST['title'])."'
6167
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6167
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6168 6168
                 Database::query($sql);
6169 6169
             }
6170 6170
         }
@@ -6182,10 +6182,10 @@  discard block
 block discarded – undo
6182 6182
         $return = '';
6183 6183
         if (is_numeric($item_id)) {
6184 6184
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6185
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6186
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6185
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6186
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6187 6187
             $result = Database::query($sql);
6188
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6188
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6189 6189
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6190 6190
 
6191 6191
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6212,8 +6212,8 @@  discard block
 block discarded – undo
6212 6212
                         break;
6213 6213
                     case TOOL_DOCUMENT:
6214 6214
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6215
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6216
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6215
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6216
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6217 6217
                         $result = Database::query($sql_doc);
6218 6218
                         $path_file = Database::result($result, 0, 0);
6219 6219
                         $path_parts = pathinfo($path_file);
@@ -6252,7 +6252,7 @@  discard block
 block discarded – undo
6252 6252
         if (is_numeric($item_id)) {
6253 6253
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6254 6254
             $sql = "SELECT * FROM $tbl_lp_item
6255
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6255
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6256 6256
             $res = Database::query($sql);
6257 6257
             $row = Database::fetch_array($res);
6258 6258
 
@@ -6263,21 +6263,21 @@  discard block
 block discarded – undo
6263 6263
                 case 'sco' :
6264 6264
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6265 6265
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6266
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6266
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6267 6267
                     } else {
6268
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6268
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6269 6269
                     }
6270 6270
                     break;
6271 6271
                 case TOOL_DOCUMENT :
6272 6272
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6273 6273
                     $sql = "SELECT lp.*, doc.path as dir
6274
-                            FROM " . $tbl_lp_item . " as lp
6275
-                            LEFT JOIN " . $tbl_doc . " as doc
6274
+                            FROM " . $tbl_lp_item." as lp
6275
+                            LEFT JOIN " . $tbl_doc." as doc
6276 6276
                             ON doc.id = lp.path
6277 6277
                             WHERE
6278 6278
                                 lp.c_id = $course_id AND
6279 6279
                                 doc.c_id = $course_id AND
6280
-                                lp.id = " . intval($item_id);
6280
+                                lp.id = ".intval($item_id);
6281 6281
                     $res_step = Database::query($sql);
6282 6282
                     $row_step = Database :: fetch_array($res_step);
6283 6283
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6287,8 +6287,8 @@  discard block
 block discarded – undo
6287 6287
                     $link_id = (string) $row['path'];
6288 6288
                     if (ctype_digit($link_id)) {
6289 6289
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6290
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6291
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6290
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6291
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6292 6292
                         $res_link = Database::query($sql_select);
6293 6293
                         $row_link = Database :: fetch_array($res_link);
6294 6294
                         if (is_array($row_link)) {
@@ -6301,9 +6301,9 @@  discard block
 block discarded – undo
6301 6301
                 case 'dokeos_module' :
6302 6302
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6303 6303
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6304
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6304
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6305 6305
                     } else {
6306
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6306
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6307 6307
                     }
6308 6308
                     break;
6309 6309
                 case TOOL_QUIZ :
@@ -6358,7 +6358,7 @@  discard block
 block discarded – undo
6358 6358
 
6359 6359
         $headers = array(
6360 6360
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6361
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6361
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6362 6362
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6363 6363
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6364 6364
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6398,16 +6398,16 @@  discard block
 block discarded – undo
6398 6398
         $course_id = api_get_course_int_id();
6399 6399
         $return = '';
6400 6400
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6401
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6402
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6401
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6402
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6403 6403
         $res_doc = Database::query($sql_doc);
6404 6404
         $row_doc = Database :: fetch_array($res_doc);
6405 6405
 
6406 6406
         // TODO: Add a path filter.
6407 6407
         if ($iframe) {
6408
-            $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>';
6408
+            $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>';
6409 6409
         } else {
6410
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6410
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6411 6411
         }
6412 6412
 
6413 6413
         return $return;
@@ -6431,8 +6431,8 @@  discard block
 block discarded – undo
6431 6431
             $item_description = $extra_info['description'];
6432 6432
         } elseif (is_numeric($extra_info)) {
6433 6433
             $sql = "SELECT title, description
6434
-                    FROM " . $tbl_quiz . "
6435
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6434
+                    FROM " . $tbl_quiz."
6435
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6436 6436
 
6437 6437
             $result = Database::query($sql);
6438 6438
             $row = Database::fetch_array($result);
@@ -6442,8 +6442,8 @@  discard block
 block discarded – undo
6442 6442
             $item_title = '';
6443 6443
             $item_description = '';
6444 6444
         }
6445
-        $item_title			= Security::remove_XSS($item_title);
6446
-        $item_description 	= Security::remove_XSS($item_description);
6445
+        $item_title = Security::remove_XSS($item_title);
6446
+        $item_description = Security::remove_XSS($item_description);
6447 6447
 
6448 6448
         $legend = '<legend>';
6449 6449
         if ($id != 0 && is_array($extra_info))
@@ -6451,13 +6451,13 @@  discard block
 block discarded – undo
6451 6451
         else
6452 6452
             $parent = 0;
6453 6453
 
6454
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6455
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6454
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6455
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6456 6456
 
6457 6457
         $result = Database::query($sql);
6458
-        $arrLP = array ();
6458
+        $arrLP = array();
6459 6459
         while ($row = Database :: fetch_array($result)) {
6460
-            $arrLP[] = array (
6460
+            $arrLP[] = array(
6461 6461
                 'id' => $row['id'],
6462 6462
                 'item_type' => $row['item_type'],
6463 6463
                 'title' => $row['title'],
@@ -6480,15 +6480,15 @@  discard block
 block discarded – undo
6480 6480
         unset ($this->arrMenu);
6481 6481
 
6482 6482
         if ($action == 'add') {
6483
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6483
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6484 6484
         } elseif ($action == 'move') {
6485
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6485
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6486 6486
         } else {
6487
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6487
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6488 6488
         }
6489 6489
 
6490 6490
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6491
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6491
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6492 6492
         }
6493 6493
 
6494 6494
         $legend .= '</legend>';
@@ -6501,34 +6501,34 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
         if ($action != 'move') {
6503 6503
             $return .= '<tr>';
6504
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6505
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6504
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6505
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6506 6506
             $return .= '</tr>';
6507 6507
         }
6508 6508
 
6509 6509
         $return .= '<tr>';
6510 6510
 
6511
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6511
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6512 6512
         $return .= '<td class="input">';
6513 6513
 
6514 6514
         // Select for Parent item, root or chapter
6515 6515
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6516 6516
 
6517
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6517
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6518 6518
 
6519
-        $arrHide = array (
6519
+        $arrHide = array(
6520 6520
             $id
6521 6521
         );
6522 6522
         for ($i = 0; $i < count($arrLP); $i++) {
6523 6523
             if ($action != 'add') {
6524 6524
                 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)) {
6525
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6525
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6526 6526
                 } else {
6527 6527
                     $arrHide[] = $arrLP[$i]['id'];
6528 6528
                 }
6529 6529
             } else {
6530 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>';
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>';
6532 6532
             }
6533 6533
         }
6534 6534
         if (is_array($arrLP)) {
@@ -6540,11 +6540,11 @@  discard block
 block discarded – undo
6540 6540
         $return .= '</tr>';
6541 6541
         $return .= '<tr>';
6542 6542
 
6543
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6543
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6544 6544
         $return .= '<td class="input">';
6545 6545
 
6546 6546
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6547
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6547
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6548 6548
         for ($i = 0; $i < count($arrLP); $i++) {
6549 6549
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6550 6550
                 if (is_array($extra_info)) {
@@ -6556,7 +6556,7 @@  discard block
 block discarded – undo
6556 6556
                 } else {
6557 6557
                     $selected = '';
6558 6558
                 }
6559
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6559
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6560 6560
             }
6561 6561
         }
6562 6562
         $return .= '</select>';
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
                     }
6574 6574
                 }
6575 6575
             }
6576
-            $arrHide = array ();
6576
+            $arrHide = array();
6577 6577
             for ($i = 0; $i < count($arrLP); $i++) {
6578 6578
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6579 6579
                     if (is_array($extra_info)) {
@@ -6619,27 +6619,27 @@  discard block
 block discarded – undo
6619 6619
 
6620 6620
         $return .= '<tr>';
6621 6621
         if ($action == 'add') {
6622
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6622
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6623 6623
         } else {
6624
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6624
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6625 6625
         }
6626 6626
 
6627 6627
         $return .= '</tr>';
6628 6628
         $return .= '</table>';
6629 6629
 
6630 6630
         if ($action == 'move') {
6631
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6632
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6631
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6632
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6633 6633
         }
6634 6634
 
6635 6635
         if (is_numeric($extra_info)) {
6636
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6636
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6637 6637
         } elseif (is_array($extra_info)) {
6638
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6638
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6639 6639
         }
6640 6640
 
6641
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6642
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6641
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6642
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6643 6643
 
6644 6644
         $return .= '</form>';
6645 6645
         $return .= '</div>';
@@ -6666,11 +6666,11 @@  discard block
 block discarded – undo
6666 6666
         } elseif (is_numeric($extra_info)) {
6667 6667
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6668 6668
 
6669
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6669
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6670 6670
                     WHERE
6671 6671
                         c_id = ".$course_id." AND
6672
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6673
-                        id = " . (int) $extra_info . "
6672
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6673
+                        id = " . (int) $extra_info."
6674 6674
                     ORDER BY id ASC";
6675 6675
 
6676 6676
             $res_hot = Database::query($sql);
@@ -6694,11 +6694,11 @@  discard block
 block discarded – undo
6694 6694
         }
6695 6695
 
6696 6696
         $sql = "SELECT * FROM $tbl_lp_item
6697
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6697
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6698 6698
         $result = Database::query($sql);
6699
-        $arrLP = array ();
6699
+        $arrLP = array();
6700 6700
         while ($row = Database :: fetch_array($result)) {
6701
-            $arrLP[] = array (
6701
+            $arrLP[] = array(
6702 6702
                 'id' => $row['id'],
6703 6703
                 'item_type' => $row['item_type'],
6704 6704
                 'title' => $row['title'],
@@ -6723,7 +6723,7 @@  discard block
 block discarded – undo
6723 6723
         else
6724 6724
             $legend .= get_lang('EditCurrentExecice');
6725 6725
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6726
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6726
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6727 6727
         }
6728 6728
         $legend .= '</legend>';
6729 6729
 
@@ -6731,11 +6731,11 @@  discard block
 block discarded – undo
6731 6731
         $return .= $legend;
6732 6732
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6733 6733
         $return .= '<tr>';
6734
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6734
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6735 6735
         $return .= '<td class="input">';
6736 6736
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6737
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6738
-        $arrHide = array (
6737
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6738
+        $arrHide = array(
6739 6739
             $id
6740 6740
         );
6741 6741
 
@@ -6743,13 +6743,13 @@  discard block
 block discarded – undo
6743 6743
             for ($i = 0; $i < count($arrLP); $i++) {
6744 6744
                 if ($action != 'add') {
6745 6745
                     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)) {
6746
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6746
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6747 6747
                     } else {
6748 6748
                         $arrHide[] = $arrLP[$i]['id'];
6749 6749
                     }
6750 6750
                 } else {
6751 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>';
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>';
6753 6753
                 }
6754 6754
             }
6755 6755
 
@@ -6760,10 +6760,10 @@  discard block
 block discarded – undo
6760 6760
         $return .= '</td>';
6761 6761
         $return .= '</tr>';
6762 6762
         $return .= '<tr>';
6763
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6763
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6764 6764
         $return .= '<td class="input">';
6765 6765
         $return .= '<select id="previous" name="previous" size="1">';
6766
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6766
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6767 6767
 
6768 6768
         for ($i = 0; $i < count($arrLP); $i++) {
6769 6769
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6773,7 +6773,7 @@  discard block
 block discarded – undo
6773 6773
                 else
6774 6774
                     $selected = '';
6775 6775
 
6776
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6776
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6777 6777
             }
6778 6778
         }
6779 6779
 
@@ -6783,8 +6783,8 @@  discard block
 block discarded – undo
6783 6783
 
6784 6784
         if ($action != 'move') {
6785 6785
             $return .= '<tr>';
6786
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6787
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6786
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6787
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6788 6788
             $return .= '</tr>';
6789 6789
             $id_prerequisite = 0;
6790 6790
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
                     }
6796 6796
                 }
6797 6797
 
6798
-                $arrHide = array ();
6798
+                $arrHide = array();
6799 6799
                 for ($i = 0; $i < count($arrLP); $i++) {
6800 6800
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6801 6801
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6809,22 +6809,22 @@  discard block
 block discarded – undo
6809 6809
         }
6810 6810
 
6811 6811
         $return .= '<tr>';
6812
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6812
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6813 6813
         $return .= '</tr>';
6814 6814
         $return .= '</table>';
6815 6815
 
6816 6816
         if ($action == 'move') {
6817
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6818
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6817
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6818
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6819 6819
         }
6820 6820
 
6821 6821
         if (is_numeric($extra_info)) {
6822
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6822
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6823 6823
         } elseif (is_array($extra_info)) {
6824
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6824
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6825 6825
         }
6826
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6827
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6826
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6827
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6828 6828
         $return .= '</form>';
6829 6829
 
6830 6830
         return $return;
@@ -6847,8 +6847,8 @@  discard block
 block discarded – undo
6847 6847
             $item_title = stripslashes($extra_info['title']);
6848 6848
         } elseif (is_numeric($extra_info)) {
6849 6849
             $sql = "SELECT forum_title as title, forum_comment as comment
6850
-                    FROM " . $tbl_forum . "
6851
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6850
+                    FROM " . $tbl_forum."
6851
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6852 6852
 
6853 6853
             $result = Database::query($sql);
6854 6854
             $row = Database :: fetch_array($result);
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
             $parent = 0;
6869 6869
         }
6870 6870
 
6871
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6871
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6872 6872
                 WHERE
6873 6873
                     c_id = ".$course_id." AND
6874 6874
                     lp_id = " . $this->lp_id;
@@ -6876,7 +6876,7 @@  discard block
 block discarded – undo
6876 6876
         $arrLP = array();
6877 6877
 
6878 6878
         while ($row = Database :: fetch_array($result)) {
6879
-            $arrLP[] = array (
6879
+            $arrLP[] = array(
6880 6880
                 'id' => $row['id'],
6881 6881
                 'item_type' => $row['item_type'],
6882 6882
                 'title' => $row['title'],
@@ -6898,10 +6898,10 @@  discard block
 block discarded – undo
6898 6898
         unset($this->arrMenu);
6899 6899
 
6900 6900
         if ($action == 'add')
6901
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6902
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6901
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6902
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6903 6903
         else
6904
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6904
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6905 6905
 
6906 6906
         $legend .= '</legend>';
6907 6907
         $return = '<div class="sectioncomment">';
@@ -6911,16 +6911,16 @@  discard block
 block discarded – undo
6911 6911
 
6912 6912
         if ($action != 'move') {
6913 6913
             $return .= '<tr>';
6914
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6915
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6914
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6915
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6916 6916
             $return .= '</tr>';
6917 6917
         }
6918 6918
 
6919 6919
         $return .= '<tr>';
6920
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6920
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6921 6921
         $return .= '<td class="input">';
6922 6922
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6923
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6923
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6924 6924
         $arrHide = array(
6925 6925
             $id
6926 6926
         );
@@ -6929,13 +6929,13 @@  discard block
 block discarded – undo
6929 6929
         for ($i = 0; $i < count($arrLP); $i++) {
6930 6930
             if ($action != 'add') {
6931 6931
                 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)) {
6932
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6932
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6933 6933
                 } else {
6934 6934
                     $arrHide[] = $arrLP[$i]['id'];
6935 6935
                 }
6936 6936
             } else {
6937 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>';
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>';
6939 6939
             }
6940 6940
         }
6941 6941
         if (is_array($arrLP)) {
@@ -6946,10 +6946,10 @@  discard block
 block discarded – undo
6946 6946
         $return .= '</td>';
6947 6947
         $return .= '</tr>';
6948 6948
         $return .= '<tr>';
6949
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6949
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6950 6950
         $return .= '<td class="input">';
6951 6951
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6952
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6952
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6953 6953
 
6954 6954
         for ($i = 0; $i < count($arrLP); $i++) {
6955 6955
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6959,8 +6959,8 @@  discard block
 block discarded – undo
6959 6959
                 else
6960 6960
                     $selected = '';
6961 6961
 
6962
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6963
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6962
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6963
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6964 6964
             }
6965 6965
         }
6966 6966
 
@@ -6994,25 +6994,25 @@  discard block
 block discarded – undo
6994 6994
         $return .= '<tr>';
6995 6995
 
6996 6996
         if ($action == 'add') {
6997
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6997
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6998 6998
         } else {
6999
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6999
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
7000 7000
         }
7001 7001
         $return .= '</tr>';
7002 7002
         $return .= '</table>';
7003 7003
 
7004 7004
         if ($action == 'move') {
7005
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7006
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7005
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7006
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7007 7007
         }
7008 7008
 
7009 7009
         if (is_numeric($extra_info)) {
7010
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7010
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7011 7011
         } elseif (is_array($extra_info)) {
7012
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7012
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7013 7013
         }
7014
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7015
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7014
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7015
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7016 7016
         $return .= '</form>';
7017 7017
         $return .= '</div>';
7018 7018
 
@@ -7039,7 +7039,7 @@  discard block
 block discarded – undo
7039 7039
             $item_title = stripslashes($extra_info['title']);
7040 7040
         } elseif (is_numeric($extra_info)) {
7041 7041
             $sql = "SELECT thread_title as title FROM $tbl_forum
7042
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7042
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7043 7043
 
7044 7044
             $result = Database::query($sql);
7045 7045
             $row = Database :: fetch_array($result);
@@ -7059,15 +7059,15 @@  discard block
 block discarded – undo
7059 7059
             $parent = 0;
7060 7060
         }
7061 7061
 
7062
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7063
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7062
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7063
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7064 7064
 
7065 7065
         $result = Database::query($sql);
7066 7066
 
7067
-        $arrLP = array ();
7067
+        $arrLP = array();
7068 7068
 
7069 7069
         while ($row = Database :: fetch_array($result)) {
7070
-            $arrLP[] = array (
7070
+            $arrLP[] = array(
7071 7071
                 'id' => $row['id'],
7072 7072
                 'item_type' => $row['item_type'],
7073 7073
                 'title' => $row['title'],
@@ -7090,31 +7090,31 @@  discard block
 block discarded – undo
7090 7090
 
7091 7091
         $return .= '<form method="POST">';
7092 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>';
7093
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7094
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7095 7095
         else
7096
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7096
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7097 7097
 
7098 7098
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7099 7099
         $return .= '<tr>';
7100
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7100
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7101 7101
         $return .= '<td class="input">';
7102 7102
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7103
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7104
-        $arrHide = array (
7103
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7104
+        $arrHide = array(
7105 7105
             $id
7106 7106
         );
7107 7107
 
7108 7108
         for ($i = 0; $i < count($arrLP); $i++) {
7109 7109
             if ($action != 'add') {
7110 7110
                 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)) {
7111
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7111
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7112 7112
                 } else {
7113 7113
                     $arrHide[] = $arrLP[$i]['id'];
7114 7114
                 }
7115 7115
             } else {
7116 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>';
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>';
7118 7118
             }
7119 7119
         }
7120 7120
 
@@ -7126,10 +7126,10 @@  discard block
 block discarded – undo
7126 7126
         $return .= '</td>';
7127 7127
         $return .= '</tr>';
7128 7128
         $return .= '<tr>';
7129
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7129
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7130 7130
         $return .= '<td class="input">';
7131 7131
         $return .= '<select id="previous" name="previous" size="1">';
7132
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7132
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7133 7133
         for ($i = 0; $i < count($arrLP); $i++) {
7134 7134
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7135 7135
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7138,7 +7138,7 @@  discard block
 block discarded – undo
7138 7138
                 else
7139 7139
                     $selected = '';
7140 7140
 
7141
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7141
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7142 7142
             }
7143 7143
         }
7144 7144
         $return .= '</select>';
@@ -7146,8 +7146,8 @@  discard block
 block discarded – undo
7146 7146
         $return .= '</tr>';
7147 7147
         if ($action != 'move') {
7148 7148
             $return .= '<tr>';
7149
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7150
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7149
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7150
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7151 7151
             $return .= '</tr>';
7152 7152
             $return .= '<tr>';
7153 7153
             $return .= '</tr>';
@@ -7174,17 +7174,17 @@  discard block
 block discarded – undo
7174 7174
             }
7175 7175
 
7176 7176
             $return .= '<tr>';
7177
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7178
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7177
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7178
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7179 7179
 
7180 7180
             foreach ($arrHide as $key => $value) {
7181 7181
                 if ($key == $s_selected_position && $action == 'add') {
7182
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7182
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7183 7183
                 }
7184 7184
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7185
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7185
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7186 7186
                 } else {
7187
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7187
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7188 7188
                 }
7189 7189
             }
7190 7190
             $return .= "</select></td>";
@@ -7198,19 +7198,19 @@  discard block
 block discarded – undo
7198 7198
         $return .= '</table>';
7199 7199
 
7200 7200
         if ($action == 'move') {
7201
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7202
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7201
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7202
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7203 7203
         }
7204 7204
 
7205 7205
         if (is_numeric($extra_info)) {
7206
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7206
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7207 7207
         }
7208 7208
         elseif (is_array($extra_info)) {
7209
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7209
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7210 7210
         }
7211 7211
 
7212
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7213
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7212
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7213
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7214 7214
         $return .= '</form>';
7215 7215
         $return .= '</div>';
7216 7216
 
@@ -7236,10 +7236,10 @@  discard block
 block discarded – undo
7236 7236
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7237 7237
 
7238 7238
         if ($id != 0 && is_array($extra_info)) {
7239
-            $item_title 		= $extra_info['title'];
7240
-            $item_description 	= $extra_info['description'];
7241
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7242
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7239
+            $item_title = $extra_info['title'];
7240
+            $item_description = $extra_info['description'];
7241
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7242
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7243 7243
         } else {
7244 7244
             $item_title = '';
7245 7245
             $item_description = '';
@@ -7253,17 +7253,17 @@  discard block
 block discarded – undo
7253 7253
         }
7254 7254
 
7255 7255
         $id  = intval($id);
7256
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7256
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7257 7257
                 WHERE
7258 7258
                     c_id = ".$course_id." AND
7259
-                    lp_id = " . $this->lp_id . " AND
7259
+                    lp_id = " . $this->lp_id." AND
7260 7260
                     id != $id";
7261 7261
 
7262 7262
         if ($item_type == 'module')
7263 7263
             $sql .= " AND parent_item_id = 0";
7264 7264
 
7265 7265
         $result = Database::query($sql);
7266
-        $arrLP = array ();
7266
+        $arrLP = array();
7267 7267
 
7268 7268
         while ($row = Database :: fetch_array($result)) {
7269 7269
             $arrLP[] = array(
@@ -7291,9 +7291,9 @@  discard block
 block discarded – undo
7291 7291
 
7292 7292
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7293 7293
 
7294
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7294
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7295 7295
 
7296
-        $form = new FormValidator('form', 'POST',  $url);
7296
+        $form = new FormValidator('form', 'POST', $url);
7297 7297
 
7298 7298
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7299 7299
         $defaults['description'] = $item_description;
@@ -7337,7 +7337,7 @@  discard block
 block discarded – undo
7337 7337
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7338 7338
 
7339 7339
             foreach ($arrHide as $key => $value) {
7340
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7340
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7341 7341
             }
7342 7342
             if (!empty($s_selected_parent)) {
7343 7343
                 $parent_select->setSelected($s_selected_parent);
@@ -7359,16 +7359,16 @@  discard block
 block discarded – undo
7359 7359
                     $s_selected_position = $arrLP[$i]['id'];
7360 7360
                 }
7361 7361
 
7362
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7362
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7363 7363
             }
7364 7364
         }
7365 7365
 
7366 7366
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7367 7367
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7368
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7368
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7369 7369
 
7370 7370
         foreach ($arrHide as $key => $value) {
7371
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7371
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7372 7372
         }
7373 7373
 
7374 7374
         if (!empty ($s_selected_position)) {
@@ -7397,23 +7397,23 @@  discard block
 block discarded – undo
7397 7397
         //assets can't be modified
7398 7398
 
7399 7399
         //$item_type == 'asset' ||
7400
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7400
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7401 7401
 
7402 7402
             if ($item_type == 'sco') {
7403
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7403
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7404 7404
             }
7405 7405
             $renderer = $form->defaultRenderer();
7406 7406
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7407 7407
 
7408 7408
             $relative_prefix = '';
7409 7409
 
7410
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7410
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7411 7411
                 'Width' 				=> '100%',
7412 7412
                 'Height' 				=> '500',
7413 7413
                 'FullPage' 				=> true,
7414 7414
                 'CreateDocumentDir' 	=> $relative_prefix,
7415
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7416
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7415
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7416
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7417 7417
             );
7418 7418
 
7419 7419
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7422,7 +7422,7 @@  discard block
 block discarded – undo
7422 7422
             $defaults['content_lp'] = file_get_contents($content_path);
7423 7423
         }
7424 7424
 
7425
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7425
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7426 7426
         $form->addElement('hidden', 'post_time', time());
7427 7427
         $form->setDefaults($defaults);
7428 7428
         return $form->return_form();
@@ -7460,8 +7460,8 @@  discard block
 block discarded – undo
7460 7460
         // We don't display the document form if it's not an editable document (html or txt file).
7461 7461
         if ($action == "add") {
7462 7462
             if (is_numeric($extra_info)) {
7463
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7464
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7463
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7464
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7465 7465
                 $result = Database::query($sql_doc);
7466 7466
                 $path_file = Database :: result($result, 0, 0);
7467 7467
                 $path_parts = pathinfo($path_file);
@@ -7479,13 +7479,13 @@  discard block
 block discarded – undo
7479 7479
                 $item_title = stripslashes($path_parts['filename']);
7480 7480
             }
7481 7481
         } elseif (is_numeric($extra_info)) {
7482
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7482
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7483 7483
                         WHERE
7484 7484
                             c_id = ".$course_id." AND
7485 7485
                             id = " . intval($extra_info);
7486 7486
 
7487 7487
             $result = Database::query($sql_doc);
7488
-            $row 	= Database::fetch_array($result);
7488
+            $row = Database::fetch_array($result);
7489 7489
             $item_title = $row['title'];
7490 7490
             $item_title = str_replace('_', ' ', $item_title);
7491 7491
             if (empty ($item_title)) {
@@ -7504,11 +7504,11 @@  discard block
 block discarded – undo
7504 7504
             $parent = 0;
7505 7505
         }
7506 7506
 
7507
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7508
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7507
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7508
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7509 7509
 
7510 7510
         $result = Database::query($sql);
7511
-        $arrLP = array ();
7511
+        $arrLP = array();
7512 7512
         while ($row = Database :: fetch_array($result)) {
7513 7513
             $arrLP[] = array(
7514 7514
                 'id' => $row['id'],
@@ -7542,9 +7542,9 @@  discard block
 block discarded – undo
7542 7542
         $return .= '</legend>';
7543 7543
 
7544 7544
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7545
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7545
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7546 7546
         }
7547
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7547
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7548 7548
         $defaults['title'] = Security :: remove_XSS($item_title);
7549 7549
         if (empty($item_title)) {
7550 7550
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7580,15 +7580,15 @@  discard block
 block discarded – undo
7580 7580
         }
7581 7581
 
7582 7582
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7583
-        $my_count=0;
7583
+        $my_count = 0;
7584 7584
         foreach ($arrHide as $key => $value) {
7585
-            if ($my_count!=0) {
7585
+            if ($my_count != 0) {
7586 7586
                 // The LP name is also the first section and is not in the same charset like the other sections.
7587 7587
                 $value['value'] = Security :: remove_XSS($value['value']);
7588
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7588
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7589 7589
             } else {
7590 7590
                 $value['value'] = Security :: remove_XSS($value['value']);
7591
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7591
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7592 7592
             }
7593 7593
             $my_count++;
7594 7594
         }
@@ -7596,7 +7596,7 @@  discard block
 block discarded – undo
7596 7596
         if (!empty($id)) {
7597 7597
             $parent_select->setSelected($parent);
7598 7598
         } else {
7599
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7599
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7600 7600
             $parent_select->setSelected($parent_item_id);
7601 7601
         }
7602 7602
 
@@ -7613,7 +7613,7 @@  discard block
 block discarded – undo
7613 7613
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7614 7614
                     $s_selected_position = $arrLP[$i]['id'];
7615 7615
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7616
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7616
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7617 7617
             }
7618 7618
         }
7619 7619
 
@@ -7621,8 +7621,8 @@  discard block
 block discarded – undo
7621 7621
         $position->addOption(get_lang('FirstPosition'), 0);
7622 7622
 
7623 7623
         foreach ($arrHide as $key => $value) {
7624
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7625
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7624
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7625
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7626 7626
         }
7627 7627
         $position->setSelected($s_selected_position);
7628 7628
 
@@ -7692,7 +7692,7 @@  discard block
 block discarded – undo
7692 7692
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7693 7693
                             $relative_path 	 = implode('/', $relative_path);
7694 7694
                             if (strlen($relative_path) > 0) {
7695
-                                $relative_path = $relative_path . '/';
7695
+                                $relative_path = $relative_path.'/';
7696 7696
                             }
7697 7697
                         } else {
7698 7698
                             $result = $this->generate_lp_folder($_course);
@@ -7706,8 +7706,8 @@  discard block
 block discarded – undo
7706 7706
                             'Height' 				=> '500',
7707 7707
                             'FullPage' 				=> true,
7708 7708
                             'CreateDocumentDir' 	=> $relative_prefix,
7709
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7710
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7709
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7710
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7711 7711
                         );
7712 7712
 
7713 7713
                         if ($_GET['action'] == 'add_item') {
@@ -7774,8 +7774,8 @@  discard block
 block discarded – undo
7774 7774
             $item_url = stripslashes($extra_info['url']);
7775 7775
         } elseif (is_numeric($extra_info)) {
7776 7776
             $extra_info = intval($extra_info);
7777
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7778
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7777
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7778
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7779 7779
             $result = Database::query($sql);
7780 7780
             $row = Database :: fetch_array($result);
7781 7781
             $item_title       = $row['title'];
@@ -7795,8 +7795,8 @@  discard block
 block discarded – undo
7795 7795
             $parent = 0;
7796 7796
         }
7797 7797
 
7798
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7799
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7798
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7799
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7800 7800
         $result = Database::query($sql);
7801 7801
         $arrLP = array();
7802 7802
 
@@ -7823,10 +7823,10 @@  discard block
 block discarded – undo
7823 7823
         unset ($this->arrMenu);
7824 7824
 
7825 7825
         if ($action == 'add')
7826
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7827
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7826
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7827
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7828 7828
         else
7829
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7829
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7830 7830
 
7831 7831
         $legend .= '</legend>';
7832 7832
 
@@ -7837,16 +7837,16 @@  discard block
 block discarded – undo
7837 7837
 
7838 7838
         if ($action != 'move') {
7839 7839
             $return .= '<tr>';
7840
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7841
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7840
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7841
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7842 7842
             $return .= '</tr>';
7843 7843
         }
7844 7844
 
7845 7845
         $return .= '<tr>';
7846
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7846
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7847 7847
         $return .= '<td class="input">';
7848 7848
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7849
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7849
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7850 7850
         $arrHide = array(
7851 7851
             $id
7852 7852
         );
@@ -7856,13 +7856,13 @@  discard block
 block discarded – undo
7856 7856
         for ($i = 0; $i < count($arrLP); $i++) {
7857 7857
             if ($action != 'add') {
7858 7858
                 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)) {
7859
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7859
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7860 7860
                 } else {
7861 7861
                     $arrHide[] = $arrLP[$i]['id'];
7862 7862
                 }
7863 7863
             } else {
7864 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>';
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>';
7866 7866
             }
7867 7867
         }
7868 7868
 
@@ -7874,11 +7874,11 @@  discard block
 block discarded – undo
7874 7874
         $return .= '</td>';
7875 7875
         $return .= '</tr>';
7876 7876
         $return .= '<tr>';
7877
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7877
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7878 7878
         $return .= '<td class="input">';
7879 7879
 
7880 7880
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7881
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7881
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7882 7882
         for ($i = 0; $i < count($arrLP); $i++) {
7883 7883
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7884 7884
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7888,7 +7888,7 @@  discard block
 block discarded – undo
7888 7888
                 else
7889 7889
                     $selected = '';
7890 7890
 
7891
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7891
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7892 7892
             }
7893 7893
         }
7894 7894
         $return .= '</select>';
@@ -7897,8 +7897,8 @@  discard block
 block discarded – undo
7897 7897
 
7898 7898
         if ($action != 'move') {
7899 7899
             $return .= '<tr>';
7900
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7901
-            $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>';
7900
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7901
+            $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>';
7902 7902
             $return .= '</tr>';
7903 7903
             $id_prerequisite = 0;
7904 7904
             if (is_array($arrLP)) {
@@ -7925,25 +7925,25 @@  discard block
 block discarded – undo
7925 7925
 
7926 7926
         $return .= '<tr>';
7927 7927
         if ($action == 'add') {
7928
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7928
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7929 7929
         } else {
7930
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7930
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7931 7931
         }
7932 7932
         $return .= '</tr>';
7933 7933
         $return .= '</table>';
7934 7934
 
7935 7935
         if ($action == 'move') {
7936
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7937
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7936
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7937
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7938 7938
         }
7939 7939
 
7940 7940
         if (is_numeric($extra_info)) {
7941
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7941
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7942 7942
         } elseif (is_array($extra_info)) {
7943
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7943
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7944 7944
         }
7945
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7946
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7945
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7946
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7947 7947
         $return .= '</form>';
7948 7948
         $return .= '</div>';
7949 7949
 
@@ -7969,8 +7969,8 @@  discard block
 block discarded – undo
7969 7969
         } elseif (is_numeric($extra_info)) {
7970 7970
             $extra_info = intval($extra_info);
7971 7971
             $sql = "SELECT title, description
7972
-                    FROM " . $tbl_publication . "
7973
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7972
+                    FROM " . $tbl_publication."
7973
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7974 7974
 
7975 7975
             $result = Database::query($sql);
7976 7976
             $row = Database :: fetch_array($result);
@@ -7986,13 +7986,13 @@  discard block
 block discarded – undo
7986 7986
             $parent = 0;
7987 7987
         }
7988 7988
 
7989
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7990
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7989
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7990
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7991 7991
 
7992 7992
         $result = Database::query($sql);
7993 7993
         $arrLP = array();
7994 7994
         while ($row = Database :: fetch_array($result)) {
7995
-            $arrLP[] = array (
7995
+            $arrLP[] = array(
7996 7996
                 'id' => $row['id'],
7997 7997
                 'item_type' => $row['item_type'],
7998 7998
                 'title' => $row['title'],
@@ -8038,7 +8038,7 @@  discard block
 block discarded – undo
8038 8038
             ]
8039 8039
         );
8040 8040
 
8041
-        $arrHide = array (
8041
+        $arrHide = array(
8042 8042
             $id
8043 8043
         );
8044 8044
 
@@ -8056,7 +8056,7 @@  discard block
 block discarded – undo
8056 8056
                     $parentSelect->addOption(
8057 8057
                         $arrLP[$i]['title'],
8058 8058
                         $arrLP[$i]['id'],
8059
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8059
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8060 8060
                     );
8061 8061
 
8062 8062
                     if ($parent == $arrLP[$i]['id']) {
@@ -8073,7 +8073,7 @@  discard block
 block discarded – undo
8073 8073
                     $parentSelect->addOption(
8074 8074
                         $arrLP[$i]['title'],
8075 8075
                         $arrLP[$i]['id'],
8076
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8076
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8077 8077
                     );
8078 8078
 
8079 8079
                     if ($parent == $arrLP[$i]['id']) {
@@ -8097,7 +8097,7 @@  discard block
 block discarded – undo
8097 8097
         for ($i = 0; $i < count($arrLP); $i++) {
8098 8098
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8099 8099
                 $previousSelect->addOption(
8100
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8100
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8101 8101
                     $arrLP[$i]['id']
8102 8102
                 );
8103 8103
 
@@ -8119,7 +8119,7 @@  discard block
 block discarded – undo
8119 8119
                     }
8120 8120
                 }
8121 8121
             }
8122
-            $arrHide = array ();
8122
+            $arrHide = array();
8123 8123
             for ($i = 0; $i < count($arrLP); $i++) {
8124 8124
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8125 8125
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8211,8 +8211,8 @@  discard block
 block discarded – undo
8211 8211
 
8212 8212
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8213 8213
         $item_id = intval($item_id);
8214
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8215
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8214
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8215
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8216 8216
         $result = Database::query($sql);
8217 8217
         $row = Database::fetch_assoc($result);
8218 8218
 
@@ -8226,16 +8226,16 @@  discard block
 block discarded – undo
8226 8226
             $audio_player .= '<script>
8227 8227
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8228 8228
                                 s1.addParam("allowscriptaccess","always");
8229
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8229
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8230 8230
                                 s1.write("container");
8231 8231
                             </script>';
8232 8232
         }
8233 8233
 
8234
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8234
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8235 8235
 
8236 8236
         $return .= Display::url(
8237 8237
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8238
-            $url.'&action=edit_item&path_item=' . $row['path']
8238
+            $url.'&action=edit_item&path_item='.$row['path']
8239 8239
         );
8240 8240
 
8241 8241
         $return .= Display::url(
@@ -8255,12 +8255,12 @@  discard block
 block discarded – undo
8255 8255
             $url.'&action=delete_item'
8256 8256
         );
8257 8257
 
8258
-        if ($item_type == TOOL_HOTPOTATOES ) {
8258
+        if ($item_type == TOOL_HOTPOTATOES) {
8259 8259
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8260 8260
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8261 8261
         }
8262 8262
 
8263
-        if ($item_type == TOOL_DOCUMENT ) {
8263
+        if ($item_type == TOOL_DOCUMENT) {
8264 8264
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8265 8265
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8266 8266
         }
@@ -8281,13 +8281,13 @@  discard block
 block discarded – undo
8281 8281
     public function get_js_dropdown_array()
8282 8282
     {
8283 8283
         $course_id = api_get_course_int_id();
8284
-        $return = 'var child_name = new Array();' . "\n";
8285
-        $return .= 'var child_value = new Array();' . "\n\n";
8286
-        $return .= 'child_name[0] = new Array();' . "\n";
8287
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8284
+        $return = 'var child_name = new Array();'."\n";
8285
+        $return .= 'var child_value = new Array();'."\n\n";
8286
+        $return .= 'child_name[0] = new Array();'."\n";
8287
+        $return .= 'child_value[0] = new Array();'."\n\n";
8288 8288
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8289
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8290
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8289
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8290
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8291 8291
                     ORDER BY display_order ASC";
8292 8292
         $res_zero = Database::query($sql_zero);
8293 8293
         $i = 0;
@@ -8297,28 +8297,28 @@  discard block
 block discarded – undo
8297 8297
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8298 8298
             }
8299 8299
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8300
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8301
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8300
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8301
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8302 8302
         }
8303 8303
         $return .= "\n";
8304
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8305
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8304
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8305
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8306 8306
         $res = Database::query($sql);
8307 8307
         while ($row = Database :: fetch_array($res)) {
8308
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8308
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8309 8309
                            WHERE
8310 8310
                                 c_id = ".$course_id." AND
8311
-                                parent_item_id = " . $row['id'] . "
8311
+                                parent_item_id = " . $row['id']."
8312 8312
                            ORDER BY display_order ASC";
8313 8313
             $res_parent = Database::query($sql_parent);
8314 8314
             $i = 0;
8315
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8316
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8315
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8316
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8317 8317
 
8318 8318
             while ($row_parent = Database :: fetch_array($res_parent)) {
8319 8319
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8320
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8321
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8320
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8321
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8322 8322
             }
8323 8323
             $return .= "\n";
8324 8324
         }
@@ -8339,8 +8339,8 @@  discard block
 block discarded – undo
8339 8339
         if (is_numeric($item_id)) {
8340 8340
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8341 8341
 
8342
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8343
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8342
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8343
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8344 8344
 
8345 8345
             $res = Database::query($sql);
8346 8346
             $row = Database :: fetch_array($res);
@@ -8399,7 +8399,7 @@  discard block
 block discarded – undo
8399 8399
      */
8400 8400
     public function display_item_small_form($item_type, $title = '', $data = array())
8401 8401
     {
8402
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8402
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8403 8403
         $form = new FormValidator('small_form', 'post', $url);
8404 8404
         $form->addElement('header', $title);
8405 8405
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8425,7 +8425,7 @@  discard block
 block discarded – undo
8425 8425
         $item_id = intval($item_id);
8426 8426
         /* Current prerequisite */
8427 8427
         $sql = "SELECT * FROM $tbl_lp_item
8428
-                WHERE c_id = $course_id AND id = " . $item_id;
8428
+                WHERE c_id = $course_id AND id = ".$item_id;
8429 8429
         $result = Database::query($sql);
8430 8430
         $row    = Database::fetch_array($result);
8431 8431
         $prerequisiteId = $row['prerequisite'];
@@ -8435,20 +8435,20 @@  discard block
 block discarded – undo
8435 8435
         $return .= '<form method="POST">';
8436 8436
         $return .= '<table class="data_table">';
8437 8437
         $return .= '<tr>';
8438
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8439
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8440
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8438
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8439
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8440
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8441 8441
         $return .= '</tr>';
8442 8442
 
8443 8443
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8444 8444
         $return .= '<tr >';
8445 8445
         $return .= '<td colspan="3" class="radio">';
8446 8446
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8447
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8447
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8448 8448
         $return .= '</tr>';
8449 8449
 
8450 8450
         $sql = "SELECT * FROM $tbl_lp_item
8451
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8451
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8452 8452
         $result = Database::query($sql);
8453 8453
         $arrLP = array();
8454 8454
 
@@ -8491,24 +8491,24 @@  discard block
 block discarded – undo
8491 8491
             }
8492 8492
 
8493 8493
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8494
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8494
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8495 8495
 
8496 8496
             $return .= '<tr>';
8497
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8498
-            $return .= '<label for="id' . $item['id'] . '">';
8499
-            $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'] . '" />';
8497
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8498
+            $return .= '<label for="id'.$item['id'].'">';
8499
+            $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'].'" />';
8500 8500
             $icon_name = str_replace(' ', '', $item['item_type']);
8501 8501
 
8502
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8503
-                $return .= '<img alt="" src="../img/lp_' . $icon_name . '.png" style="margin-right:5px;" title="" />';
8502
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8503
+                $return .= '<img alt="" src="../img/lp_'.$icon_name.'.png" style="margin-right:5px;" title="" />';
8504 8504
             } else {
8505
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8506
-                    $return .= '<img alt="" src="../img/lp_' . $icon_name . '.gif" style="margin-right:5px;" title="" />';
8505
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8506
+                    $return .= '<img alt="" src="../img/lp_'.$icon_name.'.gif" style="margin-right:5px;" title="" />';
8507 8507
                 } else {
8508
-                    $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;'));
8508
+                    $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8509 8509
                 }
8510 8510
             }
8511
-            $return .=  $item['title'] . '</label>';
8511
+            $return .= $item['title'].'</label>';
8512 8512
             $return .= '</td>';
8513 8513
 
8514 8514
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8522,19 +8522,19 @@  discard block
 block discarded – undo
8522 8522
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8523 8523
 
8524 8524
                 $return .= '<td class="exercise">';
8525
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8525
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8526 8526
                 $return .= '</td>';
8527 8527
                 $return .= '<td class="exercise">';
8528
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8528
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8529 8529
                 $return .= '</td>';
8530 8530
             }
8531 8531
 
8532 8532
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8533 8533
                 $return .= '<td class="exercise">';
8534
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8534
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8535 8535
                 $return .= '</td>';
8536 8536
                 $return .= '<td class="exercise"">';
8537
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8537
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8538 8538
                 $return .= '</td>';
8539 8539
             }
8540 8540
             $return .= '</tr>';
@@ -8543,7 +8543,7 @@  discard block
 block discarded – undo
8543 8543
         $return .= '</tr>';
8544 8544
         $return .= '</table>';
8545 8545
         $return .= '<div style="padding-top:3px;">';
8546
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8546
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8547 8547
         $return .= '</form>';
8548 8548
 
8549 8549
         return $return;
@@ -8579,7 +8579,7 @@  discard block
 block discarded – undo
8579 8579
                 if ($row['id'] == $lp_id) {
8580 8580
                     continue;
8581 8581
                 }
8582
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8582
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8583 8583
             }
8584 8584
         }
8585 8585
         $return .= '</select>';
@@ -8632,8 +8632,8 @@  discard block
 block discarded – undo
8632 8632
                      WHERE c_id = $course_id AND active<>'-1' $condition_session
8633 8633
                      ORDER BY title ASC";
8634 8634
 
8635
-        $sql_hot  = "SELECT * FROM $tbl_doc
8636
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8635
+        $sql_hot = "SELECT * FROM $tbl_doc
8636
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8637 8637
                      ORDER BY id ASC";
8638 8638
 
8639 8639
         $res_quiz = Database::query($sql_quiz);
@@ -8643,8 +8643,8 @@  discard block
 block discarded – undo
8643 8643
 
8644 8644
         $return .= '<li class="lp_resource_element">';
8645 8645
         $return .= '<img alt="" src="../img/new_test_small.gif" style="margin-right:5px;" title="" />';
8646
-        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8647
-            get_lang('NewExercise') . '</a>';
8646
+        $return .= '<a href="'.api_get_path(REL_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8647
+            get_lang('NewExercise').'</a>';
8648 8648
         $return .= '</li>';
8649 8649
 
8650 8650
         // Display hotpotatoes
@@ -8656,8 +8656,8 @@  discard block
 block discarded – undo
8656 8656
             $return .= '</a> ';
8657 8657
 
8658 8658
             $return .= '<img src="../img/hotpotatoes_s.png" style="margin-right:5px;" title="" width="16px" />';
8659
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8660
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8659
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8660
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8661 8661
             $return .= '</li>';
8662 8662
         }
8663 8663
 
@@ -8667,7 +8667,7 @@  discard block
 block discarded – undo
8667 8667
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8668 8668
             $return .= '</a> ';
8669 8669
             $return .= '<img alt="" src="../img/quizz_small.gif" style="margin-right:5px;" title="" />';
8670
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8670
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8671 8671
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8672 8672
                 '</a>';
8673 8673
             $return .= '</li>';
@@ -8721,10 +8721,10 @@  discard block
 block discarded – undo
8721 8721
             function toggle_tool(tool, id){
8722 8722
                 if(document.getElementById(tool+"_"+id+"_content").style.display == "none"){
8723 8723
                     document.getElementById(tool+"_"+id+"_content").style.display = "block";
8724
-                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
8724
+                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'remove.gif";
8725 8725
                 } else {
8726 8726
                     document.getElementById(tool+"_"+id+"_content").style.display = "none";
8727
-                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
8727
+                    document.getElementById(tool+"_"+id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'add.gif";
8728 8728
                 }
8729 8729
             }
8730 8730
         </script>
@@ -8737,7 +8737,7 @@  discard block
 block discarded – undo
8737 8737
         foreach ($categorizedLinks as $categoryId => $links) {
8738 8738
             $linkNodes = null;
8739 8739
             foreach ($links as $key => $title) {
8740
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8740
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8741 8741
                     $linkNodes .=
8742 8742
                         '<li class="lp_resource_element" data_id="'.$key.
8743 8743
                         '" data_type="'.TOOL_LINK.'" title="'.$title.'" >
@@ -8777,7 +8777,7 @@  discard block
 block discarded – undo
8777 8777
         $return = '<div class="lp_resource" >';
8778 8778
         $return .= '<div class="lp_resource_element">';
8779 8779
         $return .= '<img align="left" alt="" src="../img/works_small.gif" style="margin-right:5px;" title="" />';
8780
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8780
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8781 8781
         $return .= '</div>';
8782 8782
         $return .= '</div>';
8783 8783
         return $return;
@@ -8799,17 +8799,17 @@  discard block
 block discarded – undo
8799 8799
         //First add link
8800 8800
         $return .= '<li class="lp_resource_element">';
8801 8801
         $return .= '<img alt="" src="../img/forum_new_small.gif" style="margin-right:5px;" title="" />';
8802
-        $return .= '<a href="' . api_get_path(REL_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>';
8802
+        $return .= '<a href="'.api_get_path(REL_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>';
8803 8803
         $return .= '</li>';
8804 8804
 
8805 8805
         $return .= '<script>
8806 8806
                     function toggle_forum(forum_id){
8807 8807
                         if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
8808 8808
                             document.getElementById("forum_"+forum_id+"_content").style.display = "block";
8809
-                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'remove.gif";
8809
+                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'remove.gif";
8810 8810
                         } else {
8811 8811
                             document.getElementById("forum_"+forum_id+"_content").style.display = "none";
8812
-                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH) . 'add.gif";
8812
+                            document.getElementById("forum_"+forum_id+"_opener").src = "' . api_get_path(WEB_IMG_PATH).'add.gif";
8813 8813
                         }
8814 8814
                     }
8815 8815
                 </script>';
@@ -8821,15 +8821,15 @@  discard block
 block discarded – undo
8821 8821
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8822 8822
                 $return .= ' </a>';
8823 8823
                 $return .= '<img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />';
8824
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8825
-                                <img src="' . api_get_path(WEB_IMG_PATH) . 'add.gif" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8824
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8825
+                                <img src="' . api_get_path(WEB_IMG_PATH).'add.gif" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8826 8826
                             </a>
8827
-                            <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">' .
8828
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8827
+                            <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">'.
8828
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8829 8829
 
8830 8830
                 $return .= '</li>';
8831 8831
 
8832
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8832
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8833 8833
                 $a_threads = get_threads($forum['forum_id']);
8834 8834
                 if (is_array($a_threads)) {
8835 8835
                     foreach ($a_threads as $thread) {
@@ -8838,8 +8838,8 @@  discard block
 block discarded – undo
8838 8838
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8839 8839
                         $return .= ' </a>';
8840 8840
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8841
-                        $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 . '">' .
8842
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8841
+                        $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.'">'.
8842
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8843 8843
                         $return .= '</li>';
8844 8844
                     }
8845 8845
                 }
@@ -8910,7 +8910,7 @@  discard block
 block discarded – undo
8910 8910
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8911 8911
             // Remove the possible . at the end of the path.
8912 8912
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8913
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8913
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8914 8914
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8915 8915
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8916 8916
         }
@@ -8978,7 +8978,7 @@  discard block
 block discarded – undo
8978 8978
                 if ($item->type == 'sco') {
8979 8979
                     $inc_docs = $item->get_resources_from_source(
8980 8980
                         null,
8981
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8981
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8982 8982
                     );
8983 8983
                 } else {
8984 8984
                     $inc_docs = $item->get_resources_from_source();
@@ -9194,7 +9194,7 @@  discard block
 block discarded – undo
9194 9194
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9195 9195
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9196 9196
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9197
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9197
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9198 9198
                                         $my_dep->setAttribute('xml:base', '');
9199 9199
                                     }
9200 9200
                                 }
@@ -9325,7 +9325,7 @@  discard block
 block discarded – undo
9325 9325
                         //$my_item->appendChild($my_max_score);
9326 9326
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9327 9327
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9328
-                        $my_prereqs->setAttribute('type','aicc_script');
9328
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9329 9329
                         $my_item->appendChild($my_prereqs);
9330 9330
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9331 9331
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9378,7 +9378,7 @@  discard block
 block discarded – undo
9378 9378
                         $my_resource->appendChild($my_file);
9379 9379
 
9380 9380
                         // Get included docs.
9381
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9381
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9382 9382
                         // Dependency to other files - not yet supported.
9383 9383
                         $i = 1;
9384 9384
                         foreach ($inc_docs as $doc_info) {
@@ -9439,7 +9439,7 @@  discard block
 block discarded – undo
9439 9439
                                         $my_dep_file->setAttribute('href', $file_path);
9440 9440
                                         $my_dep->setAttribute('xml:base', '');
9441 9441
 
9442
-                                        if (strstr($file_path,$main_path) !== false) {
9442
+                                        if (strstr($file_path, $main_path) !== false) {
9443 9443
                                             // The calculated real path is really inside the chamilo root path.
9444 9444
                                             // Reduce file path to what's under the DocumentRoot.
9445 9445
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9457,7 +9457,7 @@  discard block
 block discarded – undo
9457 9457
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9458 9458
                                             $file_path = str_replace('//', '/', $file_path);
9459 9459
                                             if (file_exists($file_path)) {
9460
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9460
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9461 9461
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9462 9462
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9463 9463
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9686,7 +9686,7 @@  discard block
 block discarded – undo
9686 9686
             if (strpos($extra_file, '.') === 0)
9687 9687
                 continue;
9688 9688
             else {
9689
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9689
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9690 9690
                 $this->create_path($dest_file);
9691 9691
                 copy($main_code_path.$extra_file, $dest_file);
9692 9692
             }
@@ -9739,7 +9739,7 @@  discard block
 block discarded – undo
9739 9739
                             }
9740 9740
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9741 9741
                             if (file_exists($file_path)) {
9742
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9742
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9743 9743
                             }
9744 9744
                             break;
9745 9745
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9779,12 +9779,12 @@  discard block
 block discarded – undo
9779 9779
 
9780 9780
         foreach ($path_bits as $bit) {
9781 9781
             if (!empty ($bit)) {
9782
-                $new_path = $path_built . $bit;
9782
+                $new_path = $path_built.$bit;
9783 9783
                 if (is_dir($new_path)) {
9784
-                    $path_built = $new_path . '/';
9784
+                    $path_built = $new_path.'/';
9785 9785
                 } else {
9786 9786
                     mkdir($new_path, api_get_permissions_for_new_directories());
9787
-                    $path_built = $new_path . '/';
9787
+                    $path_built = $new_path.'/';
9788 9788
                 }
9789 9789
             }
9790 9790
         }
@@ -9828,9 +9828,9 @@  discard block
 block discarded – undo
9828 9828
 
9829 9829
         if ($upload_ok) {
9830 9830
             if ($has_attachment) {
9831
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9831
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9832 9832
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9833
-                $updir = $sys_course_path . $courseDir;
9833
+                $updir = $sys_course_path.$courseDir;
9834 9834
                 // Try to add an extension to the file if it hasn't one.
9835 9835
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9836 9836
 
@@ -9885,7 +9885,7 @@  discard block
 block discarded – undo
9885 9885
             //Setting my lp_id to autolaunch = 1
9886 9886
             $attributes['autolaunch'] = 1;
9887 9887
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9888
-            Database::update($lp_table, $attributes, $where );
9888
+            Database::update($lp_table, $attributes, $where);
9889 9889
         }
9890 9890
     }
9891 9891
 
@@ -9904,13 +9904,13 @@  discard block
 block discarded – undo
9904 9904
 
9905 9905
         // Get the max order of the items
9906 9906
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9907
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9907
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9908 9908
         $rs_max_order = Database::query($sql_max_order);
9909 9909
         $row_max_order = Database::fetch_object($rs_max_order);
9910 9910
         $max_order = $row_max_order->display_order;
9911 9911
         // Get the previous item ID
9912 9912
         $sql = "SELECT id as previous FROM $table_lp_item
9913
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9913
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9914 9914
         $rs_max = Database::query($sql);
9915 9915
         $row_max = Database::fetch_object($rs_max);
9916 9916
 
@@ -9966,9 +9966,9 @@  discard block
 block discarded – undo
9966 9966
         $documents_total_space = DocumentManager::documents_total_space();
9967 9967
         $course_max_space = DocumentManager::get_course_quota();
9968 9968
         $total_size = filesize($s) + $documents_total_space;
9969
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9969
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9970 9970
             return true;
9971
-        } else{
9971
+        } else {
9972 9972
             return false;
9973 9973
         }
9974 9974
     }
@@ -10308,7 +10308,7 @@  discard block
 block discarded – undo
10308 10308
         if ($this->debug > 0) {
10309 10309
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10310 10310
         }
10311
-        $this->subscribeUsers = intval($value);;
10311
+        $this->subscribeUsers = intval($value); ;
10312 10312
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10313 10313
         $lp_id = $this->get_id();
10314 10314
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10654,7 +10654,7 @@  discard block
 block discarded – undo
10654 10654
      */
10655 10655
     public function createForum($forumCategoryId)
10656 10656
     {
10657
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10657
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10658 10658
 
10659 10659
         $forumId = store_forum(
10660 10660
             [
Please login to merge, or discard this patch.
main/newscorm/lp_build.php 1 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 1 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.