@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | set_time_limit(0); |
38 | 38 | |
39 | 39 | if (isset($_POST['formSent'])) { |
40 | - $formSent = $_POST['formSent']; |
|
41 | - $file_type = isset($_POST['file_type']) ? $_POST['file_type'] : 'csv'; |
|
42 | - $session_id = $_POST['session_id']; |
|
43 | - if (empty($session_id)) { |
|
44 | - $sql = "SELECT |
|
40 | + $formSent = $_POST['formSent']; |
|
41 | + $file_type = isset($_POST['file_type']) ? $_POST['file_type'] : 'csv'; |
|
42 | + $session_id = $_POST['session_id']; |
|
43 | + if (empty($session_id)) { |
|
44 | + $sql = "SELECT |
|
45 | 45 | s.id, |
46 | 46 | name, |
47 | 47 | id_coach, |
@@ -55,84 +55,84 @@ discard block |
||
55 | 55 | ON $tbl_user.user_id = s.id_coach |
56 | 56 | ORDER BY id"; |
57 | 57 | |
58 | - if (api_is_multiple_url_enabled()) { |
|
59 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
60 | - $access_url_id = api_get_current_access_url_id(); |
|
61 | - if ($access_url_id != -1){ |
|
62 | - $sql = "SELECT s.id, name,id_coach,username,access_start_date,access_end_date,visibility,session_category_id |
|
58 | + if (api_is_multiple_url_enabled()) { |
|
59 | + $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
60 | + $access_url_id = api_get_current_access_url_id(); |
|
61 | + if ($access_url_id != -1){ |
|
62 | + $sql = "SELECT s.id, name,id_coach,username,access_start_date,access_end_date,visibility,session_category_id |
|
63 | 63 | FROM $tbl_session s |
64 | 64 | INNER JOIN $tbl_session_rel_access_url as session_rel_url |
65 | 65 | ON (s.id= session_rel_url.session_id) |
66 | 66 | INNER JOIN $tbl_user u ON (u.user_id = s.id_coach) |
67 | 67 | WHERE access_url_id = $access_url_id |
68 | 68 | ORDER BY id"; |
69 | - } |
|
70 | - } |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - $result = Database::query($sql); |
|
73 | - } else { |
|
74 | - $sql = "SELECT s.id,name,username,access_start_date,access_end_date,visibility,session_category_id |
|
72 | + $result = Database::query($sql); |
|
73 | + } else { |
|
74 | + $sql = "SELECT s.id,name,username,access_start_date,access_end_date,visibility,session_category_id |
|
75 | 75 | FROM $tbl_session s |
76 | 76 | INNER JOIN $tbl_user |
77 | 77 | ON $tbl_user.user_id = s.id_coach |
78 | 78 | WHERE id='$session_id'"; |
79 | - $result = Database::query($sql); |
|
80 | - } |
|
79 | + $result = Database::query($sql); |
|
80 | + } |
|
81 | 81 | |
82 | - if (Database::num_rows($result)) { |
|
82 | + if (Database::num_rows($result)) { |
|
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - $sessionListToExport = []; |
|
86 | + $sessionListToExport = []; |
|
87 | 87 | |
88 | - if (in_array($file_type, ['csv', 'xls'])) { |
|
88 | + if (in_array($file_type, ['csv', 'xls'])) { |
|
89 | 89 | |
90 | - $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time(); |
|
90 | + $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time(); |
|
91 | 91 | |
92 | - $cvs = true; |
|
93 | - $sessionListToExport[] = [ |
|
94 | - 'SessionName', |
|
95 | - 'Coach', |
|
96 | - 'DateStart', |
|
97 | - 'DateEnd', |
|
98 | - 'Visibility', |
|
99 | - 'SessionCategory', |
|
100 | - 'Users', |
|
101 | - 'Courses' |
|
102 | - ]; |
|
103 | - } else { |
|
104 | - if (!file_exists($archivePath)) { |
|
105 | - mkdir($archivePath, api_get_permissions_for_new_directories(), true); |
|
106 | - } |
|
92 | + $cvs = true; |
|
93 | + $sessionListToExport[] = [ |
|
94 | + 'SessionName', |
|
95 | + 'Coach', |
|
96 | + 'DateStart', |
|
97 | + 'DateEnd', |
|
98 | + 'Visibility', |
|
99 | + 'SessionCategory', |
|
100 | + 'Users', |
|
101 | + 'Courses' |
|
102 | + ]; |
|
103 | + } else { |
|
104 | + if (!file_exists($archivePath)) { |
|
105 | + mkdir($archivePath, api_get_permissions_for_new_directories(), true); |
|
106 | + } |
|
107 | 107 | |
108 | - if (!file_exists($archivePath.'index.html')) { |
|
109 | - $fp = fopen($archivePath.'index.html', 'w'); |
|
110 | - fputs($fp, '<html><head></head><body></body></html>'); |
|
111 | - fclose($fp); |
|
112 | - } |
|
108 | + if (!file_exists($archivePath.'index.html')) { |
|
109 | + $fp = fopen($archivePath.'index.html', 'w'); |
|
110 | + fputs($fp, '<html><head></head><body></body></html>'); |
|
111 | + fclose($fp); |
|
112 | + } |
|
113 | 113 | |
114 | - $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time().'.'.$file_type; |
|
115 | - while (file_exists($archivePath.$archiveFile)) { |
|
116 | - $archiveFile ='export_users_'.$session_id.'_'.api_get_local_time().'_'.uniqid('').'.'.$file_type; |
|
117 | - } |
|
114 | + $archiveFile = 'export_sessions_'.$session_id.'_'.api_get_local_time().'.'.$file_type; |
|
115 | + while (file_exists($archivePath.$archiveFile)) { |
|
116 | + $archiveFile ='export_users_'.$session_id.'_'.api_get_local_time().'_'.uniqid('').'.'.$file_type; |
|
117 | + } |
|
118 | 118 | |
119 | - $cvs = false; |
|
120 | - $fp = fopen($archivePath.$archiveFile, 'w'); |
|
121 | - fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Sessions>\n"); |
|
122 | - } |
|
119 | + $cvs = false; |
|
120 | + $fp = fopen($archivePath.$archiveFile, 'w'); |
|
121 | + fputs($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Sessions>\n"); |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | - while ($row = Database::fetch_array($result)) { |
|
126 | - $row['name'] = str_replace(';',',',$row['name']); |
|
127 | - $row['username'] = str_replace(';',',',$row['username']); |
|
128 | - $row['access_start_date'] = str_replace(';',',',$row['access_start_date']); |
|
129 | - $row['access_end_date'] = str_replace(';',',',$row['access_end_date']); |
|
130 | - $row['visibility'] = str_replace(';',',',$row['visibility']); |
|
131 | - $row['session_category'] = str_replace(';',',',$row['session_category_id']); |
|
125 | + while ($row = Database::fetch_array($result)) { |
|
126 | + $row['name'] = str_replace(';',',',$row['name']); |
|
127 | + $row['username'] = str_replace(';',',',$row['username']); |
|
128 | + $row['access_start_date'] = str_replace(';',',',$row['access_start_date']); |
|
129 | + $row['access_end_date'] = str_replace(';',',',$row['access_end_date']); |
|
130 | + $row['visibility'] = str_replace(';',',',$row['visibility']); |
|
131 | + $row['session_category'] = str_replace(';',',',$row['session_category_id']); |
|
132 | 132 | |
133 | 133 | |
134 | - // users |
|
135 | - $sql = "SELECT DISTINCT $tbl_user.username |
|
134 | + // users |
|
135 | + $sql = "SELECT DISTINCT $tbl_user.username |
|
136 | 136 | FROM $tbl_user |
137 | 137 | INNER JOIN $tbl_session_user |
138 | 138 | ON |
@@ -140,33 +140,33 @@ discard block |
||
140 | 140 | $tbl_session_user.relation_type<>".SESSION_RELATION_TYPE_RRHH." AND |
141 | 141 | $tbl_session_user.session_id = '".$row['id']."'"; |
142 | 142 | |
143 | - $rsUsers = Database::query($sql); |
|
144 | - $users = ''; |
|
145 | - while ($rowUsers = Database::fetch_array($rsUsers)){ |
|
146 | - if($cvs){ |
|
147 | - $users .= str_replace(';',',',$rowUsers['username']).'|'; |
|
148 | - } else { |
|
149 | - $users .= "\t\t<User>$rowUsers[username]</User>\n"; |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - if (!empty($users) && $cvs) { |
|
154 | - $users = api_substr($users, 0, api_strlen($users) - 1); |
|
155 | - } |
|
156 | - |
|
157 | - // Courses |
|
158 | - $sql = "SELECT DISTINCT c.code, sc.id, c_id |
|
143 | + $rsUsers = Database::query($sql); |
|
144 | + $users = ''; |
|
145 | + while ($rowUsers = Database::fetch_array($rsUsers)){ |
|
146 | + if($cvs){ |
|
147 | + $users .= str_replace(';',',',$rowUsers['username']).'|'; |
|
148 | + } else { |
|
149 | + $users .= "\t\t<User>$rowUsers[username]</User>\n"; |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + if (!empty($users) && $cvs) { |
|
154 | + $users = api_substr($users, 0, api_strlen($users) - 1); |
|
155 | + } |
|
156 | + |
|
157 | + // Courses |
|
158 | + $sql = "SELECT DISTINCT c.code, sc.id, c_id |
|
159 | 159 | FROM $tbl_course c |
160 | 160 | INNER JOIN $tbl_session_course_user sc |
161 | 161 | ON c.id = sc.c_id |
162 | 162 | AND sc.session_id = '".$row['id']."'"; |
163 | 163 | |
164 | - $rsCourses = Database::query($sql); |
|
164 | + $rsCourses = Database::query($sql); |
|
165 | 165 | |
166 | - $courses = ''; |
|
167 | - while ($rowCourses = Database::fetch_array($rsCourses)) { |
|
168 | - // get coachs from a course |
|
169 | - $sql = "SELECT u.username |
|
166 | + $courses = ''; |
|
167 | + while ($rowCourses = Database::fetch_array($rsCourses)) { |
|
168 | + // get coachs from a course |
|
169 | + $sql = "SELECT u.username |
|
170 | 170 | FROM $tbl_session_course_user scu |
171 | 171 | INNER JOIN $tbl_user u |
172 | 172 | ON u.user_id = scu.user_id |
@@ -175,25 +175,25 @@ discard block |
||
175 | 175 | scu.session_id = '".$row['id']."' AND |
176 | 176 | scu.status = 2 "; |
177 | 177 | |
178 | - $rs_coachs = Database::query($sql); |
|
179 | - $coachs = array(); |
|
180 | - while ($row_coachs = Database::fetch_array($rs_coachs)) { |
|
181 | - $coachs[] = $row_coachs['username']; |
|
182 | - } |
|
183 | - |
|
184 | - $coachs = implode(",", $coachs); |
|
185 | - |
|
186 | - if ($cvs) { |
|
187 | - $courses .= str_replace(';',',',$rowCourses['code']); |
|
188 | - $courses .= '['.str_replace(';',',',$coachs).']['; |
|
189 | - } else { |
|
190 | - $courses .= "\t\t<Course>\n"; |
|
191 | - $courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n"; |
|
192 | - $courses .= "\t\t\t<Coach>$coachs</Coach>\n"; |
|
193 | - } |
|
194 | - |
|
195 | - // rel user courses |
|
196 | - $sql = "SELECT DISTINCT u.username |
|
178 | + $rs_coachs = Database::query($sql); |
|
179 | + $coachs = array(); |
|
180 | + while ($row_coachs = Database::fetch_array($rs_coachs)) { |
|
181 | + $coachs[] = $row_coachs['username']; |
|
182 | + } |
|
183 | + |
|
184 | + $coachs = implode(",", $coachs); |
|
185 | + |
|
186 | + if ($cvs) { |
|
187 | + $courses .= str_replace(';',',',$rowCourses['code']); |
|
188 | + $courses .= '['.str_replace(';',',',$coachs).']['; |
|
189 | + } else { |
|
190 | + $courses .= "\t\t<Course>\n"; |
|
191 | + $courses .= "\t\t\t<CourseCode>$rowCourses[code]</CourseCode>\n"; |
|
192 | + $courses .= "\t\t\t<Coach>$coachs</Coach>\n"; |
|
193 | + } |
|
194 | + |
|
195 | + // rel user courses |
|
196 | + $sql = "SELECT DISTINCT u.username |
|
197 | 197 | FROM $tbl_session_course_user scu |
198 | 198 | INNER JOIN $tbl_session_user su |
199 | 199 | ON |
@@ -206,80 +206,80 @@ discard block |
||
206 | 206 | scu.c_id='".$rowCourses['c_id']."' AND |
207 | 207 | scu.session_id='".$row['id']."'"; |
208 | 208 | |
209 | - $rsUsersCourse = Database::query($sql); |
|
210 | - $userscourse = ''; |
|
211 | - while ($rowUsersCourse = Database::fetch_array($rsUsersCourse)){ |
|
212 | - if ($cvs) { |
|
213 | - $userscourse .= str_replace(';',',',$rowUsersCourse['username']).','; |
|
214 | - } else { |
|
215 | - $courses .= "\t\t\t<User>$rowUsersCourse[username]</User>\n"; |
|
216 | - } |
|
217 | - } |
|
218 | - |
|
219 | - if ($cvs) { |
|
220 | - if (!empty($userscourse)) { |
|
221 | - $userscourse = api_substr( |
|
222 | - $userscourse, |
|
223 | - 0, |
|
224 | - api_strlen($userscourse) - 1 |
|
225 | - ); |
|
226 | - } |
|
227 | - |
|
228 | - $courses .= $userscourse.']|'; |
|
229 | - } else { |
|
230 | - $courses .= "\t\t</Course>\n"; |
|
231 | - } |
|
232 | - } |
|
233 | - |
|
234 | - if (!empty($courses) && $cvs) { |
|
235 | - $courses = api_substr($courses, 0, api_strlen($courses) - 1); |
|
236 | - } |
|
237 | - $add .= $courses; |
|
238 | - |
|
239 | - |
|
240 | - if (in_array($file_type, ['csv', 'xls'])) { |
|
241 | - $sessionListToExport[] = [ |
|
242 | - $row['name'], |
|
243 | - $row['username'], |
|
244 | - $row['access_start_date'], |
|
245 | - $row['access_end_date'], |
|
246 | - $row['visibility'], |
|
247 | - $row['session_category'], |
|
248 | - $users, |
|
249 | - $courses |
|
250 | - ]; |
|
251 | - } else { |
|
252 | - $add = "\t<Session>\n" |
|
253 | - ."\t\t<SessionName>$row[name]</SessionName>\n" |
|
254 | - ."\t\t<Coach>$row[username]</Coach>\n" |
|
255 | - ."\t\t<DateStart>$row[access_start_date]</DateStart>\n" |
|
256 | - ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n" |
|
257 | - ."\t\t<Visibility>$row[visibility]</Visibility>\n" |
|
258 | - ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n"; |
|
259 | - } |
|
260 | - |
|
261 | - if (!$cvs) { |
|
262 | - $add .= "\t</Session>\n"; |
|
263 | - fputs($fp, $add); |
|
264 | - } |
|
265 | - } |
|
266 | - |
|
267 | - switch ($file_type) { |
|
268 | - case 'xml': |
|
269 | - fputs($fp, "</Sessions>\n"); |
|
270 | - fclose($fp); |
|
271 | - $errorMsg = get_lang('UserListHasBeenExported').'<br/> |
|
209 | + $rsUsersCourse = Database::query($sql); |
|
210 | + $userscourse = ''; |
|
211 | + while ($rowUsersCourse = Database::fetch_array($rsUsersCourse)){ |
|
212 | + if ($cvs) { |
|
213 | + $userscourse .= str_replace(';',',',$rowUsersCourse['username']).','; |
|
214 | + } else { |
|
215 | + $courses .= "\t\t\t<User>$rowUsersCourse[username]</User>\n"; |
|
216 | + } |
|
217 | + } |
|
218 | + |
|
219 | + if ($cvs) { |
|
220 | + if (!empty($userscourse)) { |
|
221 | + $userscourse = api_substr( |
|
222 | + $userscourse, |
|
223 | + 0, |
|
224 | + api_strlen($userscourse) - 1 |
|
225 | + ); |
|
226 | + } |
|
227 | + |
|
228 | + $courses .= $userscourse.']|'; |
|
229 | + } else { |
|
230 | + $courses .= "\t\t</Course>\n"; |
|
231 | + } |
|
232 | + } |
|
233 | + |
|
234 | + if (!empty($courses) && $cvs) { |
|
235 | + $courses = api_substr($courses, 0, api_strlen($courses) - 1); |
|
236 | + } |
|
237 | + $add .= $courses; |
|
238 | + |
|
239 | + |
|
240 | + if (in_array($file_type, ['csv', 'xls'])) { |
|
241 | + $sessionListToExport[] = [ |
|
242 | + $row['name'], |
|
243 | + $row['username'], |
|
244 | + $row['access_start_date'], |
|
245 | + $row['access_end_date'], |
|
246 | + $row['visibility'], |
|
247 | + $row['session_category'], |
|
248 | + $users, |
|
249 | + $courses |
|
250 | + ]; |
|
251 | + } else { |
|
252 | + $add = "\t<Session>\n" |
|
253 | + ."\t\t<SessionName>$row[name]</SessionName>\n" |
|
254 | + ."\t\t<Coach>$row[username]</Coach>\n" |
|
255 | + ."\t\t<DateStart>$row[access_start_date]</DateStart>\n" |
|
256 | + ."\t\t<DateEnd>$row[access_end_date]</DateEnd>\n" |
|
257 | + ."\t\t<Visibility>$row[visibility]</Visibility>\n" |
|
258 | + ."\t\t<SessionCategory>$row[session_category]</SessionCategory>\n"; |
|
259 | + } |
|
260 | + |
|
261 | + if (!$cvs) { |
|
262 | + $add .= "\t</Session>\n"; |
|
263 | + fputs($fp, $add); |
|
264 | + } |
|
265 | + } |
|
266 | + |
|
267 | + switch ($file_type) { |
|
268 | + case 'xml': |
|
269 | + fputs($fp, "</Sessions>\n"); |
|
270 | + fclose($fp); |
|
271 | + $errorMsg = get_lang('UserListHasBeenExported').'<br/> |
|
272 | 272 | <a class="btn btn-default" href="'.$archiveURL.$archiveFile.'">'.get_lang('ClickHereToDownloadTheFile').'</a>'; |
273 | - break; |
|
274 | - case 'csv': |
|
275 | - Export::arrayToCsv($sessionListToExport, $archiveFile); |
|
276 | - exit; |
|
277 | - case 'xls': |
|
278 | - Export::arrayToXls($sessionListToExport, $archiveFile); |
|
279 | - exit; |
|
280 | - break; |
|
281 | - } |
|
282 | - } |
|
273 | + break; |
|
274 | + case 'csv': |
|
275 | + Export::arrayToCsv($sessionListToExport, $archiveFile); |
|
276 | + exit; |
|
277 | + case 'xls': |
|
278 | + Export::arrayToXls($sessionListToExport, $archiveFile); |
|
279 | + exit; |
|
280 | + break; |
|
281 | + } |
|
282 | + } |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | // display the header |
@@ -289,26 +289,26 @@ discard block |
||
289 | 289 | $sql = "SELECT id, name FROM $tbl_session ORDER BY name"; |
290 | 290 | |
291 | 291 | if (api_is_multiple_url_enabled()) { |
292 | - $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
293 | - $access_url_id = api_get_current_access_url_id(); |
|
294 | - if ($access_url_id != -1){ |
|
295 | - $sql = "SELECT s.id, name FROM $tbl_session s |
|
292 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
293 | + $access_url_id = api_get_current_access_url_id(); |
|
294 | + if ($access_url_id != -1){ |
|
295 | + $sql = "SELECT s.id, name FROM $tbl_session s |
|
296 | 296 | INNER JOIN $tbl_session_rel_access_url as session_rel_url |
297 | 297 | ON (s.id = session_rel_url.session_id) |
298 | 298 | WHERE access_url_id = $access_url_id |
299 | 299 | ORDER BY name"; |
300 | - } |
|
300 | + } |
|
301 | 301 | } |
302 | 302 | $result = Database::query($sql); |
303 | 303 | $Sessions = Database::store_result($result); |
304 | 304 | |
305 | 305 | echo '<div class="actions">'; |
306 | 306 | echo '<a href="../session/session_list.php">'. |
307 | - Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('SessionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
307 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('SessionList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
308 | 308 | echo '</div>'; |
309 | 309 | |
310 | 310 | if (!empty($errorMsg)) { |
311 | - Display::display_normal_message($errorMsg, false); //main API |
|
311 | + Display::display_normal_message($errorMsg, false); //main API |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $form = new FormValidator('session_export', 'post', api_get_self()); |
@@ -5,8 +5,8 @@ |
||
5 | 5 | */ |
6 | 6 | require_once '../inc/global.inc.php'; |
7 | 7 | if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') { |
8 | - header('Location:inbox.php?f=social'); |
|
8 | + header('Location:inbox.php?f=social'); |
|
9 | 9 | } elseif ( api_get_setting('allow_message_tool')=='true') { |
10 | - header('Location:inbox.php'); |
|
10 | + header('Location:inbox.php'); |
|
11 | 11 | } |
12 | 12 | exit; |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | $message_uid = ''; |
51 | 51 | $message_type = array('inbox','outbox'); |
52 | 52 | if (in_array($_GET['type'],$message_type)) { |
53 | - if ($_GET['type'] == 'inbox') { |
|
54 | - $message_uid = $row_users['user_receiver_id']; |
|
55 | - } else { |
|
56 | - $message_uid = $row_users['user_sender_id']; |
|
57 | - } |
|
53 | + if ($_GET['type'] == 'inbox') { |
|
54 | + $message_uid = $row_users['user_receiver_id']; |
|
55 | + } else { |
|
56 | + $message_uid = $row_users['user_sender_id']; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // allow to the correct user for download this file |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | $userGroup = new UserGroup(); |
63 | 63 | |
64 | 64 | if (!empty($row_users['group_id'])) { |
65 | - $users_group = $userGroup->get_all_users_by_group($row_users['group_id']); |
|
66 | - if (!in_array($current_uid,array_keys($users_group))) { |
|
67 | - $not_allowed_to_edit = true; |
|
68 | - } |
|
65 | + $users_group = $userGroup->get_all_users_by_group($row_users['group_id']); |
|
66 | + if (!in_array($current_uid,array_keys($users_group))) { |
|
67 | + $not_allowed_to_edit = true; |
|
68 | + } |
|
69 | 69 | } else { |
70 | - if ($current_uid != $message_uid) { |
|
71 | - $not_allowed_to_edit = true; |
|
72 | - } |
|
70 | + if ($current_uid != $message_uid) { |
|
71 | + $not_allowed_to_edit = true; |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($not_allowed_to_edit) { |
76 | - api_not_allowed(); |
|
77 | - exit; |
|
76 | + api_not_allowed(); |
|
77 | + exit; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // set the path directory file |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | true |
86 | 86 | ); |
87 | 87 | } else { |
88 | - $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system'); |
|
88 | + $path_user_info['dir'] = UserManager::getUserPathById($message_uid, 'system'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $full_file_name = $path_user_info['dir'].'message_attachments/'.$file_url; |
92 | 92 | |
93 | 93 | if (Security::check_abs_path($full_file_name, $path_user_info['dir'].'message_attachments/')) { |
94 | 94 | // launch event |
95 | - Event::event_download($file_url); |
|
95 | + Event::event_download($file_url); |
|
96 | 96 | DocumentManager::file_send_for_download($full_file_name,TRUE, $title); |
97 | 97 | } |
98 | 98 | exit; |
@@ -9,20 +9,20 @@ discard block |
||
9 | 9 | api_block_anonymous_users(); |
10 | 10 | |
11 | 11 | if (isset($_GET['messages_page_nr'])) { |
12 | - if (api_get_setting('allow_social_tool')=='true' && |
|
12 | + if (api_get_setting('allow_social_tool')=='true' && |
|
13 | 13 | api_get_setting('allow_message_tool')=='true' |
14 | 14 | ) { |
15 | - $social_link = ''; |
|
16 | - if ($_REQUEST['f']=='social') { |
|
17 | - $social_link = '&f=social'; |
|
18 | - } |
|
19 | - header('Location:outbox.php?pager='.Security::remove_XSS($_GET['messages_page_nr']).$social_link.''); |
|
20 | - exit; |
|
21 | - } |
|
15 | + $social_link = ''; |
|
16 | + if ($_REQUEST['f']=='social') { |
|
17 | + $social_link = '&f=social'; |
|
18 | + } |
|
19 | + header('Location:outbox.php?pager='.Security::remove_XSS($_GET['messages_page_nr']).$social_link.''); |
|
20 | + exit; |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | if (api_get_setting('allow_message_tool')!='true'){ |
25 | - api_not_allowed(); |
|
25 | + api_not_allowed(); |
|
26 | 26 | } |
27 | 27 | //jquery thickbox already called from main/inc/header.inc.php |
28 | 28 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | MAIN CODE |
55 | 55 | */ |
56 | 56 | if (isset($_GET['f']) && $_GET['f']=='social') { |
57 | - $this_section = SECTION_SOCIAL; |
|
58 | - $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); |
|
59 | - $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); |
|
57 | + $this_section = SECTION_SOCIAL; |
|
58 | + $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); |
|
59 | + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); |
|
60 | 60 | } else { |
61 | - $this_section = SECTION_MYPROFILE; |
|
62 | - $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); |
|
63 | - $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); |
|
61 | + $this_section = SECTION_MYPROFILE; |
|
62 | + $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile')); |
|
63 | + $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $actions = ''; |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0])=='delete') { |
85 | 85 | for ($i = 1; $i <= $count_delete_outbox; $i++) { |
86 | - MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]); |
|
87 | - } |
|
86 | + MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]); |
|
87 | + } |
|
88 | 88 | $message_box=get_lang('SelectedMessagesDeleted'). |
89 | 89 | '  |
90 | 90 | <br><a href="../social/index.php?#remote-tab-3">'. |
@@ -636,11 +636,11 @@ |
||
636 | 636 | } |
637 | 637 | $formToDisplay = $form->returnForm(); |
638 | 638 | } else { |
639 | - if (!empty($sessionId)) { |
|
640 | - $sessionInfo = api_get_session_info($sessionId); |
|
641 | - $startDate = $sessionInfo['access_start_date']; |
|
642 | - $endDate = $sessionInfo['access_end_date']; |
|
643 | - } |
|
639 | + if (!empty($sessionId)) { |
|
640 | + $sessionInfo = api_get_session_info($sessionId); |
|
641 | + $startDate = $sessionInfo['access_start_date']; |
|
642 | + $endDate = $sessionInfo['access_end_date']; |
|
643 | + } |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | $attendance = new Attendance(); |
@@ -91,7 +91,7 @@ |
||
91 | 91 | $content .= '<div class="courseadminview-activity-3col"><span class="viewcaption">'.get_lang('SessionData').'</span> |
92 | 92 | <table width="100%">'; |
93 | 93 | $content .= CourseHome::show_session_data($session_id); |
94 | - $content .= '</table></div>'; |
|
94 | + $content .= '</table></div>'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $content .= '<div class="Authoringview">'; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $mycourseid = api_get_course_id(); |
38 | 38 | if (!empty($mycourseid) && $mycourseid != -1) { |
39 | - $open_chat_window = api_get_course_setting('allow_open_chat_window'); |
|
39 | + $open_chat_window = api_get_course_setting('allow_open_chat_window'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $courseCode = Security::remove_XSS($_GET['cidReq']); |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | |
55 | 55 | // If it is a group chat then the breadcrumbs. |
56 | 56 | if (!empty($groupId)) { |
57 | - $group_properties = GroupManager :: get_group_properties($groupId); |
|
57 | + $group_properties = GroupManager :: get_group_properties($groupId); |
|
58 | 58 | $interbreadcrumb[] = array( |
59 | 59 | 'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), |
60 | 60 | 'name' => get_lang('Groups') |
61 | 61 | ); |
62 | - $interbreadcrumb[] = array( |
|
62 | + $interbreadcrumb[] = array( |
|
63 | 63 | 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
64 | 64 | 'name' => get_lang('GroupSpace').' '.$group_properties['name'] |
65 | 65 | ); |
66 | - $noPHP_SELF = true; |
|
67 | - $shortBanner = false; |
|
68 | - $add_group_to_title = ' ('.$group_properties['name'].')'; |
|
69 | - $groupfilter = 'group_id="'.$groupId.'"'; |
|
66 | + $noPHP_SELF = true; |
|
67 | + $shortBanner = false; |
|
68 | + $add_group_to_title = ' ('.$group_properties['name'].')'; |
|
69 | + $groupfilter = 'group_id="'.$groupId.'"'; |
|
70 | 70 | } else { |
71 | - $groupfilter = 'group_id=0'; |
|
71 | + $groupfilter = 'group_id=0'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if (empty($open_chat_window)) { |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | $filename_chat = 'messages-'.$date_now.'.log.html'; |
79 | 79 | } |
80 | 80 | |
81 | - if (!file_exists($chat_path.$filename_chat)) { |
|
82 | - @fclose(fopen($chat_path.$filename_chat, 'w')); |
|
83 | - if (!api_is_anonymous()) { |
|
84 | - $doc_id = add_document($_course, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat); |
|
81 | + if (!file_exists($chat_path.$filename_chat)) { |
|
82 | + @fclose(fopen($chat_path.$filename_chat, 'w')); |
|
83 | + if (!api_is_anonymous()) { |
|
84 | + $doc_id = add_document($_course, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat); |
|
85 | 85 | api_item_property_update( |
86 | 86 | $_course, |
87 | 87 | TOOL_DOCUMENT, |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | $session_id |
108 | 108 | ); |
109 | 109 | item_property_update_on_folder($_course, $basepath_chat, $userId); |
110 | - } |
|
111 | - } |
|
110 | + } |
|
111 | + } |
|
112 | 112 | |
113 | - $basename_chat = ''; |
|
114 | - if (!empty($group_id)) { |
|
115 | - $basename_chat = 'messages-'.$date_now.'_gid-'.$group_id; |
|
116 | - } else if (!empty($session_id)) { |
|
117 | - $basename_chat = 'messages-'.$date_now.'_sid-'.$session_id; |
|
118 | - } else { |
|
119 | - $basename_chat = 'messages-'.$date_now; |
|
120 | - } |
|
113 | + $basename_chat = ''; |
|
114 | + if (!empty($group_id)) { |
|
115 | + $basename_chat = 'messages-'.$date_now.'_gid-'.$group_id; |
|
116 | + } else if (!empty($session_id)) { |
|
117 | + $basename_chat = 'messages-'.$date_now.'_sid-'.$session_id; |
|
118 | + } else { |
|
119 | + $basename_chat = 'messages-'.$date_now; |
|
120 | + } |
|
121 | 121 | |
122 | - if ($reset && $isMaster) { |
|
122 | + if ($reset && $isMaster) { |
|
123 | 123 | |
124 | - $i = 1; |
|
125 | - while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) { |
|
126 | - $i++; |
|
127 | - } |
|
124 | + $i = 1; |
|
125 | + while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) { |
|
126 | + $i++; |
|
127 | + } |
|
128 | 128 | |
129 | - @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html'); |
|
130 | - @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w')); |
|
131 | - $doc_id = add_document($_course, $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html', 'file', filesize($chat_path.$basename_chat.'-'.$i.'.log.html'), $basename_chat.'-'.$i.'.log.html'); |
|
129 | + @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html'); |
|
130 | + @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w')); |
|
131 | + $doc_id = add_document($_course, $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html', 'file', filesize($chat_path.$basename_chat.'-'.$i.'.log.html'), $basename_chat.'-'.$i.'.log.html'); |
|
132 | 132 | |
133 | 133 | api_item_property_update( |
134 | 134 | $_course, |
@@ -161,57 +161,57 @@ discard block |
||
161 | 161 | $basepath_chat.'/'.$basename_chat.'.log.html' |
162 | 162 | ); |
163 | 163 | |
164 | - update_existing_document($_course, $doc_id, 0); |
|
165 | - } |
|
166 | - |
|
167 | - $remove = 0; |
|
168 | - $content = array(); |
|
169 | - if (file_exists($chat_path.$basename_chat.'.log.html')) { |
|
170 | - $content = file($chat_path.$basename_chat.'.log.html'); |
|
171 | - $nbr_lines = sizeof($content); |
|
172 | - $remove = $nbr_lines - 100; |
|
173 | - } |
|
174 | - |
|
175 | - if ($remove < 0) { |
|
176 | - $remove = 0; |
|
177 | - } |
|
178 | - |
|
179 | - array_splice($content, 0, $remove); |
|
180 | - require 'header_frame.inc.php'; |
|
181 | - |
|
182 | - if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') { |
|
183 | - //the caller |
|
184 | - $content[0] = get_lang('CallSent').'<br />'.$content[0]; |
|
185 | - } |
|
186 | - if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') { |
|
187 | - //the joiner (we have to delete the chat request to him when he joins the chat) |
|
188 | - $track_user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
189 | - $sql = "UPDATE $track_user_table SET |
|
164 | + update_existing_document($_course, $doc_id, 0); |
|
165 | + } |
|
166 | + |
|
167 | + $remove = 0; |
|
168 | + $content = array(); |
|
169 | + if (file_exists($chat_path.$basename_chat.'.log.html')) { |
|
170 | + $content = file($chat_path.$basename_chat.'.log.html'); |
|
171 | + $nbr_lines = sizeof($content); |
|
172 | + $remove = $nbr_lines - 100; |
|
173 | + } |
|
174 | + |
|
175 | + if ($remove < 0) { |
|
176 | + $remove = 0; |
|
177 | + } |
|
178 | + |
|
179 | + array_splice($content, 0, $remove); |
|
180 | + require 'header_frame.inc.php'; |
|
181 | + |
|
182 | + if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') { |
|
183 | + //the caller |
|
184 | + $content[0] = get_lang('CallSent').'<br />'.$content[0]; |
|
185 | + } |
|
186 | + if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') { |
|
187 | + //the joiner (we have to delete the chat request to him when he joins the chat) |
|
188 | + $track_user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
189 | + $sql = "UPDATE $track_user_table SET |
|
190 | 190 | chatcall_user_id = '', |
191 | 191 | chatcall_date = '', |
192 | 192 | chatcall_text='' |
193 | 193 | WHERE (user_id = ".$userId.")"; |
194 | - $result = Database::query($sql); |
|
195 | - } |
|
194 | + $result = Database::query($sql); |
|
195 | + } |
|
196 | 196 | |
197 | - echo '<div id="content-chat"'; |
|
198 | - foreach ($content as & $this_line) { |
|
197 | + echo '<div id="content-chat"'; |
|
198 | + foreach ($content as & $this_line) { |
|
199 | 199 | echo $this_line; |
200 | - } |
|
201 | - echo '</div>'; |
|
202 | - echo '<a name="bottom" style="text-decoration:none;"> </a>'; |
|
203 | - if ($isMaster || $is_courseCoach) { |
|
204 | - $rand = mt_rand(1, 1000); |
|
205 | - echo '<div id="clear-chat">'; |
|
206 | - echo '<a class="btn btn-danger btn-small " href="'.api_get_self().'?rand='.$rand.'&reset=1&'.api_get_cidreq().'#bottom" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmReset'), ENT_QUOTES)).'\')) return false;">'. |
|
200 | + } |
|
201 | + echo '</div>'; |
|
202 | + echo '<a name="bottom" style="text-decoration:none;"> </a>'; |
|
203 | + if ($isMaster || $is_courseCoach) { |
|
204 | + $rand = mt_rand(1, 1000); |
|
205 | + echo '<div id="clear-chat">'; |
|
206 | + echo '<a class="btn btn-danger btn-small " href="'.api_get_self().'?rand='.$rand.'&reset=1&'.api_get_cidreq().'#bottom" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmReset'), ENT_QUOTES)).'\')) return false;">'. |
|
207 | 207 | get_lang('ClearList'). |
208 | 208 | '</a>'; |
209 | - echo '</div>'; |
|
210 | - } |
|
209 | + echo '</div>'; |
|
210 | + } |
|
211 | 211 | } else { |
212 | - echo '</div>'; |
|
213 | - require 'header_frame.inc.php'; |
|
214 | - $message = get_lang('CloseOtherSession'); |
|
215 | - Display :: display_error_message($message); |
|
212 | + echo '</div>'; |
|
213 | + require 'header_frame.inc.php'; |
|
214 | + $message = get_lang('CloseOtherSession'); |
|
215 | + Display :: display_error_message($message); |
|
216 | 216 | } |
217 | 217 | require 'footer_frame.inc.php'; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | $extra_condition = ''; |
37 | 37 | if (!empty($group_id)) { |
38 | - $extra_condition = $group_condition; |
|
38 | + $extra_condition = $group_condition; |
|
39 | 39 | } else { |
40 | - $extra_condition = $session_condition; |
|
40 | + $extra_condition = $session_condition; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $extra_condition.= " AND c_id = $course_id"; |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | $chat_path = ''; |
47 | 47 | $document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
48 | 48 | if (!empty($group_id)) { |
49 | - $group_info = GroupManager :: get_group_properties($group_id); |
|
50 | - $chat_path = $document_path.$group_info['directory'].'/chat_files/'; |
|
49 | + $group_info = GroupManager :: get_group_properties($group_id); |
|
50 | + $chat_path = $document_path.$group_info['directory'].'/chat_files/'; |
|
51 | 51 | } else { |
52 | - $chat_path = $document_path.'/chat_files/'; |
|
52 | + $chat_path = $document_path.'/chat_files/'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // get chat file |
56 | 56 | $basename_chat = ''; |
57 | 57 | if (!empty($group_id)) { |
58 | - $basename_chat = 'messages-'.$date_now.'_gid-'.$group_id; |
|
58 | + $basename_chat = 'messages-'.$date_now.'_gid-'.$group_id; |
|
59 | 59 | } elseif (!empty($session_id)) { |
60 | - $basename_chat = 'messages-'.$date_now.'_sid-'.$session_id; |
|
60 | + $basename_chat = 'messages-'.$date_now.'_sid-'.$session_id; |
|
61 | 61 | } else { |
62 | - $basename_chat = 'messages-'.$date_now; |
|
62 | + $basename_chat = 'messages-'.$date_now; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $chat_size_old = isset($_POST['chat_size_old']) ? intval($_POST['chat_size_old']) : null; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $current_time = api_get_utc_datetime(); |
79 | 79 | |
80 | 80 | if (Database::num_rows($result) == 0) { |
81 | - $query = "INSERT INTO $tbl_chat_connected(c_id, user_id, last_connection,session_id,to_group_id) |
|
81 | + $query = "INSERT INTO $tbl_chat_connected(c_id, user_id, last_connection,session_id,to_group_id) |
|
82 | 82 | VALUES($course_id, '".$userId."','$current_time','$session_id','$group_id')"; |
83 | 83 | Database::query($query); |
84 | 84 | $id = Database::insert_id(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | Database::query($sql); |
88 | 88 | } |
89 | 89 | } else { |
90 | - $query = "UPDATE $tbl_chat_connected SET |
|
90 | + $query = "UPDATE $tbl_chat_connected SET |
|
91 | 91 | last_connection='".$current_time."' |
92 | 92 | WHERE c_id = $course_id AND user_id='".$userId."' AND session_id='$session_id' AND to_group_id='$group_id'"; |
93 | 93 | Database::query($query); |