@@ -63,14 +63,16 @@ 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); |
@@ -554,7 +556,9 @@ discard block |
||
554 | 556 | |
555 | 557 | // First check wether the login already exists |
556 | 558 | if (!UserManager::is_username_available($loginName)) { |
557 | - if ($debug) error_log("Username $loginName is not available"); |
|
559 | + if ($debug) { |
|
560 | + error_log("Username $loginName is not available"); |
|
561 | + } |
|
558 | 562 | return 0; |
559 | 563 | } |
560 | 564 | |
@@ -1045,9 +1049,15 @@ discard block |
||
1045 | 1049 | ); |
1046 | 1050 | } |
1047 | 1051 | |
1048 | - if ($debug) error_log('$userId found: '. $userId); |
|
1049 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1050 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1052 | + if ($debug) { |
|
1053 | + error_log('$userId found: '. $userId); |
|
1054 | + } |
|
1055 | + if ($debug) { |
|
1056 | + error_log('$courseId found: '. $courseId); |
|
1057 | + } |
|
1058 | + if ($debug) { |
|
1059 | + error_log('$sessionId found: '. $sessionId); |
|
1060 | + } |
|
1051 | 1061 | |
1052 | 1062 | return [ |
1053 | 1063 | 'user_id' => $userId, |
@@ -1077,13 +1087,17 @@ discard block |
||
1077 | 1087 | { |
1078 | 1088 | global $debug; |
1079 | 1089 | |
1080 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1090 | + if ($debug) { |
|
1091 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1092 | + } |
|
1081 | 1093 | |
1082 | 1094 | if (!WSHelperVerifyKey($params)) { |
1083 | 1095 | return returnError(WS_ERROR_SECRET_KEY); |
1084 | 1096 | } |
1085 | 1097 | |
1086 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1098 | + if ($debug) { |
|
1099 | + error_log('Params '. print_r($params, 1)); |
|
1100 | + } |
|
1087 | 1101 | |
1088 | 1102 | $params = parseCourseSessionUserParams($params); |
1089 | 1103 | |
@@ -1096,13 +1110,17 @@ discard block |
||
1096 | 1110 | $result = 0; |
1097 | 1111 | |
1098 | 1112 | if (!empty($coaches)) { |
1099 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1113 | + if ($debug) { |
|
1114 | + error_log('Coaches: '. print_r($coaches, 1)); |
|
1115 | + } |
|
1100 | 1116 | if (in_array($userId, $coaches)) { |
1101 | 1117 | $result = 1; |
1102 | 1118 | } |
1103 | 1119 | } |
1104 | 1120 | |
1105 | - if ($debug) error_log('Result: '. $result); |
|
1121 | + if ($debug) { |
|
1122 | + error_log('Result: '. $result); |
|
1123 | + } |
|
1106 | 1124 | |
1107 | 1125 | return $result; |
1108 | 1126 | } |
@@ -1128,13 +1146,17 @@ discard block |
||
1128 | 1146 | { |
1129 | 1147 | global $debug; |
1130 | 1148 | |
1131 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1149 | + if ($debug) { |
|
1150 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1151 | + } |
|
1132 | 1152 | |
1133 | 1153 | if (!WSHelperVerifyKey($params)) { |
1134 | 1154 | return returnError(WS_ERROR_SECRET_KEY); |
1135 | 1155 | } |
1136 | 1156 | |
1137 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1157 | + if ($debug) { |
|
1158 | + error_log('Params '. print_r($params, 1)); |
|
1159 | + } |
|
1138 | 1160 | |
1139 | 1161 | $params = parseCourseSessionUserParams($params); |
1140 | 1162 | |
@@ -1148,7 +1170,9 @@ discard block |
||
1148 | 1170 | $result = 0; |
1149 | 1171 | |
1150 | 1172 | if (!empty($coaches)) { |
1151 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1173 | + if ($debug) { |
|
1174 | + error_log('Coaches: ' . print_r($coaches, 1)); |
|
1175 | + } |
|
1152 | 1176 | if (!in_array($userId, $coaches)) { |
1153 | 1177 | $result = 1; |
1154 | 1178 | } |
@@ -1156,7 +1180,9 @@ discard block |
||
1156 | 1180 | $result = 1; |
1157 | 1181 | } |
1158 | 1182 | |
1159 | - if ($debug) error_log('Final Result: '. $result); |
|
1183 | + if ($debug) { |
|
1184 | + error_log('Final Result: '. $result); |
|
1185 | + } |
|
1160 | 1186 | |
1161 | 1187 | return $result; |
1162 | 1188 | } |
@@ -1208,8 +1234,12 @@ discard block |
||
1208 | 1234 | { |
1209 | 1235 | global $_user, $_configuration, $debug; |
1210 | 1236 | $debug = 1; |
1211 | - if ($debug) error_log('WSCreateUserPasswordCrypted'); |
|
1212 | - if ($debug) error_log(print_r($params,1)); |
|
1237 | + if ($debug) { |
|
1238 | + error_log('WSCreateUserPasswordCrypted'); |
|
1239 | + } |
|
1240 | + if ($debug) { |
|
1241 | + error_log(print_r($params,1)); |
|
1242 | + } |
|
1213 | 1243 | |
1214 | 1244 | if (!WSHelperVerifyKey($params)) { |
1215 | 1245 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1241,22 +1271,30 @@ discard block |
||
1241 | 1271 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
1242 | 1272 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1243 | 1273 | $msg = "Encryption $encrypt_method is invalid"; |
1244 | - if ($debug) error_log($msg); |
|
1274 | + if ($debug) { |
|
1275 | + error_log($msg); |
|
1276 | + } |
|
1245 | 1277 | return $msg; |
1246 | 1278 | |
1247 | 1279 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1248 | 1280 | $msg = "Encryption $encrypt_method is invalid"; |
1249 | - if ($debug) error_log($msg); |
|
1281 | + if ($debug) { |
|
1282 | + error_log($msg); |
|
1283 | + } |
|
1250 | 1284 | return $msg; |
1251 | 1285 | } |
1252 | 1286 | } else { |
1253 | 1287 | $msg = "This encryption $encrypt_method is not configured"; |
1254 | - if ($debug) error_log($msg); |
|
1288 | + if ($debug) { |
|
1289 | + error_log($msg); |
|
1290 | + } |
|
1255 | 1291 | return $msg; |
1256 | 1292 | } |
1257 | 1293 | } else { |
1258 | 1294 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
1259 | - if ($debug) error_log($msg); |
|
1295 | + if ($debug) { |
|
1296 | + error_log($msg); |
|
1297 | + } |
|
1260 | 1298 | return $msg; |
1261 | 1299 | } |
1262 | 1300 | |
@@ -1276,10 +1314,14 @@ discard block |
||
1276 | 1314 | $original_user_id_name |
1277 | 1315 | ); |
1278 | 1316 | |
1279 | - if ($debug) error_log('Ready to create user'); |
|
1317 | + if ($debug) { |
|
1318 | + error_log('Ready to create user'); |
|
1319 | + } |
|
1280 | 1320 | |
1281 | 1321 | if ($user_id > 0) { |
1282 | - if ($debug) error_log('User found with id: '.$user_id); |
|
1322 | + if ($debug) { |
|
1323 | + error_log('User found with id: '.$user_id); |
|
1324 | + } |
|
1283 | 1325 | |
1284 | 1326 | // Check whether user is not active |
1285 | 1327 | //@todo why this condition exists?? |
@@ -1290,7 +1332,9 @@ discard block |
||
1290 | 1332 | $count_check_user = Database::num_rows($resu); |
1291 | 1333 | if ($count_check_user > 0) { |
1292 | 1334 | |
1293 | - if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1335 | + if ($debug) { |
|
1336 | + error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1337 | + } |
|
1294 | 1338 | |
1295 | 1339 | $sql = "UPDATE $table_user SET |
1296 | 1340 | lastname='".Database::escape_string($lastName)."', |
@@ -1311,7 +1355,9 @@ discard block |
||
1311 | 1355 | hr_dept_id=".intval($hr_dept_id)." |
1312 | 1356 | WHERE user_id='".$r_check_user[0]."'"; |
1313 | 1357 | |
1314 | - if ($debug) error_log($sql); |
|
1358 | + if ($debug) { |
|
1359 | + error_log($sql); |
|
1360 | + } |
|
1315 | 1361 | Database::query($sql); |
1316 | 1362 | |
1317 | 1363 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -1328,11 +1374,15 @@ discard block |
||
1328 | 1374 | } |
1329 | 1375 | return $r_check_user[0]; |
1330 | 1376 | } else { |
1331 | - if ($debug) error_log('User exists but is active. Cant be updated'); |
|
1377 | + if ($debug) { |
|
1378 | + error_log('User exists but is active. Cant be updated'); |
|
1379 | + } |
|
1332 | 1380 | return 0; |
1333 | 1381 | } |
1334 | 1382 | } else { |
1335 | - if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1383 | + if ($debug) { |
|
1384 | + error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1385 | + } |
|
1336 | 1386 | } |
1337 | 1387 | |
1338 | 1388 | // Default language. |
@@ -1348,12 +1398,16 @@ discard block |
||
1348 | 1398 | |
1349 | 1399 | // First check wether the login already exists |
1350 | 1400 | if (!UserManager::is_username_available($loginName)) { |
1351 | - if ($debug) error_log("Username $loginName is not available"); |
|
1401 | + if ($debug) { |
|
1402 | + error_log("Username $loginName is not available"); |
|
1403 | + } |
|
1352 | 1404 | return 0; |
1353 | 1405 | } |
1354 | 1406 | |
1355 | 1407 | $queryExpirationDate = ''; |
1356 | - if (!empty($params['expiration_date'])) $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1408 | + if (!empty($params['expiration_date'])) { |
|
1409 | + $queryExpirationDate = "expiration_date = '".Database::escape_string($expiration_date)."', "; |
|
1410 | + } |
|
1357 | 1411 | |
1358 | 1412 | $sql = "INSERT INTO $table_user SET |
1359 | 1413 | lastname = '".Database::escape_string(trim($lastName))."', |
@@ -1373,7 +1427,9 @@ discard block |
||
1373 | 1427 | ".$queryExpirationDate." |
1374 | 1428 | hr_dept_id = '".Database::escape_string($hr_dept_id)."', |
1375 | 1429 | active = '".Database::escape_string($active)."'"; |
1376 | - if ($debug) error_log($sql); |
|
1430 | + if ($debug) { |
|
1431 | + error_log($sql); |
|
1432 | + } |
|
1377 | 1433 | |
1378 | 1434 | Database::query($sql); |
1379 | 1435 | $return = Database::insert_id(); |
@@ -1385,7 +1441,9 @@ discard block |
||
1385 | 1441 | |
1386 | 1442 | $url_id = api_get_current_access_url_id(); |
1387 | 1443 | UrlManager::add_user_to_url($return, $url_id); |
1388 | - if ($debug) error_log("Adding user_id = $return to URL id $url_id "); |
|
1444 | + if ($debug) { |
|
1445 | + error_log("Adding user_id = $return to URL id $url_id "); |
|
1446 | + } |
|
1389 | 1447 | |
1390 | 1448 | // Create extra field for the original_user_id_name |
1391 | 1449 | UserManager::create_extra_field( |
@@ -1422,7 +1480,9 @@ discard block |
||
1422 | 1480 | } |
1423 | 1481 | } |
1424 | 1482 | } else { |
1425 | - if ($debug) error_log('Error while inserting a user'); |
|
1483 | + if ($debug) { |
|
1484 | + error_log('Error while inserting a user'); |
|
1485 | + } |
|
1426 | 1486 | |
1427 | 1487 | return 0; |
1428 | 1488 | } |
@@ -4504,7 +4564,9 @@ discard block |
||
4504 | 4564 | if (!WSHelperVerifyKey($params)) { |
4505 | 4565 | return returnError(WS_ERROR_SECRET_KEY); |
4506 | 4566 | } |
4507 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4567 | + if ($debug) { |
|
4568 | + error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4569 | + } |
|
4508 | 4570 | |
4509 | 4571 | $results = array(); |
4510 | 4572 | $userscourses = $params['userscourses']; |
@@ -4523,7 +4585,9 @@ discard block |
||
4523 | 4585 | $original_user_id['original_user_id_value'], |
4524 | 4586 | $original_user_id['original_user_id_name'] |
4525 | 4587 | ); |
4526 | - if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4588 | + if ($debug) { |
|
4589 | + error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4590 | + } |
|
4527 | 4591 | |
4528 | 4592 | if ($user_id == 0) { |
4529 | 4593 | // If user was not found, there was a problem |
@@ -4541,13 +4605,19 @@ discard block |
||
4541 | 4605 | // Course was not found |
4542 | 4606 | $resultValue = 0; |
4543 | 4607 | } else { |
4544 | - if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4608 | + if ($debug) { |
|
4609 | + error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4610 | + } |
|
4545 | 4611 | $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false); |
4546 | 4612 | if ($result) { |
4547 | 4613 | $resultValue = 1; |
4548 | - if ($debug) error_log('WSSubscribeUserToCourse subscribed'); |
|
4614 | + if ($debug) { |
|
4615 | + error_log('WSSubscribeUserToCourse subscribed'); |
|
4616 | + } |
|
4549 | 4617 | } else { |
4550 | - if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4618 | + if ($debug) { |
|
4619 | + error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4620 | + } |
|
4551 | 4621 | } |
4552 | 4622 | } |
4553 | 4623 | } |
@@ -4606,8 +4676,12 @@ discard block |
||
4606 | 4676 | function WSSubscribeUserToCourseSimple($params) { |
4607 | 4677 | global $debug; |
4608 | 4678 | |
4609 | - if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
|
4610 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4679 | + if ($debug) { |
|
4680 | + error_log('WSSubscribeUserToCourseSimple'); |
|
4681 | + } |
|
4682 | + if ($debug) { |
|
4683 | + error_log('Params '. print_r($params, 1)); |
|
4684 | + } |
|
4611 | 4685 | if (!WSHelperVerifyKey($params)) { |
4612 | 4686 | return returnError(WS_ERROR_SECRET_KEY); |
4613 | 4687 | } |
@@ -4625,7 +4699,9 @@ discard block |
||
4625 | 4699 | if (empty($user_data)) { |
4626 | 4700 | // If user was not found, there was a problem |
4627 | 4701 | $result = "User $user_id does not exist"; |
4628 | - if ($debug) error_log($result); |
|
4702 | + if ($debug) { |
|
4703 | + error_log($result); |
|
4704 | + } |
|
4629 | 4705 | return $result; |
4630 | 4706 | } |
4631 | 4707 | if (!empty($course_code)) { |
@@ -4633,14 +4709,22 @@ discard block |
||
4633 | 4709 | if (empty($course_data)) { |
4634 | 4710 | // Course was not found |
4635 | 4711 | $result = "Course $course_code does not exist in the platform "; |
4636 | - if ($debug) error_log($result); |
|
4712 | + if ($debug) { |
|
4713 | + error_log($result); |
|
4714 | + } |
|
4637 | 4715 | } else { |
4638 | - if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4716 | + if ($debug) { |
|
4717 | + error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4718 | + } |
|
4639 | 4719 | if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) { |
4640 | 4720 | $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions '; |
4641 | - if ($debug) error_log($result); |
|
4721 | + if ($debug) { |
|
4722 | + error_log($result); |
|
4723 | + } |
|
4642 | 4724 | } else { |
4643 | - if ($debug) error_log('User registered to the course: '.$course_data['code']); |
|
4725 | + if ($debug) { |
|
4726 | + error_log('User registered to the course: '.$course_data['code']); |
|
4727 | + } |
|
4644 | 4728 | $result = 1; |
4645 | 4729 | } |
4646 | 4730 | } |
@@ -4693,8 +4777,12 @@ discard block |
||
4693 | 4777 | function WSGetUser($params) |
4694 | 4778 | { |
4695 | 4779 | global $debug; |
4696 | - if ($debug) error_log('WSGetUser'); |
|
4697 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4780 | + if ($debug) { |
|
4781 | + error_log('WSGetUser'); |
|
4782 | + } |
|
4783 | + if ($debug) { |
|
4784 | + error_log('$params: '.print_r($params, 1)); |
|
4785 | + } |
|
4698 | 4786 | |
4699 | 4787 | if (!WSHelperVerifyKey($params)) { |
4700 | 4788 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4748,8 +4836,12 @@ discard block |
||
4748 | 4836 | function WSGetUserFromUsername($params) |
4749 | 4837 | { |
4750 | 4838 | global $debug; |
4751 | - if ($debug) error_log('WSGetUserFromUsername'); |
|
4752 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4839 | + if ($debug) { |
|
4840 | + error_log('WSGetUserFromUsername'); |
|
4841 | + } |
|
4842 | + if ($debug) { |
|
4843 | + error_log('$params: '.print_r($params, 1)); |
|
4844 | + } |
|
4753 | 4845 | |
4754 | 4846 | if (!WSHelperVerifyKey($params)) { |
4755 | 4847 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -5216,7 +5308,9 @@ discard block |
||
5216 | 5308 | SessionManager::subscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false); |
5217 | 5309 | $results[] = 1; |
5218 | 5310 | |
5219 | - if ($debug) error_log("subscribe user:$user_id to session $sessionId"); |
|
5311 | + if ($debug) { |
|
5312 | + error_log("subscribe user:$user_id to session $sessionId"); |
|
5313 | + } |
|
5220 | 5314 | } |
5221 | 5315 | } |
5222 | 5316 | } // end principal foreach |
@@ -5300,7 +5394,9 @@ discard block |
||
5300 | 5394 | SESSION_VISIBLE_READ_ONLY, |
5301 | 5395 | false |
5302 | 5396 | ); |
5303 | - if ($debug) error_log('User registered to the course: '.$session_id); |
|
5397 | + if ($debug) { |
|
5398 | + error_log('User registered to the course: '.$session_id); |
|
5399 | + } |
|
5304 | 5400 | $result = 1; |
5305 | 5401 | } |
5306 | 5402 | } |
@@ -5448,7 +5544,9 @@ discard block |
||
5448 | 5544 | |
5449 | 5545 | $results[] = 1; |
5450 | 5546 | |
5451 | - if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5547 | + if ($debug) { |
|
5548 | + error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5549 | + } |
|
5452 | 5550 | } |
5453 | 5551 | } |
5454 | 5552 | } // end principal foreach |
@@ -5595,7 +5693,9 @@ discard block |
||
5595 | 5693 | return returnError(WS_ERROR_SECRET_KEY); |
5596 | 5694 | } |
5597 | 5695 | |
5598 | - if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5696 | + if ($debug) { |
|
5697 | + error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5698 | + } |
|
5599 | 5699 | |
5600 | 5700 | $coursessessions_params = $params['coursessessions']; |
5601 | 5701 | $results = array(); |
@@ -5641,7 +5741,9 @@ discard block |
||
5641 | 5741 | array($courseInfo['real_id']), |
5642 | 5742 | false |
5643 | 5743 | ); |
5644 | - if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5744 | + if ($debug) { |
|
5745 | + error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5746 | + } |
|
5645 | 5747 | |
5646 | 5748 | $results[] = 1; |
5647 | 5749 | } |
@@ -6914,7 +7016,9 @@ discard block |
||
6914 | 7016 | if (!WSHelperVerifyKey($params)) { |
6915 | 7017 | return returnError(WS_ERROR_SECRET_KEY); |
6916 | 7018 | } |
6917 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7019 | + if ($debug) { |
|
7020 | + error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1)); |
|
7021 | + } |
|
6918 | 7022 | |
6919 | 7023 | $results = array(); |
6920 | 7024 | $userscourses = $params['userscourses']; |
@@ -6930,7 +7034,9 @@ discard block |
||
6930 | 7034 | $original_user_id['original_user_id_value'], |
6931 | 7035 | $original_user_id['original_user_id_name'] |
6932 | 7036 | ); |
6933 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7037 | + if ($debug) { |
|
7038 | + error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId); |
|
7039 | + } |
|
6934 | 7040 | |
6935 | 7041 | if ($userId == 0) { |
6936 | 7042 | // If user was not found, there was a problem |
@@ -6947,13 +7053,19 @@ discard block |
||
6947 | 7053 | // Course was not found |
6948 | 7054 | $resultValue = 0; |
6949 | 7055 | } else { |
6950 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7056 | + if ($debug) { |
|
7057 | + error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode); |
|
7058 | + } |
|
6951 | 7059 | $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
6952 | 7060 | if ($result) { |
6953 | 7061 | $resultValue = 1; |
6954 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7062 | + if ($debug) { |
|
7063 | + error_log('WSAddUserVisibilityToCourseCatalogue registered'); |
|
7064 | + } |
|
6955 | 7065 | } else { |
6956 | - if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7066 | + if ($debug) { |
|
7067 | + error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: '); |
|
7068 | + } |
|
6957 | 7069 | } |
6958 | 7070 | } |
6959 | 7071 | } |
@@ -6986,7 +7098,9 @@ discard block |
||
6986 | 7098 | if (!WSHelperVerifyKey($params)) { |
6987 | 7099 | return returnError(WS_ERROR_SECRET_KEY); |
6988 | 7100 | } |
6989 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7101 | + if ($debug) { |
|
7102 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1)); |
|
7103 | + } |
|
6990 | 7104 | |
6991 | 7105 | $results = array(); |
6992 | 7106 | $userscourses = $params['userscourses']; |
@@ -7002,7 +7116,9 @@ discard block |
||
7002 | 7116 | $original_user_id['original_user_id_value'], |
7003 | 7117 | $original_user_id['original_user_id_name'] |
7004 | 7118 | ); |
7005 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7119 | + if ($debug) { |
|
7120 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId); |
|
7121 | + } |
|
7006 | 7122 | |
7007 | 7123 | if ($userId == 0) { |
7008 | 7124 | // If user was not found, there was a problem |
@@ -7020,13 +7136,19 @@ discard block |
||
7020 | 7136 | // Course was not found |
7021 | 7137 | $resultValue = 0; |
7022 | 7138 | } else { |
7023 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7139 | + if ($debug) { |
|
7140 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode); |
|
7141 | + } |
|
7024 | 7142 | $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible); |
7025 | 7143 | if ($result) { |
7026 | 7144 | $resultValue = 1; |
7027 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7145 | + if ($debug) { |
|
7146 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue removed'); |
|
7147 | + } |
|
7028 | 7148 | } else { |
7029 | - if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7149 | + if ($debug) { |
|
7150 | + error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: '); |
|
7151 | + } |
|
7030 | 7152 | } |
7031 | 7153 | } |
7032 | 7154 | } |
@@ -3267,7 +3267,9 @@ discard block |
||
3267 | 3267 | ); |
3268 | 3268 | } |
3269 | 3269 | |
3270 | - if ($debug) error_log('Start answer loop '); |
|
3270 | + if ($debug) { |
|
3271 | + error_log('Start answer loop '); |
|
3272 | + } |
|
3271 | 3273 | |
3272 | 3274 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
3273 | 3275 | $answer = $objAnswerTmp->selectAnswer($answerId); |
@@ -3381,7 +3383,9 @@ discard block |
||
3381 | 3383 | } |
3382 | 3384 | $totalScore += $answerWeighting; |
3383 | 3385 | |
3384 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3386 | + if ($debug) { |
|
3387 | + error_log("studentChoice: $studentChoice"); |
|
3388 | + } |
|
3385 | 3389 | break; |
3386 | 3390 | case GLOBAL_MULTIPLE_ANSWER: |
3387 | 3391 | if ($from_database) { |
@@ -3406,7 +3410,9 @@ discard block |
||
3406 | 3410 | $real_answers[$answerId] = (bool)$studentChoice; |
3407 | 3411 | } |
3408 | 3412 | $totalScore += $answerWeighting; |
3409 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
3413 | + if ($debug) { |
|
3414 | + error_log("studentChoice: $studentChoice"); |
|
3415 | + } |
|
3410 | 3416 | break; |
3411 | 3417 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
3412 | 3418 | if ($from_database) { |
@@ -4201,7 +4207,9 @@ discard block |
||
4201 | 4207 | } // end switch Answertype |
4202 | 4208 | |
4203 | 4209 | if ($show_result) { |
4204 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4210 | + if ($debug) { |
|
4211 | + error_log('Showing questions $from '.$from); |
|
4212 | + } |
|
4205 | 4213 | if ($from == 'exercise_result') { |
4206 | 4214 | //display answers (if not matching type, or if the answer is correct) |
4207 | 4215 | if ( |
@@ -4499,7 +4507,9 @@ discard block |
||
4499 | 4507 | } |
4500 | 4508 | } |
4501 | 4509 | } else { |
4502 | - if ($debug) error_log('Showing questions $from '.$from); |
|
4510 | + if ($debug) { |
|
4511 | + error_log('Showing questions $from '.$from); |
|
4512 | + } |
|
4503 | 4513 | |
4504 | 4514 | switch ($answerType) { |
4505 | 4515 | case UNIQUE_ANSWER: |
@@ -4846,10 +4856,14 @@ discard block |
||
4846 | 4856 | } |
4847 | 4857 | } |
4848 | 4858 | } |
4849 | - if ($debug) error_log(' ------ '); |
|
4859 | + if ($debug) { |
|
4860 | + error_log(' ------ '); |
|
4861 | + } |
|
4850 | 4862 | } // end for that loops over all answers of the current question |
4851 | 4863 | |
4852 | - if ($debug) error_log('-- end answer loop --'); |
|
4864 | + if ($debug) { |
|
4865 | + error_log('-- end answer loop --'); |
|
4866 | + } |
|
4853 | 4867 | |
4854 | 4868 | $final_answer = true; |
4855 | 4869 | |
@@ -4922,7 +4936,9 @@ discard block |
||
4922 | 4936 | // some results that haven't been stored in the database yet |
4923 | 4937 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
4924 | 4938 | |
4925 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
4939 | + if ($debug) { |
|
4940 | + error_log('$from AND this is a hotspot kind of question '); |
|
4941 | + } |
|
4926 | 4942 | |
4927 | 4943 | $my_exe_id = 0; |
4928 | 4944 | $from_database = 0; |
@@ -5109,8 +5125,12 @@ discard block |
||
5109 | 5125 | // stored by exercise_results.php (using the session) |
5110 | 5126 | |
5111 | 5127 | if ($saved_results) { |
5112 | - if ($debug) error_log("Save question results $saved_results"); |
|
5113 | - if ($debug) error_log(print_r($choice ,1 )); |
|
5128 | + if ($debug) { |
|
5129 | + error_log("Save question results $saved_results"); |
|
5130 | + } |
|
5131 | + if ($debug) { |
|
5132 | + error_log(print_r($choice ,1 )); |
|
5133 | + } |
|
5114 | 5134 | |
5115 | 5135 | if (empty($choice)) { |
5116 | 5136 | $choice = 0; |
@@ -7,7 +7,9 @@ |
||
7 | 7 | * @package chamilo.exercise |
8 | 8 | */ |
9 | 9 | |
10 | -if ( count( get_included_files() ) == 1 ) die( '---' ); |
|
10 | +if ( count( get_included_files() ) == 1 ) { |
|
11 | + die( '---' ); |
|
12 | +} |
|
11 | 13 | |
12 | 14 | if (!function_exists('mime_content_type')) { |
13 | 15 |
@@ -48,8 +48,7 @@ |
||
48 | 48 | foreach($items as $item) { /** @var $item MenuItemModel */ |
49 | 49 | if($item->hasChildren()) { |
50 | 50 | $this->activateByRoute($route, $item->getChildren()); |
51 | - } |
|
52 | - else { |
|
51 | + } else { |
|
53 | 52 | if($item->getRoute() == $route) { |
54 | 53 | $item->setIsActive(true); |
55 | 54 | } |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | // Mark folders to import which are not selected by the user to import, |
536 | 536 | // but in which a document was selected. |
537 | 537 | $documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null; |
538 | - if (!empty($resources) && is_array($resources)) |
|
539 | - foreach ($resources as $id => $obj) { |
|
538 | + if (!empty($resources) && is_array($resources)) { |
|
539 | + foreach ($resources as $id => $obj) { |
|
540 | 540 | if (isset($obj->file_type) && $obj->file_type == 'folder' && |
541 | 541 | !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) && |
542 | 542 | is_array($documents) |
@@ -544,6 +544,7 @@ discard block |
||
544 | 544 | foreach ($documents as $id_to_check => $post_value) { |
545 | 545 | if (isset($resources[$id_to_check])) { |
546 | 546 | $obj_to_check = $resources[$id_to_check]; |
547 | + } |
|
547 | 548 | $shared_path_part = substr( |
548 | 549 | $obj_to_check->path, |
549 | 550 | 0, |
@@ -314,7 +314,9 @@ discard block |
||
314 | 314 | |
315 | 315 | $clock_expired_time = null; |
316 | 316 | if (empty($exercise_stat_info)) { |
317 | - if ($debug) error_log('5 $exercise_stat_info is empty '); |
|
317 | + if ($debug) { |
|
318 | + error_log('5 $exercise_stat_info is empty '); |
|
319 | + } |
|
318 | 320 | $total_weight = 0; |
319 | 321 | $questionList = $objExercise->get_validated_question_list(); |
320 | 322 | foreach ($questionListUncompressed as $question_id) { |
@@ -325,11 +327,17 @@ discard block |
||
325 | 327 | if ($time_control) { |
326 | 328 | $expected_time = $current_timestamp + $total_seconds; |
327 | 329 | |
328 | - if ($debug) error_log('5.1. $current_timestamp '.$current_timestamp); |
|
329 | - if ($debug) error_log('5.2. $expected_time '.$expected_time); |
|
330 | + if ($debug) { |
|
331 | + error_log('5.1. $current_timestamp '.$current_timestamp); |
|
332 | + } |
|
333 | + if ($debug) { |
|
334 | + error_log('5.2. $expected_time '.$expected_time); |
|
335 | + } |
|
330 | 336 | |
331 | 337 | $clock_expired_time = api_get_utc_datetime($expected_time); |
332 | - if ($debug) error_log('5.3. $expected_time '.$clock_expired_time); |
|
338 | + if ($debug) { |
|
339 | + error_log('5.3. $expected_time '.$clock_expired_time); |
|
340 | + } |
|
333 | 341 | |
334 | 342 | //Sessions that contain the expired time |
335 | 343 | $_SESSION['expired_time'][$current_expired_time_key] = $clock_expired_time; |
@@ -349,8 +357,10 @@ discard block |
||
349 | 357 | $learnpath_item_id, |
350 | 358 | $learnpath_item_view_id |
351 | 359 | ); |
352 | - if ($debug) error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
353 | -} else { |
|
360 | + if ($debug) { |
|
361 | + error_log("5.5 exercise_stat_info[] exists getting exe_id $exe_id"); |
|
362 | + } |
|
363 | + } else { |
|
354 | 364 | $exe_id = $exercise_stat_info['exe_id']; |
355 | 365 | // Remember last question id position. |
356 | 366 | $isFirstTime = Session::read('firstTime'); |
@@ -373,8 +383,10 @@ discard block |
||
373 | 383 | } |
374 | 384 | } |
375 | 385 | |
376 | - if ($debug) error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
377 | -} |
|
386 | + if ($debug) { |
|
387 | + error_log("5 exercise_stat_info[] exists getting exe_id $exe_id "); |
|
388 | + } |
|
389 | + } |
|
378 | 390 | |
379 | 391 | $questionListInSession = Session::read('questionList'); |
380 | 392 | |
@@ -430,9 +442,15 @@ discard block |
||
430 | 442 | * If the expired time is major that zero(0) then the expired time is compute on this time. |
431 | 443 | */ |
432 | 444 | if ($time_control) { |
433 | - if ($debug) error_log('7.1. Time control is enabled'); |
|
434 | - if ($debug) error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
435 | - if ($debug) error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
445 | + if ($debug) { |
|
446 | + error_log('7.1. Time control is enabled'); |
|
447 | + } |
|
448 | + if ($debug) { |
|
449 | + error_log('7.2. $current_expired_time_key '.$current_expired_time_key); |
|
450 | + } |
|
451 | + if ($debug) { |
|
452 | + error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] '.$_SESSION['expired_time'][$current_expired_time_key]); |
|
453 | + } |
|
436 | 454 | |
437 | 455 | if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { |
438 | 456 | //Timer - Get expired_time for a student |
@@ -514,7 +532,9 @@ discard block |
||
514 | 532 | } |
515 | 533 | } |
516 | 534 | |
517 | -if ($debug) error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
535 | +if ($debug) { |
|
536 | + error_log('8. Question list loaded '.print_r($questionList, 1)); |
|
537 | +} |
|
518 | 538 | |
519 | 539 | //Real question count |
520 | 540 | $question_count = 0; |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | $use_anonymous = true; |
15 | 15 | |
16 | 16 | $debug = 0; |
17 | -if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
17 | +if ($debug > 0) { |
|
18 | + error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0); |
|
19 | +} |
|
18 | 20 | |
19 | 21 | // Language files that needs to be included. |
20 | 22 | if (isset($_GET['action'])) { |
@@ -210,10 +212,14 @@ discard block |
||
210 | 212 | // If refresh is set, we regenerate the oLP object from the database (kind of flush). |
211 | 213 | Session::erase('refresh'); |
212 | 214 | $myrefresh = 1; |
213 | - if ($debug > 0) error_log('New LP - Refresh asked', 0); |
|
214 | -} |
|
215 | + if ($debug > 0) { |
|
216 | + error_log('New LP - Refresh asked', 0); |
|
217 | + } |
|
218 | + } |
|
215 | 219 | |
216 | -if ($debug > 0) error_log('New LP - Passed refresh check', 0); |
|
220 | +if ($debug > 0) { |
|
221 | + error_log('New LP - Passed refresh check', 0); |
|
222 | +} |
|
217 | 223 | |
218 | 224 | if (!empty($_REQUEST['dialog_box'])) { |
219 | 225 | $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box'])); |
@@ -223,17 +229,23 @@ discard block |
||
223 | 229 | $lp_found = false; |
224 | 230 | |
225 | 231 | if (isset($_SESSION['lpobject'])) { |
226 | - if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
232 | + if ($debug > 0) { |
|
233 | + error_log('New LP - SESSION[lpobject] is defined', 0); |
|
234 | + } |
|
227 | 235 | $oLP = unserialize($_SESSION['lpobject']); |
228 | 236 | if (isset($oLP) && is_object($oLP)) { |
229 | - if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
237 | + if ($debug > 0) { |
|
238 | + error_log('New LP - oLP is object', 0); |
|
239 | + } |
|
230 | 240 | if ($myrefresh == 1 || |
231 | 241 | empty($oLP->cc) || |
232 | 242 | $oLP->cc != api_get_course_id() || |
233 | 243 | $oLP->lp_view_session_id != $session_id || |
234 | 244 | $oLP->scorm_debug == '1' |
235 | 245 | ) { |
236 | - if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
246 | + if ($debug > 0) { |
|
247 | + error_log('New LP - Course has changed, discard lp object', 0); |
|
248 | + } |
|
237 | 249 | if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
238 | 250 | $oLP = null; |
239 | 251 | Session::erase('oLP'); |
@@ -247,13 +259,19 @@ discard block |
||
247 | 259 | |
248 | 260 | $course_id = api_get_course_int_id(); |
249 | 261 | |
250 | -if ($debug>0) error_log('New LP - Passed data remains check', 0); |
|
262 | +if ($debug>0) { |
|
263 | + error_log('New LP - Passed data remains check', 0); |
|
264 | +} |
|
251 | 265 | |
252 | 266 | if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) { |
253 | - if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
267 | + if ($debug > 0) { |
|
268 | + error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0); |
|
269 | + } |
|
254 | 270 | // Regenerate a new lp object? Not always as some pages don't need the object (like upload?) |
255 | 271 | if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) { |
256 | - if ($debug > 0) error_log('New LP - lp_id is defined', 0); |
|
272 | + if ($debug > 0) { |
|
273 | + error_log('New LP - lp_id is defined', 0); |
|
274 | + } |
|
257 | 275 | // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the |
258 | 276 | // right object. |
259 | 277 | if (!empty($_REQUEST['lp_id'])) { |
@@ -265,16 +283,22 @@ discard block |
||
265 | 283 | $lp_table = Database::get_course_table(TABLE_LP_MAIN); |
266 | 284 | if (is_numeric($lp_id)) { |
267 | 285 | $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id"; |
268 | - if ($debug > 0) error_log('New LP - querying '.$sel, 0); |
|
286 | + if ($debug > 0) { |
|
287 | + error_log('New LP - querying '.$sel, 0); |
|
288 | + } |
|
269 | 289 | $res = Database::query($sel); |
270 | 290 | |
271 | 291 | if (Database::num_rows($res)) { |
272 | 292 | $row = Database::fetch_array($res); |
273 | 293 | $type = $row['lp_type']; |
274 | - if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
294 | + if ($debug > 0) { |
|
295 | + error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
296 | + } |
|
275 | 297 | switch ($type) { |
276 | 298 | case 1: |
277 | - if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
299 | + if ($debug > 0) { |
|
300 | + error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
301 | + } |
|
278 | 302 | |
279 | 303 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
280 | 304 | if ($oLP !== false) { |
@@ -284,7 +308,9 @@ discard block |
||
284 | 308 | } |
285 | 309 | break; |
286 | 310 | case 2: |
287 | - if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
311 | + if ($debug > 0) { |
|
312 | + error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
313 | + } |
|
288 | 314 | $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
289 | 315 | if ($oLP !== false) { |
290 | 316 | $lp_found = true; |
@@ -293,7 +319,9 @@ discard block |
||
293 | 319 | } |
294 | 320 | break; |
295 | 321 | case 3: |
296 | - if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
322 | + if ($debug > 0) { |
|
323 | + error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
324 | + } |
|
297 | 325 | $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id()); |
298 | 326 | if ($oLP !== false) { |
299 | 327 | $lp_found = true; |
@@ -302,7 +330,9 @@ discard block |
||
302 | 330 | } |
303 | 331 | break; |
304 | 332 | default: |
305 | - if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
333 | + if ($debug > 0) { |
|
334 | + error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
335 | + } |
|
306 | 336 | $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
307 | 337 | if ($oLP !== false) { |
308 | 338 | $lp_found = true; |
@@ -313,17 +343,23 @@ discard block |
||
313 | 343 | } |
314 | 344 | } |
315 | 345 | } else { |
316 | - if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0); |
|
346 | + if ($debug > 0) { |
|
347 | + error_log('New LP - Request[lp_id] is not numeric', 0); |
|
348 | + } |
|
317 | 349 | } |
318 | 350 | } else { |
319 | - if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
351 | + if ($debug > 0) { |
|
352 | + error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
353 | + } |
|
320 | 354 | } |
321 | 355 | if ($lp_found) { |
322 | 356 | $_SESSION['oLP'] = $oLP; |
323 | 357 | } |
324 | 358 | } |
325 | 359 | |
326 | -if ($debug > 0) error_log('New LP - Passed oLP creation check', 0); |
|
360 | +if ($debug > 0) { |
|
361 | + error_log('New LP - Passed oLP creation check', 0); |
|
362 | +} |
|
327 | 363 | |
328 | 364 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false); |
329 | 365 | |
@@ -614,8 +650,7 @@ discard block |
||
614 | 650 | if (!$lp_found) { |
615 | 651 | error_log('New LP - No learnpath given for set_autolaunch', 0); |
616 | 652 | require 'lp_list.php'; |
617 | - } |
|
618 | - else { |
|
653 | + } else { |
|
619 | 654 | $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']); |
620 | 655 | require 'lp_list.php'; |
621 | 656 | exit; |
@@ -1127,16 +1162,24 @@ discard block |
||
1127 | 1162 | } |
1128 | 1163 | break; |
1129 | 1164 | case 'content': |
1130 | - if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1165 | + if ($debug > 0) { |
|
1166 | + error_log('New LP - Item id is '.intval($_GET['item_id']), 0); |
|
1167 | + } |
|
1131 | 1168 | if (!$lp_found) { |
1132 | 1169 | error_log('New LP - No learnpath given for content', 0); |
1133 | 1170 | require 'lp_list.php'; |
1134 | 1171 | } else { |
1135 | - if ($debug > 0) error_log('New LP - save_last()', 0); |
|
1172 | + if ($debug > 0) { |
|
1173 | + error_log('New LP - save_last()', 0); |
|
1174 | + } |
|
1136 | 1175 | $_SESSION['oLP']->save_last(); |
1137 | - if ($debug > 0) error_log('New LP - set_current_item()', 0); |
|
1176 | + if ($debug > 0) { |
|
1177 | + error_log('New LP - set_current_item()', 0); |
|
1178 | + } |
|
1138 | 1179 | $_SESSION['oLP']->set_current_item($_GET['item_id']); |
1139 | - if ($debug > 0) error_log('New LP - start_current_item()', 0); |
|
1180 | + if ($debug > 0) { |
|
1181 | + error_log('New LP - start_current_item()', 0); |
|
1182 | + } |
|
1140 | 1183 | $_SESSION['oLP']->start_current_item(); |
1141 | 1184 | require 'lp_content.php'; |
1142 | 1185 | } |
@@ -1252,8 +1295,7 @@ discard block |
||
1252 | 1295 | require 'lp_message.php'; |
1253 | 1296 | break; |
1254 | 1297 | case 'return_to_course_homepage': |
1255 | - if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } |
|
1256 | - else { |
|
1298 | + if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else { |
|
1257 | 1299 | $_SESSION['oLP']->save_current(); |
1258 | 1300 | $_SESSION['oLP']->save_last(); |
1259 | 1301 | $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); |
@@ -1441,8 +1483,10 @@ discard block |
||
1441 | 1483 | |
1442 | 1484 | if (!empty($_SESSION['oLP'])) { |
1443 | 1485 | $_SESSION['lpobject'] = serialize($_SESSION['oLP']); |
1444 | - if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0); |
|
1445 | -} |
|
1486 | + if ($debug > 0) { |
|
1487 | + error_log('New LP - lpobject is serialized in session', 0); |
|
1488 | + } |
|
1489 | + } |
|
1446 | 1490 | |
1447 | 1491 | if (!empty($redirectTo)) { |
1448 | 1492 | header("Location: $redirectTo"); |
@@ -523,7 +523,7 @@ |
||
523 | 523 | ) { |
524 | 524 | if($btnBing){ |
525 | 525 | $btnBing = 'btn-lg'; |
526 | - }else{ |
|
526 | + } else{ |
|
527 | 527 | $btnBing = 'btn-sm'; |
528 | 528 | } |
529 | 529 | if ($checkRequirements) { |
@@ -464,7 +464,10 @@ |
||
464 | 464 | <blockquote> |
465 | 465 | <pre> |
466 | 466 | <b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId; |
467 | - xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;YYYY-MM-DD 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
467 | + xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;YYYY-MM-DD 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
468 | + echo implode(';', $list_reponse).';'; |
|
469 | +} |
|
470 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
468 | 471 | </pre> |
469 | 472 | </blockquote> |
470 | 473 | <p><?php |