@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $course_id = intval($course_id); |
74 | 74 | } |
75 | 75 | |
76 | - $session_id = isset($session_id)?intval($session_id):api_get_session_id(); |
|
76 | + $session_id = isset($session_id) ? intval($session_id) : api_get_session_id(); |
|
77 | 77 | $condition_session = api_get_session_condition($session_id); |
78 | 78 | |
79 | 79 | // Get attendance data |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $from = intval($from); |
109 | 109 | $number_of_items = intval($number_of_items); |
110 | 110 | |
111 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
111 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
112 | 112 | $direction = 'ASC'; |
113 | 113 | } |
114 | 114 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | LIMIT $from,$number_of_items "; |
136 | 136 | |
137 | 137 | $res = Database::query($sql); |
138 | - $attendances = array (); |
|
138 | + $attendances = array(); |
|
139 | 139 | $user_info = api_get_user_info(); |
140 | 140 | $allowDelete = api_get_setting('allow_delete_attendance'); |
141 | 141 | |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | $attendance[2] = '<span class="muted">'.$attendance[2].'</span>'; |
191 | 191 | } |
192 | 192 | if ($allowDelete === 'true') { |
193 | - $actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0]. '">' . |
|
194 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
193 | + $actions .= '<a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'. |
|
194 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
195 | 195 | } |
196 | 196 | } else { |
197 | 197 | $is_locked_attendance = self::is_locked_attendance($attendance[0]); |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $attendance[2] = '<span class="muted">'.$attendance[2].'</span>'; |
212 | 212 | } |
213 | 213 | if ($allowDelete === 'true') { |
214 | - $actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0].'">' . |
|
215 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
214 | + $actions .= ' <a href="index.php?'.api_get_cidreq().'&action=attendance_delete&attendance_id='.$attendance[0].'">'. |
|
215 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $is_done_all_calendar = self::is_all_attendance_calendar_done($attendance[0]); |
222 | 222 | |
223 | 223 | if ($is_done_all_calendar) { |
224 | - $locked = $attendance[4]; |
|
224 | + $locked = $attendance[4]; |
|
225 | 225 | if ($locked == 0) { |
226 | 226 | if (api_is_platform_admin()) { |
227 | 227 | $message_alert = get_lang('AreYouSureToLockTheAttendance'); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | $actions .= '</center>'; |
243 | 243 | |
244 | - $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3],$actions); |
|
244 | + $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3], $actions); |
|
245 | 245 | } else { |
246 | 246 | $attendance[0] = ' '; |
247 | 247 | $attendances[] = array($attendance[0], $attendance[1], $attendance[2], $attendance[3]); |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | public function attendance_add($link_to_gradebook = false) |
283 | 283 | { |
284 | 284 | $_course = api_get_course_info(); |
285 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
285 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
286 | 286 | $table_link = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
287 | 287 | $session_id = api_get_session_id(); |
288 | 288 | $user_id = api_get_user_id(); |
289 | 289 | $course_code = $_course['code']; |
290 | 290 | $course_id = $_course['real_id']; |
291 | - $title_gradebook= $this->attendance_qualify_title; |
|
291 | + $title_gradebook = $this->attendance_qualify_title; |
|
292 | 292 | $value_calification = 0; |
293 | 293 | $weight_calification = floatval($this->attendance_weight); |
294 | 294 | |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | public function attendance_restore($attendance_id) |
435 | 435 | { |
436 | 436 | $_course = api_get_course_info(); |
437 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
437 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
438 | 438 | $user_id = api_get_user_id(); |
439 | 439 | $course_id = $_course['real_id']; |
440 | 440 | if (is_array($attendance_id)) { |
441 | 441 | foreach ($attendance_id as $id) { |
442 | - $id = intval($id); |
|
442 | + $id = intval($id); |
|
443 | 443 | $sql = "UPDATE $tbl_attendance SET active = 1 |
444 | 444 | WHERE c_id = $course_id AND id = '$id'"; |
445 | 445 | $result = Database::query($sql); |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | ); |
456 | 456 | } |
457 | 457 | } |
458 | - } else { |
|
459 | - $attendance_id = intval($attendance_id); |
|
458 | + } else { |
|
459 | + $attendance_id = intval($attendance_id); |
|
460 | 460 | $sql = "UPDATE $tbl_attendance SET active = 1 |
461 | 461 | WHERE c_id = $course_id AND id = '$attendance_id'"; |
462 | 462 | $result = Database::query($sql); |
@@ -484,13 +484,13 @@ discard block |
||
484 | 484 | public function attendance_delete($attendance_id) |
485 | 485 | { |
486 | 486 | $_course = api_get_course_info(); |
487 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
487 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
488 | 488 | $user_id = api_get_user_id(); |
489 | 489 | $course_id = $_course['real_id']; |
490 | 490 | |
491 | 491 | if (is_array($attendance_id)) { |
492 | 492 | foreach ($attendance_id as $id) { |
493 | - $id = intval($id); |
|
493 | + $id = intval($id); |
|
494 | 494 | $sql = "UPDATE $tbl_attendance SET active = 2 |
495 | 495 | WHERE c_id = $course_id AND id = '$id'"; |
496 | 496 | $result = Database::query($sql); |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | ); |
507 | 507 | } |
508 | 508 | } |
509 | - } else { |
|
510 | - $attendance_id= intval($attendance_id); |
|
509 | + } else { |
|
510 | + $attendance_id = intval($attendance_id); |
|
511 | 511 | $sql = "UPDATE $tbl_attendance SET active = 2 |
512 | 512 | WHERE c_id = $course_id AND id = '$attendance_id'"; |
513 | 513 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | public function changeVisibility($attendanceId, $status = 1) |
539 | 539 | { |
540 | 540 | $_course = api_get_course_info(); |
541 | - $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
541 | + $tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); |
|
542 | 542 | $user_id = api_get_user_id(); |
543 | 543 | $course_id = $_course['real_id']; |
544 | 544 | $status = intval($status); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | if (is_array($attendanceId)) { |
552 | 552 | foreach ($attendanceId as $id) { |
553 | - $id = intval($id); |
|
553 | + $id = intval($id); |
|
554 | 554 | $sql = "UPDATE $tbl_attendance SET active = $status |
555 | 555 | WHERE c_id = $course_id AND id = '$id'"; |
556 | 556 | $result = Database::query($sql); |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | api_item_property_update($_course, TOOL_ATTENDANCE, $id, $action, $user_id); |
561 | 561 | } |
562 | 562 | } |
563 | - } else { |
|
564 | - $attendanceId = intval($attendanceId); |
|
563 | + } else { |
|
564 | + $attendanceId = intval($attendanceId); |
|
565 | 565 | $sql = "UPDATE $tbl_attendance SET active = $status |
566 | 566 | WHERE c_id = $course_id AND id = '$attendanceId'"; |
567 | 567 | $result = Database::query($sql); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE); |
592 | 592 | $course_id = api_get_course_int_id(); |
593 | 593 | $attendance_id = intval($attendance_id); |
594 | - $locked = ($lock)?1:0; |
|
594 | + $locked = ($lock) ? 1 : 0; |
|
595 | 595 | $upd = "UPDATE $tbl_attendance SET locked = $locked |
596 | 596 | WHERE c_id = $course_id AND id = $attendance_id"; |
597 | 597 | $result = Database::query($upd); |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | */ |
721 | 721 | public function attendance_sheet_add($calendar_id, $users_present, $attendance_id) |
722 | 722 | { |
723 | - $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
724 | - $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
723 | + $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
724 | + $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
725 | 725 | |
726 | 726 | $calendar_id = intval($calendar_id); |
727 | 727 | $attendance_id = intval($attendance_id); |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $course_id = api_get_course_int_id(); |
730 | 730 | |
731 | 731 | $user_ids = array_keys($users); |
732 | - $users_absent = array_diff($user_ids,$users_present); |
|
732 | + $users_absent = array_diff($user_ids, $users_present); |
|
733 | 733 | $affected_rows = 0; |
734 | 734 | |
735 | 735 | // get last edit type |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | $faults = $faults > 0 ? $faults : 0; |
1015 | - $faults_porcent = $calendar_count > 0 ?round(($faults*100)/$calendar_count,0):0; |
|
1015 | + $faults_porcent = $calendar_count > 0 ? round(($faults * 100) / $calendar_count, 0) : 0; |
|
1016 | 1016 | $results['faults'] = $faults; |
1017 | 1017 | $results['total'] = $calendar_count; |
1018 | 1018 | $results['faults_porcent'] = $faults_porcent; |
@@ -1046,13 +1046,13 @@ discard block |
||
1046 | 1046 | //$course_code = $course['code']; |
1047 | 1047 | //$course_info = api_get_course_info($course_code); |
1048 | 1048 | $course_id = $course['real_id']; |
1049 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1049 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1050 | 1050 | |
1051 | 1051 | $attendances_by_course = $this->get_attendances_list($course_id); |
1052 | 1052 | |
1053 | 1053 | foreach ($attendances_by_course as $attendance) { |
1054 | 1054 | // get total faults and total weight |
1055 | - $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1055 | + $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1056 | 1056 | $sql = "SELECT score |
1057 | 1057 | FROM $tbl_attendance_result |
1058 | 1058 | WHERE |
@@ -1065,16 +1065,16 @@ discard block |
||
1065 | 1065 | $row = Database::fetch_array($rs); |
1066 | 1066 | $score = $row['score']; |
1067 | 1067 | } |
1068 | - $faults = $total_done_attendance-$score; |
|
1069 | - $faults = $faults > 0 ? $faults:0; |
|
1068 | + $faults = $total_done_attendance - $score; |
|
1069 | + $faults = $faults > 0 ? $faults : 0; |
|
1070 | 1070 | $total_faults += $faults; |
1071 | 1071 | $total_weight += $total_done_attendance; |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0; |
|
1075 | + $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0; |
|
1076 | 1076 | $results['faults'] = $total_faults; |
1077 | - $results['total'] = $total_weight; |
|
1077 | + $results['total'] = $total_weight; |
|
1078 | 1078 | $results['porcent'] = $porcent; |
1079 | 1079 | |
1080 | 1080 | return $results; |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | { |
1093 | 1093 | // Database tables and variables |
1094 | 1094 | $course_info = api_get_course_info($course_code); |
1095 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1095 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1096 | 1096 | $user_id = intval($user_id); |
1097 | 1097 | $results = array(); |
1098 | 1098 | $total_faults = $total_weight = $porcent = 0; |
@@ -1100,7 +1100,7 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | foreach ($attendances_by_course as $attendance) { |
1102 | 1102 | // Get total faults and total weight |
1103 | - $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1103 | + $total_done_attendance = $attendance['attendance_qualify_max']; |
|
1104 | 1104 | $sql = "SELECT score FROM $tbl_attendance_result |
1105 | 1105 | WHERE |
1106 | 1106 | c_id = {$course_info['real_id']} AND |
@@ -1112,15 +1112,15 @@ discard block |
||
1112 | 1112 | $row = Database::fetch_array($rs); |
1113 | 1113 | $score = $row['score']; |
1114 | 1114 | } |
1115 | - $faults = $total_done_attendance-$score; |
|
1116 | - $faults = $faults > 0 ? $faults:0; |
|
1115 | + $faults = $total_done_attendance - $score; |
|
1116 | + $faults = $faults > 0 ? $faults : 0; |
|
1117 | 1117 | $total_faults += $faults; |
1118 | 1118 | $total_weight += $total_done_attendance; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $porcent = $total_weight > 0 ?round(($total_faults*100)/$total_weight,0):0; |
|
1121 | + $porcent = $total_weight > 0 ? round(($total_faults * 100) / $total_weight, 0) : 0; |
|
1122 | 1122 | $results['faults'] = $total_faults; |
1123 | - $results['total'] = $total_weight; |
|
1123 | + $results['total'] = $total_weight; |
|
1124 | 1124 | $results['porcent'] = $porcent; |
1125 | 1125 | |
1126 | 1126 | return $results; |
@@ -1134,8 +1134,8 @@ discard block |
||
1134 | 1134 | */ |
1135 | 1135 | public function get_users_attendance_sheet($attendance_id, $user_id = 0, $groupId = null) |
1136 | 1136 | { |
1137 | - $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
1138 | - $tbl_attendance_calendar= Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
1137 | + $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
|
1138 | + $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
|
1139 | 1139 | |
1140 | 1140 | $attendance_calendar = $this->get_attendance_calendar($attendance_id, 'all', null, $groupId); |
1141 | 1141 | $calendar_ids = array(); |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | WHERE |
1158 | 1158 | c_id = $course_id AND |
1159 | 1159 | user_id = '$uid' AND |
1160 | - attendance_calendar_id IN(".implode(',',$calendar_ids).") |
|
1160 | + attendance_calendar_id IN(".implode(',', $calendar_ids).") |
|
1161 | 1161 | "; |
1162 | 1162 | $res = Database::query($sql); |
1163 | 1163 | if (Database::num_rows($res) > 0) { |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | att.c_id = $course_id AND |
1180 | 1180 | cal.c_id = $course_id AND |
1181 | 1181 | att.user_id = '$user_id' AND |
1182 | - att.attendance_calendar_id IN (".implode(',',$calendar_ids).") |
|
1182 | + att.attendance_calendar_id IN (".implode(',', $calendar_ids).") |
|
1183 | 1183 | ORDER BY date_time"; |
1184 | 1184 | $res = Database::query($sql); |
1185 | 1185 | if (Database::num_rows($res) > 0) { |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | */ |
1258 | 1258 | public function get_user_score($user_id, $attendance_id, $groupId = null) |
1259 | 1259 | { |
1260 | - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1260 | + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); |
|
1261 | 1261 | $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
1262 | 1262 | $tbl_attendance_cal_rel_group = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR_REL_GROUP); |
1263 | 1263 | $tbl_attendance_cal = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
@@ -1370,7 +1370,7 @@ discard block |
||
1370 | 1370 | "; |
1371 | 1371 | } |
1372 | 1372 | |
1373 | - if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done','calendar_id'))) { |
|
1373 | + if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done', 'calendar_id'))) { |
|
1374 | 1374 | $type = 'all'; |
1375 | 1375 | } |
1376 | 1376 | |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | case 'calendar_id': |
1379 | 1379 | $calendar_id = intval($calendar_id); |
1380 | 1380 | if (!empty($calendar_id)) { |
1381 | - $sql.= " AND c.id = $calendar_id"; |
|
1381 | + $sql .= " AND c.id = $calendar_id"; |
|
1382 | 1382 | } |
1383 | 1383 | break; |
1384 | 1384 | case 'today': |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | $rs = Database::query($sql); |
1400 | 1400 | $data = array(); |
1401 | 1401 | if (Database::num_rows($rs) > 0) { |
1402 | - while ($row = Database::fetch_array($rs,'ASSOC')) { |
|
1402 | + while ($row = Database::fetch_array($rs, 'ASSOC')) { |
|
1403 | 1403 | $row['db_date_time'] = $row['date_time']; |
1404 | 1404 | $row['date_time'] = api_get_local_time($row['date_time']); |
1405 | 1405 | $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT); |
@@ -1764,14 +1764,14 @@ discard block |
||
1764 | 1764 | * @param int The number of years to add |
1765 | 1765 | * @return int The new timestamp |
1766 | 1766 | */ |
1767 | - private function add_month($timestamp, $num=1) |
|
1767 | + private function add_month($timestamp, $num = 1) |
|
1768 | 1768 | { |
1769 | 1769 | $values = api_get_utc_datetime($timestamp); |
1770 | - $values = str_replace(array(':','-',' '), '/', $values); |
|
1771 | - list($y, $m, $d, $h, $n, $s) = split('/',$values); |
|
1772 | - if($m+$num>12) { |
|
1773 | - $y += floor($num/12); |
|
1774 | - $m += $num%12; |
|
1770 | + $values = str_replace(array(':', '-', ' '), '/', $values); |
|
1771 | + list($y, $m, $d, $h, $n, $s) = split('/', $values); |
|
1772 | + if ($m + $num > 12) { |
|
1773 | + $y += floor($num / 12); |
|
1774 | + $m += $num % 12; |
|
1775 | 1775 | } else { |
1776 | 1776 | $m += $num; |
1777 | 1777 | } |
@@ -1829,7 +1829,7 @@ discard block |
||
1829 | 1829 | * @param bool true for removing all calendar inside current attendance, false for removing by calendar id |
1830 | 1830 | * @return int affected rows |
1831 | 1831 | */ |
1832 | - public function attendance_calendar_delete($calendar_id, $attendance_id , $all_delete = false) |
|
1832 | + public function attendance_calendar_delete($calendar_id, $attendance_id, $all_delete = false) |
|
1833 | 1833 | { |
1834 | 1834 | $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR); |
1835 | 1835 | $tbl_attendance_sheet = Database::get_course_table(TABLE_ATTENDANCE_SHEET); |
@@ -1986,7 +1986,7 @@ discard block |
||
1986 | 1986 | |
1987 | 1987 | $dateTimeStartOriginal = new DateTime($startDate); |
1988 | 1988 | $dateTimeStart = new DateTime($startDate); |
1989 | - $dateTimeEnd= new DateTime($endDate); |
|
1989 | + $dateTimeEnd = new DateTime($endDate); |
|
1990 | 1990 | $interval = $dateTimeStart->diff($dateTimeEnd); |
1991 | 1991 | $days = intval($interval->format('%a')); |
1992 | 1992 | |
@@ -2059,7 +2059,7 @@ discard block |
||
2059 | 2059 | 0, |
2060 | 2060 | $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')' |
2061 | 2061 | ); |
2062 | - $row ++; |
|
2062 | + $row++; |
|
2063 | 2063 | } |
2064 | 2064 | |
2065 | 2065 | $column = 1; |
@@ -2136,7 +2136,7 @@ discard block |
||
2136 | 2136 | $tableToString = $table->toHtml(); |
2137 | 2137 | |
2138 | 2138 | $params = array( |
2139 | - 'filename' => get_lang('Attendance') . '_' . api_get_utc_datetime(), |
|
2139 | + 'filename' => get_lang('Attendance').'_'.api_get_utc_datetime(), |
|
2140 | 2140 | 'pdf_title' => get_lang('Attendance'), |
2141 | 2141 | 'course_code' => api_get_course_id(), |
2142 | 2142 | 'show_real_course_teachers' => true |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param string tool name (optional) |
17 | 17 | * @param string $template_path |
18 | 18 | */ |
19 | - public function __construct($toolname = '', $template_path=null) |
|
19 | + public function __construct($toolname = '', $template_path = null) |
|
20 | 20 | { |
21 | 21 | if (!empty($toolname)) { |
22 | 22 | if (isset($template_path)) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if (is_dir($path)) { |
28 | 28 | $this->tool_path = $path; |
29 | 29 | } else { |
30 | - throw new Exception('View::__construct() $path directory does not exist ' . $path); |
|
30 | + throw new Exception('View::__construct() $path directory does not exist '.$path); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function set_data($data) |
40 | 40 | { |
41 | 41 | if (!is_array($data)) { |
42 | - throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data )); |
|
42 | + throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data)); |
|
43 | 43 | } |
44 | 44 | $this->data = $data; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string layout view |
50 | 50 | * @param string $layout |
51 | 51 | */ |
52 | - public function set_layout( $layout ) |
|
52 | + public function set_layout($layout) |
|
53 | 53 | { |
54 | 54 | $this->layout = $layout; |
55 | 55 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | // actions menu |
11 | 11 | $new_thematic_plan_data = array(); |
12 | 12 | if (!empty($thematic_plan_data)) |
13 | -foreach($thematic_plan_data as $thematic_item) { |
|
13 | +foreach ($thematic_plan_data as $thematic_item) { |
|
14 | 14 | $thematic_simple_list[] = $thematic_item['description_type']; |
15 | 15 | $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item; |
16 | 16 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -$i=1; |
|
28 | +$i = 1; |
|
29 | 29 | |
30 | 30 | echo Display::tag('h2', $thematic_data['title']); |
31 | 31 | echo $thematic_data['content']; |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | $thematic_plan = null; |
68 | 68 | } else { |
69 | 69 | $thematic_plan = null; |
70 | - $default['title['.$id.']'] = $title; |
|
71 | - $default['description['.$id.']']= ''; |
|
70 | + $default['title['.$id.']'] = $title; |
|
71 | + $default['description['.$id.']'] = ''; |
|
72 | 72 | } |
73 | 73 | $form->setDefaults($default); |
74 | 74 | } |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | ]; |
18 | 18 | |
19 | 19 | foreach ($externalCSS as $css) { |
20 | - $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css); |
|
20 | + $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css); |
|
21 | 21 | } |
22 | 22 | |
23 | -$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css'); |
|
24 | -$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css'); |
|
23 | +$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css'); |
|
24 | +$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css'); |
|
25 | 25 | |
26 | 26 | $externalJS = [ |
27 | 27 | 'highlight/highlight.pack.js', |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | - $iconList[$key] = strtoupper($icon) . '.png'; |
|
44 | + $iconList[$key] = strtoupper($icon).'.png'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $view = new Template(get_lang('Chat'), false, false, false, true, false); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | foreach ($sub_options as $sub_option) { |
218 | 218 | if (!empty($sub_option)) { |
219 | - $new_params = array( |
|
219 | + $new_params = array( |
|
220 | 220 | 'field_id' => $field_id, |
221 | 221 | 'option_value' => $sub_id, |
222 | 222 | 'display_text' => $sub_option, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $form->addElement('hidden', 'field_id', $this->field_id); |
661 | 661 | |
662 | 662 | if ($action == 'edit') { |
663 | - $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ |
|
663 | + $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([ |
|
664 | 664 | 'extra_field_option' => $id |
665 | 665 | ]); |
666 | 666 | $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Now that there is an association created, move on |
65 | 65 | // to request authentication from the IdP |
66 | 66 | $identity = (!empty($services[0]['delegate'])) ? $services[0]['delegate'] : $claimed_id; |
67 | - if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0 . '/server', $services[0]['types'])) { |
|
67 | + if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0.'/server', $services[0]['types'])) { |
|
68 | 68 | $identity = 'http://openid.net/identifier_select/2.0'; |
69 | 69 | } |
70 | 70 | $authn_request = openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $services[0]['version']); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $xrds_url = $claimed_id; |
121 | 121 | if (_openid_is_xri($claimed_id)) { |
122 | - $xrds_url = 'http://xri.net/' . $claimed_id; |
|
122 | + $xrds_url = 'http://xri.net/'.$claimed_id; |
|
123 | 123 | } |
124 | 124 | $url = @parse_url($xrds_url); |
125 | 125 | if ($url['scheme'] == 'http' || $url['scheme'] == 'https') { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | //@todo Remove Old Associations: |
183 | 183 | $openid_association = Database::get_main_table(TABLE_MAIN_OPENID_ASSOCIATION); |
184 | 184 | $sql = "DELETE FROM $openid_association |
185 | - WHERE created + expires_in < '" . api_get_utc_datetime() . "'"; |
|
185 | + WHERE created + expires_in < '".api_get_utc_datetime()."'"; |
|
186 | 186 | Database::query($sql); |
187 | 187 | |
188 | 188 | // Check to see if we have an association for this IdP already |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | switch ($uri['scheme']) { |
340 | 340 | case 'http': |
341 | 341 | $port = isset($uri['port']) ? $uri['port'] : 80; |
342 | - $host = $uri['host'] . ($port != 80 ? ':' . $port : ''); |
|
342 | + $host = $uri['host'].($port != 80 ? ':'.$port : ''); |
|
343 | 343 | $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); |
344 | 344 | break; |
345 | 345 | case 'https': |
346 | 346 | // Note: Only works for PHP 4.3 compiled with OpenSSL. |
347 | 347 | $port = isset($uri['port']) ? $uri['port'] : 443; |
348 | - $host = $uri['host'] . ($port != 443 ? ':' . $port : ''); |
|
349 | - $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20); |
|
348 | + $host = $uri['host'].($port != 443 ? ':'.$port : ''); |
|
349 | + $fp = @fsockopen('ssl://'.$uri['host'], $port, $errno, $errstr, 20); |
|
350 | 350 | break; |
351 | 351 | default: |
352 | - $result->error = 'invalid schema ' . $uri['scheme']; |
|
352 | + $result->error = 'invalid schema '.$uri['scheme']; |
|
353 | 353 | return $result; |
354 | 354 | } |
355 | 355 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // Construct the path to act on. |
366 | 366 | $path = isset($uri['path']) ? $uri['path'] : '/'; |
367 | 367 | if (isset($uri['query'])) { |
368 | - $path .= '?' . $uri['query']; |
|
368 | + $path .= '?'.$uri['query']; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | // Create HTTP request. |
@@ -375,23 +375,23 @@ discard block |
||
375 | 375 | // host that do not take into account the port number. |
376 | 376 | 'Host' => "Host: $host", |
377 | 377 | 'User-Agent' => 'User-Agent: Chamilo (+http://www.chamilo.org/)', |
378 | - 'Content-Length' => 'Content-Length: ' . strlen($data) |
|
378 | + 'Content-Length' => 'Content-Length: '.strlen($data) |
|
379 | 379 | ); |
380 | 380 | |
381 | 381 | // If the server url has a user then attempt to use basic authentication |
382 | 382 | if (isset($uri['user'])) { |
383 | - $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : '')); |
|
383 | + $defaults['Authorization'] = 'Authorization: Basic '.base64_encode($uri['user'].(!empty($uri['pass']) ? ":".$uri['pass'] : '')); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | foreach ($headers as $header => $value) { |
387 | - $defaults[$header] = $header . ': ' . $value; |
|
387 | + $defaults[$header] = $header.': '.$value; |
|
388 | 388 | } |
389 | 389 | |
390 | - $request = $method . ' ' . $path . " HTTP/1.0\r\n"; |
|
390 | + $request = $method.' '.$path." HTTP/1.0\r\n"; |
|
391 | 391 | $request .= implode("\r\n", $defaults); |
392 | 392 | $request .= "\r\n\r\n"; |
393 | 393 | if ($data) { |
394 | - $request .= $data . "\r\n"; |
|
394 | + $request .= $data."\r\n"; |
|
395 | 395 | } |
396 | 396 | $result->request = $request; |
397 | 397 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if (isset($result->headers[$header]) && $header == 'Set-Cookie') { |
418 | 418 | // RFC 2109: the Set-Cookie response header comprises the token Set- |
419 | 419 | // Cookie:, followed by a comma-separated list of one or more cookies. |
420 | - $result->headers[$header] .= ',' . trim($value); |
|
420 | + $result->headers[$header] .= ','.trim($value); |
|
421 | 421 | } else { |
422 | 422 | $result->headers[$header] = trim($value); |
423 | 423 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | protected function deleteCourseHelper($course_id_field_name, $course_id_value) { |
21 | 21 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
22 | - if($course_id instanceof WSCMError) { |
|
22 | + if ($course_id instanceof WSCMError) { |
|
23 | 23 | return $course_id; |
24 | 24 | } else { |
25 | 25 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) { |
39 | 39 | $verifKey = $this->verifyKey($secret_key); |
40 | - if($verifKey instanceof WSError) { |
|
40 | + if ($verifKey instanceof WSError) { |
|
41 | 41 | $this->handleError($verifKey); |
42 | 42 | } else { |
43 | 43 | $result = $this->deleteCourseHelper($course_id_field_name, $course_id_value); |
44 | - if($result instanceof WSError) { |
|
44 | + if ($result instanceof WSError) { |
|
45 | 45 | $this->handleError($result); |
46 | 46 | } |
47 | 47 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function DeleteCourses($secret_key, $courses) { |
59 | 59 | $verifKey = $this->verifyKey($secret_key); |
60 | - if($verifKey instanceof WSError) { |
|
60 | + if ($verifKey instanceof WSError) { |
|
61 | 61 | $this->handleError($verifKey); |
62 | 62 | } else { |
63 | 63 | $results = array(); |
64 | - foreach($courses as $course) { |
|
64 | + foreach ($courses as $course) { |
|
65 | 65 | $result_tmp = array(); |
66 | 66 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
67 | 67 | $result_tmp['course_id_value'] = $course['course_id_value']; |
68 | - if($result_op instanceof WSCMError) { |
|
68 | + if ($result_op instanceof WSCMError) { |
|
69 | 69 | // Return the error in the results |
70 | 70 | $result_tmp['result'] = $result_op->toArray(); |
71 | 71 | } else { |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
96 | 96 | // Add the original course id field name and value to the extra fields if needed |
97 | 97 | $extras_associative = array(); |
98 | - if($course_id_field_name != "chamilo_course_id") { |
|
98 | + if ($course_id_field_name != "chamilo_course_id") { |
|
99 | 99 | $extras_associative[$course_id_field_name] = $course_id_value; |
100 | 100 | } |
101 | - foreach($extras as $extra) { |
|
101 | + foreach ($extras as $extra) { |
|
102 | 102 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
103 | 103 | } |
104 | 104 | $course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value); |
105 | - if($course_admin_id instanceof WSError) { |
|
105 | + if ($course_admin_id instanceof WSError) { |
|
106 | 106 | return $course_admin_id; |
107 | 107 | } |
108 | - if($wanted_code == '') { |
|
108 | + if ($wanted_code == '') { |
|
109 | 109 | $wanted_code = CourseManager::generate_course_code($title); |
110 | 110 | } |
111 | 111 | $result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return new WSError(202, 'There was an error creating the course'); |
114 | 114 | } else { |
115 | 115 | // Update extra fields |
116 | - foreach($extras_associative as $fname => $fvalue) { |
|
116 | + foreach ($extras_associative as $fname => $fvalue) { |
|
117 | 117 | CourseManager::update_course_extra_field_value($result, $fname, $fvalue); |
118 | 118 | } |
119 | 119 | // Get course id |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
142 | 142 | // First, verify the secret key |
143 | 143 | $verifKey = $this->verifyKey($secret_key); |
144 | - if($verifKey instanceof WSError) { |
|
144 | + if ($verifKey instanceof WSError) { |
|
145 | 145 | $this->handleError($verifKey); |
146 | 146 | } else { |
147 | 147 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
148 | - if($result instanceof WSError) { |
|
148 | + if ($result instanceof WSError) { |
|
149 | 149 | $this->handleError($result); |
150 | 150 | } else { |
151 | 151 | return $result; |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | public function CreateCourses($secret_key, $courses) { |
164 | 164 | // First, verify the secret key |
165 | 165 | $verifKey = $this->verifyKey($secret_key); |
166 | - if($verifKey instanceof WSCMError) { |
|
166 | + if ($verifKey instanceof WSCMError) { |
|
167 | 167 | $this->handleError($verifKey); |
168 | 168 | } else { |
169 | 169 | $results = array(); |
170 | - foreach($courses as $course) { |
|
170 | + foreach ($courses as $course) { |
|
171 | 171 | $result_tmp = array(); |
172 | 172 | //reinitialize variables just in case |
173 | 173 | $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = null; |
174 | 174 | extract($course); |
175 | 175 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
176 | - if($result instanceof WSCMError) { |
|
176 | + if ($result instanceof WSCMError) { |
|
177 | 177 | $result_tmp['result'] = $result->toArray(); |
178 | 178 | $result_tmp['course_id_value'] = $course_id_value; |
179 | 179 | $result_tmp['course_id_generated'] = 0; |
@@ -207,47 +207,47 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
209 | 209 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
210 | - if($course_id instanceof WSCMError) { |
|
210 | + if ($course_id instanceof WSCMError) { |
|
211 | 211 | return $course_id; |
212 | 212 | } else { |
213 | 213 | $attributes = array(); |
214 | - if(!empty($title)) { |
|
214 | + if (!empty($title)) { |
|
215 | 215 | $attributes['title'] = $title; |
216 | 216 | } |
217 | - if(!empty($category_code)) { |
|
217 | + if (!empty($category_code)) { |
|
218 | 218 | $attributes['category_code'] = $category_code; |
219 | 219 | } |
220 | - if(!empty($department_name)) { |
|
220 | + if (!empty($department_name)) { |
|
221 | 221 | $attributes['department_name'] = $department_name; |
222 | 222 | } |
223 | - if(!empty($department_url)) { |
|
223 | + if (!empty($department_url)) { |
|
224 | 224 | $attributes['department_url'] = $department_url; |
225 | 225 | } |
226 | - if(!empty($language)) { |
|
226 | + if (!empty($language)) { |
|
227 | 227 | $attributes['course_language'] = $language; |
228 | 228 | } |
229 | - if($visibility != '') { |
|
230 | - $attributes['visibility'] = (int)$visibility; |
|
229 | + if ($visibility != '') { |
|
230 | + $attributes['visibility'] = (int) $visibility; |
|
231 | 231 | } |
232 | - if($subscribe != '') { |
|
233 | - $attributes['subscribe'] = (int)$subscribe; |
|
232 | + if ($subscribe != '') { |
|
233 | + $attributes['subscribe'] = (int) $subscribe; |
|
234 | 234 | } |
235 | - if($unsubscribe != '') { |
|
236 | - $attributes['unsubscribe'] = (int)$unsubscribe; |
|
235 | + if ($unsubscribe != '') { |
|
236 | + $attributes['unsubscribe'] = (int) $unsubscribe; |
|
237 | 237 | } |
238 | - if(!empty($visual_code)) { |
|
238 | + if (!empty($visual_code)) { |
|
239 | 239 | $attributes['visual_code'] = $visual_code; |
240 | 240 | } |
241 | - if(!empty($attributes)) { |
|
241 | + if (!empty($attributes)) { |
|
242 | 242 | CourseManager::update_attributes($course_id, $attributes); |
243 | 243 | } |
244 | - if(!empty($extras)) { |
|
244 | + if (!empty($extras)) { |
|
245 | 245 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
246 | 246 | $extras_associative = array(); |
247 | - foreach($extras as $extra) { |
|
247 | + foreach ($extras as $extra) { |
|
248 | 248 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
249 | 249 | } |
250 | - foreach($extras_associative as $fname => $fvalue) { |
|
250 | + foreach ($extras_associative as $fname => $fvalue) { |
|
251 | 251 | CourseManager::update_extra_field_value($course_code, $fname, $fvalue); |
252 | 252 | } |
253 | 253 | } |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
276 | 276 | $verifKey = $this->verifyKey($secret_key); |
277 | - if($verifKey instanceof WSCMError) { |
|
277 | + if ($verifKey instanceof WSCMError) { |
|
278 | 278 | $this->handleError($verifKey); |
279 | 279 | } else { |
280 | 280 | $result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras); |
281 | - if($result instanceof WSCMError) { |
|
281 | + if ($result instanceof WSCMError) { |
|
282 | 282 | $this->handleError($result); |
283 | 283 | } |
284 | 284 | } |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function ListCourses($secret_key, $course_id_field_name) { |
296 | 296 | $verifKey = $this->verifyKey($secret_key); |
297 | - if($verifKey instanceof WSError) { |
|
297 | + if ($verifKey instanceof WSError) { |
|
298 | 298 | $this->handleError($verifKey); |
299 | 299 | } else { |
300 | 300 | $courses_result = array(); |
301 | 301 | $category_names = array(); |
302 | 302 | |
303 | 303 | $courses = CourseManager::get_courses_list(); |
304 | - foreach($courses as $course) { |
|
304 | + foreach ($courses as $course) { |
|
305 | 305 | $course_tmp = array(); |
306 | 306 | $course_tmp['id'] = $course['id']; |
307 | 307 | $course_tmp['code'] = $course['code']; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $course_tmp['visibility'] = $course['visibility']; |
311 | 311 | |
312 | 312 | // Determining category name |
313 | - if($category_names[$course['category_code']]) { |
|
313 | + if ($category_names[$course['category_code']]) { |
|
314 | 314 | $course_tmp['category_name'] = $category_names[$course['category_code']]; |
315 | 315 | } else { |
316 | 316 | $category = CourseManager::get_course_category($course['category_code']); |
@@ -346,21 +346,21 @@ discard block |
||
346 | 346 | */ |
347 | 347 | protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) { |
348 | 348 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
349 | - if($course_id instanceof WSError) { |
|
349 | + if ($course_id instanceof WSError) { |
|
350 | 350 | return $course_id; |
351 | 351 | } else { |
352 | 352 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
353 | - if($user_id instanceof WSError) { |
|
353 | + if ($user_id instanceof WSError) { |
|
354 | 354 | return $user_id; |
355 | 355 | } else { |
356 | 356 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
357 | - if($state == 0) { |
|
357 | + if ($state == 0) { |
|
358 | 358 | // Unsubscribe user |
359 | 359 | CourseManager::unsubscribe_user($user_id, $course_code); |
360 | 360 | return true; |
361 | 361 | } else { |
362 | 362 | // Subscribe user |
363 | - if(CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
363 | + if (CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
364 | 364 | return true; |
365 | 365 | } else { |
366 | 366 | return new WSError(203, 'An error occured subscribing to this course'); |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) { |
384 | 384 | $verifKey = $this->verifyKey($secret_key); |
385 | - if($verifKey instanceof WSError) { |
|
385 | + if ($verifKey instanceof WSError) { |
|
386 | 386 | $this->handleError($verifKey); |
387 | 387 | } else { |
388 | 388 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status); |
389 | - if($result instanceof WSError) { |
|
389 | + if ($result instanceof WSError) { |
|
390 | 390 | $this->handleError($result); |
391 | 391 | } |
392 | 392 | } |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) { |
405 | 405 | $verifKey = $this->verifyKey($secret_key); |
406 | - if($verifKey instanceof WSError) { |
|
406 | + if ($verifKey instanceof WSError) { |
|
407 | 407 | $this->handleError($verifKey); |
408 | 408 | } else { |
409 | 409 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0); |
410 | - if($result instanceof WSError) { |
|
410 | + if ($result instanceof WSError) { |
|
411 | 411 | $this->handleError($result); |
412 | 412 | } |
413 | 413 | } |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
425 | 425 | $verifKey = $this->verifyKey($secret_key); |
426 | - if($verifKey instanceof WSError) { |
|
426 | + if ($verifKey instanceof WSError) { |
|
427 | 427 | $this->handleError($verifKey); |
428 | 428 | } else { |
429 | 429 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
430 | - if($course_id instanceof WSError) { |
|
430 | + if ($course_id instanceof WSError) { |
|
431 | 431 | return $course_id; |
432 | 432 | } else { |
433 | 433 | // Course exists, get its descriptions |
434 | 434 | $descriptions = CourseDescription::get_descriptions($course_id); |
435 | 435 | $results = array(); |
436 | - foreach($descriptions as $description) { |
|
436 | + foreach ($descriptions as $description) { |
|
437 | 437 | $results[] = array('course_desc_id' => $description->get_description_type(), |
438 | 438 | 'course_desc_title' => $description->get_title(), |
439 | 439 | 'course_desc_content' => $description->get_content()); |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) { |
458 | 458 | $verifKey = $this->verifyKey($secret_key); |
459 | - if($verifKey instanceof WSError) { |
|
459 | + if ($verifKey instanceof WSError) { |
|
460 | 460 | $this->handleError($verifKey); |
461 | 461 | } else { |
462 | 462 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
463 | - if($course_id instanceof WSError) { |
|
463 | + if ($course_id instanceof WSError) { |
|
464 | 464 | return $course_id; |
465 | 465 | } else { |
466 | 466 | // Create the new course description |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | // Check if this course description exists |
478 | 478 | $descriptions = CourseDescription::get_descriptions($course_id); |
479 | 479 | $exists = false; |
480 | - foreach($descriptions as $description) { |
|
481 | - if($description->get_description_type() == $course_desc_id) { |
|
480 | + foreach ($descriptions as $description) { |
|
481 | + if ($description->get_description_type() == $course_desc_id) { |
|
482 | 482 | $exists = true; |
483 | 483 | } |
484 | 484 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | } |
495 | 495 | public function unreadMessage($username, $password) |
496 | 496 | { |
497 | - if($this->verifyUserPass($username, $password) == "valid") |
|
497 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
498 | 498 | { |
499 | 499 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
500 | 500 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | public function get_message_data($username, $password) |
513 | 513 | { |
514 | - if($this->verifyUserPass($username, $password) == "valid") |
|
514 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
515 | 515 | { |
516 | 516 | $user_id = get_user_id_from_username($username); |
517 | 517 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | public function nada($username, $password) |
523 | 523 | { |
524 | - if($this->verifyUserPass($username, $password) == "valid") |
|
524 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
525 | 525 | return $username.$password; |
526 | 526 | return $username; |
527 | 527 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected function deleteCourseHelper($course_id_field_name, $course_id_value) { |
23 | 23 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
24 | - if($course_id instanceof WSError) { |
|
24 | + if ($course_id instanceof WSError) { |
|
25 | 25 | return $course_id; |
26 | 26 | } else { |
27 | 27 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) { |
41 | 41 | $verifKey = $this->verifyKey($secret_key); |
42 | - if($verifKey instanceof WSError) { |
|
42 | + if ($verifKey instanceof WSError) { |
|
43 | 43 | $this->handleError($verifKey); |
44 | 44 | } else { |
45 | 45 | $result = $this->deleteCourseHelper($course_id_field_name, $course_id_value); |
46 | - if($result instanceof WSError) { |
|
46 | + if ($result instanceof WSError) { |
|
47 | 47 | $this->handleError($result); |
48 | 48 | } |
49 | 49 | } |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function DeleteCourses($secret_key, $courses) { |
61 | 61 | $verifKey = $this->verifyKey($secret_key); |
62 | - if($verifKey instanceof WSError) { |
|
62 | + if ($verifKey instanceof WSError) { |
|
63 | 63 | $this->handleError($verifKey); |
64 | 64 | } else { |
65 | 65 | $results = array(); |
66 | - foreach($courses as $course) { |
|
66 | + foreach ($courses as $course) { |
|
67 | 67 | $result_tmp = array(); |
68 | 68 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
69 | 69 | $result_tmp['course_id_value'] = $course['course_id_value']; |
70 | - if($result_op instanceof WSError) { |
|
70 | + if ($result_op instanceof WSError) { |
|
71 | 71 | // Return the error in the results |
72 | 72 | $result_tmp['result'] = $result_op->toArray(); |
73 | 73 | } else { |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
98 | 98 | // Add the original course id field name and value to the extra fields if needed |
99 | 99 | $extras_associative = array(); |
100 | - if($course_id_field_name != "chamilo_course_id") { |
|
100 | + if ($course_id_field_name != "chamilo_course_id") { |
|
101 | 101 | $extras_associative[$course_id_field_name] = $course_id_value; |
102 | 102 | } |
103 | - foreach($extras as $extra) { |
|
103 | + foreach ($extras as $extra) { |
|
104 | 104 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
105 | 105 | } |
106 | 106 | $course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value); |
107 | - if($course_admin_id instanceof WSError) { |
|
107 | + if ($course_admin_id instanceof WSError) { |
|
108 | 108 | return $course_admin_id; |
109 | 109 | } |
110 | - if($wanted_code == '') { |
|
110 | + if ($wanted_code == '') { |
|
111 | 111 | $wanted_code = CourseManager::generate_course_code($title); |
112 | 112 | } |
113 | 113 | $result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return new WSError(202, 'There was an error creating the course'); |
116 | 116 | } else { |
117 | 117 | // Update extra fields |
118 | - foreach($extras_associative as $fname => $fvalue) { |
|
118 | + foreach ($extras_associative as $fname => $fvalue) { |
|
119 | 119 | CourseManager::update_course_extra_field_value($result, $fname, $fvalue); |
120 | 120 | } |
121 | 121 | // Get course id |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
144 | 144 | // First, verify the secret key |
145 | 145 | $verifKey = $this->verifyKey($secret_key); |
146 | - if($verifKey instanceof WSError) { |
|
146 | + if ($verifKey instanceof WSError) { |
|
147 | 147 | $this->handleError($verifKey); |
148 | 148 | } else { |
149 | 149 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
150 | - if($result instanceof WSError) { |
|
150 | + if ($result instanceof WSError) { |
|
151 | 151 | $this->handleError($result); |
152 | 152 | } else { |
153 | 153 | return $result; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | public function CreateCourses($secret_key, $courses) { |
166 | 166 | // First, verify the secret key |
167 | 167 | $verifKey = $this->verifyKey($secret_key); |
168 | - if($verifKey instanceof WSError) { |
|
168 | + if ($verifKey instanceof WSError) { |
|
169 | 169 | $this->handleError($verifKey); |
170 | 170 | } else { |
171 | 171 | $results = array(); |
172 | - foreach($courses as $course) { |
|
172 | + foreach ($courses as $course) { |
|
173 | 173 | $result_tmp = array(); |
174 | 174 | // re-initialize variables just in case |
175 | 175 | $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = 0; |
176 | 176 | extract($course); |
177 | 177 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
178 | - if($result instanceof WSError) { |
|
178 | + if ($result instanceof WSError) { |
|
179 | 179 | $result_tmp['result'] = $result->toArray(); |
180 | 180 | $result_tmp['course_id_value'] = $course_id_value; |
181 | 181 | $result_tmp['course_id_generated'] = 0; |
@@ -209,47 +209,47 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
211 | 211 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
212 | - if($course_id instanceof WSError) { |
|
212 | + if ($course_id instanceof WSError) { |
|
213 | 213 | return $course_id; |
214 | 214 | } else { |
215 | 215 | $attributes = array(); |
216 | - if(!empty($title)) { |
|
216 | + if (!empty($title)) { |
|
217 | 217 | $attributes['title'] = $title; |
218 | 218 | } |
219 | - if(!empty($category_code)) { |
|
219 | + if (!empty($category_code)) { |
|
220 | 220 | $attributes['category_code'] = $category_code; |
221 | 221 | } |
222 | - if(!empty($department_name)) { |
|
222 | + if (!empty($department_name)) { |
|
223 | 223 | $attributes['department_name'] = $department_name; |
224 | 224 | } |
225 | - if(!empty($department_url)) { |
|
225 | + if (!empty($department_url)) { |
|
226 | 226 | $attributes['department_url'] = $department_url; |
227 | 227 | } |
228 | - if(!empty($language)) { |
|
228 | + if (!empty($language)) { |
|
229 | 229 | $attributes['course_language'] = $language; |
230 | 230 | } |
231 | - if($visibility != '') { |
|
232 | - $attributes['visibility'] = (int)$visibility; |
|
231 | + if ($visibility != '') { |
|
232 | + $attributes['visibility'] = (int) $visibility; |
|
233 | 233 | } |
234 | - if($subscribe != '') { |
|
235 | - $attributes['subscribe'] = (int)$subscribe; |
|
234 | + if ($subscribe != '') { |
|
235 | + $attributes['subscribe'] = (int) $subscribe; |
|
236 | 236 | } |
237 | - if($unsubscribe != '') { |
|
238 | - $attributes['unsubscribe'] = (int)$unsubscribe; |
|
237 | + if ($unsubscribe != '') { |
|
238 | + $attributes['unsubscribe'] = (int) $unsubscribe; |
|
239 | 239 | } |
240 | - if(!empty($visual_code)) { |
|
240 | + if (!empty($visual_code)) { |
|
241 | 241 | $attributes['visual_code'] = $visual_code; |
242 | 242 | } |
243 | - if(!empty($attributes)) { |
|
243 | + if (!empty($attributes)) { |
|
244 | 244 | CourseManager::update_attributes($course_id, $attributes); |
245 | 245 | } |
246 | - if(!empty($extras)) { |
|
246 | + if (!empty($extras)) { |
|
247 | 247 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
248 | 248 | $extras_associative = array(); |
249 | - foreach($extras as $extra) { |
|
249 | + foreach ($extras as $extra) { |
|
250 | 250 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
251 | 251 | } |
252 | - foreach($extras_associative as $fname => $fvalue) { |
|
252 | + foreach ($extras_associative as $fname => $fvalue) { |
|
253 | 253 | CourseManager::update_extra_field_value($course_code, $fname, $fvalue); |
254 | 254 | } |
255 | 255 | } |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
278 | 278 | $verifKey = $this->verifyKey($secret_key); |
279 | - if($verifKey instanceof WSError) { |
|
279 | + if ($verifKey instanceof WSError) { |
|
280 | 280 | $this->handleError($verifKey); |
281 | 281 | } else { |
282 | 282 | $result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras); |
283 | - if($result instanceof WSError) { |
|
283 | + if ($result instanceof WSError) { |
|
284 | 284 | $this->handleError($result); |
285 | 285 | } |
286 | 286 | } |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') { |
298 | 298 | $verifKey = $this->verifyKey($secret_key); |
299 | - if($verifKey instanceof WSError) { |
|
299 | + if ($verifKey instanceof WSError) { |
|
300 | 300 | $this->handleError($verifKey); |
301 | 301 | } else { |
302 | - $visibilities = split(',',$visibility); |
|
302 | + $visibilities = split(',', $visibility); |
|
303 | 303 | $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0'); |
304 | 304 | foreach ($visibilities as $p => $visibility) { |
305 | 305 | $visibilities[$p] = $vis[$visibility]; |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $category_names = array(); |
309 | 309 | |
310 | 310 | $courses = CourseManager::get_courses_list(); |
311 | - foreach($courses as $course) { |
|
311 | + foreach ($courses as $course) { |
|
312 | 312 | //skip elements that do not match required visibility |
313 | - if (!in_array($course['visibility'],$visibilities)) { continue; } |
|
313 | + if (!in_array($course['visibility'], $visibilities)) { continue; } |
|
314 | 314 | $course_tmp = array(); |
315 | 315 | $course_tmp['id'] = $course['id']; |
316 | 316 | $course_tmp['code'] = $course['code']; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $course_tmp['visibility'] = $course['visibility']; |
320 | 320 | |
321 | 321 | // Determining category name |
322 | - if($category_names[$course['category_code']]) { |
|
322 | + if ($category_names[$course['category_code']]) { |
|
323 | 323 | $course_tmp['category_name'] = $category_names[$course['category_code']]; |
324 | 324 | } else { |
325 | 325 | $category = CourseManager::get_course_category($course['category_code']); |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | */ |
356 | 356 | protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) { |
357 | 357 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
358 | - if($course_id instanceof WSError) { |
|
358 | + if ($course_id instanceof WSError) { |
|
359 | 359 | return $course_id; |
360 | 360 | } else { |
361 | 361 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
362 | - if($user_id instanceof WSError) { |
|
362 | + if ($user_id instanceof WSError) { |
|
363 | 363 | return $user_id; |
364 | 364 | } else { |
365 | 365 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
366 | - if($state == 0) { |
|
366 | + if ($state == 0) { |
|
367 | 367 | // Unsubscribe user |
368 | 368 | CourseManager::unsubscribe_user($user_id, $course_code); |
369 | 369 | return true; |
370 | 370 | } else { |
371 | 371 | // Subscribe user |
372 | - if(CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
372 | + if (CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
373 | 373 | return true; |
374 | 374 | } else { |
375 | 375 | return new WSError(203, 'An error occured subscribing to this course'); |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) { |
393 | 393 | $verifKey = $this->verifyKey($secret_key); |
394 | - if($verifKey instanceof WSError) { |
|
394 | + if ($verifKey instanceof WSError) { |
|
395 | 395 | $this->handleError($verifKey); |
396 | 396 | } else { |
397 | 397 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status); |
398 | - if($result instanceof WSError) { |
|
398 | + if ($result instanceof WSError) { |
|
399 | 399 | $this->handleError($result); |
400 | 400 | } |
401 | 401 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) { |
414 | 414 | $verifKey = $this->verifyKey($secret_key); |
415 | - if($verifKey instanceof WSError) { |
|
415 | + if ($verifKey instanceof WSError) { |
|
416 | 416 | $this->handleError($verifKey); |
417 | 417 | } else { |
418 | 418 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0); |
419 | - if($result instanceof WSError) { |
|
419 | + if ($result instanceof WSError) { |
|
420 | 420 | $this->handleError($result); |
421 | 421 | } |
422 | 422 | } |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
434 | 434 | $verifKey = $this->verifyKey($secret_key); |
435 | - if($verifKey instanceof WSError) { |
|
435 | + if ($verifKey instanceof WSError) { |
|
436 | 436 | $this->handleError($verifKey); |
437 | 437 | } else { |
438 | 438 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
439 | - if($course_id instanceof WSError) { |
|
439 | + if ($course_id instanceof WSError) { |
|
440 | 440 | return $course_id; |
441 | 441 | } else { |
442 | 442 | // Course exists, get its descriptions |
443 | 443 | $descriptions = CourseDescription::get_descriptions($course_id); |
444 | 444 | $results = array(); |
445 | - foreach($descriptions as $description) { |
|
445 | + foreach ($descriptions as $description) { |
|
446 | 446 | $results[] = array('course_desc_id' => $description->get_description_type(), |
447 | 447 | 'course_desc_title' => $description->get_title(), |
448 | 448 | 'course_desc_content' => $description->get_content()); |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) { |
467 | 467 | $verifKey = $this->verifyKey($secret_key); |
468 | - if($verifKey instanceof WSError) { |
|
468 | + if ($verifKey instanceof WSError) { |
|
469 | 469 | $this->handleError($verifKey); |
470 | 470 | } else { |
471 | 471 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
472 | - if($course_id instanceof WSError) { |
|
472 | + if ($course_id instanceof WSError) { |
|
473 | 473 | return $course_id; |
474 | 474 | } else { |
475 | 475 | // Create the new course description |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | // Check if this course description exists |
485 | 485 | $descriptions = CourseDescription::get_descriptions($course_id); |
486 | 486 | $exists = false; |
487 | - foreach($descriptions as $description) { |
|
488 | - if($description->get_description_type() == $course_desc_id) { |
|
487 | + foreach ($descriptions as $description) { |
|
488 | + if ($description->get_description_type() == $course_desc_id) { |
|
489 | 489 | $exists = true; |
490 | 490 | } |
491 | 491 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $form = TicketManager::getCategoryForm($url, $projectId); |
64 | 64 | $formToString = $form->returnForm(); |
65 | 65 | if ($form->validate()) { |
66 | - $values =$form->getSubmitValues(); |
|
66 | + $values = $form->getSubmitValues(); |
|
67 | 67 | |
68 | 68 | $params = [ |
69 | 69 | 'name' => $values['name'], |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $form->setDefaults($cat); |
96 | 96 | $formToString = $form->returnForm(); |
97 | 97 | if ($form->validate()) { |
98 | - $values =$form->getSubmitValues(); |
|
98 | + $values = $form->getSubmitValues(); |
|
99 | 99 | |
100 | 100 | $params = [ |
101 | 101 | 'name' => $values['name'], |