Completed
Push — 1.10.x ( 77bf11...88842f )
by Angel Fernando Quiroz
43:15
created
main/inc/lib/sessionmanager.lib.php 1 patch
Spacing   +195 added lines, -195 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,
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
             if (Database::num_rows($result) > 0) {
1309 1309
                 $row = Database::fetch_array($result);
1310 1310
                 $count = $row['count'] + 1;
1311
-                $session_name = $session_name . '_' . $count;
1311
+                $session_name = $session_name.'_'.$count;
1312 1312
                 $result = self::session_name_exists($session_name);
1313 1313
                 if (!$result) {
1314 1314
                     return $session_name;
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
             return false;
1390 1390
         } else {
1391
-            $sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'";
1391
+            $sql = "SELECT id FROM $tbl_session WHERE name='".Database::escape_string($name)."'";
1392 1392
             $rs = Database::query($sql);
1393 1393
             $exists = false;
1394 1394
             while ($row = Database::fetch_array($rs)) {
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
         // Delete users from the session
1755 1755
         if ($empty_users === true) {
1756 1756
             $sql = "DELETE FROM $tbl_session_rel_user
1757
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1757
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1758 1758
             Database::query($sql);
1759 1759
         }
1760 1760
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
             $enreg_user = Database::escape_string($enreg_user);
1766 1766
             $nbr_users++;
1767 1767
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1768
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1768
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1769 1769
             Database::query($sql);
1770 1770
         }
1771 1771
 
@@ -1855,9 +1855,9 @@  discard block
 block discarded – undo
1855 1855
         is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
1856 1856
 
1857 1857
         $statusCondition = null;
1858
-        if (isset($status) && !is_null($status))  {
1858
+        if (isset($status) && !is_null($status)) {
1859 1859
             $status = intval($status);
1860
-            $statusCondition  = " AND status = $status";
1860
+            $statusCondition = " AND status = $status";
1861 1861
         }
1862 1862
 
1863 1863
         foreach ($userList as $userId) {
@@ -1989,7 +1989,7 @@  discard block
 block discarded – undo
1989 1989
             if (empty($count)) {
1990 1990
                 // If user is not registered to a session then add it.
1991 1991
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
1992
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
1992
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
1993 1993
                 Database::query($sql);
1994 1994
 
1995 1995
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 		               WHERE
2033 2033
                             session_id = $session_id AND
2034 2034
 		                    user_id = $user_id AND
2035
-		                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2035
+		                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2036 2036
         $result = Database::query($delete_sql);
2037 2037
         $return = Database::affected_rows($result);
2038 2038
 
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
                 FROM $tbl_session_rel_user
2117 2117
                 WHERE
2118 2118
                     session_id = $sessionId AND
2119
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2119
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2120 2120
         $result = Database::query($sql);
2121 2121
         $user_list = Database::store_result($result);
2122 2122
 
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 
2129 2129
                     $sql = "DELETE FROM $tbl_session_rel_course
2130 2130
                             WHERE
2131
-                                c_id = " . $existingCourse['c_id'] . " AND
2131
+                                c_id = ".$existingCourse['c_id']." AND
2132 2132
                                 session_id = $sessionId";
2133 2133
                     Database::query($sql);
2134 2134
 
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2192 2192
 
2193 2193
                             $cat->set_session_id($sessionId);
2194
-                            $oldCategoryId= $cat->get_id();
2194
+                            $oldCategoryId = $cat->get_id();
2195 2195
                             $newId = $cat->add();
2196 2196
                             $newCategoryIdList[$oldCategoryId] = $newId;
2197 2197
 
@@ -2379,8 +2379,8 @@  discard block
 block discarded – undo
2379 2379
         $return_value = false;
2380 2380
         $sql = "SELECT c_id FROM $tbl_session_course
2381 2381
                 WHERE
2382
-                  session_id = " . intval($session_id) . " AND
2383
-                  c_id = " . intval($courseId) . "";
2382
+                  session_id = ".intval($session_id)." AND
2383
+                  c_id = " . intval($courseId)."";
2384 2384
         $result = Database::query($sql);
2385 2385
         $num = Database::num_rows($result);
2386 2386
         if ($num > 0) {
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
         }
2404 2404
 
2405 2405
         $sql = 'SELECT *
2406
-		        FROM ' . $tbl_session . '
2407
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2406
+		        FROM ' . $tbl_session.'
2407
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2408 2408
         $result = Database::query($sql);
2409 2409
         $num = Database::num_rows($result);
2410 2410
         if ($num > 0) {
@@ -2444,8 +2444,8 @@  discard block
 block discarded – undo
2444 2444
         $month_end = intval($smonth_end);
2445 2445
         $day_end = intval($sday_end);
2446 2446
 
2447
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2448
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2447
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2448
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2449 2449
 
2450 2450
         if (empty($name)) {
2451 2451
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
         $month_end = intval($smonth_end);
2518 2518
         $day_end = intval($sday_end);
2519 2519
         $id = intval($id);
2520
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2521
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2520
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2521
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2522 2522
 
2523 2523
         if (empty($name)) {
2524 2524
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2538,13 +2538,13 @@  discard block
 block discarded – undo
2538 2538
         if ($date_end <> null) {
2539 2539
             $sql = "UPDATE $tbl_session_category
2540 2540
                     SET
2541
-                        name = '" . Database::escape_string($name) . "',
2541
+                        name = '".Database::escape_string($name)."',
2542 2542
                         date_start = '$date_start' ,
2543 2543
                         date_end = '$date_end'
2544 2544
                     WHERE id= $id";
2545 2545
         } else {
2546 2546
             $sql = "UPDATE $tbl_session_category SET
2547
-                        name = '" . Database::escape_string($name) . "',
2547
+                        name = '".Database::escape_string($name)."',
2548 2548
                         date_start = '$date_start',
2549 2549
                         date_end = NULL
2550 2550
                     WHERE id= $id";
@@ -2574,10 +2574,10 @@  discard block
 block discarded – undo
2574 2574
 
2575 2575
         //Setting session_category_id to 0
2576 2576
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2577
-                WHERE session_category_id IN (" . $id_checked . ")";
2577
+                WHERE session_category_id IN (".$id_checked.")";
2578 2578
         Database::query($sql);
2579 2579
 
2580
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2580
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2581 2581
         $result = Database::query($sql);
2582 2582
         while ($rows = Database::fetch_array($result)) {
2583 2583
             $session_id = $rows['id'];
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
                 }
2590 2590
             }
2591 2591
         }
2592
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2592
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2593 2593
         Database::query($sql);
2594 2594
 
2595 2595
         // Add event to system log
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
                 $value = Database::escape_string($options['value']);
2663 2663
                 $sql_query .= ' AND ';
2664 2664
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2665
-                    $sql_query .= $field . " $operator '" . $value . "'";
2665
+                    $sql_query .= $field." $operator '".$value."'";
2666 2666
                 }
2667 2667
             }
2668 2668
         }
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
     {
2730 2730
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2731 2731
         $id = api_get_current_access_url_id();
2732
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2733
-                WHERE access_url_id = ' . $id . '
2732
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2733
+                WHERE access_url_id = ' . $id.'
2734 2734
                 ORDER BY name ASC';
2735 2735
         $result = Database::query($sql);
2736 2736
         if (Database::num_rows($result) > 0) {
@@ -2909,11 +2909,11 @@  discard block
 block discarded – undo
2909 2909
                         INNER JOIN $tbl_session_rel_access_url a ON (a.session_id = s.session_id)
2910 2910
                         WHERE
2911 2911
                             s.user_id = $userId AND
2912
-                            relation_type=" . SESSION_RELATION_TYPE_RRHH . " AND
2913
-                            access_url_id = " . api_get_current_access_url_id() . "";
2912
+                            relation_type=".SESSION_RELATION_TYPE_RRHH." AND
2913
+                            access_url_id = " . api_get_current_access_url_id()."";
2914 2914
             } else {
2915 2915
                 $sql = "SELECT session_id FROM $tbl_session_rel_user s
2916
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH . "";
2916
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH."";
2917 2917
             }
2918 2918
             $result = Database::query($sql);
2919 2919
 
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
                             WHERE
2924 2924
                                 session_id = {$row['session_id']} AND
2925 2925
                                 user_id = $userId AND
2926
-                                relation_type=" . SESSION_RELATION_TYPE_RRHH . " ";
2926
+                                relation_type=".SESSION_RELATION_TYPE_RRHH." ";
2927 2927
                     Database::query($sql);
2928 2928
                 }
2929 2929
             }
@@ -2937,8 +2937,8 @@  discard block
 block discarded – undo
2937 2937
                         VALUES (
2938 2938
                             $session_id,
2939 2939
                             $userId,
2940
-                            '" . SESSION_RELATION_TYPE_RRHH . "',
2941
-                            '" . api_get_utc_datetime() . "'
2940
+                            '".SESSION_RELATION_TYPE_RRHH."',
2941
+                            '" . api_get_utc_datetime()."'
2942 2942
                         )";
2943 2943
 
2944 2944
                 Database::query($sql);
@@ -2980,8 +2980,8 @@  discard block
 block discarded – undo
2980 2980
                     WHERE
2981 2981
                         sru.user_id = '$userId' AND
2982 2982
                         sru.session_id = '$sessionId' AND
2983
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
2984
-                        access_url_id = " . api_get_current_access_url_id() . "
2983
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
2984
+                        access_url_id = " . api_get_current_access_url_id()."
2985 2985
                         ";
2986 2986
         } else {
2987 2987
             $sql = "$select FROM $tbl_session s
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
                         sru.session_id = s.id AND
2991 2991
                         sru.user_id = '$userId' AND
2992 2992
                         sru.session_id = '$sessionId' AND
2993
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
2993
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
2994 2994
                     ";
2995 2995
         }
2996 2996
 
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
 
3089 3089
         $limitCondition = null;
3090 3090
         if (!empty($start) && !empty($limit)) {
3091
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3091
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3092 3092
         }
3093 3093
 
3094 3094
         if (empty($orderCondition)) {
@@ -3166,26 +3166,26 @@  discard block
 block discarded – undo
3166 3166
 
3167 3167
         $sessions = array();
3168 3168
         if (Database::num_rows($result) > 0) {
3169
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3170
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3169
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3170
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3171 3171
             $imgPath = Display::returnIconPath('session_default_small.png');
3172 3172
 
3173 3173
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3174
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3174
+            $sql = "SELECT id FROM ".$tableExtraFields."
3175 3175
                     WHERE extra_field_type = 3 AND variable='image'";
3176 3176
             $resultField = Database::query($sql);
3177 3177
             $imageFieldId = Database::fetch_assoc($resultField);
3178 3178
 
3179 3179
             while ($row = Database::fetch_array($result)) {
3180 3180
 
3181
-                $row['image'] =  null;
3182
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3181
+                $row['image'] = null;
3182
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3183 3183
 
3184 3184
                 if (is_file($sessionImage)) {
3185
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3185
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3186 3186
                     $row['image'] = $sessionImage;
3187 3187
                 } else {
3188
-                    $row['image'] =  $imgPath;
3188
+                    $row['image'] = $imgPath;
3189 3189
                 }
3190 3190
 
3191 3191
                 $sessions[$row['id']] = $row;
@@ -3255,7 +3255,7 @@  discard block
 block discarded – undo
3255 3255
                 return intval($count[0]);
3256 3256
             }
3257 3257
 
3258
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3258
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3259 3259
                 $courses[$row['real_id']] = $row;
3260 3260
             }
3261 3261
         }
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
         }
3300 3300
 
3301 3301
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3302
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3302
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3303 3303
 
3304 3304
         if ($getCount) {
3305 3305
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 		        ";
3325 3325
         if ($getCount) {
3326 3326
             $result = Database::query($sql);
3327
-            $row = Database::fetch_array($result,'ASSOC');
3327
+            $row = Database::fetch_array($result, 'ASSOC');
3328 3328
             return $row['count'];
3329 3329
         }
3330 3330
 
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
         $courses = array();
3340 3340
 
3341 3341
         if ($num_rows > 0) {
3342
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3342
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3343 3343
                 $courses[$row['id']] = $row;
3344 3344
             }
3345 3345
         }
@@ -3417,7 +3417,7 @@  discard block
 block discarded – undo
3417 3417
         $result = Database::query($sql);
3418 3418
         $num_rows = Database::num_rows($result);
3419 3419
         if ($num_rows > 0) {
3420
-            $row = Database::fetch_array($result,'ASSOC');
3420
+            $row = Database::fetch_array($result, 'ASSOC');
3421 3421
             return $row['count'];
3422 3422
         }
3423 3423
 
@@ -3529,9 +3529,9 @@  discard block
 block discarded – undo
3529 3529
 
3530 3530
             if ($access_url_id != -1) {
3531 3531
                 $sql = 'SELECT DISTINCT session.*
3532
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3532
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3533 3533
                     ON (session.id = session_rel_url.session_id)
3534
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3534
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3535 3535
             }
3536 3536
         }
