@@ -2387,7 +2387,9 @@ discard block |
||
2387 | 2387 | $debug = false; |
2388 | 2388 | } |
2389 | 2389 | |
2390 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2390 | + if ($debug) { |
|
2391 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2392 | + } |
|
2391 | 2393 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2392 | 2394 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2393 | 2395 | |
@@ -2464,7 +2466,9 @@ discard block |
||
2464 | 2466 | $condition_user1 AND |
2465 | 2467 | session_id = $session_id |
2466 | 2468 | GROUP BY lp_id, user_id"; |
2467 | - if ($debug) echo $sql; |
|
2469 | + if ($debug) { |
|
2470 | + echo $sql; |
|
2471 | + } |
|
2468 | 2472 | |
2469 | 2473 | $rs_last_lp_view_id = Database::query($sql); |
2470 | 2474 | |
@@ -2480,7 +2484,9 @@ discard block |
||
2480 | 2484 | $lp_view_id = $row_lp_view['id']; |
2481 | 2485 | $lp_id = $row_lp_view['lp_id']; |
2482 | 2486 | $user_id = $row_lp_view['user_id']; |
2483 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2487 | + if ($debug) { |
|
2488 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2489 | + } |
|
2484 | 2490 | |
2485 | 2491 | if ($get_only_latest_attempt_results) { |
2486 | 2492 | //Getting lp_items done by the user |
@@ -2537,7 +2543,9 @@ discard block |
||
2537 | 2543 | lp_i.c_id = $course_id AND |
2538 | 2544 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2539 | 2545 | WHERE lp_view_id = $lp_view_id "; |
2540 | - if ($debug) echo $sql.'<br />'; |
|
2546 | + if ($debug) { |
|
2547 | + echo $sql.'<br />'; |
|
2548 | + } |
|
2541 | 2549 | $res_max_score = Database::query($sql); |
2542 | 2550 | |
2543 | 2551 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2556,7 +2564,9 @@ discard block |
||
2556 | 2564 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2557 | 2565 | $score = $row_max_score['score']; |
2558 | 2566 | |
2559 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2567 | + if ($debug) { |
|
2568 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2569 | + } |
|
2560 | 2570 | |
2561 | 2571 | if ($row_max_score['item_type'] == 'sco') { |
2562 | 2572 | /* Check if it is sco (easier to get max_score) |
@@ -2576,7 +2586,9 @@ discard block |
||
2576 | 2586 | if (!empty($max_score)) { |
2577 | 2587 | $lp_partial_total += $score/$max_score; |
2578 | 2588 | } |
2579 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2589 | + if ($debug) { |
|
2590 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2591 | + } |
|
2580 | 2592 | } else { |
2581 | 2593 | // Case of a TOOL_QUIZ element |
2582 | 2594 | $item_id = $row_max_score['iid']; |
@@ -2598,12 +2610,16 @@ discard block |
||
2598 | 2610 | ORDER BY exe_date DESC |
2599 | 2611 | LIMIT 1"; |
2600 | 2612 | |
2601 | - if ($debug) echo $sql .'<br />'; |
|
2613 | + if ($debug) { |
|
2614 | + echo $sql .'<br />'; |
|
2615 | + } |
|
2602 | 2616 | $result_last_attempt = Database::query($sql); |
2603 | 2617 | $num = Database :: num_rows($result_last_attempt); |
2604 | 2618 | if ($num > 0 ) { |
2605 | 2619 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2606 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2620 | + if ($debug) { |
|
2621 | + echo $id_last_attempt.'<br />'; |
|
2622 | + } |
|
2607 | 2623 | |
2608 | 2624 | // Within the last attempt number tracking, get the sum of |
2609 | 2625 | // the max_scores of all questions that it was |
@@ -2622,7 +2638,9 @@ discard block |
||
2622 | 2638 | q.c_id = $course_id |
2623 | 2639 | ) |
2624 | 2640 | AS t"; |
2625 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2641 | + if ($debug) { |
|
2642 | + echo '$sql: '.$sql.' <br />'; |
|
2643 | + } |
|
2626 | 2644 | $res_max_score_bis = Database::query($sql); |
2627 | 2645 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2628 | 2646 | |
@@ -2632,7 +2650,9 @@ discard block |
||
2632 | 2650 | if (!empty($max_score) && floatval($max_score) > 0) { |
2633 | 2651 | $lp_partial_total += $score/$max_score; |
2634 | 2652 | } |
2635 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2653 | + if ($debug) { |
|
2654 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2655 | + } |
|
2636 | 2656 | } |
2637 | 2657 | } |
2638 | 2658 | |
@@ -2645,17 +2665,25 @@ discard block |
||
2645 | 2665 | $count_items++; |
2646 | 2666 | } |
2647 | 2667 | } |
2648 | - if ($debug) echo '$count_items: '.$count_items; |
|
2668 | + if ($debug) { |
|
2669 | + echo '$count_items: '.$count_items; |
|
2670 | + } |
|
2649 | 2671 | } |
2650 | 2672 | } //end for |
2651 | 2673 | |
2652 | 2674 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2653 | 2675 | |
2654 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2655 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2676 | + if ($debug) { |
|
2677 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2678 | + } |
|
2679 | + if ($debug) { |
|
2680 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2681 | + } |
|
2656 | 2682 | |
2657 | 2683 | $global_result += $score_of_scorm_calculate; |
2658 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2684 | + if ($debug) { |
|
2685 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2686 | + } |
|
2659 | 2687 | } // end while |
2660 | 2688 | } |
2661 | 2689 | |
@@ -2668,7 +2696,9 @@ discard block |
||
2668 | 2696 | c_id = $course_id AND |
2669 | 2697 | (item_type = 'quiz' OR item_type = 'sco') AND |
2670 | 2698 | lp_id = ".$lp_id; |
2671 | - if ($debug) echo $sql; |
|
2699 | + if ($debug) { |
|
2700 | + echo $sql; |
|
2701 | + } |
|
2672 | 2702 | $result_have_quiz = Database::query($sql); |
2673 | 2703 | |
2674 | 2704 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2679,19 +2709,29 @@ discard block |
||
2679 | 2709 | } |
2680 | 2710 | } |
2681 | 2711 | |
2682 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2683 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2712 | + if ($debug) { |
|
2713 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2714 | + } |
|
2715 | + if ($debug) { |
|
2716 | + echo '<h3>Final return</h3>'; |
|
2717 | + } |
|
2684 | 2718 | |
2685 | 2719 | if ($lp_with_quiz != 0) { |
2686 | 2720 | if (!$return_array) { |
2687 | 2721 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2688 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2722 | + if ($debug) { |
|
2723 | + var_dump($score_of_scorm_calculate); |
|
2724 | + } |
|
2689 | 2725 | if (empty($lp_ids)) { |
2690 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2726 | + if ($debug) { |
|
2727 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2728 | + } |
|
2691 | 2729 | } |
2692 | 2730 | return $score_of_scorm_calculate; |
2693 | 2731 | } else { |
2694 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2732 | + if ($debug) { |
|
2733 | + var_dump($global_result, $lp_with_quiz); |
|
2734 | + } |
|
2695 | 2735 | return array($global_result, $lp_with_quiz); |
2696 | 2736 | } |
2697 | 2737 | } else { |
@@ -3181,11 +3221,13 @@ discard block |
||
3181 | 3221 | |
3182 | 3222 | if (!empty ($id_session)) { |
3183 | 3223 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3184 | - if (api_is_multiple_url_enabled()) |
|
3185 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3186 | - } else { |
|
3187 | - if (api_is_multiple_url_enabled()) |
|
3188 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3224 | + if (api_is_multiple_url_enabled()) { |
|
3225 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3226 | + } |
|
3227 | + } else { |
|
3228 | + if (api_is_multiple_url_enabled()) { |
|
3229 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3230 | + } |
|
3189 | 3231 | } |
3190 | 3232 | |
3191 | 3233 | $result = Database::query($sql); |
@@ -3297,8 +3339,7 @@ discard block |
||
3297 | 3339 | if (empty($session['access_start_date']) |
3298 | 3340 | ) { |
3299 | 3341 | $session['status'] = get_lang('SessionActive'); |
3300 | - } |
|
3301 | - else { |
|
3342 | + } else { |
|
3302 | 3343 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3303 | 3344 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3304 | 3345 | if ($time_start < time() && time() < $time_end) { |
@@ -6917,8 +6958,9 @@ discard block |
||
6917 | 6958 | if (is_array($hpresults)) { |
6918 | 6959 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6919 | 6960 | $title = GetQuizName($hpresults[$i][0],''); |
6920 | - if ($title == '') |
|
6921 | - $title = basename($hpresults[$i][0]); |
|
6961 | + if ($title == '') { |
|
6962 | + $title = basename($hpresults[$i][0]); |
|
6963 | + } |
|
6922 | 6964 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6923 | 6965 | ?> |
6924 | 6966 | <tr> |
@@ -7290,8 +7332,9 @@ discard block |
||
7290 | 7332 | for($i = 0; $i < sizeof($hpresults); $i++) { |
7291 | 7333 | $title = GetQuizName($hpresults[$i][0],''); |
7292 | 7334 | |
7293 | - if ($title == '') |
|
7294 | - $title = basename($hpresults[$i][0]); |
|
7335 | + if ($title == '') { |
|
7336 | + $title = basename($hpresults[$i][0]); |
|
7337 | + } |
|
7295 | 7338 | |
7296 | 7339 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
7297 | 7340 |
@@ -1003,7 +1003,9 @@ |
||
1003 | 1003 | if ($file != '.' && $file != '..') { |
1004 | 1004 | |
1005 | 1005 | $filetype = 'file'; |
1006 | - if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
|
1006 | + if (is_dir($base_work_dir.$upload_path.'/'.$file)) { |
|
1007 | + $filetype = 'folder'; |
|
1008 | + } |
|
1007 | 1009 | |
1008 | 1010 | $safe_file = api_replace_dangerous_char($file); |
1009 | 1011 | @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
@@ -1933,8 +1933,9 @@ |
||
1933 | 1933 | $new_relation_type[] ="'$rel'"; |
1934 | 1934 | } |
1935 | 1935 | $relation_type = implode(',', $new_relation_type); |
1936 | - if (!empty($relation_type)) |
|
1937 | - $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1936 | + if (!empty($relation_type)) { |
|
1937 | + $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1938 | + } |
|
1938 | 1939 | } |
1939 | 1940 | |
1940 | 1941 | $sql = "SELECT picture_uri as image, u.id, CONCAT (u.firstname,' ', u.lastname) as fullname, relation_type |
@@ -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 |
@@ -603,7 +603,7 @@ |
||
603 | 603 | |
604 | 604 | if (is_file(api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/editor.css')) { |
605 | 605 | $css[] = api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/editor.css'; |
606 | - }else{ |
|
606 | + } else{ |
|
607 | 607 | $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'editor.css'); |
608 | 608 | } |
609 | 609 |
@@ -207,8 +207,7 @@ |
||
207 | 207 | // Dump variable for debug |
208 | 208 | error_log(print_r(debug_backtrace(),1)); |
209 | 209 | die; |
210 | - } |
|
211 | - else |
|
210 | + } else |
|
212 | 211 | { |
213 | 212 | $message = "Assert successful $message <br/>"; |
214 | 213 | echo $message; |
@@ -91,8 +91,9 @@ |
||
91 | 91 | |
92 | 92 | $user_id = UserManager :: create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], api_get_setting('PlatformLanguage'), $user['PhoneNumber'], '', $user['AuthSource']); |
93 | 93 | foreach ($user['Courses'] as $index => $course) { |
94 | - if(CourseManager :: course_exists($course)) |
|
95 | - CourseManager :: subscribe_user($user_id, $course,$user['Status']); |
|
94 | + if(CourseManager :: course_exists($course)) { |
|
95 | + CourseManager :: subscribe_user($user_id, $course,$user['Status']); |
|
96 | + } |
|
96 | 97 | } |
97 | 98 | |
98 | 99 | // TODO: Hard-coded French texts. |
@@ -48,19 +48,22 @@ discard block |
||
48 | 48 | list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 49 | $ip = trim($ip1); |
50 | 50 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
51 | + if ($debug) { |
|
52 | + error_log("ip: $ip"); |
|
53 | + } |
|
53 | 54 | // Check if a file that limits access from webservices exists and contains |
54 | 55 | // the restraining check |
55 | 56 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 57 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
58 | + if ($debug) { |
|
59 | + error_log("webservice-auth-ip.conf.php file included"); |
|
60 | + } |
|
59 | 61 | if (!empty($ws_auth_ip)) { |
60 | 62 | $check_ip = true; |
61 | 63 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
64 | + if ($debug) { |
|
65 | + error_log("ip_matches: $ip_matches"); |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | } |
66 | 69 | |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | } |
77 | 80 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 81 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
82 | + if ($debug) { |
|
83 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
84 | + } |
|
81 | 85 | return $result; |
82 | 86 | } |
83 | 87 | |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | if (!WSHelperVerifyKey($params)) { |
141 | 145 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 146 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
147 | + if ($debug) { |
|
148 | + error_log('WSImportLP'); |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $courseIdName = $params['course_id_name']; |
146 | 152 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | $courseId = $courseInfo['real_id']; |
157 | 163 | |
158 | 164 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
165 | + if ($debug) { |
|
166 | + error_log('Course not found'); |
|
167 | + } |
|
160 | 168 | return 'Course not found'; |
161 | 169 | } |
162 | 170 | |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | if (empty($sessionId)) { |
171 | 179 | |
172 | - if ($debug) error_log('Session not found'); |
|
180 | + if ($debug) { |
|
181 | + error_log('Session not found'); |
|
182 | + } |
|
173 | 183 | return 'Session not found'; |
174 | 184 | } |
175 | 185 | } |
@@ -196,7 +206,9 @@ discard block |
||
196 | 206 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 207 | |
198 | 208 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
209 | + if ($debug) { |
|
210 | + error_log('manifest.xml file not found'); |
|
211 | + } |
|
200 | 212 | return 'manifest.xml file not found'; |
201 | 213 | } |
202 | 214 | |
@@ -214,10 +226,14 @@ discard block |
||
214 | 226 | $oScorm->set_maker($maker, $courseId); |
215 | 227 | //$oScorm->set_jslib('scorm_api.php'); |
216 | 228 | |
217 | - if ($debug) error_log('scorm was added'); |
|
229 | + if ($debug) { |
|
230 | + error_log('scorm was added'); |
|
231 | + } |
|
218 | 232 | return 1; |
219 | 233 | } else { |
220 | - if ($debug) error_log('manifest data empty'); |
|
234 | + if ($debug) { |
|
235 | + error_log('manifest data empty'); |
|
236 | + } |
|
221 | 237 | return 'manifest data empty'; |
222 | 238 | } |
223 | 239 | } |
@@ -310,7 +326,9 @@ discard block |
||
310 | 326 | ); |
311 | 327 | |
312 | 328 | if (empty($courseInfo)) { |
313 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
329 | + if ($debug) { |
|
330 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
331 | + } |
|
314 | 332 | return 'Course not found'; |
315 | 333 | } |
316 | 334 | |
@@ -325,7 +343,9 @@ discard block |
||
325 | 343 | |
326 | 344 | if (empty($sessionId)) { |
327 | 345 | |
328 | - if ($debug) error_log('Session not found'); |
|
346 | + if ($debug) { |
|
347 | + error_log('Session not found'); |
|
348 | + } |
|
329 | 349 | return 'Session not found'; |
330 | 350 | } |
331 | 351 | } |
@@ -406,7 +426,9 @@ discard block |
||
406 | 426 | ); |
407 | 427 | |
408 | 428 | if (empty($courseInfo)) { |
409 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
429 | + if ($debug) { |
|
430 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
431 | + } |
|
410 | 432 | return 'Course not found'; |
411 | 433 | } |
412 | 434 | $courseId = $courseInfo['real_id']; |
@@ -431,7 +453,9 @@ discard block |
||
431 | 453 | |
432 | 454 | $lp = new learnpath($courseCode, $lpId, null); |
433 | 455 | if ($lp) { |
434 | - if ($debug) error_log("LP deleted $lpId"); |
|
456 | + if ($debug) { |
|
457 | + error_log("LP deleted $lpId"); |
|
458 | + } |
|
435 | 459 | |
436 | 460 | $course_dir = $courseInfo['directory'] . '/document'; |
437 | 461 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -447,7 +471,9 @@ discard block |
||
447 | 471 | if ($item) { |
448 | 472 | $documentId = $item->get_path(); |
449 | 473 | |
450 | - if ($debug) error_log("lp item id found #$itemId"); |
|
474 | + if ($debug) { |
|
475 | + error_log("lp item id found #$itemId"); |
|
476 | + } |
|
451 | 477 | |
452 | 478 | $documentInfo = DocumentManager::get_document_data_by_id( |
453 | 479 | $documentId, |
@@ -473,7 +499,9 @@ discard block |
||
473 | 499 | } |
474 | 500 | } |
475 | 501 | } else { |
476 | - if ($debug) error_log("Document not found #$itemId"); |
|
502 | + if ($debug) { |
|
503 | + error_log("Document not found #$itemId"); |
|
504 | + } |
|
477 | 505 | } |
478 | 506 | } |
479 | 507 | } |
@@ -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 | } |