Passed
Push — 1.10.x ( c1f149...c762b4 )
by
unknown
83:20 queued 31:10
created
main/social/group_view.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * @package chamilo.social
5
- * @author Julio Montoya <[email protected]>
6
- */
4
+     * @package chamilo.social
5
+     * @author Julio Montoya <[email protected]>
6
+     */
7 7
 
8 8
 $cidReset = true;
9 9
 $language_file = array('userInfo');
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 api_block_anonymous_users();
13 13
 
14
-if (api_get_setting('allow_social_tool') !='true') {
14
+if (api_get_setting('allow_social_tool') != 'true') {
15 15
     api_not_allowed();
16 16
 }
17 17
 
@@ -87,31 +87,31 @@  discard block
 block discarded – undo
87 87
 
88 88
 </script>';
89 89
 
90
-$allowed_views = array('mygroups','newest','pop');
90
+$allowed_views = array('mygroups', 'newest', 'pop');
91 91
 $content = null;
92 92
 
93
-if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) {
93
+if (isset($_GET['view']) && in_array($_GET['view'], $allowed_views)) {
94 94
     if ($_GET['view'] == 'mygroups') {
95
-        $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
96
-        $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MyGroups'));
97
-    } else if ( $_GET['view'] == 'newest') {
98
-        $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
99
-        $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Newest'));
100
-    } else  {
101
-        $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
102
-        $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Popular'));
95
+        $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups'));
96
+        $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('MyGroups'));
97
+    } else if ($_GET['view'] == 'newest') {
98
+        $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups'));
99
+        $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Newest'));
100
+    } else {
101
+        $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups'));
102
+        $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Popular'));
103 103
     }
104 104
 } else {
105
-    $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
105
+    $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups'));
106 106
     if (!isset($_GET['id'])) {
107
-        $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('GroupList'));
107
+        $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('GroupList'));
108 108
     } else {
109 109
         //$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Group'));
110 110
     }
111 111
 }
112 112
 
113 113
 // getting group information
114
-$group_id	= isset($_GET['id']) ? intval($_GET['id']) : null;
114
+$group_id = isset($_GET['id']) ? intval($_GET['id']) : null;
115 115
 $relation_group_title = '';
116 116
 $role = 0;
117 117
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 if ($group_id != 0) {
121 121
     $group_info = $usergroup->get($group_id);
122 122
 
123
-    $interbreadcrumb[]= array ('url' =>'#','name' => $group_info['name']);
123
+    $interbreadcrumb[] = array('url' =>'#', 'name' => $group_info['name']);
124 124
 
125
-    if (isset($_GET['action']) && $_GET['action']=='leave') {
125
+    if (isset($_GET['action']) && $_GET['action'] == 'leave') {
126 126
         $user_leaved = intval($_GET['u']);
127 127
         //I can "leave me myself"
128 128
         if (api_get_user_id() == $user_leaved) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
     }
135 135
     // add a user to a group if its open
136
-    if (isset($_GET['action']) && $_GET['action']=='join') {
136
+    if (isset($_GET['action']) && $_GET['action'] == 'join') {
137 137
         // we add a user only if is a open group
138 138
         $user_join = intval($_GET['u']);
139 139
         if (api_get_user_id() == $user_join && !empty($group_id)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 $group_info = $usergroup->get($group_id);
162 162
 
163 163
 //Loading group information
164
-if (isset($_GET['status']) && $_GET['status']=='sent') {
164
+if (isset($_GET['status']) && $_GET['status'] == 'sent') {
165 165
     $social_right_content .= Display::return_message(get_lang('MessageHasBeenSent'), 'confirmation', false);
166 166
 }
167 167
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) {
172 172
     if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) {
173
-        $social_right_content .=  Display::return_message(get_lang('YouAlreadySentAnInvitation'));
173
+        $social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation'));
174 174
     }
175 175
 }
176 176
 
@@ -179,13 +179,13 @@  discard block
 block discarded – undo
179 179
         if (!in_array($role,
180 180
             array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))
181 181
         ) {
182
-            $social_right_content .=  '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
182
+            $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
183 183
                 get_lang('JoinGroup').'</a>';
184 184
         } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
185
-            $social_right_content .=  '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
185
+            $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.
186 186
                 get_lang('YouHaveBeenInvitedJoinNow').'</a>';
187 187
         }
188
-        $social_right_content .=  '<br /><br />';
188
+        $social_right_content .= '<br /><br />';
189 189
     }
190 190
     $content = MessageManager::display_messages_for_group($group_id);
191 191
     if ($is_group_member) {
@@ -244,21 +244,21 @@  discard block
 block discarded – undo
244 244
         foreach ($members as $member) {
245 245
             // if is a member
246 246
             if (in_array($member['relation_type'],
247
-                array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER,GROUP_USER_PERMISSION_MODERATOR))
247
+                array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR))
248 248
             ) {
249 249
                 //add icons
250 250
                 if ($member['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
251
-                    $icon= Display::return_icon('social_group_admin.png', get_lang('Admin'));
251
+                    $icon = Display::return_icon('social_group_admin.png', get_lang('Admin'));
252 252
                 } elseif ($member['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
253
-                    $icon= Display::return_icon('social_group_moderator.png', get_lang('Moderator'));
253
+                    $icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator'));
254 254
                 } else {
255
-                    $icon= '';
255
+                    $icon = '';
256 256
                 }
257 257
 
258 258
                 $userPicture = UserManager::getUserPicture($member['id']);
259 259
 
260 260
                 $member_content .= '<div class="">';
261
-                $member_name = Display::url(api_get_person_name(cut($member['firstname'],15),cut($member['lastname'],15)).'&nbsp;'.$icon, $member['user_info']['profile_url']);
261
+                $member_name = Display::url(api_get_person_name(cut($member['firstname'], 15), cut($member['lastname'], 15)).'&nbsp;'.$icon, $member['user_info']['profile_url']);
262 262
                 $member_content .= Display::div('<img class="social-groups-image img-circle" src="'.$userPicture.'"/>&nbsp'.$member_name);
263 263
                 $member_content .= '</div>';
264 264
             }
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
     }
267 267
 
268 268
     if (!empty($create_thread_link)) {
269
-        $create_thread_link =  Display::div($create_thread_link, array('class'=>'pull-right'));
269
+        $create_thread_link = Display::div($create_thread_link, array('class'=>'pull-right'));
270 270
     }
271 271
     $headers = array(get_lang('Discussions'), get_lang('Members'));
272
-    $social_right_content .= Display::tabs($headers, array($content, $member_content),'tabs');
272
+    $social_right_content .= Display::tabs($headers, array($content, $member_content), 'tabs');
273 273
 } else {
274 274
     // if I already sent an invitation message
275 275
     if (!in_array(
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
         )
281 281
     )
282 282
     ) {
283
-        $social_right_content .=  '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>';
283
+        $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>';
284 284
     } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
285
-        $social_right_content .=  '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>';
285
+        $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>';
286 286
     }
287 287
 }
288 288
 
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 1 patch
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     return $msg;
144 144
                 }
145 145
             } else {
146
-                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'");
146
+                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
147 147
                 if (Database::num_rows($rs)) {
148 148
                     $msg = get_lang('SessionNameAlreadyExists');
149 149
                     return $msg;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     public static function session_name_exists($name)
257 257
     {
258 258
         $name = Database::escape_string($name);
259
-        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
259
+        $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)."
260 260
                 WHERE name = '$name'";
261 261
         $result = Database::fetch_array(Database::query($sql));
262 262
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $where .= " AND (
288 288
                             s.session_admin_id = $user_id  OR
289 289
                             sru.user_id = '$user_id' AND
290
-                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
290
+                            sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
291 291
                             )
292 292
                       ";
293 293
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             $where_condition = str_replace('category_name', 'sc.name', $where_condition);
306 306
             $where_condition = str_replace(
307 307
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
308
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
308
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
309 309
                 , $where_condition
310 310
             );
311 311
             $where_condition = str_replace(
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
             $access_url_id = api_get_current_access_url_id();
352 352
             if ($access_url_id != -1) {
353
-                $where.= " AND ar.access_url_id = $access_url_id ";
353
+                $where .= " AND ar.access_url_id = $access_url_id ";
354 354
 
355 355
                 $sql = "SELECT count(id) as total_rows FROM (
356 356
                 SELECT DISTINCT
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
             if (api_is_session_admin() &&
401 401
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
402 402
             ) {
403
-                $where .=" AND s.session_admin_id = $user_id ";
403
+                $where .= " AND s.session_admin_id = $user_id ";
404 404
             }
405 405
         }
406 406
 
407 407
         if (!api_is_platform_admin() && api_is_teacher() &&
408 408
             api_get_setting('allow_teachers_to_create_sessions') == 'true'
409 409
         ) {
410
-            $where .=" AND s.id_coach = $user_id ";
410
+            $where .= " AND s.id_coach = $user_id ";
411 411
         }
412 412
 
413 413
         $extra_field = new ExtraField('session');
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
         $query = "$select FROM $tbl_session s $inject_joins $where $inject_where";
458 458
 
459 459
         if (api_is_multiple_url_enabled()) {
460
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
460
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
461 461
             $access_url_id = api_get_current_access_url_id();
462 462
             if ($access_url_id != -1) {
463
-                $where.= " AND ar.access_url_id = $access_url_id ";
463
+                $where .= " AND ar.access_url_id = $access_url_id ";
464 464
                 $query = "$select
465 465
                         FROM $tbl_session s $inject_joins
466 466
                         INNER JOIN $table_access_url_rel_session ar
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                 INNER JOIN $tbl_lp l ON l.id = v.lp_id
565 565
                 INNER JOIN $tbl_user u ON u.user_id = v.user_id
566 566
                 INNER JOIN $tbl_course c
567
-                WHERE v.session_id = " . $sessionId;
567
+                WHERE v.session_id = ".$sessionId;
568 568
         $result_rows = Database::query($sql);
569 569
         $row = Database::fetch_array($result_rows);
570 570
         $num = $row['total_rows'];
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 
617 617
         $limit = null;
618 618
         if (!empty($options['limit'])) {
619
-            $limit = " LIMIT " . $options['limit'];
619
+            $limit = " LIMIT ".$options['limit'];
620 620
         }
621 621
 
622 622
         if (!empty($options['where'])) {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
         $order = null;
627 627
         if (!empty($options['order'])) {
628
-            $order = " ORDER BY " . $options['order'];
628
+            $order = " ORDER BY ".$options['order'];
629 629
         }
630 630
 
631 631
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -684,13 +684,13 @@  discard block
 block discarded – undo
684 684
             foreach ($lessons as $lesson) {
685 685
                 $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0;
686 686
                 $progress += $data[$lesson['id']];
687
-                $data[$lesson['id']] = $data[$lesson['id']] . '%';
687
+                $data[$lesson['id']] = $data[$lesson['id']].'%';
688 688
                 $count++;
689 689
             }
690 690
             if ($count == 0) {
691 691
                 $data['total'] = 0;
692 692
             } else {
693
-                $data['total'] = round($progress / $count, 2) . '%';
693
+                $data['total'] = round($progress / $count, 2).'%';
694 694
             }
695 695
             $table[] = $data;
696 696
         }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
         $limit = null;
733 733
         if (!empty($options['limit'])) {
734
-            $limit = " LIMIT " . $options['limit'];
734
+            $limit = " LIMIT ".$options['limit'];
735 735
         }
736 736
 
737 737
         if (!empty($options['where'])) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
         $order = null;
742 742
         if (!empty($options['order'])) {
743
-            $order = " ORDER BY " . $options['order'];
743
+            $order = " ORDER BY ".$options['order'];
744 744
         }
745 745
 
746 746
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 
843 843
         $limit = null;
844 844
         if (!empty($options['limit'])) {
845
-            $limit = " LIMIT " . $options['limit'];
845
+            $limit = " LIMIT ".$options['limit'];
846 846
         }
847 847
 
848 848
         if (!empty($options['where'])) {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 
852 852
         $order = null;
853 853
         if (!empty($options['order'])) {
854
-            $order = " ORDER BY " . $options['order'];
854
+            $order = " ORDER BY ".$options['order'];
855 855
         }
856 856
 
857 857
         //TODO, fix create report without session
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         /**
885 885
          *  Lessons
886 886
          */
887
-        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s ";  //AND session_id = %s
887
+        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
888 888
         $sql_query = sprintf($sql, $course['real_id']);
889 889
         $result = Database::query($sql_query);
890 890
         $arrLesson = array(array());
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
893 893
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
894 894
             } else {
895
-                $arrLesson[$row['session_id']]['lessons_total'] ++;
895
+                $arrLesson[$row['session_id']]['lessons_total']++;
896 896
             }
897 897
         }
898 898
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                 $course['real_id']
960 960
             );
961 961
             foreach ($user_list as $user_id) {
962
-                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1;
962
+                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
963 963
             }
964 964
         }
965 965
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
             $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']);
1014 1014
             $assignments_left = $assignments_total - $assignments_done;
1015 1015
             if (!empty($assignments_total)) {
1016
-                $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2);
1016
+                $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2);
1017 1017
             } else {
1018 1018
                 $assignments_progress = 0;
1019 1019
             }
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
             $wiki_read = $row['count'];
1044 1044
             $wiki_unread = $wiki_total - $wiki_read;
1045 1045
             if (!empty($wiki_total)) {
1046
-                $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2);
1046
+                $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2);
1047 1047
             } else {
1048 1048
                 $wiki_progress = 0;
1049 1049
             }
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
             $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0);
1053 1053
             $surveys_left = $surveys_total - $surveys_done;
1054 1054
             if (!empty($surveys_total)) {
1055
-                $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2);
1055
+                $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2);
1056 1056
             } else {
1057 1057
                 $surveys_progress = 0;
1058 1058
             }
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
             );
1066 1066
             $forums_left = $forums_total - $forums_done;
1067 1067
             if (!empty($forums_total)) {
1068
-                $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2);
1068
+                $forums_progress = round((($forums_done * 100) / $forums_total), 2);
1069 1069
             } else {
1070 1070
                 $forums_progress = 0;
1071 1071
             }
@@ -1073,58 +1073,58 @@  discard block
 block discarded – undo
1073 1073
             //Overall Total
1074 1074
             $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6;
1075 1075
 
1076
-            $link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user[0] . '&details=true&course=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1077
-            $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1078
-            $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1079
-            $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>';
1080
-            $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1076
+            $link = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user[0].'&details=true&course='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1077
+            $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1078
+            $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1079
+            $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>';
1080
+            $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1081 1081
 
1082 1082
             $table[] = array(
1083 1083
                 'lastname' => $user[1],
1084 1084
                 'firstname' => $user[2],
1085 1085
                 'username' => $user[3],
1086 1086
                 #'profile'   => '',
1087
-                'total' => round($overall_total, 2) . '%',
1088
-                'courses' => sprintf($link, $course_description_progress . '%'),
1089
-                'lessons' => sprintf($link, $lessons_progress . '%'),
1090
-                'exercises' => sprintf($link, $exercises_progress . '%'),
1091
-                'forums' => sprintf($link, $forums_progress . '%'),
1092
-                'homeworks' => sprintf($link, $assignments_progress . '%'),
1093
-                'wikis' => sprintf($link, $wiki_progress . '%'),
1094
-                'surveys' => sprintf($link, $surveys_progress . '%'),
1087
+                'total' => round($overall_total, 2).'%',
1088
+                'courses' => sprintf($link, $course_description_progress.'%'),
1089
+                'lessons' => sprintf($link, $lessons_progress.'%'),
1090
+                'exercises' => sprintf($link, $exercises_progress.'%'),
1091
+                'forums' => sprintf($link, $forums_progress.'%'),
1092
+                'homeworks' => sprintf($link, $assignments_progress.'%'),
1093
+                'wikis' => sprintf($link, $wiki_progress.'%'),
1094
+                'surveys' => sprintf($link, $surveys_progress.'%'),
1095 1095
                 //course description
1096
-                'course_description_progress' => $course_description_progress . '%',
1096
+                'course_description_progress' => $course_description_progress.'%',
1097 1097
                 //lessons
1098 1098
                 'lessons_total' => sprintf($link, $lessons_total),
1099 1099
                 'lessons_done' => sprintf($link, $lessons_done),
1100 1100
                 'lessons_left' => sprintf($link, $lessons_left),
1101
-                'lessons_progress' => sprintf($link, $lessons_progress . '%'),
1101
+                'lessons_progress' => sprintf($link, $lessons_progress.'%'),
1102 1102
                 //exercises
1103 1103
                 'exercises_total' => sprintf($link, $exercises_total),
1104 1104
                 'exercises_done' => sprintf($link, $exercises_done),
1105 1105
                 'exercises_left' => sprintf($link, $exercises_left),
1106
-                'exercises_progress' => sprintf($link, $exercises_progress . '%'),
1106
+                'exercises_progress' => sprintf($link, $exercises_progress.'%'),
1107 1107
                 //forums
1108 1108
                 'forums_total' => sprintf($linkForum, $forums_total),
1109 1109
                 'forums_done' => sprintf($linkForum, $forums_done),
1110 1110
                 'forums_left' => sprintf($linkForum, $forums_left),
1111
-                'forums_progress' => sprintf($linkForum, $forums_progress . '%'),
1111
+                'forums_progress' => sprintf($linkForum, $forums_progress.'%'),
1112 1112
                 //assignments
1113 1113
                 'assignments_total' => sprintf($linkWork, $assignments_total),
1114 1114
                 'assignments_done' => sprintf($linkWork, $assignments_done),
1115 1115
                 'assignments_left' => sprintf($linkWork, $assignments_left),
1116
-                'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'),
1116
+                'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'),
1117 1117
                 //wiki
1118 1118
                 'wiki_total' => sprintf($linkWiki, $wiki_total),
1119 1119
                 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions),
1120 1120
                 'wiki_read' => sprintf($linkWiki, $wiki_read),
1121 1121
                 'wiki_unread' => sprintf($linkWiki, $wiki_unread),
1122
-                'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'),
1122
+                'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'),
1123 1123
                 //survey
1124 1124
                 'surveys_total' => sprintf($linkSurvey, $surveys_total),
1125 1125
                 'surveys_done' => sprintf($linkSurvey, $surveys_done),
1126 1126
                 'surveys_left' => sprintf($linkSurvey, $surveys_left),
1127
-                'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'),
1127
+                'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'),
1128 1128
             );
1129 1129
         }
1130 1130
 
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 
1205 1205
         $limit = null;
1206 1206
         if (!empty($options['limit'])) {
1207
-            $limit = " LIMIT " . $options['limit'];
1207
+            $limit = " LIMIT ".$options['limit'];
1208 1208
         }
1209 1209
 
1210 1210
         if (!empty($options['where'])) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 
1214 1214
         $order = null;
1215 1215
         if (!empty($options['order'])) {
1216
-            $order = " ORDER BY " . $options['order'];
1216
+            $order = " ORDER BY ".$options['order'];
1217 1217
         }
1218 1218
 
1219 1219
         //TODO add course name
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
                     " : "
1227 1227
                     u.lastname,
1228 1228
                     u.firstname,
1229
-                ") . "
1229
+                ")."
1230 1230
                 a.logout_course_date,
1231 1231
                 a.counter,
