@@ -123,8 +123,9 @@ |
||
123 | 123 | |
124 | 124 | for ($i = 0; $i < count($matches[0]); $i++) { |
125 | 125 | |
126 | - if (empty($matches[1][$i])) |
|
127 | - continue; |
|
126 | + if (empty($matches[1][$i])) { |
|
127 | + continue; |
|
128 | + } |
|
128 | 129 | |
129 | 130 | $content = strstr($content,$matches[0][$i]); |
130 | 131 | if ($i + 1 !== count($matches[0])) { |
@@ -3881,8 +3881,9 @@ discard block |
||
3881 | 3881 | WHERE c_id = ".$course_id." |
3882 | 3882 | ORDER BY display_order"; |
3883 | 3883 | $res = Database::query($sql); |
3884 | - if ($res === false) |
|
3885 | - return false; |
|
3884 | + if ($res === false) { |
|
3885 | + return false; |
|
3886 | + } |
|
3886 | 3887 | $lps = array (); |
3887 | 3888 | $lp_order = array (); |
3888 | 3889 | $num = Database :: num_rows($res); |
@@ -4480,8 +4481,9 @@ discard block |
||
4480 | 4481 | if ($this->debug > 0) { |
4481 | 4482 | error_log('New LP - In learnpath::set_maker()', 0); |
4482 | 4483 | } |
4483 | - if (empty ($name)) |
|
4484 | - return false; |
|
4484 | + if (empty ($name)) { |
|
4485 | + return false; |
|
4486 | + } |
|
4485 | 4487 | $this->maker = $name; |
4486 | 4488 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
4487 | 4489 | $course_id = api_get_course_int_id(); |
@@ -4546,8 +4548,9 @@ discard block |
||
4546 | 4548 | public function set_terms_by_prefix($terms_string, $prefix) |
4547 | 4549 | { |
4548 | 4550 | $course_id = api_get_course_int_id(); |
4549 | - if (api_get_setting('search_enabled') !== 'true') |
|
4550 | - return false; |
|
4551 | + if (api_get_setting('search_enabled') !== 'true') { |
|
4552 | + return false; |
|
4553 | + } |
|
4551 | 4554 | |
4552 | 4555 | if (!extension_loaded('xapian')) { |
4553 | 4556 | return false; |
@@ -4560,8 +4563,9 @@ discard block |
||
4560 | 4563 | $stored_terms = $this->get_common_index_terms_by_prefix($prefix); |
4561 | 4564 | |
4562 | 4565 | // Don't do anything if no change, verify only at DB, not the search engine. |
4563 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
4564 | - return false; |
|
4566 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
4567 | + return false; |
|
4568 | + } |
|
4565 | 4569 | |
4566 | 4570 | require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API. |
4567 | 4571 | require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
@@ -4753,8 +4757,9 @@ discard block |
||
4753 | 4757 | if ($this->debug > 0) { |
4754 | 4758 | error_log('New LP - In learnpath::set_proximity()', 0); |
4755 | 4759 | } |
4756 | - if (empty ($name)) |
|
4757 | - return false; |
|
4760 | + if (empty ($name)) { |
|
4761 | + return false; |
|
4762 | + } |
|
4758 | 4763 | |
4759 | 4764 | $this->proximity = $name; |
4760 | 4765 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
@@ -5098,8 +5103,9 @@ discard block |
||
5098 | 5103 | |
5099 | 5104 | $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order"; |
5100 | 5105 | $res = Database::query($sql); |
5101 | - if ($res === false) |
|
5102 | - return false; |
|
5106 | + if ($res === false) { |
|
5107 | + return false; |
|
5108 | + } |
|
5103 | 5109 | |
5104 | 5110 | $num = Database :: num_rows($res); |
5105 | 5111 | // First check the order is correct, globally (might be wrong because |
@@ -5410,8 +5416,9 @@ discard block |
||
5410 | 5416 | $position[$key] = $row['display_order']; |
5411 | 5417 | } |
5412 | 5418 | |
5413 | - if (count($array) > 0) |
|
5414 | - array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5419 | + if (count($array) > 0) { |
|
5420 | + array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array); |
|
5421 | + } |
|
5415 | 5422 | |
5416 | 5423 | return $array; |
5417 | 5424 | } |
@@ -6183,10 +6190,12 @@ discard block |
||
6183 | 6190 | if ($new_comment || $new_title) { |
6184 | 6191 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
6185 | 6192 | $ct = ''; |
6186 | - if ($new_comment) |
|
6187 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6188 | - if ($new_title) |
|
6189 | - $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6193 | + if ($new_comment) { |
|
6194 | + $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
6195 | + } |
|
6196 | + if ($new_title) { |
|
6197 | + $ct .= ", title='" . Database::escape_string($new_title)."' "; |
|
6198 | + } |
|
6190 | 6199 | |
6191 | 6200 | $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
6192 | 6201 | WHERE c_id = ".$course_id." AND id = " . $document_id; |
@@ -6210,17 +6219,21 @@ discard block |
||
6210 | 6219 | // Please, do not modify this dirname formatting. |
6211 | 6220 | $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir']; |
6212 | 6221 | |
6213 | - if (strstr($dir, '..')) |
|
6214 | - $dir = '/'; |
|
6222 | + if (strstr($dir, '..')) { |
|
6223 | + $dir = '/'; |
|
6224 | + } |
|
6215 | 6225 | |
6216 | - if ($dir[0] == '.') |
|
6217 | - $dir = substr($dir, 1); |
|
6226 | + if ($dir[0] == '.') { |
|
6227 | + $dir = substr($dir, 1); |
|
6228 | + } |
|
6218 | 6229 | |
6219 | - if ($dir[0] != '/') |
|
6220 | - $dir = '/' . $dir; |
|
6230 | + if ($dir[0] != '/') { |
|
6231 | + $dir = '/' . $dir; |
|
6232 | + } |
|
6221 | 6233 | |
6222 | - if ($dir[strlen($dir) - 1] != '/') |
|
6223 | - $dir .= '/'; |
|
6234 | + if ($dir[strlen($dir) - 1] != '/') { |
|
6235 | + $dir .= '/'; |
|
6236 | + } |
|
6224 | 6237 | |
6225 | 6238 | $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
6226 | 6239 | |
@@ -6285,8 +6298,9 @@ discard block |
||
6285 | 6298 | } |
6286 | 6299 | $return .= '<div style="padding:10px;">'; |
6287 | 6300 | |
6288 | - if ($msg != '') |
|
6289 | - $return .= $msg; |
|
6301 | + if ($msg != '') { |
|
6302 | + $return .= $msg; |
|
6303 | + } |
|
6290 | 6304 | |
6291 | 6305 | $return .= '<h3>'.$row['title'].'</h3>'; |
6292 | 6306 | switch ($row['item_type']) { |
@@ -6563,10 +6577,11 @@ discard block |
||
6563 | 6577 | $item_title = Security::remove_XSS($item_title); |
6564 | 6578 | $item_description = Security::remove_XSS($item_description); |
6565 | 6579 | |
6566 | - if ($id != 0 && is_array($extra_info)) |
|
6567 | - $parent = $extra_info['parent_item_id']; |
|
6568 | - else |
|
6569 | - $parent = 0; |
|
6580 | + if ($id != 0 && is_array($extra_info)) { |
|
6581 | + $parent = $extra_info['parent_item_id']; |
|
6582 | + } else { |
|
6583 | + $parent = 0; |
|
6584 | + } |
|
6570 | 6585 | |
6571 | 6586 | $sql = "SELECT * FROM " . $tbl_lp_item . " |
6572 | 6587 | WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
@@ -6866,8 +6881,9 @@ discard block |
||
6866 | 6881 | $arrHide[] = $arrLP[$i]['id']; |
6867 | 6882 | } |
6868 | 6883 | } else { |
6869 | - if ($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>'; |
|
6884 | + if ($arrLP[$i]['item_type'] == 'dir') { |
|
6885 | + $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
6886 | + } |
|
6871 | 6887 | } |
6872 | 6888 | } |
6873 | 6889 | reset($arrLP); |
@@ -6884,11 +6900,13 @@ discard block |
||
6884 | 6900 | |
6885 | 6901 | for ($i = 0; $i < count($arrLP); $i++) { |
6886 | 6902 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
6887 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6903 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6904 | + $selected = 'selected="selected" '; |
|
6905 | + } elseif ($action == 'add') { |
|
6888 | 6906 | $selected = 'selected="selected" '; |
6889 | - elseif ($action == 'add') $selected = 'selected="selected" '; |
|
6890 | - else |
|
6891 | - $selected = ''; |
|
6907 | + } else { |
|
6908 | + $selected = ''; |
|
6909 | + } |
|
6892 | 6910 | |
6893 | 6911 | $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
6894 | 6912 | } |
@@ -6915,9 +6933,11 @@ discard block |
||
6915 | 6933 | $arrHide = array (); |
6916 | 6934 | for ($i = 0; $i < count($arrLP); $i++) { |
6917 | 6935 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
6918 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
6919 | - $s_selected_position = $arrLP[$i]['id']; |
|
6920 | - elseif ($action == 'add') $s_selected_position = 0; |
|
6936 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
6937 | + $s_selected_position = $arrLP[$i]['id']; |
|
6938 | + } elseif ($action == 'add') { |
|
6939 | + $s_selected_position = 0; |
|
6940 | + } |
|
6921 | 6941 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
6922 | 6942 | } |
6923 | 6943 | } |
@@ -7110,9 +7130,11 @@ discard block |
||
7110 | 7130 | $arrHide = array(); |
7111 | 7131 | for ($i = 0; $i < count($arrLP); $i++) { |
7112 | 7132 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7113 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7114 | - $s_selected_position = $arrLP[$i]['id']; |
|
7115 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7133 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7134 | + $s_selected_position = $arrLP[$i]['id']; |
|
7135 | + } elseif ($action == 'add') { |
|
7136 | + $s_selected_position = 0; |
|
7137 | + } |
|
7116 | 7138 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7117 | 7139 | } |
7118 | 7140 | } |
@@ -7307,9 +7329,11 @@ discard block |
||
7307 | 7329 | |
7308 | 7330 | for ($i = 0; $i < count($arrLP); $i++) { |
7309 | 7331 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
7310 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7311 | - $s_selected_position = $arrLP[$i]['id']; |
|
7312 | - elseif ($action == 'add') $s_selected_position = 0; |
|
7332 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7333 | + $s_selected_position = $arrLP[$i]['id']; |
|
7334 | + } elseif ($action == 'add') { |
|
7335 | + $s_selected_position = 0; |
|
7336 | + } |
|
7313 | 7337 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7314 | 7338 | |
7315 | 7339 | } |
@@ -7343,8 +7367,7 @@ discard block |
||
7343 | 7367 | |
7344 | 7368 | if (is_numeric($extra_info)) { |
7345 | 7369 | $form->addHidden('path', $extra_info); |
7346 | - } |
|
7347 | - elseif (is_array($extra_info)) { |
|
7370 | + } elseif (is_array($extra_info)) { |
|
7348 | 7371 | $form->addHidden('path', $extra_info['path']); |
7349 | 7372 | } |
7350 | 7373 | |
@@ -7397,8 +7420,9 @@ discard block |
||
7397 | 7420 | lp_id = " . $this->lp_id . " AND |
7398 | 7421 | id != $id"; |
7399 | 7422 | |
7400 | - if ($item_type == 'dir') |
|
7401 | - $sql .= " AND parent_item_id = 0"; |
|
7423 | + if ($item_type == 'dir') { |
|
7424 | + $sql .= " AND parent_item_id = 0"; |
|
7425 | + } |
|
7402 | 7426 | |
7403 | 7427 | $result = Database::query($sql); |
7404 | 7428 | $arrLP = array (); |
@@ -7795,9 +7819,11 @@ discard block |
||
7795 | 7819 | $arrHide = array(); |
7796 | 7820 | for ($i = 0; $i < count($arrLP); $i++) { |
7797 | 7821 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) { |
7798 | - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
7822 | + if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
7823 | + $s_selected_position = $arrLP[$i]['id']; |
|
7824 | + } elseif ($action == 'add') { |
|
7799 | 7825 | $s_selected_position = $arrLP[$i]['id']; |
7800 | - elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
|
7826 | + } |
|
7801 | 7827 | |
7802 | 7828 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
7803 | 7829 | |
@@ -7808,17 +7834,18 @@ discard block |
||
7808 | 7834 | $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; |
7809 | 7835 | $edit = isset($_GET['edit']) ? $_GET['edit'] : null; |
7810 | 7836 | if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) { |
7811 | - if (isset ($_POST['content'])) |
|
7812 | - $content = stripslashes($_POST['content']); |
|
7813 | - elseif (is_array($extra_info)) { |
|
7837 | + if (isset ($_POST['content'])) { |
|
7838 | + $content = stripslashes($_POST['content']); |
|
7839 | + } elseif (is_array($extra_info)) { |
|
7814 | 7840 | //If it's an html document or a text file |
7815 | 7841 | if (!$no_display_edit_textarea) { |
7816 | 7842 | $content = $this->display_document($extra_info['path'], false, false); |
7817 | 7843 | } |
7818 | - } elseif (is_numeric($extra_info)) |
|
7819 | - $content = $this->display_document($extra_info, false, false); |
|
7820 | - else |
|
7821 | - $content = ''; |
|
7844 | + } elseif (is_numeric($extra_info)) { |
|
7845 | + $content = $this->display_document($extra_info, false, false); |
|
7846 | + } else { |
|
7847 | + $content = ''; |
|
7848 | + } |
|
7822 | 7849 | |
7823 | 7850 | if (!$no_display_edit_textarea) { |
7824 | 7851 | // We need to calculate here some specific settings for the online editor. |
@@ -8082,9 +8109,11 @@ discard block |
||
8082 | 8109 | $arrHide = array(); |
8083 | 8110 | for ($i = 0; $i < count($arrLP); $i++) { |
8084 | 8111 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8085 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8086 | - $s_selected_position = $arrLP[$i]['id']; |
|
8087 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8112 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8113 | + $s_selected_position = $arrLP[$i]['id']; |
|
8114 | + } elseif ($action == 'add') { |
|
8115 | + $s_selected_position = 0; |
|
8116 | + } |
|
8088 | 8117 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8089 | 8118 | |
8090 | 8119 | } |
@@ -8280,9 +8309,11 @@ discard block |
||
8280 | 8309 | $arrHide = array (); |
8281 | 8310 | for ($i = 0; $i < count($arrLP); $i++) { |
8282 | 8311 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir') { |
8283 | - if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
|
8284 | - $s_selected_position = $arrLP[$i]['id']; |
|
8285 | - elseif ($action == 'add') $s_selected_position = 0; |
|
8312 | + if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) { |
|
8313 | + $s_selected_position = $arrLP[$i]['id']; |
|
8314 | + } elseif ($action == 'add') { |
|
8315 | + $s_selected_position = 0; |
|
8316 | + } |
|
8286 | 8317 | $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
8287 | 8318 | |
8288 | 8319 | } |
@@ -9353,10 +9384,11 @@ discard block |
||
9353 | 9384 | |
9354 | 9385 | // Dependency to other files - not yet supported. |
9355 | 9386 | $i = 1; |
9356 | - if ($inc_docs) |
|
9357 | - foreach ($inc_docs as $doc_info) { |
|
9387 | + if ($inc_docs) { |
|
9388 | + foreach ($inc_docs as $doc_info) { |
|
9358 | 9389 | if (count($doc_info) < 1 || empty($doc_info[0])) { |
9359 | 9390 | continue; |
9391 | + } |
|
9360 | 9392 | } |
9361 | 9393 | $my_dep = $xmldoc->createElement('resource'); |
9362 | 9394 | $res_id = 'RESOURCE_'.$item->get_id().'_'.$i; |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_assoc($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -231,36 +231,51 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | if (isset($user_id)) { |
234 | - if ($paramcount != 0) $sql .= ' AND'; |
|
235 | - else $sql .= ' WHERE'; |
|
234 | + if ($paramcount != 0) { |
|
235 | + $sql .= ' AND'; |
|
236 | + } else { |
|
237 | + $sql .= ' WHERE'; |
|
238 | + } |
|
236 | 239 | $sql .= ' user_id = '.intval($user_id); |
237 | 240 | $paramcount ++; |
238 | 241 | } |
239 | 242 | |
240 | 243 | if (isset($course_code) && $course_code <> '-1') { |
241 | - if ($paramcount != 0) $sql .= ' AND'; |
|
242 | - else $sql .= ' WHERE'; |
|
244 | + if ($paramcount != 0) { |
|
245 | + $sql .= ' AND'; |
|
246 | + } else { |
|
247 | + $sql .= ' WHERE'; |
|
248 | + } |
|
243 | 249 | $sql .= " course_code = '".Database::escape_string($course_code)."'"; |
244 | 250 | $paramcount ++; |
245 | 251 | } |
246 | 252 | |
247 | 253 | if (isset($category_id)) { |
248 | - if ($paramcount != 0) $sql .= ' AND'; |
|
249 | - else $sql .= ' WHERE'; |
|
254 | + if ($paramcount != 0) { |
|
255 | + $sql .= ' AND'; |
|
256 | + } else { |
|
257 | + $sql .= ' WHERE'; |
|
258 | + } |
|
250 | 259 | $sql .= ' category_id = '.intval($category_id); |
251 | 260 | $paramcount ++; |
252 | 261 | } |
253 | 262 | |
254 | 263 | if (isset($visible)) { |
255 | - if ($paramcount != 0) $sql .= ' AND'; |
|
256 | - else $sql .= ' WHERE'; |
|
264 | + if ($paramcount != 0) { |
|
265 | + $sql .= ' AND'; |
|
266 | + } else { |
|
267 | + $sql .= ' WHERE'; |
|
268 | + } |
|
257 | 269 | $sql .= ' visible = '.intval($visible); |
258 | 270 | $paramcount ++; |
259 | 271 | } |
260 | 272 | |
261 | 273 | if (isset($locked)) { |
262 | - if ($paramcount != 0) $sql .= ' AND'; |
|
263 | - else $sql .= ' WHERE'; |
|
274 | + if ($paramcount != 0) { |
|
275 | + $sql .= ' AND'; |
|
276 | + } else { |
|
277 | + $sql .= ' WHERE'; |
|
278 | + } |
|
264 | 279 | $sql .= ' locked = '.intval($locked); |
265 | 280 | } |
266 | 281 | |
@@ -398,7 +413,7 @@ discard block |
||
398 | 413 | .', description = '; |
399 | 414 | if (isset($this->description)) { |
400 | 415 | $sql .= "'".Database::escape_string($this->get_description())."'"; |
401 | - }else { |
|
416 | + } else { |
|
402 | 417 | $sql .= 'null'; |
403 | 418 | } |
404 | 419 | $sql .= ', user_id = '.intval($this->get_user_id()) |
@@ -469,7 +484,7 @@ discard block |
||
469 | 484 | $sql .= ' AND user_id = '.api_get_user_id(); |
470 | 485 | } |
471 | 486 | |
472 | - }else { |
|
487 | + } else { |
|
473 | 488 | $sql .= ' AND user_id = '.api_get_user_id(); |
474 | 489 | } |
475 | 490 |
@@ -173,7 +173,10 @@ |
||
173 | 173 | echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions'); ?> : |
174 | 174 | <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()"> |
175 | 175 | </div> |
176 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
176 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
177 | + echo '&add=true' ; |
|
178 | +} |
|
179 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
177 | 180 | <?php |
178 | 181 | echo '<legend>'.$data['name'].': '.$tool_name.'</legend>'; |
179 | 182 | echo Display::input('hidden','id',$id); |
@@ -96,13 +96,14 @@ |
||
96 | 96 | |
97 | 97 | $is_certificate_mode = DocumentManager::is_certificate_mode($dir); |
98 | 98 | |
99 | -if (!$is_certificate_mode) |
|
99 | +if (!$is_certificate_mode) { |
|
100 | 100 | $interbreadcrumb[] = array( |
101 | 101 | "url" => "./document.php?curdirpath=".urlencode($my_cur_dir_path).'&'.api_get_cidreq(), |
102 | 102 | "name" => get_lang('Documents'), |
103 | 103 | ); |
104 | -else |
|
104 | +} else { |
|
105 | 105 | $interbreadcrumb[] = array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); |
106 | +} |
|
106 | 107 | |
107 | 108 | // Interbreadcrumb for the current directory root path |
108 | 109 | if (empty($document_data['parents'])) { |
@@ -491,13 +491,19 @@ |
||
491 | 491 | $id = intval($id); |
492 | 492 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." |
493 | 493 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
494 | - if (!Database::query($sql)) return false; |
|
494 | + if (!Database::query($sql)) { |
|
495 | + return false; |
|
496 | + } |
|
495 | 497 | $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." |
496 | 498 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
497 | - if (!Database::query($sql)) return false; |
|
499 | + if (!Database::query($sql)) { |
|
500 | + return false; |
|
501 | + } |
|
498 | 502 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
499 | 503 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
500 | - if (!Database::query($sql)) return false; |
|
504 | + if (!Database::query($sql)) { |
|
505 | + return false; |
|
506 | + } |
|
501 | 507 | return true; |
502 | 508 | } |
503 | 509 |
@@ -483,7 +483,10 @@ discard block |
||
483 | 483 | <div class="actions"> |
484 | 484 | <?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> | <?php echo $link_add_group; ?> |
485 | 485 | </div> |
486 | - <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
486 | + <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) { |
|
487 | + echo '&add=true' ; |
|
488 | +} |
|
489 | +?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
487 | 490 | <?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?> |
488 | 491 | <?php |
489 | 492 | if ($add_type === 'multiple') { |
@@ -544,7 +547,10 @@ discard block |
||
544 | 547 | <?php |
545 | 548 | foreach ($nosessionUsersList as $uid => $enreg) { |
546 | 549 | ?> |
547 | - <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
550 | + <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) { |
|
551 | + echo 'selected="selected"'; |
|
552 | +} |
|
553 | +?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
548 | 554 | <?php |
549 | 555 | } |
550 | 556 | ?> |
@@ -1203,10 +1203,11 @@ |
||
1203 | 1203 | $result_last_attempt = Database::query($sql); |
1204 | 1204 | if (Database :: num_rows($result_last_attempt) > 0) { |
1205 | 1205 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
1206 | - if ($count_attempts > 0) |
|
1207 | - echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1206 | + if ($count_attempts > 0) { |
|
1207 | + echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'"> |
|
1208 | 1208 | '.Display::return_icon('quiz.png').' |
1209 | 1209 | </a>'; |
1210 | + } |
|
1210 | 1211 | } |
1211 | 1212 | echo '</td>'; |
1212 | 1213 |