@@ -32,8 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | if ($this->form_type == self :: TYPE_USER_INFO) { |
34 | 34 | $this->build_user_info_form(); |
35 | - } |
|
36 | - elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) { |
|
35 | + } elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) { |
|
37 | 36 | $this->build_simple_search(); |
38 | 37 | } |
39 | 38 | $this->setDefaults(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // sort users array |
96 | 96 | if ($sorting & self :: UDG_SORT_TYPE) { |
97 | 97 | usort($allitems, array('UserDataGenerator', 'sort_by_type')); |
98 | - }elseif ($sorting & self :: UDG_SORT_NAME) { |
|
98 | + } elseif ($sorting & self :: UDG_SORT_NAME) { |
|
99 | 99 | usort($allitems, array('UserDataGenerator', 'sort_by_name')); |
100 | 100 | } elseif ($sorting & self :: UDG_SORT_COURSE) { |
101 | 101 | usort($allitems, array('UserDataGenerator', 'sort_by_course')); |
@@ -148,8 +148,9 @@ discard block |
||
148 | 148 | $row[] = $this->build_category_name($item); |
149 | 149 | $row[] = $this->build_average_column($item, $ignore_score_color); |
150 | 150 | $row[] = $this->build_result_column($item, $ignore_score_color); |
151 | - if ($scoredisplay->is_custom()) |
|
152 | - $row[] = $this->build_mask_column($item, $ignore_score_color); |
|
151 | + if ($scoredisplay->is_custom()) { |
|
152 | + $row[] = $this->build_mask_column($item, $ignore_score_color); |
|
153 | + } |
|
153 | 154 | $data[] = $row; |
154 | 155 | } |
155 | 156 | return $data; |
@@ -496,13 +496,19 @@ |
||
496 | 496 | $id = intval($id); |
497 | 497 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
498 | 498 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
499 | - if (!Database::query($sql)) return false; |
|
499 | + if (!Database::query($sql)) { |
|
500 | + return false; |
|
501 | + } |
|
500 | 502 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
501 | 503 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
502 | - if (!Database::query($sql)) return false; |
|
504 | + if (!Database::query($sql)) { |
|
505 | + return false; |
|
506 | + } |
|
503 | 507 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
504 | 508 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
505 | - if (!Database::query($sql)) return false; |
|
509 | + if (!Database::query($sql)) { |
|
510 | + return false; |
|
511 | + } |
|
506 | 512 | return true; |
507 | 513 | } |
508 | 514 |
@@ -750,10 +750,15 @@ |
||
750 | 750 | "; |
751 | 751 | $result = Database::query($sql); |
752 | 752 | |
753 | - if (!($res = Database::fetch_array($result))) |
|
754 | - die(get_lang('GeneralError').' (code 901)'); |
|
755 | - if ($owner == 0) return $res['uploader_id']; |
|
756 | - if ($res['uploader_id'] == $owner) return true; |
|
753 | + if (!($res = Database::fetch_array($result))) { |
|
754 | + die(get_lang('GeneralError').' (code 901)'); |
|
755 | + } |
|
756 | + if ($owner == 0) { |
|
757 | + return $res['uploader_id']; |
|
758 | + } |
|
759 | + if ($res['uploader_id'] == $owner) { |
|
760 | + return true; |
|
761 | + } |
|
757 | 762 | die(get_lang('GeneralError').' (code '.$or_die.')'); |
758 | 763 | } |
759 | 764 |
@@ -3938,8 +3938,9 @@ discard block |
||
3938 | 3938 | WHERE c_id = ".$course_id." |
3939 | 3939 | ORDER BY display_order"; |
3940 | 3940 | $res = Database::query($sql); |
3941 | - if ($res === false) |
|
3942 | - return false; |
|
3941 | + if ($res === false) { |
|
3942 | + return false; |
|
3943 | + } |
|
3943 | 3944 | $lps = array (); |
3944 | 3945 | $lp_order = array (); |
3945 | 3946 | $num = Database :: num_rows($res); |
@@ -4539,8 +4540,9 @@ discard block |
||
4539 | 4540 | if ($this->debug > 0) { |
4540 | 4541 | error_log('New LP - In learnpath::set_maker()', 0); |
4541 | 4542 | } |
4542 | - if (empty ($name)) |
|
4543 | - return false; |
|
4543 | + if (empty ($name)) { |
|
4544 | + return false; |
|
4545 | + } |
|
4544 | 4546 | $this->maker = $name; |
4545 | 4547 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4546 | 4548 | $course_id = api_get_course_int_id(); |
@@ -4605,8 +4607,9 @@ discard block |
||
4605 | 4607 | public function set_terms_by_prefix($terms_string, $prefix) |
4606 | 4608 | { |
4607 | 4609 | $course_id = api_get_course_int_id(); |
4608 | - if (api_get_setting('search_enabled') !== 'true') |
|
4609 | - return false; |
|
4610 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4611 | + return false; |
|
4612 | + } |
|
4610 | 4613 | |
4611 | 4614 | if (!extension_loaded('xapian')) { |
4612 | 4615 | return false; |
@@ -4619,8 +4622,9 @@ discard block |
||
4619 | 4622 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4620 | 4623 | |
4621 | 4624 | // Don't do anything if no change, verify only at DB, not the search engine. |
4622 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4623 | - return false; |
|
4625 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4626 | + return false; |
|
4627 | + } |
|
4624 | 4628 | |
4625 | 4629 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4626 | 4630 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4812,8 +4816,9 @@ discard block |
||
4812 | 4816 | if ($this->debug > 0) { |
4813 | 4817 | error_log('New LP - In learnpath::set_proximity()', 0); |
4814 | 4818 | } |
4815 | - if (empty ($name)) |
|
4816 | - return false; |
|
4819 | + if (empty ($name)) { |
|
4820 | + return false; |
|
4821 | + } |
|
4817 | 4822 | |
4818 | 4823 | $this->proximity = $name; |
4819 | 4824 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5157,8 +5162,9 @@ discard block |
||
5157 | 5162 | |
5158 | 5163 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5159 | 5164 | $res = Database::query($sql); |
5160 | - if ($res === false) |
|
5161 | - return false; |
|
5165 | + if ($res === false) { |
|
5166 | + return false; |
|
5167 | + } |
|
5162 | 5168 | |
5163 | 5169 | $num = Database :: num_rows($res); |
5164 | 5170 | // First check the order is correct, globally (might be wrong because |
@@ -5469,8 +5475,9 @@ discard block |
||
5469 | 5475 | $position[$key] = $row['display_order']; |
5470 | 5476 | } |
5471 | 5477 | |
5472 | - if (count($array) > 0) |
|
5473 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5478 | + if (count($array) > 0) { |
|
5479 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5480 | + } |
|
5474 | 5481 | |
5475 | 5482 | return $array; |
5476 | 5483 | } |
@@ -6242,10 +6249,12 @@ discard block |
||
6242 | 6249 | if ($new_comment || $new_title) { |
6243 | 6250 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6244 | 6251 | $ct = ''; |
6245 | - if ($new_comment) |
|
6246 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6247 | - if ($new_title) |
|
6248 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6252 | + if ($new_comment) { |
|
6253 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6254 | + } |
|
6255 | + if ($new_title) { |
|
6256 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6257 | + } |
|
6249 | 6258 | |
6250 | 6259 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6251 | 6260 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6269,17 +6278,21 @@ discard block |
||
6269 | 6278 | // Please, do not modify this dirname formatting. |
6270 | 6279 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6271 | 6280 | |
6272 | - if (strstr($dir, '..')) |
|
6273 | - $dir = '/'; |
|
6281 | + if (strstr($dir, '..')) { |
|
6282 | + $dir = '/'; |
|
6283 | + } |
|
6274 | 6284 | |
6275 | - if ($dir[0] == '.') |
|
6276 | - $dir = substr($dir, 1); |
|
6285 | + if ($dir[0] == '.') { |
|
6286 | + $dir = substr($dir, 1); |
|
6287 | + } |
|
6277 | 6288 | |
6278 | - if ($dir[0] != '/') |
|
6279 | - $dir = '/' . $dir; |
|
6289 | + if ($dir[0] != '/') { |
|
6290 | + $dir = '/' . $dir; |
|
6291 | + } |
|
6280 | 6292 | |
6281 | - if ($dir[strlen($dir) - 1] != '/') |
|
6282 | - $dir .= '/'; |
|
6293 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6294 | + $dir .= '/'; |
|
6295 | + } |
|
6283 | 6296 | |
6284 | 6297 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6285 | 6298 | |
@@ -6344,8 +6357,9 @@ discard block |
||
6344 | 6357 | } |
6345 | 6358 | $return .= '<div style="padding:10px;">'; |
6346 | 6359 | |
6347 | - if ($msg != '') |
|
6348 | - $return .= $msg; |
|
6360 | + if ($msg != '') { |
|
6361 | + $return .= $msg; |
|
6362 | + } |
|
6349 | 6363 | |
6350 | 6364 | $return .= '<h3>'.$row['title'].'</h3>'; |
6351 | 6365 | switch ($row['item_type']) { |
@@ -6606,10 +6620,11 @@ discard block |
||
6606 | 6620 | $item_title = Security::remove_XSS($item_title); |
6607 | 6621 | $item_description = Security::remove_XSS($item_description); |
6608 | 6622 | |
6609 | - if ($id != 0 && is_array($extra_info)) |
|
6610 | - $parent = $extra_info['parent_item_id']; |
|
6611 | - else |
|
6612 | - $parent = 0; |
|
6623 | + if ($id != 0 && is_array($extra_info)) { |
|
6624 | + $parent = $extra_info['parent_item_id']; |
|
6625 | + } else { |
|
6626 | + $parent = 0; |
|
6627 | + } |
|
6613 | 6628 | |
6614 | 6629 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6615 | 6630 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6909,8 +6924,9 @@ discard block |
||
6909 | 6924 | $arrHide[] = $arrLP[$i]['id']; |
6910 | 6925 | } |
6911 | 6926 | } else { |
6912 | - if ($arrLP[$i]['item_type'] == 'dir') |
|
6913 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6927 | + if ($arrLP[$i]['item_type'] == 'dir') { |
|
6928 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6929 | + } |
|
6914 | 6930 | } |
6915 | 6931 | } |
6916 | 6932 | |
@@ -6928,11 +6944,13 @@ discard block |
||
6928 | 6944 | |
6929 | 6945 | for ($i = 0; $i < count($arrLP); $i++) { |
6930 | 6946 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6931 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6947 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6948 | + $selected = 'selected="selected" '; |
|
6949 | + } elseif ($action == 'add') { |
|
6932 | 6950 | $selected = 'selected="selected" '; |
6933 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6934 | - else |
|
6935 | - $selected = ''; |
|
6951 | + } else { |
|
6952 | + $selected = ''; |
|
6953 | + } |
|
6936 | 6954 | |
6937 | 6955 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6938 | 6956 | } |
@@ -6959,9 +6977,11 @@ discard block |
||
6959 | 6977 | $arrHide = array (); |
6960 | 6978 | for ($i = 0; $i < count($arrLP); $i++) { |
6961 | 6979 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6962 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6963 | - $s_selected_position = $arrLP[$i]['id']; |
|
6964 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6980 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6981 | + $s_selected_position = $arrLP[$i]['id']; |
|
6982 | + } elseif ($action == 'add') { |
|
6983 | + $s_selected_position = 0; |
|
6984 | + } |
|
6965 | 6985 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6966 | 6986 | } |
6967 | 6987 | } |
@@ -7153,9 +7173,11 @@ discard block |
||
7153 | 7173 | $arrHide = array(); |
7154 | 7174 | for ($i = 0; $i < count($arrLP); $i++) { |
7155 | 7175 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7156 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7157 | - $s_selected_position = $arrLP[$i]['id']; |
|
7158 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7176 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7177 | + $s_selected_position = $arrLP[$i]['id']; |
|
7178 | + } elseif ($action == 'add') { |
|
7179 | + $s_selected_position = 0; |
|
7180 | + } |
|
7159 | 7181 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7160 | 7182 | } |
7161 | 7183 | } |
@@ -7350,9 +7372,11 @@ discard block |
||
7350 | 7372 | |
7351 | 7373 | for ($i = 0; $i < count($arrLP); $i++) { |
7352 | 7374 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7353 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7354 | - $s_selected_position = $arrLP[$i]['id']; |
|
7355 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7375 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7376 | + $s_selected_position = $arrLP[$i]['id']; |
|
7377 | + } elseif ($action == 'add') { |
|
7378 | + $s_selected_position = 0; |
|
7379 | + } |
|
7356 | 7380 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7357 | 7381 | |
7358 | 7382 | } |
@@ -7386,8 +7410,7 @@ discard block |
||
7386 | 7410 | |
7387 | 7411 | if (is_numeric($extra_info)) { |
7388 | 7412 | $form->addHidden('path', $extra_info); |
7389 | - } |
|
7390 | - elseif (is_array($extra_info)) { |
|
7413 | + } elseif (is_array($extra_info)) { |
|
7391 | 7414 | $form->addHidden('path', $extra_info['path']); |
7392 | 7415 | } |
7393 | 7416 | |
@@ -7440,8 +7463,9 @@ discard block |
||
7440 | 7463 | lp_id = " . $this->lp_id . " AND |
7441 | 7464 | id != $id"; |
7442 | 7465 | |
7443 | - if ($item_type == 'dir') |
|
7444 | - $sql .= " AND parent_item_id = 0"; |
|
7466 | + if ($item_type == 'dir') { |
|
7467 | + $sql .= " AND parent_item_id = 0"; |
|
7468 | + } |
|
7445 | 7469 | |
7446 | 7470 | $result = Database::query($sql); |
7447 | 7471 | $arrLP = array (); |
@@ -7842,9 +7866,11 @@ discard block |
||
7842 | 7866 | $arrHide = array(); |
7843 | 7867 | for ($i = 0; $i < count($arrLP); $i++) { |
7844 | 7868 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
7845 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7869 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7870 | + $s_selected_position = $arrLP[$i]['id']; |
|
7871 | + } elseif ($action == 'add') { |
|
7846 | 7872 | $s_selected_position = $arrLP[$i]['id']; |
7847 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7873 | + } |
|
7848 | 7874 | |
7849 | 7875 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7850 | 7876 | |
@@ -7855,17 +7881,18 @@ discard block |
||
7855 | 7881 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7856 | 7882 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7857 | 7883 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
7858 | - if (isset ($_POST['content'])) |
|
7859 | - $content = stripslashes($_POST['content']); |
|
7860 | - elseif (is_array($extra_info)) { |
|
7884 | + if (isset ($_POST['content'])) { |
|
7885 | + $content = stripslashes($_POST['content']); |
|
7886 | + } elseif (is_array($extra_info)) { |
|
7861 | 7887 | //If it's an html document or a text file |
7862 | 7888 | if (!$no_display_edit_textarea) { |
7863 | 7889 | $content = $this->display_document($extra_info['path'], false, false); |
7864 | 7890 | } |
7865 | - } elseif (is_numeric($extra_info)) |
|
7866 | - $content = $this->display_document($extra_info, false, false); |
|
7867 | - else |
|
7868 | - $content = ''; |
|
7891 | + } elseif (is_numeric($extra_info)) { |
|
7892 | + $content = $this->display_document($extra_info, false, false); |
|
7893 | + } else { |
|
7894 | + $content = ''; |
|
7895 | + } |
|
7869 | 7896 | |
7870 | 7897 | if (!$no_display_edit_textarea) { |
7871 | 7898 | // We need to calculate here some specific settings for the online editor. |
@@ -8129,9 +8156,11 @@ discard block |
||
8129 | 8156 | $arrHide = array(); |
8130 | 8157 | for ($i = 0; $i < count($arrLP); $i++) { |
8131 | 8158 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8132 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8133 | - $s_selected_position = $arrLP[$i]['id']; |
|
8134 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8159 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8160 | + $s_selected_position = $arrLP[$i]['id']; |
|
8161 | + } elseif ($action == 'add') { |
|
8162 | + $s_selected_position = 0; |
|
8163 | + } |
|
8135 | 8164 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8136 | 8165 | |
8137 | 8166 | } |
@@ -8327,9 +8356,11 @@ discard block |
||
8327 | 8356 | $arrHide = array (); |
8328 | 8357 | for ($i = 0; $i < count($arrLP); $i++) { |
8329 | 8358 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8330 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8331 | - $s_selected_position = $arrLP[$i]['id']; |
|
8332 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8359 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8360 | + $s_selected_position = $arrLP[$i]['id']; |
|
8361 | + } elseif ($action == 'add') { |
|
8362 | + $s_selected_position = 0; |
|
8363 | + } |
|
8333 | 8364 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8334 | 8365 | |
8335 | 8366 | } |
@@ -9381,10 +9412,11 @@ discard block |
||
9381 | 9412 | |
9382 | 9413 | // Dependency to other files - not yet supported. |
9383 | 9414 | $i = 1; |
9384 | - if ($inc_docs) |
|
9385 | - foreach ($inc_docs as $doc_info) { |
|
9415 | + if ($inc_docs) { |
|
9416 | + foreach ($inc_docs as $doc_info) { |
|
9386 | 9417 | if (count($doc_info) < 1 || empty($doc_info[0])) { |
9387 | 9418 | continue; |
9419 | + } |
|
9388 | 9420 | } |
9389 | 9421 | $my_dep = $xmldoc->createElement('resource'); |
9390 | 9422 | $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; |
@@ -1604,8 +1604,10 @@ discard block |
||
1604 | 1604 | if (empty($session_visibility)) { |
1605 | 1605 | $session_visibility = $session->getVisibility(); |
1606 | 1606 | //default status loaded if empty |
1607 | - if (empty($session_visibility)) |
|
1608 | - $session_visibility = SESSION_VISIBLE_READ_ONLY; // by default readonly 1 |
|
1607 | + if (empty($session_visibility)) { |
|
1608 | + $session_visibility = SESSION_VISIBLE_READ_ONLY; |
|
1609 | + } |
|
1610 | + // by default readonly 1 |
|
1609 | 1611 | } else { |
1610 | 1612 | if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) { |
1611 | 1613 | $session_visibility = SESSION_VISIBLE_READ_ONLY; |
@@ -2819,10 +2821,11 @@ discard block |
||
2819 | 2821 | c_id = $courseId AND |
2820 | 2822 | user_id = $user_id "; |
2821 | 2823 | $result = Database::query($sql); |
2822 | - if (Database::affected_rows($result) > 0) |
|
2823 | - return true; |
|
2824 | - else |
|
2825 | - return false; |
|
2824 | + if (Database::affected_rows($result) > 0) { |
|
2825 | + return true; |
|
2826 | + } else { |
|
2827 | + return false; |
|
2828 | + } |
|
2826 | 2829 | } else { |
2827 | 2830 | // The user is not subscribed to the session, so make sure |
2828 | 2831 | // he isn't subscribed to a course in this session either |
@@ -84,7 +84,12 @@ discard block |
||
84 | 84 | <div class="form-group"> |
85 | 85 | <label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label> |
86 | 86 | <div class="col-sm-6"> |
87 | - <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>"> |
|
87 | + <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) { |
|
88 | + echo api_htmlentities($name,ENT_QUOTES,$charset); |
|
89 | +} else { |
|
90 | + echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); |
|
91 | +} |
|
92 | +?>"> |
|
88 | 93 | </div> |
89 | 94 | <div class="col-sm-3"></div> |
90 | 95 | </div> |
@@ -100,58 +105,184 @@ discard block |
||
100 | 105 | <div class="col-sm-6"> |
101 | 106 | <select name="day_start"> |
102 | 107 | <option value="1">01</option> |
103 | - <option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
104 | - <option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
105 | - <option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
106 | - <option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
107 | - <option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
108 | - <option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
109 | - <option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
110 | - <option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
111 | - <option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
112 | - <option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
113 | - <option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
114 | - <option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option> |
|
115 | - <option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option> |
|
116 | - <option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option> |
|
117 | - <option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option> |
|
118 | - <option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option> |
|
119 | - <option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option> |
|
120 | - <option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option> |
|
121 | - <option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option> |
|
122 | - <option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option> |
|
123 | - <option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option> |
|
124 | - <option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option> |
|
125 | - <option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option> |
|
126 | - <option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option> |
|
127 | - <option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option> |
|
128 | - <option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option> |
|
129 | - <option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option> |
|
130 | - <option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option> |
|
131 | - <option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option> |
|
132 | - <option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option> |
|
108 | + <option value="2" <?php if($day_start == 2) { |
|
109 | + echo 'selected="selected"'; |
|
110 | +} |
|
111 | +?> >02</option> |
|
112 | + <option value="3" <?php if($day_start == 3) { |
|
113 | + echo 'selected="selected"'; |
|
114 | +} |
|
115 | +?> >03</option> |
|
116 | + <option value="4" <?php if($day_start == 4) { |
|
117 | + echo 'selected="selected"'; |
|
118 | +} |
|
119 | +?> >04</option> |
|
120 | + <option value="5" <?php if($day_start == 5) { |
|
121 | + echo 'selected="selected"'; |
|
122 | +} |
|
123 | +?> >05</option> |
|
124 | + <option value="6" <?php if($day_start == 6) { |
|
125 | + echo 'selected="selected"'; |
|
126 | +} |
|
127 | +?> >06</option> |
|
128 | + <option value="7" <?php if($day_start == 7) { |
|
129 | + echo 'selected="selected"'; |
|
130 | +} |
|
131 | +?> >07</option> |
|
132 | + <option value="8" <?php if($day_start == 8) { |
|
133 | + echo 'selected="selected"'; |
|
134 | +} |
|
135 | +?> >08</option> |
|
136 | + <option value="9" <?php if($day_start == 9) { |
|
137 | + echo 'selected="selected"'; |
|
138 | +} |
|
139 | +?> >09</option> |
|
140 | + <option value="10" <?php if($day_start == 10) { |
|
141 | + echo 'selected="selected"'; |
|
142 | +} |
|
143 | +?> >10</option> |
|
144 | + <option value="11" <?php if($day_start == 11) { |
|
145 | + echo 'selected="selected"'; |
|
146 | +} |
|
147 | +?> >11</option> |
|
148 | + <option value="12" <?php if($day_start == 12) { |
|
149 | + echo 'selected="selected"'; |
|
150 | +} |
|
151 | +?> >12</option> |
|
152 | + <option value="13" <?php if($day_start == 13) { |
|
153 | + echo 'selected="selected"'; |
|
154 | +} |
|
155 | +?> >13</option> |
|
156 | + <option value="14" <?php if($day_start == 14) { |
|
157 | + echo 'selected="selected"'; |
|
158 | +} |
|
159 | +?> >14</option> |
|
160 | + <option value="15" <?php if($day_start == 15) { |
|
161 | + echo 'selected="selected"'; |
|
162 | +} |
|
163 | +?> >15</option> |
|
164 | + <option value="16" <?php if($day_start == 16) { |
|
165 | + echo 'selected="selected"'; |
|
166 | +} |
|
167 | +?> >16</option> |
|
168 | + <option value="17" <?php if($day_start == 17) { |
|
169 | + echo 'selected="selected"'; |
|
170 | +} |
|
171 | +?> >17</option> |
|
172 | + <option value="18" <?php if($day_start == 18) { |
|
173 | + echo 'selected="selected"'; |
|
174 | +} |
|
175 | +?> >18</option> |
|
176 | + <option value="19" <?php if($day_start == 19) { |
|
177 | + echo 'selected="selected"'; |
|
178 | +} |
|
179 | +?> >19</option> |
|
180 | + <option value="20" <?php if($day_start == 20) { |
|
181 | + echo 'selected="selected"'; |
|
182 | +} |
|
183 | +?> >20</option> |
|
184 | + <option value="21" <?php if($day_start == 21) { |
|
185 | + echo 'selected="selected"'; |
|
186 | +} |
|
187 | +?> >21</option> |
|
188 | + <option value="22" <?php if($day_start == 22) { |
|
189 | + echo 'selected="selected"'; |
|
190 | +} |
|
191 | +?> >22</option> |
|
192 | + <option value="23" <?php if($day_start == 23) { |
|
193 | + echo 'selected="selected"'; |
|
194 | +} |
|
195 | +?> >23</option> |
|
196 | + <option value="24" <?php if($day_start == 24) { |
|
197 | + echo 'selected="selected"'; |
|
198 | +} |
|
199 | +?> >24</option> |
|
200 | + <option value="25" <?php if($day_start == 25) { |
|
201 | + echo 'selected="selected"'; |
|
202 | +} |
|
203 | +?> >25</option> |
|
204 | + <option value="26" <?php if($day_start == 26) { |
|
205 | + echo 'selected="selected"'; |
|
206 | +} |
|
207 | +?> >26</option> |
|
208 | + <option value="27" <?php if($day_start == 27) { |
|
209 | + echo 'selected="selected"'; |
|
210 | +} |
|
211 | +?> >27</option> |
|
212 | + <option value="28" <?php if($day_start == 28) { |
|
213 | + echo 'selected="selected"'; |
|
214 | +} |
|
215 | +?> >28</option> |
|
216 | + <option value="29" <?php if($day_start == 29) { |
|
217 | + echo 'selected="selected"'; |
|
218 | +} |
|
219 | +?> >29</option> |
|
220 | + <option value="30" <?php if($day_start == 30) { |
|
221 | + echo 'selected="selected"'; |
|
222 | +} |
|
223 | +?> >30</option> |
|
224 | + <option value="31" <?php if($day_start == 31) { |
|
225 | + echo 'selected="selected"'; |
|
226 | +} |
|
227 | +?> >31</option> |
|
133 | 228 | </select> |
134 | 229 | / |
135 | 230 | <select name="month_start"> |
136 | 231 | <option value="1">01</option> |
137 | - <option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
138 | - <option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
139 | - <option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
140 | - <option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
141 | - <option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
142 | - <option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
143 | - <option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
144 | - <option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
145 | - <option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
146 | - <option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
147 | - <option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
232 | + <option value="2" <?php if($month_start == 2) { |
|
233 | + echo 'selected="selected"'; |
|
234 | +} |
|
235 | +?> >02</option> |
|
236 | + <option value="3" <?php if($month_start == 3) { |
|
237 | + echo 'selected="selected"'; |
|
238 | +} |
|
239 | +?> >03</option> |
|
240 | + <option value="4" <?php if($month_start == 4) { |
|
241 | + echo 'selected="selected"'; |
|
242 | +} |
|
243 | +?> >04</option> |
|
244 | + <option value="5" <?php if($month_start == 5) { |
|
245 | + echo 'selected="selected"'; |
|
246 | +} |
|
247 | +?> >05</option> |
|
248 | + <option value="6" <?php if($month_start == 6) { |
|
249 | + echo 'selected="selected"'; |
|
250 | +} |
|
251 | +?> >06</option> |
|
252 | + <option value="7" <?php if($month_start == 7) { |
|
253 | + echo 'selected="selected"'; |
|
254 | +} |
|
255 | +?> >07</option> |
|
256 | + <option value="8" <?php if($month_start == 8) { |
|
257 | + echo 'selected="selected"'; |
|
258 | +} |
|
259 | +?> >08</option> |
|
260 | + <option value="9" <?php if($month_start == 9) { |
|
261 | + echo 'selected="selected"'; |
|
262 | +} |
|
263 | +?> >09</option> |
|
264 | + <option value="10" <?php if($month_start == 10) { |
|
265 | + echo 'selected="selected"'; |
|
266 | +} |
|
267 | +?> >10</option> |
|
268 | + <option value="11" <?php if($month_start == 11) { |
|
269 | + echo 'selected="selected"'; |
|
270 | +} |
|
271 | +?> >11</option> |
|
272 | + <option value="12" <?php if($month_start == 12) { |
|
273 | + echo 'selected="selected"'; |
|
274 | +} |
|
275 | +?> >12</option> |
|
148 | 276 | </select> |
149 | 277 | / |
150 | 278 | <select name="year_start"> |
151 | 279 | <?php |
152 | 280 | for($i=$thisYear-5;$i <= ($thisYear+5);$i++) |
153 | 281 | { ?> |
154 | - <option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
282 | + <option value="<?php echo $i; ?>" <?php if($year_start == $i) { |
|
283 | + echo 'selected="selected"'; |
|
284 | +} |
|
285 | +?> ><?php echo $i; ?></option> |
|
155 | 286 | <?php |
156 | 287 | } ?> |
157 | 288 | </select> |
@@ -163,53 +294,182 @@ discard block |
||
163 | 294 | <div class="col-sm-6"> |
164 | 295 | <select name="day_end"> |
165 | 296 | <option value="0">--</option> |
166 | - <option value="1" <?php if($day_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
167 | - <option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
168 | - <option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
169 | - <option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
170 | - <option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
171 | - <option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
172 | - <option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
173 | - <option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
174 | - <option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
175 | - <option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
176 | - <option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
177 | - <option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
178 | - <option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option> |
|
179 | - <option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option> |
|
180 | - <option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option> |
|
181 | - <option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option> |
|
182 | - <option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option> |
|
183 | - <option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option> |
|
184 | - <option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option> |
|
185 | - <option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option> |
|
186 | - <option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option> |
|
187 | - <option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option> |
|
188 | - <option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option> |
|
189 | - <option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option> |
|
190 | - <option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option> |
|
191 | - <option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option> |
|
192 | - <option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option> |
|
193 | - <option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option> |
|
194 | - <option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option> |
|
195 | - <option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option> |
|
196 | - <option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option> |
|
297 | + <option value="1" <?php if($day_end == 1) { |
|
298 | + echo 'selected="selected"'; |
|
299 | +} |
|
300 | +?> >01</option> |
|
301 | + <option value="2" <?php if($day_end == 2) { |
|
302 | + echo 'selected="selected"'; |
|
303 | +} |
|
304 | +?> >02</option> |
|
305 | + <option value="3" <?php if($day_end == 3) { |
|
306 | + echo 'selected="selected"'; |
|
307 | +} |
|
308 | +?> >03</option> |
|
309 | + <option value="4" <?php if($day_end == 4) { |
|
310 | + echo 'selected="selected"'; |
|
311 | +} |
|
312 | +?> >04</option> |
|
313 | + <option value="5" <?php if($day_end == 5) { |
|
314 | + echo 'selected="selected"'; |
|
315 | +} |
|
316 | +?> >05</option> |
|
317 | + <option value="6" <?php if($day_end == 6) { |
|
318 | + echo 'selected="selected"'; |
|
319 | +} |
|
320 | +?> >06</option> |
|
321 | + <option value="7" <?php if($day_end == 7) { |
|
322 | + echo 'selected="selected"'; |
|
323 | +} |
|
324 | +?> >07</option> |
|
325 | + <option value="8" <?php if($day_end == 8) { |
|
326 | + echo 'selected="selected"'; |
|
327 | +} |
|
328 | +?> >08</option> |
|
329 | + <option value="9" <?php if($day_end == 9) { |
|
330 | + echo 'selected="selected"'; |
|
331 | +} |
|
332 | +?> >09</option> |
|
333 | + <option value="10" <?php if($day_end == 10) { |
|
334 | + echo 'selected="selected"'; |
|
335 | +} |
|
336 | +?> >10</option> |
|
337 | + <option value="11" <?php if($day_end == 11) { |
|
338 | + echo 'selected="selected"'; |
|
339 | +} |
|
340 | +?> >11</option> |
|
341 | + <option value="12" <?php if($day_end == 12) { |
|
342 | + echo 'selected="selected"'; |
|
343 | +} |
|
344 | +?> >12</option> |
|
345 | + <option value="13" <?php if($day_end == 13) { |
|
346 | + echo 'selected="selected"'; |
|
347 | +} |
|
348 | +?> >13</option> |
|
349 | + <option value="14" <?php if($day_end == 14) { |
|
350 | + echo 'selected="selected"'; |
|
351 | +} |
|
352 | +?> >14</option> |
|
353 | + <option value="15" <?php if($day_end == 15) { |
|
354 | + echo 'selected="selected"'; |
|
355 | +} |
|
356 | +?> >15</option> |
|
357 | + <option value="16" <?php if($day_end == 16) { |
|
358 | + echo 'selected="selected"'; |
|
359 | +} |
|
360 | +?> >16</option> |
|
361 | + <option value="17" <?php if($day_end == 17) { |
|
362 | + echo 'selected="selected"'; |
|
363 | +} |
|
364 | +?> >17</option> |
|
365 | + <option value="18" <?php if($day_end == 18) { |
|
366 | + echo 'selected="selected"'; |
|
367 | +} |
|
368 | +?> >18</option> |
|
369 | + <option value="19" <?php if($day_end == 19) { |
|
370 | + echo 'selected="selected"'; |
|
371 | +} |
|
372 | +?> >19</option> |
|
373 | + <option value="20" <?php if($day_end == 20) { |
|
374 | + echo 'selected="selected"'; |
|
375 | +} |
|
376 | +?> >20</option> |
|
377 | + <option value="21" <?php if($day_end == 21) { |
|
378 | + echo 'selected="selected"'; |
|
379 | +} |
|
380 | +?> >21</option> |
|
381 | + <option value="22" <?php if($day_end == 22) { |
|
382 | + echo 'selected="selected"'; |
|
383 | +} |
|
384 | +?> >22</option> |
|
385 | + <option value="23" <?php if($day_end == 23) { |
|
386 | + echo 'selected="selected"'; |
|
387 | +} |
|
388 | +?> >23</option> |
|
389 | + <option value="24" <?php if($day_end == 24) { |
|
390 | + echo 'selected="selected"'; |
|
391 | +} |
|
392 | +?> >24</option> |
|
393 | + <option value="25" <?php if($day_end == 25) { |
|
394 | + echo 'selected="selected"'; |
|
395 | +} |
|
396 | +?> >25</option> |
|
397 | + <option value="26" <?php if($day_end == 26) { |
|
398 | + echo 'selected="selected"'; |
|
399 | +} |
|
400 | +?> >26</option> |
|
401 | + <option value="27" <?php if($day_end == 27) { |
|
402 | + echo 'selected="selected"'; |
|
403 | +} |
|
404 | +?> >27</option> |
|
405 | + <option value="28" <?php if($day_end == 28) { |
|
406 | + echo 'selected="selected"'; |
|
407 | +} |
|
408 | +?> >28</option> |
|
409 | + <option value="29" <?php if($day_end == 29) { |
|
410 | + echo 'selected="selected"'; |
|
411 | +} |
|
412 | +?> >29</option> |
|
413 | + <option value="30" <?php if($day_end == 30) { |
|
414 | + echo 'selected="selected"'; |
|
415 | +} |
|
416 | +?> >30</option> |
|
417 | + <option value="31" <?php if($day_end == 31) { |
|
418 | + echo 'selected="selected"'; |
|
419 | +} |
|
420 | +?> >31</option> |
|
197 | 421 | </select> |
198 | 422 | / |
199 | 423 | <select name="month_end"> |
200 | 424 | <option value="0">--</option> |
201 | - <option value="1" <?php if($month_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
202 | - <option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
203 | - <option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
204 | - <option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
205 | - <option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
206 | - <option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
207 | - <option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
208 | - <option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
209 | - <option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
210 | - <option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
211 | - <option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
212 | - <option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
425 | + <option value="1" <?php if($month_end == 1) { |
|
426 | + echo 'selected="selected"'; |
|
427 | +} |
|
428 | +?> >01</option> |
|
429 | + <option value="2" <?php if($month_end == 2) { |
|
430 | + echo 'selected="selected"'; |
|
431 | +} |
|
432 | +?> >02</option> |
|
433 | + <option value="3" <?php if($month_end == 3) { |
|
434 | + echo 'selected="selected"'; |
|
435 | +} |
|
436 | +?> >03</option> |
|
437 | + <option value="4" <?php if($month_end == 4) { |
|
438 | + echo 'selected="selected"'; |
|
439 | +} |
|
440 | +?> >04</option> |
|
441 | + <option value="5" <?php if($month_end == 5) { |
|
442 | + echo 'selected="selected"'; |
|
443 | +} |
|
444 | +?> >05</option> |
|
445 | + <option value="6" <?php if($month_end == 6) { |
|
446 | + echo 'selected="selected"'; |
|
447 | +} |
|
448 | +?> >06</option> |
|
449 | + <option value="7" <?php if($month_end == 7) { |
|
450 | + echo 'selected="selected"'; |
|
451 | +} |
|
452 | +?> >07</option> |
|
453 | + <option value="8" <?php if($month_end == 8) { |
|
454 | + echo 'selected="selected"'; |
|
455 | +} |
|
456 | +?> >08</option> |
|
457 | + <option value="9" <?php if($month_end == 9) { |
|
458 | + echo 'selected="selected"'; |
|
459 | +} |
|
460 | +?> >09</option> |
|
461 | + <option value="10" <?php if($month_end == 10) { |
|
462 | + echo 'selected="selected"'; |
|
463 | +} |
|
464 | +?> >10</option> |
|
465 | + <option value="11" <?php if($month_end == 11) { |
|
466 | + echo 'selected="selected"'; |
|
467 | +} |
|
468 | +?> >11</option> |
|
469 | + <option value="12" <?php if($month_end == 12) { |
|
470 | + echo 'selected="selected"'; |
|
471 | +} |
|
472 | +?> >12</option> |
|
213 | 473 | </select> |
214 | 474 | / |
215 | 475 | <select name="year_end"> |
@@ -217,7 +477,10 @@ discard block |
||
217 | 477 | <?php |
218 | 478 | for($i=$thisYear-5;$i <= ($thisYear+5);$i++) |
219 | 479 | { ?> |
220 | - <option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
480 | + <option value="<?php echo $i; ?>" <?php if($year_end == $i) { |
|
481 | + echo 'selected="selected"'; |
|
482 | +} |
|
483 | +?> ><?php echo $i; ?></option> |
|
221 | 484 | <?php |
222 | 485 | } ?> |
223 | 486 | </select> |
@@ -238,7 +501,10 @@ discard block |
||
238 | 501 | |
239 | 502 | |
240 | 503 | <script> |
241 | -<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?> |
|
504 | +<?php if($year_start=="0000") { |
|
505 | + echo "setDisable(document.form.nolimit);\r\n"; |
|
506 | +} |
|
507 | +?> |
|
242 | 508 | function setDisable(select){ |
243 | 509 | document.form.day_start.disabled = (select.checked) ? true : false; |
244 | 510 | document.form.month_start.disabled = (select.checked) ? true : false; |
@@ -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::suscribe_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 | } |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | if (empty($this->_parameters)) |
75 | 75 | { |
76 | 76 | $this->_parameters = $parameters; |
77 | - } |
|
78 | - else if (!empty($parameters)) |
|
77 | + } else if (!empty($parameters)) |
|
79 | 78 | { |
80 | 79 | $this->_parameters = array_merge($this->_parameters,$parameters); |
81 | 80 | } |
@@ -324,8 +323,7 @@ discard block |
||
324 | 323 | { |
325 | 324 | $result .= $pName .'="' . self::_oauthEscape($val) . '", '; |
326 | 325 | } |
327 | - } |
|
328 | - else |
|
326 | + } else |
|
329 | 327 | { |
330 | 328 | $result .= $pName . '="' . self::_oauthEscape($pValue) . '", '; |
331 | 329 | } |
@@ -350,14 +348,13 @@ discard block |
||
350 | 348 | if (!is_array($result[$key])) |
351 | 349 | { |
352 | 350 | $result[$key] = array($result[$key],$token); |
353 | - } |
|
354 | - else |
|
351 | + } else |
|
355 | 352 | { |
356 | 353 | array_push($result[$key],$token); |
357 | 354 | } |
355 | + } else { |
|
356 | + $result[$key]=$token; |
|
358 | 357 | } |
359 | - else |
|
360 | - $result[$key]=$token; |
|
361 | 358 | } |
362 | 359 | return $result; |
363 | 360 | } |
@@ -447,8 +444,7 @@ discard block |
||
447 | 444 | { |
448 | 445 | array_push($normalized_keys[self::_oauthEscape($paramName)], self::_oauthEscape($item)); |
449 | 446 | } |
450 | - } |
|
451 | - else |
|
447 | + } else |
|
452 | 448 | { |
453 | 449 | $normalized_keys[self::_oauthEscape($paramName)] = self::_oauthEscape($paramValue); |
454 | 450 | } |
@@ -466,8 +462,7 @@ discard block |
||
466 | 462 | { |
467 | 463 | array_push($return_array, $key . "=" . $element); |
468 | 464 | } |
469 | - } |
|
470 | - else |
|
465 | + } else |
|
471 | 466 | { |
472 | 467 | array_push($return_array, $key .'='. $val); |
473 | 468 | } |