1232 1232
                 c.title,
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
             if (Database::num_rows($result) > 0) {
1311 1311
                 $row = Database::fetch_array($result);
1312 1312
                 $count = $row['count'] + 1;
1313
-                $session_name = $session_name . '_' . $count;
1313
+                $session_name = $session_name.'_'.$count;
1314 1314
                 $result = self::session_name_exists($session_name);
1315 1315
                 if (!$result) {
1316 1316
                     return $session_name;
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
 
1391 1391
             return false;
1392 1392
         } else {
1393
-            $sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'";
1393
+            $sql = "SELECT id FROM $tbl_session WHERE name='".Database::escape_string($name)."'";
1394 1394
             $rs = Database::query($sql);
1395 1395
             $exists = false;
1396 1396
             while ($row = Database::fetch_array($rs)) {
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
         }
1489 1489
 
1490 1490
         if (SessionManager::allowed($id_checked) && !$from_ws) {
1491
-            $sql = 'SELECT session_admin_id FROM ' . $tbl_session. '
1491
+            $sql = 'SELECT session_admin_id FROM '.$tbl_session.'
1492 1492
                     WHERE id IN (' . $id_checked.')';
1493 1493
             $rs = Database::query($sql);
1494 1494
             if (Database::result($rs, 0, 0) != $userId) {
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
         // Delete users from the session
1750 1750
         if ($empty_users === true) {
1751 1751
             $sql = "DELETE FROM $tbl_session_rel_user
1752
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1752
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1753 1753
             Database::query($sql);
1754 1754
         }
1755 1755
 
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
             $enreg_user = Database::escape_string($enreg_user);
1761 1761
             $nbr_users++;
1762 1762
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1763
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1763
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1764 1764
             Database::query($sql);
1765 1765
         }
1766 1766
 
@@ -1850,9 +1850,9 @@  discard block
 block discarded – undo
1850 1850
         is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
1851 1851
 
1852 1852
         $statusCondition = null;
1853
-        if (isset($status) && !is_null($status))  {
1853
+        if (isset($status) && !is_null($status)) {
1854 1854
             $status = intval($status);
1855
-            $statusCondition  = " AND status = $status";
1855
+            $statusCondition = " AND status = $status";
1856 1856
         }
1857 1857
 
1858 1858
         foreach ($userList as $userId) {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
             if (empty($count)) {
1985 1985
                 // If user is not registered to a session then add it.
1986 1986
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
1987
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
1987
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
1988 1988
                 Database::query($sql);
1989 1989
 
1990 1990
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 		               WHERE
2028 2028
                             session_id = $session_id AND
2029 2029
 		                    user_id = $user_id AND
2030
-		                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2030
+		                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2031 2031
         $result = Database::query($delete_sql);
2032 2032
         $return = Database::affected_rows($result);
2033 2033
 
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
                 FROM $tbl_session_rel_user
2112 2112
                 WHERE
2113 2113
                     session_id = $sessionId AND
2114
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2114
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2115 2115
         $result = Database::query($sql);
2116 2116
         $user_list = Database::store_result($result);
2117 2117
 
@@ -2123,7 +2123,7 @@  discard block
 block discarded – undo
2123 2123
 
2124 2124
                     $sql = "DELETE FROM $tbl_session_rel_course
2125 2125
                             WHERE
2126
-                                c_id = " . $existingCourse['c_id'] . " AND
2126
+                                c_id = ".$existingCourse['c_id']." AND
2127 2127
                                 session_id = $sessionId";
2128 2128
                     Database::query($sql);
2129 2129
 
@@ -2186,7 +2186,7 @@  discard block
 block discarded – undo
2186 2186
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2187 2187
 
2188 2188
                             $cat->set_session_id($sessionId);
2189
-                            $oldCategoryId= $cat->get_id();
2189
+                            $oldCategoryId = $cat->get_id();
2190 2190
                             $newId = $cat->add();
2191 2191
                             $newCategoryIdList[$oldCategoryId] = $newId;
2192 2192
 
@@ -2374,8 +2374,8 @@  discard block
 block discarded – undo
2374 2374
         $return_value = false;
2375 2375
         $sql = "SELECT c_id FROM $tbl_session_course
2376 2376
                 WHERE
2377
-                  session_id = " . intval($session_id) . " AND
2378
-                  c_id = " . intval($courseId) . "";
2377
+                  session_id = ".intval($session_id)." AND
2378
+                  c_id = " . intval($courseId)."";
2379 2379
         $result = Database::query($sql);
2380 2380
         $num = Database::num_rows($result);
2381 2381
         if ($num > 0) {
@@ -2398,8 +2398,8 @@  discard block
 block discarded – undo
2398 2398
         }
2399 2399
 
2400 2400
         $sql = 'SELECT *
2401
-		        FROM ' . $tbl_session . '
2402
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2401
+		        FROM ' . $tbl_session.'
2402
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2403 2403
         $result = Database::query($sql);
2404 2404
         $num = Database::num_rows($result);
2405 2405
         if ($num > 0) {
@@ -2439,8 +2439,8 @@  discard block
 block discarded – undo
2439 2439
         $month_end = intval($smonth_end);
2440 2440
         $day_end = intval($sday_end);
2441 2441
 
2442
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2443
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2442
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2443
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2444 2444
 
2445 2445
         if (empty($name)) {
2446 2446
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2512,8 +2512,8 @@  discard block
 block discarded – undo
2512 2512
         $month_end = intval($smonth_end);
2513 2513
         $day_end = intval($sday_end);
2514 2514
         $id = intval($id);
2515
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2516
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2515
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2516
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2517 2517
 
2518 2518
         if (empty($name)) {
2519 2519
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2533,13 +2533,13 @@  discard block
 block discarded – undo
2533 2533
         if ($date_end <> null) {
2534 2534
             $sql = "UPDATE $tbl_session_category
2535 2535
                     SET
2536
-                        name = '" . Database::escape_string($name) . "',
2536
+                        name = '".Database::escape_string($name)."',
2537 2537
                         date_start = '$date_start' ,
2538 2538
                         date_end = '$date_end'
2539 2539
                     WHERE id= $id";
2540 2540
         } else {
2541 2541
             $sql = "UPDATE $tbl_session_category SET
2542
-                        name = '" . Database::escape_string($name) . "',
2542
+                        name = '".Database::escape_string($name)."',
2543 2543
                         date_start = '$date_start',
2544 2544
                         date_end = NULL
2545 2545
                     WHERE id= $id";
@@ -2569,10 +2569,10 @@  discard block
 block discarded – undo
2569 2569
 
2570 2570
         //Setting session_category_id to 0
2571 2571
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2572
-                WHERE session_category_id IN (" . $id_checked . ")";
2572
+                WHERE session_category_id IN (".$id_checked.")";
2573 2573
         Database::query($sql);
2574 2574
 
2575
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2575
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2576 2576
         $result = Database::query($sql);
2577 2577
         while ($rows = Database::fetch_array($result)) {
2578 2578
             $session_id = $rows['id'];
@@ -2584,7 +2584,7 @@  discard block
 block discarded – undo
2584 2584
                 }
2585 2585
             }
2586 2586
         }
2587
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2587
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2588 2588
         Database::query($sql);
2589 2589
 
2590 2590
         // Add event to system log
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
                 $value = Database::escape_string($options['value']);
2658 2658
                 $sql_query .= ' AND ';
2659 2659
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2660
-                    $sql_query .= $field . " $operator '" . $value . "'";
2660
+                    $sql_query .= $field." $operator '".$value."'";
2661 2661
                 }
2662 2662
             }
2663 2663
         }
@@ -2718,8 +2718,8 @@  discard block
 block discarded – undo
2718 2718
     {
2719 2719
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2720 2720
         $id = api_get_current_access_url_id();
2721
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2722
-                WHERE access_url_id = ' . $id . '
2721
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2722
+                WHERE access_url_id = ' . $id.'
2723 2723
                 ORDER BY name ASC';
2724 2724
         $result = Database::query($sql);
2725 2725
         if (Database::num_rows($result) > 0) {
@@ -2898,11 +2898,11 @@  discard block
 block discarded – undo
2898 2898
                         INNER JOIN $tbl_session_rel_access_url a ON (a.session_id = s.session_id)
2899 2899
                         WHERE
2900 2900
                             s.user_id = $userId AND
2901
-                            relation_type=" . SESSION_RELATION_TYPE_RRHH . " AND
2902
-                            access_url_id = " . api_get_current_access_url_id() . "";
2901
+                            relation_type=".SESSION_RELATION_TYPE_RRHH." AND
2902
+                            access_url_id = " . api_get_current_access_url_id()."";
2903 2903
             } else {
2904 2904
                 $sql = "SELECT session_id FROM $tbl_session_rel_user s
2905
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH . "";
2905
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH."";
2906 2906
             }
2907 2907
             $result = Database::query($sql);
2908 2908
 
@@ -2912,7 +2912,7 @@  discard block
 block discarded – undo
2912 2912
                             WHERE
2913 2913
                                 session_id = {$row['session_id']} AND
2914 2914
                                 user_id = $userId AND
2915
-                                relation_type=" . SESSION_RELATION_TYPE_RRHH . " ";
2915
+                                relation_type=".SESSION_RELATION_TYPE_RRHH." ";
2916 2916
                     Database::query($sql);
2917 2917
                 }
2918 2918
             }
@@ -2926,8 +2926,8 @@  discard block
 block discarded – undo
2926 2926
                         VALUES (
2927 2927
                             $session_id,
2928 2928
                             $userId,
2929
-                            '" . SESSION_RELATION_TYPE_RRHH . "',
2930
-                            '" . api_get_utc_datetime() . "'
2929
+                            '".SESSION_RELATION_TYPE_RRHH."',
2930
+                            '" . api_get_utc_datetime()."'
2931 2931
                         )";
2932 2932
 
2933 2933
                 Database::query($sql);
@@ -2969,8 +2969,8 @@  discard block
 block discarded – undo
2969 2969
                     WHERE
2970 2970
                         sru.user_id = '$userId' AND
2971 2971
                         sru.session_id = '$sessionId' AND
2972
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
2973
-                        access_url_id = " . api_get_current_access_url_id() . "
2972
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
2973
+                        access_url_id = " . api_get_current_access_url_id()."
2974 2974
                         ";
2975 2975
         } else {
2976 2976
             $sql = "$select FROM $tbl_session s
@@ -2979,7 +2979,7 @@  discard block
 block discarded – undo
2979 2979
                         sru.session_id = s.id AND
2980 2980
                         sru.user_id = '$userId' AND
2981 2981
                         sru.session_id = '$sessionId' AND
2982
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
2982
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
2983 2983
                     ";
2984 2984
         }
2985 2985
 
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 
3078 3078
         $limitCondition = null;
3079 3079
         if (!empty($start) && !empty($limit)) {
3080
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3080
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3081 3081
         }
3082 3082
 
3083 3083
         if (empty($orderCondition)) {
@@ -3155,26 +3155,26 @@  discard block
 block discarded – undo
3155 3155
 
3156 3156
         $sessions = array();
3157 3157
         if (Database::num_rows($result) > 0) {
3158
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3159
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3158
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3159
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3160 3160
             $imgPath = Display::returnIconPath('session_default_small.png');
3161 3161
 
3162 3162
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3163
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3163
+            $sql = "SELECT id FROM ".$tableExtraFields."
3164 3164
                     WHERE extra_field_type = 3 AND variable='image'";
3165 3165
             $resultField = Database::query($sql);
3166 3166
             $imageFieldId = Database::fetch_assoc($resultField);
3167 3167
 
3168 3168
             while ($row = Database::fetch_array($result)) {
3169 3169
 
3170
-                $row['image'] =  null;
3171
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3170
+                $row['image'] = null;
3171
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3172 3172
 
3173 3173
                 if (is_file($sessionImage)) {
3174
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3174
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3175 3175
                     $row['image'] = $sessionImage;
3176 3176
                 } else {
3177
-                    $row['image'] =  $imgPath;
3177
+                    $row['image'] = $imgPath;
3178 3178
                 }
3179 3179
 
3180 3180
                 $sessions[$row['id']] = $row;
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
                 return intval($count[0]);
3245 3245
             }
3246 3246
 
3247
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3247
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3248 3248
                 $courses[$row['real_id']] = $row;
3249 3249
             }
3250 3250
         }
@@ -3288,7 +3288,7 @@  discard block
 block discarded – undo
3288 3288
         }
3289 3289
 
3290 3290
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3291
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3291
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3292 3292
 
3293 3293
         if ($getCount) {
3294 3294
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3313,7 +3313,7 @@  discard block
 block discarded – undo
3313 3313
 		        ";
3314 3314
         if ($getCount) {
3315 3315
             $result = Database::query($sql);
3316
-            $row = Database::fetch_array($result,'ASSOC');
3316
+            $row = Database::fetch_array($result, 'ASSOC');
3317 3317
             return $row['count'];
3318 3318
         }
3319 3319
 
@@ -3328,7 +3328,7 @@  discard block
 block discarded – undo
3328 3328
         $courses = array();
3329 3329
 
3330 3330
         if ($num_rows > 0) {
3331
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3331
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3332 3332
                 $courses[$row['id']] = $row;
3333 3333
             }
3334 3334
         }
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
         $result = Database::query($sql);
3407 3407
         $num_rows = Database::num_rows($result);
3408 3408
         if ($num_rows > 0) {
3409
-            $row = Database::fetch_array($result,'ASSOC');
3409
+            $row = Database::fetch_array($result, 'ASSOC');
3410 3410
             return $row['count'];
3411 3411
         }
3412 3412
 
@@ -3518,9 +3518,9 @@  discard block
 block discarded – undo
3518 3518
 
3519 3519
             if ($access_url_id != -1) {
3520 3520
                 $sql = 'SELECT DISTINCT session.*
3521
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3521
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3522 3522
                     ON (session.id = session_rel_url.session_id)
3523
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3523
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3524 3524
             }
3525 3525
         }
3526 3526
         $sql .= ' ORDER by name';
@@ -3554,8 +3554,8 @@  discard block
 block discarded – undo
3554 3554
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3555 3555
                 WHERE
3556 3556
                     session_rcru.user_id = user.user_id AND
3557
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3558
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3557
+                    session_rcru.session_id = '".intval($session_id)."' AND
3558
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3559 3559
                     user.user_id = " . intval($user_id);
3560 3560
 
3561 3561
         $result = Database::query($sql);
@@ -3586,8 +3586,8 @@  discard block
 block discarded – undo
3586 3586
         $sql = "SELECT session_rcru.status
3587 3587
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3588 3588
                 WHERE session_rcru.user_id = user.user_id AND
3589
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3590
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3589
+                    session_rcru.session_id = '".intval($session_id)."' AND
3590
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3591 3591
                     user.user_id = " . intval($user_id);
3592 3592
         $result = Database::query($sql);
3593 3593
         $status = false;
@@ -3664,7 +3664,7 @@  discard block
 block discarded – undo
3664 3664
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3665 3665
         $now = time() - date('Z');
3666 3666
         // Timestamp in one month
3667
-        $inOneMonth = $now + (30*24*3600);
3667
+        $inOneMonth = $now + (30 * 24 * 3600);
3668 3668
         $inOneMonth = api_get_local_time($inOneMonth);
3669 3669
         if (api_strtotime($s['access_start_date']) < $now) {
3670 3670
             $s['access_start_date'] = api_get_local_time($now);
@@ -3686,16 +3686,16 @@  discard block
 block discarded – undo
3686 3686
         }
3687 3687
         // Now try to create the session
3688 3688
         $sid = self::create_session(
3689
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3689
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3690 3690
             $s['access_start_date'],
3691 3691
             $s['access_end_date'],
3692 3692
             $s['display_start_date'],
3693 3693
             $s['display_end_date'],
3694 3694
             $s['coach_access_start_date'],
3695 3695
             $s['coach_access_end_date'],
3696
-            (int)$s['id_coach'],
3696
+            (int) $s['id_coach'],
3697 3697
             $s['session_category_id'],
3698
-            (int)$s['visibility'],
3698
+            (int) $s['visibility'],
3699 3699
             true
3700 3700
         );
3701 3701
 
@@ -3809,7 +3809,7 @@  discard block
 block discarded – undo
3809 3809
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
3810 3810
         $sql = "SELECT DISTINCT id
3811 3811
 	         	FROM $session_table
3812
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
3812
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
3813 3813
         $result = Database::query($sql);
3814 3814
         if ($result && Database::num_rows($result)) {
3815 3815
             return true;
@@ -3828,7 +3828,7 @@  discard block
 block discarded – undo
3828 3828
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3829 3829
         $sql = "SELECT count(id) FROM $session_table s";
3830 3830
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
3831
-            $sql .= ", $access_url_rel_session_table u " .
3831
+            $sql .= ", $access_url_rel_session_table u ".
3832 3832
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
3833 3833
         }
3834 3834
         $res = Database::query($sql);
@@ -4075,7 +4075,7 @@  discard block
 block discarded – undo
4075 4075
 
4076 4076
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4077 4077
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4078
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4078
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4079 4079
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4080 4080
 
4081 4081
         $sessions = array();
@@ -4169,10 +4169,10 @@  discard block
 block discarded – undo
4169 4169
                     $suffix = null;
4170 4170
                     while (!$unique_name) {
4171 4171
                         if ($i > 1) {
4172
-                            $suffix = ' - ' . $i;
4172
+                            $suffix = ' - '.$i;
4173 4173
                         }
4174
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4175
-                                WHERE name="' . $session_name . $suffix . '"';
4174
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4175
+                                WHERE name="' . $session_name.$suffix.'"';
4176 4176
                         $rs = Database::query($sql);
4177 4177
 
4178 4178
                         if (Database::result($rs, 0, 0)) {
@@ -4190,13 +4190,13 @@  discard block
 block discarded – undo
4190 4190
 
4191 4191
                     // Creating the session.
4192 4192
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4193
-                            name = '" . $session_name . "',
4193
+                            name = '".$session_name."',
4194 4194
                             id_coach = '$coach_id',
4195 4195
                             access_start_date = '$date_start',
4196 4196
                             access_end_date = '$date_end',
4197 4197
                             visibility = '$visibilityAfterExpirationPerSession',
4198 4198
                             $sessionCondition
4199
-                            session_admin_id = " . intval($defaultUserId) . $extraParameters . $extraSessionParameters;
4199
+                            session_admin_id = ".intval($defaultUserId).$extraParameters.$extraSessionParameters;
4200 4200
                     Database::query($sql);
4201 4201
 
4202 4202
                     $session_id = Database::insert_id();
@@ -4236,7 +4236,7 @@  discard block
 block discarded – undo
4236 4236
                                 access_start_date = '$date_start',
4237 4237
                                 access_end_date = '$date_end',
4238 4238
                                 visibility = '$visibilityAfterExpirationPerSession',
4239
-                                session_category_id = '$session_category_id' " . $extraParameters . $extraSessionParameters;
4239
+                                session_category_id = '$session_category_id' ".$extraParameters.$extraSessionParameters;
4240 4240
 
4241 4241
                         Database::query($sql);
4242 4242
 
@@ -4256,7 +4256,7 @@  discard block
 block discarded – undo
4256 4256
 
4257 4257
                             // Delete session-user relation only for students
4258 4258
                             $sql = "DELETE FROM $tbl_session_user
4259
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4259
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4260 4260
                             Database::query($sql);
4261 4261
 
4262 4262
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4344,7 +4344,7 @@  discard block
 block discarded – undo
4344 4344
 
4345 4345
                             // Delete session-user relation only for students
4346 4346
                             $sql = "DELETE FROM $tbl_session_user
4347
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4347
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4348 4348
                             Database::query($sql);
4349 4349
 
4350 4350
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4387,7 +4387,7 @@  discard block
 block discarded – undo
4387 4387
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4388 4388
                                     user_id = '$user_id',
4389 4389
                                     session_id = '$session_id',
4390
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4390
+                                    registered_at = '".api_get_utc_datetime()."'";
4391 4391
                             Database::query($sql);
4392 4392
                             if ($debug) {
4393 4393
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5025,7 +5025,7 @@  discard block
 block discarded – undo
5025 5025
 
5026 5026
         if (!empty($lastConnectionDate)) {
5027 5027
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5028
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5028
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5029 5029
         }
5030 5030
 
5031 5031
         if (!empty($keyword)) {
@@ -5084,7 +5084,7 @@  discard block
 block discarded – undo
5084 5084
         $result = Database::query($sql);
5085 5085
         $result = Database::store_result($result);
5086 5086
 
5087
-        return $result ;
5087
+        return $result;
5088 5088
     }
5089 5089
 
5090 5090
     /**
@@ -5144,7 +5144,7 @@  discard block
 block discarded – undo
5144 5144
                     $userToString = null;
5145 5145
                     foreach ($userList as $userInfo) {
5146 5146
                         $newUserList[] = $userInfo['user_id'];
5147
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5147
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5148 5148
                     }
5149 5149
 
5150 5150
                     if (!empty($sessionsDestination)) {
@@ -5157,7 +5157,7 @@  discard block
 block discarded – undo
5157 5157
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5158 5158
                                 continue;
5159 5159
                             }
5160
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5160
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5161 5161
                             SessionManager::suscribe_users_to_session(
5162 5162
                                 $sessionDestinationId,
5163 5163
                                 $newUserList,
@@ -5208,7 +5208,7 @@  discard block
 block discarded – undo
5208 5208
                 }
5209 5209
             }
5210 5210
         }
5211
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5211
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5212 5212
 
5213 5213
         $htmlResult = null;
5214 5214
 
@@ -5223,7 +5223,7 @@  discard block
 block discarded – undo
5223 5223
                     $sessionInfo = self::fetch($sessionId);
5224 5224
                     $htmlResult .= '<br />';
5225 5225
                     $htmlResult .= Display::url(
5226
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5226
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5227 5227
                     );
5228 5228
                     $teacherList = array();
5229 5229
                     foreach ($coachList as $coachId) {
@@ -5336,7 +5336,7 @@  discard block
 block discarded – undo
5336 5336
                 }
5337 5337
 
5338 5338
                 $sessionIdList = array_map('intval', $sessionIdList);
5339
-                $sessionToString = implode("', '",  $sessionIdList);
5339
+                $sessionToString = implode("', '", $sessionIdList);
5340 5340
 
5341 5341
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5342 5342
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5348,7 +5348,7 @@  discard block
 block discarded – undo
5348 5348
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5349 5349
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5350 5350
                 $result = Database::query($sql);
5351
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5351
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5352 5352
                     $teacherListId[$row['user_id']] = $row['user_id'];
5353 5353
                 }
5354 5354
             } else {
@@ -5423,7 +5423,7 @@  discard block
 block discarded – undo
5423 5423
         $toolList = self::getCourseToolToBeManaged();
5424 5424
 
5425 5425
         foreach ($toolList as $tool) {
5426
-            $method = 'add' . $tool;
5426
+            $method = 'add'.$tool;
5427 5427
             if (method_exists(get_class(), $method)) {
5428 5428
                 self::$method($sessionId, $courseId);
5429 5429
             }
@@ -5442,7 +5442,7 @@  discard block
 block discarded – undo
5442 5442
         $toolList = self::getCourseToolToBeManaged();
5443 5443
 
5444 5444
         foreach ($toolList as $tool) {
5445
-            $method = 'remove' . $tool;
5445
+            $method = 'remove'.$tool;
5446 5446
             if (method_exists(get_class(), $method)) {
5447 5447
                 self::$method($sessionId, $courseId);
5448 5448
             }
@@ -5560,18 +5560,18 @@  discard block
 block discarded – undo
5560 5560
                         }
5561 5561
                     }
5562 5562
 
5563
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5563
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5564 5564
 
5565 5565
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5566
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5566
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5567 5567
                         continue;
5568 5568
                     }
5569 5569
 
5570 5570
                     if (!empty($sessionList)) {
5571
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5572
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5571
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5572
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5573 5573
                     } else {
5574
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5574
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5575 5575
                     }
5576 5576
                 }
5577 5577
             }
@@ -5751,8 +5751,8 @@  discard block
 block discarded – undo
5751 5751
 
5752 5752
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
5753 5753
 
5754
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
5755
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
5754
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
5755
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
5756 5756
 
5757 5757
         return $leftDays;
5758 5758
     }
@@ -6034,7 +6034,7 @@  discard block
 block discarded – undo
6034 6034
         $sql = "SELECT COUNT(1) as count, u.id, scu.status status_in_session, u.status user_status
6035 6035
                 FROM $tableSessionRelCourseRelUser scu
6036 6036
                 INNER JOIN $tableUser u ON scu.user_id = u.id
6037
-                WHERE scu.session_id = " . intval($sessionId) ."
6037
+                WHERE scu.session_id = ".intval($sessionId)."
6038 6038
                 GROUP BY u.id";
6039 6039
 
6040 6040
         $result = Database::query($sql);
@@ -6069,7 +6069,7 @@  discard block
 block discarded – undo
6069 6069
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6070 6070
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6071 6071
             // Join session field and session field values tables
6072
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6072
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6073 6073
             $fieldsArray = array();
6074 6074
             foreach ($extraFields as $field) {
6075 6075
                 $fieldsArray[] = Database::escape_string($field);
@@ -6112,14 +6112,14 @@  discard block
 block discarded – undo
6112 6112
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6113 6113
                     $whereParams .= ', ?';
6114 6114
                 }
6115
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6116
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6115
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6116
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6117 6117
             }
6118 6118
             // Get session fields
6119 6119
             $extraField = new ExtraField('session');
6120 6120
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6121 6121
             $fieldsList = $extraField->get_all(array(
6122
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6122
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6123 6123
             ));
6124 6124
             // Index session fields
6125 6125
             foreach ($fieldsList as $field) {
@@ -6128,7 +6128,7 @@  discard block
 block discarded – undo
6128 6128
             // Get session field values
6129 6129
             $extra = new ExtraFieldValue('session');
6130 6130
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6131
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6131
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6132 6132
             // Add session fields values to session list
6133 6133
             foreach ($sessionList as $id => &$session) {
6134 6134
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6181,7 +6181,7 @@  discard block
 block discarded – undo
6181 6181
             // Check the result
6182 6182
             if ($result < 1) {
6183 6183
                 // If not found any result, update error message
6184
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6184
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6185 6185
             } elseif (count($result) > 1 && !$force) {
6186 6186
                 // If found more than one result and force is disabled, update error message
6187 6187
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6240,7 +6240,7 @@  discard block
 block discarded – undo
6240 6240
             // Check if session list query had result
6241 6241
             if (!empty($sessionList)) {
6242 6242
                 // implode all session id
6243
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6243
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6244 6244
                 // Get all field variables
6245 6245
                 $sessionFieldList = Database::select(
6246 6246
                     'id, variable',
@@ -6327,7 +6327,7 @@  discard block
 block discarded – undo
6327 6327
                 return $sessionList;
6328 6328
             } else {
6329 6329
                 // Not found result, update error message
6330
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6330
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6331 6331
             }
6332 6332
         }
6333 6333
 
@@ -6431,7 +6431,7 @@  discard block
 block discarded – undo
6431 6431
 
6432 6432
         $sessionExtraField = new ExtraField('session');
6433 6433
         $fieldList = $sessionExtraField->get_all(array(
6434
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6434
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6435 6435
         ));
6436 6436
 
6437 6437
         $fields = array();
@@ -6445,7 +6445,7 @@  discard block
 block discarded – undo
6445 6445
         $extra = new ExtraFieldValue('session');
6446 6446
         $sessionFieldValueList = $extra->get_all(
6447 6447
             array(
6448
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6448
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6449 6449
             )
6450 6450
         );
6451 6451
 
@@ -6516,7 +6516,7 @@  discard block
 block discarded – undo
6516 6516
                 FROM $sessionTable s
6517 6517
                 INNER JOIN $sessionUserTable sru ON s.id = sru.id_session
6518 6518
                 WHERE
6519
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6519
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6520 6520
                     AND sru.relation_type = 0
6521 6521
                 )";
6522 6522
 
@@ -6532,7 +6532,7 @@  discard block
 block discarded – undo
6532 6532
                         WHERE
6533 6533
                             srau.access_url_id = $accessUrlId
6534 6534
                             AND (
6535
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6535
+                                sru.id_user IN (".implode(', ', $userIdList).")
6536 6536
                                 AND sru.relation_type = 0
6537 6537
                             )";
6538 6538
             }
@@ -6553,7 +6553,7 @@  discard block
 block discarded – undo
6553 6553
      */
6554 6554
     public static function getSessionVisibility($sessionInfo)
6555 6555
     {
6556
-        switch($sessionInfo['visibility']) {
6556
+        switch ($sessionInfo['visibility']) {
6557 6557
             case 1:
6558 6558
                 return get_lang('ReadOnly');
6559 6559
             case 2:
@@ -6584,7 +6584,7 @@  discard block
 block discarded – undo
6584 6584
 
6585 6585
         $result = '';
6586 6586
         if (!empty($startDateToLocal) && !empty($endDateToLocal)) {
6587
-            $result =  sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6587
+            $result = sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6588 6588
         } else {
6589 6589
             if (!empty($startDateToLocal)) {
6590 6590
                 $result = get_lang('From').' '.$startDateToLocal;
@@ -6727,7 +6727,7 @@  discard block
 block discarded – undo
6727 6727
                     get_lang('CoachName'),
6728 6728
                     null,
6729 6729
                     [
6730
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
6730
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
6731 6731
                         'width' => '100%',
6732 6732
                     ]
6733 6733
                 );
@@ -6738,7 +6738,7 @@  discard block
 block discarded – undo
6738 6738
         $form->addHtml('<div id="ajax_list_coachs"></div>');
6739 6739
 
6740 6740
         $form->addButtonAdvancedSettings('advanced_params');
6741
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
6741
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
6742 6742
 
6743 6743
         $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
6744 6744
             'id' => 'session_category'
@@ -6876,7 +6876,7 @@  discard block
 block discarded – undo
6876 6876
         $extra_field = new ExtraField('session');
6877 6877
         $extra = $extra_field->addElements($form, $sessionId);
6878 6878
 
6879
-        $form->addElement('html','</div>');
6879
+        $form->addElement('html', '</div>');
6880 6880
 
6881 6881
         $js = $extra['jquery_ready_content'];
6882 6882
 
@@ -6907,16 +6907,16 @@  discard block
 block discarded – undo
6907 6907
         if (api_is_session_admin() &&
6908 6908
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
6909 6909
         ) {
6910
-            $where.=" WHERE s.session_admin_id = $user_id ";
6910
+            $where .= " WHERE s.session_admin_id = $user_id ";
6911 6911
         }
6912 6912
 
6913 6913
         if (!empty($options['where'])) {
6914 6914
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
6915
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
6915
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
6916 6916
 
6917 6917
             $options['where'] = str_replace(
6918 6918
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
6919
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
6919
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
6920 6920
                 , $options['where']
6921 6921
             );
6922 6922
 
@@ -6958,10 +6958,10 @@  discard block
 block discarded – undo
6958 6958
                        $where ";
6959 6959
 
6960 6960
         if (api_is_multiple_url_enabled()) {
6961
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6961
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6962 6962
             $access_url_id = api_get_current_access_url_id();
6963 6963
             if ($access_url_id != -1) {
6964
-                $where.= " AND ar.access_url_id = $access_url_id ";
6964
+                $where .= " AND ar.access_url_id = $access_url_id ";
6965 6965
 
6966 6966
                 $query_rows = "SELECT count(*) as total_rows
6967 6967
                                FROM $tbl_session s
@@ -7006,12 +7006,12 @@  discard block
 block discarded – undo
7006 7006
                     //get_lang('CourseTitle'),
7007 7007
                     get_lang('Visibility'),
7008 7008
                 );
7009
-                $column_model = array (
7010
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7011
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7012
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7013
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7014
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7009
+                $column_model = array(
7010
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7011
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7012
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7013
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7014
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7015 7015
                 );
7016 7016
                 break;
7017 7017
             case 'complete':
@@ -7024,12 +7024,12 @@  discard block
 block discarded – undo
7024 7024
                     get_lang('Visibility'),
7025 7025
                     get_lang('CourseTitle'),
7026 7026
                 );
7027
-                $column_model = array (
7028
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7029
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7030
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7031
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7032
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7027
+                $column_model = array(
7028
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7029
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7030
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7031
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7032
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7033 7033
                         // for the bottom bar
7034 7034
                         'searchoptions' => array(
7035 7035
                             'defaultValue'  => '1',
@@ -7037,8 +7037,8 @@  discard block
 block discarded – undo
7037 7037
                         // for the top bar
7038 7038
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7039 7039
                     ),
7040
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7041
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7040
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7041
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7042 7042
                 );
7043 7043
                 break;
7044 7044
         }
@@ -7047,14 +7047,14 @@  discard block
 block discarded – undo
7047 7047
         $session_field = new ExtraField('session');
7048 7048
         $rules = $session_field->getRules($columns, $column_model);
7049 7049
 
7050
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7050
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7051 7051
         $columns[] = get_lang('Actions');
7052 7052
 
7053 7053
         foreach ($column_model as $col_model) {
7054 7054
             $simple_column_name[] = $col_model['name'];
7055 7055
         }
7056 7056
 
7057
-        $return_array =  array(
7057
+        $return_array = array(
7058 7058
             'columns' => $columns,
7059 7059
             'column_model' => $column_model,
7060 7060
             'rules' => $rules,
@@ -7143,7 +7143,7 @@  discard block
 block discarded – undo
7143 7143
             if (api_is_session_admin() &&
7144 7144
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7145 7145
             ) {
7146
-                $where.=" AND s.session_admin_id = $user_id ";
7146
+                $where .= " AND s.session_admin_id = $user_id ";
7147 7147
             }
7148 7148
         }
7149 7149
 
@@ -7226,11 +7226,11 @@  discard block
 block discarded – undo
7226 7226
             }
7227 7227
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7228 7228
 
7229
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7229
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7230 7230
 
7231 7231
             $options['where'] = str_replace(
7232 7232
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7233
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7233
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7234 7234
                 , $options['where']
7235 7235
             );
7236 7236
 
@@ -7265,10 +7265,10 @@  discard block
 block discarded – undo
7265 7265
             $where;
7266 7266
 
7267 7267
         if (api_is_multiple_url_enabled()) {
7268
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7268
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7269 7269
             $access_url_id = api_get_current_access_url_id();
7270 7270
             if ($access_url_id != -1) {
7271
-                $where.= " AND ar.access_url_id = $access_url_id ";
7271
+                $where .= " AND ar.access_url_id = $access_url_id ";
7272 7272
                 $query = "$select
7273 7273
                     FROM $tbl_session s
7274 7274
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7295,7 +7295,7 @@  discard block
 block discarded – undo
7295 7295
         $formatted_sessions = array();
7296 7296
 
7297 7297
         if (Database::num_rows($result)) {
7298
-            $sessions   = Database::store_result($result, 'ASSOC');
7298
+            $sessions = Database::store_result($result, 'ASSOC');
7299 7299
             foreach ($sessions as $session) {
7300 7300
                 $session_id = $session['id'];
7301 7301
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7310,14 +7310,14 @@  discard block
 block discarded – undo
7310 7310
 
7311 7311
                 switch ($session['visibility']) {
7312 7312
                     case SESSION_VISIBLE_READ_ONLY: //1
7313
-                        $session['visibility'] =  get_lang('ReadOnly');
7313
+                        $session['visibility'] = get_lang('ReadOnly');
7314 7314
                         break;
7315 7315
                     case SESSION_VISIBLE:           //2
7316 7316
                     case SESSION_AVAILABLE:         //4
7317
-                        $session['visibility'] =  get_lang('Visible');
7317
+                        $session['visibility'] = get_lang('Visible');
7318 7318
                         break;
7319 7319
                     case SESSION_INVISIBLE:         //3
7320
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7320
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7321 7321
                         break;
7322 7322
                 }
7323 7323
 
@@ -7393,7 +7393,7 @@  discard block
 block discarded – undo
7393 7393
         if (empty($session)) {
7394 7394
             return false;
7395 7395
         }
7396
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7396
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7397 7397
     }
7398 7398
 
7399 7399
     /**
@@ -7411,7 +7411,7 @@  discard block
 block discarded – undo
7411 7411
             return false;
7412 7412
         }
7413 7413
         if (empty($courseId)) {
7414
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7414
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7415 7415
         } else {
7416 7416
             $courseInfo = api_get_course_info_by_id($courseId);
7417 7417
             if ($courseInfo) {
@@ -7657,7 +7657,7 @@  discard block
 block discarded – undo
7657 7657
             // sort $listCat by catSessionName
7658 7658
             usort($listCat, 'self::compareBySessionName');
7659 7659
             // in each catSession sort sessionList by sessionName
7660
-            foreach($listCat as $i => $listCatSessionInfo) {
7660
+            foreach ($listCat as $i => $listCatSessionInfo) {
7661 7661
                 $listSessionList = $listCatSessionInfo['sessionList'];
7662 7662
                 usort($listSessionList, 'self::compareCatSessionInfo');
7663 7663
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -7672,8 +7672,8 @@  discard block
 block discarded – undo
7672 7672
             );
7673 7673
 
7674 7674
             $userCatId = intval($userCatId);
7675
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
7676
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
7675
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
7676
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
7677 7677
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
7678 7678
         }
7679 7679
 
@@ -7699,7 +7699,7 @@  discard block
 block discarded – undo
7699 7699
     {
7700 7700
         if ($listA['sessionName'] == $listB['sessionName']) {
7701 7701
             return 0;
7702
-        } else if($listA['sessionName'] > $listB['sessionName']) {
7702
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
7703 7703
             return 1;
7704 7704
         } else {
7705 7705
             return -1;
@@ -7719,7 +7719,7 @@  discard block
 block discarded – undo
7719 7719
             return 1;
7720 7720
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
7721 7721
             return 0;
7722
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
7722
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
7723 7723
             return 1;
7724 7724
         } else {
7725 7725
             return -1;
@@ -7735,7 +7735,7 @@  discard block
 block discarded – undo
7735 7735
     {
7736 7736
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
7737 7737
             return 0;
7738
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7738
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7739 7739
             return 1;
7740 7740
         } else {
7741 7741
             return -1;
@@ -7751,7 +7751,7 @@  discard block
 block discarded – undo
7751 7751
     {
7752 7752
         if ($listA['title'] == $listB['title']) {
7753 7753
             return 0;
7754
-        } else if($listA['title'] > $listB['title']) {
7754
+        } else if ($listA['title'] > $listB['title']) {
7755 7755
             return 1;
7756 7756
         } else {
7757 7757
             return -1;
@@ -7797,8 +7797,8 @@  discard block
 block discarded – undo
7797 7797
 
7798 7798
                 $marginShift = 20;
7799 7799
                 if ($catSessionName != '') {
7800
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
7801
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
7800
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
7801
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
7802 7802
                     $marginShift = 40;
7803 7803
                 }
7804 7804
 
Please login to merge, or discard this patch.
main/inc/lib/diagnoser.lib.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     const STATUS_OK = 1;
17 17
     const STATUS_WARNING = 2;
18
-    const STATUS_ERROR 	= 3;
18
+    const STATUS_ERROR = 3;
19 19
     const STATUS_INFORMATION = 4;
20 20
 
21 21
     /**
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
                 $html .= '<li>';
45 45
             }
46 46
             $params['section'] = $section;
47
-            $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
47
+            $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
48 48
         }
49 49
 
50 50
         $html .= '</ul><div class="tab-pane">';
51 51
 
52
-        $data = call_user_func(array($this, 'get_' . $current_section . '_data'));
52
+        $data = call_user_func(array($this, 'get_'.$current_section.'_data'));
53 53
         echo $html;
54 54
         $table = new SortableTableFromArray($data, 1, 100);
55 55
 
56
-        $table->set_header(0,'', false);
57
-        $table->set_header(1,get_lang('Section'), false);
58
-        $table->set_header(2,get_lang('Setting'), false);
59
-        $table->set_header(3,get_lang('Current'), false);
60
-        $table->set_header(4,get_lang('Expected'), false);
61
-        $table->set_header(5,get_lang('Comment'), false);
56
+        $table->set_header(0, '', false);
57
+        $table->set_header(1, get_lang('Section'), false);
58
+        $table->set_header(2, get_lang('Setting'), false);
59
+        $table->set_header(3, get_lang('Current'), false);
60
+        $table->set_header(4, get_lang('Expected'), false);
61
+        $table->set_header(5, get_lang('Comment'), false);
62 62
 
63 63
         $table->display();
64 64
         echo '</div></div>';
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $array = array();
74 74
         $writable_folders = array(
75
-            api_get_path(SYS_APP_PATH) .'cache',
75
+            api_get_path(SYS_APP_PATH).'cache',
76 76
             api_get_path(SYS_COURSE_PATH),
77
-            api_get_path(SYS_APP_PATH) .'home',
78
-            api_get_path(SYS_APP_PATH) .'upload/users/',
79
-            api_get_path(SYS_PATH) .'main/default_course_document/images/',
77
+            api_get_path(SYS_APP_PATH).'home',
78
+            api_get_path(SYS_APP_PATH).'upload/users/',
79
+            api_get_path(SYS_PATH).'main/default_course_document/images/',
80 80
         );
81 81
         foreach ($writable_folders as $index => $folder) {
82 82
             $writable = is_writable($folder);
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 
96 96
         $exists = file_exists(api_get_path(SYS_CODE_PATH).'install');
97 97
         $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK;
98
-        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
98
+        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
99 99
 
100 100
         $app_version = api_get_setting('chamilo_database_version');
101
-        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null,  'Chamilo DB version');
101
+        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version');
102 102
 
103 103
         return $array;
104 104
     }
@@ -165,33 +165,33 @@  discard block
 block discarded – undo
165 165
         $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo'));
166 166
 
167 167
         $setting = ini_get('max_execution_time');
168
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
168
+        $req_setting = '300 ('.get_lang('Minimum').')';
169 169
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
170 170
         $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo'));
171 171
 
172 172
         $setting = ini_get('max_input_time');
173
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
173
+        $req_setting = '300 ('.get_lang('Minimum').')';
174 174
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
175 175
         $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo'));
176 176
 
177 177
         $setting = ini_get('memory_limit');
178 178
         $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M';
179 179
         $status = self :: STATUS_ERROR;
180
-        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT)
180
+        if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT)
181 181
             $status = self :: STATUS_OK;
182 182
         $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo'));
183 183
 
184 184
         $setting = ini_get('post_max_size');
185 185
         $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M';
186 186
         $status = self :: STATUS_ERROR;
187
-        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE)
187
+        if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE)
188 188
             $status = self :: STATUS_OK;
189 189
         $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo'));
190 190
 
191 191
         $setting = ini_get('upload_max_filesize');
192 192
         $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M';
193 193
         $status = self :: STATUS_ERROR;
194
-        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
194
+        if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
195 195
             $status = self :: STATUS_OK;
196 196
         $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo'));
197 197
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
206 206
         $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo'));
207 207
 
208
-        if (api_check_browscap()){$setting = true;}else{$setting=false;}
208
+        if (api_check_browscap()) {$setting = true; } else {$setting = false; }
209 209
         $req_setting = true;
210 210
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
211 211
         $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo'));
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
             $loaded = extension_loaded($extension);
263 263
             $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR;
264
-            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
264
+            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
265 265
         }
266 266
 
267 267
         return $array;
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
         $formatted_expected_value = $expected_value;
385 385
 
386 386
         if ($formatter) {
387
-            if (method_exists($this, 'format_' . $formatter)) {
388
-                $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value);
389
-                $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value);
387
+            if (method_exists($this, 'format_'.$formatter)) {
388
+                $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value);
389
+                $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value);
390 390
             }
391 391
         }
392 392
 
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
      */
402 402
     public function get_link($title, $url)
403 403
     {
404
-        return '<a href="' . $url . '" target="about:bank">' . $title . '</a>';
404
+        return '<a href="'.$url.'" target="about:bank">'.$title.'</a>';
405 405
     }
406 406
 
407 407
     public function format_yes_no_optional($value)
408 408
     {
409 409
     	$return = '';
410
-    	switch($value) {
410
+    	switch ($value) {
411 411
      		case 0:
412 412
      			$return = get_lang('No');
413 413
      			break;
Please login to merge, or discard this patch.
main/inc/lib/tracking.lib.php 1 patch
Spacing   +423 added lines, -423 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $extendedAttempt = null,
112 112
         $extendedAll = null,
113 113
         $type = 'classic',
114
-        $allowExtend =  true
114
+        $allowExtend = true
115 115
     ) {
116 116
         if (empty($courseInfo) || empty($lp_id)) {
117 117
             return null;
@@ -135,22 +135,22 @@  discard block
 block discarded – undo
135 135
         $extend_all = 0;
136 136
 
137 137
         if ($origin == 'tracking') {
138
-            $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
138
+            $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin;
139 139
         } else {
140
-            $url_suffix = '&lp_id=' . $lp_id;
140
+            $url_suffix = '&lp_id='.$lp_id;
141 141
         }
142 142
 
143 143
         if (!empty($extendedAll)) {
144 144
             $extend_all_link = Display::url(
145 145
                 Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
146
-                api_get_self() . '?action=stats' . $url_suffix
146
+                api_get_self().'?action=stats'.$url_suffix
147 147
             );
148 148
 
149 149
             $extend_all = 1;
150 150
         } else {
151 151
             $extend_all_link = Display::url(
152 152
                 Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')),
153
-                api_get_self() . '?action=stats&extend_all=1' . $url_suffix
153
+                api_get_self().'?action=stats&extend_all=1'.$url_suffix
154 154
             );
155 155
         }
156 156
 
@@ -162,24 +162,24 @@  discard block
 block discarded – undo
162 162
 
163 163
         $actionColumn = null;
164 164
         if ($type == 'classic') {
165
-            $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
165
+            $actionColumn = ' <th>'.get_lang('Actions').'</th>';
166 166
         }
167 167
         $output .= '<div class="table-responsive">';
168 168
         $output .= '<table class="table tracking">
169 169
             <thead>
170 170
             <tr class="table-header">
171
-                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;') . '</th>
171
+                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;').'</th>
172 172
                 <th colspan="4">
173
-                    ' . get_lang('ScormLessonTitle') .'
173
+                    ' . get_lang('ScormLessonTitle').'
174 174
                 </th>
175 175
                 <th colspan="2">
176
-                    ' . get_lang('ScormStatus') . '
176
+                    ' . get_lang('ScormStatus').'
177 177
                 </th>
178 178
                 <th colspan="2">
179
-                    ' . get_lang('ScormScore') . '
179
+                    ' . get_lang('ScormScore').'
180 180
                 </th>
181 181
                 <th colspan="2">
182
-                    ' . get_lang('ScormTime') . '
182
+                    ' . get_lang('ScormTime').'
183 183
                 </th>
184 184
                 '.$actionColumn.'
185 185
                 </tr>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 // Prepare statement to go through each attempt.
243 243
                 $viewCondition = null;
244 244
                 if (!empty($view)) {
245
-                    $viewCondition =  " AND v.view_count = $view  ";
245
+                    $viewCondition = " AND v.view_count = $view  ";
246 246
                 }
247 247
 
248 248
                 $sql = "SELECT
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                                 FROM $TBL_QUIZ
291 291
                                 WHERE
292 292
                                     c_id = $course_id AND
293
-                                    id ='" . $my_path . "'";
293
+                                    id ='".$my_path."'";
294 294
                         $res_result_disabled = Database::query($sql);
295 295
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
296 296
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     if (!empty($inter_num)) {
313 313
                         $extend_link = Display::url(
314 314
                               Display::return_icon('visible.gif', get_lang('HideAttemptView')),
315
-                              api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
315
+                              api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix
316 316
                         );
317 317
                     }
318 318
                     $title = $row['mytitle'];
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
                     $action = null;
332 332
                     if ($type == 'classic') {
333
-                        $action =  '<td></td>';
333
+                        $action = '<td></td>';
334 334
                     }
335 335
 
336 336
                     if (in_array($row['item_type'], $chapterTypes)) {
@@ -374,13 +374,13 @@  discard block
 block discarded – undo
374 374
                                 $extend_this_attempt = 1;
375 375
                                 $extend_attempt_link = Display::url(
376 376
                                     Display::return_icon('visible.gif', get_lang('HideAttemptView')),
377
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
377
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
378 378
                                 );
379 379
                             } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
380 380
                                 // The extend button for this attempt has not been clicked.
381 381
                                 $extend_attempt_link = Display::url(
382 382
                                     Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
383
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
383
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
384 384
                                 );
385 385
                             }
386 386
                         }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         }
414 414
 
415 415
                         // Remove "NaN" if any (@todo: locate the source of these NaN)
416
-                        $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
416
+                        $time = str_replace('NaN', '00'.$h.'00\'00"', $time);
417 417
 
418 418
                         if ($row['item_type'] != 'dokeos_chapter') {
419 419
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
                                 $action = '<td></td>';
442 442
                             }
443 443
 
444
-                            $output .= '<tr class="' . $oddclass . '">
444
+                            $output .= '<tr class="'.$oddclass.'">
445 445
                                     <td></td>
446
-                                    <td>' . $extend_attempt_link . '</td>
447
-                                    <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td>
448
-                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
449
-                                    <td colspan="2">' . $view_score . '</td>
450
-                                    <td colspan="2">' . $time . '</td>
446
+                                    <td>' . $extend_attempt_link.'</td>
447
+                                    <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td>
448
+                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td>
449
+                                    <td colspan="2">' . $view_score.'</td>
450
+                                    <td colspan="2">' . $time.'</td>
451 451
                                     '.$action.'
452 452
                                 </tr>';
453 453
                             $attemptCount++;
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
                                     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
461 461
                                         $temp[] = '/';
462 462
                                     } else {
463
-                                        $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
463
+                                        $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
464 464
                                     }
465 465
                                 } else {
466
-                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
466
+                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
467 467
                                 }
468 468
                                 $temp[] = $time;
469 469
                                 $csv_content[] = $temp;
@@ -500,13 +500,13 @@  discard block
 block discarded – undo
500 500
                                         <td></td>
501 501
                                         <td></td>
502 502
                                         <td></td>
503
-                                        <td>'.$interaction['order_id'] . '</td>
504
-                                        <td>'.$interaction['id'] . '</td>
503
+                                        <td>'.$interaction['order_id'].'</td>
504
+                                        <td>'.$interaction['id'].'</td>
505 505
                                         <td colspan="2">' . $interaction['type'].'</td>
506
-                                        <td>'.$student_response . '</td>
507
-                                        <td>'.$interaction['result'] . '</td>
508
-                                        <td>'.$interaction['latency'] . '</td>
509
-                                        <td>'.$interaction['time'] . '</td>
506
+                                        <td>'.$student_response.'</td>
507
+                                        <td>'.$interaction['result'].'</td>
508
+                                        <td>'.$interaction['latency'].'</td>
509
+                                        <td>'.$interaction['time'].'</td>
510 510
                                         '.$action.'
511 511
                                     </tr>';
512 512
                                 $counter++;
@@ -523,12 +523,12 @@  discard block
 block discarded – undo
523 523
                                         <td></td>
524 524
                                         <td></td>
525 525
                                         <td></td>
526
-                                        <td>' . $interaction['order_id'] . '</td>
527
-                                        <td colspan="2">' . $interaction['objective_id'] . '</td>
528
-                                        <td colspan="2">' . $interaction['status'] .'</td>
529
-                                        <td>' . $interaction['score_raw'] . '</td>
530
-                                        <td>' . $interaction['score_max'] . '</td>
531
-                                        <td>' . $interaction['score_min'] . '</td>
526
+                                        <td>' . $interaction['order_id'].'</td>
527
+                                        <td colspan="2">' . $interaction['objective_id'].'</td>
528
+                                        <td colspan="2">' . $interaction['status'].'</td>
529
+                                        <td>' . $interaction['score_raw'].'</td>
530
+                                        <td>' . $interaction['score_max'].'</td>
531
+                                        <td>' . $interaction['score_min'].'</td>
532 532
                                         '.$action.'
533 533
                                      </tr>';
534 534
                                 $counter++;
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                         $my_path = Database::escape_string($my_path);
552 552
                         $sql = "SELECT results_disabled
553 553
                                 FROM $TBL_QUIZ
554
-                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
554
+                                WHERE c_id = $course_id AND id ='".$my_path."'";
555 555
                         $res_result_disabled = Database::query($sql);
556 556
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
557 557
 
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
                             $extend_this_attempt = 1;
576 576
                             $extend_attempt_link = Display::url(
577 577
                                 Display::return_icon('visible.gif', get_lang('HideAttemptView')),
578
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
578
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
579 579
                             );
580 580
                         } else {
581 581
                             // Same case if fold_attempt_id is set, so not implemented explicitly.
582 582
                             // The extend button for this attempt has not been clicked.
583 583
                             $extend_attempt_link = Display::url(
584 584
                                 Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
585
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
585
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
586 586
                             );
587 587
                         }
588 588
                     }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
                     if ($inter_num > 1) {
598 598
                         $extend_link = Display::url(
599 599
                             Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
600
-                            api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
600
+                            api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
601 601
                         );
602 602
                     }
603 603
 
@@ -613,15 +613,15 @@  discard block
 block discarded – undo
613 613
 
614 614
                     // Selecting the exe_id from stats attempts tables in order to look the max score value.
615 615
 
616
-                    $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
616
+                    $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
617 617
                              WHERE
618
-                                exe_exo_id="' . $row['path'] . '" AND
619
-                                exe_user_id="' . $user_id . '" AND
620
-                                orig_lp_id = "' . $lp_id . '" AND
621
-                                orig_lp_item_id = "' . $row['myid'] . '" AND
622
-                                c_id = ' . $course_id . ' AND
618
+                                exe_exo_id="' . $row['path'].'" AND
619
+                                exe_user_id="' . $user_id.'" AND
620
+                                orig_lp_id = "' . $lp_id.'" AND
621
+                                orig_lp_item_id = "' . $row['myid'].'" AND
622
+                                c_id = ' . $course_id.' AND
623 623
                                 status <> "incomplete" AND
624
-                                session_id = ' . $session_id . '
624
+                                session_id = ' . $session_id.'
625 625
                              ORDER BY exe_date DESC
626 626
                              LIMIT 1';
627 627
 
@@ -652,8 +652,8 @@  discard block
 block discarded – undo
652 652
                                         FROM $TBL_LP_ITEM_VIEW
653 653
                                         WHERE
654 654
                                             c_id = $course_id AND
655
-                                            lp_item_id = '" . (int) $my_id . "' AND
656
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'
655
+                                            lp_item_id = '".(int) $my_id."' AND
656
+                                            lp_view_id = '" . (int) $my_lp_view_id."'
657 657
                                         ORDER BY view_count DESC limit 1";
658 658
                                 $res_score = Database::query($sql);
659 659
                                 $row_score = Database::fetch_array($res_score);
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
                                         FROM $TBL_LP_ITEM_VIEW
663 663
                                         WHERE
664 664
                                             c_id = $course_id AND
665
-                                            lp_item_id = '" . (int) $my_id . "' AND
666
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'";
665
+                                            lp_item_id = '".(int) $my_id."' AND
666
+                                            lp_view_id = '" . (int) $my_lp_view_id."'";
667 667
                                 $res_time = Database::query($sql);
668 668
                                 $row_time = Database::fetch_array($res_time);
669 669
 
@@ -722,16 +722,16 @@  discard block
 block discarded – undo
722 722
                     } else {
723 723
                         $correct_test_link = '-';
724 724
                         if ($row['item_type'] == 'quiz') {
725
-                            $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin;
726
-                            $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
725
+                            $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin;
726
+                            $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
727 727
                                      WHERE
728
-                                        exe_exo_id="' . $row['path'] . '" AND
729
-                                        exe_user_id="' . $user_id . '" AND
730
-                                        orig_lp_id = "' . $lp_id . '" AND
731
-                                        orig_lp_item_id = "' . $row['myid'] . '" AND
732
-                                        c_id = ' . $course_id . ' AND
728
+                                        exe_exo_id="' . $row['path'].'" AND
729
+                                        exe_user_id="' . $user_id.'" AND
730
+                                        orig_lp_id = "' . $lp_id.'" AND
731
+                                        orig_lp_item_id = "' . $row['myid'].'" AND
732
+                                        c_id = ' . $course_id.' AND
733 733
                                         status <> "incomplete" AND
734
-                                        session_id = ' . $session_id . '
734
+                                        session_id = ' . $session_id.'
735 735
                                      ORDER BY exe_date DESC ';
736 736
 
737 737
                             $resultLastAttempt = Database::query($sql);
@@ -743,12 +743,12 @@  discard block
 block discarded – undo
743 743
                                 ) {
744 744
                                     $correct_test_link = Display::url(
745 745
                                         Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
746
-                                        api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
746
+                                        api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
747 747
                                     );
748 748
                                 } else {
749 749
                                     $correct_test_link = Display::url(
750 750
                                         Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')),
751
-                                        api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
751
+                                        api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
752 752
                                     );
753 753
                                 }
754 754
                             }
@@ -758,14 +758,14 @@  discard block
 block discarded – undo
758 758
 
759 759
                         $action = null;
760 760
                         if ($type == 'classic') {
761
-                            $action =  '<td>' . $correct_test_link . '</td>';
761
+                            $action = '<td>'.$correct_test_link.'</td>';
762 762
                         }
763 763
 
764 764
                         if ($lp_id == $my_lp_id && false) {
765 765
 
766
-                            $output .= '<tr class =' . $oddclass . '>
767
-                                    <td>' . $extend_link . '</td>
768
-                                    <td colspan="4">' . $title . '</td>
766
+                            $output .= '<tr class ='.$oddclass.'>
767
+                                    <td>' . $extend_link.'</td>
768
+                                    <td colspan="4">' . $title.'</td>
769 769
                                     <td colspan="2">&nbsp;</td>
770 770
                                     <td colspan="2">&nbsp;</td>
771 771
                                     <td colspan="2">&nbsp;</td>
@@ -790,13 +790,13 @@  discard block
 block discarded – undo
790 790
                                     $scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
791 791
                                 }
792 792
                             } else {
793
-                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
793
+                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore);
794 794
                             }
795 795
 
796 796
                             $output .= '
797 797
                                 <td>'.$extend_link.'</td>
798
-                                <td colspan="4">' . $title . '</td>
799
-                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td>
798
+                                <td colspan="4">' . $title.'</td>
799
+                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td>
800 800
                                 <td colspan="2">'.$scoreItem.'</td>
801 801
                                 <td colspan="2">'.$time.'</td>
802 802
                                 '.$action.'
@@ -813,10 +813,10 @@  discard block
 block discarded – undo
813 813
                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
814 814
                                     $temp[] = '/';
815 815
                                 } else {
816
-                                    $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
816
+                                    $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
817 817
                                 }
818 818
                             } else {
819
-                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
819
+                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
820 820
                             }
821 821
                             $temp[] = $time;
822 822
                             $csv_content[] = $temp;
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 
828 828
                     $action = null;
829 829
                     if ($type == 'classic') {
830
-                        $action =  '<td></td>';
830
+                        $action = '<td></td>';
831 831
                     }
832 832
 
833 833
                     if ($extend_this_attempt || $extend_all) {
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
                                     <td></td>
865 865
                                     <td></td>
866 866
                                     <td></td>
867
-                                    <td>' . $interaction['order_id'] . '</td>
868
-                                    <td colspan="2">'.$interaction['objective_id'] . '</td>
869
-                                    <td colspan="2">' . $interaction['status'] . '</td>
867
+                                    <td>' . $interaction['order_id'].'</td>
868
+                                    <td colspan="2">'.$interaction['objective_id'].'</td>
869
+                                    <td colspan="2">' . $interaction['status'].'</td>
870 870
                                     <td>' . $interaction['score_raw'].'</td>
871
-                                    <td>' . $interaction['score_max'] .'</td>
871
+                                    <td>' . $interaction['score_max'].'</td>
872 872
                                     <td>' . $interaction['score_min'].'</td>
873 873
                                     '.$action.'
874 874
                                </tr>';
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
                     }
878 878
 
879 879
                     // Attempts listing by exercise.
880
-                    if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) {
880
+                    if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) {
881 881
                         // Get attempts of a exercise.
882 882
                         if (!empty($lp_id) &&
883 883
                             !empty($lp_item_id) &&
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
                             $row_path = Database::fetch_array($res_path);
893 893
 
894 894
                             if (Database::num_rows($res_path) > 0) {
895
-                                $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
895
+                                $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
896 896
                                         WHERE
897
-                                            exe_exo_id="' . (int) $row_path['path'] . '" AND
897
+                                            exe_exo_id="' . (int) $row_path['path'].'" AND
898 898
                                             status <> "incomplete" AND
899
-                                            exe_user_id="' . $user_id . '" AND
900
-                                            orig_lp_id = "' . (int) $lp_id . '" AND
901
-                                            orig_lp_item_id = "' . (int) $lp_item_id . '" AND
902
-                                            c_id = ' . $course_id . '  AND
903
-                                            session_id = ' . $session_id . '
899
+                                            exe_user_id="' . $user_id.'" AND
900
+                                            orig_lp_id = "' . (int) $lp_id.'" AND
901
+                                            orig_lp_item_id = "' . (int) $lp_item_id.'" AND
902
+                                            c_id = ' . $course_id.'  AND
903
+                                            session_id = ' . $session_id.'
904 904
                                         ORDER BY exe_date';
905 905
                                 $res_attempts = Database::query($sql);
906 906
                                 $num_attempts = Database::num_rows($res_attempts);
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
                                         if ($mktime_start_date && $mktime_exe_date) {
919 919
                                             $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date);
920 920
                                             $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime);
921
-                                            $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
921
+                                            $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
922 922
                                         } else {
923 923
                                             $time_attemp = ' - ';
924 924
                                         }
@@ -944,33 +944,33 @@  discard block
 block discarded – undo
944 944
                                             $my_lesson_status = learnpathitem::humanize_status('incomplete');
945 945
                                         }
946 946
 
947
-                                        $output .= '<tr class="' . $oddclass . '" >
947
+                                        $output .= '<tr class="'.$oddclass.'" >
948 948
                                         <td></td>
949
-                                        <td>' . $extend_attempt_link . '</td>
950
-                                        <td colspan="3">' . get_lang('Attempt').' '. $n.'</td>
951
-                                        <td colspan="2">' . $my_lesson_status . '</td>
952
-                                        <td colspan="2">'.$view_score . '</td>
953
-                                        <td colspan="2">'.$time_attemp . '</td>';
949
+                                        <td>' . $extend_attempt_link.'</td>
950
+                                        <td colspan="3">' . get_lang('Attempt').' '.$n.'</td>
951
+                                        <td colspan="2">' . $my_lesson_status.'</td>
952
+                                        <td colspan="2">'.$view_score.'</td>
953
+                                        <td colspan="2">'.$time_attemp.'</td>';
954 954
                                         if ($action == 'classic') {
955 955
                                             if ($origin != 'tracking') {
956 956
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
957 957
                                                     $output .= '<td>
958
-                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
958
+                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
959 959
                                                             </td>';
960 960
                                                 } else {
961 961
                                                     $output .= '<td>
962
-                                                            <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
963
-                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
962
+                                                            <a href="../exercice/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent">
963
+                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
964 964
                                                             </a></td>';
965 965
                                                 }
966 966
                                             } else {
967 967
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
968 968
                                                     $output .= '<td>
969
-                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
969
+                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>';
970 970
                                                 } else {
971 971
                                                     $output .= '<td>
972
-                                                                    <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
973
-                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
972
+                                                                    <a href="../exercice/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent">
973
+                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
974 974
                                                 }
975 975
                                             }
976 976
                                         }
@@ -1029,13 +1029,13 @@  discard block
 block discarded – undo
1029 1029
         }
1030 1030
 
1031 1031
         $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
1032
-        $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
1032
+        $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time);
1033 1033
 
