@@ -1835,7 +1835,9 @@ discard block |
||
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | global $_course; |
1838 | - if ($_course == '-1') $_course = array(); |
|
1838 | + if ($_course == '-1') { |
|
1839 | + $_course = array(); |
|
1840 | + } |
|
1839 | 1841 | return $_course; |
1840 | 1842 | } |
1841 | 1843 | |
@@ -4336,17 +4338,20 @@ discard block |
||
4336 | 4338 | switch ($lang_type) { |
4337 | 4339 | case 'platform_lang': |
4338 | 4340 | $temp_lang = api_get_setting('platformLanguage'); |
4339 | - if (!empty($temp_lang)) |
|
4340 | - $return = $temp_lang; |
|
4341 | + if (!empty($temp_lang)) { |
|
4342 | + $return = $temp_lang; |
|
4343 | + } |
|
4341 | 4344 | break; |
4342 | 4345 | case 'user_profil_lang': |
4343 | 4346 | $_user = api_get_user_info(); |
4344 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4345 | - $return = $_user['language']; |
|
4347 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4348 | + $return = $_user['language']; |
|
4349 | + } |
|
4346 | 4350 | break; |
4347 | 4351 | case 'user_selected_lang': |
4348 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4349 | - $return = $_SESSION['user_language_choice']; |
|
4352 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4353 | + $return = $_SESSION['user_language_choice']; |
|
4354 | + } |
|
4350 | 4355 | break; |
4351 | 4356 | case 'course_lang': |
4352 | 4357 | global $_course; |
@@ -4364,8 +4369,9 @@ discard block |
||
4364 | 4369 | } |
4365 | 4370 | } |
4366 | 4371 | $_course = api_get_course_info($cidReq); |
4367 | - if (isset($_course['language']) && !empty($_course['language'])) |
|
4368 | - $return = $_course['language']; |
|
4372 | + if (isset($_course['language']) && !empty($_course['language'])) { |
|
4373 | + $return = $_course['language']; |
|
4374 | + } |
|
4369 | 4375 | break; |
4370 | 4376 | default: |
4371 | 4377 | $return = false; |
@@ -5608,8 +5614,7 @@ discard block |
||
5608 | 5614 | $is_courseAdmin = false; |
5609 | 5615 | $is_courseCoach = true; |
5610 | 5616 | $is_sessionAdmin = false; |
5611 | - } |
|
5612 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5617 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5613 | 5618 | $is_courseMember = false; |
5614 | 5619 | $is_courseTutor = false; |
5615 | 5620 | $is_courseAdmin = false; |
@@ -5952,8 +5957,7 @@ discard block |
||
5952 | 5957 | elseif (isset($_ENV['OS'])) { |
5953 | 5958 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5954 | 5959 | $os = $_ENV['OS']; |
5955 | - } |
|
5956 | - elseif (defined('PHP_OS')) { |
|
5960 | + } elseif (defined('PHP_OS')) { |
|
5957 | 5961 | // PHP_OS means on which OS PHP was compiled, this is why |
5958 | 5962 | // using PHP_OS is the last choice for detection. |
5959 | 5963 | $os = PHP_OS; |
@@ -6017,12 +6021,10 @@ discard block |
||
6017 | 6021 | if ($delta_width > $delta_height) { |
6018 | 6022 | $result['width'] = ceil($image_width * $resize_factor_height); |
6019 | 6023 | $result['height'] = ceil($image_height * $resize_factor_height); |
6020 | - } |
|
6021 | - elseif ($delta_width < $delta_height) { |
|
6024 | + } elseif ($delta_width < $delta_height) { |
|
6022 | 6025 | $result['width'] = ceil($image_width * $resize_factor_width); |
6023 | 6026 | $result['height'] = ceil($image_height * $resize_factor_width); |
6024 | - } |
|
6025 | - else { |
|
6027 | + } else { |
|
6026 | 6028 | $result['width'] = ceil($target_width); |
6027 | 6029 | $result['height'] = ceil($target_height); |
6028 | 6030 | } |
@@ -6800,7 +6802,9 @@ discard block |
||
6800 | 6802 | } |
6801 | 6803 | $ip = trim($ip1); |
6802 | 6804 | } |
6803 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6805 | + if (!empty($debug)) { |
|
6806 | + error_log('Real IP: '.$ip); |
|
6807 | + } |
|
6804 | 6808 | return $ip; |
6805 | 6809 | } |
6806 | 6810 |
@@ -207,7 +207,10 @@ discard block |
||
207 | 207 | |
208 | 208 | unset($Courses); |
209 | 209 | ?> |
210 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
210 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) { |
|
211 | + echo '&add=true' ; |
|
212 | +} |
|
213 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
211 | 214 | <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend> |
212 | 215 | <input type="hidden" name="formSent" value="1" /> |
213 | 216 | |
@@ -230,7 +233,10 @@ discard block |
||
230 | 233 | <div id="ajax_list_courses_multiple"> |
231 | 234 | <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control"> |
232 | 235 | <?php foreach ($nosessionCourses as $enreg) { ?> |
233 | - <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>> |
|
236 | + <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) { |
|
237 | + echo 'selected="selected"'; |
|
238 | +} |
|
239 | +?>> |
|
234 | 240 | <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?> |
235 | 241 | </option> |
236 | 242 | <?php } ?> |
@@ -3948,8 +3948,9 @@ discard block |
||
3948 | 3948 | WHERE c_id = ".$course_id." |
3949 | 3949 | ORDER BY display_order"; |
3950 | 3950 | $res = Database::query($sql); |
3951 | - if ($res === false) |
|
3952 | - return false; |
|
3951 | + if ($res === false) { |
|
3952 | + return false; |
|
3953 | + } |
|
3953 | 3954 | $lps = array (); |
3954 | 3955 | $lp_order = array (); |
3955 | 3956 | $num = Database :: num_rows($res); |
@@ -4549,8 +4550,9 @@ discard block |
||
4549 | 4550 | if ($this->debug > 0) { |
4550 | 4551 | error_log('New LP - In learnpath::set_maker()', 0); |
4551 | 4552 | } |
4552 | - if (empty ($name)) |
|
4553 | - return false; |
|
4553 | + if (empty ($name)) { |
|
4554 | + return false; |
|
4555 | + } |
|
4554 | 4556 | $this->maker = $name; |
4555 | 4557 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4556 | 4558 | $course_id = api_get_course_int_id(); |
@@ -4615,8 +4617,9 @@ discard block |
||
4615 | 4617 | public function set_terms_by_prefix($terms_string, $prefix) |
4616 | 4618 | { |
4617 | 4619 | $course_id = api_get_course_int_id(); |
4618 | - if (api_get_setting('search_enabled') !== 'true') |
|
4619 | - return false; |
|
4620 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4621 | + return false; |
|
4622 | + } |
|
4620 | 4623 | |
4621 | 4624 | if (!extension_loaded('xapian')) { |
4622 | 4625 | return false; |
@@ -4629,8 +4632,9 @@ discard block |
||
4629 | 4632 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4630 | 4633 | |
4631 | 4634 | // Don't do anything if no change, verify only at DB, not the search engine. |
4632 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4633 | - return false; |
|
4635 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4636 | + return false; |
|
4637 | + } |
|
4634 | 4638 | |
4635 | 4639 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4636 | 4640 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4822,8 +4826,9 @@ discard block |
||
4822 | 4826 | if ($this->debug > 0) { |
4823 | 4827 | error_log('New LP - In learnpath::set_proximity()', 0); |
4824 | 4828 | } |
4825 | - if (empty ($name)) |
|
4826 | - return false; |
|
4829 | + if (empty ($name)) { |
|
4830 | + return false; |
|
4831 | + } |
|
4827 | 4832 | |
4828 | 4833 | $this->proximity = $name; |
4829 | 4834 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5165,8 +5170,9 @@ discard block |
||
5165 | 5170 | |
5166 | 5171 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5167 | 5172 | $res = Database::query($sql); |
5168 | - if ($res === false) |
|
5169 | - return false; |
|
5173 | + if ($res === false) { |
|
5174 | + return false; |
|
5175 | + } |
|
5170 | 5176 | |
5171 | 5177 | $num = Database :: num_rows($res); |
5172 | 5178 | // First check the order is correct, globally (might be wrong because |
@@ -5477,8 +5483,9 @@ discard block |
||
5477 | 5483 | $position[$key] = $row['display_order']; |
5478 | 5484 | } |
5479 | 5485 | |
5480 | - if (count($array) > 0) |
|
5481 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5486 | + if (count($array) > 0) { |
|
5487 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5488 | + } |
|
5482 | 5489 | |
5483 | 5490 | return $array; |
5484 | 5491 | } |
@@ -6043,8 +6050,9 @@ discard block |
||
6043 | 6050 | $tmp_filename = $filename; |
6044 | 6051 | |
6045 | 6052 | $i = 0; |
6046 | - while (file_exists($filepath . $tmp_filename . '.'.$extension)) |
|
6047 | - $tmp_filename = $filename . '_' . ++ $i; |
|
6053 | + while (file_exists($filepath . $tmp_filename . '.'.$extension)) { |
|
6054 | + $tmp_filename = $filename . '_' . ++ $i; |
|
6055 | + } |
|
6048 | 6056 | |
6049 | 6057 | $filename = $tmp_filename . '.'.$extension; |
6050 | 6058 | if ($extension == 'html') { |
@@ -6123,10 +6131,12 @@ discard block |
||
6123 | 6131 | if ($new_comment || $new_title) { |
6124 | 6132 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6125 | 6133 | $ct = ''; |
6126 | - if ($new_comment) |
|
6127 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6128 | - if ($new_title) |
|
6129 | - $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
6134 | + if ($new_comment) { |
|
6135 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6136 | + } |
|
6137 | + if ($new_title) { |
|
6138 | + $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
6139 | + } |
|
6130 | 6140 | |
6131 | 6141 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6132 | 6142 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6150,17 +6160,21 @@ discard block |
||
6150 | 6160 | // Please, do not modify this dirname formatting. |
6151 | 6161 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6152 | 6162 | |
6153 | - if (strstr($dir, '..')) |
|
6154 | - $dir = '/'; |
|
6163 | + if (strstr($dir, '..')) { |
|
6164 | + $dir = '/'; |
|
6165 | + } |
|
6155 | 6166 | |
6156 | - if ($dir[0] == '.') |
|
6157 | - $dir = substr($dir, 1); |
|
6167 | + if ($dir[0] == '.') { |
|
6168 | + $dir = substr($dir, 1); |
|
6169 | + } |
|
6158 | 6170 | |
6159 | - if ($dir[0] != '/') |
|
6160 | - $dir = '/' . $dir; |
|
6171 | + if ($dir[0] != '/') { |
|
6172 | + $dir = '/' . $dir; |
|
6173 | + } |
|
6161 | 6174 | |
6162 | - if ($dir[strlen($dir) - 1] != '/') |
|
6163 | - $dir .= '/'; |
|
6175 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6176 | + $dir .= '/'; |
|
6177 | + } |
|
6164 | 6178 | |
6165 | 6179 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6166 | 6180 | |
@@ -6225,8 +6239,9 @@ discard block |
||
6225 | 6239 | } |
6226 | 6240 | $return .= '<div style="padding:10px;">'; |
6227 | 6241 | |
6228 | - if ($msg != '') |
|
6229 | - $return .= $msg; |
|
6242 | + if ($msg != '') { |
|
6243 | + $return .= $msg; |
|
6244 | + } |
|
6230 | 6245 | |
6231 | 6246 | $return .= '<h3>'.$row['title'].'</h3>'; |
6232 | 6247 | switch ($row['item_type']) { |
@@ -6491,10 +6506,11 @@ discard block |
||
6491 | 6506 | $item_title = Security::remove_XSS($item_title); |
6492 | 6507 | $item_description = Security::remove_XSS($item_description); |
6493 | 6508 | |
6494 | - if ($id != 0 && is_array($extra_info)) |
|
6495 | - $parent = $extra_info['parent_item_id']; |
|
6496 | - else |
|
6497 | - $parent = 0; |
|
6509 | + if ($id != 0 && is_array($extra_info)) { |
|
6510 | + $parent = $extra_info['parent_item_id']; |
|
6511 | + } else { |
|
6512 | + $parent = 0; |
|
6513 | + } |
|
6498 | 6514 | |
6499 | 6515 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6500 | 6516 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6767,11 +6783,13 @@ discard block |
||
6767 | 6783 | } |
6768 | 6784 | |
6769 | 6785 | $legend = '<legend>'; |
6770 | - if ($action == 'add') |
|
6771 | - $legend .= get_lang('CreateTheExercise'); |
|
6772 | - elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise'); |
|
6773 | - else |
|
6774 | - $legend .= get_lang('EditCurrentExecice'); |
|
6786 | + if ($action == 'add') { |
|
6787 | + $legend .= get_lang('CreateTheExercise'); |
|
6788 | + } elseif ($action == 'move') { |
|
6789 | + $legend .= get_lang('MoveTheCurrentExercise'); |
|
6790 | + } else { |
|
6791 | + $legend .= get_lang('EditCurrentExecice'); |
|
6792 | + } |
|
6775 | 6793 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
6776 | 6794 | $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
6777 | 6795 | } |
@@ -6798,8 +6816,9 @@ discard block |
||
6798 | 6816 | $arrHide[] = $arrLP[$i]['id']; |
6799 | 6817 | } |
6800 | 6818 | } else { |
6801 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
6802 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6819 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
6820 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6821 | + } |
|
6803 | 6822 | } |
6804 | 6823 | } |
6805 | 6824 | |
@@ -6817,11 +6836,13 @@ discard block |
||
6817 | 6836 | |
6818 | 6837 | for ($i = 0; $i < count($arrLP); $i++) { |
6819 | 6838 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6820 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6839 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6840 | + $selected = 'selected="selected" '; |
|
6841 | + } elseif ($action == 'add') { |
|
6821 | 6842 | $selected = 'selected="selected" '; |
6822 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6823 | - else |
|
6824 | - $selected = ''; |
|
6843 | + } else { |
|
6844 | + $selected = ''; |
|
6845 | + } |
|
6825 | 6846 | |
6826 | 6847 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6827 | 6848 | } |
@@ -6848,9 +6869,11 @@ discard block |
||
6848 | 6869 | $arrHide = array (); |
6849 | 6870 | for ($i = 0; $i < count($arrLP); $i++) { |
6850 | 6871 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
6851 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6852 | - $s_selected_position = $arrLP[$i]['id']; |
|
6853 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6872 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6873 | + $s_selected_position = $arrLP[$i]['id']; |
|
6874 | + } elseif ($action == 'add') { |
|
6875 | + $s_selected_position = 0; |
|
6876 | + } |
|
6854 | 6877 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6855 | 6878 | |
6856 | 6879 | } |
@@ -7047,9 +7070,11 @@ discard block |
||
7047 | 7070 | $arrHide = array(); |
7048 | 7071 | for ($i = 0; $i < count($arrLP); $i++) { |
7049 | 7072 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7050 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7051 | - $s_selected_position = $arrLP[$i]['id']; |
|
7052 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7073 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7074 | + $s_selected_position = $arrLP[$i]['id']; |
|
7075 | + } elseif ($action == 'add') { |
|
7076 | + $s_selected_position = 0; |
|
7077 | + } |
|
7053 | 7078 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7054 | 7079 | } |
7055 | 7080 | } |
@@ -7252,9 +7277,11 @@ discard block |
||
7252 | 7277 | |
7253 | 7278 | for ($i = 0; $i < count($arrLP); $i++) { |
7254 | 7279 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7255 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7256 | - $s_selected_position = $arrLP[$i]['id']; |
|
7257 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7280 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7281 | + $s_selected_position = $arrLP[$i]['id']; |
|
7282 | + } elseif ($action == 'add') { |
|
7283 | + $s_selected_position = 0; |
|
7284 | + } |
|
7258 | 7285 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7259 | 7286 | |
7260 | 7287 | } |
@@ -7288,8 +7315,7 @@ discard block |
||
7288 | 7315 | |
7289 | 7316 | if (is_numeric($extra_info)) { |
7290 | 7317 | $form->addHidden('path', $extra_info); |
7291 | - } |
|
7292 | - elseif (is_array($extra_info)) { |
|
7318 | + } elseif (is_array($extra_info)) { |
|
7293 | 7319 | $form->addHidden('path', $extra_info['path']); |
7294 | 7320 | } |
7295 | 7321 | |
@@ -7342,8 +7368,9 @@ discard block |
||
7342 | 7368 | lp_id = " . $this->lp_id . " AND |
7343 | 7369 | id != $id"; |
7344 | 7370 | |
7345 | - if ($item_type == 'module') |
|
7346 | - $sql .= " AND parent_item_id = 0"; |
|
7371 | + if ($item_type == 'module') { |
|
7372 | + $sql .= " AND parent_item_id = 0"; |
|
7373 | + } |
|
7347 | 7374 | |
7348 | 7375 | $result = Database::query($sql); |
7349 | 7376 | $arrLP = array (); |
@@ -7729,9 +7756,11 @@ discard block |
||
7729 | 7756 | |
7730 | 7757 | for ($i = 0; $i < count($arrLP); $i++) { |
7731 | 7758 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
7732 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7759 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7760 | + $s_selected_position = $arrLP[$i]['id']; |
|
7761 | + } elseif ($action == 'add') { |
|
7733 | 7762 | $s_selected_position = $arrLP[$i]['id']; |
7734 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7763 | + } |
|
7735 | 7764 | |
7736 | 7765 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7737 | 7766 | |
@@ -7742,17 +7771,18 @@ discard block |
||
7742 | 7771 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7743 | 7772 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7744 | 7773 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
7745 | - if (isset ($_POST['content'])) |
|
7746 | - $content = stripslashes($_POST['content']); |
|
7747 | - elseif (is_array($extra_info)) { |
|
7774 | + if (isset ($_POST['content'])) { |
|
7775 | + $content = stripslashes($_POST['content']); |
|
7776 | + } elseif (is_array($extra_info)) { |
|
7748 | 7777 | //If it's an html document or a text file |
7749 | 7778 | if (!$no_display_edit_textarea) { |
7750 | 7779 | $content = $this->display_document($extra_info['path'], false, false); |
7751 | 7780 | } |
7752 | - } elseif (is_numeric($extra_info)) |
|
7753 | - $content = $this->display_document($extra_info, false, false); |
|
7754 | - else |
|
7755 | - $content = ''; |
|
7781 | + } elseif (is_numeric($extra_info)) { |
|
7782 | + $content = $this->display_document($extra_info, false, false); |
|
7783 | + } else { |
|
7784 | + $content = ''; |
|
7785 | + } |
|
7756 | 7786 | |
7757 | 7787 | if (!$no_display_edit_textarea) { |
7758 | 7788 | // We need to calculate here some specific settings for the online editor. |
@@ -8020,9 +8050,11 @@ discard block |
||
8020 | 8050 | $arrHide = array(); |
8021 | 8051 | for ($i = 0; $i < count($arrLP); $i++) { |
8022 | 8052 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
8023 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8024 | - $s_selected_position = $arrLP[$i]['id']; |
|
8025 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8053 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8054 | + $s_selected_position = $arrLP[$i]['id']; |
|
8055 | + } elseif ($action == 'add') { |
|
8056 | + $s_selected_position = 0; |
|
8057 | + } |
|
8026 | 8058 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8027 | 8059 | |
8028 | 8060 | } |
@@ -8225,9 +8257,11 @@ discard block |
||
8225 | 8257 | $arrHide = array (); |
8226 | 8258 | for ($i = 0; $i < count($arrLP); $i++) { |
8227 | 8259 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
8228 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8229 | - $s_selected_position = $arrLP[$i]['id']; |
|
8230 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8260 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8261 | + $s_selected_position = $arrLP[$i]['id']; |
|
8262 | + } elseif ($action == 'add') { |
|
8263 | + $s_selected_position = 0; |
|
8264 | + } |
|
8231 | 8265 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8232 | 8266 | |
8233 | 8267 | } |
@@ -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 |