Completed
Push — 1.11.x ( c5cfcc...1cf9be )
by José
46:45 queued 17:54
created
main/lp/storageapi.php 1 patch
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,52 +15,52 @@
 block discarded – undo
15 15
 }
16 16
 
17 17
 switch ($_REQUEST['action']) {
18
-    case "get":
19
-        print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
20
-        break;
21
-    case "set":
22
-        if (storage_can_set($_REQUEST['svuser'])) {
23
-            print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
24
-        }
25
-        break;
26
-    case "getall":
27
-        print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
28
-        break;
29
-    case "stackpush":
30
-        if (storage_can_set($_REQUEST['svuser'])) {
31
-            print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
32
-        }
33
-        break;
34
-    case "stackpop":
35
-        if (storage_can_set($_REQUEST['svuser'])) {
36
-            print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
37
-        }
38
-        break;
39
-    case "stacklength":
40
-        print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
41
-        break;
42
-    case "stackclear":
43
-        if (storage_can_set($_REQUEST['svuser'])) {
44
-            print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
45
-        }
46
-        break;
47
-    case "stackgetall":
48
-        if (storage_can_set($_REQUEST['svuser']))
49
-            print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
-        break;
51
-    case "getposition":
52
-        print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
53
-        break;
54
-    case "getleaders":
55
-        print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
56
-        break;
57
-    case "usersgetall":
58
-// security issue
59
-        print "NOT allowed, security issue, see sources";
60
-//		print storage_get_all_users();
61
-        break;
62
-    default:
63
-        // Do nothing
18
+        case "get":
19
+            print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
20
+            break;
21
+        case "set":
22
+            if (storage_can_set($_REQUEST['svuser'])) {
23
+                print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
24
+            }
25
+            break;
26
+        case "getall":
27
+            print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
28
+            break;
29
+        case "stackpush":
30
+            if (storage_can_set($_REQUEST['svuser'])) {
31
+                print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
32
+            }
33
+            break;
34
+        case "stackpop":
35
+            if (storage_can_set($_REQUEST['svuser'])) {
36
+                print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
37
+            }
38
+            break;
39
+        case "stacklength":
40
+            print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
41
+            break;
42
+        case "stackclear":
43
+            if (storage_can_set($_REQUEST['svuser'])) {
44
+                print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
45
+            }
46
+            break;
47
+        case "stackgetall":
48
+            if (storage_can_set($_REQUEST['svuser']))
49
+                print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
+            break;
51
+        case "getposition":
52
+            print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
53
+            break;
54
+        case "getleaders":
55
+            print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
56
+            break;
57
+        case "usersgetall":
58
+    // security issue
59
+            print "NOT allowed, security issue, see sources";
60
+    //		print storage_get_all_users();
61
+            break;
62
+        default:
63
+            // Do nothing
64 64
 }
65 65
 
66 66
 function storage_can_set($sv_user) {
Please login to merge, or discard this patch.
main/upload/upload.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
  * Redirect to the correct script to handle this type of upload
32 32
  */
33 33
 switch ($toolFromSession) {
34
-    case TOOL_LEARNPATH:
35
-        require 'upload.scorm.php';
36
-        break;
37
-    //the following cases need to be distinguished later on
38
-    case TOOL_DROPBOX:
39
-    case TOOL_STUDENTPUBLICATION:
40
-    case TOOL_DOCUMENT:
41
-    default:
42
-        require 'upload.document.php';
43
-        break;
34
+        case TOOL_LEARNPATH:
35
+            require 'upload.scorm.php';
36
+            break;
37
+        //the following cases need to be distinguished later on
38
+        case TOOL_DROPBOX:
39
+        case TOOL_STUDENTPUBLICATION:
40
+        case TOOL_DOCUMENT:
41
+        default:
42
+            require 'upload.document.php';
43
+            break;
44 44
 }
Please login to merge, or discard this patch.
main/user/user_export.php 1 patch
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -149,15 +149,15 @@
 block discarded – undo
149 149
 }
150 150
 
151 151
 switch ($file_type) {
152
-    case 'xml':
153
-        Export::arrayToXml($data, $filename, 'Contact', 'Contacts');
154
-        exit;
155
-        break;
156
-    case 'csv':
157
-        Export::arrayToCsv($data, $filename);
158
-        exit;
159
-    case 'xls':
160
-        Export::arrayToXls($data, $filename);
161
-        exit;
162
-        break;
152
+        case 'xml':
153
+            Export::arrayToXml($data, $filename, 'Contact', 'Contacts');
154
+            exit;
155
+            break;
156
+        case 'csv':
157
+            Export::arrayToCsv($data, $filename);
158
+            exit;
159
+        case 'xls':
160
+            Export::arrayToXls($data, $filename);
161
+            exit;
162
+            break;
163 163
 }