1034 1034
         if (!$is_allowed_to_edit && $result_disabled_ext_all) {
1035 1035
             $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
1036 1036
         } else {
1037 1037
             if (is_numeric($total_score)) {
1038
-                $final_score = $total_score . '%';
1038
+                $final_score = $total_score.'%';
1039 1039
             } else {
1040 1040
                 $final_score = $total_score;
1041 1041
             }
@@ -1051,19 +1051,19 @@  discard block
 block discarded – undo
1051 1051
 
1052 1052
         $action = null;
1053 1053
         if ($type == 'classic') {
1054
-            $action =  '<td></td>';
1054
+            $action = '<td></td>';
1055 1055
         }
1056 1056
 
1057 1057
         $output .= '<tr class="'.$oddclass.'">
1058 1058
                 <td></td>
1059 1059
                 <td colspan="4">
1060
-                    <i>' . get_lang('AccomplishedStepsTotal') .'</i>
1060
+                    <i>' . get_lang('AccomplishedStepsTotal').'</i>
1061 1061
                 </td>
1062 1062
                 <td colspan="2">'.$progress.'%</td>
1063 1063
                 <td colspan="2">
1064 1064
                     ' . $final_score.'
1065 1065
                 </td>
1066
-                <td colspan="2">' . $total_time . '</div>
1066
+                <td colspan="2">' . $total_time.'</div>
1067 1067
                 '.$action.'
1068 1068
            </tr>';
1069 1069
 
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
     	$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1360 1360
     	if (is_array($user_id)) {
1361 1361
     	    $user_id = array_map('intval', $user_id);
1362
-    		$condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1362
+    		$condition_user = " AND user_id IN (".implode(',', $user_id).") ";
1363 1363
     	} else {
1364 1364
     		$user_id = intval($user_id);
1365 1365
     		$condition_user = " AND user_id = $user_id ";
@@ -1396,13 +1396,13 @@  discard block
 block discarded – undo
1396 1396
     {
1397 1397
     	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1398 1398
     	$sql = 'SELECT login_date
1399
-    	        FROM ' . $tbl_track_login . '
1400
-                WHERE login_user_id = ' . intval($student_id) . '
1399
+    	        FROM ' . $tbl_track_login.'
1400
+                WHERE login_user_id = ' . intval($student_id).'
1401 1401
                 ORDER BY login_date ASC
1402 1402
                 LIMIT 0,1';
1403 1403
 
1404 1404
     	$rs = Database::query($sql);
1405
-    	if (Database::num_rows($rs)>0) {
1405
+    	if (Database::num_rows($rs) > 0) {
1406 1406
     		if ($first_login_date = Database::result($rs, 0, 0)) {
1407 1407
                 return api_convert_and_format_date(
1408 1408
                     $first_login_date,
@@ -1427,8 +1427,8 @@  discard block
 block discarded – undo
1427 1427
     {
1428 1428
     	$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1429 1429
     	$sql = 'SELECT login_date
1430
-    	        FROM ' . $table . '
1431
-                WHERE login_user_id = ' . intval($student_id) . '
1430
+    	        FROM ' . $table.'
1431
+                WHERE login_user_id = ' . intval($student_id).'
1432 1432
                 ORDER BY login_date
1433 1433
                 DESC LIMIT 0,1';
1434 1434
 
@@ -1437,18 +1437,18 @@  discard block
 block discarded – undo
1437 1437
     		if ($last_login_date = Database::result($rs, 0, 0)) {
1438 1438
     			$last_login_date = api_get_local_time($last_login_date);
1439 1439
     			if ($return_timestamp) {
1440
-    				return api_strtotime($last_login_date,'UTC');
1440
+    				return api_strtotime($last_login_date, 'UTC');
1441 1441
     			} else {
1442 1442
     				if (!$warning_message) {
1443 1443
     					return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1444 1444
     				} else {
1445
-    					$timestamp = api_strtotime($last_login_date,'UTC');
1445
+    					$timestamp = api_strtotime($last_login_date, 'UTC');
1446 1446
     					$currentTimestamp = time();
1447 1447
 
1448 1448
     					//If the last connection is > than 7 days, the text is red
1449 1449
     					//345600 = 7 days in seconds
1450 1450
     					if ($currentTimestamp - $timestamp > 604800) {
1451
-    						return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1451
+    						return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>';
1452 1452
     					} else {
1453 1453
     						return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1454 1454
     					}
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
         $sql = "$select
1484 1484
                 FROM $tbl_track_login
1485 1485
                 WHERE
1486
-                    login_user_id IN (' ". implode("','", $studentList) . "' ) AND
1486
+                    login_user_id IN (' ".implode("','", $studentList)."' ) AND
1487 1487
                     login_date < '$date'
1488 1488
                 ";
1489 1489
         $rs = Database::query($sql);
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
                               '.Display::return_icon('messagebox_warning.gif').'
1583 1583
                              </a>'
1584 1584
                             : null;
1585
-    					return $icon. Display::label($last_login_date, 'warning');
1585
+    					return $icon.Display::label($last_login_date, 'warning');
1586 1586
     				} else {
1587 1587
     					return $last_login_date;
1588 1588
     				}
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                     session_id = $session_id
1633 1633
                     $month_filter";
1634 1634
     	$rs = Database::query($sql);
1635
-    	if (Database::num_rows($rs)>0) {
1635
+    	if (Database::num_rows($rs) > 0) {
1636 1636
     		$row = Database::fetch_object($rs);
1637 1637
     		$count = $row->count_connections;
1638 1638
     	}
@@ -1653,14 +1653,14 @@  discard block
 block discarded – undo
1653 1653
     	$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1654 1654
 
1655 1655
     	$sql = 'SELECT DISTINCT c_id
1656
-                FROM ' . $tbl_course_rel_user . '
1656
+                FROM ' . $tbl_course_rel_user.'
1657 1657
                 WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH;
1658 1658
     	$rs = Database::query($sql);
1659 1659
     	$nb_courses = Database::num_rows($rs);
1660 1660
 
1661 1661
     	if ($include_sessions) {
1662 1662
     		$sql = 'SELECT DISTINCT c_id
1663
-                    FROM ' . $tbl_session_course_rel_user . '
1663
+                    FROM ' . $tbl_session_course_rel_user.'
1664 1664
                     WHERE user_id = ' . $user_id;
1665 1665
     		$rs = Database::query($sql);
1666 1666
     		$nb_courses += Database::num_rows($rs);
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
     		$condition_quiz = "";
1708 1708
     		if (!empty($exercise_id)) {
1709 1709
     			$exercise_id = intval($exercise_id);
1710
-    			$condition_quiz =" AND id = $exercise_id ";
1710
+    			$condition_quiz = " AND id = $exercise_id ";
1711 1711
     		}
1712 1712
 
1713 1713
     		// Compose a filter based on optional session id given
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
                         }
1757 1757
                     }
1758 1758
                     if (!empty($exercise_list)) {
1759
-                        $exercise_id = implode("','",$exercise_list);
1759
+                        $exercise_id = implode("','", $exercise_list);
1760 1760
                     }
1761 1761
     			}
1762 1762
 
@@ -1781,10 +1781,10 @@  discard block
 block discarded – undo
1781 1781
     			$quiz_avg_score = null;
1782 1782
 
1783 1783
     			if (!empty($row['avg_score'])) {
1784
-    				$quiz_avg_score = round($row['avg_score'],2);
1784
+    				$quiz_avg_score = round($row['avg_score'], 2);
1785 1785
     			}
1786 1786
 
1787
-    			if(!empty($row['num_attempts'])) {
1787
+    			if (!empty($row['num_attempts'])) {
1788 1788
     				$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1789 1789
     			}
1790 1790
     			if (is_array($student_id)) {
@@ -1914,7 +1914,7 @@  discard block
 block discarded – undo
1914 1914
             $row = Database::fetch_row($rs);
1915 1915
             $count = $row[0];
1916 1916
         }
1917
-        $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%';
1917
+        $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%';
1918 1918
         return $count;
1919 1919
     }
1920 1920
 
@@ -1939,7 +1939,7 @@  discard block
 block discarded – undo
1939 1939
                 );
1940 1940
 
1941 1941
                 if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) {
1942
-                    $result += $best_attempt['exe_result']/$best_attempt['exe_weighting'];
1942
+                    $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting'];
1943 1943
                 }
1944 1944
             }
1945 1945
             $result = $result / count($exercise_list);
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
         $query = sprintf($sql, intval($courseId), $sessionId);
1977 1977
         $rs = Database::query($query);
1978 1978
         $teachers = array();
1979
-        while ($teacher = Database::fetch_array($rs,'ASSOC')) {
1979
+        while ($teacher = Database::fetch_array($rs, 'ASSOC')) {
1980 1980
             $teachers[] = $teacher;
1981 1981
         }
1982 1982
         $data = array();
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
             $data[] = array(
2101 2101
                 'course' => $course['title'],
2102 2102
                 'session' => $teacher['name'],
2103
-                'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'],
2103
+                'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'],
2104 2104
                 'documents' => $totalDocuments,
2105 2105
                 'links' => $totalLinks,
2106 2106
                 'forums' => $totalForums,
@@ -2163,7 +2163,7 @@  discard block
 block discarded – undo
2163 2163
             for ($i = 0; $i < count($lPIds); $i++) {
2164 2164
                 $placeHolders[] = '?';
2165 2165
             }
2166
-            $lPConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lPIds;
2166
+            $lPConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lPIds;
2167 2167
         }
2168 2168
 
2169 2169
         if ($onlySeriousGame) {
@@ -2183,12 +2183,12 @@  discard block
 block discarded – undo
2183 2183
 
2184 2184
         $conditions = [
2185 2185
             " c_id = {$courseInfo['real_id']} ",
2186
-            " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") "
2186
+            " lp_view.lp_id IN(".implode(', ', $filteredLP).") "
2187 2187
         ];
2188 2188
 
2189 2189
         if (is_array($studentId)) {
2190 2190
             $studentId = array_map('intval', $studentId);
2191
-            $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ")  ";
2191
+            $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).")  ";
2192 2192
 
2193 2193
             $groupBy = 'GROUP BY lp_id';
2194 2194
         } else {
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
             // Compose a filter based on optional learning paths list given
2281 2281
             $condition_lp = "";
2282 2282
             if (count($lp_ids) > 0) {
2283
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2283
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2284 2284
             }
2285 2285
 
2286 2286
             // Compose a filter based on optional session id
@@ -2320,9 +2320,9 @@  discard block
 block discarded – undo
2320 2320
             // prepare filter on users
2321 2321
             if (is_array($student_id)) {
2322 2322
                 array_walk($student_id, 'intval');
2323
-                $condition_user1 =" AND user_id IN (".implode(',', $student_id).") ";
2323
+                $condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
2324 2324
             } else {
2325
-                $condition_user1 =" AND user_id = $student_id ";
2325
+                $condition_user1 = " AND user_id = $student_id ";
2326 2326
             }
2327 2327
 
2328 2328
             if ($count_row_lp > 0 && !empty($student_id)) {
@@ -2365,7 +2365,7 @@  discard block
 block discarded – undo
2365 2365
                                     ORDER BY lp_item_id";
2366 2366
                             $res_lp_item = Database::query($sql);
2367 2367
 
2368
-                            while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) {
2368
+                            while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) {
2369 2369
                                 $my_lp_item_id = $row_lp_item['lp_item_id'];
2370 2370
 
2371 2371
                                 // Getting the most recent attempt
@@ -2388,8 +2388,8 @@  discard block
 block discarded – undo
2388 2388
                                         ORDER BY view_count DESC
2389 2389
                                         LIMIT 1";
2390 2390
                                 $res_lp_item_result = Database::query($sql);
2391
-                                while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) {
2392
-                                    $list[]= $row_max_score;
2391
+                                while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) {
2392
+                                    $list[] = $row_max_score;
2393 2393
                                 }
2394 2394
                             }
2395 2395
                         } else {
@@ -2413,8 +2413,8 @@  discard block
 block discarded – undo
2413 2413
                             if ($debug) echo $sql.'<br />';
2414 2414
                             $res_max_score = Database::query($sql);
2415 2415
 
2416
-                            while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
2417
-                                $list[]= $row_max_score;
2416
+                            while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) {
2417
+                                $list[] = $row_max_score;
2418 2418
                             }
2419 2419
                         }
2420 2420
 
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2430 2430
                             $score = $row_max_score['score'];
2431 2431
 
2432
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2432
+                            if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2433 2433
 
2434 2434
                             if ($row_max_score['item_type'] == 'sco') {
2435 2435
                                 /* Check if it is sco (easier to get max_score)
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
                                 }
2448 2448
                                 // Avoid division by zero errors
2449 2449
                                 if (!empty($max_score)) {
2450
-                                    $lp_partial_total += $score/$max_score;
2450
+                                    $lp_partial_total += $score / $max_score;
2451 2451
                                 }
2452 2452
                                 if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2453 2453
                             } else {
@@ -2471,10 +2471,10 @@  discard block
 block discarded – undo
2471 2471
                                         ORDER BY exe_date DESC
2472 2472
                                         LIMIT 1";
2473 2473
 
2474
-                                if ($debug) echo $sql .'<br />';
2474
+                                if ($debug) echo $sql.'<br />';
2475 2475
                                 $result_last_attempt = Database::query($sql);
2476 2476
                                 $num = Database :: num_rows($result_last_attempt);
2477
-                                if ($num > 0 ) {
2477
+                                if ($num > 0) {
2478 2478
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2479 2479
                                     if ($debug) echo $id_last_attempt.'<br />';
2480 2480
 
@@ -2503,13 +2503,13 @@  discard block
 block discarded – undo
2503 2503
                                         $max_score = $row_max_score_bis['maxscore'];
2504 2504
                                     }
2505 2505
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2506
-                                        $lp_partial_total += $score/$max_score;
2506
+                                        $lp_partial_total += $score / $max_score;
2507 2507
                                     }
2508 2508
                                     if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2509 2509
                                 }
2510 2510
                             }
2511 2511
 
2512
-                            if (in_array($row_max_score['item_type'], array('quiz','sco'))) {
2512
+                            if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) {
2513 2513
                                 // Normal way
2514 2514
                                 if ($use_max_score[$lp_id]) {
2515 2515
                                     $count_items++;
@@ -2544,8 +2544,8 @@  discard block
 block discarded – undo
2544 2544
                     if ($debug) echo $sql;
2545 2545
                     $result_have_quiz = Database::query($sql);
2546 2546
 
2547
-                    if (Database::num_rows($result_have_quiz) > 0 ) {
2548
-                        $row = Database::fetch_array($result_have_quiz,'ASSOC');
2547
+                    if (Database::num_rows($result_have_quiz) > 0) {
2548
+                        $row = Database::fetch_array($result_have_quiz, 'ASSOC');
2549 2549
                         if (is_numeric($row['count']) && $row['count'] != 0) {
2550 2550
                             $lp_with_quiz++;
2551 2551
                         }
@@ -2557,7 +2557,7 @@  discard block
 block discarded – undo
2557 2557
 
2558 2558
                 if ($lp_with_quiz != 0) {
2559 2559
                     if (!$return_array) {
2560
-                        $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2560
+                        $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2);
2561 2561
                         if ($debug) var_dump($score_of_scorm_calculate);
2562 2562
                         if (empty($lp_ids)) {
2563 2563
                             if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
@@ -2631,9 +2631,9 @@  discard block
 block discarded – undo
2631 2631
 
2632 2632
         if (is_array($student_id)) {
2633 2633
             array_walk($student_id, 'intval');
2634
-            $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") ";
2634
+            $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") ";
2635 2635
         } else {
2636
-            $conditions[] =" lp_view.user_id = $student_id ";
2636
+            $conditions[] = " lp_view.user_id = $student_id ";
2637 2637
         }
2638 2638
 
2639 2639
         $conditionsToString = implode('AND ', $conditions);
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
             return 0;
2658 2658
         }
2659 2659
 
2660
-        return ($row['sum_score'] / $row['sum_max_score'])*100;
2660
+        return ($row['sum_score'] / $row['sum_max_score']) * 100;
2661 2661
 
2662 2662
     }
2663 2663
 
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
             // Compose a filter based on optional learning paths list given
2688 2688
             $condition_lp = "";
2689 2689
             if (count($lp_ids) > 0) {
2690
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2690
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2691 2691
             }
2692 2692
 
2693 2693
             // Compose a filter based on optional session id
@@ -2746,7 +2746,7 @@  discard block
 block discarded – undo
2746 2746
 
2747 2747
         if (!empty($course)) {
2748 2748
 
2749
-            $course_id	 = $course['real_id'];
2749
+            $course_id = $course['real_id'];
2750 2750
 
2751 2751
             $lp_table    = Database :: get_course_table(TABLE_LP_MAIN);
2752 2752
             $t_lpv       = Database :: get_course_table(TABLE_LP_VIEW);
@@ -2760,8 +2760,8 @@  discard block
 block discarded – undo
2760 2760
             // calculates last connection time
2761 2761
             if ($count_row_lp > 0) {
2762 2762
                 $sql = 'SELECT MAX(start_time)
2763
-                        FROM ' . $t_lpiv . ' AS item_view
2764
-                        INNER JOIN ' . $t_lpv . ' AS view
2763
+                        FROM ' . $t_lpiv.' AS item_view
2764
+                        INNER JOIN ' . $t_lpv.' AS view
2765 2765
                             ON item_view.lp_view_id = view.id
2766 2766
                         WHERE
2767 2767
                             item_view.c_id 		= '.$course_id.' AND
@@ -2797,15 +2797,15 @@  discard block
 block discarded – undo
2797 2797
 
2798 2798
         // At first, courses where $coach_id is coach of the course //
2799 2799
         $sql = 'SELECT session_id, c_id
2800
-                FROM ' . $tbl_session_course_user . '
2800
+                FROM ' . $tbl_session_course_user.'
2801 2801
                 WHERE user_id=' . $coach_id.' AND status=2';
2802 2802
 
2803 2803
         if (api_is_multiple_url_enabled()) {
2804
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2804
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2805 2805
             $access_url_id = api_get_current_access_url_id();
2806 2806
             if ($access_url_id != -1) {
2807 2807
                 $sql = 'SELECT scu.session_id, scu.c_id
2808
-                    FROM ' . $tbl_session_course_user . ' scu
2808
+                    FROM ' . $tbl_session_course_user.' scu
2809 2809
                     INNER JOIN '.$tbl_session_rel_access_url.'  sru
2810 2810
                     ON (scu.session_id=sru.session_id)
2811 2811
                     WHERE
@@ -2839,28 +2839,28 @@  discard block
 block discarded – undo
2839 2839
 
2840 2840
         // Then, courses where $coach_id is coach of the session    //
2841 2841
         $sql = 'SELECT session_course_user.user_id
2842
-                FROM ' . $tbl_session_course_user . ' as session_course_user
2842
+                FROM ' . $tbl_session_course_user.' as session_course_user
2843 2843
                 INNER JOIN     '.$tbl_session_user.' sru
2844 2844
                 ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id
2845
-                INNER JOIN ' . $tbl_session_course . ' as session_course
2845
+                INNER JOIN ' . $tbl_session_course.' as session_course
2846 2846
                 ON session_course.c_id = session_course_user.c_id
2847 2847
                 AND session_course_user.session_id = session_course.session_id
2848
-                INNER JOIN ' . $tbl_session . ' as session
2848
+                INNER JOIN ' . $tbl_session.' as session
2849 2849
                 ON session.id = session_course.session_id
2850 2850
                 AND session.id_coach = ' . $coach_id;
2851 2851
         if (api_is_multiple_url_enabled()) {
2852
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2852
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2853 2853
             $access_url_id = api_get_current_access_url_id();
2854
-            if ($access_url_id != -1){
2854
+            if ($access_url_id != -1) {
2855 2855
                 $sql = 'SELECT session_course_user.user_id
2856
-                        FROM ' . $tbl_session_course_user . ' as session_course_user
2856
+                        FROM ' . $tbl_session_course_user.' as session_course_user
2857 2857
                         INNER JOIN     '.$tbl_session_user.' sru
2858 2858
                             ON session_course_user.user_id = sru.user_id AND
2859 2859
                                session_course_user.session_id = sru.session_id
2860
-                        INNER JOIN ' . $tbl_session_course . ' as session_course
2860
+                        INNER JOIN ' . $tbl_session_course.' as session_course
2861 2861
                             ON session_course.c_id = session_course_user.c_id AND
2862 2862
                             session_course_user.session_id = session_course.session_id
2863
-                        INNER JOIN ' . $tbl_session . ' as session
2863
+                        INNER JOIN ' . $tbl_session.' as session
2864 2864
                             ON session.id = session_course.session_id AND
2865 2865
                             session.id_coach = ' . $coach_id.'
2866 2866
                         INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
@@ -2890,8 +2890,8 @@  discard block
 block discarded – undo
2890 2890
 
2891 2891
         $students = [];
2892 2892
         // At first, courses where $coach_id is coach of the course //
2893
-        $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . '
2894
-                WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2';
2893
+        $sql = 'SELECT c_id FROM '.$tbl_session_course_user.'
2894
+                WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2';
2895 2895
         $result = Database::query($sql);
2896 2896
 
2897 2897
         while ($a_courses = Database::fetch_array($result)) {
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
                     FROM $tbl_session_course_user AS srcru
2902 2902
                     WHERE
2903 2903
                         c_id = '$courseId' AND
2904
-                        session_id = '" . $id_session . "'";
2904
+                        session_id = '".$id_session."'";
2905 2905
             $rs = Database::query($sql);
2906 2906
             while ($row = Database::fetch_array($rs)) {
2907 2907
                 $students[$row['user_id']] = $row['user_id'];
@@ -2909,15 +2909,15 @@  discard block
 block discarded – undo
2909 2909
         }
2910 2910
 
2911 2911
         // Then, courses where $coach_id is coach of the session
2912
-        $sql = 'SELECT id_coach FROM ' . $tbl_session . '
2913
-                WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"';
2912
+        $sql = 'SELECT id_coach FROM '.$tbl_session.'
2913
+                WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"';
2914 2914
         $result = Database::query($sql);
2915 2915
 
2916 2916
         //He is the session_coach so we select all the users in the session
2917 2917
         if (Database::num_rows($result) > 0) {
2918 2918
             $sql = 'SELECT DISTINCT srcru.user_id
2919
-                    FROM ' . $tbl_session_course_user . ' AS srcru
2920
-                    WHERE session_id="' . $id_session . '"';
2919
+                    FROM ' . $tbl_session_course_user.' AS srcru
2920
+                    WHERE session_id="' . $id_session.'"';
2921 2921
             $result = Database::query($sql);
2922 2922
             while ($row = Database::fetch_array($result)) {
2923 2923
                 $students[$row['user_id']] = $row['user_id'];
@@ -2944,8 +2944,8 @@  discard block
 block discarded – undo
2944 2944
 
2945 2945
         // At first, courses where $coach_id is coach of the course //
2946 2946
 
2947
-        $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . '
2948
-                WHERE user_id=' . $coach_id .' AND status=2';
2947
+        $sql = 'SELECT 1 FROM '.$tbl_session_course_user.'
2948
+                WHERE user_id=' . $coach_id.' AND status=2';
2949 2949
         $result = Database::query($sql);
2950 2950
         if (Database::num_rows($result) > 0) {
2951 2951
             return true;
@@ -2953,12 +2953,12 @@  discard block
 block discarded – undo
2953 2953
 
2954 2954
         // Then, courses where $coach_id is coach of the session
2955 2955
         $sql = 'SELECT session_course_user.user_id
2956
-                FROM ' . $tbl_session_course_user . ' as session_course_user
2957
-                INNER JOIN ' . $tbl_session_course . ' as session_course
2956
+                FROM ' . $tbl_session_course_user.' as session_course_user
2957
+                INNER JOIN ' . $tbl_session_course.' as session_course
2958 2958
                     ON session_course.c_id = session_course_user.c_id
2959
-                INNER JOIN ' . $tbl_session . ' as session
2959
+                INNER JOIN ' . $tbl_session.' as session
2960 2960
                     ON session.id = session_course.session_id
2961
-                    AND session.id_coach = ' . $coach_id . '
2961
+                    AND session.id_coach = ' . $coach_id.'
2962 2962
                 WHERE user_id = ' . $student_id;
2963 2963
         $result = Database::query($sql);
2964 2964
         if (Database::num_rows($result) > 0) {
@@ -2990,16 +2990,16 @@  discard block
 block discarded – undo
2990 2990
         // At first, courses where $coach_id is coach of the course.
2991 2991
 
2992 2992
         $sql = 'SELECT DISTINCT c.code
2993
-                FROM ' . $tbl_session_course_user . ' sc
2993
+                FROM ' . $tbl_session_course_user.' sc
2994 2994
                 INNER JOIN '.$tbl_course.' c
2995 2995
                 ON (c.id = sc.c_id)
2996 2996
                 WHERE user_id = ' . $coach_id.' AND status = 2';
2997 2997
 
2998 2998
         if (api_is_multiple_url_enabled()) {
2999 2999
             $access_url_id = api_get_current_access_url_id();
3000
-            if ($access_url_id != -1){
3000
+            if ($access_url_id != -1) {
3001 3001
                 $sql = 'SELECT DISTINCT c.code
3002
-                        FROM ' . $tbl_session_course_user . ' scu
3002
+                        FROM ' . $tbl_session_course_user.' scu
3003 3003
                         INNER JOIN '.$tbl_course.' c
3004 3004
                         ON (c.code = scu.c_id)
3005 3005
                         INNER JOIN '.$tbl_course_rel_access_url.' cru
@@ -3012,7 +3012,7 @@  discard block
 block discarded – undo
3012 3012
         }
3013 3013
 
3014 3014
         if (!empty($id_session)) {
3015
-            $sql .= ' AND session_id=' . $id_session;
3015
+            $sql .= ' AND session_id='.$id_session;
3016 3016
         }
3017 3017
 
3018 3018
         $courseList = array();
@@ -3024,25 +3024,25 @@  discard block
 block discarded – undo
3024 3024
         // Then, courses where $coach_id is coach of the session
3025 3025
 
3026 3026
         $sql = 'SELECT DISTINCT course.code
3027
-                FROM ' . $tbl_session_course . ' as session_course
3028
-                INNER JOIN ' . $tbl_session . ' as session
3027
+                FROM ' . $tbl_session_course.' as session_course
3028
+                INNER JOIN ' . $tbl_session.' as session
3029 3029
                     ON session.id = session_course.session_id
3030
-                    AND session.id_coach = ' . $coach_id . '
3031
-                INNER JOIN ' . $tbl_course . ' as course
3030
+                    AND session.id_coach = ' . $coach_id.'
3031
+                INNER JOIN ' . $tbl_course.' as course
3032 3032
                     ON course.id = session_course.c_id';
3033 3033
 
3034 3034
         if (api_is_multiple_url_enabled()) {
3035 3035
             $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
3036 3036
             $access_url_id = api_get_current_access_url_id();
3037
-            if ($access_url_id != -1){
3037
+            if ($access_url_id != -1) {
3038 3038
                 $sql = 'SELECT DISTINCT c.code
3039
-                    FROM ' . $tbl_session_course . ' as session_course
3039
+                    FROM ' . $tbl_session_course.' as session_course
3040 3040
                     INNER JOIN '.$tbl_course.' c
3041 3041
                     ON (c.id = session_course.c_id)
3042
-                    INNER JOIN ' . $tbl_session . ' as session
3042
+                    INNER JOIN ' . $tbl_session.' as session
3043 3043
                     ON session.id = session_course.session_id
3044
-                        AND session.id_coach = ' . $coach_id . '
3045
-                    INNER JOIN ' . $tbl_course . ' as course
3044
+                        AND session.id_coach = ' . $coach_id.'
3045
+                    INNER JOIN ' . $tbl_course.' as course
3046 3046
                         ON course.id = session_course.c_id
3047 3047
                      INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url
3048 3048
                     ON (course_rel_url.c_id = c.id)';
@@ -3050,12 +3050,12 @@  discard block
 block discarded – undo
3050 3050
         }
3051 3051
 
3052 3052
         if (!empty ($id_session)) {
3053
-            $sql .= ' WHERE session_course.session_id=' . $id_session;
3053
+            $sql .= ' WHERE session_course.session_id='.$id_session;
3054 3054
             if (api_is_multiple_url_enabled())
3055
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3056
-        }  else {
3055
+            $sql .= ' AND access_url_id = '.$access_url_id;
3056
+        } else {
3057 3057
             if (api_is_multiple_url_enabled())
3058
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3058
+            $sql .= ' WHERE access_url_id = '.$access_url_id;
3059 3059
         }
3060 3060
 
3061 3061
         $result = Database::query($sql);
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
             }
3112 3112
         }
3113 3113
 
3114
-        $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3114
+        $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3115 3115
         $access_url_id = api_get_current_access_url_id();
3116 3116
 
3117 3117
         $sql = "
@@ -3231,7 +3231,7 @@  discard block
 block discarded – undo
3231 3231
             // table definition
3232 3232
             $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
3233 3233
             $tbl_document = Database :: get_course_table(TABLE_DOCUMENT);
3234
-            $course_id	 = $a_course['real_id'];
3234
+            $course_id = $a_course['real_id'];
3235 3235
             if (is_array($student_id)) {
3236 3236
                 $studentList = array_map('intval', $student_id);
3237 3237
                 $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') ";
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
         $a_course = CourseManager::get_course_information($course_code);
3283 3283
         if (!empty($a_course)) {
3284 3284
             $course_id = $a_course['real_id'];
3285
-            $conditions[]= " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3285
+            $conditions[] = " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3286 3286
         }
3287 3287
 
3288 3288
         // table definition
@@ -3291,14 +3291,14 @@  discard block
 block discarded – undo
3291 3291
 
3292 3292
         if (is_array($student_id)) {
3293 3293
             $studentList = array_map('intval', $student_id);
3294
-            $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3294
+            $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3295 3295
         } else {
3296 3296
             $student_id = intval($student_id);
3297
-            $conditions[]= " ip.insert_user_id = '$student_id' ";
3297
+            $conditions[] = " ip.insert_user_id = '$student_id' ";
3298 3298
         }
3299 3299
         if (isset($session_id)) {
3300 3300
             $session_id = intval($session_id);
3301
-            $conditions[]= " pub.session_id = $session_id ";
3301
+            $conditions[] = " pub.session_id = $session_id ";
3302 3302
         }
3303 3303
         $conditionToString = implode('AND', $conditions);
3304 3304
 
@@ -3331,8 +3331,8 @@  discard block
 block discarded – undo
3331 3331
         $courseCondition = null;
3332 3332
         $conditions = array();
3333 3333
         if (!empty($courseInfo)) {
3334
-            $course_id	    = $courseInfo['real_id'];
3335
-            $conditions[]= " post.c_id  = $course_id AND forum.c_id = $course_id ";
3334
+            $course_id = $courseInfo['real_id'];
3335
+            $conditions[] = " post.c_id  = $course_id AND forum.c_id = $course_id ";
3336 3336
         }
3337 3337
 
3338 3338
         // Table definition.
@@ -3341,15 +3341,15 @@  discard block
 block discarded – undo
3341 3341
 
3342 3342
         if (is_array($student_id)) {
3343 3343
             $studentList = array_map('intval', $student_id);
3344
-            $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') ";
3344
+            $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') ";
3345 3345
         } else {
3346 3346
             $student_id = intval($student_id);
3347
-            $conditions[]= " post.poster_id = '$student_id' ";
3347
+            $conditions[] = " post.poster_id = '$student_id' ";
3348 3348
         }
3349 3349
 
3350 3350
         if (isset($session_id)) {
3351 3351
             $session_id = intval($session_id);
3352
-            $conditions[]= " forum.session_id = $session_id";
3352
+            $conditions[] = " forum.session_id = $session_id";
3353 3353
         }
3354 3354
 
3355 3355
         $conditionsToString = implode('AND ', $conditions);
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
             $condition_session = '';
3385 3385
             if (isset($session_id)) {
3386 3386
                 $session_id = intval($session_id);
3387
-                $condition_session = api_get_session_condition($session_id, true,  false, 'f.session_id');
3387
+                $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id');
3388 3388
             }
3389 3389
 
3390 3390
             $course_id = $courseInfo['real_id'];
@@ -3440,7 +3440,7 @@  discard block
 block discarded – undo
3440 3440
         $condition_session = '';
3441 3441
         if (isset($session_id)) {
3442 3442
             $session_id = intval($session_id);
3443
-            $condition_session = ' AND f.session_id = '. $session_id;
3443
+            $condition_session = ' AND f.session_id = '.$session_id;
3444 3444
         }
3445 3445
 
3446 3446
         $groupId = intval($groupId);
@@ -3501,7 +3501,7 @@  discard block
 block discarded – undo
3501 3501
         $condition_session = '';
3502 3502
         if (isset($session_id)) {
3503 3503
              $session_id = intval($session_id);
3504
-             $condition_session = ' AND f.session_id = '. $session_id;
3504
+             $condition_session = ' AND f.session_id = '.$session_id;
3505 3505
         }
3506 3506
 
3507 3507
         $groupId = intval($groupId);
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
     {
3581 3581
         $student_id = intval($student_id);
3582 3582
         $courseId = intval($courseId);
3583
-        $session_id    = intval($session_id);
3583
+        $session_id = intval($session_id);
3584 3584
         $date_time  = '';
3585 3585
 
3586 3586
         // table definition
@@ -3649,7 +3649,7 @@  discard block
 block discarded – undo
3649 3649
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
3650 3650
 
3651 3651
         $sql = 'SELECT 1
3652
-                FROM ' . $table . '
3652
+                FROM ' . $table.'
3653 3653
                 WHERE down_user_id = '.$student_id.'
3654 3654
                 AND c_id  = "'.$courseId.'"
3655 3655
                 AND down_session_id = '.$session_id.' ';
@@ -3727,30 +3727,30 @@  discard block
 block discarded – undo
3727 3727
                 '.$inner.'
3728 3728
                 WHERE c.id = '.$courseId.'
3729 3729
                 GROUP BY stats_login.user_id
3730
-                HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date ';
3730
+                HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date ';
3731 3731
 
3732 3732
         if ($since == 'never') {
3733 3733
             if (empty($session_id)) {
3734 3734
                 $sql = 'SELECT course_user.user_id
3735
-                        FROM ' . $table_course_rel_user . ' course_user
3736
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3735
+                        FROM ' . $table_course_rel_user.' course_user
3736
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3737 3737
                         ON course_user.user_id = stats_login.user_id AND
3738
-                        relation_type<>' . COURSE_RELATION_TYPE_RRHH . '
3739
-                        INNER JOIN ' . $tableCourse . ' c
3738
+                        relation_type<>' . COURSE_RELATION_TYPE_RRHH.'
3739
+                        INNER JOIN ' . $tableCourse.' c
3740 3740
                         ON (c.id = course_user.c_id)
3741 3741
                         WHERE
3742
-                            course_user.c_id = ' . $courseId . ' AND
3742
+                            course_user.c_id = ' . $courseId.' AND
3743 3743
                             stats_login.login_course_date IS NULL
3744 3744
                         GROUP BY course_user.user_id';
3745 3745
             } else {
3746 3746
                 $sql = 'SELECT session_course_user.user_id
3747 3747
                         FROM '.$tbl_session_course_user.' session_course_user
3748
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3748
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3749 3749
                         ON session_course_user.user_id = stats_login.user_id
3750
-                        INNER JOIN ' . $tableCourse . ' c
3750
+                        INNER JOIN ' . $tableCourse.' c
3751 3751
                         ON (c.id = session_course_user.c_id)
3752 3752
                         WHERE
3753
-                            session_course_user.c_id = ' . $courseId . ' AND
3753
+                            session_course_user.c_id = ' . $courseId.' AND
3754 3754
                             stats_login.login_course_date IS NULL
3755 3755
                         GROUP BY session_course_user.user_id';
3756 3756
 
@@ -3759,7 +3759,7 @@  discard block
 block discarded – undo
3759 3759
 
3760 3760
         $rs = Database::query($sql);
3761 3761
         $inactive_users = array();
3762
-        while($user = Database::fetch_array($rs)) {
3762
+        while ($user = Database::fetch_array($rs)) {
3763 3763
             $inactive_users[] = $user['user_id'];
3764 3764
         }
3765 3765
 
@@ -3781,10 +3781,10 @@  discard block
 block discarded – undo
3781 3781
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
3782 3782
 
3783 3783
         $sql = 'SELECT '.$student_id.'
3784
-                FROM ' . $table . '
3784
+                FROM ' . $table.'
3785 3785
                 WHERE
3786
-                    access_user_id=' . $student_id . ' AND
3787
-                    c_id="' . $courseId . '" AND
3786
+                    access_user_id=' . $student_id.' AND
3787
+                    c_id="' . $courseId.'" AND
3788 3788
                     access_session_id = "'.$session_id.'" ';
3789 3789
 
3790 3790
         $rs = Database::query($sql);
@@ -3802,13 +3802,13 @@  discard block
 block discarded – undo
3802 3802
     {
3803 3803
         $hr_dept_id = intval($hr_dept_id);
3804 3804
         $a_students = array();
3805
-        $tbl_user     = Database :: get_main_table(TABLE_MAIN_USER);
3805
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
3806 3806
 
3807 3807
         $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user
3808 3808
                 WHERE hr_dept_id='.$hr_dept_id;
3809 3809
         $rs = Database::query($sql);
3810 3810
 
3811
-        while($user = Database :: fetch_array($rs)) {
3811
+        while ($user = Database :: fetch_array($rs)) {
3812 3812
             $a_students[$user['user_id']] = $user['user_id'];
3813 3813
         }
3814 3814
 
@@ -3833,7 +3833,7 @@  discard block
 block discarded – undo
3833 3833
         $condition_session     = '';
3834 3834
         if (isset($session_id)) {
3835 3835
             $session_id = intval($session_id);
3836
-            $condition_session = ' AND access_session_id = '. $session_id;
3836
+            $condition_session = ' AND access_session_id = '.$session_id;
3837 3837
         }
3838 3838
         $sql = "SELECT
3839 3839
                     access_tool,
@@ -3945,7 +3945,7 @@  discard block
 block discarded – undo
3945 3945
             if (!empty($date_from) && !empty($date_to)) {
3946 3946
                 $fieldStartDate = $fields['start_date'];
3947 3947
                 if (!isset($fields['end_date'])) {
3948
-                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ;
3948
+                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to);
3949 3949
                 } else {
3950 3950
                     $fieldEndDate = $fields['end_date'];
3951 3951
                     $where .= sprintf(" AND fieldStartDate >= '%s'
@@ -3961,12 +3961,12 @@  discard block
 block discarded – undo
3961 3961
                 $where
3962 3962
                 GROUP BY %s";
3963 3963
             $sql = sprintf($sql,
3964
-                $fields['user'],    //user field
3965
-                $tableName,         //FROM
3966
-                $fields['course'],  //course condition
3967
-                $course['real_id'],    //course condition
3968
-                $fields['user'],    //user condition
3969
-                $userId,            //user condition
3964
+                $fields['user'], //user field
3965
+                $tableName, //FROM
3966
+                $fields['course'], //course condition
3967
+                $course['real_id'], //course condition
3968
+                $fields['user'], //user condition
3969
+                $userId, //user condition
3970 3970
                 $fields['user']     //GROUP BY
3971 3971
                 );
3972 3972
             $rs = Database::query($sql);
@@ -3974,7 +3974,7 @@  discard block
 block discarded – undo
3974 3974
             //iterate query
3975 3975
             if (Database::num_rows($rs) > 0) {
3976 3976
                 while ($row = Database::fetch_array($rs)) {
3977
-                    $data[$row['user']] = (isset($data[$row['user']])) ?  $data[$row['user']] + $row[total]: $row['total'];
3977
+                    $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total'];
3978 3978
                 }
3979 3979
             }
3980 3980
         }
@@ -3997,11 +3997,11 @@  discard block
 block discarded – undo
3997 3997
         $courseId = api_get_course_int_id($course_code);
3998 3998
         $data = array();
3999 3999
 
4000
-        $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4000
+        $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4001 4001
         $condition_session = '';
4002 4002
         if (isset($session_id)) {
4003 4003
             $session_id = intval($session_id);
4004
-            $condition_session = ' AND down_session_id = '. $session_id;
4004
+            $condition_session = ' AND down_session_id = '.$session_id;
4005 4005
         }
4006 4006
         $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down
4007 4007
                 FROM $TABLETRACK_DOWNLOADS
@@ -4186,7 +4186,7 @@  discard block
 block discarded – undo
4186 4186
 
4187 4187
             $final_course_data = array();
4188 4188
 
4189
-            foreach($my_course_data as $course_id => $value) {
4189
+            foreach ($my_course_data as $course_id => $value) {
4190 4190
                 $final_course_data[$course_id] = $course_list[$course_id];
4191 4191
             }
4192 4192
             $course_in_session[$my_session_id]['course_list'] = $final_course_data;
@@ -4207,7 +4207,7 @@  discard block
 block discarded – undo
4207 4207
                           '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
4208 4208
                           '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4209 4209
                           '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
4210
-                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).'
4210
+                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4211 4211
                           '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4212 4212
                           '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4213 4213
                         </tr>';
@@ -4294,7 +4294,7 @@  discard block
 block discarded – undo
4294 4294
             $all_exercise_start_time = array();
4295 4295
 
4296 4296
             foreach ($course_in_session as $my_session_id => $session_data) {
4297
-                $course_list  = $session_data['course_list'];
4297
+                $course_list = $session_data['course_list'];
4298 4298
                 $user_count = count(SessionManager::get_users_by_session($my_session_id));
4299 4299
                 $exercise_graph_name_list = array();
4300 4300
                 //$user_results = array();
@@ -4339,20 +4339,20 @@  discard block
 block discarded – undo
4339 4339
 
4340 4340
                             $score = 0;
4341 4341
                             if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
4342
-                                $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
4342
+                                $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
4343 4343
                             }
4344 4344
                             $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
4345 4345
                             $all_exercise_start_time[] = $time;
4346 4346
                             $my_results[] = $score;
4347
-                            if (count($exercise_list)<=10) {
4347
+                            if (count($exercise_list) <= 10) {
4348 4348
                                 $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
4349
-                                $exercise_graph_name_list[]= $title;
4349
+                                $exercise_graph_name_list[] = $title;
4350 4350
                                 $all_exercise_graph_name_list[] = $title;
4351 4351
                             } else {
4352 4352
                                 // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
4353 4353
                                 $title = cut($exercise_data['title'], 30);
4354
-                                $exercise_graph_name_list[]= $title;
4355
-                                $all_exercise_graph_name_list[]= $title;
4354
+                                $exercise_graph_name_list[] = $title;
4355
+                                $all_exercise_graph_name_list[] = $title;
4356 4356
                             }
4357 4357
                         }
4358 4358
                     }
@@ -4385,7 +4385,7 @@  discard block
 block discarded – undo
4385 4385
             }
4386 4386
 
4387 4387
             $html .= Display::page_subheader(
4388
-                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions')
4388
+                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions')
4389 4389
             );
4390 4390
 
4391 4391
             $html .= '<table class="data_table" width="100%">';
@@ -4435,7 +4435,7 @@  discard block
 block discarded – undo
4435 4435
                                 $courseInfo['real_id'],
4436 4436
                                 $my_session_id
4437 4437
                             );
4438
-                            if ($attempts > 1)  {
4438
+                            if ($attempts > 1) {
4439 4439
                                 $answered_exercises++;
4440 4440
                             }
4441 4441
                         }
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
                     $all_average += $average;
4449 4449
                 }
4450 4450
 
4451
-                $all_average = $all_average /  count($course_list);
4451
+                $all_average = $all_average / count($course_list);
4452 4452
 
4453 4453
                 if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
4454 4454
                     $html .= '<tr style="background-color:#FBF09D">';
@@ -4473,31 +4473,31 @@  discard block
 block discarded – undo
4473 4473
                 $html .= '</tr>';
4474 4474
             }
4475 4475
             $html .= '</table><br />';
4476
-            $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
4476
+            $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;'));
4477 4477
 
4478 4478
             // Checking selected session.
4479 4479
 
4480 4480
             if (isset($_GET['session_id'])) {
4481 4481
                 $session_id_from_get = intval($_GET['session_id']);
4482
-                $session_data 	= $course_in_session[$session_id_from_get];
4483
-                $course_list 	= $session_data['course_list'];
4482
+                $session_data = $course_in_session[$session_id_from_get];
4483
+                $course_list = $session_data['course_list'];
4484 4484
 
4485
-                $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList'));
4485
+                $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList'));
4486 4486
 
4487 4487
                 $html .= '<table class="data_table" width="100%">';
4488 4488
                 //'.Display::tag('th', get_lang('DoneExercises'),         array('class'=>'head')).'
4489 4489
                 $html .= '
4490 4490
                     <tr>
4491 4491
                       <th width="300px">'.get_lang('Course').'</th>
4492
-                      '.Display::tag('th', get_lang('PublishedExercises'),    	array('class'=>'head')).'
4493
-                      '.Display::tag('th', get_lang('NewExercises'),    		array('class'=>'head')).'
4494
-                      '.Display::tag('th', get_lang('MyAverage'), 				array('class'=>'head')).'
4495
-                      '.Display::tag('th', get_lang('AverageExerciseResult'), 	array('class'=>'head')).'
4496
-                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'),    array('class'=>'head')).'
4497
-                      '.Display::tag('th', get_lang('LPProgress')     ,      	array('class'=>'head')).'
4498
-                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4499
-                      '.Display::tag('th', get_lang('LastConnexion'),         	array('class'=>'head')).'
4500
-                      '.Display::tag('th', get_lang('Details'),               	array('class'=>'head')).'
4492
+                      '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).'
4493
+                      '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
4494
+                      '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).'
4495
+                      '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
4496
+                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4497
+                      '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).'
4498
+                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4499
+                      '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4500
+                      '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4501 4501
                     </tr>';
4502 4502
 
4503 4503
                 foreach ($course_list as $course_data) {
@@ -4513,14 +4513,14 @@  discard block
 block discarded – undo
4513 4513
                         $count_exercises = count($exercises);
4514 4514
                     }
4515 4515
                     $answered_exercises = 0;
4516
-                    foreach($exercises as $exercise_item) {
4516
+                    foreach ($exercises as $exercise_item) {
4517 4517
                         $attempts = Event::count_exercise_attempts_by_user(
4518 4518
                             api_get_user_id(),
4519 4519
                             $exercise_item['id'],
4520 4520
                             $courseId,
4521 4521
                             $session_id_from_get
4522 4522
                         );
4523
-                        if ($attempts > 1)  {
4523
+                        if ($attempts > 1) {
4524 4524
                             $answered_exercises++;
4525 4525
                         }
4526 4526
                     }
@@ -4529,7 +4529,7 @@  discard block
 block discarded – undo
4529 4529
 
4530 4530
                     // Average
4531 4531
                     $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get);
4532
-                    $my_average	= ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4532
+                    $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4533 4533
 
4534 4534
                     $stats_array[$course_code] = array(
4535 4535
                         'exercises' => $count_exercises,
@@ -4599,11 +4599,11 @@  discard block
 block discarded – undo
4599 4599
                     }
4600 4600
                     //Score
4601 4601
                     $html .= Display::tag('td', $percentage_score, array('align'=>'center'));
4602
-                    $html .= Display::tag('td', $last_connection,  array('align'=>'center'));
4602
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center'));
4603 4603
 
4604 4604
                     if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
4605 4605
                         $details = '<a href="#">';
4606
-                        $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4606
+                        $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4607 4607
                     } else {
4608 4608
                         $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">';
4609 4609
                         $details .= Display::return_icon('2rightarrow.png', get_lang('Details'));
@@ -4726,7 +4726,7 @@  discard block
 block discarded – undo
4726 4726
                         );
4727 4727
 
4728 4728
                         $latest_attempt_url = '';
4729
-                        $best_score = $position = $percentage_score_result  = '-';
4729
+                        $best_score = $position = $percentage_score_result = '-';
4730 4730
                         $graph = $normal_graph = null;
4731 4731
 
4732 4732
                         // Getting best results
@@ -4762,7 +4762,7 @@  discard block
 block discarded – undo
4762 4762
                                 $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
4763 4763
                                 $my_score = 0;
4764 4764
                                 if (!empty($weighting) && intval($weighting) != 0) {
4765
-                                    $my_score = $score/$weighting;
4765
+                                    $my_score = $score / $weighting;
4766 4766
                                 }
4767 4767
                                 //@todo this function slows the page
4768 4768
                                 $position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list);
@@ -4773,14 +4773,14 @@  discard block
 block discarded – undo
4773 4773
                         }
4774 4774
                         $html .= Display::div(
4775 4775
                             $normal_graph,
4776
-                            array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none')
4776
+                            array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none')
4777 4777
                         );
4778 4778
 
4779 4779
                         if (empty($graph)) {
4780 4780
                             $graph = '-';
4781 4781
                         } else {
4782 4782
                             $graph = Display::url(
4783
-                                '<img src="' . $graph . '" >',
4783
+                                '<img src="'.$graph.'" >',
4784 4784
                                 $normal_graph,
4785 4785
                                 array(
4786 4786
                                     'id' => $exercices['id'],
@@ -4813,7 +4813,7 @@  discard block
 block discarded – undo
4813 4813
 
4814 4814
 
4815 4815
             // LP table results
4816
-            $html .='<table class="data_table">';
4816
+            $html .= '<table class="data_table">';
4817 4817
             $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000'));
4818 4818
             $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000'));
4819 4819
             $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000'));
@@ -4867,7 +4867,7 @@  discard block
 block discarded – undo
4867 4867
                     if (!empty($last_connection_in_lp)) {
4868 4868
                         $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG);
4869 4869
                     }
4870
-                    $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px'));
4870
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px'));
4871 4871
                     $html .= "</tr>";
4872 4872
                 }
4873 4873
             } else {
@@ -4877,7 +4877,7 @@  discard block
 block discarded – undo
4877 4877
                         </td>
4878 4878
                       </tr>';
4879 4879
             }
4880
-            $html .='</table>';
4880
+            $html .= '</table>';
4881 4881
         }
4882 4882
 
4883 4883
         return $html;
@@ -4904,7 +4904,7 @@  discard block
 block discarded – undo
4904 4904
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
4905 4905
         $myData->setSerieDescription('Serie2', get_lang('AverageScore'));
4906 4906
         $myData->setAxisUnit(0, '%');
4907
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
4907
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
4908 4908
         // Cache definition
4909 4909
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
4910 4910
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
@@ -4912,9 +4912,9 @@  discard block
 block discarded – undo
4912 4912
 
4913 4913
         if ($myCache->isInCache($chartHash)) {
4914 4914
             //if we already created the img
4915
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
4915
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
4916 4916
             $myCache->saveFromCache($chartHash, $imgPath);
4917
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
4917
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
4918 4918
         } else {
4919 4919
             /* Define width, height and angle */
4920 4920
             $mainWidth = 860;
@@ -4943,7 +4943,7 @@  discard block
 block discarded – undo
4943 4943
             /* Set the default font */
4944 4944
             $myPicture->setFontProperties(
4945 4945
                 array(
4946
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
4946
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
4947 4947
                     'FontSize' => 10)
4948 4948
             );
4949 4949
             /* Write the chart title */
@@ -4960,7 +4960,7 @@  discard block
 block discarded – undo
4960 4960
             /* Set the default font */
4961 4961
             $myPicture->setFontProperties(
4962 4962
                 array(
4963
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
4963
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
4964 4964
                     'FontSize' => 6
4965 4965
                 )
4966 4966
             );
@@ -5002,7 +5002,7 @@  discard block
 block discarded – undo
5002 5002
             /* Draw the line chart */
5003 5003
             $myPicture->setFontProperties(
5004 5004
                 array(
5005
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5005
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5006 5006
                     'FontSize' => 10
5007 5007
                 )
5008 5008
             );
@@ -5035,12 +5035,12 @@  discard block
 block discarded – undo
5035 5035
             );
5036 5036
 
5037 5037
             $myCache->writeToCache($chartHash, $myPicture);
5038
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5038
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5039 5039
             $myCache->saveFromCache($chartHash, $imgPath);
5040
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5040
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5041 5041
         }
5042 5042
 
5043
-        $html = '<img src="' . $imgPath . '">';
5043
+        $html = '<img src="'.$imgPath.'">';
5044 5044
 
5045 5045
         return $html;
5046 5046
     }