3537 3537
         $sql .= ' ORDER by name';
@@ -3565,8 +3565,8 @@  discard block
 block discarded – undo
3565 3565
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3566 3566
                 WHERE
3567 3567
                     session_rcru.user_id = user.user_id AND
3568
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3569
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3568
+                    session_rcru.session_id = '".intval($session_id)."' AND
3569
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3570 3570
                     user.user_id = " . intval($user_id);
3571 3571
 
3572 3572
         $result = Database::query($sql);
@@ -3597,8 +3597,8 @@  discard block
 block discarded – undo
3597 3597
         $sql = "SELECT session_rcru.status
3598 3598
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3599 3599
                 WHERE session_rcru.user_id = user.user_id AND
3600
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3601
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3600
+                    session_rcru.session_id = '".intval($session_id)."' AND
3601
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3602 3602
                     user.user_id = " . intval($user_id);
3603 3603
         $result = Database::query($sql);
3604 3604
         $status = false;
@@ -3675,7 +3675,7 @@  discard block
 block discarded – undo
3675 3675
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3676 3676
         $now = time() - date('Z');
3677 3677
         // Timestamp in one month
3678
-        $inOneMonth = $now + (30*24*3600);
3678
+        $inOneMonth = $now + (30 * 24 * 3600);
3679 3679
         $inOneMonth = api_get_local_time($inOneMonth);
