@@ -80,7 +80,8 @@ discard block |
||
80 | 80 | { |
81 | 81 | $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
82 | 82 | |
83 | - if ($by_username) { // Show only for lost password |
|
83 | + if ($by_username) { |
|
84 | +// Show only for lost password |
|
84 | 85 | $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY |
85 | 86 | $email_to = $user['email']; |
86 | 87 | } else { |
@@ -284,7 +285,8 @@ discard block |
||
284 | 285 | global $is_allowedCreateCourse; |
285 | 286 | global $_user; |
286 | 287 | |
287 | - if (isset($reset) && $reset) { // session data refresh requested |
|
288 | + if (isset($reset) && $reset) { |
|
289 | +// session data refresh requested |
|
288 | 290 | unset($_SESSION['_user']['uidReset']); |
289 | 291 | $is_platformAdmin = false; |
290 | 292 | $is_allowedCreateCourse = false; |
@@ -335,14 +337,16 @@ discard block |
||
335 | 337 | header('location:'.api_get_path(WEB_PATH)); |
336 | 338 | //exit("WARNING UNDEFINED UID !! "); |
337 | 339 | } |
338 | - } else { // no uid => logout or Anonymous |
|
340 | + } else { |
|
341 | +// no uid => logout or Anonymous |
|
339 | 342 | Session::erase('_user'); |
340 | 343 | Session::erase('_uid'); |
341 | 344 | } |
342 | 345 | |
343 | 346 | Session::write('is_platformAdmin', $is_platformAdmin); |
344 | 347 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
345 | - } else { // continue with the previous values |
|
348 | + } else { |
|
349 | +// continue with the previous values |
|
346 | 350 | $_user = $_SESSION['_user']; |
347 | 351 | $is_platformAdmin = $_SESSION['is_platformAdmin']; |
348 | 352 | $is_allowedCreateCourse = $_SESSION['is_allowedCreateCourse']; |
@@ -481,7 +485,8 @@ discard block |
||
481 | 485 | } |
482 | 486 | } else { |
483 | 487 | // Continue with the previous values |
484 | - if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { //no previous values... |
|
488 | + if (empty($_SESSION['_course']) or empty($_SESSION['_cid'])) { |
|
489 | +//no previous values... |
|
485 | 490 | $_cid = -1; //set default values that will be caracteristic of being unset |
486 | 491 | $_course = -1; |
487 | 492 | } else { |
@@ -654,7 +659,8 @@ discard block |
||
654 | 659 | $is_courseAdmin = true; |
655 | 660 | } |
656 | 661 | } |
657 | - } else { // keys missing => not anymore in the course - user relation |
|
662 | + } else { |
|
663 | +// keys missing => not anymore in the course - user relation |
|
658 | 664 | // course |
659 | 665 | $is_courseMember = false; |
660 | 666 | $is_courseAdmin = false; |
@@ -746,12 +752,15 @@ discard block |
||
746 | 752 | global $_course; |
747 | 753 | global $_gid; |
748 | 754 | |
749 | - if ($reset) { // session data refresh requested |
|
750 | - if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data |
|
755 | + if ($reset) { |
|
756 | +// session data refresh requested |
|
757 | + if ($group_id && $_cid && !empty($_course['real_id'])) { |
|
758 | +// have keys to search data |
|
751 | 759 | $group_table = Database::get_course_table(TABLE_GROUP); |
752 | 760 | $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'"; |
753 | 761 | $result = Database::query($sql); |
754 | - if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
|
762 | + if (Database::num_rows($result) > 0) { |
|
763 | +// This group has recorded status related to this course |
|
755 | 764 | $gpData = Database::fetch_array($result); |
756 | 765 | $_gid = $gpData ['id']; |
757 | 766 | Session::write('_gid', $_gid); |
@@ -762,9 +771,11 @@ discard block |
||
762 | 771 | // Keys missing => not anymore in the group - course relation |
763 | 772 | Session::erase('_gid'); |
764 | 773 | } |
765 | - } elseif (isset($_SESSION['_gid'])) { // continue with the previous values |
|
774 | + } elseif (isset($_SESSION['_gid'])) { |
|
775 | +// continue with the previous values |
|
766 | 776 | $_gid = $_SESSION ['_gid']; |
767 | - } else { //if no previous value, assign caracteristic undefined value |
|
777 | + } else { |
|
778 | +//if no previous value, assign caracteristic undefined value |
|
768 | 779 | $_gid = -1; |
769 | 780 | } |
770 | 781 |
@@ -97,8 +97,9 @@ discard block |
||
97 | 97 | // Read the magic bytes and verify |
98 | 98 | $retval = substr($png, 0, 8); |
99 | 99 | $ipos = 8; |
100 | - if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") |
|
101 | - throw new Exception('Is not a valid PNG image'); |
|
100 | + if ($retval != "\x89PNG\x0d\x0a\x1a\x0a") { |
|
101 | + throw new Exception('Is not a valid PNG image'); |
|
102 | + } |
|
102 | 103 | // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type |
103 | 104 | $chunkHeader = substr($png, $ipos, 8); |
104 | 105 | $ipos = $ipos + 8; |
@@ -110,13 +111,17 @@ discard block |
||
110 | 111 | $data = substr($png, $ipos, $chunk['size']); |
111 | 112 | $sections = explode("\0", $data); |
112 | 113 | print_r($sections); |
113 | - if ($sections[0] == $key) $skip = true; |
|
114 | + if ($sections[0] == $key) { |
|
115 | + $skip = true; |
|
116 | + } |
|
114 | 117 | } |
115 | 118 | // Extract the data and the CRC |
116 | 119 | $data = substr($png, $ipos, $chunk['size'] + 4); |
117 | 120 | $ipos = $ipos + $chunk['size'] + 4; |
118 | 121 | // Add in the header, data, and CRC |
119 | - if (!$skip) $retval = $retval.$chunkHeader.$data; |
|
122 | + if (!$skip) { |
|
123 | + $retval = $retval.$chunkHeader.$data; |
|
124 | + } |
|
120 | 125 | // Read next chunk header |
121 | 126 | $chunkHeader = substr($png, $ipos, 8); |
122 | 127 | $ipos = $ipos + 8; |
@@ -57,7 +57,7 @@ |
||
57 | 57 | if ($form->validate()) { |
58 | 58 | $values = $form->exportValues(); |
59 | 59 | //Avoid self-subscribe as request |
60 | - $usersId = array_filter($values['users'], function ($userId) use ($hrm) { |
|
60 | + $usersId = array_filter($values['users'], function($userId) use ($hrm) { |
|
61 | 61 | return (int) $userId != $hrm->getId(); |
62 | 62 | }); |
63 | 63 |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $tot += $row['marks']; |
212 | 212 | } |
213 | 213 | |
214 | - $sql = "UPDATE $TBL_TRACK_EXERCISES |
|
214 | + $sql = "update $TBL_TRACK_EXERCISES |
|
215 | 215 | SET exe_result = '".floatval($tot)."' |
216 | 216 | WHERE exe_id = ".$id; |
217 | 217 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | // Updating LP score here |
242 | 242 | if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) { |
243 | - $sql = "UPDATE $TBL_LP_ITEM_VIEW |
|
243 | + $sql = "update $TBL_LP_ITEM_VIEW |
|
244 | 244 | SET score = '".floatval($tot)."' |
245 | 245 | WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id; |
246 | 246 | Database::query($sql); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | ) { |
359 | 359 | // Close the user attempt otherwise left pending |
360 | 360 | $exe_id = intval($_GET['id']); |
361 | - $sql = "UPDATE $TBL_TRACK_EXERCISES SET status = '' |
|
361 | + $sql = "update $TBL_TRACK_EXERCISES SET status = '' |
|
362 | 362 | WHERE exe_id = $exe_id AND status = 'incomplete'"; |
363 | 363 | Database::query($sql); |
364 | 364 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $csvData = TrackingCourseLog::get_item_resources_data(0, 0, '', ''); |
38 | 38 | array_walk( |
39 | 39 | $csvData, |
40 | - function (&$item) { |
|
40 | + function(&$item) { |
|
41 | 41 | $item[0] = strip_tags($item[0]); |
42 | 42 | $item[2] = strip_tags(preg_replace('/\<br(\s*)?\/?\>/i', PHP_EOL, $item[2])); |
43 | 43 | $item[3] = strip_tags($item[3]); |
@@ -228,113 +228,113 @@ |
||
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 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
276 | - * @return array |
|
276 | + * @return string[] |
|
277 | 277 | */ |
278 | 278 | public static function notificationTags() |
279 | 279 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $courseInfo |
298 | 298 | * @param array $certificateInfo |
299 | 299 | * |
300 | - * @return bool |
|
300 | + * @return false|null |
|
301 | 301 | */ |
302 | 302 | public static function sendNotification( |
303 | 303 | $subject, |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * Generates a QR code for the certificate. The QR code embeds the text given |
396 | 396 | * @param string $text Text to be added in the QR code |
397 | 397 | * @param string $path file path of the image |
398 | - * @return bool |
|
398 | + * @return null|false |
|
399 | 399 | **/ |
400 | 400 | public function generateQRImage($text, $path) |
401 | 401 | { |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | - * update user info about certificate |
|
355 | - * @param int $cat_id category id |
|
356 | - * @param int $user_id user id |
|
357 | - * @param string $path_certificate the path name of the certificate |
|
358 | - * @return void |
|
359 | - */ |
|
354 | + * update user info about certificate |
|
355 | + * @param int $cat_id category id |
|
356 | + * @param int $user_id user id |
|
357 | + * @param string $path_certificate the path name of the certificate |
|
358 | + * @return void |
|
359 | + */ |
|
360 | 360 | public function updateUserCertificateInfo( |
361 | 361 | $cat_id, |
362 | 362 | $user_id, |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
521 | - * Shows the student's certificate (HTML file) |
|
522 | - */ |
|
521 | + * Shows the student's certificate (HTML file) |
|
522 | + */ |
|
523 | 523 | public function show() |
524 | 524 | { |
525 | 525 | header('Content-Type: text/html; charset='.api_get_system_encoding()); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | * Save a participant in a meeting room |
402 | 402 | * @param int $meetingId |
403 | 403 | * @param int $participantId |
404 | - * @return false|int The last inserted ID. Otherwise return false |
|
404 | + * @return false|string The last inserted ID. Otherwise return false |
|
405 | 405 | */ |
406 | 406 | public function saveParticipant($meetingId, $participantId) |
407 | 407 | { |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | /** |
479 | 479 | * Returns a meeting "join" URL |
480 | 480 | * @param string The name of the meeting (usually the course code) |
481 | - * @return mixed The URL to join the meeting, or false on error |
|
481 | + * @return false|string The URL to join the meeting, or false on error |
|
482 | 482 | * @todo implement moderator pass |
483 | 483 | * @assert ('') === false |
484 | 484 | * @assert ('abcdefghijklmnopqrstuvwxyzabcdefghijklmno') === false |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | * @param string The internal ID of the meeting (id field for this meeting) |
873 | 873 | * @param string $courseCode |
874 | 874 | * |
875 | - * @return void |
|
875 | + * @return false|null |
|
876 | 876 | * @assert (0) === false |
877 | 877 | */ |
878 | 878 | public function endMeeting($id, $courseCode = null) |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | * @param array $recordInfo |
1359 | 1359 | * @param bool $isGlobal |
1360 | 1360 | * @param bool $isAdminReport |
1361 | - * @return array |
|
1361 | + * @return string[] |
|
1362 | 1362 | */ |
1363 | 1363 | private function getActionLinks($meetingInfo, $recordInfo, $isGlobal = false, $isAdminReport = false) |
1364 | 1364 | { |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | |
1489 | 1489 | /** |
1490 | 1490 | * @param array $userInfo |
1491 | - * @return bool |
|
1491 | + * @return boolean|null |
|
1492 | 1492 | */ |
1493 | 1493 | public static function showGlobalConferenceLink($userInfo) |
1494 | 1494 | { |
@@ -63,6 +63,9 @@ |
||
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param integer $latestMessages |
|
68 | + */ |
|
66 | 69 | public function getLatestChat($currentUserId, $userId, $latestMessages) |
67 | 70 | { |
68 | 71 | $items = self::getPreviousMessages( |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Set user chat status |
|
52 | - * @param int 0 if disconnected, 1 if connected |
|
53 | - * @param integer $status |
|
51 | + * Set user chat status |
|
52 | + * @param int 0 if disconnected, 1 if connected |
|
53 | + * @param integer $status |
|
54 | 54 | * |
55 | - * @return void |
|
56 | - */ |
|
55 | + * @return void |
|
56 | + */ |
|
57 | 57 | public function setUserStatus($status) |
58 | 58 | { |
59 | 59 | UserManager::update_extra_field_value( |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * Returns an array of messages inside a chat session with a specific user |
|
328 | - * @param int The ID of the user with whom the current user is chatting |
|
329 | - * @return array Messages list |
|
330 | - */ |
|
327 | + * Returns an array of messages inside a chat session with a specific user |
|
328 | + * @param int The ID of the user with whom the current user is chatting |
|
329 | + * @return array Messages list |
|
330 | + */ |
|
331 | 331 | public function box_session($user_id) |
332 | 332 | { |
333 | 333 | $items = array(); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | - return false; |
|
479 | + return false; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |