@@ -15,52 +15,52 @@ |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | switch ($_REQUEST['action']) { |
18 | - case "get": |
|
19 | - print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
20 | - break; |
|
21 | - case "set": |
|
22 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
23 | - print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
24 | - } |
|
25 | - break; |
|
26 | - case "getall": |
|
27 | - print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']); |
|
28 | - break; |
|
29 | - case "stackpush": |
|
30 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
31 | - print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
32 | - } |
|
33 | - break; |
|
34 | - case "stackpop": |
|
35 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
36 | - print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
37 | - } |
|
38 | - break; |
|
39 | - case "stacklength": |
|
40 | - print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
41 | - break; |
|
42 | - case "stackclear": |
|
43 | - if (storage_can_set($_REQUEST['svuser'])) { |
|
44 | - print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
45 | - } |
|
46 | - break; |
|
47 | - case "stackgetall": |
|
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | - break; |
|
51 | - case "getposition": |
|
52 | - print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
|
53 | - break; |
|
54 | - case "getleaders": |
|
55 | - print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']); |
|
56 | - break; |
|
57 | - case "usersgetall": |
|
58 | -// security issue |
|
59 | - print "NOT allowed, security issue, see sources"; |
|
60 | -// print storage_get_all_users(); |
|
61 | - break; |
|
62 | - default: |
|
63 | - // Do nothing |
|
18 | + case "get": |
|
19 | + print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
20 | + break; |
|
21 | + case "set": |
|
22 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
23 | + print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
24 | + } |
|
25 | + break; |
|
26 | + case "getall": |
|
27 | + print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']); |
|
28 | + break; |
|
29 | + case "stackpush": |
|
30 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
31 | + print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']); |
|
32 | + } |
|
33 | + break; |
|
34 | + case "stackpop": |
|
35 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
36 | + print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
37 | + } |
|
38 | + break; |
|
39 | + case "stacklength": |
|
40 | + print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
41 | + break; |
|
42 | + case "stackclear": |
|
43 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
44 | + print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
45 | + } |
|
46 | + break; |
|
47 | + case "stackgetall": |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + break; |
|
51 | + case "getposition": |
|
52 | + print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
|
53 | + break; |
|
54 | + case "getleaders": |
|
55 | + print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']); |
|
56 | + break; |
|
57 | + case "usersgetall": |
|
58 | + // security issue |
|
59 | + print "NOT allowed, security issue, see sources"; |
|
60 | + // print storage_get_all_users(); |
|
61 | + break; |
|
62 | + default: |
|
63 | + // Do nothing |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | function storage_can_set($sv_user) { |
@@ -45,8 +45,9 @@ discard block |
||
45 | 45 | } |
46 | 46 | break; |
47 | 47 | case "stackgetall": |
48 | - if (storage_can_set($_REQUEST['svuser'])) |
|
49 | - print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
48 | + if (storage_can_set($_REQUEST['svuser'])) { |
|
49 | + print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']); |
|
50 | + } |
|
50 | 51 | break; |
51 | 52 | case "getposition": |
52 | 53 | print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']); |
@@ -63,7 +64,8 @@ discard block |
||
63 | 64 | // Do nothing |
64 | 65 | } |
65 | 66 | |
66 | -function storage_can_set($sv_user) { |
|
67 | +function storage_can_set($sv_user) |
|
68 | +{ |
|
67 | 69 | // platform admin can change any user's stored values, other users can only change their own values |
68 | 70 | $allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id())); |
69 | 71 | if (!$allowed) { |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | return $allowed; |
73 | 75 | } |
74 | 76 | |
75 | -function storage_get($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
77 | +function storage_get($sv_user, $sv_course, $sv_sco, $sv_key) |
|
78 | +{ |
|
76 | 79 | $sql = "select sv_value |
77 | 80 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
78 | 81 | where user_id= '$sv_user' |
@@ -87,13 +90,13 @@ discard block |
||
87 | 90 | } else { |
88 | 91 | return $row['sv_value']; |
89 | 92 | } |
90 | - } |
|
91 | - else { |
|
93 | + } else { |
|
92 | 94 | return null; |
93 | 95 | } |
94 | 96 | } |
95 | 97 | |
96 | -function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) { |
|
98 | +function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) |
|
99 | +{ |
|
97 | 100 | |
98 | 101 | // get leaders |
99 | 102 | $sql_leaders = "select u.user_id, firstname, lastname, email, username, sv_value as value |
@@ -127,7 +130,8 @@ discard block |
||
127 | 130 | return json_encode($result); |
128 | 131 | } |
129 | 132 | |
130 | -function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) { |
|
133 | +function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $sv_length) |
|
134 | +{ |
|
131 | 135 | $sql = "select count(list.user_id) as position |
132 | 136 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." search, |
133 | 137 | ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." list |
@@ -144,13 +148,13 @@ discard block |
||
144 | 148 | if (Database::num_rows($res) > 0) { |
145 | 149 | $row = Database::fetch_assoc($res); |
146 | 150 | return $row['position']; |
147 | - } |
|
148 | - else { |
|
151 | + } else { |
|
149 | 152 | return null; |
150 | 153 | } |
151 | 154 | } |
152 | 155 | |
153 | -function storage_set($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) { |
|
156 | +function storage_set($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) |
|
157 | +{ |
|
154 | 158 | $sv_value = Database::escape_string($sv_value); |
155 | 159 | $sql = "replace into ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
156 | 160 | (user_id, sco_id, course_id, sv_key, sv_value) |
@@ -160,7 +164,8 @@ discard block |
||
160 | 164 | return Database::affected_rows($res); |
161 | 165 | } |
162 | 166 | |
163 | -function storage_getall($sv_user, $sv_course, $sv_sco) { |
|
167 | +function storage_getall($sv_user, $sv_course, $sv_sco) |
|
168 | +{ |
|
164 | 169 | $sql = "select sv_key, sv_value |
165 | 170 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." |
166 | 171 | where user_id= '$sv_user' |
@@ -177,7 +182,8 @@ discard block |
||
177 | 182 | return json_encode($data); |
178 | 183 | } |
179 | 184 | |
180 | -function storage_stack_push($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) { |
|
185 | +function storage_stack_push($sv_user, $sv_course, $sv_sco, $sv_key, $sv_value) |
|
186 | +{ |
|
181 | 187 | $sv_value = Database::escape_string($sv_value); |
182 | 188 | Database::query("start transaction"); |
183 | 189 | $sqlorder = "select ifnull((select max(stack_order) |
@@ -198,14 +204,14 @@ discard block |
||
198 | 204 | if ($resorder && $resinsert) { |
199 | 205 | Database::query("commit"); |
200 | 206 | return 1; |
201 | - } |
|
202 | - else { |
|
207 | + } else { |
|
203 | 208 | Database::query("rollback"); |
204 | 209 | return 0; |
205 | 210 | } |
206 | 211 | } |
207 | 212 | |
208 | -function storage_stack_pop($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
213 | +function storage_stack_pop($sv_user, $sv_course, $sv_sco, $sv_key) |
|
214 | +{ |
|
209 | 215 | Database::query("start transaction"); |
210 | 216 | $sqlselect = "select sv_value, stack_order |
211 | 217 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
@@ -239,7 +245,8 @@ discard block |
||
239 | 245 | } |
240 | 246 | } |
241 | 247 | |
242 | -function storage_stack_length($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
248 | +function storage_stack_length($sv_user, $sv_course, $sv_sco, $sv_key) |
|
249 | +{ |
|
243 | 250 | $sql = "select count(*) as length |
244 | 251 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
245 | 252 | where user_id= '$sv_user' |
@@ -251,7 +258,8 @@ discard block |
||
251 | 258 | return $row['length']; |
252 | 259 | } |
253 | 260 | |
254 | -function storage_stack_clear($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
261 | +function storage_stack_clear($sv_user, $sv_course, $sv_sco, $sv_key) |
|
262 | +{ |
|
255 | 263 | $sql = "delete |
256 | 264 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
257 | 265 | where user_id= '$sv_user' |
@@ -262,7 +270,8 @@ discard block |
||
262 | 270 | return Database::num_rows($res); |
263 | 271 | } |
264 | 272 | |
265 | -function storage_stack_getall($sv_user, $sv_course, $sv_sco, $sv_key) { |
|
273 | +function storage_stack_getall($sv_user, $sv_course, $sv_sco, $sv_key) |
|
274 | +{ |
|
266 | 275 | $sql = "select stack_order as stack_order, sv_value as value |
267 | 276 | from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)." |
268 | 277 | where user_id= '$sv_user' |
@@ -280,7 +289,8 @@ discard block |
||
280 | 289 | return json_encode($results); |
281 | 290 | } |
282 | 291 | |
283 | -function storage_get_all_users() { |
|
292 | +function storage_get_all_users() |
|
293 | +{ |
|
284 | 294 | $sql = "select user_id, username, firstname, lastname |
285 | 295 | from ".Database::get_main_table(TABLE_MAIN_USER)." |
286 | 296 | order by user_id asc"; |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | //if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function. |
39 | 39 | $children = $element->childNodes; |
40 | 40 | foreach ($children as $child) { |
41 | - switch ($child->nodeType) { |
|
41 | + switch ($child->nodeType) { |
|
42 | 42 | case XML_ELEMENT_NODE: |
43 | 43 | switch ($child->tagName) { |
44 | 44 | case 'item': |
45 | 45 | $oItem = new scormItem('manifest', $child); |
46 | - if ($oItem->identifier != '') { |
|
46 | + if ($oItem->identifier != '') { |
|
47 | 47 | $this->items[$oItem->identifier] = $oItem; |
48 | - } |
|
48 | + } |
|
49 | 49 | break; |
50 | 50 | case 'metadata': |
51 | 51 | $this->metadata = new scormMetadata('manifest', $child); |
@@ -58,24 +58,24 @@ discard block |
||
58 | 58 | break; |
59 | 59 | } |
60 | 60 | break; |
61 | - case XML_TEXT_NODE: |
|
61 | + case XML_TEXT_NODE: |
|
62 | 62 | break; |
63 | - } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ($element->hasAttributes()) { |
67 | - $attributes = $element->attributes; |
|
68 | - //$keep_href = ''; |
|
69 | - foreach ($attributes as $attrib) { |
|
70 | - switch ($attrib->name) { |
|
71 | - case 'identifier': |
|
67 | + $attributes = $element->attributes; |
|
68 | + //$keep_href = ''; |
|
69 | + foreach ($attributes as $attrib) { |
|
70 | + switch ($attrib->name) { |
|
71 | + case 'identifier': |
|
72 | 72 | $this->identifier = $attrib->value; |
73 | - break; |
|
74 | - case 'structure': |
|
73 | + break; |
|
74 | + case 'structure': |
|
75 | 75 | $this->structure = $attrib->value; |
76 | - break; |
|
77 | - } |
|
78 | - } |
|
76 | + break; |
|
77 | + } |
|
78 | + } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return true; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | <?php |
143 | 143 | $who = addslashes(api_get_person_name($_user['firstName'], $_user['lastName'])); |
144 | 144 | echo "result='$who';"; |
145 | - ?> |
|
145 | + ?> |
|
146 | 146 | }else if(param == 'cmi.core.lesson_location'){ |
147 | 147 | result=lesson_location; |
148 | 148 | }else if(param == 'cmi.core.total_time'){ |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | <?php |
199 | 199 | $who = addslashes(api_get_person_name($_user['firstName'], $_user['lastName'])); |
200 | 200 | echo "result='$who';"; |
201 | - ?> break; |
|
201 | + ?> break; |
|
202 | 202 | case 'cmi.core.lesson_location' : |
203 | 203 | result=''; |
204 | 204 | break; |
@@ -322,12 +322,12 @@ discard block |
||
322 | 322 | } |
323 | 323 | <?php |
324 | 324 | /** |
325 | - * Chamilo-specific code that deals with event handling and inter-frames |
|
326 | - * messaging/refreshing. |
|
327 | - * Note that from now on, the Chamilo JS code in this library will act as |
|
328 | - * a controller, of the MVC pattern, and receive all requests for frame |
|
329 | - * updates, then redispatch to any frame concerned. |
|
330 | - */ |
|
325 | + * Chamilo-specific code that deals with event handling and inter-frames |
|
326 | + * messaging/refreshing. |
|
327 | + * Note that from now on, the Chamilo JS code in this library will act as |
|
328 | + * a controller, of the MVC pattern, and receive all requests for frame |
|
329 | + * updates, then redispatch to any frame concerned. |
|
330 | + */ |
|
331 | 331 | ?> |
332 | 332 | /** |
333 | 333 | * Defining the AJAX-object class to be made available from other frames. |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | /** |
1155 | 1155 | * Returns an array containing the list of options used to populate the gradebook_number_decimals variable |
1156 | 1156 | * This function is called through a call_user_func() in the generate_settings_form function. |
1157 | - * @return array List of gradebook_number_decimals options |
|
1157 | + * @return string[] List of gradebook_number_decimals options |
|
1158 | 1158 | * |
1159 | 1159 | * @author Guillaume Viguier <[email protected]> |
1160 | 1160 | */ |
@@ -1575,8 +1575,9 @@ discard block |
||
1575 | 1575 | } |
1576 | 1576 | /** |
1577 | 1577 | * Helper function to generates a form elements group |
1578 | - * @param object $form The form where the elements group has to be added |
|
1578 | + * @param FormValidator $form The form where the elements group has to be added |
|
1579 | 1579 | * @param array $values Values to browse through |
1580 | + * @param string $elementName |
|
1580 | 1581 | * @return array |
1581 | 1582 | */ |
1582 | 1583 | function formGenerateElementsGroup($form, $values = array(), $elementName) |
@@ -1592,7 +1593,7 @@ discard block |
||
1592 | 1593 | } |
1593 | 1594 | /** |
1594 | 1595 | * Helper function with allowed file types for CSS |
1595 | - * @return array Array of file types (no indexes) |
|
1596 | + * @return string[] Array of file types (no indexes) |
|
1596 | 1597 | */ |
1597 | 1598 | function getAllowedFileTypes() |
1598 | 1599 | { |
@@ -962,7 +962,8 @@ discard block |
||
962 | 962 | * @version August 2008 |
963 | 963 | * @since v1.8.6 |
964 | 964 | */ |
965 | -function actionsFilter($id) { |
|
965 | +function actionsFilter($id) |
|
966 | +{ |
|
966 | 967 | $return = '<a href="settings.php?category=Templates&action=edit&id='.Security::remove_XSS($id).'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
967 | 968 | $return .= '<a href="settings.php?category=Templates&action=delete&id='.Security::remove_XSS($id).'" onClick="javascript:if(!confirm('."'".get_lang('ConfirmYourChoice')."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
968 | 969 | return $return; |
@@ -1178,7 +1179,8 @@ discard block |
||
1178 | 1179 | * |
1179 | 1180 | * @author Guillaume Viguier <[email protected]> |
1180 | 1181 | */ |
1181 | -function select_gradebook_number_decimals() { |
|
1182 | +function select_gradebook_number_decimals() |
|
1183 | +{ |
|
1182 | 1184 | return array('0', '1', '2'); |
1183 | 1185 | } |
1184 | 1186 |
@@ -1108,7 +1108,7 @@ |
||
1108 | 1108 | echo '<a href="settings.php?category=Templates&action=add">'.Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM).'</a>'; |
1109 | 1109 | } else { |
1110 | 1110 | $content_template = '<head>{CSS}<style type="text/css">.text{font-weight: normal;}</style></head><body>'.Database::escape_string($values['template_text']).'</body>'; |
1111 | - $sql = "UPDATE $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'"; |
|
1111 | + $sql = "update $table_system_template set title = '".Database::escape_string($values['title'])."', content = '".$content_template."'"; |
|
1112 | 1112 | if (!empty($new_file_name)) { |
1113 | 1113 | $sql .= ", image = '".Database::escape_string($new_file_name)."'"; |
1114 | 1114 | } |
@@ -674,7 +674,7 @@ |
||
674 | 674 | // Get a list of all current 'Plugins' settings |
675 | 675 | $plugin_list = $appPlugin->read_plugins_from_path(); |
676 | 676 | |
677 | - var_dump($plugin_list);exit; |
|
677 | + var_dump($plugin_list); exit; |
|
678 | 678 | $installed_plugins = array(); |
679 | 679 | |
680 | 680 | foreach ($plugin_list as $plugin) { |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | /** |
1417 | 1417 | * Get the emoji list to include in chat |
1418 | - * @return array |
|
1418 | + * @return string[] |
|
1419 | 1419 | */ |
1420 | 1420 | public static function getEmojisToInclude() |
1421 | 1421 | { |
@@ -1738,7 +1738,7 @@ discard block |
||
1738 | 1738 | |
1739 | 1739 | /** |
1740 | 1740 | * Get the number of users connected in chat |
1741 | - * @return mixed |
|
1741 | + * @return integer |
|
1742 | 1742 | */ |
1743 | 1743 | public function countUsersOnline() |
1744 | 1744 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | return ''; |
68 | 68 | } |
69 | 69 | |
70 | - Emojione\Emojione::$imagePathPNG = api_get_path(WEB_PUBLIC_PATH) . 'bundles/chamilocore/js/emojione/png/'; |
|
70 | + Emojione\Emojione::$imagePathPNG = api_get_path(WEB_PUBLIC_PATH).'bundles/chamilocore/js/emojione/png/'; |
|
71 | 71 | Emojione\Emojione::$ascii = true; |
72 | 72 | |
73 | 73 | $message = trim($message); |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | { |
1395 | 1395 | return [ |
1396 | 1396 | ':bowtie:', |
1397 | - ':smile:'| |
|
1397 | + ':smile:' | |
|
1398 | 1398 | ':laughing:', |
1399 | 1399 | ':blush:', |
1400 | 1400 | ':smiley:', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param array $values Array of title + description (name => $title, description => $comment) |
97 | 97 | * |
98 | - * @return mixed Term id on success, false on failure |
|
98 | + * @return false|string Term id on success, false on failure |
|
99 | 99 | * |
100 | 100 | */ |
101 | 101 | public static function save_glossary($values, $showMessage = true) |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | /** |
450 | 450 | * Display the glossary terms in a list |
451 | - * @return bool true |
|
451 | + * @return string true |
|
452 | 452 | */ |
453 | 453 | public static function displayGlossaryList() |
454 | 454 | { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * Update action icons column |
586 | 586 | * |
587 | 587 | * @param integer $glossary_id |
588 | - * @param array $url_params Parameters to use to affect links |
|
588 | + * @param string $url_params Parameters to use to affect links |
|
589 | 589 | * @param array $row The line of results from a query on the glossary table |
590 | 590 | * |
591 | 591 | * @return string HTML string for the action icons columns |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $id = Database::insert($t_glossary, $params); |
135 | 135 | |
136 | 136 | if ($id) { |
137 | - $sql = "UPDATE $t_glossary SET glossary_id = $id WHERE iid = $id"; |
|
137 | + $sql = "update $t_glossary SET glossary_id = $id WHERE iid = $id"; |
|
138 | 138 | Database::query($sql); |
139 | 139 | |
140 | 140 | //insert into item_property |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | return false; |
182 | 182 | } else { |
183 | - $sql = "UPDATE $t_glossary SET |
|
183 | + $sql = "update $t_glossary SET |
|
184 | 184 | name = '".Database::escape_string($values['name'])."', |
185 | 185 | description = '".Database::escape_string($values['description'])."' |
186 | 186 | WHERE |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | |
640 | 640 | $i = 1; |
641 | 641 | while ($data = Database::fetch_array($res)) { |
642 | - $sql = "UPDATE $t_glossary SET display_order = $i |
|
642 | + $sql = "update $t_glossary SET display_order = $i |
|
643 | 643 | WHERE c_id = $course_id AND glossary_id = '".intval($data['glossary_id'])."'"; |
644 | 644 | Database::query($sql); |
645 | 645 | $i++; |
@@ -682,9 +682,9 @@ discard block |
||
682 | 682 | $found = true; |
683 | 683 | } |
684 | 684 | } |
685 | - $sql1 = "UPDATE $t_glossary SET display_order = '".Database::escape_string($next_display_order)."' |
|
685 | + $sql1 = "update $t_glossary SET display_order = '".Database::escape_string($next_display_order)."' |
|
686 | 686 | WHERE c_id = $course_id AND glossary_id = '".Database::escape_string($current_id)."'"; |
687 | - $sql2 = "UPDATE $t_glossary SET display_order = '".Database::escape_string($current_display_order)."' |
|
687 | + $sql2 = "update $t_glossary SET display_order = '".Database::escape_string($current_display_order)."' |
|
688 | 688 | WHERE c_id = $course_id AND glossary_id = '".Database::escape_string($next_id)."'"; |
689 | 689 | Database::query($sql1); |
690 | 690 | Database::query($sql2); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | - * @return array |
|
143 | + * @return string[] |
|
144 | 144 | */ |
145 | 145 | public static function getValidExtraFieldTypes() |
146 | 146 | { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | /** |
219 | 219 | * @param array $conditions |
220 | - * @param null $order_field_options_by |
|
220 | + * @param string $order_field_options_by |
|
221 | 221 | * |
222 | 222 | * @return array |
223 | 223 | */ |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | /** |
376 | 376 | * @param string $handler |
377 | 377 | * |
378 | - * @return array |
|
378 | + * @return string[] |
|
379 | 379 | */ |
380 | 380 | public static function get_extra_fields_by_handler($handler) |
381 | 381 | { |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
577 | - * @return array |
|
577 | + * @return string[] |
|
578 | 578 | */ |
579 | 579 | public function get_field_types() |
580 | 580 | { |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | /** |
585 | 585 | * @param int $id |
586 | 586 | * |
587 | - * @return null |
|
587 | + * @return string|null |
|
588 | 588 | */ |
589 | 589 | public function get_field_type_by_id($id) |
590 | 590 | { |
@@ -1826,7 +1826,7 @@ discard block |
||
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | /** |
1829 | - * @return array |
|
1829 | + * @return string[] |
|
1830 | 1830 | */ |
1831 | 1831 | public function getJqgridColumnNames() |
1832 | 1832 | { |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | /** |
2089 | - * @param array $columns |
|
2089 | + * @param string[] $columns |
|
2090 | 2090 | * @param array $column_model |
2091 | 2091 | * @param array $extraFields |
2092 | 2092 | * @return array |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'changeable', |
21 | 21 | 'filter', |
22 | 22 | 'extra_field_type', |
23 | - /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
23 | + /* Enable this when field_loggeable is introduced as a table field (2.0) |
|
24 | 24 | 'field_loggeable', |
25 | 25 | */ |
26 | 26 | 'created_at' |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | 'align' => 'left', |
2001 | 2001 | 'sortable' => 'true', |
2002 | 2002 | ), |
2003 | - array( |
|
2003 | + array( |
|
2004 | 2004 | 'name' => 'visible_to_others', |
2005 | 2005 | 'index' => 'visible_to_others', |
2006 | 2006 | 'width' => '35', |
@@ -2230,7 +2230,7 @@ discard block |
||
2230 | 2230 | <a href="?action=edit&type={$this->type}&id=' + options.rowId + '" class="btn btn-link btn-xs">\ |
2231 | 2231 | $editIcon\ |
2232 | 2232 | </a> |
2233 | -JAVASCRIPT; |
|
2233 | +javascript; |
|
2234 | 2234 | $deleteButton = <<<JAVASCRIPT |
2235 | 2235 | <a \ |
2236 | 2236 | onclick="if (!confirm(\'$confirmMessage\')) {return false;}" \ |
@@ -2238,7 +2238,7 @@ discard block |
||
2238 | 2238 | class="btn btn-link btn-xs">\ |
2239 | 2239 | $deleteIcon\ |
2240 | 2240 | </a> |
2241 | -JAVASCRIPT; |
|
2241 | +javascript; |
|
2242 | 2242 | |
2243 | 2243 | return "function action_formatter(cellvalue, options, rowObject) { |
2244 | 2244 | return '$editButton $deleteButton'; |
@@ -96,6 +96,9 @@ |
||
96 | 96 | echo PHP_EOL; |
97 | 97 | } |
98 | 98 | |
99 | +/** |
|
100 | + * @param string $message |
|
101 | + */ |
|
99 | 102 | function echo_style($style, $message) |
100 | 103 | { |
101 | 104 | // ANSI color codes |
@@ -20,16 +20,16 @@ |
||
20 | 20 | $exerciseId = $objExercise->selectId(); |
21 | 21 | if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
22 | 22 | $hit = 0; |
23 | - $answerId = $hotspotId; |
|
23 | + $answerId = $hotspotId; |
|
24 | 24 | |
25 | - // remove from session |
|
26 | - unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
25 | + // remove from session |
|
26 | + unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
27 | 27 | } else { // user clicked ON a hotspot |
28 | - $hit = 1; |
|
29 | - $answerId = $hotspotId; |
|
28 | + $hit = 1; |
|
29 | + $answerId = $hotspotId; |
|
30 | 30 | |
31 | - // Save into session |
|
32 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
31 | + // Save into session |
|
32 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | //round-up the coordinates |
@@ -18,13 +18,15 @@ |
||
18 | 18 | $objExercise = Session::read('objExercise'); |
19 | 19 | $hotspotId = $_GET['hotspotId']; |
20 | 20 | $exerciseId = $objExercise->selectId(); |
21 | -if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
|
21 | +if ($_GET['answerId'] == "0") { |
|
22 | +// click is NOT on a hotspot |
|
22 | 23 | $hit = 0; |
23 | 24 | $answerId = $hotspotId; |
24 | 25 | |
25 | 26 | // remove from session |
26 | 27 | unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
27 | -} else { // user clicked ON a hotspot |
|
28 | +} else { |
|
29 | +// user clicked ON a hotspot |
|
28 | 30 | $hit = 1; |
29 | 31 | $answerId = $hotspotId; |
30 | 32 |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | // update db |
47 | 47 | $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId]; |
48 | -$sql = "UPDATE $TBL_TRACK_E_HOTSPOT |
|
48 | +$sql = "update $TBL_TRACK_E_HOTSPOT |
|
49 | 49 | SET coordinate = '".Database::escape_string($coordinates)."' |
50 | 50 | WHERE id = ".intval($update_id)." |
51 | 51 | LIMIT 1"; |