164 164
\ No newline at end of file
Please login to merge, or discard this patch.
main/ticket/tickets.php 1 patch
Switch Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -72,48 +72,48 @@
 block discarded – undo
72 72
 }
73 73
 
74 74
 switch ($action) {
75
-    case 'alert':
76
-        if (!$isAdmin && isset($_GET['ticket_id'])) {
77
-            TicketManager::send_alert($_GET['ticket_id'], $user_id);
78
-        }
79
-        break;
80
-    case 'export':
81
-        $data = array(
82
-            array(
83
-                '#',
84
-                get_lang('Date'),
85
-                get_lang('LastUpdate'),
86
-                get_lang('Category'),
87
-                get_lang('User'),
88
-                get_lang('Program'),
89
-                get_lang('AssignedTo'),
90
-                get_lang('Status'),
91
-                get_lang('Description')
92
-            )
93
-        );
94
-        $datos = $table->get_clean_html();
95
-        foreach ($datos as $ticket) {
96
-            $ticket[0] = substr(strip_tags($ticket[0]), 0, 12);
97
-            $ticket_rem = array(
98
-                utf8_decode(strip_tags($ticket[0])),
99
-                utf8_decode(api_html_entity_decode($ticket[1])),
100
-                utf8_decode(strip_tags($ticket[2])),
101
-                utf8_decode(strip_tags($ticket[3])),
102
-                utf8_decode(strip_tags($ticket[4])),
103
-                utf8_decode(strip_tags($ticket[5])),
104
-                utf8_decode(strip_tags($ticket[6])),
105
-                utf8_decode(strip_tags($ticket[7]))
75
+        case 'alert':
76
+            if (!$isAdmin && isset($_GET['ticket_id'])) {
77
+                TicketManager::send_alert($_GET['ticket_id'], $user_id);
78
+            }
79
+            break;
80
+        case 'export':
81
+            $data = array(
82
+                array(
83
+                    '#',
84
+                    get_lang('Date'),
85
+                    get_lang('LastUpdate'),
86
+                    get_lang('Category'),
87
+                    get_lang('User'),
88
+                    get_lang('Program'),
89
+                    get_lang('AssignedTo'),
90
+                    get_lang('Status'),
91
+                    get_lang('Description')
92
+                )
106 93
             );
107
-            $data[] = $ticket_rem;
108
-        }
109
-        Export::arrayToXls($data, get_lang('Tickets'));
110
-        exit;
111
-        break;
112
-    case 'close_tickets':
113
-        TicketManager::close_old_tickets();
114
-        break;
115
-    default:
116
-        break;
94
+            $datos = $table->get_clean_html();
95
+            foreach ($datos as $ticket) {
96
+                $ticket[0] = substr(strip_tags($ticket[0]), 0, 12);
97
+                $ticket_rem = array(
98
+                    utf8_decode(strip_tags($ticket[0])),
99
+                    utf8_decode(api_html_entity_decode($ticket[1])),
100
+                    utf8_decode(strip_tags($ticket[2])),
101
+                    utf8_decode(strip_tags($ticket[3])),
102
+                    utf8_decode(strip_tags($ticket[4])),
103
+                    utf8_decode(strip_tags($ticket[5])),
104
+                    utf8_decode(strip_tags($ticket[6])),
105
+                    utf8_decode(strip_tags($ticket[7]))
106
+                );
107
+                $data[] = $ticket_rem;
108
+            }
109
+            Export::arrayToXls($data, get_lang('Tickets'));
110
+            exit;
111
+            break;
112
+        case 'close_tickets':
113
+            TicketManager::close_old_tickets();
114
+            break;
115
+        default:
116
+            break;
117 117
 }
118 118
 
119 119
 if (empty($projectId)) {
Please login to merge, or discard this patch.
main/session/session_course_user_list.php 1 patch
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,30 +62,30 @@
 block discarded – undo
62 62
 }
63 63
 
64 64
 switch ($action) {
65
-    case 'delete':
66
-        if (is_array($idChecked) && count($idChecked) > 0) {
67
-            array_map('intval', $idChecked);
68
-            $idChecked = implode(',', $idChecked);
69
-        }
70
-        if (!empty($idChecked)) {
71
-            $sql = "DELETE FROM $tbl_session_rel_course_rel_user
65
+        case 'delete':
66
+            if (is_array($idChecked) && count($idChecked) > 0) {
67
+                array_map('intval', $idChecked);
68
+                $idChecked = implode(',', $idChecked);
69
+            }
70
+            if (!empty($idChecked)) {
71
+                $sql = "DELETE FROM $tbl_session_rel_course_rel_user
72 72
                     WHERE session_id='$id_session' AND c_id='".$courseId."' AND user_id IN($idChecked)";
73
-            $result = Database::query($sql);
74
-            $nbr_affected_rows = Database::affected_rows($result);
75
-            $sql = "UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows
73
+                $result = Database::query($sql);
74
+                $nbr_affected_rows = Database::affected_rows($result);
75
+                $sql = "UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows
76 76
                     WHERE session_id='$id_session' AND c_id='".$courseId."'";
77
-            Database::query($sql);
78
-        }
79
-        header('Location: '.api_get_self()
80
-            .'?id_session='.$id_session.'&course_code='.urlencode($course_code).'&sort='.$sort);
81
-        exit();
82
-        break;
83
-    case 'add':
84
-        SessionManager::subscribe_users_to_session_course($idChecked, $id_session, $course_code);
85
-        header('Location: '.api_get_self()
86
-            .'?id_session='.$id_session.'&course_code='.urlencode($course_code).'&sort='.$sort);
87
-        exit;
88
-        break;
77
+                Database::query($sql);
78
+            }
79
+            header('Location: '.api_get_self()
80
+                .'?id_session='.$id_session.'&course_code='.urlencode($course_code).'&sort='.$sort);
81
+            exit();
82
+            break;
83
+        case 'add':
84
+            SessionManager::subscribe_users_to_session_course($idChecked, $id_session, $course_code);
85
+            header('Location: '.api_get_self()
86
+                .'?id_session='.$id_session.'&course_code='.urlencode($course_code).'&sort='.$sort);
87
+            exit;
88
+            break;
89 89
 }
90 90
 
91 91
 
Please login to merge, or discard this patch.
main/session/scheduled_announcement.php 1 patch
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 switch ($action) {
46
-    case 'run':
47
-        $messagesSent = $object->sendPendingMessages();
46
+        case 'run':
47
+            $messagesSent = $object->sendPendingMessages();
48
+
49
+            Display::addFlash(
50
+                Display::return_message(
51
+                    get_lang('MessageSent').': '.$messagesSent,
52
+                    'confirmation'
53
+                )
54
+            );
55
+            $content = $object->getGrid($sessionId);
48 56
 
49
-        Display::addFlash(
50
-            Display::return_message(
51
-                get_lang('MessageSent').': '.$messagesSent,
52
-                'confirmation'
53
-            )
54
-        );
55
-        $content = $object->getGrid($sessionId);
57
+            break;
58
+        case 'add':
59
+            $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&session_id='.$sessionId;
60
+            $form = $object->returnForm($url, 'add', $sessionInfo);
56 61
 
57
-        break;
58
-    case 'add':
59
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&session_id='.$sessionId;
60
-        $form = $object->returnForm($url, 'add', $sessionInfo);
61
-
62
-        // The validation or display
63
-        if ($form->validate()) {
64
-            $values = $form->getSubmitValues();
65
-            switch ($values['type']) {
62
+            // The validation or display
63
+            if ($form->validate()) {
64
+                $values = $form->getSubmitValues();
65
+                switch ($values['type']) {
66 66
                 case 'base_date':
67 67
                     $numberDays = (int) $values['days'];
68 68
                     switch ($values['base_date']) {
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
                             $baseDate = new DateTime($sessionInfo['access_end_date']);
74 74
                             break;
75 75
                     }
76
-                    $interval = new DateInterval('P'.$numberDays.'D');
77
-                    switch ($values['moment_type']) {
76
+                        $interval = new DateInterval('P'.$numberDays.'D');
77
+                        switch ($values['moment_type']) {
78 78
                         case 'after':
79 79
                             $newDate = $baseDate->add($interval);
80 80
                             break;
81 81
                         case 'before':
82 82
                             $newDate = $baseDate->sub($interval);
83 83
                             break;
84
-                    }
84
+                        }
85 85
                     $values['date'] = $newDate->format('Y-m-d h:i:s');
86 86
                     break;
87
-                case 'specific_date':
88
-                    $values['date'] = api_get_utc_datetime($values['date']);
89
-                    break;
87
+                    case 'specific_date':
88
+                        $values['date'] = api_get_utc_datetime($values['date']);
89
+                        break;
90 90
             }
91 91
 
92 92
             $res = $object->save($values);
@@ -110,34 +110,34 @@  discard block
 block discarded – undo
110 110
             $content .= $form->returnForm();
111 111
         }
112 112
         break;
113
-    case 'edit':
114
-        // Action handling: Editing
115
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&session_id='.$sessionId;
116
-        $form = $object->returnSimpleForm($url, 'edit', $sessionInfo);
117
-        if ($form->validate()) {
118
-            $values = $form->getSubmitValues();
119
-            $values['id'] = $id;
120
-            $values['sent'] = isset($values['sent']) ? 1 : '';
121
-            $values['date'] = api_get_utc_datetime($values['date']);
122
-            $res = $object->update($values);
123
-
124
-            Display::addFlash(Display::return_message(
125
-                get_lang('Updated'),
126
-                'confirmation'
127
-            ));
128
-        }
129
-        $item = $object->get($id);
130
-        $item['date'] = api_get_local_time($item['date']);
131
-        $form->setDefaults($item);
132
-        $content = $form->returnForm();
133
-        break;
134
-    case 'delete':
135
-        $object->delete($_GET['id']);
136
-        $content = $object->getGrid($sessionId);
137
-        break;
138
-    default:
139
-        $content = $object->getGrid($sessionId);
140
-        break;
113
+        case 'edit':
114
+            // Action handling: Editing
115
+            $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&session_id='.$sessionId;
116
+            $form = $object->returnSimpleForm($url, 'edit', $sessionInfo);
117
+            if ($form->validate()) {
118
+                $values = $form->getSubmitValues();
119
+                $values['id'] = $id;
120
+                $values['sent'] = isset($values['sent']) ? 1 : '';
121
+                $values['date'] = api_get_utc_datetime($values['date']);
122
+                $res = $object->update($values);
123
+
124
+                Display::addFlash(Display::return_message(
125
+                    get_lang('Updated'),
126
+                    'confirmation'
127
+                ));
128
+            }
129
+            $item = $object->get($id);
130
+            $item['date'] = api_get_local_time($item['date']);
131
+            $form->setDefaults($item);
132
+            $content = $form->returnForm();
133
+            break;
134
+        case 'delete':
135
+            $object->delete($_GET['id']);
136
+            $content = $object->getGrid($sessionId);
137
+            break;
138
+        default:
139
+            $content = $object->getGrid($sessionId);
140
+            break;
141 141
 }
142 142
 
143 143
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_programmed_announcements&session_id='.$sessionId;
Please login to merge, or discard this patch.
main/attendance/index.php 1 patch
Switch Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -228,113 +228,113 @@
 block discarded – undo
228 228
 }
229 229
 
230 230
 switch ($action) {
231
-    case 'attendance_list':
232
-        $attendanceController->attendance_list();
233
-        break;
234
-    case 'attendance_add':
235
-        if ($allowToEdit) {
236
-            $attendanceController->attendance_add();
237
-        } else {
238
-            api_not_allowed(true);
239
-        }
240
-        break;
241
-    case 'attendance_edit':
242
-        if ($allowToEdit) {
243
-            $attendanceController->attendance_edit($attendance_id);
244
-        } else {
245
-            api_not_allowed(true);
246
-        }
247
-        break;
248
-    case 'attendance_delete':
249
-        if ($allowToEdit) {
250
-            $attendanceController->attendance_delete($attendance_id);
251
-        } else {
252
-            api_not_allowed(true);
253
-        }
254
-        break;
255
-    case 'attendance_set_invisible':
256
-        if ($allowToEdit) {
257
-            $attendanceController->attendanceSetInvisible($attendance_id);
258
-        } else {
259
-            api_not_allowed(true);
260
-        }
261
-        break;
262
-    case 'attendance_set_visible':
263
-        if ($allowToEdit) {
264
-            $attendanceController->attendanceSetVisible($attendance_id);
265
-        } else {
266
-            api_not_allowed(true);
267
-        }
268
-        break;
269
-    /*case 'attendance_restore':
231
+        case 'attendance_list':
232
+            $attendanceController->attendance_list();
233
+            break;
234
+        case 'attendance_add':
235
+            if ($allowToEdit) {
236
+                $attendanceController->attendance_add();
237
+            } else {
238
+                api_not_allowed(true);
239
+            }
240
+            break;
241
+        case 'attendance_edit':
242
+            if ($allowToEdit) {
243
+                $attendanceController->attendance_edit($attendance_id);
244
+            } else {
245
+                api_not_allowed(true);
246
+            }
247
+            break;
248
+        case 'attendance_delete':
249
+            if ($allowToEdit) {
250
+                $attendanceController->attendance_delete($attendance_id);
251
+            } else {
252
+                api_not_allowed(true);
253
+            }
254
+            break;
255
+        case 'attendance_set_invisible':
256
+            if ($allowToEdit) {
257
+                $attendanceController->attendanceSetInvisible($attendance_id);
258
+            } else {
259
+                api_not_allowed(true);
260
+            }
261
+            break;
262
+        case 'attendance_set_visible':
263
+            if ($allowToEdit) {
264
+                $attendanceController->attendanceSetVisible($attendance_id);
265
+            } else {
266
+                api_not_allowed(true);
267
+            }
268
+            break;
269
+        /*case 'attendance_restore':
270 270
         if ($allowToEdit) {
271 271
             $attendanceController->attendance_restore($attendance_id);
272 272
         } else {
273 273
             api_not_allowed(true);
274 274
         }
275 275
         break;*/
276
-    case 'attendance_sheet_list':
277
-        $attendanceController->attendance_sheet(
278
-            $action,
279
-            $attendance_id,
280
-            $student_id,
281
-            true
282
-        );
283
-        break;
284
-    case 'attendance_sheet_list_no_edit':
285
-        $attendanceController->attendance_sheet(
286
-            $action,
287
-            $attendance_id,
288
-            $student_id,
289
-            false
290
-        );
291
-        break;
292
-    case 'attendance_sheet_export_to_pdf':
293
-        $attendanceController->attendance_sheet_export_to_pdf(
294
-            $action,
295
-            $attendance_id,
296
-            $student_id,
297
-            $course_id
298
-        );
299
-        break;
300
-    case 'attendance_sheet_add':
301
-        if ($allowToEdit) {
302
-            $attendanceController->attendance_sheet($action, $attendance_id);
303
-        } else {
304
-            api_not_allowed(true);
305
-        }
306
-        break;
307
-    case 'lock_attendance':
308
-    case 'unlock_attendance':
309
-        if ($allowToEdit) {
310
-            $attendanceController->lock_attendance($action, $attendance_id);
311
-        } else {
312
-            api_not_allowed(true);
313
-        }
314
-        break;
315
-    case 'calendar_add':
316
-        //no break
317
-    case 'calendar_edit':
318
-        //no break
319
-    case 'calendar_all_delete':
320
-        //no break
321
-    case 'calendar_delete':
322
-        if (!$allowToEdit) {
323
-            api_not_allowed(true);
324
-        }
325
-        //no break
326
-    case 'calendar_list':
327
-        $attendanceController->attendance_calendar(
328
-            $action,
329
-            $attendance_id,
330
-            $calendar_id
331
-        );
332
-        break;
333
-    case 'calendar_logins':
334
-        if (api_is_course_admin() || api_is_drh()) {
335
-            $attendanceController->getAttendanceBaseInLogin(false, true);
336
-        }
337
-        break;
338
-    default:
339
-        $attendanceController->attendance_list();
276
+        case 'attendance_sheet_list':
277
+            $attendanceController->attendance_sheet(
278
+                $action,
279
+                $attendance_id,
280
+                $student_id,
281
+                true
282
+            );
283
+            break;
284
+        case 'attendance_sheet_list_no_edit':
285
+            $attendanceController->attendance_sheet(
286
+                $action,
287
+                $attendance_id,
288
+                $student_id,
289
+                false
290
+            );
291
+            break;
292
+        case 'attendance_sheet_export_to_pdf':
293
+            $attendanceController->attendance_sheet_export_to_pdf(
294
+                $action,
295
+                $attendance_id,
296
+                $student_id,
297
+                $course_id
298
+            );
299
+            break;
300
+        case 'attendance_sheet_add':
301
+            if ($allowToEdit) {
302
+                $attendanceController->attendance_sheet($action, $attendance_id);
303
+            } else {
304
+                api_not_allowed(true);
305
+            }
306
+            break;
307
+        case 'lock_attendance':
308
+        case 'unlock_attendance':
309
+            if ($allowToEdit) {
310
+                $attendanceController->lock_attendance($action, $attendance_id);
311
+            } else {
312
+                api_not_allowed(true);
313
+            }
314
+            break;
315
+        case 'calendar_add':
316
+            //no break
317
+        case 'calendar_edit':
318
+            //no break
319
+        case 'calendar_all_delete':
320
+            //no break
321
+        case 'calendar_delete':
322
+            if (!$allowToEdit) {
323
+                api_not_allowed(true);
324
+            }
325
+            //no break
326
+        case 'calendar_list':
327
+            $attendanceController->attendance_calendar(
328
+                $action,
329
+                $attendance_id,
330
+                $calendar_id
331
+            );
332
+            break;
333
+        case 'calendar_logins':
334
+            if (api_is_course_admin() || api_is_drh()) {
335
+                $attendanceController->getAttendanceBaseInLogin(false, true);
336
+            }
337
+            break;
338
+        default:
339
+            $attendanceController->attendance_list();
340 340
 }
Please login to merge, or discard this patch.
main/inc/ajax/chat.ajax.php 1 patch
Switch Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -47,77 +47,77 @@
 block discarded – undo
47 47
 }
48 48
 
49 49
 switch ($action) {
50
-    case 'chatheartbeat':
51
-        $chat->heartbeat();
52
-        break;
53
-    case 'closechat':
54
-        $chat->close();
55
-        break;
56
-    case 'sendchat':
57
-        $chat->send(api_get_user_id(), $toUserId, $message);
58
-        break;
59
-    case 'startchatsession':
60
-        $chat->startSession();
61
-        break;
62
-    case 'get_previous_messages':
63
-        $userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
64
-        $visibleMessages = isset($_REQUEST['visible_messages']) ? $_REQUEST['visible_messages'] : null;
65
-        if (empty($userId)) {
66
-            return '';
67
-        }
68
-        $items = $chat->getPreviousMessages(
69
-            $userId,
70
-            api_get_user_id(),
71
-            $visibleMessages
72
-        );
73
-        echo json_encode($items);
74
-        exit;
75
-        break;
76
-    case 'set_status':
77
-        $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
78
-        $chat->setUserStatus($status);
79
-        break;
80
-    case 'create_room':
81
-        $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $toUserId);
82
-
83
-        if ($room === false) {
84
-            $createdRoom = VideoChat::createRoom(api_get_user_id(), $toUserId);
85
-
86
-            if ($createdRoom === false) {
87
-                echo Display::return_message(
88
-                    get_lang('ChatRoomNotCreated'),
89
-                    'error'
90
-                );
91
-                break;
50
+        case 'chatheartbeat':
51
+            $chat->heartbeat();
52
+            break;
53
+        case 'closechat':
54
+            $chat->close();
55
+            break;
56
+        case 'sendchat':
57
+            $chat->send(api_get_user_id(), $toUserId, $message);
58
+            break;
59
+        case 'startchatsession':
60
+            $chat->startSession();
61
+            break;
62
+        case 'get_previous_messages':
63
+            $userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
64
+            $visibleMessages = isset($_REQUEST['visible_messages']) ? $_REQUEST['visible_messages'] : null;
65
+            if (empty($userId)) {
66
+                return '';
92 67
             }
93
-
68
+            $items = $chat->getPreviousMessages(
69
+                $userId,
70
+                api_get_user_id(),
71
+                $visibleMessages
72
+            );
73
+            echo json_encode($items);
74
+            exit;
75
+            break;
76
+        case 'set_status':
77
+            $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
78
+            $chat->setUserStatus($status);
79
+            break;
80
+        case 'create_room':
94 81
             $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $toUserId);
95
-        }
96
-
97
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
98
-        $videoChatLink = Display::url(
99
-            Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
100
-            $videoChatUrl
101
-        );
102
-
103
-        $chat->send(
104
-            api_get_user_id(),
105
-            $toUserId,
106
-            $videoChatLink,
107
-            false,
108
-            false
109
-        );
110
-
111
-        echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
112
-        break;
113
-    case 'notify_not_support':
114
-        $chat->send(
115
-            api_get_user_id(),
116
-            $toUserId,
117
-            get_lang('TheXUserBrowserDoesNotSupportWebRTC')
118
-        );
119
-        break;
120
-    default:
121
-        echo '';
82
+
83
+            if ($room === false) {
84
+                $createdRoom = VideoChat::createRoom(api_get_user_id(), $toUserId);
85
+
86
+                if ($createdRoom === false) {
87
+                    echo Display::return_message(
88
+                        get_lang('ChatRoomNotCreated'),
89
+                        'error'
90
+                    );
91
+                    break;
92
+                }
93
+
94
+                $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $toUserId);
95
+            }
96
+
97
+            $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
98
+            $videoChatLink = Display::url(
99
+                Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
100
+                $videoChatUrl
101
+            );
102
+
103
+            $chat->send(
104
+                api_get_user_id(),
105
+                $toUserId,
106
+                $videoChatLink,
107
+                false,
108
+                false
109
+            );
110
+
111
+            echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
112
+            break;
113
+        case 'notify_not_support':
114
+            $chat->send(
115
+                api_get_user_id(),
116
+                $toUserId,
117
+                get_lang('TheXUserBrowserDoesNotSupportWebRTC')
118
+            );
119
+            break;
120
+        default:
121
+            echo '';
122 122
 }