3680 3680
         if (api_strtotime($s['access_start_date']) < $now) {
3681 3681
             $s['access_start_date'] = api_get_local_time($now);
@@ -3697,16 +3697,16 @@  discard block
 block discarded – undo
3697 3697
         }
3698 3698
         // Now try to create the session
3699 3699
         $sid = self::create_session(
3700
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3700
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3701 3701
             $s['access_start_date'],
3702 3702
             $s['access_end_date'],
3703 3703
             $s['display_start_date'],
3704 3704
             $s['display_end_date'],
3705 3705
             $s['coach_access_start_date'],
3706 3706
             $s['coach_access_end_date'],
3707
-            (int)$s['id_coach'],
3707
+            (int) $s['id_coach'],
3708 3708
             $s['session_category_id'],
3709
-            (int)$s['visibility'],
3709
+            (int) $s['visibility'],
3710 3710
             true
3711 3711
         );
3712 3712
 
@@ -3820,7 +3820,7 @@  discard block
 block discarded – undo
3820 3820
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
3821 3821
         $sql = "SELECT DISTINCT id
3822 3822
 	         	FROM $session_table
3823
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
3823
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
3824 3824
         $result = Database::query($sql);
3825 3825
         if ($result && Database::num_rows($result)) {
3826 3826
             return true;
@@ -3839,7 +3839,7 @@  discard block
 block discarded – undo
3839 3839
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3840 3840
         $sql = "SELECT count(id) FROM $session_table s";
3841 3841
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
3842
-            $sql .= ", $access_url_rel_session_table u " .
3842
+            $sql .= ", $access_url_rel_session_table u ".
3843 3843
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
3844 3844
         }