@@ -5061,12 +5061,12 @@  discard block
 block discarded – undo
5061 5061
 
5062 5062
         foreach ($attempts as $attempt) {
5063 5063
             if (api_get_user_id() == $attempt['exe_user_id']) {
5064
-                if ($attempt['exe_weighting'] != 0 ) {
5065
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5064
+                if ($attempt['exe_weighting'] != 0) {
5065
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5066 5066
                 }
5067 5067
             } else {
5068
-                if ($attempt['exe_weighting'] != 0 ) {
5069
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5068
+                if ($attempt['exe_weighting'] != 0) {
5069
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5070 5070
                 }
5071 5071
             }
5072 5072
         }
@@ -5075,27 +5075,27 @@  discard block
 block discarded – undo
5075 5075
         rsort($my_exercise_result_array);
5076 5076
         $my_exercise_result = 0;
5077 5077
         if (isset($my_exercise_result_array[0])) {
5078
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5078
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5079 5079
         }
5080 5080
 
5081 5081
         $max     = 100;
5082
-        $pieces  = 5 ;
5082
+        $pieces  = 5;
5083 5083
         $part    = round($max / $pieces);
5084 5084
         $x_axis = array();
5085 5085
         $final_array = array();
5086 5086
         $my_final_array = array();
5087 5087
 
5088
-        for ($i=1; $i <=$pieces; $i++) {
5088
+        for ($i = 1; $i <= $pieces; $i++) {
5089 5089
             $sum = 1;
5090 5090
             if ($i == 1) {
5091 5091
                 $sum = 0;
5092 5092
             }
5093
-            $min = ($i-1)*$part + $sum;
5094
-            $max = ($i)*$part;
5095
-            $x_axis[]= $min." - ".$max;
5093
+            $min = ($i - 1) * $part + $sum;
5094
+            $max = ($i) * $part;
5095
+            $x_axis[] = $min." - ".$max;
5096 5096
             $count = 0;
5097
-            foreach($exercise_result as $result) {
5098
-                $percentage = $result*100;
5097
+            foreach ($exercise_result as $result) {
5098
+                $percentage = $result * 100;
5099 5099
                 //echo $percentage.' - '.$min.' - '.$max."<br />";
5100 5100
                 if ($percentage >= $min && $percentage <= $max) {
5101 5101
                     //echo ' is > ';
@@ -5103,7 +5103,7 @@  discard block
 block discarded – undo
5103 5103
                 }
5104 5104
             }
5105 5105
             //echo '<br />';
5106
-            $final_array[]= $count;
5106
+            $final_array[] = $count;
5107 5107
 
5108 5108
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5109 5109
                 $my_final_array[] = 1;
@@ -5113,9 +5113,9 @@  discard block
 block discarded – undo
5113 5113
         }
5114 5114
 
5115 5115
         //Fix to remove the data of the user with my data
5116
-        for($i = 0; $i<=count($my_final_array); $i++) {
5116
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5117 5117
             if (!empty($my_final_array[$i])) {
5118
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5118
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5119 5119
                 $final_array[$i] = 0;
5120 5120
             }
5121 5121
         }
@@ -5125,16 +5125,16 @@  discard block
 block discarded – undo
5125 5125
         $dataSet->addPoints($final_array, 'Serie1');
5126 5126
         $dataSet->addPoints($my_final_array, 'Serie2');
5127 5127
         $dataSet->normalize(100, "%");
5128
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5128
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5129 5129
 
5130 5130
         // Cache definition
5131 5131
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5132 5132
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
5133 5133
         $chartHash = $myCache->getHash($dataSet);
5134 5134
         if ($myCache->isInCache($chartHash)) {
5135
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5135
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5136 5136
             $myCache->saveFromCache($chartHash, $imgPath);
5137
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5137
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5138 5138
         } else {
5139 5139
             /* Create the pChart object */
5140 5140
             $widthSize = 80;
@@ -5150,7 +5150,7 @@  discard block
 block discarded – undo
5150 5150
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5151 5151
 
5152 5152
             /* Set the default font */
5153
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5153
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5154 5154
 
5155 5155
             /* Do not write the chart title */
5156 5156
 
@@ -5214,9 +5214,9 @@  discard block
 block discarded – undo
5214 5214
 
5215 5215
             /* Save and write in cache */
5216 5216
             $myCache->writeToCache($chartHash, $myPicture);
5217
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5217
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5218 5218
             $myCache->saveFromCache($chartHash, $imgPath);
5219
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5219
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5220 5220
         }
5221 5221
 
5222 5222
         return $imgPath;
@@ -5236,12 +5236,12 @@  discard block
 block discarded – undo
5236 5236
         }
5237 5237
         foreach ($attempts as $attempt) {
5238 5238
             if (api_get_user_id() == $attempt['exe_user_id']) {
5239
-                if ($attempt['exe_weighting'] != 0 ) {
5240
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5239
+                if ($attempt['exe_weighting'] != 0) {
5240
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5241 5241
                 }
5242 5242
             } else {
5243
-                if ($attempt['exe_weighting'] != 0 ) {
5244
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5243
+                if ($attempt['exe_weighting'] != 0) {
5244
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5245 5245
                 }
5246 5246
             }
5247 5247
         }
@@ -5250,32 +5250,32 @@  discard block
 block discarded – undo
5250 5250
         rsort($my_exercise_result_array);
5251 5251
         $my_exercise_result = 0;
5252 5252
         if (isset($my_exercise_result_array[0])) {
5253
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5253
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5254 5254
         }
5255 5255
 
5256 5256
         $max = 100;
5257
-        $pieces = 5 ;
5257
+        $pieces = 5;
5258 5258
         $part = round($max / $pieces);
5259 5259
         $x_axis = array();
5260 5260
         $final_array = array();
5261 5261
         $my_final_array = array();
5262 5262
 
5263
-        for ($i=1; $i <=$pieces; $i++) {
5263
+        for ($i = 1; $i <= $pieces; $i++) {
5264 5264
             $sum = 1;
5265 5265
             if ($i == 1) {
5266 5266
                 $sum = 0;
5267 5267
             }
5268
-            $min = ($i-1)*$part + $sum;
5269
-            $max = ($i)*$part;
5270
-            $x_axis[]= $min." - ".$max;
5268
+            $min = ($i - 1) * $part + $sum;
5269
+            $max = ($i) * $part;
5270
+            $x_axis[] = $min." - ".$max;
5271 5271
             $count = 0;
5272
-            foreach($exercise_result as $result) {
5273
-                $percentage = $result*100;
5272
+            foreach ($exercise_result as $result) {
5273
+                $percentage = $result * 100;
5274 5274
                 if ($percentage >= $min && $percentage <= $max) {
5275 5275
                     $count++;
5276 5276
                 }
5277 5277
             }
5278
-            $final_array[]= $count;
5278
+            $final_array[] = $count;
5279 5279
 
5280 5280
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5281 5281
                 $my_final_array[] = 1;
@@ -5286,9 +5286,9 @@  discard block
 block discarded – undo
5286 5286
 
5287 5287
         //Fix to remove the data of the user with my data
5288 5288
 
5289
-        for($i = 0; $i<=count($my_final_array); $i++) {
5289
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5290 5290
             if (!empty($my_final_array[$i])) {
5291
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5291
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5292 5292
                 $final_array[$i] = 0;
5293 5293
             }
5294 5294
         }
@@ -5306,7 +5306,7 @@  discard block
 block discarded – undo
5306 5306
         $dataSet->setXAxisName(get_lang('Score'));
5307 5307
         $dataSet->normalize(100, "%");
5308 5308
 
5309
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5309
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5310 5310
 
5311 5311
         // Cache definition
5312 5312
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -5314,9 +5314,9 @@  discard block
 block discarded – undo
5314 5314
         $chartHash = $myCache->getHash($dataSet);
5315 5315
 
5316 5316
         if ($myCache->isInCache($chartHash)) {
5317
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5317
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5318 5318
             $myCache->saveFromCache($chartHash, $imgPath);
5319
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5319
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5320 5320
         } else {
5321 5321
             /* Create the pChart object */
5322 5322
             $widthSize = 480;
@@ -5332,7 +5332,7 @@  discard block
 block discarded – undo
5332 5332
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5333 5333
 
5334 5334
             /* Set the default font */
5335
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5335
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5336 5336
 
5337 5337
             /* Write the chart title */
5338 5338
             $myPicture->drawText(
@@ -5391,9 +5391,9 @@  discard block
 block discarded – undo
5391 5391
 
5392 5392
             /* Write and save into cache */
5393 5393
             $myCache->writeToCache($chartHash, $myPicture);
5394
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5394
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5395 5395
             $myCache->saveFromCache($chartHash, $imgPath);
5396
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5396
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5397 5397
         }
5398 5398
 
5399 5399
         return $imgPath;
@@ -5519,7 +5519,7 @@  discard block
 block discarded – undo
5519 5519
                         $whereSessionParams .= $sessionIdx.',';
5520 5520
                     }
5521 5521
                 }
5522
-                $whereSessionParams = substr($whereSessionParams,0,-1);
5522
+                $whereSessionParams = substr($whereSessionParams, 0, -1);
5523 5523
             }
5524 5524
 
5525 5525
             if (!empty($exerciseId)) {
@@ -5580,7 +5580,7 @@  discard block
 block discarded – undo
5580 5580
                     qq.position = rq.question_order AND
5581 5581
                     ta.question_id = rq.question_id
5582 5582
                 WHERE
5583
-                    te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."
5583
+                    te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")."
5584 5584
                     AND q.c_id = $courseIdx
5585 5585
                     $where $order $limit";
5586 5586
             $sql_query = vsprintf($sql, $whereParams);
@@ -5628,7 +5628,7 @@  discard block
 block discarded – undo
5628 5628
             // Now fill users data
5629 5629
             $sqlUsers = "SELECT user_id, username, lastname, firstname
5630 5630
                          FROM $tuser
5631
-                         WHERE user_id IN (".implode(',',$userIds).")";
5631
+                         WHERE user_id IN (".implode(',', $userIds).")";
5632 5632
             $resUsers = Database::query($sqlUsers);
5633 5633
             while ($rowUser = Database::fetch_assoc($resUsers)) {
5634 5634
                 $users[$rowUser['user_id']] = $rowUser;
@@ -5689,7 +5689,7 @@  discard block
 block discarded – undo
5689 5689
     	        WHERE
5690 5690
                     track_resource.c_id = $course_id AND
5691 5691
                     track_resource.insert_user_id = user.user_id AND
5692
-                    session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5692
+                    session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5693 5693
 
5694 5694
     	if (isset($_GET['keyword'])) {
5695 5695
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -5747,7 +5747,7 @@  discard block
 block discarded – undo
5747 5747
                 WHERE
5748 5748
                   track_resource.c_id = $course_id AND
5749 5749
                   track_resource.insert_user_id = user.user_id AND
5750
-                  session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5750
+                  session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5751 5751
 
5752 5752
     	if (isset($_GET['keyword'])) {
5753 5753
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6041,7 +6041,7 @@  discard block
 block discarded – undo
6041 6041
     public static function display_additional_profile_fields()
6042 6042
     {
6043 6043
     	// getting all the extra profile fields that are defined by the platform administrator
6044
-    	$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6044
+    	$extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC');
6045 6045
 
6046 6046
     	// creating the form
6047 6047
     	$return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
@@ -6053,8 +6053,8 @@  discard block
 block discarded – undo
6053 6053
     	$extra_fields_to_show = 0;
6054 6054
     	foreach ($extra_fields as $key=>$field) {
6055 6055
     		// show only extra fields that are visible + and can be filtered, added by J.Montoya
6056
-    		if ($field[6]==1 && $field[8] == 1) {
6057
-    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6056
+    		if ($field[6] == 1 && $field[8] == 1) {
6057
+    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) {
6058 6058
     				$selected = 'selected="selected"';
6059 6059
     			} else {
6060 6060
     				$selected = '';
@@ -6066,8 +6066,8 @@  discard block
 block discarded – undo
6066 6066
     	$return .= '</select>';
6067 6067
 
6068 6068
     	// the form elements for the $_GET parameters (because the form is passed through GET
6069
-    	foreach ($_GET as $key=>$value){
6070
-    		if ($key <> 'additional_profile_field')    {
6069
+    	foreach ($_GET as $key=>$value) {
6070
+    		if ($key <> 'additional_profile_field') {
6071 6071
     			$return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6072 6072
     		}
6073 6073
     	}
@@ -6104,21 +6104,21 @@  discard block
 block discarded – undo
6104 6104
     	$result_extra_field = UserManager::get_extra_field_information($field_id);
6105 6105
 
6106 6106
     	if (!empty($users)) {
6107
-    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6108
-    			foreach($users as $user_id) {
6107
+    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) {
6108
+    			foreach ($users as $user_id) {
6109 6109
     				$user_result = UserManager::get_user_tags($user_id, $field_id);
6110 6110
     				$tag_list = array();
6111
-    				foreach($user_result as $item) {
6111
+    				foreach ($user_result as $item) {
6112 6112
     					$tag_list[] = $item['tag'];
6113 6113
     				}
6114
-    				$return[$user_id][] = implode(', ',$tag_list);
6114
+    				$return[$user_id][] = implode(', ', $tag_list);
6115 6115
     			}
6116 6116
     		} else {
6117 6117
     			$new_user_array = array();
6118 6118
     			foreach ($users as $user_id) {
6119
-    				$new_user_array[]= "'".$user_id."'";
6119
+    				$new_user_array[] = "'".$user_id."'";
6120 6120
     			}
6121
-    			$users = implode(',',$new_user_array);
6121
+    			$users = implode(',', $new_user_array);
6122 6122
                 $extraFieldType = EntityExtraField::USER_FIELD_TYPE;
6123 6123
     			// Selecting only the necessary information NOT ALL the user list
6124 6124
     			$sql = "SELECT user.user_id, v.value
@@ -6133,7 +6133,7 @@  discard block
 block discarded – undo
6133 6133
                             user.user_id IN ($users)";
6134 6134
 
6135 6135
     			$result = Database::query($sql);
6136
-    			while($row = Database::fetch_array($result)) {
6136
+    			while ($row = Database::fetch_array($result)) {
6137 6137
     				// get option value for field type double select by id
6138 6138
     				if (!empty($row['value'])) {
6139 6139
     					if ($result_extra_field['field_type'] ==
@@ -6172,7 +6172,7 @@  discard block
 block discarded – undo
6172 6172
 
6173 6173
     public function sort_users_desc($a, $b)
6174 6174
     {
6175
-    	return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6175
+    	return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6176 6176
     }
6177 6177
 
6178 6178
     /**
@@ -6207,7 +6207,7 @@  discard block
 block discarded – undo
6207 6207
     	// get all users data from a course for sortable with limit
6208 6208
     	if (is_array($user_ids)) {
6209 6209
     		$user_ids = array_map('intval', $user_ids);
6210
-    		$condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6210
+    		$condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") ";
6211 6211
     	} else {
6212 6212
     		$user_ids = intval($user_ids);
6213 6213
     		$condition_user = " WHERE user.user_id = $user_ids ";
@@ -6215,7 +6215,7 @@  discard block
 block discarded – undo
6215 6215
 
6216 6216
     	if (!empty($_GET['user_keyword'])) {
6217 6217
     		$keyword = trim(Database::escape_string($_GET['user_keyword']));
6218
-    		$condition_user .=  " AND (
6218
+    		$condition_user .= " AND (
6219 6219
                 user.firstname LIKE '%".$keyword."%' OR
6220 6220
                 user.lastname LIKE '%".$keyword."%'  OR
6221 6221
                 user.username LIKE '%".$keyword."%'  OR
@@ -6233,7 +6233,7 @@  discard block
 block discarded – undo
6233 6233
         $invitedUsersCondition = '';
6234 6234
 
6235 6235
         if (!$includeInvitedUsers) {
6236
-            $invitedUsersCondition = " AND user.status != " . INVITEE;
6236
+            $invitedUsersCondition = " AND user.status != ".INVITEE;
6237 6237
         }
6238 6238
 
6239 6239
     	$sql = "SELECT  user.user_id as user_id,
@@ -6244,7 +6244,7 @@  discard block
 block discarded – undo
6244 6244
                 FROM $tbl_user as user $url_table
6245 6245
     	        $condition_user $url_condition $invitedUsersCondition";
6246 6246
 
6247
-    	if (!in_array($direction, array('ASC','DESC'))) {
6247
+    	if (!in_array($direction, array('ASC', 'DESC'))) {
6248 6248
     		$direction = 'ASC';
6249 6249
     	}
6250 6250
 
@@ -6381,7 +6381,7 @@  discard block
 block discarded – undo
6381 6381
     		}
6382 6382
 
6383 6383
             if (empty($session_id)) {
6384
-                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys;
6384
+                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys;
6385 6385
             }
6386 6386
 
6387 6387
     		$user['link'] = '<center><a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'icons/22/2rightarrow.png" border="0" /></a></center>';
@@ -6391,35 +6391,35 @@  discard block
 block discarded – undo
6391 6391
     		$is_western_name_order = api_is_western_name_order();
6392 6392
             $user_row = array();
6393 6393
 
6394
-            $user_row[]= $user['official_code']; //0
6394
+            $user_row[] = $user['official_code']; //0
6395 6395
 
6396 6396
             if ($is_western_name_order) {
6397
-                $user_row[]= $user['firstname'];
6398
-                $user_row[]= $user['lastname'];
6397
+                $user_row[] = $user['firstname'];
6398
+                $user_row[] = $user['lastname'];
6399 6399
             } else {
6400
-                $user_row[]= $user['lastname'];
6401
-                $user_row[]= $user['firstname'];
6400
+                $user_row[] = $user['lastname'];
6401
+                $user_row[] = $user['firstname'];
6402 6402
             }
6403
-            $user_row[]= $user['username'];
6404
-            $user_row[]= $user['time'];
6405
-            $user_row[]= $user['average_progress'];
6406
-            $user_row[]= $user['exercise_progress'];
6407
-            $user_row[]= $user['exercise_average_best_attempt'];
6408
-            $user_row[]= $user['student_score'];
6409
-            $user_row[]= $user['count_assignments'];
6410
-            $user_row[]= $user['count_messages'];
6403
+            $user_row[] = $user['username'];
6404
+            $user_row[] = $user['time'];
6405
+            $user_row[] = $user['average_progress'];
6406
+            $user_row[] = $user['exercise_progress'];
6407
+            $user_row[] = $user['exercise_average_best_attempt'];
6408
+            $user_row[] = $user['student_score'];
6409
+            $user_row[] = $user['count_assignments'];
6410
+            $user_row[] = $user['count_messages'];
6411 6411
 
6412 6412
             if (empty($session_id)) {
6413
-                $user_row[]= $user['survey'];
6413
+                $user_row[] = $user['survey'];
6414 6414
             }
6415 6415
 
6416
-            $user_row[]= $user['first_connection'];
6417
-            $user_row[]= $user['last_connection'];
6416
+            $user_row[] = $user['first_connection'];
6417
+            $user_row[] = $user['last_connection'];
6418 6418
             if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6419
-                $user_row[]= $user['additional'];
6419
+                $user_row[] = $user['additional'];
6420 6420
             }
6421 6421
 
6422
-            $user_row[]= $user['link'];
6422
+            $user_row[] = $user['link'];
6423 6423
 
6424 6424
             $users[] = $user_row;
6425 6425
 
@@ -6464,8 +6464,8 @@  discard block
 block discarded – undo
6464 6464
 
6465 6465
     	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6466 6466
     	$tempView = $view;
6467
-    	if(substr($view,0,1) == '1') {
6468
-    		$new_view = substr_replace($view,'0',0,1);
6467
+    	if (substr($view, 0, 1) == '1') {
6468
+    		$new_view = substr_replace($view, '0', 0, 1);
6469 6469
     		echo "
6470 6470
                 <tr>
6471 6471
                     <td valign='top'>
@@ -6498,9 +6498,9 @@  discard block
 block discarded – undo
6498 6498
                 </tr>";
6499 6499
     		$total = 0;
6500 6500
     		if (is_array($results)) {
6501
-    			for($j = 0 ; $j < count($results) ; $j++) {
6501
+    			for ($j = 0; $j < count($results); $j++) {
6502 6502
     				echo "<tr>";
6503
-    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6503
+    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>";
6504 6504
     				echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6505 6505
     				echo"</tr>";
6506 6506
     				$total = $total + $results[$j][1];
@@ -6517,7 +6517,7 @@  discard block
 block discarded – undo
6517 6517
     		echo "</table>";
6518 6518
     		echo "</td></tr>";
6519 6519
     	} else {
6520
-    		$new_view = substr_replace($view,'1',0,1);
6520
+    		$new_view = substr_replace($view, '1', 0, 1);
6521 6521
     		echo "
6522 6522
                 <tr>
6523 6523
                     <td valign='top'>
@@ -6540,8 +6540,8 @@  discard block
 block discarded – undo
6540 6540
     {
6541 6541
     	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6542 6542
         $courseId = api_get_course_int_id($courseCode);
6543
-    	if(substr($view,1,1) == '1') {
6544
-    		$new_view = substr_replace($view,'0',1,1);
6543
+    	if (substr($view, 1, 1) == '1') {
6544
+    		$new_view = substr_replace($view, '0', 1, 1);
6545 6545
     		echo "<tr>
6546 6546
                     <td valign='top'>
6547 6547
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>]
@@ -6583,7 +6583,7 @@  discard block
 block discarded – undo
6583 6583
                 </tr>";
6584 6584
 
6585 6585
     		if (is_array($results)) {
6586
-    			for($i = 0; $i < sizeof($results); $i++) {
6586
+    			for ($i = 0; $i < sizeof($results); $i++) {
6587 6587
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6588 6588
     				echo "<tr>\n";
6589 6589
     				echo "<td class='content'>".$results[$i][0]."</td>\n";
@@ -6598,8 +6598,8 @@  discard block
 block discarded – undo
6598 6598
 
6599 6599
     		// The Result of Tests
6600 6600
     		if (is_array($hpresults)) {
6601
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6602
-    				$title = GetQuizName($hpresults[$i][0],'');
6601
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
6602
+    				$title = GetQuizName($hpresults[$i][0], '');
6603 6603
     				if ($title == '')
6604 6604
     				$title = basename($hpresults[$i][0]);
6605 6605
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
@@ -6625,7 +6625,7 @@  discard block
 block discarded – undo
6625 6625
     		echo "</table>";
6626 6626
     		echo "</td>\n</tr>\n";
6627 6627
     	} else {
6628
-    		$new_view = substr_replace($view,'1',1,1);
6628
+    		$new_view = substr_replace($view, '1', 1, 1);
6629 6629
     		echo "
6630 6630
                 <tr>
6631 6631
                     <td valign='top'>
@@ -6644,8 +6644,8 @@  discard block
 block discarded – undo
6644 6644
     	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6645 6645
         $_course = api_get_course_info_by_id($course_id);
6646 6646
 
6647
-    	if (substr($view,2,1) == '1') {
6648
-    		$new_view = substr_replace($view,'0',2,1);
6647
+    	if (substr($view, 2, 1) == '1') {
6648
+    		$new_view = substr_replace($view, '0', 2, 1);
6649 6649
     		echo "<tr>
6650 6650
                     <td valign='top'>
6651 6651
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
@@ -6659,7 +6659,7 @@  discard block
 block discarded – undo
6659 6659
                         AND u.c_id = '".intval($course_id)."'
6660 6660
                     ORDER BY u.upload_date DESC";
6661 6661
     		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6662
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
6662
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
6663 6663
     		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6664 6664
     		echo "<tr>
6665 6665
                     <td class='secLine' width='40%'>
@@ -6673,7 +6673,7 @@  discard block
 block discarded – undo
6673 6673
                     </td>
6674 6674
                 </tr>";
6675 6675
     		if (is_array($results)) {
6676
-    			for($j = 0 ; $j < count($results) ; $j++) {
6676
+    			for ($j = 0; $j < count($results); $j++) {
6677 6677
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6678 6678
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6679 6679
     				echo "<tr>";
@@ -6692,7 +6692,7 @@  discard block
 block discarded – undo
6692 6692
     		echo "</table>";
6693 6693
     		echo "</td></tr>";
6694 6694
     	} else {
6695
-    		$new_view = substr_replace($view,'1',2,1);
6695
+    		$new_view = substr_replace($view, '1', 2, 1);
6696 6696
     		echo "
6697 6697
                 <tr>
6698 6698
                     <td valign='top'>
@@ -6711,8 +6711,8 @@  discard block
 block discarded – undo
6711 6711
     {
6712 6712
     	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
6713 6713
         $courseId = api_get_course_int_id($courseCode);
6714
-    	if (substr($view,3,1) == '1') {
6715
-    		$new_view = substr_replace($view,'0',3,1);
6714
+    	if (substr($view, 3, 1) == '1') {
6715
+    		$new_view = substr_replace($view, '0', 3, 1);
6716 6716
     		echo "
6717 6717
                 <tr>
6718 6718
                         <td valign='top'>
@@ -6736,7 +6736,7 @@  discard block
 block discarded – undo
6736 6736
                     </td>
6737 6737
                 </tr>";
6738 6738
     		if (is_array($results)) {
6739
-    			for($j = 0 ; $j < count($results) ; $j++) {
6739
+    			for ($j = 0; $j < count($results); $j++) {
6740 6740
     				echo "<tr>";
6741 6741
     				echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
6742 6742
     				echo"</tr>";
@@ -6749,7 +6749,7 @@  discard block
 block discarded – undo
6749 6749
     		echo "</table>";
6750 6750
     		echo "</td></tr>";
6751 6751
     	} else {
6752
-    		$new_view = substr_replace($view,'1',3,1);
6752
+    		$new_view = substr_replace($view, '1', 3, 1);
6753 6753
     		echo "
6754 6754
                 <tr>
6755 6755
                     <td valign='top'>
@@ -6776,8 +6776,8 @@  discard block
 block discarded – undo
6776 6776
     	$session_id = intval($session_id);
6777 6777
 
6778 6778
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
6779
-    	if(substr($view,4,1) == '1') {
6780
-    		$new_view = substr_replace($view,'0',4,1);
6779
+    	if (substr($view, 4, 1) == '1') {
6780
+    		$new_view = substr_replace($view, '0', 4, 1);
6781 6781
     		echo "
6782 6782
                 <tr>
6783 6783
                     <td valign='top'>
@@ -6803,7 +6803,7 @@  discard block
 block discarded – undo
6803 6803
                     </td>
6804 6804
                 </tr>";
6805 6805
     		if (is_array($results)) {
6806
-    			for($j = 0 ; $j < count($results) ; $j++) {
6806
+    			for ($j = 0; $j < count($results); $j++) {
6807 6807
     				echo "<tr>";
6808 6808
     				echo "<td class='content'>".$results[$j]."</td>";
6809 6809
     				echo"</tr>";
@@ -6816,7 +6816,7 @@  discard block
 block discarded – undo
6816 6816
     		echo "</table>";
6817 6817
     		echo "</td></tr>";
6818 6818
     	} else {
6819
-    		$new_view = substr_replace($view,'1',4,1);
6819
+    		$new_view = substr_replace($view, '1', 4, 1);
6820 6820
     		echo "
6821 6821
                 <tr>
6822 6822
                     <td valign='top'>
@@ -6850,11 +6850,11 @@  discard block
 block discarded – undo
6850 6850
                    ORDER BY login_date DESC LIMIT 1";
6851 6851
         $ip = '';
6852 6852
         $res_ip = Database::query($sql_ip);
6853
-        if ($res_ip !== false && Database::num_rows($res_ip)>0) {
6853
+        if ($res_ip !== false && Database::num_rows($res_ip) > 0) {
6854 6854
             $row_ip = Database::fetch_row($res_ip);
6855 6855
             if ($return_as_link) {
6856 6856
                 $ip = Display::url(
6857
-                    (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
6857
+                    (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
6858 6858
                     array('title'=>get_lang('TraceIP'), 'target'=>'_blank')
6859 6859
                 );
6860 6860
             } else {
@@ -6890,9 +6890,9 @@  discard block
 block discarded – undo
6890 6890
     	$course_id  = intval($course_id);
6891 6891
 
6892 6892
     	$tempView = $view;
6893
-    	if (substr($view,0,1) == '1') {
6894
-    		$new_view = substr_replace($view,'0',0,1);
6895
-    		$title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
6893
+    	if (substr($view, 0, 1) == '1') {
6894
+    		$new_view = substr_replace($view, '0', 0, 1);
6895
+    		$title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
6896 6896
     		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
6897 6897
                     FROM $track_access_table
6898 6898
                     WHERE access_user_id = $user_id
@@ -6902,20 +6902,20 @@  discard block
 block discarded – undo
6902 6902
                     ORDER BY YEAR(access_date),MONTH(access_date) ASC";
6903 6903
     		//$results = getManyResults2Col($sql);
6904 6904
     		$results = getManyResults3Col($sql);
6905
-    		$title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
6906
-    		$line='';
6905
+    		$title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
6906
+    		$line = '';
6907 6907
     		$total = 0;
6908 6908
     		if (is_array($results)) {
6909
-    			for($j = 0 ; $j < count($results) ; $j++) {
6909
+    			for ($j = 0; $j < count($results); $j++) {
6910 6910
     				$line .= $results[$j][0].';'.$results[$j][1]."\n";
6911 6911
     				$total = $total + $results[$j][1];
6912 6912
     			}
6913 6913
     			$line .= get_lang('Total').";".$total."\n";
6914 6914
     		} else {
6915
-    			$line= get_lang('NoResult')."</center></td>";
6915
+    			$line = get_lang('NoResult')."</center></td>";
6916 6916
     		}
6917 6917
     	} else {
6918
-    		$new_view = substr_replace($view,'1',0,1);
6918
+    		$new_view = substr_replace($view, '1', 0, 1);
6919 6919
     	}
6920 6920
     	return array($title_line, $line);
6921 6921
     }
@@ -6933,8 +6933,8 @@  discard block
 block discarded – undo
6933 6933
     	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
6934 6934
         $courseId = api_get_course_int_id($courseCode);
6935 6935
         $userId = intval($userId);
6936
-    	if (substr($view,1,1) == '1') {
6937
-    		$new_view = substr_replace($view,'0',1,1);
6936
+    	if (substr($view, 1, 1) == '1') {
6937
+    		$new_view = substr_replace($view, '0', 1, 1);
6938 6938
     		$title[1] = get_lang('ExercicesDetails');
6939 6939
     		$line = '';
6940 6940
     		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
@@ -6958,7 +6958,7 @@  discard block
 block discarded – undo
6958 6958
     		$title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
6959 6959
 
6960 6960
     		if (is_array($results)) {
6961
-    			for($i = 0; $i < sizeof($results); $i++)
6961
+    			for ($i = 0; $i < sizeof($results); $i++)
6962 6962
     			{
6963 6963
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6964 6964
     				$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
@@ -6970,8 +6970,8 @@  discard block
 block discarded – undo
6970 6970
 
6971 6971
     		// The Result of Tests
6972 6972
     		if (is_array($hpresults)) {
6973
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6974
-    				$title = GetQuizName($hpresults[$i][0],'');
6973
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
6974
+    				$title = GetQuizName($hpresults[$i][0], '');
6975 6975
 
6976 6976
     				if ($title == '')
6977 6977
     				$title = basename($hpresults[$i][0]);
@@ -6985,10 +6985,10 @@  discard block
 block discarded – undo
6985 6985
     		}
6986 6986
 
6987 6987
     		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
6988
-    			$line=get_lang('NoResult');
6988
+    			$line = get_lang('NoResult');
6989 6989
     		}
6990 6990
     	} else {
6991
-    		$new_view = substr_replace($view,'1',1,1);
6991
+    		$new_view = substr_replace($view, '1', 1, 1);
6992 6992
     	}
6993 6993
     	return array($title_line, $line);
6994 6994
     }
@@ -7004,7 +7004,7 @@  discard block
 block discarded – undo
7004 7004
         $user_id = intval($user_id);
7005 7005
         $course_id = intval($course_id);
7006 7006
 
7007
-    	if (substr($view,2,1) == '1') {
7007
+    	if (substr($view, 2, 1) == '1') {
7008 7008
     		$sql = "SELECT u.upload_date, w.title, w.author, w.url
7009 7009
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
7010 7010
                     WHERE
@@ -7012,21 +7012,21 @@  discard block
 block discarded – undo
7012 7012
                         u.upload_user_id = '$user_id' AND
7013 7013
                         u.c_id = '$course_id'
7014 7014
                     ORDER BY u.upload_date DESC";
7015
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
7015
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
7016 7016
 
7017
-    		$title[1]=get_lang('WorksDetails');
7018
-    		$line='';
7019
-    		$title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7017
+    		$title[1] = get_lang('WorksDetails');
7018
+    		$line = '';
7019
+    		$title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7020 7020
 
7021 7021
     		if (is_array($results)) {
7022
-    			for($j = 0 ; $j < count($results) ; $j++) {
7022
+    			for ($j = 0; $j < count($results); $j++) {
7023 7023
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7024 7024
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7025 7025
     				$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7026 7026
     			}
7027 7027
 
7028 7028
     		} else {
7029
-    			$line= get_lang('NoResult');
7029
+    			$line = get_lang('NoResult');
7030 7030
     		}
7031 7031
     	}
7032 7032
     	return array($title_line, $line);
@@ -7042,9 +7042,9 @@  discard block
 block discarded – undo
7042 7042
         $courseId = api_get_course_int_id($courseCode);
7043 7043
         $userId = intval($userId);
7044 7044
         $line = null;
7045
-    	if (substr($view,3,1) == '1') {
7046
-    		$new_view = substr_replace($view,'0',3,1);
7047
-    		$title[1]=get_lang('LinksDetails');
7045
+    	if (substr($view, 3, 1) == '1') {
7046
+    		$new_view = substr_replace($view, '0', 3, 1);
7047
+    		$title[1] = get_lang('LinksDetails');
7048 7048
     		$sql = "SELECT cl.title, cl.url
7049 7049
                         FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7050 7050
                         WHERE sl.links_link_id = cl.id
@@ -7052,16 +7052,16 @@  discard block
 block discarded – undo
7052 7052
                             AND sl.links_user_id = $userId
7053 7053
                         GROUP BY cl.title, cl.url";
7054 7054
     		$results = StatsUtils::getManyResults2Col($sql);
7055
-    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7055
+    		$title_line = get_lang('LinksTitleLinkColumn')."\n";
7056 7056
     		if (is_array($results)) {
7057
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7057
+    			for ($j = 0; $j < count($results); $j++) {
7058 7058
     				$line .= $results[$j][0]."\n";
7059 7059
     			}
7060 7060
     		} else {
7061
-    			$line=get_lang('NoResult');
7061
+    			$line = get_lang('NoResult');
7062 7062
     		}
7063 7063
     	} else {
7064
-    		$new_view = substr_replace($view,'1',3,1);
7064
+    		$new_view = substr_replace($view, '1', 3, 1);
7065 7065
     	}
7066 7066
     	return array($title_line, $line);
7067 7067
     }
@@ -7083,9 +7083,9 @@  discard block
 block discarded – undo
7083 7083
 
7084 7084
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7085 7085
 
7086
-    	if (substr($view,4,1) == '1') {
7087
-    		$new_view = substr_replace($view,'0',4,1);
7088
-    		$title[1]= get_lang('DocumentsDetails');
7086
+    	if (substr($view, 4, 1) == '1') {
7087
+    		$new_view = substr_replace($view, '0', 4, 1);
7088
+    		$title[1] = get_lang('DocumentsDetails');
7089 7089
 
7090 7090
     		$sql = "SELECT down_doc_path
7091 7091
                         FROM $downloads_table
@@ -7098,14 +7098,14 @@  discard block
 block discarded – undo
7098 7098
     		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7099 7099
             $line = null;
7100 7100
     		if (is_array($results)) {
7101
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7101
+    			for ($j = 0; $j < count($results); $j++) {
7102 7102
     				$line .= $results[$j]."\n";
7103 7103
     			}
7104 7104
     		} else {
7105 7105
     			$line = get_lang('NoResult');
7106 7106
     		}
7107 7107
     	} else {
7108
-    		$new_view = substr_replace($view,'1',4,1);
7108
+    		$new_view = substr_replace($view, '1', 4, 1);
7109 7109
     	}
7110 7110
     	return array($title_line, $line);
7111 7111
     }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/FormValidator.class.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $renderer->setHeaderTemplate('<legend>{header}</legend>');
100 100
 
101 101
         //Set required field template
102
-        $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>');
102
+        $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>');
103 103
         $noteTemplate = <<<EOT
104 104
 	<div class="form-group">
105 105
 		<div class="col-sm-offset-2 col-sm-10">{requiredNote}</div>
@@ -851,9 +851,9 @@  discard block
 block discarded – undo
851 851
             $label = get_lang('PleaseStandBy');
852 852
         }
853 853
         $this->with_progress_bar = true;
854
-        $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','" . $label . "','" . $this->getAttribute('id') . "')\"");
855
-        $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>');
856
-        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>');
854
+        $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','".$label."','".$this->getAttribute('id')."')\"");
855
+        $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>');
856
+        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>');
857 857
     }
858 858
 
859 859
     /**
@@ -870,22 +870,22 @@  discard block
 block discarded – undo
870 870
             return;
871 871
         }
872 872
 
873
-        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php');
873
+        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH).'upload.xajax.php');
874 874
 
875 875
         $xajax_upload->registerFunction('updateProgress');
876 876
 
877 877
 
878 878
         // IMPORTANT : must be the first element of the form
879
-        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after);
879
+        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="'.$upload_id.'" />'), $element_after);
880 880
 
881 881
         $this->addElement('html', '<br />');
882 882
 
883 883
         // Add div-element where the progress bar is to be displayed
884 884
         $this->addElement('html', '
885 885
             <div id="dynamic_div_container" style="display:none">
886
-                <div id="dynamic_div_label">' . get_lang('UploadFile') . '</div>
886
+                <div id="dynamic_div_label">' . get_lang('UploadFile').'</div>
887 887
                 <div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . Display::returnIconPath('real_upload_frame.gif').');">
888
-                    <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . api_get_path(WEB_IMG_PATH) . 'real_upload_step.gif);background-repeat:repeat-x;background-position:center;"></div>
888
+                    <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . api_get_path(WEB_IMG_PATH).'real_upload_step.gif);background-repeat:repeat-x;background-position:center;"></div>
889 889
                 </div>
890 890
             </div>'
891 891
         );
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
             $this->addElement('html', '
895 895
 			<div id="dynamic_div_waiter_container" style="display:none">
896 896
 				<div id="dynamic_div_waiter_label">
897
-					' . get_lang('SlideshowConversion') . '
897
+					' . get_lang('SlideshowConversion').'
898 898
 				</div>
899 899
 				<div id="dynamic_div_waiter_frame">
900 900
 					'.Display::return_icon('real_upload_frame.gif').'
@@ -904,18 +904,18 @@  discard block
 block discarded – undo
904 904
         }
905 905
 
906 906
         // Get the xajax code
907
-        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax'));
907
+        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax'));
908 908
 
909 909
         // Get the upload code
910
-        $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>');
911
-        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>');
910
+        $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>');
911
+        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>');
912 912
 
913 913
         if (!$wait_after_upload) {
914 914
             $wait_after_upload = 0;
915 915
         }
916 916
 
917 917
         // Add the upload event
918
-        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\"");
918
+        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$wait_after_upload.")\"");
919 919
     }
920 920
 
921 921
     /**
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 1 patch
Spacing   +688 added lines, -688 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,22 +5599,22 @@  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
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5607
-                $icon = '<img src="../img/lp_' . $icon_name . '.png" />';
5606
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5607
+                $icon = '<img src="../img/lp_'.$icon_name.'.png" />';
5608 5608
             } else {
5609
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5610
-                    $icon = '<img src="../img/lp_' . $icon_name . '.gif"  />';
5609
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5610
+                    $icon = '<img src="../img/lp_'.$icon_name.'.gif"  />';
5611 5611
                 } else {
5612 5612
                     $icon = '<img src="../img/folder_document.gif" />';
5613 5613
                 }
5614 5614
             }
5615 5615
 
5616 5616
             // The audio column.
5617
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5617
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5618 5618
 
5619 5619
             $audio = '';
5620 5620
 
@@ -5634,10 +5634,10 @@  discard block
 block discarded – undo
5634 5634
             } else {
5635 5635
                 $types = self::getChapterTypes();
5636 5636
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5637
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5637
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5638 5638
                     if (!empty ($arrLP[$i]['audio'])) {
5639 5639
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5640
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5640
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5641 5641
                     }
5642 5642
                 }
5643 5643
             }
@@ -5661,7 +5661,7 @@  discard block
 block discarded – undo
5661 5661
                 // No edit for this item types
5662 5662
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5663 5663
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5664
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5664
+                        $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 5665
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5666 5666
                         $edit_icon .= '</a>';
5667 5667
 
@@ -5674,7 +5674,7 @@  discard block
 block discarded – undo
5674 5674
                                 $this->lp_session_id
5675 5675
                             )
5676 5676
                             ) {
5677
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5677
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5678 5678
                                     'action' => 'dissociate_forum',
5679 5679
                                     'id' => $arrLP[$i]['id'],
5680 5680
                                     'lp_id' => $this->lp_id
@@ -5685,7 +5685,7 @@  discard block
 block discarded – undo
5685 5685
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5686 5686
                                 );
5687 5687
                             } else {
5688
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5688
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5689 5689
                                     'action' => 'create_forum',
5690 5690
                                     'id' => $arrLP[$i]['id'],
5691 5691
                                     'lp_id' => $this->lp_id
@@ -5698,17 +5698,17 @@  discard block
 block discarded – undo
5698 5698
                             }
5699 5699
                         }
5700 5700
                     } else {
5701
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5701
+                        $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 5702
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5703 5703
                         $edit_icon .= '</a>';
5704 5704
                     }
5705 5705
                 }
5706 5706
 
5707
-                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
5707
+                $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 5708
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5709 5709
                 $delete_icon .= '</a>';
5710 5710
 
5711
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5711
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5712 5712
 
5713 5713
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5714 5714
                     $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']);
@@ -5717,8 +5717,8 @@  discard block
 block discarded – undo
5717 5717
                 }
5718 5718
             }
5719 5719
             if ($update_audio != 'true') {
5720
-                $row = $move_icon . ' ' . $icon .
5721
-                    Display::span($title_cut) .
5720
+                $row = $move_icon.' '.$icon.
5721
+                    Display::span($title_cut).
5722 5722
                     Display::tag(
5723 5723
                         'div',
5724 5724
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5739,8 +5739,8 @@  discard block
 block discarded – undo
5739 5739
                 $parent_arrays = array();
5740 5740
                 if ($arrLP[$i]['depth'] > 1) {
5741 5741
                     //Getting list of parents
5742
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5743
-                        foreach($arrLP as $item) {
5742
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5743
+                        foreach ($arrLP as $item) {
5744 5744
                             if ($item['id'] == $parent_id) {
5745 5745
                                 if ($item['parent_item_id'] == 0) {
5746 5746
                                     $parent_id = $item['id'];
@@ -5762,8 +5762,8 @@  discard block
 block discarded – undo
5762 5762
                     $parent_arrays = array_reverse($parent_arrays);
5763 5763
                     $val = '$elements';
5764 5764
                     $x = 0;
5765
-                    foreach($parent_arrays as $item) {
5766
-                        if ($x != count($parent_arrays) -1) {
5765
+                    foreach ($parent_arrays as $item) {
5766
+                        if ($x != count($parent_arrays) - 1) {
5767 5767
                             $val .= '["'.$item.'"]["children"]';
5768 5768
                         } else {
5769 5769
                             $val .= '["'.$item.'"]["children"]';
@@ -5826,7 +5826,7 @@  discard block
 block discarded – undo
5826 5826
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5827 5827
                     $active = 'active';
5828 5828
                 }
5829
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5829
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5830 5830
             } else {
5831 5831
                 //sections
5832 5832
                 if (isset($item['children'])) {
@@ -5849,17 +5849,17 @@  discard block
 block discarded – undo
5849 5849
     {
5850 5850
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5851 5851
         $return = '<div class="actions">';
5852
-        $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> ';
5853
-        $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>';
5854
-        $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>';
5852
+        $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> ';
5853
+        $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>';
5854
+        $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>';
5855 5855
         $buttons = array(
5856 5856
             array(
5857 5857
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5858
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5858
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5859 5859
             ),
5860 5860
             array(
5861 5861
                 'title' => get_lang('ClearAllPrerequisites'),
5862
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5862
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5863 5863
             ),
5864 5864
         );
5865 5865
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5880,7 +5880,7 @@  discard block
 block discarded – undo
5880 5880
     {
5881 5881
         // Creating learning_path folder
5882 5882
         $dir = '/learning_path';
5883
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5883
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5884 5884
         $folder = false;
5885 5885
         if (!is_dir($filepath.'/'.$dir)) {
5886 5886
             $folderData = create_unexisting_directory(
@@ -5921,9 +5921,9 @@  discard block
 block discarded – undo
5921 5921
         // Creating LP folder
5922 5922
         if ($folder) {
5923 5923
             //Limits title size
5924
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5924
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5925 5925
             $dir   = $dir.$title;
5926
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5926
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5927 5927
             if (!is_dir($filepath.'/'.$dir)) {
5928 5928
                 $folderData = create_unexisting_directory(
5929 5929
                     $course,
@@ -5943,7 +5943,7 @@  discard block
 block discarded – undo
5943 5943
             }
5944 5944
             $dir = $dir.'/';
5945 5945
             if ($folder) {
5946
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5946
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5947 5947
             }
5948 5948
         }
5949 5949
         $array = array(
@@ -5982,12 +5982,12 @@  discard block
 block discarded – undo
5982 5982
             $dir = substr($dir, 1);
5983 5983
         }
5984 5984
         if (!empty($dir[0]) && $dir[0] != '/') {
5985
-            $dir = '/' . $dir;
5985
+            $dir = '/'.$dir;
5986 5986
         }
5987 5987
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5988 5988
             $dir .= '/';
5989 5989
         }
5990
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5990
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5991 5991
 
5992 5992
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5993 5993
             //Generates folder
@@ -5997,7 +5997,7 @@  discard block
 block discarded – undo
5997 5997
         }
5998 5998
 
5999 5999
         if (!is_dir($filepath)) {
6000
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6000
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6001 6001
             $dir = '/';
6002 6002
         }
6003 6003
 
@@ -6020,10 +6020,10 @@  discard block
 block discarded – undo
6020 6020
         $tmp_filename = $filename;
6021 6021
 
6022 6022
         $i = 0;
6023
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6024
-            $tmp_filename = $filename . '_' . ++ $i;
6023
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6024
+            $tmp_filename = $filename.'_'.++ $i;
6025 6025
 
6026
-        $filename = $tmp_filename . '.'.$extension;
6026
+        $filename = $tmp_filename.'.'.$extension;
6027 6027
         if ($extension == 'html') {
6028 6028
             $content = stripslashes($content);
6029 6029
             $content = str_replace(
@@ -6058,12 +6058,12 @@  discard block
 block discarded – undo
6058 6058
             );
6059 6059
         }
6060 6060
 
6061
-        if (!file_exists($filepath . $filename)) {
6062
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6061
+        if (!file_exists($filepath.$filename)) {
6062
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6063 6063
                 fputs($fp, $content);
6064 6064
                 fclose($fp);
6065 6065
 
6066
-                $file_size = filesize($filepath . $filename);
6066
+                $file_size = filesize($filepath.$filename);
6067 6067
                 $save_file_path = $dir.$filename;
6068 6068
 
6069 6069
                 $document_id = add_document(
@@ -6095,12 +6095,12 @@  discard block
 block discarded – undo
6095 6095
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6096 6096
                         $ct = '';
6097 6097
                         if ($new_comment)
6098
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6098
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6099 6099
                         if ($new_title)
6100
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6100
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6101 6101
 
6102
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6103
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6102
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6103
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6104 6104
                         Database::query($sql);
6105 6105
                     }
6106 6106
                 }
@@ -6128,42 +6128,42 @@  discard block
 block discarded – undo
6128 6128
             $dir = substr($dir, 1);
6129 6129
 
6130 6130
         if ($dir[0] != '/')
6131
-            $dir = '/' . $dir;
6131
+            $dir = '/'.$dir;
6132 6132
 
6133 6133
         if ($dir[strlen($dir) - 1] != '/')
6134 6134
             $dir .= '/';
6135 6135
 
6136
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6136
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6137 6137
 
6138 6138
         if (!is_dir($filepath)) {
6139
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6139
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6140 6140
             $dir = '/';
6141 6141
         }
6142 6142
 
6143 6143
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6144 6144
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6145 6145
             $document_id = intval($_POST['path']);
6146
-            $sql = "SELECT path FROM " . $table_doc . "
6147
-                    WHERE c_id = $course_id AND id = " . $document_id;
6146
+            $sql = "SELECT path FROM ".$table_doc."
6147
+                    WHERE c_id = $course_id AND id = ".$document_id;
6148 6148
             $res = Database::query($sql);
6149 6149
             $row = Database :: fetch_array($res);
6150 6150
             $content = stripslashes($_POST['content_lp']);
6151
-            $file = $filepath . $row['path'];
6151
+            $file = $filepath.$row['path'];
6152 6152
 
6153 6153
             if ($fp = @ fopen($file, 'w')) {
6154
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6154
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6155 6155
 
6156 6156
                 // Change the path of mp3 to absolute.
6157 6157
                 // The first regexp deals with :// urls.
6158
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6158
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6159 6159
                 // The second regexp deals with audio/ urls.
6160
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6160
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6161 6161
                 fputs($fp, $content);
6162 6162
                 fclose($fp);
6163 6163
 
6164
-                $sql = "UPDATE " . $table_doc ." SET
6164
+                $sql = "UPDATE ".$table_doc." SET
6165 6165
                             title='".Database::escape_string($_POST['title'])."'
6166
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6166
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6167 6167
                 Database::query($sql);
6168 6168
             }
6169 6169
         }
@@ -6181,10 +6181,10 @@  discard block
 block discarded – undo
6181 6181
         $return = '';
6182 6182
         if (is_numeric($item_id)) {
6183 6183
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6184
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6185
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6184
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6185
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6186 6186
             $result = Database::query($sql);
6187
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6187
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6188 6188
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6189 6189
 
6190 6190
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6211,8 +6211,8 @@  discard block
 block discarded – undo
6211 6211
                         break;
6212 6212
                     case TOOL_DOCUMENT:
6213 6213
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6214
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6215
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6214
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6215
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6216 6216
                         $result = Database::query($sql_doc);
6217 6217
                         $path_file = Database::result($result, 0, 0);
6218 6218
                         $path_parts = pathinfo($path_file);
@@ -6251,7 +6251,7 @@  discard block
 block discarded – undo
6251 6251
         if (is_numeric($item_id)) {
6252 6252
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6253 6253
             $sql = "SELECT * FROM $tbl_lp_item
6254
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6254
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6255 6255
             $res = Database::query($sql);
6256 6256
             $row = Database::fetch_array($res);
6257 6257
 
@@ -6262,21 +6262,21 @@  discard block
 block discarded – undo
6262 6262
                 case 'sco' :
6263 6263
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6264 6264
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6265
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6265
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6266 6266
                     } else {
6267
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6267
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6268 6268
                     }
6269 6269
                     break;
6270 6270
                 case TOOL_DOCUMENT :
6271 6271
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6272 6272
                     $sql = "SELECT lp.*, doc.path as dir
6273
-                            FROM " . $tbl_lp_item . " as lp
6274
-                            LEFT JOIN " . $tbl_doc . " as doc
6273
+                            FROM " . $tbl_lp_item." as lp
6274
+                            LEFT JOIN " . $tbl_doc." as doc
6275 6275
                             ON doc.id = lp.path
6276 6276
                             WHERE
6277 6277
                                 lp.c_id = $course_id AND
6278 6278
                                 doc.c_id = $course_id AND
6279
-                                lp.id = " . intval($item_id);
6279
+                                lp.id = ".intval($item_id);
6280 6280
                     $res_step = Database::query($sql);
6281 6281
                     $row_step = Database :: fetch_array($res_step);
6282 6282
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6286,8 +6286,8 @@  discard block
 block discarded – undo
6286 6286
                     $link_id = (string) $row['path'];
6287 6287
                     if (ctype_digit($link_id)) {
6288 6288
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6289
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6290
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6289
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6290
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6291 6291
                         $res_link = Database::query($sql_select);
6292 6292
                         $row_link = Database :: fetch_array($res_link);
6293 6293
                         if (is_array($row_link)) {
@@ -6300,9 +6300,9 @@  discard block
 block discarded – undo
6300 6300
                 case 'dokeos_module' :
6301 6301
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6302 6302
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6303
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6303
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6304 6304
                     } else {
6305
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6305
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6306 6306
                     }
6307 6307
                     break;
6308 6308
                 case TOOL_QUIZ :
@@ -6357,7 +6357,7 @@  discard block
 block discarded – undo
6357 6357
 
6358 6358
         $headers = array(
6359 6359
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6360
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6360
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6361 6361
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6362 6362
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6363 6363
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6397,16 +6397,16 @@  discard block
 block discarded – undo
6397 6397
         $course_id = api_get_course_int_id();
6398 6398
         $return = '';
6399 6399
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6400
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6401
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6400
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6401
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6402 6402
         $res_doc = Database::query($sql_doc);
6403 6403
         $row_doc = Database :: fetch_array($res_doc);
6404 6404
 
6405 6405
         // TODO: Add a path filter.
6406 6406
         if ($iframe) {
6407
-            $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>';
6407
+            $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 6408
         } else {
6409
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6409
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6410 6410
         }
6411 6411
 
6412 6412
         return $return;
@@ -6430,8 +6430,8 @@  discard block
 block discarded – undo
6430 6430
             $item_description = $extra_info['description'];
6431 6431
         } elseif (is_numeric($extra_info)) {
6432 6432
             $sql = "SELECT title, description
6433
-                    FROM " . $tbl_quiz . "
6434
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6433
+                    FROM " . $tbl_quiz."
6434
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6435 6435
 
6436 6436
             $result = Database::query($sql);
6437 6437
             $row = Database::fetch_array($result);
@@ -6441,8 +6441,8 @@  discard block
 block discarded – undo
6441 6441
             $item_title = '';
6442 6442
             $item_description = '';
6443 6443
         }
6444
-        $item_title			= Security::remove_XSS($item_title);
6445
-        $item_description 	= Security::remove_XSS($item_description);
6444
+        $item_title = Security::remove_XSS($item_title);
6445
+        $item_description = Security::remove_XSS($item_description);
6446 6446
 
6447 6447
         $legend = '<legend>';
6448 6448
         if ($id != 0 && is_array($extra_info))
@@ -6450,13 +6450,13 @@  discard block
 block discarded – undo
6450 6450
         else
6451 6451
             $parent = 0;
6452 6452
 
6453
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6454
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6453
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6454
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6455 6455
 
6456 6456
         $result = Database::query($sql);
6457
-        $arrLP = array ();
6457
+        $arrLP = array();
6458 6458
         while ($row = Database :: fetch_array($result)) {
6459
-            $arrLP[] = array (
6459
+            $arrLP[] = array(
6460 6460
                 'id' => $row['id'],
6461 6461
                 'item_type' => $row['item_type'],
6462 6462
                 'title' => $row['title'],
@@ -6479,15 +6479,15 @@  discard block
 block discarded – undo
6479 6479
         unset ($this->arrMenu);
6480 6480
 
6481 6481
         if ($action == 'add') {
6482
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6482
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6483 6483
         } elseif ($action == 'move') {
6484
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6484
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6485 6485
         } else {
6486
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6486
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6487 6487
         }
6488 6488
 
6489 6489
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6490
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6490
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6491 6491
         }
6492 6492
 
6493 6493
         $legend .= '</legend>';
@@ -6500,34 +6500,34 @@  discard block
 block discarded – undo
6500 6500
 
6501 6501
         if ($action != 'move') {
6502 6502
             $return .= '<tr>';
6503
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6504
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6503
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6504
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6505 6505
             $return .= '</tr>';
6506 6506
         }
6507 6507
 
6508 6508
         $return .= '<tr>';
6509 6509
 
6510
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6510
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6511 6511
         $return .= '<td class="input">';
6512 6512
 
6513 6513
         // Select for Parent item, root or chapter
6514 6514
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6515 6515
 
6516
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6516
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6517 6517
 
6518
-        $arrHide = array (
6518
+        $arrHide = array(
6519 6519
             $id
6520 6520
         );
6521 6521
         for ($i = 0; $i < count($arrLP); $i++) {
6522 6522
             if ($action != 'add') {
6523 6523
                 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)) {
6524
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6524
+                    $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 6525
                 } else {
6526 6526
                     $arrHide[] = $arrLP[$i]['id'];
6527 6527
                 }
6528 6528
             } else {
6529 6529
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6530
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6530
+                    $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 6531
             }
6532 6532
         }
6533 6533
         if (is_array($arrLP)) {
@@ -6539,11 +6539,11 @@  discard block
 block discarded – undo
6539 6539
         $return .= '</tr>';
6540 6540
         $return .= '<tr>';
6541 6541
 
6542
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6542
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6543 6543
         $return .= '<td class="input">';
6544 6544
 
6545 6545
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6546
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6546
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6547 6547
         for ($i = 0; $i < count($arrLP); $i++) {
6548 6548
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6549 6549
                 if (is_array($extra_info)) {
@@ -6555,7 +6555,7 @@  discard block
 block discarded – undo
6555 6555
                 } else {
6556 6556
                     $selected = '';
6557 6557
                 }
6558
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6558
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6559 6559
             }
6560 6560
         }
6561 6561
         $return .= '</select>';
@@ -6572,7 +6572,7 @@  discard block
 block discarded – undo
6572 6572
                     }
6573 6573
                 }
6574 6574
             }
6575
-            $arrHide = array ();
6575
+            $arrHide = array();
6576 6576
             for ($i = 0; $i < count($arrLP); $i++) {
6577 6577
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6578 6578
                     if (is_array($extra_info)) {
@@ -6618,27 +6618,27 @@  discard block
 block discarded – undo
6618 6618
 
6619 6619
         $return .= '<tr>';
6620 6620
         if ($action == 'add') {
6621
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6621
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6622 6622
         } else {
6623
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6623
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6624 6624
         }
6625 6625
 
6626 6626
         $return .= '</tr>';
6627 6627
         $return .= '</table>';
6628 6628
 
6629 6629
         if ($action == 'move') {
6630
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6631
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6630
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6631
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6632 6632
         }
6633 6633
 
6634 6634
         if (is_numeric($extra_info)) {
6635
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6635
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6636 6636
         } elseif (is_array($extra_info)) {
6637
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6637
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6638 6638
         }
6639 6639
 
6640
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6641
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6640
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6641
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6642 6642
 
6643 6643
         $return .= '</form>';
6644 6644
         $return .= '</div>';
@@ -6665,11 +6665,11 @@  discard block
 block discarded – undo
6665 6665
         } elseif (is_numeric($extra_info)) {
6666 6666
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6667 6667
 
6668
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6668
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6669 6669
                     WHERE
6670 6670
                         c_id = ".$course_id." AND
6671
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6672
-                        id = " . (int) $extra_info . "
6671
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6672
+                        id = " . (int) $extra_info."
6673 6673
                     ORDER BY id ASC";
6674 6674
 
6675 6675
             $res_hot = Database::query($sql);
@@ -6693,11 +6693,11 @@  discard block
 block discarded – undo
6693 6693
         }
6694 6694
 
6695 6695
         $sql = "SELECT * FROM $tbl_lp_item
6696
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6696
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6697 6697
         $result = Database::query($sql);
6698
-        $arrLP = array ();
6698
+        $arrLP = array();
6699 6699
         while ($row = Database :: fetch_array($result)) {
6700
-            $arrLP[] = array (
6700
+            $arrLP[] = array(
6701 6701
                 'id' => $row['id'],
6702 6702
                 'item_type' => $row['item_type'],
6703 6703
                 'title' => $row['title'],
@@ -6722,7 +6722,7 @@  discard block
 block discarded – undo
6722 6722
         else
6723 6723
             $legend .= get_lang('EditCurrentExecice');
6724 6724
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6725
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6725
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6726 6726
         }
6727 6727
         $legend .= '</legend>';
6728 6728
 
@@ -6730,11 +6730,11 @@  discard block
 block discarded – undo
6730 6730
         $return .= $legend;
6731 6731
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6732 6732
         $return .= '<tr>';
6733
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6733
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6734 6734
         $return .= '<td class="input">';
6735 6735
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6736
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6737
-        $arrHide = array (
6736
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6737
+        $arrHide = array(
6738 6738
             $id
6739 6739
         );
6740 6740
 
@@ -6742,13 +6742,13 @@  discard block
 block discarded – undo
6742 6742
             for ($i = 0; $i < count($arrLP); $i++) {
6743 6743
                 if ($action != 'add') {
6744 6744
                     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)) {
6745
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6745
+                        $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 6746
                     } else {
6747 6747
                         $arrHide[] = $arrLP[$i]['id'];
6748 6748
                     }
6749 6749
                 } else {
6750 6750
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6751
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6751
+                        $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 6752
                 }
6753 6753
             }
6754 6754
 
@@ -6759,10 +6759,10 @@  discard block
 block discarded – undo
6759 6759
         $return .= '</td>';
6760 6760
         $return .= '</tr>';
6761 6761
         $return .= '<tr>';
6762
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6762
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6763 6763
         $return .= '<td class="input">';
6764 6764
         $return .= '<select id="previous" name="previous" size="1">';
6765
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6765
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6766 6766
 
6767 6767
         for ($i = 0; $i < count($arrLP); $i++) {
6768 6768
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6772,7 +6772,7 @@  discard block
 block discarded – undo
6772 6772
                 else
6773 6773
                     $selected = '';
6774 6774
 
6775
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6775
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6776 6776
             }
6777 6777
         }
6778 6778
 
@@ -6782,8 +6782,8 @@  discard block
 block discarded – undo
6782 6782
 
6783 6783
         if ($action != 'move') {
6784 6784
             $return .= '<tr>';
6785
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6786
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6785
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6786
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6787 6787
             $return .= '</tr>';
6788 6788
             $id_prerequisite = 0;
6789 6789
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6794,7 +6794,7 @@  discard block
 block discarded – undo
6794 6794
                     }
6795 6795
                 }
6796 6796
 
6797
-                $arrHide = array ();
6797
+                $arrHide = array();
6798 6798
                 for ($i = 0; $i < count($arrLP); $i++) {
6799 6799
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6800 6800
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6808,22 +6808,22 @@  discard block
 block discarded – undo
6808 6808
         }
6809 6809
 
6810 6810
         $return .= '<tr>';
6811
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6811
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6812 6812
         $return .= '</tr>';
6813 6813
         $return .= '</table>';
6814 6814
 
6815 6815
         if ($action == 'move') {
6816
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6817
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6816
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6817
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6818 6818
         }
6819 6819
 
6820 6820
         if (is_numeric($extra_info)) {
6821
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6821
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6822 6822
         } elseif (is_array($extra_info)) {
6823
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6823
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6824 6824
         }
6825
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6826
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6825
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6826
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6827 6827
         $return .= '</form>';
6828 6828
 
6829 6829
         return $return;
@@ -6846,8 +6846,8 @@  discard block
 block discarded – undo
6846 6846
             $item_title = stripslashes($extra_info['title']);
6847 6847
         } elseif (is_numeric($extra_info)) {
6848 6848
             $sql = "SELECT forum_title as title, forum_comment as comment
6849
-                    FROM " . $tbl_forum . "
6850
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6849
+                    FROM " . $tbl_forum."
6850
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6851 6851
 
6852 6852
             $result = Database::query($sql);
6853 6853
             $row = Database :: fetch_array($result);
@@ -6867,7 +6867,7 @@  discard block
 block discarded – undo
6867 6867
             $parent = 0;
6868 6868
         }
6869 6869
 
6870
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6870
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6871 6871
                 WHERE
6872 6872
                     c_id = ".$course_id." AND
6873 6873
                     lp_id = " . $this->lp_id;
@@ -6875,7 +6875,7 @@  discard block
 block discarded – undo
6875 6875
         $arrLP = array();
6876 6876
 
6877 6877
         while ($row = Database :: fetch_array($result)) {
6878
-            $arrLP[] = array (
6878
+            $arrLP[] = array(
6879 6879
                 'id' => $row['id'],
6880 6880
                 'item_type' => $row['item_type'],
6881 6881
                 'title' => $row['title'],
@@ -6897,10 +6897,10 @@  discard block
 block discarded – undo
6897 6897
         unset($this->arrMenu);
6898 6898
 
6899 6899
         if ($action == 'add')
6900
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6901
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6900
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6901
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6902 6902
         else
6903
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6903
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6904 6904
 
6905 6905
         $legend .= '</legend>';
6906 6906
         $return = '<div class="sectioncomment">';
@@ -6910,16 +6910,16 @@  discard block
 block discarded – undo
6910 6910
 
6911 6911
         if ($action != 'move') {
6912 6912
             $return .= '<tr>';
6913
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6914
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6913
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6914
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6915 6915
             $return .= '</tr>';
6916 6916
         }
6917 6917
 
6918 6918
         $return .= '<tr>';
6919
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6919
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6920 6920
         $return .= '<td class="input">';
6921 6921
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6922
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6922
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6923 6923
         $arrHide = array(
6924 6924
             $id
6925 6925
         );
@@ -6928,13 +6928,13 @@  discard block
 block discarded – undo
6928 6928
         for ($i = 0; $i < count($arrLP); $i++) {
6929 6929
             if ($action != 'add') {
6930 6930
                 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)) {
6931
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6931
+                    $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 6932
                 } else {
6933 6933
                     $arrHide[] = $arrLP[$i]['id'];
6934 6934
                 }
6935 6935
             } else {
6936 6936
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6937
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6937
+                    $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 6938
             }
6939 6939
         }
6940 6940
         if (is_array($arrLP)) {
@@ -6945,10 +6945,10 @@  discard block
 block discarded – undo
6945 6945
         $return .= '</td>';
6946 6946
         $return .= '</tr>';
6947 6947
         $return .= '<tr>';
6948
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6948
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6949 6949
         $return .= '<td class="input">';
6950 6950
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6951
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6951
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6952 6952
 
6953 6953
         for ($i = 0; $i < count($arrLP); $i++) {
6954 6954
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6958,8 +6958,8 @@  discard block
 block discarded – undo
6958 6958
                 else
6959 6959
                     $selected = '';
6960 6960
 
6961
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6962
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6961
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6962
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6963 6963
             }
6964 6964
         }
6965 6965
 
@@ -6993,25 +6993,25 @@  discard block
 block discarded – undo
6993 6993
         $return .= '<tr>';
6994 6994
 
6995 6995
         if ($action == 'add') {
6996
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6996
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6997 6997
         } else {
6998
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6998
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
6999 6999
         }
7000 7000
         $return .= '</tr>';
7001 7001
         $return .= '</table>';
7002 7002
 
7003 7003
         if ($action == 'move') {
7004
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7005
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7004
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7005
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7006 7006
         }
7007 7007
 
7008 7008
         if (is_numeric($extra_info)) {
7009
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7009
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7010 7010
         } elseif (is_array($extra_info)) {
7011
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7011
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7012 7012
         }
7013
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7014
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7013
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7014
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7015 7015
         $return .= '</form>';
7016 7016
         $return .= '</div>';
7017 7017
 
@@ -7038,7 +7038,7 @@  discard block
 block discarded – undo
7038 7038
             $item_title = stripslashes($extra_info['title']);
7039 7039
         } elseif (is_numeric($extra_info)) {
7040 7040
             $sql = "SELECT thread_title as title FROM $tbl_forum
7041
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7041
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7042 7042
 
7043 7043
             $result = Database::query($sql);
7044 7044
             $row = Database :: fetch_array($result);
@@ -7058,15 +7058,15 @@  discard block
 block discarded – undo
7058 7058
             $parent = 0;
7059 7059
         }
7060 7060
 
7061
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7062
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7061
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7062
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7063 7063
 
7064 7064
         $result = Database::query($sql);
7065 7065
 
7066
-        $arrLP = array ();
7066
+        $arrLP = array();
7067 7067
 
7068 7068
         while ($row = Database :: fetch_array($result)) {
7069
-            $arrLP[] = array (
7069
+            $arrLP[] = array(
7070 7070
                 'id' => $row['id'],
7071 7071
                 'item_type' => $row['item_type'],
7072 7072
                 'title' => $row['title'],
@@ -7089,31 +7089,31 @@  discard block
 block discarded – undo
7089 7089
 
7090 7090
         $return .= '<form method="POST">';
7091 7091
         if ($action == 'add')
7092
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7093
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7092
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7093
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7094 7094
         else
7095
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7095
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7096 7096
 
7097 7097
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7098 7098
         $return .= '<tr>';
7099
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7099
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7100 7100
         $return .= '<td class="input">';
7101 7101
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7102
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7103
-        $arrHide = array (
7102
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7103
+        $arrHide = array(
7104 7104
             $id
7105 7105
         );
7106 7106
 
7107 7107
         for ($i = 0; $i < count($arrLP); $i++) {
7108 7108
             if ($action != 'add') {
7109 7109
                 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)) {
7110
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7110
+                    $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 7111
                 } else {
7112 7112
                     $arrHide[] = $arrLP[$i]['id'];
7113 7113
                 }
7114 7114
             } else {
7115 7115
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7116
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7116
+                    $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 7117
             }
7118 7118
         }
7119 7119
 
@@ -7125,10 +7125,10 @@  discard block
 block discarded – undo
7125 7125
         $return .= '</td>';
7126 7126
         $return .= '</tr>';
7127 7127
         $return .= '<tr>';
7128
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7128
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7129 7129
         $return .= '<td class="input">';
7130 7130
         $return .= '<select id="previous" name="previous" size="1">';
7131
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7131
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7132 7132
         for ($i = 0; $i < count($arrLP); $i++) {
7133 7133
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7134 7134
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7137,7 +7137,7 @@  discard block
 block discarded – undo
7137 7137
                 else
7138 7138
                     $selected = '';
7139 7139
 
7140
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7140
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7141 7141
             }
7142 7142
         }
7143 7143
         $return .= '</select>';
@@ -7145,8 +7145,8 @@  discard block
 block discarded – undo
7145 7145
         $return .= '</tr>';
7146 7146
         if ($action != 'move') {
7147 7147
             $return .= '<tr>';
7148
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7149
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7148
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7149
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7150 7150
             $return .= '</tr>';
7151 7151
             $return .= '<tr>';
7152 7152
             $return .= '</tr>';
@@ -7173,17 +7173,17 @@  discard block
 block discarded – undo
7173 7173
             }
7174 7174
 
7175 7175
             $return .= '<tr>';
7176
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7177
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7176
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7177
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7178 7178
 
7179 7179
             foreach ($arrHide as $key => $value) {
7180 7180
                 if ($key == $s_selected_position && $action == 'add') {
7181
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7181
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7182 7182
                 }
7183 7183
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7184
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7184
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7185 7185
                 } else {
7186
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7186
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7187 7187
                 }
7188 7188
             }
7189 7189
             $return .= "</select></td>";
@@ -7197,19 +7197,19 @@  discard block
 block discarded – undo
7197 7197
         $return .= '</table>';
7198 7198
 
7199 7199
         if ($action == 'move') {
7200
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7201
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7200
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7201
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7202 7202
         }
7203 7203
 
7204 7204
         if (is_numeric($extra_info)) {
7205
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7205
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7206 7206
         }
7207 7207
         elseif (is_array($extra_info)) {
7208
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7208
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7209 7209
         }
7210 7210
 
7211
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7212
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7211
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7212
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7213 7213
         $return .= '</form>';
7214 7214
         $return .= '</div>';
7215 7215
 
@@ -7235,10 +7235,10 @@  discard block
 block discarded – undo
7235 7235
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7236 7236
 
7237 7237
         if ($id != 0 && is_array($extra_info)) {
7238
-            $item_title 		= $extra_info['title'];
7239
-            $item_description 	= $extra_info['description'];
7240
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7241
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7238
+            $item_title = $extra_info['title'];
7239
+            $item_description = $extra_info['description'];
7240
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7241
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7242 7242
         } else {
7243 7243
             $item_title = '';
7244 7244
             $item_description = '';
@@ -7252,17 +7252,17 @@  discard block
 block discarded – undo
7252 7252
         }
7253 7253
 
7254 7254
         $id  = intval($id);
7255
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7255
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7256 7256
                 WHERE
7257 7257
                     c_id = ".$course_id." AND
7258
-                    lp_id = " . $this->lp_id . " AND
7258
+                    lp_id = " . $this->lp_id." AND
7259 7259
                     id != $id";
7260 7260
 
7261 7261
         if ($item_type == 'module')
7262 7262
             $sql .= " AND parent_item_id = 0";
7263 7263
 
7264 7264
         $result = Database::query($sql);
7265
-        $arrLP = array ();
7265
+        $arrLP = array();
7266 7266
 
7267 7267
         while ($row = Database :: fetch_array($result)) {
7268 7268
             $arrLP[] = array(
@@ -7290,9 +7290,9 @@  discard block
 block discarded – undo
7290 7290
 
7291 7291
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7292 7292
 
7293
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7293
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7294 7294
 
7295
-        $form = new FormValidator('form', 'POST',  $url);
7295
+        $form = new FormValidator('form', 'POST', $url);
7296 7296
 
7297 7297
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7298 7298
         $defaults['description'] = $item_description;
@@ -7336,7 +7336,7 @@  discard block
 block discarded – undo
7336 7336
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7337 7337
 
7338 7338
             foreach ($arrHide as $key => $value) {
7339
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7339
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7340 7340
             }
7341 7341
             if (!empty($s_selected_parent)) {
7342 7342
                 $parent_select->setSelected($s_selected_parent);
@@ -7358,16 +7358,16 @@  discard block
 block discarded – undo
7358 7358
                     $s_selected_position = $arrLP[$i]['id'];
7359 7359
                 }
7360 7360
 
7361
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7361
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7362 7362
             }
7363 7363
         }
7364 7364
 
7365 7365
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7366 7366
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7367
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7367
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7368 7368
 
7369 7369
         foreach ($arrHide as $key => $value) {
7370
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7370
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7371 7371
         }
7372 7372
 
7373 7373
         if (!empty ($s_selected_position)) {
@@ -7396,23 +7396,23 @@  discard block
 block discarded – undo
7396 7396
         //assets can't be modified
7397 7397
 
7398 7398
         //$item_type == 'asset' ||
7399
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7399
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7400 7400
 
7401 7401
             if ($item_type == 'sco') {
7402
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7402
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7403 7403
             }
7404 7404
             $renderer = $form->defaultRenderer();
7405 7405
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7406 7406
 
7407 7407
             $relative_prefix = '';
7408 7408
 
7409
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7409
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7410 7410
                 'Width' 				=> '100%',
7411 7411
                 'Height' 				=> '500',
7412 7412
                 'FullPage' 				=> true,
7413 7413
                 'CreateDocumentDir' 	=> $relative_prefix,
7414
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7415
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7414
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7415
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7416 7416
             );
7417 7417
 
7418 7418
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7421,7 +7421,7 @@  discard block
 block discarded – undo
7421 7421
             $defaults['content_lp'] = file_get_contents($content_path);
7422 7422
         }
7423 7423
 
7424
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7424
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7425 7425
         $form->addElement('hidden', 'post_time', time());
7426 7426
         $form->setDefaults($defaults);
7427 7427
         return $form->return_form();
@@ -7459,8 +7459,8 @@  discard block
 block discarded – undo
7459 7459
         // We don't display the document form if it's not an editable document (html or txt file).
7460 7460
         if ($action == "add") {
7461 7461
             if (is_numeric($extra_info)) {
7462
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7463
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7462
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7463
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7464 7464
                 $result = Database::query($sql_doc);
7465 7465
                 $path_file = Database :: result($result, 0, 0);
7466 7466
                 $path_parts = pathinfo($path_file);
@@ -7478,13 +7478,13 @@  discard block
 block discarded – undo
7478 7478
                 $item_title = stripslashes($path_parts['filename']);
7479 7479
             }
7480 7480
         } elseif (is_numeric($extra_info)) {
7481
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7481
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7482 7482
                         WHERE
7483 7483
                             c_id = ".$course_id." AND
7484 7484
                             id = " . intval($extra_info);
7485 7485
 
7486 7486
             $result = Database::query($sql_doc);
7487
-            $row 	= Database::fetch_array($result);
7487
+            $row = Database::fetch_array($result);
7488 7488
             $item_title = $row['title'];
7489 7489
             $item_title = str_replace('_', ' ', $item_title);
7490 7490
             if (empty ($item_title)) {
@@ -7503,11 +7503,11 @@  discard block
 block discarded – undo
7503 7503
             $parent = 0;
7504 7504
         }
7505 7505
 
7506
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7507
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7506
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7507
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7508 7508
 
7509 7509
         $result = Database::query($sql);
7510
-        $arrLP = array ();
7510
+        $arrLP = array();
7511 7511
         while ($row = Database :: fetch_array($result)) {
7512 7512
             $arrLP[] = array(
7513 7513
                 'id' => $row['id'],
@@ -7541,9 +7541,9 @@  discard block
 block discarded – undo
7541 7541
         $return .= '</legend>';
7542 7542
 
7543 7543
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7544
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7544
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7545 7545
         }
7546
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7546
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7547 7547
         $defaults['title'] = Security :: remove_XSS($item_title);
7548 7548
         if (empty($item_title)) {
7549 7549
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7579,15 +7579,15 @@  discard block
 block discarded – undo
7579 7579
         }
7580 7580
 
7581 7581
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7582
-        $my_count=0;
7582
+        $my_count = 0;
7583 7583
         foreach ($arrHide as $key => $value) {
7584
-            if ($my_count!=0) {
7584
+            if ($my_count != 0) {
7585 7585
                 // The LP name is also the first section and is not in the same charset like the other sections.
7586 7586
                 $value['value'] = Security :: remove_XSS($value['value']);
7587
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7587
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7588 7588
             } else {
7589 7589
                 $value['value'] = Security :: remove_XSS($value['value']);
7590
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7590
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7591 7591
             }
7592 7592
             $my_count++;
7593 7593
         }
@@ -7595,7 +7595,7 @@  discard block
 block discarded – undo
7595 7595
         if (!empty($id)) {
7596 7596
             $parent_select->setSelected($parent);
7597 7597
         } else {
7598
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7598
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7599 7599
             $parent_select->setSelected($parent_item_id);
7600 7600
         }
7601 7601
 
@@ -7612,7 +7612,7 @@  discard block
 block discarded – undo
7612 7612
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7613 7613
                     $s_selected_position = $arrLP[$i]['id'];
7614 7614
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7615
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7615
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7616 7616
             }
7617 7617
         }
7618 7618
 
@@ -7620,8 +7620,8 @@  discard block
 block discarded – undo
7620 7620
         $position->addOption(get_lang('FirstPosition'), 0);
7621 7621
 
7622 7622
         foreach ($arrHide as $key => $value) {
7623
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7624
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7623
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7624
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7625 7625
         }
7626 7626
         $position->setSelected($s_selected_position);
7627 7627
 
@@ -7691,7 +7691,7 @@  discard block
 block discarded – undo
7691 7691
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7692 7692
                             $relative_path 	 = implode('/', $relative_path);
7693 7693
                             if (strlen($relative_path) > 0) {
7694
-                                $relative_path = $relative_path . '/';
7694
+                                $relative_path = $relative_path.'/';
7695 7695
                             }
7696 7696
                         } else {
7697 7697
                             $result = $this->generate_lp_folder($_course);
@@ -7705,8 +7705,8 @@  discard block
 block discarded – undo
7705 7705
                             'Height' 				=> '500',
7706 7706
                             'FullPage' 				=> true,
7707 7707
                             'CreateDocumentDir' 	=> $relative_prefix,
7708
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7709
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7708
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7709
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7710 7710
                         );
7711 7711
 
7712 7712
                         if ($_GET['action'] == 'add_item') {
@@ -7773,8 +7773,8 @@  discard block
 block discarded – undo
7773 7773
             $item_url = stripslashes($extra_info['url']);
7774 7774
         } elseif (is_numeric($extra_info)) {
7775 7775
             $extra_info = intval($extra_info);
7776
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7777
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7776
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7777
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7778 7778
             $result = Database::query($sql);
7779 7779
             $row = Database :: fetch_array($result);
7780 7780
             $item_title       = $row['title'];
@@ -7794,8 +7794,8 @@  discard block
 block discarded – undo
7794 7794
             $parent = 0;
7795 7795
         }
7796 7796
 
7797
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7798
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7797
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7798
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7799 7799
         $result = Database::query($sql);
7800 7800
         $arrLP = array();
7801 7801
 
@@ -7822,10 +7822,10 @@  discard block
 block discarded – undo
7822 7822
         unset ($this->arrMenu);
7823 7823
 
7824 7824
         if ($action == 'add')
7825
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7826
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7825
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7826
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7827 7827
         else
7828
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7828
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7829 7829
 
7830 7830
         $legend .= '</legend>';
7831 7831
 
@@ -7836,16 +7836,16 @@  discard block
 block discarded – undo
7836 7836
 
7837 7837
         if ($action != 'move') {
7838 7838
             $return .= '<tr>';
7839
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7840
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7839
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7840
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7841 7841
             $return .= '</tr>';
7842 7842
         }
7843 7843
 
7844 7844
         $return .= '<tr>';
7845
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7845
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7846 7846
         $return .= '<td class="input">';
7847 7847
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7848
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7848
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7849 7849
         $arrHide = array(
7850 7850
             $id
7851 7851
         );
@@ -7855,13 +7855,13 @@  discard block
 block discarded – undo
7855 7855
         for ($i = 0; $i < count($arrLP); $i++) {
7856 7856
             if ($action != 'add') {
7857 7857
                 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)) {
7858
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7858
+                    $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 7859
                 } else {
7860 7860
                     $arrHide[] = $arrLP[$i]['id'];
7861 7861
                 }
7862 7862
             } else {
7863 7863
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7864
-                    $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>';
7864
+                    $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 7865
             }
7866 7866
         }
7867 7867
 
@@ -7873,11 +7873,11 @@  discard block
 block discarded – undo
7873 7873
         $return .= '</td>';
7874 7874
         $return .= '</tr>';
7875 7875
         $return .= '<tr>';
7876
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7876
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7877 7877
         $return .= '<td class="input">';
7878 7878
 
7879 7879
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7880
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7880
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7881 7881
         for ($i = 0; $i < count($arrLP); $i++) {
7882 7882
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7883 7883
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7887,7 +7887,7 @@  discard block
 block discarded – undo
7887 7887
                 else
7888 7888
                     $selected = '';
7889 7889
 
7890
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7890
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7891 7891
             }
7892 7892
         }
7893 7893
         $return .= '</select>';
@@ -7896,8 +7896,8 @@  discard block
 block discarded – undo
7896 7896
 
7897 7897
         if ($action != 'move') {
7898 7898
             $return .= '<tr>';
7899
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7900
-            $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>';
7899
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7900
+            $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>';
7901 7901
             $return .= '</tr>';
7902 7902
             $id_prerequisite = 0;
7903 7903
             if (is_array($arrLP)) {
@@ -7924,25 +7924,25 @@  discard block
 block discarded – undo
7924 7924
 
7925 7925
         $return .= '<tr>';
7926 7926
         if ($action == 'add') {
7927
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7927
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7928 7928
         } else {
7929
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7929
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7930 7930
         }
7931 7931
         $return .= '</tr>';
7932 7932
         $return .= '</table>';
7933 7933
 
7934 7934
         if ($action == 'move') {
7935
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7936
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7935
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7936
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7937 7937
         }
7938 7938
 
7939 7939
         if (is_numeric($extra_info)) {
7940
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7940
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7941 7941
         } elseif (is_array($extra_info)) {
7942
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7942
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7943 7943
         }
7944
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7945
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7944
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7945
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7946 7946
         $return .= '</form>';
7947 7947
         $return .= '</div>';
7948 7948
 
@@ -7968,8 +7968,8 @@  discard block
 block discarded – undo
7968 7968
         } elseif (is_numeric($extra_info)) {
7969 7969
             $extra_info = intval($extra_info);
7970 7970
             $sql = "SELECT title, description
7971
-                    FROM " . $tbl_publication . "
7972
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7971
+                    FROM " . $tbl_publication."
7972
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7973 7973
 
7974 7974
             $result = Database::query($sql);
7975 7975
             $row = Database :: fetch_array($result);
@@ -7985,13 +7985,13 @@  discard block
 block discarded – undo
7985 7985
             $parent = 0;
7986 7986
         }
7987 7987
 
7988
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7989
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7988
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7989
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7990 7990
 
7991 7991
         $result = Database::query($sql);
7992 7992
         $arrLP = array();
7993 7993
         while ($row = Database :: fetch_array($result)) {
7994
-            $arrLP[] = array (
7994
+            $arrLP[] = array(
7995 7995
                 'id' => $row['id'],
7996 7996
                 'item_type' => $row['item_type'],
7997 7997
                 'title' => $row['title'],
@@ -8037,7 +8037,7 @@  discard block
 block discarded – undo
8037 8037
             ]
8038 8038
         );
8039 8039
 
8040
-        $arrHide = array (
8040
+        $arrHide = array(
8041 8041
             $id
8042 8042
         );
8043 8043
 
@@ -8055,7 +8055,7 @@  discard block
 block discarded – undo
8055 8055
                     $parentSelect->addOption(
8056 8056
                         $arrLP[$i]['title'],
8057 8057
                         $arrLP[$i]['id'],
8058
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8058
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8059 8059
                     );
8060 8060
 
8061 8061
                     if ($parent == $arrLP[$i]['id']) {
@@ -8072,7 +8072,7 @@  discard block
 block discarded – undo
8072 8072
                     $parentSelect->addOption(
8073 8073
                         $arrLP[$i]['title'],
8074 8074
                         $arrLP[$i]['id'],
8075
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8075
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8076 8076
                     );
8077 8077
 
8078 8078
                     if ($parent == $arrLP[$i]['id']) {
@@ -8096,7 +8096,7 @@  discard block
 block discarded – undo
8096 8096
         for ($i = 0; $i < count($arrLP); $i++) {
8097 8097
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8098 8098
                 $previousSelect->addOption(
8099
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8099
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8100 8100
                     $arrLP[$i]['id']
8101 8101
                 );
8102 8102
 
@@ -8118,7 +8118,7 @@  discard block
 block discarded – undo
8118 8118
                     }
8119 8119
                 }
8120 8120
             }
8121
-            $arrHide = array ();
8121
+            $arrHide = array();
8122 8122
             for ($i = 0; $i < count($arrLP); $i++) {
8123 8123
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8124 8124
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8210,8 +8210,8 @@  discard block
 block discarded – undo
8210 8210
 
8211 8211
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8212 8212
         $item_id = intval($item_id);
8213
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8214
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8213
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8214
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8215 8215
         $result = Database::query($sql);
8216 8216
         $row = Database::fetch_assoc($result);
8217 8217
 
@@ -8225,16 +8225,16 @@  discard block
 block discarded – undo
8225 8225
             $audio_player .= '<script>
8226 8226
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8227 8227
                                 s1.addParam("allowscriptaccess","always");
8228
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8228
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8229 8229
                                 s1.write("container");
8230 8230
                             </script>';
8231 8231
         }
8232 8232
 
8233
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8233
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8234 8234
 
8235 8235
         $return .= Display::url(
8236 8236
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8237
-            $url.'&action=edit_item&path_item=' . $row['path']
8237
+            $url.'&action=edit_item&path_item='.$row['path']
8238 8238
         );
8239 8239
 
8240 8240
         $return .= Display::url(
@@ -8254,12 +8254,12 @@  discard block
 block discarded – undo
8254 8254
             $url.'&action=delete_item'
8255 8255
         );
8256 8256
 
8257
-        if ($item_type == TOOL_HOTPOTATOES ) {
8257
+        if ($item_type == TOOL_HOTPOTATOES) {
8258 8258
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8259 8259
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8260 8260
         }
8261 8261
 
8262
-        if ($item_type == TOOL_DOCUMENT ) {
8262
+        if ($item_type == TOOL_DOCUMENT) {
8263 8263
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8264 8264
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8265 8265
         }
@@ -8280,13 +8280,13 @@  discard block
 block discarded – undo
8280 8280
     public function get_js_dropdown_array()
8281 8281
     {
8282 8282
         $course_id = api_get_course_int_id();
8283
-        $return = 'var child_name = new Array();' . "\n";
8284
-        $return .= 'var child_value = new Array();' . "\n\n";
8285
-        $return .= 'child_name[0] = new Array();' . "\n";
8286
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8283
+        $return = 'var child_name = new Array();'."\n";
8284
+        $return .= 'var child_value = new Array();'."\n\n";
8285
+        $return .= 'child_name[0] = new Array();'."\n";
8286
+        $return .= 'child_value[0] = new Array();'."\n\n";
8287 8287
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8288
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8289
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8288
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8289
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8290 8290
                     ORDER BY display_order ASC";
8291 8291
         $res_zero = Database::query($sql_zero);
8292 8292
         $i = 0;
@@ -8296,28 +8296,28 @@  discard block
 block discarded – undo
8296 8296
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8297 8297
             }
8298 8298
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8299
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8300
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8299
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8300
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8301 8301
         }
8302 8302
         $return .= "\n";
8303
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8304
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8303
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8304
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8305 8305
         $res = Database::query($sql);
8306 8306
         while ($row = Database :: fetch_array($res)) {
8307
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8307
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8308 8308
                            WHERE
8309 8309
                                 c_id = ".$course_id." AND
8310
-                                parent_item_id = " . $row['id'] . "
8310
+                                parent_item_id = " . $row['id']."
8311 8311
                            ORDER BY display_order ASC";
8312 8312
             $res_parent = Database::query($sql_parent);
8313 8313
             $i = 0;
8314
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8315
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8314
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8315
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8316 8316
 
8317 8317
             while ($row_parent = Database :: fetch_array($res_parent)) {
8318 8318
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8319
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8320
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8319
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8320
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8321 8321
             }
8322 8322
             $return .= "\n";
8323 8323
         }
@@ -8338,8 +8338,8 @@  discard block
 block discarded – undo
8338 8338
         if (is_numeric($item_id)) {
8339 8339
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8340 8340
 
8341
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8342
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8341
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8342
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8343 8343
 
8344 8344
             $res = Database::query($sql);
8345 8345
             $row = Database :: fetch_array($res);
@@ -8398,7 +8398,7 @@  discard block
 block discarded – undo
8398 8398
      */
8399 8399
     public function display_item_small_form($item_type, $title = '', $data = array())
8400 8400
     {
8401
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8401
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8402 8402
         $form = new FormValidator('small_form', 'post', $url);
8403 8403
         $form->addElement('header', $title);
8404 8404
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8424,7 +8424,7 @@  discard block
 block discarded – undo
8424 8424
         $item_id = intval($item_id);
8425 8425
         /* Current prerequisite */
8426 8426
         $sql = "SELECT * FROM $tbl_lp_item
8427
-                WHERE c_id = $course_id AND id = " . $item_id;
8427
+                WHERE c_id = $course_id AND id = ".$item_id;
8428 8428
         $result = Database::query($sql);
8429 8429
         $row    = Database::fetch_array($result);
8430 8430
         $prerequisiteId = $row['prerequisite'];
@@ -8434,20 +8434,20 @@  discard block
 block discarded – undo
8434 8434
         $return .= '<form method="POST">';
8435 8435
         $return .= '<table class="data_table">';
8436 8436
         $return .= '<tr>';
8437
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8438
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8439
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8437
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8438
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8439
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8440 8440
         $return .= '</tr>';
8441 8441
 
8442 8442
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8443 8443
         $return .= '<tr >';
8444 8444
         $return .= '<td colspan="3" class="radio">';
8445 8445
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8446
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8446
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8447 8447
         $return .= '</tr>';
8448 8448
 
8449 8449
         $sql = "SELECT * FROM $tbl_lp_item
8450
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8450
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8451 8451
         $result = Database::query($sql);
8452 8452
         $arrLP = array();
8453 8453
 
@@ -8490,24 +8490,24 @@  discard block
 block discarded – undo
8490 8490
             }
8491 8491
 
8492 8492
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8493
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8493
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8494 8494
 
8495 8495
             $return .= '<tr>';
8496
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8497
-            $return .= '<label for="id' . $item['id'] . '">';
8498
-            $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'] . '" />';
8496
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8497
+            $return .= '<label for="id'.$item['id'].'">';
8498
+            $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'].'" />';
8499 8499
             $icon_name = str_replace(' ', '', $item['item_type']);
8500 8500
 
8501
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8502
-                $return .= '<img alt="" src="../img/lp_' . $icon_name . '.png" style="margin-right:5px;" title="" />';
8501
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8502
+                $return .= '<img alt="" src="../img/lp_'.$icon_name.'.png" style="margin-right:5px;" title="" />';
8503 8503
             } else {
8504
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8505
-                    $return .= '<img alt="" src="../img/lp_' . $icon_name . '.gif" style="margin-right:5px;" title="" />';
8504
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8505
+                    $return .= '<img alt="" src="../img/lp_'.$icon_name.'.gif" style="margin-right:5px;" title="" />';
8506 8506
                 } else {
8507
-                    $return .= Display::return_icon('folder_document.gif','',array('style'=>'margin-right:5px;'));
8507
+                    $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8508 8508
                 }
8509 8509
             }
8510
-            $return .=  $item['title'] . '</label>';
8510
+            $return .= $item['title'].'</label>';
8511 8511
             $return .= '</td>';
8512 8512
 
8513 8513
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8521,19 +8521,19 @@  discard block
 block discarded – undo
8521 8521
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8522 8522
 
8523 8523
                 $return .= '<td class="exercise">';
8524
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8524
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8525 8525
                 $return .= '</td>';
8526 8526
                 $return .= '<td class="exercise">';
8527
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8527
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8528 8528
                 $return .= '</td>';
8529 8529
             }
8530 8530
 
8531 8531
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8532 8532
                 $return .= '<td class="exercise">';
8533
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8533
+                $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 8534
                 $return .= '</td>';
8535 8535
                 $return .= '<td class="exercise"">';
8536
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8536
+                $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 8537
                 $return .= '</td>';
8538 8538
             }
8539 8539
             $return .= '</tr>';
@@ -8542,7 +8542,7 @@  discard block
 block discarded – undo
8542 8542
         $return .= '</tr>';
8543 8543
         $return .= '</table>';
8544 8544
         $return .= '<div style="padding-top:3px;">';
8545
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8545
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8546 8546
         $return .= '</form>';
8547 8547
 
8548 8548
         return $return;
@@ -8578,7 +8578,7 @@  discard block
 block discarded – undo
8578 8578
                 if ($row['id'] == $lp_id) {
8579 8579
                     continue;
8580 8580
                 }
8581
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8581
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8582 8582
             }
8583 8583
         }
8584 8584
         $return .= '</select>';
@@ -8638,8 +8638,8 @@  discard block
 block discarded – undo
8638 8638
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8639 8639
                      ORDER BY title ASC";
8640 8640
 
8641
-        $sql_hot  = "SELECT * FROM $tbl_doc
8642
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8641
+        $sql_hot = "SELECT * FROM $tbl_doc
8642
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8643 8643
                      ORDER BY id ASC";
8644 8644
 
8645 8645
         $res_quiz = Database::query($sql_quiz);
@@ -8649,8 +8649,8 @@  discard block
 block discarded – undo
8649 8649
 
8650 8650
         $return .= '<li class="lp_resource_element">';
8651 8651
         $return .= '<img alt="" src="../img/new_test_small.gif" style="margin-right:5px;" title="" />';
8652
-        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8653
-            get_lang('NewExercise') . '</a>';
8652
+        $return .= '<a href="'.api_get_path(REL_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8653
+            get_lang('NewExercise').'</a>';
8654 8654
         $return .= '</li>';
8655 8655
 
8656 8656
         // Display hotpotatoes
@@ -8662,8 +8662,8 @@  discard block
 block discarded – undo
8662 8662
             $return .= '</a> ';
8663 8663
 
8664 8664
             $return .= '<img src="../img/hotpotatoes_s.png" style="margin-right:5px;" title="" width="16px" />';
8665
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8666
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8665
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8666
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8667 8667
             $return .= '</li>';
8668 8668
         }
8669 8669
 
@@ -8673,7 +8673,7 @@  discard block
 block discarded – undo
8673 8673
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8674 8674
             $return .= '</a> ';
8675 8675
             $return .= '<img alt="" src="../img/quizz_small.gif" style="margin-right:5px;" title="" />';
8676
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8676
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8677 8677
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8678 8678
                 '</a>';
8679 8679
             $return .= '</li>';
@@ -8743,7 +8743,7 @@  discard block
 block discarded – undo
8743 8743
         foreach ($categorizedLinks as $categoryId => $links) {
8744 8744
             $linkNodes = null;
8745 8745
             foreach ($links as $key => $title) {
8746
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8746
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8747 8747
                     $linkNodes .=
8748 8748
                         '<li class="lp_resource_element" data_id="'.$key.
8749 8749
                         '" data_type="'.TOOL_LINK.'" title="'.$title.'" >
@@ -8783,7 +8783,7 @@  discard block
 block discarded – undo
8783 8783
         $return = '<div class="lp_resource" >';
8784 8784
         $return .= '<div class="lp_resource_element">';
8785 8785
         $return .= '<img align="left" alt="" src="../img/works_small.gif" style="margin-right:5px;" title="" />';
8786
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8786
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8787 8787
         $return .= '</div>';
8788 8788
         $return .= '</div>';
8789 8789
         return $return;
@@ -8805,7 +8805,7 @@  discard block
 block discarded – undo
8805 8805
         //First add link
8806 8806
         $return .= '<li class="lp_resource_element">';
8807 8807
         $return .= '<img alt="" src="../img/forum_new_small.gif" style="margin-right:5px;" title="" />';
8808
-        $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>';
8808
+        $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>';
8809 8809
         $return .= '</li>';
8810 8810
 
8811 8811
         $return .= '<script>
@@ -8827,15 +8827,15 @@  discard block
 block discarded – undo
8827 8827
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8828 8828
                 $return .= ' </a>';
8829 8829
                 $return .= '<img alt="" src="../img/lp_forum.gif" style="margin-right:5px;" title="" />';
8830
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8831
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8830
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8831
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8832 8832
                             </a>
8833
-                            <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">' .
8834
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8833
+                            <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">'.
8834
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8835 8835
 
8836 8836
                 $return .= '</li>';
8837 8837
 
8838
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8838
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8839 8839
                 $a_threads = get_threads($forum['forum_id']);
8840 8840
                 if (is_array($a_threads)) {
8841 8841
                     foreach ($a_threads as $thread) {
@@ -8844,8 +8844,8 @@  discard block
 block discarded – undo
8844 8844
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8845 8845
                         $return .= ' </a>';
8846 8846
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8847
-                        $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 . '">' .
8848
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8847
+                        $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.'">'.
8848
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8849 8849
                         $return .= '</li>';
8850 8850
                     }
8851 8851
                 }
@@ -8916,7 +8916,7 @@  discard block
 block discarded – undo
8916 8916
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8917 8917
             // Remove the possible . at the end of the path.
8918 8918
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8919
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8919
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8920 8920
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8921 8921
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8922 8922
         }
@@ -8984,7 +8984,7 @@  discard block
 block discarded – undo
8984 8984
                 if ($item->type == 'sco') {
8985 8985
                     $inc_docs = $item->get_resources_from_source(
8986 8986
                         null,
8987
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8987
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8988 8988
                     );
8989 8989
                 } else {
8990 8990
                     $inc_docs = $item->get_resources_from_source();
@@ -9200,7 +9200,7 @@  discard block
 block discarded – undo
9200 9200
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9201 9201
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9202 9202
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9203
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9203
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9204 9204
                                         $my_dep->setAttribute('xml:base', '');
9205 9205
                                     }
9206 9206
                                 }
@@ -9331,7 +9331,7 @@  discard block
 block discarded – undo
9331 9331
                         //$my_item->appendChild($my_max_score);
9332 9332
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9333 9333
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9334
-                        $my_prereqs->setAttribute('type','aicc_script');
9334
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9335 9335
                         $my_item->appendChild($my_prereqs);
9336 9336
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9337 9337
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9384,7 +9384,7 @@  discard block
 block discarded – undo
9384 9384
                         $my_resource->appendChild($my_file);
9385 9385
 
9386 9386
                         // Get included docs.
9387
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9387
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9388 9388
                         // Dependency to other files - not yet supported.
9389 9389
                         $i = 1;
9390 9390
                         foreach ($inc_docs as $doc_info) {
@@ -9445,7 +9445,7 @@  discard block
 block discarded – undo
9445 9445
                                         $my_dep_file->setAttribute('href', $file_path);
9446 9446
                                         $my_dep->setAttribute('xml:base', '');
9447 9447
 
9448
-                                        if (strstr($file_path,$main_path) !== false) {
9448
+                                        if (strstr($file_path, $main_path) !== false) {
9449 9449
                                             // The calculated real path is really inside the chamilo root path.
9450 9450
                                             // Reduce file path to what's under the DocumentRoot.
9451 9451
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9463,7 +9463,7 @@  discard block
 block discarded – undo
9463 9463
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9464 9464
                                             $file_path = str_replace('//', '/', $file_path);
9465 9465
                                             if (file_exists($file_path)) {
9466
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9466
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9467 9467
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9468 9468
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9469 9469
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9692,7 +9692,7 @@  discard block
 block discarded – undo
9692 9692
             if (strpos($extra_file, '.') === 0)
9693 9693
                 continue;
9694 9694
             else {
9695
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9695
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9696 9696
                 $this->create_path($dest_file);
9697 9697
                 copy($main_code_path.$extra_file, $dest_file);
9698 9698
             }
@@ -9745,7 +9745,7 @@  discard block
 block discarded – undo
9745 9745
                             }
9746 9746
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9747 9747
                             if (file_exists($file_path)) {
9748
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9748
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9749 9749
                             }
9750 9750
                             break;
9751 9751
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9785,12 +9785,12 @@  discard block
 block discarded – undo
9785 9785
 
9786 9786
         foreach ($path_bits as $bit) {
9787 9787
             if (!empty ($bit)) {
9788
-                $new_path = $path_built . $bit;
9788
+                $new_path = $path_built.$bit;
9789 9789
                 if (is_dir($new_path)) {
9790
-                    $path_built = $new_path . '/';
9790
+                    $path_built = $new_path.'/';
9791 9791
                 } else {
9792 9792
                     mkdir($new_path, api_get_permissions_for_new_directories());
9793
-                    $path_built = $new_path . '/';
9793
+                    $path_built = $new_path.'/';
9794 9794
                 }
9795 9795
             }
9796 9796
         }
@@ -9834,9 +9834,9 @@  discard block
 block discarded – undo
9834 9834
 
9835 9835
         if ($upload_ok) {
9836 9836
             if ($has_attachment) {
9837
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9837
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9838 9838
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9839
-                $updir = $sys_course_path . $courseDir;
9839
+                $updir = $sys_course_path.$courseDir;
9840 9840
                 // Try to add an extension to the file if it hasn't one.
9841 9841
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9842 9842
 
@@ -9891,7 +9891,7 @@  discard block
 block discarded – undo
9891 9891
             //Setting my lp_id to autolaunch = 1
9892 9892
             $attributes['autolaunch'] = 1;
9893 9893
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9894
-            Database::update($lp_table, $attributes, $where );
9894
+            Database::update($lp_table, $attributes, $where);
9895 9895
         }
9896 9896
     }
9897 9897
 
@@ -9910,13 +9910,13 @@  discard block
 block discarded – undo
9910 9910
 
9911 9911
         // Get the max order of the items
9912 9912
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9913
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9913
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9914 9914
         $rs_max_order = Database::query($sql_max_order);
9915 9915
         $row_max_order = Database::fetch_object($rs_max_order);
9916 9916
         $max_order = $row_max_order->display_order;
9917 9917
         // Get the previous item ID
9918 9918
         $sql = "SELECT id as previous FROM $table_lp_item
9919
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9919
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9920 9920
         $rs_max = Database::query($sql);
9921 9921
         $row_max = Database::fetch_object($rs_max);
9922 9922
 
@@ -9972,9 +9972,9 @@  discard block
 block discarded – undo
9972 9972
         $documents_total_space = DocumentManager::documents_total_space();
9973 9973
         $course_max_space = DocumentManager::get_course_quota();
9974 9974
         $total_size = filesize($s) + $documents_total_space;
9975
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9975
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9976 9976
             return true;
9977
-        } else{
9977
+        } else {
9978 9978
             return false;
9979 9979
         }
9980 9980
     }
@@ -10314,7 +10314,7 @@  discard block
 block discarded – undo
10314 10314
         if ($this->debug > 0) {
10315 10315
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10316 10316
         }
10317
-        $this->subscribeUsers = intval($value);;
10317
+        $this->subscribeUsers = intval($value); ;
10318 10318
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10319 10319
         $lp_id = $this->get_id();
10320 10320
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10660,7 +10660,7 @@  discard block
 block discarded – undo
10660 10660
      */
10661 10661
     public function createForum($forumCategoryId)
10662 10662
     {
10663
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10663
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10664 10664
 
10665 10665
         $forumId = store_forum(
10666 10666
             [
Please login to merge, or discard this patch.
main/document/slideshow.php 1 patch
Indentation   +279 added lines, -279 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null;
16 16
 
17 17
 if (empty($slide_id)) {
18
-	$edit_slide_id = 1;
18
+    $edit_slide_id = 1;
19 19
 } else {
20
-	$edit_slide_id = $slide_id;
20
+    $edit_slide_id = $slide_id;
21 21
 }
22 22
 
23 23
 if ($path != '/') {
24
-	$folder = $path.'/';
24
+    $folder = $path.'/';
25 25
 } else {
26
-	$folder = '/';
26
+    $folder = '/';
27 27
 }
28 28
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
29 29
 
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Loading the slides from the session
43 43
 if (isset($_SESSION['image_files_only'])) {
44
-	$image_files_only = $_SESSION['image_files_only'];
44
+    $image_files_only = $_SESSION['image_files_only'];
45 45
 }
46 46
 
47 47
 // Calculating the current slide, next slide, previous slide and the number of slides
48 48
 $slide = null;
49 49
 if ($slide_id != 'all') {
50
-	$slide = $slide_id ? $slide_id : 0;
51
-	$previous_slide = $slide - 1;
52
-	$next_slide = $slide + 1;
50
+    $slide = $slide_id ? $slide_id : 0;
51
+    $previous_slide = $slide - 1;
52
+    $next_slide = $slide + 1;
53 53
 }
54 54
 $total_slides = count($image_files_only);
55 55
 ?>
@@ -62,59 +62,59 @@  discard block
 block discarded – undo
62 62
 <?php
63 63
 
64 64
 if ($slide_id != 'all') {
65
-	$image = null;
66
-	if (isset($image_files_only[$slide])) {
67
-		$image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
-	}
69
-	if (file_exists($image)) {
70
-		echo '<div class="actions-pagination">';
71
-
72
-		// Back forward buttons
73
-		if ($slide == 0) {
74
-			$imgp = 'action_prev_na.png';
75
-			$first = Display::return_icon('action_first_na.png');
76
-		} else {
77
-			$imgp = 'action_prev.png';
78
-			$first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
65
+    $image = null;
66
+    if (isset($image_files_only[$slide])) {
67
+        $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide];
68
+    }
69
+    if (file_exists($image)) {
70
+        echo '<div class="actions-pagination">';
71
+
72
+        // Back forward buttons
73
+        if ($slide == 0) {
74
+            $imgp = 'action_prev_na.png';
75
+            $first = Display::return_icon('action_first_na.png');
76
+        } else {
77
+            $imgp = 'action_prev.png';
78
+            $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
79 79
 			          '.Display::return_icon('action_first.png', get_lang('FirstSlide')).'
80 80
 			          </a>';
81
-		}
82
-
83
-		// First slide
84
-		echo $first;
85
-
86
-		// Previous slide
87
-		if ($slide > 0) {
88
-			echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
-		}
90
-		echo '<img src="'.api_get_path(WEB_IMG_PATH).$imgp.'" title="'.get_lang('Previous').'" alt="'.get_lang('Previous').'">';
91
-		if ($slide > 0) {
92
-			echo '</a>';
93
-		}
94
-
95
-		// Divider
96
-		echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
97
-
98
-		// Next slide
99
-		if ($slide < $total_slides - 1) {
100
-			echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
101
-		}
102
-		if ($slide == $total_slides - 1) {
103
-			$imgn = 'action_next_na.png';
104
-			$last = '<img src="'.api_get_path(WEB_IMG_PATH).'action_last_na.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'">';
105
-		} else {
106
-			$imgn = 'action_next.png';
107
-			$last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'action_last.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'"></a>';
108
-		}
109
-		echo '<img src="'.api_get_path(WEB_IMG_PATH).$imgn.'" title="'.get_lang('Next').'" alt="'.get_lang('Next').'">';
110
-		if ($slide > 0) {
111
-			echo '</a>';
112
-		}
113
-
114
-		// Last slide
115
-		echo $last;
116
-		echo '</div>';
117
-	}
81
+        }
82
+
83
+        // First slide
84
+        echo $first;
85
+
86
+        // Previous slide
87
+        if ($slide > 0) {
88
+            echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
89
+        }
90
+        echo '<img src="'.api_get_path(WEB_IMG_PATH).$imgp.'" title="'.get_lang('Previous').'" alt="'.get_lang('Previous').'">';
91
+        if ($slide > 0) {
92
+            echo '</a>';
93
+        }
94
+
95
+        // Divider
96
+        echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
97
+
98
+        // Next slide
99
+        if ($slide < $total_slides - 1) {
100
+            echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
101
+        }
102
+        if ($slide == $total_slides - 1) {
103
+            $imgn = 'action_next_na.png';
104
+            $last = '<img src="'.api_get_path(WEB_IMG_PATH).'action_last_na.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'">';
105
+        } else {
106
+            $imgn = 'action_next.png';
107
+            $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"><img src="'.api_get_path(WEB_IMG_PATH).'action_last.png" title="'.get_lang('LastSlide').'" alt="'.get_lang('LastSlide').'"></a>';
108
+        }
109
+        echo '<img src="'.api_get_path(WEB_IMG_PATH).$imgn.'" title="'.get_lang('Next').'" alt="'.get_lang('Next').'">';
110
+        if ($slide > 0) {
111
+            echo '</a>';
112
+        }
113
+
114
+        // Last slide
115
+        echo $last;
116
+        echo '</div>';
117
+    }
118 118
 }
119 119
 
120 120
 // Exit the slideshow
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 
124 124
 // Show thumbnails
125 125
 if ($slide_id != 'all') {
126
-	echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
126
+    echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
127 127
         Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>';
128 128
 } else {
129
-	echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
129
+    echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM);
130 130
 }
131 131
 // Slideshow options
132 132
 echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
@@ -142,24 +142,24 @@  discard block
 block discarded – undo
142 142
 
143 143
 // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options
144 144
 if (isset($_POST['Submit'])) {
145
-	// We come from slideshowoptions.php
146
-	//$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
-	$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
-	if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
-		//echo "resizing";
150
-		$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
-		$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
-	} else {
153
-		//echo "unsetting the session heighte and width";
154
-		$_SESSION["image_resizing_width"] = null;
155
-		$_SESSION["image_resizing_height"] = null;
156
-	}
145
+    // We come from slideshowoptions.php
146
+    //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
147
+    $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
148
+    if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
149
+        //echo "resizing";
150
+        $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
151
+        $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
152
+    } else {
153
+        //echo "unsetting the session heighte and width";
154
+        $_SESSION["image_resizing_width"] = null;
155
+        $_SESSION["image_resizing_height"] = null;
156
+    }
157 157
 }
158 158
 $target_width = $target_height = null;
159 159
 // The target height and width depends if we choose resizing or no resizing
160 160
 if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == "resizing") {
161
-	$target_width = $_SESSION["image_resizing_width"];
162
-	$target_height = $_SESSION["image_resizing_height"];
161
+    $target_width = $_SESSION["image_resizing_width"];
162
+    $target_height = $_SESSION["image_resizing_height"];
163 163
 }
164 164
 
165 165
 /*	THUMBNAIL VIEW */
@@ -169,59 +169,59 @@  discard block
 block discarded – undo
169 169
 $html = '';
170 170
 if ($slide_id == 'all') {
171 171
 
172
-	// Config for make thumbnails
172
+    // Config for make thumbnails
173 173
     $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
174
-	$max_thumbnail_width     = 250;
175
-	$max_thumbnail_height    = 250;
176
-	$png_compression	     = 0; // 0(none)-9
177
-	$jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
174
+    $max_thumbnail_width     = 250;
175
+    $max_thumbnail_height    = 250;
176
+    $png_compression	     = 0; // 0(none)-9
177
+    $jpg_quality  	         = 75; // from 0 to 100 (default is 75). More quality less compression
178 178
 
179
-	$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
179
+    $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
180 180
 
181
-	//Other parameters only for show tumbnails
182
-	$row_items 			     = 4;//only in slideshow.php
183
-	$number_image 			 = 7;//num icons cols to show
184
-	$thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x
185
-	$thumbnail_height_frame = $max_thumbnail_height;
181
+    //Other parameters only for show tumbnails
182
+    $row_items 			     = 4;//only in slideshow.php
183
+    $number_image 			 = 7;//num icons cols to show
184
+    $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x
185
+    $thumbnail_height_frame = $max_thumbnail_height;
186 186
 
187
-	// Create the template_thumbnails folder (if no exist)
187
+    // Create the template_thumbnails folder (if no exist)
188 188
 
189
-	if (!file_exists($directory_thumbnails)) {
190
-		@mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
189
+    if (!file_exists($directory_thumbnails)) {
190
+        @mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
191 191
     }
192 192
 
193
-	// check files and thumbnails
194
-	if (is_array($image_files_only)) {
193
+    // check files and thumbnails
194
+    if (is_array($image_files_only)) {
195 195
 
196
-		foreach ($image_files_only as $one_image_file) {
197
-			$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
-			$image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
196
+        foreach ($image_files_only as $one_image_file) {
197
+            $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
198
+            $image_thumbnail= $directory_thumbnails.'.'.$one_image_file;
199 199
 
200
-			if (file_exists($image)) {
201
-				//check thumbnail
202
-				$imagetype = explode(".", $image);
200
+            if (file_exists($image)) {
201
+                //check thumbnail
202
+                $imagetype = explode(".", $image);
203 203
                 //or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
204
-				$imagetype = strtolower($imagetype[count($imagetype)-1]);
204
+                $imagetype = strtolower($imagetype[count($imagetype)-1]);
205 205
 
206
-				if (in_array($imagetype,$allowed_thumbnail_types)) {
207
-					if (!file_exists($image_thumbnail)){
206
+                if (in_array($imagetype,$allowed_thumbnail_types)) {
207
+                    if (!file_exists($image_thumbnail)){
208 208
                         //run each once we view thumbnails is too heavy, then need move into  !file_exists($image_thumbnail, and only run when haven't the thumbnail
209
-						$original_image_size = api_getimagesize($image);
210
-
211
-						switch($imagetype) {
212
-							case 'gif':
213
-								$source_img = imagecreatefromgif($image);
214
-								break;
215
-							case 'jpg':
216
-								$source_img = imagecreatefromjpeg($image);
217
-								break;
218
-							case 'jpeg':
219
-								$source_img = imagecreatefromjpeg($image);
220
-								break;
221
-							case 'png':
222
-								$source_img = imagecreatefrompng($image);
223
-								break;
224
-						}
209
+                        $original_image_size = api_getimagesize($image);
210
+
211
+                        switch($imagetype) {
212
+                            case 'gif':
213
+                                $source_img = imagecreatefromgif($image);
214
+                                break;
215
+                            case 'jpg':
216
+                                $source_img = imagecreatefromjpeg($image);
217
+                                break;
218
+                            case 'jpeg':
219
+                                $source_img = imagecreatefromjpeg($image);
220
+                                break;
221
+                            case 'png':
222
+                                $source_img = imagecreatefrompng($image);
223
+                                break;
224
+                        }
225 225
 
226 226
                         $new_thumbnail_size = api_calculate_image_size(
227 227
                             $original_image_size['width'],
@@ -229,33 +229,33 @@  discard block
 block discarded – undo
229 229
                             $max_thumbnail_width,
230 230
                             $max_thumbnail_height
231 231
                         );
232
-						if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
233
-							$new_thumbnail_size['width']=$original_image_size['width'];
234
-							$new_thumbnail_size['height']=$original_image_size['height'];
235
-						}
236
-
237
-						$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
-
239
-						// preserve transparency
240
-						if ($imagetype == "png"){
241
-							imagesavealpha($crop, true);
242
-							$color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
-							imagefill($crop, 0, 0, $color);
244
-						}
245
-
246
-						if ($imagetype == "gif") {
247
-							$transindex = imagecolortransparent($source_img);
232
+                        if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){
233
+                            $new_thumbnail_size['width']=$original_image_size['width'];
234
+                            $new_thumbnail_size['height']=$original_image_size['height'];
235
+                        }
236
+
237
+                        $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
238
+
239
+                        // preserve transparency
240
+                        if ($imagetype == "png"){
241
+                            imagesavealpha($crop, true);
242
+                            $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127);
243
+                            imagefill($crop, 0, 0, $color);
244
+                        }
245
+
246
+                        if ($imagetype == "gif") {
247
+                            $transindex = imagecolortransparent($source_img);
248 248
                             $palletsize = imagecolorstotal($source_img);
249
-							 //GIF89a for transparent and anim (first clip), either GIF87a
250
-							 if ($transindex >= 0 && $transindex < $palletsize){
251
-								 $transcol = imagecolorsforindex($source_img, $transindex);
252
-								 $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
-								 imagefill($crop, 0, 0, $transindex);
254
-								 imagecolortransparent($crop, $transindex);
255
-							 }
256
-						}
257
-
258
-						//resampled image
249
+                                //GIF89a for transparent and anim (first clip), either GIF87a
250
+                                if ($transindex >= 0 && $transindex < $palletsize){
251
+                                    $transcol = imagecolorsforindex($source_img, $transindex);
252
+                                    $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
253
+                                    imagefill($crop, 0, 0, $transindex);
254
+                                    imagecolortransparent($crop, $transindex);
255
+                                }
256
+                        }
257
+
258
+                        //resampled image
259 259
                         imagecopyresampled(
260 260
                             $crop,
261 261
                             $source_img,
@@ -269,69 +269,69 @@  discard block
 block discarded – undo
269 269
                             $original_image_size['height']
270 270
                         );
271 271
 
272
-						switch ($imagetype) {
273
-							case 'gif':
274
-								imagegif($crop,$image_thumbnail);
275
-								break;
276
-							case 'jpg':
277
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
-								break;
279
-							case 'jpeg':
280
-								imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
-								break;
282
-							case 'png':
283
-								imagepng($crop,$image_thumbnail,$png_compression);
284
-								break;
285
-						}
286
-
287
-						//clean memory
288
-						imagedestroy($crop);
289
-					}//end !exist thumbnail
290
-
291
-					//show thumbnail and link
292
-
293
-					$one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
-					$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
-				} else {
297
-					//if images aren't support by gd (not gif, jpg, jpeg, png)
298
-					if ($imagetype=="bmp") {
272
+                        switch ($imagetype) {
273
+                            case 'gif':
274
+                                imagegif($crop,$image_thumbnail);
275
+                                break;
276
+                            case 'jpg':
277
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
278
+                                break;
279
+                            case 'jpeg':
280
+                                imagejpeg($crop,$image_thumbnail,$jpg_quality);
281
+                                break;
282
+                            case 'png':
283
+                                imagepng($crop,$image_thumbnail,$png_compression);
284
+                                break;
285
+                        }
286
+
287
+                        //clean memory
288
+                        imagedestroy($crop);
289
+                    }//end !exist thumbnail
290
+
291
+                    //show thumbnail and link
292
+
293
+                    $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail
294
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
295
+                    $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
296
+                } else {
297
+                    //if images aren't support by gd (not gif, jpg, jpeg, png)
298
+                    if ($imagetype=="bmp") {
299 299
                         // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
300
-						$original_image_size = getimagesize($image);
301
-						if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
302
-							$thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
303
-							$image_height = $thumbnail_size['height'];
304
-							$image_width  = $thumbnail_size['width'];
305
-						} else {
306
-							$image_height=$original_image_size[0];
307
-							$image_width=$original_image_size[1];
308
-						}
309
-					} else {
310
-						//example for svg files,...
311
-						$image_width=$max_thumbnail_width;
312
-						$image_height=$max_thumbnail_height;
313
-					}
314
-
315
-					$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
-					$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
-
318
-				}//end allowed image types
319
-			}//end if exist file image
320
-		}//end foreach
321
-	}//end image files only
322
-
323
-	// Creating the table
324
-	$html_table = '';
325
-
326
-	$i = 0;
327
-	$count_image = count($image_tag);
328
-	$number_iteration = ceil($count_image/$number_image);
329
-	$p = 0;
300
+                        $original_image_size = getimagesize($image);
301
+                        if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){
302
+                            $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files
303
+                            $image_height = $thumbnail_size['height'];
304
+                            $image_width  = $thumbnail_size['width'];
305
+                        } else {
306
+                            $image_height=$original_image_size[0];
307
+                            $image_width=$original_image_size[1];
308
+                        }
309
+                    } else {
310
+                        //example for svg files,...
311
+                        $image_width=$max_thumbnail_width;
312
+                        $image_height=$max_thumbnail_height;
313
+                    }
314
+
315
+                    $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
316
+                    $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
317
+
318
+                }//end allowed image types
319
+            }//end if exist file image
320
+        }//end foreach
321
+    }//end image files only
322
+
323
+    // Creating the table
324
+    $html_table = '';
325
+
326
+    $i = 0;
327
+    $count_image = count($image_tag);
328
+    $number_iteration = ceil($count_image/$number_image);
329
+    $p = 0;
330 330
     $html = '';
331 331
     $html .= '<div class="gallery">';
332
-	for ($k = 0; $k < $number_iteration; $k++) {
333
-		for ($i = 0; $i < $number_image; $i++) {
334
-			if (isset($image_tag[$p])) {
332
+    for ($k = 0; $k < $number_iteration; $k++) {
333
+        for ($i = 0; $i < $number_image; $i++) {
334
+            if (isset($image_tag[$p])) {
335 335
                             $html .= '<div class="col-xs-6 col-sm-3 col-md-2">';
336 336
                             $html .= '<div class="canvas-one">';
337 337
                             $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                             $html .= '</a>';
344 344
                             $html .= '</div>';
345 345
                             $html .= '</div>';
346
-			}
347
-			$p++;
348
-		}
349
-	}
346
+            }
347
+            $p++;
348
+        }
349
+    }
350 350
     $html .= '</div>';
351 351
 
352 352
 }//end slide==all
@@ -357,45 +357,45 @@  discard block
 block discarded – undo
357 357
 // This is for viewing all the images in the slideshow one at a time.
358 358
 
359 359
 if ($slide_id != 'all' && !empty($image_files_only)) {
360
-	if (file_exists($image) && is_file($image)) {
361
-		$image_height_width = resize_image($image, $target_width, $target_height);
362
-
363
-		$image_height = $image_height_width[0];
364
-		$image_width = $image_height_width[1];
365
-
366
-		$height_width_tags = null;
367
-		if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
-			$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
-		}
370
-
371
-		// This is done really quickly and should be cleaned up a little bit using the API functions
372
-		$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
-		if ($path == '/') {
374
-			$pathpart = '/';
375
-		} else {
376
-			$pathpart = $path.'/';
377
-		}
378
-		$sql = "SELECT * FROM $tbl_documents
360
+    if (file_exists($image) && is_file($image)) {
361
+        $image_height_width = resize_image($image, $target_width, $target_height);
362
+
363
+        $image_height = $image_height_width[0];
364
+        $image_width = $image_height_width[1];
365
+
366
+        $height_width_tags = null;
367
+        if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
368
+            $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
369
+        }
370
+
371
+        // This is done really quickly and should be cleaned up a little bit using the API functions
372
+        $tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
373
+        if ($path == '/') {
374
+            $pathpart = '/';
375
+        } else {
376
+            $pathpart = $path.'/';
377
+        }
378
+        $sql = "SELECT * FROM $tbl_documents
379 379
 		        WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
380
-		$result = Database::query($sql);
381
-		$row = Database::fetch_array($result);
382
-
383
-		echo '<table align="center" border="0" cellspacing="10">';
384
-		echo '<tr>';
385
-		echo '<td id="td_image" align="center">';
386
-		if ($slide < $total_slides - 1 && $slide_id != 'all') {
387
-			echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
388
-		} else {
389
-			echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
390
-		}
380
+        $result = Database::query($sql);
381
+        $row = Database::fetch_array($result);
382
+
383
+        echo '<table align="center" border="0" cellspacing="10">';
384
+        echo '<tr>';
385
+        echo '<td id="td_image" align="center">';
386
+        if ($slide < $total_slides - 1 && $slide_id != 'all') {
387
+            echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
388
+        } else {
389
+            echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
390
+        }
391 391
         if ($path == '/') {
392
-        	$path = '';
392
+            $path = '';
393 393
         }
394 394
 
395
-		list($width, $height) = getimagesize($image);
396
-		// Auto resize
397
-		if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
398
-		?>
395
+        list($width, $height) = getimagesize($image);
396
+        // Auto resize
397
+        if (isset($_SESSION["image_resizing"]) &&  $_SESSION["image_resizing"] == 'resizing') {
398
+        ?>
399 399
 
400 400
 		<script type="text/javascript">
401 401
 			var initial_width='<?php echo $width; ?>';
@@ -448,30 +448,30 @@  discard block
 block discarded – undo
448 448
 
449 449
 		</script>
450 450
     <?php
451
-		} else {
452
-			echo "<img src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
453
-		}
454
-
455
-		echo '</a>';
456
-		echo '</td>';
457
-		echo '</tr>';
458
-		echo '<tr>';
459
-		echo '<td>';
460
-		echo $row['comment'];
461
-		echo '</td>';
451
+        } else {
452
+            echo "<img src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
453
+        }
454
+
455
+        echo '</a>';
456
+        echo '</td>';
457
+        echo '</tr>';
458
+        echo '<tr>';
459
+        echo '<td>';
460
+        echo $row['comment'];
461
+        echo '</td>';
462 462
 
463 463
         echo '<tr>';
464 464
         echo '<td style="padding:10px;" align="center">';
465 465
         echo Display::tag('h3', $row['title']);
466 466
         echo '</td>';
467 467
         echo '</tr>';
468
-		echo '</tr>';
469
-		echo '</table>';
468
+        echo '</tr>';
469
+        echo '</table>';
470 470
 
471
-		echo '<table align="center" border="0">';
472
-		if (api_is_allowed_to_edit(null, true)) {
473
-			$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
474
-			$ext = $aux[count($aux) - 1];
471
+        echo '<table align="center" border="0">';
472
+        if (api_is_allowed_to_edit(null, true)) {
473
+            $aux = explode('.', htmlspecialchars($image_files_only[$slide]));
474
+            $ext = $aux[count($aux) - 1];
475 475
 
476 476
             if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
477 477
                 $resize_info = get_lang('Resizing').'<br />';
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
                 $resize_height = get_lang('Auto');
484 484
             } else {
485 485
                 $resize_info = get_lang('NoResizing').'<br />';
486
-				$resize_width = '';
487
-				$resize_height = '';
486
+                $resize_width = '';
487
+                $resize_height = '';
488 488
             }
489 489
 
490 490
             echo '<tr>';
@@ -492,25 +492,25 @@  discard block
 block discarded – undo
492 492
             echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$row['id'].'&origin=slideshow&origin_opt='.$edit_slide_id.'&">
493 493
 			      <img src="../img/edit.gif" border="0" title="'.get_lang('Modify').'" alt="'.get_lang('Modify').'" /></a><br />';
494 494
 
495
-			echo $image_files_only[$slide].' <br />';
496
-			echo $width.' x '.$height.' <br />';
497
-			echo round((filesize($image)/1024), 2).' KB';
498
-			echo ' - '.$ext;
499
-			echo '</td>';
500
-			echo '</tr>';
501
-			echo '<tr>';
502
-			echo '<td align="center">';
503
-			echo $resize_info;
504
-			echo $resize_width;
505
-			echo $resize_height;
506
-			echo '</td>';
507
-			echo '</tr>';
508
-		}
509
-		echo '</table>';
510
-
511
-	} else {
512
-		Display::display_warning_message(get_lang('FileNotFound'));
513
-	}
495
+            echo $image_files_only[$slide].' <br />';
496
+            echo $width.' x '.$height.' <br />';
497
+            echo round((filesize($image)/1024), 2).' KB';
498
+            echo ' - '.$ext;
499
+            echo '</td>';
500
+            echo '</tr>';
501
+            echo '<tr>';
502
+            echo '<td align="center">';
503
+            echo $resize_info;
504
+            echo $resize_width;
505
+            echo $resize_height;
506
+            echo '</td>';
507
+            echo '</tr>';
508
+        }
509
+        echo '</table>';
510
+
511
+    } else {
512
+        Display::display_warning_message(get_lang('FileNotFound'));
513
+    }
514 514
 } else {
515 515
     if ($slide_id != 'all') {
516 516
         Display::display_warning_message(get_lang('NoDataAvailable'));
Please login to merge, or discard this patch.
main/mySpace/myStudents.php 1 patch
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -63,53 +63,53 @@  discard block
 block discarded – undo
63 63
     if ($origin == 'user_course') {
64 64
         $course_info = CourseManager :: get_course_information($get_course_code);
65 65
         if (empty ($cidReq)) {
66
-            $interbreadcrumb[] = array (
67
-                "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
66
+            $interbreadcrumb[] = array(
67
+                "url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'],
68 68
                 'name' => $course_info['title']
69 69
             );
70 70
         }
71
-        $interbreadcrumb[] = array (
72
-            "url" => "../user/user.php?cidReq=" . $get_course_code,
71
+        $interbreadcrumb[] = array(
72
+            "url" => "../user/user.php?cidReq=".$get_course_code,
73 73
             "name" => get_lang("Users")
74 74
         );
75 75
     } else
76 76
         if ($origin == 'tracking_course') {
77 77
             $course_info = CourseManager :: get_course_information($get_course_code);
78
-            $interbreadcrumb[] = array (
79
-                "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
78
+            $interbreadcrumb[] = array(
79
+                "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session='.api_get_session_id(),
80 80
                 "name" => get_lang("Tracking")
81 81
             );
82 82
         } else
83 83
             if ($origin == 'resume_session') {
84
-                $interbreadcrumb[] = array (
84
+                $interbreadcrumb[] = array(
85 85
                     'url' => "../session/session_list.php",
86 86
                     "name" => get_lang('SessionList')
87 87
                 );
88
-                $interbreadcrumb[] = array (
89
-                    'url' => "../session/resume_session.php?id_session=" . $sessionId,
88
+                $interbreadcrumb[] = array(
89
+                    'url' => "../session/resume_session.php?id_session=".$sessionId,
90 90
                     "name" => get_lang('SessionOverview')
91 91
                 );
92 92
             } else {
93
-                $interbreadcrumb[] = array (
93
+                $interbreadcrumb[] = array(
94 94
                     "url" => "index.php",
95 95
                     "name" => get_lang('MySpace')
96 96
                 );
97 97
                 if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
98
-                    $interbreadcrumb[] = array (
99
-                        "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
98
+                    $interbreadcrumb[] = array(
99
+                        "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
100 100
                         "name" => get_lang("CoachStudents")
101 101
                     );
102
-                    $interbreadcrumb[] = array (
103
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
102
+                    $interbreadcrumb[] = array(
103
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']).'&id_coach='.Security :: remove_XSS($_GET['id_coach']),
104 104
                         "name" => get_lang("StudentDetails")
105 105
                     );
106 106
                 } else {
107
-                    $interbreadcrumb[] = array (
107
+                    $interbreadcrumb[] = array(
108 108
                         "url" => "student.php",
109 109
                         "name" => get_lang("MyStudents")
110 110
                     );
111
-                    $interbreadcrumb[] = array (
112
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
111
+                    $interbreadcrumb[] = array(
112
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']),
113 113
                         "name" => get_lang("StudentDetails")
114 114
                     );
115 115
                 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     $nameTools = get_lang("DetailsStudentInCourse");
118 118
 } else {
119 119
     if ($origin == 'resume_session') {
120
-        $interbreadcrumb[] = array (
120
+        $interbreadcrumb[] = array(
121 121
             'url' => "../session/session_list.php",
122 122
             "name" => get_lang('SessionList')
123 123
         );
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
             );
129 129
         }
130 130
     } else {
131
-        $interbreadcrumb[] = array (
131
+        $interbreadcrumb[] = array(
132 132
             "url" => "index.php",
133 133
             "name" => get_lang('MySpace')
134 134
         );
135 135
         if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
136 136
             if ($sessionId) {
137
-                $interbreadcrumb[] = array (
138
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId,
137
+                $interbreadcrumb[] = array(
138
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach'])."&id_session=".$sessionId,
139 139
                     "name" => get_lang("CoachStudents")
140 140
                 );
141 141
             } else {
142
-                $interbreadcrumb[] = array (
143
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
142
+                $interbreadcrumb[] = array(
143
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
144 144
                     "name" => get_lang("CoachStudents")
145 145
                 );
146 146
             }
147 147
         } else {
148
-            $interbreadcrumb[] = array (
148
+            $interbreadcrumb[] = array(
149 149
                 "url" => "student.php",
150 150
                 "name" => get_lang("MyStudents")
151 151
             );
@@ -316,28 +316,28 @@  discard block
 block discarded – undo
316 316
     // Actions bar
317 317
     echo '<div class="actions">';
318 318
     echo '<a href="javascript: window.history.go(-1);">'.
319
-            Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
319
+            Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
320 320
 
321 321
     echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
322
-            Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
322
+            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
323 323
 
324
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv">'.
325
-            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
324
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'.
325
+            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
326 326
 
327
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=xls">'.
328
-    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
327
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'.
328
+    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
329 329
 
330 330
     if (!empty ($user_info['email'])) {
331 331
         $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
332
-            Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
332
+            Display :: return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).'</a>';
333 333
     } else {
334
-        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
334
+        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM);
335 335
     }
336 336
     echo $send_mail;
337 337
     if (!empty($student_id) && !empty($_GET['course'])) {
338 338
         // Only show link to connection details if course and student were defined in the URL
339
-        echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&origin=' . $origin. '&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
340
-            Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
339
+        echo '<a href="access_details.php?student='.$student_id.'&course='.Security :: remove_XSS($_GET['course']).'&origin='.$origin.'&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
340
+            Display :: return_icon('statistics.png', get_lang('AccessDetails'), '', ICON_SIZE_MEDIUM).'</a>';
341 341
     }
342 342
     if (api_can_login_as($student_id)) {
343 343
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$student_id.'&sec_token='.$token.'">'.
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     $csv_content[] = array(
407 407
         get_lang('Information', '')
408 408
     );
409
-    $csv_content[] = array (
409
+    $csv_content[] = array(
410 410
         get_lang('Name', ''),
411 411
         get_lang('Email', ''),
412 412
         get_lang('Tel', '')
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         strip_tags($first_connection_date),
435 435
         strip_tags($last_connection_date),
436 436
         $time_spent_on_the_course,
437
-        $avg_student_progress . '%',
437
+        $avg_student_progress.'%',
438 438
         $avg_student_score
439 439
     );
440 440
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
             foreach ($course_coachs as $course_coach) {
455 455
                 $info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
456 456
             }
457
-            $info_course['tutor_name'] = implode(",",$info_tutor_name);
457
+            $info_course['tutor_name'] = implode(",", $info_tutor_name);
458 458
         } elseif ($session_coach_id != 0) {
459 459
             $session_coach_id = intval($session_info['id_coach']);
460 460
             $coach_info = api_get_user_info($session_coach_id);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
         $session_name = $session_info['name'];
465 465
     } // end
466 466
 
467
-    $info_course  = CourseManager :: get_course_information($get_course_code);
467
+    $info_course = CourseManager :: get_course_information($get_course_code);
468 468
     $table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
469 469
 
470 470
     echo Display::page_subheader($table_title);
@@ -485,19 +485,19 @@  discard block
 block discarded – undo
485 485
             </thead>
486 486
             <tbody>
487 487
             <tr>
488
-                <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
488
+                <td><?php echo get_lang('Name').' : '.$user_info['complete_name']; ?></td>
489 489
             </tr>
490 490
             <tr>
491
-                <td><?php echo get_lang('Email') . ' : ';
491
+                <td><?php echo get_lang('Email').' : ';
492 492
                     if (!empty ($user_info['email'])) {
493
-                        echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
493
+                        echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>';
494 494
                     } else {
495 495
                         echo get_lang('NoEmail');
496 496
                     } ?>
497 497
                 </td>
498 498
             </tr>
499 499
             <tr>
500
-                <td> <?php echo get_lang('Tel') . ' : ';
500
+                <td> <?php echo get_lang('Tel').' : ';
501 501
                     if (!empty ($user_info['phone'])) {
502 502
                         echo $user_info['phone'];
503 503
                     } else {
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 </td>
508 508
             </tr>
509 509
             <tr>
510
-                <td> <?php echo get_lang('OfficialCode') . ' : ';
510
+                <td> <?php echo get_lang('OfficialCode').' : ';
511 511
                     if (!empty ($user_info['official_code'])) {
512 512
                         echo $user_info['official_code'];
513 513
                     } else {
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
                 </td>
518 518
             </tr>
519 519
             <tr>
520
-                <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td>
520
+                <td><?php echo get_lang('OnLine').' : '.$online; ?> </td>
521 521
             </tr>
522 522
             <?php
523 523
 
524 524
             // Display timezone if the user selected one and if the admin allows the use of user's timezone
525 525
             $timezone = null;
526
-            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'],'timezone');
526
+            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'], 'timezone');
527 527
             $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
528 528
             if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
529 529
                 $timezone = $timezone_user['timezone'];
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             if ($timezone !== null) {
532 532
                 ?>
533 533
                 <tr>
534
-                    <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td>
534
+                    <td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td>
535 535
                 </tr>
536 536
             <?php
537 537
             }
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                     <td align="right">
564 564
                         <?php
565 565
                         echo get_lang('Progress').' ';
566
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?>
566
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
567 567
                     </td>
568 568
                     <td align="left"><?php echo $avg_student_progress.'%' ?></td>
569 569
                 </tr>
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
                     <td align="right">
572 572
                         <?php
573 573
                         echo get_lang('Score').' ';
574
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
574
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
575 575
                     </td>
576
-                    <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;}  ?></td>
576
+                    <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%'; } else { echo $avg_student_score; }  ?></td>
577 577
                 </tr>
578 578
                 <?php
579 579
                 if (!empty($nb_login)) {
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
     $table_title = '';
608 608
     if (!empty($sessionId)) {
609 609
         $session_name = api_get_session_name($sessionId);
610
-        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'';
610
+        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : '';
611 611
     }
612 612
     if (!empty($info_course['title'])) {
613
-        $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].'  ':'';
613
+        $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].'  ' : '';
614 614
     }
615 615
 
616 616
     echo Display::page_subheader($table_title);
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
             }
649 649
             $date_session = '';
650 650
             if (!empty($access_start_date) && !empty($access_end_date)) {
651
-                $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
651
+                $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date;
652 652
             }
653 653
             $title = '';
654 654
             if (empty($sessionId)) {
655 655
                 $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
656 656
             } else {
657
-                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
657
+                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
658 658
             }
659 659
 
660 660
             // Courses
@@ -705,15 +705,15 @@  discard block
 block discarded – undo
705 705
                         $scoretotal = array();
706 706
                         if (isset($cats) && isset($cats[0])) {
707 707
                             if (!empty($sessionId)) {
708
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
708
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
709 709
                             } else {
710
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
710
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $course_code);
711 711
                             }
712 712
                         }
713 713
 
714 714
                         $scoretotal_display = '0/0 (0%)';
715 715
                         if (!empty($scoretotal)) {
716
-                            $scoretotal_display =  round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
716
+                            $scoretotal_display = round($scoretotal[0], 1).'/'.round($scoretotal[1], 1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
717 717
                         }
718 718
 
719 719
                         $progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
                         );
733 733
 
734 734
                         echo '<tr>
735
-                        <td ><a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['directory'] .'/?id_session=' . $sessionId . '">'.$course_info['title'].'</a></td>
736
-                        <td >'.$time_spent_on_course .'</td>
735
+                        <td ><a href="' . api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/?id_session='.$sessionId.'">'.$course_info['title'].'</a></td>
736
+                        <td >'.$time_spent_on_course.'</td>
737 737
                         <td >'.$progress.'</td>
738 738
                         <td >'.$score.'</td>
739 739
                         <td >'.$attendances_faults_avg.'</td>
@@ -799,22 +799,22 @@  discard block
 block discarded – undo
799 799
                 <table class="table table-striped table-hover">
800 800
                 <thead>
801 801
                 <tr>
802
-                    <th><?php echo get_lang('Learnpaths');?></th>
802
+                    <th><?php echo get_lang('Learnpaths'); ?></th>
803 803
                     <th><?php
804 804
                         echo get_lang('Time').' ';
805
-                        Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
805
+                        Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
806 806
                     <th><?php
807 807
                         echo get_lang('AverageScore').' ';
808
-                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
808
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
809 809
                     <th><?php
810 810
                         echo get_lang('LatestAttemptAverageScore').' ';
811
-                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
811
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
812 812
                     <th><?php
813 813
                         echo get_lang('Progress').' ';
814
-                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
814
+                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
815 815
                     <th><?php
816 816
                         echo get_lang('LastConnexion').' ';
817
-                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
817
+                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
818 818
                     <?php
819 819
                     echo '<th>'.get_lang('Details').'</th>';
820 820
                     if (api_is_allowed_to_edit()) {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 
843 843
                     if ($progress === null) {
844 844
                         $progress = '0%';
845
-                    }  else {
845
+                    } else {
846 846
                         $any_result = true;
847 847
                     }
848 848
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                     if (!empty($start_time)) {
870 870
                         $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
871 871
                     } else {
872
-                        $start_time =  '-';
872
+                        $start_time = '-';
873 873
                     }
874 874
 
875 875
                     if (!empty($total_time)) $any_result = true;
@@ -898,11 +898,11 @@  discard block
 block discarded – undo
898 898
                     $i++;
899 899
 
900 900
                     // csv export content
901
-                    $csv_content[] = array (
901
+                    $csv_content[] = array(
902 902
                         api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
903 903
                         api_time_to_hms($total_time),
904
-                        $score . '%',
905
-                        $score_latest . '%',
904
+                        $score.'%',
905
+                        $score_latest.'%',
906 906
                         $progress.'%',
907 907
                         $start_time
908 908
                     );
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
                     if ($any_result === true) {
941 941
                         $from = '';
942 942
                         if ($from_myspace) {
943
-                            $from ='&from=myspace';
943
+                            $from = '&from=myspace';
944 944
                         }
945 945
                         $link = Display::url(
946 946
                             '<img src="../img/icons/22/2rightarrow.png" border="0" />',
@@ -953,14 +953,14 @@  discard block
 block discarded – undo
953 953
                         echo '<td>';
954 954
                         if ($any_result === true) {
955 955
                             echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.$origin.'&lp_id='.$learnpath->getId().'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">';
956
-                            echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
956
+                            echo Display::return_icon('clean.png', get_lang('Clean'), '', ICON_SIZE_SMALL).'</a>';
957 957
                             echo '</a>';
958 958
                         }
959 959
                         echo '</td>';
960 960
                         echo '</tr>';
961 961
                     }
962 962
                     $data_learnpath[$i][] = $lp_name;
963
-                    $data_learnpath[$i][] = $progress . '%';
963
+                    $data_learnpath[$i][] = $progress.'%';
964 964
                 }
965 965
             } else {
966 966
                 //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
         <thead>
978 978
         <tr>
979 979
             <th><?php echo get_lang('Exercises'); ?></th>
980
-            <th><?php echo get_lang('LearningPath');?></th>
980
+            <th><?php echo get_lang('LearningPath'); ?></th>
981 981
             <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
982 982
             <th><?php echo get_lang('Attempts'); ?></th>
983 983
             <th><?php echo get_lang('LatestAttempt'); ?></th>
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
         );
997 997
 
998 998
         $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
999
-        $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
999
+        $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
1000 1000
                 WHERE
1001 1001
                     quiz.c_id =  ".$info_course['real_id']." AND
1002 1002
                     (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
                 echo '<td>';
1040 1040
 
1041 1041
                 if ($count_attempts > 0) {
1042
-                    echo $score_percentage . '%';
1042
+                    echo $score_percentage.'%';
1043 1043
                 } else {
1044 1044
                     echo '-';
1045 1045
                     $score_percentage = 0;
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
                 echo '<td>'.$count_attempts.'</td>';
1050 1050
                 echo '<td>';
1051 1051
 
1052
-                $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
1052
+                $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
1053 1053
                          WHERE
1054 1054
                             exe_exo_id      ="'.$exercise_id.'" AND
1055 1055
                             exe_user_id     ="'.$student_id.'" AND
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
                 if (Database :: num_rows($result_last_attempt) > 0) {
1063 1063
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1064 1064
                     if ($count_attempts > 0)
1065
-                        echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1065
+                        echo '<a href="../exercice/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'">
1066 1066
                         '.Display::return_icon('quiz.gif').'
1067 1067
                      </a>';
1068 1068
                 }
@@ -1070,11 +1070,11 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
                 echo '<td>';
1072 1072
                 $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
1073
-                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
1073
+                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url);
1074 1074
 
1075 1075
                 echo '</td></tr>';
1076 1076
                 $data_exercices[$i][] = $exercices['title'];
1077
-                $data_exercices[$i][] = $score_percentage . '%';
1077
+                $data_exercices[$i][] = $score_percentage.'%';
1078 1078
                 $data_exercices[$i][] = $count_attempts;
1079 1079
 
1080 1080
                 $csv_content[] = array(
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
             $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
1103 1103
 
1104 1104
             $survey_data = array();
1105
-            foreach($survey_list as $survey) {
1105
+            foreach ($survey_list as $survey) {
1106 1106
                 $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
1107 1107
                 $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
1108 1108
                 if (in_array($student_id, $user_list)) {
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
                         $column = 0;
1128 1128
                         $table->setCellContents($row, $column, $data);
1129 1129
                         $class = 'class="row_odd"';
1130
-                        if($row % 2) {
1130
+                        if ($row % 2) {
1131 1131
                             $class = 'class="row_even"';
1132 1132
                         }
1133 1133
                         $table->setRowAttributes($row, $class, true);
@@ -1150,13 +1150,13 @@  discard block
 block discarded – undo
1150 1150
             </thead>
1151 1151
             <tbody>
1152 1152
         <?php
1153
-        $csv_content[] = array ();
1154
-        $nb_assignments 		= Tracking::count_student_assignments($student_id, $course_code, $sessionId);
1153
+        $csv_content[] = array();
1154
+        $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
1155 1155
         $messages 				= Tracking::count_student_messages($student_id, $course_code, $sessionId);
1156
-        $links 					= Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
1157
-        $chat_last_connection 	= Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
1156
+        $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
1157
+        $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
1158 1158
         $documents				= Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
1159
-        $uploaded_documents		= Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
1159
+        $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
1160 1160
 
1161 1161
         $csv_content[] = array(
1162 1162
             get_lang('OtherTools')
Please login to merge, or discard this patch.