@@ -3935,8 +3935,9 @@ discard block |
||
3935 | 3935 | WHERE c_id = ".$course_id." |
3936 | 3936 | ORDER BY display_order"; |
3937 | 3937 | $res = Database::query($sql); |
3938 | - if ($res === false) |
|
3939 | - return false; |
|
3938 | + if ($res === false) { |
|
3939 | + return false; |
|
3940 | + } |
|
3940 | 3941 | $lps = array (); |
3941 | 3942 | $lp_order = array (); |
3942 | 3943 | $num = Database :: num_rows($res); |
@@ -4536,8 +4537,9 @@ discard block |
||
4536 | 4537 | if ($this->debug > 0) { |
4537 | 4538 | error_log('New LP - In learnpath::set_maker()', 0); |
4538 | 4539 | } |
4539 | - if (empty ($name)) |
|
4540 | - return false; |
|
4540 | + if (empty ($name)) { |
|
4541 | + return false; |
|
4542 | + } |
|
4541 | 4543 | $this->maker = $name; |
4542 | 4544 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4543 | 4545 | $course_id = api_get_course_int_id(); |
@@ -4602,8 +4604,9 @@ discard block |
||
4602 | 4604 | public function set_terms_by_prefix($terms_string, $prefix) |
4603 | 4605 | { |
4604 | 4606 | $course_id = api_get_course_int_id(); |
4605 | - if (api_get_setting('search_enabled') !== 'true') |
|
4606 | - return false; |
|
4607 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4608 | + return false; |
|
4609 | + } |
|
4607 | 4610 | |
4608 | 4611 | if (!extension_loaded('xapian')) { |
4609 | 4612 | return false; |
@@ -4616,8 +4619,9 @@ discard block |
||
4616 | 4619 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4617 | 4620 | |
4618 | 4621 | // Don't do anything if no change, verify only at DB, not the search engine. |
4619 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4620 | - return false; |
|
4622 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4623 | + return false; |
|
4624 | + } |
|
4621 | 4625 | |
4622 | 4626 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4623 | 4627 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4809,8 +4813,9 @@ discard block |
||
4809 | 4813 | if ($this->debug > 0) { |
4810 | 4814 | error_log('New LP - In learnpath::set_proximity()', 0); |
4811 | 4815 | } |
4812 | - if (empty ($name)) |
|
4813 | - return false; |
|
4816 | + if (empty ($name)) { |
|
4817 | + return false; |
|
4818 | + } |
|
4814 | 4819 | |
4815 | 4820 | $this->proximity = $name; |
4816 | 4821 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5152,8 +5157,9 @@ discard block |
||
5152 | 5157 | |
5153 | 5158 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5154 | 5159 | $res = Database::query($sql); |
5155 | - if ($res === false) |
|
5156 | - return false; |
|
5160 | + if ($res === false) { |
|
5161 | + return false; |
|
5162 | + } |
|
5157 | 5163 | |
5158 | 5164 | $num = Database :: num_rows($res); |
5159 | 5165 | // First check the order is correct, globally (might be wrong because |
@@ -5464,8 +5470,9 @@ discard block |
||
5464 | 5470 | $position[$key] = $row['display_order']; |
5465 | 5471 | } |
5466 | 5472 | |
5467 | - if (count($array) > 0) |
|
5468 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5473 | + if (count($array) > 0) { |
|
5474 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5475 | + } |
|
5469 | 5476 | |
5470 | 5477 | return $array; |
5471 | 5478 | } |
@@ -6021,8 +6028,9 @@ discard block |
||
6021 | 6028 | $tmp_filename = $filename; |
6022 | 6029 | |
6023 | 6030 | $i = 0; |
6024 | - while (file_exists($filepath . $tmp_filename . '.'.$extension)) |
|
6025 | - $tmp_filename = $filename . '_' . ++ $i; |
|
6031 | + while (file_exists($filepath . $tmp_filename . '.'.$extension)) { |
|
6032 | + $tmp_filename = $filename . '_' . ++ $i; |
|
6033 | + } |
|
6026 | 6034 | |
6027 | 6035 | $filename = $tmp_filename . '.'.$extension; |
6028 | 6036 | if ($extension == 'html') { |
@@ -6095,10 +6103,12 @@ discard block |
||
6095 | 6103 | if ($new_comment || $new_title) { |
6096 | 6104 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6097 | 6105 | $ct = ''; |
6098 | - if ($new_comment) |
|
6099 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6100 | - if ($new_title) |
|
6101 | - $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
6106 | + if ($new_comment) { |
|
6107 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6108 | + } |
|
6109 | + if ($new_title) { |
|
6110 | + $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
6111 | + } |
|
6102 | 6112 | |
6103 | 6113 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6104 | 6114 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6122,17 +6132,21 @@ discard block |
||
6122 | 6132 | // Please, do not modify this dirname formatting. |
6123 | 6133 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6124 | 6134 | |
6125 | - if (strstr($dir, '..')) |
|
6126 | - $dir = '/'; |
|
6135 | + if (strstr($dir, '..')) { |
|
6136 | + $dir = '/'; |
|
6137 | + } |
|
6127 | 6138 | |
6128 | - if ($dir[0] == '.') |
|
6129 | - $dir = substr($dir, 1); |
|
6139 | + if ($dir[0] == '.') { |
|
6140 | + $dir = substr($dir, 1); |
|
6141 | + } |
|
6130 | 6142 | |
6131 | - if ($dir[0] != '/') |
|
6132 | - $dir = '/' . $dir; |
|
6143 | + if ($dir[0] != '/') { |
|
6144 | + $dir = '/' . $dir; |
|
6145 | + } |
|
6133 | 6146 | |
6134 | - if ($dir[strlen($dir) - 1] != '/') |
|
6135 | - $dir .= '/'; |
|
6147 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6148 | + $dir .= '/'; |
|
6149 | + } |
|
6136 | 6150 | |
6137 | 6151 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6138 | 6152 | |
@@ -6198,8 +6212,9 @@ discard block |
||
6198 | 6212 | } |
6199 | 6213 | $return .= '<div style="padding:10px;">'; |
6200 | 6214 | |
6201 | - if ($msg != '') |
|
6202 | - $return .= $msg; |
|
6215 | + if ($msg != '') { |
|
6216 | + $return .= $msg; |
|
6217 | + } |
|
6203 | 6218 | |
6204 | 6219 | $return .= '<h3>'.$row['title'].'</h3>'; |
6205 | 6220 | switch ($row['item_type']) { |
@@ -6446,10 +6461,11 @@ discard block |
||
6446 | 6461 | $item_description = Security::remove_XSS($item_description); |
6447 | 6462 | |
6448 | 6463 | $legend = '<legend>'; |
6449 | - if ($id != 0 && is_array($extra_info)) |
|
6450 | - $parent = $extra_info['parent_item_id']; |
|
6451 | - else |
|
6452 | - $parent = 0; |
|
6464 | + if ($id != 0 && is_array($extra_info)) { |
|
6465 | + $parent = $extra_info['parent_item_id']; |
|
6466 | + } else { |
|
6467 | + $parent = 0; |
|
6468 | + } |
|
6453 | 6469 | |
6454 | 6470 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6455 | 6471 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6527,8 +6543,9 @@ discard block |
||
6527 | 6543 | $arrHide[] = $arrLP[$i]['id']; |
6528 | 6544 | } |
6529 | 6545 | } else { |
6530 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
6531 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6546 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
6547 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6548 | + } |
|
6532 | 6549 | } |
6533 | 6550 | } |
6534 | 6551 | if (is_array($arrLP)) { |
@@ -6717,11 +6734,13 @@ discard block |
||
6717 | 6734 | } |
6718 | 6735 | |
6719 | 6736 | $legend = '<legend>'; |
6720 | - if ($action == 'add') |
|
6721 | - $legend .= get_lang('CreateTheExercise'); |
|
6722 | - elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise'); |
|
6723 | - else |
|
6724 | - $legend .= get_lang('EditCurrentExecice'); |
|
6737 | + if ($action == 'add') { |
|
6738 | + $legend .= get_lang('CreateTheExercise'); |
|
6739 | + } elseif ($action == 'move') { |
|
6740 | + $legend .= get_lang('MoveTheCurrentExercise'); |
|
6741 | + } else { |
|
6742 | + $legend .= get_lang('EditCurrentExecice'); |
|
6743 | + } |
|
6725 | 6744 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
6726 | 6745 | $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
6727 | 6746 | } |
@@ -6748,8 +6767,9 @@ discard block |
||
6748 | 6767 | $arrHide[] = $arrLP[$i]['id']; |
6749 | 6768 | } |
6750 | 6769 | } else { |
6751 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
6752 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6770 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
6771 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6772 | + } |
|
6753 | 6773 | } |
6754 | 6774 | } |
6755 | 6775 | |
@@ -6767,11 +6787,13 @@ discard block |
||
6767 | 6787 | |
6768 | 6788 | for ($i = 0; $i < count($arrLP); $i++) { |
6769 | 6789 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6770 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6790 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6791 | + $selected = 'selected="selected" '; |
|
6792 | + } elseif ($action == 'add') { |
|
6771 | 6793 | $selected = 'selected="selected" '; |
6772 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6773 | - else |
|
6774 | - $selected = ''; |
|
6794 | + } else { |
|
6795 | + $selected = ''; |
|
6796 | + } |
|
6775 | 6797 | |
6776 | 6798 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6777 | 6799 | } |
@@ -6798,9 +6820,11 @@ discard block |
||
6798 | 6820 | $arrHide = array (); |
6799 | 6821 | for ($i = 0; $i < count($arrLP); $i++) { |
6800 | 6822 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
6801 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6802 | - $s_selected_position = $arrLP[$i]['id']; |
|
6803 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6823 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6824 | + $s_selected_position = $arrLP[$i]['id']; |
|
6825 | + } elseif ($action == 'add') { |
|
6826 | + $s_selected_position = 0; |
|
6827 | + } |
|
6804 | 6828 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6805 | 6829 | |
6806 | 6830 | } |
@@ -6897,11 +6921,13 @@ discard block |
||
6897 | 6921 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
6898 | 6922 | unset($this->arrMenu); |
6899 | 6923 | |
6900 | - if ($action == 'add') |
|
6901 | - $legend .= get_lang('CreateTheForum') . ' :'; |
|
6902 | - elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . ' :'; |
|
6903 | - else |
|
6904 | - $legend .= get_lang('EditCurrentForum') . ' :'; |
|
6924 | + if ($action == 'add') { |
|
6925 | + $legend .= get_lang('CreateTheForum') . ' :'; |
|
6926 | + } elseif ($action == 'move') { |
|
6927 | + $legend .= get_lang('MoveTheCurrentForum') . ' :'; |
|
6928 | + } else { |
|
6929 | + $legend .= get_lang('EditCurrentForum') . ' :'; |
|
6930 | + } |
|
6905 | 6931 | |
6906 | 6932 | $legend .= '</legend>'; |
6907 | 6933 | $return = '<div class="sectioncomment">'; |
@@ -6934,8 +6960,9 @@ discard block |
||
6934 | 6960 | $arrHide[] = $arrLP[$i]['id']; |
6935 | 6961 | } |
6936 | 6962 | } else { |
6937 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
6938 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6963 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
6964 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6965 | + } |
|
6939 | 6966 | } |
6940 | 6967 | } |
6941 | 6968 | if (is_array($arrLP)) { |
@@ -6953,11 +6980,13 @@ discard block |
||
6953 | 6980 | |
6954 | 6981 | for ($i = 0; $i < count($arrLP); $i++) { |
6955 | 6982 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6956 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6983 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6984 | + $selected = 'selected="selected" '; |
|
6985 | + } elseif ($action == 'add') { |
|
6957 | 6986 | $selected = 'selected="selected" '; |
6958 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6959 | - else |
|
6960 | - $selected = ''; |
|
6987 | + } else { |
|
6988 | + $selected = ''; |
|
6989 | + } |
|
6961 | 6990 | |
6962 | 6991 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . |
6963 | 6992 | get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
@@ -6983,9 +7012,11 @@ discard block |
||
6983 | 7012 | $arrHide = array(); |
6984 | 7013 | for ($i = 0; $i < count($arrLP); $i++) { |
6985 | 7014 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
6986 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6987 | - $s_selected_position = $arrLP[$i]['id']; |
|
6988 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7015 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7016 | + $s_selected_position = $arrLP[$i]['id']; |
|
7017 | + } elseif ($action == 'add') { |
|
7018 | + $s_selected_position = 0; |
|
7019 | + } |
|
6989 | 7020 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6990 | 7021 | } |
6991 | 7022 | } |
@@ -7089,11 +7120,13 @@ discard block |
||
7089 | 7120 | unset ($this->arrMenu); |
7090 | 7121 | |
7091 | 7122 | $return .= '<form method="POST">'; |
7092 | - if ($action == 'add') |
|
7093 | - $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>'; |
|
7094 | - elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . ' :</p>'; |
|
7095 | - else |
|
7096 | - $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>'; |
|
7123 | + if ($action == 'add') { |
|
7124 | + $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>'; |
|
7125 | + } elseif ($action == 'move') { |
|
7126 | + $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . ' :</p>'; |
|
7127 | + } else { |
|
7128 | + $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>'; |
|
7129 | + } |
|
7097 | 7130 | |
7098 | 7131 | $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">'; |
7099 | 7132 | $return .= '<tr>'; |
@@ -7113,8 +7146,9 @@ discard block |
||
7113 | 7146 | $arrHide[] = $arrLP[$i]['id']; |
7114 | 7147 | } |
7115 | 7148 | } else { |
7116 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
7117 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
7149 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
7150 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
7151 | + } |
|
7118 | 7152 | } |
7119 | 7153 | } |
7120 | 7154 | |
@@ -7132,11 +7166,13 @@ discard block |
||
7132 | 7166 | $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
7133 | 7167 | for ($i = 0; $i < count($arrLP); $i++) { |
7134 | 7168 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7135 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7169 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7170 | + $selected = 'selected="selected" '; |
|
7171 | + } elseif ($action == 'add') { |
|
7136 | 7172 | $selected = 'selected="selected" '; |
7137 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
7138 | - else |
|
7139 | - $selected = ''; |
|
7173 | + } else { |
|
7174 | + $selected = ''; |
|
7175 | + } |
|
7140 | 7176 | |
7141 | 7177 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
7142 | 7178 | } |
@@ -7165,9 +7201,11 @@ discard block |
||
7165 | 7201 | $arrHide = array(); |
7166 | 7202 | for ($i = 0; $i < count($arrLP); $i++) { |
7167 | 7203 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7168 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7169 | - $s_selected_position = $arrLP[$i]['id']; |
|
7170 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7204 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7205 | + $s_selected_position = $arrLP[$i]['id']; |
|
7206 | + } elseif ($action == 'add') { |
|
7207 | + $s_selected_position = 0; |
|
7208 | + } |
|
7171 | 7209 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7172 | 7210 | |
7173 | 7211 | } |
@@ -7180,8 +7218,7 @@ discard block |
||
7180 | 7218 | foreach ($arrHide as $key => $value) { |
7181 | 7219 | if ($key == $s_selected_position && $action == 'add') { |
7182 | 7220 | $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>'; |
7183 | - } |
|
7184 | - elseif ($key == $id_prerequisite && $action == 'edit') { |
|
7221 | + } elseif ($key == $id_prerequisite && $action == 'edit') { |
|
7185 | 7222 | $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>'; |
7186 | 7223 | } else { |
7187 | 7224 | $return .= '<option value="' . $key . '">' . $value['value'] . '</option>'; |
@@ -7204,8 +7241,7 @@ discard block |
||
7204 | 7241 | |
7205 | 7242 | if (is_numeric($extra_info)) { |
7206 | 7243 | $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
7207 | - } |
|
7208 | - elseif (is_array($extra_info)) { |
|
7244 | + } elseif (is_array($extra_info)) { |
|
7209 | 7245 | $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
7210 | 7246 | } |
7211 | 7247 | |
@@ -7259,8 +7295,9 @@ discard block |
||
7259 | 7295 | lp_id = " . $this->lp_id . " AND |
7260 | 7296 | id != $id"; |
7261 | 7297 | |
7262 | - if ($item_type == 'module') |
|
7263 | - $sql .= " AND parent_item_id = 0"; |
|
7298 | + if ($item_type == 'module') { |
|
7299 | + $sql .= " AND parent_item_id = 0"; |
|
7300 | + } |
|
7264 | 7301 | |
7265 | 7302 | $result = Database::query($sql); |
7266 | 7303 | $arrLP = array (); |
@@ -7610,9 +7647,11 @@ discard block |
||
7610 | 7647 | //POSITION |
7611 | 7648 | for ($i = 0; $i < count($arrLP); $i++) { |
7612 | 7649 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7613 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7650 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7651 | + $s_selected_position = $arrLP[$i]['id']; |
|
7652 | + } elseif ($action == 'add') { |
|
7614 | 7653 | $s_selected_position = $arrLP[$i]['id']; |
7615 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7654 | + } |
|
7616 | 7655 | $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
7617 | 7656 | } |
7618 | 7657 | } |
@@ -7645,9 +7684,11 @@ discard block |
||
7645 | 7684 | |
7646 | 7685 | for ($i = 0; $i < count($arrLP); $i++) { |
7647 | 7686 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7648 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7687 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7688 | + $s_selected_position = $arrLP[$i]['id']; |
|
7689 | + } elseif ($action == 'add') { |
|
7649 | 7690 | $s_selected_position = $arrLP[$i]['id']; |
7650 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7691 | + } |
|
7651 | 7692 | |
7652 | 7693 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7653 | 7694 | |
@@ -7658,17 +7699,18 @@ discard block |
||
7658 | 7699 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7659 | 7700 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7660 | 7701 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) { |
7661 | - if (isset ($_POST['content'])) |
|
7662 | - $content = stripslashes($_POST['content']); |
|
7663 | - elseif (is_array($extra_info)) { |
|
7702 | + if (isset ($_POST['content'])) { |
|
7703 | + $content = stripslashes($_POST['content']); |
|
7704 | + } elseif (is_array($extra_info)) { |
|
7664 | 7705 | //If it's an html document or a text file |
7665 | 7706 | if (!$no_display_edit_textarea) { |
7666 | 7707 | $content = $this->display_document($extra_info['path'], false, false); |
7667 | 7708 | } |
7668 | - } elseif (is_numeric($extra_info)) |
|
7669 | - $content = $this->display_document($extra_info, false, false); |
|
7670 | - else |
|
7671 | - $content = ''; |
|
7709 | + } elseif (is_numeric($extra_info)) { |
|
7710 | + $content = $this->display_document($extra_info, false, false); |
|
7711 | + } else { |
|
7712 | + $content = ''; |
|
7713 | + } |
|
7672 | 7714 | |
7673 | 7715 | if (!$no_display_edit_textarea) { |
7674 | 7716 | // We need to calculate here some specific settings for the online editor. |
@@ -7822,11 +7864,13 @@ discard block |
||
7822 | 7864 | $arrLP = isset($this->arrMenu) ? $this->arrMenu : null; |
7823 | 7865 | unset ($this->arrMenu); |
7824 | 7866 | |
7825 | - if ($action == 'add') |
|
7826 | - $legend .= get_lang('CreateTheLink') . ' :'; |
|
7827 | - elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . ' :'; |
|
7828 | - else |
|
7829 | - $legend .= get_lang('EditCurrentLink') . ' :'; |
|
7867 | + if ($action == 'add') { |
|
7868 | + $legend .= get_lang('CreateTheLink') . ' :'; |
|
7869 | + } elseif ($action == 'move') { |
|
7870 | + $legend .= get_lang('MoveCurrentLink') . ' :'; |
|
7871 | + } else { |
|
7872 | + $legend .= get_lang('EditCurrentLink') . ' :'; |
|
7873 | + } |
|
7830 | 7874 | |
7831 | 7875 | $legend .= '</legend>'; |
7832 | 7876 | |
@@ -7861,8 +7905,9 @@ discard block |
||
7861 | 7905 | $arrHide[] = $arrLP[$i]['id']; |
7862 | 7906 | } |
7863 | 7907 | } else { |
7864 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
7865 | - $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
7908 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
7909 | + $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
7910 | + } |
|
7866 | 7911 | } |
7867 | 7912 | } |
7868 | 7913 | |
@@ -7881,12 +7926,13 @@ discard block |
||
7881 | 7926 | $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
7882 | 7927 | for ($i = 0; $i < count($arrLP); $i++) { |
7883 | 7928 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7884 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7885 | - $selected = 'selected="selected" '; |
|
7886 | - elseif ($action == 'add') |
|
7887 | - $selected = 'selected="selected" '; |
|
7888 | - else |
|
7889 | - $selected = ''; |
|
7929 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7930 | + $selected = 'selected="selected" '; |
|
7931 | + } elseif ($action == 'add') { |
|
7932 | + $selected = 'selected="selected" '; |
|
7933 | + } else { |
|
7934 | + $selected = ''; |
|
7935 | + } |
|
7890 | 7936 | |
7891 | 7937 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
7892 | 7938 | } |
@@ -7913,9 +7959,11 @@ discard block |
||
7913 | 7959 | $arrHide = array(); |
7914 | 7960 | for ($i = 0; $i < count($arrLP); $i++) { |
7915 | 7961 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7916 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7917 | - $s_selected_position = $arrLP[$i]['id']; |
|
7918 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7962 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7963 | + $s_selected_position = $arrLP[$i]['id']; |
|
7964 | + } elseif ($action == 'add') { |
|
7965 | + $s_selected_position = 0; |
|
7966 | + } |
|
7919 | 7967 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7920 | 7968 | |
7921 | 7969 | } |
@@ -8122,9 +8170,11 @@ discard block |
||
8122 | 8170 | $arrHide = array (); |
8123 | 8171 | for ($i = 0; $i < count($arrLP); $i++) { |
8124 | 8172 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
8125 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8126 | - $s_selected_position = $arrLP[$i]['id']; |
|
8127 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8173 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8174 | + $s_selected_position = $arrLP[$i]['id']; |
|
8175 | + } elseif ($action == 'add') { |
|
8176 | + $s_selected_position = 0; |
|
8177 | + } |
|
8128 | 8178 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8129 | 8179 | |
8130 | 8180 | } |
@@ -9683,9 +9733,9 @@ discard block |
||
9683 | 9733 | $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/'; |
9684 | 9734 | $extra_files = scandir($main_code_path); |
9685 | 9735 | foreach ($extra_files as $extra_file) { |
9686 | - if (strpos($extra_file, '.') === 0) |
|
9687 | - continue; |
|
9688 | - else { |
|
9736 | + if (strpos($extra_file, '.') === 0) { |
|
9737 | + continue; |
|
9738 | + } else { |
|
9689 | 9739 | $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file; |
9690 | 9740 | $this->create_path($dest_file); |
9691 | 9741 | copy($main_code_path.$extra_file, $dest_file); |
@@ -119,8 +119,9 @@ |
||
119 | 119 | |
120 | 120 | for ($i = 0; $i<count($matches[0]); $i++) { |
121 | 121 | |
122 | - if (empty($matches[1][$i])) |
|
123 | - continue; |
|
122 | + if (empty($matches[1][$i])) { |
|
123 | + continue; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $content = api_strstr($content, $matches[0][$i]); |
126 | 127 | if ($i + 1 !== count($matches[0])) { |
@@ -341,8 +341,7 @@ |
||
341 | 341 | case '1': // coming from Agenda |
342 | 342 | if ($action == 'edit') { |
343 | 343 | $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource"; |
344 | - } |
|
345 | - elseif ($action == 'add') { |
|
344 | + } elseif ($action == 'add') { |
|
346 | 345 | $url = "../calendar/agenda.php?action=add&originalresource=$originalresource"; |
347 | 346 | } else { |
348 | 347 | $url = "../calendar/agenda.php?action=add"; |
@@ -459,11 +459,12 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
462 | - if ($package_type == '' || !$mandatory) |
|
463 | - // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
462 | + if ($package_type == '' || !$mandatory) { |
|
463 | + // && defined('CHECK_FOR_AICC') && CHECK_FOR_AICC) |
|
464 | 464 | { |
465 | 465 | return api_failure::set_failure('not_aicc_content'); |
466 | 466 | } |
467 | + } |
|
467 | 468 | |
468 | 469 | if (!enough_size($realFileSize, $course_sys_dir, $maxFilledSpace)) { |
469 | 470 | return api_failure::set_failure('not_enough_space'); |
@@ -511,7 +512,9 @@ discard block |
||
511 | 512 | if ($file != '.' && $file != '..') { |
512 | 513 | $filetype = 'file'; |
513 | 514 | |
514 | - if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder'; |
|
515 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
516 | + $filetype = 'folder'; |
|
517 | + } |
|
515 | 518 | |
516 | 519 | // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible! |
517 | 520 | //$safe_file = api_replace_dangerous_char($file, 'strict'); |
@@ -910,37 +913,43 @@ discard block |
||
910 | 913 | if ($enclosed && $data{$i+1} == $enclosure) { |
911 | 914 | $fldval .= $chr; |
912 | 915 | ++$i; // Skip the next character. |
913 | - } else |
|
914 | - $enclosed = !$enclosed; |
|
916 | + } else { |
|
917 | + $enclosed = !$enclosed; |
|
918 | + } |
|
915 | 919 | break; |
916 | 920 | case $delim: |
917 | 921 | if (!$enclosed) { |
918 | 922 | $ret_array[$linecount][$fldcount++] = $fldval; |
919 | 923 | $fldval = ''; |
920 | - } else |
|
921 | - $fldval .= $chr; |
|
924 | + } else { |
|
925 | + $fldval .= $chr; |
|
926 | + } |
|
922 | 927 | break; |
923 | 928 | case "\r": |
924 | - if (!$enclosed&&$data{$i+1} == "\n") |
|
925 | - continue; |
|
929 | + if (!$enclosed&&$data{$i+1} == "\n") { |
|
930 | + continue; |
|
931 | + } |
|
926 | 932 | case "\n": |
927 | 933 | if (!$enclosed) { |
928 | 934 | $ret_array[$linecount++][$fldcount] = $fldval; |
929 | 935 | $fldcount = 0; |
930 | 936 | $fldval = ''; |
931 | - } else |
|
932 | - $fldval .= $chr; |
|
937 | + } else { |
|
938 | + $fldval .= $chr; |
|
939 | + } |
|
933 | 940 | break; |
934 | 941 | case "\\r": |
935 | - if (!$enclosed&&$data{$i+1} == "\\n") |
|
936 | - continue; |
|
942 | + if (!$enclosed&&$data{$i+1} == "\\n") { |
|
943 | + continue; |
|
944 | + } |
|
937 | 945 | case "\\n": |
938 | 946 | if (!$enclosed) { |
939 | 947 | $ret_array[$linecount++][$fldcount] = $fldval; |
940 | 948 | $fldcount = 0; |
941 | 949 | $fldval = ''; |
942 | - } else |
|
943 | - $fldval .= $chr; |
|
950 | + } else { |
|
951 | + $fldval .= $chr; |
|
952 | + } |
|
944 | 953 | break; |
945 | 954 | default: |
946 | 955 | $fldval .= $chr; |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | foreach ($dashboard_blocks as $block) { |
49 | 49 | |
50 | 50 | // display only user blocks |
51 | - if (!in_array($block['id'], $user_blocks_id)) continue; |
|
51 | + if (!in_array($block['id'], $user_blocks_id)) { |
|
52 | + continue; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | $path = $block['path']; |
54 | 56 | $controller_class = $block['controller']; |
@@ -61,7 +63,9 @@ discard block |
||
61 | 63 | // check if user is allowed to see the block |
62 | 64 | if (method_exists($obj, 'is_block_visible_for_user')) { |
63 | 65 | $is_block_visible_for_user = $obj->is_block_visible_for_user($user_id); |
64 | - if (!$is_block_visible_for_user) continue; |
|
66 | + if (!$is_block_visible_for_user) { |
|
67 | + continue; |
|
68 | + } |
|
65 | 69 | } |
66 | 70 | |
67 | 71 | $data_block[$path] = $obj->get_block(); |
@@ -40,7 +40,9 @@ |
||
40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
41 | 41 | if (is_dir($full_file_name)) { |
42 | 42 | //remove last slash if present |
43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') { |
|
44 | + $doc_url = substr($doc_url,0,$dul); |
|
45 | + } |
|
44 | 46 | //create the path |
45 | 47 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
46 | 48 | //redirect |
@@ -379,9 +379,10 @@ discard block |
||
379 | 379 | $result = Database::query($sql); |
380 | 380 | $row = Database::fetch_array($result); |
381 | 381 | |
382 | - if ($row['number'] == 1) |
|
383 | - $user_task = true; |
|
384 | -} |
|
382 | + if ($row['number'] == 1) { |
|
383 | + $user_task = true; |
|
384 | + } |
|
385 | + } |
|
385 | 386 | |
386 | 387 | switch ($action) { |
387 | 388 | case 'new_post': |
@@ -468,16 +469,17 @@ discard block |
||
468 | 469 | echo '<br /><br />'; |
469 | 470 | Blog :: display_assigned_task_list($blog_id); |
470 | 471 | echo '<br /><br />'; |
472 | + } else { |
|
473 | + api_not_allowed(); |
|
471 | 474 | } |
472 | - else |
|
473 | - api_not_allowed(); |
|
474 | 475 | |
475 | 476 | break; |
476 | 477 | case 'execute_task' : |
477 | - if (isset ($_GET['post_id'])) |
|
478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
479 | - else |
|
480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
478 | + if (isset ($_GET['post_id'])) { |
|
479 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
480 | + } else { |
|
481 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
482 | + } |
|
481 | 483 | |
482 | 484 | break; |
483 | 485 | case 'view_search_result' : |
@@ -400,8 +400,9 @@ |
||
400 | 400 | $extra .= $form->return_form(); |
401 | 401 | $extra .= '</div>'; |
402 | 402 | |
403 | -if ($is_allowedToEdit) |
|
403 | +if ($is_allowedToEdit) { |
|
404 | 404 | echo $extra; |
405 | +} |
|
405 | 406 | |
406 | 407 | echo $actions; |
407 | 408 |
@@ -538,10 +538,11 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function isInList($questionId) |
540 | 540 | { |
541 | - if (is_array($this->questionList)) |
|
542 | - return in_array($questionId,$this->questionList); |
|
543 | - else |
|
544 | - return false; |
|
541 | + if (is_array($this->questionList)) { |
|
542 | + return in_array($questionId,$this->questionList); |
|
543 | + } else { |
|
544 | + return false; |
|
545 | + } |
|
545 | 546 | } |
546 | 547 | |
547 | 548 | /** |
@@ -1227,10 +1228,11 @@ discard block |
||
1227 | 1228 | |
1228 | 1229 | $var = Exercise::selectTimeLimit(); |
1229 | 1230 | |
1230 | - if (($this->start_time != '0000-00-00 00:00:00')) |
|
1231 | - $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1232 | - else |
|
1233 | - $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1231 | + if (($this->start_time != '0000-00-00 00:00:00')) { |
|
1232 | + $form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
1233 | + } else { |
|
1234 | + $form->addElement('html','<div id="start_date_div" style="display:none;">'); |
|
1235 | + } |
|
1234 | 1236 | |
1235 | 1237 | $form->addElement('date_time_picker', 'start_time'); |
1236 | 1238 | |
@@ -1238,10 +1240,11 @@ discard block |
||
1238 | 1240 | |
1239 | 1241 | $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
1240 | 1242 | |
1241 | - if (($this->end_time != '0000-00-00 00:00:00')) |
|
1242 | - $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1243 | - else |
|
1244 | - $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1243 | + if (($this->end_time != '0000-00-00 00:00:00')) { |
|
1244 | + $form->addElement('html','<div id="end_date_div" style="display:block;">'); |
|
1245 | + } else { |
|
1246 | + $form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
1247 | + } |
|
1245 | 1248 | |
1246 | 1249 | $form->addElement('date_time_picker', 'end_time'); |
1247 | 1250 | $form->addElement('html','</div>'); |
@@ -2268,7 +2271,9 @@ discard block |
||
2268 | 2271 | $organs_at_risk_hit = 0; |
2269 | 2272 | $questionScore = 0; |
2270 | 2273 | |
2271 | - if ($debug) error_log('Start answer loop '); |
|
2274 | + if ($debug) { |
|
2275 | + error_log('Start answer loop '); |
|
2276 | + } |
|
2272 | 2277 | |
2273 | 2278 | $answer_correct_array = array(); |
2274 | 2279 | |
@@ -2383,7 +2388,9 @@ discard block |
||
2383 | 2388 | } |
2384 | 2389 | $totalScore += $answerWeighting; |
2385 | 2390 | |
2386 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
2391 | + if ($debug) { |
|
2392 | + error_log("studentChoice: $studentChoice"); |
|
2393 | + } |
|
2387 | 2394 | break; |
2388 | 2395 | case GLOBAL_MULTIPLE_ANSWER: |
2389 | 2396 | if ($from_database) { |
@@ -2408,7 +2415,9 @@ discard block |
||
2408 | 2415 | $real_answers[$answerId] = (bool)$studentChoice; |
2409 | 2416 | } |
2410 | 2417 | $totalScore += $answerWeighting; |
2411 | - if ($debug) error_log("studentChoice: $studentChoice"); |
|
2418 | + if ($debug) { |
|
2419 | + error_log("studentChoice: $studentChoice"); |
|
2420 | + } |
|
2412 | 2421 | break; |
2413 | 2422 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
2414 | 2423 | if ($from_database) { |
@@ -3125,9 +3134,13 @@ discard block |
||
3125 | 3134 | } // end switch Answertype |
3126 | 3135 | |
3127 | 3136 | if ($show_result) { |
3128 | - if ($debug) error_log('show result '.$show_result); |
|
3137 | + if ($debug) { |
|
3138 | + error_log('show result '.$show_result); |
|
3139 | + } |
|
3129 | 3140 | if ($from == 'exercise_result') { |
3130 | - if ($debug) error_log('Showing questions $from '.$from); |
|
3141 | + if ($debug) { |
|
3142 | + error_log('Showing questions $from '.$from); |
|
3143 | + } |
|
3131 | 3144 | //display answers (if not matching type, or if the answer is correct) |
3132 | 3145 | if ( |
3133 | 3146 | !in_array( |
@@ -3415,7 +3428,9 @@ discard block |
||
3415 | 3428 | } |
3416 | 3429 | } |
3417 | 3430 | } else { |
3418 | - if ($debug) error_log('Showing questions $from '.$from); |
|
3431 | + if ($debug) { |
|
3432 | + error_log('Showing questions $from '.$from); |
|
3433 | + } |
|
3419 | 3434 | |
3420 | 3435 | switch ($answerType) { |
3421 | 3436 | case UNIQUE_ANSWER: |
@@ -3747,10 +3762,14 @@ discard block |
||
3747 | 3762 | } |
3748 | 3763 | } |
3749 | 3764 | } |
3750 | - if ($debug) error_log(' ------ '); |
|
3765 | + if ($debug) { |
|
3766 | + error_log(' ------ '); |
|
3767 | + } |
|
3751 | 3768 | } // end for that loops over all answers of the current question |
3752 | 3769 | |
3753 | - if ($debug) error_log('-- end answer loop --'); |
|
3770 | + if ($debug) { |
|
3771 | + error_log('-- end answer loop --'); |
|
3772 | + } |
|
3754 | 3773 | |
3755 | 3774 | $final_answer = true; |
3756 | 3775 | |
@@ -3823,7 +3842,9 @@ discard block |
||
3823 | 3842 | // some results that haven't been stored in the database yet |
3824 | 3843 | if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) { |
3825 | 3844 | |
3826 | - if ($debug) error_log('$from AND this is a hotspot kind of question '); |
|
3845 | + if ($debug) { |
|
3846 | + error_log('$from AND this is a hotspot kind of question '); |
|
3847 | + } |
|
3827 | 3848 | |
3828 | 3849 | $my_exe_id = 0; |
3829 | 3850 | $from_database = 0; |
@@ -3999,8 +4020,12 @@ discard block |
||
3999 | 4020 | // stored by exercise_results.php (using the session) |
4000 | 4021 | |
4001 | 4022 | if ($saved_results) { |
4002 | - if ($debug) error_log("Save question results $saved_results"); |
|
4003 | - if ($debug) error_log(print_r($choice ,1 )); |
|
4023 | + if ($debug) { |
|
4024 | + error_log("Save question results $saved_results"); |
|
4025 | + } |
|
4026 | + if ($debug) { |
|
4027 | + error_log(print_r($choice ,1 )); |
|
4028 | + } |
|
4004 | 4029 | |
4005 | 4030 | if (empty($choice)) { |
4006 | 4031 | $choice = 0; |
@@ -4102,7 +4127,9 @@ discard block |
||
4102 | 4127 | $sql = 'UPDATE ' . $stat_table . ' SET |
4103 | 4128 | exe_result = exe_result + ' . floatval($questionScore) . ' |
4104 | 4129 | WHERE exe_id = ' . $exeId; |
4105 | - if ($debug) error_log($sql); |
|
4130 | + if ($debug) { |
|
4131 | + error_log($sql); |
|
4132 | + } |
|
4106 | 4133 | Database::query($sql); |
4107 | 4134 | } |
4108 | 4135 |