@@ -47,10 +47,10 @@ |
||
47 | 47 | " . |
48 | 48 | "\n" . |
49 | 49 | '$().ready(function() {'."\n" . |
50 | - 'if ($(\'#previous\')) {'."\n" . |
|
50 | + 'if ($(\'#previous\')) {'."\n" . |
|
51 | 51 | 'if(\'parent is\'+$(\'#idParent\').val()) {'. |
52 | - 'load_cbo($(\'#idParent\').val());'."\n" . |
|
53 | - '}}'."\n" . |
|
52 | + 'load_cbo($(\'#idParent\').val());'."\n" . |
|
53 | + '}}'."\n" . |
|
54 | 54 | '});</script>'."\n" ; |
55 | 55 | |
56 | 56 | /* Constants and variables */ |
@@ -3955,8 +3955,9 @@ discard block |
||
3955 | 3955 | WHERE c_id = ".$course_id." |
3956 | 3956 | ORDER BY display_order"; |
3957 | 3957 | $res = Database::query($sql); |
3958 | - if ($res === false) |
|
3959 | - return false; |
|
3958 | + if ($res === false) { |
|
3959 | + return false; |
|
3960 | + } |
|
3960 | 3961 | $lps = array (); |
3961 | 3962 | $lp_order = array (); |
3962 | 3963 | $num = Database :: num_rows($res); |
@@ -4556,8 +4557,9 @@ discard block |
||
4556 | 4557 | if ($this->debug > 0) { |
4557 | 4558 | error_log('New LP - In learnpath::set_maker()', 0); |
4558 | 4559 | } |
4559 | - if (empty ($name)) |
|
4560 | - return false; |
|
4560 | + if (empty ($name)) { |
|
4561 | + return false; |
|
4562 | + } |
|
4561 | 4563 | $this->maker = $name; |
4562 | 4564 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4563 | 4565 | $course_id = api_get_course_int_id(); |
@@ -4624,8 +4626,9 @@ discard block |
||
4624 | 4626 | $em = Database::getManager(); |
4625 | 4627 | |
4626 | 4628 | $course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id()); |
4627 | - if (api_get_setting('search.search_enabled') !== 'true') |
|
4628 | - return false; |
|
4629 | + if (api_get_setting('search.search_enabled') !== 'true') { |
|
4630 | + return false; |
|
4631 | + } |
|
4629 | 4632 | |
4630 | 4633 | if (!extension_loaded('xapian')) { |
4631 | 4634 | return false; |
@@ -4638,8 +4641,9 @@ discard block |
||
4638 | 4641 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4639 | 4642 | |
4640 | 4643 | // Don't do anything if no change, verify only at DB, not the search engine. |
4641 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4642 | - return false; |
|
4644 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4645 | + return false; |
|
4646 | + } |
|
4643 | 4647 | |
4644 | 4648 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4645 | 4649 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4830,8 +4834,9 @@ discard block |
||
4830 | 4834 | if ($this->debug > 0) { |
4831 | 4835 | error_log('New LP - In learnpath::set_proximity()', 0); |
4832 | 4836 | } |
4833 | - if (empty ($name)) |
|
4834 | - return false; |
|
4837 | + if (empty ($name)) { |
|
4838 | + return false; |
|
4839 | + } |
|
4835 | 4840 | |
4836 | 4841 | $this->proximity = $name; |
4837 | 4842 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5173,8 +5178,9 @@ discard block |
||
5173 | 5178 | |
5174 | 5179 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5175 | 5180 | $res = Database::query($sql); |
5176 | - if ($res === false) |
|
5177 | - return false; |
|
5181 | + if ($res === false) { |
|
5182 | + return false; |
|
5183 | + } |
|
5178 | 5184 | |
5179 | 5185 | $num = Database :: num_rows($res); |
5180 | 5186 | // First check the order is correct, globally (might be wrong because |
@@ -5485,8 +5491,9 @@ discard block |
||
5485 | 5491 | $position[$key] = $row['display_order']; |
5486 | 5492 | } |
5487 | 5493 | |
5488 | - if (count($array) > 0) |
|
5489 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5494 | + if (count($array) > 0) { |
|
5495 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5496 | + } |
|
5490 | 5497 | |
5491 | 5498 | return $array; |
5492 | 5499 | } |
@@ -6181,10 +6188,12 @@ discard block |
||
6181 | 6188 | if ($new_comment || $new_title) { |
6182 | 6189 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6183 | 6190 | $ct = ''; |
6184 | - if ($new_comment) |
|
6185 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6186 | - if ($new_title) |
|
6187 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6191 | + if ($new_comment) { |
|
6192 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6193 | + } |
|
6194 | + if ($new_title) { |
|
6195 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6196 | + } |
|
6188 | 6197 | |
6189 | 6198 | $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)." |
6190 | 6199 | WHERE c_id = ".$course_id." AND id = ".$document_id; |
@@ -6209,17 +6218,21 @@ discard block |
||
6209 | 6218 | // Please, do not modify this dirname formatting. |
6210 | 6219 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6211 | 6220 | |
6212 | - if (strstr($dir, '..')) |
|
6213 | - $dir = '/'; |
|
6221 | + if (strstr($dir, '..')) { |
|
6222 | + $dir = '/'; |
|
6223 | + } |
|
6214 | 6224 | |
6215 | - if ($dir[0] == '.') |
|
6216 | - $dir = substr($dir, 1); |
|
6225 | + if ($dir[0] == '.') { |
|
6226 | + $dir = substr($dir, 1); |
|
6227 | + } |
|
6217 | 6228 | |
6218 | - if ($dir[0] != '/') |
|
6219 | - $dir = '/' . $dir; |
|
6229 | + if ($dir[0] != '/') { |
|
6230 | + $dir = '/' . $dir; |
|
6231 | + } |
|
6220 | 6232 | |
6221 | - if ($dir[strlen($dir) - 1] != '/') |
|
6222 | - $dir .= '/'; |
|
6233 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6234 | + $dir .= '/'; |
|
6235 | + } |
|
6223 | 6236 | |
6224 | 6237 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6225 | 6238 | |
@@ -6286,8 +6299,9 @@ discard block |
||
6286 | 6299 | } |
6287 | 6300 | $return .= '<div style="padding:10px;">'; |
6288 | 6301 | |
6289 | - if ($msg != '') |
|
6290 | - $return .= $msg; |
|
6302 | + if ($msg != '') { |
|
6303 | + $return .= $msg; |
|
6304 | + } |
|
6291 | 6305 | |
6292 | 6306 | $return .= '<h3>'.$row['title'].'</h3>'; |
6293 | 6307 | switch ($row['item_type']) { |
@@ -6542,10 +6556,11 @@ discard block |
||
6542 | 6556 | $item_title = Security::remove_XSS($item_title); |
6543 | 6557 | $item_description = Security::remove_XSS($item_description); |
6544 | 6558 | |
6545 | - if ($id != 0 && is_array($extra_info)) |
|
6546 | - $parent = $extra_info['parent_item_id']; |
|
6547 | - else |
|
6548 | - $parent = 0; |
|
6559 | + if ($id != 0 && is_array($extra_info)) { |
|
6560 | + $parent = $extra_info['parent_item_id']; |
|
6561 | + } else { |
|
6562 | + $parent = 0; |
|
6563 | + } |
|
6549 | 6564 | |
6550 | 6565 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6551 | 6566 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6818,11 +6833,13 @@ discard block |
||
6818 | 6833 | } |
6819 | 6834 | |
6820 | 6835 | $legend = '<legend>'; |
6821 | - if ($action == 'add') |
|
6822 | - $legend .= get_lang('CreateTheExercise'); |
|
6823 | - elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise'); |
|
6824 | - else |
|
6825 | - $legend .= get_lang('EditCurrentExecice'); |
|
6836 | + if ($action == 'add') { |
|
6837 | + $legend .= get_lang('CreateTheExercise'); |
|
6838 | + } elseif ($action == 'move') { |
|
6839 | + $legend .= get_lang('MoveTheCurrentExercise'); |
|
6840 | + } else { |
|
6841 | + $legend .= get_lang('EditCurrentExecice'); |
|
6842 | + } |
|
6826 | 6843 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
6827 | 6844 | $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
6828 | 6845 | } |
@@ -6849,8 +6866,9 @@ discard block |
||
6849 | 6866 | $arrHide[] = $arrLP[$i]['id']; |
6850 | 6867 | } |
6851 | 6868 | } else { |
6852 | - if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
|
6853 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6869 | + if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') { |
|
6870 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6871 | + } |
|
6854 | 6872 | } |
6855 | 6873 | } |
6856 | 6874 | |
@@ -6868,11 +6886,13 @@ discard block |
||
6868 | 6886 | |
6869 | 6887 | for ($i = 0; $i < count($arrLP); $i++) { |
6870 | 6888 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6871 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6889 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6890 | + $selected = 'selected="selected" '; |
|
6891 | + } elseif ($action == 'add') { |
|
6872 | 6892 | $selected = 'selected="selected" '; |
6873 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6874 | - else |
|
6875 | - $selected = ''; |
|
6893 | + } else { |
|
6894 | + $selected = ''; |
|
6895 | + } |
|
6876 | 6896 | |
6877 | 6897 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6878 | 6898 | } |
@@ -6899,9 +6919,11 @@ discard block |
||
6899 | 6919 | $arrHide = array (); |
6900 | 6920 | for ($i = 0; $i < count($arrLP); $i++) { |
6901 | 6921 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
6902 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6903 | - $s_selected_position = $arrLP[$i]['id']; |
|
6904 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6922 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6923 | + $s_selected_position = $arrLP[$i]['id']; |
|
6924 | + } elseif ($action == 'add') { |
|
6925 | + $s_selected_position = 0; |
|
6926 | + } |
|
6905 | 6927 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6906 | 6928 | |
6907 | 6929 | } |
@@ -7097,9 +7119,11 @@ discard block |
||
7097 | 7119 | $arrHide = array(); |
7098 | 7120 | for ($i = 0; $i < count($arrLP); $i++) { |
7099 | 7121 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7100 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7101 | - $s_selected_position = $arrLP[$i]['id']; |
|
7102 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7122 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7123 | + $s_selected_position = $arrLP[$i]['id']; |
|
7124 | + } elseif ($action == 'add') { |
|
7125 | + $s_selected_position = 0; |
|
7126 | + } |
|
7103 | 7127 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7104 | 7128 | } |
7105 | 7129 | } |
@@ -7302,9 +7326,11 @@ discard block |
||
7302 | 7326 | |
7303 | 7327 | for ($i = 0; $i < count($arrLP); $i++) { |
7304 | 7328 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7305 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7306 | - $s_selected_position = $arrLP[$i]['id']; |
|
7307 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7329 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7330 | + $s_selected_position = $arrLP[$i]['id']; |
|
7331 | + } elseif ($action == 'add') { |
|
7332 | + $s_selected_position = 0; |
|
7333 | + } |
|
7308 | 7334 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7309 | 7335 | |
7310 | 7336 | } |
@@ -7338,8 +7364,7 @@ discard block |
||
7338 | 7364 | |
7339 | 7365 | if (is_numeric($extra_info)) { |
7340 | 7366 | $form->addHidden('path', $extra_info); |
7341 | - } |
|
7342 | - elseif (is_array($extra_info)) { |
|
7367 | + } elseif (is_array($extra_info)) { |
|
7343 | 7368 | $form->addHidden('path', $extra_info['path']); |
7344 | 7369 | } |
7345 | 7370 | |
@@ -7392,8 +7417,9 @@ discard block |
||
7392 | 7417 | lp_id = " . $this->lp_id . " AND |
7393 | 7418 | id != $id"; |
7394 | 7419 | |
7395 | - if ($item_type == 'module') |
|
7396 | - $sql .= " AND parent_item_id = 0"; |
|
7420 | + if ($item_type == 'module') { |
|
7421 | + $sql .= " AND parent_item_id = 0"; |
|
7422 | + } |
|
7397 | 7423 | |
7398 | 7424 | $result = Database::query($sql); |
7399 | 7425 | $arrLP = array (); |
@@ -7771,9 +7797,11 @@ discard block |
||
7771 | 7797 | //POSITION |
7772 | 7798 | for ($i = 0; $i < count($arrLP); $i++) { |
7773 | 7799 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
7774 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7800 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7801 | + $s_selected_position = $arrLP[$i]['id']; |
|
7802 | + } elseif ($action == 'add') { |
|
7775 | 7803 | $s_selected_position = $arrLP[$i]['id']; |
7776 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7804 | + } |
|
7777 | 7805 | $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
7778 | 7806 | } |
7779 | 7807 | } |
@@ -7806,9 +7834,11 @@ discard block |
||
7806 | 7834 | |
7807 | 7835 | for ($i = 0; $i < count($arrLP); $i++) { |
7808 | 7836 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
7809 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7837 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7838 | + $s_selected_position = $arrLP[$i]['id']; |
|
7839 | + } elseif ($action == 'add') { |
|
7810 | 7840 | $s_selected_position = $arrLP[$i]['id']; |
7811 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7841 | + } |
|
7812 | 7842 | |
7813 | 7843 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7814 | 7844 | |
@@ -7819,17 +7849,18 @@ discard block |
||
7819 | 7849 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7820 | 7850 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7821 | 7851 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) { |
7822 | - if (isset ($_POST['content'])) |
|
7823 | - $content = stripslashes($_POST['content']); |
|
7824 | - elseif (is_array($extra_info)) { |
|
7852 | + if (isset ($_POST['content'])) { |
|
7853 | + $content = stripslashes($_POST['content']); |
|
7854 | + } elseif (is_array($extra_info)) { |
|
7825 | 7855 | //If it's an html document or a text file |
7826 | 7856 | if (!$no_display_edit_textarea) { |
7827 | 7857 | $content = $this->display_document($extra_info['path'], false, false); |
7828 | 7858 | } |
7829 | - } elseif (is_numeric($extra_info)) |
|
7830 | - $content = $this->display_document($extra_info, false, false); |
|
7831 | - else |
|
7832 | - $content = ''; |
|
7859 | + } elseif (is_numeric($extra_info)) { |
|
7860 | + $content = $this->display_document($extra_info, false, false); |
|
7861 | + } else { |
|
7862 | + $content = ''; |
|
7863 | + } |
|
7833 | 7864 | |
7834 | 7865 | if (!$no_display_edit_textarea) { |
7835 | 7866 | // We need to calculate here some specific settings for the online editor. |
@@ -8094,9 +8125,11 @@ discard block |
||
8094 | 8125 | $arrHide = array(); |
8095 | 8126 | for ($i = 0; $i < count($arrLP); $i++) { |
8096 | 8127 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
8097 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8098 | - $s_selected_position = $arrLP[$i]['id']; |
|
8099 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8128 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8129 | + $s_selected_position = $arrLP[$i]['id']; |
|
8130 | + } elseif ($action == 'add') { |
|
8131 | + $s_selected_position = 0; |
|
8132 | + } |
|
8100 | 8133 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8101 | 8134 | |
8102 | 8135 | } |
@@ -8299,9 +8332,11 @@ discard block |
||
8299 | 8332 | $arrHide = array (); |
8300 | 8333 | for ($i = 0; $i < count($arrLP); $i++) { |
8301 | 8334 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
8302 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8303 | - $s_selected_position = $arrLP[$i]['id']; |
|
8304 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8335 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8336 | + $s_selected_position = $arrLP[$i]['id']; |
|
8337 | + } elseif ($action == 'add') { |
|
8338 | + $s_selected_position = 0; |
|
8339 | + } |
|
8305 | 8340 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8306 | 8341 | |
8307 | 8342 | } |
@@ -9996,9 +10031,9 @@ discard block |
||
9996 | 10031 | $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/'; |
9997 | 10032 | $extra_files = scandir($main_code_path); |
9998 | 10033 | foreach ($extra_files as $extra_file) { |
9999 | - if (strpos($extra_file, '.') === 0) |
|
10000 | - continue; |
|
10001 | - else { |
|
10034 | + if (strpos($extra_file, '.') === 0) { |
|
10035 | + continue; |
|
10036 | + } else { |
|
10002 | 10037 | $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file; |
10003 | 10038 | $this->create_path($dest_file); |
10004 | 10039 | copy($main_code_path.$extra_file, $dest_file); |