123 123
 exit;
Please login to merge, or discard this patch.
main/auth/courses.php 1 patch
Switch Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -186,29 +186,29 @@  discard block
 block discarded – undo
186 186
     }
187 187
 }
188 188
 switch ($action) {
189
-    case 'subscribe_user_with_password':
190
-        $courses_controller->subscribe_user(
191
-            isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '',
192
-            $searchTerm,
193
-            isset($_POST['category_code']) ? $_POST['category_code'] : ''
194
-        );
195
-        break;
196
-    case 'createcoursecategory':
197
-        $courses_controller->categories_list($action);
198
-        break;
199
-    case 'deletecoursecategory':
200
-        $courses_controller->courses_list($action);
201
-        break;
202
-    case 'sortmycourses':
203
-        $courses_controller->courses_list($action);
204
-        break;
205
-    case 'subscribe':
206
-        if (!$user_can_view_page) {
207
-            api_not_allowed(true);
208
-        }
209
-        header('Location: '.api_get_self());
210
-        exit;
211
-        /* if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) {
189
+        case 'subscribe_user_with_password':
190
+            $courses_controller->subscribe_user(
191
+                isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '',
192
+                $searchTerm,
193
+                isset($_POST['category_code']) ? $_POST['category_code'] : ''
194
+            );
195
+            break;
196
+        case 'createcoursecategory':
197
+            $courses_controller->categories_list($action);
198
+            break;
199
+        case 'deletecoursecategory':
200
+            $courses_controller->courses_list($action);
201
+            break;
202
+        case 'sortmycourses':
203
+            $courses_controller->courses_list($action);
204
+            break;
205
+        case 'subscribe':
206
+            if (!$user_can_view_page) {
207
+                api_not_allowed(true);
208
+            }
209
+            header('Location: '.api_get_self());
210
+            exit;
211
+            /* if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) {
212 212
             $courses_controller->courses_categories(
213 213
                 $action,
214 214
                 $categoryCode,
@@ -221,121 +221,121 @@  discard block
 block discarded – undo
221 221
             header('Location: ' . api_get_self());
222 222
             exit;
223 223
         }*/
224
-        break;
225
-    case 'display_random_courses':
226
-        if (!$user_can_view_page) {
227
-            api_not_allowed(true);
228
-        }
229
-
230
-        $courses_controller->courses_categories($action);
231
-        break;
232
-    case 'display_courses':
233
-        if (!$user_can_view_page) {
234
-            api_not_allowed(true);
235
-        }
236
-
237
-        $courses_controller->courses_categories(
238
-            $action,
239
-            $categoryCode,
240
-            null,
241
-            null,
242
-            null,
243
-            $limit
244
-        );
245
-        break;
246
-    case 'display_sessions':
247
-        if (!$user_can_view_page) {
248
-            api_not_allowed(true);
249
-        }
250
-
251
-        $courses_controller->sessionsList($action, $nameTools, $limit);
252
-        break;
253
-    case 'subscribe_to_session':
254
-        if (!$user_can_view_page) {
255
-            api_not_allowed(true);
256
-        }
257
-
258
-        $userId = api_get_user_id();
259
-        $confirmed = isset($_GET['confirm']);
260
-        $sessionId = intval($_GET['session_id']);
261
-
262
-        if (empty($userId)) {
263
-            api_not_allowed();
264
-            exit;
265
-        }
266
-
267
-        if (!$confirmed) {
268
-            $template = new Template(null, false, false, false, false, false);
269
-            $template->assign('session_id', $sessionId);
270
-            $layout = $template->get_template('auth/confirm_session_subscription.tpl');
271
-            echo $template->fetch($layout);
272
-            exit;
273
-        }
224
+            break;
225
+        case 'display_random_courses':
226
+            if (!$user_can_view_page) {
227
+                api_not_allowed(true);
228
+            }
274 229
 
275
-        $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
276
-        if ($registrationAllowed === 'true') {
277
-            $entityManager = Database::getManager();
278
-            $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
230
+            $courses_controller->courses_categories($action);
231
+            break;
232
+        case 'display_courses':
233
+            if (!$user_can_view_page) {
234
+                api_not_allowed(true);
235
+            }
279 236
 
280
-            $sequences = $repository->getRequirements(
281
-                $sessionId,
282
-                SequenceResource::SESSION_TYPE
237
+            $courses_controller->courses_categories(
238
+                $action,
239
+                $categoryCode,
240
+                null,
241
+                null,
242
+                null,
243
+                $limit
283 244
             );
245
+            break;
246
+        case 'display_sessions':
247
+            if (!$user_can_view_page) {
248
+                api_not_allowed(true);
249
+            }
250
+
251
+            $courses_controller->sessionsList($action, $nameTools, $limit);
252
+            break;
253
+        case 'subscribe_to_session':
254
+            if (!$user_can_view_page) {
255
+                api_not_allowed(true);
256
+            }
257
+
258
+            $userId = api_get_user_id();
259
+            $confirmed = isset($_GET['confirm']);
260
+            $sessionId = intval($_GET['session_id']);
261
+
262
+            if (empty($userId)) {
263
+                api_not_allowed();
264
+                exit;
265
+            }
266
+
267
+            if (!$confirmed) {
268
+                $template = new Template(null, false, false, false, false, false);
269
+                $template->assign('session_id', $sessionId);
270
+                $layout = $template->get_template('auth/confirm_session_subscription.tpl');
271
+                echo $template->fetch($layout);
272
+                exit;
273
+            }
284 274
 
285
-            if (count($sequences) > 0) {
286
-                $requirementsData = SequenceResourceManager::checkRequirementsForUser(
287
-                    $sequences,
288
-                    SequenceResource::SESSION_TYPE,
289
-                    $userId
275
+            $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
276
+            if ($registrationAllowed === 'true') {
277
+                $entityManager = Database::getManager();
278
+                $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
279
+
280
+                $sequences = $repository->getRequirements(
281
+                    $sessionId,
282
+                    SequenceResource::SESSION_TYPE
290 283
                 );
291 284
 
292
-                $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
285
+                if (count($sequences) > 0) {
286
+                    $requirementsData = SequenceResourceManager::checkRequirementsForUser(
287
+                        $sequences,
288
+                        SequenceResource::SESSION_TYPE,
289
+                        $userId
290
+                    );
291
+
292
+                    $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
293 293
 
294
-                if (!$continueWithSubscription) {
295
-                    header('Location: '.api_get_path(WEB_CODE_PATH).'auth/courses.php');
296
-                    exit;
294
+                    if (!$continueWithSubscription) {
295
+                        header('Location: '.api_get_path(WEB_CODE_PATH).'auth/courses.php');
296
+                        exit;
297
+                    }
297 298
                 }
298
-            }
299 299
 
300
-            SessionManager::subscribe_users_to_session(
301
-                $_GET['session_id'],
302
-                array($userId),
303
-                SESSION_VISIBLE_READ_ONLY,
304
-                false
305
-            );
300
+                SessionManager::subscribe_users_to_session(
301
+                    $_GET['session_id'],
302
+                    array($userId),
303
+                    SESSION_VISIBLE_READ_ONLY,
304
+                    false
305
+                );
306 306
 
307
-            $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
308
-            $count = count($coursesList);
309
-            $url = '';
310
-
311
-            if ($count <= 0) {
312
-                // no course in session -> return to catalog
313
-                $url = api_get_path(WEB_CODE_PATH).'auth/courses.php';
314
-            } elseif ($count == 1) {
315
-                // only one course, so redirect directly to this course
316
-                foreach ($coursesList as $course) {
317
-                    $url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.intval($_GET['session_id']);
307
+                $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
308
+                $count = count($coursesList);
309
+                $url = '';
310
+
311
+                if ($count <= 0) {
312
+                    // no course in session -> return to catalog
313
+                    $url = api_get_path(WEB_CODE_PATH).'auth/courses.php';
314
+                } elseif ($count == 1) {
315
+                    // only one course, so redirect directly to this course
316
+                    foreach ($coursesList as $course) {
317
+                        $url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.intval($_GET['session_id']);
318
+                    }
319
+                } else {
320
+                    $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.intval($_GET['session_id']);
318 321
                 }
319
-            } else {
320
-                $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.intval($_GET['session_id']);
322
+                header('Location: '.$url);
323
+                exit;
321 324
             }
322
-            header('Location: '.$url);
323
-            exit;
324
-        }
325
-        //else show error message?
326
-        break;
327
-    case 'search_tag':
328
-        if (!$user_can_view_page) {
329
-            api_not_allowed(true);
330
-        }
331
-
332
-        $courses_controller->sessionsListByCoursesTag($limit);
333
-        break;
334
-    case 'search_session':
335
-        if (!$user_can_view_page) {
336
-            api_not_allowed(true);
337
-        }
338
-
339
-        $courses_controller->sessionListBySearch($limit);
340
-        break;
325
+            //else show error message?
326
+            break;
327
+        case 'search_tag':
328
+            if (!$user_can_view_page) {
329
+                api_not_allowed(true);
330
+            }
331
+
332
+            $courses_controller->sessionsListByCoursesTag($limit);
333
+            break;
334
+        case 'search_session':
335
+            if (!$user_can_view_page) {
336
+                api_not_allowed(true);
337
+            }
338
+
339
+            $courses_controller->sessionListBySearch($limit);
340
+            break;
341 341
 }
Please login to merge, or discard this patch.