@@ -287,7 +287,10 @@ discard block |
||
287 | 287 | <td width="40%" align="center"> |
288 | 288 | <select name="UserList[]" multiple="multiple" size="20" style="width:300px;"> |
289 | 289 | <?php foreach ($db_users as $user) { ?> |
290 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> |
|
290 | + <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) { |
|
291 | + echo 'selected="selected"'; |
|
292 | +} |
|
293 | +?>> |
|
291 | 294 | <?php |
292 | 295 | $userName = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
293 | 296 | if ($showOfficialCode) { |
@@ -308,7 +311,10 @@ discard block |
||
308 | 311 | <td width="40%" align="center"> |
309 | 312 | <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;"> |
310 | 313 | <?php foreach ($db_courses as $course) { ?> |
311 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> |
|
314 | + <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) { |
|
315 | + echo 'selected="selected"'; |
|
316 | +} |
|
317 | +?>> |
|
312 | 318 | <?php echo '('.$course['visual_code'].') '.$course['title']; ?> |
313 | 319 | </option> |
314 | 320 | <?php } ?> |
@@ -679,12 +679,15 @@ discard block |
||
679 | 679 | $option1 = $option2 = $option3 = ''; |
680 | 680 | for ($k = 1; $k <= 100; $k++) { |
681 | 681 | $selected1 = $selected2 = $selected3 = ''; |
682 | - if ($k == $threadhold1[$i]) |
|
683 | - $selected1 = 'selected="selected"'; |
|
684 | - if ($k == $threadhold2[$i]) |
|
685 | - $selected2 = 'selected="selected"'; |
|
686 | - if ($k == $threadhold3[$i]) |
|
687 | - $selected3 = 'selected="selected"'; |
|
682 | + if ($k == $threadhold1[$i]) { |
|
683 | + $selected1 = 'selected="selected"'; |
|
684 | + } |
|
685 | + if ($k == $threadhold2[$i]) { |
|
686 | + $selected2 = 'selected="selected"'; |
|
687 | + } |
|
688 | + if ($k == $threadhold3[$i]) { |
|
689 | + $selected3 = 'selected="selected"'; |
|
690 | + } |
|
688 | 691 | $option1.='<option ' . $selected1 . ' >' . $k . ' % </option>'; |
689 | 692 | $option2.='<option ' . $selected2 . ' >' . $k . ' % </option>'; |
690 | 693 | $option3.='<option ' . $selected3 . '>' . $k . ' %</option>'; |
@@ -731,7 +734,10 @@ discard block |
||
731 | 734 | <div class="checkbox"> |
732 | 735 | <p> |
733 | 736 | <label> |
734 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
737 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
738 | + echo'checked'; |
|
739 | +} |
|
740 | +?> /> |
|
735 | 741 | <?php echo get_lang('TryAgain'); ?> |
736 | 742 | </label> |
737 | 743 | </p> |
@@ -784,7 +790,10 @@ discard block |
||
784 | 790 | <div class="checkbox"> |
785 | 791 | <p> |
786 | 792 | <label> |
787 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) echo'checked'; ?> /> |
|
793 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if ($try[$i] == 1) { |
|
794 | + echo'checked'; |
|
795 | +} |
|
796 | +?> /> |
|
788 | 797 | <?php echo get_lang('TryAgain'); ?> |
789 | 798 | </label> |
790 | 799 | </p> |
@@ -823,7 +832,10 @@ discard block |
||
823 | 832 | <th ><?php echo get_lang('OAR'); ?>*</th> |
824 | 833 | <?php if ($objExercise->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT) { ?> |
825 | 834 | <th colspan="2" ><?php echo get_lang('Comment'); ?></th> |
826 | - <th ><?php if ($answerType == HOT_SPOT_DELINEATION) echo get_lang('Scenario'); ?></th> |
|
835 | + <th ><?php if ($answerType == HOT_SPOT_DELINEATION) { |
|
836 | + echo get_lang('Scenario'); |
|
837 | +} |
|
838 | +?></th> |
|
827 | 839 | <?php } else { ?> |
828 | 840 | <th colspan="3" ><?php echo get_lang('Comment'); ?></th> |
829 | 841 | <?php } ?> |
@@ -849,7 +861,10 @@ discard block |
||
849 | 861 | <div class="checkbox"> |
850 | 862 | <p> |
851 | 863 | <label> |
852 | - <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) echo'checked'; ?> /> |
|
864 | + <input type="checkbox" class="checkbox" name="<?php echo 'try[' . $i; ?>]" <?php if (isset($try[$i]) && $try[$i] == 1) { |
|
865 | + echo'checked'; |
|
866 | +} |
|
867 | +?> /> |
|
853 | 868 | <?php echo get_lang('TryAgain'); ?> |
854 | 869 | </label> |
855 | 870 | </p> |
@@ -998,7 +1013,10 @@ discard block |
||
998 | 1013 | <div class="checkbox"> |
999 | 1014 | <p> |
1000 | 1015 | <label> |
1001 | - <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) echo'checked'; ?> /> |
|
1016 | + <input type="checkbox" class="checkbox" name="try_noerror" <?php if ($try_noerror == 1) { |
|
1017 | + echo'checked'; |
|
1018 | +} |
|
1019 | +?> /> |
|
1002 | 1020 | <?php echo get_lang('TryAgain'); ?> |
1003 | 1021 | </label> |
1004 | 1022 | </p> |
@@ -64,9 +64,10 @@ |
||
64 | 64 | $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : ''; |
65 | 65 | $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : ''; |
66 | 66 | |
67 | - if ($new_path && ($new_comment || $new_title)) |
|
68 | - if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
67 | + if ($new_path && ($new_comment || $new_title)) { |
|
68 | + if (($docid = DocumentManager::get_document_id($_course, $new_path))) { |
|
69 | 69 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
70 | + } |
|
70 | 71 | $ct = ''; |
71 | 72 | if ($new_comment) { |
72 | 73 | $ct .= ", comment='$new_comment'"; |
@@ -63,19 +63,22 @@ discard block |
||
63 | 63 | list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
64 | 64 | $ip = trim($ip1); |
65 | 65 | } |
66 | - if ($debug) |
|
67 | - error_log("ip: $ip"); |
|
66 | + if ($debug) { |
|
67 | + error_log("ip: $ip"); |
|
68 | + } |
|
68 | 69 | // Check if a file that limits access from webservices exists and contains |
69 | 70 | // the restraining check |
70 | 71 | if (is_file('webservice-auth-ip.conf.php')) { |
71 | 72 | include 'webservice-auth-ip.conf.php'; |
72 | - if ($debug) |
|
73 | - error_log("webservice-auth-ip.conf.php file included"); |
|
73 | + if ($debug) { |
|
74 | + error_log("webservice-auth-ip.conf.php file included"); |
|
75 | + } |
|
74 | 76 | if (!empty($ws_auth_ip)) { |
75 | 77 | $check_ip = true; |
76 | 78 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
77 | - if ($debug) |
|
78 | - error_log("ip_matches: $ip_matches"); |
|
79 | + if ($debug) { |
|
80 | + error_log("ip_matches: $ip_matches"); |
|
81 | + } |
|
79 | 82 | } |
80 | 83 | } |
81 | 84 | |
@@ -92,8 +95,9 @@ discard block |
||
92 | 95 | |
93 | 96 | $result = api_is_valid_secret_key($secret_key, $security_key); |
94 | 97 | |
95 | - if ($debug) |
|
96 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
98 | + if ($debug) { |
|
99 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
100 | + } |
|
97 | 101 | return $result; |
98 | 102 | } |
99 | 103 | |
@@ -553,7 +557,9 @@ discard block |
||
553 | 557 | |
554 | 558 | // First check wether the login already exists |
555 | 559 | if (!UserManager::is_username_available($loginName)) { |
556 | - if ($debug) error_log("Username $loginName is not available"); |
|
560 | + if ($debug) { |
|
561 | + error_log("Username $loginName is not available"); |
|
562 | + } |
|
557 | 563 | return 0; |
558 | 564 | } |
559 | 565 | |
@@ -1012,7 +1018,9 @@ discard block |
||
1012 | 1018 | if (empty($userId) && empty($sessionId) && empty($courseId)) { |
1013 | 1019 | // try original values |
1014 | 1020 | |
1015 | - if ($debug) error_log('try original values'); |
|
1021 | + if ($debug) { |
|
1022 | + error_log('try original values'); |
|
1023 | + } |
|
1016 | 1024 | |
1017 | 1025 | $userIdName = isset($params['original_user_id_name']) ? $params['original_user_id_name'] : 0; |
1018 | 1026 | $userIdValue = isset($params['original_user_id_value']) ? $params['original_user_id_value'] : 0; |
@@ -1044,9 +1052,15 @@ discard block |
||
1044 | 1052 | ); |
1045 | 1053 | } |
1046 | 1054 | |
1047 | - if ($debug) error_log('$userId found: '. $userId); |
|
1048 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1049 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1055 | + if ($debug) { |
|
1056 | + error_log('$userId found: '. $userId); |
|
1057 | + } |
|
1058 | + if ($debug) { |
|
1059 | + error_log('$courseId found: '. $courseId); |
|
1060 | + } |
|
1061 | + if ($debug) { |
|
1062 | + error_log('$sessionId found: '. $sessionId); |
|
1063 | + } |
|
1050 | 1064 | |
1051 | 1065 | return [ |
1052 | 1066 | 'user_id' => $userId, |
@@ -1076,13 +1090,17 @@ discard block |
||
1076 | 1090 | { |
1077 | 1091 | global $debug; |
1078 | 1092 | |
1079 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1093 | + if ($debug) { |
|
1094 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1095 | + } |
|
1080 | 1096 | |
1081 | 1097 | if (!WSHelperVerifyKey($params)) { |
1082 | 1098 | return returnError(WS_ERROR_SECRET_KEY); |
1083 | 1099 | } |
1084 | 1100 | |
1085 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1101 | + if ($debug) { |
|
1102 | + error_log('Params '. print_r($params, 1)); |
|
1103 | + } |
|
1086 | 1104 | |
1087 | 1105 | $params = parseCourseSessionUserParams($params); |
1088 | 1106 | |
@@ -1095,13 +1113,17 @@ discard block |
||
1095 | 1113 | $result = 0; |
1096 | 1114 | |
1097 | 1115 | if (!empty($coaches)) { |
1098 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1116 | + if ($debug) { |
|
1117 | + error_log('Coaches: '. print_r($coaches, 1)); |
|
1118 | + } |
|
1099 | 1119 | if (in_array($userId, $coaches)) { |
1100 | 1120 | $result = 1; |
1101 | 1121 | } |
1102 | 1122 | } |
1103 | 1123 | |
1104 | - if ($debug) error_log('Result: '. $result); |
|
1124 | + if ($debug) { |
|
1125 | + error_log('Result: '. $result); |
|
1126 | + } |
|
1105 | 1127 | |
1106 | 1128 | return $result; |
1107 | 1129 | } |
@@ -1127,13 +1149,17 @@ discard block |
||
1127 | 1149 | { |
1128 | 1150 | global $debug; |
1129 | 1151 | |
1130 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1152 | + if ($debug) { |
|
1153 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1154 | + } |
|
1131 | 1155 | |
1132 | 1156 | if (!WSHelperVerifyKey($params)) { |
1133 | 1157 | return returnError(WS_ERROR_SECRET_KEY); |
1134 | 1158 | } |
1135 | 1159 | |
1136 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1160 | + if ($debug) { |
|
1161 | + error_log('Params '. print_r($params, 1)); |
|
1162 | + } |
|
1137 | 1163 | |
1138 | 1164 | $params = parseCourseSessionUserParams($params); |
1139 | 1165 | |
@@ -1147,7 +1173,9 @@ discard block |
||
1147 | 1173 | $result = 0; |
1148 | 1174 | |
1149 | 1175 | if (!empty($coaches)) { |
1150 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1176 | + if ($debug) { |
|
1177 | + error_log('Coaches: ' . print_r($coaches, 1)); |
|
1178 | + } |
|
1151 | 1179 | if (!in_array($userId, $coaches)) { |
1152 | 1180 | $result = 1; |
1153 | 1181 | } |
@@ -1155,7 +1183,9 @@ discard block |
||
1155 | 1183 | $result = 1; |
1156 | 1184 | } |
1157 | 1185 | |
1158 | - if ($debug) error_log('Final Result: '. $result); |
|
1186 | + if ($debug) { |
|
1187 | + error_log('Final Result: '. $result); |
|
1188 | + } |
|
1159 | 1189 | |
1160 | 1190 | return $result; |
1161 | 1191 | } |
@@ -1207,8 +1237,12 @@ discard block |
||
1207 | 1237 | { |
1208 | 1238 | global $_user, $_configuration, $debug; |
1209 | 1239 | $debug = 1; |
1210 | - if ($debug) error_log('WSCreateUserPasswordCrypted'); |
|
1211 | - if ($debug) error_log(print_r($params,1)); |
|
1240 | + if ($debug) { |
|
1241 | + error_log('WSCreateUserPasswordCrypted'); |
|
1242 | + } |
|
1243 | + if ($debug) { |
|
1244 | + error_log(print_r($params,1)); |
|
1245 | + } |
|
1212 | 1246 | |
1213 | 1247 | if (!WSHelperVerifyKey($params)) { |
1214 | 1248 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1244,22 +1278,30 @@ discard block |
||
1244 | 1278 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
1245 | 1279 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1246 | 1280 | $msg = "Encryption $encrypt_method is invalid"; |
1247 | - if ($debug) error_log($msg); |
|
1281 | + if ($debug) { |
|
1282 | + error_log($msg); |
|
1283 | + } |
|
1248 | 1284 | return $msg; |
1249 | 1285 | |
1250 | 1286 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1251 | 1287 | $msg = "Encryption $encrypt_method is invalid"; |
1252 | - if ($debug) error_log($msg); |
|
1288 | + if ($debug) { |
|
1289 | + error_log($msg); |
|
1290 | + } |
|
1253 | 1291 | return $msg; |
1254 | 1292 | } |
1255 | 1293 | } else { |
1256 | 1294 | $msg = "This encryption $encrypt_method is not configured"; |
1257 | - if ($debug) error_log($msg); |
|
1295 | + if ($debug) { |
|
1296 | + error_log($msg); |
|
1297 | + } |
|
1258 | 1298 | return $msg; |
1259 | 1299 | } |
1260 | 1300 | } else { |
1261 | 1301 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
1262 | - if ($debug) error_log($msg); |
|
1302 | + if ($debug) { |
|
1303 | + error_log($msg); |
|
1304 | + } |
|
1263 | 1305 | return $msg; |
1264 | 1306 | } |
1265 | 1307 | |
@@ -1279,10 +1321,14 @@ discard block |
||
1279 | 1321 | $original_user_id_name |
1280 | 1322 | ); |
1281 | 1323 | |
1282 | - if ($debug) error_log('Ready to create user'); |
|
1324 | + if ($debug) { |
|
1325 | + error_log('Ready to create user'); |
|
1326 | + } |
|
1283 | 1327 | |
1284 | 1328 | if ($user_id > 0) { |
1285 | - if ($debug) error_log('User found with id: '.$user_id); |
|
1329 | + if ($debug) { |
|
1330 | + error_log('User found with id: '.$user_id); |
|
1331 | + } |
|
1286 | 1332 | |
1287 | 1333 | // Check whether user is not active |
1288 | 1334 | //@todo why this condition exists?? |
@@ -1293,7 +1339,9 @@ discard block |
||
1293 | 1339 | $count_check_user = Database::num_rows($resu); |
1294 | 1340 | if ($count_check_user > 0) { |
1295 | 1341 | |
1296 | - if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1342 | + if ($debug) { |
|
1343 | + error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1344 | + } |
|
1297 | 1345 | |
1298 | 1346 | $sql = "UPDATE $table_user SET |
1299 | 1347 | lastname='".Database::escape_string($lastName)."', |
@@ -1313,7 +1361,9 @@ discard block |
||
1313 | 1361 | active='1', |
1314 | 1362 | hr_dept_id=".intval($hr_dept_id); |
1315 | 1363 | $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
1316 | - if ($debug) error_log($sql); |
|
1364 | + if ($debug) { |
|
1365 | + error_log($sql); |
|
1366 | + } |
|
1317 | 1367 | Database::query($sql); |
1318 | 1368 | |
1319 | 1369 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -1330,11 +1380,15 @@ discard block |
||
1330 | 1380 | } |
1331 | 1381 | return $r_check_user[0]; |
1332 | 1382 | } else { |
1333 | - if ($debug) error_log('User exists but is active. Cant be updated'); |
|
1383 | + if ($debug) { |
|
1384 | + error_log('User exists but is active. Cant be updated'); |
|
1385 | + } |
|
1334 | 1386 | return 0; |
1335 | 1387 | } |
1336 | 1388 | } else { |
1337 | - if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1389 | + if ($debug) { |
|
1390 | + error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1391 | + } |
|
1338 | 1392 | } |
1339 | 1393 | |
1340 | 1394 | // Default language. |
@@ -1350,12 +1404,16 @@ discard block |
||
1350 | 1404 | |
1351 | 1405 | // First check wether the login already exists |
1352 | 1406 | if (!UserManager::is_username_available($loginName)) { |
1353 | - if ($debug) error_log("Username $loginName is not available"); |
|
1407 | + if ($debug) { |
|
1408 | + error_log("Username $loginName is not available"); |
|
1409 | + } |
|
1354 | 1410 | return 0; |
1355 | 1411 | } |
1356 | 1412 | |
1357 | 1413 | $queryExpirationDate = ''; |
1358 | - if (!empty($params['expiration_date'])) $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1414 | + if (!empty($params['expiration_date'])) { |
|
1415 | + $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1416 | + } |
|
1359 | 1417 | |
1360 | 1418 | $sql = "INSERT INTO $table_user SET |
1361 | 1419 | lastname = '".Database::escape_string(trim($lastName))."', |
@@ -1375,7 +1433,9 @@ discard block |
||
1375 | 1433 | ".$queryExpirationDate." |
1376 | 1434 | hr_dept_id = '".Database::escape_string($hr_dept_id)."', |
1377 | 1435 | active = '".Database::escape_string($active)."'"; |
1378 | - if ($debug) error_log($sql); |
|
1436 | + if ($debug) { |
|
1437 | + error_log($sql); |
|
1438 | + } |
|
1379 | 1439 | |
1380 | 1440 | Database::query($sql); |
1381 | 1441 | $return = Database::insert_id(); |
@@ -1387,7 +1447,9 @@ discard block |
||
1387 | 1447 | |
1388 | 1448 | $url_id = api_get_current_access_url_id(); |
1389 | 1449 | UrlManager::add_user_to_url($return, $url_id); |
1390 | - if ($debug) error_log("Adding user_id = $return to URL id $url_id "); |
|
1450 | + if ($debug) { |
|
1451 | + error_log("Adding user_id = $return to URL id $url_id "); |
|
1452 | + } |
|
1391 | 1453 | |
1392 | 1454 | // Create extra field for the original_user_id_name |
1393 | 1455 | UserManager::create_extra_field( |
@@ -1424,7 +1486,9 @@ discard block |
||
1424 | 1486 | } |
1425 | 1487 | } |
1426 | 1488 | } else { |
1427 | - if ($debug) error_log('Error while inserting a user'); |
|
1489 | + if ($debug) { |
|
1490 | + error_log('Error while inserting a user'); |
|
1491 | + } |
|
1428 | 1492 | return 0; |
1429 | 1493 | } |
1430 | 1494 | |
@@ -4487,7 +4551,9 @@ discard block |
||
4487 | 4551 | if (!WSHelperVerifyKey($params)) { |
4488 | 4552 | return returnError(WS_ERROR_SECRET_KEY); |
4489 | 4553 | } |
4490 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4554 | + if ($debug) { |
|
4555 | + error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4556 | + } |
|
4491 | 4557 | |
4492 | 4558 | $results = array(); |
4493 | 4559 | $userscourses = $params['userscourses']; |
@@ -4506,7 +4572,9 @@ discard block |
||
4506 | 4572 | $original_user_id['original_user_id_value'], |
4507 | 4573 | $original_user_id['original_user_id_name'] |
4508 | 4574 | ); |
4509 | - if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4575 | + if ($debug) { |
|
4576 | + error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4577 | + } |
|
4510 | 4578 | |
4511 | 4579 | if ($user_id == 0) { |
4512 | 4580 | // If user was not found, there was a problem |
@@ -4524,13 +4592,19 @@ discard block |
||
4524 | 4592 | // Course was not found |
4525 | 4593 | $resultValue = 0; |
4526 | 4594 | } else { |
4527 | - if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4595 | + if ($debug) { |
|
4596 | + error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4597 | + } |
|
4528 | 4598 | $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false); |
4529 | 4599 | if ($result) { |
4530 | 4600 | $resultValue = 1; |
4531 | - if ($debug) error_log('WSSubscribeUserToCourse subscribed'); |
|
4601 | + if ($debug) { |
|
4602 | + error_log('WSSubscribeUserToCourse subscribed'); |
|
4603 | + } |
|
4532 | 4604 | } else { |
4533 | - if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4605 | + if ($debug) { |
|
4606 | + error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4607 | + } |
|
4534 | 4608 | } |
4535 | 4609 | } |
4536 | 4610 | } |
@@ -4588,8 +4662,12 @@ discard block |
||
4588 | 4662 | function WSSubscribeUserToCourseSimple($params) { |
4589 | 4663 | global $debug; |
4590 | 4664 | |
4591 | - if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
|
4592 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4665 | + if ($debug) { |
|
4666 | + error_log('WSSubscribeUserToCourseSimple'); |
|
4667 | + } |
|
4668 | + if ($debug) { |
|
4669 | + error_log('Params '. print_r($params, 1)); |
|
4670 | + } |
|
4593 | 4671 | if (!WSHelperVerifyKey($params)) { |
4594 | 4672 | return returnError(WS_ERROR_SECRET_KEY); |
4595 | 4673 | } |
@@ -4604,7 +4682,9 @@ discard block |
||
4604 | 4682 | if (empty($user_data)) { |
4605 | 4683 | // If user was not found, there was a problem |
4606 | 4684 | $result = "User $user_id does not exist"; |
4607 | - if ($debug) error_log($result); |
|
4685 | + if ($debug) { |
|
4686 | + error_log($result); |
|
4687 | + } |
|
4608 | 4688 | return $result; |
4609 | 4689 | } |
4610 | 4690 | if (!empty($course_code)) { |
@@ -4612,14 +4692,22 @@ discard block |
||
4612 | 4692 | if (empty($course_data)) { |
4613 | 4693 | // Course was not found |
4614 | 4694 | $result = "Course $course_code does not exist in the platform "; |
4615 | - if ($debug) error_log($result); |
|
4695 | + if ($debug) { |
|
4696 | + error_log($result); |
|
4697 | + } |
|
4616 | 4698 | } else { |
4617 | - if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4699 | + if ($debug) { |
|
4700 | + error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4701 | + } |
|
4618 | 4702 | if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) { |
4619 | 4703 | $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions '; |
4620 | - if ($debug) error_log($result); |
|
4704 | + if ($debug) { |
|
4705 | + error_log($result); |
|
4706 | + } |
|
4621 | 4707 | } else { |
4622 | - if ($debug) error_log('User registered to the course: '.$course_data['code']); |
|
4708 | + if ($debug) { |
|
4709 | + error_log('User registered to the course: '.$course_data['code']); |
|
4710 | + } |
|
4623 | 4711 | $result = 1; |
4624 | 4712 | } |
4625 | 4713 | } |
@@ -4671,8 +4759,12 @@ discard block |
||
4671 | 4759 | // define the method WSGetUser |
4672 | 4760 | function WSGetUser($params) { |
4673 | 4761 | global $debug; |
4674 | - if ($debug) error_log('WSGetUser'); |
|
4675 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4762 | + if ($debug) { |
|
4763 | + error_log('WSGetUser'); |
|
4764 | + } |
|
4765 | + if ($debug) { |
|
4766 | + error_log('$params: '.print_r($params, 1)); |
|
4767 | + } |
|
4676 | 4768 | |
4677 | 4769 | if (!WSHelperVerifyKey($params)) { |
4678 | 4770 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4725,8 +4817,12 @@ discard block |
||
4725 | 4817 | // define the method WSGetUserFromUsername |
4726 | 4818 | function WSGetUserFromUsername($params) { |
4727 | 4819 | global $debug; |
4728 | - if ($debug) error_log('WSGetUserFromUsername'); |
|
4729 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4820 | + if ($debug) { |
|
4821 | + error_log('WSGetUserFromUsername'); |
|
4822 | + } |
|
4823 | + if ($debug) { |
|
4824 | + error_log('$params: '.print_r($params, 1)); |
|
4825 | + } |
|
4730 | 4826 | |
4731 | 4827 | if (!WSHelperVerifyKey($params)) { |
4732 | 4828 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -5176,7 +5272,9 @@ discard block |
||
5176 | 5272 | $orig_session_id_value[] = $original_session_id_value; |
5177 | 5273 | $results[] = 1; |
5178 | 5274 | |
5179 | - if ($debug) error_log("subscribe user:$user_id to session $sessionId"); |
|
5275 | + if ($debug) { |
|
5276 | + error_log("subscribe user:$user_id to session $sessionId"); |
|
5277 | + } |
|
5180 | 5278 | } |
5181 | 5279 | } |
5182 | 5280 | } // end principal foreach |
@@ -5260,7 +5358,9 @@ discard block |
||
5260 | 5358 | SESSION_VISIBLE_READ_ONLY, |
5261 | 5359 | false |
5262 | 5360 | ); |
5263 | - if ($debug) error_log('User registered to the course: '.$session_id); |
|
5361 | + if ($debug) { |
|
5362 | + error_log('User registered to the course: '.$session_id); |
|
5363 | + } |
|
5264 | 5364 | $result = 1; |
5265 | 5365 | } |
5266 | 5366 | } |
@@ -5406,7 +5506,9 @@ discard block |
||
5406 | 5506 | $orig_session_id_value[] = $original_session_id_value; |
5407 | 5507 | $results[] = 1; |
5408 | 5508 | |
5409 | - if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5509 | + if ($debug) { |
|
5510 | + error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5511 | + } |
|
5410 | 5512 | } |
5411 | 5513 | } |
5412 | 5514 | } // end principal foreach |
@@ -5553,7 +5655,9 @@ discard block |
||
5553 | 5655 | return returnError(WS_ERROR_SECRET_KEY); |
5554 | 5656 | } |
5555 | 5657 | |
5556 | - if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5658 | + if ($debug) { |
|
5659 | + error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5660 | + } |
|
5557 | 5661 | |
5558 | 5662 | $coursessessions_params = $params['coursessessions']; |
5559 | 5663 | $results = array(); |
@@ -5591,7 +5695,9 @@ discard block |
||
5591 | 5695 | array($courseInfo['real_id']), |
5592 | 5696 | false |
5593 | 5697 | ); |
5594 | - if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5698 | + if ($debug) { |
|
5699 | + error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5700 | + } |
|
5595 | 5701 | |
5596 | 5702 | $results[] = 1; |
5597 | 5703 | $orig_course_id_value[] = $original_session_id_value; |
@@ -5969,8 +6075,7 @@ discard block |
||
5969 | 6075 | UserManager::create_extra_field($params['original_user_id_name'], 1, $params['original_user_id_name'], ''); |
5970 | 6076 | // Save the external system's id into user_field_value table. |
5971 | 6077 | UserManager::update_extra_field_value($user_id, $params['original_user_id_name'], $params['original_user_id_value']); |
5972 | - } |
|
5973 | - else { |
|
6078 | + } else { |
|
5974 | 6079 | return 0; |
5975 | 6080 | } |
5976 | 6081 | } |
@@ -6126,8 +6231,12 @@ discard block |
||
6126 | 6231 | { |
6127 | 6232 | global $debug; |
6128 | 6233 | |
6129 | - if ($debug) error_log('WSUserSubscribedInCourse'); |
|
6130 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
6234 | + if ($debug) { |
|
6235 | + error_log('WSUserSubscribedInCourse'); |
|
6236 | + } |
|
6237 | + if ($debug) { |
|
6238 | + error_log('Params '. print_r($params, 1)); |
|
6239 | + } |
|
6131 | 6240 | if (!WSHelperVerifyKey($params)) { |
6132 | 6241 | |
6133 | 6242 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1267,10 +1267,11 @@ discard block |
||
1267 | 1267 | */ |
1268 | 1268 | public function isInList($questionId) |
1269 | 1269 | { |
1270 | - if (is_array($this->questionList)) |
|
1271 | - return in_array($questionId,$this->questionList); |
|
1272 | - else |
|
1273 | - return false; |
|
1270 | + if (is_array($this->questionList)) { |
|
1271 | + return in_array($questionId,$this->questionList); |
|
1272 | + } else { |
|
1273 | + return false; |
|
1274 | + } |
|
1274 | 1275 | } |
1275 | 1276 | |
1276 | 1277 | /** |
@@ -2207,10 +2208,11 @@ discard block |
||
2207 | 2208 | |
2208 | 2209 | $var = Exercise::selectTimeLimit(); |
2209 | 2210 | |
2210 | - if (($this->start_time != '0000-00-00 00:00:00') && !empty($this->start_time)) |
|
2211 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
2212 | - else |
|
2213 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
2211 | + if (($this->start_time != '0000-00-00 00:00:00') && !empty($this->start_time)) { |
|
2212 | + $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
2213 | + } else { |
|
2214 | + $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
2215 | + } |
|
2214 | 2216 | |
2215 | 2217 | $form->addElement('date_time_picker', 'start_time'); |
2216 | 2218 | |
@@ -2218,10 +2220,11 @@ discard block |
||
2218 | 2220 | |
2219 | 2221 | $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
2220 | 2222 | |
2221 | - if (($this->end_time != '0000-00-00 00:00:00' && !empty($this->end_time))) |
|
2222 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
2223 | - else |
|
2224 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
2223 | + if (($this->end_time != '0000-00-00 00:00:00' && !empty($this->end_time))) { |
|
2224 | + $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
2225 | + } else { |
|
2226 | + $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
2227 | + } |
|
2225 | 2228 | |
2226 | 2229 | $form->addElement('date_time_picker', 'end_time'); |
2227 | 2230 | $form->addElement('html','</div>'); |
@@ -3278,7 +3281,9 @@ discard block |
||
3278 | 3281 | $organs_at_risk_hit = 0; |
3279 | 3282 | $questionScore = 0; |
3280 | 3283 | |
3281 | - if ($debug) error_log('Start answer loop '); |
|
3284 | + if ($debug) { |
|
3285 | + error_log('Start answer loop '); |
|
3286 | + } |
|
3282 | 3287 | |
3283 | 3288 | $orderedHotspots = []; |
3284 | 3289 | |
@@ -3402,7 +3407,9 @@ discard block |
||
3402 | 3407 | } |
3403 | 3408 | $totalScore += $answerWeighting; |
3404 | 3409 | |
3405 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3410 | + if ($debug) { |
|
3411 | + error_log("studentChoice: $studentChoice"); |
|
3412 | + } |
|
3406 | 3413 | break; |
3407 | 3414 | case GLOBAL_MULTIPLE_ANSWER: |
3408 | 3415 | if ($from_database) { |
@@ -3427,7 +3434,9 @@ discard block |
||
3427 | 3434 | $real_answers[$answerId] = (bool)$studentChoice; |
3428 | 3435 | } |
3429 | 3436 | $totalScore += $answerWeighting; |
3430 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3437 | + if ($debug) { |
|
3438 | + error_log("studentChoice: $studentChoice"); |
|
3439 | + } |
|
3431 | 3440 | break; |
3432 | 3441 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
3433 | 3442 | if ($from_database) { |
@@ -4149,7 +4158,9 @@ discard block |
||
4149 | 4158 | } // end switch Answertype |
4150 | 4159 | |
4151 | 4160 | if ($show_result) { |
4152 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4161 | + if ($debug) { |
|
4162 | + error_log('Showing questions $from '.$from); |
|
4163 | + } |
|
4153 | 4164 | if ($from == 'exercise_result') { |
4154 | 4165 | // display answers (if not matching type, or if the answer is correct) |
4155 | 4166 | if ( |
@@ -4446,7 +4457,9 @@ discard block |
||
4446 | 4457 | } |
4447 | 4458 | } |
4448 | 4459 | } else { |
4449 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4460 | + if ($debug) { |
|
4461 | + error_log('Showing questions $from '.$from); |
|
4462 | + } |
|
4450 | 4463 | |
4451 | 4464 | switch ($answerType) { |
4452 | 4465 | case UNIQUE_ANSWER: |
@@ -4793,10 +4806,14 @@ discard block |
||
4793 | 4806 | } |
4794 | 4807 | } |
4795 | 4808 | } |
4796 | - if ($debug) error_log(' ------ '); |
|
4809 | + if ($debug) { |
|
4810 | + error_log(' ------ '); |
|
4811 | + } |
|
4797 | 4812 | } // end for that loops over all answers of the current question |
4798 | 4813 | |
4799 | - if ($debug) error_log('-- end answer loop --'); |
|
4814 | + if ($debug) { |
|
4815 | + error_log('-- end answer loop --'); |
|
4816 | + } |
|
4800 | 4817 | |
4801 | 4818 | $final_answer = true; |
4802 | 4819 | |
@@ -4869,7 +4886,9 @@ discard block |
||
4869 | 4886 | // some results that haven't been stored in the database yet |
4870 | 4887 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
4871 | 4888 | |
4872 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
4889 | + if ($debug) { |
|
4890 | + error_log('$from AND this is a hotspot kind of question '); |
|
4891 | + } |
|
4873 | 4892 | |
4874 | 4893 | $my_exe_id = 0; |
4875 | 4894 | $from_database = 0; |
@@ -5045,8 +5064,12 @@ discard block |
||
5045 | 5064 | // stored by exercise_results.php (using the session) |
5046 | 5065 | |
5047 | 5066 | if ($saved_results) { |
5048 | - if ($debug) error_log("Save question results $saved_results"); |
|
5049 | - if ($debug) error_log(print_r($choice ,1 )); |
|
5067 | + if ($debug) { |
|
5068 | + error_log("Save question results $saved_results"); |
|
5069 | + } |
|
5070 | + if ($debug) { |
|
5071 | + error_log(print_r($choice ,1 )); |
|
5072 | + } |
|
5050 | 5073 | |
5051 | 5074 | if (empty($choice)) { |
5052 | 5075 | $choice = 0; |
@@ -5148,7 +5171,9 @@ discard block |
||
5148 | 5171 | $sql = 'UPDATE ' . $stat_table . ' SET |
5149 | 5172 | exe_result = exe_result + ' . floatval($questionScore) . ' |
5150 | 5173 | WHERE exe_id = ' . $exeId; |
5151 | - if ($debug) error_log($sql); |
|
5174 | + if ($debug) { |
|
5175 | + error_log($sql); |
|
5176 | + } |
|
5152 | 5177 | Database::query($sql); |
5153 | 5178 | } |
5154 | 5179 |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | |
865 | 865 | if ($progress === null) { |
866 | 866 | $progress = '0%'; |
867 | - } else { |
|
867 | + } else { |
|
868 | 868 | $any_result = true; |
869 | 869 | } |
870 | 870 | |
@@ -894,7 +894,9 @@ discard block |
||
894 | 894 | $start_time = '-'; |
895 | 895 | } |
896 | 896 | |
897 | - if (!empty($total_time)) $any_result = true; |
|
897 | + if (!empty($total_time)) { |
|
898 | + $any_result = true; |
|
899 | + } |
|
898 | 900 | |
899 | 901 | // Quiz in lp |
900 | 902 | $score = Tracking::get_avg_student_score( |
@@ -1110,10 +1112,11 @@ discard block |
||
1110 | 1112 | $result_last_attempt = Database::query($sql); |
1111 | 1113 | if (Database :: num_rows($result_last_attempt) > 0) { |
1112 | 1114 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1113 | - if ($count_attempts > 0) |
|
1114 | - echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1115 | + if ($count_attempts > 0) { |
|
1116 | + echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1115 | 1117 | '.Display::return_icon('quiz.gif').' |
1116 | 1118 | </a>'; |
1119 | + } |
|
1117 | 1120 | } |
1118 | 1121 | echo '</td>'; |
1119 | 1122 |
@@ -73,10 +73,11 @@ discard block |
||
73 | 73 | $data = curl_exec( $ch ); |
74 | 74 | curl_close( $ch ); |
75 | 75 | |
76 | - if($data) |
|
77 | - return (new SimpleXMLElement($data)); |
|
78 | - else |
|
79 | - return false; |
|
76 | + if($data) { |
|
77 | + return (new SimpleXMLElement($data)); |
|
78 | + } else { |
|
79 | + return false; |
|
80 | + } |
|
80 | 81 | } |
81 | 82 | return (simplexml_load_file($url)); |
82 | 83 | } |
@@ -85,11 +86,9 @@ discard block |
||
85 | 86 | /* Process required params and throw errors if we don't get values */ |
86 | 87 | if ((isset($param)) && ($param != '')) { |
87 | 88 | return $param; |
88 | - } |
|
89 | - elseif (!isset($param)) { |
|
89 | + } elseif (!isset($param)) { |
|
90 | 90 | throw new Exception('Missing parameter.'); |
91 | - } |
|
92 | - else { |
|
91 | + } else { |
|
93 | 92 | throw new Exception(''.$param.' is required.'); |
94 | 93 | } |
95 | 94 | } |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | /* Don't know if we'll use this one, but let's build it in case. */ |
100 | 99 | if ((isset($param)) && ($param != '')) { |
101 | 100 | return $param; |
102 | - } |
|
103 | - else { |
|
101 | + } else { |
|
104 | 102 | $param = ''; |
105 | 103 | return $param; |
106 | 104 | } |
@@ -137,8 +135,9 @@ discard block |
||
137 | 135 | '&duration='.urlencode($creationParams['duration']); |
138 | 136 | //'&meta_category='.urlencode($creationParams['meta_category']); |
139 | 137 | $welcomeMessage = $creationParams['welcomeMsg']; |
140 | - if(trim($welcomeMessage)) |
|
141 | - $params .= '&welcome='.urlencode($welcomeMessage); |
|
138 | + if(trim($welcomeMessage)) { |
|
139 | + $params .= '&welcome='.urlencode($welcomeMessage); |
|
140 | + } |
|
142 | 141 | // Return the complete URL: |
143 | 142 | return ( $creationUrl.$params.'&checksum='.sha1("create".$params.$this->_securitySalt) ); |
144 | 143 | } |
@@ -165,8 +164,8 @@ discard block |
||
165 | 164 | $xml = $this->_processXmlResponse($this->getCreateMeetingURL($creationParams)); |
166 | 165 | |
167 | 166 | if ($xml) { |
168 | - if($xml->meetingID) |
|
169 | - return array( |
|
167 | + if($xml->meetingID) { |
|
168 | + return array( |
|
170 | 169 | 'returncode' => $xml->returncode->__toString(), |
171 | 170 | 'message' => $xml->message->__toString(), |
172 | 171 | 'messageKey' => $xml->messageKey->__toString(), |
@@ -176,14 +175,14 @@ discard block |
||
176 | 175 | 'hasBeenForciblyEnded' => $xml->hasBeenForciblyEnded->__toString(), |
177 | 176 | 'createTime' => $xml->createTime->__toString() |
178 | 177 | ); |
179 | - else |
|
180 | - return array( |
|
178 | + } else { |
|
179 | + return array( |
|
181 | 180 | 'returncode' => $xml->returncode->__toString(), |
182 | 181 | 'message' => $xml->message->__toString(), |
183 | 182 | 'messageKey' => $xml->messageKey->__toString() |
184 | 183 | ); |
185 | - } |
|
186 | - else { |
|
184 | + } |
|
185 | + } else { |
|
187 | 186 | return null; |
188 | 187 | } |
189 | 188 | } |
@@ -253,8 +252,7 @@ discard block |
||
253 | 252 | 'message' => $xml->message->__toString(), |
254 | 253 | 'messageKey' => $xml->messageKey->__toString() |
255 | 254 | ); |
256 | - } |
|
257 | - else { |
|
255 | + } else { |
|
258 | 256 | return null; |
259 | 257 | } |
260 | 258 | |
@@ -288,8 +286,7 @@ discard block |
||
288 | 286 | 'returncode' => $xml->returncode->__toString(), |
289 | 287 | 'running' => $xml->running->__toString() // -- Returns true/false. |
290 | 288 | ); |
291 | - } |
|
292 | - else { |
|
289 | + } else { |
|
293 | 290 | return null; |
294 | 291 | } |
295 | 292 | |
@@ -317,8 +314,7 @@ discard block |
||
317 | 314 | 'returncode' => $xml->returncode->__toString() |
318 | 315 | ); |
319 | 316 | return $result; |
320 | - } |
|
321 | - elseif ($xml->messageKey == 'noMeetings') { |
|
317 | + } elseif ($xml->messageKey == 'noMeetings') { |
|
322 | 318 | /* No meetings on server, so return just this info: */ |
323 | 319 | $result = array( |
324 | 320 | 'returncode' => $xml->returncode->__toString(), |
@@ -326,8 +322,7 @@ discard block |
||
326 | 322 | 'message' => $xml->message->__toString() |
327 | 323 | ); |
328 | 324 | return $result; |
329 | - } |
|
330 | - else { |
|
325 | + } else { |
|
331 | 326 | // In this case, we have success and meetings. First return general response: |
332 | 327 | $result = array( |
333 | 328 | 'returncode' => $xml->returncode->__toString(), |
@@ -348,8 +343,7 @@ discard block |
||
348 | 343 | } |
349 | 344 | return $result; |
350 | 345 | } |
351 | - } |
|
352 | - else { |
|
346 | + } else { |
|
353 | 347 | return null; |
354 | 348 | } |
355 | 349 | |
@@ -388,8 +382,7 @@ discard block |
||
388 | 382 | 'message' => $xml->message->__toString() |
389 | 383 | ); |
390 | 384 | return $result; |
391 | - } |
|
392 | - else { |
|
385 | + } else { |
|
393 | 386 | // In this case, we have success and meeting info: |
394 | 387 | $result = array( |
395 | 388 | 'returncode' => $xml->returncode->__toString(), |
@@ -418,8 +411,7 @@ discard block |
||
418 | 411 | } |
419 | 412 | return $result; |
420 | 413 | } |
421 | - } |
|
422 | - else { |
|
414 | + } else { |
|
423 | 415 | return null; |
424 | 416 | } |
425 | 417 | |
@@ -463,8 +455,7 @@ discard block |
||
463 | 455 | 'message' => $xml->message->__toString() |
464 | 456 | ); |
465 | 457 | return $result; |
466 | - } |
|
467 | - else { |
|
458 | + } else { |
|
468 | 459 | // In this case, we have success and recording info: |
469 | 460 | $result = array( |
470 | 461 | 'returncode' => $xml->returncode->__toString(), |
@@ -495,8 +486,7 @@ discard block |
||
495 | 486 | } |
496 | 487 | return $result; |
497 | 488 | } |
498 | - } |
|
499 | - else { |
|
489 | + } else { |
|
500 | 490 | return null; |
501 | 491 | } |
502 | 492 | } |
@@ -529,8 +519,7 @@ discard block |
||
529 | 519 | 'returncode' => $xml->returncode->__toString(), |
530 | 520 | 'published' => $xml->published->__toString() // -- Returns true/false. |
531 | 521 | ); |
532 | - } |
|
533 | - else { |
|
522 | + } else { |
|
534 | 523 | return null; |
535 | 524 | } |
536 | 525 | |
@@ -562,8 +551,7 @@ discard block |
||
562 | 551 | 'returncode' => $xml->returncode->__toString(), |
563 | 552 | 'deleted' => $xml->deleted->__toString() // -- Returns true/false. |
564 | 553 | ); |
565 | - } |
|
566 | - else { |
|
554 | + } else { |
|
567 | 555 | return null; |
568 | 556 | } |
569 | 557 |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_assoc($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($sf_term_array as $raw_term) { |
50 | 50 | $term = substr($raw_term, 1); |
51 | - if (empty($term)) continue; |
|
51 | + if (empty($term)) { |
|
52 | + continue; |
|
53 | + } |
|
52 | 54 | $html_term = htmlspecialchars($term, ENT_QUOTES, $charset); |
53 | 55 | $selected = ''; |
54 | 56 | if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) { |
@@ -69,7 +71,9 @@ discard block |
||
69 | 71 | $max = count($sf_terms); |
70 | 72 | $multiple_selects =''; |
71 | 73 | foreach ($sf_terms as $prefix => $sf_term_array) { |
72 | - if ($prefix == $prefilter_prefix) continue; |
|
74 | + if ($prefix == $prefilter_prefix) { |
|
75 | + continue; |
|
76 | + } |
|
73 | 77 | $multiple_select = ''; |
74 | 78 | if ($i>0) { |
75 | 79 | //print "+" image |
@@ -344,9 +348,10 @@ discard block |
||
344 | 348 | |
345 | 349 | // Tool introduction |
346 | 350 | // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here. |
347 | - if (api_get_course_id() !== -1) |
|
348 | - if (!empty($groupId)) { |
|
351 | + if (api_get_course_id() !== -1) { |
|
352 | + if (!empty($groupId)) { |
|
349 | 353 | Display::display_introduction_section(TOOL_SEARCH.$groupId); |
354 | + } |
|
350 | 355 | } else { |
351 | 356 | Display::display_introduction_section(TOOL_SEARCH); |
352 | 357 | } |
@@ -368,7 +373,9 @@ discard block |
||
368 | 373 | break; |
369 | 374 | } |
370 | 375 | } |
371 | - if ($thesaurus_decided) break; |
|
376 | + if ($thesaurus_decided) { |
|
377 | + break; |
|
378 | + } |
|
372 | 379 | } |
373 | 380 | } |
374 | 381 |