@@ -31,6 +31,10 @@ |
||
31 | 31 | return $method == 'GET'; |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param string $key |
|
36 | + * @param string $default |
|
37 | + */ |
|
34 | 38 | public static function post($key, $default = null) |
35 | 39 | { |
36 | 40 | return isset($_POST[$key]) ? $_POST[$key] : $default; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default; |
16 | 16 | } |
17 | 17 | |
18 | - public static function has($key){ |
|
18 | + public static function has($key) { |
|
19 | 19 | return isset($_REQUEST[$key]); |
20 | 20 | } |
21 | 21 |
@@ -16,7 +16,6 @@ |
||
16 | 16 | * @author Patrick Cool |
17 | 17 | * @author René Haentjens, added CSV file import (October 2004) |
18 | 18 | * @package chamilo.link |
19 | - |
|
20 | 19 | */ |
21 | 20 | |
22 | 21 | // Including libraries |
@@ -80,7 +80,7 @@ |
||
80 | 80 | * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
81 | 81 | * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
82 | 82 | * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
83 | + * @param integer $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | 84 | * @return array The sorted dataset |
85 | 85 | * @author [email protected] |
86 | 86 | */ |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $new_data_order = array(); |
159 | 159 | if (!empty($docs_to_sort)) { |
160 | - foreach($docs_to_sort as $id => $document) { |
|
160 | + foreach ($docs_to_sort as $id => $document) { |
|
161 | 161 | if (isset($new_data[$id])) { |
162 | 162 | $new_data_order[] = $new_data[$id]; |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (!empty($folder_to_sort)) { |
168 | - foreach($folder_to_sort as $id => $document) { |
|
168 | + foreach ($folder_to_sort as $id => $document) { |
|
169 | 169 | if (isset($new_data[$id])) { |
170 | 170 | $new_data_order[] = $new_data[$id]; |
171 | 171 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | class TableSort |
16 | 16 | { |
17 | 17 | /** |
18 | - * Sorts 2-dimensional table. |
|
19 | - * @param array $data The data to be sorted. |
|
20 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | - * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | - * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | - * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | - * @return array The sorted dataset |
|
25 | - * @author [email protected] |
|
26 | - */ |
|
27 | - public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
18 | + * Sorts 2-dimensional table. |
|
19 | + * @param array $data The data to be sorted. |
|
20 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
21 | + * @param int $direction The direction to sort (SORT_ASC (default) or SORT_DESC) |
|
22 | + * @param int $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, |
|
23 | + * SORT_STRING,SORT_DATE,SORT_IMAGE) |
|
24 | + * @return array The sorted dataset |
|
25 | + * @author [email protected] |
|
26 | + */ |
|
27 | + public static function sort_table($data, $column = 0, $direction = SORT_ASC, $type = SORT_REGULAR) |
|
28 | 28 | { |
29 | 29 | if (!is_array($data) || empty($data)) { |
30 | 30 | return array(); |
@@ -71,20 +71,20 @@ discard block |
||
71 | 71 | usort($data, create_function('$a, $b', $compare_function)); |
72 | 72 | |
73 | 73 | return $data; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | - * @param array $data The data to be sorted. |
|
79 | - * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | - * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | - * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | - * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | - * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | - * @return array The sorted dataset |
|
85 | - * @author [email protected] |
|
86 | - */ |
|
87 | - public static function sort_table_config( |
|
76 | + /** |
|
77 | + * Sorts 2-dimensional table. It is possile changing the columns that will be shown and the way that the columns are to be sorted. |
|
78 | + * @param array $data The data to be sorted. |
|
79 | + * @param int $column The column on which the data should be sorted (default = 0) |
|
80 | + * @param string $direction The direction to sort (SORT_ASC (default) orSORT_DESC) |
|
81 | + * @param array $column_show The columns that we will show in the table i.e: $column_show = array('1','0','1') we will show the 1st and the 3th column. |
|
82 | + * @param array $column_order Changes how the columns will be sorted ie. $column_order = array('0','3','2','3') The column [1] will be sorted like the column [3] |
|
83 | + * @param constant $type How should data be sorted (SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_DATE, SORT_IMAGE) |
|
84 | + * @return array The sorted dataset |
|
85 | + * @author [email protected] |
|
86 | + */ |
|
87 | + public static function sort_table_config( |
|
88 | 88 | $data, |
89 | 89 | $column = 0, |
90 | 90 | $direction = SORT_ASC, |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | if (!empty($data)) { |
133 | 133 | foreach ($data as $document) { |
134 | 134 | if ($document['type'] == 'folder') { |
135 | - $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
135 | + $docs_to_sort[$document['id']] = api_strtolower($document['name']); |
|
136 | 136 | } else { |
137 | - $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
137 | + $folder_to_sort[$document['id']] = api_strtolower($document['name']); |
|
138 | 138 | } |
139 | 139 | $new_data[$document['id']] = $document; |
140 | 140 | } |
@@ -196,91 +196,91 @@ discard block |
||
196 | 196 | usort($data, create_function('$a, $b', $compare_function)); |
197 | 197 | } |
198 | 198 | |
199 | - if (is_array($column_show) && !empty($column_show)) { |
|
199 | + if (is_array($column_show) && !empty($column_show)) { |
|
200 | 200 | |
201 | - // We show only the columns data that were set up on the $column_show array |
|
202 | - $new_order_data = array(); |
|
203 | - $count_data = count($data); |
|
204 | - $count_column_show = count($column_show); |
|
205 | - for ($j = 0; $j < $count_data; $j++) { |
|
206 | - $k = 0; |
|
207 | - for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | - if ($column_show[$i]) { |
|
209 | - $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | - } |
|
211 | - $k++; |
|
212 | - } |
|
213 | - } |
|
214 | - // Replace the multi-arrays |
|
215 | - $data = $new_order_data; |
|
216 | - } |
|
201 | + // We show only the columns data that were set up on the $column_show array |
|
202 | + $new_order_data = array(); |
|
203 | + $count_data = count($data); |
|
204 | + $count_column_show = count($column_show); |
|
205 | + for ($j = 0; $j < $count_data; $j++) { |
|
206 | + $k = 0; |
|
207 | + for ($i = 0; $i < $count_column_show; $i++) { |
|
208 | + if ($column_show[$i]) { |
|
209 | + $new_order_data[$j][$k] = $data[$j][$i]; |
|
210 | + } |
|
211 | + $k++; |
|
212 | + } |
|
213 | + } |
|
214 | + // Replace the multi-arrays |
|
215 | + $data = $new_order_data; |
|
216 | + } |
|
217 | 217 | |
218 | - return $data; |
|
219 | - } |
|
218 | + return $data; |
|
219 | + } |
|
220 | 220 | |
221 | - /** |
|
222 | - * Checks whether a column of a 2D-array contains only numeric values |
|
223 | - * @param array $data The data-array |
|
224 | - * @param int $column The index of the column to check |
|
225 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | - * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | - * @author [email protected] |
|
228 | - */ |
|
229 | - private static function is_numeric_column(& $data, $column) |
|
221 | + /** |
|
222 | + * Checks whether a column of a 2D-array contains only numeric values |
|
223 | + * @param array $data The data-array |
|
224 | + * @param int $column The index of the column to check |
|
225 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
226 | + * @todo Take locale into account (eg decimal point or comma ?) |
|
227 | + * @author [email protected] |
|
228 | + */ |
|
229 | + private static function is_numeric_column(& $data, $column) |
|
230 | 230 | { |
231 | - $is_numeric = true; |
|
232 | - foreach ($data as $index => & $row) { |
|
233 | - $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | - if (!$is_numeric) { |
|
235 | - break; |
|
236 | - } |
|
237 | - } |
|
238 | - return $is_numeric; |
|
239 | - } |
|
231 | + $is_numeric = true; |
|
232 | + foreach ($data as $index => & $row) { |
|
233 | + $is_numeric &= is_numeric(strip_tags($row[$column])); |
|
234 | + if (!$is_numeric) { |
|
235 | + break; |
|
236 | + } |
|
237 | + } |
|
238 | + return $is_numeric; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | - * @param array $data The data-array |
|
244 | - * @param int $column The index of the column to check |
|
245 | - * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | - * @author [email protected] |
|
247 | - */ |
|
248 | - private static function is_date_column(& $data, $column) |
|
241 | + /** |
|
242 | + * Checks whether a column of a 2D-array contains only dates (GNU date syntax) |
|
243 | + * @param array $data The data-array |
|
244 | + * @param int $column The index of the column to check |
|
245 | + * @return bool TRUE if column contains only dates, FALSE otherwise |
|
246 | + * @author [email protected] |
|
247 | + */ |
|
248 | + private static function is_date_column(& $data, $column) |
|
249 | 249 | { |
250 | - $is_date = true; |
|
251 | - foreach ($data as $index => & $row) { |
|
252 | - if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | - $check_date = strtotime(strip_tags($row[$column])); |
|
254 | - // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | - // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | - $is_date &= ($check_date != -1 && $check_date); |
|
257 | - } else { |
|
258 | - $is_date &= false; |
|
259 | - } |
|
260 | - if (!$is_date) { |
|
261 | - break; |
|
262 | - } |
|
263 | - } |
|
264 | - return $is_date; |
|
265 | - } |
|
250 | + $is_date = true; |
|
251 | + foreach ($data as $index => & $row) { |
|
252 | + if (strlen(strip_tags($row[$column])) != 0) { |
|
253 | + $check_date = strtotime(strip_tags($row[$column])); |
|
254 | + // strtotime Returns a timestamp on success, FALSE otherwise. |
|
255 | + // Previous to PHP 5.1.0, this function would return -1 on failure. |
|
256 | + $is_date &= ($check_date != -1 && $check_date); |
|
257 | + } else { |
|
258 | + $is_date &= false; |
|
259 | + } |
|
260 | + if (!$is_date) { |
|
261 | + break; |
|
262 | + } |
|
263 | + } |
|
264 | + return $is_date; |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | - * @param array $data The data-array |
|
270 | - * @param int $column The index of the column to check |
|
271 | - * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | - * @author [email protected] |
|
273 | - */ |
|
274 | - private static function is_image_column(& $data, $column) |
|
267 | + /** |
|
268 | + * Checks whether a column of a 2D-array contains only images (<img src="path/file.ext" alt=".."/>) |
|
269 | + * @param array $data The data-array |
|
270 | + * @param int $column The index of the column to check |
|
271 | + * @return bool TRUE if column contains only images, FALSE otherwise |
|
272 | + * @author [email protected] |
|
273 | + */ |
|
274 | + private static function is_image_column(& $data, $column) |
|
275 | 275 | { |
276 | - $is_image = true; |
|
277 | - foreach ($data as $index => & $row) { |
|
278 | - $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | - $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | - if (!$is_image) { |
|
281 | - break; |
|
282 | - } |
|
283 | - } |
|
284 | - return $is_image; |
|
285 | - } |
|
276 | + $is_image = true; |
|
277 | + foreach ($data as $index => & $row) { |
|
278 | + $is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0; // at least one img-tag |
|
279 | + $is_image &= strlen(trim(strip_tags($row[$column]))) == 0; // and no text outside attribute-values |
|
280 | + if (!$is_image) { |
|
281 | + break; |
|
282 | + } |
|
283 | + } |
|
284 | + return $is_image; |
|
285 | + } |
|
286 | 286 | } |
@@ -330,6 +330,7 @@ discard block |
||
330 | 330 | /** |
331 | 331 | * Sets the footer visibility |
332 | 332 | * @param bool true if we show the footer |
333 | + * @param boolean $status |
|
333 | 334 | */ |
334 | 335 | public function set_footer($status) |
335 | 336 | { |
@@ -370,6 +371,7 @@ discard block |
||
370 | 371 | /** |
371 | 372 | * Sets the header visibility |
372 | 373 | * @param bool true if we show the header |
374 | + * @param boolean $status |
|
373 | 375 | */ |
374 | 376 | public function set_header($status) |
375 | 377 | { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $content = '<li class="help">'; |
265 | 265 | $content .= Display::url( |
266 | 266 | Display::return_icon('help.large.png', get_lang('Help')), |
267 | - api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help, |
|
267 | + api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help, |
|
268 | 268 | [ |
269 | 269 | 'class' => 'ajax', |
270 | 270 | 'data-title' => get_lang('Help') |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | 'web_course' => api_get_path(WEB_COURSE_PATH), |
479 | 479 | 'web_main' => api_get_path(WEB_CODE_PATH), |
480 | 480 | 'web_css' => api_get_path(WEB_CSS_PATH), |
481 | - 'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/', |
|
481 | + 'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/', |
|
482 | 482 | 'web_ajax' => api_get_path(WEB_AJAX_PATH), |
483 | 483 | 'web_img' => api_get_path(WEB_IMG_PATH), |
484 | 484 | 'web_plugin' => api_get_path(WEB_PLUGIN_PATH), |
@@ -536,12 +536,12 @@ discard block |
||
536 | 536 | foreach ($bowerCSSFiles as $file) { |
537 | 537 | $css[] = api_get_path(WEB_PATH).'web/assets/'.$file; |
538 | 538 | } |
539 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
540 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css'; |
|
541 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css'; |
|
539 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css'; |
|
540 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css'; |
|
541 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css'; |
|
542 | 542 | |
543 | 543 | if (api_is_global_chat_enabled()) { |
544 | - $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css'; |
|
544 | + $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css'; |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | //THEME CSS STYLE |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | $style_print = ''; |
610 | 610 | if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) { |
611 | - $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'), |
|
611 | + $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'), |
|
612 | 612 | 'print'); |
613 | 613 | } |
614 | 614 | $this->assign('css_style_print', $style_print); |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | |
632 | 632 | $isoCode = api_get_language_isocode(); |
633 | 633 | |
634 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js'; |
|
634 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js'; |
|
635 | 635 | |
636 | 636 | if ($isoCode == 'en') { |
637 | - $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js'; |
|
637 | + $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js'; |
|
638 | 638 | } |
639 | 639 | // JS files |
640 | 640 | $js_files = array( |
@@ -684,8 +684,8 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | if ($isoCode != 'en') { |
687 | - $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js'; |
|
688 | - $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js'; |
|
687 | + $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js'; |
|
688 | + $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js'; |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | foreach ($bowerJsFiles as $file) { |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } |
767 | 767 | |
768 | 768 | $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM)); |
769 | - $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
769 | + $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM)); |
|
770 | 770 | |
771 | 771 | // Get language iso-code for this page - ignore errors |
772 | 772 | $this->assign('document_language', api_get_language_isocode()); |
@@ -825,15 +825,15 @@ discard block |
||
825 | 825 | $this->assign('section_name', 'section-'.$this_section); |
826 | 826 | |
827 | 827 | //Defaul root chamilo favicon |
828 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />'; |
|
828 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />'; |
|
829 | 829 | |
830 | 830 | //Added to verify if in the current Chamilo Theme exist a favicon |
831 | - $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/'; |
|
831 | + $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/'; |
|
832 | 832 | |
833 | 833 | //If exist pick the current chamilo theme favicon |
834 | - if (is_file($favicoThemeUrl . 'favicon.ico')) { |
|
835 | - $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH) |
|
836 | - . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />'; |
|
834 | + if (is_file($favicoThemeUrl.'favicon.ico')) { |
|
835 | + $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH) |
|
836 | + . 'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />'; |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | if (api_is_multiple_url_enabled()) { |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) { |
864 | 864 | $bug_notification_link = '<li class="report"> |
865 | 865 | <a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"> |
866 | - '. $iconBug . ' |
|
866 | + '. $iconBug.' |
|
867 | 867 | </a> |
868 | 868 | </li>'; |
869 | 869 | } |
@@ -975,13 +975,13 @@ discard block |
||
975 | 975 | $socialMeta = ''; |
976 | 976 | $metaTitle = api_get_setting('meta_title'); |
977 | 977 | if (!empty($metaTitle)) { |
978 | - $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n"; |
|
978 | + $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n"; |
|
979 | 979 | $metaSite = api_get_setting('meta_twitter_site'); |
980 | 980 | if (!empty($metaSite)) { |
981 | - $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n"; |
|
981 | + $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n"; |
|
982 | 982 | $metaCreator = api_get_setting('meta_twitter_creator'); |
983 | 983 | if (!empty($metaCreator)) { |
984 | - $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n"; |
|
984 | + $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n"; |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | |
@@ -993,19 +993,19 @@ discard block |
||
993 | 993 | if (!$userId && !$skillId) { |
994 | 994 | // no combination of user and skill ID has been defined, |
995 | 995 | // so print the normal OpenGraph meta tags |
996 | - $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n"; |
|
997 | - $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n"; |
|
996 | + $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n"; |
|
997 | + $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n"; |
|
998 | 998 | |
999 | 999 | $metaDescription = api_get_setting('meta_description'); |
1000 | 1000 | if (!empty($metaDescription)) { |
1001 | - $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n"; |
|
1001 | + $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n"; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $metaImage = api_get_setting('meta_image_path'); |
1005 | 1005 | if (!empty($metaImage)) { |
1006 | - if (is_file(api_get_path(SYS_PATH) . $metaImage)) { |
|
1007 | - $path = api_get_path(WEB_PATH) . $metaImage; |
|
1008 | - $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n"; |
|
1006 | + if (is_file(api_get_path(SYS_PATH).$metaImage)) { |
|
1007 | + $path = api_get_path(WEB_PATH).$metaImage; |
|
1008 | + $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n"; |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | // Tutor name |
1040 | 1040 | if (api_get_setting('show_tutor_data') == 'true') { |
1041 | 1041 | // Course manager |
1042 | - $courseId = api_get_course_int_id(); |
|
1042 | + $courseId = api_get_course_int_id(); |
|
1043 | 1043 | $id_session = api_get_session_id(); |
1044 | 1044 | if (!empty($courseId)) { |
1045 | 1045 | $tutor_data = ''; |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $courseId = api_get_course_int_id(); |
1072 | 1072 | if (!empty($courseId)) { |
1073 | 1073 | $teacher_data = ''; |
1074 | - $mail= CourseManager::get_emails_of_tutors_to_course($courseId); |
|
1074 | + $mail = CourseManager::get_emails_of_tutors_to_course($courseId); |
|
1075 | 1075 | if (!empty($mail)) { |
1076 | 1076 | $teachers_parsed = array(); |
1077 | 1077 | foreach ($mail as $value) { |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | 'sessionVar' => basename(__FILE__, '.php'), |
1306 | 1306 | 'imageOptions' => array( |
1307 | 1307 | 'font_size' => 20, |
1308 | - 'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/', |
|
1308 | + 'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/', |
|
1309 | 1309 | 'font_file' => 'OpenSans-Regular.ttf', |
1310 | 1310 | //'output' => 'gif' |
1311 | 1311 | ) |
@@ -52,6 +52,7 @@ discard block |
||
52 | 52 | * Converts the text of a html-document to a given encoding, the meta-tag is changed accordingly. |
53 | 53 | * @param string $string The input full-html document. |
54 | 54 | * @param string The new encoding value to be set. |
55 | + * @param string $encoding |
|
55 | 56 | */ |
56 | 57 | function api_set_encoding_html(&$string, $encoding) { |
57 | 58 | $old_encoding = api_detect_encoding_html($string); |
@@ -74,7 +75,7 @@ discard block |
||
74 | 75 | * Returns the title of a html document. |
75 | 76 | * @param string $string The contents of the input document. |
76 | 77 | * @param string $input_encoding The encoding of the input document. If the value is not set, it is detected. |
77 | - * @param string $$output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
78 | + * @param string $output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend. |
|
78 | 79 | * @return string The retrieved title, html-entities and extra-whitespace between the words are cleaned. |
79 | 80 | */ |
80 | 81 | function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null) { |
@@ -433,7 +434,7 @@ discard block |
||
433 | 434 | * @since wordpress 2.8.1 |
434 | 435 | * @access private |
435 | 436 | * |
436 | - * @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
437 | + * @param string[] $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles. |
|
437 | 438 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
438 | 439 | * @return string The string with the replaced svalues. |
439 | 440 | */ |
@@ -628,6 +629,7 @@ discard block |
||
628 | 629 | * @param string The text to "cut" |
629 | 630 | * @param int Count of chars |
630 | 631 | * @param bool Whether to embed in a <span title="...">...</span> |
632 | + * @param integer $maxchar |
|
631 | 633 | * @return string |
632 | 634 | * */ |
633 | 635 | function cut($text, $maxchar, $embed = false) { |
@@ -645,7 +647,7 @@ discard block |
||
645 | 647 | * |
646 | 648 | * @param mixed Number to convert |
647 | 649 | * @param int Decimal points 0=never, 1=if needed, 2=always |
648 | - * @return mixed An integer or a float depends on the parameter |
|
650 | + * @return string|null An integer or a float depends on the parameter |
|
649 | 651 | */ |
650 | 652 | function float_format($number, $flag = 1) { |
651 | 653 | if (is_numeric($number)) { |
@@ -689,7 +691,7 @@ discard block |
||
689 | 691 | /** |
690 | 692 | * Gets the week from a day |
691 | 693 | * @param string Date in UTC (2010-01-01 12:12:12) |
692 | - * @return int Returns an integer with the week number of the year |
|
694 | + * @return string Returns an integer with the week number of the year |
|
693 | 695 | */ |
694 | 696 | function get_week_from_day($date) { |
695 | 697 | if (!empty($date)) { |
@@ -739,6 +741,9 @@ discard block |
||
739 | 741 | return $output.$end; |
740 | 742 | } |
741 | 743 | |
744 | +/** |
|
745 | + * @param string $glue |
|
746 | + */ |
|
742 | 747 | function implode_with_key($glue, $array) { |
743 | 748 | if (!empty($array)) { |
744 | 749 | $string = ''; |
@@ -817,7 +822,7 @@ discard block |
||
817 | 822 | /** |
818 | 823 | * @param string $string |
819 | 824 | * @param bool $capitalizeFirstCharacter |
820 | - * @return mixed |
|
825 | + * @return string |
|
821 | 826 | */ |
822 | 827 | function underScoreToCamelCase($string, $capitalizeFirstCharacter = true) |
823 | 828 | { |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | if (@preg_match('/(.*<head.*)(<meta[^>]*content=[^>]*>)(.*<\/head>.*)/si', $string, $matches)) { |
59 | 59 | $meta = $matches[2]; |
60 | 60 | if (@preg_match("/(<meta[^>]*charset=)(.*)([\"';][^>]*>)/si", $meta, $matches1)) { |
61 | - $meta = $matches1[1] . $encoding . $matches1[3]; |
|
62 | - $string = $matches[1] . $meta . $matches[3]; |
|
61 | + $meta = $matches1[1].$encoding.$matches1[3]; |
|
62 | + $string = $matches[1].$meta.$matches[3]; |
|
63 | 63 | } else { |
64 | - $string = $matches[1] . '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>' . $matches[3]; |
|
64 | + $string = $matches[1].'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/>'.$matches[3]; |
|
65 | 65 | } |
66 | 66 | } else { |
67 | 67 | $count = 1; |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | if (!preg_match(_PCRE_XML_ENCODING, $string)) { |
169 | 169 | if (strpos($matches[0], 'standalone') !== false) { |
170 | 170 | // The encoding option should precede the standalone option, othewise DOMDocument fails to load the document. |
171 | - $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone' , $matches[0]); |
|
171 | + $replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]); |
|
172 | 172 | } else { |
173 | - $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>' , $matches[0]); |
|
173 | + $replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]); |
|
174 | 174 | } |
175 | 175 | return api_convert_encoding(str_replace($matches[0], $replace, $string), $to_encoding, $from_encoding); |
176 | 176 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | function _make_url_clickable_cb($matches) { |
336 | 336 | $url = $matches[2]; |
337 | 337 | |
338 | - if ( ')' == $matches[3] && strpos( $url, '(' ) ) { |
|
338 | + if (')' == $matches[3] && strpos($url, '(')) { |
|
339 | 339 | // If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL. |
340 | 340 | // Then we can let the parenthesis balancer do its thing below. |
341 | 341 | $url .= $matches[3]; |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | } |
346 | 346 | |
347 | 347 | // Include parentheses in the URL only if paired |
348 | - while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) { |
|
349 | - $suffix = strrchr( $url, ')' ) . $suffix; |
|
350 | - $url = substr( $url, 0, strrpos( $url, ')' ) ); |
|
348 | + while (substr_count($url, '(') < substr_count($url, ')')) { |
|
349 | + $suffix = strrchr($url, ')').$suffix; |
|
350 | + $url = substr($url, 0, strrpos($url, ')')); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | $url = esc_url($url); |
354 | - if ( empty($url) ) |
|
354 | + if (empty($url)) |
|
355 | 355 | return $matches[0]; |
356 | 356 | |
357 | - return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
|
357 | + return $matches[1]."<a href=\"$url\" rel=\"nofollow\">$url</a>".$suffix; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | * @param string $_context Private. Use esc_url_raw() for database usage. |
375 | 375 | * @return string The cleaned $url after the 'clean_url' filter is applied. |
376 | 376 | */ |
377 | -function esc_url( $url, $protocols = null, $_context = 'display' ) { |
|
377 | +function esc_url($url, $protocols = null, $_context = 'display') { |
|
378 | 378 | //$original_url = $url; |
379 | 379 | |
380 | - if ( '' == $url ) |
|
380 | + if ('' == $url) |
|
381 | 381 | return $url; |
382 | 382 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
383 | 383 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | * presume it needs http:// appended (unless a relative |
388 | 388 | * link starting with /, # or ? or a php file). |
389 | 389 | */ |
390 | - if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
|
391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
392 | - $url = 'http://' . $url; |
|
390 | + if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && |
|
391 | + !preg_match('/^[a-z0-9-]+?\.php/i', $url)) |
|
392 | + $url = 'http://'.$url; |
|
393 | 393 | |
394 | 394 | return Security::remove_XSS($url); |
395 | 395 | |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | * @param string $subject The string being searched and replaced on, otherwise known as the haystack. |
438 | 438 | * @return string The string with the replaced svalues. |
439 | 439 | */ |
440 | -function _deep_replace( $search, $subject ) { |
|
440 | +function _deep_replace($search, $subject) { |
|
441 | 441 | $subject = (string) $subject; |
442 | 442 | |
443 | 443 | $count = 1; |
444 | - while ( $count ) { |
|
445 | - $subject = str_replace( $search, '', $subject, $count ); |
|
444 | + while ($count) { |
|
445 | + $subject = str_replace($search, '', $subject, $count); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | return $subject; |
@@ -464,17 +464,17 @@ discard block |
||
464 | 464 | function _make_web_ftp_clickable_cb($matches) { |
465 | 465 | $ret = ''; |
466 | 466 | $dest = $matches[2]; |
467 | - $dest = 'http://' . $dest; |
|
467 | + $dest = 'http://'.$dest; |
|
468 | 468 | $dest = esc_url($dest); |
469 | - if ( empty($dest) ) |
|
469 | + if (empty($dest)) |
|
470 | 470 | return $matches[0]; |
471 | 471 | |
472 | 472 | // removed trailing [.,;:)] from URL |
473 | - if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
|
473 | + if (in_array(substr($dest, -1), array('.', ',', ';', ':', ')')) === true) { |
|
474 | 474 | $ret = substr($dest, -1); |
475 | - $dest = substr($dest, 0, strlen($dest)-1); |
|
475 | + $dest = substr($dest, 0, strlen($dest) - 1); |
|
476 | 476 | } |
477 | - return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
477 | + return $matches[1]."<a href=\"$dest\" rel=\"nofollow\">$dest</a>$ret"; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | * @return string HTML A element with email address. |
491 | 491 | */ |
492 | 492 | function _make_email_clickable_cb($matches) { |
493 | - $email = $matches[2] . '@' . $matches[3]; |
|
494 | - return $matches[1] . "<a href=\"mailto:$email\">$email</a>"; |
|
493 | + $email = $matches[2].'@'.$matches[3]; |
|
494 | + return $matches[1]."<a href=\"mailto:$email\">$email</a>"; |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -505,30 +505,30 @@ discard block |
||
505 | 505 | * @param string $text Content to convert URIs. |
506 | 506 | * @return string Content with converted URIs. |
507 | 507 | */ |
508 | -function make_clickable( $text ) { |
|
508 | +function make_clickable($text) { |
|
509 | 509 | $r = ''; |
510 | - $textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags |
|
510 | + $textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags |
|
511 | 511 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
512 | - foreach ( $textarr as $piece ) { |
|
512 | + foreach ($textarr as $piece) { |
|
513 | 513 | |
514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
514 | + if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece)) |
|
515 | 515 | $nested_code_pre++; |
516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
516 | + elseif (('</code>' === strtolower($piece) || '</pre>' === strtolower($piece)) && $nested_code_pre) |
|
517 | 517 | $nested_code_pre--; |
518 | 518 | |
519 | - if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
|
519 | + if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) { |
|
520 | 520 | $r .= $piece; |
521 | 521 | continue; |
522 | 522 | } |
523 | 523 | |
524 | 524 | // Long strings might contain expensive edge cases ... |
525 | - if ( 10000 < strlen( $piece ) ) { |
|
525 | + if (10000 < strlen($piece)) { |
|
526 | 526 | // ... break it up |
527 | - foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
528 | - if ( 2101 < strlen( $chunk ) ) { |
|
527 | + foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses |
|
528 | + if (2101 < strlen($chunk)) { |
|
529 | 529 | $r .= $chunk; // Too big, no whitespace: bail. |
530 | 530 | } else { |
531 | - $r .= make_clickable( $chunk ); |
|
531 | + $r .= make_clickable($chunk); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } else { |
@@ -549,18 +549,18 @@ discard block |
||
549 | 549 | ~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character. |
550 | 550 | // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times. |
551 | 551 | |
552 | - $ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret ); |
|
552 | + $ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret); |
|
553 | 553 | |
554 | - $ret = preg_replace_callback( '#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret ); |
|
555 | - $ret = preg_replace_callback( '#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret ); |
|
554 | + $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret); |
|
555 | + $ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret); |
|
556 | 556 | |
557 | - $ret = substr( $ret, 1, -1 ); // Remove our whitespace padding. |
|
557 | + $ret = substr($ret, 1, -1); // Remove our whitespace padding. |
|
558 | 558 | $r .= $ret; |
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | 562 | // Cleanup of accidental links within links |
563 | - $r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r ); |
|
563 | + $r = preg_replace('#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r); |
|
564 | 564 | return $r; |
565 | 565 | } |
566 | 566 | |
@@ -595,27 +595,27 @@ discard block |
||
595 | 595 | * @param int $goal The desired chunk length. |
596 | 596 | * @return array Numeric array of chunks. |
597 | 597 | */ |
598 | -function _split_str_by_whitespace( $string, $goal ) { |
|
598 | +function _split_str_by_whitespace($string, $goal) { |
|
599 | 599 | $chunks = array(); |
600 | 600 | |
601 | - $string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" ); |
|
601 | + $string_nullspace = strtr($string, "\r\n\t\v\f ", "\000\000\000\000\000\000"); |
|
602 | 602 | |
603 | - while ( $goal < strlen( $string_nullspace ) ) { |
|
604 | - $pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" ); |
|
603 | + while ($goal < strlen($string_nullspace)) { |
|
604 | + $pos = strrpos(substr($string_nullspace, 0, $goal + 1), "\000"); |
|
605 | 605 | |
606 | - if ( false === $pos ) { |
|
607 | - $pos = strpos( $string_nullspace, "\000", $goal + 1 ); |
|
608 | - if ( false === $pos ) { |
|
606 | + if (false === $pos) { |
|
607 | + $pos = strpos($string_nullspace, "\000", $goal + 1); |
|
608 | + if (false === $pos) { |
|
609 | 609 | break; |
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | - $chunks[] = substr( $string, 0, $pos + 1 ); |
|
614 | - $string = substr( $string, $pos + 1 ); |
|
615 | - $string_nullspace = substr( $string_nullspace, $pos + 1 ); |
|
613 | + $chunks[] = substr($string, 0, $pos + 1); |
|
614 | + $string = substr($string, $pos + 1); |
|
615 | + $string_nullspace = substr($string_nullspace, $pos + 1); |
|
616 | 616 | } |
617 | 617 | |
618 | - if ( $string ) { |
|
618 | + if ($string) { |
|
619 | 619 | $chunks[] = $string; |
620 | 620 | } |
621 | 621 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | */ |
694 | 694 | function get_week_from_day($date) { |
695 | 695 | if (!empty($date)) { |
696 | - $time = api_strtotime($date,'UTC'); |
|
696 | + $time = api_strtotime($date, 'UTC'); |
|
697 | 697 | return date('W', $time); |
698 | 698 | } else { |
699 | 699 | return date('W'); |
@@ -710,17 +710,17 @@ discard block |
||
710 | 710 | * @return a reduce string |
711 | 711 | */ |
712 | 712 | |
713 | -function substrwords($text,$maxchar,$end='...') |
|
713 | +function substrwords($text, $maxchar, $end = '...') |
|
714 | 714 | { |
715 | - if(strlen($text)>$maxchar) |
|
715 | + if (strlen($text) > $maxchar) |
|
716 | 716 | { |
717 | - $words=explode(" ",$text); |
|
717 | + $words = explode(" ", $text); |
|
718 | 718 | $output = ''; |
719 | - $i=0; |
|
720 | - while(1) |
|
719 | + $i = 0; |
|
720 | + while (1) |
|
721 | 721 | { |
722 | - $length = (strlen($output)+strlen($words[$i])); |
|
723 | - if($length>$maxchar) |
|
722 | + $length = (strlen($output) + strlen($words[$i])); |
|
723 | + if ($length > $maxchar) |
|
724 | 724 | { |
725 | 725 | break; |
726 | 726 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | function implode_with_key($glue, $array) { |
743 | 743 | if (!empty($array)) { |
744 | 744 | $string = ''; |
745 | - foreach($array as $key => $value) { |
|
745 | + foreach ($array as $key => $value) { |
|
746 | 746 | if (empty($value)) { |
747 | 747 | $value = 'null'; |
748 | 748 | } |
@@ -764,13 +764,13 @@ discard block |
||
764 | 764 | { |
765 | 765 | $file_size = intval($file_size); |
766 | 766 | if ($file_size >= 1073741824) { |
767 | - $file_size = round($file_size / 1073741824 * 100) / 100 . 'G'; |
|
768 | - } elseif($file_size >= 1048576) { |
|
769 | - $file_size = round($file_size / 1048576 * 100) / 100 . 'M'; |
|
770 | - } elseif($file_size >= 1024) { |
|
771 | - $file_size = round($file_size / 1024 * 100) / 100 . 'k'; |
|
767 | + $file_size = round($file_size / 1073741824 * 100) / 100.'G'; |
|
768 | + } elseif ($file_size >= 1048576) { |
|
769 | + $file_size = round($file_size / 1048576 * 100) / 100.'M'; |
|
770 | + } elseif ($file_size >= 1024) { |
|
771 | + $file_size = round($file_size / 1024 * 100) / 100.'k'; |
|
772 | 772 | } else { |
773 | - $file_size = $file_size . 'B'; |
|
773 | + $file_size = $file_size.'B'; |
|
774 | 774 | } |
775 | 775 | return $file_size; |
776 | 776 | } |
@@ -779,18 +779,18 @@ discard block |
||
779 | 779 | { |
780 | 780 | $year = '0000'; |
781 | 781 | $month = $day = $hours = $minutes = $seconds = '00'; |
782 | - if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
782 | + if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
|
783 | 783 | $year = $array['Y']; |
784 | - $month = isset($array['F'])?$array['F']:$array['M']; |
|
785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
784 | + $month = isset($array['F']) ? $array['F'] : $array['M']; |
|
785 | + if (intval($month) < 10) $month = '0'.$month; |
|
786 | 786 | $day = $array['d']; |
787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
787 | + if (intval($day) < 10) $day = '0'.$day; |
|
788 | 788 | $hours = $array['H']; |
789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
789 | + if (intval($hours) < 10) $hours = '0'.$hours; |
|
790 | 790 | $minutes = $array['i']; |
791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
791 | + if (intval($minutes) < 10) $minutes = '0'.$minutes; |
|
792 | 792 | } |
793 | - if (checkdate($month,$day,$year)) { |
|
793 | + if (checkdate($month, $day, $year)) { |
|
794 | 794 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
795 | 795 | } |
796 | 796 | return $datetime; |
@@ -351,8 +351,9 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | $url = esc_url($url); |
354 | - if ( empty($url) ) |
|
355 | - return $matches[0]; |
|
354 | + if ( empty($url) ) { |
|
355 | + return $matches[0]; |
|
356 | + } |
|
356 | 357 | |
357 | 358 | return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $suffix; |
358 | 359 | } |
@@ -377,8 +378,9 @@ discard block |
||
377 | 378 | function esc_url( $url, $protocols = null, $_context = 'display' ) { |
378 | 379 | //$original_url = $url; |
379 | 380 | |
380 | - if ( '' == $url ) |
|
381 | - return $url; |
|
381 | + if ( '' == $url ) { |
|
382 | + return $url; |
|
383 | + } |
|
382 | 384 | $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); |
383 | 385 | $strip = array('%0d', '%0a', '%0D', '%0A'); |
384 | 386 | $url = _deep_replace($strip, $url); |
@@ -388,8 +390,9 @@ discard block |
||
388 | 390 | * link starting with /, # or ? or a php file). |
389 | 391 | */ |
390 | 392 | if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) && |
391 | - ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) |
|
392 | - $url = 'http://' . $url; |
|
393 | + ! preg_match('/^[a-z0-9-]+?\.php/i', $url) ) { |
|
394 | + $url = 'http://' . $url; |
|
395 | + } |
|
393 | 396 | |
394 | 397 | return Security::remove_XSS($url); |
395 | 398 | |
@@ -466,8 +469,9 @@ discard block |
||
466 | 469 | $dest = $matches[2]; |
467 | 470 | $dest = 'http://' . $dest; |
468 | 471 | $dest = esc_url($dest); |
469 | - if ( empty($dest) ) |
|
470 | - return $matches[0]; |
|
472 | + if ( empty($dest) ) { |
|
473 | + return $matches[0]; |
|
474 | + } |
|
471 | 475 | |
472 | 476 | // removed trailing [.,;:)] from URL |
473 | 477 | if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { |
@@ -511,10 +515,11 @@ discard block |
||
511 | 515 | $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> |
512 | 516 | foreach ( $textarr as $piece ) { |
513 | 517 | |
514 | - if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) |
|
515 | - $nested_code_pre++; |
|
516 | - elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) |
|
517 | - $nested_code_pre--; |
|
518 | + if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) ) { |
|
519 | + $nested_code_pre++; |
|
520 | + } elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre ) { |
|
521 | + $nested_code_pre--; |
|
522 | + } |
|
518 | 523 | |
519 | 524 | if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { |
520 | 525 | $r .= $piece; |
@@ -723,15 +728,13 @@ discard block |
||
723 | 728 | if($length>$maxchar) |
724 | 729 | { |
725 | 730 | break; |
726 | - } |
|
727 | - else |
|
731 | + } else |
|
728 | 732 | { |
729 | 733 | $output = $output." ".$words[$i]; |
730 | 734 | $i++; |
731 | 735 | }; |
732 | 736 | }; |
733 | - } |
|
734 | - else |
|
737 | + } else |
|
735 | 738 | { |
736 | 739 | $output = $text; |
737 | 740 | return $output; |
@@ -782,13 +785,21 @@ discard block |
||
782 | 785 | if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) { |
783 | 786 | $year = $array['Y']; |
784 | 787 | $month = isset($array['F'])?$array['F']:$array['M']; |
785 | - if (intval($month) < 10 ) $month = '0'.$month; |
|
788 | + if (intval($month) < 10 ) { |
|
789 | + $month = '0'.$month; |
|
790 | + } |
|
786 | 791 | $day = $array['d']; |
787 | - if (intval($day) < 10 ) $day = '0'.$day; |
|
792 | + if (intval($day) < 10 ) { |
|
793 | + $day = '0'.$day; |
|
794 | + } |
|
788 | 795 | $hours = $array['H']; |
789 | - if (intval($hours) < 10 ) $hours = '0'.$hours; |
|
796 | + if (intval($hours) < 10 ) { |
|
797 | + $hours = '0'.$hours; |
|
798 | + } |
|
790 | 799 | $minutes = $array['i']; |
791 | - if (intval($minutes) < 10 ) $minutes = '0'.$minutes; |
|
800 | + if (intval($minutes) < 10 ) { |
|
801 | + $minutes = '0'.$minutes; |
|
802 | + } |
|
792 | 803 | } |
793 | 804 | if (checkdate($month,$day,$year)) { |
794 | 805 | $datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds; |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | */ |
694 | 694 | function get_week_from_day($date) { |
695 | 695 | if (!empty($date)) { |
696 | - $time = api_strtotime($date,'UTC'); |
|
697 | - return date('W', $time); |
|
696 | + $time = api_strtotime($date,'UTC'); |
|
697 | + return date('W', $time); |
|
698 | 698 | } else { |
699 | 699 | return date('W'); |
700 | 700 | } |
@@ -712,31 +712,31 @@ discard block |
||
712 | 712 | |
713 | 713 | function substrwords($text,$maxchar,$end='...') |
714 | 714 | { |
715 | - if(strlen($text)>$maxchar) |
|
716 | - { |
|
717 | - $words=explode(" ",$text); |
|
718 | - $output = ''; |
|
719 | - $i=0; |
|
720 | - while(1) |
|
721 | - { |
|
722 | - $length = (strlen($output)+strlen($words[$i])); |
|
723 | - if($length>$maxchar) |
|
724 | - { |
|
725 | - break; |
|
726 | - } |
|
727 | - else |
|
728 | - { |
|
729 | - $output = $output." ".$words[$i]; |
|
730 | - $i++; |
|
731 | - }; |
|
732 | - }; |
|
733 | - } |
|
734 | - else |
|
735 | - { |
|
736 | - $output = $text; |
|
737 | - return $output; |
|
738 | - } |
|
739 | - return $output.$end; |
|
715 | + if(strlen($text)>$maxchar) |
|
716 | + { |
|
717 | + $words=explode(" ",$text); |
|
718 | + $output = ''; |
|
719 | + $i=0; |
|
720 | + while(1) |
|
721 | + { |
|
722 | + $length = (strlen($output)+strlen($words[$i])); |
|
723 | + if($length>$maxchar) |
|
724 | + { |
|
725 | + break; |
|
726 | + } |
|
727 | + else |
|
728 | + { |
|
729 | + $output = $output." ".$words[$i]; |
|
730 | + $i++; |
|
731 | + }; |
|
732 | + }; |
|
733 | + } |
|
734 | + else |
|
735 | + { |
|
736 | + $output = $text; |
|
737 | + return $output; |
|
738 | + } |
|
739 | + return $output.$end; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | function implode_with_key($glue, $array) { |
@@ -73,7 +73,7 @@ |
||
73 | 73 | * @todo the form should be auto generated |
74 | 74 | * @param string url |
75 | 75 | * @param string action add, edit |
76 | - * @return obj form validator obj |
|
76 | + * @return FormValidator form validator obj |
|
77 | 77 | */ |
78 | 78 | public function return_form($url, $action) |
79 | 79 | { |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ); |
26 | 26 | public $is_course_model = true; |
27 | 27 | |
28 | - public function __construct() |
|
28 | + public function __construct() |
|
29 | 29 | { |
30 | 30 | $this->table = Database::get_course_table(TABLE_TIMELINE); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Get the count of elements |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Displays the title + grid |
54 | 54 | */ |
55 | - public function listing() |
|
55 | + public function listing() |
|
56 | 56 | { |
57 | - // action links |
|
58 | - $html = '<div class="actions">'; |
|
57 | + // action links |
|
58 | + $html = '<div class="actions">'; |
|
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | - $html .= '</div>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | + $html .= '</div>'; |
|
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public function get_status_list() |
67 | 67 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70')); |
91 | 91 | //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250')); |
92 | - $status_list = $this->get_status_list(); |
|
92 | + $status_list = $this->get_status_list(); |
|
93 | 93 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
94 | 94 | if ($action == 'edit') { |
95 | 95 | //$form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // Setting the rules |
175 | 175 | $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required'); |
176 | - return $form; |
|
176 | + return $form; |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | public function save_item($params) |
185 | 185 | { |
186 | 186 | $params['c_id'] = api_get_course_int_id(); |
187 | - $id = parent::save($params); |
|
188 | - if (!empty($id)) { |
|
189 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | - } |
|
191 | - return $id; |
|
187 | + $id = parent::save($params); |
|
188 | + if (!empty($id)) { |
|
189 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | + } |
|
191 | + return $id; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | $params['c_id'] = api_get_course_int_id(); |
200 | 200 | $params['parent_id'] = '0'; |
201 | 201 | $params['type'] = 'default'; |
202 | - $id = parent::save($params); |
|
203 | - if (!empty($id)) { |
|
204 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | - } |
|
206 | - return $id; |
|
202 | + $id = parent::save($params); |
|
203 | + if (!empty($id)) { |
|
204 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | + } |
|
206 | + return $id; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function delete($id) { |
210 | - parent::delete($id); |
|
211 | - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
210 | + parent::delete($id); |
|
211 | + //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | public function get_url($id) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $item['asset'] = array( 'media' => $item['media'], |
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | - ); |
|
250 | + ); |
|
251 | 251 | |
252 | 252 | //Cleaning items |
253 | 253 | unset($item['id']); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
30 | + $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function get_all($where_conditions = array()) |
48 | 48 | { |
49 | - return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC')); |
|
49 | + return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // action links |
58 | 58 | $html = '<div class="actions">'; |
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
61 | 61 | $html .= '</div>'; |
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | unset($item['end_date']); |
246 | 246 | // Assets |
247 | - $item['asset'] = array( 'media' => $item['media'], |
|
247 | + $item['asset'] = array('media' => $item['media'], |
|
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | 250 | ); |
@@ -1287,6 +1287,8 @@ discard block |
||
1287 | 1287 | * @param string type of time filter: 'last_week' or 'custom' |
1288 | 1288 | * @param string start date date('Y-m-d H:i:s') |
1289 | 1289 | * @param string end date date('Y-m-d H:i:s') |
1290 | + * @param string $start_date |
|
1291 | + * @param string $end_date |
|
1290 | 1292 | * @return timestamp $nb_seconds |
1291 | 1293 | */ |
1292 | 1294 | public static function get_time_spent_on_the_platform( |
@@ -1390,7 +1392,7 @@ discard block |
||
1390 | 1392 | * Get first connection date for a student |
1391 | 1393 | * @param int $student_id |
1392 | 1394 | * |
1393 | - * @return string|bool Date format long without day or false if there are no connections |
|
1395 | + * @return string|false Date format long without day or false if there are no connections |
|
1394 | 1396 | */ |
1395 | 1397 | public static function get_first_connection_date($student_id) |
1396 | 1398 | { |
@@ -1420,7 +1422,7 @@ discard block |
||
1420 | 1422 | * @param int $student_id |
1421 | 1423 | * @param bool $warning_message Show a warning message (optional) |
1422 | 1424 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
1423 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
1425 | + * @return string Date format long without day, false if there are no connections or |
|
1424 | 1426 | * timestamp if parameter $return_timestamp is true |
1425 | 1427 | */ |
1426 | 1428 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2667,6 +2669,9 @@ discard block |
||
2667 | 2669 | * @param array Limit average to listed lp ids |
2668 | 2670 | * @param int Session id (optional), if param $session_id is |
2669 | 2671 | * null(default) it'll return results including sessions, 0 = session is not filtered |
2672 | + * @param integer $student_id |
|
2673 | + * @param string $course_code |
|
2674 | + * @param integer $session_id |
|
2670 | 2675 | * @return int Total time |
2671 | 2676 | */ |
2672 | 2677 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2733,6 +2738,8 @@ discard block |
||
2733 | 2738 | * @param int|array Student id(s) |
2734 | 2739 | * @param string Course code |
2735 | 2740 | * @param int Learning path id |
2741 | + * @param integer $student_id |
|
2742 | + * @param string $course_code |
|
2736 | 2743 | * @return int Total time |
2737 | 2744 | */ |
2738 | 2745 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5400,7 +5407,7 @@ discard block |
||
5400 | 5407 | |
5401 | 5408 | /** |
5402 | 5409 | * @param FormValidator $form |
5403 | - * @return mixed |
|
5410 | + * @return FormValidator |
|
5404 | 5411 | */ |
5405 | 5412 | public static function setUserSearchForm($form) |
5406 | 5413 | { |
@@ -5439,7 +5446,6 @@ discard block |
||
5439 | 5446 | * @param int $sessionId The session ID (session.id) |
5440 | 5447 | * @param int $courseId The course ID (course.id) |
5441 | 5448 | * @param int $exerciseId The quiz ID (c_quiz.id) |
5442 | - * @param int $answer The answer status (0 = incorrect, 1 = correct, 2 = both) |
|
5443 | 5449 | * @param array $options An array of options you can pass to the query (limit, where and order) |
5444 | 5450 | * @return array An array with the data of exercise(s) progress |
5445 | 5451 | */ |
@@ -6876,7 +6882,7 @@ discard block |
||
6876 | 6882 | * @param int $user_id |
6877 | 6883 | * @param int $course_id |
6878 | 6884 | * @param int $session_id |
6879 | - * @return array |
|
6885 | + * @return string[] |
|
6880 | 6886 | */ |
6881 | 6887 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6882 | 6888 | { |
@@ -6922,9 +6928,9 @@ discard block |
||
6922 | 6928 | /** |
6923 | 6929 | * Displays the exercise results for a specific user in a specific course. |
6924 | 6930 | * @param string $view |
6925 | - * @param int $user_id User ID |
|
6931 | + * @param int $userId User ID |
|
6926 | 6932 | * @param string $courseCode Course code |
6927 | - * @return array |
|
6933 | + * @return string[] |
|
6928 | 6934 | * @todo remove globals |
6929 | 6935 | */ |
6930 | 6936 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -2259,7 +2259,9 @@ discard block |
||
2259 | 2259 | $debug = false; |
2260 | 2260 | } |
2261 | 2261 | |
2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2262 | + if ($debug) { |
|
2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2264 | + } |
|
2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
2336 | 2338 | $condition_user1 AND |
2337 | 2339 | session_id = $session_id |
2338 | 2340 | GROUP BY lp_id, user_id"; |
2339 | - if ($debug) echo $sql; |
|
2341 | + if ($debug) { |
|
2342 | + echo $sql; |
|
2343 | + } |
|
2340 | 2344 | |
2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
2354 | 2358 | $user_id = $row_lp_view['user_id']; |
2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2359 | + if ($debug) { |
|
2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2361 | + } |
|
2356 | 2362 | |
2357 | 2363 | if ($get_only_latest_attempt_results) { |
2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
2409 | 2415 | lp_i.c_id = $course_id AND |
2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
2412 | - if ($debug) echo $sql.'<br />'; |
|
2418 | + if ($debug) { |
|
2419 | + echo $sql.'<br />'; |
|
2420 | + } |
|
2413 | 2421 | $res_max_score = Database::query($sql); |
2414 | 2422 | |
2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2429 | 2437 | $score = $row_max_score['score']; |
2430 | 2438 | |
2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2439 | + if ($debug) { |
|
2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2441 | + } |
|
2432 | 2442 | |
2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
2448 | 2458 | if (!empty($max_score)) { |
2449 | 2459 | $lp_partial_total += $score/$max_score; |
2450 | 2460 | } |
2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2461 | + if ($debug) { |
|
2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2463 | + } |
|
2452 | 2464 | } else { |
2453 | 2465 | // Case of a TOOL_QUIZ element |
2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
2470 | 2482 | ORDER BY exe_date DESC |
2471 | 2483 | LIMIT 1"; |
2472 | 2484 | |
2473 | - if ($debug) echo $sql .'<br />'; |
|
2485 | + if ($debug) { |
|
2486 | + echo $sql .'<br />'; |
|
2487 | + } |
|
2474 | 2488 | $result_last_attempt = Database::query($sql); |
2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
2476 | 2490 | if ($num > 0 ) { |
2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2492 | + if ($debug) { |
|
2493 | + echo $id_last_attempt.'<br />'; |
|
2494 | + } |
|
2479 | 2495 | |
2480 | 2496 | // Within the last attempt number tracking, get the sum of |
2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
2494 | 2510 | q.c_id = $course_id |
2495 | 2511 | ) |
2496 | 2512 | AS t"; |
2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2513 | + if ($debug) { |
|
2514 | + echo '$sql: '.$sql.' <br />'; |
|
2515 | + } |
|
2498 | 2516 | $res_max_score_bis = Database::query($sql); |
2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
2505 | 2523 | $lp_partial_total += $score/$max_score; |
2506 | 2524 | } |
2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2525 | + if ($debug) { |
|
2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2527 | + } |
|
2508 | 2528 | } |
2509 | 2529 | } |
2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
2517 | 2537 | $count_items++; |
2518 | 2538 | } |
2519 | 2539 | } |
2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
2540 | + if ($debug) { |
|
2541 | + echo '$count_items: '.$count_items; |
|
2542 | + } |
|
2521 | 2543 | } |
2522 | 2544 | } //end for |
2523 | 2545 | |
2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2525 | 2547 | |
2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2548 | + if ($debug) { |
|
2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2550 | + } |
|
2551 | + if ($debug) { |
|
2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2553 | + } |
|
2528 | 2554 | |
2529 | 2555 | $global_result += $score_of_scorm_calculate; |
2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2556 | + if ($debug) { |
|
2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2558 | + } |
|
2531 | 2559 | } // end while |
2532 | 2560 | } |
2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
2540 | 2568 | c_id = $course_id AND |
2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
2542 | 2570 | lp_id = ".$lp_id; |
2543 | - if ($debug) echo $sql; |
|
2571 | + if ($debug) { |
|
2572 | + echo $sql; |
|
2573 | + } |
|
2544 | 2574 | $result_have_quiz = Database::query($sql); |
2545 | 2575 | |
2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
2551 | 2581 | } |
2552 | 2582 | } |
2553 | 2583 | |
2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2584 | + if ($debug) { |
|
2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2586 | + } |
|
2587 | + if ($debug) { |
|
2588 | + echo '<h3>Final return</h3>'; |
|
2589 | + } |
|
2556 | 2590 | |
2557 | 2591 | if ($lp_with_quiz != 0) { |
2558 | 2592 | if (!$return_array) { |
2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2594 | + if ($debug) { |
|
2595 | + var_dump($score_of_scorm_calculate); |
|
2596 | + } |
|
2561 | 2597 | if (empty($lp_ids)) { |
2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2598 | + if ($debug) { |
|
2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2600 | + } |
|
2563 | 2601 | } |
2564 | 2602 | return $score_of_scorm_calculate; |
2565 | 2603 | } else { |
2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2604 | + if ($debug) { |
|
2605 | + var_dump($global_result, $lp_with_quiz); |
|
2606 | + } |
|
2567 | 2607 | return array($global_result, $lp_with_quiz); |
2568 | 2608 | } |
2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
3050 | 3090 | |
3051 | 3091 | if (!empty ($id_session)) { |
3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3053 | - if (api_is_multiple_url_enabled()) |
|
3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3055 | - } else { |
|
3056 | - if (api_is_multiple_url_enabled()) |
|
3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3093 | + if (api_is_multiple_url_enabled()) { |
|
3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + if (api_is_multiple_url_enabled()) { |
|
3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3099 | + } |
|
3058 | 3100 | } |
3059 | 3101 | |
3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
3163 | 3205 | ) { |
3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
3165 | - } |
|
3166 | - else { |
|
3207 | + } else { |
|
3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
6599 | 6640 | if (is_array($hpresults)) { |
6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
6602 | - if ($title == '') |
|
6603 | - $title = basename($hpresults[$i][0]); |
|
6643 | + if ($title == '') { |
|
6644 | + $title = basename($hpresults[$i][0]); |
|
6645 | + } |
|
6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6605 | 6647 | ?> |
6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
6974 | 7016 | |
6975 | - if ($title == '') |
|
6976 | - $title = basename($hpresults[$i][0]); |
|
7017 | + if ($title == '') { |
|
7018 | + $title = basename($hpresults[$i][0]); |
|
7019 | + } |
|
6977 | 7020 | |
6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6979 | 7022 |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | $extend_link = ''; |
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
317 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
318 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | $newDate = new DateTime('-30 days', new DateTimeZone('UTC')); |
1367 | 1367 | $condition_time = " AND (login_date >= '{$newDate->format('Y-m-d H:i:s')}'"; |
1368 | 1368 | $condition_time .= "AND logout_date <= '{$today->format('Y-m-d H:i:s')}') "; |
1369 | - break; |
|
1369 | + break; |
|
1370 | 1370 | case 'custom': |
1371 | 1371 | if (!empty($start_date) && !empty($end_date)) { |
1372 | 1372 | $start_date = Database::escape_string($start_date); |
@@ -1376,10 +1376,10 @@ discard block |
||
1376 | 1376 | break; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1379 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1380 | 1380 | FROM '.$tbl_track_login.' |
1381 | 1381 | WHERE '.$userCondition.$condition_time; |
1382 | - $rs = Database::query($sql); |
|
1382 | + $rs = Database::query($sql); |
|
1383 | 1383 | $row = Database::fetch_array($rs, 'ASSOC'); |
1384 | 1384 | $diff = $row['diff']; |
1385 | 1385 | |
@@ -1401,18 +1401,18 @@ discard block |
||
1401 | 1401 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1402 | 1402 | { |
1403 | 1403 | $courseId = intval($courseId); |
1404 | - $session_id = intval($session_id); |
|
1405 | - |
|
1406 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1407 | - if (is_array($user_id)) { |
|
1408 | - $user_id = array_map('intval', $user_id); |
|
1409 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1410 | - } else { |
|
1411 | - $user_id = intval($user_id); |
|
1412 | - $condition_user = " AND user_id = $user_id "; |
|
1413 | - } |
|
1414 | - |
|
1415 | - $sql = "SELECT |
|
1404 | + $session_id = intval($session_id); |
|
1405 | + |
|
1406 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1407 | + if (is_array($user_id)) { |
|
1408 | + $user_id = array_map('intval', $user_id); |
|
1409 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1410 | + } else { |
|
1411 | + $user_id = intval($user_id); |
|
1412 | + $condition_user = " AND user_id = $user_id "; |
|
1413 | + } |
|
1414 | + |
|
1415 | + $sql = "SELECT |
|
1416 | 1416 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1417 | 1417 | FROM $tbl_track_course |
1418 | 1418 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1427,9 +1427,9 @@ discard block |
||
1427 | 1427 | |
1428 | 1428 | $sql .= $condition_user; |
1429 | 1429 | $rs = Database::query($sql); |
1430 | - $row = Database::fetch_array($rs); |
|
1430 | + $row = Database::fetch_array($rs); |
|
1431 | 1431 | |
1432 | - return $row['nb_seconds']; |
|
1432 | + return $row['nb_seconds']; |
|
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | /** |
@@ -1440,25 +1440,25 @@ discard block |
||
1440 | 1440 | */ |
1441 | 1441 | public static function get_first_connection_date($student_id) |
1442 | 1442 | { |
1443 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1444 | - $sql = 'SELECT login_date |
|
1443 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1444 | + $sql = 'SELECT login_date |
|
1445 | 1445 | FROM ' . $tbl_track_login . ' |
1446 | 1446 | WHERE login_user_id = ' . intval($student_id) . ' |
1447 | 1447 | ORDER BY login_date ASC |
1448 | 1448 | LIMIT 0,1'; |
1449 | 1449 | |
1450 | - $rs = Database::query($sql); |
|
1451 | - if (Database::num_rows($rs)>0) { |
|
1452 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1450 | + $rs = Database::query($sql); |
|
1451 | + if (Database::num_rows($rs)>0) { |
|
1452 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1453 | 1453 | return api_convert_and_format_date( |
1454 | 1454 | $first_login_date, |
1455 | 1455 | DATE_FORMAT_SHORT, |
1456 | 1456 | date_default_timezone_get() |
1457 | 1457 | ); |
1458 | - } |
|
1459 | - } |
|
1458 | + } |
|
1459 | + } |
|
1460 | 1460 | |
1461 | - return false; |
|
1461 | + return false; |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | /** |
@@ -1471,38 +1471,38 @@ discard block |
||
1471 | 1471 | */ |
1472 | 1472 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1473 | 1473 | { |
1474 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1475 | - $sql = 'SELECT login_date |
|
1474 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1475 | + $sql = 'SELECT login_date |
|
1476 | 1476 | FROM ' . $table . ' |
1477 | 1477 | WHERE login_user_id = ' . intval($student_id) . ' |
1478 | 1478 | ORDER BY login_date |
1479 | 1479 | DESC LIMIT 0,1'; |
1480 | 1480 | |
1481 | - $rs = Database::query($sql); |
|
1482 | - if (Database::num_rows($rs) > 0) { |
|
1483 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1484 | - $last_login_date = api_get_local_time($last_login_date); |
|
1485 | - if ($return_timestamp) { |
|
1486 | - return api_strtotime($last_login_date,'UTC'); |
|
1487 | - } else { |
|
1488 | - if (!$warning_message) { |
|
1489 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1490 | - } else { |
|
1491 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1492 | - $currentTimestamp = time(); |
|
1493 | - |
|
1494 | - //If the last connection is > than 7 days, the text is red |
|
1495 | - //345600 = 7 days in seconds |
|
1496 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1497 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1498 | - } else { |
|
1499 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1500 | - } |
|
1501 | - } |
|
1502 | - } |
|
1503 | - } |
|
1504 | - } |
|
1505 | - return false; |
|
1481 | + $rs = Database::query($sql); |
|
1482 | + if (Database::num_rows($rs) > 0) { |
|
1483 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1484 | + $last_login_date = api_get_local_time($last_login_date); |
|
1485 | + if ($return_timestamp) { |
|
1486 | + return api_strtotime($last_login_date,'UTC'); |
|
1487 | + } else { |
|
1488 | + if (!$warning_message) { |
|
1489 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1490 | + } else { |
|
1491 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1492 | + $currentTimestamp = time(); |
|
1493 | + |
|
1494 | + //If the last connection is > than 7 days, the text is red |
|
1495 | + //345600 = 7 days in seconds |
|
1496 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1497 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1498 | + } else { |
|
1499 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1500 | + } |
|
1501 | + } |
|
1502 | + } |
|
1503 | + } |
|
1504 | + } |
|
1505 | + return false; |
|
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | /** |
@@ -1556,30 +1556,30 @@ discard block |
||
1556 | 1556 | $session_id = 0, |
1557 | 1557 | $convert_date = true |
1558 | 1558 | ) { |
1559 | - $student_id = intval($student_id); |
|
1559 | + $student_id = intval($student_id); |
|
1560 | 1560 | $courseId = intval($courseId); |
1561 | - $session_id = intval($session_id); |
|
1561 | + $session_id = intval($session_id); |
|
1562 | 1562 | |
1563 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1564 | - $sql = 'SELECT login_course_date |
|
1563 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1564 | + $sql = 'SELECT login_course_date |
|
1565 | 1565 | FROM '.$tbl_track_login.' |
1566 | 1566 | WHERE |
1567 | 1567 | user_id = '.$student_id.' AND |
1568 | 1568 | c_id = '.$courseId.' AND |
1569 | 1569 | session_id = '.$session_id.' |
1570 | 1570 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1571 | - $rs = Database::query($sql); |
|
1572 | - if (Database::num_rows($rs) > 0) { |
|
1573 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1574 | - if ($convert_date) { |
|
1575 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1576 | - } else { |
|
1577 | - return $first_login_date; |
|
1578 | - } |
|
1579 | - } |
|
1580 | - } |
|
1581 | - |
|
1582 | - return false; |
|
1571 | + $rs = Database::query($sql); |
|
1572 | + if (Database::num_rows($rs) > 0) { |
|
1573 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1574 | + if ($convert_date) { |
|
1575 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1576 | + } else { |
|
1577 | + return $first_login_date; |
|
1578 | + } |
|
1579 | + } |
|
1580 | + } |
|
1581 | + |
|
1582 | + return false; |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | /** |
@@ -1595,13 +1595,13 @@ discard block |
||
1595 | 1595 | $session_id = 0, |
1596 | 1596 | $convert_date = true |
1597 | 1597 | ) { |
1598 | - // protect data |
|
1599 | - $student_id = intval($student_id); |
|
1598 | + // protect data |
|
1599 | + $student_id = intval($student_id); |
|
1600 | 1600 | $courseId = $courseInfo['real_id']; |
1601 | - $session_id = intval($session_id); |
|
1601 | + $session_id = intval($session_id); |
|
1602 | 1602 | |
1603 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1604 | - $sql = 'SELECT access_date |
|
1603 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1604 | + $sql = 'SELECT access_date |
|
1605 | 1605 | FROM '.$tbl_track_e_access.' |
1606 | 1606 | WHERE access_user_id = '.$student_id.' AND |
1607 | 1607 | c_id = "'.$courseId.'" AND |
@@ -1609,39 +1609,39 @@ discard block |
||
1609 | 1609 | ORDER BY access_date DESC |
1610 | 1610 | LIMIT 0,1'; |
1611 | 1611 | |
1612 | - $rs = Database::query($sql); |
|
1613 | - if (Database::num_rows($rs) > 0) { |
|
1614 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1612 | + $rs = Database::query($sql); |
|
1613 | + if (Database::num_rows($rs) > 0) { |
|
1614 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1615 | 1615 | if (empty($last_login_date) || $last_login_date == '0000-00-00 00:00:00') { |
1616 | 1616 | return false; |
1617 | 1617 | } |
1618 | 1618 | //see #5736 |
1619 | 1619 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1620 | - $now = time(); |
|
1621 | - //If the last connection is > than 7 days, the text is red |
|
1622 | - //345600 = 7 days in seconds |
|
1623 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1624 | - if ($convert_date) { |
|
1620 | + $now = time(); |
|
1621 | + //If the last connection is > than 7 days, the text is red |
|
1622 | + //345600 = 7 days in seconds |
|
1623 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1624 | + if ($convert_date) { |
|
1625 | 1625 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1626 | 1626 | $icon = api_is_allowed_to_edit() ? |
1627 | 1627 | '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1628 | 1628 | '.Display::return_icon('messagebox_warning.gif').' |
1629 | 1629 | </a>' |
1630 | 1630 | : null; |
1631 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1632 | - } else { |
|
1633 | - return $last_login_date; |
|
1634 | - } |
|
1635 | - } else { |
|
1636 | - if ($convert_date) { |
|
1637 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1638 | - } else { |
|
1639 | - return $last_login_date; |
|
1640 | - } |
|
1641 | - } |
|
1642 | - } |
|
1643 | - } |
|
1644 | - return false; |
|
1631 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1632 | + } else { |
|
1633 | + return $last_login_date; |
|
1634 | + } |
|
1635 | + } else { |
|
1636 | + if ($convert_date) { |
|
1637 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1638 | + } else { |
|
1639 | + return $last_login_date; |
|
1640 | + } |
|
1641 | + } |
|
1642 | + } |
|
1643 | + } |
|
1644 | + return false; |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
@@ -1655,11 +1655,11 @@ discard block |
||
1655 | 1655 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1656 | 1656 | { |
1657 | 1657 | if ($start < 0) { |
1658 | - $start = 0; |
|
1659 | - } |
|
1660 | - if (!isset($stop) or ($stop < 0)) { |
|
1661 | - $stop = api_get_utc_datetime(); |
|
1662 | - } |
|
1658 | + $start = 0; |
|
1659 | + } |
|
1660 | + if (!isset($stop) or ($stop < 0)) { |
|
1661 | + $stop = api_get_utc_datetime(); |
|
1662 | + } |
|
1663 | 1663 | |
1664 | 1664 | // Given we're storing in cache, round the start and end times |
1665 | 1665 | // to the lower minute |
@@ -1668,11 +1668,11 @@ discard block |
||
1668 | 1668 | $roundedStart = Database::escape_string($roundedStart); |
1669 | 1669 | $roundedStop = Database::escape_string($roundedStop); |
1670 | 1670 | |
1671 | - $month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' "; |
|
1671 | + $month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' "; |
|
1672 | 1672 | |
1673 | 1673 | $courseId = intval($courseId); |
1674 | - $session_id = intval($session_id); |
|
1675 | - $count = 0; |
|
1674 | + $session_id = intval($session_id); |
|
1675 | + $count = 0; |
|
1676 | 1676 | $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1677 | 1677 | $sql = "SELECT count(*) as count_connections |
1678 | 1678 | FROM $tbl_track_e_course_access |
@@ -1711,7 +1711,7 @@ discard block |
||
1711 | 1711 | } |
1712 | 1712 | } |
1713 | 1713 | |
1714 | - return $count; |
|
1714 | + return $count; |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1722,25 +1722,25 @@ discard block |
||
1722 | 1722 | */ |
1723 | 1723 | public static function count_course_per_student($user_id, $include_sessions = true) |
1724 | 1724 | { |
1725 | - $user_id = intval($user_id); |
|
1726 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1727 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1725 | + $user_id = intval($user_id); |
|
1726 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1727 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1728 | 1728 | |
1729 | - $sql = 'SELECT DISTINCT c_id |
|
1729 | + $sql = 'SELECT DISTINCT c_id |
|
1730 | 1730 | FROM ' . $tbl_course_rel_user . ' |
1731 | 1731 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1732 | - $rs = Database::query($sql); |
|
1733 | - $nb_courses = Database::num_rows($rs); |
|
1732 | + $rs = Database::query($sql); |
|
1733 | + $nb_courses = Database::num_rows($rs); |
|
1734 | 1734 | |
1735 | - if ($include_sessions) { |
|
1736 | - $sql = 'SELECT DISTINCT c_id |
|
1735 | + if ($include_sessions) { |
|
1736 | + $sql = 'SELECT DISTINCT c_id |
|
1737 | 1737 | FROM ' . $tbl_session_course_rel_user . ' |
1738 | 1738 | WHERE user_id = ' . $user_id; |
1739 | - $rs = Database::query($sql); |
|
1740 | - $nb_courses += Database::num_rows($rs); |
|
1741 | - } |
|
1739 | + $rs = Database::query($sql); |
|
1740 | + $nb_courses += Database::num_rows($rs); |
|
1741 | + } |
|
1742 | 1742 | |
1743 | - return $nb_courses; |
|
1743 | + return $nb_courses; |
|
1744 | 1744 | } |
1745 | 1745 | |
1746 | 1746 | /** |
@@ -1771,25 +1771,25 @@ discard block |
||
1771 | 1771 | $into_lp = 0 |
1772 | 1772 | ) { |
1773 | 1773 | $course_code = Database::escape_string($course_code); |
1774 | - $course_info = api_get_course_info($course_code); |
|
1775 | - if (!empty($course_info)) { |
|
1776 | - // table definition |
|
1777 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1778 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1779 | - |
|
1780 | - // Compose a filter based on optional exercise given |
|
1781 | - $condition_quiz = ""; |
|
1782 | - if (!empty($exercise_id)) { |
|
1783 | - $exercise_id = intval($exercise_id); |
|
1784 | - $condition_quiz =" AND id = $exercise_id "; |
|
1785 | - } |
|
1786 | - |
|
1787 | - // Compose a filter based on optional session id given |
|
1788 | - $condition_session = ""; |
|
1789 | - if (isset($session_id)) { |
|
1790 | - $session_id = intval($session_id); |
|
1791 | - $condition_session = " AND session_id = $session_id "; |
|
1792 | - } |
|
1774 | + $course_info = api_get_course_info($course_code); |
|
1775 | + if (!empty($course_info)) { |
|
1776 | + // table definition |
|
1777 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1778 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1779 | + |
|
1780 | + // Compose a filter based on optional exercise given |
|
1781 | + $condition_quiz = ""; |
|
1782 | + if (!empty($exercise_id)) { |
|
1783 | + $exercise_id = intval($exercise_id); |
|
1784 | + $condition_quiz =" AND id = $exercise_id "; |
|
1785 | + } |
|
1786 | + |
|
1787 | + // Compose a filter based on optional session id given |
|
1788 | + $condition_session = ""; |
|
1789 | + if (isset($session_id)) { |
|
1790 | + $session_id = intval($session_id); |
|
1791 | + $condition_session = " AND session_id = $session_id "; |
|
1792 | + } |
|
1793 | 1793 | if ($active_filter == 1) { |
1794 | 1794 | $condition_active = 'AND active <> -1'; |
1795 | 1795 | } elseif ($active_filter == 0) { |
@@ -1805,25 +1805,25 @@ discard block |
||
1805 | 1805 | $select_lp_id = ', orig_lp_id as lp_id '; |
1806 | 1806 | } |
1807 | 1807 | |
1808 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1808 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1809 | 1809 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1810 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1810 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1811 | 1811 | |
1812 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1813 | - if (is_array($student_id)) { |
|
1812 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1813 | + if (is_array($student_id)) { |
|
1814 | 1814 | $student_id = array_map('intval', $student_id); |
1815 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1816 | - } else { |
|
1815 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1816 | + } else { |
|
1817 | 1817 | $student_id = intval($student_id); |
1818 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1819 | - } |
|
1818 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1819 | + } |
|
1820 | 1820 | |
1821 | - if (empty($exercise_id)) { |
|
1822 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1821 | + if (empty($exercise_id)) { |
|
1822 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1823 | 1823 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1824 | 1824 | $result = Database::query($sql); |
1825 | 1825 | $exercise_list = array(); |
1826 | - $exercise_id = null; |
|
1826 | + $exercise_id = null; |
|
1827 | 1827 | if (Database::num_rows($result)) { |
1828 | 1828 | while ($row = Database::fetch_array($result)) { |
1829 | 1829 | $exercise_list[] = $row['id']; |
@@ -1832,11 +1832,11 @@ discard block |
||
1832 | 1832 | if (!empty($exercise_list)) { |
1833 | 1833 | $exercise_id = implode("','",$exercise_list); |
1834 | 1834 | } |
1835 | - } |
|
1835 | + } |
|
1836 | 1836 | |
1837 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1837 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1838 | 1838 | |
1839 | - $sql = "SELECT |
|
1839 | + $sql = "SELECT |
|
1840 | 1840 | SUM(exe_result/exe_weighting*100) as avg_score, |
1841 | 1841 | COUNT(*) as num_attempts |
1842 | 1842 | $select_lp_id |
@@ -1850,20 +1850,20 @@ discard block |
||
1850 | 1850 | $condition_into_lp |
1851 | 1851 | ORDER BY exe_date DESC"; |
1852 | 1852 | |
1853 | - $res = Database::query($sql); |
|
1854 | - $row = Database::fetch_array($res); |
|
1855 | - $quiz_avg_score = null; |
|
1853 | + $res = Database::query($sql); |
|
1854 | + $row = Database::fetch_array($res); |
|
1855 | + $quiz_avg_score = null; |
|
1856 | 1856 | |
1857 | - if (!empty($row['avg_score'])) { |
|
1858 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1859 | - } |
|
1857 | + if (!empty($row['avg_score'])) { |
|
1858 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1859 | + } |
|
1860 | 1860 | |
1861 | - if(!empty($row['num_attempts'])) { |
|
1862 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1863 | - } |
|
1864 | - if (is_array($student_id)) { |
|
1865 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1866 | - } |
|
1861 | + if(!empty($row['num_attempts'])) { |
|
1862 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1863 | + } |
|
1864 | + if (is_array($student_id)) { |
|
1865 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1866 | + } |
|
1867 | 1867 | if ($into_lp == 0) { |
1868 | 1868 | return $quiz_avg_score; |
1869 | 1869 | } else { |
@@ -1886,9 +1886,9 @@ discard block |
||
1886 | 1886 | return array($quiz_avg_score, null); |
1887 | 1887 | } |
1888 | 1888 | } |
1889 | - } |
|
1890 | - } |
|
1891 | - return null; |
|
1889 | + } |
|
1890 | + } |
|
1891 | + return null; |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | /** |
@@ -1921,15 +1921,15 @@ discard block |
||
1921 | 1921 | $find_all_lp = 0 |
1922 | 1922 | ) { |
1923 | 1923 | $courseId = intval($courseId); |
1924 | - $student_id = intval($student_id); |
|
1925 | - $exercise_id = intval($exercise_id); |
|
1926 | - $session_id = intval($session_id); |
|
1924 | + $student_id = intval($student_id); |
|
1925 | + $exercise_id = intval($exercise_id); |
|
1926 | + $session_id = intval($session_id); |
|
1927 | 1927 | |
1928 | - $lp_id = intval($lp_id); |
|
1928 | + $lp_id = intval($lp_id); |
|
1929 | 1929 | $lp_item_id = intval($lp_item_id); |
1930 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1930 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1931 | 1931 | |
1932 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1932 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1933 | 1933 | WHERE ex.c_id = $courseId |
1934 | 1934 | AND ex.exe_exo_id = $exercise_id |
1935 | 1935 | AND status = '' |
@@ -1944,11 +1944,11 @@ discard block |
||
1944 | 1944 | AND orig_lp_item_id = $lp_item_id"; |
1945 | 1945 | } |
1946 | 1946 | |
1947 | - $rs = Database::query($sql); |
|
1948 | - $row = Database::fetch_row($rs); |
|
1949 | - $count_attempts = $row[0]; |
|
1947 | + $rs = Database::query($sql); |
|
1948 | + $row = Database::fetch_row($rs); |
|
1949 | + $count_attempts = $row[0]; |
|
1950 | 1950 | |
1951 | - return $count_attempts; |
|
1951 | + return $count_attempts; |
|
1952 | 1952 | } |
1953 | 1953 | |
1954 | 1954 | /** |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | * @param int $user_id |
1959 | 1959 | * @param int $courseId |
1960 | 1960 | * @param int $session_id |
1961 | - */ |
|
1961 | + */ |
|
1962 | 1962 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1963 | 1963 | { |
1964 | 1964 | $courseId = intval($courseId); |
@@ -3622,8 +3622,8 @@ discard block |
||
3622 | 3622 | |
3623 | 3623 | $condition_session = ''; |
3624 | 3624 | if (isset($session_id)) { |
3625 | - $session_id = intval($session_id); |
|
3626 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3625 | + $session_id = intval($session_id); |
|
3626 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3627 | 3627 | } |
3628 | 3628 | |
3629 | 3629 | $groupId = intval($groupId); |
@@ -5522,9 +5522,9 @@ discard block |
||
5522 | 5522 | } |
5523 | 5523 | |
5524 | 5524 | /** |
5525 | - * @param FormValidator $form |
|
5526 | - * @return mixed |
|
5527 | - */ |
|
5525 | + * @param FormValidator $form |
|
5526 | + * @return mixed |
|
5527 | + */ |
|
5528 | 5528 | public static function setUserSearchForm($form) |
5529 | 5529 | { |
5530 | 5530 | global $_configuration; |
@@ -5838,26 +5838,26 @@ discard block |
||
5838 | 5838 | $session_id = api_get_session_id(); |
5839 | 5839 | $course_id = api_get_course_int_id(); |
5840 | 5840 | |
5841 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5842 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5841 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5842 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5843 | 5843 | |
5844 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5844 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5845 | 5845 | FROM $table_item_property track_resource, $table_user user |
5846 | 5846 | WHERE |
5847 | 5847 | track_resource.c_id = $course_id AND |
5848 | 5848 | track_resource.insert_user_id = user.user_id AND |
5849 | 5849 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5850 | 5850 | |
5851 | - if (isset($_GET['keyword'])) { |
|
5852 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5853 | - $sql .= " AND ( |
|
5851 | + if (isset($_GET['keyword'])) { |
|
5852 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5853 | + $sql .= " AND ( |
|
5854 | 5854 | user.username LIKE '%".$keyword."%' OR |
5855 | 5855 | lastedit_type LIKE '%".$keyword."%' OR |
5856 | 5856 | tool LIKE '%".$keyword."%' |
5857 | 5857 | )"; |
5858 | - } |
|
5858 | + } |
|
5859 | 5859 | |
5860 | - $sql .= " AND tool IN ( |
|
5860 | + $sql .= " AND tool IN ( |
|
5861 | 5861 | 'document', |
5862 | 5862 | 'learnpath', |
5863 | 5863 | 'quiz', |
@@ -5869,10 +5869,10 @@ discard block |
||
5869 | 5869 | 'thematic_advance', |
5870 | 5870 | 'thematic_plan' |
5871 | 5871 | )"; |
5872 | - $res = Database::query($sql); |
|
5873 | - $obj = Database::fetch_object($res); |
|
5872 | + $res = Database::query($sql); |
|
5873 | + $obj = Database::fetch_object($res); |
|
5874 | 5874 | |
5875 | - return $obj->total_number_of_items; |
|
5875 | + return $obj->total_number_of_items; |
|
5876 | 5876 | } |
5877 | 5877 | |
5878 | 5878 | /** |
@@ -5887,12 +5887,12 @@ discard block |
||
5887 | 5887 | $session_id = api_get_session_id(); |
5888 | 5888 | $course_id = api_get_course_int_id(); |
5889 | 5889 | |
5890 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5891 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5892 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5893 | - $session_id = intval($session_id); |
|
5890 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5891 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5892 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5893 | + $session_id = intval($session_id); |
|
5894 | 5894 | |
5895 | - $sql = "SELECT |
|
5895 | + $sql = "SELECT |
|
5896 | 5896 | tool as col0, |
5897 | 5897 | lastedit_type as col1, |
5898 | 5898 | ref as ref, |
@@ -5906,16 +5906,16 @@ discard block |
||
5906 | 5906 | track_resource.insert_user_id = user.user_id AND |
5907 | 5907 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5908 | 5908 | |
5909 | - if (isset($_GET['keyword'])) { |
|
5910 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5911 | - $sql .= " AND ( |
|
5909 | + if (isset($_GET['keyword'])) { |
|
5910 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5911 | + $sql .= " AND ( |
|
5912 | 5912 | user.username LIKE '%".$keyword."%' OR |
5913 | 5913 | lastedit_type LIKE '%".$keyword."%' OR |
5914 | 5914 | tool LIKE '%".$keyword."%' |
5915 | 5915 | ) "; |
5916 | - } |
|
5916 | + } |
|
5917 | 5917 | |
5918 | - $sql .= " AND tool IN ( |
|
5918 | + $sql .= " AND tool IN ( |
|
5919 | 5919 | 'document', |
5920 | 5920 | 'learnpath', |
5921 | 5921 | 'quiz', |
@@ -5928,41 +5928,41 @@ discard block |
||
5928 | 5928 | 'thematic_plan' |
5929 | 5929 | )"; |
5930 | 5930 | |
5931 | - if ($column == 0) { |
|
5932 | - $column = '0'; |
|
5933 | - } |
|
5934 | - if ($column != '' && $direction != '') { |
|
5935 | - if ($column != 2 && $column != 4) { |
|
5936 | - $sql .= " ORDER BY col$column $direction"; |
|
5937 | - } |
|
5938 | - } else { |
|
5939 | - $sql .= " ORDER BY col5 DESC "; |
|
5940 | - } |
|
5931 | + if ($column == 0) { |
|
5932 | + $column = '0'; |
|
5933 | + } |
|
5934 | + if ($column != '' && $direction != '') { |
|
5935 | + if ($column != 2 && $column != 4) { |
|
5936 | + $sql .= " ORDER BY col$column $direction"; |
|
5937 | + } |
|
5938 | + } else { |
|
5939 | + $sql .= " ORDER BY col5 DESC "; |
|
5940 | + } |
|
5941 | 5941 | |
5942 | 5942 | $from = intval($from); |
5943 | 5943 | $number_of_items = intval($number_of_items); |
5944 | 5944 | |
5945 | - $sql .= " LIMIT $from, $number_of_items "; |
|
5946 | - |
|
5947 | - $res = Database::query($sql); |
|
5948 | - $resources = array(); |
|
5949 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5950 | - while ($row = Database::fetch_array($res)) { |
|
5951 | - $ref = $row['ref']; |
|
5952 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5953 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5945 | + $sql .= " LIMIT $from, $number_of_items "; |
|
5954 | 5946 | |
5955 | - $id = $table_name['id_tool']; |
|
5956 | - $recorset = false; |
|
5957 | - |
|
5958 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5959 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5960 | - $sql = "SELECT thematic_id FROM $table_tool |
|
5947 | + $res = Database::query($sql); |
|
5948 | + $resources = array(); |
|
5949 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5950 | + while ($row = Database::fetch_array($res)) { |
|
5951 | + $ref = $row['ref']; |
|
5952 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5953 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5954 | + |
|
5955 | + $id = $table_name['id_tool']; |
|
5956 | + $recorset = false; |
|
5957 | + |
|
5958 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5959 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5960 | + $sql = "SELECT thematic_id FROM $table_tool |
|
5961 | 5961 | WHERE c_id = $course_id AND id = $ref"; |
5962 | - $rs_thematic = Database::query($sql); |
|
5963 | - if (Database::num_rows($rs_thematic)) { |
|
5964 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
5965 | - $thematic_id = $row_thematic['thematic_id']; |
|
5962 | + $rs_thematic = Database::query($sql); |
|
5963 | + if (Database::num_rows($rs_thematic)) { |
|
5964 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
5965 | + $thematic_id = $row_thematic['thematic_id']; |
|
5966 | 5966 | |
5967 | 5967 | $sql = "SELECT session.id, session.name, user.username |
5968 | 5968 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5971,9 +5971,9 @@ discard block |
||
5971 | 5971 | t.session_id = session.id AND |
5972 | 5972 | session.id_coach = user.user_id AND |
5973 | 5973 | t.id = $thematic_id"; |
5974 | - $recorset = Database::query($sql); |
|
5975 | - } |
|
5976 | - } else { |
|
5974 | + $recorset = Database::query($sql); |
|
5975 | + } |
|
5976 | + } else { |
|
5977 | 5977 | $sql = "SELECT session.id, session.name, user.username |
5978 | 5978 | FROM $table_tool tool, $table_session session, $table_user user |
5979 | 5979 | WHERE |
@@ -5981,127 +5981,127 @@ discard block |
||
5981 | 5981 | tool.session_id = session.id AND |
5982 | 5982 | session.id_coach = user.user_id AND |
5983 | 5983 | tool.$id = $ref"; |
5984 | - $recorset = Database::query($sql); |
|
5985 | - } |
|
5986 | - |
|
5987 | - if (!empty($recorset)) { |
|
5988 | - $obj = Database::fetch_object($recorset); |
|
5989 | - |
|
5990 | - $name_session = ''; |
|
5991 | - $coach_name = ''; |
|
5992 | - if (!empty($obj)) { |
|
5993 | - $name_session = $obj->name; |
|
5994 | - $coach_name = $obj->username; |
|
5995 | - } |
|
5996 | - |
|
5997 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5998 | - $row[0] = ''; |
|
5999 | - if ($row['col6'] != 2) { |
|
6000 | - if (in_array($row['col0'], $thematic_tools)) { |
|
6001 | - |
|
6002 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
6003 | - $thematic_tool_title = ''; |
|
6004 | - if (is_array($exp_thematic_tool)) { |
|
6005 | - foreach ($exp_thematic_tool as $exp) { |
|
6006 | - $thematic_tool_title .= api_ucfirst($exp); |
|
6007 | - } |
|
6008 | - } else { |
|
6009 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
6010 | - } |
|
6011 | - |
|
6012 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
6013 | - } else { |
|
6014 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
6015 | - } |
|
6016 | - } else { |
|
6017 | - $row[0] = api_ucfirst($row['col0']); |
|
6018 | - } |
|
6019 | - $row[1] = get_lang($row[1]); |
|
6020 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
6021 | - $row[5] = ''; |
|
6022 | - //@todo Improve this code please |
|
6023 | - switch ($table_name['table_name']) { |
|
6024 | - case 'document' : |
|
6025 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5984 | + $recorset = Database::query($sql); |
|
5985 | + } |
|
5986 | + |
|
5987 | + if (!empty($recorset)) { |
|
5988 | + $obj = Database::fetch_object($recorset); |
|
5989 | + |
|
5990 | + $name_session = ''; |
|
5991 | + $coach_name = ''; |
|
5992 | + if (!empty($obj)) { |
|
5993 | + $name_session = $obj->name; |
|
5994 | + $coach_name = $obj->username; |
|
5995 | + } |
|
5996 | + |
|
5997 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5998 | + $row[0] = ''; |
|
5999 | + if ($row['col6'] != 2) { |
|
6000 | + if (in_array($row['col0'], $thematic_tools)) { |
|
6001 | + |
|
6002 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
6003 | + $thematic_tool_title = ''; |
|
6004 | + if (is_array($exp_thematic_tool)) { |
|
6005 | + foreach ($exp_thematic_tool as $exp) { |
|
6006 | + $thematic_tool_title .= api_ucfirst($exp); |
|
6007 | + } |
|
6008 | + } else { |
|
6009 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
6010 | + } |
|
6011 | + |
|
6012 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
6013 | + } else { |
|
6014 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
6015 | + } |
|
6016 | + } else { |
|
6017 | + $row[0] = api_ucfirst($row['col0']); |
|
6018 | + } |
|
6019 | + $row[1] = get_lang($row[1]); |
|
6020 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
6021 | + $row[5] = ''; |
|
6022 | + //@todo Improve this code please |
|
6023 | + switch ($table_name['table_name']) { |
|
6024 | + case 'document' : |
|
6025 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
6026 | 6026 | WHERE c_id = $course_id AND id = $ref"; |
6027 | - $rs_document = Database::query($sql); |
|
6028 | - $obj_document = Database::fetch_object($rs_document); |
|
6029 | - $row[5] = $obj_document->title; |
|
6027 | + $rs_document = Database::query($sql); |
|
6028 | + $obj_document = Database::fetch_object($rs_document); |
|
6029 | + $row[5] = $obj_document->title; |
|
6030 | 6030 | |
6031 | - break; |
|
6032 | - case 'announcement': |
|
6031 | + break; |
|
6032 | + case 'announcement': |
|
6033 | 6033 | $sql = "SELECT title FROM $table_tool |
6034 | 6034 | WHERE c_id = $course_id AND id = $ref"; |
6035 | - $rs_document = Database::query($sql); |
|
6036 | - $obj_document = Database::fetch_object($rs_document); |
|
6035 | + $rs_document = Database::query($sql); |
|
6036 | + $obj_document = Database::fetch_object($rs_document); |
|
6037 | 6037 | if ($obj_document) { |
6038 | 6038 | $row[5] = $obj_document->title; |
6039 | 6039 | } |
6040 | - break; |
|
6041 | - case 'glossary': |
|
6040 | + break; |
|
6041 | + case 'glossary': |
|
6042 | 6042 | $sql = "SELECT name FROM $table_tool |
6043 | 6043 | WHERE c_id = $course_id AND glossary_id = $ref"; |
6044 | - $rs_document = Database::query($sql); |
|
6045 | - $obj_document = Database::fetch_object($rs_document); |
|
6044 | + $rs_document = Database::query($sql); |
|
6045 | + $obj_document = Database::fetch_object($rs_document); |
|
6046 | 6046 | if ($obj_document) { |
6047 | 6047 | $row[5] = $obj_document->name; |
6048 | 6048 | } |
6049 | - break; |
|
6050 | - case 'lp': |
|
6049 | + break; |
|
6050 | + case 'lp': |
|
6051 | 6051 | $sql = "SELECT name |
6052 | 6052 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
6053 | - $rs_document = Database::query($sql); |
|
6054 | - $obj_document = Database::fetch_object($rs_document); |
|
6055 | - $row[5] = $obj_document->name; |
|
6056 | - break; |
|
6057 | - case 'quiz': |
|
6053 | + $rs_document = Database::query($sql); |
|
6054 | + $obj_document = Database::fetch_object($rs_document); |
|
6055 | + $row[5] = $obj_document->name; |
|
6056 | + break; |
|
6057 | + case 'quiz': |
|
6058 | 6058 | $sql = "SELECT title FROM $table_tool |
6059 | 6059 | WHERE c_id = $course_id AND id = $ref"; |
6060 | - $rs_document = Database::query($sql); |
|
6061 | - $obj_document = Database::fetch_object($rs_document); |
|
6060 | + $rs_document = Database::query($sql); |
|
6061 | + $obj_document = Database::fetch_object($rs_document); |
|
6062 | 6062 | if ($obj_document) { |
6063 | 6063 | $row[5] = $obj_document->title; |
6064 | 6064 | } |
6065 | - break; |
|
6066 | - case 'course_description': |
|
6065 | + break; |
|
6066 | + case 'course_description': |
|
6067 | 6067 | $sql = "SELECT title FROM $table_tool |
6068 | 6068 | WHERE c_id = $course_id AND id = $ref"; |
6069 | - $rs_document = Database::query($sql); |
|
6070 | - $obj_document = Database::fetch_object($rs_document); |
|
6069 | + $rs_document = Database::query($sql); |
|
6070 | + $obj_document = Database::fetch_object($rs_document); |
|
6071 | 6071 | if ($obj_document) { |
6072 | 6072 | $row[5] = $obj_document->title; |
6073 | 6073 | } |
6074 | - break; |
|
6075 | - case 'thematic': |
|
6076 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6077 | - if (Database::num_rows($rs) > 0) { |
|
6078 | - $obj = Database::fetch_object($rs); |
|
6079 | - $row[5] = $obj->title; |
|
6080 | - } |
|
6081 | - break; |
|
6082 | - case 'thematic_advance': |
|
6083 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6084 | - if (Database::num_rows($rs) > 0) { |
|
6085 | - $obj = Database::fetch_object($rs); |
|
6086 | - $row[5] = $obj->content; |
|
6087 | - } |
|
6088 | - break; |
|
6089 | - case 'thematic_plan': |
|
6090 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6091 | - if (Database::num_rows($rs) > 0) { |
|
6092 | - $obj = Database::fetch_object($rs); |
|
6093 | - $row[5] = $obj->title; |
|
6094 | - } |
|
6095 | - break; |
|
6096 | - default: |
|
6097 | - break; |
|
6098 | - } |
|
6099 | - |
|
6100 | - $row2 = $name_session; |
|
6101 | - if (!empty($coach_name)) { |
|
6102 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6103 | - } |
|
6104 | - $row[2] = $row2; |
|
6074 | + break; |
|
6075 | + case 'thematic': |
|
6076 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6077 | + if (Database::num_rows($rs) > 0) { |
|
6078 | + $obj = Database::fetch_object($rs); |
|
6079 | + $row[5] = $obj->title; |
|
6080 | + } |
|
6081 | + break; |
|
6082 | + case 'thematic_advance': |
|
6083 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6084 | + if (Database::num_rows($rs) > 0) { |
|
6085 | + $obj = Database::fetch_object($rs); |
|
6086 | + $row[5] = $obj->content; |
|
6087 | + } |
|
6088 | + break; |
|
6089 | + case 'thematic_plan': |
|
6090 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6091 | + if (Database::num_rows($rs) > 0) { |
|
6092 | + $obj = Database::fetch_object($rs); |
|
6093 | + $row[5] = $obj->title; |
|
6094 | + } |
|
6095 | + break; |
|
6096 | + default: |
|
6097 | + break; |
|
6098 | + } |
|
6099 | + |
|
6100 | + $row2 = $name_session; |
|
6101 | + if (!empty($coach_name)) { |
|
6102 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6103 | + } |
|
6104 | + $row[2] = $row2; |
|
6105 | 6105 | if (!empty($row['col3'])) { |
6106 | 6106 | $userInfo = api_get_user_info($row['user_id']); |
6107 | 6107 | |
@@ -6118,11 +6118,11 @@ discard block |
||
6118 | 6118 | $row[4] = $ip; |
6119 | 6119 | } |
6120 | 6120 | |
6121 | - $resources[] = $row; |
|
6122 | - } |
|
6123 | - } |
|
6121 | + $resources[] = $row; |
|
6122 | + } |
|
6123 | + } |
|
6124 | 6124 | |
6125 | - return $resources; |
|
6125 | + return $resources; |
|
6126 | 6126 | } |
6127 | 6127 | |
6128 | 6128 | /** |
@@ -6132,63 +6132,63 @@ discard block |
||
6132 | 6132 | */ |
6133 | 6133 | public static function get_tool_name_table($tool) |
6134 | 6134 | { |
6135 | - switch ($tool) { |
|
6136 | - case 'document': |
|
6137 | - $table_name = TABLE_DOCUMENT; |
|
6138 | - $link_tool = 'document/document.php'; |
|
6139 | - $id_tool = 'id'; |
|
6140 | - break; |
|
6141 | - case 'learnpath': |
|
6142 | - $table_name = TABLE_LP_MAIN; |
|
6143 | - $link_tool = 'newscorm/lp_controller.php'; |
|
6144 | - $id_tool = 'id'; |
|
6145 | - break; |
|
6146 | - case 'quiz': |
|
6147 | - $table_name = TABLE_QUIZ_TEST; |
|
6148 | - $link_tool = 'exercice/exercice.php'; |
|
6149 | - $id_tool = 'id'; |
|
6150 | - break; |
|
6151 | - case 'glossary': |
|
6152 | - $table_name = TABLE_GLOSSARY; |
|
6153 | - $link_tool = 'glossary/index.php'; |
|
6154 | - $id_tool = 'glossary_id'; |
|
6155 | - break; |
|
6156 | - case 'link': |
|
6157 | - $table_name = TABLE_LINK; |
|
6158 | - $link_tool = 'link/link.php'; |
|
6159 | - $id_tool = 'id'; |
|
6160 | - break; |
|
6161 | - case 'course_description': |
|
6162 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6163 | - $link_tool = 'course_description/'; |
|
6164 | - $id_tool = 'id'; |
|
6165 | - break; |
|
6166 | - case 'announcement': |
|
6167 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6168 | - $link_tool = 'announcements/announcements.php'; |
|
6169 | - $id_tool = 'id'; |
|
6170 | - break; |
|
6171 | - case 'thematic': |
|
6172 | - $table_name = TABLE_THEMATIC; |
|
6173 | - $link_tool = 'course_progress/index.php'; |
|
6174 | - $id_tool = 'id'; |
|
6175 | - break; |
|
6176 | - case 'thematic_advance': |
|
6177 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6178 | - $link_tool = 'course_progress/index.php'; |
|
6179 | - $id_tool = 'id'; |
|
6180 | - break; |
|
6181 | - case 'thematic_plan': |
|
6182 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6183 | - $link_tool = 'course_progress/index.php'; |
|
6184 | - $id_tool = 'id'; |
|
6185 | - break; |
|
6186 | - default: |
|
6187 | - $table_name = $tool; |
|
6188 | - break; |
|
6189 | - } |
|
6190 | - |
|
6191 | - return array( |
|
6135 | + switch ($tool) { |
|
6136 | + case 'document': |
|
6137 | + $table_name = TABLE_DOCUMENT; |
|
6138 | + $link_tool = 'document/document.php'; |
|
6139 | + $id_tool = 'id'; |
|
6140 | + break; |
|
6141 | + case 'learnpath': |
|
6142 | + $table_name = TABLE_LP_MAIN; |
|
6143 | + $link_tool = 'newscorm/lp_controller.php'; |
|
6144 | + $id_tool = 'id'; |
|
6145 | + break; |
|
6146 | + case 'quiz': |
|
6147 | + $table_name = TABLE_QUIZ_TEST; |
|
6148 | + $link_tool = 'exercice/exercice.php'; |
|
6149 | + $id_tool = 'id'; |
|
6150 | + break; |
|
6151 | + case 'glossary': |
|
6152 | + $table_name = TABLE_GLOSSARY; |
|
6153 | + $link_tool = 'glossary/index.php'; |
|
6154 | + $id_tool = 'glossary_id'; |
|
6155 | + break; |
|
6156 | + case 'link': |
|
6157 | + $table_name = TABLE_LINK; |
|
6158 | + $link_tool = 'link/link.php'; |
|
6159 | + $id_tool = 'id'; |
|
6160 | + break; |
|
6161 | + case 'course_description': |
|
6162 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6163 | + $link_tool = 'course_description/'; |
|
6164 | + $id_tool = 'id'; |
|
6165 | + break; |
|
6166 | + case 'announcement': |
|
6167 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6168 | + $link_tool = 'announcements/announcements.php'; |
|
6169 | + $id_tool = 'id'; |
|
6170 | + break; |
|
6171 | + case 'thematic': |
|
6172 | + $table_name = TABLE_THEMATIC; |
|
6173 | + $link_tool = 'course_progress/index.php'; |
|
6174 | + $id_tool = 'id'; |
|
6175 | + break; |
|
6176 | + case 'thematic_advance': |
|
6177 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6178 | + $link_tool = 'course_progress/index.php'; |
|
6179 | + $id_tool = 'id'; |
|
6180 | + break; |
|
6181 | + case 'thematic_plan': |
|
6182 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6183 | + $link_tool = 'course_progress/index.php'; |
|
6184 | + $id_tool = 'id'; |
|
6185 | + break; |
|
6186 | + default: |
|
6187 | + $table_name = $tool; |
|
6188 | + break; |
|
6189 | + } |
|
6190 | + |
|
6191 | + return array( |
|
6192 | 6192 | 'table_name' => $table_name, |
6193 | 6193 | 'link_tool' => $link_tool, |
6194 | 6194 | 'id_tool' => $id_tool |
@@ -6197,45 +6197,45 @@ discard block |
||
6197 | 6197 | |
6198 | 6198 | public static function display_additional_profile_fields() |
6199 | 6199 | { |
6200 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6201 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6202 | - |
|
6203 | - // creating the form |
|
6204 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6205 | - |
|
6206 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6207 | - // the information the users have entered or selected. |
|
6208 | - $return .= '<select name="additional_profile_field">'; |
|
6209 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6210 | - $extra_fields_to_show = 0; |
|
6211 | - foreach ($extra_fields as $key=>$field) { |
|
6212 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6213 | - if ($field[6]==1 && $field[8] == 1) { |
|
6214 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6215 | - $selected = 'selected="selected"'; |
|
6216 | - } else { |
|
6217 | - $selected = ''; |
|
6218 | - } |
|
6219 | - $extra_fields_to_show++; |
|
6220 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6221 | - } |
|
6222 | - } |
|
6223 | - $return .= '</select>'; |
|
6224 | - |
|
6225 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6226 | - foreach ($_GET as $key=>$value){ |
|
6227 | - if ($key <> 'additional_profile_field') { |
|
6228 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6229 | - } |
|
6230 | - } |
|
6231 | - // the submit button |
|
6232 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6233 | - $return .= '</form>'; |
|
6234 | - if ($extra_fields_to_show > 0) { |
|
6235 | - return $return; |
|
6236 | - } else { |
|
6237 | - return ''; |
|
6238 | - } |
|
6200 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6201 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6202 | + |
|
6203 | + // creating the form |
|
6204 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6205 | + |
|
6206 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6207 | + // the information the users have entered or selected. |
|
6208 | + $return .= '<select name="additional_profile_field">'; |
|
6209 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6210 | + $extra_fields_to_show = 0; |
|
6211 | + foreach ($extra_fields as $key=>$field) { |
|
6212 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6213 | + if ($field[6]==1 && $field[8] == 1) { |
|
6214 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6215 | + $selected = 'selected="selected"'; |
|
6216 | + } else { |
|
6217 | + $selected = ''; |
|
6218 | + } |
|
6219 | + $extra_fields_to_show++; |
|
6220 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6221 | + } |
|
6222 | + } |
|
6223 | + $return .= '</select>'; |
|
6224 | + |
|
6225 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6226 | + foreach ($_GET as $key=>$value){ |
|
6227 | + if ($key <> 'additional_profile_field') { |
|
6228 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6229 | + } |
|
6230 | + } |
|
6231 | + // the submit button |
|
6232 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6233 | + $return .= '</form>'; |
|
6234 | + if ($extra_fields_to_show > 0) { |
|
6235 | + return $return; |
|
6236 | + } else { |
|
6237 | + return ''; |
|
6238 | + } |
|
6239 | 6239 | } |
6240 | 6240 | |
6241 | 6241 | /** |
@@ -6254,31 +6254,31 @@ discard block |
||
6254 | 6254 | */ |
6255 | 6255 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6256 | 6256 | { |
6257 | - // Database table definition |
|
6258 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6259 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6257 | + // Database table definition |
|
6258 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6259 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6260 | 6260 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6261 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6262 | - |
|
6263 | - if (!empty($users)) { |
|
6264 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6265 | - foreach($users as $user_id) { |
|
6266 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6267 | - $tag_list = array(); |
|
6268 | - foreach($user_result as $item) { |
|
6269 | - $tag_list[] = $item['tag']; |
|
6270 | - } |
|
6271 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6272 | - } |
|
6273 | - } else { |
|
6274 | - $new_user_array = array(); |
|
6275 | - foreach ($users as $user_id) { |
|
6276 | - $new_user_array[]= "'".$user_id."'"; |
|
6277 | - } |
|
6278 | - $users = implode(',',$new_user_array); |
|
6261 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6262 | + |
|
6263 | + if (!empty($users)) { |
|
6264 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6265 | + foreach($users as $user_id) { |
|
6266 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6267 | + $tag_list = array(); |
|
6268 | + foreach($user_result as $item) { |
|
6269 | + $tag_list[] = $item['tag']; |
|
6270 | + } |
|
6271 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6272 | + } |
|
6273 | + } else { |
|
6274 | + $new_user_array = array(); |
|
6275 | + foreach ($users as $user_id) { |
|
6276 | + $new_user_array[]= "'".$user_id."'"; |
|
6277 | + } |
|
6278 | + $users = implode(',',$new_user_array); |
|
6279 | 6279 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6280 | - // Selecting only the necessary information NOT ALL the user list |
|
6281 | - $sql = "SELECT user.user_id, v.value |
|
6280 | + // Selecting only the necessary information NOT ALL the user list |
|
6281 | + $sql = "SELECT user.user_id, v.value |
|
6282 | 6282 | FROM $table_user user |
6283 | 6283 | INNER JOIN $table_user_field_values v |
6284 | 6284 | ON (user.user_id = v.item_id) |
@@ -6289,27 +6289,27 @@ discard block |
||
6289 | 6289 | v.field_id=".intval($field_id)." AND |
6290 | 6290 | user.user_id IN ($users)"; |
6291 | 6291 | |
6292 | - $result = Database::query($sql); |
|
6293 | - while($row = Database::fetch_array($result)) { |
|
6294 | - // get option value for field type double select by id |
|
6295 | - if (!empty($row['value'])) { |
|
6296 | - if ($result_extra_field['field_type'] == |
|
6292 | + $result = Database::query($sql); |
|
6293 | + while($row = Database::fetch_array($result)) { |
|
6294 | + // get option value for field type double select by id |
|
6295 | + if (!empty($row['value'])) { |
|
6296 | + if ($result_extra_field['field_type'] == |
|
6297 | 6297 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6298 | 6298 | ) { |
6299 | - $id_double_select = explode(';', $row['value']); |
|
6300 | - if (is_array($id_double_select)) { |
|
6301 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6302 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6303 | - $row['value'] = ($value1.';'.$value2); |
|
6304 | - } |
|
6305 | - } |
|
6306 | - } |
|
6307 | - // get other value from extra field |
|
6308 | - $return[$row['user_id']][] = $row['value']; |
|
6309 | - } |
|
6310 | - } |
|
6311 | - } |
|
6312 | - return $return; |
|
6299 | + $id_double_select = explode(';', $row['value']); |
|
6300 | + if (is_array($id_double_select)) { |
|
6301 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6302 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6303 | + $row['value'] = ($value1.';'.$value2); |
|
6304 | + } |
|
6305 | + } |
|
6306 | + } |
|
6307 | + // get other value from extra field |
|
6308 | + $return[$row['user_id']][] = $row['value']; |
|
6309 | + } |
|
6310 | + } |
|
6311 | + } |
|
6312 | + return $return; |
|
6313 | 6313 | } |
6314 | 6314 | |
6315 | 6315 | /** |
@@ -6318,18 +6318,18 @@ discard block |
||
6318 | 6318 | */ |
6319 | 6319 | public function count_student_in_course() |
6320 | 6320 | { |
6321 | - global $nbStudents; |
|
6322 | - return $nbStudents; |
|
6321 | + global $nbStudents; |
|
6322 | + return $nbStudents; |
|
6323 | 6323 | } |
6324 | 6324 | |
6325 | 6325 | public function sort_users($a, $b) |
6326 | 6326 | { |
6327 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6327 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6328 | 6328 | } |
6329 | 6329 | |
6330 | 6330 | public function sort_users_desc($a, $b) |
6331 | 6331 | { |
6332 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6332 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6333 | 6333 | } |
6334 | 6334 | |
6335 | 6335 | /** |
@@ -6338,8 +6338,8 @@ discard block |
||
6338 | 6338 | */ |
6339 | 6339 | public static function get_number_of_users() |
6340 | 6340 | { |
6341 | - global $user_ids; |
|
6342 | - return count($user_ids); |
|
6341 | + global $user_ids; |
|
6342 | + return count($user_ids); |
|
6343 | 6343 | } |
6344 | 6344 | |
6345 | 6345 | /** |
@@ -6355,37 +6355,37 @@ discard block |
||
6355 | 6355 | { |
6356 | 6356 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6357 | 6357 | |
6358 | - $course_code = Database::escape_string($course_code); |
|
6359 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6360 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6358 | + $course_code = Database::escape_string($course_code); |
|
6359 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6360 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6361 | 6361 | |
6362 | - $access_url_id = api_get_current_access_url_id(); |
|
6362 | + $access_url_id = api_get_current_access_url_id(); |
|
6363 | 6363 | |
6364 | - // get all users data from a course for sortable with limit |
|
6365 | - if (is_array($user_ids)) { |
|
6366 | - $user_ids = array_map('intval', $user_ids); |
|
6367 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6368 | - } else { |
|
6369 | - $user_ids = intval($user_ids); |
|
6370 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6371 | - } |
|
6364 | + // get all users data from a course for sortable with limit |
|
6365 | + if (is_array($user_ids)) { |
|
6366 | + $user_ids = array_map('intval', $user_ids); |
|
6367 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6368 | + } else { |
|
6369 | + $user_ids = intval($user_ids); |
|
6370 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6371 | + } |
|
6372 | 6372 | |
6373 | - if (!empty($_GET['user_keyword'])) { |
|
6374 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6375 | - $condition_user .= " AND ( |
|
6373 | + if (!empty($_GET['user_keyword'])) { |
|
6374 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6375 | + $condition_user .= " AND ( |
|
6376 | 6376 | user.firstname LIKE '%".$keyword."%' OR |
6377 | 6377 | user.lastname LIKE '%".$keyword."%' OR |
6378 | 6378 | user.username LIKE '%".$keyword."%' OR |
6379 | 6379 | user.email LIKE '%".$keyword."%' |
6380 | 6380 | ) "; |
6381 | - } |
|
6381 | + } |
|
6382 | 6382 | |
6383 | 6383 | $url_table = null; |
6384 | 6384 | $url_condition = null; |
6385 | - if (api_is_multiple_url_enabled()) { |
|
6386 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6387 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6388 | - } |
|
6385 | + if (api_is_multiple_url_enabled()) { |
|
6386 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6387 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6388 | + } |
|
6389 | 6389 | |
6390 | 6390 | $invitedUsersCondition = ''; |
6391 | 6391 | |
@@ -6393,7 +6393,7 @@ discard block |
||
6393 | 6393 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6394 | 6394 | } |
6395 | 6395 | |
6396 | - $sql = "SELECT user.user_id as user_id, |
|
6396 | + $sql = "SELECT user.user_id as user_id, |
|
6397 | 6397 | user.official_code as col0, |
6398 | 6398 | user.lastname as col1, |
6399 | 6399 | user.firstname as col2, |
@@ -6401,17 +6401,17 @@ discard block |
||
6401 | 6401 | FROM $tbl_user as user $url_table |
6402 | 6402 | $condition_user $url_condition $invitedUsersCondition"; |
6403 | 6403 | |
6404 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6405 | - $direction = 'ASC'; |
|
6406 | - } |
|
6404 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6405 | + $direction = 'ASC'; |
|
6406 | + } |
|
6407 | 6407 | |
6408 | - $column = intval($column); |
|
6408 | + $column = intval($column); |
|
6409 | 6409 | |
6410 | - $from = intval($from); |
|
6411 | - $number_of_items = intval($number_of_items); |
|
6410 | + $from = intval($from); |
|
6411 | + $number_of_items = intval($number_of_items); |
|
6412 | 6412 | |
6413 | - $sql .= " ORDER BY col$column $direction "; |
|
6414 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6413 | + $sql .= " ORDER BY col$column $direction "; |
|
6414 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6415 | 6415 | |
6416 | 6416 | $res = Database::query($sql); |
6417 | 6417 | $users = array(); |
@@ -6445,7 +6445,7 @@ discard block |
||
6445 | 6445 | } |
6446 | 6446 | } |
6447 | 6447 | |
6448 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6448 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6449 | 6449 | $courseInfo = api_get_course_info($course_code); |
6450 | 6450 | $courseId = $courseInfo['real_id']; |
6451 | 6451 | |
@@ -6476,10 +6476,10 @@ discard block |
||
6476 | 6476 | $session_id |
6477 | 6477 | ); |
6478 | 6478 | |
6479 | - if (empty($avg_student_progress)) { |
|
6479 | + if (empty($avg_student_progress)) { |
|
6480 | 6480 | $avg_student_progress = 0; |
6481 | - } |
|
6482 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6481 | + } |
|
6482 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6483 | 6483 | |
6484 | 6484 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6485 | 6485 | $total_exercises, |
@@ -6499,11 +6499,11 @@ discard block |
||
6499 | 6499 | |
6500 | 6500 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6501 | 6501 | |
6502 | - if (is_numeric($avg_student_score)) { |
|
6503 | - $user['student_score'] = $avg_student_score.'%'; |
|
6504 | - } else { |
|
6505 | - $user['student_score'] = $avg_student_score; |
|
6506 | - } |
|
6502 | + if (is_numeric($avg_student_score)) { |
|
6503 | + $user['student_score'] = $avg_student_score.'%'; |
|
6504 | + } else { |
|
6505 | + $user['student_score'] = $avg_student_score; |
|
6506 | + } |
|
6507 | 6507 | |
6508 | 6508 | $user['count_assignments'] = Tracking::count_student_assignments( |
6509 | 6509 | $user['user_id'], |
@@ -6526,29 +6526,29 @@ discard block |
||
6526 | 6526 | $session_id |
6527 | 6527 | ); |
6528 | 6528 | |
6529 | - // we need to display an additional profile field |
|
6530 | - $user['additional'] = ''; |
|
6529 | + // we need to display an additional profile field |
|
6530 | + $user['additional'] = ''; |
|
6531 | 6531 | |
6532 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6533 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6532 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6533 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6534 | 6534 | is_array($additional_user_profile_info[$user['user_id']]) |
6535 | 6535 | ) { |
6536 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6537 | - } |
|
6538 | - } |
|
6536 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6537 | + } |
|
6538 | + } |
|
6539 | 6539 | |
6540 | 6540 | if (empty($session_id)) { |
6541 | 6541 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6542 | 6542 | } |
6543 | 6543 | |
6544 | - $user['link'] = '<center> |
|
6544 | + $user['link'] = '<center> |
|
6545 | 6545 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6546 | 6546 | '.Display::return_icon('2rightarrow.png').' |
6547 | 6547 | </a> |
6548 | 6548 | </center>'; |
6549 | 6549 | |
6550 | - // store columns in array $users |
|
6551 | - $is_western_name_order = api_is_western_name_order(); |
|
6550 | + // store columns in array $users |
|
6551 | + $is_western_name_order = api_is_western_name_order(); |
|
6552 | 6552 | $user_row = array(); |
6553 | 6553 | $user_row[]= $user['official_code']; //0 |
6554 | 6554 | if ($is_western_name_order) { |
@@ -6584,21 +6584,21 @@ discard block |
||
6584 | 6584 | |
6585 | 6585 | $users[] = $user_row; |
6586 | 6586 | |
6587 | - if ($export_csv) { |
|
6588 | - if (empty($session_id)) { |
|
6587 | + if ($export_csv) { |
|
6588 | + if (empty($session_id)) { |
|
6589 | 6589 | $user_row = array_map('strip_tags', $user_row); |
6590 | - unset($user_row[14]); |
|
6591 | - unset($user_row[15]); |
|
6590 | + unset($user_row[14]); |
|
6591 | + unset($user_row[15]); |
|
6592 | 6592 | } else { |
6593 | 6593 | $user_row = array_map('strip_tags', $user_row); |
6594 | 6594 | unset($user_row[13]); |
6595 | 6595 | unset($user_row[14]); |
6596 | 6596 | } |
6597 | 6597 | |
6598 | - $csv_content[] = $user_row; |
|
6599 | - } |
|
6600 | - } |
|
6601 | - return $users; |
|
6598 | + $csv_content[] = $user_row; |
|
6599 | + } |
|
6600 | + } |
|
6601 | + return $users; |
|
6602 | 6602 | } |
6603 | 6603 | } |
6604 | 6604 | |
@@ -6616,18 +6616,18 @@ discard block |
||
6616 | 6616 | */ |
6617 | 6617 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6618 | 6618 | { |
6619 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6620 | - |
|
6621 | - // protected data |
|
6622 | - $user_id = intval($user_id); |
|
6623 | - $session_id = intval($session_id); |
|
6624 | - $course_id = Database::escape_string($course_id); |
|
6625 | - |
|
6626 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6627 | - $tempView = $view; |
|
6628 | - if(substr($view,0,1) == '1') { |
|
6629 | - $new_view = substr_replace($view,'0',0,1); |
|
6630 | - echo " |
|
6619 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6620 | + |
|
6621 | + // protected data |
|
6622 | + $user_id = intval($user_id); |
|
6623 | + $session_id = intval($session_id); |
|
6624 | + $course_id = Database::escape_string($course_id); |
|
6625 | + |
|
6626 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6627 | + $tempView = $view; |
|
6628 | + if(substr($view,0,1) == '1') { |
|
6629 | + $new_view = substr_replace($view,'0',0,1); |
|
6630 | + echo " |
|
6631 | 6631 | <tr> |
6632 | 6632 | <td valign='top'> |
6633 | 6633 | <font color='#0000FF'>- </font>" . |
@@ -6635,9 +6635,9 @@ discard block |
||
6635 | 6635 | </td> |
6636 | 6636 | </tr> |
6637 | 6637 | "; |
6638 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6638 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6639 | 6639 | |
6640 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6640 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6641 | 6641 | FROM $track_access_table |
6642 | 6642 | WHERE access_user_id = $user_id |
6643 | 6643 | AND c_id = $course_id |
@@ -6645,11 +6645,11 @@ discard block |
||
6645 | 6645 | GROUP BY YEAR(access_date),MONTH(access_date) |
6646 | 6646 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6647 | 6647 | |
6648 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6649 | - $results = getManyResults3Col($sql); |
|
6648 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6649 | + $results = getManyResults3Col($sql); |
|
6650 | 6650 | |
6651 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6652 | - echo "<tr> |
|
6651 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6652 | + echo "<tr> |
|
6653 | 6653 | <td class='secLine'> |
6654 | 6654 | ".get_lang('LoginsTitleMonthColumn')." |
6655 | 6655 | </td> |
@@ -6657,36 +6657,36 @@ discard block |
||
6657 | 6657 | ".get_lang('LoginsTitleCountColumn')." |
6658 | 6658 | </td> |
6659 | 6659 | </tr>"; |
6660 | - $total = 0; |
|
6661 | - if (is_array($results)) { |
|
6662 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6663 | - echo "<tr>"; |
|
6664 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6665 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6666 | - echo"</tr>"; |
|
6667 | - $total = $total + $results[$j][1]; |
|
6668 | - } |
|
6669 | - echo "<tr>"; |
|
6670 | - echo "<td>".get_lang('Total')."</td>"; |
|
6671 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6672 | - echo"</tr>"; |
|
6673 | - } else { |
|
6674 | - echo "<tr>"; |
|
6675 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6676 | - echo"</tr>"; |
|
6677 | - } |
|
6678 | - echo "</table>"; |
|
6679 | - echo "</td></tr>"; |
|
6680 | - } else { |
|
6681 | - $new_view = substr_replace($view,'1',0,1); |
|
6682 | - echo " |
|
6660 | + $total = 0; |
|
6661 | + if (is_array($results)) { |
|
6662 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6663 | + echo "<tr>"; |
|
6664 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6665 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6666 | + echo"</tr>"; |
|
6667 | + $total = $total + $results[$j][1]; |
|
6668 | + } |
|
6669 | + echo "<tr>"; |
|
6670 | + echo "<td>".get_lang('Total')."</td>"; |
|
6671 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6672 | + echo"</tr>"; |
|
6673 | + } else { |
|
6674 | + echo "<tr>"; |
|
6675 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6676 | + echo"</tr>"; |
|
6677 | + } |
|
6678 | + echo "</table>"; |
|
6679 | + echo "</td></tr>"; |
|
6680 | + } else { |
|
6681 | + $new_view = substr_replace($view,'1',0,1); |
|
6682 | + echo " |
|
6683 | 6683 | <tr> |
6684 | 6684 | <td valign='top'> |
6685 | 6685 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6686 | 6686 | </td> |
6687 | 6687 | </tr> |
6688 | 6688 | "; |
6689 | - } |
|
6689 | + } |
|
6690 | 6690 | } |
6691 | 6691 | |
6692 | 6692 | /** |
@@ -6699,38 +6699,38 @@ discard block |
||
6699 | 6699 | */ |
6700 | 6700 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
6701 | 6701 | { |
6702 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6702 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6703 | 6703 | $courseId = api_get_course_int_id($courseCode); |
6704 | - if(substr($view,1,1) == '1') { |
|
6705 | - $new_view = substr_replace($view,'0',1,1); |
|
6706 | - echo "<tr> |
|
6704 | + if(substr($view,1,1) == '1') { |
|
6705 | + $new_view = substr_replace($view,'0',1,1); |
|
6706 | + echo "<tr> |
|
6707 | 6707 | <td valign='top'> |
6708 | 6708 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
6709 | 6709 | </td> |
6710 | 6710 | </tr>"; |
6711 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6711 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6712 | 6712 | |
6713 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6713 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6714 | 6714 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6715 | 6715 | WHERE te.c_id = $courseId |
6716 | 6716 | AND te.exe_user_id = ".intval($user_id)." |
6717 | 6717 | AND te.exe_exo_id = ce.id |
6718 | 6718 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6719 | 6719 | |
6720 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6720 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6721 | 6721 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6722 | 6722 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6723 | 6723 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6724 | 6724 | |
6725 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6725 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6726 | 6726 | |
6727 | - $NoTestRes = 0; |
|
6728 | - $NoHPTestRes = 0; |
|
6727 | + $NoTestRes = 0; |
|
6728 | + $NoHPTestRes = 0; |
|
6729 | 6729 | |
6730 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6731 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6732 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6733 | - echo " |
|
6730 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6731 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6732 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6733 | + echo " |
|
6734 | 6734 | <tr bgcolor='#E6E6E6'> |
6735 | 6735 | <td> |
6736 | 6736 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6743,28 +6743,28 @@ discard block |
||
6743 | 6743 | </td> |
6744 | 6744 | </tr>"; |
6745 | 6745 | |
6746 | - if (is_array($results)) { |
|
6747 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6748 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6749 | - echo "<tr>\n"; |
|
6750 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6751 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6752 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6753 | - echo "</tr>\n"; |
|
6754 | - } |
|
6755 | - } else { |
|
6756 | - // istvan begin |
|
6757 | - $NoTestRes = 1; |
|
6758 | - } |
|
6759 | - |
|
6760 | - // The Result of Tests |
|
6761 | - if (is_array($hpresults)) { |
|
6762 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6763 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6764 | - if ($title == '') |
|
6765 | - $title = basename($hpresults[$i][0]); |
|
6766 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6767 | - ?> |
|
6746 | + if (is_array($results)) { |
|
6747 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6748 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6749 | + echo "<tr>\n"; |
|
6750 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6751 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6752 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6753 | + echo "</tr>\n"; |
|
6754 | + } |
|
6755 | + } else { |
|
6756 | + // istvan begin |
|
6757 | + $NoTestRes = 1; |
|
6758 | + } |
|
6759 | + |
|
6760 | + // The Result of Tests |
|
6761 | + if (is_array($hpresults)) { |
|
6762 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6763 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6764 | + if ($title == '') |
|
6765 | + $title = basename($hpresults[$i][0]); |
|
6766 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6767 | + ?> |
|
6768 | 6768 | <tr> |
6769 | 6769 | <td class="content"><?php echo $title; ?></td> |
6770 | 6770 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6774,26 +6774,26 @@ discard block |
||
6774 | 6774 | |
6775 | 6775 | <?php |
6776 | 6776 | } |
6777 | - } else { |
|
6778 | - $NoHPTestRes = 1; |
|
6779 | - } |
|
6780 | - |
|
6781 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6782 | - echo "<tr>\n"; |
|
6783 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6784 | - echo "</tr>\n"; |
|
6785 | - } |
|
6786 | - echo "</table>"; |
|
6787 | - echo "</td>\n</tr>\n"; |
|
6788 | - } else { |
|
6789 | - $new_view = substr_replace($view,'1',1,1); |
|
6790 | - echo " |
|
6777 | + } else { |
|
6778 | + $NoHPTestRes = 1; |
|
6779 | + } |
|
6780 | + |
|
6781 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6782 | + echo "<tr>\n"; |
|
6783 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6784 | + echo "</tr>\n"; |
|
6785 | + } |
|
6786 | + echo "</table>"; |
|
6787 | + echo "</td>\n</tr>\n"; |
|
6788 | + } else { |
|
6789 | + $new_view = substr_replace($view,'1',1,1); |
|
6790 | + echo " |
|
6791 | 6791 | <tr> |
6792 | 6792 | <td valign='top'> |
6793 | 6793 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6794 | 6794 | </td> |
6795 | 6795 | </tr>"; |
6796 | - } |
|
6796 | + } |
|
6797 | 6797 | } |
6798 | 6798 | |
6799 | 6799 | /** |
@@ -6802,27 +6802,27 @@ discard block |
||
6802 | 6802 | */ |
6803 | 6803 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
6804 | 6804 | { |
6805 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6805 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6806 | 6806 | $_course = api_get_course_info_by_id($course_id); |
6807 | 6807 | |
6808 | - if (substr($view,2,1) == '1') { |
|
6809 | - $new_view = substr_replace($view,'0',2,1); |
|
6810 | - echo "<tr> |
|
6808 | + if (substr($view,2,1) == '1') { |
|
6809 | + $new_view = substr_replace($view,'0',2,1); |
|
6810 | + echo "<tr> |
|
6811 | 6811 | <td valign='top'> |
6812 | 6812 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
6813 | 6813 | </td> |
6814 | 6814 | </tr>"; |
6815 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6816 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6815 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6816 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6817 | 6817 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6818 | 6818 | WHERE u.upload_work_id = w.id |
6819 | 6819 | AND u.upload_user_id = '".intval($user_id)."' |
6820 | 6820 | AND u.c_id = '".intval($course_id)."' |
6821 | 6821 | ORDER BY u.upload_date DESC"; |
6822 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6823 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6824 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6825 | - echo "<tr> |
|
6822 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6823 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6824 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6825 | + echo "<tr> |
|
6826 | 6826 | <td class='secLine' width='40%'> |
6827 | 6827 | ".get_lang('WorkTitle')." |
6828 | 6828 | </td> |
@@ -6833,35 +6833,35 @@ discard block |
||
6833 | 6833 | ".get_lang('Date')." |
6834 | 6834 | </td> |
6835 | 6835 | </tr>"; |
6836 | - if (is_array($results)) { |
|
6837 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6838 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6839 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6840 | - echo "<tr>"; |
|
6841 | - echo "<td class='content'>" |
|
6842 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6843 | - ."</td>"; |
|
6844 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6845 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6846 | - echo"</tr>"; |
|
6847 | - } |
|
6848 | - } else { |
|
6849 | - echo "<tr>"; |
|
6850 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6851 | - echo"</tr>"; |
|
6852 | - } |
|
6853 | - echo "</table>"; |
|
6854 | - echo "</td></tr>"; |
|
6855 | - } else { |
|
6856 | - $new_view = substr_replace($view,'1',2,1); |
|
6857 | - echo " |
|
6836 | + if (is_array($results)) { |
|
6837 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6838 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6839 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6840 | + echo "<tr>"; |
|
6841 | + echo "<td class='content'>" |
|
6842 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6843 | + ."</td>"; |
|
6844 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6845 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6846 | + echo"</tr>"; |
|
6847 | + } |
|
6848 | + } else { |
|
6849 | + echo "<tr>"; |
|
6850 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6851 | + echo"</tr>"; |
|
6852 | + } |
|
6853 | + echo "</table>"; |
|
6854 | + echo "</td></tr>"; |
|
6855 | + } else { |
|
6856 | + $new_view = substr_replace($view,'1',2,1); |
|
6857 | + echo " |
|
6858 | 6858 | <tr> |
6859 | 6859 | <td valign='top'> |
6860 | 6860 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
6861 | 6861 | </td> |
6862 | 6862 | </tr> |
6863 | 6863 | "; |
6864 | - } |
|
6864 | + } |
|
6865 | 6865 | } |
6866 | 6866 | |
6867 | 6867 | /** |
@@ -6870,55 +6870,55 @@ discard block |
||
6870 | 6870 | */ |
6871 | 6871 | public function display_links_tracking_info($view, $user_id, $courseCode) |
6872 | 6872 | { |
6873 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6873 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6874 | 6874 | $courseId = api_get_course_int_id($courseCode); |
6875 | - if (substr($view,3,1) == '1') { |
|
6876 | - $new_view = substr_replace($view,'0',3,1); |
|
6877 | - echo " |
|
6875 | + if (substr($view,3,1) == '1') { |
|
6876 | + $new_view = substr_replace($view,'0',3,1); |
|
6877 | + echo " |
|
6878 | 6878 | <tr> |
6879 | 6879 | <td valign='top'> |
6880 | 6880 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
6881 | 6881 | </td> |
6882 | 6882 | </tr> |
6883 | 6883 | "; |
6884 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6885 | - $sql = "SELECT cl.title, cl.url |
|
6884 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6885 | + $sql = "SELECT cl.title, cl.url |
|
6886 | 6886 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
6887 | 6887 | WHERE sl.links_link_id = cl.id |
6888 | 6888 | AND sl.c_id = $courseId |
6889 | 6889 | AND sl.links_user_id = ".intval($user_id)." |
6890 | 6890 | GROUP BY cl.title, cl.url"; |
6891 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6892 | - $results = StatsUtils::getManyResults2Col($sql); |
|
6893 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6894 | - echo "<tr> |
|
6891 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6892 | + $results = StatsUtils::getManyResults2Col($sql); |
|
6893 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6894 | + echo "<tr> |
|
6895 | 6895 | <td class='secLine'> |
6896 | 6896 | ".get_lang('LinksTitleLinkColumn')." |
6897 | 6897 | </td> |
6898 | 6898 | </tr>"; |
6899 | - if (is_array($results)) { |
|
6900 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6901 | - echo "<tr>"; |
|
6902 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6903 | - echo"</tr>"; |
|
6904 | - } |
|
6905 | - } else { |
|
6906 | - echo "<tr>"; |
|
6907 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6908 | - echo"</tr>"; |
|
6909 | - } |
|
6910 | - echo "</table>"; |
|
6911 | - echo "</td></tr>"; |
|
6912 | - } else { |
|
6913 | - $new_view = substr_replace($view,'1',3,1); |
|
6914 | - echo " |
|
6899 | + if (is_array($results)) { |
|
6900 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6901 | + echo "<tr>"; |
|
6902 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6903 | + echo"</tr>"; |
|
6904 | + } |
|
6905 | + } else { |
|
6906 | + echo "<tr>"; |
|
6907 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6908 | + echo"</tr>"; |
|
6909 | + } |
|
6910 | + echo "</table>"; |
|
6911 | + echo "</td></tr>"; |
|
6912 | + } else { |
|
6913 | + $new_view = substr_replace($view,'1',3,1); |
|
6914 | + echo " |
|
6915 | 6915 | <tr> |
6916 | 6916 | <td valign='top'> |
6917 | 6917 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
6918 | 6918 | </td> |
6919 | 6919 | </tr> |
6920 | 6920 | "; |
6921 | - } |
|
6921 | + } |
|
6922 | 6922 | } |
6923 | 6923 | |
6924 | 6924 | /** |
@@ -6931,61 +6931,61 @@ discard block |
||
6931 | 6931 | */ |
6932 | 6932 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
6933 | 6933 | { |
6934 | - // protect data |
|
6934 | + // protect data |
|
6935 | 6935 | $user_id = intval($user_id); |
6936 | 6936 | $courseId = api_get_course_int_id($course_code); |
6937 | - $session_id = intval($session_id); |
|
6937 | + $session_id = intval($session_id); |
|
6938 | 6938 | |
6939 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6940 | - if(substr($view,4,1) == '1') { |
|
6941 | - $new_view = substr_replace($view,'0',4,1); |
|
6942 | - echo " |
|
6939 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6940 | + if(substr($view,4,1) == '1') { |
|
6941 | + $new_view = substr_replace($view,'0',4,1); |
|
6942 | + echo " |
|
6943 | 6943 | <tr> |
6944 | 6944 | <td valign='top'> |
6945 | 6945 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
6946 | 6946 | </td> |
6947 | 6947 | </tr> |
6948 | 6948 | "; |
6949 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6949 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6950 | 6950 | |
6951 | - $sql = "SELECT down_doc_path |
|
6951 | + $sql = "SELECT down_doc_path |
|
6952 | 6952 | FROM $downloads_table |
6953 | 6953 | WHERE c_id = $courseId |
6954 | 6954 | AND down_user_id = $user_id |
6955 | 6955 | AND down_session_id = $session_id |
6956 | 6956 | GROUP BY down_doc_path"; |
6957 | 6957 | |
6958 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6959 | - $results = StatsUtils::getManyResults1Col($sql); |
|
6960 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6961 | - echo "<tr> |
|
6958 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6959 | + $results = StatsUtils::getManyResults1Col($sql); |
|
6960 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6961 | + echo "<tr> |
|
6962 | 6962 | <td class='secLine'> |
6963 | 6963 | ".get_lang('DocumentsTitleDocumentColumn')." |
6964 | 6964 | </td> |
6965 | 6965 | </tr>"; |
6966 | - if (is_array($results)) { |
|
6967 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6968 | - echo "<tr>"; |
|
6969 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
6970 | - echo"</tr>"; |
|
6971 | - } |
|
6972 | - } else { |
|
6973 | - echo "<tr>"; |
|
6974 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6975 | - echo"</tr>"; |
|
6976 | - } |
|
6977 | - echo "</table>"; |
|
6978 | - echo "</td></tr>"; |
|
6979 | - } else { |
|
6980 | - $new_view = substr_replace($view,'1',4,1); |
|
6981 | - echo " |
|
6966 | + if (is_array($results)) { |
|
6967 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6968 | + echo "<tr>"; |
|
6969 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
6970 | + echo"</tr>"; |
|
6971 | + } |
|
6972 | + } else { |
|
6973 | + echo "<tr>"; |
|
6974 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6975 | + echo"</tr>"; |
|
6976 | + } |
|
6977 | + echo "</table>"; |
|
6978 | + echo "</td></tr>"; |
|
6979 | + } else { |
|
6980 | + $new_view = substr_replace($view,'1',4,1); |
|
6981 | + echo " |
|
6982 | 6982 | <tr> |
6983 | 6983 | <td valign='top'> |
6984 | 6984 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
6985 | 6985 | </td> |
6986 | 6986 | </tr> |
6987 | 6987 | "; |
6988 | - } |
|
6988 | + } |
|
6989 | 6989 | } |
6990 | 6990 | |
6991 | 6991 | /** |
@@ -7042,43 +7042,43 @@ discard block |
||
7042 | 7042 | */ |
7043 | 7043 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
7044 | 7044 | { |
7045 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
7046 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
7047 | - |
|
7048 | - // protected data |
|
7049 | - $user_id = intval($user_id); |
|
7050 | - $session_id = intval($session_id); |
|
7051 | - $course_id = intval($course_id); |
|
7052 | - |
|
7053 | - $tempView = $view; |
|
7054 | - if (substr($view,0,1) == '1') { |
|
7055 | - $new_view = substr_replace($view,'0',0,1); |
|
7056 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7057 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7045 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
7046 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
7047 | + |
|
7048 | + // protected data |
|
7049 | + $user_id = intval($user_id); |
|
7050 | + $session_id = intval($session_id); |
|
7051 | + $course_id = intval($course_id); |
|
7052 | + |
|
7053 | + $tempView = $view; |
|
7054 | + if (substr($view,0,1) == '1') { |
|
7055 | + $new_view = substr_replace($view,'0',0,1); |
|
7056 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7057 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7058 | 7058 | FROM $track_access_table |
7059 | 7059 | WHERE access_user_id = $user_id |
7060 | 7060 | AND c_id = $course_id |
7061 | 7061 | AND access_session_id = $session_id |
7062 | 7062 | GROUP BY YEAR(access_date),MONTH(access_date) |
7063 | 7063 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7064 | - //$results = getManyResults2Col($sql); |
|
7065 | - $results = getManyResults3Col($sql); |
|
7066 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7067 | - $line=''; |
|
7068 | - $total = 0; |
|
7069 | - if (is_array($results)) { |
|
7070 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7071 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7072 | - $total = $total + $results[$j][1]; |
|
7073 | - } |
|
7074 | - $line .= get_lang('Total').";".$total."\n"; |
|
7075 | - } else { |
|
7076 | - $line= get_lang('NoResult')."</center></td>"; |
|
7077 | - } |
|
7078 | - } else { |
|
7079 | - $new_view = substr_replace($view,'1',0,1); |
|
7080 | - } |
|
7081 | - return array($title_line, $line); |
|
7064 | + //$results = getManyResults2Col($sql); |
|
7065 | + $results = getManyResults3Col($sql); |
|
7066 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7067 | + $line=''; |
|
7068 | + $total = 0; |
|
7069 | + if (is_array($results)) { |
|
7070 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7071 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7072 | + $total = $total + $results[$j][1]; |
|
7073 | + } |
|
7074 | + $line .= get_lang('Total').";".$total."\n"; |
|
7075 | + } else { |
|
7076 | + $line= get_lang('NoResult')."</center></td>"; |
|
7077 | + } |
|
7078 | + } else { |
|
7079 | + $new_view = substr_replace($view,'1',0,1); |
|
7080 | + } |
|
7081 | + return array($title_line, $line); |
|
7082 | 7082 | } |
7083 | 7083 | |
7084 | 7084 | /** |
@@ -7091,67 +7091,67 @@ discard block |
||
7091 | 7091 | */ |
7092 | 7092 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
7093 | 7093 | { |
7094 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7094 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7095 | 7095 | $courseId = api_get_course_int_id($courseCode); |
7096 | 7096 | $userId = intval($userId); |
7097 | - if (substr($view,1,1) == '1') { |
|
7098 | - $new_view = substr_replace($view,'0',1,1); |
|
7099 | - $title[1] = get_lang('ExercicesDetails'); |
|
7100 | - $line = ''; |
|
7101 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7097 | + if (substr($view,1,1) == '1') { |
|
7098 | + $new_view = substr_replace($view,'0',1,1); |
|
7099 | + $title[1] = get_lang('ExercicesDetails'); |
|
7100 | + $line = ''; |
|
7101 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7102 | 7102 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
7103 | 7103 | WHERE te.c_id = $courseId |
7104 | 7104 | AND te.exe_user_id = $userId |
7105 | 7105 | AND te.exe_exo_id = ce.id |
7106 | 7106 | ORDER BY ce.title ASC, te.exe_date ASC"; |
7107 | 7107 | |
7108 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7108 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7109 | 7109 | FROM $TABLETRACK_HOTPOTATOES AS te |
7110 | 7110 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
7111 | 7111 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
7112 | 7112 | |
7113 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7113 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7114 | 7114 | |
7115 | - $NoTestRes = 0; |
|
7116 | - $NoHPTestRes = 0; |
|
7115 | + $NoTestRes = 0; |
|
7116 | + $NoHPTestRes = 0; |
|
7117 | 7117 | |
7118 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7119 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7118 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7119 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7120 | 7120 | |
7121 | - if (is_array($results)) { |
|
7122 | - for($i = 0; $i < sizeof($results); $i++) |
|
7123 | - { |
|
7124 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7125 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7126 | - } |
|
7127 | - } else { |
|
7121 | + if (is_array($results)) { |
|
7122 | + for($i = 0; $i < sizeof($results); $i++) |
|
7123 | + { |
|
7124 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7125 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7126 | + } |
|
7127 | + } else { |
|
7128 | 7128 | // istvan begin |
7129 | - $NoTestRes = 1; |
|
7130 | - } |
|
7131 | - |
|
7132 | - // The Result of Tests |
|
7133 | - if (is_array($hpresults)) { |
|
7134 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7135 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7136 | - |
|
7137 | - if ($title == '') |
|
7138 | - $title = basename($hpresults[$i][0]); |
|
7139 | - |
|
7140 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7141 | - |
|
7142 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7143 | - } |
|
7144 | - } else { |
|
7145 | - $NoHPTestRes = 1; |
|
7146 | - } |
|
7147 | - |
|
7148 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7149 | - $line=get_lang('NoResult'); |
|
7150 | - } |
|
7151 | - } else { |
|
7152 | - $new_view = substr_replace($view,'1',1,1); |
|
7153 | - } |
|
7154 | - return array($title_line, $line); |
|
7129 | + $NoTestRes = 1; |
|
7130 | + } |
|
7131 | + |
|
7132 | + // The Result of Tests |
|
7133 | + if (is_array($hpresults)) { |
|
7134 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7135 | + $title = GetQuizName($hpresults[$i][0],''); |
|
7136 | + |
|
7137 | + if ($title == '') |
|
7138 | + $title = basename($hpresults[$i][0]); |
|
7139 | + |
|
7140 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7141 | + |
|
7142 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7143 | + } |
|
7144 | + } else { |
|
7145 | + $NoHPTestRes = 1; |
|
7146 | + } |
|
7147 | + |
|
7148 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7149 | + $line=get_lang('NoResult'); |
|
7150 | + } |
|
7151 | + } else { |
|
7152 | + $new_view = substr_replace($view,'1',1,1); |
|
7153 | + } |
|
7154 | + return array($title_line, $line); |
|
7155 | 7155 | } |
7156 | 7156 | |
7157 | 7157 | /** |
@@ -7160,37 +7160,37 @@ discard block |
||
7160 | 7160 | */ |
7161 | 7161 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7162 | 7162 | { |
7163 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7163 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7164 | 7164 | $_course = api_get_course_info(); |
7165 | 7165 | $user_id = intval($user_id); |
7166 | 7166 | $course_id = intval($course_id); |
7167 | 7167 | |
7168 | - if (substr($view,2,1) == '1') { |
|
7169 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7168 | + if (substr($view,2,1) == '1') { |
|
7169 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7170 | 7170 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7171 | 7171 | WHERE |
7172 | 7172 | u.upload_work_id = w.id AND |
7173 | 7173 | u.upload_user_id = '$user_id' AND |
7174 | 7174 | u.c_id = '$course_id' |
7175 | 7175 | ORDER BY u.upload_date DESC"; |
7176 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7177 | - |
|
7178 | - $title[1]=get_lang('WorksDetails'); |
|
7179 | - $line=''; |
|
7180 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7181 | - |
|
7182 | - if (is_array($results)) { |
|
7183 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7184 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7185 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7186 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7187 | - } |
|
7188 | - |
|
7189 | - } else { |
|
7190 | - $line= get_lang('NoResult'); |
|
7191 | - } |
|
7192 | - } |
|
7193 | - return array($title_line, $line); |
|
7176 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7177 | + |
|
7178 | + $title[1]=get_lang('WorksDetails'); |
|
7179 | + $line=''; |
|
7180 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7181 | + |
|
7182 | + if (is_array($results)) { |
|
7183 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7184 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7185 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7186 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7187 | + } |
|
7188 | + |
|
7189 | + } else { |
|
7190 | + $line= get_lang('NoResult'); |
|
7191 | + } |
|
7192 | + } |
|
7193 | + return array($title_line, $line); |
|
7194 | 7194 | } |
7195 | 7195 | |
7196 | 7196 | /** |
@@ -7199,32 +7199,32 @@ discard block |
||
7199 | 7199 | */ |
7200 | 7200 | public function display_links_tracking_info($view, $userId, $courseCode) |
7201 | 7201 | { |
7202 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7202 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7203 | 7203 | $courseId = api_get_course_int_id($courseCode); |
7204 | 7204 | $userId = intval($userId); |
7205 | 7205 | $line = null; |
7206 | - if (substr($view,3,1) == '1') { |
|
7207 | - $new_view = substr_replace($view,'0',3,1); |
|
7208 | - $title[1]=get_lang('LinksDetails'); |
|
7209 | - $sql = "SELECT cl.title, cl.url |
|
7206 | + if (substr($view,3,1) == '1') { |
|
7207 | + $new_view = substr_replace($view,'0',3,1); |
|
7208 | + $title[1]=get_lang('LinksDetails'); |
|
7209 | + $sql = "SELECT cl.title, cl.url |
|
7210 | 7210 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7211 | 7211 | WHERE sl.links_link_id = cl.id |
7212 | 7212 | AND sl.c_id = $courseId |
7213 | 7213 | AND sl.links_user_id = $userId |
7214 | 7214 | GROUP BY cl.title, cl.url"; |
7215 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7216 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7217 | - if (is_array($results)) { |
|
7218 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7219 | - $line .= $results[$j][0]."\n"; |
|
7220 | - } |
|
7221 | - } else { |
|
7222 | - $line=get_lang('NoResult'); |
|
7223 | - } |
|
7224 | - } else { |
|
7225 | - $new_view = substr_replace($view,'1',3,1); |
|
7226 | - } |
|
7227 | - return array($title_line, $line); |
|
7215 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7216 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7217 | + if (is_array($results)) { |
|
7218 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7219 | + $line .= $results[$j][0]."\n"; |
|
7220 | + } |
|
7221 | + } else { |
|
7222 | + $line=get_lang('NoResult'); |
|
7223 | + } |
|
7224 | + } else { |
|
7225 | + $new_view = substr_replace($view,'1',3,1); |
|
7226 | + } |
|
7227 | + return array($title_line, $line); |
|
7228 | 7228 | } |
7229 | 7229 | |
7230 | 7230 | /** |
@@ -7237,38 +7237,38 @@ discard block |
||
7237 | 7237 | */ |
7238 | 7238 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7239 | 7239 | { |
7240 | - // protect data |
|
7241 | - $user_id = intval($user_id); |
|
7240 | + // protect data |
|
7241 | + $user_id = intval($user_id); |
|
7242 | 7242 | $courseId = api_get_course_int_id($courseCode); |
7243 | - $session_id = intval($session_id); |
|
7243 | + $session_id = intval($session_id); |
|
7244 | 7244 | |
7245 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7245 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7246 | 7246 | |
7247 | - if (substr($view,4,1) == '1') { |
|
7248 | - $new_view = substr_replace($view,'0',4,1); |
|
7249 | - $title[1]= get_lang('DocumentsDetails'); |
|
7247 | + if (substr($view,4,1) == '1') { |
|
7248 | + $new_view = substr_replace($view,'0',4,1); |
|
7249 | + $title[1]= get_lang('DocumentsDetails'); |
|
7250 | 7250 | |
7251 | - $sql = "SELECT down_doc_path |
|
7251 | + $sql = "SELECT down_doc_path |
|
7252 | 7252 | FROM $downloads_table |
7253 | 7253 | WHERE c_id = $courseId |
7254 | 7254 | AND down_user_id = $user_id |
7255 | 7255 | AND down_session_id = $session_id |
7256 | 7256 | GROUP BY down_doc_path"; |
7257 | 7257 | |
7258 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7259 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7258 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7259 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7260 | 7260 | $line = null; |
7261 | - if (is_array($results)) { |
|
7262 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7263 | - $line .= $results[$j]."\n"; |
|
7264 | - } |
|
7265 | - } else { |
|
7266 | - $line = get_lang('NoResult'); |
|
7267 | - } |
|
7268 | - } else { |
|
7269 | - $new_view = substr_replace($view,'1',4,1); |
|
7270 | - } |
|
7271 | - return array($title_line, $line); |
|
7261 | + if (is_array($results)) { |
|
7262 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7263 | + $line .= $results[$j]."\n"; |
|
7264 | + } |
|
7265 | + } else { |
|
7266 | + $line = get_lang('NoResult'); |
|
7267 | + } |
|
7268 | + } else { |
|
7269 | + $new_view = substr_replace($view,'1',4,1); |
|
7270 | + } |
|
7271 | + return array($title_line, $line); |
|
7272 | 7272 | } |
7273 | 7273 | |
7274 | 7274 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $extendedAttempt = null, |
115 | 115 | $extendedAll = null, |
116 | 116 | $type = 'classic', |
117 | - $allowExtend = true |
|
117 | + $allowExtend = true |
|
118 | 118 | ) { |
119 | 119 | if (empty($courseInfo) || empty($lp_id)) { |
120 | 120 | return null; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | $extend_all = 0; |
139 | 139 | |
140 | 140 | if ($origin == 'tracking') { |
141 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
141 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
142 | 142 | } else { |
143 | - $url_suffix = '&lp_id=' . $lp_id; |
|
143 | + $url_suffix = '&lp_id='.$lp_id; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if (!empty($extendedAll)) { |
147 | 147 | $extend_all_link = Display::url( |
148 | 148 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
149 | - api_get_self() . '?action=stats' . $url_suffix |
|
149 | + api_get_self().'?action=stats'.$url_suffix |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | $extend_all = 1; |
153 | 153 | } else { |
154 | 154 | $extend_all_link = Display::url( |
155 | 155 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
156 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
156 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | |
166 | 166 | $actionColumn = null; |
167 | 167 | if ($type == 'classic') { |
168 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
168 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
169 | 169 | } |
170 | 170 | $output .= '<div class="table-responsive">'; |
171 | 171 | $output .= '<table class="table tracking"> |
172 | 172 | <thead> |
173 | 173 | <tr class="table-header"> |
174 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
174 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
175 | 175 | <th colspan="4"> |
176 | - ' . get_lang('ScormLessonTitle') .' |
|
176 | + ' . get_lang('ScormLessonTitle').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormStatus') . ' |
|
179 | + ' . get_lang('ScormStatus').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormScore') . ' |
|
182 | + ' . get_lang('ScormScore').' |
|
183 | 183 | </th> |
184 | 184 | <th colspan="2"> |
185 | - ' . get_lang('ScormTime') . ' |
|
185 | + ' . get_lang('ScormTime').' |
|
186 | 186 | </th> |
187 | 187 | '.$actionColumn.' |
188 | 188 | </tr> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // Prepare statement to go through each attempt. |
246 | 246 | $viewCondition = null; |
247 | 247 | if (!empty($view)) { |
248 | - $viewCondition = " AND v.view_count = $view "; |
|
248 | + $viewCondition = " AND v.view_count = $view "; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $sql = "SELECT |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | FROM $TBL_QUIZ |
294 | 294 | WHERE |
295 | 295 | c_id = $course_id AND |
296 | - id ='" . $my_path . "'"; |
|
296 | + id ='".$my_path."'"; |
|
297 | 297 | $res_result_disabled = Database::query($sql); |
298 | 298 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
299 | 299 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | 317 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
318 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $action = null; |
335 | 335 | if ($type == 'classic') { |
336 | - $action = '<td></td>'; |
|
336 | + $action = '<td></td>'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | $extend_this_attempt = 1; |
378 | 378 | $extend_attempt_link = Display::url( |
379 | 379 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
380 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
380 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
381 | 381 | ); |
382 | 382 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
383 | 383 | // The extend button for this attempt has not been clicked. |
384 | 384 | $extend_attempt_link = Display::url( |
385 | 385 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
386 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
386 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
387 | 387 | ); |
388 | 388 | } |
389 | 389 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
419 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
419 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
420 | 420 | |
421 | 421 | if ($row['item_type'] != 'dokeos_chapter') { |
422 | 422 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | $action = '<td></td>'; |
445 | 445 | } |
446 | 446 | |
447 | - $output .= '<tr class="' . $oddclass . '"> |
|
447 | + $output .= '<tr class="'.$oddclass.'"> |
|
448 | 448 | <td></td> |
449 | - <td>' . $extend_attempt_link . '</td> |
|
450 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
451 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
452 | - <td colspan="2">' . $view_score . '</td> |
|
453 | - <td colspan="2">' . $time . '</td> |
|
449 | + <td>' . $extend_attempt_link.'</td> |
|
450 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
451 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
452 | + <td colspan="2">' . $view_score.'</td> |
|
453 | + <td colspan="2">' . $time.'</td> |
|
454 | 454 | '.$action.' |
455 | 455 | </tr>'; |
456 | 456 | $attemptCount++; |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
464 | 464 | $temp[] = '/'; |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | } else { |
469 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
469 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
470 | 470 | } |
471 | 471 | $temp[] = $time; |
472 | 472 | $csv_content[] = $temp; |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | <td></td> |
504 | 504 | <td></td> |
505 | 505 | <td></td> |
506 | - <td>'.$interaction['order_id'] . '</td> |
|
507 | - <td>'.$interaction['id'] . '</td> |
|
506 | + <td>'.$interaction['order_id'].'</td> |
|
507 | + <td>'.$interaction['id'].'</td> |
|
508 | 508 | <td colspan="2">' . $interaction['type'].'</td> |
509 | - <td>'.$student_response . '</td> |
|
510 | - <td>'.$interaction['result'] . '</td> |
|
511 | - <td>'.$interaction['latency'] . '</td> |
|
512 | - <td>'.$interaction['time'] . '</td> |
|
509 | + <td>'.$student_response.'</td> |
|
510 | + <td>'.$interaction['result'].'</td> |
|
511 | + <td>'.$interaction['latency'].'</td> |
|
512 | + <td>'.$interaction['time'].'</td> |
|
513 | 513 | '.$action.' |
514 | 514 | </tr>'; |
515 | 515 | $counter++; |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | <td></td> |
527 | 527 | <td></td> |
528 | 528 | <td></td> |
529 | - <td>' . $interaction['order_id'] . '</td> |
|
530 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
531 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
532 | - <td>' . $interaction['score_raw'] . '</td> |
|
533 | - <td>' . $interaction['score_max'] . '</td> |
|
534 | - <td>' . $interaction['score_min'] . '</td> |
|
529 | + <td>' . $interaction['order_id'].'</td> |
|
530 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
531 | + <td colspan="2">' . $interaction['status'].'</td> |
|
532 | + <td>' . $interaction['score_raw'].'</td> |
|
533 | + <td>' . $interaction['score_max'].'</td> |
|
534 | + <td>' . $interaction['score_min'].'</td> |
|
535 | 535 | '.$action.' |
536 | 536 | </tr>'; |
537 | 537 | $counter++; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $my_path = Database::escape_string($my_path); |
555 | 555 | $sql = "SELECT results_disabled |
556 | 556 | FROM $TBL_QUIZ |
557 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
557 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
558 | 558 | $res_result_disabled = Database::query($sql); |
559 | 559 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
560 | 560 | |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | $extend_this_attempt = 1; |
579 | 579 | $extend_attempt_link = Display::url( |
580 | 580 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
581 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
581 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
582 | 582 | ); |
583 | 583 | } else { |
584 | 584 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
585 | 585 | // The extend button for this attempt has not been clicked. |
586 | 586 | $extend_attempt_link = Display::url( |
587 | 587 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
588 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
588 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
589 | 589 | ); |
590 | 590 | } |
591 | 591 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | if ($inter_num > 1) { |
601 | 601 | $extend_link = Display::url( |
602 | 602 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
603 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
603 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
604 | 604 | ); |
605 | 605 | } |
606 | 606 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | |
617 | 617 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
618 | 618 | |
619 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
619 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
620 | 620 | WHERE |
621 | - exe_exo_id="' . $row['path'] . '" AND |
|
622 | - exe_user_id="' . $user_id . '" AND |
|
623 | - orig_lp_id = "' . $lp_id . '" AND |
|
624 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
625 | - c_id = ' . $course_id . ' AND |
|
621 | + exe_exo_id="' . $row['path'].'" AND |
|
622 | + exe_user_id="' . $user_id.'" AND |
|
623 | + orig_lp_id = "' . $lp_id.'" AND |
|
624 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
625 | + c_id = ' . $course_id.' AND |
|
626 | 626 | status <> "incomplete" AND |
627 | - session_id = ' . $session_id . ' |
|
627 | + session_id = ' . $session_id.' |
|
628 | 628 | ORDER BY exe_date DESC |
629 | 629 | LIMIT 1'; |
630 | 630 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | FROM $TBL_LP_ITEM_VIEW |
656 | 656 | WHERE |
657 | 657 | c_id = $course_id AND |
658 | - lp_item_id = '" . (int) $my_id . "' AND |
|
659 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
658 | + lp_item_id = '".(int) $my_id."' AND |
|
659 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
660 | 660 | ORDER BY view_count DESC limit 1"; |
661 | 661 | $res_score = Database::query($sql); |
662 | 662 | $row_score = Database::fetch_array($res_score); |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | FROM $TBL_LP_ITEM_VIEW |
666 | 666 | WHERE |
667 | 667 | c_id = $course_id AND |
668 | - lp_item_id = '" . (int) $my_id . "' AND |
|
669 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
668 | + lp_item_id = '".(int) $my_id."' AND |
|
669 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
670 | 670 | $res_time = Database::query($sql); |
671 | 671 | $row_time = Database::fetch_array($res_time); |
672 | 672 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | } else { |
726 | 726 | $correct_test_link = '-'; |
727 | 727 | if ($row['item_type'] == 'quiz') { |
728 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
729 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
728 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
729 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
730 | 730 | WHERE |
731 | - exe_exo_id="' . $row['path'] . '" AND |
|
732 | - exe_user_id="' . $user_id . '" AND |
|
733 | - orig_lp_id = "' . $lp_id . '" AND |
|
734 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
735 | - c_id = ' . $course_id . ' AND |
|
731 | + exe_exo_id="' . $row['path'].'" AND |
|
732 | + exe_user_id="' . $user_id.'" AND |
|
733 | + orig_lp_id = "' . $lp_id.'" AND |
|
734 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
735 | + c_id = ' . $course_id.' AND |
|
736 | 736 | status <> "incomplete" AND |
737 | - session_id = ' . $session_id . ' |
|
737 | + session_id = ' . $session_id.' |
|
738 | 738 | ORDER BY exe_date DESC '; |
739 | 739 | |
740 | 740 | $resultLastAttempt = Database::query($sql); |
@@ -746,12 +746,12 @@ discard block |
||
746 | 746 | ) { |
747 | 747 | $correct_test_link = Display::url( |
748 | 748 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
749 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
749 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
750 | 750 | ); |
751 | 751 | } else { |
752 | 752 | $correct_test_link = Display::url( |
753 | 753 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
754 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
754 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
755 | 755 | ); |
756 | 756 | } |
757 | 757 | } |
@@ -761,14 +761,14 @@ discard block |
||
761 | 761 | |
762 | 762 | $action = null; |
763 | 763 | if ($type == 'classic') { |
764 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
764 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($lp_id == $my_lp_id && false) { |
768 | 768 | |
769 | - $output .= '<tr class =' . $oddclass . '> |
|
770 | - <td>' . $extend_link . '</td> |
|
771 | - <td colspan="4">' . $title . '</td> |
|
769 | + $output .= '<tr class ='.$oddclass.'> |
|
770 | + <td>' . $extend_link.'</td> |
|
771 | + <td colspan="4">' . $title.'</td> |
|
772 | 772 | <td colspan="2"> </td> |
773 | 773 | <td colspan="2"> </td> |
774 | 774 | <td colspan="2"> </td> |
@@ -793,13 +793,13 @@ discard block |
||
793 | 793 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
794 | 794 | } |
795 | 795 | } else { |
796 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
796 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | $output .= ' |
800 | 800 | <td>'.$extend_link.'</td> |
801 | - <td colspan="4">' . $title . '</td> |
|
802 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
801 | + <td colspan="4">' . $title.'</td> |
|
802 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
803 | 803 | <td colspan="2">'.$scoreItem.'</td> |
804 | 804 | <td colspan="2">'.$time.'</td> |
805 | 805 | '.$action.' |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
817 | 817 | $temp[] = '/'; |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | } else { |
822 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
822 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
823 | 823 | } |
824 | 824 | $temp[] = $time; |
825 | 825 | $csv_content[] = $temp; |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $action = null; |
832 | 832 | if ($type == 'classic') { |
833 | - $action = '<td></td>'; |
|
833 | + $action = '<td></td>'; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | if ($extend_this_attempt || $extend_all) { |
@@ -867,11 +867,11 @@ discard block |
||
867 | 867 | <td></td> |
868 | 868 | <td></td> |
869 | 869 | <td></td> |
870 | - <td>' . $interaction['order_id'] . '</td> |
|
871 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
872 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
870 | + <td>' . $interaction['order_id'].'</td> |
|
871 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
872 | + <td colspan="2">' . $interaction['status'].'</td> |
|
873 | 873 | <td>' . $interaction['score_raw'].'</td> |
874 | - <td>' . $interaction['score_max'] .'</td> |
|
874 | + <td>' . $interaction['score_max'].'</td> |
|
875 | 875 | <td>' . $interaction['score_min'].'</td> |
876 | 876 | '.$action.' |
877 | 877 | </tr>'; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | // Attempts listing by exercise. |
883 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
883 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
884 | 884 | // Get attempts of a exercise. |
885 | 885 | if (!empty($lp_id) && |
886 | 886 | !empty($lp_item_id) && |
@@ -895,15 +895,15 @@ discard block |
||
895 | 895 | $row_path = Database::fetch_array($res_path); |
896 | 896 | |
897 | 897 | if (Database::num_rows($res_path) > 0) { |
898 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
898 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
899 | 899 | WHERE |
900 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
900 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
901 | 901 | status <> "incomplete" AND |
902 | - exe_user_id="' . $user_id . '" AND |
|
903 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
904 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
905 | - c_id = ' . $course_id . ' AND |
|
906 | - session_id = ' . $session_id . ' |
|
902 | + exe_user_id="' . $user_id.'" AND |
|
903 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
904 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
905 | + c_id = ' . $course_id.' AND |
|
906 | + session_id = ' . $session_id.' |
|
907 | 907 | ORDER BY exe_date'; |
908 | 908 | $res_attempts = Database::query($sql); |
909 | 909 | $num_attempts = Database::num_rows($res_attempts); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | if ($mktime_start_date && $mktime_exe_date) { |
922 | 922 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
923 | 923 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
924 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
924 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
925 | 925 | } else { |
926 | 926 | $time_attemp = ' - '; |
927 | 927 | } |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
948 | 948 | } |
949 | 949 | |
950 | - $output .= '<tr class="' . $oddclass . '" > |
|
950 | + $output .= '<tr class="'.$oddclass.'" > |
|
951 | 951 | <td></td> |
952 | - <td>' . $extend_attempt_link . '</td> |
|
953 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
954 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
955 | - <td colspan="2">'.$view_score . '</td> |
|
956 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
952 | + <td>' . $extend_attempt_link.'</td> |
|
953 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
954 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
955 | + <td colspan="2">'.$view_score.'</td> |
|
956 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
957 | 957 | if ($action == 'classic') { |
958 | 958 | if ($origin != 'tracking') { |
959 | 959 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
960 | 960 | $output .= '<td> |
961 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
961 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
962 | 962 | </td>'; |
963 | 963 | } else { |
964 | 964 | $output .= '<td> |
965 | - <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
966 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
965 | + <a href="../exercice/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
966 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
967 | 967 | </a></td>'; |
968 | 968 | } |
969 | 969 | } else { |
970 | 970 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
971 | 971 | $output .= '<td> |
972 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
972 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
973 | 973 | } else { |
974 | 974 | $output .= '<td> |
975 | - <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
976 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
975 | + <a href="../exercice/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
976 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
977 | 977 | } |
978 | 978 | } |
979 | 979 | } |
@@ -1032,13 +1032,13 @@ discard block |
||
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1035 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1035 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1036 | 1036 | |
1037 | 1037 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1038 | 1038 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1039 | 1039 | } else { |
1040 | 1040 | if (is_numeric($total_score)) { |
1041 | - $final_score = $total_score . '%'; |
|
1041 | + $final_score = $total_score.'%'; |
|
1042 | 1042 | } else { |
1043 | 1043 | $final_score = $total_score; |
1044 | 1044 | } |
@@ -1054,19 +1054,19 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | $action = null; |
1056 | 1056 | if ($type == 'classic') { |
1057 | - $action = '<td></td>'; |
|
1057 | + $action = '<td></td>'; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $output .= '<tr class="'.$oddclass.'"> |
1061 | 1061 | <td></td> |
1062 | 1062 | <td colspan="4"> |
1063 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1063 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1064 | 1064 | </td> |
1065 | 1065 | <td colspan="2">'.$progress.'%</td> |
1066 | 1066 | <td colspan="2"> |
1067 | 1067 | ' . $final_score.' |
1068 | 1068 | </td> |
1069 | - <td colspan="2">' . $total_time . '</div> |
|
1069 | + <td colspan="2">' . $total_time.'</div> |
|
1070 | 1070 | '.$action.' |
1071 | 1071 | </tr>'; |
1072 | 1072 | |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1407 | 1407 | if (is_array($user_id)) { |
1408 | 1408 | $user_id = array_map('intval', $user_id); |
1409 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1410 | 1410 | } else { |
1411 | 1411 | $user_id = intval($user_id); |
1412 | 1412 | $condition_user = " AND user_id = $user_id "; |
@@ -1442,13 +1442,13 @@ discard block |
||
1442 | 1442 | { |
1443 | 1443 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1444 | 1444 | $sql = 'SELECT login_date |
1445 | - FROM ' . $tbl_track_login . ' |
|
1446 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1445 | + FROM ' . $tbl_track_login.' |
|
1446 | + WHERE login_user_id = ' . intval($student_id).' |
|
1447 | 1447 | ORDER BY login_date ASC |
1448 | 1448 | LIMIT 0,1'; |
1449 | 1449 | |
1450 | 1450 | $rs = Database::query($sql); |
1451 | - if (Database::num_rows($rs)>0) { |
|
1451 | + if (Database::num_rows($rs) > 0) { |
|
1452 | 1452 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1453 | 1453 | return api_convert_and_format_date( |
1454 | 1454 | $first_login_date, |
@@ -1473,8 +1473,8 @@ discard block |
||
1473 | 1473 | { |
1474 | 1474 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1475 | 1475 | $sql = 'SELECT login_date |
1476 | - FROM ' . $table . ' |
|
1477 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1476 | + FROM ' . $table.' |
|
1477 | + WHERE login_user_id = ' . intval($student_id).' |
|
1478 | 1478 | ORDER BY login_date |
1479 | 1479 | DESC LIMIT 0,1'; |
1480 | 1480 | |
@@ -1483,18 +1483,18 @@ discard block |
||
1483 | 1483 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1484 | 1484 | $last_login_date = api_get_local_time($last_login_date); |
1485 | 1485 | if ($return_timestamp) { |
1486 | - return api_strtotime($last_login_date,'UTC'); |
|
1486 | + return api_strtotime($last_login_date, 'UTC'); |
|
1487 | 1487 | } else { |
1488 | 1488 | if (!$warning_message) { |
1489 | 1489 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1490 | 1490 | } else { |
1491 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1492 | 1492 | $currentTimestamp = time(); |
1493 | 1493 | |
1494 | 1494 | //If the last connection is > than 7 days, the text is red |
1495 | 1495 | //345600 = 7 days in seconds |
1496 | 1496 | if ($currentTimestamp - $timestamp > 604800) { |
1497 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1498 | 1498 | } else { |
1499 | 1499 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1500 | 1500 | } |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | $sql = "$select |
1530 | 1530 | FROM $tbl_track_login |
1531 | 1531 | WHERE |
1532 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1532 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1533 | 1533 | login_date < '$date' |
1534 | 1534 | "; |
1535 | 1535 | $rs = Database::query($sql); |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | '.Display::return_icon('messagebox_warning.gif').' |
1629 | 1629 | </a>' |
1630 | 1630 | : null; |
1631 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1632 | 1632 | } else { |
1633 | 1633 | return $last_login_date; |
1634 | 1634 | } |
@@ -1663,8 +1663,8 @@ discard block |
||
1663 | 1663 | |
1664 | 1664 | // Given we're storing in cache, round the start and end times |
1665 | 1665 | // to the lower minute |
1666 | - $roundedStart = substr($start, 0, -2) . '00'; |
|
1667 | - $roundedStop = substr($stop, 0, -2) . '00'; |
|
1666 | + $roundedStart = substr($start, 0, -2).'00'; |
|
1667 | + $roundedStop = substr($stop, 0, -2).'00'; |
|
1668 | 1668 | $roundedStart = Database::escape_string($roundedStart); |
1669 | 1669 | $roundedStop = Database::escape_string($roundedStop); |
1670 | 1670 | |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | $session_id = intval($session_id); |
1675 | 1675 | $count = 0; |
1676 | 1676 | $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1677 | - $sql = "SELECT count(*) as count_connections |
|
1677 | + $sql = "SELECT count(*) as count_connections |
|
1678 | 1678 | FROM $tbl_track_e_course_access |
1679 | 1679 | WHERE |
1680 | 1680 | c_id = $courseId AND |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | $count = apcu_fetch($apc_var); |
1697 | 1697 | } else { |
1698 | 1698 | $rs = Database::query($sql); |
1699 | - if (Database::num_rows($rs)>0) { |
|
1699 | + if (Database::num_rows($rs) > 0) { |
|
1700 | 1700 | $row = Database::fetch_object($rs); |
1701 | 1701 | $count = $row->count_connections; |
1702 | 1702 | } |
@@ -1705,7 +1705,7 @@ discard block |
||
1705 | 1705 | } |
1706 | 1706 | } else { |
1707 | 1707 | $rs = Database::query($sql); |
1708 | - if (Database::num_rows($rs)>0) { |
|
1708 | + if (Database::num_rows($rs) > 0) { |
|
1709 | 1709 | $row = Database::fetch_object($rs); |
1710 | 1710 | $count = $row->count_connections; |
1711 | 1711 | } |
@@ -1727,14 +1727,14 @@ discard block |
||
1727 | 1727 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1728 | 1728 | |
1729 | 1729 | $sql = 'SELECT DISTINCT c_id |
1730 | - FROM ' . $tbl_course_rel_user . ' |
|
1730 | + FROM ' . $tbl_course_rel_user.' |
|
1731 | 1731 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1732 | 1732 | $rs = Database::query($sql); |
1733 | 1733 | $nb_courses = Database::num_rows($rs); |
1734 | 1734 | |
1735 | 1735 | if ($include_sessions) { |
1736 | 1736 | $sql = 'SELECT DISTINCT c_id |
1737 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1737 | + FROM ' . $tbl_session_course_rel_user.' |
|
1738 | 1738 | WHERE user_id = ' . $user_id; |
1739 | 1739 | $rs = Database::query($sql); |
1740 | 1740 | $nb_courses += Database::num_rows($rs); |
@@ -1781,7 +1781,7 @@ discard block |
||
1781 | 1781 | $condition_quiz = ""; |
1782 | 1782 | if (!empty($exercise_id)) { |
1783 | 1783 | $exercise_id = intval($exercise_id); |
1784 | - $condition_quiz =" AND id = $exercise_id "; |
|
1784 | + $condition_quiz = " AND id = $exercise_id "; |
|
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | // Compose a filter based on optional session id given |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | } |
1831 | 1831 | } |
1832 | 1832 | if (!empty($exercise_list)) { |
1833 | - $exercise_id = implode("','",$exercise_list); |
|
1833 | + $exercise_id = implode("','", $exercise_list); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1855,10 +1855,10 @@ discard block |
||
1855 | 1855 | $quiz_avg_score = null; |
1856 | 1856 | |
1857 | 1857 | if (!empty($row['avg_score'])) { |
1858 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1858 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1859 | 1859 | } |
1860 | 1860 | |
1861 | - if(!empty($row['num_attempts'])) { |
|
1861 | + if (!empty($row['num_attempts'])) { |
|
1862 | 1862 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1863 | 1863 | } |
1864 | 1864 | if (is_array($student_id)) { |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | $row = Database::fetch_row($rs); |
1989 | 1989 | $count = $row[0]; |
1990 | 1990 | } |
1991 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1991 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
1992 | 1992 | return $count; |
1993 | 1993 | } |
1994 | 1994 | |
@@ -2013,7 +2013,7 @@ discard block |
||
2013 | 2013 | ); |
2014 | 2014 | |
2015 | 2015 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
2016 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
2016 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
2017 | 2017 | } |
2018 | 2018 | } |
2019 | 2019 | $result = $result / count($exercise_list); |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | $query = sprintf($sql, intval($courseId), $sessionId); |
2051 | 2051 | $rs = Database::query($query); |
2052 | 2052 | $teachers = array(); |
2053 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
2053 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
2054 | 2054 | $teachers[] = $teacher; |
2055 | 2055 | } |
2056 | 2056 | $data = array(); |
@@ -2174,7 +2174,7 @@ discard block |
||
2174 | 2174 | $data[] = array( |
2175 | 2175 | 'course' => $course['title'], |
2176 | 2176 | 'session' => $teacher['name'], |
2177 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2177 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2178 | 2178 | 'documents' => $totalDocuments, |
2179 | 2179 | 'links' => $totalLinks, |
2180 | 2180 | 'forums' => $totalForums, |
@@ -2237,7 +2237,7 @@ discard block |
||
2237 | 2237 | for ($i = 0; $i < count($lpIdList); $i++) { |
2238 | 2238 | $placeHolders[] = '?'; |
2239 | 2239 | } |
2240 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
2240 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
2241 | 2241 | } |
2242 | 2242 | |
2243 | 2243 | if ($onlySeriousGame) { |
@@ -2257,14 +2257,14 @@ discard block |
||
2257 | 2257 | |
2258 | 2258 | $conditions = [ |
2259 | 2259 | " c_id = {$courseInfo['real_id']} ", |
2260 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2260 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2261 | 2261 | ]; |
2262 | 2262 | |
2263 | 2263 | $groupBy = 'GROUP BY lp_id'; |
2264 | 2264 | |
2265 | 2265 | if (is_array($studentId)) { |
2266 | 2266 | $studentId = array_map('intval', $studentId); |
2267 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2267 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2268 | 2268 | |
2269 | 2269 | |
2270 | 2270 | } else { |
@@ -2399,7 +2399,7 @@ discard block |
||
2399 | 2399 | // Compose a filter based on optional learning paths list given |
2400 | 2400 | $condition_lp = ""; |
2401 | 2401 | if (count($lp_ids) > 0) { |
2402 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2402 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | // Compose a filter based on optional session id |
@@ -2439,9 +2439,9 @@ discard block |
||
2439 | 2439 | // prepare filter on users |
2440 | 2440 | if (is_array($student_id)) { |
2441 | 2441 | array_walk($student_id, 'intval'); |
2442 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2442 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2443 | 2443 | } else { |
2444 | - $condition_user1 =" AND user_id = $student_id "; |
|
2444 | + $condition_user1 = " AND user_id = $student_id "; |
|
2445 | 2445 | } |
2446 | 2446 | |
2447 | 2447 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | ORDER BY lp_item_id"; |
2485 | 2485 | $res_lp_item = Database::query($sql); |
2486 | 2486 | |
2487 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2487 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2488 | 2488 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2489 | 2489 | |
2490 | 2490 | // Getting the most recent attempt |
@@ -2507,8 +2507,8 @@ discard block |
||
2507 | 2507 | ORDER BY view_count DESC |
2508 | 2508 | LIMIT 1"; |
2509 | 2509 | $res_lp_item_result = Database::query($sql); |
2510 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2511 | - $list[]= $row_max_score; |
|
2510 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2511 | + $list[] = $row_max_score; |
|
2512 | 2512 | } |
2513 | 2513 | } |
2514 | 2514 | } else { |
@@ -2532,8 +2532,8 @@ discard block |
||
2532 | 2532 | if ($debug) echo $sql.'<br />'; |
2533 | 2533 | $res_max_score = Database::query($sql); |
2534 | 2534 | |
2535 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2536 | - $list[]= $row_max_score; |
|
2535 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2536 | + $list[] = $row_max_score; |
|
2537 | 2537 | } |
2538 | 2538 | } |
2539 | 2539 | |
@@ -2548,7 +2548,7 @@ discard block |
||
2548 | 2548 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2549 | 2549 | $score = $row_max_score['score']; |
2550 | 2550 | |
2551 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2551 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2552 | 2552 | |
2553 | 2553 | if ($row_max_score['item_type'] == 'sco') { |
2554 | 2554 | /* Check if it is sco (easier to get max_score) |
@@ -2566,7 +2566,7 @@ discard block |
||
2566 | 2566 | } |
2567 | 2567 | // Avoid division by zero errors |
2568 | 2568 | if (!empty($max_score)) { |
2569 | - $lp_partial_total += $score/$max_score; |
|
2569 | + $lp_partial_total += $score / $max_score; |
|
2570 | 2570 | } |
2571 | 2571 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2572 | 2572 | } else { |
@@ -2590,10 +2590,10 @@ discard block |
||
2590 | 2590 | ORDER BY exe_date DESC |
2591 | 2591 | LIMIT 1"; |
2592 | 2592 | |
2593 | - if ($debug) echo $sql .'<br />'; |
|
2593 | + if ($debug) echo $sql.'<br />'; |
|
2594 | 2594 | $result_last_attempt = Database::query($sql); |
2595 | 2595 | $num = Database :: num_rows($result_last_attempt); |
2596 | - if ($num > 0 ) { |
|
2596 | + if ($num > 0) { |
|
2597 | 2597 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2598 | 2598 | if ($debug) echo $id_last_attempt.'<br />'; |
2599 | 2599 | |
@@ -2622,13 +2622,13 @@ discard block |
||
2622 | 2622 | $max_score = $row_max_score_bis['maxscore']; |
2623 | 2623 | } |
2624 | 2624 | if (!empty($max_score) && floatval($max_score) > 0) { |
2625 | - $lp_partial_total += $score/$max_score; |
|
2625 | + $lp_partial_total += $score / $max_score; |
|
2626 | 2626 | } |
2627 | 2627 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2628 | 2628 | } |
2629 | 2629 | } |
2630 | 2630 | |
2631 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2631 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2632 | 2632 | // Normal way |
2633 | 2633 | if ($use_max_score[$lp_id]) { |
2634 | 2634 | $count_items++; |
@@ -2663,8 +2663,8 @@ discard block |
||
2663 | 2663 | if ($debug) echo $sql; |
2664 | 2664 | $result_have_quiz = Database::query($sql); |
2665 | 2665 | |
2666 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2667 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2666 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2667 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2668 | 2668 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2669 | 2669 | $lp_with_quiz++; |
2670 | 2670 | } |
@@ -2676,7 +2676,7 @@ discard block |
||
2676 | 2676 | |
2677 | 2677 | if ($lp_with_quiz != 0) { |
2678 | 2678 | if (!$return_array) { |
2679 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2679 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2680 | 2680 | if ($debug) var_dump($score_of_scorm_calculate); |
2681 | 2681 | if (empty($lp_ids)) { |
2682 | 2682 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2750,9 +2750,9 @@ discard block |
||
2750 | 2750 | |
2751 | 2751 | if (is_array($student_id)) { |
2752 | 2752 | array_walk($student_id, 'intval'); |
2753 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2753 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2754 | 2754 | } else { |
2755 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2755 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2756 | 2756 | } |
2757 | 2757 | |
2758 | 2758 | $conditionsToString = implode('AND ', $conditions); |
@@ -2776,7 +2776,7 @@ discard block |
||
2776 | 2776 | return 0; |
2777 | 2777 | } |
2778 | 2778 | |
2779 | - return ($row['sum_score'] / $row['sum_max_score'])*100; |
|
2779 | + return ($row['sum_score'] / $row['sum_max_score']) * 100; |
|
2780 | 2780 | |
2781 | 2781 | } |
2782 | 2782 | |
@@ -2806,7 +2806,7 @@ discard block |
||
2806 | 2806 | // Compose a filter based on optional learning paths list given |
2807 | 2807 | $condition_lp = ""; |
2808 | 2808 | if (count($lp_ids) > 0) { |
2809 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2809 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2810 | 2810 | } |
2811 | 2811 | |
2812 | 2812 | // Compose a filter based on optional session id |
@@ -2868,7 +2868,7 @@ discard block |
||
2868 | 2868 | |
2869 | 2869 | if (!empty($course)) { |
2870 | 2870 | |
2871 | - $course_id = $course['real_id']; |
|
2871 | + $course_id = $course['real_id']; |
|
2872 | 2872 | |
2873 | 2873 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2874 | 2874 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2882,8 +2882,8 @@ discard block |
||
2882 | 2882 | // calculates last connection time |
2883 | 2883 | if ($count_row_lp > 0) { |
2884 | 2884 | $sql = 'SELECT MAX(start_time) |
2885 | - FROM ' . $t_lpiv . ' AS item_view |
|
2886 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2885 | + FROM ' . $t_lpiv.' AS item_view |
|
2886 | + INNER JOIN ' . $t_lpv.' AS view |
|
2887 | 2887 | ON item_view.lp_view_id = view.id |
2888 | 2888 | WHERE |
2889 | 2889 | item_view.c_id = '.$course_id.' AND |
@@ -2919,15 +2919,15 @@ discard block |
||
2919 | 2919 | |
2920 | 2920 | // At first, courses where $coach_id is coach of the course // |
2921 | 2921 | $sql = 'SELECT session_id, c_id |
2922 | - FROM ' . $tbl_session_course_user . ' |
|
2922 | + FROM ' . $tbl_session_course_user.' |
|
2923 | 2923 | WHERE user_id=' . $coach_id.' AND status=2'; |
2924 | 2924 | |
2925 | 2925 | if (api_is_multiple_url_enabled()) { |
2926 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2926 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2927 | 2927 | $access_url_id = api_get_current_access_url_id(); |
2928 | 2928 | if ($access_url_id != -1) { |
2929 | 2929 | $sql = 'SELECT scu.session_id, scu.c_id |
2930 | - FROM ' . $tbl_session_course_user . ' scu |
|
2930 | + FROM ' . $tbl_session_course_user.' scu |
|
2931 | 2931 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2932 | 2932 | ON (scu.session_id=sru.session_id) |
2933 | 2933 | WHERE |
@@ -2961,28 +2961,28 @@ discard block |
||
2961 | 2961 | |
2962 | 2962 | // Then, courses where $coach_id is coach of the session // |
2963 | 2963 | $sql = 'SELECT session_course_user.user_id |
2964 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2964 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2965 | 2965 | INNER JOIN '.$tbl_session_user.' sru |
2966 | 2966 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2967 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2967 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2968 | 2968 | ON session_course.c_id = session_course_user.c_id |
2969 | 2969 | AND session_course_user.session_id = session_course.session_id |
2970 | - INNER JOIN ' . $tbl_session . ' as session |
|
2970 | + INNER JOIN ' . $tbl_session.' as session |
|
2971 | 2971 | ON session.id = session_course.session_id |
2972 | 2972 | AND session.id_coach = ' . $coach_id; |
2973 | 2973 | if (api_is_multiple_url_enabled()) { |
2974 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2974 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2975 | 2975 | $access_url_id = api_get_current_access_url_id(); |
2976 | - if ($access_url_id != -1){ |
|
2976 | + if ($access_url_id != -1) { |
|
2977 | 2977 | $sql = 'SELECT session_course_user.user_id |
2978 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2978 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2979 | 2979 | INNER JOIN '.$tbl_session_user.' sru |
2980 | 2980 | ON session_course_user.user_id = sru.user_id AND |
2981 | 2981 | session_course_user.session_id = sru.session_id |
2982 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2982 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2983 | 2983 | ON session_course.c_id = session_course_user.c_id AND |
2984 | 2984 | session_course_user.session_id = session_course.session_id |
2985 | - INNER JOIN ' . $tbl_session . ' as session |
|
2985 | + INNER JOIN ' . $tbl_session.' as session |
|
2986 | 2986 | ON session.id = session_course.session_id AND |
2987 | 2987 | session.id_coach = ' . $coach_id.' |
2988 | 2988 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -3012,8 +3012,8 @@ discard block |
||
3012 | 3012 | |
3013 | 3013 | $students = []; |
3014 | 3014 | // At first, courses where $coach_id is coach of the course // |
3015 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
3016 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
3015 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
3016 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
3017 | 3017 | $result = Database::query($sql); |
3018 | 3018 | |
3019 | 3019 | while ($a_courses = Database::fetch_array($result)) { |
@@ -3023,7 +3023,7 @@ discard block |
||
3023 | 3023 | FROM $tbl_session_course_user AS srcru |
3024 | 3024 | WHERE |
3025 | 3025 | c_id = '$courseId' AND |
3026 | - session_id = '" . $id_session . "'"; |
|
3026 | + session_id = '".$id_session."'"; |
|
3027 | 3027 | $rs = Database::query($sql); |
3028 | 3028 | while ($row = Database::fetch_array($rs)) { |
3029 | 3029 | $students[$row['user_id']] = $row['user_id']; |
@@ -3031,15 +3031,15 @@ discard block |
||
3031 | 3031 | } |
3032 | 3032 | |
3033 | 3033 | // Then, courses where $coach_id is coach of the session |
3034 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
3035 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
3034 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
3035 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
3036 | 3036 | $result = Database::query($sql); |
3037 | 3037 | |
3038 | 3038 | //He is the session_coach so we select all the users in the session |
3039 | 3039 | if (Database::num_rows($result) > 0) { |
3040 | 3040 | $sql = 'SELECT DISTINCT srcru.user_id |
3041 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
3042 | - WHERE session_id="' . $id_session . '"'; |
|
3041 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
3042 | + WHERE session_id="' . $id_session.'"'; |
|
3043 | 3043 | $result = Database::query($sql); |
3044 | 3044 | while ($row = Database::fetch_array($result)) { |
3045 | 3045 | $students[$row['user_id']] = $row['user_id']; |
@@ -3066,8 +3066,8 @@ discard block |
||
3066 | 3066 | |
3067 | 3067 | // At first, courses where $coach_id is coach of the course // |
3068 | 3068 | |
3069 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
3070 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
3069 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
3070 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
3071 | 3071 | $result = Database::query($sql); |
3072 | 3072 | if (Database::num_rows($result) > 0) { |
3073 | 3073 | return true; |
@@ -3075,12 +3075,12 @@ discard block |
||
3075 | 3075 | |
3076 | 3076 | // Then, courses where $coach_id is coach of the session |
3077 | 3077 | $sql = 'SELECT session_course_user.user_id |
3078 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
3079 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
3078 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
3079 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
3080 | 3080 | ON session_course.c_id = session_course_user.c_id |
3081 | - INNER JOIN ' . $tbl_session . ' as session |
|
3081 | + INNER JOIN ' . $tbl_session.' as session |
|
3082 | 3082 | ON session.id = session_course.session_id |
3083 | - AND session.id_coach = ' . $coach_id . ' |
|
3083 | + AND session.id_coach = ' . $coach_id.' |
|
3084 | 3084 | WHERE user_id = ' . $student_id; |
3085 | 3085 | $result = Database::query($sql); |
3086 | 3086 | if (Database::num_rows($result) > 0) { |
@@ -3112,16 +3112,16 @@ discard block |
||
3112 | 3112 | // At first, courses where $coach_id is coach of the course. |
3113 | 3113 | |
3114 | 3114 | $sql = 'SELECT DISTINCT c.code |
3115 | - FROM ' . $tbl_session_course_user . ' sc |
|
3115 | + FROM ' . $tbl_session_course_user.' sc |
|
3116 | 3116 | INNER JOIN '.$tbl_course.' c |
3117 | 3117 | ON (c.id = sc.c_id) |
3118 | 3118 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
3119 | 3119 | |
3120 | 3120 | if (api_is_multiple_url_enabled()) { |
3121 | 3121 | $access_url_id = api_get_current_access_url_id(); |
3122 | - if ($access_url_id != -1){ |
|
3122 | + if ($access_url_id != -1) { |
|
3123 | 3123 | $sql = 'SELECT DISTINCT c.code |
3124 | - FROM ' . $tbl_session_course_user . ' scu |
|
3124 | + FROM ' . $tbl_session_course_user.' scu |
|
3125 | 3125 | INNER JOIN '.$tbl_course.' c |
3126 | 3126 | ON (c.code = scu.c_id) |
3127 | 3127 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3134,7 +3134,7 @@ discard block |
||
3134 | 3134 | } |
3135 | 3135 | |
3136 | 3136 | if (!empty($id_session)) { |
3137 | - $sql .= ' AND session_id=' . $id_session; |
|
3137 | + $sql .= ' AND session_id='.$id_session; |
|
3138 | 3138 | } |
3139 | 3139 | |
3140 | 3140 | $courseList = array(); |
@@ -3146,25 +3146,25 @@ discard block |
||
3146 | 3146 | // Then, courses where $coach_id is coach of the session |
3147 | 3147 | |
3148 | 3148 | $sql = 'SELECT DISTINCT course.code |
3149 | - FROM ' . $tbl_session_course . ' as session_course |
|
3150 | - INNER JOIN ' . $tbl_session . ' as session |
|
3149 | + FROM ' . $tbl_session_course.' as session_course |
|
3150 | + INNER JOIN ' . $tbl_session.' as session |
|
3151 | 3151 | ON session.id = session_course.session_id |
3152 | - AND session.id_coach = ' . $coach_id . ' |
|
3153 | - INNER JOIN ' . $tbl_course . ' as course |
|
3152 | + AND session.id_coach = ' . $coach_id.' |
|
3153 | + INNER JOIN ' . $tbl_course.' as course |
|
3154 | 3154 | ON course.id = session_course.c_id'; |
3155 | 3155 | |
3156 | 3156 | if (api_is_multiple_url_enabled()) { |
3157 | 3157 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3158 | 3158 | $access_url_id = api_get_current_access_url_id(); |
3159 | - if ($access_url_id != -1){ |
|
3159 | + if ($access_url_id != -1) { |
|
3160 | 3160 | $sql = 'SELECT DISTINCT c.code |
3161 | - FROM ' . $tbl_session_course . ' as session_course |
|
3161 | + FROM ' . $tbl_session_course.' as session_course |
|
3162 | 3162 | INNER JOIN '.$tbl_course.' c |
3163 | 3163 | ON (c.id = session_course.c_id) |
3164 | - INNER JOIN ' . $tbl_session . ' as session |
|
3164 | + INNER JOIN ' . $tbl_session.' as session |
|
3165 | 3165 | ON session.id = session_course.session_id |
3166 | - AND session.id_coach = ' . $coach_id . ' |
|
3167 | - INNER JOIN ' . $tbl_course . ' as course |
|
3166 | + AND session.id_coach = ' . $coach_id.' |
|
3167 | + INNER JOIN ' . $tbl_course.' as course |
|
3168 | 3168 | ON course.id = session_course.c_id |
3169 | 3169 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3170 | 3170 | ON (course_rel_url.c_id = c.id)'; |
@@ -3172,12 +3172,12 @@ discard block |
||
3172 | 3172 | } |
3173 | 3173 | |
3174 | 3174 | if (!empty ($id_session)) { |
3175 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3175 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3176 | 3176 | if (api_is_multiple_url_enabled()) |
3177 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3178 | - } else { |
|
3177 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3178 | + } else { |
|
3179 | 3179 | if (api_is_multiple_url_enabled()) |
3180 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3180 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3181 | 3181 | } |
3182 | 3182 | |
3183 | 3183 | $result = Database::query($sql); |
@@ -3233,7 +3233,7 @@ discard block |
||
3233 | 3233 | } |
3234 | 3234 | } |
3235 | 3235 | |
3236 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3236 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3237 | 3237 | $access_url_id = api_get_current_access_url_id(); |
3238 | 3238 | |
3239 | 3239 | $sql = " |
@@ -3353,7 +3353,7 @@ discard block |
||
3353 | 3353 | // table definition |
3354 | 3354 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3355 | 3355 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3356 | - $course_id = $a_course['real_id']; |
|
3356 | + $course_id = $a_course['real_id']; |
|
3357 | 3357 | if (is_array($student_id)) { |
3358 | 3358 | $studentList = array_map('intval', $student_id); |
3359 | 3359 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3404,7 +3404,7 @@ discard block |
||
3404 | 3404 | $a_course = CourseManager::get_course_information($course_code); |
3405 | 3405 | if (!empty($a_course)) { |
3406 | 3406 | $course_id = $a_course['real_id']; |
3407 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3407 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3408 | 3408 | } |
3409 | 3409 | |
3410 | 3410 | // table definition |
@@ -3413,14 +3413,14 @@ discard block |
||
3413 | 3413 | |
3414 | 3414 | if (is_array($student_id)) { |
3415 | 3415 | $studentList = array_map('intval', $student_id); |
3416 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3416 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3417 | 3417 | } else { |
3418 | 3418 | $student_id = intval($student_id); |
3419 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3419 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3420 | 3420 | } |
3421 | 3421 | if (isset($session_id)) { |
3422 | 3422 | $session_id = intval($session_id); |
3423 | - $conditions[]= " pub.session_id = $session_id "; |
|
3423 | + $conditions[] = " pub.session_id = $session_id "; |
|
3424 | 3424 | } |
3425 | 3425 | $conditionToString = implode('AND', $conditions); |
3426 | 3426 | |
@@ -3453,8 +3453,8 @@ discard block |
||
3453 | 3453 | $courseCondition = null; |
3454 | 3454 | $conditions = array(); |
3455 | 3455 | if (!empty($courseInfo)) { |
3456 | - $course_id = $courseInfo['real_id']; |
|
3457 | - $conditions[]= " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3456 | + $course_id = $courseInfo['real_id']; |
|
3457 | + $conditions[] = " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3458 | 3458 | } |
3459 | 3459 | |
3460 | 3460 | // Table definition. |
@@ -3463,15 +3463,15 @@ discard block |
||
3463 | 3463 | |
3464 | 3464 | if (is_array($student_id)) { |
3465 | 3465 | $studentList = array_map('intval', $student_id); |
3466 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3466 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3467 | 3467 | } else { |
3468 | 3468 | $student_id = intval($student_id); |
3469 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3469 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3470 | 3470 | } |
3471 | 3471 | |
3472 | 3472 | if (isset($session_id)) { |
3473 | 3473 | $session_id = intval($session_id); |
3474 | - $conditions[]= " forum.session_id = $session_id"; |
|
3474 | + $conditions[] = " forum.session_id = $session_id"; |
|
3475 | 3475 | } |
3476 | 3476 | |
3477 | 3477 | $conditionsToString = implode('AND ', $conditions); |
@@ -3506,7 +3506,7 @@ discard block |
||
3506 | 3506 | $condition_session = ''; |
3507 | 3507 | if (isset($session_id)) { |
3508 | 3508 | $session_id = intval($session_id); |
3509 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3509 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3510 | 3510 | } |
3511 | 3511 | |
3512 | 3512 | $course_id = $courseInfo['real_id']; |
@@ -3562,7 +3562,7 @@ discard block |
||
3562 | 3562 | $condition_session = ''; |
3563 | 3563 | if (isset($session_id)) { |
3564 | 3564 | $session_id = intval($session_id); |
3565 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3565 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3566 | 3566 | } |
3567 | 3567 | |
3568 | 3568 | $groupId = intval($groupId); |
@@ -3623,7 +3623,7 @@ discard block |
||
3623 | 3623 | $condition_session = ''; |
3624 | 3624 | if (isset($session_id)) { |
3625 | 3625 | $session_id = intval($session_id); |
3626 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3626 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3627 | 3627 | } |
3628 | 3628 | |
3629 | 3629 | $groupId = intval($groupId); |
@@ -3702,7 +3702,7 @@ discard block |
||
3702 | 3702 | { |
3703 | 3703 | $student_id = intval($student_id); |
3704 | 3704 | $courseId = intval($courseId); |
3705 | - $session_id = intval($session_id); |
|
3705 | + $session_id = intval($session_id); |
|
3706 | 3706 | $date_time = ''; |
3707 | 3707 | |
3708 | 3708 | // table definition |
@@ -3771,7 +3771,7 @@ discard block |
||
3771 | 3771 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3772 | 3772 | |
3773 | 3773 | $sql = 'SELECT 1 |
3774 | - FROM ' . $table . ' |
|
3774 | + FROM ' . $table.' |
|
3775 | 3775 | WHERE down_user_id = '.$student_id.' |
3776 | 3776 | AND c_id = "'.$courseId.'" |
3777 | 3777 | AND down_session_id = '.$session_id.' '; |
@@ -3849,30 +3849,30 @@ discard block |
||
3849 | 3849 | '.$inner.' |
3850 | 3850 | WHERE c.id = '.$courseId.' |
3851 | 3851 | GROUP BY stats_login.user_id |
3852 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3852 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3853 | 3853 | |
3854 | 3854 | if ($since == 'never') { |
3855 | 3855 | if (empty($session_id)) { |
3856 | 3856 | $sql = 'SELECT course_user.user_id |
3857 | - FROM ' . $table_course_rel_user . ' course_user |
|
3858 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3857 | + FROM ' . $table_course_rel_user.' course_user |
|
3858 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3859 | 3859 | ON course_user.user_id = stats_login.user_id AND |
3860 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3861 | - INNER JOIN ' . $tableCourse . ' c |
|
3860 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3861 | + INNER JOIN ' . $tableCourse.' c |
|
3862 | 3862 | ON (c.id = course_user.c_id) |
3863 | 3863 | WHERE |
3864 | - course_user.c_id = ' . $courseId . ' AND |
|
3864 | + course_user.c_id = ' . $courseId.' AND |
|
3865 | 3865 | stats_login.login_course_date IS NULL |
3866 | 3866 | GROUP BY course_user.user_id'; |
3867 | 3867 | } else { |
3868 | 3868 | $sql = 'SELECT session_course_user.user_id |
3869 | 3869 | FROM '.$tbl_session_course_user.' session_course_user |
3870 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3870 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3871 | 3871 | ON session_course_user.user_id = stats_login.user_id |
3872 | - INNER JOIN ' . $tableCourse . ' c |
|
3872 | + INNER JOIN ' . $tableCourse.' c |
|
3873 | 3873 | ON (c.id = session_course_user.c_id) |
3874 | 3874 | WHERE |
3875 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3875 | + session_course_user.c_id = ' . $courseId.' AND |
|
3876 | 3876 | stats_login.login_course_date IS NULL |
3877 | 3877 | GROUP BY session_course_user.user_id'; |
3878 | 3878 | |
@@ -3881,7 +3881,7 @@ discard block |
||
3881 | 3881 | |
3882 | 3882 | $rs = Database::query($sql); |
3883 | 3883 | $inactive_users = array(); |
3884 | - while($user = Database::fetch_array($rs)) { |
|
3884 | + while ($user = Database::fetch_array($rs)) { |
|
3885 | 3885 | $inactive_users[] = $user['user_id']; |
3886 | 3886 | } |
3887 | 3887 | |
@@ -3903,10 +3903,10 @@ discard block |
||
3903 | 3903 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3904 | 3904 | |
3905 | 3905 | $sql = 'SELECT '.$student_id.' |
3906 | - FROM ' . $table . ' |
|
3906 | + FROM ' . $table.' |
|
3907 | 3907 | WHERE |
3908 | - access_user_id=' . $student_id . ' AND |
|
3909 | - c_id="' . $courseId . '" AND |
|
3908 | + access_user_id=' . $student_id.' AND |
|
3909 | + c_id="' . $courseId.'" AND |
|
3910 | 3910 | access_session_id = "'.$session_id.'" '; |
3911 | 3911 | |
3912 | 3912 | $rs = Database::query($sql); |
@@ -3924,13 +3924,13 @@ discard block |
||
3924 | 3924 | { |
3925 | 3925 | $hr_dept_id = intval($hr_dept_id); |
3926 | 3926 | $a_students = array(); |
3927 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3927 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3928 | 3928 | |
3929 | 3929 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3930 | 3930 | WHERE hr_dept_id='.$hr_dept_id; |
3931 | 3931 | $rs = Database::query($sql); |
3932 | 3932 | |
3933 | - while($user = Database :: fetch_array($rs)) { |
|
3933 | + while ($user = Database :: fetch_array($rs)) { |
|
3934 | 3934 | $a_students[$user['user_id']] = $user['user_id']; |
3935 | 3935 | } |
3936 | 3936 | |
@@ -3955,7 +3955,7 @@ discard block |
||
3955 | 3955 | $condition_session = ''; |
3956 | 3956 | if (isset($session_id)) { |
3957 | 3957 | $session_id = intval($session_id); |
3958 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3958 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3959 | 3959 | } |
3960 | 3960 | $sql = "SELECT |
3961 | 3961 | access_tool, |
@@ -4067,7 +4067,7 @@ discard block |
||
4067 | 4067 | if (!empty($date_from) && !empty($date_to)) { |
4068 | 4068 | $fieldStartDate = $fields['start_date']; |
4069 | 4069 | if (!isset($fields['end_date'])) { |
4070 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
4070 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
4071 | 4071 | } else { |
4072 | 4072 | $fieldEndDate = $fields['end_date']; |
4073 | 4073 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4083,12 +4083,12 @@ discard block |
||
4083 | 4083 | $where |
4084 | 4084 | GROUP BY %s"; |
4085 | 4085 | $sql = sprintf($sql, |
4086 | - $fields['user'], //user field |
|
4087 | - $tableName, //FROM |
|
4088 | - $fields['course'], //course condition |
|
4089 | - $course['real_id'], //course condition |
|
4090 | - $fields['user'], //user condition |
|
4091 | - $userId, //user condition |
|
4086 | + $fields['user'], //user field |
|
4087 | + $tableName, //FROM |
|
4088 | + $fields['course'], //course condition |
|
4089 | + $course['real_id'], //course condition |
|
4090 | + $fields['user'], //user condition |
|
4091 | + $userId, //user condition |
|
4092 | 4092 | $fields['user'] //GROUP BY |
4093 | 4093 | ); |
4094 | 4094 | $rs = Database::query($sql); |
@@ -4096,7 +4096,7 @@ discard block |
||
4096 | 4096 | //iterate query |
4097 | 4097 | if (Database::num_rows($rs) > 0) { |
4098 | 4098 | while ($row = Database::fetch_array($rs)) { |
4099 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
4099 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
4100 | 4100 | } |
4101 | 4101 | } |
4102 | 4102 | } |
@@ -4119,11 +4119,11 @@ discard block |
||
4119 | 4119 | $courseId = api_get_course_int_id($course_code); |
4120 | 4120 | $data = array(); |
4121 | 4121 | |
4122 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4122 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4123 | 4123 | $condition_session = ''; |
4124 | 4124 | if (isset($session_id)) { |
4125 | 4125 | $session_id = intval($session_id); |
4126 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4126 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4127 | 4127 | } |
4128 | 4128 | $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
4129 | 4129 | FROM $TABLETRACK_DOWNLOADS |
@@ -4308,7 +4308,7 @@ discard block |
||
4308 | 4308 | |
4309 | 4309 | $final_course_data = array(); |
4310 | 4310 | |
4311 | - foreach($my_course_data as $course_id => $value) { |
|
4311 | + foreach ($my_course_data as $course_id => $value) { |
|
4312 | 4312 | $final_course_data[$course_id] = $course_list[$course_id]; |
4313 | 4313 | } |
4314 | 4314 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4329,7 +4329,7 @@ discard block |
||
4329 | 4329 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4330 | 4330 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4331 | 4331 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4332 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4332 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4333 | 4333 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4334 | 4334 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4335 | 4335 | </tr>'; |
@@ -4416,7 +4416,7 @@ discard block |
||
4416 | 4416 | $all_exercise_start_time = array(); |
4417 | 4417 | |
4418 | 4418 | foreach ($course_in_session as $my_session_id => $session_data) { |
4419 | - $course_list = $session_data['course_list']; |
|
4419 | + $course_list = $session_data['course_list']; |
|
4420 | 4420 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4421 | 4421 | $exercise_graph_name_list = array(); |
4422 | 4422 | //$user_results = array(); |
@@ -4461,20 +4461,20 @@ discard block |
||
4461 | 4461 | |
4462 | 4462 | $score = 0; |
4463 | 4463 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4464 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4464 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4465 | 4465 | } |
4466 | 4466 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4467 | 4467 | $all_exercise_start_time[] = $time; |
4468 | 4468 | $my_results[] = $score; |
4469 | - if (count($exercise_list)<=10) { |
|
4469 | + if (count($exercise_list) <= 10) { |
|
4470 | 4470 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4471 | - $exercise_graph_name_list[]= $title; |
|
4471 | + $exercise_graph_name_list[] = $title; |
|
4472 | 4472 | $all_exercise_graph_name_list[] = $title; |
4473 | 4473 | } else { |
4474 | 4474 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4475 | 4475 | $title = cut($exercise_data['title'], 30); |
4476 | - $exercise_graph_name_list[]= $title; |
|
4477 | - $all_exercise_graph_name_list[]= $title; |
|
4476 | + $exercise_graph_name_list[] = $title; |
|
4477 | + $all_exercise_graph_name_list[] = $title; |
|
4478 | 4478 | } |
4479 | 4479 | } |
4480 | 4480 | } |
@@ -4507,7 +4507,7 @@ discard block |
||
4507 | 4507 | } |
4508 | 4508 | |
4509 | 4509 | $html .= Display::page_subheader( |
4510 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4510 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4511 | 4511 | ); |
4512 | 4512 | |
4513 | 4513 | $html .= '<table class="data_table" width="100%">'; |
@@ -4557,7 +4557,7 @@ discard block |
||
4557 | 4557 | $courseInfo['real_id'], |
4558 | 4558 | $my_session_id |
4559 | 4559 | ); |
4560 | - if ($attempts > 1) { |
|
4560 | + if ($attempts > 1) { |
|
4561 | 4561 | $answered_exercises++; |
4562 | 4562 | } |
4563 | 4563 | } |
@@ -4570,7 +4570,7 @@ discard block |
||
4570 | 4570 | $all_average += $average; |
4571 | 4571 | } |
4572 | 4572 | |
4573 | - $all_average = $all_average / count($course_list); |
|
4573 | + $all_average = $all_average / count($course_list); |
|
4574 | 4574 | |
4575 | 4575 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4576 | 4576 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4595,31 +4595,31 @@ discard block |
||
4595 | 4595 | $html .= '</tr>'; |
4596 | 4596 | } |
4597 | 4597 | $html .= '</table><br />'; |
4598 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4598 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4599 | 4599 | |
4600 | 4600 | // Checking selected session. |
4601 | 4601 | |
4602 | 4602 | if (isset($_GET['session_id'])) { |
4603 | 4603 | $session_id_from_get = intval($_GET['session_id']); |
4604 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4605 | - $course_list = $session_data['course_list']; |
|
4604 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4605 | + $course_list = $session_data['course_list']; |
|
4606 | 4606 | |
4607 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4607 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4608 | 4608 | |
4609 | 4609 | $html .= '<table class="data_table" width="100%">'; |
4610 | 4610 | //'.Display::tag('th', get_lang('DoneExercises'), array('class'=>'head')).' |
4611 | 4611 | $html .= ' |
4612 | 4612 | <tr> |
4613 | 4613 | <th width="300px">'.get_lang('Course').'</th> |
4614 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4615 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4616 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4617 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4618 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4619 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4620 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4621 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4622 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4614 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4615 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4616 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4617 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4618 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4619 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4620 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4621 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4622 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4623 | 4623 | </tr>'; |
4624 | 4624 | |
4625 | 4625 | foreach ($course_list as $course_data) { |
@@ -4635,14 +4635,14 @@ discard block |
||
4635 | 4635 | $count_exercises = count($exercises); |
4636 | 4636 | } |
4637 | 4637 | $answered_exercises = 0; |
4638 | - foreach($exercises as $exercise_item) { |
|
4638 | + foreach ($exercises as $exercise_item) { |
|
4639 | 4639 | $attempts = Event::count_exercise_attempts_by_user( |
4640 | 4640 | api_get_user_id(), |
4641 | 4641 | $exercise_item['id'], |
4642 | 4642 | $courseId, |
4643 | 4643 | $session_id_from_get |
4644 | 4644 | ); |
4645 | - if ($attempts > 1) { |
|
4645 | + if ($attempts > 1) { |
|
4646 | 4646 | $answered_exercises++; |
4647 | 4647 | } |
4648 | 4648 | } |
@@ -4651,7 +4651,7 @@ discard block |
||
4651 | 4651 | |
4652 | 4652 | // Average |
4653 | 4653 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4654 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4654 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4655 | 4655 | |
4656 | 4656 | $stats_array[$course_code] = array( |
4657 | 4657 | 'exercises' => $count_exercises, |
@@ -4721,11 +4721,11 @@ discard block |
||
4721 | 4721 | } |
4722 | 4722 | //Score |
4723 | 4723 | $html .= Display::tag('td', $percentage_score, array('align'=>'center')); |
4724 | - $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
4724 | + $html .= Display::tag('td', $last_connection, array('align'=>'center')); |
|
4725 | 4725 | |
4726 | 4726 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4727 | 4727 | $details = '<a href="#">'; |
4728 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4728 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4729 | 4729 | } else { |
4730 | 4730 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4731 | 4731 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4848,7 +4848,7 @@ discard block |
||
4848 | 4848 | ); |
4849 | 4849 | |
4850 | 4850 | $latest_attempt_url = ''; |
4851 | - $best_score = $position = $percentage_score_result = '-'; |
|
4851 | + $best_score = $position = $percentage_score_result = '-'; |
|
4852 | 4852 | $graph = $normal_graph = null; |
4853 | 4853 | |
4854 | 4854 | // Getting best results |
@@ -4884,7 +4884,7 @@ discard block |
||
4884 | 4884 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4885 | 4885 | $my_score = 0; |
4886 | 4886 | if (!empty($weighting) && intval($weighting) != 0) { |
4887 | - $my_score = $score/$weighting; |
|
4887 | + $my_score = $score / $weighting; |
|
4888 | 4888 | } |
4889 | 4889 | //@todo this function slows the page |
4890 | 4890 | $position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list); |
@@ -4895,14 +4895,14 @@ discard block |
||
4895 | 4895 | } |
4896 | 4896 | $html .= Display::div( |
4897 | 4897 | $normal_graph, |
4898 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4898 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4899 | 4899 | ); |
4900 | 4900 | |
4901 | 4901 | if (empty($graph)) { |
4902 | 4902 | $graph = '-'; |
4903 | 4903 | } else { |
4904 | 4904 | $graph = Display::url( |
4905 | - '<img src="' . $graph . '" >', |
|
4905 | + '<img src="'.$graph.'" >', |
|
4906 | 4906 | $normal_graph, |
4907 | 4907 | array( |
4908 | 4908 | 'id' => $exercices['id'], |
@@ -4935,7 +4935,7 @@ discard block |
||
4935 | 4935 | |
4936 | 4936 | |
4937 | 4937 | // LP table results |
4938 | - $html .='<table class="data_table">'; |
|
4938 | + $html .= '<table class="data_table">'; |
|
4939 | 4939 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
4940 | 4940 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
4941 | 4941 | $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -4989,7 +4989,7 @@ discard block |
||
4989 | 4989 | if (!empty($last_connection_in_lp)) { |
4990 | 4990 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
4991 | 4991 | } |
4992 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
4992 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
4993 | 4993 | $html .= "</tr>"; |
4994 | 4994 | } |
4995 | 4995 | } else { |
@@ -4999,7 +4999,7 @@ discard block |
||
4999 | 4999 | </td> |
5000 | 5000 | </tr>'; |
5001 | 5001 | } |
5002 | - $html .='</table>'; |
|
5002 | + $html .= '</table>'; |
|
5003 | 5003 | } |
5004 | 5004 | |
5005 | 5005 | return $html; |
@@ -5026,7 +5026,7 @@ discard block |
||
5026 | 5026 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
5027 | 5027 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
5028 | 5028 | $myData->setAxisUnit(0, '%'); |
5029 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5029 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5030 | 5030 | // Cache definition |
5031 | 5031 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5032 | 5032 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -5034,9 +5034,9 @@ discard block |
||
5034 | 5034 | |
5035 | 5035 | if ($myCache->isInCache($chartHash)) { |
5036 | 5036 | //if we already created the img |
5037 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5037 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5038 | 5038 | $myCache->saveFromCache($chartHash, $imgPath); |
5039 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5039 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5040 | 5040 | } else { |
5041 | 5041 | /* Define width, height and angle */ |
5042 | 5042 | $mainWidth = 860; |
@@ -5065,7 +5065,7 @@ discard block |
||
5065 | 5065 | /* Set the default font */ |
5066 | 5066 | $myPicture->setFontProperties( |
5067 | 5067 | array( |
5068 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5068 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5069 | 5069 | 'FontSize' => 10) |
5070 | 5070 | ); |
5071 | 5071 | /* Write the chart title */ |
@@ -5082,7 +5082,7 @@ discard block |
||
5082 | 5082 | /* Set the default font */ |
5083 | 5083 | $myPicture->setFontProperties( |
5084 | 5084 | array( |
5085 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5085 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5086 | 5086 | 'FontSize' => 6 |
5087 | 5087 | ) |
5088 | 5088 | ); |
@@ -5124,7 +5124,7 @@ discard block |
||
5124 | 5124 | /* Draw the line chart */ |
5125 | 5125 | $myPicture->setFontProperties( |
5126 | 5126 | array( |
5127 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5127 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5128 | 5128 | 'FontSize' => 10 |
5129 | 5129 | ) |
5130 | 5130 | ); |
@@ -5157,12 +5157,12 @@ discard block |
||
5157 | 5157 | ); |
5158 | 5158 | |
5159 | 5159 | $myCache->writeToCache($chartHash, $myPicture); |
5160 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5160 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5161 | 5161 | $myCache->saveFromCache($chartHash, $imgPath); |
5162 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5162 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5163 | 5163 | } |
5164 | 5164 | |
5165 | - $html = '<img src="' . $imgPath . '">'; |
|
5165 | + $html = '<img src="'.$imgPath.'">'; |
|
5166 | 5166 | |
5167 | 5167 | return $html; |
5168 | 5168 | } |
@@ -5183,12 +5183,12 @@ discard block |
||
5183 | 5183 | |
5184 | 5184 | foreach ($attempts as $attempt) { |
5185 | 5185 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5186 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5187 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5186 | + if ($attempt['exe_weighting'] != 0) { |
|
5187 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5188 | 5188 | } |
5189 | 5189 | } else { |
5190 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5191 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5190 | + if ($attempt['exe_weighting'] != 0) { |
|
5191 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5192 | 5192 | } |
5193 | 5193 | } |
5194 | 5194 | } |
@@ -5197,27 +5197,27 @@ discard block |
||
5197 | 5197 | rsort($my_exercise_result_array); |
5198 | 5198 | $my_exercise_result = 0; |
5199 | 5199 | if (isset($my_exercise_result_array[0])) { |
5200 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5200 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5201 | 5201 | } |
5202 | 5202 | |
5203 | 5203 | $max = 100; |
5204 | - $pieces = 5 ; |
|
5204 | + $pieces = 5; |
|
5205 | 5205 | $part = round($max / $pieces); |
5206 | 5206 | $x_axis = array(); |
5207 | 5207 | $final_array = array(); |
5208 | 5208 | $my_final_array = array(); |
5209 | 5209 | |
5210 | - for ($i=1; $i <=$pieces; $i++) { |
|
5210 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5211 | 5211 | $sum = 1; |
5212 | 5212 | if ($i == 1) { |
5213 | 5213 | $sum = 0; |
5214 | 5214 | } |
5215 | - $min = ($i-1)*$part + $sum; |
|
5216 | - $max = ($i)*$part; |
|
5217 | - $x_axis[]= $min." - ".$max; |
|
5215 | + $min = ($i - 1) * $part + $sum; |
|
5216 | + $max = ($i) * $part; |
|
5217 | + $x_axis[] = $min." - ".$max; |
|
5218 | 5218 | $count = 0; |
5219 | - foreach($exercise_result as $result) { |
|
5220 | - $percentage = $result*100; |
|
5219 | + foreach ($exercise_result as $result) { |
|
5220 | + $percentage = $result * 100; |
|
5221 | 5221 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5222 | 5222 | if ($percentage >= $min && $percentage <= $max) { |
5223 | 5223 | //echo ' is > '; |
@@ -5225,7 +5225,7 @@ discard block |
||
5225 | 5225 | } |
5226 | 5226 | } |
5227 | 5227 | //echo '<br />'; |
5228 | - $final_array[]= $count; |
|
5228 | + $final_array[] = $count; |
|
5229 | 5229 | |
5230 | 5230 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5231 | 5231 | $my_final_array[] = 1; |
@@ -5235,9 +5235,9 @@ discard block |
||
5235 | 5235 | } |
5236 | 5236 | |
5237 | 5237 | //Fix to remove the data of the user with my data |
5238 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5238 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5239 | 5239 | if (!empty($my_final_array[$i])) { |
5240 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5240 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5241 | 5241 | $final_array[$i] = 0; |
5242 | 5242 | } |
5243 | 5243 | } |
@@ -5247,16 +5247,16 @@ discard block |
||
5247 | 5247 | $dataSet->addPoints($final_array, 'Serie1'); |
5248 | 5248 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5249 | 5249 | $dataSet->normalize(100, "%"); |
5250 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5250 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5251 | 5251 | |
5252 | 5252 | // Cache definition |
5253 | 5253 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5254 | 5254 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5255 | 5255 | $chartHash = $myCache->getHash($dataSet); |
5256 | 5256 | if ($myCache->isInCache($chartHash)) { |
5257 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5257 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5258 | 5258 | $myCache->saveFromCache($chartHash, $imgPath); |
5259 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5259 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5260 | 5260 | } else { |
5261 | 5261 | /* Create the pChart object */ |
5262 | 5262 | $widthSize = 80; |
@@ -5272,7 +5272,7 @@ discard block |
||
5272 | 5272 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5273 | 5273 | |
5274 | 5274 | /* Set the default font */ |
5275 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5275 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5276 | 5276 | |
5277 | 5277 | /* Do not write the chart title */ |
5278 | 5278 | |
@@ -5336,9 +5336,9 @@ discard block |
||
5336 | 5336 | |
5337 | 5337 | /* Save and write in cache */ |
5338 | 5338 | $myCache->writeToCache($chartHash, $myPicture); |
5339 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5339 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5340 | 5340 | $myCache->saveFromCache($chartHash, $imgPath); |
5341 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5341 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5342 | 5342 | } |
5343 | 5343 | |
5344 | 5344 | return $imgPath; |
@@ -5358,12 +5358,12 @@ discard block |
||
5358 | 5358 | } |
5359 | 5359 | foreach ($attempts as $attempt) { |
5360 | 5360 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5361 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5362 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5361 | + if ($attempt['exe_weighting'] != 0) { |
|
5362 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5363 | 5363 | } |
5364 | 5364 | } else { |
5365 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5366 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5365 | + if ($attempt['exe_weighting'] != 0) { |
|
5366 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5367 | 5367 | } |
5368 | 5368 | } |
5369 | 5369 | } |
@@ -5372,32 +5372,32 @@ discard block |
||
5372 | 5372 | rsort($my_exercise_result_array); |
5373 | 5373 | $my_exercise_result = 0; |
5374 | 5374 | if (isset($my_exercise_result_array[0])) { |
5375 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5375 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5376 | 5376 | } |
5377 | 5377 | |
5378 | 5378 | $max = 100; |
5379 | - $pieces = 5 ; |
|
5379 | + $pieces = 5; |
|
5380 | 5380 | $part = round($max / $pieces); |
5381 | 5381 | $x_axis = array(); |
5382 | 5382 | $final_array = array(); |
5383 | 5383 | $my_final_array = array(); |
5384 | 5384 | |
5385 | - for ($i=1; $i <=$pieces; $i++) { |
|
5385 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5386 | 5386 | $sum = 1; |
5387 | 5387 | if ($i == 1) { |
5388 | 5388 | $sum = 0; |
5389 | 5389 | } |
5390 | - $min = ($i-1)*$part + $sum; |
|
5391 | - $max = ($i)*$part; |
|
5392 | - $x_axis[]= $min." - ".$max; |
|
5390 | + $min = ($i - 1) * $part + $sum; |
|
5391 | + $max = ($i) * $part; |
|
5392 | + $x_axis[] = $min." - ".$max; |
|
5393 | 5393 | $count = 0; |
5394 | - foreach($exercise_result as $result) { |
|
5395 | - $percentage = $result*100; |
|
5394 | + foreach ($exercise_result as $result) { |
|
5395 | + $percentage = $result * 100; |
|
5396 | 5396 | if ($percentage >= $min && $percentage <= $max) { |
5397 | 5397 | $count++; |
5398 | 5398 | } |
5399 | 5399 | } |
5400 | - $final_array[]= $count; |
|
5400 | + $final_array[] = $count; |
|
5401 | 5401 | |
5402 | 5402 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5403 | 5403 | $my_final_array[] = 1; |
@@ -5408,9 +5408,9 @@ discard block |
||
5408 | 5408 | |
5409 | 5409 | //Fix to remove the data of the user with my data |
5410 | 5410 | |
5411 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5411 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5412 | 5412 | if (!empty($my_final_array[$i])) { |
5413 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5413 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5414 | 5414 | $final_array[$i] = 0; |
5415 | 5415 | } |
5416 | 5416 | } |
@@ -5428,7 +5428,7 @@ discard block |
||
5428 | 5428 | $dataSet->setXAxisName(get_lang('Score')); |
5429 | 5429 | $dataSet->normalize(100, "%"); |
5430 | 5430 | |
5431 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5431 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5432 | 5432 | |
5433 | 5433 | // Cache definition |
5434 | 5434 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5436,9 +5436,9 @@ discard block |
||
5436 | 5436 | $chartHash = $myCache->getHash($dataSet); |
5437 | 5437 | |
5438 | 5438 | if ($myCache->isInCache($chartHash)) { |
5439 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5439 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5440 | 5440 | $myCache->saveFromCache($chartHash, $imgPath); |
5441 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5441 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5442 | 5442 | } else { |
5443 | 5443 | /* Create the pChart object */ |
5444 | 5444 | $widthSize = 480; |
@@ -5454,7 +5454,7 @@ discard block |
||
5454 | 5454 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5455 | 5455 | |
5456 | 5456 | /* Set the default font */ |
5457 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5457 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5458 | 5458 | |
5459 | 5459 | /* Write the chart title */ |
5460 | 5460 | $myPicture->drawText( |
@@ -5513,9 +5513,9 @@ discard block |
||
5513 | 5513 | |
5514 | 5514 | /* Write and save into cache */ |
5515 | 5515 | $myCache->writeToCache($chartHash, $myPicture); |
5516 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5516 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5517 | 5517 | $myCache->saveFromCache($chartHash, $imgPath); |
5518 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5518 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5519 | 5519 | } |
5520 | 5520 | |
5521 | 5521 | return $imgPath; |
@@ -5641,7 +5641,7 @@ discard block |
||
5641 | 5641 | $whereSessionParams .= $sessionIdx.','; |
5642 | 5642 | } |
5643 | 5643 | } |
5644 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5644 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5645 | 5645 | } |
5646 | 5646 | |
5647 | 5647 | if (!empty($exerciseId)) { |
@@ -5702,7 +5702,7 @@ discard block |
||
5702 | 5702 | qq.position = rq.question_order AND |
5703 | 5703 | ta.question_id = rq.question_id |
5704 | 5704 | WHERE |
5705 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5705 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5706 | 5706 | AND q.c_id = $courseIdx |
5707 | 5707 | $where $order $limit"; |
5708 | 5708 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5750,7 +5750,7 @@ discard block |
||
5750 | 5750 | // Now fill users data |
5751 | 5751 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5752 | 5752 | FROM $tuser |
5753 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5753 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5754 | 5754 | $resUsers = Database::query($sqlUsers); |
5755 | 5755 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5756 | 5756 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5846,7 +5846,7 @@ discard block |
||
5846 | 5846 | WHERE |
5847 | 5847 | track_resource.c_id = $course_id AND |
5848 | 5848 | track_resource.insert_user_id = user.user_id AND |
5849 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5849 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5850 | 5850 | |
5851 | 5851 | if (isset($_GET['keyword'])) { |
5852 | 5852 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -5904,7 +5904,7 @@ discard block |
||
5904 | 5904 | WHERE |
5905 | 5905 | track_resource.c_id = $course_id AND |
5906 | 5906 | track_resource.insert_user_id = user.user_id AND |
5907 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5907 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5908 | 5908 | |
5909 | 5909 | if (isset($_GET['keyword'])) { |
5910 | 5910 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6198,7 +6198,7 @@ discard block |
||
6198 | 6198 | public static function display_additional_profile_fields() |
6199 | 6199 | { |
6200 | 6200 | // getting all the extra profile fields that are defined by the platform administrator |
6201 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6201 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6202 | 6202 | |
6203 | 6203 | // creating the form |
6204 | 6204 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6210,8 +6210,8 @@ discard block |
||
6210 | 6210 | $extra_fields_to_show = 0; |
6211 | 6211 | foreach ($extra_fields as $key=>$field) { |
6212 | 6212 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6213 | - if ($field[6]==1 && $field[8] == 1) { |
|
6214 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6213 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6214 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6215 | 6215 | $selected = 'selected="selected"'; |
6216 | 6216 | } else { |
6217 | 6217 | $selected = ''; |
@@ -6223,8 +6223,8 @@ discard block |
||
6223 | 6223 | $return .= '</select>'; |
6224 | 6224 | |
6225 | 6225 | // the form elements for the $_GET parameters (because the form is passed through GET |
6226 | - foreach ($_GET as $key=>$value){ |
|
6227 | - if ($key <> 'additional_profile_field') { |
|
6226 | + foreach ($_GET as $key=>$value) { |
|
6227 | + if ($key <> 'additional_profile_field') { |
|
6228 | 6228 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6229 | 6229 | } |
6230 | 6230 | } |
@@ -6261,21 +6261,21 @@ discard block |
||
6261 | 6261 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6262 | 6262 | |
6263 | 6263 | if (!empty($users)) { |
6264 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6265 | - foreach($users as $user_id) { |
|
6264 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6265 | + foreach ($users as $user_id) { |
|
6266 | 6266 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6267 | 6267 | $tag_list = array(); |
6268 | - foreach($user_result as $item) { |
|
6268 | + foreach ($user_result as $item) { |
|
6269 | 6269 | $tag_list[] = $item['tag']; |
6270 | 6270 | } |
6271 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6271 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6272 | 6272 | } |
6273 | 6273 | } else { |
6274 | 6274 | $new_user_array = array(); |
6275 | 6275 | foreach ($users as $user_id) { |
6276 | - $new_user_array[]= "'".$user_id."'"; |
|
6276 | + $new_user_array[] = "'".$user_id."'"; |
|
6277 | 6277 | } |
6278 | - $users = implode(',',$new_user_array); |
|
6278 | + $users = implode(',', $new_user_array); |
|
6279 | 6279 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6280 | 6280 | // Selecting only the necessary information NOT ALL the user list |
6281 | 6281 | $sql = "SELECT user.user_id, v.value |
@@ -6290,7 +6290,7 @@ discard block |
||
6290 | 6290 | user.user_id IN ($users)"; |
6291 | 6291 | |
6292 | 6292 | $result = Database::query($sql); |
6293 | - while($row = Database::fetch_array($result)) { |
|
6293 | + while ($row = Database::fetch_array($result)) { |
|
6294 | 6294 | // get option value for field type double select by id |
6295 | 6295 | if (!empty($row['value'])) { |
6296 | 6296 | if ($result_extra_field['field_type'] == |
@@ -6329,7 +6329,7 @@ discard block |
||
6329 | 6329 | |
6330 | 6330 | public function sort_users_desc($a, $b) |
6331 | 6331 | { |
6332 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6332 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6333 | 6333 | } |
6334 | 6334 | |
6335 | 6335 | /** |
@@ -6364,7 +6364,7 @@ discard block |
||
6364 | 6364 | // get all users data from a course for sortable with limit |
6365 | 6365 | if (is_array($user_ids)) { |
6366 | 6366 | $user_ids = array_map('intval', $user_ids); |
6367 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6367 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6368 | 6368 | } else { |
6369 | 6369 | $user_ids = intval($user_ids); |
6370 | 6370 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6372,7 +6372,7 @@ discard block |
||
6372 | 6372 | |
6373 | 6373 | if (!empty($_GET['user_keyword'])) { |
6374 | 6374 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6375 | - $condition_user .= " AND ( |
|
6375 | + $condition_user .= " AND ( |
|
6376 | 6376 | user.firstname LIKE '%".$keyword."%' OR |
6377 | 6377 | user.lastname LIKE '%".$keyword."%' OR |
6378 | 6378 | user.username LIKE '%".$keyword."%' OR |
@@ -6390,7 +6390,7 @@ discard block |
||
6390 | 6390 | $invitedUsersCondition = ''; |
6391 | 6391 | |
6392 | 6392 | if (!$includeInvitedUsers) { |
6393 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6393 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6394 | 6394 | } |
6395 | 6395 | |
6396 | 6396 | $sql = "SELECT user.user_id as user_id, |
@@ -6401,7 +6401,7 @@ discard block |
||
6401 | 6401 | FROM $tbl_user as user $url_table |
6402 | 6402 | $condition_user $url_condition $invitedUsersCondition"; |
6403 | 6403 | |
6404 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6404 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6405 | 6405 | $direction = 'ASC'; |
6406 | 6406 | } |
6407 | 6407 | |
@@ -6538,7 +6538,7 @@ discard block |
||
6538 | 6538 | } |
6539 | 6539 | |
6540 | 6540 | if (empty($session_id)) { |
6541 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6541 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6542 | 6542 | } |
6543 | 6543 | |
6544 | 6544 | $user['link'] = '<center> |
@@ -6550,37 +6550,37 @@ discard block |
||
6550 | 6550 | // store columns in array $users |
6551 | 6551 | $is_western_name_order = api_is_western_name_order(); |
6552 | 6552 | $user_row = array(); |
6553 | - $user_row[]= $user['official_code']; //0 |
|
6553 | + $user_row[] = $user['official_code']; //0 |
|
6554 | 6554 | if ($is_western_name_order) { |
6555 | - $user_row[]= $user['firstname']; |
|
6556 | - $user_row[]= $user['lastname']; |
|
6555 | + $user_row[] = $user['firstname']; |
|
6556 | + $user_row[] = $user['lastname']; |
|
6557 | 6557 | } else { |
6558 | - $user_row[]= $user['lastname']; |
|
6559 | - $user_row[]= $user['firstname']; |
|
6558 | + $user_row[] = $user['lastname']; |
|
6559 | + $user_row[] = $user['firstname']; |
|
6560 | 6560 | } |
6561 | - $user_row[]= $user['username']; |
|
6562 | - $user_row[]= $user['time']; |
|
6563 | - $user_row[]= $user['average_progress']; |
|
6564 | - $user_row[]= $user['exercise_progress']; |
|
6565 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6566 | - $user_row[]= $user['student_score']; |
|
6567 | - $user_row[]= $user['count_assignments']; |
|
6568 | - $user_row[]= $user['count_messages']; |
|
6561 | + $user_row[] = $user['username']; |
|
6562 | + $user_row[] = $user['time']; |
|
6563 | + $user_row[] = $user['average_progress']; |
|
6564 | + $user_row[] = $user['exercise_progress']; |
|
6565 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6566 | + $user_row[] = $user['student_score']; |
|
6567 | + $user_row[] = $user['count_assignments']; |
|
6568 | + $user_row[] = $user['count_messages']; |
|
6569 | 6569 | |
6570 | 6570 | $userGroupManager = new UserGroup(); |
6571 | 6571 | $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); |
6572 | 6572 | |
6573 | 6573 | if (empty($session_id)) { |
6574 | - $user_row[]= $user['survey']; |
|
6574 | + $user_row[] = $user['survey']; |
|
6575 | 6575 | } |
6576 | 6576 | |
6577 | - $user_row[]= $user['first_connection']; |
|
6578 | - $user_row[]= $user['last_connection']; |
|
6577 | + $user_row[] = $user['first_connection']; |
|
6578 | + $user_row[] = $user['last_connection']; |
|
6579 | 6579 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6580 | - $user_row[]= $user['additional']; |
|
6580 | + $user_row[] = $user['additional']; |
|
6581 | 6581 | } |
6582 | 6582 | |
6583 | - $user_row[]= $user['link']; |
|
6583 | + $user_row[] = $user['link']; |
|
6584 | 6584 | |
6585 | 6585 | $users[] = $user_row; |
6586 | 6586 | |
@@ -6625,8 +6625,8 @@ discard block |
||
6625 | 6625 | |
6626 | 6626 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6627 | 6627 | $tempView = $view; |
6628 | - if(substr($view,0,1) == '1') { |
|
6629 | - $new_view = substr_replace($view,'0',0,1); |
|
6628 | + if (substr($view, 0, 1) == '1') { |
|
6629 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6630 | 6630 | echo " |
6631 | 6631 | <tr> |
6632 | 6632 | <td valign='top'> |
@@ -6659,9 +6659,9 @@ discard block |
||
6659 | 6659 | </tr>"; |
6660 | 6660 | $total = 0; |
6661 | 6661 | if (is_array($results)) { |
6662 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6662 | + for ($j = 0; $j < count($results); $j++) { |
|
6663 | 6663 | echo "<tr>"; |
6664 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6664 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6665 | 6665 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6666 | 6666 | echo"</tr>"; |
6667 | 6667 | $total = $total + $results[$j][1]; |
@@ -6678,7 +6678,7 @@ discard block |
||
6678 | 6678 | echo "</table>"; |
6679 | 6679 | echo "</td></tr>"; |
6680 | 6680 | } else { |
6681 | - $new_view = substr_replace($view,'1',0,1); |
|
6681 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6682 | 6682 | echo " |
6683 | 6683 | <tr> |
6684 | 6684 | <td valign='top'> |
@@ -6701,8 +6701,8 @@ discard block |
||
6701 | 6701 | { |
6702 | 6702 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6703 | 6703 | $courseId = api_get_course_int_id($courseCode); |
6704 | - if(substr($view,1,1) == '1') { |
|
6705 | - $new_view = substr_replace($view,'0',1,1); |
|
6704 | + if (substr($view, 1, 1) == '1') { |
|
6705 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6706 | 6706 | echo "<tr> |
6707 | 6707 | <td valign='top'> |
6708 | 6708 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
@@ -6744,7 +6744,7 @@ discard block |
||
6744 | 6744 | </tr>"; |
6745 | 6745 | |
6746 | 6746 | if (is_array($results)) { |
6747 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6747 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6748 | 6748 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6749 | 6749 | echo "<tr>\n"; |
6750 | 6750 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6759,8 +6759,8 @@ discard block |
||
6759 | 6759 | |
6760 | 6760 | // The Result of Tests |
6761 | 6761 | if (is_array($hpresults)) { |
6762 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6763 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6762 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6763 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6764 | 6764 | if ($title == '') |
6765 | 6765 | $title = basename($hpresults[$i][0]); |
6766 | 6766 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6786,7 +6786,7 @@ discard block |
||
6786 | 6786 | echo "</table>"; |
6787 | 6787 | echo "</td>\n</tr>\n"; |
6788 | 6788 | } else { |
6789 | - $new_view = substr_replace($view,'1',1,1); |
|
6789 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6790 | 6790 | echo " |
6791 | 6791 | <tr> |
6792 | 6792 | <td valign='top'> |
@@ -6805,8 +6805,8 @@ discard block |
||
6805 | 6805 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6806 | 6806 | $_course = api_get_course_info_by_id($course_id); |
6807 | 6807 | |
6808 | - if (substr($view,2,1) == '1') { |
|
6809 | - $new_view = substr_replace($view,'0',2,1); |
|
6808 | + if (substr($view, 2, 1) == '1') { |
|
6809 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6810 | 6810 | echo "<tr> |
6811 | 6811 | <td valign='top'> |
6812 | 6812 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
@@ -6820,7 +6820,7 @@ discard block |
||
6820 | 6820 | AND u.c_id = '".intval($course_id)."' |
6821 | 6821 | ORDER BY u.upload_date DESC"; |
6822 | 6822 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6823 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6823 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6824 | 6824 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6825 | 6825 | echo "<tr> |
6826 | 6826 | <td class='secLine' width='40%'> |
@@ -6834,7 +6834,7 @@ discard block |
||
6834 | 6834 | </td> |
6835 | 6835 | </tr>"; |
6836 | 6836 | if (is_array($results)) { |
6837 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6837 | + for ($j = 0; $j < count($results); $j++) { |
|
6838 | 6838 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6839 | 6839 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6840 | 6840 | echo "<tr>"; |
@@ -6853,7 +6853,7 @@ discard block |
||
6853 | 6853 | echo "</table>"; |
6854 | 6854 | echo "</td></tr>"; |
6855 | 6855 | } else { |
6856 | - $new_view = substr_replace($view,'1',2,1); |
|
6856 | + $new_view = substr_replace($view, '1', 2, 1); |
|
6857 | 6857 | echo " |
6858 | 6858 | <tr> |
6859 | 6859 | <td valign='top'> |
@@ -6872,8 +6872,8 @@ discard block |
||
6872 | 6872 | { |
6873 | 6873 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
6874 | 6874 | $courseId = api_get_course_int_id($courseCode); |
6875 | - if (substr($view,3,1) == '1') { |
|
6876 | - $new_view = substr_replace($view,'0',3,1); |
|
6875 | + if (substr($view, 3, 1) == '1') { |
|
6876 | + $new_view = substr_replace($view, '0', 3, 1); |
|
6877 | 6877 | echo " |
6878 | 6878 | <tr> |
6879 | 6879 | <td valign='top'> |
@@ -6897,7 +6897,7 @@ discard block |
||
6897 | 6897 | </td> |
6898 | 6898 | </tr>"; |
6899 | 6899 | if (is_array($results)) { |
6900 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6900 | + for ($j = 0; $j < count($results); $j++) { |
|
6901 | 6901 | echo "<tr>"; |
6902 | 6902 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
6903 | 6903 | echo"</tr>"; |
@@ -6910,7 +6910,7 @@ discard block |
||
6910 | 6910 | echo "</table>"; |
6911 | 6911 | echo "</td></tr>"; |
6912 | 6912 | } else { |
6913 | - $new_view = substr_replace($view,'1',3,1); |
|
6913 | + $new_view = substr_replace($view, '1', 3, 1); |
|
6914 | 6914 | echo " |
6915 | 6915 | <tr> |
6916 | 6916 | <td valign='top'> |
@@ -6937,8 +6937,8 @@ discard block |
||
6937 | 6937 | $session_id = intval($session_id); |
6938 | 6938 | |
6939 | 6939 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
6940 | - if(substr($view,4,1) == '1') { |
|
6941 | - $new_view = substr_replace($view,'0',4,1); |
|
6940 | + if (substr($view, 4, 1) == '1') { |
|
6941 | + $new_view = substr_replace($view, '0', 4, 1); |
|
6942 | 6942 | echo " |
6943 | 6943 | <tr> |
6944 | 6944 | <td valign='top'> |
@@ -6964,7 +6964,7 @@ discard block |
||
6964 | 6964 | </td> |
6965 | 6965 | </tr>"; |
6966 | 6966 | if (is_array($results)) { |
6967 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6967 | + for ($j = 0; $j < count($results); $j++) { |
|
6968 | 6968 | echo "<tr>"; |
6969 | 6969 | echo "<td class='content'>".$results[$j]."</td>"; |
6970 | 6970 | echo"</tr>"; |
@@ -6977,7 +6977,7 @@ discard block |
||
6977 | 6977 | echo "</table>"; |
6978 | 6978 | echo "</td></tr>"; |
6979 | 6979 | } else { |
6980 | - $new_view = substr_replace($view,'1',4,1); |
|
6980 | + $new_view = substr_replace($view, '1', 4, 1); |
|
6981 | 6981 | echo " |
6982 | 6982 | <tr> |
6983 | 6983 | <td valign='top'> |
@@ -7011,11 +7011,11 @@ discard block |
||
7011 | 7011 | ORDER BY login_date DESC LIMIT 1"; |
7012 | 7012 | $ip = ''; |
7013 | 7013 | $res_ip = Database::query($sql_ip); |
7014 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
7014 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
7015 | 7015 | $row_ip = Database::fetch_row($res_ip); |
7016 | 7016 | if ($return_as_link) { |
7017 | 7017 | $ip = Display::url( |
7018 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7018 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7019 | 7019 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
7020 | 7020 | ); |
7021 | 7021 | } else { |
@@ -7051,9 +7051,9 @@ discard block |
||
7051 | 7051 | $course_id = intval($course_id); |
7052 | 7052 | |
7053 | 7053 | $tempView = $view; |
7054 | - if (substr($view,0,1) == '1') { |
|
7055 | - $new_view = substr_replace($view,'0',0,1); |
|
7056 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7054 | + if (substr($view, 0, 1) == '1') { |
|
7055 | + $new_view = substr_replace($view, '0', 0, 1); |
|
7056 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7057 | 7057 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
7058 | 7058 | FROM $track_access_table |
7059 | 7059 | WHERE access_user_id = $user_id |
@@ -7063,20 +7063,20 @@ discard block |
||
7063 | 7063 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7064 | 7064 | //$results = getManyResults2Col($sql); |
7065 | 7065 | $results = getManyResults3Col($sql); |
7066 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7067 | - $line=''; |
|
7066 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7067 | + $line = ''; |
|
7068 | 7068 | $total = 0; |
7069 | 7069 | if (is_array($results)) { |
7070 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7070 | + for ($j = 0; $j < count($results); $j++) { |
|
7071 | 7071 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
7072 | 7072 | $total = $total + $results[$j][1]; |
7073 | 7073 | } |
7074 | 7074 | $line .= get_lang('Total').";".$total."\n"; |
7075 | 7075 | } else { |
7076 | - $line= get_lang('NoResult')."</center></td>"; |
|
7076 | + $line = get_lang('NoResult')."</center></td>"; |
|
7077 | 7077 | } |
7078 | 7078 | } else { |
7079 | - $new_view = substr_replace($view,'1',0,1); |
|
7079 | + $new_view = substr_replace($view, '1', 0, 1); |
|
7080 | 7080 | } |
7081 | 7081 | return array($title_line, $line); |
7082 | 7082 | } |
@@ -7094,8 +7094,8 @@ discard block |
||
7094 | 7094 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
7095 | 7095 | $courseId = api_get_course_int_id($courseCode); |
7096 | 7096 | $userId = intval($userId); |
7097 | - if (substr($view,1,1) == '1') { |
|
7098 | - $new_view = substr_replace($view,'0',1,1); |
|
7097 | + if (substr($view, 1, 1) == '1') { |
|
7098 | + $new_view = substr_replace($view, '0', 1, 1); |
|
7099 | 7099 | $title[1] = get_lang('ExercicesDetails'); |
7100 | 7100 | $line = ''; |
7101 | 7101 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7119,7 +7119,7 @@ discard block |
||
7119 | 7119 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
7120 | 7120 | |
7121 | 7121 | if (is_array($results)) { |
7122 | - for($i = 0; $i < sizeof($results); $i++) |
|
7122 | + for ($i = 0; $i < sizeof($results); $i++) |
|
7123 | 7123 | { |
7124 | 7124 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
7125 | 7125 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7131,8 +7131,8 @@ discard block |
||
7131 | 7131 | |
7132 | 7132 | // The Result of Tests |
7133 | 7133 | if (is_array($hpresults)) { |
7134 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7135 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7134 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
7135 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
7136 | 7136 | |
7137 | 7137 | if ($title == '') |
7138 | 7138 | $title = basename($hpresults[$i][0]); |
@@ -7146,10 +7146,10 @@ discard block |
||
7146 | 7146 | } |
7147 | 7147 | |
7148 | 7148 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
7149 | - $line=get_lang('NoResult'); |
|
7149 | + $line = get_lang('NoResult'); |
|
7150 | 7150 | } |
7151 | 7151 | } else { |
7152 | - $new_view = substr_replace($view,'1',1,1); |
|
7152 | + $new_view = substr_replace($view, '1', 1, 1); |
|
7153 | 7153 | } |
7154 | 7154 | return array($title_line, $line); |
7155 | 7155 | } |
@@ -7165,7 +7165,7 @@ discard block |
||
7165 | 7165 | $user_id = intval($user_id); |
7166 | 7166 | $course_id = intval($course_id); |
7167 | 7167 | |
7168 | - if (substr($view,2,1) == '1') { |
|
7168 | + if (substr($view, 2, 1) == '1') { |
|
7169 | 7169 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7170 | 7170 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7171 | 7171 | WHERE |
@@ -7173,21 +7173,21 @@ discard block |
||
7173 | 7173 | u.upload_user_id = '$user_id' AND |
7174 | 7174 | u.c_id = '$course_id' |
7175 | 7175 | ORDER BY u.upload_date DESC"; |
7176 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7176 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7177 | 7177 | |
7178 | - $title[1]=get_lang('WorksDetails'); |
|
7179 | - $line=''; |
|
7180 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7178 | + $title[1] = get_lang('WorksDetails'); |
|
7179 | + $line = ''; |
|
7180 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7181 | 7181 | |
7182 | 7182 | if (is_array($results)) { |
7183 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7183 | + for ($j = 0; $j < count($results); $j++) { |
|
7184 | 7184 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7185 | 7185 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7186 | 7186 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7187 | 7187 | } |
7188 | 7188 | |
7189 | 7189 | } else { |
7190 | - $line= get_lang('NoResult'); |
|
7190 | + $line = get_lang('NoResult'); |
|
7191 | 7191 | } |
7192 | 7192 | } |
7193 | 7193 | return array($title_line, $line); |
@@ -7203,9 +7203,9 @@ discard block |
||
7203 | 7203 | $courseId = api_get_course_int_id($courseCode); |
7204 | 7204 | $userId = intval($userId); |
7205 | 7205 | $line = null; |
7206 | - if (substr($view,3,1) == '1') { |
|
7207 | - $new_view = substr_replace($view,'0',3,1); |
|
7208 | - $title[1]=get_lang('LinksDetails'); |
|
7206 | + if (substr($view, 3, 1) == '1') { |
|
7207 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7208 | + $title[1] = get_lang('LinksDetails'); |
|
7209 | 7209 | $sql = "SELECT cl.title, cl.url |
7210 | 7210 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7211 | 7211 | WHERE sl.links_link_id = cl.id |
@@ -7213,16 +7213,16 @@ discard block |
||
7213 | 7213 | AND sl.links_user_id = $userId |
7214 | 7214 | GROUP BY cl.title, cl.url"; |
7215 | 7215 | $results = StatsUtils::getManyResults2Col($sql); |
7216 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7216 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7217 | 7217 | if (is_array($results)) { |
7218 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7218 | + for ($j = 0; $j < count($results); $j++) { |
|
7219 | 7219 | $line .= $results[$j][0]."\n"; |
7220 | 7220 | } |
7221 | 7221 | } else { |
7222 | - $line=get_lang('NoResult'); |
|
7222 | + $line = get_lang('NoResult'); |
|
7223 | 7223 | } |
7224 | 7224 | } else { |
7225 | - $new_view = substr_replace($view,'1',3,1); |
|
7225 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7226 | 7226 | } |
7227 | 7227 | return array($title_line, $line); |
7228 | 7228 | } |
@@ -7244,9 +7244,9 @@ discard block |
||
7244 | 7244 | |
7245 | 7245 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7246 | 7246 | |
7247 | - if (substr($view,4,1) == '1') { |
|
7248 | - $new_view = substr_replace($view,'0',4,1); |
|
7249 | - $title[1]= get_lang('DocumentsDetails'); |
|
7247 | + if (substr($view, 4, 1) == '1') { |
|
7248 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7249 | + $title[1] = get_lang('DocumentsDetails'); |
|
7250 | 7250 | |
7251 | 7251 | $sql = "SELECT down_doc_path |
7252 | 7252 | FROM $downloads_table |
@@ -7259,14 +7259,14 @@ discard block |
||
7259 | 7259 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7260 | 7260 | $line = null; |
7261 | 7261 | if (is_array($results)) { |
7262 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7262 | + for ($j = 0; $j < count($results); $j++) { |
|
7263 | 7263 | $line .= $results[$j]."\n"; |
7264 | 7264 | } |
7265 | 7265 | } else { |
7266 | 7266 | $line = get_lang('NoResult'); |
7267 | 7267 | } |
7268 | 7268 | } else { |
7269 | - $new_view = substr_replace($view,'1',4,1); |
|
7269 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7270 | 7270 | } |
7271 | 7271 | return array($title_line, $line); |
7272 | 7272 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param string $url The URL of the site |
19 | 19 | * @param string $description The description of the site |
20 | 20 | * @param int $active is active or not |
21 | - * @return boolean if success |
|
21 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
22 | 22 | */ |
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $url |
44 | 44 | * @param string $description The description of the site |
45 | 45 | * @param int $active is active or not |
46 | - * @return boolean if success |
|
46 | + * @return Doctrine\DBAL\Driver\Statement|null if success |
|
47 | 47 | */ |
48 | 48 | public static function update($url_id, $url, $description, $active) |
49 | 49 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @author Julio Montoya |
68 | 68 | * @param int $id url id |
69 | 69 | * |
70 | - * @return boolean true if success |
|
70 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
71 | 71 | * */ |
72 | 72 | public static function delete($id) |
73 | 73 | { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @author Julio Montoya |
367 | 367 | * @param int user id |
368 | 368 | * @param int url id |
369 | - * @return boolean true if success |
|
369 | + * @return integer true if success |
|
370 | 370 | * */ |
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @author Julio Montoya |
385 | 385 | * @param int $courseId |
386 | 386 | * @param int $urlId |
387 | - * @return boolean true if success |
|
387 | + * @return integer true if success |
|
388 | 388 | * */ |
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @author Julio Montoya |
406 | 406 | * @param int $userGroupId |
407 | 407 | * @param int $urlId |
408 | - * @return boolean true if success |
|
408 | + * @return integer true if success |
|
409 | 409 | * */ |
410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
411 | 411 | { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @author Julio Montoya |
425 | 425 | * @param int user id |
426 | 426 | * @param int url id |
427 | - * @return boolean true if success |
|
427 | + * @return integer true if success |
|
428 | 428 | * */ |
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
@@ -545,6 +545,8 @@ discard block |
||
545 | 545 | * @author Julio Montoya |
546 | 546 | * @param array of course ids |
547 | 547 | * @param array of url_ids |
548 | + * @param integer[] $courseCategoryList |
|
549 | + * @param integer[] $urlList |
|
548 | 550 | * @return array |
549 | 551 | **/ |
550 | 552 | public static function addCourseCategoryListToUrl($courseCategoryList, $urlList) |
@@ -575,7 +577,7 @@ discard block |
||
575 | 577 | * @author Julio Montoya |
576 | 578 | * @param int $categoryCourseId |
577 | 579 | * @param int $urlId |
578 | - * @return boolean true if success |
|
580 | + * @return integer true if success |
|
579 | 581 | * */ |
580 | 582 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
581 | 583 | { |
@@ -592,7 +594,7 @@ discard block |
||
592 | 594 | /** |
593 | 595 | * @param int $userGroupId |
594 | 596 | * @param int $urlId |
595 | - * @return int |
|
597 | + * @return string |
|
596 | 598 | */ |
597 | 599 | public static function addUserGroupToUrl($userGroupId, $urlId) |
598 | 600 | { |
@@ -692,7 +694,7 @@ discard block |
||
692 | 694 | * @param int $courseId |
693 | 695 | * @param int $url_id |
694 | 696 | * |
695 | - * @return resource |
|
697 | + * @return boolean |
|
696 | 698 | */ |
697 | 699 | public static function add_course_to_url($courseId, $url_id = 1) |
698 | 700 | { |
@@ -763,7 +765,7 @@ discard block |
||
763 | 765 | * @param int $courseId |
764 | 766 | * @param int $urlId |
765 | 767 | * |
766 | - * @return boolean true if success |
|
768 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
767 | 769 | * */ |
768 | 770 | public static function delete_url_rel_course($courseId, $urlId) |
769 | 771 | { |
@@ -781,7 +783,7 @@ discard block |
||
781 | 783 | * @param int $userGroupId |
782 | 784 | * @param int $urlId |
783 | 785 | * |
784 | - * @return boolean true if success |
|
786 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
785 | 787 | * */ |
786 | 788 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
787 | 789 | { |
@@ -800,7 +802,7 @@ discard block |
||
800 | 802 | * @param int $userGroupId |
801 | 803 | * @param int $urlId |
802 | 804 | * |
803 | - * @return boolean true if success |
|
805 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
804 | 806 | * */ |
805 | 807 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
806 | 808 | { |
@@ -819,7 +821,7 @@ discard block |
||
819 | 821 | * @param char course code |
820 | 822 | * @param int url id |
821 | 823 | * |
822 | - * @return boolean true if success |
|
824 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
823 | 825 | * */ |
824 | 826 | public static function delete_url_rel_session($session_id, $url_id) |
825 | 827 | { |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | class UrlManager |
12 | 12 | { |
13 | 13 | /** |
14 | - * Creates a new url access |
|
15 | - * |
|
16 | - * @author Julio Montoya <[email protected]>, |
|
17 | - * |
|
18 | - * @param string $url The URL of the site |
|
19 | - * @param string $description The description of the site |
|
20 | - * @param int $active is active or not |
|
21 | - * @return boolean if success |
|
22 | - */ |
|
14 | + * Creates a new url access |
|
15 | + * |
|
16 | + * @author Julio Montoya <[email protected]>, |
|
17 | + * |
|
18 | + * @param string $url The URL of the site |
|
19 | + * @param string $description The description of the site |
|
20 | + * @param int $active is active or not |
|
21 | + * @return boolean if success |
|
22 | + */ |
|
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
25 | 25 | $tms = time(); |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Updates an URL access |
|
40 | - * @author Julio Montoya <[email protected]>, |
|
41 | - * |
|
42 | - * @param int $url_id The url id |
|
43 | - * @param string $url |
|
44 | - * @param string $description The description of the site |
|
45 | - * @param int $active is active or not |
|
46 | - * @return boolean if success |
|
47 | - */ |
|
39 | + * Updates an URL access |
|
40 | + * @author Julio Montoya <[email protected]>, |
|
41 | + * |
|
42 | + * @param int $url_id The url id |
|
43 | + * @param string $url |
|
44 | + * @param string $description The description of the site |
|
45 | + * @param int $active is active or not |
|
46 | + * @return boolean if success |
|
47 | + */ |
|
48 | 48 | public static function update($url_id, $url, $description, $active) |
49 | 49 | { |
50 | 50 | $url_id = intval($url_id); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * Deletes an url |
|
67 | - * @author Julio Montoya |
|
68 | - * @param int $id url id |
|
66 | + * Deletes an url |
|
67 | + * @author Julio Montoya |
|
68 | + * @param int $id url id |
|
69 | 69 | * |
70 | - * @return boolean true if success |
|
71 | - * */ |
|
70 | + * @return boolean true if success |
|
71 | + * */ |
|
72 | 72 | public static function delete($id) |
73 | 73 | { |
74 | 74 | $id = intval($id); |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | - * Gets the inner join of access_url and the course table |
|
204 | - * |
|
205 | - * @author Julio Montoya |
|
206 | - * @param int access url id |
|
207 | - * @return array Database::store_result of the result |
|
208 | - **/ |
|
203 | + * Gets the inner join of access_url and the course table |
|
204 | + * |
|
205 | + * @author Julio Montoya |
|
206 | + * @param int access url id |
|
207 | + * @return array Database::store_result of the result |
|
208 | + **/ |
|
209 | 209 | public static function get_url_rel_course_data($access_url_id = null) |
210 | 210 | { |
211 | 211 | $where = ''; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | - * Checks the relationship between an URL and a User (return the num_rows) |
|
366 | - * @author Julio Montoya |
|
367 | - * @param int user id |
|
368 | - * @param int url id |
|
369 | - * @return boolean true if success |
|
370 | - * */ |
|
365 | + * Checks the relationship between an URL and a User (return the num_rows) |
|
366 | + * @author Julio Montoya |
|
367 | + * @param int user id |
|
368 | + * @param int url id |
|
369 | + * @return boolean true if success |
|
370 | + * */ |
|
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | $num = Database::num_rows($result); |
378 | 378 | |
379 | 379 | return $num; |
380 | - } |
|
380 | + } |
|
381 | 381 | |
382 | 382 | /** |
383 | - * Checks the relationship between an URL and a Course (return the num_rows) |
|
384 | - * @author Julio Montoya |
|
385 | - * @param int $courseId |
|
386 | - * @param int $urlId |
|
387 | - * @return boolean true if success |
|
388 | - * */ |
|
383 | + * Checks the relationship between an URL and a Course (return the num_rows) |
|
384 | + * @author Julio Montoya |
|
385 | + * @param int $courseId |
|
386 | + * @param int $urlId |
|
387 | + * @return boolean true if success |
|
388 | + * */ |
|
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -420,12 +420,12 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
423 | - * Checks the relationship between an URL and a Session (return the num_rows) |
|
424 | - * @author Julio Montoya |
|
425 | - * @param int user id |
|
426 | - * @param int url id |
|
427 | - * @return boolean true if success |
|
428 | - * */ |
|
423 | + * Checks the relationship between an URL and a Session (return the num_rows) |
|
424 | + * @author Julio Montoya |
|
425 | + * @param int user id |
|
426 | + * @param int url id |
|
427 | + * @return boolean true if success |
|
428 | + * */ |
|
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
431 | 431 | $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -737,13 +737,13 @@ discard block |
||
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
740 | - * Deletes an url and user relationship |
|
741 | - * @author Julio Montoya |
|
742 | - * @param int user id |
|
743 | - * @param int url id |
|
740 | + * Deletes an url and user relationship |
|
741 | + * @author Julio Montoya |
|
742 | + * @param int user id |
|
743 | + * @param int url id |
|
744 | 744 | * |
745 | - * @return boolean true if success |
|
746 | - * */ |
|
745 | + * @return boolean true if success |
|
746 | + * */ |
|
747 | 747 | public static function delete_url_rel_user($user_id, $url_id) |
748 | 748 | { |
749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | } |
759 | 759 | |
760 | 760 | /** |
761 | - * Deletes an url and course relationship |
|
762 | - * @author Julio Montoya |
|
763 | - * @param int $courseId |
|
764 | - * @param int $urlId |
|
761 | + * Deletes an url and course relationship |
|
762 | + * @author Julio Montoya |
|
763 | + * @param int $courseId |
|
764 | + * @param int $urlId |
|
765 | 765 | * |
766 | - * @return boolean true if success |
|
767 | - * */ |
|
766 | + * @return boolean true if success |
|
767 | + * */ |
|
768 | 768 | public static function delete_url_rel_course($courseId, $urlId) |
769 | 769 | { |
770 | 770 | $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | } |
815 | 815 | |
816 | 816 | /** |
817 | - * Deletes an url and session relationship |
|
818 | - * @author Julio Montoya |
|
819 | - * @param char course code |
|
820 | - * @param int url id |
|
817 | + * Deletes an url and session relationship |
|
818 | + * @author Julio Montoya |
|
819 | + * @param char course code |
|
820 | + * @param int url id |
|
821 | 821 | * |
822 | - * @return boolean true if success |
|
823 | - * */ |
|
822 | + * @return boolean true if success |
|
823 | + * */ |
|
824 | 824 | public static function delete_url_rel_session($session_id, $url_id) |
825 | 825 | { |
826 | 826 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
@@ -262,8 +262,9 @@ |
||
262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
264 | 264 | |
265 | - if (!empty($access_url_id)) |
|
266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
265 | + if (!empty($access_url_id)) { |
|
266 | + $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
267 | + } |
|
267 | 268 | |
268 | 269 | $sql = "SELECT id, name, access_url_id |
269 | 270 | FROM $tbl_session u |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public static function add($url, $description, $active) |
24 | 24 | { |
25 | 25 | $tms = time(); |
26 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
26 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
27 | 27 | $sql = "INSERT INTO $table |
28 | 28 | SET url = '".Database::escape_string($url)."', |
29 | 29 | description = '".Database::escape_string($description)."', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $id = intval($id); |
75 | 75 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
76 | - $sql= "DELETE FROM $table WHERE id = ".$id; |
|
76 | + $sql = "DELETE FROM $table WHERE id = ".$id; |
|
77 | 77 | $result = Database::query($sql); |
78 | 78 | |
79 | 79 | return $result; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function url_exist($url) |
88 | 88 | { |
89 | - $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
89 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
90 | 90 | $sql = "SELECT id FROM $table |
91 | 91 | WHERE url = '".Database::escape_string($url)."' "; |
92 | 92 | $res = Database::query($sql); |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * */ |
121 | 121 | public static function url_count() |
122 | 122 | { |
123 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
123 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
124 | 124 | $sql = "SELECT count(id) as count_result FROM $table_access_url"; |
125 | 125 | $res = Database::query($sql); |
126 | - $url = Database::fetch_array($res,'ASSOC'); |
|
126 | + $url = Database::fetch_array($res, 'ASSOC'); |
|
127 | 127 | $result = $url['count_result']; |
128 | 128 | |
129 | 129 | return $result; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | FROM $table |
142 | 142 | ORDER BY id"; |
143 | 143 | $res = Database::query($sql); |
144 | - $urls = array (); |
|
144 | + $urls = array(); |
|
145 | 145 | while ($url = Database::fetch_array($res)) { |
146 | 146 | $urls[] = $url; |
147 | 147 | } |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | **/ |
259 | 259 | public static function get_url_rel_session_data($access_url_id = null) |
260 | 260 | { |
261 | - $where =''; |
|
261 | + $where = ''; |
|
262 | 262 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
263 | 263 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
264 | 264 | |
265 | 265 | if (!empty($access_url_id)) |
266 | - $where ="WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
266 | + $where = "WHERE $table_url_rel_session.access_url_id = ".intval($access_url_id); |
|
267 | 267 | |
268 | 268 | $sql = "SELECT id, name, access_url_id |
269 | 269 | FROM $tbl_session u |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $table_user_group = Database::get_main_table(TABLE_USERGROUP); |
294 | 294 | |
295 | 295 | if (!empty($access_url_id)) { |
296 | - $where ="WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
296 | + $where = "WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | $sql = "SELECT id, name, access_url_id |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | public static function relation_url_user_exist($user_id, $url_id) |
372 | 372 | { |
373 | 373 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
374 | - $sql= "SELECT user_id FROM $table |
|
374 | + $sql = "SELECT user_id FROM $table |
|
375 | 375 | WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." "; |
376 | 376 | $result = Database::query($sql); |
377 | 377 | $num = Database::num_rows($result); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public static function relation_url_course_exist($courseId, $urlId) |
390 | 390 | { |
391 | 391 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
392 | - $sql= "SELECT c_id FROM $table_url_rel_course |
|
392 | + $sql = "SELECT c_id FROM $table_url_rel_course |
|
393 | 393 | WHERE |
394 | 394 | access_url_id = ".intval($urlId)." AND |
395 | 395 | c_id = '".intval($courseId)."'"; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | public static function relationUrlUsergroupExist($userGroupId, $urlId) |
411 | 411 | { |
412 | 412 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
413 | - $sql= "SELECT usergroup_id FROM $table |
|
413 | + $sql = "SELECT usergroup_id FROM $table |
|
414 | 414 | WHERE access_url_id = ".intval($urlId)." AND |
415 | 415 | usergroup_id = ".intval($userGroupId); |
416 | 416 | $result = Database::query($sql); |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | * */ |
429 | 429 | public static function relation_url_session_exist($session_id, $url_id) |
430 | 430 | { |
431 | - $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
431 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
432 | 432 | $session_id = intval($session_id); |
433 | - $url_id = intval($url_id); |
|
433 | + $url_id = intval($url_id); |
|
434 | 434 | $sql = "SELECT session_id FROM $table_url_rel_session |
435 | 435 | WHERE |
436 | 436 | access_url_id = ".intval($url_id)." AND |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
454 | 454 | $result_array = array(); |
455 | 455 | |
456 | - if (is_array($user_list) && is_array($url_list)){ |
|
456 | + if (is_array($user_list) && is_array($url_list)) { |
|
457 | 457 | foreach ($url_list as $url_id) { |
458 | 458 | foreach ($user_list as $user_id) { |
459 | - $count = UrlManager::relation_url_user_exist($user_id,$url_id); |
|
460 | - if ($count==0) { |
|
459 | + $count = UrlManager::relation_url_user_exist($user_id, $url_id); |
|
460 | + if ($count == 0) { |
|
461 | 461 | $sql = "INSERT INTO $table_url_rel_user |
462 | 462 | SET user_id = ".intval($user_id).", access_url_id = ".intval($url_id); |
463 | 463 | $result = Database::query($sql); |
@@ -482,19 +482,19 @@ discard block |
||
482 | 482 | * @param array of url_ids |
483 | 483 | * @return array |
484 | 484 | **/ |
485 | - public static function add_courses_to_urls($course_list,$url_list) |
|
485 | + public static function add_courses_to_urls($course_list, $url_list) |
|
486 | 486 | { |
487 | 487 | $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
488 | 488 | $result_array = array(); |
489 | 489 | |
490 | - if (is_array($course_list) && is_array($url_list)){ |
|
490 | + if (is_array($course_list) && is_array($url_list)) { |
|
491 | 491 | foreach ($url_list as $url_id) { |
492 | 492 | foreach ($course_list as $course_code) { |
493 | 493 | $courseInfo = api_get_course_info($course_code); |
494 | 494 | $courseId = $courseInfo['real_id']; |
495 | 495 | |
496 | 496 | $count = self::relation_url_course_exist($courseId, $url_id); |
497 | - if ($count==0) { |
|
497 | + if ($count == 0) { |
|
498 | 498 | $sql = "INSERT INTO $table_url_rel_course |
499 | 499 | SET c_id = '".$courseId."', access_url_id = ".intval($url_id); |
500 | 500 | $result = Database::query($sql); |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId) |
581 | 581 | { |
582 | 582 | $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
583 | - $sql= "SELECT course_category_id FROM $table |
|
583 | + $sql = "SELECT course_category_id FROM $table |
|
584 | 584 | WHERE access_url_id = ".intval($urlId)." AND |
585 | 585 | course_category_id = ".intval($categoryCourseId); |
586 | 586 | $result = Database::query($sql); |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
750 | 750 | $result = true; |
751 | 751 | if (!empty($user_id) && !empty($url_id)) { |
752 | - $sql= "DELETE FROM $table_url_rel_user |
|
752 | + $sql = "DELETE FROM $table_url_rel_user |
|
753 | 753 | WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id); |
754 | 754 | $result = Database::query($sql); |
755 | 755 | } |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
770 | 770 | $result = true; |
771 | 771 | if (!empty($userId)) { |
772 | - $sql= "DELETE FROM $table_url_rel_user |
|
772 | + $sql = "DELETE FROM $table_url_rel_user |
|
773 | 773 | WHERE user_id = ".intval($userId); |
774 | 774 | Database::query($sql); |
775 | 775 | } |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | * */ |
788 | 788 | public static function delete_url_rel_course($courseId, $urlId) |
789 | 789 | { |
790 | - $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
791 | - $sql= "DELETE FROM $table_url_rel_course |
|
790 | + $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
791 | + $sql = "DELETE FROM $table_url_rel_course |
|
792 | 792 | WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)." "; |
793 | 793 | $result = Database::query($sql); |
794 | 794 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | public static function delete_url_rel_usergroup($userGroupId, $urlId) |
807 | 807 | { |
808 | 808 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP); |
809 | - $sql= "DELETE FROM $table |
|
809 | + $sql = "DELETE FROM $table |
|
810 | 810 | WHERE usergroup_id = '".intval($userGroupId)."' AND |
811 | 811 | access_url_id=".intval($urlId)." "; |
812 | 812 | $result = Database::query($sql); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | public static function deleteUrlRelCourseCategory($userGroupId, $urlId) |
826 | 826 | { |
827 | 827 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY); |
828 | - $sql= "DELETE FROM $table |
|
828 | + $sql = "DELETE FROM $table |
|
829 | 829 | WHERE course_category_id = '".intval($userGroupId)."' AND |
830 | 830 | access_url_id=".intval($urlId)." "; |
831 | 831 | $result = Database::query($sql); |
@@ -844,9 +844,9 @@ discard block |
||
844 | 844 | public static function delete_url_rel_session($session_id, $url_id) |
845 | 845 | { |
846 | 846 | $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
847 | - $sql= "DELETE FROM $table_url_rel_session |
|
847 | + $sql = "DELETE FROM $table_url_rel_session |
|
848 | 848 | WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)." "; |
849 | - $result = Database::query($sql,'ASSOC'); |
|
849 | + $result = Database::query($sql, 'ASSOC'); |
|
850 | 850 | |
851 | 851 | return $result; |
852 | 852 | } |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | * */ |
860 | 860 | public static function update_urls_rel_user($user_list, $access_url_id) |
861 | 861 | { |
862 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
862 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
863 | 863 | $sql = "SELECT user_id FROM $table_url_rel_user WHERE access_url_id = ".intval($access_url_id); |
864 | 864 | $result = Database::query($sql); |
865 | 865 | $existing_users = array(); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $result = Database::query($sql); |
914 | 914 | |
915 | 915 | $existing_courses = array(); |
916 | - while ($row = Database::fetch_array($result)){ |
|
916 | + while ($row = Database::fetch_array($result)) { |
|
917 | 917 | $existing_courses[] = $row['c_id']; |
918 | 918 | } |
919 | 919 | |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | $result = Database::query($sql); |
947 | 947 | $existingItems = array(); |
948 | 948 | |
949 | - while ($row = Database::fetch_array($result)){ |
|
949 | + while ($row = Database::fetch_array($result)) { |
|
950 | 950 | $existingItems[] = $row['usergroup_id']; |
951 | 951 | } |
952 | 952 | |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | $result = Database::query($sql); |
980 | 980 | $existingItems = array(); |
981 | 981 | |
982 | - while ($row = Database::fetch_array($result)){ |
|
982 | + while ($row = Database::fetch_array($result)) { |
|
983 | 983 | $existingItems[] = $row['course_category_id']; |
984 | 984 | } |
985 | 985 | |
@@ -1020,15 +1020,15 @@ discard block |
||
1020 | 1020 | * @param array user list |
1021 | 1021 | * @param int access_url_id |
1022 | 1022 | * */ |
1023 | - public static function update_urls_rel_session($session_list,$access_url_id) |
|
1023 | + public static function update_urls_rel_session($session_list, $access_url_id) |
|
1024 | 1024 | { |
1025 | - $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
1025 | + $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
1026 | 1026 | |
1027 | 1027 | $sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".intval($access_url_id); |
1028 | 1028 | $result = Database::query($sql); |
1029 | 1029 | $existing_sessions = array(); |
1030 | 1030 | |
1031 | - while ($row = Database::fetch_array($result)){ |
|
1031 | + while ($row = Database::fetch_array($result)) { |
|
1032 | 1032 | $existing_sessions[] = $row['session_id']; |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1057,13 +1057,13 @@ discard block |
||
1057 | 1057 | */ |
1058 | 1058 | public static function get_access_url_from_user($user_id) |
1059 | 1059 | { |
1060 | - $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
1061 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1060 | + $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
1061 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1062 | 1062 | $sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u |
1063 | 1063 | ON (url_rel_user.access_url_id = u.id) |
1064 | 1064 | WHERE user_id = ".intval($user_id); |
1065 | 1065 | $result = Database::query($sql); |
1066 | - $url_list = Database::store_result($result,'ASSOC'); |
|
1066 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
1067 | 1067 | return $url_list; |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1073,14 +1073,14 @@ discard block |
||
1073 | 1073 | */ |
1074 | 1074 | public static function get_access_url_from_course($courseId) |
1075 | 1075 | { |
1076 | - $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
1077 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1076 | + $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
1077 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1078 | 1078 | $sql = "SELECT url, access_url_id FROM $table c INNER JOIN $table_url u |
1079 | 1079 | ON (c.access_url_id = u.id) |
1080 | 1080 | WHERE c_id = ".intval($courseId); |
1081 | 1081 | |
1082 | 1082 | $result = Database::query($sql); |
1083 | - $url_list = Database::store_result($result,'ASSOC'); |
|
1083 | + $url_list = Database::store_result($result, 'ASSOC'); |
|
1084 | 1084 | return $url_list; |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | public static function get_access_url_from_session($session_id) |
1092 | 1092 | { |
1093 | 1093 | $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
1094 | - $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1094 | + $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1095 | 1095 | $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u |
1096 | 1096 | ON (url_rel_session.access_url_id = u.id) |
1097 | 1097 | WHERE session_id = ".intval($session_id); |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | */ |
1108 | 1108 | public static function get_url_id($url) |
1109 | 1109 | { |
1110 | - $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1110 | + $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
1111 | 1111 | $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'"; |
1112 | 1112 | $result = Database::query($sql); |
1113 | 1113 | $access_url_id = Database::result($result, 0, 0); |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | * @param int $groupId |
1014 | 1014 | * @param string $picture |
1015 | 1015 | * |
1016 | - * @return bool|string |
|
1016 | + * @return false|string |
|
1017 | 1017 | */ |
1018 | 1018 | public function manageFileUpload($groupId, $picture) |
1019 | 1019 | { |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | /** |
1158 | - * @return mixed |
|
1158 | + * @return integer |
|
1159 | 1159 | */ |
1160 | 1160 | public function getGroupType() |
1161 | 1161 | { |
@@ -1359,6 +1359,8 @@ discard block |
||
1359 | 1359 | * @param string height |
1360 | 1360 | * @param string picture size it can be small_, medium_ or big_ |
1361 | 1361 | * @param string style css |
1362 | + * @param integer $height |
|
1363 | + * @param integer $size_picture |
|
1362 | 1364 | * @return array with the file and the style of an image i.e $array['file'] $array['style'] |
1363 | 1365 | */ |
1364 | 1366 | public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM , $style = '') |
@@ -1420,7 +1422,7 @@ discard block |
||
1420 | 1422 | * @param string Type of path to return (can be 'none', 'system', 'rel', 'web') |
1421 | 1423 | * @param bool Whether we want to have the directory name returned 'as if' there was a file or not (in the case we want to know which directory to create - otherwise no file means no split subdir) |
1422 | 1424 | * @param bool If we want that the function returns the /main/img/unknown.jpg image set it at true |
1423 | - * @return array Array of 2 elements: 'dir' and 'file' which contain the dir and file as the name implies if image does not exist it will return the unknow image if anonymous parameter is true if not it returns an empty er's |
|
1425 | + * @return integer Array of 2 elements: 'dir' and 'file' which contain the dir and file as the name implies if image does not exist it will return the unknow image if anonymous parameter is true if not it returns an empty er's |
|
1424 | 1426 | */ |
1425 | 1427 | public function get_group_picture_path_by_id($id, $type = 'none', $preview = false, $anonymous = false) |
1426 | 1428 | { |
@@ -1470,7 +1472,7 @@ discard block |
||
1470 | 1472 | } |
1471 | 1473 | |
1472 | 1474 | /** |
1473 | - * @return array |
|
1475 | + * @return string[] |
|
1474 | 1476 | */ |
1475 | 1477 | public function getAllowedPictureExtensions() |
1476 | 1478 | { |
@@ -1660,7 +1662,7 @@ discard block |
||
1660 | 1662 | * @author Julio Montoya |
1661 | 1663 | * @param int $user_id |
1662 | 1664 | * @param int $group_id |
1663 | - * @return boolean true if success |
|
1665 | + * @return Doctrine\DBAL\Driver\Statement|null true if success |
|
1664 | 1666 | * */ |
1665 | 1667 | public function delete_user_rel_group($user_id, $group_id) |
1666 | 1668 | { |
@@ -1872,6 +1874,8 @@ discard block |
||
1872 | 1874 | * @param int from value |
1873 | 1875 | * @param int limit |
1874 | 1876 | * @param array image configuration, i.e array('height'=>'20px', 'size'=> '20px') |
1877 | + * @param integer $from |
|
1878 | + * @param integer $limit |
|
1875 | 1879 | * @return array list of users in a group |
1876 | 1880 | */ |
1877 | 1881 | public function get_users_by_group( |
@@ -1970,6 +1974,8 @@ discard block |
||
1970 | 1974 | * Shows the left column of the group page |
1971 | 1975 | * @param int group id |
1972 | 1976 | * @param int user id |
1977 | + * @param integer $group_id |
|
1978 | + * @param integer $user_id |
|
1973 | 1979 | * |
1974 | 1980 | */ |
1975 | 1981 | public function show_group_column_information($group_id, $user_id, $show = '') |
@@ -2323,7 +2329,7 @@ discard block |
||
2323 | 2329 | * @param int $group_id |
2324 | 2330 | * @param int $parent_group_id if 0, we delete the parent_group association |
2325 | 2331 | * @param int $relation_type |
2326 | - * @return resource |
|
2332 | + * @return Doctrine\DBAL\Driver\Statement|null |
|
2327 | 2333 | **/ |
2328 | 2334 | public static function set_parent_group($group_id, $parent_group_id, $relation_type = 1) |
2329 | 2335 | { |
@@ -1906,8 +1906,9 @@ |
||
1906 | 1906 | $new_relation_type[] ="'$rel'"; |
1907 | 1907 | } |
1908 | 1908 | $relation_type = implode(',', $new_relation_type); |
1909 | - if (!empty($relation_type)) |
|
1910 | - $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1909 | + if (!empty($relation_type)) { |
|
1910 | + $where_relation_condition = "AND gu.relation_type IN ($relation_type) "; |
|
1911 | + } |
|
1911 | 1912 | } |
1912 | 1913 | |
1913 | 1914 | $sql = "SELECT picture_uri as image, u.id, u.firstname, u.lastname, relation_type |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | "; |
82 | 82 | $result = Database::query($sql); |
83 | 83 | if (Database::num_rows($result)) { |
84 | - $row = Database::fetch_array($result); |
|
84 | + $row = Database::fetch_array($result); |
|
85 | 85 | |
86 | 86 | return $row['count']; |
87 | 87 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | "; |
102 | 102 | $result = Database::query($sql); |
103 | 103 | if (Database::num_rows($result)) { |
104 | - $row = Database::fetch_array($result); |
|
104 | + $row = Database::fetch_array($result); |
|
105 | 105 | return $row['count']; |
106 | 106 | } |
107 | 107 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | "; |
127 | 127 | $result = Database::query($sql); |
128 | 128 | if (Database::num_rows($result)) { |
129 | - $row = Database::fetch_array($result); |
|
129 | + $row = Database::fetch_array($result); |
|
130 | 130 | return $row['count']; |
131 | 131 | } |
132 | 132 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | "; |
148 | 148 | $result = Database::query($sql); |
149 | 149 | if (Database::num_rows($result)) { |
150 | - $row = Database::fetch_array($result); |
|
150 | + $row = Database::fetch_array($result); |
|
151 | 151 | return $row['count']; |
152 | 152 | } |
153 | 153 | |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | INNER JOIN {$this->table} g |
529 | 529 | ON (u.usergroup_id = g.id) |
530 | 530 | "; |
531 | - $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId))); |
|
531 | + $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId))); |
|
532 | 532 | } else { |
533 | 533 | $from = $this->usergroup_rel_user_table." u |
534 | 534 | INNER JOIN {$this->table} g |
535 | 535 | ON (u.usergroup_id = g.id) |
536 | 536 | "; |
537 | - $where = array('where' => array('user_id = ?' => $userId)); |
|
537 | + $where = array('where' => array('user_id = ?' => $userId)); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | if ($filterByType !== null) { |
@@ -567,10 +567,10 @@ discard block |
||
567 | 567 | $urlId = api_get_current_access_url_id(); |
568 | 568 | $from = $this->usergroup_rel_user_table." u |
569 | 569 | INNER JOIN {$this->access_url_rel_usergroup} a ON (a.usergroup_id AND u.usergroup_id)"; |
570 | - $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId))); |
|
570 | + $where = array('where' => array('user_id = ? AND access_url_id = ? ' => array($userId, $urlId))); |
|
571 | 571 | } else { |
572 | 572 | $from = $this->usergroup_rel_user_table." u "; |
573 | - $where = array('where' => array('user_id = ?' => $userId)); |
|
573 | + $where = array('where' => array('user_id = ?' => $userId)); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | $results = Database::select( |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | } |
857 | 857 | $result = $new_result; |
858 | 858 | } |
859 | - $columns = array('name', 'users', 'courses','sessions', 'group_type'); |
|
859 | + $columns = array('name', 'users', 'courses', 'sessions', 'group_type'); |
|
860 | 860 | |
861 | 861 | if (!in_array($sidx, $columns)) { |
862 | 862 | $sidx = 'name'; |
@@ -1260,7 +1260,7 @@ discard block |
||
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | } |
1263 | - $response->addAssign('ajax_list_courses','innerHTML', api_utf8_encode($return)); |
|
1263 | + $response->addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return)); |
|
1264 | 1264 | |
1265 | 1265 | return $response; |
1266 | 1266 | } |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * @param string style css |
1368 | 1368 | * @return array with the file and the style of an image i.e $array['file'] $array['style'] |
1369 | 1369 | */ |
1370 | - public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM , $style = '') |
|
1370 | + public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM, $style = '') |
|
1371 | 1371 | { |
1372 | 1372 | $picture = array(); |
1373 | 1373 | $picture['style'] = $style; |
@@ -1480,7 +1480,7 @@ discard block |
||
1480 | 1480 | */ |
1481 | 1481 | public function getAllowedPictureExtensions() |
1482 | 1482 | { |
1483 | - return $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
|
1483 | + return $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); |
|
1484 | 1484 | } |
1485 | 1485 | |
1486 | 1486 | /** |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | if (empty($user_id)) { |
1515 | 1515 | $user_id = api_get_user_id(); |
1516 | 1516 | } |
1517 | - $user_role = $this->get_user_group_role($user_id, $group_id); |
|
1517 | + $user_role = $this->get_user_group_role($user_id, $group_id); |
|
1518 | 1518 | if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN))) { |
1519 | 1519 | return true; |
1520 | 1520 | } else { |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | if (empty($user_id)) { |
1533 | 1533 | $user_id = api_get_user_id(); |
1534 | 1534 | } |
1535 | - $user_role = $this->get_user_group_role($user_id, $group_id); |
|
1535 | + $user_role = $this->get_user_group_role($user_id, $group_id); |
|
1536 | 1536 | if (in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) { |
1537 | 1537 | return true; |
1538 | 1538 | } else { |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | GROUP_USER_PERMISSION_READER, |
1560 | 1560 | GROUP_USER_PERMISSION_HRM, |
1561 | 1561 | ); |
1562 | - $user_role = self::get_user_group_role($user_id, $group_id); |
|
1562 | + $user_role = self::get_user_group_role($user_id, $group_id); |
|
1563 | 1563 | if (in_array($user_role, $roles)) { |
1564 | 1564 | return true; |
1565 | 1565 | } else { |
@@ -1576,7 +1576,7 @@ discard block |
||
1576 | 1576 | * */ |
1577 | 1577 | public function get_user_group_role($user_id, $group_id) |
1578 | 1578 | { |
1579 | - $table_group_rel_user= $this->usergroup_rel_user_table; |
|
1579 | + $table_group_rel_user = $this->usergroup_rel_user_table; |
|
1580 | 1580 | $return_value = 0; |
1581 | 1581 | if (!empty($user_id) && !empty($group_id)) { |
1582 | 1582 | $sql = "SELECT relation_type FROM $table_group_rel_user |
@@ -1584,8 +1584,8 @@ discard block |
||
1584 | 1584 | usergroup_id = ".intval($group_id)." AND |
1585 | 1585 | user_id = ".intval($user_id)." "; |
1586 | 1586 | $result = Database::query($sql); |
1587 | - if (Database::num_rows($result)>0) { |
|
1588 | - $row = Database::fetch_array($result,'ASSOC'); |
|
1587 | + if (Database::num_rows($result) > 0) { |
|
1588 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
1589 | 1589 | $return_value = $row['relation_type']; |
1590 | 1590 | } |
1591 | 1591 | } |
@@ -1640,7 +1640,7 @@ discard block |
||
1640 | 1640 | if (is_array($user_list) && is_array($group_list)) { |
1641 | 1641 | foreach ($group_list as $group_id) { |
1642 | 1642 | foreach ($user_list as $user_id) { |
1643 | - $role = self::get_user_group_role($user_id,$group_id); |
|
1643 | + $role = self::get_user_group_role($user_id, $group_id); |
|
1644 | 1644 | if ($role == 0) { |
1645 | 1645 | $sql = "INSERT INTO $table_url_rel_group |
1646 | 1646 | SET |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | public function delete_user_rel_group($user_id, $group_id) |
1672 | 1672 | { |
1673 | 1673 | $table = $this->usergroup_rel_user_table; |
1674 | - $sql= "DELETE FROM $table |
|
1674 | + $sql = "DELETE FROM $table |
|
1675 | 1675 | WHERE |
1676 | 1676 | user_id = ".intval($user_id)." AND |
1677 | 1677 | usergroup_id = ".intval($group_id)." "; |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | |
1728 | 1728 | $sql = "UPDATE $table_group_rel_user |
1729 | 1729 | SET relation_type = ".intval($relation_type)." |
1730 | - WHERE user_id = $user_id AND usergroup_id = $group_id" ; |
|
1730 | + WHERE user_id = $user_id AND usergroup_id = $group_id"; |
|
1731 | 1731 | Database::query($sql); |
1732 | 1732 | } |
1733 | 1733 | |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | if (Database::num_rows($result) > 0) { |
1770 | 1770 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1771 | 1771 | if ($with_image) { |
1772 | - $picture = self::get_picture_group($row['id'], $row['picture'],80); |
|
1772 | + $picture = self::get_picture_group($row['id'], $row['picture'], 80); |
|
1773 | 1773 | $img = '<img src="'.$picture['file'].'" />'; |
1774 | 1774 | $row['picture'] = $img; |
1775 | 1775 | } |
@@ -1805,11 +1805,11 @@ discard block |
||
1805 | 1805 | ORDER BY count DESC |
1806 | 1806 | LIMIT $num"; |
1807 | 1807 | |
1808 | - $result=Database::query($sql); |
|
1808 | + $result = Database::query($sql); |
|
1809 | 1809 | $array = array(); |
1810 | 1810 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1811 | 1811 | if ($with_image) { |
1812 | - $picture = self::get_picture_group($row['id'], $row['picture'],80); |
|
1812 | + $picture = self::get_picture_group($row['id'], $row['picture'], 80); |
|
1813 | 1813 | $img = '<img src="'.$picture['file'].'" />'; |
1814 | 1814 | $row['picture'] = $img; |
1815 | 1815 | } |
@@ -1854,11 +1854,11 @@ discard block |
||
1854 | 1854 | ORDER BY created_at DESC |
1855 | 1855 | LIMIT $num "; |
1856 | 1856 | |
1857 | - $result=Database::query($sql); |
|
1857 | + $result = Database::query($sql); |
|
1858 | 1858 | $array = array(); |
1859 | 1859 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1860 | 1860 | if ($with_image) { |
1861 | - $picture = self::get_picture_group($row['id'], $row['picture'],80); |
|
1861 | + $picture = self::get_picture_group($row['id'], $row['picture'], 80); |
|
1862 | 1862 | $img = '<img src="'.$picture['file'].'" />'; |
1863 | 1863 | $row['picture'] = $img; |
1864 | 1864 | } |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
1893 | 1893 | $group_id = intval($group_id); |
1894 | 1894 | |
1895 | - if (empty($group_id)){ |
|
1895 | + if (empty($group_id)) { |
|
1896 | 1896 | return array(); |
1897 | 1897 | } |
1898 | 1898 | |
@@ -1907,9 +1907,9 @@ discard block |
||
1907 | 1907 | $where_relation_condition = ''; |
1908 | 1908 | } else { |
1909 | 1909 | $new_relation_type = array(); |
1910 | - foreach($relation_type as $rel) { |
|
1910 | + foreach ($relation_type as $rel) { |
|
1911 | 1911 | $rel = intval($rel); |
1912 | - $new_relation_type[] ="'$rel'"; |
|
1912 | + $new_relation_type[] = "'$rel'"; |
|
1913 | 1913 | } |
1914 | 1914 | $relation_type = implode(',', $new_relation_type); |
1915 | 1915 | if (!empty($relation_type)) |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
1954 | 1954 | $group_id = intval($group_id); |
1955 | 1955 | |
1956 | - if (empty($group_id)){ |
|
1956 | + if (empty($group_id)) { |
|
1957 | 1957 | return array(); |
1958 | 1958 | } |
1959 | 1959 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | WHERE gu.usergroup_id= $group_id |
1965 | 1965 | ORDER BY relation_type, firstname"; |
1966 | 1966 | |
1967 | - $result=Database::query($sql); |
|
1967 | + $result = Database::query($sql); |
|
1968 | 1968 | $array = array(); |
1969 | 1969 | while ($row = Database::fetch_array($result, 'ASSOC')) { |
1970 | 1970 | $array[$row['id']] = $row; |
@@ -1993,27 +1993,27 @@ discard block |
||
1993 | 1993 | case GROUP_USER_PERMISSION_READER: |
1994 | 1994 | // I'm just a reader |
1995 | 1995 | $relation_group_title = get_lang('IAmAReader'); |
1996 | - $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
1997 | - Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
1998 | - $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
1996 | + $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
1997 | + Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show == 'invite_friends' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
1998 | + $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
1999 | 1999 | Display::return_icon('group_leave.png', get_lang('LeaveGroup'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('LeaveGroup').'</span></a></li>'; |
2000 | 2000 | break; |
2001 | 2001 | case GROUP_USER_PERMISSION_ADMIN: |
2002 | 2002 | $relation_group_title = get_lang('IAmAnAdmin'); |
2003 | - $links .= '<li><a href="group_edit.php?id='.$group_id.'">'. |
|
2004 | - Display::return_icon('group_edit.png', get_lang('EditGroup'), array('hspace'=>'6')).'<span class="'.($show=='group_edit'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('EditGroup').'</span></a></li>'; |
|
2005 | - $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. |
|
2006 | - Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show=='waiting_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>'; |
|
2007 | - $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2008 | - Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2009 | - $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2003 | + $links .= '<li><a href="group_edit.php?id='.$group_id.'">'. |
|
2004 | + Display::return_icon('group_edit.png', get_lang('EditGroup'), array('hspace'=>'6')).'<span class="'.($show == 'group_edit' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('EditGroup').'</span></a></li>'; |
|
2005 | + $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. |
|
2006 | + Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show == 'waiting_list' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>'; |
|
2007 | + $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2008 | + Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show == 'invite_friends' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2009 | + $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2010 | 2010 | Display::return_icon('group_leave.png', get_lang('LeaveGroup'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('LeaveGroup').'</span></a></li>'; |
2011 | 2011 | break; |
2012 | 2012 | case GROUP_USER_PERMISSION_PENDING_INVITATION: |
2013 | 2013 | // $links .= '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.Display::return_icon('addd.gif', get_lang('YouHaveBeenInvitedJoinNow'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('YouHaveBeenInvitedJoinNow').'</span></a></li>'; |
2014 | 2014 | break; |
2015 | 2015 | case GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER: |
2016 | - $relation_group_title = get_lang('WaitingForAdminResponse'); |
|
2016 | + $relation_group_title = get_lang('WaitingForAdminResponse'); |
|
2017 | 2017 | break; |
2018 | 2018 | case GROUP_USER_PERMISSION_MODERATOR: |
2019 | 2019 | $relation_group_title = get_lang('IAmAModerator'); |
@@ -2021,25 +2021,25 @@ discard block |
||
2021 | 2021 | //$links .= '<li><a href="groups.php?id='.$group_id.'">'. Display::return_icon('message_list.png', get_lang('MessageList'), array('hspace'=>'6')).'<span class="'.($show=='messages_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MessageList').'</span></a></li>'; |
2022 | 2022 | //$links .= '<li><a href="group_members.php?id='.$group_id.'">'. Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show=='member_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>'; |
2023 | 2023 | if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED) { |
2024 | - $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. |
|
2025 | - Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show=='waiting_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>'; |
|
2024 | + $links .= '<li><a href="group_waiting_list.php?id='.$group_id.'">'. |
|
2025 | + Display::return_icon('waiting_list.png', get_lang('WaitingList'), array('hspace'=>'6')).'<span class="'.($show == 'waiting_list' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('WaitingList').'</span></a></li>'; |
|
2026 | 2026 | } |
2027 | - $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2028 | - Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2029 | - $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2027 | + $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2028 | + Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show == 'invite_friends' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2029 | + $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2030 | 2030 | Display::return_icon('group_leave.png', get_lang('LeaveGroup'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('LeaveGroup').'</span></a></li>'; |
2031 | 2031 | break; |
2032 | 2032 | case GROUP_USER_PERMISSION_HRM: |
2033 | 2033 | $relation_group_title = get_lang('IAmAHRM'); |
2034 | 2034 | $links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&action=add_message_group" class="ajax" title="'.get_lang('ComposeMessage').'" data-size="lg" data-title="'.get_lang('ComposeMessage').'">'. |
2035 | 2035 | Display::return_icon('new-message.png', get_lang('NewTopic'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('NewTopic').'</span></a></li>'; |
2036 | - $links .= '<li><a href="group_view.php?id='.$group_id.'">'. |
|
2037 | - Display::return_icon('message_list.png', get_lang('MessageList'), array('hspace'=>'6')).'<span class="'.($show=='messages_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MessageList').'</span></a></li>'; |
|
2038 | - $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2039 | - Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show=='invite_friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2040 | - $links .= '<li><a href="group_members.php?id='.$group_id.'">'. |
|
2041 | - Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show=='member_list'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>'; |
|
2042 | - $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2036 | + $links .= '<li><a href="group_view.php?id='.$group_id.'">'. |
|
2037 | + Display::return_icon('message_list.png', get_lang('MessageList'), array('hspace'=>'6')).'<span class="'.($show == 'messages_list' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('MessageList').'</span></a></li>'; |
|
2038 | + $links .= '<li><a href="group_invitation.php?id='.$group_id.'">'. |
|
2039 | + Display::return_icon('invitation_friend.png', get_lang('InviteFriends'), array('hspace'=>'6')).'<span class="'.($show == 'invite_friends' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('InviteFriends').'</span></a></li>'; |
|
2040 | + $links .= '<li><a href="group_members.php?id='.$group_id.'">'. |
|
2041 | + Display::return_icon('member_list.png', get_lang('MemberList'), array('hspace'=>'6')).'<span class="'.($show == 'member_list' ? 'social-menu-text-active' : 'social-menu-text4').'" >'.get_lang('MemberList').'</span></a></li>'; |
|
2042 | + $links .= '<li><a href="group_view.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'. |
|
2043 | 2043 | Display::return_icon('delete_data.gif', get_lang('LeaveGroup'), array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('LeaveGroup').'</span></a></li>'; |
2044 | 2044 | break; |
2045 | 2045 | default: |
@@ -2082,14 +2082,14 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | public function get_groups_by_user_count($user_id = '', $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false) |
2084 | 2084 | { |
2085 | - $table_group_rel_user = $this->usergroup_rel_user_table; |
|
2086 | - $tbl_group = $this->table; |
|
2087 | - $user_id = intval($user_id); |
|
2085 | + $table_group_rel_user = $this->usergroup_rel_user_table; |
|
2086 | + $tbl_group = $this->table; |
|
2087 | + $user_id = intval($user_id); |
|
2088 | 2088 | |
2089 | 2089 | if ($relation_type == 0) { |
2090 | 2090 | $where_relation_condition = ''; |
2091 | 2091 | } else { |
2092 | - $relation_type = intval($relation_type); |
|
2092 | + $relation_type = intval($relation_type); |
|
2093 | 2093 | $where_relation_condition = "AND gu.relation_type = $relation_type "; |
2094 | 2094 | } |
2095 | 2095 | |
@@ -2162,7 +2162,7 @@ discard block |
||
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | $direction = 'ASC'; |
2165 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
2165 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
2166 | 2166 | $direction = 'ASC'; |
2167 | 2167 | } |
2168 | 2168 | |
@@ -2173,8 +2173,8 @@ discard block |
||
2173 | 2173 | $sql .= " LIMIT $from,$number_of_items"; |
2174 | 2174 | |
2175 | 2175 | $res = Database::query($sql); |
2176 | - if (Database::num_rows($res)> 0) { |
|
2177 | - while ($row = Database::fetch_array($res,'ASSOC')) { |
|
2176 | + if (Database::num_rows($res) > 0) { |
|
2177 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
2178 | 2178 | if (!in_array($row['id'], $return)) { |
2179 | 2179 | $return[$row['id']] = $row; |
2180 | 2180 | } |
@@ -2199,7 +2199,7 @@ discard block |
||
2199 | 2199 | if ($i == $max_level) { |
2200 | 2200 | $select_part .= "rg$rg_number.group_id as id_$rg_number "; |
2201 | 2201 | } else { |
2202 | - $select_part .="rg$rg_number.group_id as id_$rg_number, "; |
|
2202 | + $select_part .= "rg$rg_number.group_id as id_$rg_number, "; |
|
2203 | 2203 | } |
2204 | 2204 | if ($i == 1) { |
2205 | 2205 | $cond_part .= "FROM $t_rel_group rg0 LEFT JOIN $t_rel_group rg$i on rg$rg_number.group_id = rg$i.subgroup_id "; |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | $nameList = '<ul class="list-unstyled">'; |
2388 | 2388 | |
2389 | 2389 | foreach ($groupsNameListParsed as $name) { |
2390 | - $nameList .= '<li>' . Display::span($name, ['class' => 'label label-info']) . '</li>'; |
|
2390 | + $nameList .= '<li>'.Display::span($name, ['class' => 'label label-info']).'</li>'; |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | $nameList .= '</ul>'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * @return bool|mixed |
|
89 | + * @return string |
|
90 | 90 | */ |
91 | 91 | public static function getPasswordEncryption() |
92 | 92 | { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param string $raw |
162 | 162 | * @param User $user |
163 | 163 | * |
164 | - * @return bool |
|
164 | + * @return string |
|
165 | 165 | */ |
166 | 166 | public static function encryptPassword($raw, User $user) |
167 | 167 | { |
@@ -965,6 +965,7 @@ discard block |
||
965 | 965 | * Disables or enables a user |
966 | 966 | * @param int user_id |
967 | 967 | * @param int Enable or disable |
968 | + * @param integer $active |
|
968 | 969 | * @return void |
969 | 970 | * @assert (-1,0) === false |
970 | 971 | * @assert (1,1) === true |
@@ -995,6 +996,7 @@ discard block |
||
995 | 996 | /** |
996 | 997 | * Disables a user |
997 | 998 | * @param int User id |
999 | + * @param integer $user_id |
|
998 | 1000 | * @return bool |
999 | 1001 | * @uses UserManager::change_active_state() to actually disable the user |
1000 | 1002 | * @assert (0) === false |
@@ -1011,6 +1013,7 @@ discard block |
||
1011 | 1013 | /** |
1012 | 1014 | * Enable a user |
1013 | 1015 | * @param int User id |
1016 | + * @param integer $user_id |
|
1014 | 1017 | * @return bool |
1015 | 1018 | * @uses UserManager::change_active_state() to actually disable the user |
1016 | 1019 | * @assert (0) === false |
@@ -1175,6 +1178,7 @@ discard block |
||
1175 | 1178 | * Checks whether the user id exists in the database |
1176 | 1179 | * |
1177 | 1180 | * @param int User id |
1181 | + * @param integer $userId |
|
1178 | 1182 | * @return bool True if user id was found, false otherwise |
1179 | 1183 | */ |
1180 | 1184 | public static function is_user_id_valid($userId) |
@@ -1357,7 +1361,7 @@ discard block |
||
1357 | 1361 | * @param array $userInfo user information to avoid query the DB |
1358 | 1362 | * returns the /main/img/unknown.jpg image set it at true |
1359 | 1363 | * |
1360 | - * @return array Array of 2 elements: 'dir' and 'file' which contain |
|
1364 | + * @return integer Array of 2 elements: 'dir' and 'file' which contain |
|
1361 | 1365 | * the dir and file as the name implies if image does not exist it will |
1362 | 1366 | * return the unknow image if anonymous parameter is true if not it returns an empty array |
1363 | 1367 | */ |
@@ -1729,7 +1733,7 @@ discard block |
||
1729 | 1733 | * @param int $user_id User id |
1730 | 1734 | * @param $force Optional parameter to force building after a removal request |
1731 | 1735 | * |
1732 | - * @return A string containing the XHTML code to dipslay the production list, or FALSE |
|
1736 | + * @return boolean|string string containing the XHTML code to dipslay the production list, or FALSE |
|
1733 | 1737 | */ |
1734 | 1738 | public static function build_production_list($user_id, $force = false, $showdelete = false) |
1735 | 1739 | { |
@@ -1765,7 +1769,7 @@ discard block |
||
1765 | 1769 | /** |
1766 | 1770 | * Returns an array with the user's productions. |
1767 | 1771 | * |
1768 | - * @param $user_id User id |
|
1772 | + * @param integer $user_id User id |
|
1769 | 1773 | * @return array An array containing the user's productions |
1770 | 1774 | */ |
1771 | 1775 | public static function get_user_productions($user_id) |
@@ -1920,7 +1924,7 @@ discard block |
||
1920 | 1924 | |
1921 | 1925 | /** |
1922 | 1926 | * Build a list of extra file already uploaded in $user_folder/{$extra_field}/ |
1923 | - * @param $user_id |
|
1927 | + * @param integer $user_id |
|
1924 | 1928 | * @param $extra_field |
1925 | 1929 | * @param bool $force |
1926 | 1930 | * @param bool $showdelete |
@@ -2023,7 +2027,7 @@ discard block |
||
2023 | 2027 | * @param int $fieldType Field's type |
2024 | 2028 | * @param string $displayText Field's language var name |
2025 | 2029 | * @param string $default Field's default value |
2026 | - * @return int |
|
2030 | + * @return boolean |
|
2027 | 2031 | */ |
2028 | 2032 | public static function create_extra_field($variable, $fieldType, $displayText, $default) |
2029 | 2033 | { |
@@ -2056,6 +2060,7 @@ discard block |
||
2056 | 2060 | * @param boolean Whether to prefix the fields indexes with "extra_" (might be used by formvalidator) |
2057 | 2061 | * @param boolean Whether to return invisible fields as well |
2058 | 2062 | * @param boolean Whether to split multiple-selection fields or not |
2063 | + * @param boolean $field_filter |
|
2059 | 2064 | * @return array Array of fields => value for the given user |
2060 | 2065 | */ |
2061 | 2066 | public static function get_extra_user_data( |
@@ -2242,7 +2247,6 @@ discard block |
||
2242 | 2247 | /** |
2243 | 2248 | * Get all the extra field information of a certain field (also the options) |
2244 | 2249 | * |
2245 | - * @param int $field_name the name of the field we want to know everything of |
|
2246 | 2250 | * @return array $return containing all th information about the extra profile field |
2247 | 2251 | * @author Julio Montoya |
2248 | 2252 | * @deprecated |
@@ -2285,6 +2289,7 @@ discard block |
||
2285 | 2289 | /** |
2286 | 2290 | * Get extra user data by field variable |
2287 | 2291 | * @param string field variable |
2292 | + * @param string $field_variable |
|
2288 | 2293 | * @return array data |
2289 | 2294 | */ |
2290 | 2295 | public static function get_extra_user_data_by_field_variable($field_variable) |
@@ -2829,7 +2834,7 @@ discard block |
||
2829 | 2834 | * @param string User ID |
2830 | 2835 | * @param string course directory |
2831 | 2836 | * @param string resourcetype: images, all |
2832 | - * @return int User ID (or false if not found) |
|
2837 | + * @return string User ID (or false if not found) |
|
2833 | 2838 | */ |
2834 | 2839 | public static function get_user_upload_files_by_course($user_id, $course, $resourcetype = 'all') |
2835 | 2840 | { |
@@ -2909,7 +2914,7 @@ discard block |
||
2909 | 2914 | /** |
2910 | 2915 | * Adds a new API key to the users' account |
2911 | 2916 | * @param int Optional user ID (defaults to the results of api_get_user_id()) |
2912 | - * @return boolean True on success, false on failure |
|
2917 | + * @return false|string True on success, false on failure |
|
2913 | 2918 | */ |
2914 | 2919 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
2915 | 2920 | { |
@@ -2964,6 +2969,7 @@ discard block |
||
2964 | 2969 | * Regenerate an API key from the user's account |
2965 | 2970 | * @param int user ID (defaults to the results of api_get_user_id()) |
2966 | 2971 | * @param string API key's internal ID |
2972 | + * @param string $api_service |
|
2967 | 2973 | * @return int num |
2968 | 2974 | */ |
2969 | 2975 | public static function update_api_key($user_id, $api_service) |
@@ -2993,6 +2999,7 @@ discard block |
||
2993 | 2999 | /** |
2994 | 3000 | * @param int user ID (defaults to the results of api_get_user_id()) |
2995 | 3001 | * @param string API key's internal ID |
3002 | + * @param string $api_service |
|
2996 | 3003 | * @return int row ID, or return false if not found |
2997 | 3004 | */ |
2998 | 3005 | public static function get_api_key_id($user_id, $api_service) |
@@ -3204,7 +3211,8 @@ discard block |
||
3204 | 3211 | * @param int user_id |
3205 | 3212 | * @param int field_id |
3206 | 3213 | * @param bool show links or not |
3207 | - * @return array |
|
3214 | + * @param integer $user_id |
|
3215 | + * @return string |
|
3208 | 3216 | */ |
3209 | 3217 | public static function get_user_tags_to_string($user_id, $field_id, $show_links = true) |
3210 | 3218 | { |
@@ -3249,6 +3257,8 @@ discard block |
||
3249 | 3257 | * Get the tag id |
3250 | 3258 | * @param int tag |
3251 | 3259 | * @param int field_id |
3260 | + * @param string $tag |
|
3261 | + * @param integer $field_id |
|
3252 | 3262 | * @return int returns 0 if fails otherwise the tag id |
3253 | 3263 | */ |
3254 | 3264 | public static function get_tag_id($tag, $field_id) |
@@ -3295,7 +3305,7 @@ discard block |
||
3295 | 3305 | * @param mixed tag |
3296 | 3306 | * @param int The user id |
3297 | 3307 | * @param int field id of the tag |
3298 | - * @return bool |
|
3308 | + * @return boolean|null |
|
3299 | 3309 | */ |
3300 | 3310 | public static function add_tag($tag, $user_id, $field_id) |
3301 | 3311 | { |
@@ -4101,7 +4111,7 @@ discard block |
||
4101 | 4111 | * Add subscribed users to a user by relation type |
4102 | 4112 | * @param int $userId The user id |
4103 | 4113 | * @param array $subscribedUsersId The id of suscribed users |
4104 | - * @param action $relationType The relation type |
|
4114 | + * @param integer $relationType The relation type |
|
4105 | 4115 | */ |
4106 | 4116 | public static function subscribeUsersToUser($userId, $subscribedUsersId, $relationType) |
4107 | 4117 | { |
@@ -4158,6 +4168,8 @@ discard block |
||
4158 | 4168 | * This function check if an user is followed by human resources manager |
4159 | 4169 | * @param int User id |
4160 | 4170 | * @param int Human resources manager |
4171 | + * @param integer $user_id |
|
4172 | + * @param integer $hr_dept_id |
|
4161 | 4173 | * @return bool |
4162 | 4174 | */ |
4163 | 4175 | public static function is_user_followed_by_drh($user_id, $hr_dept_id) |
@@ -4230,6 +4242,8 @@ discard block |
||
4230 | 4242 | * Determines if a user is a gradebook certified |
4231 | 4243 | * @param int The category id of gradebook |
4232 | 4244 | * @param int The user id |
4245 | + * @param integer $cat_id |
|
4246 | + * @param integer $user_id |
|
4233 | 4247 | * @return boolean |
4234 | 4248 | */ |
4235 | 4249 | public static function is_user_certified($cat_id, $user_id) |
@@ -4252,6 +4266,8 @@ discard block |
||
4252 | 4266 | * Gets the info about a gradebook certificate for a user by course |
4253 | 4267 | * @param string The course code |
4254 | 4268 | * @param int The user id |
4269 | + * @param integer $course_code |
|
4270 | + * @param integer $user_id |
|
4255 | 4271 | * @return array if there is not information return false |
4256 | 4272 | */ |
4257 | 4273 | public static function get_info_gradebook_certificate($course_code, $user_id) |
@@ -4715,7 +4731,7 @@ discard block |
||
4715 | 4731 | } |
4716 | 4732 | |
4717 | 4733 | /** |
4718 | - * @return array |
|
4734 | + * @return string[] |
|
4719 | 4735 | */ |
4720 | 4736 | static function get_user_field_types() |
4721 | 4737 | { |
@@ -4967,7 +4983,7 @@ discard block |
||
4967 | 4983 | * Get either a Gravatar URL or complete image tag for a specified email address. |
4968 | 4984 | * |
4969 | 4985 | * @param string $email The email address |
4970 | - * @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ] |
|
4986 | + * @param integer $s Size in pixels, defaults to 80px [ 1 - 2048 ] |
|
4971 | 4987 | * @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] |
4972 | 4988 | * @param string $r Maximum rating (inclusive) [ g | pg | r | x ] |
4973 | 4989 | * @param boole $img True to return a complete IMG tag False for just the URL |
@@ -774,10 +774,12 @@ discard block |
||
774 | 774 | public static function update_openid($user_id, $openid) |
775 | 775 | { |
776 | 776 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
777 | - if ($user_id != strval(intval($user_id))) |
|
778 | - return false; |
|
779 | - if ($user_id === false) |
|
780 | - return false; |
|
777 | + if ($user_id != strval(intval($user_id))) { |
|
778 | + return false; |
|
779 | + } |
|
780 | + if ($user_id === false) { |
|
781 | + return false; |
|
782 | + } |
|
781 | 783 | $sql = "UPDATE $table_user SET |
782 | 784 | openid='".Database::escape_string($openid)."'"; |
783 | 785 | $sql .= " WHERE id= $user_id"; |
@@ -2069,8 +2071,9 @@ discard block |
||
2069 | 2071 | if (empty($user_id)) { |
2070 | 2072 | $user_id = 0; |
2071 | 2073 | } else { |
2072 | - if ($user_id != strval(intval($user_id))) |
|
2073 | - return array(); |
|
2074 | + if ($user_id != strval(intval($user_id))) { |
|
2075 | + return array(); |
|
2076 | + } |
|
2074 | 2077 | } |
2075 | 2078 | $extra_data = array(); |
2076 | 2079 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2162,8 +2165,9 @@ discard block |
||
2162 | 2165 | if (empty($user_id)) { |
2163 | 2166 | $user_id = 0; |
2164 | 2167 | } else { |
2165 | - if ($user_id != strval(intval($user_id))) |
|
2166 | - return array(); |
|
2168 | + if ($user_id != strval(intval($user_id))) { |
|
2169 | + return array(); |
|
2170 | + } |
|
2167 | 2171 | } |
2168 | 2172 | $extra_data = array(); |
2169 | 2173 | $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD); |
@@ -2880,13 +2884,15 @@ discard block |
||
2880 | 2884 | */ |
2881 | 2885 | public static function get_api_keys($user_id = null, $api_service = 'dokeos') |
2882 | 2886 | { |
2883 | - if ($user_id != strval(intval($user_id))) |
|
2884 | - return false; |
|
2887 | + if ($user_id != strval(intval($user_id))) { |
|
2888 | + return false; |
|
2889 | + } |
|
2885 | 2890 | if (empty($user_id)) { |
2886 | 2891 | $user_id = api_get_user_id(); |
2887 | 2892 | } |
2888 | - if ($user_id === false) |
|
2889 | - return false; |
|
2893 | + if ($user_id === false) { |
|
2894 | + return false; |
|
2895 | + } |
|
2890 | 2896 | $service_name = Database::escape_string($api_service); |
2891 | 2897 | if (is_string($service_name) === false) { |
2892 | 2898 | return false; |
@@ -2894,11 +2900,14 @@ discard block |
||
2894 | 2900 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2895 | 2901 | $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';"; |
2896 | 2902 | $res = Database::query($sql); |
2897 | - if ($res === false) |
|
2898 | - return false; //error during query |
|
2903 | + if ($res === false) { |
|
2904 | + return false; |
|
2905 | + } |
|
2906 | + //error during query |
|
2899 | 2907 | $num = Database::num_rows($res); |
2900 | - if ($num == 0) |
|
2901 | - return false; |
|
2908 | + if ($num == 0) { |
|
2909 | + return false; |
|
2910 | + } |
|
2902 | 2911 | $list = array(); |
2903 | 2912 | while ($row = Database::fetch_array($res)) { |
2904 | 2913 | $list[$row['id']] = $row['api_key']; |
@@ -2913,13 +2922,15 @@ discard block |
||
2913 | 2922 | */ |
2914 | 2923 | public static function add_api_key($user_id = null, $api_service = 'dokeos') |
2915 | 2924 | { |
2916 | - if ($user_id != strval(intval($user_id))) |
|
2917 | - return false; |
|
2925 | + if ($user_id != strval(intval($user_id))) { |
|
2926 | + return false; |
|
2927 | + } |
|
2918 | 2928 | if (empty($user_id)) { |
2919 | 2929 | $user_id = api_get_user_id(); |
2920 | 2930 | } |
2921 | - if ($user_id === false) |
|
2922 | - return false; |
|
2931 | + if ($user_id === false) { |
|
2932 | + return false; |
|
2933 | + } |
|
2923 | 2934 | $service_name = Database::escape_string($api_service); |
2924 | 2935 | if (is_string($service_name) === false) { |
2925 | 2936 | return false; |
@@ -2928,8 +2939,10 @@ discard block |
||
2928 | 2939 | $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key |
2929 | 2940 | $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')"; |
2930 | 2941 | $res = Database::query($sql); |
2931 | - if ($res === false) |
|
2932 | - return false; //error during query |
|
2942 | + if ($res === false) { |
|
2943 | + return false; |
|
2944 | + } |
|
2945 | + //error during query |
|
2933 | 2946 | $num = Database::insert_id(); |
2934 | 2947 | return ($num == 0) ? false : $num; |
2935 | 2948 | } |
@@ -2941,22 +2954,29 @@ discard block |
||
2941 | 2954 | */ |
2942 | 2955 | public static function delete_api_key($key_id) |
2943 | 2956 | { |
2944 | - if ($key_id != strval(intval($key_id))) |
|
2945 | - return false; |
|
2946 | - if ($key_id === false) |
|
2947 | - return false; |
|
2957 | + if ($key_id != strval(intval($key_id))) { |
|
2958 | + return false; |
|
2959 | + } |
|
2960 | + if ($key_id === false) { |
|
2961 | + return false; |
|
2962 | + } |
|
2948 | 2963 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
2949 | 2964 | $sql = "SELECT * FROM $t_api WHERE id = ".$key_id; |
2950 | 2965 | $res = Database::query($sql); |
2951 | - if ($res === false) |
|
2952 | - return false; //error during query |
|
2966 | + if ($res === false) { |
|
2967 | + return false; |
|
2968 | + } |
|
2969 | + //error during query |
|
2953 | 2970 | $num = Database::num_rows($res); |
2954 | - if ($num !== 1) |
|
2955 | - return false; |
|
2971 | + if ($num !== 1) { |
|
2972 | + return false; |
|
2973 | + } |
|
2956 | 2974 | $sql = "DELETE FROM $t_api WHERE id = ".$key_id; |
2957 | 2975 | $res = Database::query($sql); |
2958 | - if ($res === false) |
|
2959 | - return false; //error during query |
|
2976 | + if ($res === false) { |
|
2977 | + return false; |
|
2978 | + } |
|
2979 | + //error during query |
|
2960 | 2980 | return true; |
2961 | 2981 | } |
2962 | 2982 | |
@@ -2968,10 +2988,12 @@ discard block |
||
2968 | 2988 | */ |
2969 | 2989 | public static function update_api_key($user_id, $api_service) |
2970 | 2990 | { |
2971 | - if ($user_id != strval(intval($user_id))) |
|
2972 | - return false; |
|
2973 | - if ($user_id === false) |
|
2974 | - return false; |
|
2991 | + if ($user_id != strval(intval($user_id))) { |
|
2992 | + return false; |
|
2993 | + } |
|
2994 | + if ($user_id === false) { |
|
2995 | + return false; |
|
2996 | + } |
|
2975 | 2997 | $service_name = Database::escape_string($api_service); |
2976 | 2998 | if (is_string($service_name) === false) { |
2977 | 2999 | return false; |
@@ -2997,12 +3019,15 @@ discard block |
||
2997 | 3019 | */ |
2998 | 3020 | public static function get_api_key_id($user_id, $api_service) |
2999 | 3021 | { |
3000 | - if ($user_id != strval(intval($user_id))) |
|
3001 | - return false; |
|
3002 | - if ($user_id === false) |
|
3003 | - return false; |
|
3004 | - if (empty($api_service)) |
|
3005 | - return false; |
|
3022 | + if ($user_id != strval(intval($user_id))) { |
|
3023 | + return false; |
|
3024 | + } |
|
3025 | + if ($user_id === false) { |
|
3026 | + return false; |
|
3027 | + } |
|
3028 | + if (empty($api_service)) { |
|
3029 | + return false; |
|
3030 | + } |
|
3006 | 3031 | $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY); |
3007 | 3032 | $api_service = Database::escape_string($api_service); |
3008 | 3033 | $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'"; |
@@ -4473,8 +4498,9 @@ discard block |
||
4473 | 4498 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4474 | 4499 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4475 | 4500 | if (!$admin_permissions) { |
4476 | - if ($field_details[7] == 0) |
|
4477 | - $form->freeze('extra_'.$field_details[1]); |
|
4501 | + if ($field_details[7] == 0) { |
|
4502 | + $form->freeze('extra_'.$field_details[1]); |
|
4503 | + } |
|
4478 | 4504 | } |
4479 | 4505 | break; |
4480 | 4506 | case ExtraField::FIELD_TYPE_RADIO: |
@@ -4491,8 +4517,9 @@ discard block |
||
4491 | 4517 | } |
4492 | 4518 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ''); |
4493 | 4519 | if (!$admin_permissions) { |
4494 | - if ($field_details[7] == 0) |
|
4495 | - $form->freeze('extra_'.$field_details[1]); |
|
4520 | + if ($field_details[7] == 0) { |
|
4521 | + $form->freeze('extra_'.$field_details[1]); |
|
4522 | + } |
|
4496 | 4523 | } |
4497 | 4524 | break; |
4498 | 4525 | case ExtraField::FIELD_TYPE_SELECT: |
@@ -4530,8 +4557,9 @@ discard block |
||
4530 | 4557 | ); |
4531 | 4558 | |
4532 | 4559 | if (!$admin_permissions) { |
4533 | - if ($field_details[7] == 0) |
|
4534 | - $form->freeze('extra_'.$field_details[1]); |
|
4560 | + if ($field_details[7] == 0) { |
|
4561 | + $form->freeze('extra_'.$field_details[1]); |
|
4562 | + } |
|
4535 | 4563 | } |
4536 | 4564 | break; |
4537 | 4565 | case ExtraField::FIELD_TYPE_SELECT_MULTIPLE: |
@@ -4547,8 +4575,9 @@ discard block |
||
4547 | 4575 | array('multiple' => 'multiple') |
4548 | 4576 | ); |
4549 | 4577 | if (!$admin_permissions) { |
4550 | - if ($field_details[7] == 0) |
|
4551 | - $form->freeze('extra_'.$field_details[1]); |
|
4578 | + if ($field_details[7] == 0) { |
|
4579 | + $form->freeze('extra_'.$field_details[1]); |
|
4580 | + } |
|
4552 | 4581 | } |
4553 | 4582 | break; |
4554 | 4583 | case ExtraField::FIELD_TYPE_DATE: |
@@ -4556,8 +4585,9 @@ discard block |
||
4556 | 4585 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4557 | 4586 | $form->setDefaults($defaults); |
4558 | 4587 | if (!$admin_permissions) { |
4559 | - if ($field_details[7] == 0) |
|
4560 | - $form->freeze('extra_'.$field_details[1]); |
|
4588 | + if ($field_details[7] == 0) { |
|
4589 | + $form->freeze('extra_'.$field_details[1]); |
|
4590 | + } |
|
4561 | 4591 | } |
4562 | 4592 | $form->applyFilter('theme', 'trim'); |
4563 | 4593 | break; |
@@ -4566,8 +4596,9 @@ discard block |
||
4566 | 4596 | $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00'); |
4567 | 4597 | $form->setDefaults($defaults); |
4568 | 4598 | if (!$admin_permissions) { |
4569 | - if ($field_details[7] == 0) |
|
4570 | - $form->freeze('extra_'.$field_details[1]); |
|
4599 | + if ($field_details[7] == 0) { |
|
4600 | + $form->freeze('extra_'.$field_details[1]); |
|
4601 | + } |
|
4571 | 4602 | } |
4572 | 4603 | $form->applyFilter('theme', 'trim'); |
4573 | 4604 | break; |
@@ -4586,8 +4617,9 @@ discard block |
||
4586 | 4617 | $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], ' '); |
4587 | 4618 | |
4588 | 4619 | if (!$admin_permissions) { |
4589 | - if ($field_details[7] == 0) |
|
4590 | - $form->freeze('extra_'.$field_details[1]); |
|
4620 | + if ($field_details[7] == 0) { |
|
4621 | + $form->freeze('extra_'.$field_details[1]); |
|
4622 | + } |
|
4591 | 4623 | } |
4592 | 4624 | |
4593 | 4625 | /* Recoding the selected values for double : if the user has |
@@ -4647,8 +4679,9 @@ discard block |
||
4647 | 4679 | break; |
4648 | 4680 | case ExtraField::FIELD_TYPE_TIMEZONE: |
4649 | 4681 | $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), ''); |
4650 | - if ($field_details[7] == 0) |
|
4651 | - $form->freeze('extra_'.$field_details[1]); |
|
4682 | + if ($field_details[7] == 0) { |
|
4683 | + $form->freeze('extra_'.$field_details[1]); |
|
4684 | + } |
|
4652 | 4685 | break; |
4653 | 4686 | case ExtraField::FIELD_TYPE_SOCIAL_PROFILE: |
4654 | 4687 | // get the social network's favicon |
@@ -4673,8 +4706,9 @@ discard block |
||
4673 | 4706 | ); |
4674 | 4707 | $form->applyFilter('extra_'.$field_details[1], 'stripslashes'); |
4675 | 4708 | $form->applyFilter('extra_'.$field_details[1], 'trim'); |
4676 | - if ($field_details[7] == 0) |
|
4677 | - $form->freeze('extra_'.$field_details[1]); |
|
4709 | + if ($field_details[7] == 0) { |
|
4710 | + $form->freeze('extra_'.$field_details[1]); |
|
4711 | + } |
|
4678 | 4712 | break; |
4679 | 4713 | case ExtraField::FIELD_TYPE_FILE: |
4680 | 4714 | $extra_field = 'extra_'.$field_details[1]; |
@@ -4991,8 +5025,9 @@ discard block |
||
4991 | 5025 | $url .= "?s=$s&d=$d&r=$r"; |
4992 | 5026 | if ( $img ) { |
4993 | 5027 | $url = '<img src="' . $url . '"'; |
4994 | - foreach ( $atts as $key => $val ) |
|
4995 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5028 | + foreach ( $atts as $key => $val ) { |
|
5029 | + $url .= ' ' . $key . '="' . $val . '"'; |
|
5030 | + } |
|
4996 | 5031 | $url .= ' />'; |
4997 | 5032 | } |
4998 | 5033 | return $url; |
@@ -1231,13 +1231,13 @@ discard block |
||
1231 | 1231 | } |
1232 | 1232 | |
1233 | 1233 | /** |
1234 | - * Get the users by ID |
|
1235 | - * @param array $ids student ids |
|
1236 | - * @param string $active |
|
1237 | - * @param string $order |
|
1238 | - * @param string $limit |
|
1239 | - * @return array $result student information |
|
1240 | - */ |
|
1234 | + * Get the users by ID |
|
1235 | + * @param array $ids student ids |
|
1236 | + * @param string $active |
|
1237 | + * @param string $order |
|
1238 | + * @param string $limit |
|
1239 | + * @return array $result student information |
|
1240 | + */ |
|
1241 | 1241 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
1242 | 1242 | { |
1243 | 1243 | if (empty($ids)) { |
@@ -2275,7 +2275,7 @@ discard block |
||
2275 | 2275 | * |
2276 | 2276 | * @return array with extra data info of a user i.e array('field_variable'=>'value'); |
2277 | 2277 | */ |
2278 | - public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
2278 | + public static function get_extra_user_data_by_value($field_variable, $field_value, $all_visibility = true) |
|
2279 | 2279 | { |
2280 | 2280 | $extraField = new ExtraFieldValue('user'); |
2281 | 2281 | |
@@ -3352,12 +3352,12 @@ discard block |
||
3352 | 3352 | if ($tag_id == 0) { |
3353 | 3353 | //the tag doesn't exist |
3354 | 3354 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
3355 | - Database::query($sql); |
|
3355 | + Database::query($sql); |
|
3356 | 3356 | $last_insert_id = Database::insert_id(); |
3357 | 3357 | } else { |
3358 | 3358 | //the tag exists we update it |
3359 | 3359 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
3360 | - Database::query($sql); |
|
3360 | + Database::query($sql); |
|
3361 | 3361 | $last_insert_id = $tag_id; |
3362 | 3362 | } |
3363 | 3363 | |
@@ -3552,9 +3552,9 @@ discard block |
||
3552 | 3552 | } |
3553 | 3553 | |
3554 | 3554 | /** |
3555 | - * Get extra filtrable user fields (only type select) |
|
3556 | - * @return array |
|
3557 | - */ |
|
3555 | + * Get extra filtrable user fields (only type select) |
|
3556 | + * @return array |
|
3557 | + */ |
|
3558 | 3558 | public static function get_extra_filtrable_fields() |
3559 | 3559 | { |
3560 | 3560 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3579,9 +3579,9 @@ discard block |
||
3579 | 3579 | } |
3580 | 3580 | |
3581 | 3581 | /** |
3582 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3583 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3584 | - */ |
|
3582 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
3583 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
3584 | + */ |
|
3585 | 3585 | public static function get_search_form_where_extra_fields() |
3586 | 3586 | { |
3587 | 3587 | $useExtraFields = false; |
@@ -3900,23 +3900,23 @@ discard block |
||
3900 | 3900 | } |
3901 | 3901 | |
3902 | 3902 | /** |
3903 | - * Get users followed by human resource manager |
|
3904 | - * @param int $userId |
|
3905 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3906 | - * @param bool $getOnlyUserId |
|
3907 | - * @param bool $getSql |
|
3908 | - * @param bool $getCount |
|
3909 | - * @param int $from |
|
3910 | - * @param int $numberItems |
|
3911 | - * @param int $column |
|
3912 | - * @param string $direction |
|
3913 | - * @param int $active |
|
3914 | - * @param string $lastConnectionDate |
|
3915 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3916 | - * @param string $keyword |
|
3903 | + * Get users followed by human resource manager |
|
3904 | + * @param int $userId |
|
3905 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
3906 | + * @param bool $getOnlyUserId |
|
3907 | + * @param bool $getSql |
|
3908 | + * @param bool $getCount |
|
3909 | + * @param int $from |
|
3910 | + * @param int $numberItems |
|
3911 | + * @param int $column |
|
3912 | + * @param string $direction |
|
3913 | + * @param int $active |
|
3914 | + * @param string $lastConnectionDate |
|
3915 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
3916 | + * @param string $keyword |
|
3917 | 3917 | * |
3918 | - * @return array user list |
|
3919 | - */ |
|
3918 | + * @return array user list |
|
3919 | + */ |
|
3920 | 3920 | public static function getUsersFollowedByUser( |
3921 | 3921 | $userId, |
3922 | 3922 | $userStatus = null, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | const USER_FIELD_TYPE_TIMEZONE = 11; |
35 | 35 | const USER_FIELD_TYPE_SOCIAL_PROFILE = 12; |
36 | 36 | const USER_FIELD_TYPE_FILE = 13; |
37 | - const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14; |
|
37 | + const USER_FIELD_TYPE_MOBILE_PHONE_NUMBER = 14; |
|
38 | 38 | |
39 | 39 | private static $encryptionMethod; |
40 | 40 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | if (empty($password)) { |
283 | - Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password') , 'warning')); |
|
283 | + Display::addFlash(Display::return_message(get_lang('ThisFieldIsRequired').': '.get_lang('Password'), 'warning')); |
|
284 | 284 | |
285 | 285 | return false; |
286 | 286 | } |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $res = Database::query($sql); |
487 | 487 | while ($course = Database::fetch_object($res)) { |
488 | 488 | $sql = "SELECT id FROM $table_course_user |
489 | - WHERE status=1 AND c_id = " . intval($course->c_id); |
|
489 | + WHERE status=1 AND c_id = ".intval($course->c_id); |
|
490 | 490 | $res2 = Database::query($sql); |
491 | 491 | if (Database::num_rows($res2) == 1) { |
492 | 492 | |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | $sql = "UPDATE $table_user SET active = 1 WHERE id IN ($ids)"; |
751 | 751 | $r = Database::query($sql); |
752 | 752 | if ($r !== false) { |
753 | - Event::addEvent(LOG_USER_ENABLE,LOG_USER_ID,$ids); |
|
753 | + Event::addEvent(LOG_USER_ENABLE, LOG_USER_ID, $ids); |
|
754 | 754 | } |
755 | 755 | return $r; |
756 | 756 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | // 1. Conversion of unacceptable letters (latinian letters with accents for example) into ASCII letters in order they not to be totally removed. |
1157 | 1157 | // 2. Applying the strict purifier. |
1158 | 1158 | // 3. Length limitation. |
1159 | - $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH); |
|
1159 | + $return = api_get_setting('login_is_email') == 'true' ? substr(preg_replace(USERNAME_PURIFIER_MAIL, '', $username), 0, USERNAME_MAX_LENGTH) : substr(preg_replace(USERNAME_PURIFIER, '', $username), 0, USERNAME_MAX_LENGTH); |
|
1160 | 1160 | $return = URLify::transliterate($return); |
1161 | 1161 | return $return; |
1162 | 1162 | } |
@@ -1248,12 +1248,12 @@ discard block |
||
1248 | 1248 | |
1249 | 1249 | if (!is_null($order)) { |
1250 | 1250 | $order = Database::escape_string($order); |
1251 | - $sql .= ' ORDER BY ' . $order; |
|
1251 | + $sql .= ' ORDER BY '.$order; |
|
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | if (!is_null($limit)) { |
1255 | 1255 | $limit = Database::escape_string($limit); |
1256 | - $sql .= ' LIMIT ' . $limit; |
|
1256 | + $sql .= ' LIMIT '.$limit; |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | $rs = Database::query($sql); |
@@ -1346,11 +1346,11 @@ discard block |
||
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | if (api_is_multiple_url_enabled()) { |
1349 | - $sql_query .= ' AND auru.access_url_id = ' . api_get_current_access_url_id(); |
|
1349 | + $sql_query .= ' AND auru.access_url_id = '.api_get_current_access_url_id(); |
|
1350 | 1350 | } |
1351 | 1351 | } else { |
1352 | 1352 | if (api_is_multiple_url_enabled()) { |
1353 | - $sql_query .= ' WHERE auru.access_url_id = ' . api_get_current_access_url_id(); |
|
1353 | + $sql_query .= ' WHERE auru.access_url_id = '.api_get_current_access_url_id(); |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | 1356 | if (count($order_by) > 0) { |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | // In exceptional cases, on some portals, the intermediate base user |
1450 | 1450 | // directory might not have been created. Make sure it is before |
1451 | 1451 | // going further. |
1452 | - $rootPath = api_get_path(SYS_UPLOAD_PATH) . 'users/' . substr((string) $id, 0, 1); |
|
1452 | + $rootPath = api_get_path(SYS_UPLOAD_PATH).'users/'.substr((string) $id, 0, 1); |
|
1453 | 1453 | if (!is_dir($rootPath)) { |
1454 | 1454 | $perm = api_get_permissions_for_new_directories(); |
1455 | 1455 | try { |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | $path_info = self::get_user_picture_path_by_id($user_id, 'system'); |
1702 | 1702 | $path = $path_info['dir']; |
1703 | 1703 | if (!empty($extra_field)) { |
1704 | - $path .= $extra_field . '/'; |
|
1704 | + $path .= $extra_field.'/'; |
|
1705 | 1705 | } |
1706 | 1706 | // If this directory does not exist - we create it. |
1707 | 1707 | if (!file_exists($path)) { |
@@ -1709,7 +1709,7 @@ discard block |
||
1709 | 1709 | } |
1710 | 1710 | |
1711 | 1711 | if (filter_extension($file)) { |
1712 | - if (@move_uploaded_file($source_file,$path.$file)) { |
|
1712 | + if (@move_uploaded_file($source_file, $path.$file)) { |
|
1713 | 1713 | if ($extra_field) { |
1714 | 1714 | return $extra_field.'/'.$file; |
1715 | 1715 | } else { |
@@ -1962,10 +1962,10 @@ discard block |
||
1962 | 1962 | if (count($extra_files) > 0) { |
1963 | 1963 | $extra_file_list = '<div class="files-production"><ul id="productions">'; |
1964 | 1964 | foreach ($extra_files as $file) { |
1965 | - $filename = substr($file,strlen($extra_field)+1); |
|
1965 | + $filename = substr($file, strlen($extra_field) + 1); |
|
1966 | 1966 | $extra_file_list .= '<li>'.Display::return_icon('archive.png').'<a href="'.$path.$extra_field.'/'.urlencode($filename).'" target="_blank">'.htmlentities($filename).'</a> '; |
1967 | 1967 | if ($showdelete) { |
1968 | - $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>'; |
|
1968 | + $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_'.$extra_field.'['.urlencode($file).']" src="'.$del_image.'" alt="'.$del_text.'" title="'.$del_text.' '.htmlentities($filename).'" onclick="javascript: return confirmation(\''.htmlentities($filename).'\');" /></li>'; |
|
1969 | 1969 | } |
1970 | 1970 | } |
1971 | 1971 | $extra_file_list .= '</ul></div>'; |
@@ -2561,7 +2561,7 @@ discard block |
||
2561 | 2561 | |
2562 | 2562 | if (api_is_allowed_to_create_course()) { |
2563 | 2563 | $sessionListFromCourseCoach = array(); |
2564 | - $sql =" SELECT DISTINCT session_id |
|
2564 | + $sql = " SELECT DISTINCT session_id |
|
2565 | 2565 | FROM $tbl_session_course_user |
2566 | 2566 | WHERE user_id = $user_id AND status = 2 "; |
2567 | 2567 | |
@@ -2569,7 +2569,7 @@ discard block |
||
2569 | 2569 | if (Database::num_rows($result)) { |
2570 | 2570 | $result = Database::store_result($result); |
2571 | 2571 | foreach ($result as $session) { |
2572 | - $sessionListFromCourseCoach[]= $session['session_id']; |
|
2572 | + $sessionListFromCourseCoach[] = $session['session_id']; |
|
2573 | 2573 | } |
2574 | 2574 | } |
2575 | 2575 | if (!empty($sessionListFromCourseCoach)) { |
@@ -2592,7 +2592,7 @@ discard block |
||
2592 | 2592 | ORDER BY access_start_date, access_end_date, name"; |
2593 | 2593 | |
2594 | 2594 | $result = Database::query($sql); |
2595 | - if (Database::num_rows($result)>0) { |
|
2595 | + if (Database::num_rows($result) > 0) { |
|
2596 | 2596 | while ($row = Database::fetch_assoc($result)) { |
2597 | 2597 | $sessions[$row['id']] = $row; |
2598 | 2598 | } |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | ORDER BY access_start_date, access_end_date, name"; |
2609 | 2609 | |
2610 | 2610 | $result = Database::query($sql); |
2611 | - if (Database::num_rows($result)>0) { |
|
2611 | + if (Database::num_rows($result) > 0) { |
|
2612 | 2612 | while ($row = Database::fetch_assoc($result)) { |
2613 | 2613 | if (empty($sessions[$row['id']])) { |
2614 | 2614 | $sessions[$row['id']] = $row; |
@@ -3600,13 +3600,13 @@ discard block |
||
3600 | 3600 | $useExtraFields = false; |
3601 | 3601 | $extraFields = UserManager::get_extra_filtrable_fields(); |
3602 | 3602 | $extraFieldResult = array(); |
3603 | - if (is_array($extraFields) && count($extraFields)>0 ) { |
|
3603 | + if (is_array($extraFields) && count($extraFields) > 0) { |
|
3604 | 3604 | foreach ($extraFields as $extraField) { |
3605 | 3605 | $varName = 'field_'.$extraField['variable']; |
3606 | 3606 | if (UserManager::is_extra_field_available($extraField['variable'])) { |
3607 | - if (isset($_GET[$varName]) && $_GET[$varName]!='0') { |
|
3607 | + if (isset($_GET[$varName]) && $_GET[$varName] != '0') { |
|
3608 | 3608 | $useExtraFields = true; |
3609 | - $extraFieldResult[]= UserManager::get_extra_user_data_by_value( |
|
3609 | + $extraFieldResult[] = UserManager::get_extra_user_data_by_value( |
|
3610 | 3610 | $extraField['variable'], |
3611 | 3611 | $_GET[$varName] |
3612 | 3612 | ); |
@@ -3617,17 +3617,17 @@ discard block |
||
3617 | 3617 | |
3618 | 3618 | if ($useExtraFields) { |
3619 | 3619 | $finalResult = array(); |
3620 | - if (count($extraFieldResult)>1) { |
|
3621 | - for ($i=0; $i < count($extraFieldResult) -1; $i++) { |
|
3622 | - if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i+1])) { |
|
3623 | - $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i+1]); |
|
3620 | + if (count($extraFieldResult) > 1) { |
|
3621 | + for ($i = 0; $i < count($extraFieldResult) - 1; $i++) { |
|
3622 | + if (is_array($extraFieldResult[$i]) && is_array($extraFieldResult[$i + 1])) { |
|
3623 | + $finalResult = array_intersect($extraFieldResult[$i], $extraFieldResult[$i + 1]); |
|
3624 | 3624 | } |
3625 | 3625 | } |
3626 | 3626 | } else { |
3627 | 3627 | $finalResult = $extraFieldResult[0]; |
3628 | 3628 | } |
3629 | 3629 | |
3630 | - if (is_array($finalResult) && count($finalResult)>0) { |
|
3630 | + if (is_array($finalResult) && count($finalResult) > 0) { |
|
3631 | 3631 | $whereFilter = " AND u.id IN ('".implode("','", $finalResult)."') "; |
3632 | 3632 | } else { |
3633 | 3633 | //no results |
@@ -3804,7 +3804,7 @@ discard block |
||
3804 | 3804 | $sql = 'DELETE FROM '.$tbl_my_friend.' |
3805 | 3805 | WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND friend_user_id='.$friend_id.' '.$extra_condition; |
3806 | 3806 | Database::query($sql); |
3807 | - $sql= 'DELETE FROM '.$tbl_my_friend.' |
|
3807 | + $sql = 'DELETE FROM '.$tbl_my_friend.' |
|
3808 | 3808 | WHERE relation_type <> '.USER_RELATION_TYPE_RRHH.' AND user_id='.$friend_id.' '.$extra_condition; |
3809 | 3809 | Database::query($sql); |
3810 | 3810 | } else { |
@@ -4005,7 +4005,7 @@ discard block |
||
4005 | 4005 | |
4006 | 4006 | if (!empty($lastConnectionDate)) { |
4007 | 4007 | $lastConnectionDate = Database::escape_string($lastConnectionDate); |
4008 | - $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
4008 | + $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
4009 | 4009 | } |
4010 | 4010 | |
4011 | 4011 | $courseConditions = null; |
@@ -4074,7 +4074,7 @@ discard block |
||
4074 | 4074 | break; |
4075 | 4075 | case STUDENT_BOSS : |
4076 | 4076 | $drhConditions = " AND friend_user_id = $userId AND " |
4077 | - . "relation_type = " . USER_RELATION_TYPE_BOSS; |
|
4077 | + . "relation_type = ".USER_RELATION_TYPE_BOSS; |
|
4078 | 4078 | break; |
4079 | 4079 | } |
4080 | 4080 | |
@@ -4166,7 +4166,7 @@ discard block |
||
4166 | 4166 | WHERE |
4167 | 4167 | friend_user_id = $userId AND |
4168 | 4168 | relation_type = $relationType AND |
4169 | - access_url_id = " . api_get_current_access_url_id(); |
|
4169 | + access_url_id = ".api_get_current_access_url_id(); |
|
4170 | 4170 | } else { |
4171 | 4171 | $sql = "SELECT user_id FROM $userRelUserTable |
4172 | 4172 | WHERE friend_user_id = $userId |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | if (empty($years)) { |
4449 | 4449 | $years = 1; |
4450 | 4450 | } |
4451 | - $inactive_time = $years * 31536000; //1 year |
|
4451 | + $inactive_time = $years * 31536000; //1 year |
|
4452 | 4452 | $rs = Database::query($sql); |
4453 | 4453 | if (Database::num_rows($rs) > 0) { |
4454 | 4454 | if ($last_login_date = Database::result($rs, 0, 0)) { |
@@ -4581,7 +4581,7 @@ discard block |
||
4581 | 4581 | 'extra_'.$field_details[1], |
4582 | 4582 | $field_details[3], |
4583 | 4583 | $options, |
4584 | - array('id' => 'extra_' . $field_details[1]) |
|
4584 | + array('id' => 'extra_'.$field_details[1]) |
|
4585 | 4585 | ); |
4586 | 4586 | |
4587 | 4587 | if (!$admin_permissions) { |
@@ -4735,7 +4735,7 @@ discard block |
||
4735 | 4735 | $extra_field = 'extra_'.$field_details[1]; |
4736 | 4736 | $form->addElement('file', $extra_field, $field_details[3], null, ''); |
4737 | 4737 | if ($extra_file_list = UserManager::build_user_extra_file_list($user_id, $field_details[1], '', true)) { |
4738 | - $form->addElement('static', $extra_field . '_list', null, $extra_file_list); |
|
4738 | + $form->addElement('static', $extra_field.'_list', null, $extra_file_list); |
|
4739 | 4739 | } |
4740 | 4740 | if ($field_details[7] == 0) { |
4741 | 4741 | $form->freeze($extra_field); |
@@ -4903,7 +4903,7 @@ discard block |
||
4903 | 4903 | $direction = null, |
4904 | 4904 | $active = null, |
4905 | 4905 | $lastConnectionDate = null |
4906 | - ){ |
|
4906 | + ) { |
|
4907 | 4907 | return self::getUsersFollowedByUser( |
4908 | 4908 | $userId, |
4909 | 4909 | $userStatus, |
@@ -5110,12 +5110,12 @@ discard block |
||
5110 | 5110 | if (!empty($_SERVER['HTTPS'])) { |
5111 | 5111 | $url = 'https://secure.gravatar.com/avatar/'; |
5112 | 5112 | } |
5113 | - $url .= md5( strtolower( trim( $email ) ) ); |
|
5113 | + $url .= md5(strtolower(trim($email))); |
|
5114 | 5114 | $url .= "?s=$s&d=$d&r=$r"; |
5115 | - if ( $img ) { |
|
5116 | - $url = '<img src="' . $url . '"'; |
|
5117 | - foreach ( $atts as $key => $val ) |
|
5118 | - $url .= ' ' . $key . '="' . $val . '"'; |
|
5115 | + if ($img) { |
|
5116 | + $url = '<img src="'.$url.'"'; |
|
5117 | + foreach ($atts as $key => $val) |
|
5118 | + $url .= ' '.$key.'="'.$val.'"'; |
|
5119 | 5119 | $url .= ' />'; |
5120 | 5120 | } |
5121 | 5121 | return $url; |