3845 3845
         $res = Database::query($sql);
@@ -4090,7 +4090,7 @@  discard block
 block discarded – undo
4090 4090
 
4091 4091
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4092 4092
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4093
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4093
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4094 4094
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4095 4095
 
4096 4096
         $sessions = array();
@@ -4184,10 +4184,10 @@  discard block
 block discarded – undo
4184 4184
                     $suffix = null;
4185 4185
                     while (!$unique_name) {
4186 4186
                         if ($i > 1) {
4187
-                            $suffix = ' - ' . $i;
4187
+                            $suffix = ' - '.$i;
4188 4188
                         }
4189
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4190
-                                WHERE name="' . $session_name . $suffix . '"';
4189
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4190
+                                WHERE name="' . $session_name.$suffix.'"';
4191 4191
                         $rs = Database::query($sql);
4192 4192
 
4193 4193
                         if (Database::result($rs, 0, 0)) {
@@ -4205,13 +4205,13 @@  discard block
 block discarded – undo
4205 4205
 
4206 4206
                     // Creating the session.
4207 4207
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4208
-                            name = '" . $session_name . "',
4208
+                            name = '".$session_name."',
4209 4209
                             id_coach = '$coach_id',
4210 4210
                             access_start_date = '$date_start',
4211 4211
                             access_end_date = '$date_end',
4212 4212
                             visibility = '$visibilityAfterExpirationPerSession',
4213 4213
                             $sessionCondition
4214
-                            session_admin_id = " . intval($defaultUserId) . $extraParameters . $extraSessionParameters;
4214
+                            session_admin_id = ".intval($defaultUserId).$extraParameters.$extraSessionParameters;
4215 4215
                     Database::query($sql);
4216 4216
 
4217 4217
                     $session_id = Database::insert_id();
@@ -4251,7 +4251,7 @@  discard block
 block discarded – undo
4251 4251
                                 access_start_date = '$date_start',
4252 4252
                                 access_end_date = '$date_end',
4253 4253
                                 visibility = '$visibilityAfterExpirationPerSession',
4254
-                                session_category_id = '$session_category_id' " . $extraParameters . $extraSessionParameters;
4254
+                                session_category_id = '$session_category_id' ".$extraParameters.$extraSessionParameters;
4255 4255
 
4256 4256
                         Database::query($sql);
4257 4257
 
@@ -4271,7 +4271,7 @@  discard block
 block discarded – undo
4271 4271
 
4272 4272
                             // Delete session-user relation only for students
4273 4273
                             $sql = "DELETE FROM $tbl_session_user
4274
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4274
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4275 4275
                             Database::query($sql);
4276 4276
 
4277 4277
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4359,7 +4359,7 @@  discard block
 block discarded – undo
4359 4359
 
4360 4360
                             // Delete session-user relation only for students
4361 4361
                             $sql = "DELETE FROM $tbl_session_user
4362
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4362
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4363 4363
                             Database::query($sql);
4364 4364
 
4365 4365
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4402,7 +4402,7 @@  discard block
 block discarded – undo
4402 4402
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4403 4403
                                     user_id = '$user_id',
4404 4404
                                     session_id = '$session_id',
4405
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4405
+                                    registered_at = '".api_get_utc_datetime()."'";
4406 4406
                             Database::query($sql);
4407 4407
                             if ($debug) {
4408 4408
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5040,7 +5040,7 @@  discard block
 block discarded – undo
5040 5040
 
5041 5041
         if (!empty($lastConnectionDate)) {
5042 5042
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5043
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5043
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5044 5044
         }
5045 5045
 
5046 5046
         if (!empty($keyword)) {
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
         $result = Database::query($sql);
5100 5100
         $result = Database::store_result($result);
5101 5101
 
5102
-        return $result ;
5102
+        return $result;
5103 5103
     }
5104 5104
 
5105 5105
     /**
@@ -5159,7 +5159,7 @@  discard block
 block discarded – undo
5159 5159
                     $userToString = null;
5160 5160
                     foreach ($userList as $userInfo) {
5161 5161
                         $newUserList[] = $userInfo['user_id'];
5162
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5162
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5163 5163
                     }
5164 5164
 
5165 5165
                     if (!empty($sessionsDestination)) {
@@ -5172,7 +5172,7 @@  discard block
 block discarded – undo
5172 5172
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5173 5173
                                 continue;
5174 5174
                             }
5175
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5175
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5176 5176
                             SessionManager::suscribe_users_to_session(
5177 5177
                                 $sessionDestinationId,
5178 5178
                                 $newUserList,
@@ -5223,7 +5223,7 @@  discard block
 block discarded – undo
5223 5223
                 }
5224 5224
             }
5225 5225
         }
5226
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5226
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5227 5227
 
5228 5228
         $htmlResult = null;
5229 5229
 
@@ -5238,7 +5238,7 @@  discard block
 block discarded – undo
5238 5238
                     $sessionInfo = self::fetch($sessionId);
5239 5239
                     $htmlResult .= '<br />';
5240 5240
                     $htmlResult .= Display::url(
5241
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5241
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5242 5242
                     );
5243 5243
                     $teacherList = array();
5244 5244
                     foreach ($coachList as $coachId) {
@@ -5351,7 +5351,7 @@  discard block
 block discarded – undo
5351 5351
                 }
5352 5352
 
5353 5353
                 $sessionIdList = array_map('intval', $sessionIdList);
5354
-                $sessionToString = implode("', '",  $sessionIdList);
5354
+                $sessionToString = implode("', '", $sessionIdList);
5355 5355
 
5356 5356
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5357 5357
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5363,7 +5363,7 @@  discard block
 block discarded – undo
5363 5363
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5364 5364
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5365 5365
                 $result = Database::query($sql);
5366
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5366
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5367 5367
                     $teacherListId[$row['user_id']] = $row['user_id'];
5368 5368
                 }
5369 5369
             } else {
@@ -5438,7 +5438,7 @@  discard block
 block discarded – undo
5438 5438
         $toolList = self::getCourseToolToBeManaged();
5439 5439
 
5440 5440
         foreach ($toolList as $tool) {
5441
-            $method = 'add' . $tool;
5441
+            $method = 'add'.$tool;
5442 5442
             if (method_exists(get_class(), $method)) {
5443 5443
                 self::$method($sessionId, $courseId);
5444 5444
             }
@@ -5457,7 +5457,7 @@  discard block
 block discarded – undo
5457 5457
         $toolList = self::getCourseToolToBeManaged();
5458 5458
 
5459 5459
         foreach ($toolList as $tool) {
5460
-            $method = 'remove' . $tool;
5460
+            $method = 'remove'.$tool;
5461 5461
             if (method_exists(get_class(), $method)) {
5462 5462
                 self::$method($sessionId, $courseId);
5463 5463
             }
@@ -5575,18 +5575,18 @@  discard block
 block discarded – undo
5575 5575
                         }
5576 5576
                     }
5577 5577
 
5578
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5578
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5579 5579
 
5580 5580
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5581
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5581
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5582 5582
                         continue;
5583 5583
                     }
5584 5584
 
5585 5585
                     if (!empty($sessionList)) {
5586
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5587
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5586
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5587
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5588 5588
                     } else {
5589
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5589
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5590 5590
                     }
5591 5591
                 }
5592 5592
             }
@@ -5766,8 +5766,8 @@  discard block
 block discarded – undo
5766 5766
 
5767 5767
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
5768 5768
 
5769
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
5770
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
5769
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
5770
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
5771 5771
 
5772 5772
         return $leftDays;
5773 5773
     }
@@ -6049,7 +6049,7 @@  discard block
 block discarded – undo
6049 6049
         $sql = "SELECT COUNT(1) as count, u.id, scu.status status_in_session, u.status user_status
6050 6050
                 FROM $tableSessionRelCourseRelUser scu
6051 6051
                 INNER JOIN $tableUser u ON scu.user_id = u.id
6052
-                WHERE scu.session_id = " . intval($sessionId) ."
6052
+                WHERE scu.session_id = ".intval($sessionId)."
6053 6053
                 GROUP BY u.id";
6054 6054
 
6055 6055
         $result = Database::query($sql);
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6085 6085
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6086 6086
             // Join session field and session field values tables
6087
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6087
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6088 6088
             $fieldsArray = array();
6089 6089
             foreach ($extraFields as $field) {
6090 6090
                 $fieldsArray[] = Database::escape_string($field);
@@ -6127,14 +6127,14 @@  discard block
 block discarded – undo
6127 6127
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6128 6128
                     $whereParams .= ', ?';
6129 6129
                 }
6130
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6131
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6130
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6131
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6132 6132
             }
6133 6133
             // Get session fields
6134 6134
             $extraField = new ExtraField('session');
6135 6135
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6136 6136
             $fieldsList = $extraField->get_all(array(
6137
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6137
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6138 6138
             ));
6139 6139
             // Index session fields
6140 6140
             foreach ($fieldsList as $field) {
@@ -6143,7 +6143,7 @@  discard block
 block discarded – undo
6143 6143
             // Get session field values
6144 6144
             $extra = new ExtraFieldValue('session');
6145 6145
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6146
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6146
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6147 6147
             // Add session fields values to session list
6148 6148
             foreach ($sessionList as $id => &$session) {
6149 6149
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6196,7 +6196,7 @@  discard block
 block discarded – undo
6196 6196
             // Check the result
6197 6197
             if ($result < 1) {
6198 6198
                 // If not found any result, update error message
6199
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6199
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6200 6200
             } elseif (count($result) > 1 && !$force) {
6201 6201
                 // If found more than one result and force is disabled, update error message
6202 6202
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6255,7 +6255,7 @@  discard block
 block discarded – undo
6255 6255
             // Check if session list query had result
6256 6256
             if (!empty($sessionList)) {
6257 6257
                 // implode all session id
6258
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6258
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6259 6259
                 // Get all field variables
6260 6260
                 $sessionFieldList = Database::select(
6261 6261
                     'id, variable',
@@ -6342,7 +6342,7 @@  discard block
 block discarded – undo
6342 6342
                 return $sessionList;
6343 6343
             } else {
6344 6344
                 // Not found result, update error message
6345
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6345
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6346 6346
             }
6347 6347
         }
6348 6348
 
@@ -6446,7 +6446,7 @@  discard block
 block discarded – undo
6446 6446
 
6447 6447
         $sessionExtraField = new ExtraField('session');
6448 6448
         $fieldList = $sessionExtraField->get_all(array(
6449
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6449
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6450 6450
         ));
6451 6451
 
6452 6452
         $fields = array();
@@ -6460,7 +6460,7 @@  discard block
 block discarded – undo
6460 6460
         $extra = new ExtraFieldValue('session');
6461 6461
         $sessionFieldValueList = $extra->get_all(
6462 6462
             array(
6463
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6463
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6464 6464
             )
6465 6465
         );
6466 6466
 
@@ -6531,7 +6531,7 @@  discard block
 block discarded – undo
6531 6531
                 FROM $sessionTable s
6532 6532
                 INNER JOIN $sessionUserTable sru ON s.id = sru.id_session
6533 6533
                 WHERE
6534
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6534
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6535 6535
                     AND sru.relation_type = 0
6536 6536
                 )";
6537 6537
 
@@ -6547,7 +6547,7 @@  discard block
 block discarded – undo
6547 6547
                         WHERE
6548 6548
                             srau.access_url_id = $accessUrlId
6549 6549
                             AND (
6550
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6550
+                                sru.id_user IN (".implode(', ', $userIdList).")
6551 6551
                                 AND sru.relation_type = 0
6552 6552
                             )";
6553 6553
             }
@@ -6568,7 +6568,7 @@  discard block
 block discarded – undo
6568 6568
      */
6569 6569
     public static function getSessionVisibility($sessionInfo)
6570 6570
     {
6571
-        switch($sessionInfo['visibility']) {
6571
+        switch ($sessionInfo['visibility']) {
6572 6572
             case 1:
6573 6573
                 return get_lang('ReadOnly');
6574 6574
             case 2:
@@ -6599,7 +6599,7 @@  discard block
 block discarded – undo
6599 6599
 
6600 6600
         $result = '';
6601 6601
         if (!empty($startDateToLocal) && !empty($endDateToLocal)) {
6602
-            $result =  sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6602
+            $result = sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6603 6603
         } else {
6604 6604
             if (!empty($startDateToLocal)) {
6605 6605
                 $result = get_lang('From').' '.$startDateToLocal;
@@ -6742,7 +6742,7 @@  discard block
 block discarded – undo
6742 6742
                     get_lang('CoachName'),
6743 6743
                     null,
6744 6744
                     [
6745
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
6745
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
6746 6746
                         'width' => '100%',
6747 6747
                     ]
6748 6748
                 );
@@ -6753,7 +6753,7 @@  discard block
 block discarded – undo
6753 6753
         $form->addHtml('<div id="ajax_list_coachs"></div>');
6754 6754
 
6755 6755
         $form->addButtonAdvancedSettings('advanced_params');
6756
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
6756
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
6757 6757
 
6758 6758
         $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
6759 6759
             'id' => 'session_category'
@@ -6891,7 +6891,7 @@  discard block
 block discarded – undo
6891 6891
         $extra_field = new ExtraField('session');
6892 6892
         $extra = $extra_field->addElements($form, $sessionId);
6893 6893
 
6894
-        $form->addElement('html','</div>');
6894
+        $form->addElement('html', '</div>');
6895 6895
 
6896 6896
         $js = $extra['jquery_ready_content'];
6897 6897
 
@@ -6922,16 +6922,16 @@  discard block
 block discarded – undo
6922 6922
         if (api_is_session_admin() &&
6923 6923
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
6924 6924
         ) {
6925
-            $where.=" WHERE s.session_admin_id = $user_id ";
6925
+            $where .= " WHERE s.session_admin_id = $user_id ";
6926 6926
         }
6927 6927
 
6928 6928
         if (!empty($options['where'])) {
6929 6929
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
6930
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
6930
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
6931 6931
 
6932 6932
             $options['where'] = str_replace(
6933 6933
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
6934
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
6934
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
6935 6935
                 , $options['where']
6936 6936
             );
6937 6937
 
@@ -6973,10 +6973,10 @@  discard block
 block discarded – undo
6973 6973
                        $where ";
6974 6974
 
6975 6975
         if (api_is_multiple_url_enabled()) {
6976
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6976
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6977 6977
             $access_url_id = api_get_current_access_url_id();
6978 6978
             if ($access_url_id != -1) {
6979
-                $where.= " AND ar.access_url_id = $access_url_id ";
6979
+                $where .= " AND ar.access_url_id = $access_url_id ";
6980 6980
 
6981 6981
                 $query_rows = "SELECT count(*) as total_rows
6982 6982
                                FROM $tbl_session s
@@ -7021,12 +7021,12 @@  discard block
 block discarded – undo
7021 7021
                     //get_lang('CourseTitle'),
7022 7022
                     get_lang('Visibility'),
7023 7023
                 );
7024
-                $column_model = array (
7025
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7026
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7027
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7028
-                    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)),
7029
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7024
+                $column_model = array(
7025
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7026
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7027
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7028
+                    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)),
7029
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7030 7030
                 );
7031 7031
                 break;
7032 7032
             case 'complete':
@@ -7039,12 +7039,12 @@  discard block
 block discarded – undo
7039 7039
                     get_lang('Visibility'),
7040 7040
                     get_lang('CourseTitle'),
7041 7041
                 );
7042
-                $column_model = array (
7043
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7044
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7045
-                    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)),
7046
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7047
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7042
+                $column_model = array(
7043
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7044
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7045
+                    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)),
7046
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7047
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7048 7048
                         // for the bottom bar
7049 7049
                         'searchoptions' => array(
7050 7050
                             'defaultValue'  => '1',
@@ -7052,8 +7052,8 @@  discard block
 block discarded – undo
7052 7052
                         // for the top bar
7053 7053
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7054 7054
                     ),
7055
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7056
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7055
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7056
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7057 7057
                 );
7058 7058
                 break;
7059 7059
         }
@@ -7062,14 +7062,14 @@  discard block
 block discarded – undo
7062 7062
         $session_field = new ExtraField('session');
7063 7063
         $rules = $session_field->getRules($columns, $column_model);
7064 7064
 
7065
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7065
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7066 7066
         $columns[] = get_lang('Actions');
7067 7067
 
7068 7068
         foreach ($column_model as $col_model) {
7069 7069
             $simple_column_name[] = $col_model['name'];
7070 7070
         }
7071 7071
 
7072
-        $return_array =  array(
7072
+        $return_array = array(
7073 7073
             'columns' => $columns,
7074 7074
             'column_model' => $column_model,
7075 7075
             'rules' => $rules,
@@ -7158,7 +7158,7 @@  discard block
 block discarded – undo
7158 7158
             if (api_is_session_admin() &&
7159 7159
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7160 7160
             ) {
7161
-                $where.=" AND s.session_admin_id = $user_id ";
7161
+                $where .= " AND s.session_admin_id = $user_id ";
7162 7162
             }
7163 7163
         }
7164 7164
 
@@ -7241,11 +7241,11 @@  discard block
 block discarded – undo
7241 7241
             }
7242 7242
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7243 7243
 
7244
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7244
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7245 7245
 
7246 7246
             $options['where'] = str_replace(
7247 7247
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7248
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7248
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7249 7249
                 , $options['where']
7250 7250
             );
7251 7251
 
@@ -7280,10 +7280,10 @@  discard block
 block discarded – undo
7280 7280
             $where;
7281 7281
 
7282 7282
         if (api_is_multiple_url_enabled()) {
7283
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7283
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7284 7284
             $access_url_id = api_get_current_access_url_id();
7285 7285
             if ($access_url_id != -1) {
7286
-                $where.= " AND ar.access_url_id = $access_url_id ";
7286
+                $where .= " AND ar.access_url_id = $access_url_id ";
7287 7287
                 $query = "$select
7288 7288
                     FROM $tbl_session s
7289 7289
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7310,7 +7310,7 @@  discard block
 block discarded – undo
7310 7310
         $formatted_sessions = array();
7311 7311
 
7312 7312
         if (Database::num_rows($result)) {
7313
-            $sessions   = Database::store_result($result, 'ASSOC');
7313
+            $sessions = Database::store_result($result, 'ASSOC');
7314 7314
             foreach ($sessions as $session) {
7315 7315
                 $session_id = $session['id'];
7316 7316
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7325,14 +7325,14 @@  discard block
 block discarded – undo
7325 7325
 
7326 7326
                 switch ($session['visibility']) {
7327 7327
                     case SESSION_VISIBLE_READ_ONLY: //1
7328
-                        $session['visibility'] =  get_lang('ReadOnly');
7328
+                        $session['visibility'] = get_lang('ReadOnly');
7329 7329
                         break;
7330 7330
                     case SESSION_VISIBLE:           //2
7331 7331
                     case SESSION_AVAILABLE:         //4
7332
-                        $session['visibility'] =  get_lang('Visible');
7332
+                        $session['visibility'] = get_lang('Visible');
7333 7333
                         break;
7334 7334
                     case SESSION_INVISIBLE:         //3
7335
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7335
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7336 7336
                         break;
7337 7337
                 }
7338 7338
 
@@ -7408,7 +7408,7 @@  discard block
 block discarded – undo
7408 7408
         if (empty($session)) {
7409 7409
             return false;
7410 7410
         }
7411
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7411
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7412 7412
     }
7413 7413
 
7414 7414
     /**
@@ -7426,7 +7426,7 @@  discard block
 block discarded – undo
7426 7426
             return false;
7427 7427
         }
7428 7428
         if (empty($courseId)) {
7429
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7429
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7430 7430
         } else {
7431 7431
             $courseInfo = api_get_course_info_by_id($courseId);
7432 7432
             if ($courseInfo) {
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
             // sort $listCat by catSessionName
7673 7673
             usort($listCat, 'self::compareBySessionName');
7674 7674
             // in each catSession sort sessionList by sessionName
7675
-            foreach($listCat as $i => $listCatSessionInfo) {
7675
+            foreach ($listCat as $i => $listCatSessionInfo) {
7676 7676
                 $listSessionList = $listCatSessionInfo['sessionList'];
7677 7677
                 usort($listSessionList, 'self::compareCatSessionInfo');
7678 7678
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -7687,8 +7687,8 @@  discard block
 block discarded – undo
7687 7687
             );
7688 7688
 
7689 7689
             $userCatId = intval($userCatId);
7690
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
7691
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
7690
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
7691
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
7692 7692
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
7693 7693
         }
7694 7694
 
@@ -7714,7 +7714,7 @@  discard block
 block discarded – undo
7714 7714
     {
7715 7715
         if ($listA['sessionName'] == $listB['sessionName']) {
7716 7716
             return 0;
7717
-        } else if($listA['sessionName'] > $listB['sessionName']) {
7717
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
7718 7718
             return 1;
7719 7719
         } else {
7720 7720
             return -1;
@@ -7734,7 +7734,7 @@  discard block
 block discarded – undo
7734 7734
             return 1;
7735 7735
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
7736 7736
             return 0;
7737
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
7737
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
7738 7738
             return 1;
7739 7739
         } else {
7740 7740
             return -1;
@@ -7750,7 +7750,7 @@  discard block
 block discarded – undo
7750 7750
     {
7751 7751
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
7752 7752
             return 0;
7753
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7753
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7754 7754
             return 1;
7755 7755
         } else {
7756 7756
             return -1;
@@ -7766,7 +7766,7 @@  discard block
 block discarded – undo
7766 7766
     {
7767 7767
         if ($listA['title'] == $listB['title']) {
7768 7768
             return 0;
7769
-        } else if($listA['title'] > $listB['title']) {
7769
+        } else if ($listA['title'] > $listB['title']) {
7770 7770
             return 1;
7771 7771
         } else {
7772 7772
             return -1;
@@ -7812,8 +7812,8 @@  discard block
 block discarded – undo
7812 7812
 
7813 7813
                 $marginShift = 20;
7814 7814
                 if ($catSessionName != '') {
7815
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
7816
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
7815
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
7816
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
7817 7817
                     $marginShift = 40;
7818 7818
                 }
7819 7819
 
Please login to merge, or discard this patch.