@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * Gets an array of options for a specific field |
413 | 413 | * @param int $field_id The field ID |
414 | 414 | * @param bool $add_id_in_array Whether to add the row ID in the result |
415 | - * @param null $ordered_by Extra ordering query bit |
|
415 | + * @param null|string $ordered_by Extra ordering query bit |
|
416 | 416 | * @return array The options if they exists. Otherwise return false |
417 | 417 | */ |
418 | 418 | public function get_field_options_by_field($field_id, $add_id_in_array = false, $ordered_by = null) |
@@ -782,8 +782,8 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * @param $defaultDisplayText |
|
786 | - * @return mixed|string |
|
785 | + * @param string $defaultDisplayText |
|
786 | + * @return string |
|
787 | 787 | */ |
788 | 788 | public static function getLanguageVariable($defaultDisplayText) |
789 | 789 | { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | foreach ($sub_options as $sub_option) { |
218 | 218 | if (!empty($sub_option)) { |
219 | - $new_params = array( |
|
219 | + $new_params = array( |
|
220 | 220 | 'field_id' => $field_id, |
221 | 221 | 'option_value' => $sub_id, |
222 | 222 | 'display_text' => $sub_option, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $form->addElement('hidden', 'field_id', $this->field_id); |
661 | 661 | |
662 | 662 | if ($action == 'edit') { |
663 | - $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ |
|
663 | + $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([ |
|
664 | 664 | 'extra_field_option' => $id |
665 | 665 | ]); |
666 | 666 | $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
@@ -954,7 +954,7 @@ |
||
954 | 954 | /** |
955 | 955 | * This function has been created for avoiding changes directly within QuickForm class. |
956 | 956 | * When we use it, the element is threated as 'required' to be dealt during validation. |
957 | - * @param array $element The array of elements |
|
957 | + * @param array $elements The array of elements |
|
958 | 958 | * @param string $message The message displayed |
959 | 959 | */ |
960 | 960 | public function add_multiple_required_rule($elements, $message) |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $renderer->setHeaderTemplate('<legend>{header}</legend>'); |
100 | 100 | |
101 | 101 | //Set required field template |
102 | - $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); |
|
102 | + $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); |
|
103 | 103 | $noteTemplate = <<<EOT |
104 | 104 | <div class="form-group"> |
105 | 105 | <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | $this->with_progress_bar = true; |
903 | 903 | $id = $this->getAttribute('id'); |
904 | 904 | |
905 | - $this->updateAttributes("onsubmit=\"javascript: addProgress('" . $id . "')\""); |
|
906 | - $this->addHtml('<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
905 | + $this->updateAttributes("onsubmit=\"javascript: addProgress('".$id."')\""); |
|
906 | + $this->addHtml('<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | /** |
@@ -1402,7 +1402,7 @@ discard block |
||
1402 | 1402 | .prop('href', file.url); |
1403 | 1403 | $(data.context.children()[index]).parent().wrap(link); |
1404 | 1404 | |
1405 | - var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded')) . "')); |
|
1405 | + var successMessage = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-success\"/>').text('" . addslashes(get_lang('UplUploadSucceeded'))."')); |
|
1406 | 1406 | $(data.context.children()[index]).parent().append(successMessage); |
1407 | 1407 | } else if (file.error) { |
1408 | 1408 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(file.error)); |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | }); |
1412 | 1412 | }).on('fileuploadfail', function (e, data) { |
1413 | 1413 | $.each(data.files, function (index) { |
1414 | - var failedMessage = '" . addslashes(get_lang('UplUploadFailed')) . "'; |
|
1414 | + var failedMessage = '" . addslashes(get_lang('UplUploadFailed'))."'; |
|
1415 | 1415 | var error = $('<div class=\"col-sm-3\">').html($('<span class=\"alert alert-danger\"/>').text(failedMessage)); |
1416 | 1416 | $(data.context.children()[index]).parent().append(error); |
1417 | 1417 | }); |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | "</td>\n". |
127 | 127 | "<td>\n". |
128 | 128 | "<select name=\"image\">\n". |
129 | - "<option selected>". $image. "</option>\n"; |
|
129 | + "<option selected>".$image."</option>\n"; |
|
130 | 130 | |
131 | 131 | if ($dir = @opendir($chemin)) { |
132 | 132 | while ($file = readdir($dir)) { |
133 | 133 | if ($file == '..' || $file == '.') { |
134 | 134 | unset($file); |
135 | 135 | } |
136 | - $content .= "<option>". $file. "</option>\n"; |
|
136 | + $content .= "<option>".$file."</option>\n"; |
|
137 | 137 | } |
138 | 138 | closedir($dir); |
139 | 139 | } |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | "</td>\n". |
143 | 143 | "</tr>\n". |
144 | 144 | "<tr>\n". |
145 | - "<td>". get_lang('NameOfTheLink'). " : </td>\n". |
|
146 | - "<td><input type=\"text\" name=\"name\" value=\"". $name. "\"></td>\n". |
|
145 | + "<td>".get_lang('NameOfTheLink')." : </td>\n". |
|
146 | + "<td><input type=\"text\" name=\"name\" value=\"".$name."\"></td>\n". |
|
147 | 147 | "</tr>\n". |
148 | 148 | "<tr>\n". |
149 | 149 | "<td>Lien :</td>\n". |
150 | - "<td><input type=\"text\" name=\"link\" value=\"". $link. "\"></td>\n". |
|
150 | + "<td><input type=\"text\" name=\"link\" value=\"".$link."\"></td>\n". |
|
151 | 151 | "</tr>\n". |
152 | 152 | "<tr>\n". |
153 | - "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"". get_lang('Ok'). "\"></td>\n". |
|
153 | + "<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"".get_lang('Ok')."\"></td>\n". |
|
154 | 154 | "</tr>\n". |
155 | 155 | "</form>\n". |
156 | 156 | "</table>\n". |
@@ -203,21 +203,21 @@ discard block |
||
203 | 203 | "<tr><td colspan=\"6\"><font color=\"#F66105\">\n".get_lang('CourseAdminOnly')."</font> |
204 | 204 | </td></tr>\n"; |
205 | 205 | $content .= "<tr>\n<td colspan=\"6\">"; |
206 | - $content .=CourseHome::show_tool_3column('courseAdmin'); |
|
206 | + $content .= CourseHome::show_tool_3column('courseAdmin'); |
|
207 | 207 | $content .= "</td>\n</tr>\n"; |
208 | 208 | } |
209 | 209 | |
210 | 210 | /* TOOLS FOR PLATFORM ADMIN ONLY */ |
211 | 211 | if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { |
212 | - $content .= "<tr>"."<td colspan=\"6\">". |
|
212 | + $content .= "<tr>"."<td colspan=\"6\">". |
|
213 | 213 | "<hr noshade size=\"1\" />". |
214 | 214 | "</td>"."</tr>\n". |
215 | 215 | "<tr>\n"."<td colspan=\"6\">\n". |
216 | - "<font color=\"#F66105\" >". get_lang('PlatformAdminOnly'). "</font>\n". |
|
216 | + "<font color=\"#F66105\" >".get_lang('PlatformAdminOnly')."</font>\n". |
|
217 | 217 | "</td>\n"."</tr>\n"; |
218 | - $content .= "<tr>\n<td colspan=\"6\">"; |
|
218 | + $content .= "<tr>\n<td colspan=\"6\">"; |
|
219 | 219 | $content .= CourseHome::show_tool_3column('platformAdmin'); |
220 | - $content .= "</td>\n</tr>\n"; |
|
220 | + $content .= "</td>\n</tr>\n"; |
|
221 | 221 | } |
222 | 222 | |
223 | -$content .= "</table>\n"; |
|
223 | +$content .= "</table>\n"; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Show message to confirm that a tool it to be hidden from available tools |
57 | 57 | // visibility 0,1->2 |
58 | 58 | if (!empty($_GET['askDelete'])) { |
59 | - $content .='<div id="toolhide">'.get_lang('DelLk').'<br /> |
|
59 | + $content .= '<div id="toolhide">'.get_lang('DelLk').'<br /> |
|
60 | 60 | <a href="'.api_get_self().'">'.get_lang('No').'</a> | |
61 | 61 | <a href="'.api_get_self().'?delete=yes&id='.intval($_GET['id']).'">'.get_lang('Yes').'</a> |
62 | 62 | </div>'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | /* INACTIVE TOOLS - HIDDEN (GREY) LINKS */ |
94 | 94 | |
95 | - $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n". |
|
95 | + $content .= "<tr><td colspan=\"4\"><hr style='color:\"#4171B5\"' noshade=\"noshade\" size=\"1\" /></td></tr>\n". |
|
96 | 96 | "<tr>\n". |
97 | 97 | "<td colspan=\"4\">\n". |
98 | 98 | "<div style=\"margin-bottom: 10px;\"><font color=\"#808080\">\n".get_lang('InLnk')."</font></div>". |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | |
102 | 102 | $content .= CourseHome::show_tool_2column(TOOL_PUBLIC_BUT_HIDDEN); |
103 | 103 | |
104 | - $content .= "</table>"; |
|
105 | - $content .= "</div> "; |
|
104 | + $content .= "</table>"; |
|
105 | + $content .= "</div> "; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /* Tools for platform admin only */ |
109 | 109 | |
110 | 110 | if (api_is_platform_admin() && api_is_allowed_to_edit(null, true) && !api_is_coach()) { |
111 | - $content .='<div class="platformadminview"> |
|
111 | + $content .= '<div class="platformadminview"> |
|
112 | 112 | <span class="viewcaption">'.get_lang('PlatformAdminOnly').'</span> |
113 | 113 | <table width="100%"> |
114 | 114 | '.CourseHome::show_tool_2column(TOOL_PLATFORM_ADMIN).' |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param string tool name (optional) |
17 | 17 | * @param string $template_path |
18 | 18 | */ |
19 | - public function __construct($toolname = '', $template_path=null) |
|
19 | + public function __construct($toolname = '', $template_path = null) |
|
20 | 20 | { |
21 | 21 | if (!empty($toolname)) { |
22 | 22 | if (isset($template_path)) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | if (is_dir($path)) { |
28 | 28 | $this->tool_path = $path; |
29 | 29 | } else { |
30 | - throw new Exception('View::__construct() $path directory does not exist ' . $path); |
|
30 | + throw new Exception('View::__construct() $path directory does not exist '.$path); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public function set_data($data) |
40 | 40 | { |
41 | 41 | if (!is_array($data)) { |
42 | - throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data )); |
|
42 | + throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data)); |
|
43 | 43 | } |
44 | 44 | $this->data = $data; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string layout view |
50 | 50 | * @param string $layout |
51 | 51 | */ |
52 | - public function set_layout( $layout ) |
|
52 | + public function set_layout($layout) |
|
53 | 53 | { |
54 | 54 | $this->layout = $layout; |
55 | 55 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $special_course_list = array(); |
49 | 49 | if (Database::num_rows($result) > 0) { |
50 | 50 | while ($result_row = Database::fetch_array($result)) { |
51 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
51 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | $without_special_courses = ''; |
55 | 55 | if (!empty($special_course_list)) { |
56 | - $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')'; |
|
56 | + $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Secondly we select the courses that are in a category (user_course_cat<>0) and sort these according to the sort of the category |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | FROM $TABLECOURS course, $TABLECOURSUSER course_rel_user |
74 | 74 | WHERE |
75 | 75 | course.id = course_rel_user.c_id AND |
76 | - course_rel_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
77 | - course_rel_user.user_id = '" . $user_id . "' $without_special_courses |
|
76 | + course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
77 | + course_rel_user.user_id = '" . $user_id."' $without_special_courses |
|
78 | 78 | ORDER BY course_rel_user.sort ASC"; |
79 | 79 | $result = Database::query($sql); |
80 | 80 | $courses = array(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $user_id = api_get_user_id(); |
108 | 108 | $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
109 | - $sql = "SELECT * FROM " . $table_category . " |
|
109 | + $sql = "SELECT * FROM ".$table_category." |
|
110 | 110 | WHERE user_id=$user_id |
111 | 111 | ORDER BY sort ASC"; |
112 | 112 | $result = Database::query($sql); |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | $special_course_list = array(); |
149 | 149 | if (Database::num_rows($result) > 0) { |
150 | 150 | while ($result_row = Database::fetch_array($result)) { |
151 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
151 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | $without_special_courses = ''; |
156 | 156 | if (!empty($special_course_list)) { |
157 | - $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')'; |
|
157 | + $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $sql = "SELECT |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | $TABLECOURSUSER course_rel_user |
166 | 166 | WHERE |
167 | 167 | course.id = course_rel_user.c_id AND |
168 | - course_rel_user.user_id = '" . $user_id . "' AND |
|
169 | - course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH . " |
|
168 | + course_rel_user.user_id = '".$user_id."' AND |
|
169 | + course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH." |
|
170 | 170 | $without_special_courses |
171 | 171 | ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; |
172 | 172 | $result = Database::query($sql); |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
195 | 195 | $max_sort_value = api_max_sort_value($newcategory, $current_user); |
196 | 196 | $sql = "UPDATE $TABLECOURSUSER SET |
197 | - user_course_cat='" . $newcategory . "', |
|
198 | - sort='" . ($max_sort_value + 1) . "' |
|
197 | + user_course_cat='".$newcategory."', |
|
198 | + sort='" . ($max_sort_value + 1)."' |
|
199 | 199 | WHERE |
200 | - c_id ='" . $courseId . "' AND |
|
201 | - user_id='" . $current_user . "' AND |
|
200 | + c_id ='" . $courseId."' AND |
|
201 | + user_id='" . $current_user."' AND |
|
202 | 202 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
203 | 203 | $resultQuery = Database::query($sql); |
204 | 204 | |
@@ -257,18 +257,18 @@ discard block |
||
257 | 257 | $targetCourseId = $targetCourseInfo['real_id']; |
258 | 258 | |
259 | 259 | $sql = "UPDATE $table |
260 | - SET sort='" . $target_course['sort'] . "' |
|
260 | + SET sort='".$target_course['sort']."' |
|
261 | 261 | WHERE |
262 | - c_id = '" . $courseId . "' AND |
|
263 | - user_id = '" . $current_user_id . "' AND |
|
262 | + c_id = '" . $courseId."' AND |
|
263 | + user_id = '" . $current_user_id."' AND |
|
264 | 264 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
265 | 265 | |
266 | 266 | $result1 = Database::query($sql); |
267 | 267 | |
268 | - $sql = "UPDATE $table SET sort='" . $source_course['sort'] . "' |
|
268 | + $sql = "UPDATE $table SET sort='".$source_course['sort']."' |
|
269 | 269 | WHERE |
270 | - c_id ='" . $targetCourseId . "' AND |
|
271 | - user_id='" . $current_user_id . "' AND |
|
270 | + c_id ='" . $targetCourseId."' AND |
|
271 | + user_id='" . $current_user_id."' AND |
|
272 | 272 | relation_type<>" . COURSE_RELATION_TYPE_RRHH; |
273 | 273 | |
274 | 274 | $result2 = Database::query($sql); |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | } |
313 | 313 | |
314 | 314 | if (count($target_category) > 0 && count($source_category) > 0) { |
315 | - $sql_update1 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($target_category['sort']) . "' |
|
316 | - WHERE id='" . intval($source_category['id']) . "' AND user_id='" . $current_user_id . "'"; |
|
317 | - $sql_update2 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($source_category['sort']) . "' |
|
318 | - WHERE id='" . intval($target_category['id']) . "' AND user_id='" . $current_user_id . "'"; |
|
315 | + $sql_update1 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($target_category['sort'])."' |
|
316 | + WHERE id='" . intval($source_category['id'])."' AND user_id='".$current_user_id."'"; |
|
317 | + $sql_update2 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($source_category['sort'])."' |
|
318 | + WHERE id='" . intval($target_category['id'])."' AND user_id='".$current_user_id."'"; |
|
319 | 319 | |
320 | 320 | $result1 = Database::query($sql_update2); |
321 | 321 | $result2 = Database::query($sql_update1); |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | { |
335 | 335 | $current_user_id = api_get_user_id(); |
336 | 336 | $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
337 | - $sql = "SELECT * FROM " . $table_category . " |
|
338 | - WHERE user_id='" . $current_user_id . "' |
|
337 | + $sql = "SELECT * FROM ".$table_category." |
|
338 | + WHERE user_id='" . $current_user_id."' |
|
339 | 339 | ORDER BY sort ASC"; |
340 | 340 | $result = Database::query($sql); |
341 | 341 | while ($row = Database::fetch_array($result)) { |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | $result = false; |
359 | 359 | $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
360 | 360 | $sql = "UPDATE $tucc |
361 | - SET title='" . api_htmlentities($title, ENT_QUOTES, api_get_system_encoding()) . "' |
|
362 | - WHERE id='" . $category_id . "'"; |
|
361 | + SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."' |
|
362 | + WHERE id='" . $category_id."'"; |
|
363 | 363 | $resultQuery = Database::query($sql); |
364 | 364 | if (Database::affected_rows($resultQuery)) { |
365 | 365 | $result = true; |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | $result = false; |
382 | 382 | $sql = "DELETE FROM $tucc |
383 | 383 | WHERE |
384 | - id='" . $category_id . "' AND |
|
385 | - user_id='" . $current_user_id . "'"; |
|
384 | + id='".$category_id."' AND |
|
385 | + user_id='" . $current_user_id."'"; |
|
386 | 386 | $resultQuery = Database::query($sql); |
387 | 387 | if (Database::affected_rows($resultQuery)) { |
388 | 388 | $result = true; |
@@ -390,9 +390,9 @@ discard block |
||
390 | 390 | $sql = "UPDATE $TABLECOURSUSER |
391 | 391 | SET user_course_cat='0' |
392 | 392 | WHERE |
393 | - user_course_cat='" . $category_id . "' AND |
|
394 | - user_id='" . $current_user_id . "' AND |
|
395 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " "; |
|
393 | + user_course_cat='".$category_id."' AND |
|
394 | + user_id='" . $current_user_id."' AND |
|
395 | + relation_type<>" . COURSE_RELATION_TYPE_RRHH." "; |
|
396 | 396 | Database::query($sql); |
397 | 397 | |
398 | 398 | return $result; |
@@ -425,20 +425,20 @@ discard block |
||
425 | 425 | if (Database::num_rows($special_course_result) > 0) { |
426 | 426 | $special_course_list = array(); |
427 | 427 | while ($result_row = Database::fetch_array($special_course_result)) { |
428 | - $special_course_list[] = '"' . $result_row['item_id'] . '"'; |
|
428 | + $special_course_list[] = '"'.$result_row['item_id'].'"'; |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | $without_special_courses = ''; |
432 | 432 | if (!empty($special_course_list)) { |
433 | - $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')'; |
|
433 | + $without_special_courses = ' AND course.code NOT IN ('.implode(',', $special_course_list).')'; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | $search_term_safe = Database::escape_string($search_term); |
437 | 437 | $sql_find = "SELECT * FROM $courseTable |
438 | 438 | WHERE ( |
439 | - code LIKE '%" . $search_term_safe . "%' OR |
|
440 | - title LIKE '%" . $search_term_safe . "%' OR |
|
441 | - tutor_name LIKE '%" . $search_term_safe . "%' |
|
439 | + code LIKE '%".$search_term_safe."%' OR |
|
440 | + title LIKE '%" . $search_term_safe."%' OR |
|
441 | + tutor_name LIKE '%" . $search_term_safe."%' |
|
442 | 442 | ) |
443 | 443 | $without_special_courses |
444 | 444 | ORDER BY title, visual_code ASC |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | ON (url_rel_course.c_id = course.id) |
456 | 456 | WHERE |
457 | 457 | access_url_id = $url_access_id AND ( |
458 | - code LIKE '%" . $search_term_safe . "%' OR |
|
459 | - title LIKE '%" . $search_term_safe . "%' OR |
|
460 | - tutor_name LIKE '%" . $search_term_safe . "%' |
|
458 | + code LIKE '%".$search_term_safe."%' OR |
|
459 | + title LIKE '%" . $search_term_safe."%' OR |
|
460 | + tutor_name LIKE '%" . $search_term_safe."%' |
|
461 | 461 | ) |
462 | 462 | $without_special_courses |
463 | 463 | ORDER BY title, visual_code ASC |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | // (s)he can only delete the course |
519 | 519 | $sql = "SELECT * FROM $tbl_course_user |
520 | 520 | WHERE |
521 | - user_id='" . $current_user_id . "' AND |
|
522 | - c_id ='" . $courseId . "' AND |
|
521 | + user_id='".$current_user_id."' AND |
|
522 | + c_id ='" . $courseId."' AND |
|
523 | 523 | status='1' "; |
524 | 524 | $result_check = Database::query($sql); |
525 | 525 | $number_of_rows = Database::num_rows($result_check); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | // step 1: we determine the max value of the user defined course categories |
550 | 550 | $sql = "SELECT sort FROM $tucc |
551 | - WHERE user_id='" . $current_user_id . "' |
|
551 | + WHERE user_id='".$current_user_id."' |
|
552 | 552 | ORDER BY sort DESC"; |
553 | 553 | $rs_sort = Database::query($sql); |
554 | 554 | $maxsort = Database::fetch_array($rs_sort); |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | // step 2: we check if there is already a category with this name, if not we store it, else we give an error. |
558 | 558 | $sql = "SELECT * FROM $tucc |
559 | 559 | WHERE |
560 | - user_id='" . $current_user_id . "' AND |
|
561 | - title='" . $category_title . "' |
|
560 | + user_id='".$current_user_id."' AND |
|
561 | + title='" . $category_title."' |
|
562 | 562 | ORDER BY sort DESC"; |
563 | 563 | $rs = Database::query($sql); |
564 | 564 | if (Database::num_rows($rs) == 0) { |
565 | 565 | $sql = "INSERT INTO $tucc (user_id, title,sort) |
566 | - VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')"; |
|
566 | + VALUES ('".$current_user_id."', '".api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding())."', '".$nextsort."')"; |
|
567 | 567 | $resultQuery = Database::query($sql); |
568 | 568 | if (Database::affected_rows($resultQuery)) { |
569 | 569 | $result = true; |
@@ -647,10 +647,10 @@ discard block |
||
647 | 647 | if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) { |
648 | 648 | return false; |
649 | 649 | } |
650 | - $message = get_lang('CourseRequiresPassword') . '<br />'; |
|
650 | + $message = get_lang('CourseRequiresPassword').'<br />'; |
|
651 | 651 | $message .= $all_course_information['title'].' ('.$all_course_information['visual_code'].') '; |
652 | 652 | |
653 | - $action = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token']; |
|
653 | + $action = api_get_path(WEB_CODE_PATH)."auth/courses.php?action=subscribe_user_with_password&sec_token=".$_SESSION['sec_token']; |
|
654 | 654 | $form = new FormValidator('subscribe_user_with_password', 'post', $action); |
655 | 655 | $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']); |
656 | 656 | $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']); |
@@ -183,6 +183,7 @@ discard block |
||
183 | 183 | * (moving a course to a different course category) |
184 | 184 | * @param int $courseId |
185 | 185 | * @param int Category id |
186 | + * @param integer $newcategory |
|
186 | 187 | * @return bool True if it success |
187 | 188 | */ |
188 | 189 | public function updateCourseCategory($courseId, $newcategory) |
@@ -215,6 +216,9 @@ discard block |
||
215 | 216 | * @param string Direction (up/down) |
216 | 217 | * @param string Course code |
217 | 218 | * @param int Category id |
219 | + * @param string $direction |
|
220 | + * @param string $course2move |
|
221 | + * @param integer $category |
|
218 | 222 | * @return bool True if it success |
219 | 223 | */ |
220 | 224 | public function move_course($direction, $course2move, $category) |
@@ -285,6 +289,8 @@ discard block |
||
285 | 289 | * Moves the course one place up or down |
286 | 290 | * @param string Direction up/down |
287 | 291 | * @param string Category id |
292 | + * @param string $direction |
|
293 | + * @param integer $category2move |
|
288 | 294 | * @return bool True If it success |
289 | 295 | */ |
290 | 296 | public function move_category($direction, $category2move) |
@@ -348,6 +354,8 @@ discard block |
||
348 | 354 | * Updates the user course category in the chamilo_user database |
349 | 355 | * @param string Category title |
350 | 356 | * @param int Category id |
357 | + * @param string $title |
|
358 | + * @param integer $category_id |
|
351 | 359 | * @return bool True if it success |
352 | 360 | */ |
353 | 361 | public function store_edit_course_category($title, $category_id) |
@@ -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 | { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | return ''; |
63 | 63 | } |
64 | 64 | |
65 | - Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/'; |
|
65 | + Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH).'javascript/emojione/png/'; |
|
66 | 66 | Emojione\Emojione::$ascii = true; |
67 | 67 | |
68 | 68 | $message = trim($message); |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | $user = $em->find('ChamiloUserBundle:User', $this->userId); |
96 | 96 | $courseInfo = api_get_course_info_by_id($this->courseId); |
97 | 97 | $isMaster = (bool) api_is_course_admin(); |
98 | - $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'; |
|
98 | + $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; |
|
99 | 99 | $basepath_chat = '/chat_files'; |
100 | 100 | |
101 | 101 | if (!$this->groupId) { |
102 | 102 | $group_info = GroupManager::get_group_properties($this->groupId); |
103 | - $basepath_chat = $group_info['directory'] . '/chat_files'; |
|
103 | + $basepath_chat = $group_info['directory'].'/chat_files'; |
|
104 | 104 | } |
105 | 105 | |
106 | - $chat_path = $document_path . $basepath_chat . '/'; |
|
106 | + $chat_path = $document_path.$basepath_chat.'/'; |
|
107 | 107 | |
108 | 108 | if (!is_dir($chat_path)) { |
109 | 109 | if (is_file($chat_path)) { |
@@ -113,25 +113,25 @@ discard block |
||
113 | 113 | |
114 | 114 | $date_now = date('Y-m-d'); |
115 | 115 | $timeNow = date('d/m/y H:i:s'); |
116 | - $basename_chat = 'messages-' . $date_now; |
|
116 | + $basename_chat = 'messages-'.$date_now; |
|
117 | 117 | |
118 | 118 | if ($this->groupId && !$friendId) { |
119 | - $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId; |
|
119 | + $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId; |
|
120 | 120 | } elseif ($this->sessionId && !$friendId) { |
121 | - $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId; |
|
121 | + $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId; |
|
122 | 122 | } elseif ($friendId) { |
123 | 123 | if ($this->userId < $friendId) { |
124 | - $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId; |
|
124 | + $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId; |
|
125 | 125 | } else { |
126 | - $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId; |
|
126 | + $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | 130 | $message = self::prepareMessage($message); |
131 | 131 | |
132 | - $fileTitle = $basename_chat . '.log.html'; |
|
133 | - $filePath = $basepath_chat . '/' . $fileTitle; |
|
134 | - $absoluteFilePath = $chat_path . $fileTitle; |
|
132 | + $fileTitle = $basename_chat.'.log.html'; |
|
133 | + $filePath = $basepath_chat.'/'.$fileTitle; |
|
134 | + $absoluteFilePath = $chat_path.$fileTitle; |
|
135 | 135 | |
136 | 136 | if (!file_exists($absoluteFilePath)) { |
137 | 137 | $doc_id = add_document($courseInfo, $filePath, 'file', 0, $fileTitle); |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | $fileContent = ' |
165 | 165 | <div class="message-teacher"> |
166 | 166 | <div class="content-message"> |
167 | - <div class="chat-message-block-name">' . $user->getCompleteName() . '</div> |
|
168 | - <div class="chat-message-block-content">' . $message . '</div> |
|
169 | - <div class="message-date">' . $timeNow . '</div> |
|
167 | + <div class="chat-message-block-name">' . $user->getCompleteName().'</div> |
|
168 | + <div class="chat-message-block-content">' . $message.'</div> |
|
169 | + <div class="message-date">' . $timeNow.'</div> |
|
170 | 170 | </div> |
171 | 171 | <div class="icon-message"></div> |
172 | - <img class="chat-image" src="' . $userPhoto . '"> |
|
172 | + <img class="chat-image" src="' . $userPhoto.'"> |
|
173 | 173 | </div> |
174 | 174 | '; |
175 | 175 | } else { |
176 | 176 | $fileContent = ' |
177 | 177 | <div class="message-student"> |
178 | - <img class="chat-image" src="' . $userPhoto . '"> |
|
178 | + <img class="chat-image" src="' . $userPhoto.'"> |
|
179 | 179 | <div class="icon-message"></div> |
180 | 180 | <div class="content-message"> |
181 | - <div class="chat-message-block-name">' . $user->getCompleteName() . '</div> |
|
182 | - <div class="chat-message-block-content">' . $message . '</div> |
|
183 | - <div class="message-date">' . $timeNow . '</div> |
|
181 | + <div class="chat-message-block-name">' . $user->getCompleteName().'</div> |
|
182 | + <div class="chat-message-block-content">' . $message.'</div> |
|
183 | + <div class="message-date">' . $timeNow.'</div> |
|
184 | 184 | </div> |
185 | 185 | </div> |
186 | 186 | '; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $extraCondition = null; |
276 | 276 | |
277 | 277 | if ($this->groupId) { |
278 | - $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId); |
|
278 | + $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId); |
|
279 | 279 | } else { |
280 | - $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId); |
|
280 | + $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | $currentTime = new DateTime(api_get_utc_datetime(), new DateTimeZone('UTC')); |
@@ -1413,7 +1413,7 @@ discard block |
||
1413 | 1413 | { |
1414 | 1414 | return [ |
1415 | 1415 | ':bowtie:', |
1416 | - ':smile:'| |
|
1416 | + ':smile:' | |
|
1417 | 1417 | ':laughing:', |
1418 | 1418 | ':blush:', |
1419 | 1419 | ':smiley:', |
@@ -1487,17 +1487,17 @@ discard block |
||
1487 | 1487 | { |
1488 | 1488 | $date = date('Y-m-d'); |
1489 | 1489 | |
1490 | - $base = 'messages-' . $date . '.log.html'; |
|
1490 | + $base = 'messages-'.$date.'.log.html'; |
|
1491 | 1491 | |
1492 | 1492 | if ($this->groupId && !$friendId) { |
1493 | - $base = 'messages-' . $date . '_gid-' . $this->groupId . '.log.html'; |
|
1493 | + $base = 'messages-'.$date.'_gid-'.$this->groupId.'.log.html'; |
|
1494 | 1494 | } elseif ($this->sessionId && !$friendId) { |
1495 | - $base = 'messages-' . $date . '_sid-' . $this->sessionId . '.log.html'; |
|
1495 | + $base = 'messages-'.$date.'_sid-'.$this->sessionId.'.log.html'; |
|
1496 | 1496 | } elseif ($friendId) { |
1497 | 1497 | if ($this->userId < $friendId) { |
1498 | - $base = 'messages-' . $date . '_uid-' . $this->userId . '-' . $friendId . '.log.html'; |
|
1498 | + $base = 'messages-'.$date.'_uid-'.$this->userId.'-'.$friendId.'.log.html'; |
|
1499 | 1499 | } else { |
1500 | - $base = 'messages-' . $date . '_uid-' . $friendId . '-' . $this->userId . '.log.html'; |
|
1500 | + $base = 'messages-'.$date.'_uid-'.$friendId.'-'.$this->userId.'.log.html'; |
|
1501 | 1501 | } |
1502 | 1502 | } |
1503 | 1503 | |
@@ -1506,16 +1506,16 @@ discard block |
||
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | $courseInfo = api_get_course_info_by_id($this->courseId); |
1509 | - $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'; |
|
1509 | + $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; |
|
1510 | 1510 | |
1511 | - $chatPath = $document_path . '/chat_files/'; |
|
1511 | + $chatPath = $document_path.'/chat_files/'; |
|
1512 | 1512 | |
1513 | 1513 | if ($this->groupId) { |
1514 | 1514 | $group_info = GroupManager::get_group_properties($this->groupId); |
1515 | - $chatPath = $document_path . $group_info['directory'] . '/chat_files/'; |
|
1515 | + $chatPath = $document_path.$group_info['directory'].'/chat_files/'; |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | - return $chatPath . $base; |
|
1518 | + return $chatPath.$base; |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | /** |
@@ -1528,16 +1528,16 @@ discard block |
||
1528 | 1528 | { |
1529 | 1529 | $courseInfo = api_get_course_info_by_id($this->courseId); |
1530 | 1530 | $date_now = date('Y-m-d'); |
1531 | - $isMaster = (bool)api_is_course_admin(); |
|
1531 | + $isMaster = (bool) api_is_course_admin(); |
|
1532 | 1532 | $basepath_chat = '/chat_files'; |
1533 | - $document_path = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document'; |
|
1533 | + $document_path = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'; |
|
1534 | 1534 | |
1535 | 1535 | if ($this->groupId) { |
1536 | 1536 | $group_info = GroupManager:: get_group_properties($this->groupId); |
1537 | - $basepath_chat = $group_info['directory'] . '/chat_files'; |
|
1537 | + $basepath_chat = $group_info['directory'].'/chat_files'; |
|
1538 | 1538 | } |
1539 | 1539 | |
1540 | - $chat_path = $document_path . $basepath_chat . '/'; |
|
1540 | + $chat_path = $document_path.$basepath_chat.'/'; |
|
1541 | 1541 | |
1542 | 1542 | if (!is_dir($chat_path)) { |
1543 | 1543 | if (is_file($chat_path)) { |
@@ -1564,24 +1564,24 @@ discard block |
||
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | |
1567 | - $filename_chat = 'messages-' . $date_now . '.log.html'; |
|
1567 | + $filename_chat = 'messages-'.$date_now.'.log.html'; |
|
1568 | 1568 | |
1569 | 1569 | if ($this->groupId && !$friendId) { |
1570 | - $filename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId . '.log.html'; |
|
1570 | + $filename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId.'.log.html'; |
|
1571 | 1571 | } else if ($this->sessionId && !$friendId) { |
1572 | - $filename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId . '.log.html'; |
|
1572 | + $filename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId.'.log.html'; |
|
1573 | 1573 | } elseif ($friendId) { |
1574 | 1574 | if ($this->userId < $friendId) { |
1575 | - $filename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId . '.log.html'; |
|
1575 | + $filename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId.'.log.html'; |
|
1576 | 1576 | } else { |
1577 | - $filename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId . '.log.html'; |
|
1577 | + $filename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId.'.log.html'; |
|
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | |
1581 | - if (!file_exists($chat_path . $filename_chat)) { |
|
1582 | - @fclose(fopen($chat_path . $filename_chat, 'w')); |
|
1581 | + if (!file_exists($chat_path.$filename_chat)) { |
|
1582 | + @fclose(fopen($chat_path.$filename_chat, 'w')); |
|
1583 | 1583 | if (!api_is_anonymous()) { |
1584 | - $doc_id = add_document($courseInfo, $basepath_chat . '/' . $filename_chat, 'file', 0, $filename_chat); |
|
1584 | + $doc_id = add_document($courseInfo, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat); |
|
1585 | 1585 | api_item_property_update( |
1586 | 1586 | $courseInfo, |
1587 | 1587 | TOOL_DOCUMENT, |
@@ -1610,17 +1610,17 @@ discard block |
||
1610 | 1610 | } |
1611 | 1611 | } |
1612 | 1612 | |
1613 | - $basename_chat = 'messages-' . $date_now; |
|
1613 | + $basename_chat = 'messages-'.$date_now; |
|
1614 | 1614 | |
1615 | 1615 | if ($this->groupId && !$friendId) { |
1616 | - $basename_chat = 'messages-' . $date_now . '_gid-' . $this->groupId; |
|
1616 | + $basename_chat = 'messages-'.$date_now.'_gid-'.$this->groupId; |
|
1617 | 1617 | } else if ($this->sessionId && !$friendId) { |
1618 | - $basename_chat = 'messages-' . $date_now . '_sid-' . $this->sessionId; |
|
1618 | + $basename_chat = 'messages-'.$date_now.'_sid-'.$this->sessionId; |
|
1619 | 1619 | } elseif ($friendId) { |
1620 | 1620 | if ($this->userId < $friendId) { |
1621 | - $basename_chat = 'messages-' . $date_now . '_uid-' . $this->userId . '-' . $friendId; |
|
1621 | + $basename_chat = 'messages-'.$date_now.'_uid-'.$this->userId.'-'.$friendId; |
|
1622 | 1622 | } else { |
1623 | - $basename_chat = 'messages-' . $date_now . '_uid-' . $friendId . '-' . $this->userId; |
|
1623 | + $basename_chat = 'messages-'.$date_now.'_uid-'.$friendId.'-'.$this->userId; |
|
1624 | 1624 | } |
1625 | 1625 | } |
1626 | 1626 | |
@@ -1628,19 +1628,19 @@ discard block |
||
1628 | 1628 | |
1629 | 1629 | $i = 1; |
1630 | 1630 | |
1631 | - while (file_exists($chat_path . $basename_chat . '-' . $i . '.log.html')) { |
|
1631 | + while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) { |
|
1632 | 1632 | $i++; |
1633 | 1633 | } |
1634 | 1634 | |
1635 | - @rename($chat_path . $basename_chat . '.log.html', $chat_path . $basename_chat . '-' . $i . '.log.html'); |
|
1636 | - @fclose(fopen($chat_path . $basename_chat . '.log.html', 'w')); |
|
1635 | + @rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html'); |
|
1636 | + @fclose(fopen($chat_path.$basename_chat.'.log.html', 'w')); |
|
1637 | 1637 | |
1638 | 1638 | $doc_id = add_document( |
1639 | 1639 | $courseInfo, |
1640 | - $basepath_chat . '/' . $basename_chat . '-' . $i . '.log.html', |
|
1640 | + $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html', |
|
1641 | 1641 | 'file', |
1642 | - filesize($chat_path . $basename_chat . '-' . $i . '.log.html'), |
|
1643 | - $basename_chat . '-' . $i . '.log.html' |
|
1642 | + filesize($chat_path.$basename_chat.'-'.$i.'.log.html'), |
|
1643 | + $basename_chat.'-'.$i.'.log.html' |
|
1644 | 1644 | ); |
1645 | 1645 | |
1646 | 1646 | api_item_property_update( |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | |
1672 | 1672 | $doc_id = DocumentManager::get_document_id( |
1673 | 1673 | $courseInfo, |
1674 | - $basepath_chat . '/' . $basename_chat . '.log.html' |
|
1674 | + $basepath_chat.'/'.$basename_chat.'.log.html' |
|
1675 | 1675 | ); |
1676 | 1676 | |
1677 | 1677 | update_existing_document($courseInfo, $doc_id, 0); |
@@ -1680,8 +1680,8 @@ discard block |
||
1680 | 1680 | $remove = 0; |
1681 | 1681 | $content = array(); |
1682 | 1682 | |
1683 | - if (file_exists($chat_path . $basename_chat . '.log.html')) { |
|
1684 | - $content = file($chat_path . $basename_chat . '.log.html'); |
|
1683 | + if (file_exists($chat_path.$basename_chat.'.log.html')) { |
|
1684 | + $content = file($chat_path.$basename_chat.'.log.html'); |
|
1685 | 1685 | $nbr_lines = sizeof($content); |
1686 | 1686 | $remove = $nbr_lines - 100; |
1687 | 1687 | } |
@@ -1694,7 +1694,7 @@ discard block |
||
1694 | 1694 | |
1695 | 1695 | if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') { |
1696 | 1696 | //the caller |
1697 | - $content[0] = get_lang('CallSent') . '<br />' . $content[0]; |
|
1697 | + $content[0] = get_lang('CallSent').'<br />'.$content[0]; |
|
1698 | 1698 | } |
1699 | 1699 | if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') { |
1700 | 1700 | //the joiner (we have to delete the chat request to him when he joins the chat) |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | $history .= ' |
1720 | 1720 | <div id="clear-chat"> |
1721 | 1721 | <button type="button" id="chat-reset" class="btn btn-danger btn-sm"> |
1722 | - ' . get_lang('ClearList') . ' |
|
1722 | + ' . get_lang('ClearList').' |
|
1723 | 1723 | </button> |
1724 | 1724 | </div> |
1725 | 1725 | '; |
@@ -1740,9 +1740,9 @@ discard block |
||
1740 | 1740 | $extraCondition = null; |
1741 | 1741 | |
1742 | 1742 | if ($this->groupId) { |
1743 | - $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId); |
|
1743 | + $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId); |
|
1744 | 1744 | } else { |
1745 | - $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId); |
|
1745 | + $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId); |
|
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | $number = Database::getManager() |
@@ -1772,9 +1772,9 @@ discard block |
||
1772 | 1772 | $extraCondition = null; |
1773 | 1773 | |
1774 | 1774 | if ($this->groupId) { |
1775 | - $extraCondition = 'AND ccc.toGroupId = ' . intval($this->groupId); |
|
1775 | + $extraCondition = 'AND ccc.toGroupId = '.intval($this->groupId); |
|
1776 | 1776 | } else { |
1777 | - $extraCondition = 'AND ccc.sessionId = ' . intval($this->sessionId); |
|
1777 | + $extraCondition = 'AND ccc.sessionId = '.intval($this->sessionId); |
|
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | $number = Database::getManager() |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | 'lastname' => $user->getLastname(), |
1811 | 1811 | 'status' => !$this->sessionId ? $subscription->getStatus() : $user->getStatus(), |
1812 | 1812 | 'image_url' => UserManager::getUserPicture($user->getId(), USER_IMAGE_SIZE_MEDIUM), |
1813 | - 'profile_url' => api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $user->getId(), |
|
1813 | + 'profile_url' => api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user->getId(), |
|
1814 | 1814 | 'complete_name' => $user->getCompleteName(), |
1815 | 1815 | 'username' => $user->getUsername(), |
1816 | 1816 | 'email' => $user->getEmail(), |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | ]; |
18 | 18 | |
19 | 19 | foreach ($externalCSS as $css) { |
20 | - $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css); |
|
20 | + $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css); |
|
21 | 21 | } |
22 | 22 | |
23 | -$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css'); |
|
24 | -$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css'); |
|
23 | +$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css'); |
|
24 | +$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css'); |
|
25 | 25 | |
26 | 26 | $externalJS = [ |
27 | 27 | 'highlight/highlight.pack.js', |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | - $iconList[$key] = strtoupper($icon) . '.png'; |
|
44 | + $iconList[$key] = strtoupper($icon).'.png'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $view = new Template(get_lang('Chat'), false, false, false, true, false); |
@@ -1320,10 +1320,10 @@ discard block |
||
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ' |
1323 | - . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1323 | + . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1324 | 1324 | ON user.user_id = course_rel_user.user_id AND |
1325 | 1325 | course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' ' |
1326 | - . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1326 | + . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1327 | 1327 | |
1328 | 1328 | if (!empty($course_code)) { |
1329 | 1329 | $sql .= ' AND course_rel_user.c_id="' . $courseId . '"'; |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | // We get the coach for the given course in a given session. |
1667 | 1667 | $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
1668 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1668 | + ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1669 | 1669 | $rs = Database::query($sql); |
1670 | 1670 | while ($user = Database::fetch_array($rs)) { |
1671 | 1671 | $user_info = api_get_user_info($user['user_id']); |
@@ -3374,13 +3374,13 @@ discard block |
||
3374 | 3374 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3375 | 3375 | if ($load_dirs) { |
3376 | 3376 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3377 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3377 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3378 | 3378 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3379 | 3379 | } |
3380 | 3380 | }else{ |
3381 | 3381 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) { |
3382 | 3382 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3383 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3383 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3384 | 3384 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3385 | 3385 | } |
3386 | 3386 | } |
@@ -3563,7 +3563,7 @@ discard block |
||
3563 | 3563 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3564 | 3564 | if($load_dirs){ |
3565 | 3565 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3566 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3566 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3567 | 3567 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3568 | 3568 | } |
3569 | 3569 | } |
@@ -3701,7 +3701,7 @@ discard block |
||
3701 | 3701 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3702 | 3702 | if($load_dirs){ |
3703 | 3703 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3704 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3704 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3705 | 3705 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3706 | 3706 | } |
3707 | 3707 | } |
@@ -4010,7 +4010,7 @@ discard block |
||
4010 | 4010 | } |
4011 | 4011 | |
4012 | 4012 | $session_title .= isset($course['special_course']) ? ' ' . |
4013 | - Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4013 | + Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4014 | 4014 | |
4015 | 4015 | $params['title'] = $session_title; |
4016 | 4016 | $params['extra'] = ''; |
@@ -3416,7 +3416,7 @@ discard block |
||
3416 | 3416 | $html .= '<a class="thumbnail" href="'.$params['link'].'">'; |
3417 | 3417 | $html .= $params['icon']; |
3418 | 3418 | $html .= '</a>'; |
3419 | - }else{ |
|
3419 | + } else{ |
|
3420 | 3420 | $html .= $params['icon']; |
3421 | 3421 | } |
3422 | 3422 | $html .= '</div>'; |
@@ -3675,7 +3675,7 @@ discard block |
||
3675 | 3675 | if ($showCustomIcon === 'true' && $iconName != 'course.png') { |
3676 | 3676 | $thumbnails = $course_info['course_image']; |
3677 | 3677 | $image = $course_info['course_image_large']; |
3678 | - }else{ |
|
3678 | + } else{ |
|
3679 | 3679 | $image = Display::return_icon('session_default.png', null, null, null,null, true); |
3680 | 3680 | } |
3681 | 3681 | |
@@ -3803,7 +3803,7 @@ discard block |
||
3803 | 3803 | if ($showCustomIcon === 'true' && $iconName != 'course.png') { |
3804 | 3804 | $thumbnails = $course_info['course_image']; |
3805 | 3805 | $image = $course_info['course_image_large']; |
3806 | - }else{ |
|
3806 | + } else{ |
|
3807 | 3807 | $image = Display::return_icon('session_default.png', null, null, null,null, true); |
3808 | 3808 | } |
3809 | 3809 |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * @param string $courseCode the course code |
737 | 737 | * @param int $visible (optional) The course visibility in the catalogue to the user (1=visible, 0=invisible) |
738 | 738 | * |
739 | - * @return boolean true if added succesfully, false otherwise. |
|
739 | + * @return boolean|string true if added succesfully, false otherwise. |
|
740 | 740 | */ |
741 | 741 | public static function addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible = 1) |
742 | 742 | { |
@@ -2607,7 +2607,7 @@ discard block |
||
2607 | 2607 | * then the courses that the user is allowed or not to see in catalogue |
2608 | 2608 | * |
2609 | 2609 | * @param boolean $allowed Either if the courses have some users that are or are not allowed to see in catalogue |
2610 | - * @param boolean $byUserId if the courses are or are not allowed to see to the user |
|
2610 | + * @param integer $byUserId if the courses are or are not allowed to see to the user |
|
2611 | 2611 | * @return array Course codes allowed or not to see in catalogue by some user or the user |
2612 | 2612 | */ |
2613 | 2613 | public static function getCatalogueCourseList($allowed = true, $byUserId = -1) |
@@ -3151,6 +3151,7 @@ discard block |
||
3151 | 3151 | * @param int $limit |
3152 | 3152 | * @param string $column |
3153 | 3153 | * @param string $direction |
3154 | + * @param integer $status |
|
3154 | 3155 | * @return array courses |
3155 | 3156 | */ |
3156 | 3157 | public static function get_courses_followed_by_drh( |
@@ -4902,7 +4903,7 @@ discard block |
||
4902 | 4903 | /** |
4903 | 4904 | * Returns the SQL conditions to filter course only visible by the user in the catalogue |
4904 | 4905 | * |
4905 | - * @param $courseTableAlias Alias of the course table |
|
4906 | + * @param string $courseTableAlias Alias of the course table |
|
4906 | 4907 | * @return string SQL conditions |
4907 | 4908 | */ |
4908 | 4909 | public static function getCourseVisibilitySQLCondition($courseTableAlias) { |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | { |
122 | 122 | return Database::fetch_array( |
123 | 123 | Database::query( |
124 | - "SELECT *, id as real_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
125 | - WHERE code='" . Database::escape_string($course_code) . "'"), 'ASSOC' |
|
124 | + "SELECT *, id as real_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
125 | + WHERE code='" . Database::escape_string($course_code)."'"), 'ASSOC' |
|
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $alsoSearchCode = false, |
151 | 151 | $conditionsLike = array() |
152 | 152 | ) { |
153 | - $sql = "SELECT course.* FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course "; |
|
153 | + $sql = "SELECT course.* FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." course "; |
|
154 | 154 | |
155 | 155 | if (!empty($urlId)) { |
156 | 156 | $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | } |
159 | 159 | |
160 | 160 | if (!empty($startwith)) { |
161 | - $sql .= "WHERE (title LIKE '" . Database::escape_string($startwith) . "%' "; |
|
161 | + $sql .= "WHERE (title LIKE '".Database::escape_string($startwith)."%' "; |
|
162 | 162 | if ($alsoSearchCode) { |
163 | - $sql .= "OR code LIKE '" . Database::escape_string($startwith) . "%' "; |
|
163 | + $sql .= "OR code LIKE '".Database::escape_string($startwith)."%' "; |
|
164 | 164 | } |
165 | 165 | $sql .= ') '; |
166 | 166 | if ($visibility !== -1 && $visibility == strval(intval($visibility))) { |
@@ -194,19 +194,19 @@ discard block |
||
194 | 194 | $value = Database::escape_string($value); |
195 | 195 | $simple_like = false; |
196 | 196 | if ($simple_like) { |
197 | - $temp_conditions[] = $field . " LIKE '$value%'"; |
|
197 | + $temp_conditions[] = $field." LIKE '$value%'"; |
|
198 | 198 | } else { |
199 | - $temp_conditions[] = $field . ' LIKE \'%' . $value . '%\''; |
|
199 | + $temp_conditions[] = $field.' LIKE \'%'.$value.'%\''; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | $condition = ' AND '; |
203 | 203 | if (!empty($temp_conditions)) { |
204 | - $sql .= implode(' ' . $condition . ' ', $temp_conditions); |
|
204 | + $sql .= implode(' '.$condition.' ', $temp_conditions); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
208 | 208 | if (!empty($orderby)) { |
209 | - $sql .= " ORDER BY " . Database::escape_string($orderby) . " "; |
|
209 | + $sql .= " ORDER BY ".Database::escape_string($orderby)." "; |
|
210 | 210 | } else { |
211 | 211 | $sql .= " ORDER BY 1 "; |
212 | 212 | } |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | if (!empty($howmany) && is_int($howmany) and $howmany > 0) { |
221 | - $sql .= ' LIMIT ' . Database::escape_string($howmany); |
|
221 | + $sql .= ' LIMIT '.Database::escape_string($howmany); |
|
222 | 222 | } else { |
223 | 223 | $sql .= ' LIMIT 1000000'; //virtually no limit |
224 | 224 | } |
225 | 225 | if (!empty($from)) { |
226 | 226 | $from = intval($from); |
227 | - $sql .= ' OFFSET ' . intval($from); |
|
227 | + $sql .= ' OFFSET '.intval($from); |
|
228 | 228 | } else { |
229 | 229 | $sql .= ' OFFSET 0'; |
230 | 230 | } |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | |
257 | 257 | $result = Database::fetch_array( |
258 | 258 | Database::query( |
259 | - "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
259 | + "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
260 | 260 | WHERE |
261 | 261 | c_id = $courseId AND |
262 | - user_id = " . intval($userId) |
|
262 | + user_id = ".intval($userId) |
|
263 | 263 | ) |
264 | 264 | ); |
265 | 265 | |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | |
278 | 278 | $result = Database::fetch_array( |
279 | 279 | Database::query(" |
280 | - SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
280 | + SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
281 | 281 | WHERE |
282 | - c_id = '" . intval($courseId). "' AND |
|
282 | + c_id = '" . intval($courseId)."' AND |
|
283 | 283 | user_id = " . intval($userId) |
284 | 284 | ) |
285 | 285 | ); |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | $result = Database::fetch_array( |
327 | 327 | Database::query(" |
328 | 328 | SELECT is_tutor |
329 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
329 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
330 | 330 | WHERE |
331 | - c_id = '" . Database::escape_string($courseId) . "' AND |
|
331 | + c_id = '" . Database::escape_string($courseId)."' AND |
|
332 | 332 | user_id = " . intval($user_id) |
333 | 333 | ) |
334 | 334 | ); |
@@ -381,17 +381,17 @@ discard block |
||
381 | 381 | $course_id = $course_info['real_id']; |
382 | 382 | |
383 | 383 | // Unsubscribe user from all groups in the course. |
384 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_USER) . " |
|
385 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
384 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_USER)." |
|
385 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
386 | 386 | Database::query($sql); |
387 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_GROUP_TUTOR) . " |
|
388 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
387 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_GROUP_TUTOR)." |
|
388 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
389 | 389 | Database::query($sql); |
390 | 390 | |
391 | 391 | // Erase user student publications (works) in the course - by André Boivin |
392 | 392 | |
393 | 393 | if (!empty($user_list)) { |
394 | - require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php'; |
|
394 | + require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php'; |
|
395 | 395 | foreach ($user_list as $userId) { |
396 | 396 | // Getting all work from user |
397 | 397 | $workList = getWorkPerUser($userId); |
@@ -410,74 +410,74 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | // Unsubscribe user from all blogs in the course. |
413 | - Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_REL_USER) . " WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"); |
|
414 | - Database::query("DELETE FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"); |
|
413 | + Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")"); |
|
414 | + Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")"); |
|
415 | 415 | |
416 | 416 | // Deleting users in forum_notification and mailqueue course tables |
417 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_FORUM_NOTIFICATION) . " |
|
418 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
417 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_NOTIFICATION)." |
|
418 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
419 | 419 | Database::query($sql); |
420 | 420 | |
421 | - $sql = "DELETE FROM " . Database::get_course_table(TABLE_FORUM_MAIL_QUEUE) . " |
|
422 | - WHERE c_id = $course_id AND user_id IN (" . $user_ids . ")"; |
|
421 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_MAIL_QUEUE)." |
|
422 | + WHERE c_id = $course_id AND user_id IN (".$user_ids.")"; |
|
423 | 423 | Database::query($sql); |
424 | 424 | |
425 | 425 | // Unsubscribe user from the course. |
426 | 426 | if (!empty($session_id)) { |
427 | 427 | |
428 | 428 | // Delete in table session_rel_course_rel_user |
429 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
429 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
430 | 430 | WHERE |
431 | - session_id ='" . $session_id . "' AND |
|
432 | - c_id = '" . $course_id . "' AND |
|
431 | + session_id ='" . $session_id."' AND |
|
432 | + c_id = '" . $course_id."' AND |
|
433 | 433 | user_id IN ($user_ids)"; |
434 | 434 | Database::query($sql); |
435 | 435 | |
436 | 436 | foreach ($user_list as $uid) { |
437 | 437 | // check if a user is register in the session with other course |
438 | - $sql = "SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
438 | + $sql = "SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
439 | 439 | WHERE session_id='$session_id' AND user_id='$uid'"; |
440 | 440 | $rs = Database::query($sql); |
441 | 441 | |
442 | 442 | if (Database::num_rows($rs) == 0) { |
443 | 443 | // Delete in table session_rel_user |
444 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . " |
|
444 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)." |
|
445 | 445 | WHERE |
446 | - session_id ='" . $session_id . "' AND |
|
446 | + session_id ='" . $session_id."' AND |
|
447 | 447 | user_id = '$uid' AND |
448 | - relation_type<>" . SESSION_RELATION_TYPE_RRHH . ""; |
|
448 | + relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
|
449 | 449 | Database::query($sql); |
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
453 | 453 | // Update the table session |
454 | - $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_USER) . " |
|
455 | - WHERE session_id = '" . $session_id . "' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH; |
|
454 | + $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_USER)." |
|
455 | + WHERE session_id = '" . $session_id."' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH; |
|
456 | 456 | $row = Database::fetch_array(Database::query($sql)); |
457 | 457 | $count = $row[0]; |
458 | 458 | // number of users by session |
459 | - $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION) . " SET nbr_users = '$count' |
|
460 | - WHERE id = '" . $session_id . "'"; |
|
459 | + $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION)." SET nbr_users = '$count' |
|
460 | + WHERE id = '".$session_id."'"; |
|
461 | 461 | Database::query($sql); |
462 | 462 | |
463 | 463 | // Update the table session_rel_course |
464 | - $sql = "SELECT COUNT(*) FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
464 | + $sql = "SELECT COUNT(*) FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
465 | 465 | WHERE session_id = '$session_id' AND c_id = '$course_id' AND status<>2"; |
466 | 466 | $row = Database::fetch_array(@Database::query($sql)); |
467 | 467 | $count = $row[0]; |
468 | 468 | |
469 | 469 | // number of users by session and course |
470 | - $sql = "UPDATE " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . " |
|
470 | + $sql = "UPDATE ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE)." |
|
471 | 471 | SET nbr_users = '$count' |
472 | 472 | WHERE session_id = '$session_id' AND c_id = '$course_id'"; |
473 | 473 | Database::query($sql); |
474 | 474 | |
475 | 475 | } else { |
476 | - $sql = "DELETE FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
476 | + $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
477 | 477 | WHERE |
478 | - user_id IN (" . $user_ids . ") AND |
|
479 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
480 | - c_id = '" . $course_id . "'"; |
|
478 | + user_id IN (" . $user_ids.") AND |
|
479 | + relation_type<>" . COURSE_RELATION_TYPE_RRHH." AND |
|
480 | + c_id = '" . $course_id."'"; |
|
481 | 481 | Database::query($sql); |
482 | 482 | |
483 | 483 | // add event to system log |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | // A preliminary check whether the user has bben already registered on the platform. |
549 | 549 | if (Database::num_rows(Database::query( |
550 | - "SELECT status FROM " . Database::get_main_table(TABLE_MAIN_USER) . " |
|
550 | + "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_USER)." |
|
551 | 551 | WHERE user_id = '$user_id' ")) == 0 |
552 | 552 | ) { |
553 | 553 | return false; // The user has not been registered to the platform. |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | |
558 | 558 | if (empty($session_id)) { |
559 | 559 | if (Database::num_rows(Database::query(" |
560 | - SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
561 | - WHERE user_id = '$user_id' AND relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND c_id = '$courseId'")) > 0 |
|
560 | + SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
561 | + WHERE user_id = '$user_id' AND relation_type<>".COURSE_RELATION_TYPE_RRHH." AND c_id = '$courseId'")) > 0 |
|
562 | 562 | ) { |
563 | 563 | // The user has been already subscribed to the course. |
564 | 564 | return false; |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | $courseId = $courseInfo['real_id']; |
681 | 681 | |
682 | 682 | // Check in advance whether the user has already been registered on the platform. |
683 | - $sql = "SELECT status FROM " . $user_table . " WHERE user_id = $user_id "; |
|
683 | + $sql = "SELECT status FROM ".$user_table." WHERE user_id = $user_id "; |
|
684 | 684 | if (Database::num_rows(Database::query($sql)) == 0) { |
685 | 685 | if ($debug) { |
686 | 686 | error_log('The user has not been registered to the platform'); |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | $sql = "SELECT * FROM $course_user_table |
693 | 693 | WHERE |
694 | 694 | user_id = $user_id AND |
695 | - relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND |
|
695 | + relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND |
|
696 | 696 | c_id = $courseId"; |
697 | 697 | if (Database::num_rows(Database::query($sql)) > 0) { |
698 | 698 | if ($debug) { |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | if (!api_is_course_admin()) { |
705 | 705 | // Check in advance whether subscription is allowed or not for this course. |
706 | 706 | $sql = "SELECT code, visibility FROM $course_table |
707 | - WHERE id = $courseId AND subscribe = '" . SUBSCRIBE_NOT_ALLOWED . "'"; |
|
707 | + WHERE id = $courseId AND subscribe = '".SUBSCRIBE_NOT_ALLOWED."'"; |
|
708 | 708 | if (Database::num_rows(Database::query($sql)) > 0) { |
709 | 709 | if ($debug) { |
710 | 710 | error_log('Subscription is not allowed for this course'); |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $courseId = $courseInfo['real_id']; |
754 | 754 | |
755 | 755 | // Check in advance whether the user has already been registered on the platform. |
756 | - $sql = "SELECT status FROM " . $userTable . " WHERE user_id = $userId "; |
|
756 | + $sql = "SELECT status FROM ".$userTable." WHERE user_id = $userId "; |
|
757 | 757 | if (Database::num_rows(Database::query($sql)) == 0) { |
758 | 758 | if ($debug) { |
759 | 759 | error_log('The user has not been registered to the platform'); |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $sql = "SELECT * FROM $courseUserTable |
766 | 766 | WHERE |
767 | 767 | user_id = $userId AND |
768 | - visible = " . $visible . " AND |
|
768 | + visible = ".$visible." AND |
|
769 | 769 | c_id = $courseId"; |
770 | 770 | if (Database::num_rows(Database::query($sql)) > 0) { |
771 | 771 | if ($debug) { |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | $sql = "SELECT * FROM $courseUserTable |
813 | 813 | WHERE |
814 | 814 | user_id = $userId AND |
815 | - visible = " . $visible . " AND |
|
815 | + visible = ".$visible." AND |
|
816 | 816 | c_id = $courseId"; |
817 | 817 | if (Database::num_rows(Database::query($sql)) > 0) { |
818 | 818 | $cond = array( |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | { |
865 | 865 | $wanted_course_code = Database::escape_string($wanted_course_code); |
866 | 866 | $sql = "SELECT COUNT(*) as number |
867 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
867 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." |
|
868 | 868 | WHERE code = '$wanted_course_code' OR visual_code = '$wanted_course_code'"; |
869 | 869 | $result = Database::fetch_array(Database::query($sql)); |
870 | 870 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $sql = "SELECT * FROM $table |
1061 | 1061 | WHERE |
1062 | 1062 | user_id = $userId AND |
1063 | - relation_type = " . COURSE_RELATION_TYPE_RRHH . " AND |
|
1063 | + relation_type = ".COURSE_RELATION_TYPE_RRHH." AND |
|
1064 | 1064 | c_id = $courseId"; |
1065 | 1065 | |
1066 | 1066 | $result = Database::fetch_array(Database::query($sql)); |
@@ -1099,13 +1099,13 @@ discard block |
||
1099 | 1099 | return false; |
1100 | 1100 | } |
1101 | 1101 | $courseId = $courseInfo['real_id']; |
1102 | - $condition_course = ' AND c_id = ' . $courseId; |
|
1102 | + $condition_course = ' AND c_id = '.$courseId; |
|
1103 | 1103 | } |
1104 | 1104 | |
1105 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
1105 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
1106 | 1106 | WHERE |
1107 | 1107 | user_id = $user_id AND |
1108 | - relation_type<>" . COURSE_RELATION_TYPE_RRHH . " |
|
1108 | + relation_type<>".COURSE_RELATION_TYPE_RRHH." |
|
1109 | 1109 | $condition_course "; |
1110 | 1110 | |
1111 | 1111 | $result = Database::fetch_array(Database::query($sql)); |
@@ -1121,20 +1121,20 @@ discard block |
||
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | $tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1124 | - $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser . |
|
1125 | - ' WHERE user_id = ' . $user_id . ' ' . $condition_course; |
|
1124 | + $sql = 'SELECT 1 FROM '.$tableSessionCourseUser. |
|
1125 | + ' WHERE user_id = '.$user_id.' '.$condition_course; |
|
1126 | 1126 | if (Database::num_rows(Database::query($sql)) > 0) { |
1127 | 1127 | return true; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $sql = 'SELECT 1 FROM ' . $tableSessionCourseUser . |
|
1131 | - ' WHERE user_id = ' . $user_id . ' AND status=2 ' . $condition_course; |
|
1130 | + $sql = 'SELECT 1 FROM '.$tableSessionCourseUser. |
|
1131 | + ' WHERE user_id = '.$user_id.' AND status=2 '.$condition_course; |
|
1132 | 1132 | if (Database::num_rows(Database::query($sql)) > 0) { |
1133 | 1133 | return true; |
1134 | 1134 | } |
1135 | 1135 | |
1136 | - $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . |
|
1137 | - ' WHERE id = ' . $session_id . ' AND id_coach=' . $user_id; |
|
1136 | + $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_SESSION). |
|
1137 | + ' WHERE id = '.$session_id.' AND id_coach='.$user_id; |
|
1138 | 1138 | |
1139 | 1139 | if (Database::num_rows(Database::query($sql)) > 0) { |
1140 | 1140 | return true; |
@@ -1161,8 +1161,8 @@ discard block |
||
1161 | 1161 | $courseId = $courseInfo['real_id']; |
1162 | 1162 | |
1163 | 1163 | $result = Database::query( |
1164 | - 'SELECT status FROM ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . |
|
1165 | - ' WHERE c_id = ' . $courseId . ' AND user_id = ' . $user_id . '' |
|
1164 | + 'SELECT status FROM '.Database::get_main_table(TABLE_MAIN_COURSE_USER). |
|
1165 | + ' WHERE c_id = '.$courseId.' AND user_id = '.$user_id.'' |
|
1166 | 1166 | ); |
1167 | 1167 | |
1168 | 1168 | if (Database::num_rows($result) > 0) { |
@@ -1192,12 +1192,12 @@ discard block |
||
1192 | 1192 | $result = Database::fetch_array( |
1193 | 1193 | Database::query( |
1194 | 1194 | "SELECT * |
1195 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " course |
|
1196 | - LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " course_user |
|
1195 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." course |
|
1196 | + LEFT JOIN " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." course_user |
|
1197 | 1197 | ON course.id = course_user.c_id |
1198 | 1198 | WHERE |
1199 | 1199 | course_user.user_id = '$user_id' AND |
1200 | - course_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND |
|
1200 | + course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND |
|
1201 | 1201 | ( course.id = '$courseId')" |
1202 | 1202 | ) |
1203 | 1203 | ); |
@@ -1211,8 +1211,8 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // A user? |
1213 | 1213 | if (Database::num_rows(Database::query("SELECT user_id |
1214 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
1215 | - WHERE session_id='" . $session_id . "' |
|
1214 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
1215 | + WHERE session_id='" . $session_id."' |
|
1216 | 1216 | AND user_id ='$user_id'")) |
1217 | 1217 | ) { |
1218 | 1218 | return true; |
@@ -1220,8 +1220,8 @@ discard block |
||
1220 | 1220 | |
1221 | 1221 | // A course coach? |
1222 | 1222 | if (Database::num_rows(Database::query("SELECT user_id |
1223 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " |
|
1224 | - WHERE session_id='" . $session_id . "' |
|
1223 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." |
|
1224 | + WHERE session_id='" . $session_id."' |
|
1225 | 1225 | AND user_id = '$user_id' AND status = 2 |
1226 | 1226 | AND c_id ='$courseId'")) |
1227 | 1227 | ) { |
@@ -1230,8 +1230,8 @@ discard block |
||
1230 | 1230 | |
1231 | 1231 | // A session coach? |
1232 | 1232 | if (Database::num_rows(Database::query("SELECT id_coach |
1233 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . " AS session |
|
1234 | - WHERE session.id='" . $session_id . "' |
|
1233 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION)." AS session |
|
1234 | + WHERE session.id='" . $session_id."' |
|
1235 | 1235 | AND id_coach='$user_id'")) |
1236 | 1236 | ) { |
1237 | 1237 | return true; |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | // we have to check if it is a valid field that can be sorted on |
1300 | 1300 | if (!strstr($order_by, 'ORDER BY')) { |
1301 | 1301 | if (!empty($order_by)) { |
1302 | - $order_by = 'ORDER BY ' . $order_by; |
|
1302 | + $order_by = 'ORDER BY '.$order_by; |
|
1303 | 1303 | } else { |
1304 | 1304 | $order_by = ''; |
1305 | 1305 | } |
@@ -1331,11 +1331,11 @@ discard block |
||
1331 | 1331 | if (!empty($courseCodeList)) { |
1332 | 1332 | $courseCodeListForSession = array_map(array('Database', 'escape_string'), $courseCodeList); |
1333 | 1333 | $courseCodeListForSession = implode('","', $courseCodeListForSession); |
1334 | - $courseCondition = ' course.code IN ("' . $courseCodeListForSession . '") '; |
|
1334 | + $courseCondition = ' course.code IN ("'.$courseCodeListForSession.'") '; |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | - $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user '; |
|
1338 | - $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " as session_course_user |
|
1337 | + $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user '; |
|
1338 | + $sql .= " LEFT JOIN ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." as session_course_user |
|
1339 | 1339 | ON |
1340 | 1340 | user.id = session_course_user.user_id AND |
1341 | 1341 | $sessionCondition |
@@ -1376,15 +1376,15 @@ discard block |
||
1376 | 1376 | } |
1377 | 1377 | } |
1378 | 1378 | |
1379 | - $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ' |
|
1380 | - . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1379 | + $sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ' |
|
1380 | + . ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user |
|
1381 | 1381 | ON |
1382 | 1382 | user.id = course_rel_user.user_id AND |
1383 | - course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' ' |
|
1383 | + course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH.' ' |
|
1384 | 1384 | . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
1385 | 1385 | |
1386 | 1386 | if (!empty($course_code)) { |
1387 | - $sql .= ' AND course_rel_user.c_id = "' . $courseId . '"'; |
|
1387 | + $sql .= ' AND course_rel_user.c_id = "'.$courseId.'"'; |
|
1388 | 1388 | } |
1389 | 1389 | $where[] = ' course_rel_user.c_id IS NOT NULL '; |
1390 | 1390 | |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | |
1397 | 1397 | $multiple_access_url = api_get_multiple_access_url(); |
1398 | 1398 | if ($multiple_access_url) { |
1399 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au |
|
1399 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au |
|
1400 | 1400 | ON (au.user_id = user.id) '; |
1401 | 1401 | } |
1402 | 1402 | |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | } |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - $sql .= ' WHERE ' . $filter_by_status_condition . ' ' . implode(' OR ', $where); |
|
1419 | + $sql .= ' WHERE '.$filter_by_status_condition.' '.implode(' OR ', $where); |
|
1420 | 1420 | |
1421 | 1421 | if ($multiple_access_url) { |
1422 | 1422 | $current_access_url_id = api_get_current_access_url_id(); |
@@ -1438,15 +1438,15 @@ discard block |
||
1438 | 1438 | if (!empty($userIdList)) { |
1439 | 1439 | $userIdList = array_map('intval', $userIdList); |
1440 | 1440 | $userIdList = implode('","', $userIdList); |
1441 | - $sql .= ' AND user.id IN ("' . $userIdList . '")'; |
|
1441 | + $sql .= ' AND user.id IN ("'.$userIdList.'")'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | if (isset($filterByActive)) { |
1445 | 1445 | $filterByActive = intval($filterByActive); |
1446 | - $sql .= ' AND user.active = ' . $filterByActive; |
|
1446 | + $sql .= ' AND user.active = '.$filterByActive; |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | - $sql .= ' ' . $order_by . ' ' . $limit; |
|
1449 | + $sql .= ' '.$order_by.' '.$limit; |
|
1450 | 1450 | |
1451 | 1451 | $rs = Database::query($sql); |
1452 | 1452 | $users = array(); |
@@ -1592,7 +1592,7 @@ discard block |
||
1592 | 1592 | ) |
1593 | 1593 | ); |
1594 | 1594 | $report_info['progress_100'] = $progress == 100 ? Display::label(get_lang('Yes'), 'success') : Display::label(get_lang('No')); |
1595 | - $report_info['progress'] = $progress . "%"; |
|
1595 | + $report_info['progress'] = $progress."%"; |
|
1596 | 1596 | |
1597 | 1597 | foreach ($extra_fields as $extra) { |
1598 | 1598 | $user_data = UserManager::get_extra_user_data_by_field($user['user_id'], $extra['1']); |
@@ -1662,32 +1662,32 @@ discard block |
||
1662 | 1662 | $courseId = $courseInfo['real_id']; |
1663 | 1663 | |
1664 | 1664 | $sql = 'SELECT DISTINCT count(user.id) as count |
1665 | - FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user '; |
|
1665 | + FROM ' . Database::get_main_table(TABLE_MAIN_USER).' as user '; |
|
1666 | 1666 | $where = array(); |
1667 | 1667 | if (!empty($session_id)) { |
1668 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' as session_course_user |
|
1668 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' as session_course_user |
|
1669 | 1669 | ON |
1670 | 1670 | user.user_id = session_course_user.user_id AND |
1671 | - session_course_user.c_id = "' . $courseId . '" AND |
|
1671 | + session_course_user.c_id = "' . $courseId.'" AND |
|
1672 | 1672 | session_course_user.session_id = ' . $session_id; |
1673 | 1673 | |
1674 | 1674 | $where[] = ' session_course_user.c_id IS NOT NULL '; |
1675 | 1675 | } else { |
1676 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1676 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_COURSE_USER).' as course_rel_user |
|
1677 | 1677 | ON |
1678 | 1678 | user.user_id = course_rel_user.user_id AND |
1679 | - course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
1680 | - course_rel_user.c_id = ' . $courseId ; |
|
1679 | + course_rel_user.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
1680 | + course_rel_user.c_id = ' . $courseId; |
|
1681 | 1681 | $where[] = ' course_rel_user.c_id IS NOT NULL '; |
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | $multiple_access_url = api_get_multiple_access_url(); |
1685 | 1685 | if ($multiple_access_url) { |
1686 | - $sql .= ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER) . ' au |
|
1686 | + $sql .= ' LEFT JOIN '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au |
|
1687 | 1687 | ON (au.user_id = user.user_id) '; |
1688 | 1688 | } |
1689 | 1689 | |
1690 | - $sql .= ' WHERE ' . implode(' OR ', $where); |
|
1690 | + $sql .= ' WHERE '.implode(' OR ', $where); |
|
1691 | 1691 | |
1692 | 1692 | if ($multiple_access_url) { |
1693 | 1693 | $current_access_url_id = api_get_current_access_url_id(); |
@@ -1724,8 +1724,8 @@ discard block |
||
1724 | 1724 | $users = array(); |
1725 | 1725 | |
1726 | 1726 | // We get the coach for the given course in a given session. |
1727 | - $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
|
1728 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1727 | + $sql = 'SELECT user_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER). |
|
1728 | + ' WHERE session_id ="'.$session_id.'" AND c_id="'.$courseId.'" AND status = 2'; |
|
1729 | 1729 | $rs = Database::query($sql); |
1730 | 1730 | while ($user = Database::fetch_array($rs)) { |
1731 | 1731 | $userInfo = api_get_user_info($user['user_id']); |
@@ -1812,11 +1812,11 @@ discard block |
||
1812 | 1812 | $joinSession = ""; |
1813 | 1813 | //Session creation date |
1814 | 1814 | if (!empty($date_from) && !empty($date_to)) { |
1815 | - $joinSession = "INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . " s"; |
|
1815 | + $joinSession = "INNER JOIN ".Database::get_main_table(TABLE_MAIN_SESSION)." s"; |
|
1816 | 1816 | } |
1817 | 1817 | |
1818 | 1818 | $sql_query = "SELECT * |
1819 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " scu |
|
1819 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." scu |
|
1820 | 1820 | $joinSession |
1821 | 1821 | INNER JOIN $userTable u ON scu.user_id = u.user_id |
1822 | 1822 | WHERE scu.c_id = '$courseId' AND scu.status <> 2"; |
@@ -1828,11 +1828,11 @@ discard block |
||
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | if ($session_id != 0) { |
1831 | - $sql_query .= ' AND scu.session_id = ' . $session_id; |
|
1831 | + $sql_query .= ' AND scu.session_id = '.$session_id; |
|
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | if (!$includeInvitedUsers) { |
1835 | - $sql_query .= " AND u.status != " . INVITEE; |
|
1835 | + $sql_query .= " AND u.status != ".INVITEE; |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | 1838 | $rs = Database::query($sql_query); |
@@ -1866,8 +1866,8 @@ discard block |
||
1866 | 1866 | u.email, |
1867 | 1867 | u.username, |
1868 | 1868 | u.status |
1869 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " cu |
|
1870 | - INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " u |
|
1869 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu |
|
1870 | + INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER)." u |
|
1871 | 1871 | ON (cu.user_id = u.id) |
1872 | 1872 | WHERE |
1873 | 1873 | cu.c_id = $courseId AND |
@@ -1905,8 +1905,8 @@ discard block |
||
1905 | 1905 | u.email, |
1906 | 1906 | u.username, |
1907 | 1907 | u.status |
1908 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " cu |
|
1909 | - INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER) . " u |
|
1908 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu |
|
1909 | + INNER JOIN " . Database::get_main_table(TABLE_MAIN_USER)." u |
|
1910 | 1910 | ON (cu.user_id = u.id) |
1911 | 1911 | WHERE |
1912 | 1912 | cu.c_id = $courseId AND |
@@ -1914,7 +1914,7 @@ discard block |
||
1914 | 1914 | $rs = Database::query($sql); |
1915 | 1915 | $listTeachers = array(); |
1916 | 1916 | $teachers = array(); |
1917 | - $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup'; |
|
1917 | + $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup'; |
|
1918 | 1918 | while ($teacher = Database::fetch_array($rs)) { |
1919 | 1919 | $teachers['id'] = $teacher['user_id']; |
1920 | 1920 | $teachers['lastname'] = $teacher['lastname']; |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | $userPicture = UserManager::getUserPicture($teacher['user_id'], USER_IMAGE_SIZE_SMALL); |
1928 | 1928 | $teachers['avatar'] = $userPicture; |
1929 | 1929 | } |
1930 | - $teachers['url'] = $url.'&user_id='. $teacher['user_id']; |
|
1930 | + $teachers['url'] = $url.'&user_id='.$teacher['user_id']; |
|
1931 | 1931 | $listTeachers[] = $teachers; |
1932 | 1932 | } |
1933 | 1933 | |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | $teacher['lastname'] |
1958 | 1958 | ); |
1959 | 1959 | if ($add_link_to_profile) { |
1960 | - $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $teacher['user_id']; |
|
1960 | + $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$teacher['user_id']; |
|
1961 | 1961 | $teacher_name = Display::url( |
1962 | 1962 | $teacher_name, |
1963 | 1963 | $url, |
@@ -1973,8 +1973,8 @@ discard block |
||
1973 | 1973 | if (!empty($list)) { |
1974 | 1974 | if ($orderList === true) { |
1975 | 1975 | $html .= '<ul class="user-teacher">'; |
1976 | - foreach ($list as $teacher){ |
|
1977 | - $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY) . ' ' . $teacher); |
|
1976 | + foreach ($list as $teacher) { |
|
1977 | + $html .= Display::tag('li', Display::return_icon('teacher.png', $teacher, null, ICON_SIZE_TINY).' '.$teacher); |
|
1978 | 1978 | } |
1979 | 1979 | $html .= '</ul>'; |
1980 | 1980 | } else { |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | foreach ($coachList as $coach_course) { |
2056 | 2056 | $coach_name = $coach_course['full_name']; |
2057 | 2057 | if ($add_link_to_profile) { |
2058 | - $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coach_course['user_id']; |
|
2058 | + $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coach_course['user_id']; |
|
2059 | 2059 | $coach_name = Display::url( |
2060 | 2060 | $coach_name, |
2061 | 2061 | $url, |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | foreach ($course_coachs as $coachs) { |
2077 | 2077 | $html .= Display::tag( |
2078 | 2078 | 'li', |
2079 | - Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY) . ' ' . $coachs |
|
2079 | + Display::return_icon('teacher.png', $coachs, null, ICON_SIZE_TINY).' '.$coachs |
|
2080 | 2080 | ); |
2081 | 2081 | } |
2082 | 2082 | $html .= '</ul>'; |
@@ -2129,20 +2129,20 @@ discard block |
||
2129 | 2129 | } |
2130 | 2130 | |
2131 | 2131 | $group_list = array(); |
2132 | - $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,' . intval($session_id) . ')' : $session_condition = ' WHERE g.session_id = 0'; |
|
2132 | + $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0'; |
|
2133 | 2133 | |
2134 | 2134 | if ($in_get_empty_group == 0) { |
2135 | 2135 | // get only groups that are not empty |
2136 | 2136 | $sql = "SELECT DISTINCT g.id, g.iid, g.name |
2137 | - FROM " . Database::get_course_table(TABLE_GROUP) . " AS g |
|
2138 | - INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER) . " gu |
|
2137 | + FROM " . Database::get_course_table(TABLE_GROUP)." AS g |
|
2138 | + INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER)." gu |
|
2139 | 2139 | ON (g.id = gu.group_id AND g.c_id = $course_id AND gu.c_id = $course_id) |
2140 | 2140 | $session_condition |
2141 | 2141 | ORDER BY g.name"; |
2142 | 2142 | } else { |
2143 | 2143 | // get all groups even if they are empty |
2144 | 2144 | $sql = "SELECT g.id, g.name, g.iid |
2145 | - FROM " . Database::get_course_table(TABLE_GROUP) . " AS g |
|
2145 | + FROM " . Database::get_course_table(TABLE_GROUP)." AS g |
|
2146 | 2146 | $session_condition |
2147 | 2147 | AND c_id = $course_id"; |
2148 | 2148 | } |
@@ -2198,7 +2198,7 @@ discard block |
||
2198 | 2198 | $table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS); |
2199 | 2199 | |
2200 | 2200 | $codeFiltered = Database::escape_string($code); |
2201 | - $sql = "SELECT * FROM $table_course WHERE code='" . $codeFiltered . "'"; |
|
2201 | + $sql = "SELECT * FROM $table_course WHERE code='".$codeFiltered."'"; |
|
2202 | 2202 | $res = Database::query($sql); |
2203 | 2203 | |
2204 | 2204 | if (Database::num_rows($res) == 0) { |
@@ -2206,7 +2206,7 @@ discard block |
||
2206 | 2206 | } |
2207 | 2207 | |
2208 | 2208 | $sql = "SELECT * FROM $table_course |
2209 | - WHERE code = '" . $codeFiltered . "'"; |
|
2209 | + WHERE code = '".$codeFiltered."'"; |
|
2210 | 2210 | $res = Database::query($sql); |
2211 | 2211 | $course = Database::fetch_array($res); |
2212 | 2212 | $courseId = $course['id']; |
@@ -2254,34 +2254,34 @@ discard block |
||
2254 | 2254 | } |
2255 | 2255 | } |
2256 | 2256 | |
2257 | - $course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory']; |
|
2258 | - $archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time(); |
|
2257 | + $course_dir = api_get_path(SYS_COURSE_PATH).$course['directory']; |
|
2258 | + $archive_dir = api_get_path(SYS_ARCHIVE_PATH).$course['directory'].'_'.time(); |
|
2259 | 2259 | if (is_dir($course_dir)) { |
2260 | 2260 | rename($course_dir, $archive_dir); |
2261 | 2261 | } |
2262 | 2262 | |
2263 | 2263 | // Unsubscribe all users from the course |
2264 | - $sql = "DELETE FROM $table_course_user WHERE c_id='" . $courseId . "'"; |
|
2264 | + $sql = "DELETE FROM $table_course_user WHERE c_id='".$courseId."'"; |
|
2265 | 2265 | Database::query($sql); |
2266 | 2266 | // Delete the course from the sessions tables |
2267 | - $sql = "DELETE FROM $table_session_course WHERE c_id='" . $courseId . "'"; |
|
2267 | + $sql = "DELETE FROM $table_session_course WHERE c_id='".$courseId."'"; |
|
2268 | 2268 | Database::query($sql); |
2269 | - $sql = "DELETE FROM $table_session_course_user WHERE c_id='" . $courseId . "'"; |
|
2269 | + $sql = "DELETE FROM $table_session_course_user WHERE c_id='".$courseId."'"; |
|
2270 | 2270 | Database::query($sql); |
2271 | 2271 | |
2272 | 2272 | // Delete from Course - URL |
2273 | - $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '" . $courseId. "'"; |
|
2273 | + $sql = "DELETE FROM $table_course_rel_url WHERE c_id = '".$courseId."'"; |
|
2274 | 2274 | Database::query($sql); |
2275 | 2275 | |
2276 | - $sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"'; |
|
2276 | + $sql = 'SELECT survey_id FROM '.$table_course_survey.' WHERE course_code="'.$codeFiltered.'"'; |
|
2277 | 2277 | $result_surveys = Database::query($sql); |
2278 | 2278 | while ($surveys = Database::fetch_array($result_surveys)) { |
2279 | 2279 | $survey_id = $surveys[0]; |
2280 | - $sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"'; |
|
2280 | + $sql = 'DELETE FROM '.$table_course_survey_question.' WHERE survey_id="'.$survey_id.'"'; |
|
2281 | 2281 | Database::query($sql); |
2282 | - $sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"'; |
|
2282 | + $sql = 'DELETE FROM '.$table_course_survey_question_option.' WHERE survey_id="'.$survey_id.'"'; |
|
2283 | 2283 | Database::query($sql); |
2284 | - $sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"'; |
|
2284 | + $sql = 'DELETE FROM '.$table_course_survey.' WHERE survey_id="'.$survey_id.'"'; |
|
2285 | 2285 | Database::query($sql); |
2286 | 2286 | } |
2287 | 2287 | |
@@ -2324,7 +2324,7 @@ discard block |
||
2324 | 2324 | Database::query($sql); |
2325 | 2325 | |
2326 | 2326 | // Delete the course from the database |
2327 | - $sql = "DELETE FROM $table_course WHERE code = '" . $codeFiltered . "'"; |
|
2327 | + $sql = "DELETE FROM $table_course WHERE code = '".$codeFiltered."'"; |
|
2328 | 2328 | Database::query($sql); |
2329 | 2329 | |
2330 | 2330 | // delete extra course fields |
@@ -2370,15 +2370,15 @@ discard block |
||
2370 | 2370 | while ($row = Database::fetch_array($res_table, 'ASSOC')) { |
2371 | 2371 | $row_to_save = array(); |
2372 | 2372 | foreach ($row as $key => $value) { |
2373 | - $row_to_save[$key] = $key . "='" . Database::escape_string($row[$key]) . "'"; |
|
2373 | + $row_to_save[$key] = $key."='".Database::escape_string($row[$key])."'"; |
|
2374 | 2374 | } |
2375 | - $sql_dump .= "\nINSERT INTO $table SET " . implode(', ', $row_to_save) . ';'; |
|
2375 | + $sql_dump .= "\nINSERT INTO $table SET ".implode(', ', $row_to_save).';'; |
|
2376 | 2376 | } |
2377 | 2377 | } |
2378 | 2378 | } |
2379 | 2379 | |
2380 | - if (is_dir(api_get_path(SYS_COURSE_PATH) . $course['directory'])) { |
|
2381 | - $file_name = api_get_path(SYS_COURSE_PATH) . $course['directory'] . '/mysql_dump.sql'; |
|
2380 | + if (is_dir(api_get_path(SYS_COURSE_PATH).$course['directory'])) { |
|
2381 | + $file_name = api_get_path(SYS_COURSE_PATH).$course['directory'].'/mysql_dump.sql'; |
|
2382 | 2382 | $handle = fopen($file_name, 'a+'); |
2383 | 2383 | if ($handle !== false) { |
2384 | 2384 | fwrite($handle, $sql_dump); |
@@ -2407,13 +2407,13 @@ discard block |
||
2407 | 2407 | $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE); |
2408 | 2408 | $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
2409 | 2409 | |
2410 | - $course_title = Database::result(Database::query('SELECT title FROM ' . $TABLECOURSE . ' WHERE code="' . $course_code . '"'), |
|
2410 | + $course_title = Database::result(Database::query('SELECT title FROM '.$TABLECOURSE.' WHERE code="'.$course_code.'"'), |
|
2411 | 2411 | 0, 0); |
2412 | 2412 | |
2413 | 2413 | $sql = 'SELECT course.code as code, course.title as title, cu.sort as sort |
2414 | - FROM ' . $TABLECOURSUSER . ' as cu, ' . $TABLECOURSE . ' as course |
|
2415 | - WHERE course.id = cu.c_id AND user_id = "' . $user_id . '" AND |
|
2416 | - cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
2414 | + FROM ' . $TABLECOURSUSER.' as cu, '.$TABLECOURSE.' as course |
|
2415 | + WHERE course.id = cu.c_id AND user_id = "' . $user_id.'" AND |
|
2416 | + cu.relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
2417 | 2417 | user_course_cat = 0 |
2418 | 2418 | ORDER BY cu.sort'; |
2419 | 2419 | $result = Database::query($sql); |
@@ -2432,21 +2432,21 @@ discard block |
||
2432 | 2432 | $course_found = true; |
2433 | 2433 | $course_sort = $courses['sort']; |
2434 | 2434 | if ($counter == 0) { |
2435 | - $sql = 'UPDATE ' . $TABLECOURSUSER . ' |
|
2435 | + $sql = 'UPDATE '.$TABLECOURSUSER.' |
|
2436 | 2436 | SET sort = sort+1 |
2437 | 2437 | WHERE |
2438 | - user_id= "' . $user_id . '" AND |
|
2439 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
2438 | + user_id= "' . $user_id.'" AND |
|
2439 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
2440 | 2440 | AND user_course_cat="0" |
2441 | - AND sort > "' . $course_sort . '"'; |
|
2441 | + AND sort > "' . $course_sort.'"'; |
|
2442 | 2442 | $course_sort++; |
2443 | 2443 | } else { |
2444 | - $sql = 'UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1 |
|
2444 | + $sql = 'UPDATE '.$TABLECOURSUSER.' SET sort = sort+1 |
|
2445 | 2445 | WHERE |
2446 | - user_id= "' . $user_id . '" AND |
|
2447 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' AND |
|
2446 | + user_id= "' . $user_id.'" AND |
|
2447 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' AND |
|
2448 | 2448 | user_course_cat="0" AND |
2449 | - sort >= "' . $course_sort . '"'; |
|
2449 | + sort >= "' . $course_sort.'"'; |
|
2450 | 2450 | } |
2451 | 2451 | Database::query($sql); |
2452 | 2452 | break; |
@@ -2459,9 +2459,9 @@ discard block |
||
2459 | 2459 | |
2460 | 2460 | // We must register the course in the beginning of the list |
2461 | 2461 | if (!$course_found) { |
2462 | - $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM ' . $TABLECOURSUSER . ' WHERE user_id="' . $user_id . '" AND user_course_cat="0"'), |
|
2462 | + $course_sort = Database::result(Database::query('SELECT min(sort) as min_sort FROM '.$TABLECOURSUSER.' WHERE user_id="'.$user_id.'" AND user_course_cat="0"'), |
|
2463 | 2463 | 0, 0); |
2464 | - Database::query('UPDATE ' . $TABLECOURSUSER . ' SET sort = sort+1 WHERE user_id= "' . $user_id . '" AND user_course_cat="0"'); |
|
2464 | + Database::query('UPDATE '.$TABLECOURSUSER.' SET sort = sort+1 WHERE user_id= "'.$user_id.'" AND user_course_cat="0"'); |
|
2465 | 2465 | } |
2466 | 2466 | } |
2467 | 2467 | return $course_sort; |
@@ -2474,8 +2474,8 @@ discard block |
||
2474 | 2474 | */ |
2475 | 2475 | public static function course_exists($course_code) |
2476 | 2476 | { |
2477 | - $sql = 'SELECT 1 FROM ' . Database::get_main_table(TABLE_MAIN_COURSE) . ' |
|
2478 | - WHERE code="' . Database::escape_string($course_code) . '"'; |
|
2477 | + $sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_COURSE).' |
|
2478 | + WHERE code="' . Database::escape_string($course_code).'"'; |
|
2479 | 2479 | |
2480 | 2480 | return Database::num_rows(Database::query($sql)); |
2481 | 2481 | } |
@@ -2500,8 +2500,8 @@ discard block |
||
2500 | 2500 | $student = api_get_user_info($user_id); |
2501 | 2501 | |
2502 | 2502 | $name_course = $information['title']; |
2503 | - $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
2504 | - WHERE c_id ='" . $courseId . "'"; |
|
2503 | + $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
2504 | + WHERE c_id ='" . $courseId."'"; |
|
2505 | 2505 | |
2506 | 2506 | // TODO: Ivan: This is a mistake, please, have a look at it. Intention here is diffcult to be guessed. |
2507 | 2507 | //if ($send_to_tutor_also = true) |
@@ -2516,18 +2516,18 @@ discard block |
||
2516 | 2516 | while ($row = Database::fetch_array($result)) { |
2517 | 2517 | $tutor = api_get_user_info($row['user_id']); |
2518 | 2518 | $emailto = $tutor['email']; |
2519 | - $emailsubject = get_lang('NewUserInTheCourse') . ': ' . $name_course; |
|
2520 | - $emailbody = get_lang('Dear') . ': ' . api_get_person_name($tutor['firstname'], $tutor['lastname']) . "\n"; |
|
2521 | - $emailbody .= get_lang('MessageNewUserInTheCourse') . ': ' . $name_course . "\n"; |
|
2522 | - $emailbody .= get_lang('UserName') . ': ' . $student['username'] . "\n"; |
|
2519 | + $emailsubject = get_lang('NewUserInTheCourse').': '.$name_course; |
|
2520 | + $emailbody = get_lang('Dear').': '.api_get_person_name($tutor['firstname'], $tutor['lastname'])."\n"; |
|
2521 | + $emailbody .= get_lang('MessageNewUserInTheCourse').': '.$name_course."\n"; |
|
2522 | + $emailbody .= get_lang('UserName').': '.$student['username']."\n"; |
|
2523 | 2523 | if (api_is_western_name_order()) { |
2524 | - $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; |
|
2525 | - $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; |
|
2524 | + $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n"; |
|
2525 | + $emailbody .= get_lang('LastName').': '.$student['lastname']."\n"; |
|
2526 | 2526 | } else { |
2527 | - $emailbody .= get_lang('LastName') . ': ' . $student['lastname'] . "\n"; |
|
2528 | - $emailbody .= get_lang('FirstName') . ': ' . $student['firstname'] . "\n"; |
|
2527 | + $emailbody .= get_lang('LastName').': '.$student['lastname']."\n"; |
|
2528 | + $emailbody .= get_lang('FirstName').': '.$student['firstname']."\n"; |
|
2529 | 2529 | } |
2530 | - $emailbody .= get_lang('Email') . ': <a href="mailto:' . $student['email'] . '">' . $student['email'] ."</a>\n\n"; |
|
2530 | + $emailbody .= get_lang('Email').': <a href="mailto:'.$student['email'].'">'.$student['email']."</a>\n\n"; |
|
2531 | 2531 | $recipient_name = api_get_person_name($tutor['firstname'], $tutor['lastname'], null, |
2532 | 2532 | PERSON_NAME_EMAIL_ADDRESS); |
2533 | 2533 | $sender_name = api_get_person_name(api_get_setting('administratorName'), |
@@ -2681,9 +2681,9 @@ discard block |
||
2681 | 2681 | } else { |
2682 | 2682 | $with_special_courses = $without_special_courses = ''; |
2683 | 2683 | if (!empty($special_course_list)) { |
2684 | - $sc_string = '"' . implode('","', $special_course_list) . '"'; |
|
2685 | - $with_special_courses = ' course.id IN (' . $sc_string . ')'; |
|
2686 | - $without_special_courses = ' AND course.id NOT IN (' . $sc_string . ')'; |
|
2684 | + $sc_string = '"'.implode('","', $special_course_list).'"'; |
|
2685 | + $with_special_courses = ' course.id IN ('.$sc_string.')'; |
|
2686 | + $without_special_courses = ' AND course.id NOT IN ('.$sc_string.')'; |
|
2687 | 2687 | } |
2688 | 2688 | |
2689 | 2689 | if (!empty($with_special_courses)) { |
@@ -2727,8 +2727,8 @@ discard block |
||
2727 | 2727 | |
2728 | 2728 | if ($include_sessions === true) { |
2729 | 2729 | $sql = "SELECT DISTINCT(c.code), c.id as real_id |
2730 | - FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . " s, |
|
2731 | - " . Database::get_main_table(TABLE_MAIN_COURSE) . " c |
|
2730 | + FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER)." s, |
|
2731 | + " . Database::get_main_table(TABLE_MAIN_COURSE)." c |
|
2732 | 2732 | WHERE user_id = $user_id AND s.c_id = c.id"; |
2733 | 2733 | $r = Database::query($sql); |
2734 | 2734 | while ($row = Database::fetch_array($r, 'ASSOC')) { |
@@ -2750,7 +2750,7 @@ discard block |
||
2750 | 2750 | public static function get_course_id_from_path($path) |
2751 | 2751 | { |
2752 | 2752 | $path = Database::escape_string(str_replace('.', '', str_replace('/', '', $path))); |
2753 | - $res = Database::query("SELECT code FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
2753 | + $res = Database::query("SELECT code FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
2754 | 2754 | WHERE directory LIKE BINARY '$path'"); |
2755 | 2755 | if ($res === false) { |
2756 | 2756 | return false; |
@@ -2772,8 +2772,8 @@ discard block |
||
2772 | 2772 | public static function get_courses_info_from_visual_code($code) |
2773 | 2773 | { |
2774 | 2774 | $result = array(); |
2775 | - $sql_result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE) . " |
|
2776 | - WHERE visual_code = '" . Database::escape_string($code) . "'"); |
|
2775 | + $sql_result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE)." |
|
2776 | + WHERE visual_code = '" . Database::escape_string($code)."'"); |
|
2777 | 2777 | while ($virtual_course = Database::fetch_array($sql_result)) { |
2778 | 2778 | $result[] = $virtual_course; |
2779 | 2779 | } |
@@ -2790,10 +2790,10 @@ discard block |
||
2790 | 2790 | public static function get_emails_of_tutors_to_course($courseId) |
2791 | 2791 | { |
2792 | 2792 | $list = array(); |
2793 | - $res = Database::query("SELECT user_id FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . " |
|
2794 | - WHERE c_id ='" . intval($courseId) . "' AND status=1"); |
|
2793 | + $res = Database::query("SELECT user_id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." |
|
2794 | + WHERE c_id ='" . intval($courseId)."' AND status=1"); |
|
2795 | 2795 | while ($list_users = Database::fetch_array($res)) { |
2796 | - $result = Database::query("SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . " |
|
2796 | + $result = Database::query("SELECT * FROM ".Database::get_main_table(TABLE_MAIN_USER)." |
|
2797 | 2797 | WHERE user_id=" . $list_users['user_id']); |
2798 | 2798 | while ($row_user = Database::fetch_array($result)) { |
2799 | 2799 | $name_teacher = api_get_person_name($row_user['firstname'], $row_user['lastname']); |
@@ -2837,7 +2837,7 @@ discard block |
||
2837 | 2837 | } |
2838 | 2838 | |
2839 | 2839 | $sql = "SELECT firstname, lastname, email FROM $tbl_user |
2840 | - WHERE user_id IN (" . implode(",", $user_ids) . ")"; |
|
2840 | + WHERE user_id IN (".implode(",", $user_ids).")"; |
|
2841 | 2841 | $rs_user = Database::query($sql); |
2842 | 2842 | |
2843 | 2843 | while ($row_emails = Database::fetch_array($rs_user)) { |
@@ -2886,9 +2886,9 @@ discard block |
||
2886 | 2886 | */ |
2887 | 2887 | public static function update_attribute($id, $name, $value) |
2888 | 2888 | { |
2889 | - $id = (int)$id; |
|
2889 | + $id = (int) $id; |
|
2890 | 2890 | $table = Database::get_main_table(TABLE_MAIN_COURSE); |
2891 | - $sql = "UPDATE $table SET $name = '" . Database::escape_string($value) . "' |
|
2891 | + $sql = "UPDATE $table SET $name = '".Database::escape_string($value)."' |
|
2892 | 2892 | WHERE id = '$id'"; |
2893 | 2893 | |
2894 | 2894 | return Database::query($sql); |
@@ -2904,7 +2904,7 @@ discard block |
||
2904 | 2904 | */ |
2905 | 2905 | public static function update_attributes($id, $attributes) |
2906 | 2906 | { |
2907 | - $id = (int)$id; |
|
2907 | + $id = (int) $id; |
|
2908 | 2908 | $table = Database::get_main_table(TABLE_MAIN_COURSE); |
2909 | 2909 | $sql = "UPDATE $table SET "; |
2910 | 2910 | $i = 0; |
@@ -2913,7 +2913,7 @@ discard block |
||
2913 | 2913 | if ($i > 0) { |
2914 | 2914 | $sql .= ", "; |
2915 | 2915 | } |
2916 | - $sql .= " $name = '" . Database::escape_string($value) . "'"; |
|
2916 | + $sql .= " $name = '".Database::escape_string($value)."'"; |
|
2917 | 2917 | $i++; |
2918 | 2918 | } |
2919 | 2919 | } |
@@ -2955,10 +2955,10 @@ discard block |
||
2955 | 2955 | } |
2956 | 2956 | |
2957 | 2957 | $sql = 'SELECT sc.id session_category |
2958 | - FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY) . ' sc |
|
2959 | - INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' s |
|
2958 | + FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY).' sc |
|
2959 | + INNER JOIN ' . Database::get_main_table(TABLE_MAIN_SESSION).' s |
|
2960 | 2960 | ON sc.id = s.session_category_id |
2961 | - WHERE s.id="' . intval($session_id) . '"'; |
|
2961 | + WHERE s.id="' . intval($session_id).'"'; |
|
2962 | 2962 | |
2963 | 2963 | return Database::result( |
2964 | 2964 | Database::query($sql), |
@@ -3004,13 +3004,13 @@ discard block |
||
3004 | 3004 | $data .= '<div class="sectiontitle">'; |
3005 | 3005 | if (api_is_allowed_to_edit() && $action_show) { |
3006 | 3006 | //delete |
3007 | - $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete&description_id=' . $description->id . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), |
|
3008 | - ENT_QUOTES, $charset)) . '\')) return false;">'; |
|
3007 | + $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), |
|
3008 | + ENT_QUOTES, $charset)).'\')) return false;">'; |
|
3009 | 3009 | $data .= Display::return_icon('delete.gif', get_lang('Delete'), |
3010 | 3010 | array('style' => 'vertical-align:middle;float:right;')); |
3011 | 3011 | $data .= '</a> '; |
3012 | 3012 | //edit |
3013 | - $data .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&description_id=' . $description->id . '">'; |
|
3013 | + $data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&description_id='.$description->id.'">'; |
|
3014 | 3014 | $data .= Display::return_icon('edit.png', get_lang('Edit'), |
3015 | 3015 | array('style' => 'vertical-align:middle;float:right; padding-right:4px;'), ICON_SIZE_SMALL); |
3016 | 3016 | $data .= '</a> '; |
@@ -3022,7 +3022,7 @@ discard block |
||
3022 | 3022 | $data .= '</div>'; |
3023 | 3023 | } |
3024 | 3024 | } else { |
3025 | - $data .= '<em>' . get_lang('ThisCourseDescriptionIsEmpty') . '</em>'; |
|
3025 | + $data .= '<em>'.get_lang('ThisCourseDescriptionIsEmpty').'</em>'; |
|
3026 | 3026 | } |
3027 | 3027 | |
3028 | 3028 | return $data; |
@@ -3109,11 +3109,11 @@ discard block |
||
3109 | 3109 | ON (a.c_id = s.c_id) |
3110 | 3110 | WHERE |
3111 | 3111 | user_id = $hr_manager_id AND |
3112 | - relation_type=" . COURSE_RELATION_TYPE_RRHH . " AND |
|
3113 | - access_url_id = " . api_get_current_access_url_id() . ""; |
|
3112 | + relation_type=".COURSE_RELATION_TYPE_RRHH." AND |
|
3113 | + access_url_id = " . api_get_current_access_url_id().""; |
|
3114 | 3114 | } else { |
3115 | 3115 | $sql = "SELECT c_id FROM $tbl_course_rel_user |
3116 | - WHERE user_id = $hr_manager_id AND relation_type=" . COURSE_RELATION_TYPE_RRHH . " "; |
|
3116 | + WHERE user_id = $hr_manager_id AND relation_type=".COURSE_RELATION_TYPE_RRHH." "; |
|
3117 | 3117 | } |
3118 | 3118 | $result = Database::query($sql); |
3119 | 3119 | if (Database::num_rows($result) > 0) { |
@@ -3122,7 +3122,7 @@ discard block |
||
3122 | 3122 | WHERE |
3123 | 3123 | c_id = '{$row['c_id']}' AND |
3124 | 3124 | user_id = $hr_manager_id AND |
3125 | - relation_type=" . COURSE_RELATION_TYPE_RRHH . " "; |
|
3125 | + relation_type=".COURSE_RELATION_TYPE_RRHH." "; |
|
3126 | 3126 | Database::query($sql); |
3127 | 3127 | } |
3128 | 3128 | } |
@@ -3133,7 +3133,7 @@ discard block |
||
3133 | 3133 | $courseInfo = api_get_course_info($course_code); |
3134 | 3134 | $courseId = $courseInfo['real_id']; |
3135 | 3135 | $sql = "INSERT IGNORE INTO $tbl_course_rel_user(c_id, user_id, status, relation_type) |
3136 | - VALUES($courseId, $hr_manager_id, '" . DRH . "', '" . COURSE_RELATION_TYPE_RRHH . "')"; |
|
3136 | + VALUES($courseId, $hr_manager_id, '".DRH."', '".COURSE_RELATION_TYPE_RRHH."')"; |
|
3137 | 3137 | $result = Database::query($sql); |
3138 | 3138 | if (Database::affected_rows($result)) { |
3139 | 3139 | $affected_rows++; |
@@ -3216,16 +3216,16 @@ discard block |
||
3216 | 3216 | case COURSEMANAGER: |
3217 | 3217 | $whereConditions .= " AND cru.user_id = '$user_id'"; |
3218 | 3218 | if (!$showAllAssignedCourses) { |
3219 | - $whereConditions .= " AND status = " . COURSEMANAGER; |
|
3219 | + $whereConditions .= " AND status = ".COURSEMANAGER; |
|
3220 | 3220 | } else { |
3221 | - $whereConditions .= " AND relation_type = " . COURSE_RELATION_TYPE_COURSE_MANAGER; |
|
3221 | + $whereConditions .= " AND relation_type = ".COURSE_RELATION_TYPE_COURSE_MANAGER; |
|
3222 | 3222 | } |
3223 | 3223 | break; |
3224 | 3224 | case DRH: |
3225 | 3225 | $whereConditions .= " AND |
3226 | 3226 | cru.user_id = '$user_id' AND |
3227 | - status = " . DRH . " AND |
|
3228 | - relation_type = '" . COURSE_RELATION_TYPE_RRHH . "' |
|
3227 | + status = ".DRH." AND |
|
3228 | + relation_type = '" . COURSE_RELATION_TYPE_RRHH."' |
|
3229 | 3229 | "; |
3230 | 3230 | break; |
3231 | 3231 | } |
@@ -3246,7 +3246,7 @@ discard block |
||
3246 | 3246 | ); |
3247 | 3247 | if (!empty($courseList)) { |
3248 | 3248 | $courseListToString = implode("','", array_keys($courseList)); |
3249 | - $whereConditions .= " AND c.id IN ('" . $courseListToString . "')"; |
|
3249 | + $whereConditions .= " AND c.id IN ('".$courseListToString."')"; |
|
3250 | 3250 | } |
3251 | 3251 | $tableSessionRelCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
3252 | 3252 | $orderBy = ' ORDER BY position'; |
@@ -3262,7 +3262,7 @@ discard block |
||
3262 | 3262 | INNER JOIN $tbl_course_rel_access_url a ON (a.c_id = c.id) |
3263 | 3263 | $extraInnerJoin |
3264 | 3264 | WHERE |
3265 | - access_url_id = " . api_get_current_access_url_id() . " |
|
3265 | + access_url_id = ".api_get_current_access_url_id()." |
|
3266 | 3266 | $whereConditions |
3267 | 3267 | $orderBy |
3268 | 3268 | "; |
@@ -3323,10 +3323,10 @@ discard block |
||
3323 | 3323 | { |
3324 | 3324 | $course_info = api_get_course_info($course_code); |
3325 | 3325 | // course path |
3326 | - $store_path = api_get_path(SYS_COURSE_PATH) . $course_info['path']; |
|
3326 | + $store_path = api_get_path(SYS_COURSE_PATH).$course_info['path']; |
|
3327 | 3327 | // image name for courses |
3328 | - $course_image = $store_path . '/course-pic.png'; |
|
3329 | - $course_medium_image = $store_path . '/course-pic85x85.png'; |
|
3328 | + $course_image = $store_path.'/course-pic.png'; |
|
3329 | + $course_medium_image = $store_path.'/course-pic85x85.png'; |
|
3330 | 3330 | |
3331 | 3331 | if (file_exists($course_image)) { |
3332 | 3332 | unlink($course_image); |
@@ -3360,11 +3360,11 @@ discard block |
||
3360 | 3360 | { |
3361 | 3361 | $course_info = api_get_course_info($courseCode); |
3362 | 3362 | // course path |
3363 | - $storePath = api_get_path(SYS_COURSE_PATH) . $course_info['path']; |
|
3363 | + $storePath = api_get_path(SYS_COURSE_PATH).$course_info['path']; |
|
3364 | 3364 | // image name for courses |
3365 | - $courseImage = $storePath . '/course-pic.png'; |
|
3366 | - $courseMediumImage = $storePath . '/course-pic85x85.png'; |
|
3367 | - $courseSmallImage = $storePath . '/course-pic32.png'; |
|
3365 | + $courseImage = $storePath.'/course-pic.png'; |
|
3366 | + $courseMediumImage = $storePath.'/course-pic85x85.png'; |
|
3367 | + $courseSmallImage = $storePath.'/course-pic32.png'; |
|
3368 | 3368 | |
3369 | 3369 | if (file_exists($courseImage)) { |
3370 | 3370 | unlink($courseImage); |
@@ -3392,26 +3392,26 @@ discard block |
||
3392 | 3392 | |
3393 | 3393 | $notifications = isset($params['notifications']) ? $params['notifications'] : null; |
3394 | 3394 | |
3395 | - $html .= '<h3>' . $params['title'] . $notifications . '</h3> '; |
|
3395 | + $html .= '<h3>'.$params['title'].$notifications.'</h3> '; |
|
3396 | 3396 | |
3397 | 3397 | if (isset($params['description'])) { |
3398 | - $html .= '<p>' . $params['description'] . '</p>'; |
|
3398 | + $html .= '<p>'.$params['description'].'</p>'; |
|
3399 | 3399 | } |
3400 | 3400 | if (!empty($params['subtitle'])) { |
3401 | - $html .= '<small>' . $params['subtitle'] . '</small>'; |
|
3401 | + $html .= '<small>'.$params['subtitle'].'</small>'; |
|
3402 | 3402 | } |
3403 | 3403 | if (!empty($params['teachers'])) { |
3404 | - $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Teacher'), array(), |
|
3405 | - ICON_SIZE_TINY) . $params['teachers'] . '</h5>'; |
|
3404 | + $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Teacher'), array(), |
|
3405 | + ICON_SIZE_TINY).$params['teachers'].'</h5>'; |
|
3406 | 3406 | } |
3407 | 3407 | if (!empty($params['coaches'])) { |
3408 | - $html .= '<h5 class="teacher">' . Display::return_icon('teacher.png', get_lang('Coach'), array(), |
|
3409 | - ICON_SIZE_TINY) . $params['coaches'] . '</h5>'; |
|
3408 | + $html .= '<h5 class="teacher">'.Display::return_icon('teacher.png', get_lang('Coach'), array(), |
|
3409 | + ICON_SIZE_TINY).$params['coaches'].'</h5>'; |
|
3410 | 3410 | } |
3411 | 3411 | |
3412 | 3412 | $html .= '</div>'; |
3413 | 3413 | $params['right_actions'] = isset($params['right_actions']) ? $params['right_actions'] : null; |
3414 | - $html .= '<div class="pull-right course-box-actions">' . $params['right_actions'] . '</div>'; |
|
3414 | + $html .= '<div class="pull-right course-box-actions">'.$params['right_actions'].'</div>'; |
|
3415 | 3415 | $html .= '</div>'; |
3416 | 3416 | $html .= '</div>'; |
3417 | 3417 | |
@@ -3428,11 +3428,11 @@ discard block |
||
3428 | 3428 | $html = ''; |
3429 | 3429 | $html .= '<div class="row">'; |
3430 | 3430 | $html .= '<div class="col-md-2">'; |
3431 | - if (!empty($params['link'])){ |
|
3431 | + if (!empty($params['link'])) { |
|
3432 | 3432 | $html .= '<a class="thumbnail" href="'.$params['link'].'">'; |
3433 | 3433 | $html .= $params['icon']; |
3434 | 3434 | $html .= '</a>'; |
3435 | - }else{ |
|
3435 | + } else { |
|
3436 | 3436 | $html .= $params['icon']; |
3437 | 3437 | } |
3438 | 3438 | $html .= '</div>'; |
@@ -3462,7 +3462,7 @@ discard block |
||
3462 | 3462 | $special_course_list = self::get_special_course_list(); |
3463 | 3463 | $with_special_courses = ''; |
3464 | 3464 | if (!empty($special_course_list)) { |
3465 | - $with_special_courses = ' AND course.id IN ("' . implode('","', $special_course_list) . '")'; |
|
3465 | + $with_special_courses = ' AND course.id IN ("'.implode('","', $special_course_list).'")'; |
|
3466 | 3466 | } |
3467 | 3467 | |
3468 | 3468 | $courseList = []; |
@@ -3506,27 +3506,27 @@ discard block |
||
3506 | 3506 | $params['edit_actions'] = ''; |
3507 | 3507 | $params['document'] = ''; |
3508 | 3508 | if (api_is_platform_admin()) { |
3509 | - $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
|
3509 | + $params['edit_actions'] .= api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code']; |
|
3510 | 3510 | if ($load_dirs) { |
3511 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3512 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3513 | - $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
|
3511 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3512 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3513 | + $params['document'] .= Display::div('', ['id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container']); |
|
3514 | 3514 | } |
3515 | 3515 | } else { |
3516 | 3516 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) { |
3517 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3518 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3519 | - $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
|
3517 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3518 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3519 | + $params['document'] .= Display::div('', ['id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container']); |
|
3520 | 3520 | } |
3521 | 3521 | } |
3522 | 3522 | |
3523 | 3523 | $params['visibility'] = $course_info['visibility']; |
3524 | 3524 | $params['status'] = $course_info['status']; |
3525 | 3525 | $params['category'] = $course_info['categoryName']; |
3526 | - $params['icon'] = Display::return_icon('drawing-pin.png',null, null, ICON_SIZE_LARGE, null); |
|
3526 | + $params['icon'] = Display::return_icon('drawing-pin.png', null, null, ICON_SIZE_LARGE, null); |
|
3527 | 3527 | |
3528 | 3528 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3529 | - $params['code_course'] = '(' . $course_info['visual_code'] . ')'; |
|
3529 | + $params['code_course'] = '('.$course_info['visual_code'].')'; |
|
3530 | 3530 | } |
3531 | 3531 | |
3532 | 3532 | $params['title'] = $course_info['title']; |
@@ -3571,7 +3571,7 @@ discard block |
||
3571 | 3571 | // Step 1: We get all the categories of the user |
3572 | 3572 | $table = Database::get_main_table(TABLE_USER_COURSE_CATEGORY); |
3573 | 3573 | $sql = "SELECT id, title FROM $table |
3574 | - WHERE user_id = '" . $user_id . "' |
|
3574 | + WHERE user_id = '".$user_id."' |
|
3575 | 3575 | ORDER BY sort ASC"; |
3576 | 3576 | |
3577 | 3577 | $result = Database::query($sql); |
@@ -3625,7 +3625,7 @@ discard block |
||
3625 | 3625 | |
3626 | 3626 | $without_special_courses = ''; |
3627 | 3627 | if (!empty($special_course_list)) { |
3628 | - $without_special_courses = ' AND course.id NOT IN ("' . implode('","', $special_course_list) . '")'; |
|
3628 | + $without_special_courses = ' AND course.id NOT IN ("'.implode('","', $special_course_list).'")'; |
|
3629 | 3629 | } |
3630 | 3630 | |
3631 | 3631 | $sql = "SELECT |
@@ -3637,14 +3637,14 @@ discard block |
||
3637 | 3637 | INNER JOIN $TABLE_ACCESS_URL_REL_COURSE url |
3638 | 3638 | ON (url.c_id = course.id) |
3639 | 3639 | WHERE |
3640 | - course_rel_user.user_id = '" . $user_id . "' AND |
|
3641 | - course_rel_user.user_course_cat = '" . $user_category_id . "' |
|
3640 | + course_rel_user.user_id = '".$user_id."' AND |
|
3641 | + course_rel_user.user_course_cat = '" . $user_category_id."' |
|
3642 | 3642 | $without_special_courses "; |
3643 | 3643 | |
3644 | 3644 | // If multiple URL access mode is enabled, only fetch courses |
3645 | 3645 | // corresponding to the current URL. |
3646 | 3646 | if (api_get_multiple_access_url() && $current_url_id != -1) { |
3647 | - $sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'"; |
|
3647 | + $sql .= " AND url.c_id = course.id AND access_url_id='".$current_url_id."'"; |
|
3648 | 3648 | } |
3649 | 3649 | // Use user's classification for courses (if any). |
3650 | 3650 | $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; |
@@ -3680,28 +3680,28 @@ discard block |
||
3680 | 3680 | if ($showCustomIcon === 'true' && $iconName != 'course.png') { |
3681 | 3681 | $thumbnails = $course_info['course_image']; |
3682 | 3682 | $image = $course_info['course_image_large']; |
3683 | - }else{ |
|
3684 | - $image = Display::return_icon('session_default.png', null, null, null,null, true); |
|
3683 | + } else { |
|
3684 | + $image = Display::return_icon('session_default.png', null, null, null, null, true); |
|
3685 | 3685 | } |
3686 | 3686 | |
3687 | 3687 | $params['course_id'] = $course_info['real_id']; |
3688 | 3688 | $params['edit_actions'] = ''; |
3689 | 3689 | $params['document'] = ''; |
3690 | 3690 | if (api_is_platform_admin()) { |
3691 | - $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course_info['code']; |
|
3691 | + $params['edit_actions'] .= api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course_info['code']; |
|
3692 | 3692 | if ($load_dirs) { |
3693 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3694 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3695 | - $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
|
3693 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3694 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3695 | + $params['document'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container')); |
|
3696 | 3696 | } |
3697 | 3697 | } |
3698 | 3698 | if ($load_dirs) { |
3699 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3700 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3701 | - $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
|
3699 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3700 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3701 | + $params['document'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container')); |
|
3702 | 3702 | } |
3703 | 3703 | |
3704 | - $courseUrl = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0'; |
|
3704 | + $courseUrl = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?id_session=0'; |
|
3705 | 3705 | $teachers = []; |
3706 | 3706 | if (api_get_setting('display_teacher_in_courselist') === 'true') { |
3707 | 3707 | $teachers = CourseManager::getTeachersFromCourse($course_info['real_id'], false); |
@@ -3709,7 +3709,7 @@ discard block |
||
3709 | 3709 | |
3710 | 3710 | $params['status'] = $row['status']; |
3711 | 3711 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3712 | - $params['code_course'] = '(' . $course_info['visual_code'] . ') '; |
|
3712 | + $params['code_course'] = '('.$course_info['visual_code'].') '; |
|
3713 | 3713 | } |
3714 | 3714 | |
3715 | 3715 | $params['visibility'] = $course_info['visibility']; |
@@ -3753,7 +3753,7 @@ discard block |
||
3753 | 3753 | |
3754 | 3754 | $without_special_courses = ''; |
3755 | 3755 | if (!empty($special_course_list)) { |
3756 | - $without_special_courses = ' AND course.id NOT IN ("' . implode('","', $special_course_list) . '")'; |
|
3756 | + $without_special_courses = ' AND course.id NOT IN ("'.implode('","', $special_course_list).'")'; |
|
3757 | 3757 | } |
3758 | 3758 | |
3759 | 3759 | $sql = "SELECT |
@@ -3771,14 +3771,14 @@ discard block |
||
3771 | 3771 | INNER JOIN $TABLE_ACCESS_URL_REL_COURSE url |
3772 | 3772 | ON (url.c_id = course.id) |
3773 | 3773 | WHERE |
3774 | - course_rel_user.user_id = '" . $user_id . "' AND |
|
3775 | - course_rel_user.user_course_cat = '" . $user_category_id . "' |
|
3774 | + course_rel_user.user_id = '".$user_id."' AND |
|
3775 | + course_rel_user.user_course_cat = '" . $user_category_id."' |
|
3776 | 3776 | $without_special_courses "; |
3777 | 3777 | |
3778 | 3778 | // If multiple URL access mode is enabled, only fetch courses |
3779 | 3779 | // corresponding to the current URL. |
3780 | 3780 | if (api_get_multiple_access_url() && $current_url_id != -1) { |
3781 | - $sql .= " AND url.c_id = course.id AND access_url_id='" . $current_url_id . "'"; |
|
3781 | + $sql .= " AND url.c_id = course.id AND access_url_id='".$current_url_id."'"; |
|
3782 | 3782 | } |
3783 | 3783 | // Use user's classification for courses (if any). |
3784 | 3784 | $sql .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; |
@@ -3807,28 +3807,28 @@ discard block |
||
3807 | 3807 | if ($showCustomIcon === 'true' && $iconName != 'course.png') { |
3808 | 3808 | $thumbnails = $course_info['course_image']; |
3809 | 3809 | $image = $course_info['course_image_large']; |
3810 | - }else{ |
|
3811 | - $image = Display::return_icon('session_default.png', null, null, null,null, true); |
|
3810 | + } else { |
|
3811 | + $image = Display::return_icon('session_default.png', null, null, null, null, true); |
|
3812 | 3812 | } |
3813 | 3813 | |
3814 | 3814 | $params = array(); |
3815 | 3815 | $params['edit_actions'] = ''; |
3816 | 3816 | $params['document'] = ''; |
3817 | 3817 | if (api_is_platform_admin()) { |
3818 | - $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course_info['code']; |
|
3819 | - if($load_dirs){ |
|
3820 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3821 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3822 | - $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
|
3818 | + $params['edit_actions'] .= api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course_info['code']; |
|
3819 | + if ($load_dirs) { |
|
3820 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3821 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3822 | + $params['document'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container')); |
|
3823 | 3823 | } |
3824 | 3824 | } |
3825 | 3825 | if ($load_dirs) { |
3826 | - $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3827 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3828 | - $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
|
3826 | + $params['document'] = '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
|
3827 | + . Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
3828 | + $params['document'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class' => 'document_preview_container')); |
|
3829 | 3829 | } |
3830 | 3830 | |
3831 | - $course_title_url = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?id_session=0'; |
|
3831 | + $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?id_session=0'; |
|
3832 | 3832 | |
3833 | 3833 | $teachers = []; |
3834 | 3834 | if (api_get_setting('display_teacher_in_courselist') === 'true') { |
@@ -3837,7 +3837,7 @@ discard block |
||
3837 | 3837 | $params['status'] = $row['status']; |
3838 | 3838 | |
3839 | 3839 | if (api_get_setting('display_coursecode_in_courselist') == 'true') { |
3840 | - $params['code_course'] = '(' . $course_info['visual_code'] . ') '; |
|
3840 | + $params['code_course'] = '('.$course_info['visual_code'].') '; |
|
3841 | 3841 | } |
3842 | 3842 | |
3843 | 3843 | $params['visibility'] = $course_info['visibility']; |
@@ -4026,15 +4026,15 @@ discard block |
||
4026 | 4026 | } |
4027 | 4027 | |
4028 | 4028 | if ($userInCourseStatus == COURSEMANAGER || $sessionCourseAvailable) { |
4029 | - $session_url = $course_info['course_public_url'] . '?id_session=' . $course_info['id_session']; |
|
4030 | - $session_title = '<a href="' . $session_url. '">'. $course_info['name'] . '</a>'.$notifications; |
|
4029 | + $session_url = $course_info['course_public_url'].'?id_session='.$course_info['id_session']; |
|
4030 | + $session_title = '<a href="'.$session_url.'">'.$course_info['name'].'</a>'.$notifications; |
|
4031 | 4031 | } else { |
4032 | 4032 | $session_title = $course_info['name']; |
4033 | 4033 | } |
4034 | 4034 | |
4035 | 4035 | } else { |
4036 | 4036 | $session_title = |
4037 | - $course_info['name'] . ' ' . |
|
4037 | + $course_info['name'].' '. |
|
4038 | 4038 | Display::tag('span', get_lang('CourseClosed'), array('class' => 'item_closed')); |
4039 | 4039 | } |
4040 | 4040 | } else { |
@@ -4050,7 +4050,7 @@ discard block |
||
4050 | 4050 | $thumbnails = $course_info['course_image']; |
4051 | 4051 | $image = $course_info['course_image_large']; |
4052 | 4052 | } else { |
4053 | - $image = Display::return_icon('session_default.png', null, null, null,null, true); |
|
4053 | + $image = Display::return_icon('session_default.png', null, null, null, null, true); |
|
4054 | 4054 | } |
4055 | 4055 | $params['thumbnails'] = $thumbnails; |
4056 | 4056 | $params['image'] = $image; |
@@ -4063,12 +4063,12 @@ discard block |
||
4063 | 4063 | $course_visibility != COURSE_VISIBILITY_HIDDEN |
4064 | 4064 | ) { |
4065 | 4065 | if (api_is_platform_admin()) { |
4066 | - $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course_info['code']; |
|
4066 | + $params['edit_actions'] .= api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course_info['code']; |
|
4067 | 4067 | if ($load_dirs) { |
4068 | - $params['document'] .= '<a id="document_preview_' . $course_info['real_id'] . '_' . $course_info['id_session'] . '" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' . |
|
4069 | - Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
4068 | + $params['document'] .= '<a id="document_preview_'.$course_info['real_id'].'_'.$course_info['id_session'].'" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">'. |
|
4069 | + Display::returnFontAwesomeIcon('folder-open').'</a>'; |
|
4070 | 4070 | $params['document'] .= Display::div('', array( |
4071 | - 'id' => 'document_result_' . $course_info['real_id'] . '_' . $course_info['id_session'], |
|
4071 | + 'id' => 'document_result_'.$course_info['real_id'].'_'.$course_info['id_session'], |
|
4072 | 4072 | 'class' => 'document_preview_container' |
4073 | 4073 | )); |
4074 | 4074 | } |
@@ -4076,7 +4076,7 @@ discard block |
||
4076 | 4076 | } |
4077 | 4077 | |
4078 | 4078 | if (api_get_setting('display_coursecode_in_courselist') === 'true') { |
4079 | - $session_title .= ' (' . $course_info['visual_code'] . ') '; |
|
4079 | + $session_title .= ' ('.$course_info['visual_code'].') '; |
|
4080 | 4080 | } |
4081 | 4081 | |
4082 | 4082 | if (api_get_setting('display_teacher_in_courselist') === 'true') { |
@@ -4098,7 +4098,7 @@ discard block |
||
4098 | 4098 | } |
4099 | 4099 | } |
4100 | 4100 | |
4101 | - $session_title .= isset($course['special_course']) ? ' ' . |
|
4101 | + $session_title .= isset($course['special_course']) ? ' '. |
|
4102 | 4102 | Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
4103 | 4103 | |
4104 | 4104 | $params['title'] = $session_title; |
@@ -4125,13 +4125,13 @@ discard block |
||
4125 | 4125 | ) { |
4126 | 4126 | $session['dates'] = ''; |
4127 | 4127 | if (api_get_setting('show_session_coach') === 'true') { |
4128 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . $sessionCoachName; |
|
4128 | + $session['coach'] = get_lang('GeneralCoach').': '.$sessionCoachName; |
|
4129 | 4129 | } |
4130 | 4130 | $active = true; |
4131 | 4131 | } else { |
4132 | - $session ['dates'] = ' - ' . get_lang('From') . ' ' . $session['access_start_date'] . ' ' . get_lang('To') . ' ' . $session['access_end_date']; |
|
4132 | + $session ['dates'] = ' - '.get_lang('From').' '.$session['access_start_date'].' '.get_lang('To').' '.$session['access_end_date']; |
|
4133 | 4133 | if (api_get_setting('show_session_coach') === 'true') { |
4134 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . $sessionCoachName; |
|
4134 | + $session['coach'] = get_lang('GeneralCoach').': '.$sessionCoachName; |
|
4135 | 4135 | } |
4136 | 4136 | $date_start = $session['access_start_date']; |
4137 | 4137 | $date_end = $session['access_end_date']; |
@@ -4264,7 +4264,7 @@ discard block |
||
4264 | 4264 | if (Database::num_rows($result) > 0) { |
4265 | 4265 | $row = Database::fetch_array($result); |
4266 | 4266 | $count = $row['count'] + 1; |
4267 | - $wanted_code = $wanted_code . '_' . $count; |
|
4267 | + $wanted_code = $wanted_code.'_'.$count; |
|
4268 | 4268 | $result = api_get_course_info($wanted_code); |
4269 | 4269 | if (empty($result)) { |
4270 | 4270 | return $wanted_code; |
@@ -4298,7 +4298,7 @@ discard block |
||
4298 | 4298 | $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); |
4299 | 4299 | |
4300 | 4300 | if ($enabled == 'true') { |
4301 | - require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php'; |
|
4301 | + require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; |
|
4302 | 4302 | $plugin = CourseLegalPlugin::create(); |
4303 | 4303 | return $plugin->isUserAcceptedLegal($user_id, $course_code, $session_id); |
4304 | 4304 | } |
@@ -4343,7 +4343,7 @@ discard block |
||
4343 | 4343 | $enabled = api_get_plugin_setting('courselegal', 'tool_enable'); |
4344 | 4344 | |
4345 | 4345 | if ($enabled == 'true') { |
4346 | - require_once api_get_path(SYS_PLUGIN_PATH) . 'courselegal/config.php'; |
|
4346 | + require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php'; |
|
4347 | 4347 | $plugin = CourseLegalPlugin::create(); |
4348 | 4348 | return $plugin->saveUserLegal($user_id, $course_code, $session_id); |
4349 | 4349 | } |
@@ -4685,10 +4685,10 @@ discard block |
||
4685 | 4685 | INNER JOIN $table_course_url u |
4686 | 4686 | ON u.c_id = c.id |
4687 | 4687 | WHERE |
4688 | - u.access_url_id = " . api_get_current_access_url_id() . " AND |
|
4688 | + u.access_url_id = ".api_get_current_access_url_id()." AND |
|
4689 | 4689 | login_course_date <= '$now' AND |
4690 | 4690 | login_course_date > DATE_SUB('$now', INTERVAL $days DAY) AND |
4691 | - visibility <> '" . COURSE_VISIBILITY_CLOSED . "' AND visibility <> '" . COURSE_VISIBILITY_HIDDEN . "' |
|
4691 | + visibility <> '".COURSE_VISIBILITY_CLOSED."' AND visibility <> '".COURSE_VISIBILITY_HIDDEN."' |
|
4692 | 4692 | GROUP BY a.c_id |
4693 | 4693 | ORDER BY course_count DESC |
4694 | 4694 | LIMIT $limit |
@@ -4713,7 +4713,7 @@ discard block |
||
4713 | 4713 | public static function process_hot_course_item($courses, $my_course_code_list = array()) |
4714 | 4714 | { |
4715 | 4715 | $hotCourses = []; |
4716 | - $ajax_url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=add_course_vote'; |
|
4716 | + $ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote'; |
|
4717 | 4717 | $stok = Security::get_existing_token(); |
4718 | 4718 | $user_id = api_get_user_id(); |
4719 | 4719 | |
@@ -4759,7 +4759,7 @@ discard block |
||
4759 | 4759 | if ($access_link && in_array('register', $access_link)) { |
4760 | 4760 | $my_course['register_button'] = Display::url( |
4761 | 4761 | Display::returnFontAwesomeIcon('sign-in'), |
4762 | - api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?action=subscribe&sec_token=' . $stok, |
|
4762 | + api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php?action=subscribe&sec_token='.$stok, |
|
4763 | 4763 | array('class' => 'btn btn-success btn-sm', 'title' => get_lang('Subscribe'))); |
4764 | 4764 | } |
4765 | 4765 | |
@@ -4768,14 +4768,14 @@ discard block |
||
4768 | 4768 | ) { |
4769 | 4769 | $my_course['go_to_course_button'] = Display::url( |
4770 | 4770 | Display::returnFontAwesomeIcon('share'), |
4771 | - api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php', |
|
4771 | + api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php', |
|
4772 | 4772 | array('class' => 'btn btn-default btn-sm', 'title' => get_lang('GoToCourse'))); |
4773 | 4773 | } |
4774 | 4774 | |
4775 | 4775 | if ($access_link && in_array('unsubscribe', $access_link)) { |
4776 | 4776 | $my_course['unsubscribe_button'] = Display::url( |
4777 | 4777 | Display::returnFontAwesomeIcon('sign-out'), |
4778 | - api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=unsubscribe&unsubscribe=' . $courseCode . '&sec_token=' . $stok . '&category_code=' . $categoryCode, |
|
4778 | + api_get_path(WEB_CODE_PATH).'auth/courses.php?action=unsubscribe&unsubscribe='.$courseCode.'&sec_token='.$stok.'&category_code='.$categoryCode, |
|
4779 | 4779 | array('class' => 'btn btn-danger btn-sm', 'title' => get_lang('Unreg'))); |
4780 | 4780 | } |
4781 | 4781 | |
@@ -4800,7 +4800,7 @@ discard block |
||
4800 | 4800 | ) { */ |
4801 | 4801 | $my_course['description_button'] = Display::url( |
4802 | 4802 | Display::returnFontAwesomeIcon('info-circle'), |
4803 | - api_get_path(WEB_AJAX_PATH) . 'course_home.ajax.php?a=show_course_information&code=' . $course_info['code'], |
|
4803 | + api_get_path(WEB_AJAX_PATH).'course_home.ajax.php?a=show_course_information&code='.$course_info['code'], |
|
4804 | 4804 | [ |
4805 | 4805 | 'class' => 'btn btn-default btn-sm ajax', |
4806 | 4806 | 'data-title' => get_lang('Description'), |
@@ -4811,8 +4811,8 @@ discard block |
||
4811 | 4811 | /* get_lang('Description') */ |
4812 | 4812 | $my_course['teachers'] = CourseManager::getTeachersFromCourse($course_info['real_id'], false); |
4813 | 4813 | $point_info = self::get_course_ranking($course_info['real_id'], 0); |
4814 | - $my_course['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'], |
|
4815 | - $ajax_url . '&course_id=' . $course_info['real_id'], $point_info); |
|
4814 | + $my_course['rating_html'] = Display::return_rating_system('star_'.$course_info['real_id'], |
|
4815 | + $ajax_url.'&course_id='.$course_info['real_id'], $point_info); |
|
4816 | 4816 | |
4817 | 4817 | $hotCourses[] = $my_course; |
4818 | 4818 | } |
@@ -4890,9 +4890,9 @@ discard block |
||
4890 | 4890 | WHERE |
4891 | 4891 | c.id = u.c_id AND |
4892 | 4892 | u.access_url_id = $urlId AND |
4893 | - visibility <> " . COURSE_VISIBILITY_HIDDEN; |
|
4893 | + visibility <> ".COURSE_VISIBILITY_HIDDEN; |
|
4894 | 4894 | } else { |
4895 | - $sql .= " WHERE visibility <> " . COURSE_VISIBILITY_HIDDEN; |
|
4895 | + $sql .= " WHERE visibility <> ".COURSE_VISIBILITY_HIDDEN; |
|
4896 | 4896 | } |
4897 | 4897 | $res = Database::query($sql); |
4898 | 4898 | $row = Database::fetch_row($res); |
@@ -4917,16 +4917,16 @@ discard block |
||
4917 | 4917 | $restrictedCourses = self::getCatalogueCourseList(true); |
4918 | 4918 | $allowedCoursesToCurrentUser = self::getCatalogueCourseList(true, $currentUserId); |
4919 | 4919 | if (!empty($restrictedCourses)) { |
4920 | - $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")'; |
|
4921 | - $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("' . implode('","', $allowedCoursesToCurrentUser) . '"))'; |
|
4920 | + $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("'.implode('","', $restrictedCourses).'")'; |
|
4921 | + $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("'.implode('","', $allowedCoursesToCurrentUser).'"))'; |
|
4922 | 4922 | } |
4923 | 4923 | |
4924 | 4924 | // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it |
4925 | 4925 | $restrictedCourses = self::getCatalogueCourseList(false); |
4926 | 4926 | $notAllowedCoursesToCurrentUser = self::getCatalogueCourseList(false, $currentUserId); |
4927 | 4927 | if (!empty($restrictedCourses)) { |
4928 | - $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")'; |
|
4929 | - $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("' . implode('","', $notAllowedCoursesToCurrentUser) . '"))'; |
|
4928 | + $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("'.implode('","', $restrictedCourses).'")'; |
|
4929 | + $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("'.implode('","', $notAllowedCoursesToCurrentUser).'"))'; |
|
4930 | 4930 | } |
4931 | 4931 | |
4932 | 4932 | return $visibilityCondition; |
@@ -4946,7 +4946,7 @@ discard block |
||
4946 | 4946 | |
4947 | 4947 | $withoutSpecialCourses = ''; |
4948 | 4948 | if (!empty($specialCourseList)) { |
4949 | - $withoutSpecialCourses = ' AND c.id NOT IN ("' . implode('","', $specialCourseList) . '")'; |
|
4949 | + $withoutSpecialCourses = ' AND c.id NOT IN ("'.implode('","', $specialCourseList).'")'; |
|
4950 | 4950 | } |
4951 | 4951 | |
4952 | 4952 | $visibilityCondition = self::getCourseVisibilitySQLCondition('c'); |
@@ -5080,12 +5080,12 @@ discard block |
||
5080 | 5080 | if (count($teachers) > 0) { |
5081 | 5081 | foreach ($teachers as $key) { |
5082 | 5082 | $key = Database::escape_string($key); |
5083 | - $cond .= " AND user_id <> '" . $key . "'"; |
|
5083 | + $cond .= " AND user_id <> '".$key."'"; |
|
5084 | 5084 | } |
5085 | 5085 | } |
5086 | 5086 | |
5087 | - $sql = 'DELETE FROM ' . $course_user_table . ' |
|
5088 | - WHERE c_id ="' . $courseId . '" AND status="1" AND relation_type = 0 ' . $cond; |
|
5087 | + $sql = 'DELETE FROM '.$course_user_table.' |
|
5088 | + WHERE c_id ="' . $courseId.'" AND status="1" AND relation_type = 0 '.$cond; |
|
5089 | 5089 | Database::query($sql); |
5090 | 5090 | } |
5091 | 5091 | |
@@ -5093,12 +5093,12 @@ discard block |
||
5093 | 5093 | foreach ($teachers as $userId) { |
5094 | 5094 | $userId = intval($userId); |
5095 | 5095 | // We check if the teacher is already subscribed in this course |
5096 | - $sql = 'SELECT 1 FROM ' . $course_user_table . ' |
|
5097 | - WHERE user_id = "' . $userId . '" AND c_id = "' . $courseId . '" '; |
|
5096 | + $sql = 'SELECT 1 FROM '.$course_user_table.' |
|
5097 | + WHERE user_id = "' . $userId.'" AND c_id = "'.$courseId.'" '; |
|
5098 | 5098 | $result = Database::query($sql); |
5099 | 5099 | if (Database::num_rows($result)) { |
5100 | - $sql = 'UPDATE ' . $course_user_table . ' SET status = "1" |
|
5101 | - WHERE c_id = "' . $courseId . '" AND user_id = "' . $userId . '" '; |
|
5100 | + $sql = 'UPDATE '.$course_user_table.' SET status = "1" |
|
5101 | + WHERE c_id = "' . $courseId.'" AND user_id = "'.$userId.'" '; |
|
5102 | 5102 | } else { |
5103 | 5103 | $userCourseCategory = '0'; |
5104 | 5104 | if (isset($teacherBackup[$userId]) && |
@@ -5108,9 +5108,9 @@ discard block |
||
5108 | 5108 | $userCourseCategory = $courseUserData['user_course_cat']; |
5109 | 5109 | } |
5110 | 5110 | |
5111 | - $sql = "INSERT INTO " . $course_user_table . " SET |
|
5112 | - c_id = " . $courseId . ", |
|
5113 | - user_id = " . $userId . ", |
|
5111 | + $sql = "INSERT INTO ".$course_user_table." SET |
|
5112 | + c_id = " . $courseId.", |
|
5113 | + user_id = " . $userId.", |
|
5114 | 5114 | status = '1', |
5115 | 5115 | is_tutor = '0', |
5116 | 5116 | sort = '0', |
@@ -5462,8 +5462,8 @@ discard block |
||
5462 | 5462 | { |
5463 | 5463 | $tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE); |
5464 | 5464 | $sql = 'SELECT title |
5465 | - FROM ' . $tbl_main_categories . ' |
|
5466 | - WHERE code = "' . Database::escape_string($code) . '"'; |
|
5465 | + FROM ' . $tbl_main_categories.' |
|
5466 | + WHERE code = "' . Database::escape_string($code).'"'; |
|
5467 | 5467 | $result = Database::query($sql); |
5468 | 5468 | if ($col = Database::fetch_array($result)) { |
5469 | 5469 | return $col['title']; |
@@ -5644,7 +5644,7 @@ discard block |
||
5644 | 5644 | foreach ($group_list as $this_group) { |
5645 | 5645 | if (is_array($to_already_selected)) { |
5646 | 5646 | if (!in_array( |
5647 | - "GROUP:" . $this_group['id'], |
|
5647 | + "GROUP:".$this_group['id'], |
|
5648 | 5648 | $to_already_selected |
5649 | 5649 | ) |
5650 | 5650 | ) { // $to_already_selected is the array containing the groups (and users) that are already selected |
@@ -5652,8 +5652,8 @@ discard block |
||
5652 | 5652 | $user_disabled = ($this_group['userNb'] > 0) ? "" : "disabled=disabled"; |
5653 | 5653 | $result[] = array( |
5654 | 5654 | 'disabled' => $user_disabled, |
5655 | - 'value' => "GROUP:" . $this_group['id'], |
|
5656 | - 'content' => "G: " . $this_group['name'] . " - " . $this_group['userNb'] . " " . $user_label |
|
5655 | + 'value' => "GROUP:".$this_group['id'], |
|
5656 | + 'content' => "G: ".$this_group['name']." - ".$this_group['userNb']." ".$user_label |
|
5657 | 5657 | ); |
5658 | 5658 | } |
5659 | 5659 | } |
@@ -5665,13 +5665,13 @@ discard block |
||
5665 | 5665 | foreach ($user_list as $user) { |
5666 | 5666 | if (is_array($to_already_selected)) { |
5667 | 5667 | if (!in_array( |
5668 | - "USER:" . $user['user_id'], |
|
5668 | + "USER:".$user['user_id'], |
|
5669 | 5669 | $to_already_selected |
5670 | 5670 | ) |
5671 | 5671 | ) { // $to_already_selected is the array containing the users (and groups) that are already selected |
5672 | 5672 | |
5673 | 5673 | $result[] = array( |
5674 | - 'value' => "USER:" . $user['user_id'], |
|
5674 | + 'value' => "USER:".$user['user_id'], |
|
5675 | 5675 | 'content' => api_get_person_name($user['firstname'], $user['lastname']) |
5676 | 5676 | ); |
5677 | 5677 | } |
@@ -5700,7 +5700,7 @@ discard block |
||
5700 | 5700 | { |
5701 | 5701 | $category_id = intval($category_id); |
5702 | 5702 | $info = Database::fetch_array( |
5703 | - Database::query('SELECT course_code FROM ' . Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY) . ' |
|
5703 | + Database::query('SELECT course_code FROM '.Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY).' |
|
5704 | 5704 | WHERE id=' . $category_id), 'ASSOC' |
5705 | 5705 | ); |
5706 | 5706 | return $info ? $info['course_code'] : false; |
@@ -5716,15 +5716,14 @@ discard block |
||
5716 | 5716 | public static function getCoursesWithoutSession($startDate = null, $endDate = null, $includeClosed = false) |
5717 | 5717 | { |
5718 | 5718 | $dateConditional = ($startDate && $endDate) ? |
5719 | - " WHERE session_id IN (SELECT id FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . |
|
5720 | - " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : |
|
5721 | - null; |
|
5719 | + " WHERE session_id IN (SELECT id FROM ".Database::get_main_table(TABLE_MAIN_SESSION). |
|
5720 | + " WHERE access_start_date = '$startDate' AND access_end_date = '$endDate')" : null; |
|
5722 | 5721 | $visibility = ($includeClosed ? '' : 'visibility NOT IN (0, 4) AND '); |
5723 | 5722 | |
5724 | 5723 | $query = "SELECT id, code, title |
5725 | - FROM " . Database::get_main_table(TABLE_MAIN_COURSE). " |
|
5724 | + FROM " . Database::get_main_table(TABLE_MAIN_COURSE)." |
|
5726 | 5725 | WHERE $visibility code NOT IN ( |
5727 | - SELECT DISTINCT course_code FROM " . Database::get_main_table(TABLE_MAIN_SESSION_COURSE) . $dateConditional . ") |
|
5726 | + SELECT DISTINCT course_code FROM ".Database::get_main_table(TABLE_MAIN_SESSION_COURSE).$dateConditional.") |
|
5728 | 5727 | ORDER BY id"; |
5729 | 5728 | |
5730 | 5729 | $result = Database::query($query); |
@@ -5757,7 +5756,7 @@ discard block |
||
5757 | 5756 | FROM $courseTable c |
5758 | 5757 | INNER JOIN $courseUserTable cru ON c.id = cru.c_id |
5759 | 5758 | WHERE ( |
5760 | - cru.user_id IN (" . implode(', ', $userIdList) . ") |
|
5759 | + cru.user_id IN (".implode(', ', $userIdList).") |
|
5761 | 5760 | AND cru.relation_type = 0 |
5762 | 5761 | )"; |
5763 | 5762 | |
@@ -5772,7 +5771,7 @@ discard block |
||
5772 | 5771 | INNER JOIN $courseAccessUrlTable crau ON c.id = crau.c_id |
5773 | 5772 | WHERE crau.access_url_id = $accessUrlId |
5774 | 5773 | AND ( |
5775 | - cru.id_user IN (" . implode(', ', $userIdList) . ") AND |
|
5774 | + cru.id_user IN (".implode(', ', $userIdList).") AND |
|
5776 | 5775 | cru.relation_type = 0 |
5777 | 5776 | )"; |
5778 | 5777 | } |
@@ -5825,7 +5824,7 @@ discard block |
||
5825 | 5824 | $result = $objExercise->read($exercise_redirect); |
5826 | 5825 | |
5827 | 5826 | if (!empty($exercise_redirect) && !empty($result)) { |
5828 | - $form_data['action'] = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?exerciseId='.$exercise_redirect.'&cidReq='.$course_info['code']; |
|
5827 | + $form_data['action'] = api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$exercise_redirect.'&cidReq='.$course_info['code']; |
|
5829 | 5828 | $form_data['message'] .= '<br />'.get_lang('YouCanAccessTheExercise'); |
5830 | 5829 | $form_data['button'] = Display::button( |
5831 | 5830 | 'next', |
@@ -5881,7 +5880,7 @@ discard block |
||
5881 | 5880 | |
5882 | 5881 | $without_special_courses = ''; |
5883 | 5882 | if (!empty($special_course_list)) { |
5884 | - $without_special_courses = ' AND course.id NOT IN ("'.implode('","',$special_course_list).'")'; |
|
5883 | + $without_special_courses = ' AND course.id NOT IN ("'.implode('","', $special_course_list).'")'; |
|
5885 | 5884 | } |
5886 | 5885 | |
5887 | 5886 | //AND course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." |
@@ -5945,11 +5944,11 @@ discard block |
||
5945 | 5944 | |
5946 | 5945 | if (api_is_platform_admin()) { |
5947 | 5946 | if ($loadDirs) { |
5948 | - $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5949 | - $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5947 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5948 | + $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5950 | 5949 | $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container')); |
5951 | 5950 | } else { |
5952 | - $params['right_actions'].= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>'; |
|
5951 | + $params['right_actions'] .= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>'; |
|
5953 | 5952 | } |
5954 | 5953 | |
5955 | 5954 | if ($course_info['status'] == COURSEMANAGER) { |
@@ -5958,11 +5957,11 @@ discard block |
||
5958 | 5957 | } else { |
5959 | 5958 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED) { |
5960 | 5959 | if ($loadDirs) { |
5961 | - $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'),ICON_SIZE_SMALL).'</a>'; |
|
5960 | + $params['right_actions'] .= '<a id="document_preview_'.$course_info['real_id'].'_0" class="document_preview" href="javascript:void(0);">'.Display::return_icon('folder.png', get_lang('Documents'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; |
|
5962 | 5961 | $params['right_actions'] .= Display::div('', array('id' => 'document_result_'.$course_info['real_id'].'_0', 'class'=>'document_preview_container')); |
5963 | 5962 | } else { |
5964 | 5963 | if ($course_info['status'] == COURSEMANAGER) { |
5965 | - $params['right_actions'].= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>'; |
|
5964 | + $params['right_actions'] .= '<a class="btn btn-default btn-sm" title="'.get_lang('Edit').'" href="'.api_get_path(WEB_CODE_PATH).'course_info/infocours.php?cidReq='.$course['code'].'">'.Display::returnFontAwesomeIcon('pencil').'</a>'; |
|
5966 | 5965 | } |
5967 | 5966 | } |
5968 | 5967 | } |
@@ -5973,7 +5972,7 @@ discard block |
||
5973 | 5972 | $course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0'; |
5974 | 5973 | $course_title = Display::url($course_info['title'], $course_title_url); |
5975 | 5974 | } else { |
5976 | - $course_title = $course_info['title'].' '.Display::tag('span',get_lang('CourseClosed'), array('class'=>'item_closed')); |
|
5975 | + $course_title = $course_info['title'].' '.Display::tag('span', get_lang('CourseClosed'), array('class'=>'item_closed')); |
|
5977 | 5976 | } |
5978 | 5977 | |
5979 | 5978 | // Start displaying the course block itself |