@@ -2,7 +2,7 @@ |
||
2 | 2 | // $Id: xbd.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $ |
3 | 3 | |
4 | 4 | return array( |
5 | - 'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh', |
|
5 | + 'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh', |
|
6 | 6 | 'bwa', 'bwag', 'bwagg', 'bwags', 'bwan', 'bwanj', 'bwanh', 'bwad', 'bwal', 'bwalg', 'bwalm', 'bwalb', 'bwals', 'bwalt', 'bwalp', 'bwalh', |
7 | 7 | 'bwam', 'bwab', 'bwabs', 'bwas', 'bwass', 'bwang', 'bwaj', 'bwac', 'bwak', 'bwat', 'bwap', 'bwah', 'bwae', 'bwaeg', 'bwaegg', 'bwaegs', |
8 | 8 | 'bwaen', 'bwaenj', 'bwaenh', 'bwaed', 'bwael', 'bwaelg', 'bwaelm', 'bwaelb', 'bwaels', 'bwaelt', 'bwaelp', 'bwaelh', 'bwaem', 'bwaeb', 'bwaebs', 'bwaes', |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | Database::query($query); |
34 | 34 | break; |
35 | 35 | case 'update': |
36 | - if ($new_path[0] == '.') $new_path = substr($new_path, 1); |
|
36 | + if ($new_path[0] == '.') { |
|
37 | + $new_path = substr($new_path, 1); |
|
38 | + } |
|
37 | 39 | $new_path = str_replace('//', '/', $new_path); |
38 | 40 | |
39 | 41 | // Attempt to update - tested & working for root dir |
@@ -379,7 +381,9 @@ discard block |
||
379 | 381 | chdir($path); |
380 | 382 | $handle = opendir($path); |
381 | 383 | while ($element = readdir($handle)) { |
382 | - if ($element == '.' || $element == '..') continue; |
|
384 | + if ($element == '.' || $element == '..') { |
|
385 | + continue; |
|
386 | + } |
|
383 | 387 | // Skip the current and parent directories |
384 | 388 | if (is_dir($element)) { |
385 | 389 | $dir_array[] = $path.'/'.$element; |
@@ -419,7 +423,9 @@ discard block |
||
419 | 423 | chdir($directory); |
420 | 424 | $handle = opendir($directory); |
421 | 425 | while ($element = readdir($handle)) { |
422 | - if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
426 | + if ($element == '.' || $element == '..' || $element == '.htaccess') { |
|
427 | + continue; |
|
428 | + } |
|
423 | 429 | // Skip the current and parent directories |
424 | 430 | if (!is_dir($element)) { |
425 | 431 | $element_array[] = $directory.'/'.$element; |
@@ -469,7 +475,9 @@ discard block |
||
469 | 475 | */ |
470 | 476 | function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v') |
471 | 477 | { |
472 | - if (!$default_visibility) $default_visibility = 'v'; |
|
478 | + if (!$default_visibility) { |
|
479 | + $default_visibility = 'v'; |
|
480 | + } |
|
473 | 481 | |
474 | 482 | // Make sure path is not wrongly formed |
475 | 483 | $upload_path = !empty($upload_path) ? "/$upload_path" : ''; |
@@ -170,37 +170,37 @@ discard block |
||
170 | 170 | */ |
171 | 171 | function my_rename($file_path, $new_file_name) { |
172 | 172 | |
173 | - $save_dir = getcwd(); |
|
174 | - $path = dirname($file_path); |
|
175 | - $old_file_name = basename($file_path); |
|
176 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
177 | - |
|
178 | - // If no extension, take the old one |
|
179 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
180 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
181 | - } |
|
182 | - |
|
183 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
184 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
185 | - |
|
186 | - // Extension PHP is not allowed, change to PHPS |
|
187 | - $new_file_name = php2phps($new_file_name); |
|
188 | - |
|
189 | - if ($new_file_name == $old_file_name) { |
|
190 | - return $old_file_name; |
|
191 | - } |
|
192 | - |
|
193 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
194 | - return false; |
|
195 | - } |
|
196 | - // On a Windows server, it would be better not to do the above check |
|
197 | - // because it succeeds for some new names resembling the old name. |
|
198 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
199 | - |
|
200 | - chdir($path); |
|
201 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
202 | - chdir($save_dir); |
|
203 | - return $res; |
|
173 | + $save_dir = getcwd(); |
|
174 | + $path = dirname($file_path); |
|
175 | + $old_file_name = basename($file_path); |
|
176 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
177 | + |
|
178 | + // If no extension, take the old one |
|
179 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
180 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
181 | + } |
|
182 | + |
|
183 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
184 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
185 | + |
|
186 | + // Extension PHP is not allowed, change to PHPS |
|
187 | + $new_file_name = php2phps($new_file_name); |
|
188 | + |
|
189 | + if ($new_file_name == $old_file_name) { |
|
190 | + return $old_file_name; |
|
191 | + } |
|
192 | + |
|
193 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
194 | + return false; |
|
195 | + } |
|
196 | + // On a Windows server, it would be better not to do the above check |
|
197 | + // because it succeeds for some new names resembling the old name. |
|
198 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
199 | + |
|
200 | + chdir($path); |
|
201 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
202 | + chdir($save_dir); |
|
203 | + return $res; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -217,38 +217,38 @@ discard block |
||
217 | 217 | */ |
218 | 218 | function move($source, $target, $forceMove = false, $moveContent = false) |
219 | 219 | { |
220 | - if (check_name_exist($source)) { |
|
221 | - $file_name = basename($source); |
|
220 | + if (check_name_exist($source)) { |
|
221 | + $file_name = basename($source); |
|
222 | 222 | $isWindowsOS = api_is_windows_os(); |
223 | 223 | $canExec = function_exists('exec'); |
224 | 224 | |
225 | - /* File case */ |
|
226 | - if (is_file($source)) { |
|
227 | - if ($forceMove && !$isWindowsOS && $canExec) { |
|
228 | - exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
229 | - } else { |
|
230 | - copy($source, $target . '/' . $file_name); |
|
231 | - unlink($source); |
|
232 | - } |
|
233 | - return true; |
|
234 | - } elseif (is_dir($source)) { |
|
235 | - /* Directory */ |
|
236 | - if ($forceMove && !$isWindowsOS && $canExec) { |
|
237 | - if ($moveContent) { |
|
238 | - $base = basename($source); |
|
239 | - exec('mv '.$source.'/* '.$target.$base.'/'); |
|
240 | - exec('rm -rf '.$source); |
|
241 | - } else { |
|
242 | - exec('mv $source $target'); |
|
243 | - } |
|
244 | - } else { |
|
245 | - copyDirTo($source, $target); |
|
246 | - } |
|
247 | - return true; |
|
248 | - } |
|
249 | - } else { |
|
250 | - return false; |
|
251 | - } |
|
225 | + /* File case */ |
|
226 | + if (is_file($source)) { |
|
227 | + if ($forceMove && !$isWindowsOS && $canExec) { |
|
228 | + exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
229 | + } else { |
|
230 | + copy($source, $target . '/' . $file_name); |
|
231 | + unlink($source); |
|
232 | + } |
|
233 | + return true; |
|
234 | + } elseif (is_dir($source)) { |
|
235 | + /* Directory */ |
|
236 | + if ($forceMove && !$isWindowsOS && $canExec) { |
|
237 | + if ($moveContent) { |
|
238 | + $base = basename($source); |
|
239 | + exec('mv '.$source.'/* '.$target.$base.'/'); |
|
240 | + exec('rm -rf '.$source); |
|
241 | + } else { |
|
242 | + exec('mv $source $target'); |
|
243 | + } |
|
244 | + } else { |
|
245 | + copyDirTo($source, $target); |
|
246 | + } |
|
247 | + return true; |
|
248 | + } |
|
249 | + } else { |
|
250 | + return false; |
|
251 | + } |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @param string $filename filename |
280 | 280 | */ |
281 | 281 | function getextension($filename) { |
282 | - $bouts = explode('.', $filename); |
|
283 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
282 | + $bouts = explode('.', $filename); |
|
283 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * @param boolean $recursive if true , include subdir in total |
292 | 292 | */ |
293 | 293 | function dirsize($root, $recursive = true) { |
294 | - $dir = @opendir($root); |
|
295 | - $size = 0; |
|
296 | - while ($file = @readdir($dir)) { |
|
297 | - if (!in_array($file, array('.', '..'))) { |
|
298 | - if (is_dir($root.'/'.$file)) { |
|
299 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
300 | - } else { |
|
301 | - $size += @filesize($root.'/'.$file); |
|
302 | - } |
|
303 | - } |
|
304 | - } |
|
305 | - @closedir($dir); |
|
306 | - return $size; |
|
294 | + $dir = @opendir($root); |
|
295 | + $size = 0; |
|
296 | + while ($file = @readdir($dir)) { |
|
297 | + if (!in_array($file, array('.', '..'))) { |
|
298 | + if (is_dir($root.'/'.$file)) { |
|
299 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
300 | + } else { |
|
301 | + $size += @filesize($root.'/'.$file); |
|
302 | + } |
|
303 | + } |
|
304 | + } |
|
305 | + @closedir($dir); |
|
306 | + return $size; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /* CLASS FileManager */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | class FileManager |
324 | 324 | { |
325 | - /** |
|
325 | + /** |
|
326 | 326 | Returns a list of all directories, except the base dir, |
327 | 327 | of the current course. This function uses recursion. |
328 | 328 | |
@@ -330,131 +330,130 @@ discard block |
||
330 | 330 | |
331 | 331 | @author Roan Embrechts |
332 | 332 | @version 1.0.1 |
333 | - */ |
|
334 | - function list_all_directories($path) |
|
333 | + */ |
|
334 | + function list_all_directories($path) |
|
335 | 335 | { |
336 | - $result_array = array(); |
|
337 | - if (is_dir($path)) { |
|
338 | - $save_dir = getcwd(); |
|
339 | - chdir($path); |
|
340 | - $handle = opendir($path); |
|
341 | - while ($element = readdir($handle)) { |
|
342 | - if ($element == '.' || $element == '..') continue; |
|
336 | + $result_array = array(); |
|
337 | + if (is_dir($path)) { |
|
338 | + $save_dir = getcwd(); |
|
339 | + chdir($path); |
|
340 | + $handle = opendir($path); |
|
341 | + while ($element = readdir($handle)) { |
|
342 | + if ($element == '.' || $element == '..') continue; |
|
343 | 343 | // Skip the current and parent directories |
344 | - if (is_dir($element)) { |
|
345 | - $dir_array[] = $path.'/'.$element; |
|
346 | - } |
|
347 | - } |
|
348 | - closedir($handle); |
|
349 | - // Recursive operation if subdirectories exist |
|
350 | - $dir_number = sizeof($dir_array); |
|
351 | - if ($dir_number > 0) { |
|
352 | - for ($i = 0 ; $i < $dir_number ; $i++) { |
|
353 | - $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity |
|
354 | - if (is_array($dir_array) && is_array($sub_dir_array)) { |
|
355 | - $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
356 | - } |
|
357 | - } |
|
358 | - } |
|
359 | - $result_array = $dir_array; |
|
360 | - chdir($save_dir) ; |
|
361 | - } |
|
362 | - return $result_array ; |
|
363 | - } |
|
364 | - |
|
365 | - /** |
|
344 | + if (is_dir($element)) { |
|
345 | + $dir_array[] = $path.'/'.$element; |
|
346 | + } |
|
347 | + } |
|
348 | + closedir($handle); |
|
349 | + // Recursive operation if subdirectories exist |
|
350 | + $dir_number = sizeof($dir_array); |
|
351 | + if ($dir_number > 0) { |
|
352 | + for ($i = 0 ; $i < $dir_number ; $i++) { |
|
353 | + $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity |
|
354 | + if (is_array($dir_array) && is_array($sub_dir_array)) { |
|
355 | + $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
356 | + } |
|
357 | + } |
|
358 | + } |
|
359 | + $result_array = $dir_array; |
|
360 | + chdir($save_dir) ; |
|
361 | + } |
|
362 | + return $result_array ; |
|
363 | + } |
|
364 | + |
|
365 | + /** |
|
366 | 366 | This function receives a list of directories. |
367 | 367 | It returns a list of all files in these directories |
368 | 368 | |
369 | 369 | @author Roan Embrechts |
370 | 370 | @version 1.0 |
371 | - */ |
|
372 | - function list_all_files($dir_array) |
|
371 | + */ |
|
372 | + function list_all_files($dir_array) |
|
373 | 373 | { |
374 | - $element_array = array(); |
|
375 | - if (is_dir($dir_array)) { |
|
376 | - |
|
377 | - $save_dir = getcwd(); |
|
378 | - foreach ($dir_array as $directory) { |
|
379 | - chdir($directory); |
|
380 | - $handle = opendir($directory); |
|
381 | - while ($element = readdir($handle)) { |
|
382 | - if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
374 | + $element_array = array(); |
|
375 | + if (is_dir($dir_array)) { |
|
376 | + |
|
377 | + $save_dir = getcwd(); |
|
378 | + foreach ($dir_array as $directory) { |
|
379 | + chdir($directory); |
|
380 | + $handle = opendir($directory); |
|
381 | + while ($element = readdir($handle)) { |
|
382 | + if ($element == '.' || $element == '..' || $element == '.htaccess') continue; |
|
383 | 383 | // Skip the current and parent directories |
384 | - if (!is_dir($element)) { |
|
385 | - $element_array[] = $directory.'/'.$element; |
|
386 | - } |
|
387 | - } |
|
388 | - closedir($handle); |
|
389 | - chdir('..'); |
|
390 | - chdir($save_dir); |
|
391 | - } |
|
392 | - } |
|
393 | - |
|
394 | - return $element_array; |
|
395 | - } |
|
396 | - |
|
397 | - /** |
|
384 | + if (!is_dir($element)) { |
|
385 | + $element_array[] = $directory.'/'.$element; |
|
386 | + } |
|
387 | + } |
|
388 | + closedir($handle); |
|
389 | + chdir('..'); |
|
390 | + chdir($save_dir); |
|
391 | + } |
|
392 | + } |
|
393 | + |
|
394 | + return $element_array; |
|
395 | + } |
|
396 | + |
|
397 | + /** |
|
398 | 398 | Loads contents of file $filename into memory and returns them as a string. |
399 | 399 | Function kept for compatibility with older PHP versions. |
400 | 400 | Function is binary safe (is needed on Windows) |
401 | - */ |
|
402 | - function compat_load_file($file_name) |
|
401 | + */ |
|
402 | + function compat_load_file($file_name) |
|
403 | 403 | { |
404 | - $buffer = ''; |
|
405 | - if (file_exists($file_name)) { |
|
406 | - $fp = fopen($file_name, 'rb'); |
|
407 | - $buffer = fread ($fp, filesize($file_name)); |
|
408 | - fclose ($fp); |
|
409 | - } |
|
410 | - return $buffer; |
|
411 | - } |
|
412 | - |
|
413 | - /** |
|
414 | - * Adds file/folder to document table in database |
|
415 | - * improvement from set_default_settings (see below): |
|
416 | - * take all info from function parameters |
|
417 | - * no global variables needed |
|
418 | - * |
|
419 | - * NOTE $glued_table should already have backticks around it |
|
420 | - * (get it from the database library, and it is done automatically) |
|
421 | - * |
|
422 | - * @param path, filename, filetype, |
|
423 | - $glued_table, default_visibility |
|
404 | + $buffer = ''; |
|
405 | + if (file_exists($file_name)) { |
|
406 | + $fp = fopen($file_name, 'rb'); |
|
407 | + $buffer = fread ($fp, filesize($file_name)); |
|
408 | + fclose ($fp); |
|
409 | + } |
|
410 | + return $buffer; |
|
411 | + } |
|
424 | 412 | |
425 | - * action: Adds an entry to the document table with the default settings. |
|
426 | - * @author Olivier Cauberghe <[email protected]> |
|
427 | - * @author Roan Embrechts |
|
428 | - * @version 1.2 |
|
429 | - */ |
|
430 | - function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v') |
|
413 | + /** |
|
414 | + * Adds file/folder to document table in database |
|
415 | + * improvement from set_default_settings (see below): |
|
416 | + * take all info from function parameters |
|
417 | + * no global variables needed |
|
418 | + * |
|
419 | + * NOTE $glued_table should already have backticks around it |
|
420 | + * (get it from the database library, and it is done automatically) |
|
421 | + * |
|
422 | + * @param path, filename, filetype, |
|
423 | + $glued_table, default_visibility |
|
424 | + * action: Adds an entry to the document table with the default settings. |
|
425 | + * @author Olivier Cauberghe <[email protected]> |
|
426 | + * @author Roan Embrechts |
|
427 | + * @version 1.2 |
|
428 | + */ |
|
429 | + function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v') |
|
431 | 430 | { |
432 | - if (!$default_visibility) $default_visibility = 'v'; |
|
433 | - |
|
434 | - // Make sure path is not wrongly formed |
|
435 | - $upload_path = !empty($upload_path) ? "/$upload_path" : ''; |
|
436 | - |
|
437 | - $endchar = substr($filename, strlen($filename) - 1, 1); |
|
438 | - if ($endchar == "\\" || $endchar == '/') { |
|
439 | - $filename = substr($filename, 0, strlen($filename) - 1); |
|
440 | - } |
|
441 | - |
|
442 | - $full_file_name = $upload_path.'/'.$filename; |
|
443 | - $full_file_name = str_replace("//", '/', $full_file_name); |
|
444 | - |
|
445 | - $sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'"; |
|
446 | - $sql_result = Database::query($sql_query); |
|
447 | - $result = Database::fetch_array($sql_result); |
|
448 | - // Determine which query to execute |
|
449 | - if ($result['number_existing'] > 0) { |
|
450 | - // Entry exists, update |
|
451 | - $query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype' |
|
431 | + if (!$default_visibility) $default_visibility = 'v'; |
|
432 | + |
|
433 | + // Make sure path is not wrongly formed |
|
434 | + $upload_path = !empty($upload_path) ? "/$upload_path" : ''; |
|
435 | + |
|
436 | + $endchar = substr($filename, strlen($filename) - 1, 1); |
|
437 | + if ($endchar == "\\" || $endchar == '/') { |
|
438 | + $filename = substr($filename, 0, strlen($filename) - 1); |
|
439 | + } |
|
440 | + |
|
441 | + $full_file_name = $upload_path.'/'.$filename; |
|
442 | + $full_file_name = str_replace("//", '/', $full_file_name); |
|
443 | + |
|
444 | + $sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'"; |
|
445 | + $sql_result = Database::query($sql_query); |
|
446 | + $result = Database::fetch_array($sql_result); |
|
447 | + // Determine which query to execute |
|
448 | + if ($result['number_existing'] > 0) { |
|
449 | + // Entry exists, update |
|
450 | + $query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype' |
|
452 | 451 | WHERE path='$full_file_name'"; |
453 | - } else { |
|
454 | - // No entry exists, create new one |
|
455 | - $query = "INSERT INTO $glued_table (path,visibility,filetype) |
|
452 | + } else { |
|
453 | + // No entry exists, create new one |
|
454 | + $query = "INSERT INTO $glued_table (path,visibility,filetype) |
|
456 | 455 | VALUES ('$full_file_name','$default_visibility','$filetype')"; |
457 | - } |
|
458 | - Database::query($query); |
|
459 | - } |
|
456 | + } |
|
457 | + Database::query($query); |
|
458 | + } |
|
460 | 459 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | /* File case */ |
226 | 226 | if (is_file($source)) { |
227 | 227 | if ($forceMove && !$isWindowsOS && $canExec) { |
228 | - exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
228 | + exec('mv '.$source.' '.$target.'/'.$file_name); |
|
229 | 229 | } else { |
230 | - copy($source, $target . '/' . $file_name); |
|
230 | + copy($source, $target.'/'.$file_name); |
|
231 | 231 | unlink($source); |
232 | 232 | } |
233 | 233 | return true; |
@@ -349,17 +349,17 @@ discard block |
||
349 | 349 | // Recursive operation if subdirectories exist |
350 | 350 | $dir_number = sizeof($dir_array); |
351 | 351 | if ($dir_number > 0) { |
352 | - for ($i = 0 ; $i < $dir_number ; $i++) { |
|
352 | + for ($i = 0; $i < $dir_number; $i++) { |
|
353 | 353 | $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity |
354 | 354 | if (is_array($dir_array) && is_array($sub_dir_array)) { |
355 | - $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
355 | + $dir_array = array_merge($dir_array, $sub_dir_array); // Data merge |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
359 | - $result_array = $dir_array; |
|
360 | - chdir($save_dir) ; |
|
359 | + $result_array = $dir_array; |
|
360 | + chdir($save_dir); |
|
361 | 361 | } |
362 | - return $result_array ; |
|
362 | + return $result_array; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | $buffer = ''; |
405 | 405 | if (file_exists($file_name)) { |
406 | 406 | $fp = fopen($file_name, 'rb'); |
407 | - $buffer = fread ($fp, filesize($file_name)); |
|
408 | - fclose ($fp); |
|
407 | + $buffer = fread($fp, filesize($file_name)); |
|
408 | + fclose($fp); |
|
409 | 409 | } |
410 | 410 | return $buffer; |
411 | 411 | } |
@@ -13,6 +13,8 @@ discard block |
||
13 | 13 | * @param - action (string) - action type require : 'delete' or 'update' |
14 | 14 | * @param - old_path (string) - old path info stored to change |
15 | 15 | * @param - new_path (string) - new path info to substitute |
16 | + * @param string $action |
|
17 | + * @param string $old_path |
|
16 | 18 | * @desc Update the file or directory path in the document db document table |
17 | 19 | * |
18 | 20 | */ |
@@ -75,8 +77,8 @@ discard block |
||
75 | 77 | * Deletes a file or a directory |
76 | 78 | * |
77 | 79 | * @author - Hugues Peeters |
78 | - * @param $file (String) - the path of file or directory to delete |
|
79 | - * @return boolean - true if the delete succeed, false otherwise. |
|
80 | + * @param string $file (String) - the path of file or directory to delete |
|
81 | + * @return boolean|null - true if the delete succeed, false otherwise. |
|
80 | 82 | * @see - delete() uses check_name_exist() and removeDir() functions |
81 | 83 | */ |
82 | 84 | function my_delete($file) |
@@ -163,7 +165,7 @@ discard block |
||
163 | 165 | * @author Hugues Peeters <[email protected]> |
164 | 166 | * @param string $file_path complete path of the file or the directory |
165 | 167 | * @param string $new_file_name new name for the file or the directory |
166 | - * @return boolean true if succeed, false otherwise |
|
168 | + * @return string|false true if succeed, false otherwise |
|
167 | 169 | * @see rename() uses the check_name_exist() and php2phps() functions |
168 | 170 | */ |
169 | 171 | function my_rename($file_path, $new_file_name) { |
@@ -209,7 +211,7 @@ discard block |
||
209 | 211 | * @param string $target the path of the new area |
210 | 212 | * @param bool $forceMove Whether to force a move or to make a copy (safer but slower) and then delete the original |
211 | 213 | * @param bool $moveContent In some cases (including migrations), we need to move the *content* and not the folder itself |
212 | - * @return bool true if the move succeed, false otherwise. |
|
214 | + * @return boolean|null true if the move succeed, false otherwise. |
|
213 | 215 | * @see move() uses check_name_exist() and copyDirTo() functions |
214 | 216 | */ |
215 | 217 | function move($source, $target, $forceMove = false, $moveContent = false) |
@@ -18,30 +18,30 @@ discard block |
||
18 | 18 | if (api_is_student() && !api_get_setting('student_page_after_login') == '') { |
19 | 19 | $redirect_url = html_entity_decode(api_get_setting('student_page_after_login')); |
20 | 20 | if ($redirect_url[0] == "/") { |
21 | - $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url; |
|
21 | + $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url; |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | if (api_is_teacher() && !api_get_setting('teacher_page_after_login') == '') { |
25 | 25 | $redirect_url = html_entity_decode(api_get_setting('teacher_page_after_login')); |
26 | 26 | if ($redirect_url[0] == "/") { |
27 | - $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url; |
|
27 | + $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (api_is_drh() && !api_get_setting('drh_page_after_login') == '') { |
31 | 31 | $redirect_url = html_entity_decode(api_get_setting('drh_page_after_login')); |
32 | 32 | if ($redirect_url[0] == "/") { |
33 | - $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url; |
|
33 | + $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | if (api_is_session_admin() && !api_get_setting('sessionadmin_page_after_login') == '') { |
37 | 37 | $redirect_url = html_entity_decode(api_get_setting('sessionadmin_page_after_login')); |
38 | 38 | if ($redirect_url[0] == "/") { |
39 | - $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url; |
|
39 | + $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!empty($redirect_url)) { |
44 | - header('Location: ' . $redirect_url . $param); |
|
44 | + header('Location: '.$redirect_url.$param); |
|
45 | 45 | exit(); |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if (CustomPages::enabled()) { |
50 | 50 | CustomPages::display(CustomPages::INDEX_LOGGED); |
51 | 51 | } |
52 | - header('location: ' . api_get_path(WEB_PATH) . api_get_setting('page_after_login') . $param); |
|
52 | + header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param); |
|
53 | 53 | exit(); |
54 | 54 | } |
55 | 55 | } |
@@ -6022,7 +6022,7 @@ |
||
6022 | 6022 | ]); |
6023 | 6023 | } |
6024 | 6024 | |
6025 | - /** |
|
6025 | + /** |
|
6026 | 6026 | * Get the count of user courses in session |
6027 | 6027 | * @param int $sessionId The session id |
6028 | 6028 | * @return array |
@@ -1588,8 +1588,10 @@ discard block |
||
1588 | 1588 | if (empty($session_visibility)) { |
1589 | 1589 | $session_visibility = $session->getVisibility(); |
1590 | 1590 | //default status loaded if empty |
1591 | - if (empty($session_visibility)) |
|
1592 | - $session_visibility = SESSION_VISIBLE_READ_ONLY; // by default readonly 1 |
|
1591 | + if (empty($session_visibility)) { |
|
1592 | + $session_visibility = SESSION_VISIBLE_READ_ONLY; |
|
1593 | + } |
|
1594 | + // by default readonly 1 |
|
1593 | 1595 | } else { |
1594 | 1596 | if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) { |
1595 | 1597 | $session_visibility = SESSION_VISIBLE_READ_ONLY; |
@@ -2792,10 +2794,11 @@ discard block |
||
2792 | 2794 | c_id = $courseId AND |
2793 | 2795 | user_id = $user_id "; |
2794 | 2796 | $result = Database::query($sql); |
2795 | - if (Database::affected_rows($result) > 0) |
|
2796 | - return true; |
|
2797 | - else |
|
2798 | - return false; |
|
2797 | + if (Database::affected_rows($result) > 0) { |
|
2798 | + return true; |
|
2799 | + } else { |
|
2800 | + return false; |
|
2801 | + } |
|
2799 | 2802 | } else { |
2800 | 2803 | // The user is not subscribed to the session, so make sure |
2801 | 2804 | // he isn't subscribed to a course in this session either |
@@ -2806,10 +2809,11 @@ discard block |
||
2806 | 2809 | c_id = $courseId AND |
2807 | 2810 | user_id = $user_id "; |
2808 | 2811 | $result = Database::query($sql); |
2809 | - if (Database::affected_rows($result) > 0) |
|
2810 | - return true; |
|
2811 | - else |
|
2812 | - return false; |
|
2812 | + if (Database::affected_rows($result) > 0) { |
|
2813 | + return true; |
|
2814 | + } else { |
|
2815 | + return false; |
|
2816 | + } |
|
2813 | 2817 | } |
2814 | 2818 | } else { |
2815 | 2819 | // Assign user as a coach to course |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $msg; |
144 | 144 | } |
145 | 145 | } else { |
146 | - $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'"); |
|
146 | + $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'"); |
|
147 | 147 | if (Database::num_rows($rs)) { |
148 | 148 | $msg = get_lang('SessionNameAlreadyExists'); |
149 | 149 | return $msg; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | public static function session_name_exists($name) |
257 | 257 | { |
258 | 258 | $name = Database::escape_string($name); |
259 | - $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . " |
|
259 | + $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)." |
|
260 | 260 | WHERE name = '$name'"; |
261 | 261 | $result = Database::fetch_array(Database::query($sql)); |
262 | 262 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $where .= " AND ( |
288 | 288 | s.session_admin_id = $user_id OR |
289 | 289 | sru.user_id = '$user_id' AND |
290 | - sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' |
|
290 | + sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' |
|
291 | 291 | ) |
292 | 292 | "; |
293 | 293 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $where_condition = str_replace('category_name', 'sc.name', $where_condition); |
306 | 306 | $where_condition = str_replace( |
307 | 307 | array("AND session_active = '1' )", " AND ( session_active = '1' )"), |
308 | - array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " ) |
|
308 | + array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ") |
|
309 | 309 | , $where_condition |
310 | 310 | ); |
311 | 311 | $where_condition = str_replace( |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $access_url_id = api_get_current_access_url_id(); |
352 | 352 | if ($access_url_id != -1) { |
353 | - $where.= " AND ar.access_url_id = $access_url_id "; |
|
353 | + $where .= " AND ar.access_url_id = $access_url_id "; |
|
354 | 354 | |
355 | 355 | $sql = "SELECT count(id) as total_rows FROM ( |
356 | 356 | SELECT DISTINCT |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | if (api_is_session_admin() && |
401 | 401 | api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false' |
402 | 402 | ) { |
403 | - $where .=" AND s.session_admin_id = $user_id "; |
|
403 | + $where .= " AND s.session_admin_id = $user_id "; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
407 | 407 | if (!api_is_platform_admin() && api_is_teacher() && |
408 | 408 | api_get_setting('allow_teachers_to_create_sessions') == 'true' |
409 | 409 | ) { |
410 | - $where .=" AND s.id_coach = $user_id "; |
|
410 | + $where .= " AND s.id_coach = $user_id "; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | $extra_field = new ExtraField('session'); |
@@ -457,10 +457,10 @@ discard block |
||
457 | 457 | $query = "$select FROM $tbl_session s $inject_joins $where $inject_where"; |
458 | 458 | |
459 | 459 | if (api_is_multiple_url_enabled()) { |
460 | - $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
460 | + $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
461 | 461 | $access_url_id = api_get_current_access_url_id(); |
462 | 462 | if ($access_url_id != -1) { |
463 | - $where.= " AND ar.access_url_id = $access_url_id "; |
|
463 | + $where .= " AND ar.access_url_id = $access_url_id "; |
|
464 | 464 | $query = "$select |
465 | 465 | FROM $tbl_session s $inject_joins |
466 | 466 | INNER JOIN $table_access_url_rel_session ar |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | INNER JOIN $tbl_lp l ON l.id = v.lp_id |
565 | 565 | INNER JOIN $tbl_user u ON u.user_id = v.user_id |
566 | 566 | INNER JOIN $tbl_course c |
567 | - WHERE v.session_id = " . $sessionId; |
|
567 | + WHERE v.session_id = ".$sessionId; |
|
568 | 568 | $result_rows = Database::query($sql); |
569 | 569 | $row = Database::fetch_array($result_rows); |
570 | 570 | $num = $row['total_rows']; |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | |
617 | 617 | $limit = null; |
618 | 618 | if (!empty($options['limit'])) { |
619 | - $limit = " LIMIT " . $options['limit']; |
|
619 | + $limit = " LIMIT ".$options['limit']; |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | if (!empty($options['where'])) { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | |
626 | 626 | $order = null; |
627 | 627 | if (!empty($options['order'])) { |
628 | - $order = " ORDER BY " . $options['order']; |
|
628 | + $order = " ORDER BY ".$options['order']; |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id |
@@ -684,13 +684,13 @@ discard block |
||
684 | 684 | foreach ($lessons as $lesson) { |
685 | 685 | $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0; |
686 | 686 | $progress += $data[$lesson['id']]; |
687 | - $data[$lesson['id']] = $data[$lesson['id']] . '%'; |
|
687 | + $data[$lesson['id']] = $data[$lesson['id']].'%'; |
|
688 | 688 | $count++; |
689 | 689 | } |
690 | 690 | if ($count == 0) { |
691 | 691 | $data['total'] = 0; |
692 | 692 | } else { |
693 | - $data['total'] = round($progress / $count, 2) . '%'; |
|
693 | + $data['total'] = round($progress / $count, 2).'%'; |
|
694 | 694 | } |
695 | 695 | $table[] = $data; |
696 | 696 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | $limit = null; |
733 | 733 | if (!empty($options['limit'])) { |
734 | - $limit = " LIMIT " . $options['limit']; |
|
734 | + $limit = " LIMIT ".$options['limit']; |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | if (!empty($options['where'])) { |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | |
741 | 741 | $order = null; |
742 | 742 | if (!empty($options['order'])) { |
743 | - $order = " ORDER BY " . $options['order']; |
|
743 | + $order = " ORDER BY ".$options['order']; |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | |
843 | 843 | $limit = null; |
844 | 844 | if (!empty($options['limit'])) { |
845 | - $limit = " LIMIT " . $options['limit']; |
|
845 | + $limit = " LIMIT ".$options['limit']; |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if (!empty($options['where'])) { |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | $order = null; |
853 | 853 | if (!empty($options['order'])) { |
854 | - $order = " ORDER BY " . $options['order']; |
|
854 | + $order = " ORDER BY ".$options['order']; |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | //TODO, fix create report without session |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | /** |
885 | 885 | * Lessons |
886 | 886 | */ |
887 | - $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s |
|
887 | + $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s |
|
888 | 888 | $sql_query = sprintf($sql, $course['real_id']); |
889 | 889 | $result = Database::query($sql_query); |
890 | 890 | $arrLesson = array(array()); |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | if (empty($arrLesson[$row['session_id']]['lessons_total'])) { |
893 | 893 | $arrLesson[$row['session_id']]['lessons_total'] = 1; |
894 | 894 | } else { |
895 | - $arrLesson[$row['session_id']]['lessons_total'] ++; |
|
895 | + $arrLesson[$row['session_id']]['lessons_total']++; |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $course['real_id'] |
960 | 960 | ); |
961 | 961 | foreach ($user_list as $user_id) { |
962 | - isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1; |
|
962 | + isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1; |
|
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']); |
1014 | 1014 | $assignments_left = $assignments_total - $assignments_done; |
1015 | 1015 | if (!empty($assignments_total)) { |
1016 | - $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2); |
|
1016 | + $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2); |
|
1017 | 1017 | } else { |
1018 | 1018 | $assignments_progress = 0; |
1019 | 1019 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | $wiki_read = $row['count']; |
1044 | 1044 | $wiki_unread = $wiki_total - $wiki_read; |
1045 | 1045 | if (!empty($wiki_total)) { |
1046 | - $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2); |
|
1046 | + $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2); |
|
1047 | 1047 | } else { |
1048 | 1048 | $wiki_progress = 0; |
1049 | 1049 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0); |
1053 | 1053 | $surveys_left = $surveys_total - $surveys_done; |
1054 | 1054 | if (!empty($surveys_total)) { |
1055 | - $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2); |
|
1055 | + $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2); |
|
1056 | 1056 | } else { |
1057 | 1057 | $surveys_progress = 0; |
1058 | 1058 | } |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | ); |
1066 | 1066 | $forums_left = $forums_total - $forums_done; |
1067 | 1067 | if (!empty($forums_total)) { |
1068 | - $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2); |
|
1068 | + $forums_progress = round((($forums_done * 100) / $forums_total), 2); |
|
1069 | 1069 | } else { |
1070 | 1070 | $forums_progress = 0; |
1071 | 1071 | } |
@@ -1073,58 +1073,58 @@ discard block |
||
1073 | 1073 | //Overall Total |
1074 | 1074 | $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6; |
1075 | 1075 | |
1076 | - $link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user[0] . '&details=true&course=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>'; |
|
1077 | - $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>'; |
|
1078 | - $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>'; |
|
1079 | - $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>'; |
|
1080 | - $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>'; |
|
1076 | + $link = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user[0].'&details=true&course='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>'; |
|
1077 | + $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>'; |
|
1078 | + $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>'; |
|
1079 | + $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>'; |
|
1080 | + $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>'; |
|
1081 | 1081 | |
1082 | 1082 | $table[] = array( |
1083 | 1083 | 'lastname' => $user[1], |
1084 | 1084 | 'firstname' => $user[2], |
1085 | 1085 | 'username' => $user[3], |
1086 | 1086 | #'profile' => '', |
1087 | - 'total' => round($overall_total, 2) . '%', |
|
1088 | - 'courses' => sprintf($link, $course_description_progress . '%'), |
|
1089 | - 'lessons' => sprintf($link, $lessons_progress . '%'), |
|
1090 | - 'exercises' => sprintf($link, $exercises_progress . '%'), |
|
1091 | - 'forums' => sprintf($link, $forums_progress . '%'), |
|
1092 | - 'homeworks' => sprintf($link, $assignments_progress . '%'), |
|
1093 | - 'wikis' => sprintf($link, $wiki_progress . '%'), |
|
1094 | - 'surveys' => sprintf($link, $surveys_progress . '%'), |
|
1087 | + 'total' => round($overall_total, 2).'%', |
|
1088 | + 'courses' => sprintf($link, $course_description_progress.'%'), |
|
1089 | + 'lessons' => sprintf($link, $lessons_progress.'%'), |
|
1090 | + 'exercises' => sprintf($link, $exercises_progress.'%'), |
|
1091 | + 'forums' => sprintf($link, $forums_progress.'%'), |
|
1092 | + 'homeworks' => sprintf($link, $assignments_progress.'%'), |
|
1093 | + 'wikis' => sprintf($link, $wiki_progress.'%'), |
|
1094 | + 'surveys' => sprintf($link, $surveys_progress.'%'), |
|
1095 | 1095 | //course description |
1096 | - 'course_description_progress' => $course_description_progress . '%', |
|
1096 | + 'course_description_progress' => $course_description_progress.'%', |
|
1097 | 1097 | //lessons |
1098 | 1098 | 'lessons_total' => sprintf($link, $lessons_total), |
1099 | 1099 | 'lessons_done' => sprintf($link, $lessons_done), |
1100 | 1100 | 'lessons_left' => sprintf($link, $lessons_left), |
1101 | - 'lessons_progress' => sprintf($link, $lessons_progress . '%'), |
|
1101 | + 'lessons_progress' => sprintf($link, $lessons_progress.'%'), |
|
1102 | 1102 | //exercises |
1103 | 1103 | 'exercises_total' => sprintf($link, $exercises_total), |
1104 | 1104 | 'exercises_done' => sprintf($link, $exercises_done), |
1105 | 1105 | 'exercises_left' => sprintf($link, $exercises_left), |
1106 | - 'exercises_progress' => sprintf($link, $exercises_progress . '%'), |
|
1106 | + 'exercises_progress' => sprintf($link, $exercises_progress.'%'), |
|
1107 | 1107 | //forums |
1108 | 1108 | 'forums_total' => sprintf($linkForum, $forums_total), |
1109 | 1109 | 'forums_done' => sprintf($linkForum, $forums_done), |
1110 | 1110 | 'forums_left' => sprintf($linkForum, $forums_left), |
1111 | - 'forums_progress' => sprintf($linkForum, $forums_progress . '%'), |
|
1111 | + 'forums_progress' => sprintf($linkForum, $forums_progress.'%'), |
|
1112 | 1112 | //assignments |
1113 | 1113 | 'assignments_total' => sprintf($linkWork, $assignments_total), |
1114 | 1114 | 'assignments_done' => sprintf($linkWork, $assignments_done), |
1115 | 1115 | 'assignments_left' => sprintf($linkWork, $assignments_left), |
1116 | - 'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'), |
|
1116 | + 'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'), |
|
1117 | 1117 | //wiki |
1118 | 1118 | 'wiki_total' => sprintf($linkWiki, $wiki_total), |
1119 | 1119 | 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions), |
1120 | 1120 | 'wiki_read' => sprintf($linkWiki, $wiki_read), |
1121 | 1121 | 'wiki_unread' => sprintf($linkWiki, $wiki_unread), |
1122 | - 'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'), |
|
1122 | + 'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'), |
|
1123 | 1123 | //survey |
1124 | 1124 | 'surveys_total' => sprintf($linkSurvey, $surveys_total), |
1125 | 1125 | 'surveys_done' => sprintf($linkSurvey, $surveys_done), |
1126 | 1126 | 'surveys_left' => sprintf($linkSurvey, $surveys_left), |
1127 | - 'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'), |
|
1127 | + 'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'), |
|
1128 | 1128 | ); |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | |
1205 | 1205 | $limit = null; |
1206 | 1206 | if (!empty($options['limit'])) { |
1207 | - $limit = " LIMIT " . $options['limit']; |
|
1207 | + $limit = " LIMIT ".$options['limit']; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | if (!empty($options['where'])) { |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | |
1214 | 1214 | $order = null; |
1215 | 1215 | if (!empty($options['order'])) { |
1216 | - $order = " ORDER BY " . $options['order']; |
|
1216 | + $order = " ORDER BY ".$options['order']; |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | //TODO add course name |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | " : " |
1227 | 1227 | u.lastname, |
1228 | 1228 | u.firstname, |
1229 | - ") . " |
|
1229 | + ")." |
|
1230 | 1230 | a.logout_course_date, |
1231 | 1231 | a.counter, |
1232 | 1232 | c.title, |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | if (Database::num_rows($result) > 0) { |
1309 | 1309 | $row = Database::fetch_array($result); |
1310 | 1310 | $count = $row['count'] + 1; |
1311 | - $session_name = $session_name . '_' . $count; |
|
1311 | + $session_name = $session_name.'_'.$count; |
|
1312 | 1312 | $result = self::session_name_exists($session_name); |
1313 | 1313 | if (!$result) { |
1314 | 1314 | return $session_name; |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | |
1389 | 1389 | return false; |
1390 | 1390 | } else { |
1391 | - $sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'"; |
|
1391 | + $sql = "SELECT id FROM $tbl_session WHERE name='".Database::escape_string($name)."'"; |
|
1392 | 1392 | $rs = Database::query($sql); |
1393 | 1393 | $exists = false; |
1394 | 1394 | while ($row = Database::fetch_array($rs)) { |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | // Delete users from the session |
1755 | 1755 | if ($empty_users === true) { |
1756 | 1756 | $sql = "DELETE FROM $tbl_session_rel_user |
1757 | - WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . ""; |
|
1757 | + WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH.""; |
|
1758 | 1758 | Database::query($sql); |
1759 | 1759 | } |
1760 | 1760 | |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $enreg_user = Database::escape_string($enreg_user); |
1766 | 1766 | $nbr_users++; |
1767 | 1767 | $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at) |
1768 | - VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')"; |
|
1768 | + VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')"; |
|
1769 | 1769 | Database::query($sql); |
1770 | 1770 | } |
1771 | 1771 | |
@@ -1855,9 +1855,9 @@ discard block |
||
1855 | 1855 | is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo; |
1856 | 1856 | |
1857 | 1857 | $statusCondition = null; |
1858 | - if (isset($status) && !is_null($status)) { |
|
1858 | + if (isset($status) && !is_null($status)) { |
|
1859 | 1859 | $status = intval($status); |
1860 | - $statusCondition = " AND status = $status"; |
|
1860 | + $statusCondition = " AND status = $status"; |
|
1861 | 1861 | } |
1862 | 1862 | |
1863 | 1863 | foreach ($userList as $userId) { |
@@ -1989,7 +1989,7 @@ discard block |
||
1989 | 1989 | if (empty($count)) { |
1990 | 1990 | // If user is not registered to a session then add it. |
1991 | 1991 | $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at) |
1992 | - VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')"; |
|
1992 | + VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')"; |
|
1993 | 1993 | Database::query($sql); |
1994 | 1994 | |
1995 | 1995 | $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1 |
@@ -2032,7 +2032,7 @@ discard block |
||
2032 | 2032 | WHERE |
2033 | 2033 | session_id = $session_id AND |
2034 | 2034 | user_id = $user_id AND |
2035 | - relation_type <> " . SESSION_RELATION_TYPE_RRHH . ""; |
|
2035 | + relation_type <> ".SESSION_RELATION_TYPE_RRHH.""; |
|
2036 | 2036 | $result = Database::query($delete_sql); |
2037 | 2037 | $return = Database::affected_rows($result); |
2038 | 2038 | |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | FROM $tbl_session_rel_user |
2117 | 2117 | WHERE |
2118 | 2118 | session_id = $sessionId AND |
2119 | - relation_type<>" . SESSION_RELATION_TYPE_RRHH; |
|
2119 | + relation_type<>".SESSION_RELATION_TYPE_RRHH; |
|
2120 | 2120 | $result = Database::query($sql); |
2121 | 2121 | $user_list = Database::store_result($result); |
2122 | 2122 | |
@@ -2128,7 +2128,7 @@ discard block |
||
2128 | 2128 | |
2129 | 2129 | $sql = "DELETE FROM $tbl_session_rel_course |
2130 | 2130 | WHERE |
2131 | - c_id = " . $existingCourse['c_id'] . " AND |
|
2131 | + c_id = ".$existingCourse['c_id']." AND |
|
2132 | 2132 | session_id = $sessionId"; |
2133 | 2133 | Database::query($sql); |
2134 | 2134 | |
@@ -2191,7 +2191,7 @@ discard block |
||
2191 | 2191 | $links = $cat->get_links(null, false, $courseInfo['code'], 0); |
2192 | 2192 | |
2193 | 2193 | $cat->set_session_id($sessionId); |
2194 | - $oldCategoryId= $cat->get_id(); |
|
2194 | + $oldCategoryId = $cat->get_id(); |
|
2195 | 2195 | $newId = $cat->add(); |
2196 | 2196 | $newCategoryIdList[$oldCategoryId] = $newId; |
2197 | 2197 | |
@@ -2379,8 +2379,8 @@ discard block |
||
2379 | 2379 | $return_value = false; |
2380 | 2380 | $sql = "SELECT c_id FROM $tbl_session_course |
2381 | 2381 | WHERE |
2382 | - session_id = " . intval($session_id) . " AND |
|
2383 | - c_id = " . intval($courseId) . ""; |
|
2382 | + session_id = ".intval($session_id)." AND |
|
2383 | + c_id = " . intval($courseId).""; |
|
2384 | 2384 | $result = Database::query($sql); |
2385 | 2385 | $num = Database::num_rows($result); |
2386 | 2386 | if ($num > 0) { |
@@ -2403,8 +2403,8 @@ discard block |
||
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | $sql = 'SELECT * |
2406 | - FROM ' . $tbl_session . ' |
|
2407 | - WHERE name = "' . Database::escape_string($session_name) . '"'; |
|
2406 | + FROM ' . $tbl_session.' |
|
2407 | + WHERE name = "' . Database::escape_string($session_name).'"'; |
|
2408 | 2408 | $result = Database::query($sql); |
2409 | 2409 | $num = Database::num_rows($result); |
2410 | 2410 | if ($num > 0) { |
@@ -2444,8 +2444,8 @@ discard block |
||
2444 | 2444 | $month_end = intval($smonth_end); |
2445 | 2445 | $day_end = intval($sday_end); |
2446 | 2446 | |
2447 | - $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start); |
|
2448 | - $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end); |
|
2447 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start); |
|
2448 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end); |
|
2449 | 2449 | |
2450 | 2450 | if (empty($name)) { |
2451 | 2451 | $msg = get_lang('SessionCategoryNameIsRequired'); |
@@ -2517,8 +2517,8 @@ discard block |
||
2517 | 2517 | $month_end = intval($smonth_end); |
2518 | 2518 | $day_end = intval($sday_end); |
2519 | 2519 | $id = intval($id); |
2520 | - $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start); |
|
2521 | - $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end); |
|
2520 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start); |
|
2521 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end); |
|
2522 | 2522 | |
2523 | 2523 | if (empty($name)) { |
2524 | 2524 | $msg = get_lang('SessionCategoryNameIsRequired'); |
@@ -2538,13 +2538,13 @@ discard block |
||
2538 | 2538 | if ($date_end <> null) { |
2539 | 2539 | $sql = "UPDATE $tbl_session_category |
2540 | 2540 | SET |
2541 | - name = '" . Database::escape_string($name) . "', |
|
2541 | + name = '".Database::escape_string($name)."', |
|
2542 | 2542 | date_start = '$date_start' , |
2543 | 2543 | date_end = '$date_end' |
2544 | 2544 | WHERE id= $id"; |
2545 | 2545 | } else { |
2546 | 2546 | $sql = "UPDATE $tbl_session_category SET |
2547 | - name = '" . Database::escape_string($name) . "', |
|
2547 | + name = '".Database::escape_string($name)."', |
|
2548 | 2548 | date_start = '$date_start', |
2549 | 2549 | date_end = NULL |
2550 | 2550 | WHERE id= $id"; |
@@ -2574,10 +2574,10 @@ discard block |
||
2574 | 2574 | |
2575 | 2575 | //Setting session_category_id to 0 |
2576 | 2576 | $sql = "UPDATE $tbl_session SET session_category_id = 0 |
2577 | - WHERE session_category_id IN (" . $id_checked . ")"; |
|
2577 | + WHERE session_category_id IN (".$id_checked.")"; |
|
2578 | 2578 | Database::query($sql); |
2579 | 2579 | |
2580 | - $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")"; |
|
2580 | + $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")"; |
|
2581 | 2581 | $result = Database::query($sql); |
2582 | 2582 | while ($rows = Database::fetch_array($result)) { |
2583 | 2583 | $session_id = $rows['id']; |
@@ -2589,7 +2589,7 @@ discard block |
||
2589 | 2589 | } |
2590 | 2590 | } |
2591 | 2591 | } |
2592 | - $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")"; |
|
2592 | + $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")"; |
|
2593 | 2593 | Database::query($sql); |
2594 | 2594 | |
2595 | 2595 | // Add event to system log |
@@ -2662,7 +2662,7 @@ discard block |
||
2662 | 2662 | $value = Database::escape_string($options['value']); |
2663 | 2663 | $sql_query .= ' AND '; |
2664 | 2664 | if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) { |
2665 | - $sql_query .= $field . " $operator '" . $value . "'"; |
|
2665 | + $sql_query .= $field." $operator '".$value."'"; |
|
2666 | 2666 | } |
2667 | 2667 | } |
2668 | 2668 | } |
@@ -2729,8 +2729,8 @@ discard block |
||
2729 | 2729 | { |
2730 | 2730 | $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); |
2731 | 2731 | $id = api_get_current_access_url_id(); |
2732 | - $sql = 'SELECT * FROM ' . $tbl_session_category . ' |
|
2733 | - WHERE access_url_id = ' . $id . ' |
|
2732 | + $sql = 'SELECT * FROM '.$tbl_session_category.' |
|
2733 | + WHERE access_url_id = ' . $id.' |
|
2734 | 2734 | ORDER BY name ASC'; |
2735 | 2735 | $result = Database::query($sql); |
2736 | 2736 | if (Database::num_rows($result) > 0) { |
@@ -2909,11 +2909,11 @@ discard block |
||
2909 | 2909 | INNER JOIN $tbl_session_rel_access_url a ON (a.session_id = s.session_id) |
2910 | 2910 | WHERE |
2911 | 2911 | s.user_id = $userId AND |
2912 | - relation_type=" . SESSION_RELATION_TYPE_RRHH . " AND |
|
2913 | - access_url_id = " . api_get_current_access_url_id() . ""; |
|
2912 | + relation_type=".SESSION_RELATION_TYPE_RRHH." AND |
|
2913 | + access_url_id = " . api_get_current_access_url_id().""; |
|
2914 | 2914 | } else { |
2915 | 2915 | $sql = "SELECT session_id FROM $tbl_session_rel_user s |
2916 | - WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH . ""; |
|
2916 | + WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH.""; |
|
2917 | 2917 | } |
2918 | 2918 | $result = Database::query($sql); |
2919 | 2919 | |
@@ -2923,7 +2923,7 @@ discard block |
||
2923 | 2923 | WHERE |
2924 | 2924 | session_id = {$row['session_id']} AND |
2925 | 2925 | user_id = $userId AND |
2926 | - relation_type=" . SESSION_RELATION_TYPE_RRHH . " "; |
|
2926 | + relation_type=".SESSION_RELATION_TYPE_RRHH." "; |
|
2927 | 2927 | Database::query($sql); |
2928 | 2928 | } |
2929 | 2929 | } |
@@ -2937,8 +2937,8 @@ discard block |
||
2937 | 2937 | VALUES ( |
2938 | 2938 | $session_id, |
2939 | 2939 | $userId, |
2940 | - '" . SESSION_RELATION_TYPE_RRHH . "', |
|
2941 | - '" . api_get_utc_datetime() . "' |
|
2940 | + '".SESSION_RELATION_TYPE_RRHH."', |
|
2941 | + '" . api_get_utc_datetime()."' |
|
2942 | 2942 | )"; |
2943 | 2943 | |
2944 | 2944 | Database::query($sql); |
@@ -2980,8 +2980,8 @@ discard block |
||
2980 | 2980 | WHERE |
2981 | 2981 | sru.user_id = '$userId' AND |
2982 | 2982 | sru.session_id = '$sessionId' AND |
2983 | - sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND |
|
2984 | - access_url_id = " . api_get_current_access_url_id() . " |
|
2983 | + sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND |
|
2984 | + access_url_id = " . api_get_current_access_url_id()." |
|
2985 | 2985 | "; |
2986 | 2986 | } else { |
2987 | 2987 | $sql = "$select FROM $tbl_session s |
@@ -2990,7 +2990,7 @@ discard block |
||
2990 | 2990 | sru.session_id = s.id AND |
2991 | 2991 | sru.user_id = '$userId' AND |
2992 | 2992 | sru.session_id = '$sessionId' AND |
2993 | - sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' |
|
2993 | + sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' |
|
2994 | 2994 | "; |
2995 | 2995 | } |
2996 | 2996 | |
@@ -3088,7 +3088,7 @@ discard block |
||
3088 | 3088 | |
3089 | 3089 | $limitCondition = null; |
3090 | 3090 | if (!empty($start) && !empty($limit)) { |
3091 | - $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit); |
|
3091 | + $limitCondition = " LIMIT ".intval($start).", ".intval($limit); |
|
3092 | 3092 | } |
3093 | 3093 | |
3094 | 3094 | if (empty($orderCondition)) { |
@@ -3166,26 +3166,26 @@ discard block |
||
3166 | 3166 | |
3167 | 3167 | $sessions = array(); |
3168 | 3168 | if (Database::num_rows($result) > 0) { |
3169 | - $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/'; |
|
3170 | - $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/'; |
|
3169 | + $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/'; |
|
3170 | + $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/'; |
|
3171 | 3171 | $imgPath = Display::returnIconPath('session_default_small.png'); |
3172 | 3172 | |
3173 | 3173 | $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD); |
3174 | - $sql = "SELECT id FROM " . $tableExtraFields . " |
|
3174 | + $sql = "SELECT id FROM ".$tableExtraFields." |
|
3175 | 3175 | WHERE extra_field_type = 3 AND variable='image'"; |
3176 | 3176 | $resultField = Database::query($sql); |
3177 | 3177 | $imageFieldId = Database::fetch_assoc($resultField); |
3178 | 3178 | |
3179 | 3179 | while ($row = Database::fetch_array($result)) { |
3180 | 3180 | |
3181 | - $row['image'] = null; |
|
3182 | - $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png'; |
|
3181 | + $row['image'] = null; |
|
3182 | + $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png'; |
|
3183 | 3183 | |
3184 | 3184 | if (is_file($sessionImage)) { |
3185 | - $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png'; |
|
3185 | + $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png'; |
|
3186 | 3186 | $row['image'] = $sessionImage; |
3187 | 3187 | } else { |
3188 | - $row['image'] = $imgPath; |
|
3188 | + $row['image'] = $imgPath; |
|
3189 | 3189 | } |
3190 | 3190 | |
3191 | 3191 | $sessions[$row['id']] = $row; |
@@ -3255,7 +3255,7 @@ discard block |
||
3255 | 3255 | return intval($count[0]); |
3256 | 3256 | } |
3257 | 3257 | |
3258 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
3258 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
3259 | 3259 | $courses[$row['real_id']] = $row; |
3260 | 3260 | } |
3261 | 3261 | } |
@@ -3299,7 +3299,7 @@ discard block |
||
3299 | 3299 | } |
3300 | 3300 | |
3301 | 3301 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
3302 | - $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
3302 | + $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
3303 | 3303 | |
3304 | 3304 | if ($getCount) { |
3305 | 3305 | $select = "SELECT COUNT(DISTINCT(c.code)) as count "; |
@@ -3324,7 +3324,7 @@ discard block |
||
3324 | 3324 | "; |
3325 | 3325 | if ($getCount) { |
3326 | 3326 | $result = Database::query($sql); |
3327 | - $row = Database::fetch_array($result,'ASSOC'); |
|
3327 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
3328 | 3328 | return $row['count']; |
3329 | 3329 | } |
3330 | 3330 | |
@@ -3339,7 +3339,7 @@ discard block |
||
3339 | 3339 | $courses = array(); |
3340 | 3340 | |
3341 | 3341 | if ($num_rows > 0) { |
3342 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
3342 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
3343 | 3343 | $courses[$row['id']] = $row; |
3344 | 3344 | } |
3345 | 3345 | } |
@@ -3417,7 +3417,7 @@ discard block |
||
3417 | 3417 | $result = Database::query($sql); |
3418 | 3418 | $num_rows = Database::num_rows($result); |
3419 | 3419 | if ($num_rows > 0) { |
3420 | - $row = Database::fetch_array($result,'ASSOC'); |
|
3420 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
3421 | 3421 | return $row['count']; |
3422 | 3422 | } |
3423 | 3423 | |
@@ -3529,9 +3529,9 @@ discard block |
||
3529 | 3529 | |
3530 | 3530 | if ($access_url_id != -1) { |
3531 | 3531 | $sql = 'SELECT DISTINCT session.* |
3532 | - FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url |
|
3532 | + FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
|
3533 | 3533 | ON (session.id = session_rel_url.session_id) |
3534 | - WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id; |
|
3534 | + WHERE '.$sqlCoach.' access_url_id = '.$access_url_id; |
|
3535 | 3535 | } |
3536 | 3536 | } |
3537 | 3537 | $sql .= ' ORDER by name'; |
@@ -3565,8 +3565,8 @@ discard block |
||
3565 | 3565 | FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user |
3566 | 3566 | WHERE |
3567 | 3567 | session_rcru.user_id = user.user_id AND |
3568 | - session_rcru.session_id = '" . intval($session_id) . "' AND |
|
3569 | - session_rcru.c_id ='" . intval($courseId) . "' AND |
|
3568 | + session_rcru.session_id = '".intval($session_id)."' AND |
|
3569 | + session_rcru.c_id ='" . intval($courseId)."' AND |
|
3570 | 3570 | user.user_id = " . intval($user_id); |
3571 | 3571 | |
3572 | 3572 | $result = Database::query($sql); |
@@ -3597,8 +3597,8 @@ discard block |
||
3597 | 3597 | $sql = "SELECT session_rcru.status |
3598 | 3598 | FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user |
3599 | 3599 | WHERE session_rcru.user_id = user.user_id AND |
3600 | - session_rcru.session_id = '" . intval($session_id) . "' AND |
|
3601 | - session_rcru.c_id ='" . intval($courseId) . "' AND |
|
3600 | + session_rcru.session_id = '".intval($session_id)."' AND |
|
3601 | + session_rcru.c_id ='" . intval($courseId)."' AND |
|
3602 | 3602 | user.user_id = " . intval($user_id); |
3603 | 3603 | $result = Database::query($sql); |
3604 | 3604 | $status = false; |
@@ -3675,7 +3675,7 @@ discard block |
||
3675 | 3675 | // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251 |
3676 | 3676 | $now = time() - date('Z'); |
3677 | 3677 | // Timestamp in one month |
3678 | - $inOneMonth = $now + (30*24*3600); |
|
3678 | + $inOneMonth = $now + (30 * 24 * 3600); |
|
3679 | 3679 | $inOneMonth = api_get_local_time($inOneMonth); |
3680 | 3680 | if (api_strtotime($s['access_start_date']) < $now) { |
3681 | 3681 | $s['access_start_date'] = api_get_local_time($now); |
@@ -3697,16 +3697,16 @@ discard block |
||
3697 | 3697 | } |
3698 | 3698 | // Now try to create the session |
3699 | 3699 | $sid = self::create_session( |
3700 | - $s['name'] . ' ' . get_lang('CopyLabelSuffix'), |
|
3700 | + $s['name'].' '.get_lang('CopyLabelSuffix'), |
|
3701 | 3701 | $s['access_start_date'], |
3702 | 3702 | $s['access_end_date'], |
3703 | 3703 | $s['display_start_date'], |
3704 | 3704 | $s['display_end_date'], |
3705 | 3705 | $s['coach_access_start_date'], |
3706 | 3706 | $s['coach_access_end_date'], |
3707 | - (int)$s['id_coach'], |
|
3707 | + (int) $s['id_coach'], |
|
3708 | 3708 | $s['session_category_id'], |
3709 | - (int)$s['visibility'], |
|
3709 | + (int) $s['visibility'], |
|
3710 | 3710 | true |
3711 | 3711 | ); |
3712 | 3712 | |
@@ -3820,7 +3820,7 @@ discard block |
||
3820 | 3820 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
3821 | 3821 | $sql = "SELECT DISTINCT id |
3822 | 3822 | FROM $session_table |
3823 | - WHERE session.id_coach = '" . $user_id . "' AND id = '$session_id'"; |
|
3823 | + WHERE session.id_coach = '".$user_id."' AND id = '$session_id'"; |
|
3824 | 3824 | $result = Database::query($sql); |
3825 | 3825 | if ($result && Database::num_rows($result)) { |
3826 | 3826 | return true; |
@@ -3839,7 +3839,7 @@ discard block |
||
3839 | 3839 | $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
3840 | 3840 | $sql = "SELECT count(id) FROM $session_table s"; |
3841 | 3841 | if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) { |
3842 | - $sql .= ", $access_url_rel_session_table u " . |
|
3842 | + $sql .= ", $access_url_rel_session_table u ". |
|
3843 | 3843 | " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id"; |
3844 | 3844 | } |
3845 | 3845 | $res = Database::query($sql); |
@@ -4090,7 +4090,7 @@ discard block |
||
4090 | 4090 | |
4091 | 4091 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
4092 | 4092 | $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); |
4093 | - $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
4093 | + $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
4094 | 4094 | $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
4095 | 4095 | |
4096 | 4096 | $sessions = array(); |
@@ -4184,10 +4184,10 @@ discard block |
||
4184 | 4184 | $suffix = null; |
4185 | 4185 | while (!$unique_name) { |
4186 | 4186 | if ($i > 1) { |
4187 | - $suffix = ' - ' . $i; |
|
4187 | + $suffix = ' - '.$i; |
|
4188 | 4188 | } |
4189 | - $sql = 'SELECT 1 FROM ' . $tbl_session . ' |
|
4190 | - WHERE name="' . $session_name . $suffix . '"'; |
|
4189 | + $sql = 'SELECT 1 FROM '.$tbl_session.' |
|
4190 | + WHERE name="' . $session_name.$suffix.'"'; |
|
4191 | 4191 | $rs = Database::query($sql); |
4192 | 4192 | |
4193 | 4193 | if (Database::result($rs, 0, 0)) { |
@@ -4205,13 +4205,13 @@ discard block |
||
4205 | 4205 | |
4206 | 4206 | // Creating the session. |
4207 | 4207 | $sql = "INSERT IGNORE INTO $tbl_session SET |
4208 | - name = '" . $session_name . "', |
|
4208 | + name = '".$session_name."', |
|
4209 | 4209 | id_coach = '$coach_id', |
4210 | 4210 | access_start_date = '$date_start', |
4211 | 4211 | access_end_date = '$date_end', |
4212 | 4212 | visibility = '$visibilityAfterExpirationPerSession', |
4213 | 4213 | $sessionCondition |
4214 | - session_admin_id = " . intval($defaultUserId) . $extraParameters . $extraSessionParameters; |
|
4214 | + session_admin_id = ".intval($defaultUserId).$extraParameters.$extraSessionParameters; |
|
4215 | 4215 | Database::query($sql); |
4216 | 4216 | |
4217 | 4217 | $session_id = Database::insert_id(); |
@@ -4251,7 +4251,7 @@ discard block |
||
4251 | 4251 | access_start_date = '$date_start', |
4252 | 4252 | access_end_date = '$date_end', |
4253 | 4253 | visibility = '$visibilityAfterExpirationPerSession', |
4254 | - session_category_id = '$session_category_id' " . $extraParameters . $extraSessionParameters; |
|
4254 | + session_category_id = '$session_category_id' ".$extraParameters.$extraSessionParameters; |
|
4255 | 4255 | |
4256 | 4256 | Database::query($sql); |
4257 | 4257 | |
@@ -4271,7 +4271,7 @@ discard block |
||
4271 | 4271 | |
4272 | 4272 | // Delete session-user relation only for students |
4273 | 4273 | $sql = "DELETE FROM $tbl_session_user |
4274 | - WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH; |
|
4274 | + WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH; |
|
4275 | 4275 | Database::query($sql); |
4276 | 4276 | |
4277 | 4277 | $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'"; |
@@ -4359,7 +4359,7 @@ discard block |
||
4359 | 4359 | |
4360 | 4360 | // Delete session-user relation only for students |
4361 | 4361 | $sql = "DELETE FROM $tbl_session_user |
4362 | - WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH; |
|
4362 | + WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH; |
|
4363 | 4363 | Database::query($sql); |
4364 | 4364 | |
4365 | 4365 | $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'"; |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | $sql = "INSERT IGNORE INTO $tbl_session_user SET |
4403 | 4403 | user_id = '$user_id', |
4404 | 4404 | session_id = '$session_id', |
4405 | - registered_at = '" . api_get_utc_datetime() . "'"; |
|
4405 | + registered_at = '".api_get_utc_datetime()."'"; |
|
4406 | 4406 | Database::query($sql); |
4407 | 4407 | if ($debug) { |
4408 | 4408 | $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id"); |
@@ -5040,7 +5040,7 @@ discard block |
||
5040 | 5040 | |
5041 | 5041 | if (!empty($lastConnectionDate)) { |
5042 | 5042 | $lastConnectionDate = Database::escape_string($lastConnectionDate); |
5043 | - $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
5043 | + $userConditions .= " AND u.last_login <= '$lastConnectionDate' "; |
|
5044 | 5044 | } |
5045 | 5045 | |
5046 | 5046 | if (!empty($keyword)) { |
@@ -5099,7 +5099,7 @@ discard block |
||
5099 | 5099 | $result = Database::query($sql); |
5100 | 5100 | $result = Database::store_result($result); |
5101 | 5101 | |
5102 | - return $result ; |
|
5102 | + return $result; |
|
5103 | 5103 | } |
5104 | 5104 | |
5105 | 5105 | /** |
@@ -5159,7 +5159,7 @@ discard block |
||
5159 | 5159 | $userToString = null; |
5160 | 5160 | foreach ($userList as $userInfo) { |
5161 | 5161 | $newUserList[] = $userInfo['user_id']; |
5162 | - $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />'; |
|
5162 | + $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />'; |
|
5163 | 5163 | } |
5164 | 5164 | |
5165 | 5165 | if (!empty($sessionsDestination)) { |
@@ -5172,7 +5172,7 @@ discard block |
||
5172 | 5172 | $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false); |
5173 | 5173 | continue; |
5174 | 5174 | } |
5175 | - $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false); |
|
5175 | + $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false); |
|
5176 | 5176 | SessionManager::suscribe_users_to_session( |
5177 | 5177 | $sessionDestinationId, |
5178 | 5178 | $newUserList, |
@@ -5223,7 +5223,7 @@ discard block |
||
5223 | 5223 | } |
5224 | 5224 | } |
5225 | 5225 | } |
5226 | - $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session='; |
|
5226 | + $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session='; |
|
5227 | 5227 | |
5228 | 5228 | $htmlResult = null; |
5229 | 5229 | |
@@ -5238,7 +5238,7 @@ discard block |
||
5238 | 5238 | $sessionInfo = self::fetch($sessionId); |
5239 | 5239 | $htmlResult .= '<br />'; |
5240 | 5240 | $htmlResult .= Display::url( |
5241 | - get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank') |
|
5241 | + get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank') |
|
5242 | 5242 | ); |
5243 | 5243 | $teacherList = array(); |
5244 | 5244 | foreach ($coachList as $coachId) { |
@@ -5351,7 +5351,7 @@ discard block |
||
5351 | 5351 | } |
5352 | 5352 | |
5353 | 5353 | $sessionIdList = array_map('intval', $sessionIdList); |
5354 | - $sessionToString = implode("', '", $sessionIdList); |
|
5354 | + $sessionToString = implode("', '", $sessionIdList); |
|
5355 | 5355 | |
5356 | 5356 | $course = Database::get_main_table(TABLE_MAIN_COURSE); |
5357 | 5357 | $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
@@ -5363,7 +5363,7 @@ discard block |
||
5363 | 5363 | INNER JOIN $courseUser cu ON (cu.c_id = c.id) |
5364 | 5364 | WHERE src.session_id IN ('$sessionToString') AND cu.status = 1"; |
5365 | 5365 | $result = Database::query($sql); |
5366 | - while($row = Database::fetch_array($result, 'ASSOC')) { |
|
5366 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
5367 | 5367 | $teacherListId[$row['user_id']] = $row['user_id']; |
5368 | 5368 | } |
5369 | 5369 | } else { |
@@ -5438,7 +5438,7 @@ discard block |
||
5438 | 5438 | $toolList = self::getCourseToolToBeManaged(); |
5439 | 5439 | |
5440 | 5440 | foreach ($toolList as $tool) { |
5441 | - $method = 'add' . $tool; |
|
5441 | + $method = 'add'.$tool; |
|
5442 | 5442 | if (method_exists(get_class(), $method)) { |
5443 | 5443 | self::$method($sessionId, $courseId); |
5444 | 5444 | } |
@@ -5457,7 +5457,7 @@ discard block |
||
5457 | 5457 | $toolList = self::getCourseToolToBeManaged(); |
5458 | 5458 | |
5459 | 5459 | foreach ($toolList as $tool) { |
5460 | - $method = 'remove' . $tool; |
|
5460 | + $method = 'remove'.$tool; |
|
5461 | 5461 | if (method_exists(get_class(), $method)) { |
5462 | 5462 | self::$method($sessionId, $courseId); |
5463 | 5463 | } |
@@ -5575,18 +5575,18 @@ discard block |
||
5575 | 5575 | } |
5576 | 5576 | } |
5577 | 5577 | |
5578 | - $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />'; |
|
5578 | + $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />'; |
|
5579 | 5579 | |
5580 | 5580 | if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) { |
5581 | - $message .= get_lang('UserMustHaveTheDrhRole') . '<br />'; |
|
5581 | + $message .= get_lang('UserMustHaveTheDrhRole').'<br />'; |
|
5582 | 5582 | continue; |
5583 | 5583 | } |
5584 | 5584 | |
5585 | 5585 | if (!empty($sessionList)) { |
5586 | - $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />'; |
|
5587 | - $message .= implode(', ', $sessionList) . '<br /><br />'; |
|
5586 | + $message .= '<strong>'.get_lang('Sessions').':</strong> <br />'; |
|
5587 | + $message .= implode(', ', $sessionList).'<br /><br />'; |
|
5588 | 5588 | } else { |
5589 | - $message .= get_lang('NoSessionProvided') . ' <br /><br />'; |
|
5589 | + $message .= get_lang('NoSessionProvided').' <br /><br />'; |
|
5590 | 5590 | } |
5591 | 5591 | } |
5592 | 5592 | } |
@@ -5766,8 +5766,8 @@ discard block |
||
5766 | 5766 | |
5767 | 5767 | $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC'); |
5768 | 5768 | |
5769 | - $endDateInSeconds = $firstAccess + $duration*24*60*60; |
|
5770 | - $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24); |
|
5769 | + $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60; |
|
5770 | + $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24); |
|
5771 | 5771 | |
5772 | 5772 | return $leftDays; |
5773 | 5773 | } |
@@ -6049,7 +6049,7 @@ discard block |
||
6049 | 6049 | $sql = "SELECT COUNT(1) as count, u.id, scu.status status_in_session, u.status user_status |
6050 | 6050 | FROM $tableSessionRelCourseRelUser scu |
6051 | 6051 | INNER JOIN $tableUser u ON scu.user_id = u.id |
6052 | - WHERE scu.session_id = " . intval($sessionId) ." |
|
6052 | + WHERE scu.session_id = ".intval($sessionId)." |
|
6053 | 6053 | GROUP BY u.id"; |
6054 | 6054 | |
6055 | 6055 | $result = Database::query($sql); |
@@ -6084,7 +6084,7 @@ discard block |
||
6084 | 6084 | $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD); |
6085 | 6085 | $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
6086 | 6086 | // Join session field and session field values tables |
6087 | - $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id'; |
|
6087 | + $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id'; |
|
6088 | 6088 | $fieldsArray = array(); |
6089 | 6089 | foreach ($extraFields as $field) { |
6090 | 6090 | $fieldsArray[] = Database::escape_string($field); |
@@ -6127,14 +6127,14 @@ discard block |
||
6127 | 6127 | for ($i = 1; $i < count($fieldsArray); $i++) { |
6128 | 6128 | $whereParams .= ', ?'; |
6129 | 6129 | } |
6130 | - $whereFieldVariables = ' variable IN ( ' . $whereParams .' )'; |
|
6131 | - $whereFieldIds = 'field_id IN ( ' . $whereParams . ' )'; |
|
6130 | + $whereFieldVariables = ' variable IN ( '.$whereParams.' )'; |
|
6131 | + $whereFieldIds = 'field_id IN ( '.$whereParams.' )'; |
|
6132 | 6132 | } |
6133 | 6133 | // Get session fields |
6134 | 6134 | $extraField = new ExtraField('session'); |
6135 | 6135 | $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2); |
6136 | 6136 | $fieldsList = $extraField->get_all(array( |
6137 | - ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray, |
|
6137 | + ' variable IN ( '.$questionMarks.' )' => $fieldsArray, |
|
6138 | 6138 | )); |
6139 | 6139 | // Index session fields |
6140 | 6140 | foreach ($fieldsList as $field) { |
@@ -6143,7 +6143,7 @@ discard block |
||
6143 | 6143 | // Get session field values |
6144 | 6144 | $extra = new ExtraFieldValue('session'); |
6145 | 6145 | $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2); |
6146 | - $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields)))); |
|
6146 | + $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields)))); |
|
6147 | 6147 | // Add session fields values to session list |
6148 | 6148 | foreach ($sessionList as $id => &$session) { |
6149 | 6149 | foreach ($sessionFieldValueList as $sessionFieldValue) { |
@@ -6196,7 +6196,7 @@ discard block |
||
6196 | 6196 | // Check the result |
6197 | 6197 | if ($result < 1) { |
6198 | 6198 | // If not found any result, update error message |
6199 | - $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName; |
|
6199 | + $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName; |
|
6200 | 6200 | } elseif (count($result) > 1 && !$force) { |
6201 | 6201 | // If found more than one result and force is disabled, update error message |
6202 | 6202 | $errorResult['errorMessage'] = 'Found many session categories'; |
@@ -6255,7 +6255,7 @@ discard block |
||
6255 | 6255 | // Check if session list query had result |
6256 | 6256 | if (!empty($sessionList)) { |
6257 | 6257 | // implode all session id |
6258 | - $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')'; |
|
6258 | + $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')'; |
|
6259 | 6259 | // Get all field variables |
6260 | 6260 | $sessionFieldList = Database::select( |
6261 | 6261 | 'id, variable', |
@@ -6342,7 +6342,7 @@ discard block |
||
6342 | 6342 | return $sessionList; |
6343 | 6343 | } else { |
6344 | 6344 | // Not found result, update error message |
6345 | - $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId; |
|
6345 | + $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId; |
|
6346 | 6346 | } |
6347 | 6347 | } |
6348 | 6348 | |
@@ -6446,7 +6446,7 @@ discard block |
||
6446 | 6446 | |
6447 | 6447 | $sessionExtraField = new ExtraField('session'); |
6448 | 6448 | $fieldList = $sessionExtraField->get_all(array( |
6449 | - "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables, |
|
6449 | + "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables, |
|
6450 | 6450 | )); |
6451 | 6451 | |
6452 | 6452 | $fields = array(); |
@@ -6460,7 +6460,7 @@ discard block |
||
6460 | 6460 | $extra = new ExtraFieldValue('session'); |
6461 | 6461 | $sessionFieldValueList = $extra->get_all( |
6462 | 6462 | array( |
6463 | - "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields), |
|
6463 | + "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields), |
|
6464 | 6464 | ) |
6465 | 6465 | ); |
6466 | 6466 | |
@@ -6531,7 +6531,7 @@ discard block |
||
6531 | 6531 | FROM $sessionTable s |
6532 | 6532 | INNER JOIN $sessionUserTable sru ON s.id = sru.id_session |
6533 | 6533 | WHERE |
6534 | - (sru.id_user IN (" . implode(', ', $userIdList) . ") |
|
6534 | + (sru.id_user IN (".implode(', ', $userIdList).") |
|
6535 | 6535 | AND sru.relation_type = 0 |
6536 | 6536 | )"; |
6537 | 6537 | |
@@ -6547,7 +6547,7 @@ discard block |
||
6547 | 6547 | WHERE |
6548 | 6548 | srau.access_url_id = $accessUrlId |
6549 | 6549 | AND ( |
6550 | - sru.id_user IN (" . implode(', ', $userIdList) . ") |
|
6550 | + sru.id_user IN (".implode(', ', $userIdList).") |
|
6551 | 6551 | AND sru.relation_type = 0 |
6552 | 6552 | )"; |
6553 | 6553 | } |
@@ -6568,7 +6568,7 @@ discard block |
||
6568 | 6568 | */ |
6569 | 6569 | public static function getSessionVisibility($sessionInfo) |
6570 | 6570 | { |
6571 | - switch($sessionInfo['visibility']) { |
|
6571 | + switch ($sessionInfo['visibility']) { |
|
6572 | 6572 | case 1: |
6573 | 6573 | return get_lang('ReadOnly'); |
6574 | 6574 | case 2: |
@@ -6599,7 +6599,7 @@ discard block |
||
6599 | 6599 | |
6600 | 6600 | $result = ''; |
6601 | 6601 | if (!empty($startDateToLocal) && !empty($endDateToLocal)) { |
6602 | - $result = sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal); |
|
6602 | + $result = sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal); |
|
6603 | 6603 | } else { |
6604 | 6604 | if (!empty($startDateToLocal)) { |
6605 | 6605 | $result = get_lang('From').' '.$startDateToLocal; |
@@ -6742,7 +6742,7 @@ discard block |
||
6742 | 6742 | get_lang('CoachName'), |
6743 | 6743 | null, |
6744 | 6744 | [ |
6745 | - 'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach', |
|
6745 | + 'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach', |
|
6746 | 6746 | 'width' => '100%', |
6747 | 6747 | ] |
6748 | 6748 | ); |
@@ -6753,7 +6753,7 @@ discard block |
||
6753 | 6753 | $form->addHtml('<div id="ajax_list_coachs"></div>'); |
6754 | 6754 | |
6755 | 6755 | $form->addButtonAdvancedSettings('advanced_params'); |
6756 | - $form->addElement('html','<div id="advanced_params_options" style="display:none">'); |
|
6756 | + $form->addElement('html', '<div id="advanced_params_options" style="display:none">'); |
|
6757 | 6757 | |
6758 | 6758 | $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array( |
6759 | 6759 | 'id' => 'session_category' |
@@ -6891,7 +6891,7 @@ discard block |
||
6891 | 6891 | $extra_field = new ExtraField('session'); |
6892 | 6892 | $extra = $extra_field->addElements($form, $sessionId); |
6893 | 6893 | |
6894 | - $form->addElement('html','</div>'); |
|
6894 | + $form->addElement('html', '</div>'); |
|
6895 | 6895 | |
6896 | 6896 | $js = $extra['jquery_ready_content']; |
6897 | 6897 | |
@@ -6922,16 +6922,16 @@ discard block |
||
6922 | 6922 | if (api_is_session_admin() && |
6923 | 6923 | api_get_setting('allow_session_admins_to_see_all_sessions') == 'false' |
6924 | 6924 | ) { |
6925 | - $where.=" WHERE s.session_admin_id = $user_id "; |
|
6925 | + $where .= " WHERE s.session_admin_id = $user_id "; |
|
6926 | 6926 | } |
6927 | 6927 | |
6928 | 6928 | if (!empty($options['where'])) { |
6929 | 6929 | $options['where'] = str_replace('course_title', 'c.title', $options['where']); |
6930 | - $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']); |
|
6930 | + $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']); |
|
6931 | 6931 | |
6932 | 6932 | $options['where'] = str_replace( |
6933 | 6933 | array("AND session_active = '1' )", " AND ( session_active = '1' )"), |
6934 | - array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " ) |
|
6934 | + array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ") |
|
6935 | 6935 | , $options['where'] |
6936 | 6936 | ); |
6937 | 6937 | |
@@ -6973,10 +6973,10 @@ discard block |
||
6973 | 6973 | $where "; |
6974 | 6974 | |
6975 | 6975 | if (api_is_multiple_url_enabled()) { |
6976 | - $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
6976 | + $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
6977 | 6977 | $access_url_id = api_get_current_access_url_id(); |
6978 | 6978 | if ($access_url_id != -1) { |
6979 | - $where.= " AND ar.access_url_id = $access_url_id "; |
|
6979 | + $where .= " AND ar.access_url_id = $access_url_id "; |
|
6980 | 6980 | |
6981 | 6981 | $query_rows = "SELECT count(*) as total_rows |
6982 | 6982 | FROM $tbl_session s |
@@ -7021,12 +7021,12 @@ discard block |
||
7021 | 7021 | //get_lang('CourseTitle'), |
7022 | 7022 | get_lang('Visibility'), |
7023 | 7023 | ); |
7024 | - $column_model = array ( |
|
7025 | - array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7026 | - array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7027 | - array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), |
|
7028 | - array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), |
|
7029 | - array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
7024 | + $column_model = array( |
|
7025 | + array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7026 | + array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7027 | + array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), |
|
7028 | + array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), |
|
7029 | + array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
7030 | 7030 | ); |
7031 | 7031 | break; |
7032 | 7032 | case 'complete': |
@@ -7039,12 +7039,12 @@ discard block |
||
7039 | 7039 | get_lang('Visibility'), |
7040 | 7040 | get_lang('CourseTitle'), |
7041 | 7041 | ); |
7042 | - $column_model = array ( |
|
7043 | - array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7044 | - array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), |
|
7045 | - array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), |
|
7046 | - array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)), |
|
7047 | - array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select', |
|
7042 | + $column_model = array( |
|
7043 | + array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)), |
|
7044 | + array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)), |
|
7045 | + array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)), |
|
7046 | + array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)), |
|
7047 | + array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select', |
|
7048 | 7048 | // for the bottom bar |
7049 | 7049 | 'searchoptions' => array( |
7050 | 7050 | 'defaultValue' => '1', |
@@ -7052,8 +7052,8 @@ discard block |
||
7052 | 7052 | // for the top bar |
7053 | 7053 | 'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')), |
7054 | 7054 | ), |
7055 | - array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
7056 | - array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)), |
|
7055 | + array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'), |
|
7056 | + array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)), |
|
7057 | 7057 | ); |
7058 | 7058 | break; |
7059 | 7059 | } |
@@ -7062,14 +7062,14 @@ discard block |
||
7062 | 7062 | $session_field = new ExtraField('session'); |
7063 | 7063 | $rules = $session_field->getRules($columns, $column_model); |
7064 | 7064 | |
7065 | - $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false'); |
|
7065 | + $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false'); |
|
7066 | 7066 | $columns[] = get_lang('Actions'); |
7067 | 7067 | |
7068 | 7068 | foreach ($column_model as $col_model) { |
7069 | 7069 | $simple_column_name[] = $col_model['name']; |
7070 | 7070 | } |
7071 | 7071 | |
7072 | - $return_array = array( |
|
7072 | + $return_array = array( |
|
7073 | 7073 | 'columns' => $columns, |
7074 | 7074 | 'column_model' => $column_model, |
7075 | 7075 | 'rules' => $rules, |
@@ -7158,7 +7158,7 @@ discard block |
||
7158 | 7158 | if (api_is_session_admin() && |
7159 | 7159 | api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false' |
7160 | 7160 | ) { |
7161 | - $where.=" AND s.session_admin_id = $user_id "; |
|
7161 | + $where .= " AND s.session_admin_id = $user_id "; |
|
7162 | 7162 | } |
7163 | 7163 | } |
7164 | 7164 | |
@@ -7241,11 +7241,11 @@ discard block |
||
7241 | 7241 | } |
7242 | 7242 | $options['where'] = str_replace('course_title', 'c.title', $options['where']); |
7243 | 7243 | |
7244 | - $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']); |
|
7244 | + $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']); |
|
7245 | 7245 | |
7246 | 7246 | $options['where'] = str_replace( |
7247 | 7247 | array("AND session_active = '1' )", " AND ( session_active = '1' )"), |
7248 | - array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " ) |
|
7248 | + array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ") |
|
7249 | 7249 | , $options['where'] |
7250 | 7250 | ); |
7251 | 7251 | |
@@ -7280,10 +7280,10 @@ discard block |
||
7280 | 7280 | $where; |
7281 | 7281 | |
7282 | 7282 | if (api_is_multiple_url_enabled()) { |
7283 | - $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
7283 | + $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
7284 | 7284 | $access_url_id = api_get_current_access_url_id(); |
7285 | 7285 | if ($access_url_id != -1) { |
7286 | - $where.= " AND ar.access_url_id = $access_url_id "; |
|
7286 | + $where .= " AND ar.access_url_id = $access_url_id "; |
|
7287 | 7287 | $query = "$select |
7288 | 7288 | FROM $tbl_session s |
7289 | 7289 | LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id) |
@@ -7310,7 +7310,7 @@ discard block |
||
7310 | 7310 | $formatted_sessions = array(); |
7311 | 7311 | |
7312 | 7312 | if (Database::num_rows($result)) { |
7313 | - $sessions = Database::store_result($result, 'ASSOC'); |
|
7313 | + $sessions = Database::store_result($result, 'ASSOC'); |
|
7314 | 7314 | foreach ($sessions as $session) { |
7315 | 7315 | $session_id = $session['id']; |
7316 | 7316 | $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']); |
@@ -7325,14 +7325,14 @@ discard block |
||
7325 | 7325 | |
7326 | 7326 | switch ($session['visibility']) { |
7327 | 7327 | case SESSION_VISIBLE_READ_ONLY: //1 |
7328 | - $session['visibility'] = get_lang('ReadOnly'); |
|
7328 | + $session['visibility'] = get_lang('ReadOnly'); |
|
7329 | 7329 | break; |
7330 | 7330 | case SESSION_VISIBLE: //2 |
7331 | 7331 | case SESSION_AVAILABLE: //4 |
7332 | - $session['visibility'] = get_lang('Visible'); |
|
7332 | + $session['visibility'] = get_lang('Visible'); |
|
7333 | 7333 | break; |
7334 | 7334 | case SESSION_INVISIBLE: //3 |
7335 | - $session['visibility'] = api_ucfirst(get_lang('Invisible')); |
|
7335 | + $session['visibility'] = api_ucfirst(get_lang('Invisible')); |
|
7336 | 7336 | break; |
7337 | 7337 | } |
7338 | 7338 | |
@@ -7408,7 +7408,7 @@ discard block |
||
7408 | 7408 | if (empty($session)) { |
7409 | 7409 | return false; |
7410 | 7410 | } |
7411 | - return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id; |
|
7411 | + return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id; |
|
7412 | 7412 | } |
7413 | 7413 | |
7414 | 7414 | /** |
@@ -7426,7 +7426,7 @@ discard block |
||
7426 | 7426 | return false; |
7427 | 7427 | } |
7428 | 7428 | if (empty($courseId)) { |
7429 | - return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id; |
|
7429 | + return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id; |
|
7430 | 7430 | } else { |
7431 | 7431 | $courseInfo = api_get_course_info_by_id($courseId); |
7432 | 7432 | if ($courseInfo) { |
@@ -7672,7 +7672,7 @@ discard block |
||
7672 | 7672 | // sort $listCat by catSessionName |
7673 | 7673 | usort($listCat, 'self::compareBySessionName'); |
7674 | 7674 | // in each catSession sort sessionList by sessionName |
7675 | - foreach($listCat as $i => $listCatSessionInfo) { |
|
7675 | + foreach ($listCat as $i => $listCatSessionInfo) { |
|
7676 | 7676 | $listSessionList = $listCatSessionInfo['sessionList']; |
7677 | 7677 | usort($listSessionList, 'self::compareCatSessionInfo'); |
7678 | 7678 | $listCat[$i]['sessionList'] = $listSessionList; |
@@ -7687,8 +7687,8 @@ discard block |
||
7687 | 7687 | ); |
7688 | 7688 | |
7689 | 7689 | $userCatId = intval($userCatId); |
7690 | - $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId; |
|
7691 | - $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle; |
|
7690 | + $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId; |
|
7691 | + $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle; |
|
7692 | 7692 | $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse; |
7693 | 7693 | } |
7694 | 7694 | |
@@ -7714,7 +7714,7 @@ discard block |
||
7714 | 7714 | { |
7715 | 7715 | if ($listA['sessionName'] == $listB['sessionName']) { |
7716 | 7716 | return 0; |
7717 | - } else if($listA['sessionName'] > $listB['sessionName']) { |
|
7717 | + } else if ($listA['sessionName'] > $listB['sessionName']) { |
|
7718 | 7718 | return 1; |
7719 | 7719 | } else { |
7720 | 7720 | return -1; |
@@ -7734,7 +7734,7 @@ discard block |
||
7734 | 7734 | return 1; |
7735 | 7735 | } else if ($listA['catSessionName'] == $listB['catSessionName']) { |
7736 | 7736 | return 0; |
7737 | - } else if($listA['catSessionName'] > $listB['catSessionName']) { |
|
7737 | + } else if ($listA['catSessionName'] > $listB['catSessionName']) { |
|
7738 | 7738 | return 1; |
7739 | 7739 | } else { |
7740 | 7740 | return -1; |
@@ -7750,7 +7750,7 @@ discard block |
||
7750 | 7750 | { |
7751 | 7751 | if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) { |
7752 | 7752 | return 0; |
7753 | - } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) { |
|
7753 | + } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) { |
|
7754 | 7754 | return 1; |
7755 | 7755 | } else { |
7756 | 7756 | return -1; |
@@ -7766,7 +7766,7 @@ discard block |
||
7766 | 7766 | { |
7767 | 7767 | if ($listA['title'] == $listB['title']) { |
7768 | 7768 | return 0; |
7769 | - } else if($listA['title'] > $listB['title']) { |
|
7769 | + } else if ($listA['title'] > $listB['title']) { |
|
7770 | 7770 | return 1; |
7771 | 7771 | } else { |
7772 | 7772 | return -1; |
@@ -7812,8 +7812,8 @@ discard block |
||
7812 | 7812 | |
7813 | 7813 | $marginShift = 20; |
7814 | 7814 | if ($catSessionName != '') { |
7815 | - $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' . |
|
7816 | - CourseManager::course_item_html($listParamsCatSession, true) . '</div>'; |
|
7815 | + $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'. |
|
7816 | + CourseManager::course_item_html($listParamsCatSession, true).'</div>'; |
|
7817 | 7817 | $marginShift = 40; |
7818 | 7818 | } |
7819 | 7819 |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | * @param string $description |
1337 | 1337 | * @param int $showDescription |
1338 | 1338 | * @param int $duration |
1339 | - * @param array $extraFields |
|
1339 | + * @param boolean|null $extraFields |
|
1340 | 1340 | * @param int $sessionAdminId |
1341 | 1341 | * @param boolean $sendSubscriptionNotification Optional. |
1342 | 1342 | * Whether send a mail notification to users being subscribed |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * @param array $user_list |
1566 | 1566 | * @param int $session_visibility |
1567 | 1567 | * @param bool $empty_users |
1568 | - * @return bool |
|
1568 | + * @return false|null |
|
1569 | 1569 | */ |
1570 | 1570 | public static function suscribe_users_to_session( |
1571 | 1571 | $id_session, |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | * @param array $courseInfo |
1838 | 1838 | * @param int $status |
1839 | 1839 | * @param bool $updateTotal |
1840 | - * @return bool |
|
1840 | + * @return false|null |
|
1841 | 1841 | */ |
1842 | 1842 | public static function removeUsersFromCourseSession( |
1843 | 1843 | $userList, |
@@ -1903,7 +1903,7 @@ discard block |
||
1903 | 1903 | * @param string $course_code |
1904 | 1904 | * @param int $session_visibility |
1905 | 1905 | * @param bool $removeUsersNotInList |
1906 | - * @return bool |
|
1906 | + * @return false|null |
|
1907 | 1907 | */ |
1908 | 1908 | public static function subscribe_users_to_session_course( |
1909 | 1909 | $user_list, |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | * @param bool $removeExistingCoursesWithUsers Whether to unsubscribe |
2087 | 2087 | * existing courses and users (true, default) or not (false) |
2088 | 2088 | * @param $copyEvaluation from base course to session course |
2089 | - * @return void Nothing, or false on error |
|
2089 | + * @return false|null Nothing, or false on error |
|
2090 | 2090 | * */ |
2091 | 2091 | public static function add_courses_to_session( |
2092 | 2092 | $sessionId, |
@@ -2282,6 +2282,8 @@ discard block |
||
2282 | 2282 | * |
2283 | 2283 | * @param int Session id |
2284 | 2284 | * @param int Course id |
2285 | + * @param integer $session_id |
|
2286 | + * @param integer $course_id |
|
2285 | 2287 | * @return bool True in case of success, false otherwise |
2286 | 2288 | */ |
2287 | 2289 | public static function unsubscribe_course_from_session($session_id, $course_id) |
@@ -2337,7 +2339,7 @@ discard block |
||
2337 | 2339 | * @param string $variable Field's internal variable name |
2338 | 2340 | * @param int $fieldType Field's type |
2339 | 2341 | * @param string $displayText Field's language var name |
2340 | - * @return int new extra field id |
|
2342 | + * @return boolean new extra field id |
|
2341 | 2343 | */ |
2342 | 2344 | public static function create_session_extra_field($variable, $fieldType, $displayText) |
2343 | 2345 | { |
@@ -2561,7 +2563,7 @@ discard block |
||
2561 | 2563 | * @param array id_checked |
2562 | 2564 | * @param bool include delete session |
2563 | 2565 | * @param bool optional, true if the function is called by a webservice, false otherwise. |
2564 | - * @return void Nothing, or false on error |
|
2566 | + * @return boolean Nothing, or false on error |
|
2565 | 2567 | * The parameters is a array to delete sessions |
2566 | 2568 | * */ |
2567 | 2569 | public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false) |
@@ -3056,6 +3058,7 @@ discard block |
||
3056 | 3058 | * @param string $orderCondition |
3057 | 3059 | * @param string $keyword |
3058 | 3060 | * @param string $description |
3061 | + * @param integer $status |
|
3059 | 3062 | * @return array sessions |
3060 | 3063 | */ |
3061 | 3064 | public static function getSessionsFollowedByUser( |
@@ -3268,8 +3271,8 @@ discard block |
||
3268 | 3271 | /** |
3269 | 3272 | * Gets the list of courses by session filtered by access_url |
3270 | 3273 | * |
3271 | - * @param $userId |
|
3272 | - * @param $sessionId |
|
3274 | + * @param integer $userId |
|
3275 | + * @param null|integer $sessionId |
|
3273 | 3276 | * @param null $from |
3274 | 3277 | * @param null $limit |
3275 | 3278 | * @param null $column |
@@ -3394,6 +3397,7 @@ discard block |
||
3394 | 3397 | /** |
3395 | 3398 | * Gets the count of courses by session filtered by access_url |
3396 | 3399 | * @param int session id |
3400 | + * @param integer $session_id |
|
3397 | 3401 | * @return array list of courses |
3398 | 3402 | */ |
3399 | 3403 | public static function getCourseCountBySessionId($session_id, $keyword = null) |
@@ -3645,6 +3649,7 @@ discard block |
||
3645 | 3649 | * Updates a session status |
3646 | 3650 | * @param int session id |
3647 | 3651 | * @param int status |
3652 | + * @param integer $status |
|
3648 | 3653 | */ |
3649 | 3654 | public static function set_session_status($session_id, $status) |
3650 | 3655 | { |
@@ -3960,7 +3965,7 @@ discard block |
||
3960 | 3965 | |
3961 | 3966 | /** |
3962 | 3967 | * @param $id |
3963 | - * @return bool |
|
3968 | + * @return null|boolean |
|
3964 | 3969 | */ |
3965 | 3970 | public static function protect_teacher_session_edit($id) |
3966 | 3971 | { |
@@ -4024,7 +4029,7 @@ discard block |
||
4024 | 4029 | * true: if the session exists it will be updated. |
4025 | 4030 | * false: if session exists a new session will be created adding a counter session1, session2, etc |
4026 | 4031 | * @param int $defaultUserId |
4027 | - * @param mixed $logger |
|
4032 | + * @param Logger $logger |
|
4028 | 4033 | * @param array $extraFields convert a file row to an extra field. Example in CSV file there's a SessionID then it will |
4029 | 4034 | * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id') |
4030 | 4035 | * @param string $extraFieldId |
@@ -5266,7 +5271,6 @@ discard block |
||
5266 | 5271 | * @param string $lastConnectionDate |
5267 | 5272 | * @param array $sessionIdList |
5268 | 5273 | * @param array $studentIdList |
5269 | - * @param int $userStatus STUDENT|COURSEMANAGER constants |
|
5270 | 5274 | * |
5271 | 5275 | * @return array|int |
5272 | 5276 | */ |
@@ -5418,7 +5422,7 @@ discard block |
||
5418 | 5422 | /** |
5419 | 5423 | * Get the list of course tools that have to be dealt with in case of |
5420 | 5424 | * registering any course to a session |
5421 | - * @return array The list of tools to be dealt with (literal names) |
|
5425 | + * @return string[] The list of tools to be dealt with (literal names) |
|
5422 | 5426 | */ |
5423 | 5427 | public static function getCourseToolToBeManaged() |
5424 | 5428 | { |
@@ -5432,7 +5436,7 @@ discard block |
||
5432 | 5436 | * Calls the methods bound to each tool when a course is registered into a session |
5433 | 5437 | * @param int $sessionId |
5434 | 5438 | * @param int $courseId |
5435 | - * @return void |
|
5439 | + * @return boolean|null |
|
5436 | 5440 | */ |
5437 | 5441 | public static function installCourse($sessionId, $courseId) |
5438 | 5442 | { |
@@ -6072,6 +6076,7 @@ discard block |
||
6072 | 6076 | * @param int $categoryId The internal ID of the session category |
6073 | 6077 | * @param string $target Value to search for in the session field values |
6074 | 6078 | * @param array $extraFields A list of fields to be scanned and returned |
6079 | + * @param DateTime $publicationDate |
|
6075 | 6080 | * @return mixed |
6076 | 6081 | */ |
6077 | 6082 | public static function getShortSessionListAndExtraByCategory($categoryId, $target, $extraFields = null, $publicationDate = null) |
@@ -6584,6 +6589,8 @@ discard block |
||
6584 | 6589 | * Converts "start date" and "end date" to "From start date to end date" string |
6585 | 6590 | * @param string $startDate |
6586 | 6591 | * @param string $endDate |
6592 | + * @param boolean $showTime |
|
6593 | + * @param boolean $dateHuman |
|
6587 | 6594 | * |
6588 | 6595 | * @return string |
6589 | 6596 | */ |
@@ -7402,7 +7409,7 @@ discard block |
||
7402 | 7409 | /** |
7403 | 7410 | * Get link to the admin page for this session |
7404 | 7411 | * @param int $id Session ID |
7405 | - * @return mixed URL to the admin page to manage the session, or false on error |
|
7412 | + * @return false|string URL to the admin page to manage the session, or false on error |
|
7406 | 7413 | */ |
7407 | 7414 | public static function getAdminPath($id) |
7408 | 7415 | { |
@@ -7419,7 +7426,7 @@ discard block |
||
7419 | 7426 | * If a course is provided, build the link to the course |
7420 | 7427 | * @param int $id Session ID |
7421 | 7428 | * @param int $courseId Course ID (optional) in case the link has to send straight to the course |
7422 | - * @return mixed URL to the page to use the session, or false on error |
|
7429 | + * @return false|string URL to the page to use the session, or false on error |
|
7423 | 7430 | */ |
7424 | 7431 | public static function getPath($id, $courseId = 0) |
7425 | 7432 | { |
@@ -7517,7 +7524,7 @@ discard block |
||
7517 | 7524 | /** |
7518 | 7525 | * Return true if coach is allowed to access this session |
7519 | 7526 | * @param int $sessionId |
7520 | - * @return bool |
|
7527 | + * @return integer |
|
7521 | 7528 | */ |
7522 | 7529 | public static function isSessionDateOkForCoach($sessionId) |
7523 | 7530 | { |
@@ -23,7 +23,7 @@ |
||
23 | 23 | if (isset($condition['conditional_function']) && $condition['conditional_function']($user) == false) { |
24 | 24 | $_SESSION['conditional_login']['uid'] = $user['user_id']; |
25 | 25 | $_SESSION['conditional_login']['can_login'] = false; |
26 | - header("Location:". $condition['url']); |
|
26 | + header("Location:".$condition['url']); |
|
27 | 27 | exit(); |
28 | 28 | } |
29 | 29 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($height >= $max_size_for_picture) { |
48 | 48 | // scale width |
49 | 49 | $new_width = round($width * ($max_size_for_picture / $height)); |
50 | - $this->image_wrapper->resize($new_width, $max_size_for_picture, 0); |
|
50 | + $this->image_wrapper->resize($new_width, $max_size_for_picture, 0); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function __construct($path) |
151 | 151 | { |
152 | - parent::__construct($path); |
|
152 | + parent::__construct($path); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function set_image_wrapper() |
@@ -184,19 +184,19 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - public function get_image_size() |
|
187 | + public function get_image_size() |
|
188 | 188 | { |
189 | - $imagesize = array('width'=>0,'height'=>0); |
|
190 | - if ($this->image_validated) { |
|
189 | + $imagesize = array('width'=>0,'height'=>0); |
|
190 | + if ($this->image_validated) { |
|
191 | 191 | $imagesize = $this->image->getImageGeometry(); |
192 | - } |
|
193 | - return $imagesize; |
|
194 | - } |
|
192 | + } |
|
193 | + return $imagesize; |
|
194 | + } |
|
195 | 195 | |
196 | - //@todo implement border logic case for Imagick |
|
197 | - public function resize($thumbw, $thumbh, $border, $specific_size = false) |
|
196 | + //@todo implement border logic case for Imagick |
|
197 | + public function resize($thumbw, $thumbh, $border, $specific_size = false) |
|
198 | 198 | { |
199 | - if (!$this->image_validated) return false; |
|
199 | + if (!$this->image_validated) return false; |
|
200 | 200 | |
201 | 201 | if ($specific_size) { |
202 | 202 | $width = $thumbw; |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | $width = (int)($this->width * $scale); |
207 | 207 | $height = (int)($this->height * $scale); |
208 | 208 | } |
209 | - $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
|
210 | - $this->width = $thumbw; |
|
211 | - $this->height = $thumbh; |
|
212 | - } |
|
209 | + $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
|
210 | + $this->width = $thumbw; |
|
211 | + $this->height = $thumbh; |
|
212 | + } |
|
213 | 213 | |
214 | 214 | /** |
215 | 215 | * @author José Loguercio <[email protected]> |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
225 | 225 | if (!$this->image_validated) return false; |
226 | 226 | $this->image->cropimage($width, $height, $x, $y); |
227 | - $this->width = $width; |
|
228 | - $this->height = $height; |
|
227 | + $this->width = $width; |
|
228 | + $this->height = $height; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
@@ -235,35 +235,35 @@ discard block |
||
235 | 235 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
236 | 236 | $type = $convert_file_to; |
237 | 237 | } |
238 | - switch ($type) { |
|
239 | - case 'jpeg': |
|
240 | - case 'jpg': |
|
241 | - if (!$file) header("Content-type: image/jpeg"); |
|
242 | - break; |
|
243 | - case 'png': |
|
244 | - if (!$file) header("Content-type: image/png"); |
|
245 | - break; |
|
246 | - case 'gif': |
|
247 | - if (!$file) header("Content-type: image/gif"); |
|
248 | - break; |
|
249 | - } |
|
250 | - $result = false; |
|
251 | - try { |
|
252 | - $result = $this->image->writeImage($file); |
|
253 | - } catch(ImagickException $e) { |
|
238 | + switch ($type) { |
|
239 | + case 'jpeg': |
|
240 | + case 'jpg': |
|
241 | + if (!$file) header("Content-type: image/jpeg"); |
|
242 | + break; |
|
243 | + case 'png': |
|
244 | + if (!$file) header("Content-type: image/png"); |
|
245 | + break; |
|
246 | + case 'gif': |
|
247 | + if (!$file) header("Content-type: image/gif"); |
|
248 | + break; |
|
249 | + } |
|
250 | + $result = false; |
|
251 | + try { |
|
252 | + $result = $this->image->writeImage($file); |
|
253 | + } catch(ImagickException $e) { |
|
254 | 254 | if ($this->debug) error_log($e->getMessage()); |
255 | 255 | } |
256 | 256 | |
257 | - if (!$file) { |
|
258 | - echo $this->image; |
|
259 | - $this->image->clear(); |
|
257 | + if (!$file) { |
|
258 | + echo $this->image; |
|
259 | + $this->image->clear(); |
|
260 | 260 | $this->image->destroy(); |
261 | - } else { |
|
262 | - $this->image->clear(); |
|
261 | + } else { |
|
262 | + $this->image->clear(); |
|
263 | 263 | $this->image->destroy(); |
264 | - return $result; |
|
265 | - } |
|
266 | - } |
|
264 | + return $result; |
|
265 | + } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | $this->fill_image_info(); |
286 | 286 | |
287 | 287 | switch ($this->type) { |
288 | - case 0: |
|
289 | - $handler = false; |
|
290 | - break; |
|
291 | - case 1 : |
|
288 | + case 0: |
|
289 | + $handler = false; |
|
290 | + break; |
|
291 | + case 1 : |
|
292 | 292 | $handler = @imagecreatefromgif($this->path); |
293 | 293 | $this->type = 'gif'; |
294 | 294 | break; |
295 | - case 2 : |
|
295 | + case 2 : |
|
296 | 296 | $handler = @imagecreatefromjpeg($this->path); |
297 | 297 | $this->type = 'jpg'; |
298 | 298 | break; |
299 | - case 3 : |
|
300 | - $handler = @imagecreatefrompng($this->path); |
|
301 | - $this->type = 'png'; |
|
302 | - break; |
|
299 | + case 3 : |
|
300 | + $handler = @imagecreatefrompng($this->path); |
|
301 | + $this->type = 'png'; |
|
302 | + break; |
|
303 | 303 | } |
304 | 304 | if ($handler) { |
305 | 305 | $this->image_validated = true; |
@@ -313,29 +313,29 @@ discard block |
||
313 | 313 | { |
314 | 314 | $return_array = array('width'=>0,'height'=>0); |
315 | 315 | if ($this->image_validated) { |
316 | - $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
316 | + $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
317 | 317 | } |
318 | 318 | return $return_array; |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | 321 | public function fill_image_info() |
322 | 322 | { |
323 | - if (file_exists($this->path)) { |
|
324 | - $image_info = getimagesize($this->path); |
|
325 | - $this->width = $image_info[0]; |
|
326 | - $this->height = $image_info[1]; |
|
327 | - $this->type = $image_info[2]; |
|
328 | - } else { |
|
329 | - $this->width = 0; |
|
330 | - $this->height = 0; |
|
331 | - $this->type = 0; |
|
332 | - } |
|
323 | + if (file_exists($this->path)) { |
|
324 | + $image_info = getimagesize($this->path); |
|
325 | + $this->width = $image_info[0]; |
|
326 | + $this->height = $image_info[1]; |
|
327 | + $this->type = $image_info[2]; |
|
328 | + } else { |
|
329 | + $this->width = 0; |
|
330 | + $this->height = 0; |
|
331 | + $this->type = 0; |
|
332 | + } |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
336 | 336 | { |
337 | 337 | if (!$this->image_validated) return false; |
338 | - if ($border == 1) { |
|
338 | + if ($border == 1) { |
|
339 | 339 | if ($specific_size) { |
340 | 340 | $width = $thumbw; |
341 | 341 | $height = $thumbh; |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | $width = (int)($this->width * $scale); |
345 | 345 | $height = (int)($this->height * $scale); |
346 | 346 | } |
347 | - $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | - $deltah = (int)(($thumbh - $height) / 2); |
|
349 | - $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
350 | - @imagealphablending($dst_img, false); |
|
351 | - @imagesavealpha($dst_img, true); |
|
352 | - if (!empty($this->color)) { |
|
353 | - @imagefill($dst_img, 0, 0, $this->color); |
|
354 | - } |
|
355 | - $this->width = $thumbw; |
|
356 | - $this->height = $thumbh; |
|
357 | - } elseif ($border == 0) { |
|
347 | + $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | + $deltah = (int)(($thumbh - $height) / 2); |
|
349 | + $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
350 | + @imagealphablending($dst_img, false); |
|
351 | + @imagesavealpha($dst_img, true); |
|
352 | + if (!empty($this->color)) { |
|
353 | + @imagefill($dst_img, 0, 0, $this->color); |
|
354 | + } |
|
355 | + $this->width = $thumbw; |
|
356 | + $this->height = $thumbh; |
|
357 | + } elseif ($border == 0) { |
|
358 | 358 | if ($specific_size) { |
359 | 359 | $width = $thumbw; |
360 | 360 | $height = $thumbh; |
@@ -363,19 +363,19 @@ discard block |
||
363 | 363 | $width = (int)($this->width * $scale); |
364 | 364 | $height = (int)($this->height * $scale); |
365 | 365 | } |
366 | - $deltaw = 0; |
|
367 | - $deltah = 0; |
|
368 | - $dst_img = @ImageCreateTrueColor($width, $height); |
|
369 | - @imagealphablending($dst_img, false); |
|
370 | - @imagesavealpha($dst_img, true); |
|
371 | - $this->width = $width; |
|
372 | - $this->height = $height; |
|
373 | - } |
|
374 | - $src_img = $this->bg; |
|
375 | - @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
376 | - $this->bg = $dst_img; |
|
377 | - @imagedestroy($src_img); |
|
378 | - } |
|
366 | + $deltaw = 0; |
|
367 | + $deltah = 0; |
|
368 | + $dst_img = @ImageCreateTrueColor($width, $height); |
|
369 | + @imagealphablending($dst_img, false); |
|
370 | + @imagesavealpha($dst_img, true); |
|
371 | + $this->width = $width; |
|
372 | + $this->height = $height; |
|
373 | + } |
|
374 | + $src_img = $this->bg; |
|
375 | + @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
376 | + $this->bg = $dst_img; |
|
377 | + @imagedestroy($src_img); |
|
378 | + } |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * @author José Loguercio <[email protected]> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
390 | 390 | if (!$this->image_validated) return false; |
391 | 391 | $this->width = $width; |
392 | - $this->height = $height; |
|
392 | + $this->height = $height; |
|
393 | 393 | $src = null; |
394 | 394 | $dest = @imagecreatetruecolor($width, $height); |
395 | 395 | $type = $this->type; |
@@ -400,56 +400,56 @@ discard block |
||
400 | 400 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
401 | 401 | @imagejpeg($dest, $this->path); |
402 | 402 | break; |
403 | - case 'png' : |
|
403 | + case 'png' : |
|
404 | 404 | $src = @imagecreatefrompng($this->path); |
405 | 405 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
406 | 406 | @imagepng($dest, $this->path); |
407 | 407 | break; |
408 | - case 'gif' : |
|
409 | - $src = @imagecreatefromgif($this->path); |
|
408 | + case 'gif' : |
|
409 | + $src = @imagecreatefromgif($this->path); |
|
410 | 410 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
411 | 411 | @imagegif($dest, $this->path); |
412 | - break; |
|
412 | + break; |
|
413 | 413 | default: return 0; |
414 | 414 | } |
415 | 415 | @imagedestroy($dest); |
416 | 416 | @imagedestroy($src); |
417 | 417 | } |
418 | 418 | |
419 | - public function send_image($file = '', $compress = -1, $convert_file_to = null) |
|
419 | + public function send_image($file = '', $compress = -1, $convert_file_to = null) |
|
420 | 420 | { |
421 | - if (!$this->image_validated) return false; |
|
421 | + if (!$this->image_validated) return false; |
|
422 | 422 | $compress = (int)$compress; |
423 | 423 | $type = $this->type; |
424 | 424 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
425 | 425 | $type = $convert_file_to; |
426 | 426 | } |
427 | - switch ($type) { |
|
428 | - case 'jpeg': |
|
429 | - case 'jpg': |
|
430 | - if (!$file) header("Content-type: image/jpeg"); |
|
431 | - if ($compress == -1) $compress = 100; |
|
432 | - return imagejpeg($this->bg, $file, $compress); |
|
433 | - break; |
|
434 | - case 'png': |
|
435 | - if (!$file) header("Content-type: image/png"); |
|
436 | - if ($compress != -1) { |
|
437 | - @imagetruecolortopalette($this->bg, true, $compress); |
|
438 | - } |
|
439 | - return imagepng($this->bg, $file, $compress); |
|
440 | - break; |
|
441 | - case 'gif': |
|
442 | - if (!$file) header("Content-type: image/gif"); |
|
443 | - if ($compress != -1) { |
|
444 | - @imagetruecolortopalette($this->bg, true, $compress); |
|
445 | - } |
|
446 | - return imagegif($this->bg, $file, $compress); |
|
447 | - break; |
|
448 | - default: return 0; |
|
449 | - } |
|
450 | - // TODO: Occupied memory is not released, because the following fragment of code is actually dead. |
|
451 | - @imagedestroy($this->bg); |
|
452 | - } |
|
427 | + switch ($type) { |
|
428 | + case 'jpeg': |
|
429 | + case 'jpg': |
|
430 | + if (!$file) header("Content-type: image/jpeg"); |
|
431 | + if ($compress == -1) $compress = 100; |
|
432 | + return imagejpeg($this->bg, $file, $compress); |
|
433 | + break; |
|
434 | + case 'png': |
|
435 | + if (!$file) header("Content-type: image/png"); |
|
436 | + if ($compress != -1) { |
|
437 | + @imagetruecolortopalette($this->bg, true, $compress); |
|
438 | + } |
|
439 | + return imagepng($this->bg, $file, $compress); |
|
440 | + break; |
|
441 | + case 'gif': |
|
442 | + if (!$file) header("Content-type: image/gif"); |
|
443 | + if ($compress != -1) { |
|
444 | + @imagetruecolortopalette($this->bg, true, $compress); |
|
445 | + } |
|
446 | + return imagegif($this->bg, $file, $compress); |
|
447 | + break; |
|
448 | + default: return 0; |
|
449 | + } |
|
450 | + // TODO: Occupied memory is not released, because the following fragment of code is actually dead. |
|
451 | + @imagedestroy($this->bg); |
|
452 | + } |
|
453 | 453 | |
454 | 454 | /** |
455 | 455 | * Convert image to black & white |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | $this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path; |
118 | - $this->set_image_wrapper(); //Creates image obj |
|
118 | + $this->set_image_wrapper(); //Creates image obj |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | abstract function set_image_wrapper(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
158 | 158 | try { |
159 | 159 | if (file_exists($this->path)) { |
160 | - $this->image = new Imagick($this->path); |
|
160 | + $this->image = new Imagick($this->path); |
|
161 | 161 | |
162 | 162 | if ($this->image) { |
163 | 163 | $this->fill_image_info(); //Fills height, width and type |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } else { |
166 | 166 | if ($this->debug) error_log('Image::image does not exist'); |
167 | 167 | } |
168 | - } catch(ImagickException $e) { |
|
168 | + } catch (ImagickException $e) { |
|
169 | 169 | if ($this->debug) error_log($e->getMessage()); |
170 | 170 | } |
171 | 171 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public function get_image_size() |
188 | 188 | { |
189 | - $imagesize = array('width'=>0,'height'=>0); |
|
189 | + $imagesize = array('width'=>0, 'height'=>0); |
|
190 | 190 | if ($this->image_validated) { |
191 | 191 | $imagesize = $this->image->getImageGeometry(); |
192 | 192 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $height = $thumbh; |
204 | 204 | } else { |
205 | 205 | $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0; |
206 | - $width = (int)($this->width * $scale); |
|
207 | - $height = (int)($this->height * $scale); |
|
206 | + $width = (int) ($this->width * $scale); |
|
207 | + $height = (int) ($this->height * $scale); |
|
208 | 208 | } |
209 | 209 | $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
210 | 210 | $this->width = $thumbw; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $result = false; |
251 | 251 | try { |
252 | 252 | $result = $this->image->writeImage($file); |
253 | - } catch(ImagickException $e) { |
|
253 | + } catch (ImagickException $e) { |
|
254 | 254 | if ($this->debug) error_log($e->getMessage()); |
255 | 255 | } |
256 | 256 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | |
312 | 312 | public function get_image_size() |
313 | 313 | { |
314 | - $return_array = array('width'=>0,'height'=>0); |
|
314 | + $return_array = array('width'=>0, 'height'=>0); |
|
315 | 315 | if ($this->image_validated) { |
316 | - $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
316 | + $return_array = array('width'=>$this->width, 'height'=>$this->height); |
|
317 | 317 | } |
318 | 318 | return $return_array; |
319 | 319 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function fill_image_info() |
322 | 322 | { |
323 | 323 | if (file_exists($this->path)) { |
324 | - $image_info = getimagesize($this->path); |
|
324 | + $image_info = getimagesize($this->path); |
|
325 | 325 | $this->width = $image_info[0]; |
326 | 326 | $this->height = $image_info[1]; |
327 | 327 | $this->type = $image_info[2]; |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $height = $thumbh; |
342 | 342 | } else { |
343 | 343 | $scale = min($thumbw / $this->width, $thumbh / $this->height); |
344 | - $width = (int)($this->width * $scale); |
|
345 | - $height = (int)($this->height * $scale); |
|
344 | + $width = (int) ($this->width * $scale); |
|
345 | + $height = (int) ($this->height * $scale); |
|
346 | 346 | } |
347 | - $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | - $deltah = (int)(($thumbh - $height) / 2); |
|
347 | + $deltaw = (int) (($thumbw - $width) / 2); |
|
348 | + $deltah = (int) (($thumbh - $height) / 2); |
|
349 | 349 | $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
350 | 350 | @imagealphablending($dst_img, false); |
351 | 351 | @imagesavealpha($dst_img, true); |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | $height = $thumbh; |
361 | 361 | } else { |
362 | 362 | $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0; |
363 | - $width = (int)($this->width * $scale); |
|
364 | - $height = (int)($this->height * $scale); |
|
363 | + $width = (int) ($this->width * $scale); |
|
364 | + $height = (int) ($this->height * $scale); |
|
365 | 365 | } |
366 | 366 | $deltaw = 0; |
367 | 367 | $deltah = 0; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
420 | 420 | { |
421 | 421 | if (!$this->image_validated) return false; |
422 | - $compress = (int)$compress; |
|
422 | + $compress = (int) $compress; |
|
423 | 423 | $type = $this->type; |
424 | 424 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
425 | 425 | $type = $convert_file_to; |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | * so that we can use black (0,0,0) as transparent, which is what |
464 | 464 | * the image is filled with when created. |
465 | 465 | */ |
466 | - $transparent = imagecolorallocate($dest_img, 0,0,0); |
|
466 | + $transparent = imagecolorallocate($dest_img, 0, 0, 0); |
|
467 | 467 | imagealphablending($dest_img, false); |
468 | 468 | imagesavealpha($dest_img, true); |
469 | 469 | imagecolortransparent($dest_img, $transparent); |
470 | - imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg)); |
|
470 | + imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg)); |
|
471 | 471 | imagefilter($dest_img, IMG_FILTER_GRAYSCALE); |
472 | 472 | $this->bg = $dest_img; |
473 | 473 |
@@ -154,7 +154,9 @@ discard block |
||
154 | 154 | |
155 | 155 | public function set_image_wrapper() |
156 | 156 | { |
157 | - if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
|
157 | + if ($this->debug) { |
|
158 | + error_log('Image::set_image_wrapper loaded'); |
|
159 | + } |
|
158 | 160 | try { |
159 | 161 | if (file_exists($this->path)) { |
160 | 162 | $this->image = new Imagick($this->path); |
@@ -163,10 +165,14 @@ discard block |
||
163 | 165 | $this->fill_image_info(); //Fills height, width and type |
164 | 166 | } |
165 | 167 | } else { |
166 | - if ($this->debug) error_log('Image::image does not exist'); |
|
168 | + if ($this->debug) { |
|
169 | + error_log('Image::image does not exist'); |
|
170 | + } |
|
167 | 171 | } |
168 | 172 | } catch(ImagickException $e) { |
169 | - if ($this->debug) error_log($e->getMessage()); |
|
173 | + if ($this->debug) { |
|
174 | + error_log($e->getMessage()); |
|
175 | + } |
|
170 | 176 | } |
171 | 177 | } |
172 | 178 | |
@@ -180,7 +186,9 @@ discard block |
||
180 | 186 | |
181 | 187 | if (in_array($this->type, $this->allowed_extensions)) { |
182 | 188 | $this->image_validated = true; |
183 | - if ($this->debug) error_log('image_validated true'); |
|
189 | + if ($this->debug) { |
|
190 | + error_log('image_validated true'); |
|
191 | + } |
|
184 | 192 | } |
185 | 193 | } |
186 | 194 | |
@@ -196,7 +204,9 @@ discard block |
||
196 | 204 | //@todo implement border logic case for Imagick |
197 | 205 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
198 | 206 | { |
199 | - if (!$this->image_validated) return false; |
|
207 | + if (!$this->image_validated) { |
|
208 | + return false; |
|
209 | + } |
|
200 | 210 | |
201 | 211 | if ($specific_size) { |
202 | 212 | $width = $thumbw; |
@@ -222,7 +232,9 @@ discard block |
||
222 | 232 | */ |
223 | 233 | |
224 | 234 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
225 | - if (!$this->image_validated) return false; |
|
235 | + if (!$this->image_validated) { |
|
236 | + return false; |
|
237 | + } |
|
226 | 238 | $this->image->cropimage($width, $height, $x, $y); |
227 | 239 | $this->width = $width; |
228 | 240 | $this->height = $height; |
@@ -230,7 +242,9 @@ discard block |
||
230 | 242 | |
231 | 243 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
232 | 244 | { |
233 | - if (!$this->image_validated) return false; |
|
245 | + if (!$this->image_validated) { |
|
246 | + return false; |
|
247 | + } |
|
234 | 248 | $type = $this->type; |
235 | 249 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
236 | 250 | $type = $convert_file_to; |
@@ -238,20 +252,28 @@ discard block |
||
238 | 252 | switch ($type) { |
239 | 253 | case 'jpeg': |
240 | 254 | case 'jpg': |
241 | - if (!$file) header("Content-type: image/jpeg"); |
|
255 | + if (!$file) { |
|
256 | + header("Content-type: image/jpeg"); |
|
257 | + } |
|
242 | 258 | break; |
243 | 259 | case 'png': |
244 | - if (!$file) header("Content-type: image/png"); |
|
260 | + if (!$file) { |
|
261 | + header("Content-type: image/png"); |
|
262 | + } |
|
245 | 263 | break; |
246 | 264 | case 'gif': |
247 | - if (!$file) header("Content-type: image/gif"); |
|
265 | + if (!$file) { |
|
266 | + header("Content-type: image/gif"); |
|
267 | + } |
|
248 | 268 | break; |
249 | 269 | } |
250 | 270 | $result = false; |
251 | 271 | try { |
252 | 272 | $result = $this->image->writeImage($file); |
253 | 273 | } catch(ImagickException $e) { |
254 | - if ($this->debug) error_log($e->getMessage()); |
|
274 | + if ($this->debug) { |
|
275 | + error_log($e->getMessage()); |
|
276 | + } |
|
255 | 277 | } |
256 | 278 | |
257 | 279 | if (!$file) { |
@@ -334,7 +356,9 @@ discard block |
||
334 | 356 | |
335 | 357 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
336 | 358 | { |
337 | - if (!$this->image_validated) return false; |
|
359 | + if (!$this->image_validated) { |
|
360 | + return false; |
|
361 | + } |
|
338 | 362 | if ($border == 1) { |
339 | 363 | if ($specific_size) { |
340 | 364 | $width = $thumbw; |
@@ -387,7 +411,9 @@ discard block |
||
387 | 411 | * @param int $src_height the source height of the original image |
388 | 412 | */ |
389 | 413 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
390 | - if (!$this->image_validated) return false; |
|
414 | + if (!$this->image_validated) { |
|
415 | + return false; |
|
416 | + } |
|
391 | 417 | $this->width = $width; |
392 | 418 | $this->height = $height; |
393 | 419 | $src = null; |
@@ -418,7 +444,9 @@ discard block |
||
418 | 444 | |
419 | 445 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
420 | 446 | { |
421 | - if (!$this->image_validated) return false; |
|
447 | + if (!$this->image_validated) { |
|
448 | + return false; |
|
449 | + } |
|
422 | 450 | $compress = (int)$compress; |
423 | 451 | $type = $this->type; |
424 | 452 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
@@ -427,19 +455,27 @@ discard block |
||
427 | 455 | switch ($type) { |
428 | 456 | case 'jpeg': |
429 | 457 | case 'jpg': |
430 | - if (!$file) header("Content-type: image/jpeg"); |
|
431 | - if ($compress == -1) $compress = 100; |
|
458 | + if (!$file) { |
|
459 | + header("Content-type: image/jpeg"); |
|
460 | + } |
|
461 | + if ($compress == -1) { |
|
462 | + $compress = 100; |
|
463 | + } |
|
432 | 464 | return imagejpeg($this->bg, $file, $compress); |
433 | 465 | break; |
434 | 466 | case 'png': |
435 | - if (!$file) header("Content-type: image/png"); |
|
467 | + if (!$file) { |
|
468 | + header("Content-type: image/png"); |
|
469 | + } |
|
436 | 470 | if ($compress != -1) { |
437 | 471 | @imagetruecolortopalette($this->bg, true, $compress); |
438 | 472 | } |
439 | 473 | return imagepng($this->bg, $file, $compress); |
440 | 474 | break; |
441 | 475 | case 'gif': |
442 | - if (!$file) header("Content-type: image/gif"); |
|
476 | + if (!$file) { |
|
477 | + header("Content-type: image/gif"); |
|
478 | + } |
|
443 | 479 | if ($compress != -1) { |
444 | 480 | @imagetruecolortopalette($this->bg, true, $compress); |
445 | 481 | } |
@@ -456,7 +492,9 @@ discard block |
||
456 | 492 | */ |
457 | 493 | function convert2bw() |
458 | 494 | { |
459 | - if (!$this->image_validated) return false; |
|
495 | + if (!$this->image_validated) { |
|
496 | + return false; |
|
497 | + } |
|
460 | 498 | |
461 | 499 | $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg)); |
462 | 500 | /* copy ignore the transparent color |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return $image; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $convert_file_to |
|
68 | + */ |
|
66 | 69 | public function send_image( |
67 | 70 | $file = '', |
68 | 71 | $compress = -1, |
@@ -144,6 +147,9 @@ discard block |
||
144 | 147 | public $image; |
145 | 148 | public $filter = Imagick::FILTER_LANCZOS; |
146 | 149 | |
150 | + /** |
|
151 | + * @param string $path |
|
152 | + */ |
|
147 | 153 | public function __construct($path) |
148 | 154 | { |
149 | 155 | parent::__construct($path); |
@@ -191,6 +197,10 @@ discard block |
||
191 | 197 | } |
192 | 198 | |
193 | 199 | //@todo implement border logic case for Imagick |
200 | + |
|
201 | + /** |
|
202 | + * @param integer $border |
|
203 | + */ |
|
194 | 204 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
195 | 205 | { |
196 | 206 | if (!$this->image_validated) return false; |
@@ -272,6 +282,9 @@ discard block |
||
272 | 282 | { |
273 | 283 | public $bg; |
274 | 284 | |
285 | + /** |
|
286 | + * @param string $path |
|
287 | + */ |
|
275 | 288 | function __construct($path) { |
276 | 289 | parent::__construct($path); |
277 | 290 | } |
@@ -329,6 +342,9 @@ discard block |
||
329 | 342 | } |
330 | 343 | } |
331 | 344 | |
345 | + /** |
|
346 | + * @param integer $border |
|
347 | + */ |
|
332 | 348 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
333 | 349 | { |
334 | 350 | if (!$this->image_validated) return false; |
@@ -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 | ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
81 | 81 | $sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id"; |
82 | 82 | $res = Database::query($sql); |
83 | - $users = array (); |
|
83 | + $users = array(); |
|
84 | 84 | while ($user = Database::fetch_array($res, 'ASSOC')) { |
85 | 85 | $users[] = $user; |
86 | 86 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
118 | 118 | $courses = ClassManager :: get_courses($class_id); |
119 | 119 | if (count($courses) != 0) { |
120 | - $course_codes = array (); |
|
120 | + $course_codes = array(); |
|
121 | 121 | foreach ($courses as $index => $course) { |
122 | 122 | $course_codes[] = $course['course_code']; |
123 | 123 | $sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'"; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
143 | 143 | $sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code"; |
144 | 144 | $res = Database::query($sql); |
145 | - $courses = array (); |
|
145 | + $courses = array(); |
|
146 | 146 | while ($course = Database::fetch_array($res, 'ASSOC')) { |
147 | 147 | $courses[] = $course; |
148 | 148 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
218 | 218 | $sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id"; |
219 | 219 | $res = Database::query($sql); |
220 | - $classes = array (); |
|
220 | + $classes = array(); |
|
221 | 221 | while ($class = Database::fetch_array($res, 'ASSOC')) { |
222 | 222 | $classes[] = $class; |
223 | 223 | } |
@@ -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 |
@@ -1333,6 +1333,8 @@ discard block |
||
1333 | 1333 | * @param string type of time filter: 'last_week' or 'custom' |
1334 | 1334 | * @param string start date date('Y-m-d H:i:s') |
1335 | 1335 | * @param string end date date('Y-m-d H:i:s') |
1336 | + * @param string $start_date |
|
1337 | + * @param string $end_date |
|
1336 | 1338 | * @return timestamp $nb_seconds |
1337 | 1339 | */ |
1338 | 1340 | public static function get_time_spent_on_the_platform( |
@@ -1435,7 +1437,7 @@ discard block |
||
1435 | 1437 | * Get first connection date for a student |
1436 | 1438 | * @param int $student_id |
1437 | 1439 | * |
1438 | - * @return string|bool Date format long without day or false if there are no connections |
|
1440 | + * @return string|false Date format long without day or false if there are no connections |
|
1439 | 1441 | */ |
1440 | 1442 | public static function get_first_connection_date($student_id) |
1441 | 1443 | { |
@@ -1465,7 +1467,7 @@ discard block |
||
1465 | 1467 | * @param int $student_id |
1466 | 1468 | * @param bool $warning_message Show a warning message (optional) |
1467 | 1469 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
1468 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
1470 | + * @return string Date format long without day, false if there are no connections or |
|
1469 | 1471 | * timestamp if parameter $return_timestamp is true |
1470 | 1472 | */ |
1471 | 1473 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2762,6 +2764,9 @@ discard block |
||
2762 | 2764 | * @param array Limit average to listed lp ids |
2763 | 2765 | * @param int Session id (optional), if param $session_id is |
2764 | 2766 | * null(default) it'll return results including sessions, 0 = session is not filtered |
2767 | + * @param integer $student_id |
|
2768 | + * @param string $course_code |
|
2769 | + * @param integer $session_id |
|
2765 | 2770 | * @return int Total time |
2766 | 2771 | */ |
2767 | 2772 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2831,6 +2836,8 @@ discard block |
||
2831 | 2836 | * @param int|array Student id(s) |
2832 | 2837 | * @param string Course code |
2833 | 2838 | * @param int Learning path id |
2839 | + * @param integer $student_id |
|
2840 | + * @param string $course_code |
|
2834 | 2841 | * @return int Total time |
2835 | 2842 | */ |
2836 | 2843 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5504,7 +5511,7 @@ discard block |
||
5504 | 5511 | |
5505 | 5512 | /** |
5506 | 5513 | * @param FormValidator $form |
5507 | - * @return mixed |
|
5514 | + * @return FormValidator |
|
5508 | 5515 | */ |
5509 | 5516 | public static function setUserSearchForm($form) |
5510 | 5517 | { |
@@ -6985,7 +6992,7 @@ discard block |
||
6985 | 6992 | * @param int $user_id |
6986 | 6993 | * @param int $course_id |
6987 | 6994 | * @param int $session_id |
6988 | - * @return array |
|
6995 | + * @return string[] |
|
6989 | 6996 | */ |
6990 | 6997 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6998 | { |
@@ -7031,9 +7038,9 @@ discard block |
||
7031 | 7038 | /** |
7032 | 7039 | * Displays the exercise results for a specific user in a specific course. |
7033 | 7040 | * @param string $view |
7034 | - * @param int $user_id User ID |
|
7041 | + * @param int $userId User ID |
|
7035 | 7042 | * @param string $courseCode Course code |
7036 | - * @return array |
|
7043 | + * @return string[] |
|
7037 | 7044 | * @todo remove globals |
7038 | 7045 | */ |
7039 | 7046 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $extend_link = ''; |
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | case 'last_30_days': |
1366 | 1366 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
1367 | 1367 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
1368 | - break; |
|
1368 | + break; |
|
1369 | 1369 | case 'custom': |
1370 | 1370 | if (!empty($start_date) && !empty($end_date)) { |
1371 | 1371 | $start_date = Database::escape_string($start_date); |
@@ -1375,10 +1375,10 @@ discard block |
||
1375 | 1375 | break; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1378 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1379 | 1379 | FROM '.$tbl_track_login.' |
1380 | 1380 | WHERE '.$userCondition.$condition_time; |
1381 | - $rs = Database::query($sql); |
|
1381 | + $rs = Database::query($sql); |
|
1382 | 1382 | $row = Database::fetch_array($rs, 'ASSOC'); |
1383 | 1383 | $diff = $row['diff']; |
1384 | 1384 | |
@@ -1400,18 +1400,18 @@ discard block |
||
1400 | 1400 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1401 | 1401 | { |
1402 | 1402 | $courseId = intval($courseId); |
1403 | - $session_id = intval($session_id); |
|
1404 | - |
|
1405 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | - if (is_array($user_id)) { |
|
1407 | - $user_id = array_map('intval', $user_id); |
|
1408 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | - } else { |
|
1410 | - $user_id = intval($user_id); |
|
1411 | - $condition_user = " AND user_id = $user_id "; |
|
1412 | - } |
|
1413 | - |
|
1414 | - $sql = "SELECT |
|
1403 | + $session_id = intval($session_id); |
|
1404 | + |
|
1405 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | + if (is_array($user_id)) { |
|
1407 | + $user_id = array_map('intval', $user_id); |
|
1408 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | + } else { |
|
1410 | + $user_id = intval($user_id); |
|
1411 | + $condition_user = " AND user_id = $user_id "; |
|
1412 | + } |
|
1413 | + |
|
1414 | + $sql = "SELECT |
|
1415 | 1415 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1416 | 1416 | FROM $tbl_track_course |
1417 | 1417 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1426,9 +1426,9 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | $sql .= $condition_user; |
1428 | 1428 | $rs = Database::query($sql); |
1429 | - $row = Database::fetch_array($rs); |
|
1429 | + $row = Database::fetch_array($rs); |
|
1430 | 1430 | |
1431 | - return $row['nb_seconds']; |
|
1431 | + return $row['nb_seconds']; |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | /** |
@@ -1439,25 +1439,25 @@ discard block |
||
1439 | 1439 | */ |
1440 | 1440 | public static function get_first_connection_date($student_id) |
1441 | 1441 | { |
1442 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | - $sql = 'SELECT login_date |
|
1442 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | + $sql = 'SELECT login_date |
|
1444 | 1444 | FROM ' . $tbl_track_login . ' |
1445 | 1445 | WHERE login_user_id = ' . intval($student_id) . ' |
1446 | 1446 | ORDER BY login_date ASC |
1447 | 1447 | LIMIT 0,1'; |
1448 | 1448 | |
1449 | - $rs = Database::query($sql); |
|
1450 | - if (Database::num_rows($rs)>0) { |
|
1451 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1449 | + $rs = Database::query($sql); |
|
1450 | + if (Database::num_rows($rs)>0) { |
|
1451 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1452 | 1452 | return api_convert_and_format_date( |
1453 | 1453 | $first_login_date, |
1454 | 1454 | DATE_FORMAT_SHORT, |
1455 | 1455 | date_default_timezone_get() |
1456 | 1456 | ); |
1457 | - } |
|
1458 | - } |
|
1457 | + } |
|
1458 | + } |
|
1459 | 1459 | |
1460 | - return false; |
|
1460 | + return false; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | /** |
@@ -1470,38 +1470,38 @@ discard block |
||
1470 | 1470 | */ |
1471 | 1471 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1472 | 1472 | { |
1473 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | - $sql = 'SELECT login_date |
|
1473 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | + $sql = 'SELECT login_date |
|
1475 | 1475 | FROM ' . $table . ' |
1476 | 1476 | WHERE login_user_id = ' . intval($student_id) . ' |
1477 | 1477 | ORDER BY login_date |
1478 | 1478 | DESC LIMIT 0,1'; |
1479 | 1479 | |
1480 | - $rs = Database::query($sql); |
|
1481 | - if (Database::num_rows($rs) > 0) { |
|
1482 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | - $last_login_date = api_get_local_time($last_login_date); |
|
1484 | - if ($return_timestamp) { |
|
1485 | - return api_strtotime($last_login_date,'UTC'); |
|
1486 | - } else { |
|
1487 | - if (!$warning_message) { |
|
1488 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | - } else { |
|
1490 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | - $currentTimestamp = time(); |
|
1492 | - |
|
1493 | - //If the last connection is > than 7 days, the text is red |
|
1494 | - //345600 = 7 days in seconds |
|
1495 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | - } else { |
|
1498 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | - } |
|
1500 | - } |
|
1501 | - } |
|
1502 | - } |
|
1503 | - } |
|
1504 | - return false; |
|
1480 | + $rs = Database::query($sql); |
|
1481 | + if (Database::num_rows($rs) > 0) { |
|
1482 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | + $last_login_date = api_get_local_time($last_login_date); |
|
1484 | + if ($return_timestamp) { |
|
1485 | + return api_strtotime($last_login_date,'UTC'); |
|
1486 | + } else { |
|
1487 | + if (!$warning_message) { |
|
1488 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | + } else { |
|
1490 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | + $currentTimestamp = time(); |
|
1492 | + |
|
1493 | + //If the last connection is > than 7 days, the text is red |
|
1494 | + //345600 = 7 days in seconds |
|
1495 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | + } else { |
|
1498 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | + } |
|
1500 | + } |
|
1501 | + } |
|
1502 | + } |
|
1503 | + } |
|
1504 | + return false; |
|
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | /** |
@@ -1555,30 +1555,30 @@ discard block |
||
1555 | 1555 | $session_id = 0, |
1556 | 1556 | $convert_date = true |
1557 | 1557 | ) { |
1558 | - $student_id = intval($student_id); |
|
1558 | + $student_id = intval($student_id); |
|
1559 | 1559 | $courseId = intval($courseId); |
1560 | - $session_id = intval($session_id); |
|
1560 | + $session_id = intval($session_id); |
|
1561 | 1561 | |
1562 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | - $sql = 'SELECT login_course_date |
|
1562 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | + $sql = 'SELECT login_course_date |
|
1564 | 1564 | FROM '.$tbl_track_login.' |
1565 | 1565 | WHERE |
1566 | 1566 | user_id = '.$student_id.' AND |
1567 | 1567 | c_id = '.$courseId.' AND |
1568 | 1568 | session_id = '.$session_id.' |
1569 | 1569 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1570 | - $rs = Database::query($sql); |
|
1571 | - if (Database::num_rows($rs) > 0) { |
|
1572 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | - if ($convert_date) { |
|
1574 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | - } else { |
|
1576 | - return $first_login_date; |
|
1577 | - } |
|
1578 | - } |
|
1579 | - } |
|
1580 | - |
|
1581 | - return false; |
|
1570 | + $rs = Database::query($sql); |
|
1571 | + if (Database::num_rows($rs) > 0) { |
|
1572 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | + if ($convert_date) { |
|
1574 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | + } else { |
|
1576 | + return $first_login_date; |
|
1577 | + } |
|
1578 | + } |
|
1579 | + } |
|
1580 | + |
|
1581 | + return false; |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | /** |
@@ -1594,13 +1594,13 @@ discard block |
||
1594 | 1594 | $session_id = 0, |
1595 | 1595 | $convert_date = true |
1596 | 1596 | ) { |
1597 | - // protect data |
|
1598 | - $student_id = intval($student_id); |
|
1597 | + // protect data |
|
1598 | + $student_id = intval($student_id); |
|
1599 | 1599 | $courseId = $courseInfo['real_id']; |
1600 | - $session_id = intval($session_id); |
|
1600 | + $session_id = intval($session_id); |
|
1601 | 1601 | |
1602 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | - $sql = 'SELECT access_date |
|
1602 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | + $sql = 'SELECT access_date |
|
1604 | 1604 | FROM '.$tbl_track_e_access.' |
1605 | 1605 | WHERE access_user_id = '.$student_id.' AND |
1606 | 1606 | c_id = "'.$courseId.'" AND |
@@ -1608,39 +1608,39 @@ discard block |
||
1608 | 1608 | ORDER BY access_date DESC |
1609 | 1609 | LIMIT 0,1'; |
1610 | 1610 | |
1611 | - $rs = Database::query($sql); |
|
1612 | - if (Database::num_rows($rs) > 0) { |
|
1613 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1611 | + $rs = Database::query($sql); |
|
1612 | + if (Database::num_rows($rs) > 0) { |
|
1613 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1614 | 1614 | if (empty($last_login_date)) { |
1615 | 1615 | return false; |
1616 | 1616 | } |
1617 | 1617 | //see #5736 |
1618 | 1618 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1619 | - $now = time(); |
|
1620 | - //If the last connection is > than 7 days, the text is red |
|
1621 | - //345600 = 7 days in seconds |
|
1622 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | - if ($convert_date) { |
|
1619 | + $now = time(); |
|
1620 | + //If the last connection is > than 7 days, the text is red |
|
1621 | + //345600 = 7 days in seconds |
|
1622 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | + if ($convert_date) { |
|
1624 | 1624 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1625 | 1625 | $icon = api_is_allowed_to_edit() ? |
1626 | 1626 | '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1627 | 1627 | '.Display::return_icon('messagebox_warning.gif').' |
1628 | 1628 | </a>' |
1629 | 1629 | : null; |
1630 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | - } else { |
|
1632 | - return $last_login_date; |
|
1633 | - } |
|
1634 | - } else { |
|
1635 | - if ($convert_date) { |
|
1636 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | - } else { |
|
1638 | - return $last_login_date; |
|
1639 | - } |
|
1640 | - } |
|
1641 | - } |
|
1642 | - } |
|
1643 | - return false; |
|
1630 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | + } else { |
|
1632 | + return $last_login_date; |
|
1633 | + } |
|
1634 | + } else { |
|
1635 | + if ($convert_date) { |
|
1636 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | + } else { |
|
1638 | + return $last_login_date; |
|
1639 | + } |
|
1640 | + } |
|
1641 | + } |
|
1642 | + } |
|
1643 | + return false; |
|
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | /** |
@@ -1653,36 +1653,36 @@ discard block |
||
1653 | 1653 | */ |
1654 | 1654 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1655 | 1655 | { |
1656 | - if ($start < 0) { |
|
1657 | - $start = 0; |
|
1658 | - } |
|
1659 | - if (!isset($stop) or ($stop < 0)) { |
|
1660 | - $stop = api_get_utc_datetime(); |
|
1661 | - } |
|
1656 | + if ($start < 0) { |
|
1657 | + $start = 0; |
|
1658 | + } |
|
1659 | + if (!isset($stop) or ($stop < 0)) { |
|
1660 | + $stop = api_get_utc_datetime(); |
|
1661 | + } |
|
1662 | 1662 | |
1663 | 1663 | $start = Database::escape_string($start); |
1664 | 1664 | $stop = Database::escape_string($stop); |
1665 | 1665 | |
1666 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1666 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1667 | 1667 | |
1668 | 1668 | $courseId = intval($courseId); |
1669 | - $session_id = intval($session_id); |
|
1670 | - $count = 0; |
|
1669 | + $session_id = intval($session_id); |
|
1670 | + $count = 0; |
|
1671 | 1671 | |
1672 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | - $sql = "SELECT count(*) as count_connections |
|
1672 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | + $sql = "SELECT count(*) as count_connections |
|
1674 | 1674 | FROM $tbl_track_e_course_access |
1675 | 1675 | WHERE |
1676 | 1676 | c_id = $courseId AND |
1677 | 1677 | session_id = $session_id |
1678 | 1678 | $month_filter"; |
1679 | - $rs = Database::query($sql); |
|
1680 | - if (Database::num_rows($rs)>0) { |
|
1681 | - $row = Database::fetch_object($rs); |
|
1682 | - $count = $row->count_connections; |
|
1683 | - } |
|
1679 | + $rs = Database::query($sql); |
|
1680 | + if (Database::num_rows($rs)>0) { |
|
1681 | + $row = Database::fetch_object($rs); |
|
1682 | + $count = $row->count_connections; |
|
1683 | + } |
|
1684 | 1684 | |
1685 | - return $count; |
|
1685 | + return $count; |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | /** |
@@ -1693,25 +1693,25 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public static function count_course_per_student($user_id, $include_sessions = true) |
1695 | 1695 | { |
1696 | - $user_id = intval($user_id); |
|
1697 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1696 | + $user_id = intval($user_id); |
|
1697 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1699 | 1699 | |
1700 | - $sql = 'SELECT DISTINCT c_id |
|
1700 | + $sql = 'SELECT DISTINCT c_id |
|
1701 | 1701 | FROM ' . $tbl_course_rel_user . ' |
1702 | 1702 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1703 | - $rs = Database::query($sql); |
|
1704 | - $nb_courses = Database::num_rows($rs); |
|
1703 | + $rs = Database::query($sql); |
|
1704 | + $nb_courses = Database::num_rows($rs); |
|
1705 | 1705 | |
1706 | - if ($include_sessions) { |
|
1707 | - $sql = 'SELECT DISTINCT c_id |
|
1706 | + if ($include_sessions) { |
|
1707 | + $sql = 'SELECT DISTINCT c_id |
|
1708 | 1708 | FROM ' . $tbl_session_course_rel_user . ' |
1709 | 1709 | WHERE user_id = ' . $user_id; |
1710 | - $rs = Database::query($sql); |
|
1711 | - $nb_courses += Database::num_rows($rs); |
|
1712 | - } |
|
1710 | + $rs = Database::query($sql); |
|
1711 | + $nb_courses += Database::num_rows($rs); |
|
1712 | + } |
|
1713 | 1713 | |
1714 | - return $nb_courses; |
|
1714 | + return $nb_courses; |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1742,25 +1742,25 @@ discard block |
||
1742 | 1742 | $into_lp = 0 |
1743 | 1743 | ) { |
1744 | 1744 | $course_code = Database::escape_string($course_code); |
1745 | - $course_info = api_get_course_info($course_code); |
|
1746 | - if (!empty($course_info)) { |
|
1747 | - // table definition |
|
1748 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | - |
|
1751 | - // Compose a filter based on optional exercise given |
|
1752 | - $condition_quiz = ""; |
|
1753 | - if (!empty($exercise_id)) { |
|
1754 | - $exercise_id = intval($exercise_id); |
|
1755 | - $condition_quiz =" AND id = $exercise_id "; |
|
1756 | - } |
|
1757 | - |
|
1758 | - // Compose a filter based on optional session id given |
|
1759 | - $condition_session = ""; |
|
1760 | - if (isset($session_id)) { |
|
1761 | - $session_id = intval($session_id); |
|
1762 | - $condition_session = " AND session_id = $session_id "; |
|
1763 | - } |
|
1745 | + $course_info = api_get_course_info($course_code); |
|
1746 | + if (!empty($course_info)) { |
|
1747 | + // table definition |
|
1748 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | + |
|
1751 | + // Compose a filter based on optional exercise given |
|
1752 | + $condition_quiz = ""; |
|
1753 | + if (!empty($exercise_id)) { |
|
1754 | + $exercise_id = intval($exercise_id); |
|
1755 | + $condition_quiz =" AND id = $exercise_id "; |
|
1756 | + } |
|
1757 | + |
|
1758 | + // Compose a filter based on optional session id given |
|
1759 | + $condition_session = ""; |
|
1760 | + if (isset($session_id)) { |
|
1761 | + $session_id = intval($session_id); |
|
1762 | + $condition_session = " AND session_id = $session_id "; |
|
1763 | + } |
|
1764 | 1764 | if ($active_filter == 1) { |
1765 | 1765 | $condition_active = 'AND active <> -1'; |
1766 | 1766 | } elseif ($active_filter == 0) { |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | $select_lp_id = ', orig_lp_id as lp_id '; |
1777 | 1777 | } |
1778 | 1778 | |
1779 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1779 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1780 | 1780 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1781 | 1781 | $count_quiz = 0; |
1782 | 1782 | $countQuizResult = Database::query($sql); |
@@ -1784,21 +1784,21 @@ discard block |
||
1784 | 1784 | $count_quiz = Database::fetch_row($countQuizResult); |
1785 | 1785 | } |
1786 | 1786 | |
1787 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | - if (is_array($student_id)) { |
|
1787 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | + if (is_array($student_id)) { |
|
1789 | 1789 | $student_id = array_map('intval', $student_id); |
1790 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | - } else { |
|
1790 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | + } else { |
|
1792 | 1792 | $student_id = intval($student_id); |
1793 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | - } |
|
1793 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | + } |
|
1795 | 1795 | |
1796 | - if (empty($exercise_id)) { |
|
1797 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1796 | + if (empty($exercise_id)) { |
|
1797 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1798 | 1798 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1799 | 1799 | $result = Database::query($sql); |
1800 | 1800 | $exercise_list = array(); |
1801 | - $exercise_id = null; |
|
1801 | + $exercise_id = null; |
|
1802 | 1802 | if (!empty($result) && Database::num_rows($result)) { |
1803 | 1803 | while ($row = Database::fetch_array($result)) { |
1804 | 1804 | $exercise_list[] = $row['id']; |
@@ -1807,11 +1807,11 @@ discard block |
||
1807 | 1807 | if (!empty($exercise_list)) { |
1808 | 1808 | $exercise_id = implode("','",$exercise_list); |
1809 | 1809 | } |
1810 | - } |
|
1810 | + } |
|
1811 | 1811 | |
1812 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1812 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1813 | 1813 | |
1814 | - $sql = "SELECT |
|
1814 | + $sql = "SELECT |
|
1815 | 1815 | SUM(exe_result/exe_weighting*100) as avg_score, |
1816 | 1816 | COUNT(*) as num_attempts |
1817 | 1817 | $select_lp_id |
@@ -1825,20 +1825,20 @@ discard block |
||
1825 | 1825 | $condition_into_lp |
1826 | 1826 | ORDER BY exe_date DESC"; |
1827 | 1827 | |
1828 | - $res = Database::query($sql); |
|
1829 | - $row = Database::fetch_array($res); |
|
1830 | - $quiz_avg_score = null; |
|
1828 | + $res = Database::query($sql); |
|
1829 | + $row = Database::fetch_array($res); |
|
1830 | + $quiz_avg_score = null; |
|
1831 | 1831 | |
1832 | - if (!empty($row['avg_score'])) { |
|
1833 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | - } |
|
1832 | + if (!empty($row['avg_score'])) { |
|
1833 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | + } |
|
1835 | 1835 | |
1836 | - if(!empty($row['num_attempts'])) { |
|
1837 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | - } |
|
1839 | - if (is_array($student_id)) { |
|
1840 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | - } |
|
1836 | + if(!empty($row['num_attempts'])) { |
|
1837 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | + } |
|
1839 | + if (is_array($student_id)) { |
|
1840 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | + } |
|
1842 | 1842 | if ($into_lp == 0) { |
1843 | 1843 | return $quiz_avg_score; |
1844 | 1844 | } else { |
@@ -1861,9 +1861,9 @@ discard block |
||
1861 | 1861 | return array($quiz_avg_score, null); |
1862 | 1862 | } |
1863 | 1863 | } |
1864 | - } |
|
1865 | - } |
|
1866 | - return null; |
|
1864 | + } |
|
1865 | + } |
|
1866 | + return null; |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | /** |
@@ -1896,15 +1896,15 @@ discard block |
||
1896 | 1896 | $find_all_lp = 0 |
1897 | 1897 | ) { |
1898 | 1898 | $courseId = intval($courseId); |
1899 | - $student_id = intval($student_id); |
|
1900 | - $exercise_id = intval($exercise_id); |
|
1901 | - $session_id = intval($session_id); |
|
1899 | + $student_id = intval($student_id); |
|
1900 | + $exercise_id = intval($exercise_id); |
|
1901 | + $session_id = intval($session_id); |
|
1902 | 1902 | |
1903 | - $lp_id = intval($lp_id); |
|
1903 | + $lp_id = intval($lp_id); |
|
1904 | 1904 | $lp_item_id = intval($lp_item_id); |
1905 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1905 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1906 | 1906 | |
1907 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1907 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1908 | 1908 | WHERE ex.c_id = $courseId |
1909 | 1909 | AND ex.exe_exo_id = $exercise_id |
1910 | 1910 | AND status = '' |
@@ -1919,11 +1919,11 @@ discard block |
||
1919 | 1919 | AND orig_lp_item_id = $lp_item_id"; |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - $rs = Database::query($sql); |
|
1923 | - $row = Database::fetch_row($rs); |
|
1924 | - $count_attempts = $row[0]; |
|
1922 | + $rs = Database::query($sql); |
|
1923 | + $row = Database::fetch_row($rs); |
|
1924 | + $count_attempts = $row[0]; |
|
1925 | 1925 | |
1926 | - return $count_attempts; |
|
1926 | + return $count_attempts; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | /** |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | * @param int $user_id |
1934 | 1934 | * @param int $courseId |
1935 | 1935 | * @param int $session_id |
1936 | - */ |
|
1936 | + */ |
|
1937 | 1937 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1938 | 1938 | { |
1939 | 1939 | $courseId = intval($courseId); |
@@ -3597,8 +3597,8 @@ discard block |
||
3597 | 3597 | |
3598 | 3598 | $condition_session = ''; |
3599 | 3599 | if (isset($session_id)) { |
3600 | - $session_id = intval($session_id); |
|
3601 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3600 | + $session_id = intval($session_id); |
|
3601 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3602 | 3602 | } |
3603 | 3603 | |
3604 | 3604 | $groupId = intval($groupId); |
@@ -5503,9 +5503,9 @@ discard block |
||
5503 | 5503 | } |
5504 | 5504 | |
5505 | 5505 | /** |
5506 | - * @param FormValidator $form |
|
5507 | - * @return mixed |
|
5508 | - */ |
|
5506 | + * @param FormValidator $form |
|
5507 | + * @return mixed |
|
5508 | + */ |
|
5509 | 5509 | public static function setUserSearchForm($form) |
5510 | 5510 | { |
5511 | 5511 | global $_configuration; |
@@ -5785,26 +5785,26 @@ discard block |
||
5785 | 5785 | $session_id = api_get_session_id(); |
5786 | 5786 | $course_id = api_get_course_int_id(); |
5787 | 5787 | |
5788 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5788 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5790 | 5790 | |
5791 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5791 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5792 | 5792 | FROM $table_item_property track_resource, $table_user user |
5793 | 5793 | WHERE |
5794 | 5794 | track_resource.c_id = $course_id AND |
5795 | 5795 | track_resource.insert_user_id = user.user_id AND |
5796 | 5796 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5797 | 5797 | |
5798 | - if (isset($_GET['keyword'])) { |
|
5799 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | - $sql .= " AND ( |
|
5798 | + if (isset($_GET['keyword'])) { |
|
5799 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | + $sql .= " AND ( |
|
5801 | 5801 | user.username LIKE '%".$keyword."%' OR |
5802 | 5802 | lastedit_type LIKE '%".$keyword."%' OR |
5803 | 5803 | tool LIKE '%".$keyword."%' |
5804 | 5804 | )"; |
5805 | - } |
|
5805 | + } |
|
5806 | 5806 | |
5807 | - $sql .= " AND tool IN ( |
|
5807 | + $sql .= " AND tool IN ( |
|
5808 | 5808 | 'document', |
5809 | 5809 | 'learnpath', |
5810 | 5810 | 'quiz', |
@@ -5816,10 +5816,10 @@ discard block |
||
5816 | 5816 | 'thematic_advance', |
5817 | 5817 | 'thematic_plan' |
5818 | 5818 | )"; |
5819 | - $res = Database::query($sql); |
|
5820 | - $obj = Database::fetch_object($res); |
|
5819 | + $res = Database::query($sql); |
|
5820 | + $obj = Database::fetch_object($res); |
|
5821 | 5821 | |
5822 | - return $obj->total_number_of_items; |
|
5822 | + return $obj->total_number_of_items; |
|
5823 | 5823 | } |
5824 | 5824 | |
5825 | 5825 | /** |
@@ -5834,12 +5834,12 @@ discard block |
||
5834 | 5834 | $session_id = api_get_session_id(); |
5835 | 5835 | $course_id = api_get_course_int_id(); |
5836 | 5836 | |
5837 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | - $session_id = intval($session_id); |
|
5837 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | + $session_id = intval($session_id); |
|
5841 | 5841 | |
5842 | - $sql = "SELECT |
|
5842 | + $sql = "SELECT |
|
5843 | 5843 | tool as col0, |
5844 | 5844 | lastedit_type as col1, |
5845 | 5845 | ref as ref, |
@@ -5853,16 +5853,16 @@ discard block |
||
5853 | 5853 | track_resource.insert_user_id = user.user_id AND |
5854 | 5854 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5855 | 5855 | |
5856 | - if (isset($_GET['keyword'])) { |
|
5857 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | - $sql .= " AND ( |
|
5856 | + if (isset($_GET['keyword'])) { |
|
5857 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | + $sql .= " AND ( |
|
5859 | 5859 | user.username LIKE '%".$keyword."%' OR |
5860 | 5860 | lastedit_type LIKE '%".$keyword."%' OR |
5861 | 5861 | tool LIKE '%".$keyword."%' |
5862 | 5862 | ) "; |
5863 | - } |
|
5863 | + } |
|
5864 | 5864 | |
5865 | - $sql .= " AND tool IN ( |
|
5865 | + $sql .= " AND tool IN ( |
|
5866 | 5866 | 'document', |
5867 | 5867 | 'learnpath', |
5868 | 5868 | 'quiz', |
@@ -5875,41 +5875,41 @@ discard block |
||
5875 | 5875 | 'thematic_plan' |
5876 | 5876 | )"; |
5877 | 5877 | |
5878 | - if ($column == 0) { |
|
5879 | - $column = '0'; |
|
5880 | - } |
|
5881 | - if ($column != '' && $direction != '') { |
|
5882 | - if ($column != 2 && $column != 4) { |
|
5883 | - $sql .= " ORDER BY col$column $direction"; |
|
5884 | - } |
|
5885 | - } else { |
|
5886 | - $sql .= " ORDER BY col5 DESC "; |
|
5887 | - } |
|
5878 | + if ($column == 0) { |
|
5879 | + $column = '0'; |
|
5880 | + } |
|
5881 | + if ($column != '' && $direction != '') { |
|
5882 | + if ($column != 2 && $column != 4) { |
|
5883 | + $sql .= " ORDER BY col$column $direction"; |
|
5884 | + } |
|
5885 | + } else { |
|
5886 | + $sql .= " ORDER BY col5 DESC "; |
|
5887 | + } |
|
5888 | 5888 | |
5889 | 5889 | $from = intval($from); |
5890 | 5890 | $number_of_items = intval($number_of_items); |
5891 | 5891 | |
5892 | - $sql .= " LIMIT $from, $number_of_items "; |
|
5893 | - |
|
5894 | - $res = Database::query($sql); |
|
5895 | - $resources = array(); |
|
5896 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | - while ($row = Database::fetch_array($res)) { |
|
5898 | - $ref = $row['ref']; |
|
5899 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | - |
|
5902 | - $id = $table_name['id_tool']; |
|
5903 | - $recorset = false; |
|
5892 | + $sql .= " LIMIT $from, $number_of_items "; |
|
5904 | 5893 | |
5905 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | - $sql = "SELECT thematic_id FROM $table_tool |
|
5894 | + $res = Database::query($sql); |
|
5895 | + $resources = array(); |
|
5896 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | + while ($row = Database::fetch_array($res)) { |
|
5898 | + $ref = $row['ref']; |
|
5899 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | + |
|
5902 | + $id = $table_name['id_tool']; |
|
5903 | + $recorset = false; |
|
5904 | + |
|
5905 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | + $sql = "SELECT thematic_id FROM $table_tool |
|
5908 | 5908 | WHERE c_id = $course_id AND id = $ref"; |
5909 | - $rs_thematic = Database::query($sql); |
|
5910 | - if (Database::num_rows($rs_thematic)) { |
|
5911 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | - $thematic_id = $row_thematic['thematic_id']; |
|
5909 | + $rs_thematic = Database::query($sql); |
|
5910 | + if (Database::num_rows($rs_thematic)) { |
|
5911 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | + $thematic_id = $row_thematic['thematic_id']; |
|
5913 | 5913 | |
5914 | 5914 | $sql = "SELECT session.id, session.name, user.username |
5915 | 5915 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5918,9 +5918,9 @@ discard block |
||
5918 | 5918 | t.session_id = session.id AND |
5919 | 5919 | session.id_coach = user.user_id AND |
5920 | 5920 | t.id = $thematic_id"; |
5921 | - $recorset = Database::query($sql); |
|
5922 | - } |
|
5923 | - } else { |
|
5921 | + $recorset = Database::query($sql); |
|
5922 | + } |
|
5923 | + } else { |
|
5924 | 5924 | $sql = "SELECT session.id, session.name, user.username |
5925 | 5925 | FROM $table_tool tool, $table_session session, $table_user user |
5926 | 5926 | WHERE |
@@ -5928,127 +5928,127 @@ discard block |
||
5928 | 5928 | tool.session_id = session.id AND |
5929 | 5929 | session.id_coach = user.user_id AND |
5930 | 5930 | tool.$id = $ref"; |
5931 | - $recorset = Database::query($sql); |
|
5932 | - } |
|
5933 | - |
|
5934 | - if (!empty($recorset)) { |
|
5935 | - $obj = Database::fetch_object($recorset); |
|
5936 | - |
|
5937 | - $name_session = ''; |
|
5938 | - $coach_name = ''; |
|
5939 | - if (!empty($obj)) { |
|
5940 | - $name_session = $obj->name; |
|
5941 | - $coach_name = $obj->username; |
|
5942 | - } |
|
5943 | - |
|
5944 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | - $row[0] = ''; |
|
5946 | - if ($row['col6'] != 2) { |
|
5947 | - if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | - |
|
5949 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | - $thematic_tool_title = ''; |
|
5951 | - if (is_array($exp_thematic_tool)) { |
|
5952 | - foreach ($exp_thematic_tool as $exp) { |
|
5953 | - $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | - } |
|
5955 | - } else { |
|
5956 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | - } |
|
5958 | - |
|
5959 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | - } else { |
|
5961 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | - } |
|
5963 | - } else { |
|
5964 | - $row[0] = api_ucfirst($row['col0']); |
|
5965 | - } |
|
5966 | - $row[1] = get_lang($row[1]); |
|
5967 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | - $row[5] = ''; |
|
5969 | - //@todo Improve this code please |
|
5970 | - switch ($table_name['table_name']) { |
|
5971 | - case 'document' : |
|
5972 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5931 | + $recorset = Database::query($sql); |
|
5932 | + } |
|
5933 | + |
|
5934 | + if (!empty($recorset)) { |
|
5935 | + $obj = Database::fetch_object($recorset); |
|
5936 | + |
|
5937 | + $name_session = ''; |
|
5938 | + $coach_name = ''; |
|
5939 | + if (!empty($obj)) { |
|
5940 | + $name_session = $obj->name; |
|
5941 | + $coach_name = $obj->username; |
|
5942 | + } |
|
5943 | + |
|
5944 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | + $row[0] = ''; |
|
5946 | + if ($row['col6'] != 2) { |
|
5947 | + if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | + |
|
5949 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | + $thematic_tool_title = ''; |
|
5951 | + if (is_array($exp_thematic_tool)) { |
|
5952 | + foreach ($exp_thematic_tool as $exp) { |
|
5953 | + $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | + } |
|
5955 | + } else { |
|
5956 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | + } |
|
5958 | + |
|
5959 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | + } else { |
|
5961 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | + } |
|
5963 | + } else { |
|
5964 | + $row[0] = api_ucfirst($row['col0']); |
|
5965 | + } |
|
5966 | + $row[1] = get_lang($row[1]); |
|
5967 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | + $row[5] = ''; |
|
5969 | + //@todo Improve this code please |
|
5970 | + switch ($table_name['table_name']) { |
|
5971 | + case 'document' : |
|
5972 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5973 | 5973 | WHERE c_id = $course_id AND id = $ref"; |
5974 | - $rs_document = Database::query($sql); |
|
5975 | - $obj_document = Database::fetch_object($rs_document); |
|
5976 | - $row[5] = $obj_document->title; |
|
5974 | + $rs_document = Database::query($sql); |
|
5975 | + $obj_document = Database::fetch_object($rs_document); |
|
5976 | + $row[5] = $obj_document->title; |
|
5977 | 5977 | |
5978 | - break; |
|
5979 | - case 'announcement': |
|
5978 | + break; |
|
5979 | + case 'announcement': |
|
5980 | 5980 | $sql = "SELECT title FROM $table_tool |
5981 | 5981 | WHERE c_id = $course_id AND id = $ref"; |
5982 | - $rs_document = Database::query($sql); |
|
5983 | - $obj_document = Database::fetch_object($rs_document); |
|
5982 | + $rs_document = Database::query($sql); |
|
5983 | + $obj_document = Database::fetch_object($rs_document); |
|
5984 | 5984 | if ($obj_document) { |
5985 | 5985 | $row[5] = $obj_document->title; |
5986 | 5986 | } |
5987 | - break; |
|
5988 | - case 'glossary': |
|
5987 | + break; |
|
5988 | + case 'glossary': |
|
5989 | 5989 | $sql = "SELECT name FROM $table_tool |
5990 | 5990 | WHERE c_id = $course_id AND glossary_id = $ref"; |
5991 | - $rs_document = Database::query($sql); |
|
5992 | - $obj_document = Database::fetch_object($rs_document); |
|
5991 | + $rs_document = Database::query($sql); |
|
5992 | + $obj_document = Database::fetch_object($rs_document); |
|
5993 | 5993 | if ($obj_document) { |
5994 | 5994 | $row[5] = $obj_document->name; |
5995 | 5995 | } |
5996 | - break; |
|
5997 | - case 'lp': |
|
5996 | + break; |
|
5997 | + case 'lp': |
|
5998 | 5998 | $sql = "SELECT name |
5999 | 5999 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
6000 | - $rs_document = Database::query($sql); |
|
6001 | - $obj_document = Database::fetch_object($rs_document); |
|
6002 | - $row[5] = $obj_document->name; |
|
6003 | - break; |
|
6004 | - case 'quiz': |
|
6000 | + $rs_document = Database::query($sql); |
|
6001 | + $obj_document = Database::fetch_object($rs_document); |
|
6002 | + $row[5] = $obj_document->name; |
|
6003 | + break; |
|
6004 | + case 'quiz': |
|
6005 | 6005 | $sql = "SELECT title FROM $table_tool |
6006 | 6006 | WHERE c_id = $course_id AND id = $ref"; |
6007 | - $rs_document = Database::query($sql); |
|
6008 | - $obj_document = Database::fetch_object($rs_document); |
|
6007 | + $rs_document = Database::query($sql); |
|
6008 | + $obj_document = Database::fetch_object($rs_document); |
|
6009 | 6009 | if ($obj_document) { |
6010 | 6010 | $row[5] = $obj_document->title; |
6011 | 6011 | } |
6012 | - break; |
|
6013 | - case 'course_description': |
|
6012 | + break; |
|
6013 | + case 'course_description': |
|
6014 | 6014 | $sql = "SELECT title FROM $table_tool |
6015 | 6015 | WHERE c_id = $course_id AND id = $ref"; |
6016 | - $rs_document = Database::query($sql); |
|
6017 | - $obj_document = Database::fetch_object($rs_document); |
|
6016 | + $rs_document = Database::query($sql); |
|
6017 | + $obj_document = Database::fetch_object($rs_document); |
|
6018 | 6018 | if ($obj_document) { |
6019 | 6019 | $row[5] = $obj_document->title; |
6020 | 6020 | } |
6021 | - break; |
|
6022 | - case 'thematic': |
|
6023 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | - if (Database::num_rows($rs) > 0) { |
|
6025 | - $obj = Database::fetch_object($rs); |
|
6026 | - $row[5] = $obj->title; |
|
6027 | - } |
|
6028 | - break; |
|
6029 | - case 'thematic_advance': |
|
6030 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | - if (Database::num_rows($rs) > 0) { |
|
6032 | - $obj = Database::fetch_object($rs); |
|
6033 | - $row[5] = $obj->content; |
|
6034 | - } |
|
6035 | - break; |
|
6036 | - case 'thematic_plan': |
|
6037 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | - if (Database::num_rows($rs) > 0) { |
|
6039 | - $obj = Database::fetch_object($rs); |
|
6040 | - $row[5] = $obj->title; |
|
6041 | - } |
|
6042 | - break; |
|
6043 | - default: |
|
6044 | - break; |
|
6045 | - } |
|
6046 | - |
|
6047 | - $row2 = $name_session; |
|
6048 | - if (!empty($coach_name)) { |
|
6049 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | - } |
|
6051 | - $row[2] = $row2; |
|
6021 | + break; |
|
6022 | + case 'thematic': |
|
6023 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | + if (Database::num_rows($rs) > 0) { |
|
6025 | + $obj = Database::fetch_object($rs); |
|
6026 | + $row[5] = $obj->title; |
|
6027 | + } |
|
6028 | + break; |
|
6029 | + case 'thematic_advance': |
|
6030 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | + if (Database::num_rows($rs) > 0) { |
|
6032 | + $obj = Database::fetch_object($rs); |
|
6033 | + $row[5] = $obj->content; |
|
6034 | + } |
|
6035 | + break; |
|
6036 | + case 'thematic_plan': |
|
6037 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | + if (Database::num_rows($rs) > 0) { |
|
6039 | + $obj = Database::fetch_object($rs); |
|
6040 | + $row[5] = $obj->title; |
|
6041 | + } |
|
6042 | + break; |
|
6043 | + default: |
|
6044 | + break; |
|
6045 | + } |
|
6046 | + |
|
6047 | + $row2 = $name_session; |
|
6048 | + if (!empty($coach_name)) { |
|
6049 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | + } |
|
6051 | + $row[2] = $row2; |
|
6052 | 6052 | if (!empty($row['col3'])) { |
6053 | 6053 | $userInfo = api_get_user_info($row['user_id']); |
6054 | 6054 | |
@@ -6065,11 +6065,11 @@ discard block |
||
6065 | 6065 | $row[4] = $ip; |
6066 | 6066 | } |
6067 | 6067 | |
6068 | - $resources[] = $row; |
|
6069 | - } |
|
6070 | - } |
|
6068 | + $resources[] = $row; |
|
6069 | + } |
|
6070 | + } |
|
6071 | 6071 | |
6072 | - return $resources; |
|
6072 | + return $resources; |
|
6073 | 6073 | } |
6074 | 6074 | |
6075 | 6075 | /** |
@@ -6079,63 +6079,63 @@ discard block |
||
6079 | 6079 | */ |
6080 | 6080 | public static function get_tool_name_table($tool) |
6081 | 6081 | { |
6082 | - switch ($tool) { |
|
6083 | - case 'document': |
|
6084 | - $table_name = TABLE_DOCUMENT; |
|
6085 | - $link_tool = 'document/document.php'; |
|
6086 | - $id_tool = 'id'; |
|
6087 | - break; |
|
6088 | - case 'learnpath': |
|
6089 | - $table_name = TABLE_LP_MAIN; |
|
6090 | - $link_tool = 'lp/lp_controller.php'; |
|
6091 | - $id_tool = 'id'; |
|
6092 | - break; |
|
6093 | - case 'quiz': |
|
6094 | - $table_name = TABLE_QUIZ_TEST; |
|
6095 | - $link_tool = 'exercise/exercise.php'; |
|
6096 | - $id_tool = 'id'; |
|
6097 | - break; |
|
6098 | - case 'glossary': |
|
6099 | - $table_name = TABLE_GLOSSARY; |
|
6100 | - $link_tool = 'glossary/index.php'; |
|
6101 | - $id_tool = 'glossary_id'; |
|
6102 | - break; |
|
6103 | - case 'link': |
|
6104 | - $table_name = TABLE_LINK; |
|
6105 | - $link_tool = 'link/link.php'; |
|
6106 | - $id_tool = 'id'; |
|
6107 | - break; |
|
6108 | - case 'course_description': |
|
6109 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | - $link_tool = 'course_description/'; |
|
6111 | - $id_tool = 'id'; |
|
6112 | - break; |
|
6113 | - case 'announcement': |
|
6114 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | - $link_tool = 'announcements/announcements.php'; |
|
6116 | - $id_tool = 'id'; |
|
6117 | - break; |
|
6118 | - case 'thematic': |
|
6119 | - $table_name = TABLE_THEMATIC; |
|
6120 | - $link_tool = 'course_progress/index.php'; |
|
6121 | - $id_tool = 'id'; |
|
6122 | - break; |
|
6123 | - case 'thematic_advance': |
|
6124 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | - $link_tool = 'course_progress/index.php'; |
|
6126 | - $id_tool = 'id'; |
|
6127 | - break; |
|
6128 | - case 'thematic_plan': |
|
6129 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | - $link_tool = 'course_progress/index.php'; |
|
6131 | - $id_tool = 'id'; |
|
6132 | - break; |
|
6133 | - default: |
|
6134 | - $table_name = $tool; |
|
6135 | - break; |
|
6136 | - } |
|
6137 | - |
|
6138 | - return array( |
|
6082 | + switch ($tool) { |
|
6083 | + case 'document': |
|
6084 | + $table_name = TABLE_DOCUMENT; |
|
6085 | + $link_tool = 'document/document.php'; |
|
6086 | + $id_tool = 'id'; |
|
6087 | + break; |
|
6088 | + case 'learnpath': |
|
6089 | + $table_name = TABLE_LP_MAIN; |
|
6090 | + $link_tool = 'lp/lp_controller.php'; |
|
6091 | + $id_tool = 'id'; |
|
6092 | + break; |
|
6093 | + case 'quiz': |
|
6094 | + $table_name = TABLE_QUIZ_TEST; |
|
6095 | + $link_tool = 'exercise/exercise.php'; |
|
6096 | + $id_tool = 'id'; |
|
6097 | + break; |
|
6098 | + case 'glossary': |
|
6099 | + $table_name = TABLE_GLOSSARY; |
|
6100 | + $link_tool = 'glossary/index.php'; |
|
6101 | + $id_tool = 'glossary_id'; |
|
6102 | + break; |
|
6103 | + case 'link': |
|
6104 | + $table_name = TABLE_LINK; |
|
6105 | + $link_tool = 'link/link.php'; |
|
6106 | + $id_tool = 'id'; |
|
6107 | + break; |
|
6108 | + case 'course_description': |
|
6109 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | + $link_tool = 'course_description/'; |
|
6111 | + $id_tool = 'id'; |
|
6112 | + break; |
|
6113 | + case 'announcement': |
|
6114 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | + $link_tool = 'announcements/announcements.php'; |
|
6116 | + $id_tool = 'id'; |
|
6117 | + break; |
|
6118 | + case 'thematic': |
|
6119 | + $table_name = TABLE_THEMATIC; |
|
6120 | + $link_tool = 'course_progress/index.php'; |
|
6121 | + $id_tool = 'id'; |
|
6122 | + break; |
|
6123 | + case 'thematic_advance': |
|
6124 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | + $link_tool = 'course_progress/index.php'; |
|
6126 | + $id_tool = 'id'; |
|
6127 | + break; |
|
6128 | + case 'thematic_plan': |
|
6129 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | + $link_tool = 'course_progress/index.php'; |
|
6131 | + $id_tool = 'id'; |
|
6132 | + break; |
|
6133 | + default: |
|
6134 | + $table_name = $tool; |
|
6135 | + break; |
|
6136 | + } |
|
6137 | + |
|
6138 | + return array( |
|
6139 | 6139 | 'table_name' => $table_name, |
6140 | 6140 | 'link_tool' => $link_tool, |
6141 | 6141 | 'id_tool' => $id_tool |
@@ -6144,45 +6144,45 @@ discard block |
||
6144 | 6144 | |
6145 | 6145 | public static function display_additional_profile_fields() |
6146 | 6146 | { |
6147 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | - |
|
6150 | - // creating the form |
|
6151 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | - |
|
6153 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | - // the information the users have entered or selected. |
|
6155 | - $return .= '<select name="additional_profile_field">'; |
|
6156 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | - $extra_fields_to_show = 0; |
|
6158 | - foreach ($extra_fields as $key=>$field) { |
|
6159 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | - if ($field[6]==1 && $field[8] == 1) { |
|
6161 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | - $selected = 'selected="selected"'; |
|
6163 | - } else { |
|
6164 | - $selected = ''; |
|
6165 | - } |
|
6166 | - $extra_fields_to_show++; |
|
6167 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | - } |
|
6169 | - } |
|
6170 | - $return .= '</select>'; |
|
6171 | - |
|
6172 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | - foreach ($_GET as $key=>$value){ |
|
6174 | - if ($key <> 'additional_profile_field') { |
|
6175 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | - } |
|
6177 | - } |
|
6178 | - // the submit button |
|
6179 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | - $return .= '</form>'; |
|
6181 | - if ($extra_fields_to_show > 0) { |
|
6182 | - return $return; |
|
6183 | - } else { |
|
6184 | - return ''; |
|
6185 | - } |
|
6147 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | + |
|
6150 | + // creating the form |
|
6151 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | + |
|
6153 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | + // the information the users have entered or selected. |
|
6155 | + $return .= '<select name="additional_profile_field">'; |
|
6156 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | + $extra_fields_to_show = 0; |
|
6158 | + foreach ($extra_fields as $key=>$field) { |
|
6159 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | + if ($field[6]==1 && $field[8] == 1) { |
|
6161 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | + $selected = 'selected="selected"'; |
|
6163 | + } else { |
|
6164 | + $selected = ''; |
|
6165 | + } |
|
6166 | + $extra_fields_to_show++; |
|
6167 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | + } |
|
6169 | + } |
|
6170 | + $return .= '</select>'; |
|
6171 | + |
|
6172 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | + foreach ($_GET as $key=>$value){ |
|
6174 | + if ($key <> 'additional_profile_field') { |
|
6175 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | + } |
|
6177 | + } |
|
6178 | + // the submit button |
|
6179 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | + $return .= '</form>'; |
|
6181 | + if ($extra_fields_to_show > 0) { |
|
6182 | + return $return; |
|
6183 | + } else { |
|
6184 | + return ''; |
|
6185 | + } |
|
6186 | 6186 | } |
6187 | 6187 | |
6188 | 6188 | /** |
@@ -6201,31 +6201,31 @@ discard block |
||
6201 | 6201 | */ |
6202 | 6202 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6203 | 6203 | { |
6204 | - // Database table definition |
|
6205 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6204 | + // Database table definition |
|
6205 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6207 | 6207 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6208 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | - |
|
6210 | - if (!empty($users)) { |
|
6211 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | - foreach($users as $user_id) { |
|
6213 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | - $tag_list = array(); |
|
6215 | - foreach($user_result as $item) { |
|
6216 | - $tag_list[] = $item['tag']; |
|
6217 | - } |
|
6218 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | - } |
|
6220 | - } else { |
|
6221 | - $new_user_array = array(); |
|
6222 | - foreach ($users as $user_id) { |
|
6223 | - $new_user_array[]= "'".$user_id."'"; |
|
6224 | - } |
|
6225 | - $users = implode(',',$new_user_array); |
|
6208 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | + |
|
6210 | + if (!empty($users)) { |
|
6211 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | + foreach($users as $user_id) { |
|
6213 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | + $tag_list = array(); |
|
6215 | + foreach($user_result as $item) { |
|
6216 | + $tag_list[] = $item['tag']; |
|
6217 | + } |
|
6218 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | + } |
|
6220 | + } else { |
|
6221 | + $new_user_array = array(); |
|
6222 | + foreach ($users as $user_id) { |
|
6223 | + $new_user_array[]= "'".$user_id."'"; |
|
6224 | + } |
|
6225 | + $users = implode(',',$new_user_array); |
|
6226 | 6226 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6227 | - // Selecting only the necessary information NOT ALL the user list |
|
6228 | - $sql = "SELECT user.user_id, v.value |
|
6227 | + // Selecting only the necessary information NOT ALL the user list |
|
6228 | + $sql = "SELECT user.user_id, v.value |
|
6229 | 6229 | FROM $table_user user |
6230 | 6230 | INNER JOIN $table_user_field_values v |
6231 | 6231 | ON (user.user_id = v.item_id) |
@@ -6236,27 +6236,27 @@ discard block |
||
6236 | 6236 | v.field_id=".intval($field_id)." AND |
6237 | 6237 | user.user_id IN ($users)"; |
6238 | 6238 | |
6239 | - $result = Database::query($sql); |
|
6240 | - while($row = Database::fetch_array($result)) { |
|
6241 | - // get option value for field type double select by id |
|
6242 | - if (!empty($row['value'])) { |
|
6243 | - if ($result_extra_field['field_type'] == |
|
6239 | + $result = Database::query($sql); |
|
6240 | + while($row = Database::fetch_array($result)) { |
|
6241 | + // get option value for field type double select by id |
|
6242 | + if (!empty($row['value'])) { |
|
6243 | + if ($result_extra_field['field_type'] == |
|
6244 | 6244 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6245 | 6245 | ) { |
6246 | - $id_double_select = explode(';', $row['value']); |
|
6247 | - if (is_array($id_double_select)) { |
|
6248 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | - $row['value'] = ($value1.';'.$value2); |
|
6251 | - } |
|
6252 | - } |
|
6253 | - } |
|
6254 | - // get other value from extra field |
|
6255 | - $return[$row['user_id']][] = $row['value']; |
|
6256 | - } |
|
6257 | - } |
|
6258 | - } |
|
6259 | - return $return; |
|
6246 | + $id_double_select = explode(';', $row['value']); |
|
6247 | + if (is_array($id_double_select)) { |
|
6248 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | + $row['value'] = ($value1.';'.$value2); |
|
6251 | + } |
|
6252 | + } |
|
6253 | + } |
|
6254 | + // get other value from extra field |
|
6255 | + $return[$row['user_id']][] = $row['value']; |
|
6256 | + } |
|
6257 | + } |
|
6258 | + } |
|
6259 | + return $return; |
|
6260 | 6260 | } |
6261 | 6261 | |
6262 | 6262 | /** |
@@ -6265,18 +6265,18 @@ discard block |
||
6265 | 6265 | */ |
6266 | 6266 | public function count_student_in_course() |
6267 | 6267 | { |
6268 | - global $nbStudents; |
|
6269 | - return $nbStudents; |
|
6268 | + global $nbStudents; |
|
6269 | + return $nbStudents; |
|
6270 | 6270 | } |
6271 | 6271 | |
6272 | 6272 | public function sort_users($a, $b) |
6273 | 6273 | { |
6274 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6274 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | public function sort_users_desc($a, $b) |
6278 | 6278 | { |
6279 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6279 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6285,8 +6285,8 @@ discard block |
||
6285 | 6285 | */ |
6286 | 6286 | public static function get_number_of_users() |
6287 | 6287 | { |
6288 | - global $user_ids; |
|
6289 | - return count($user_ids); |
|
6288 | + global $user_ids; |
|
6289 | + return count($user_ids); |
|
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | /** |
@@ -6302,37 +6302,37 @@ discard block |
||
6302 | 6302 | { |
6303 | 6303 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6304 | 6304 | |
6305 | - $course_code = Database::escape_string($course_code); |
|
6306 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6305 | + $course_code = Database::escape_string($course_code); |
|
6306 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6308 | 6308 | |
6309 | - $access_url_id = api_get_current_access_url_id(); |
|
6309 | + $access_url_id = api_get_current_access_url_id(); |
|
6310 | 6310 | |
6311 | - // get all users data from a course for sortable with limit |
|
6312 | - if (is_array($user_ids)) { |
|
6313 | - $user_ids = array_map('intval', $user_ids); |
|
6314 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | - } else { |
|
6316 | - $user_ids = intval($user_ids); |
|
6317 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | - } |
|
6311 | + // get all users data from a course for sortable with limit |
|
6312 | + if (is_array($user_ids)) { |
|
6313 | + $user_ids = array_map('intval', $user_ids); |
|
6314 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | + } else { |
|
6316 | + $user_ids = intval($user_ids); |
|
6317 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | + } |
|
6319 | 6319 | |
6320 | - if (!empty($_GET['user_keyword'])) { |
|
6321 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | - $condition_user .= " AND ( |
|
6320 | + if (!empty($_GET['user_keyword'])) { |
|
6321 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | + $condition_user .= " AND ( |
|
6323 | 6323 | user.firstname LIKE '%".$keyword."%' OR |
6324 | 6324 | user.lastname LIKE '%".$keyword."%' OR |
6325 | 6325 | user.username LIKE '%".$keyword."%' OR |
6326 | 6326 | user.email LIKE '%".$keyword."%' |
6327 | 6327 | ) "; |
6328 | - } |
|
6328 | + } |
|
6329 | 6329 | |
6330 | 6330 | $url_table = null; |
6331 | 6331 | $url_condition = null; |
6332 | - if (api_is_multiple_url_enabled()) { |
|
6333 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | - } |
|
6332 | + if (api_is_multiple_url_enabled()) { |
|
6333 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | + } |
|
6336 | 6336 | |
6337 | 6337 | $invitedUsersCondition = ''; |
6338 | 6338 | |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6341 | 6341 | } |
6342 | 6342 | |
6343 | - $sql = "SELECT user.user_id as user_id, |
|
6343 | + $sql = "SELECT user.user_id as user_id, |
|
6344 | 6344 | user.official_code as col0, |
6345 | 6345 | user.lastname as col1, |
6346 | 6346 | user.firstname as col2, |
@@ -6348,17 +6348,17 @@ discard block |
||
6348 | 6348 | FROM $tbl_user as user $url_table |
6349 | 6349 | $condition_user $url_condition $invitedUsersCondition"; |
6350 | 6350 | |
6351 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | - $direction = 'ASC'; |
|
6353 | - } |
|
6351 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | + $direction = 'ASC'; |
|
6353 | + } |
|
6354 | 6354 | |
6355 | - $column = intval($column); |
|
6355 | + $column = intval($column); |
|
6356 | 6356 | |
6357 | - $from = intval($from); |
|
6358 | - $number_of_items = intval($number_of_items); |
|
6357 | + $from = intval($from); |
|
6358 | + $number_of_items = intval($number_of_items); |
|
6359 | 6359 | |
6360 | - $sql .= " ORDER BY col$column $direction "; |
|
6361 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6360 | + $sql .= " ORDER BY col$column $direction "; |
|
6361 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6362 | 6362 | |
6363 | 6363 | $res = Database::query($sql); |
6364 | 6364 | $users = array(); |
@@ -6392,7 +6392,7 @@ discard block |
||
6392 | 6392 | } |
6393 | 6393 | } |
6394 | 6394 | |
6395 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6395 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6396 | 6396 | $courseInfo = api_get_course_info($course_code); |
6397 | 6397 | $courseId = $courseInfo['real_id']; |
6398 | 6398 | |
@@ -6423,10 +6423,10 @@ discard block |
||
6423 | 6423 | $session_id |
6424 | 6424 | ); |
6425 | 6425 | |
6426 | - if (empty($avg_student_progress)) { |
|
6426 | + if (empty($avg_student_progress)) { |
|
6427 | 6427 | $avg_student_progress = 0; |
6428 | - } |
|
6429 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6428 | + } |
|
6429 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6430 | 6430 | |
6431 | 6431 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6432 | 6432 | $total_exercises, |
@@ -6446,11 +6446,11 @@ discard block |
||
6446 | 6446 | |
6447 | 6447 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6448 | 6448 | |
6449 | - if (is_numeric($avg_student_score)) { |
|
6450 | - $user['student_score'] = $avg_student_score.'%'; |
|
6451 | - } else { |
|
6452 | - $user['student_score'] = $avg_student_score; |
|
6453 | - } |
|
6449 | + if (is_numeric($avg_student_score)) { |
|
6450 | + $user['student_score'] = $avg_student_score.'%'; |
|
6451 | + } else { |
|
6452 | + $user['student_score'] = $avg_student_score; |
|
6453 | + } |
|
6454 | 6454 | |
6455 | 6455 | $user['count_assignments'] = Tracking::count_student_assignments( |
6456 | 6456 | $user['user_id'], |
@@ -6473,29 +6473,29 @@ discard block |
||
6473 | 6473 | $session_id |
6474 | 6474 | ); |
6475 | 6475 | |
6476 | - // we need to display an additional profile field |
|
6477 | - $user['additional'] = ''; |
|
6476 | + // we need to display an additional profile field |
|
6477 | + $user['additional'] = ''; |
|
6478 | 6478 | |
6479 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6479 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6481 | 6481 | is_array($additional_user_profile_info[$user['user_id']]) |
6482 | 6482 | ) { |
6483 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | - } |
|
6485 | - } |
|
6483 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | + } |
|
6485 | + } |
|
6486 | 6486 | |
6487 | 6487 | if (empty($session_id)) { |
6488 | 6488 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6489 | 6489 | } |
6490 | 6490 | |
6491 | - $user['link'] = '<center> |
|
6491 | + $user['link'] = '<center> |
|
6492 | 6492 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6493 | 6493 | '.Display::return_icon('2rightarrow.png').' |
6494 | 6494 | </a> |
6495 | 6495 | </center>'; |
6496 | 6496 | |
6497 | - // store columns in array $users |
|
6498 | - $is_western_name_order = api_is_western_name_order(); |
|
6497 | + // store columns in array $users |
|
6498 | + $is_western_name_order = api_is_western_name_order(); |
|
6499 | 6499 | $user_row = array(); |
6500 | 6500 | $user_row[]= $user['official_code']; //0 |
6501 | 6501 | if ($is_western_name_order) { |
@@ -6531,21 +6531,21 @@ discard block |
||
6531 | 6531 | |
6532 | 6532 | $users[] = $user_row; |
6533 | 6533 | |
6534 | - if ($export_csv) { |
|
6535 | - if (empty($session_id)) { |
|
6534 | + if ($export_csv) { |
|
6535 | + if (empty($session_id)) { |
|
6536 | 6536 | $user_row = array_map('strip_tags', $user_row); |
6537 | - unset($user_row[14]); |
|
6538 | - unset($user_row[15]); |
|
6537 | + unset($user_row[14]); |
|
6538 | + unset($user_row[15]); |
|
6539 | 6539 | } else { |
6540 | 6540 | $user_row = array_map('strip_tags', $user_row); |
6541 | 6541 | unset($user_row[13]); |
6542 | 6542 | unset($user_row[14]); |
6543 | 6543 | } |
6544 | 6544 | |
6545 | - $csv_content[] = $user_row; |
|
6546 | - } |
|
6547 | - } |
|
6548 | - return $users; |
|
6545 | + $csv_content[] = $user_row; |
|
6546 | + } |
|
6547 | + } |
|
6548 | + return $users; |
|
6549 | 6549 | } |
6550 | 6550 | } |
6551 | 6551 | |
@@ -6563,18 +6563,18 @@ discard block |
||
6563 | 6563 | */ |
6564 | 6564 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6565 | 6565 | { |
6566 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | - |
|
6568 | - // protected data |
|
6569 | - $user_id = intval($user_id); |
|
6570 | - $session_id = intval($session_id); |
|
6571 | - $course_id = Database::escape_string($course_id); |
|
6572 | - |
|
6573 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | - $tempView = $view; |
|
6575 | - if(substr($view,0,1) == '1') { |
|
6576 | - $new_view = substr_replace($view,'0',0,1); |
|
6577 | - echo " |
|
6566 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | + |
|
6568 | + // protected data |
|
6569 | + $user_id = intval($user_id); |
|
6570 | + $session_id = intval($session_id); |
|
6571 | + $course_id = Database::escape_string($course_id); |
|
6572 | + |
|
6573 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | + $tempView = $view; |
|
6575 | + if(substr($view,0,1) == '1') { |
|
6576 | + $new_view = substr_replace($view,'0',0,1); |
|
6577 | + echo " |
|
6578 | 6578 | <tr> |
6579 | 6579 | <td valign='top'> |
6580 | 6580 | <font color='#0000FF'>- </font>" . |
@@ -6582,9 +6582,9 @@ discard block |
||
6582 | 6582 | </td> |
6583 | 6583 | </tr> |
6584 | 6584 | "; |
6585 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6585 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6586 | 6586 | |
6587 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6587 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6588 | 6588 | FROM $track_access_table |
6589 | 6589 | WHERE access_user_id = $user_id |
6590 | 6590 | AND c_id = $course_id |
@@ -6592,11 +6592,11 @@ discard block |
||
6592 | 6592 | GROUP BY YEAR(access_date),MONTH(access_date) |
6593 | 6593 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6594 | 6594 | |
6595 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | - $results = getManyResults3Col($sql); |
|
6595 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | + $results = getManyResults3Col($sql); |
|
6597 | 6597 | |
6598 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | - echo "<tr> |
|
6598 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | + echo "<tr> |
|
6600 | 6600 | <td class='secLine'> |
6601 | 6601 | ".get_lang('LoginsTitleMonthColumn')." |
6602 | 6602 | </td> |
@@ -6604,36 +6604,36 @@ discard block |
||
6604 | 6604 | ".get_lang('LoginsTitleCountColumn')." |
6605 | 6605 | </td> |
6606 | 6606 | </tr>"; |
6607 | - $total = 0; |
|
6608 | - if (is_array($results)) { |
|
6609 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | - echo "<tr>"; |
|
6611 | - 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>"; |
|
6612 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | - echo"</tr>"; |
|
6614 | - $total = $total + $results[$j][1]; |
|
6615 | - } |
|
6616 | - echo "<tr>"; |
|
6617 | - echo "<td>".get_lang('Total')."</td>"; |
|
6618 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | - echo"</tr>"; |
|
6620 | - } else { |
|
6621 | - echo "<tr>"; |
|
6622 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | - echo"</tr>"; |
|
6624 | - } |
|
6625 | - echo "</table>"; |
|
6626 | - echo "</td></tr>"; |
|
6627 | - } else { |
|
6628 | - $new_view = substr_replace($view,'1',0,1); |
|
6629 | - echo " |
|
6607 | + $total = 0; |
|
6608 | + if (is_array($results)) { |
|
6609 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | + echo "<tr>"; |
|
6611 | + 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>"; |
|
6612 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | + echo"</tr>"; |
|
6614 | + $total = $total + $results[$j][1]; |
|
6615 | + } |
|
6616 | + echo "<tr>"; |
|
6617 | + echo "<td>".get_lang('Total')."</td>"; |
|
6618 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | + echo"</tr>"; |
|
6620 | + } else { |
|
6621 | + echo "<tr>"; |
|
6622 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | + echo"</tr>"; |
|
6624 | + } |
|
6625 | + echo "</table>"; |
|
6626 | + echo "</td></tr>"; |
|
6627 | + } else { |
|
6628 | + $new_view = substr_replace($view,'1',0,1); |
|
6629 | + echo " |
|
6630 | 6630 | <tr> |
6631 | 6631 | <td valign='top'> |
6632 | 6632 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6633 | 6633 | </td> |
6634 | 6634 | </tr> |
6635 | 6635 | "; |
6636 | - } |
|
6636 | + } |
|
6637 | 6637 | } |
6638 | 6638 | |
6639 | 6639 | /** |
@@ -6646,38 +6646,38 @@ discard block |
||
6646 | 6646 | */ |
6647 | 6647 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
6648 | 6648 | { |
6649 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6649 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6650 | 6650 | $courseId = api_get_course_int_id($courseCode); |
6651 | - if(substr($view,1,1) == '1') { |
|
6652 | - $new_view = substr_replace($view,'0',1,1); |
|
6653 | - echo "<tr> |
|
6651 | + if(substr($view,1,1) == '1') { |
|
6652 | + $new_view = substr_replace($view,'0',1,1); |
|
6653 | + echo "<tr> |
|
6654 | 6654 | <td valign='top'> |
6655 | 6655 | <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>] |
6656 | 6656 | </td> |
6657 | 6657 | </tr>"; |
6658 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6658 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6659 | 6659 | |
6660 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6660 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6661 | 6661 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6662 | 6662 | WHERE te.c_id = $courseId |
6663 | 6663 | AND te.exe_user_id = ".intval($user_id)." |
6664 | 6664 | AND te.exe_exo_id = ce.id |
6665 | 6665 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6666 | 6666 | |
6667 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6667 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6668 | 6668 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6669 | 6669 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6670 | 6670 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6671 | 6671 | |
6672 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6672 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6673 | 6673 | |
6674 | - $NoTestRes = 0; |
|
6675 | - $NoHPTestRes = 0; |
|
6674 | + $NoTestRes = 0; |
|
6675 | + $NoHPTestRes = 0; |
|
6676 | 6676 | |
6677 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | - echo " |
|
6677 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | + echo " |
|
6681 | 6681 | <tr bgcolor='#E6E6E6'> |
6682 | 6682 | <td> |
6683 | 6683 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6690,28 +6690,28 @@ discard block |
||
6690 | 6690 | </td> |
6691 | 6691 | </tr>"; |
6692 | 6692 | |
6693 | - if (is_array($results)) { |
|
6694 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | - echo "<tr>\n"; |
|
6697 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | - echo "</tr>\n"; |
|
6701 | - } |
|
6702 | - } else { |
|
6703 | - // istvan begin |
|
6704 | - $NoTestRes = 1; |
|
6705 | - } |
|
6706 | - |
|
6707 | - // The Result of Tests |
|
6708 | - if (is_array($hpresults)) { |
|
6709 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | - if ($title == '') |
|
6712 | - $title = basename($hpresults[$i][0]); |
|
6713 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | - ?> |
|
6693 | + if (is_array($results)) { |
|
6694 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | + echo "<tr>\n"; |
|
6697 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | + echo "</tr>\n"; |
|
6701 | + } |
|
6702 | + } else { |
|
6703 | + // istvan begin |
|
6704 | + $NoTestRes = 1; |
|
6705 | + } |
|
6706 | + |
|
6707 | + // The Result of Tests |
|
6708 | + if (is_array($hpresults)) { |
|
6709 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | + if ($title == '') |
|
6712 | + $title = basename($hpresults[$i][0]); |
|
6713 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | + ?> |
|
6715 | 6715 | <tr> |
6716 | 6716 | <td class="content"><?php echo $title; ?></td> |
6717 | 6717 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6721,26 +6721,26 @@ discard block |
||
6721 | 6721 | |
6722 | 6722 | <?php |
6723 | 6723 | } |
6724 | - } else { |
|
6725 | - $NoHPTestRes = 1; |
|
6726 | - } |
|
6727 | - |
|
6728 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | - echo "<tr>\n"; |
|
6730 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | - echo "</tr>\n"; |
|
6732 | - } |
|
6733 | - echo "</table>"; |
|
6734 | - echo "</td>\n</tr>\n"; |
|
6735 | - } else { |
|
6736 | - $new_view = substr_replace($view,'1',1,1); |
|
6737 | - echo " |
|
6724 | + } else { |
|
6725 | + $NoHPTestRes = 1; |
|
6726 | + } |
|
6727 | + |
|
6728 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | + echo "<tr>\n"; |
|
6730 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | + echo "</tr>\n"; |
|
6732 | + } |
|
6733 | + echo "</table>"; |
|
6734 | + echo "</td>\n</tr>\n"; |
|
6735 | + } else { |
|
6736 | + $new_view = substr_replace($view,'1',1,1); |
|
6737 | + echo " |
|
6738 | 6738 | <tr> |
6739 | 6739 | <td valign='top'> |
6740 | 6740 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6741 | 6741 | </td> |
6742 | 6742 | </tr>"; |
6743 | - } |
|
6743 | + } |
|
6744 | 6744 | } |
6745 | 6745 | |
6746 | 6746 | /** |
@@ -6749,27 +6749,27 @@ discard block |
||
6749 | 6749 | */ |
6750 | 6750 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
6751 | 6751 | { |
6752 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6752 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6753 | 6753 | $_course = api_get_course_info_by_id($course_id); |
6754 | 6754 | |
6755 | - if (substr($view,2,1) == '1') { |
|
6756 | - $new_view = substr_replace($view,'0',2,1); |
|
6757 | - echo "<tr> |
|
6755 | + if (substr($view,2,1) == '1') { |
|
6756 | + $new_view = substr_replace($view,'0',2,1); |
|
6757 | + echo "<tr> |
|
6758 | 6758 | <td valign='top'> |
6759 | 6759 | <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>] |
6760 | 6760 | </td> |
6761 | 6761 | </tr>"; |
6762 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6762 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6764 | 6764 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6765 | 6765 | WHERE u.upload_work_id = w.id |
6766 | 6766 | AND u.upload_user_id = '".intval($user_id)."' |
6767 | 6767 | AND u.c_id = '".intval($course_id)."' |
6768 | 6768 | ORDER BY u.upload_date DESC"; |
6769 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | - echo "<tr> |
|
6769 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | + echo "<tr> |
|
6773 | 6773 | <td class='secLine' width='40%'> |
6774 | 6774 | ".get_lang('WorkTitle')." |
6775 | 6775 | </td> |
@@ -6780,35 +6780,35 @@ discard block |
||
6780 | 6780 | ".get_lang('Date')." |
6781 | 6781 | </td> |
6782 | 6782 | </tr>"; |
6783 | - if (is_array($results)) { |
|
6784 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | - echo "<tr>"; |
|
6788 | - echo "<td class='content'>" |
|
6789 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | - ."</td>"; |
|
6791 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | - echo"</tr>"; |
|
6794 | - } |
|
6795 | - } else { |
|
6796 | - echo "<tr>"; |
|
6797 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | - echo"</tr>"; |
|
6799 | - } |
|
6800 | - echo "</table>"; |
|
6801 | - echo "</td></tr>"; |
|
6802 | - } else { |
|
6803 | - $new_view = substr_replace($view,'1',2,1); |
|
6804 | - echo " |
|
6783 | + if (is_array($results)) { |
|
6784 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | + echo "<tr>"; |
|
6788 | + echo "<td class='content'>" |
|
6789 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | + ."</td>"; |
|
6791 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | + echo"</tr>"; |
|
6794 | + } |
|
6795 | + } else { |
|
6796 | + echo "<tr>"; |
|
6797 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | + echo"</tr>"; |
|
6799 | + } |
|
6800 | + echo "</table>"; |
|
6801 | + echo "</td></tr>"; |
|
6802 | + } else { |
|
6803 | + $new_view = substr_replace($view,'1',2,1); |
|
6804 | + echo " |
|
6805 | 6805 | <tr> |
6806 | 6806 | <td valign='top'> |
6807 | 6807 | +<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> |
6808 | 6808 | </td> |
6809 | 6809 | </tr> |
6810 | 6810 | "; |
6811 | - } |
|
6811 | + } |
|
6812 | 6812 | } |
6813 | 6813 | |
6814 | 6814 | /** |
@@ -6817,55 +6817,55 @@ discard block |
||
6817 | 6817 | */ |
6818 | 6818 | public function display_links_tracking_info($view, $user_id, $courseCode) |
6819 | 6819 | { |
6820 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6820 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6821 | 6821 | $courseId = api_get_course_int_id($courseCode); |
6822 | - if (substr($view,3,1) == '1') { |
|
6823 | - $new_view = substr_replace($view,'0',3,1); |
|
6824 | - echo " |
|
6822 | + if (substr($view,3,1) == '1') { |
|
6823 | + $new_view = substr_replace($view,'0',3,1); |
|
6824 | + echo " |
|
6825 | 6825 | <tr> |
6826 | 6826 | <td valign='top'> |
6827 | 6827 | <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>] |
6828 | 6828 | </td> |
6829 | 6829 | </tr> |
6830 | 6830 | "; |
6831 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | - $sql = "SELECT cl.title, cl.url |
|
6831 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | + $sql = "SELECT cl.title, cl.url |
|
6833 | 6833 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
6834 | 6834 | WHERE sl.links_link_id = cl.id |
6835 | 6835 | AND sl.c_id = $courseId |
6836 | 6836 | AND sl.links_user_id = ".intval($user_id)." |
6837 | 6837 | GROUP BY cl.title, cl.url"; |
6838 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | - $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | - echo "<tr> |
|
6838 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | + $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | + echo "<tr> |
|
6842 | 6842 | <td class='secLine'> |
6843 | 6843 | ".get_lang('LinksTitleLinkColumn')." |
6844 | 6844 | </td> |
6845 | 6845 | </tr>"; |
6846 | - if (is_array($results)) { |
|
6847 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | - echo "<tr>"; |
|
6849 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | - echo"</tr>"; |
|
6851 | - } |
|
6852 | - } else { |
|
6853 | - echo "<tr>"; |
|
6854 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | - echo"</tr>"; |
|
6856 | - } |
|
6857 | - echo "</table>"; |
|
6858 | - echo "</td></tr>"; |
|
6859 | - } else { |
|
6860 | - $new_view = substr_replace($view,'1',3,1); |
|
6861 | - echo " |
|
6846 | + if (is_array($results)) { |
|
6847 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | + echo "<tr>"; |
|
6849 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | + echo"</tr>"; |
|
6851 | + } |
|
6852 | + } else { |
|
6853 | + echo "<tr>"; |
|
6854 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | + echo"</tr>"; |
|
6856 | + } |
|
6857 | + echo "</table>"; |
|
6858 | + echo "</td></tr>"; |
|
6859 | + } else { |
|
6860 | + $new_view = substr_replace($view,'1',3,1); |
|
6861 | + echo " |
|
6862 | 6862 | <tr> |
6863 | 6863 | <td valign='top'> |
6864 | 6864 | +<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> |
6865 | 6865 | </td> |
6866 | 6866 | </tr> |
6867 | 6867 | "; |
6868 | - } |
|
6868 | + } |
|
6869 | 6869 | } |
6870 | 6870 | |
6871 | 6871 | /** |
@@ -6878,61 +6878,61 @@ discard block |
||
6878 | 6878 | */ |
6879 | 6879 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
6880 | 6880 | { |
6881 | - // protect data |
|
6881 | + // protect data |
|
6882 | 6882 | $user_id = intval($user_id); |
6883 | 6883 | $courseId = api_get_course_int_id($course_code); |
6884 | - $session_id = intval($session_id); |
|
6884 | + $session_id = intval($session_id); |
|
6885 | 6885 | |
6886 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | - if(substr($view,4,1) == '1') { |
|
6888 | - $new_view = substr_replace($view,'0',4,1); |
|
6889 | - echo " |
|
6886 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | + if(substr($view,4,1) == '1') { |
|
6888 | + $new_view = substr_replace($view,'0',4,1); |
|
6889 | + echo " |
|
6890 | 6890 | <tr> |
6891 | 6891 | <td valign='top'> |
6892 | 6892 | <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>] |
6893 | 6893 | </td> |
6894 | 6894 | </tr> |
6895 | 6895 | "; |
6896 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6896 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6897 | 6897 | |
6898 | - $sql = "SELECT down_doc_path |
|
6898 | + $sql = "SELECT down_doc_path |
|
6899 | 6899 | FROM $downloads_table |
6900 | 6900 | WHERE c_id = $courseId |
6901 | 6901 | AND down_user_id = $user_id |
6902 | 6902 | AND down_session_id = $session_id |
6903 | 6903 | GROUP BY down_doc_path"; |
6904 | 6904 | |
6905 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | - $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | - echo "<tr> |
|
6905 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | + $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | + echo "<tr> |
|
6909 | 6909 | <td class='secLine'> |
6910 | 6910 | ".get_lang('DocumentsTitleDocumentColumn')." |
6911 | 6911 | </td> |
6912 | 6912 | </tr>"; |
6913 | - if (is_array($results)) { |
|
6914 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | - echo "<tr>"; |
|
6916 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | - echo"</tr>"; |
|
6918 | - } |
|
6919 | - } else { |
|
6920 | - echo "<tr>"; |
|
6921 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | - echo"</tr>"; |
|
6923 | - } |
|
6924 | - echo "</table>"; |
|
6925 | - echo "</td></tr>"; |
|
6926 | - } else { |
|
6927 | - $new_view = substr_replace($view,'1',4,1); |
|
6928 | - echo " |
|
6913 | + if (is_array($results)) { |
|
6914 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | + echo "<tr>"; |
|
6916 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | + echo"</tr>"; |
|
6918 | + } |
|
6919 | + } else { |
|
6920 | + echo "<tr>"; |
|
6921 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | + echo"</tr>"; |
|
6923 | + } |
|
6924 | + echo "</table>"; |
|
6925 | + echo "</td></tr>"; |
|
6926 | + } else { |
|
6927 | + $new_view = substr_replace($view,'1',4,1); |
|
6928 | + echo " |
|
6929 | 6929 | <tr> |
6930 | 6930 | <td valign='top'> |
6931 | 6931 | +<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> |
6932 | 6932 | </td> |
6933 | 6933 | </tr> |
6934 | 6934 | "; |
6935 | - } |
|
6935 | + } |
|
6936 | 6936 | } |
6937 | 6937 | |
6938 | 6938 | /** |
@@ -6989,43 +6989,43 @@ discard block |
||
6989 | 6989 | */ |
6990 | 6990 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6991 | { |
6992 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | - |
|
6995 | - // protected data |
|
6996 | - $user_id = intval($user_id); |
|
6997 | - $session_id = intval($session_id); |
|
6998 | - $course_id = intval($course_id); |
|
6999 | - |
|
7000 | - $tempView = $view; |
|
7001 | - if (substr($view,0,1) == '1') { |
|
7002 | - $new_view = substr_replace($view,'0',0,1); |
|
7003 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6992 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | + |
|
6995 | + // protected data |
|
6996 | + $user_id = intval($user_id); |
|
6997 | + $session_id = intval($session_id); |
|
6998 | + $course_id = intval($course_id); |
|
6999 | + |
|
7000 | + $tempView = $view; |
|
7001 | + if (substr($view,0,1) == '1') { |
|
7002 | + $new_view = substr_replace($view,'0',0,1); |
|
7003 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7005 | 7005 | FROM $track_access_table |
7006 | 7006 | WHERE access_user_id = $user_id |
7007 | 7007 | AND c_id = $course_id |
7008 | 7008 | AND access_session_id = $session_id |
7009 | 7009 | GROUP BY YEAR(access_date),MONTH(access_date) |
7010 | 7010 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7011 | - //$results = getManyResults2Col($sql); |
|
7012 | - $results = getManyResults3Col($sql); |
|
7013 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | - $line=''; |
|
7015 | - $total = 0; |
|
7016 | - if (is_array($results)) { |
|
7017 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | - $total = $total + $results[$j][1]; |
|
7020 | - } |
|
7021 | - $line .= get_lang('Total').";".$total."\n"; |
|
7022 | - } else { |
|
7023 | - $line= get_lang('NoResult')."</center></td>"; |
|
7024 | - } |
|
7025 | - } else { |
|
7026 | - $new_view = substr_replace($view,'1',0,1); |
|
7027 | - } |
|
7028 | - return array($title_line, $line); |
|
7011 | + //$results = getManyResults2Col($sql); |
|
7012 | + $results = getManyResults3Col($sql); |
|
7013 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | + $line=''; |
|
7015 | + $total = 0; |
|
7016 | + if (is_array($results)) { |
|
7017 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | + $total = $total + $results[$j][1]; |
|
7020 | + } |
|
7021 | + $line .= get_lang('Total').";".$total."\n"; |
|
7022 | + } else { |
|
7023 | + $line= get_lang('NoResult')."</center></td>"; |
|
7024 | + } |
|
7025 | + } else { |
|
7026 | + $new_view = substr_replace($view,'1',0,1); |
|
7027 | + } |
|
7028 | + return array($title_line, $line); |
|
7029 | 7029 | } |
7030 | 7030 | |
7031 | 7031 | /** |
@@ -7038,67 +7038,67 @@ discard block |
||
7038 | 7038 | */ |
7039 | 7039 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
7040 | 7040 | { |
7041 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7041 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7042 | 7042 | $courseId = api_get_course_int_id($courseCode); |
7043 | 7043 | $userId = intval($userId); |
7044 | - if (substr($view,1,1) == '1') { |
|
7045 | - $new_view = substr_replace($view,'0',1,1); |
|
7046 | - $title[1] = get_lang('ExercicesDetails'); |
|
7047 | - $line = ''; |
|
7048 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7044 | + if (substr($view,1,1) == '1') { |
|
7045 | + $new_view = substr_replace($view,'0',1,1); |
|
7046 | + $title[1] = get_lang('ExercicesDetails'); |
|
7047 | + $line = ''; |
|
7048 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7049 | 7049 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
7050 | 7050 | WHERE te.c_id = $courseId |
7051 | 7051 | AND te.exe_user_id = $userId |
7052 | 7052 | AND te.exe_exo_id = ce.id |
7053 | 7053 | ORDER BY ce.title ASC, te.exe_date ASC"; |
7054 | 7054 | |
7055 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7055 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7056 | 7056 | FROM $TABLETRACK_HOTPOTATOES AS te |
7057 | 7057 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
7058 | 7058 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
7059 | 7059 | |
7060 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7060 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7061 | 7061 | |
7062 | - $NoTestRes = 0; |
|
7063 | - $NoHPTestRes = 0; |
|
7062 | + $NoTestRes = 0; |
|
7063 | + $NoHPTestRes = 0; |
|
7064 | 7064 | |
7065 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7065 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7067 | 7067 | |
7068 | - if (is_array($results)) { |
|
7069 | - for($i = 0; $i < sizeof($results); $i++) |
|
7070 | - { |
|
7071 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | - } |
|
7074 | - } else { |
|
7068 | + if (is_array($results)) { |
|
7069 | + for($i = 0; $i < sizeof($results); $i++) |
|
7070 | + { |
|
7071 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | + } |
|
7074 | + } else { |
|
7075 | 7075 | // istvan begin |
7076 | - $NoTestRes = 1; |
|
7077 | - } |
|
7078 | - |
|
7079 | - // The Result of Tests |
|
7080 | - if (is_array($hpresults)) { |
|
7081 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | - |
|
7084 | - if ($title == '') |
|
7085 | - $title = basename($hpresults[$i][0]); |
|
7086 | - |
|
7087 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | - |
|
7089 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | - } |
|
7091 | - } else { |
|
7092 | - $NoHPTestRes = 1; |
|
7093 | - } |
|
7094 | - |
|
7095 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | - $line=get_lang('NoResult'); |
|
7097 | - } |
|
7098 | - } else { |
|
7099 | - $new_view = substr_replace($view,'1',1,1); |
|
7100 | - } |
|
7101 | - return array($title_line, $line); |
|
7076 | + $NoTestRes = 1; |
|
7077 | + } |
|
7078 | + |
|
7079 | + // The Result of Tests |
|
7080 | + if (is_array($hpresults)) { |
|
7081 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | + $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | + |
|
7084 | + if ($title == '') |
|
7085 | + $title = basename($hpresults[$i][0]); |
|
7086 | + |
|
7087 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | + |
|
7089 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | + } |
|
7091 | + } else { |
|
7092 | + $NoHPTestRes = 1; |
|
7093 | + } |
|
7094 | + |
|
7095 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | + $line=get_lang('NoResult'); |
|
7097 | + } |
|
7098 | + } else { |
|
7099 | + $new_view = substr_replace($view,'1',1,1); |
|
7100 | + } |
|
7101 | + return array($title_line, $line); |
|
7102 | 7102 | } |
7103 | 7103 | |
7104 | 7104 | /** |
@@ -7107,37 +7107,37 @@ discard block |
||
7107 | 7107 | */ |
7108 | 7108 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7109 | 7109 | { |
7110 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7110 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7111 | 7111 | $_course = api_get_course_info(); |
7112 | 7112 | $user_id = intval($user_id); |
7113 | 7113 | $course_id = intval($course_id); |
7114 | 7114 | |
7115 | - if (substr($view,2,1) == '1') { |
|
7116 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7115 | + if (substr($view,2,1) == '1') { |
|
7116 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7117 | 7117 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7118 | 7118 | WHERE |
7119 | 7119 | u.upload_work_id = w.id AND |
7120 | 7120 | u.upload_user_id = '$user_id' AND |
7121 | 7121 | u.c_id = '$course_id' |
7122 | 7122 | ORDER BY u.upload_date DESC"; |
7123 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | - |
|
7125 | - $title[1]=get_lang('WorksDetails'); |
|
7126 | - $line=''; |
|
7127 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | - |
|
7129 | - if (is_array($results)) { |
|
7130 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | - } |
|
7135 | - |
|
7136 | - } else { |
|
7137 | - $line= get_lang('NoResult'); |
|
7138 | - } |
|
7139 | - } |
|
7140 | - return array($title_line, $line); |
|
7123 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | + |
|
7125 | + $title[1]=get_lang('WorksDetails'); |
|
7126 | + $line=''; |
|
7127 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | + |
|
7129 | + if (is_array($results)) { |
|
7130 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | + } |
|
7135 | + |
|
7136 | + } else { |
|
7137 | + $line= get_lang('NoResult'); |
|
7138 | + } |
|
7139 | + } |
|
7140 | + return array($title_line, $line); |
|
7141 | 7141 | } |
7142 | 7142 | |
7143 | 7143 | /** |
@@ -7146,32 +7146,32 @@ discard block |
||
7146 | 7146 | */ |
7147 | 7147 | public function display_links_tracking_info($view, $userId, $courseCode) |
7148 | 7148 | { |
7149 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7149 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7150 | 7150 | $courseId = api_get_course_int_id($courseCode); |
7151 | 7151 | $userId = intval($userId); |
7152 | 7152 | $line = null; |
7153 | - if (substr($view,3,1) == '1') { |
|
7154 | - $new_view = substr_replace($view,'0',3,1); |
|
7155 | - $title[1]=get_lang('LinksDetails'); |
|
7156 | - $sql = "SELECT cl.title, cl.url |
|
7153 | + if (substr($view,3,1) == '1') { |
|
7154 | + $new_view = substr_replace($view,'0',3,1); |
|
7155 | + $title[1]=get_lang('LinksDetails'); |
|
7156 | + $sql = "SELECT cl.title, cl.url |
|
7157 | 7157 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7158 | 7158 | WHERE sl.links_link_id = cl.id |
7159 | 7159 | AND sl.c_id = $courseId |
7160 | 7160 | AND sl.links_user_id = $userId |
7161 | 7161 | GROUP BY cl.title, cl.url"; |
7162 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | - if (is_array($results)) { |
|
7165 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | - $line .= $results[$j][0]."\n"; |
|
7167 | - } |
|
7168 | - } else { |
|
7169 | - $line=get_lang('NoResult'); |
|
7170 | - } |
|
7171 | - } else { |
|
7172 | - $new_view = substr_replace($view,'1',3,1); |
|
7173 | - } |
|
7174 | - return array($title_line, $line); |
|
7162 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | + if (is_array($results)) { |
|
7165 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | + $line .= $results[$j][0]."\n"; |
|
7167 | + } |
|
7168 | + } else { |
|
7169 | + $line=get_lang('NoResult'); |
|
7170 | + } |
|
7171 | + } else { |
|
7172 | + $new_view = substr_replace($view,'1',3,1); |
|
7173 | + } |
|
7174 | + return array($title_line, $line); |
|
7175 | 7175 | } |
7176 | 7176 | |
7177 | 7177 | /** |
@@ -7184,38 +7184,38 @@ discard block |
||
7184 | 7184 | */ |
7185 | 7185 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7186 | 7186 | { |
7187 | - // protect data |
|
7188 | - $user_id = intval($user_id); |
|
7187 | + // protect data |
|
7188 | + $user_id = intval($user_id); |
|
7189 | 7189 | $courseId = api_get_course_int_id($courseCode); |
7190 | - $session_id = intval($session_id); |
|
7190 | + $session_id = intval($session_id); |
|
7191 | 7191 | |
7192 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7192 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7193 | 7193 | |
7194 | - if (substr($view,4,1) == '1') { |
|
7195 | - $new_view = substr_replace($view,'0',4,1); |
|
7196 | - $title[1]= get_lang('DocumentsDetails'); |
|
7194 | + if (substr($view,4,1) == '1') { |
|
7195 | + $new_view = substr_replace($view,'0',4,1); |
|
7196 | + $title[1]= get_lang('DocumentsDetails'); |
|
7197 | 7197 | |
7198 | - $sql = "SELECT down_doc_path |
|
7198 | + $sql = "SELECT down_doc_path |
|
7199 | 7199 | FROM $downloads_table |
7200 | 7200 | WHERE c_id = $courseId |
7201 | 7201 | AND down_user_id = $user_id |
7202 | 7202 | AND down_session_id = $session_id |
7203 | 7203 | GROUP BY down_doc_path"; |
7204 | 7204 | |
7205 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7205 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7207 | 7207 | $line = null; |
7208 | - if (is_array($results)) { |
|
7209 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | - $line .= $results[$j]."\n"; |
|
7211 | - } |
|
7212 | - } else { |
|
7213 | - $line = get_lang('NoResult'); |
|
7214 | - } |
|
7215 | - } else { |
|
7216 | - $new_view = substr_replace($view,'1',4,1); |
|
7217 | - } |
|
7218 | - return array($title_line, $line); |
|
7208 | + if (is_array($results)) { |
|
7209 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | + $line .= $results[$j]."\n"; |
|
7211 | + } |
|
7212 | + } else { |
|
7213 | + $line = get_lang('NoResult'); |
|
7214 | + } |
|
7215 | + } else { |
|
7216 | + $new_view = substr_replace($view,'1',4,1); |
|
7217 | + } |
|
7218 | + return array($title_line, $line); |
|
7219 | 7219 | } |
7220 | 7220 | |
7221 | 7221 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $extendedAttempt = null, |
112 | 112 | $extendedAll = null, |
113 | 113 | $type = 'classic', |
114 | - $allowExtend = true |
|
114 | + $allowExtend = true |
|
115 | 115 | ) { |
116 | 116 | if (empty($courseInfo) || empty($lp_id)) { |
117 | 117 | return null; |
@@ -135,22 +135,22 @@ discard block |
||
135 | 135 | $extend_all = 0; |
136 | 136 | |
137 | 137 | if ($origin == 'tracking') { |
138 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
138 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
139 | 139 | } else { |
140 | - $url_suffix = '&lp_id=' . $lp_id; |
|
140 | + $url_suffix = '&lp_id='.$lp_id; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | if (!empty($extendedAll)) { |
144 | 144 | $extend_all_link = Display::url( |
145 | 145 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
146 | - api_get_self() . '?action=stats' . $url_suffix |
|
146 | + api_get_self().'?action=stats'.$url_suffix |
|
147 | 147 | ); |
148 | 148 | |
149 | 149 | $extend_all = 1; |
150 | 150 | } else { |
151 | 151 | $extend_all_link = Display::url( |
152 | 152 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
153 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
153 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
@@ -162,24 +162,24 @@ discard block |
||
162 | 162 | |
163 | 163 | $actionColumn = null; |
164 | 164 | if ($type == 'classic') { |
165 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
165 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
166 | 166 | } |
167 | 167 | $output .= '<div class="table-responsive">'; |
168 | 168 | $output .= '<table class="table tracking"> |
169 | 169 | <thead> |
170 | 170 | <tr class="table-header"> |
171 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
171 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
172 | 172 | <th colspan="4"> |
173 | - ' . get_lang('ScormLessonTitle') .' |
|
173 | + ' . get_lang('ScormLessonTitle').' |
|
174 | 174 | </th> |
175 | 175 | <th colspan="2"> |
176 | - ' . get_lang('ScormStatus') . ' |
|
176 | + ' . get_lang('ScormStatus').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormScore') . ' |
|
179 | + ' . get_lang('ScormScore').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormTime') . ' |
|
182 | + ' . get_lang('ScormTime').' |
|
183 | 183 | </th> |
184 | 184 | '.$actionColumn.' |
185 | 185 | </tr> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // Prepare statement to go through each attempt. |
243 | 243 | $viewCondition = null; |
244 | 244 | if (!empty($view)) { |
245 | - $viewCondition = " AND v.view_count = $view "; |
|
245 | + $viewCondition = " AND v.view_count = $view "; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | $sql = "SELECT |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | FROM $TBL_QUIZ |
291 | 291 | WHERE |
292 | 292 | c_id = $course_id AND |
293 | - id ='" . $my_path . "'"; |
|
293 | + id ='".$my_path."'"; |
|
294 | 294 | $res_result_disabled = Database::query($sql); |
295 | 295 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
296 | 296 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | 314 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
315 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | $action = null; |
332 | 332 | if ($type == 'classic') { |
333 | - $action = '<td></td>'; |
|
333 | + $action = '<td></td>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -374,13 +374,13 @@ discard block |
||
374 | 374 | $extend_this_attempt = 1; |
375 | 375 | $extend_attempt_link = Display::url( |
376 | 376 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
377 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
377 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
378 | 378 | ); |
379 | 379 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
380 | 380 | // The extend button for this attempt has not been clicked. |
381 | 381 | $extend_attempt_link = Display::url( |
382 | 382 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
383 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
383 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
416 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
416 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
417 | 417 | |
418 | 418 | if ($row['item_type'] != 'dokeos_chapter') { |
419 | 419 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -441,13 +441,13 @@ discard block |
||
441 | 441 | $action = '<td></td>'; |
442 | 442 | } |
443 | 443 | |
444 | - $output .= '<tr class="' . $oddclass . '"> |
|
444 | + $output .= '<tr class="'.$oddclass.'"> |
|
445 | 445 | <td></td> |
446 | - <td>' . $extend_attempt_link . '</td> |
|
447 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
448 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
449 | - <td colspan="2">' . $view_score . '</td> |
|
450 | - <td colspan="2">' . $time . '</td> |
|
446 | + <td>' . $extend_attempt_link.'</td> |
|
447 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
448 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
449 | + <td colspan="2">' . $view_score.'</td> |
|
450 | + <td colspan="2">' . $time.'</td> |
|
451 | 451 | '.$action.' |
452 | 452 | </tr>'; |
453 | 453 | $attemptCount++; |
@@ -460,10 +460,10 @@ discard block |
||
460 | 460 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
461 | 461 | $temp[] = '/'; |
462 | 462 | } else { |
463 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
463 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
464 | 464 | } |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | $temp[] = $time; |
469 | 469 | $csv_content[] = $temp; |
@@ -500,13 +500,13 @@ discard block |
||
500 | 500 | <td></td> |
501 | 501 | <td></td> |
502 | 502 | <td></td> |
503 | - <td>'.$interaction['order_id'] . '</td> |
|
504 | - <td>'.$interaction['id'] . '</td> |
|
503 | + <td>'.$interaction['order_id'].'</td> |
|
504 | + <td>'.$interaction['id'].'</td> |
|
505 | 505 | <td colspan="2">' . $interaction['type'].'</td> |
506 | - <td>'.$student_response . '</td> |
|
507 | - <td>'.$interaction['result'] . '</td> |
|
508 | - <td>'.$interaction['latency'] . '</td> |
|
509 | - <td>'.$interaction['time'] . '</td> |
|
506 | + <td>'.$student_response.'</td> |
|
507 | + <td>'.$interaction['result'].'</td> |
|
508 | + <td>'.$interaction['latency'].'</td> |
|
509 | + <td>'.$interaction['time'].'</td> |
|
510 | 510 | '.$action.' |
511 | 511 | </tr>'; |
512 | 512 | $counter++; |
@@ -523,12 +523,12 @@ discard block |
||
523 | 523 | <td></td> |
524 | 524 | <td></td> |
525 | 525 | <td></td> |
526 | - <td>' . $interaction['order_id'] . '</td> |
|
527 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
528 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
529 | - <td>' . $interaction['score_raw'] . '</td> |
|
530 | - <td>' . $interaction['score_max'] . '</td> |
|
531 | - <td>' . $interaction['score_min'] . '</td> |
|
526 | + <td>' . $interaction['order_id'].'</td> |
|
527 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
528 | + <td colspan="2">' . $interaction['status'].'</td> |
|
529 | + <td>' . $interaction['score_raw'].'</td> |
|
530 | + <td>' . $interaction['score_max'].'</td> |
|
531 | + <td>' . $interaction['score_min'].'</td> |
|
532 | 532 | '.$action.' |
533 | 533 | </tr>'; |
534 | 534 | $counter++; |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | $my_path = Database::escape_string($my_path); |
552 | 552 | $sql = "SELECT results_disabled |
553 | 553 | FROM $TBL_QUIZ |
554 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
554 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
555 | 555 | $res_result_disabled = Database::query($sql); |
556 | 556 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
557 | 557 | |
@@ -575,14 +575,14 @@ discard block |
||
575 | 575 | $extend_this_attempt = 1; |
576 | 576 | $extend_attempt_link = Display::url( |
577 | 577 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
578 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
578 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
579 | 579 | ); |
580 | 580 | } else { |
581 | 581 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
582 | 582 | // The extend button for this attempt has not been clicked. |
583 | 583 | $extend_attempt_link = Display::url( |
584 | 584 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
585 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
585 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
586 | 586 | ); |
587 | 587 | } |
588 | 588 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | if ($inter_num > 1) { |
598 | 598 | $extend_link = Display::url( |
599 | 599 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
600 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
600 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
601 | 601 | ); |
602 | 602 | } |
603 | 603 | |
@@ -613,15 +613,15 @@ discard block |
||
613 | 613 | |
614 | 614 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
615 | 615 | |
616 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
616 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
617 | 617 | WHERE |
618 | - exe_exo_id="' . $row['path'] . '" AND |
|
619 | - exe_user_id="' . $user_id . '" AND |
|
620 | - orig_lp_id = "' . $lp_id . '" AND |
|
621 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
622 | - c_id = ' . $course_id . ' AND |
|
618 | + exe_exo_id="' . $row['path'].'" AND |
|
619 | + exe_user_id="' . $user_id.'" AND |
|
620 | + orig_lp_id = "' . $lp_id.'" AND |
|
621 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
622 | + c_id = ' . $course_id.' AND |
|
623 | 623 | status <> "incomplete" AND |
624 | - session_id = ' . $session_id . ' |
|
624 | + session_id = ' . $session_id.' |
|
625 | 625 | ORDER BY exe_date DESC |
626 | 626 | LIMIT 1'; |
627 | 627 | |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | FROM $TBL_LP_ITEM_VIEW |
653 | 653 | WHERE |
654 | 654 | c_id = $course_id AND |
655 | - lp_item_id = '" . (int) $my_id . "' AND |
|
656 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
655 | + lp_item_id = '".(int) $my_id."' AND |
|
656 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
657 | 657 | ORDER BY view_count DESC limit 1"; |
658 | 658 | $res_score = Database::query($sql); |
659 | 659 | $row_score = Database::fetch_array($res_score); |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | FROM $TBL_LP_ITEM_VIEW |
663 | 663 | WHERE |
664 | 664 | c_id = $course_id AND |
665 | - lp_item_id = '" . (int) $my_id . "' AND |
|
666 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
665 | + lp_item_id = '".(int) $my_id."' AND |
|
666 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
667 | 667 | $res_time = Database::query($sql); |
668 | 668 | $row_time = Database::fetch_array($res_time); |
669 | 669 | |
@@ -722,16 +722,16 @@ discard block |
||
722 | 722 | } else { |
723 | 723 | $correct_test_link = '-'; |
724 | 724 | if ($row['item_type'] == 'quiz') { |
725 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
726 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
725 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
726 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
727 | 727 | WHERE |
728 | - exe_exo_id="' . $row['path'] . '" AND |
|
729 | - exe_user_id="' . $user_id . '" AND |
|
730 | - orig_lp_id = "' . $lp_id . '" AND |
|
731 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
732 | - c_id = ' . $course_id . ' AND |
|
728 | + exe_exo_id="' . $row['path'].'" AND |
|
729 | + exe_user_id="' . $user_id.'" AND |
|
730 | + orig_lp_id = "' . $lp_id.'" AND |
|
731 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
732 | + c_id = ' . $course_id.' AND |
|
733 | 733 | status <> "incomplete" AND |
734 | - session_id = ' . $session_id . ' |
|
734 | + session_id = ' . $session_id.' |
|
735 | 735 | ORDER BY exe_date DESC '; |
736 | 736 | |
737 | 737 | $resultLastAttempt = Database::query($sql); |
@@ -743,12 +743,12 @@ discard block |
||
743 | 743 | ) { |
744 | 744 | $correct_test_link = Display::url( |
745 | 745 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
746 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
746 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
747 | 747 | ); |
748 | 748 | } else { |
749 | 749 | $correct_test_link = Display::url( |
750 | 750 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
751 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
751 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
752 | 752 | ); |
753 | 753 | } |
754 | 754 | } |
@@ -758,14 +758,14 @@ discard block |
||
758 | 758 | |
759 | 759 | $action = null; |
760 | 760 | if ($type == 'classic') { |
761 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
761 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | if ($lp_id == $my_lp_id && false) { |
765 | 765 | |
766 | - $output .= '<tr class =' . $oddclass . '> |
|
767 | - <td>' . $extend_link . '</td> |
|
768 | - <td colspan="4">' . $title . '</td> |
|
766 | + $output .= '<tr class ='.$oddclass.'> |
|
767 | + <td>' . $extend_link.'</td> |
|
768 | + <td colspan="4">' . $title.'</td> |
|
769 | 769 | <td colspan="2"> </td> |
770 | 770 | <td colspan="2"> </td> |
771 | 771 | <td colspan="2"> </td> |
@@ -790,13 +790,13 @@ discard block |
||
790 | 790 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
791 | 791 | } |
792 | 792 | } else { |
793 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
793 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | $output .= ' |
797 | 797 | <td>'.$extend_link.'</td> |
798 | - <td colspan="4">' . $title . '</td> |
|
799 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
798 | + <td colspan="4">' . $title.'</td> |
|
799 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
800 | 800 | <td colspan="2">'.$scoreItem.'</td> |
801 | 801 | <td colspan="2">'.$time.'</td> |
802 | 802 | '.$action.' |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
814 | 814 | $temp[] = '/'; |
815 | 815 | } else { |
816 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
816 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
817 | 817 | } |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | $temp[] = $time; |
822 | 822 | $csv_content[] = $temp; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | |
828 | 828 | $action = null; |
829 | 829 | if ($type == 'classic') { |
830 | - $action = '<td></td>'; |
|
830 | + $action = '<td></td>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | if ($extend_this_attempt || $extend_all) { |
@@ -864,11 +864,11 @@ discard block |
||
864 | 864 | <td></td> |
865 | 865 | <td></td> |
866 | 866 | <td></td> |
867 | - <td>' . $interaction['order_id'] . '</td> |
|
868 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
869 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
867 | + <td>' . $interaction['order_id'].'</td> |
|
868 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
869 | + <td colspan="2">' . $interaction['status'].'</td> |
|
870 | 870 | <td>' . $interaction['score_raw'].'</td> |
871 | - <td>' . $interaction['score_max'] .'</td> |
|
871 | + <td>' . $interaction['score_max'].'</td> |
|
872 | 872 | <td>' . $interaction['score_min'].'</td> |
873 | 873 | '.$action.' |
874 | 874 | </tr>'; |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | } |
878 | 878 | |
879 | 879 | // Attempts listing by exercise. |
880 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
880 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
881 | 881 | // Get attempts of a exercise. |
882 | 882 | if (!empty($lp_id) && |
883 | 883 | !empty($lp_item_id) && |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | $row_path = Database::fetch_array($res_path); |
893 | 893 | |
894 | 894 | if (Database::num_rows($res_path) > 0) { |
895 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
895 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
896 | 896 | WHERE |
897 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
897 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
898 | 898 | status <> "incomplete" AND |
899 | - exe_user_id="' . $user_id . '" AND |
|
900 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
901 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
902 | - c_id = ' . $course_id . ' AND |
|
903 | - session_id = ' . $session_id . ' |
|
899 | + exe_user_id="' . $user_id.'" AND |
|
900 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
901 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
902 | + c_id = ' . $course_id.' AND |
|
903 | + session_id = ' . $session_id.' |
|
904 | 904 | ORDER BY exe_date'; |
905 | 905 | $res_attempts = Database::query($sql); |
906 | 906 | $num_attempts = Database::num_rows($res_attempts); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | if ($mktime_start_date && $mktime_exe_date) { |
919 | 919 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
920 | 920 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
921 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
921 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
922 | 922 | } else { |
923 | 923 | $time_attemp = ' - '; |
924 | 924 | } |
@@ -944,33 +944,33 @@ discard block |
||
944 | 944 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
945 | 945 | } |
946 | 946 | |
947 | - $output .= '<tr class="' . $oddclass . '" > |
|
947 | + $output .= '<tr class="'.$oddclass.'" > |
|
948 | 948 | <td></td> |
949 | - <td>' . $extend_attempt_link . '</td> |
|
950 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
951 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
952 | - <td colspan="2">'.$view_score . '</td> |
|
953 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
949 | + <td>' . $extend_attempt_link.'</td> |
|
950 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
951 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
952 | + <td colspan="2">'.$view_score.'</td> |
|
953 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
954 | 954 | if ($action == 'classic') { |
955 | 955 | if ($origin != 'tracking') { |
956 | 956 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
957 | 957 | $output .= '<td> |
958 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
958 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
959 | 959 | </td>'; |
960 | 960 | } else { |
961 | 961 | $output .= '<td> |
962 | - <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
963 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
962 | + <a href="../exercise/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
963 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
964 | 964 | </a></td>'; |
965 | 965 | } |
966 | 966 | } else { |
967 | 967 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
968 | 968 | $output .= '<td> |
969 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
969 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
970 | 970 | } else { |
971 | 971 | $output .= '<td> |
972 | - <a href="../exercise/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
973 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
972 | + <a href="../exercise/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
973 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | } |
@@ -1029,13 +1029,13 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1032 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1032 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1033 | 1033 | |
1034 | 1034 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1035 | 1035 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1036 | 1036 | } else { |
1037 | 1037 | if (is_numeric($total_score)) { |
1038 | - $final_score = $total_score . '%'; |
|
1038 | + $final_score = $total_score.'%'; |
|
1039 | 1039 | } else { |
1040 | 1040 | $final_score = $total_score; |
1041 | 1041 | } |
@@ -1051,19 +1051,19 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $action = null; |
1053 | 1053 | if ($type == 'classic') { |
1054 | - $action = '<td></td>'; |
|
1054 | + $action = '<td></td>'; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | $output .= '<tr class="'.$oddclass.'"> |
1058 | 1058 | <td></td> |
1059 | 1059 | <td colspan="4"> |
1060 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1060 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1061 | 1061 | </td> |
1062 | 1062 | <td colspan="2">'.$progress.'%</td> |
1063 | 1063 | <td colspan="2"> |
1064 | 1064 | ' . $final_score.' |
1065 | 1065 | </td> |
1066 | - <td colspan="2">' . $total_time . '</div> |
|
1066 | + <td colspan="2">' . $total_time.'</div> |
|
1067 | 1067 | '.$action.' |
1068 | 1068 | </tr>'; |
1069 | 1069 | |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1406 | 1406 | if (is_array($user_id)) { |
1407 | 1407 | $user_id = array_map('intval', $user_id); |
1408 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1408 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1409 | 1409 | } else { |
1410 | 1410 | $user_id = intval($user_id); |
1411 | 1411 | $condition_user = " AND user_id = $user_id "; |
@@ -1441,13 +1441,13 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1443 | 1443 | $sql = 'SELECT login_date |
1444 | - FROM ' . $tbl_track_login . ' |
|
1445 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1444 | + FROM ' . $tbl_track_login.' |
|
1445 | + WHERE login_user_id = ' . intval($student_id).' |
|
1446 | 1446 | ORDER BY login_date ASC |
1447 | 1447 | LIMIT 0,1'; |
1448 | 1448 | |
1449 | 1449 | $rs = Database::query($sql); |
1450 | - if (Database::num_rows($rs)>0) { |
|
1450 | + if (Database::num_rows($rs) > 0) { |
|
1451 | 1451 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1452 | 1452 | return api_convert_and_format_date( |
1453 | 1453 | $first_login_date, |
@@ -1472,8 +1472,8 @@ discard block |
||
1472 | 1472 | { |
1473 | 1473 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1474 | 1474 | $sql = 'SELECT login_date |
1475 | - FROM ' . $table . ' |
|
1476 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1475 | + FROM ' . $table.' |
|
1476 | + WHERE login_user_id = ' . intval($student_id).' |
|
1477 | 1477 | ORDER BY login_date |
1478 | 1478 | DESC LIMIT 0,1'; |
1479 | 1479 | |
@@ -1482,18 +1482,18 @@ discard block |
||
1482 | 1482 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1483 | 1483 | $last_login_date = api_get_local_time($last_login_date); |
1484 | 1484 | if ($return_timestamp) { |
1485 | - return api_strtotime($last_login_date,'UTC'); |
|
1485 | + return api_strtotime($last_login_date, 'UTC'); |
|
1486 | 1486 | } else { |
1487 | 1487 | if (!$warning_message) { |
1488 | 1488 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1489 | 1489 | } else { |
1490 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1490 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1491 | 1491 | $currentTimestamp = time(); |
1492 | 1492 | |
1493 | 1493 | //If the last connection is > than 7 days, the text is red |
1494 | 1494 | //345600 = 7 days in seconds |
1495 | 1495 | if ($currentTimestamp - $timestamp > 604800) { |
1496 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1496 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1497 | 1497 | } else { |
1498 | 1498 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1499 | 1499 | } |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | $sql = "$select |
1529 | 1529 | FROM $tbl_track_login |
1530 | 1530 | WHERE |
1531 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1531 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1532 | 1532 | login_date < '$date' |
1533 | 1533 | "; |
1534 | 1534 | $rs = Database::query($sql); |
@@ -1627,7 +1627,7 @@ discard block |
||
1627 | 1627 | '.Display::return_icon('messagebox_warning.gif').' |
1628 | 1628 | </a>' |
1629 | 1629 | : null; |
1630 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1630 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1631 | 1631 | } else { |
1632 | 1632 | return $last_login_date; |
1633 | 1633 | } |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | session_id = $session_id |
1678 | 1678 | $month_filter"; |
1679 | 1679 | $rs = Database::query($sql); |
1680 | - if (Database::num_rows($rs)>0) { |
|
1680 | + if (Database::num_rows($rs) > 0) { |
|
1681 | 1681 | $row = Database::fetch_object($rs); |
1682 | 1682 | $count = $row->count_connections; |
1683 | 1683 | } |
@@ -1698,14 +1698,14 @@ discard block |
||
1698 | 1698 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1699 | 1699 | |
1700 | 1700 | $sql = 'SELECT DISTINCT c_id |
1701 | - FROM ' . $tbl_course_rel_user . ' |
|
1701 | + FROM ' . $tbl_course_rel_user.' |
|
1702 | 1702 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1703 | 1703 | $rs = Database::query($sql); |
1704 | 1704 | $nb_courses = Database::num_rows($rs); |
1705 | 1705 | |
1706 | 1706 | if ($include_sessions) { |
1707 | 1707 | $sql = 'SELECT DISTINCT c_id |
1708 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1708 | + FROM ' . $tbl_session_course_rel_user.' |
|
1709 | 1709 | WHERE user_id = ' . $user_id; |
1710 | 1710 | $rs = Database::query($sql); |
1711 | 1711 | $nb_courses += Database::num_rows($rs); |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | $condition_quiz = ""; |
1753 | 1753 | if (!empty($exercise_id)) { |
1754 | 1754 | $exercise_id = intval($exercise_id); |
1755 | - $condition_quiz =" AND id = $exercise_id "; |
|
1755 | + $condition_quiz = " AND id = $exercise_id "; |
|
1756 | 1756 | } |
1757 | 1757 | |
1758 | 1758 | // Compose a filter based on optional session id given |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | } |
1806 | 1806 | } |
1807 | 1807 | if (!empty($exercise_list)) { |
1808 | - $exercise_id = implode("','",$exercise_list); |
|
1808 | + $exercise_id = implode("','", $exercise_list); |
|
1809 | 1809 | } |
1810 | 1810 | } |
1811 | 1811 | |
@@ -1830,10 +1830,10 @@ discard block |
||
1830 | 1830 | $quiz_avg_score = null; |
1831 | 1831 | |
1832 | 1832 | if (!empty($row['avg_score'])) { |
1833 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1833 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1834 | 1834 | } |
1835 | 1835 | |
1836 | - if(!empty($row['num_attempts'])) { |
|
1836 | + if (!empty($row['num_attempts'])) { |
|
1837 | 1837 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1838 | 1838 | } |
1839 | 1839 | if (is_array($student_id)) { |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | $row = Database::fetch_row($rs); |
1964 | 1964 | $count = $row[0]; |
1965 | 1965 | } |
1966 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1966 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
1967 | 1967 | return $count; |
1968 | 1968 | } |
1969 | 1969 | |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | ); |
1989 | 1989 | |
1990 | 1990 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
1991 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
1991 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
1992 | 1992 | } |
1993 | 1993 | } |
1994 | 1994 | $result = $result / count($exercise_list); |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | $query = sprintf($sql, intval($courseId), $sessionId); |
2026 | 2026 | $rs = Database::query($query); |
2027 | 2027 | $teachers = array(); |
2028 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
2028 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
2029 | 2029 | $teachers[] = $teacher; |
2030 | 2030 | } |
2031 | 2031 | $data = array(); |
@@ -2149,7 +2149,7 @@ discard block |
||
2149 | 2149 | $data[] = array( |
2150 | 2150 | 'course' => $course['title'], |
2151 | 2151 | 'session' => $teacher['name'], |
2152 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2152 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2153 | 2153 | 'documents' => $totalDocuments, |
2154 | 2154 | 'links' => $totalLinks, |
2155 | 2155 | 'forums' => $totalForums, |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | for ($i = 0; $i < count($lpIdList); $i++) { |
2213 | 2213 | $placeHolders[] = '?'; |
2214 | 2214 | } |
2215 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
2215 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
2216 | 2216 | } |
2217 | 2217 | |
2218 | 2218 | if ($onlySeriousGame) { |
@@ -2232,14 +2232,14 @@ discard block |
||
2232 | 2232 | |
2233 | 2233 | $conditions = [ |
2234 | 2234 | " c_id = {$courseInfo['real_id']} ", |
2235 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2235 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2236 | 2236 | ]; |
2237 | 2237 | |
2238 | 2238 | $groupBy = 'GROUP BY lp_id'; |
2239 | 2239 | |
2240 | 2240 | if (is_array($studentId)) { |
2241 | 2241 | $studentId = array_map('intval', $studentId); |
2242 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2242 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2243 | 2243 | |
2244 | 2244 | |
2245 | 2245 | } else { |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | // Compose a filter based on optional learning paths list given |
2375 | 2375 | $condition_lp = ""; |
2376 | 2376 | if (count($lp_ids) > 0) { |
2377 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2377 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2378 | 2378 | } |
2379 | 2379 | |
2380 | 2380 | // Compose a filter based on optional session id |
@@ -2414,9 +2414,9 @@ discard block |
||
2414 | 2414 | // prepare filter on users |
2415 | 2415 | if (is_array($student_id)) { |
2416 | 2416 | array_walk($student_id, 'intval'); |
2417 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2417 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2418 | 2418 | } else { |
2419 | - $condition_user1 =" AND user_id = $student_id "; |
|
2419 | + $condition_user1 = " AND user_id = $student_id "; |
|
2420 | 2420 | } |
2421 | 2421 | |
2422 | 2422 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2459,7 +2459,7 @@ discard block |
||
2459 | 2459 | ORDER BY lp_item_id"; |
2460 | 2460 | $res_lp_item = Database::query($sql); |
2461 | 2461 | |
2462 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2462 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2463 | 2463 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2464 | 2464 | |
2465 | 2465 | // Getting the most recent attempt |
@@ -2482,8 +2482,8 @@ discard block |
||
2482 | 2482 | ORDER BY view_count DESC |
2483 | 2483 | LIMIT 1"; |
2484 | 2484 | $res_lp_item_result = Database::query($sql); |
2485 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2486 | - $list[]= $row_max_score; |
|
2485 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2486 | + $list[] = $row_max_score; |
|
2487 | 2487 | } |
2488 | 2488 | } |
2489 | 2489 | } else { |
@@ -2507,8 +2507,8 @@ discard block |
||
2507 | 2507 | if ($debug) echo $sql.'<br />'; |
2508 | 2508 | $res_max_score = Database::query($sql); |
2509 | 2509 | |
2510 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2511 | - $list[]= $row_max_score; |
|
2510 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2511 | + $list[] = $row_max_score; |
|
2512 | 2512 | } |
2513 | 2513 | } |
2514 | 2514 | |
@@ -2523,7 +2523,7 @@ discard block |
||
2523 | 2523 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2524 | 2524 | $score = $row_max_score['score']; |
2525 | 2525 | |
2526 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2526 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2527 | 2527 | |
2528 | 2528 | if ($row_max_score['item_type'] == 'sco') { |
2529 | 2529 | /* Check if it is sco (easier to get max_score) |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | } |
2542 | 2542 | // Avoid division by zero errors |
2543 | 2543 | if (!empty($max_score)) { |
2544 | - $lp_partial_total += $score/$max_score; |
|
2544 | + $lp_partial_total += $score / $max_score; |
|
2545 | 2545 | } |
2546 | 2546 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2547 | 2547 | } else { |
@@ -2565,10 +2565,10 @@ discard block |
||
2565 | 2565 | ORDER BY exe_date DESC |
2566 | 2566 | LIMIT 1"; |
2567 | 2567 | |
2568 | - if ($debug) echo $sql .'<br />'; |
|
2568 | + if ($debug) echo $sql.'<br />'; |
|
2569 | 2569 | $result_last_attempt = Database::query($sql); |
2570 | 2570 | $num = Database :: num_rows($result_last_attempt); |
2571 | - if ($num > 0 ) { |
|
2571 | + if ($num > 0) { |
|
2572 | 2572 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2573 | 2573 | if ($debug) echo $id_last_attempt.'<br />'; |
2574 | 2574 | |
@@ -2597,13 +2597,13 @@ discard block |
||
2597 | 2597 | $max_score = $row_max_score_bis['maxscore']; |
2598 | 2598 | } |
2599 | 2599 | if (!empty($max_score) && floatval($max_score) > 0) { |
2600 | - $lp_partial_total += $score/$max_score; |
|
2600 | + $lp_partial_total += $score / $max_score; |
|
2601 | 2601 | } |
2602 | 2602 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2603 | 2603 | } |
2604 | 2604 | } |
2605 | 2605 | |
2606 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2606 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2607 | 2607 | // Normal way |
2608 | 2608 | if ($use_max_score[$lp_id]) { |
2609 | 2609 | $count_items++; |
@@ -2638,8 +2638,8 @@ discard block |
||
2638 | 2638 | if ($debug) echo $sql; |
2639 | 2639 | $result_have_quiz = Database::query($sql); |
2640 | 2640 | |
2641 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2642 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2641 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2642 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2643 | 2643 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2644 | 2644 | $lp_with_quiz++; |
2645 | 2645 | } |
@@ -2651,7 +2651,7 @@ discard block |
||
2651 | 2651 | |
2652 | 2652 | if ($lp_with_quiz != 0) { |
2653 | 2653 | if (!$return_array) { |
2654 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2654 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2655 | 2655 | if ($debug) var_dump($score_of_scorm_calculate); |
2656 | 2656 | if (empty($lp_ids)) { |
2657 | 2657 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2725,9 +2725,9 @@ discard block |
||
2725 | 2725 | |
2726 | 2726 | if (is_array($student_id)) { |
2727 | 2727 | array_walk($student_id, 'intval'); |
2728 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2728 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2729 | 2729 | } else { |
2730 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2730 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2731 | 2731 | } |
2732 | 2732 | |
2733 | 2733 | $conditionsToString = implode('AND ', $conditions); |
@@ -2751,7 +2751,7 @@ discard block |
||
2751 | 2751 | return 0; |
2752 | 2752 | } |
2753 | 2753 | |
2754 | - return ($row['sum_score'] / $row['sum_max_score'])*100; |
|
2754 | + return ($row['sum_score'] / $row['sum_max_score']) * 100; |
|
2755 | 2755 | |
2756 | 2756 | } |
2757 | 2757 | |
@@ -2781,7 +2781,7 @@ discard block |
||
2781 | 2781 | // Compose a filter based on optional learning paths list given |
2782 | 2782 | $condition_lp = ""; |
2783 | 2783 | if (count($lp_ids) > 0) { |
2784 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2784 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2785 | 2785 | } |
2786 | 2786 | |
2787 | 2787 | // Compose a filter based on optional session id |
@@ -2843,7 +2843,7 @@ discard block |
||
2843 | 2843 | |
2844 | 2844 | if (!empty($course)) { |
2845 | 2845 | |
2846 | - $course_id = $course['real_id']; |
|
2846 | + $course_id = $course['real_id']; |
|
2847 | 2847 | |
2848 | 2848 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2849 | 2849 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2857,8 +2857,8 @@ discard block |
||
2857 | 2857 | // calculates last connection time |
2858 | 2858 | if ($count_row_lp > 0) { |
2859 | 2859 | $sql = 'SELECT MAX(start_time) |
2860 | - FROM ' . $t_lpiv . ' AS item_view |
|
2861 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2860 | + FROM ' . $t_lpiv.' AS item_view |
|
2861 | + INNER JOIN ' . $t_lpv.' AS view |
|
2862 | 2862 | ON item_view.lp_view_id = view.id |
2863 | 2863 | WHERE |
2864 | 2864 | item_view.c_id = '.$course_id.' AND |
@@ -2894,15 +2894,15 @@ discard block |
||
2894 | 2894 | |
2895 | 2895 | // At first, courses where $coach_id is coach of the course // |
2896 | 2896 | $sql = 'SELECT session_id, c_id |
2897 | - FROM ' . $tbl_session_course_user . ' |
|
2897 | + FROM ' . $tbl_session_course_user.' |
|
2898 | 2898 | WHERE user_id=' . $coach_id.' AND status=2'; |
2899 | 2899 | |
2900 | 2900 | if (api_is_multiple_url_enabled()) { |
2901 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2901 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2902 | 2902 | $access_url_id = api_get_current_access_url_id(); |
2903 | 2903 | if ($access_url_id != -1) { |
2904 | 2904 | $sql = 'SELECT scu.session_id, scu.c_id |
2905 | - FROM ' . $tbl_session_course_user . ' scu |
|
2905 | + FROM ' . $tbl_session_course_user.' scu |
|
2906 | 2906 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2907 | 2907 | ON (scu.session_id=sru.session_id) |
2908 | 2908 | WHERE |
@@ -2936,28 +2936,28 @@ discard block |
||
2936 | 2936 | |
2937 | 2937 | // Then, courses where $coach_id is coach of the session // |
2938 | 2938 | $sql = 'SELECT session_course_user.user_id |
2939 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2939 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2940 | 2940 | INNER JOIN '.$tbl_session_user.' sru |
2941 | 2941 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2942 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2942 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2943 | 2943 | ON session_course.c_id = session_course_user.c_id |
2944 | 2944 | AND session_course_user.session_id = session_course.session_id |
2945 | - INNER JOIN ' . $tbl_session . ' as session |
|
2945 | + INNER JOIN ' . $tbl_session.' as session |
|
2946 | 2946 | ON session.id = session_course.session_id |
2947 | 2947 | AND session.id_coach = ' . $coach_id; |
2948 | 2948 | if (api_is_multiple_url_enabled()) { |
2949 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2949 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2950 | 2950 | $access_url_id = api_get_current_access_url_id(); |
2951 | - if ($access_url_id != -1){ |
|
2951 | + if ($access_url_id != -1) { |
|
2952 | 2952 | $sql = 'SELECT session_course_user.user_id |
2953 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2953 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2954 | 2954 | INNER JOIN '.$tbl_session_user.' sru |
2955 | 2955 | ON session_course_user.user_id = sru.user_id AND |
2956 | 2956 | session_course_user.session_id = sru.session_id |
2957 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2957 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2958 | 2958 | ON session_course.c_id = session_course_user.c_id AND |
2959 | 2959 | session_course_user.session_id = session_course.session_id |
2960 | - INNER JOIN ' . $tbl_session . ' as session |
|
2960 | + INNER JOIN ' . $tbl_session.' as session |
|
2961 | 2961 | ON session.id = session_course.session_id AND |
2962 | 2962 | session.id_coach = ' . $coach_id.' |
2963 | 2963 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -2987,8 +2987,8 @@ discard block |
||
2987 | 2987 | |
2988 | 2988 | $students = []; |
2989 | 2989 | // At first, courses where $coach_id is coach of the course // |
2990 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
2991 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
2990 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
2991 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
2992 | 2992 | $result = Database::query($sql); |
2993 | 2993 | |
2994 | 2994 | while ($a_courses = Database::fetch_array($result)) { |
@@ -2998,7 +2998,7 @@ discard block |
||
2998 | 2998 | FROM $tbl_session_course_user AS srcru |
2999 | 2999 | WHERE |
3000 | 3000 | c_id = '$courseId' AND |
3001 | - session_id = '" . $id_session . "'"; |
|
3001 | + session_id = '".$id_session."'"; |
|
3002 | 3002 | $rs = Database::query($sql); |
3003 | 3003 | while ($row = Database::fetch_array($rs)) { |
3004 | 3004 | $students[$row['user_id']] = $row['user_id']; |
@@ -3006,15 +3006,15 @@ discard block |
||
3006 | 3006 | } |
3007 | 3007 | |
3008 | 3008 | // Then, courses where $coach_id is coach of the session |
3009 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
3010 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
3009 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
3010 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
3011 | 3011 | $result = Database::query($sql); |
3012 | 3012 | |
3013 | 3013 | //He is the session_coach so we select all the users in the session |
3014 | 3014 | if (Database::num_rows($result) > 0) { |
3015 | 3015 | $sql = 'SELECT DISTINCT srcru.user_id |
3016 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
3017 | - WHERE session_id="' . $id_session . '"'; |
|
3016 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
3017 | + WHERE session_id="' . $id_session.'"'; |
|
3018 | 3018 | $result = Database::query($sql); |
3019 | 3019 | while ($row = Database::fetch_array($result)) { |
3020 | 3020 | $students[$row['user_id']] = $row['user_id']; |
@@ -3041,8 +3041,8 @@ discard block |
||
3041 | 3041 | |
3042 | 3042 | // At first, courses where $coach_id is coach of the course // |
3043 | 3043 | |
3044 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
3045 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
3044 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
3045 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
3046 | 3046 | $result = Database::query($sql); |
3047 | 3047 | if (Database::num_rows($result) > 0) { |
3048 | 3048 | return true; |
@@ -3050,12 +3050,12 @@ discard block |
||
3050 | 3050 | |
3051 | 3051 | // Then, courses where $coach_id is coach of the session |
3052 | 3052 | $sql = 'SELECT session_course_user.user_id |
3053 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
3054 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
3053 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
3054 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
3055 | 3055 | ON session_course.c_id = session_course_user.c_id |
3056 | - INNER JOIN ' . $tbl_session . ' as session |
|
3056 | + INNER JOIN ' . $tbl_session.' as session |
|
3057 | 3057 | ON session.id = session_course.session_id |
3058 | - AND session.id_coach = ' . $coach_id . ' |
|
3058 | + AND session.id_coach = ' . $coach_id.' |
|
3059 | 3059 | WHERE user_id = ' . $student_id; |
3060 | 3060 | $result = Database::query($sql); |
3061 | 3061 | if (Database::num_rows($result) > 0) { |
@@ -3087,16 +3087,16 @@ discard block |
||
3087 | 3087 | // At first, courses where $coach_id is coach of the course. |
3088 | 3088 | |
3089 | 3089 | $sql = 'SELECT DISTINCT c.code |
3090 | - FROM ' . $tbl_session_course_user . ' sc |
|
3090 | + FROM ' . $tbl_session_course_user.' sc |
|
3091 | 3091 | INNER JOIN '.$tbl_course.' c |
3092 | 3092 | ON (c.id = sc.c_id) |
3093 | 3093 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
3094 | 3094 | |
3095 | 3095 | if (api_is_multiple_url_enabled()) { |
3096 | 3096 | $access_url_id = api_get_current_access_url_id(); |
3097 | - if ($access_url_id != -1){ |
|
3097 | + if ($access_url_id != -1) { |
|
3098 | 3098 | $sql = 'SELECT DISTINCT c.code |
3099 | - FROM ' . $tbl_session_course_user . ' scu |
|
3099 | + FROM ' . $tbl_session_course_user.' scu |
|
3100 | 3100 | INNER JOIN '.$tbl_course.' c |
3101 | 3101 | ON (c.code = scu.c_id) |
3102 | 3102 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3109,7 +3109,7 @@ discard block |
||
3109 | 3109 | } |
3110 | 3110 | |
3111 | 3111 | if (!empty($id_session)) { |
3112 | - $sql .= ' AND session_id=' . $id_session; |
|
3112 | + $sql .= ' AND session_id='.$id_session; |
|
3113 | 3113 | } |
3114 | 3114 | |
3115 | 3115 | $courseList = array(); |
@@ -3121,25 +3121,25 @@ discard block |
||
3121 | 3121 | // Then, courses where $coach_id is coach of the session |
3122 | 3122 | |
3123 | 3123 | $sql = 'SELECT DISTINCT course.code |
3124 | - FROM ' . $tbl_session_course . ' as session_course |
|
3125 | - INNER JOIN ' . $tbl_session . ' as session |
|
3124 | + FROM ' . $tbl_session_course.' as session_course |
|
3125 | + INNER JOIN ' . $tbl_session.' as session |
|
3126 | 3126 | ON session.id = session_course.session_id |
3127 | - AND session.id_coach = ' . $coach_id . ' |
|
3128 | - INNER JOIN ' . $tbl_course . ' as course |
|
3127 | + AND session.id_coach = ' . $coach_id.' |
|
3128 | + INNER JOIN ' . $tbl_course.' as course |
|
3129 | 3129 | ON course.id = session_course.c_id'; |
3130 | 3130 | |
3131 | 3131 | if (api_is_multiple_url_enabled()) { |
3132 | 3132 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3133 | 3133 | $access_url_id = api_get_current_access_url_id(); |
3134 | - if ($access_url_id != -1){ |
|
3134 | + if ($access_url_id != -1) { |
|
3135 | 3135 | $sql = 'SELECT DISTINCT c.code |
3136 | - FROM ' . $tbl_session_course . ' as session_course |
|
3136 | + FROM ' . $tbl_session_course.' as session_course |
|
3137 | 3137 | INNER JOIN '.$tbl_course.' c |
3138 | 3138 | ON (c.id = session_course.c_id) |
3139 | - INNER JOIN ' . $tbl_session . ' as session |
|
3139 | + INNER JOIN ' . $tbl_session.' as session |
|
3140 | 3140 | ON session.id = session_course.session_id |
3141 | - AND session.id_coach = ' . $coach_id . ' |
|
3142 | - INNER JOIN ' . $tbl_course . ' as course |
|
3141 | + AND session.id_coach = ' . $coach_id.' |
|
3142 | + INNER JOIN ' . $tbl_course.' as course |
|
3143 | 3143 | ON course.id = session_course.c_id |
3144 | 3144 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3145 | 3145 | ON (course_rel_url.c_id = c.id)'; |
@@ -3147,12 +3147,12 @@ discard block |
||
3147 | 3147 | } |
3148 | 3148 | |
3149 | 3149 | if (!empty ($id_session)) { |
3150 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3150 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3151 | 3151 | if (api_is_multiple_url_enabled()) |
3152 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3153 | - } else { |
|
3152 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3153 | + } else { |
|
3154 | 3154 | if (api_is_multiple_url_enabled()) |
3155 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3155 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | $result = Database::query($sql); |
@@ -3208,7 +3208,7 @@ discard block |
||
3208 | 3208 | } |
3209 | 3209 | } |
3210 | 3210 | |
3211 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3211 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3212 | 3212 | $access_url_id = api_get_current_access_url_id(); |
3213 | 3213 | |
3214 | 3214 | $sql = " |
@@ -3328,7 +3328,7 @@ discard block |
||
3328 | 3328 | // table definition |
3329 | 3329 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3330 | 3330 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3331 | - $course_id = $a_course['real_id']; |
|
3331 | + $course_id = $a_course['real_id']; |
|
3332 | 3332 | if (is_array($student_id)) { |
3333 | 3333 | $studentList = array_map('intval', $student_id); |
3334 | 3334 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3379,7 +3379,7 @@ discard block |
||
3379 | 3379 | $a_course = CourseManager::get_course_information($course_code); |
3380 | 3380 | if (!empty($a_course)) { |
3381 | 3381 | $course_id = $a_course['real_id']; |
3382 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3382 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3383 | 3383 | } |
3384 | 3384 | |
3385 | 3385 | // table definition |
@@ -3388,14 +3388,14 @@ discard block |
||
3388 | 3388 | |
3389 | 3389 | if (is_array($student_id)) { |
3390 | 3390 | $studentList = array_map('intval', $student_id); |
3391 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3391 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3392 | 3392 | } else { |
3393 | 3393 | $student_id = intval($student_id); |
3394 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3394 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3395 | 3395 | } |
3396 | 3396 | if (isset($session_id)) { |
3397 | 3397 | $session_id = intval($session_id); |
3398 | - $conditions[]= " pub.session_id = $session_id "; |
|
3398 | + $conditions[] = " pub.session_id = $session_id "; |
|
3399 | 3399 | } |
3400 | 3400 | $conditionToString = implode('AND', $conditions); |
3401 | 3401 | |
@@ -3428,8 +3428,8 @@ discard block |
||
3428 | 3428 | $courseCondition = null; |
3429 | 3429 | $conditions = array(); |
3430 | 3430 | if (!empty($courseInfo)) { |
3431 | - $course_id = $courseInfo['real_id']; |
|
3432 | - $conditions[]= " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3431 | + $course_id = $courseInfo['real_id']; |
|
3432 | + $conditions[] = " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3433 | 3433 | } |
3434 | 3434 | |
3435 | 3435 | // Table definition. |
@@ -3438,15 +3438,15 @@ discard block |
||
3438 | 3438 | |
3439 | 3439 | if (is_array($student_id)) { |
3440 | 3440 | $studentList = array_map('intval', $student_id); |
3441 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3441 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3442 | 3442 | } else { |
3443 | 3443 | $student_id = intval($student_id); |
3444 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3444 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3445 | 3445 | } |
3446 | 3446 | |
3447 | 3447 | if (isset($session_id)) { |
3448 | 3448 | $session_id = intval($session_id); |
3449 | - $conditions[]= " forum.session_id = $session_id"; |
|
3449 | + $conditions[] = " forum.session_id = $session_id"; |
|
3450 | 3450 | } |
3451 | 3451 | |
3452 | 3452 | $conditionsToString = implode('AND ', $conditions); |
@@ -3481,7 +3481,7 @@ discard block |
||
3481 | 3481 | $condition_session = ''; |
3482 | 3482 | if (isset($session_id)) { |
3483 | 3483 | $session_id = intval($session_id); |
3484 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3484 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3485 | 3485 | } |
3486 | 3486 | |
3487 | 3487 | $course_id = $courseInfo['real_id']; |
@@ -3537,7 +3537,7 @@ discard block |
||
3537 | 3537 | $condition_session = ''; |
3538 | 3538 | if (isset($session_id)) { |
3539 | 3539 | $session_id = intval($session_id); |
3540 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3540 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3541 | 3541 | } |
3542 | 3542 | |
3543 | 3543 | $groupId = intval($groupId); |
@@ -3598,7 +3598,7 @@ discard block |
||
3598 | 3598 | $condition_session = ''; |
3599 | 3599 | if (isset($session_id)) { |
3600 | 3600 | $session_id = intval($session_id); |
3601 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3601 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3602 | 3602 | } |
3603 | 3603 | |
3604 | 3604 | $groupId = intval($groupId); |
@@ -3677,7 +3677,7 @@ discard block |
||
3677 | 3677 | { |
3678 | 3678 | $student_id = intval($student_id); |
3679 | 3679 | $courseId = intval($courseId); |
3680 | - $session_id = intval($session_id); |
|
3680 | + $session_id = intval($session_id); |
|
3681 | 3681 | $date_time = ''; |
3682 | 3682 | |
3683 | 3683 | // table definition |
@@ -3746,7 +3746,7 @@ discard block |
||
3746 | 3746 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3747 | 3747 | |
3748 | 3748 | $sql = 'SELECT 1 |
3749 | - FROM ' . $table . ' |
|
3749 | + FROM ' . $table.' |
|
3750 | 3750 | WHERE down_user_id = '.$student_id.' |
3751 | 3751 | AND c_id = "'.$courseId.'" |
3752 | 3752 | AND down_session_id = '.$session_id.' '; |
@@ -3824,30 +3824,30 @@ discard block |
||
3824 | 3824 | '.$inner.' |
3825 | 3825 | WHERE c.id = '.$courseId.' |
3826 | 3826 | GROUP BY stats_login.user_id |
3827 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3827 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3828 | 3828 | |
3829 | 3829 | if ($since == 'never') { |
3830 | 3830 | if (empty($session_id)) { |
3831 | 3831 | $sql = 'SELECT course_user.user_id |
3832 | - FROM ' . $table_course_rel_user . ' course_user |
|
3833 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3832 | + FROM ' . $table_course_rel_user.' course_user |
|
3833 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3834 | 3834 | ON course_user.user_id = stats_login.user_id AND |
3835 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3836 | - INNER JOIN ' . $tableCourse . ' c |
|
3835 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3836 | + INNER JOIN ' . $tableCourse.' c |
|
3837 | 3837 | ON (c.id = course_user.c_id) |
3838 | 3838 | WHERE |
3839 | - course_user.c_id = ' . $courseId . ' AND |
|
3839 | + course_user.c_id = ' . $courseId.' AND |
|
3840 | 3840 | stats_login.login_course_date IS NULL |
3841 | 3841 | GROUP BY course_user.user_id'; |
3842 | 3842 | } else { |
3843 | 3843 | $sql = 'SELECT session_course_user.user_id |
3844 | 3844 | FROM '.$tbl_session_course_user.' session_course_user |
3845 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3845 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3846 | 3846 | ON session_course_user.user_id = stats_login.user_id |
3847 | - INNER JOIN ' . $tableCourse . ' c |
|
3847 | + INNER JOIN ' . $tableCourse.' c |
|
3848 | 3848 | ON (c.id = session_course_user.c_id) |
3849 | 3849 | WHERE |
3850 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3850 | + session_course_user.c_id = ' . $courseId.' AND |
|
3851 | 3851 | stats_login.login_course_date IS NULL |
3852 | 3852 | GROUP BY session_course_user.user_id'; |
3853 | 3853 | |
@@ -3856,7 +3856,7 @@ discard block |
||
3856 | 3856 | |
3857 | 3857 | $rs = Database::query($sql); |
3858 | 3858 | $inactive_users = array(); |
3859 | - while($user = Database::fetch_array($rs)) { |
|
3859 | + while ($user = Database::fetch_array($rs)) { |
|
3860 | 3860 | $inactive_users[] = $user['user_id']; |
3861 | 3861 | } |
3862 | 3862 | |
@@ -3878,10 +3878,10 @@ discard block |
||
3878 | 3878 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3879 | 3879 | |
3880 | 3880 | $sql = 'SELECT '.$student_id.' |
3881 | - FROM ' . $table . ' |
|
3881 | + FROM ' . $table.' |
|
3882 | 3882 | WHERE |
3883 | - access_user_id=' . $student_id . ' AND |
|
3884 | - c_id="' . $courseId . '" AND |
|
3883 | + access_user_id=' . $student_id.' AND |
|
3884 | + c_id="' . $courseId.'" AND |
|
3885 | 3885 | access_session_id = "'.$session_id.'" '; |
3886 | 3886 | |
3887 | 3887 | $rs = Database::query($sql); |
@@ -3899,13 +3899,13 @@ discard block |
||
3899 | 3899 | { |
3900 | 3900 | $hr_dept_id = intval($hr_dept_id); |
3901 | 3901 | $a_students = array(); |
3902 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3902 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3903 | 3903 | |
3904 | 3904 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3905 | 3905 | WHERE hr_dept_id='.$hr_dept_id; |
3906 | 3906 | $rs = Database::query($sql); |
3907 | 3907 | |
3908 | - while($user = Database :: fetch_array($rs)) { |
|
3908 | + while ($user = Database :: fetch_array($rs)) { |
|
3909 | 3909 | $a_students[$user['user_id']] = $user['user_id']; |
3910 | 3910 | } |
3911 | 3911 | |
@@ -3930,7 +3930,7 @@ discard block |
||
3930 | 3930 | $condition_session = ''; |
3931 | 3931 | if (isset($session_id)) { |
3932 | 3932 | $session_id = intval($session_id); |
3933 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3933 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3934 | 3934 | } |
3935 | 3935 | $sql = "SELECT |
3936 | 3936 | access_tool, |
@@ -4042,7 +4042,7 @@ discard block |
||
4042 | 4042 | if (!empty($date_from) && !empty($date_to)) { |
4043 | 4043 | $fieldStartDate = $fields['start_date']; |
4044 | 4044 | if (!isset($fields['end_date'])) { |
4045 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
4045 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
4046 | 4046 | } else { |
4047 | 4047 | $fieldEndDate = $fields['end_date']; |
4048 | 4048 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4058,12 +4058,12 @@ discard block |
||
4058 | 4058 | $where |
4059 | 4059 | GROUP BY %s"; |
4060 | 4060 | $sql = sprintf($sql, |
4061 | - $fields['user'], //user field |
|
4062 | - $tableName, //FROM |
|
4063 | - $fields['course'], //course condition |
|
4064 | - $course['real_id'], //course condition |
|
4065 | - $fields['user'], //user condition |
|
4066 | - $userId, //user condition |
|
4061 | + $fields['user'], //user field |
|
4062 | + $tableName, //FROM |
|
4063 | + $fields['course'], //course condition |
|
4064 | + $course['real_id'], //course condition |
|
4065 | + $fields['user'], //user condition |
|
4066 | + $userId, //user condition |
|
4067 | 4067 | $fields['user'] //GROUP BY |
4068 | 4068 | ); |
4069 | 4069 | $rs = Database::query($sql); |
@@ -4071,7 +4071,7 @@ discard block |
||
4071 | 4071 | //iterate query |
4072 | 4072 | if (Database::num_rows($rs) > 0) { |
4073 | 4073 | while ($row = Database::fetch_array($rs)) { |
4074 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
4074 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
4075 | 4075 | } |
4076 | 4076 | } |
4077 | 4077 | } |
@@ -4094,11 +4094,11 @@ discard block |
||
4094 | 4094 | $courseId = api_get_course_int_id($course_code); |
4095 | 4095 | $data = array(); |
4096 | 4096 | |
4097 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4097 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4098 | 4098 | $condition_session = ''; |
4099 | 4099 | if (isset($session_id)) { |
4100 | 4100 | $session_id = intval($session_id); |
4101 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4101 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4102 | 4102 | } |
4103 | 4103 | $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
4104 | 4104 | FROM $TABLETRACK_DOWNLOADS |
@@ -4283,7 +4283,7 @@ discard block |
||
4283 | 4283 | |
4284 | 4284 | $final_course_data = array(); |
4285 | 4285 | |
4286 | - foreach($my_course_data as $course_id => $value) { |
|
4286 | + foreach ($my_course_data as $course_id => $value) { |
|
4287 | 4287 | $final_course_data[$course_id] = $course_list[$course_id]; |
4288 | 4288 | } |
4289 | 4289 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4304,7 +4304,7 @@ discard block |
||
4304 | 4304 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4305 | 4305 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4306 | 4306 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4307 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4307 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4308 | 4308 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4309 | 4309 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4310 | 4310 | </tr>'; |
@@ -4391,7 +4391,7 @@ discard block |
||
4391 | 4391 | $all_exercise_start_time = array(); |
4392 | 4392 | |
4393 | 4393 | foreach ($course_in_session as $my_session_id => $session_data) { |
4394 | - $course_list = $session_data['course_list']; |
|
4394 | + $course_list = $session_data['course_list']; |
|
4395 | 4395 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4396 | 4396 | $exercise_graph_name_list = array(); |
4397 | 4397 | //$user_results = array(); |
@@ -4436,20 +4436,20 @@ discard block |
||
4436 | 4436 | |
4437 | 4437 | $score = 0; |
4438 | 4438 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4439 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4439 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4440 | 4440 | } |
4441 | 4441 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4442 | 4442 | $all_exercise_start_time[] = $time; |
4443 | 4443 | $my_results[] = $score; |
4444 | - if (count($exercise_list)<=10) { |
|
4444 | + if (count($exercise_list) <= 10) { |
|
4445 | 4445 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4446 | - $exercise_graph_name_list[]= $title; |
|
4446 | + $exercise_graph_name_list[] = $title; |
|
4447 | 4447 | $all_exercise_graph_name_list[] = $title; |
4448 | 4448 | } else { |
4449 | 4449 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4450 | 4450 | $title = cut($exercise_data['title'], 30); |
4451 | - $exercise_graph_name_list[]= $title; |
|
4452 | - $all_exercise_graph_name_list[]= $title; |
|
4451 | + $exercise_graph_name_list[] = $title; |
|
4452 | + $all_exercise_graph_name_list[] = $title; |
|
4453 | 4453 | } |
4454 | 4454 | } |
4455 | 4455 | } |
@@ -4482,7 +4482,7 @@ discard block |
||
4482 | 4482 | } |
4483 | 4483 | |
4484 | 4484 | $html .= Display::page_subheader( |
4485 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4485 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4486 | 4486 | ); |
4487 | 4487 | |
4488 | 4488 | $html .= '<table class="data_table" width="100%">'; |
@@ -4532,7 +4532,7 @@ discard block |
||
4532 | 4532 | $courseInfo['real_id'], |
4533 | 4533 | $my_session_id |
4534 | 4534 | ); |
4535 | - if ($attempts > 1) { |
|
4535 | + if ($attempts > 1) { |
|
4536 | 4536 | $answered_exercises++; |
4537 | 4537 | } |
4538 | 4538 | } |
@@ -4545,7 +4545,7 @@ discard block |
||
4545 | 4545 | $all_average += $average; |
4546 | 4546 | } |
4547 | 4547 | |
4548 | - $all_average = $all_average / count($course_list); |
|
4548 | + $all_average = $all_average / count($course_list); |
|
4549 | 4549 | |
4550 | 4550 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4551 | 4551 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4570,31 +4570,31 @@ discard block |
||
4570 | 4570 | $html .= '</tr>'; |
4571 | 4571 | } |
4572 | 4572 | $html .= '</table><br />'; |
4573 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4573 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4574 | 4574 | |
4575 | 4575 | // Checking selected session. |
4576 | 4576 | |
4577 | 4577 | if (isset($_GET['session_id'])) { |
4578 | 4578 | $session_id_from_get = intval($_GET['session_id']); |
4579 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4580 | - $course_list = $session_data['course_list']; |
|
4579 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4580 | + $course_list = $session_data['course_list']; |
|
4581 | 4581 | |
4582 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4582 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4583 | 4583 | |
4584 | 4584 | $html .= '<table class="data_table" width="100%">'; |
4585 | 4585 | //'.Display::tag('th', get_lang('DoneExercises'), array('class'=>'head')).' |
4586 | 4586 | $html .= ' |
4587 | 4587 | <tr> |
4588 | 4588 | <th width="300px">'.get_lang('Course').'</th> |
4589 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4590 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4591 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4592 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4593 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4594 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4595 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4596 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4597 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4589 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4590 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4591 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4592 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4593 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4594 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4595 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4596 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4597 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4598 | 4598 | </tr>'; |
4599 | 4599 | |
4600 | 4600 | foreach ($course_list as $course_data) { |
@@ -4610,14 +4610,14 @@ discard block |
||
4610 | 4610 | $count_exercises = count($exercises); |
4611 | 4611 | } |
4612 | 4612 | $answered_exercises = 0; |
4613 | - foreach($exercises as $exercise_item) { |
|
4613 | + foreach ($exercises as $exercise_item) { |
|
4614 | 4614 | $attempts = Event::count_exercise_attempts_by_user( |
4615 | 4615 | api_get_user_id(), |
4616 | 4616 | $exercise_item['id'], |
4617 | 4617 | $courseId, |
4618 | 4618 | $session_id_from_get |
4619 | 4619 | ); |
4620 | - if ($attempts > 1) { |
|
4620 | + if ($attempts > 1) { |
|
4621 | 4621 | $answered_exercises++; |
4622 | 4622 | } |
4623 | 4623 | } |
@@ -4626,7 +4626,7 @@ discard block |
||
4626 | 4626 | |
4627 | 4627 | // Average |
4628 | 4628 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4629 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4629 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4630 | 4630 | |
4631 | 4631 | $stats_array[$course_code] = array( |
4632 | 4632 | 'exercises' => $count_exercises, |
@@ -4703,7 +4703,7 @@ discard block |
||
4703 | 4703 | |
4704 | 4704 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4705 | 4705 | $details = '<a href="#">'; |
4706 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4706 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4707 | 4707 | } else { |
4708 | 4708 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4709 | 4709 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4799,7 +4799,7 @@ discard block |
||
4799 | 4799 | ); |
4800 | 4800 | |
4801 | 4801 | $html .= '<tr class="row_even">'; |
4802 | - $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4802 | + $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4803 | 4803 | |
4804 | 4804 | if ($visible_return['value'] == true) { |
4805 | 4805 | $exercices['title'] = Display::url( |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | ); |
4827 | 4827 | |
4828 | 4828 | $latest_attempt_url = ''; |
4829 | - $best_score = $position = $percentage_score_result = '-'; |
|
4829 | + $best_score = $position = $percentage_score_result = '-'; |
|
4830 | 4830 | $graph = $normal_graph = null; |
4831 | 4831 | |
4832 | 4832 | // Getting best results |
@@ -4858,11 +4858,11 @@ discard block |
||
4858 | 4858 | $weighting = $exercise_stat['exe_weighting']; |
4859 | 4859 | $exe_id = $exercise_stat['exe_id']; |
4860 | 4860 | |
4861 | - $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; |
|
4861 | + $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id; |
|
4862 | 4862 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4863 | 4863 | $my_score = 0; |
4864 | 4864 | if (!empty($weighting) && intval($weighting) != 0) { |
4865 | - $my_score = $score/$weighting; |
|
4865 | + $my_score = $score / $weighting; |
|
4866 | 4866 | } |
4867 | 4867 | //@todo this function slows the page |
4868 | 4868 | if (is_int($user_list)) { |
@@ -4876,14 +4876,14 @@ discard block |
||
4876 | 4876 | } |
4877 | 4877 | $html .= Display::div( |
4878 | 4878 | $normal_graph, |
4879 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4879 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4880 | 4880 | ); |
4881 | 4881 | |
4882 | 4882 | if (empty($graph)) { |
4883 | 4883 | $graph = '-'; |
4884 | 4884 | } else { |
4885 | 4885 | $graph = Display::url( |
4886 | - '<img src="' . $graph . '" >', |
|
4886 | + '<img src="'.$graph.'" >', |
|
4887 | 4887 | $normal_graph, |
4888 | 4888 | array( |
4889 | 4889 | 'id' => $exercices['id'], |
@@ -4916,7 +4916,7 @@ discard block |
||
4916 | 4916 | |
4917 | 4917 | |
4918 | 4918 | // LP table results |
4919 | - $html .='<table class="data_table">'; |
|
4919 | + $html .= '<table class="data_table">'; |
|
4920 | 4920 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
4921 | 4921 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
4922 | 4922 | $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -4951,7 +4951,7 @@ discard block |
||
4951 | 4951 | $time_spent_in_lp = api_time_to_hms($time_spent_in_lp); |
4952 | 4952 | |
4953 | 4953 | $html .= '<tr class="row_even">'; |
4954 | - $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
4954 | + $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
4955 | 4955 | |
4956 | 4956 | if ($learnpath['lp_visibility'] == 0) { |
4957 | 4957 | $html .= Display::tag('td', $learnpath['lp_name']); |
@@ -4970,7 +4970,7 @@ discard block |
||
4970 | 4970 | if (!empty($last_connection_in_lp)) { |
4971 | 4971 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
4972 | 4972 | } |
4973 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
4973 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
4974 | 4974 | $html .= "</tr>"; |
4975 | 4975 | } |
4976 | 4976 | } else { |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | </td> |
4981 | 4981 | </tr>'; |
4982 | 4982 | } |
4983 | - $html .='</table>'; |
|
4983 | + $html .= '</table>'; |
|
4984 | 4984 | } |
4985 | 4985 | |
4986 | 4986 | return $html; |
@@ -5007,7 +5007,7 @@ discard block |
||
5007 | 5007 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
5008 | 5008 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
5009 | 5009 | $myData->setAxisUnit(0, '%'); |
5010 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5010 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5011 | 5011 | // Cache definition |
5012 | 5012 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5013 | 5013 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -5015,9 +5015,9 @@ discard block |
||
5015 | 5015 | |
5016 | 5016 | if ($myCache->isInCache($chartHash)) { |
5017 | 5017 | //if we already created the img |
5018 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5018 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5019 | 5019 | $myCache->saveFromCache($chartHash, $imgPath); |
5020 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5020 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5021 | 5021 | } else { |
5022 | 5022 | /* Define width, height and angle */ |
5023 | 5023 | $mainWidth = 860; |
@@ -5046,7 +5046,7 @@ discard block |
||
5046 | 5046 | /* Set the default font */ |
5047 | 5047 | $myPicture->setFontProperties( |
5048 | 5048 | array( |
5049 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5049 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5050 | 5050 | 'FontSize' => 10) |
5051 | 5051 | ); |
5052 | 5052 | /* Write the chart title */ |
@@ -5063,7 +5063,7 @@ discard block |
||
5063 | 5063 | /* Set the default font */ |
5064 | 5064 | $myPicture->setFontProperties( |
5065 | 5065 | array( |
5066 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5066 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5067 | 5067 | 'FontSize' => 6 |
5068 | 5068 | ) |
5069 | 5069 | ); |
@@ -5105,7 +5105,7 @@ discard block |
||
5105 | 5105 | /* Draw the line chart */ |
5106 | 5106 | $myPicture->setFontProperties( |
5107 | 5107 | array( |
5108 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5108 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5109 | 5109 | 'FontSize' => 10 |
5110 | 5110 | ) |
5111 | 5111 | ); |
@@ -5138,12 +5138,12 @@ discard block |
||
5138 | 5138 | ); |
5139 | 5139 | |
5140 | 5140 | $myCache->writeToCache($chartHash, $myPicture); |
5141 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5141 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5142 | 5142 | $myCache->saveFromCache($chartHash, $imgPath); |
5143 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5143 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5144 | 5144 | } |
5145 | 5145 | |
5146 | - $html = '<img src="' . $imgPath . '">'; |
|
5146 | + $html = '<img src="'.$imgPath.'">'; |
|
5147 | 5147 | |
5148 | 5148 | return $html; |
5149 | 5149 | } |
@@ -5164,12 +5164,12 @@ discard block |
||
5164 | 5164 | |
5165 | 5165 | foreach ($attempts as $attempt) { |
5166 | 5166 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5167 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5168 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5167 | + if ($attempt['exe_weighting'] != 0) { |
|
5168 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5169 | 5169 | } |
5170 | 5170 | } else { |
5171 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5172 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5171 | + if ($attempt['exe_weighting'] != 0) { |
|
5172 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5173 | 5173 | } |
5174 | 5174 | } |
5175 | 5175 | } |
@@ -5178,27 +5178,27 @@ discard block |
||
5178 | 5178 | rsort($my_exercise_result_array); |
5179 | 5179 | $my_exercise_result = 0; |
5180 | 5180 | if (isset($my_exercise_result_array[0])) { |
5181 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5181 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5182 | 5182 | } |
5183 | 5183 | |
5184 | 5184 | $max = 100; |
5185 | - $pieces = 5 ; |
|
5185 | + $pieces = 5; |
|
5186 | 5186 | $part = round($max / $pieces); |
5187 | 5187 | $x_axis = array(); |
5188 | 5188 | $final_array = array(); |
5189 | 5189 | $my_final_array = array(); |
5190 | 5190 | |
5191 | - for ($i=1; $i <=$pieces; $i++) { |
|
5191 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5192 | 5192 | $sum = 1; |
5193 | 5193 | if ($i == 1) { |
5194 | 5194 | $sum = 0; |
5195 | 5195 | } |
5196 | - $min = ($i-1)*$part + $sum; |
|
5197 | - $max = ($i)*$part; |
|
5198 | - $x_axis[]= $min." - ".$max; |
|
5196 | + $min = ($i - 1) * $part + $sum; |
|
5197 | + $max = ($i) * $part; |
|
5198 | + $x_axis[] = $min." - ".$max; |
|
5199 | 5199 | $count = 0; |
5200 | - foreach($exercise_result as $result) { |
|
5201 | - $percentage = $result*100; |
|
5200 | + foreach ($exercise_result as $result) { |
|
5201 | + $percentage = $result * 100; |
|
5202 | 5202 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5203 | 5203 | if ($percentage >= $min && $percentage <= $max) { |
5204 | 5204 | //echo ' is > '; |
@@ -5206,7 +5206,7 @@ discard block |
||
5206 | 5206 | } |
5207 | 5207 | } |
5208 | 5208 | //echo '<br />'; |
5209 | - $final_array[]= $count; |
|
5209 | + $final_array[] = $count; |
|
5210 | 5210 | |
5211 | 5211 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5212 | 5212 | $my_final_array[] = 1; |
@@ -5216,9 +5216,9 @@ discard block |
||
5216 | 5216 | } |
5217 | 5217 | |
5218 | 5218 | //Fix to remove the data of the user with my data |
5219 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5219 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5220 | 5220 | if (!empty($my_final_array[$i])) { |
5221 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5221 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5222 | 5222 | $final_array[$i] = 0; |
5223 | 5223 | } |
5224 | 5224 | } |
@@ -5228,16 +5228,16 @@ discard block |
||
5228 | 5228 | $dataSet->addPoints($final_array, 'Serie1'); |
5229 | 5229 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5230 | 5230 | $dataSet->normalize(100, "%"); |
5231 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5231 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5232 | 5232 | |
5233 | 5233 | // Cache definition |
5234 | 5234 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5235 | 5235 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5236 | 5236 | $chartHash = $myCache->getHash($dataSet); |
5237 | 5237 | if ($myCache->isInCache($chartHash)) { |
5238 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5238 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5239 | 5239 | $myCache->saveFromCache($chartHash, $imgPath); |
5240 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5240 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5241 | 5241 | } else { |
5242 | 5242 | /* Create the pChart object */ |
5243 | 5243 | $widthSize = 80; |
@@ -5253,7 +5253,7 @@ discard block |
||
5253 | 5253 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5254 | 5254 | |
5255 | 5255 | /* Set the default font */ |
5256 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5256 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5257 | 5257 | |
5258 | 5258 | /* Do not write the chart title */ |
5259 | 5259 | |
@@ -5317,9 +5317,9 @@ discard block |
||
5317 | 5317 | |
5318 | 5318 | /* Save and write in cache */ |
5319 | 5319 | $myCache->writeToCache($chartHash, $myPicture); |
5320 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5320 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5321 | 5321 | $myCache->saveFromCache($chartHash, $imgPath); |
5322 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5322 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5323 | 5323 | } |
5324 | 5324 | |
5325 | 5325 | return $imgPath; |
@@ -5339,12 +5339,12 @@ discard block |
||
5339 | 5339 | } |
5340 | 5340 | foreach ($attempts as $attempt) { |
5341 | 5341 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5342 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5343 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5342 | + if ($attempt['exe_weighting'] != 0) { |
|
5343 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5344 | 5344 | } |
5345 | 5345 | } else { |
5346 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5347 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5346 | + if ($attempt['exe_weighting'] != 0) { |
|
5347 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5348 | 5348 | } |
5349 | 5349 | } |
5350 | 5350 | } |
@@ -5353,32 +5353,32 @@ discard block |
||
5353 | 5353 | rsort($my_exercise_result_array); |
5354 | 5354 | $my_exercise_result = 0; |
5355 | 5355 | if (isset($my_exercise_result_array[0])) { |
5356 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5356 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5357 | 5357 | } |
5358 | 5358 | |
5359 | 5359 | $max = 100; |
5360 | - $pieces = 5 ; |
|
5360 | + $pieces = 5; |
|
5361 | 5361 | $part = round($max / $pieces); |
5362 | 5362 | $x_axis = array(); |
5363 | 5363 | $final_array = array(); |
5364 | 5364 | $my_final_array = array(); |
5365 | 5365 | |
5366 | - for ($i=1; $i <=$pieces; $i++) { |
|
5366 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5367 | 5367 | $sum = 1; |
5368 | 5368 | if ($i == 1) { |
5369 | 5369 | $sum = 0; |
5370 | 5370 | } |
5371 | - $min = ($i-1)*$part + $sum; |
|
5372 | - $max = ($i)*$part; |
|
5373 | - $x_axis[]= $min." - ".$max; |
|
5371 | + $min = ($i - 1) * $part + $sum; |
|
5372 | + $max = ($i) * $part; |
|
5373 | + $x_axis[] = $min." - ".$max; |
|
5374 | 5374 | $count = 0; |
5375 | - foreach($exercise_result as $result) { |
|
5376 | - $percentage = $result*100; |
|
5375 | + foreach ($exercise_result as $result) { |
|
5376 | + $percentage = $result * 100; |
|
5377 | 5377 | if ($percentage >= $min && $percentage <= $max) { |
5378 | 5378 | $count++; |
5379 | 5379 | } |
5380 | 5380 | } |
5381 | - $final_array[]= $count; |
|
5381 | + $final_array[] = $count; |
|
5382 | 5382 | |
5383 | 5383 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5384 | 5384 | $my_final_array[] = 1; |
@@ -5389,9 +5389,9 @@ discard block |
||
5389 | 5389 | |
5390 | 5390 | //Fix to remove the data of the user with my data |
5391 | 5391 | |
5392 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5392 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5393 | 5393 | if (!empty($my_final_array[$i])) { |
5394 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5394 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5395 | 5395 | $final_array[$i] = 0; |
5396 | 5396 | } |
5397 | 5397 | } |
@@ -5409,7 +5409,7 @@ discard block |
||
5409 | 5409 | $dataSet->setXAxisName(get_lang('Score')); |
5410 | 5410 | $dataSet->normalize(100, "%"); |
5411 | 5411 | |
5412 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5412 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5413 | 5413 | |
5414 | 5414 | // Cache definition |
5415 | 5415 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5417,9 +5417,9 @@ discard block |
||
5417 | 5417 | $chartHash = $myCache->getHash($dataSet); |
5418 | 5418 | |
5419 | 5419 | if ($myCache->isInCache($chartHash)) { |
5420 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5420 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5421 | 5421 | $myCache->saveFromCache($chartHash, $imgPath); |
5422 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5422 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5423 | 5423 | } else { |
5424 | 5424 | /* Create the pChart object */ |
5425 | 5425 | $widthSize = 480; |
@@ -5435,7 +5435,7 @@ discard block |
||
5435 | 5435 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5436 | 5436 | |
5437 | 5437 | /* Set the default font */ |
5438 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5438 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5439 | 5439 | |
5440 | 5440 | /* Write the chart title */ |
5441 | 5441 | $myPicture->drawText( |
@@ -5494,9 +5494,9 @@ discard block |
||
5494 | 5494 | |
5495 | 5495 | /* Write and save into cache */ |
5496 | 5496 | $myCache->writeToCache($chartHash, $myPicture); |
5497 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5497 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5498 | 5498 | $myCache->saveFromCache($chartHash, $imgPath); |
5499 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5499 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5500 | 5500 | } |
5501 | 5501 | |
5502 | 5502 | return $imgPath; |
@@ -5623,7 +5623,7 @@ discard block |
||
5623 | 5623 | $whereSessionParams .= $sessionIdx.','; |
5624 | 5624 | } |
5625 | 5625 | } |
5626 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5626 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5627 | 5627 | } |
5628 | 5628 | |
5629 | 5629 | if (!empty($exerciseId)) { |
@@ -5684,7 +5684,7 @@ discard block |
||
5684 | 5684 | qq.position = rq.question_order AND |
5685 | 5685 | ta.question_id = rq.question_id |
5686 | 5686 | WHERE |
5687 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5687 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5688 | 5688 | AND q.c_id = $courseIdx |
5689 | 5689 | $where $order $limit"; |
5690 | 5690 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5732,7 +5732,7 @@ discard block |
||
5732 | 5732 | // Now fill users data |
5733 | 5733 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5734 | 5734 | FROM $tuser |
5735 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5735 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5736 | 5736 | $resUsers = Database::query($sqlUsers); |
5737 | 5737 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5738 | 5738 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5793,7 +5793,7 @@ discard block |
||
5793 | 5793 | WHERE |
5794 | 5794 | track_resource.c_id = $course_id AND |
5795 | 5795 | track_resource.insert_user_id = user.user_id AND |
5796 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5796 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5797 | 5797 | |
5798 | 5798 | if (isset($_GET['keyword'])) { |
5799 | 5799 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -5851,7 +5851,7 @@ discard block |
||
5851 | 5851 | WHERE |
5852 | 5852 | track_resource.c_id = $course_id AND |
5853 | 5853 | track_resource.insert_user_id = user.user_id AND |
5854 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5854 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5855 | 5855 | |
5856 | 5856 | if (isset($_GET['keyword'])) { |
5857 | 5857 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6145,7 +6145,7 @@ discard block |
||
6145 | 6145 | public static function display_additional_profile_fields() |
6146 | 6146 | { |
6147 | 6147 | // getting all the extra profile fields that are defined by the platform administrator |
6148 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6148 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6149 | 6149 | |
6150 | 6150 | // creating the form |
6151 | 6151 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6157,8 +6157,8 @@ discard block |
||
6157 | 6157 | $extra_fields_to_show = 0; |
6158 | 6158 | foreach ($extra_fields as $key=>$field) { |
6159 | 6159 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6160 | - if ($field[6]==1 && $field[8] == 1) { |
|
6161 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6160 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6161 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6162 | 6162 | $selected = 'selected="selected"'; |
6163 | 6163 | } else { |
6164 | 6164 | $selected = ''; |
@@ -6170,8 +6170,8 @@ discard block |
||
6170 | 6170 | $return .= '</select>'; |
6171 | 6171 | |
6172 | 6172 | // the form elements for the $_GET parameters (because the form is passed through GET |
6173 | - foreach ($_GET as $key=>$value){ |
|
6174 | - if ($key <> 'additional_profile_field') { |
|
6173 | + foreach ($_GET as $key=>$value) { |
|
6174 | + if ($key <> 'additional_profile_field') { |
|
6175 | 6175 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6176 | 6176 | } |
6177 | 6177 | } |
@@ -6208,21 +6208,21 @@ discard block |
||
6208 | 6208 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6209 | 6209 | |
6210 | 6210 | if (!empty($users)) { |
6211 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | - foreach($users as $user_id) { |
|
6211 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6212 | + foreach ($users as $user_id) { |
|
6213 | 6213 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6214 | 6214 | $tag_list = array(); |
6215 | - foreach($user_result as $item) { |
|
6215 | + foreach ($user_result as $item) { |
|
6216 | 6216 | $tag_list[] = $item['tag']; |
6217 | 6217 | } |
6218 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6218 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6219 | 6219 | } |
6220 | 6220 | } else { |
6221 | 6221 | $new_user_array = array(); |
6222 | 6222 | foreach ($users as $user_id) { |
6223 | - $new_user_array[]= "'".$user_id."'"; |
|
6223 | + $new_user_array[] = "'".$user_id."'"; |
|
6224 | 6224 | } |
6225 | - $users = implode(',',$new_user_array); |
|
6225 | + $users = implode(',', $new_user_array); |
|
6226 | 6226 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6227 | 6227 | // Selecting only the necessary information NOT ALL the user list |
6228 | 6228 | $sql = "SELECT user.user_id, v.value |
@@ -6237,7 +6237,7 @@ discard block |
||
6237 | 6237 | user.user_id IN ($users)"; |
6238 | 6238 | |
6239 | 6239 | $result = Database::query($sql); |
6240 | - while($row = Database::fetch_array($result)) { |
|
6240 | + while ($row = Database::fetch_array($result)) { |
|
6241 | 6241 | // get option value for field type double select by id |
6242 | 6242 | if (!empty($row['value'])) { |
6243 | 6243 | if ($result_extra_field['field_type'] == |
@@ -6276,7 +6276,7 @@ discard block |
||
6276 | 6276 | |
6277 | 6277 | public function sort_users_desc($a, $b) |
6278 | 6278 | { |
6279 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6279 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6311,7 +6311,7 @@ discard block |
||
6311 | 6311 | // get all users data from a course for sortable with limit |
6312 | 6312 | if (is_array($user_ids)) { |
6313 | 6313 | $user_ids = array_map('intval', $user_ids); |
6314 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6314 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6315 | 6315 | } else { |
6316 | 6316 | $user_ids = intval($user_ids); |
6317 | 6317 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6319,7 +6319,7 @@ discard block |
||
6319 | 6319 | |
6320 | 6320 | if (!empty($_GET['user_keyword'])) { |
6321 | 6321 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6322 | - $condition_user .= " AND ( |
|
6322 | + $condition_user .= " AND ( |
|
6323 | 6323 | user.firstname LIKE '%".$keyword."%' OR |
6324 | 6324 | user.lastname LIKE '%".$keyword."%' OR |
6325 | 6325 | user.username LIKE '%".$keyword."%' OR |
@@ -6337,7 +6337,7 @@ discard block |
||
6337 | 6337 | $invitedUsersCondition = ''; |
6338 | 6338 | |
6339 | 6339 | if (!$includeInvitedUsers) { |
6340 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6340 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6341 | 6341 | } |
6342 | 6342 | |
6343 | 6343 | $sql = "SELECT user.user_id as user_id, |
@@ -6348,7 +6348,7 @@ discard block |
||
6348 | 6348 | FROM $tbl_user as user $url_table |
6349 | 6349 | $condition_user $url_condition $invitedUsersCondition"; |
6350 | 6350 | |
6351 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6351 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6352 | 6352 | $direction = 'ASC'; |
6353 | 6353 | } |
6354 | 6354 | |
@@ -6485,7 +6485,7 @@ discard block |
||
6485 | 6485 | } |
6486 | 6486 | |
6487 | 6487 | if (empty($session_id)) { |
6488 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6488 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6489 | 6489 | } |
6490 | 6490 | |
6491 | 6491 | $user['link'] = '<center> |
@@ -6497,37 +6497,37 @@ discard block |
||
6497 | 6497 | // store columns in array $users |
6498 | 6498 | $is_western_name_order = api_is_western_name_order(); |
6499 | 6499 | $user_row = array(); |
6500 | - $user_row[]= $user['official_code']; //0 |
|
6500 | + $user_row[] = $user['official_code']; //0 |
|
6501 | 6501 | if ($is_western_name_order) { |
6502 | - $user_row[]= $user['firstname']; |
|
6503 | - $user_row[]= $user['lastname']; |
|
6502 | + $user_row[] = $user['firstname']; |
|
6503 | + $user_row[] = $user['lastname']; |
|
6504 | 6504 | } else { |
6505 | - $user_row[]= $user['lastname']; |
|
6506 | - $user_row[]= $user['firstname']; |
|
6505 | + $user_row[] = $user['lastname']; |
|
6506 | + $user_row[] = $user['firstname']; |
|
6507 | 6507 | } |
6508 | - $user_row[]= $user['username']; |
|
6509 | - $user_row[]= $user['time']; |
|
6510 | - $user_row[]= $user['average_progress']; |
|
6511 | - $user_row[]= $user['exercise_progress']; |
|
6512 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6513 | - $user_row[]= $user['student_score']; |
|
6514 | - $user_row[]= $user['count_assignments']; |
|
6515 | - $user_row[]= $user['count_messages']; |
|
6508 | + $user_row[] = $user['username']; |
|
6509 | + $user_row[] = $user['time']; |
|
6510 | + $user_row[] = $user['average_progress']; |
|
6511 | + $user_row[] = $user['exercise_progress']; |
|
6512 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6513 | + $user_row[] = $user['student_score']; |
|
6514 | + $user_row[] = $user['count_assignments']; |
|
6515 | + $user_row[] = $user['count_messages']; |
|
6516 | 6516 | |
6517 | 6517 | $userGroupManager = new UserGroup(); |
6518 | 6518 | $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); |
6519 | 6519 | |
6520 | 6520 | if (empty($session_id)) { |
6521 | - $user_row[]= $user['survey']; |
|
6521 | + $user_row[] = $user['survey']; |
|
6522 | 6522 | } |
6523 | 6523 | |
6524 | - $user_row[]= $user['first_connection']; |
|
6525 | - $user_row[]= $user['last_connection']; |
|
6524 | + $user_row[] = $user['first_connection']; |
|
6525 | + $user_row[] = $user['last_connection']; |
|
6526 | 6526 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6527 | - $user_row[]= $user['additional']; |
|
6527 | + $user_row[] = $user['additional']; |
|
6528 | 6528 | } |
6529 | 6529 | |
6530 | - $user_row[]= $user['link']; |
|
6530 | + $user_row[] = $user['link']; |
|
6531 | 6531 | |
6532 | 6532 | $users[] = $user_row; |
6533 | 6533 | |
@@ -6572,8 +6572,8 @@ discard block |
||
6572 | 6572 | |
6573 | 6573 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6574 | 6574 | $tempView = $view; |
6575 | - if(substr($view,0,1) == '1') { |
|
6576 | - $new_view = substr_replace($view,'0',0,1); |
|
6575 | + if (substr($view, 0, 1) == '1') { |
|
6576 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6577 | 6577 | echo " |
6578 | 6578 | <tr> |
6579 | 6579 | <td valign='top'> |
@@ -6606,9 +6606,9 @@ discard block |
||
6606 | 6606 | </tr>"; |
6607 | 6607 | $total = 0; |
6608 | 6608 | if (is_array($results)) { |
6609 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6609 | + for ($j = 0; $j < count($results); $j++) { |
|
6610 | 6610 | echo "<tr>"; |
6611 | - 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>"; |
|
6611 | + 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>"; |
|
6612 | 6612 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6613 | 6613 | echo"</tr>"; |
6614 | 6614 | $total = $total + $results[$j][1]; |
@@ -6625,7 +6625,7 @@ discard block |
||
6625 | 6625 | echo "</table>"; |
6626 | 6626 | echo "</td></tr>"; |
6627 | 6627 | } else { |
6628 | - $new_view = substr_replace($view,'1',0,1); |
|
6628 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6629 | 6629 | echo " |
6630 | 6630 | <tr> |
6631 | 6631 | <td valign='top'> |
@@ -6648,8 +6648,8 @@ discard block |
||
6648 | 6648 | { |
6649 | 6649 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6650 | 6650 | $courseId = api_get_course_int_id($courseCode); |
6651 | - if(substr($view,1,1) == '1') { |
|
6652 | - $new_view = substr_replace($view,'0',1,1); |
|
6651 | + if (substr($view, 1, 1) == '1') { |
|
6652 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6653 | 6653 | echo "<tr> |
6654 | 6654 | <td valign='top'> |
6655 | 6655 | <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>] |
@@ -6691,7 +6691,7 @@ discard block |
||
6691 | 6691 | </tr>"; |
6692 | 6692 | |
6693 | 6693 | if (is_array($results)) { |
6694 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6694 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6695 | 6695 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6696 | 6696 | echo "<tr>\n"; |
6697 | 6697 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6706,8 +6706,8 @@ discard block |
||
6706 | 6706 | |
6707 | 6707 | // The Result of Tests |
6708 | 6708 | if (is_array($hpresults)) { |
6709 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6709 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6711 | 6711 | if ($title == '') |
6712 | 6712 | $title = basename($hpresults[$i][0]); |
6713 | 6713 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6733,7 +6733,7 @@ discard block |
||
6733 | 6733 | echo "</table>"; |
6734 | 6734 | echo "</td>\n</tr>\n"; |
6735 | 6735 | } else { |
6736 | - $new_view = substr_replace($view,'1',1,1); |
|
6736 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6737 | 6737 | echo " |
6738 | 6738 | <tr> |
6739 | 6739 | <td valign='top'> |
@@ -6752,8 +6752,8 @@ discard block |
||
6752 | 6752 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6753 | 6753 | $_course = api_get_course_info_by_id($course_id); |
6754 | 6754 | |
6755 | - if (substr($view,2,1) == '1') { |
|
6756 | - $new_view = substr_replace($view,'0',2,1); |
|
6755 | + if (substr($view, 2, 1) == '1') { |
|
6756 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6757 | 6757 | echo "<tr> |
6758 | 6758 | <td valign='top'> |
6759 | 6759 | <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>] |
@@ -6767,7 +6767,7 @@ discard block |
||
6767 | 6767 | AND u.c_id = '".intval($course_id)."' |
6768 | 6768 | ORDER BY u.upload_date DESC"; |
6769 | 6769 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6770 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6770 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6771 | 6771 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6772 | 6772 | echo "<tr> |
6773 | 6773 | <td class='secLine' width='40%'> |
@@ -6781,7 +6781,7 @@ discard block |
||
6781 | 6781 | </td> |
6782 | 6782 | </tr>"; |
6783 | 6783 | if (is_array($results)) { |
6784 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6784 | + for ($j = 0; $j < count($results); $j++) { |
|
6785 | 6785 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6786 | 6786 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6787 | 6787 | echo "<tr>"; |
@@ -6800,7 +6800,7 @@ discard block |
||
6800 | 6800 | echo "</table>"; |
6801 | 6801 | echo "</td></tr>"; |
6802 | 6802 | } else { |
6803 | - $new_view = substr_replace($view,'1',2,1); |
|
6803 | + $new_view = substr_replace($view, '1', 2, 1); |
|
6804 | 6804 | echo " |
6805 | 6805 | <tr> |
6806 | 6806 | <td valign='top'> |
@@ -6819,8 +6819,8 @@ discard block |
||
6819 | 6819 | { |
6820 | 6820 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
6821 | 6821 | $courseId = api_get_course_int_id($courseCode); |
6822 | - if (substr($view,3,1) == '1') { |
|
6823 | - $new_view = substr_replace($view,'0',3,1); |
|
6822 | + if (substr($view, 3, 1) == '1') { |
|
6823 | + $new_view = substr_replace($view, '0', 3, 1); |
|
6824 | 6824 | echo " |
6825 | 6825 | <tr> |
6826 | 6826 | <td valign='top'> |
@@ -6844,7 +6844,7 @@ discard block |
||
6844 | 6844 | </td> |
6845 | 6845 | </tr>"; |
6846 | 6846 | if (is_array($results)) { |
6847 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6847 | + for ($j = 0; $j < count($results); $j++) { |
|
6848 | 6848 | echo "<tr>"; |
6849 | 6849 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
6850 | 6850 | echo"</tr>"; |
@@ -6857,7 +6857,7 @@ discard block |
||
6857 | 6857 | echo "</table>"; |
6858 | 6858 | echo "</td></tr>"; |
6859 | 6859 | } else { |
6860 | - $new_view = substr_replace($view,'1',3,1); |
|
6860 | + $new_view = substr_replace($view, '1', 3, 1); |
|
6861 | 6861 | echo " |
6862 | 6862 | <tr> |
6863 | 6863 | <td valign='top'> |
@@ -6884,8 +6884,8 @@ discard block |
||
6884 | 6884 | $session_id = intval($session_id); |
6885 | 6885 | |
6886 | 6886 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
6887 | - if(substr($view,4,1) == '1') { |
|
6888 | - $new_view = substr_replace($view,'0',4,1); |
|
6887 | + if (substr($view, 4, 1) == '1') { |
|
6888 | + $new_view = substr_replace($view, '0', 4, 1); |
|
6889 | 6889 | echo " |
6890 | 6890 | <tr> |
6891 | 6891 | <td valign='top'> |
@@ -6911,7 +6911,7 @@ discard block |
||
6911 | 6911 | </td> |
6912 | 6912 | </tr>"; |
6913 | 6913 | if (is_array($results)) { |
6914 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6914 | + for ($j = 0; $j < count($results); $j++) { |
|
6915 | 6915 | echo "<tr>"; |
6916 | 6916 | echo "<td class='content'>".$results[$j]."</td>"; |
6917 | 6917 | echo"</tr>"; |
@@ -6924,7 +6924,7 @@ discard block |
||
6924 | 6924 | echo "</table>"; |
6925 | 6925 | echo "</td></tr>"; |
6926 | 6926 | } else { |
6927 | - $new_view = substr_replace($view,'1',4,1); |
|
6927 | + $new_view = substr_replace($view, '1', 4, 1); |
|
6928 | 6928 | echo " |
6929 | 6929 | <tr> |
6930 | 6930 | <td valign='top'> |
@@ -6958,11 +6958,11 @@ discard block |
||
6958 | 6958 | ORDER BY login_date DESC LIMIT 1"; |
6959 | 6959 | $ip = ''; |
6960 | 6960 | $res_ip = Database::query($sql_ip); |
6961 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
6961 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
6962 | 6962 | $row_ip = Database::fetch_row($res_ip); |
6963 | 6963 | if ($return_as_link) { |
6964 | 6964 | $ip = Display::url( |
6965 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
6965 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
6966 | 6966 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
6967 | 6967 | ); |
6968 | 6968 | } else { |
@@ -6998,9 +6998,9 @@ discard block |
||
6998 | 6998 | $course_id = intval($course_id); |
6999 | 6999 | |
7000 | 7000 | $tempView = $view; |
7001 | - if (substr($view,0,1) == '1') { |
|
7002 | - $new_view = substr_replace($view,'0',0,1); |
|
7003 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7001 | + if (substr($view, 0, 1) == '1') { |
|
7002 | + $new_view = substr_replace($view, '0', 0, 1); |
|
7003 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | 7004 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
7005 | 7005 | FROM $track_access_table |
7006 | 7006 | WHERE access_user_id = $user_id |
@@ -7010,20 +7010,20 @@ discard block |
||
7010 | 7010 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7011 | 7011 | //$results = getManyResults2Col($sql); |
7012 | 7012 | $results = getManyResults3Col($sql); |
7013 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | - $line=''; |
|
7013 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | + $line = ''; |
|
7015 | 7015 | $total = 0; |
7016 | 7016 | if (is_array($results)) { |
7017 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7017 | + for ($j = 0; $j < count($results); $j++) { |
|
7018 | 7018 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
7019 | 7019 | $total = $total + $results[$j][1]; |
7020 | 7020 | } |
7021 | 7021 | $line .= get_lang('Total').";".$total."\n"; |
7022 | 7022 | } else { |
7023 | - $line= get_lang('NoResult')."</center></td>"; |
|
7023 | + $line = get_lang('NoResult')."</center></td>"; |
|
7024 | 7024 | } |
7025 | 7025 | } else { |
7026 | - $new_view = substr_replace($view,'1',0,1); |
|
7026 | + $new_view = substr_replace($view, '1', 0, 1); |
|
7027 | 7027 | } |
7028 | 7028 | return array($title_line, $line); |
7029 | 7029 | } |
@@ -7041,8 +7041,8 @@ discard block |
||
7041 | 7041 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
7042 | 7042 | $courseId = api_get_course_int_id($courseCode); |
7043 | 7043 | $userId = intval($userId); |
7044 | - if (substr($view,1,1) == '1') { |
|
7045 | - $new_view = substr_replace($view,'0',1,1); |
|
7044 | + if (substr($view, 1, 1) == '1') { |
|
7045 | + $new_view = substr_replace($view, '0', 1, 1); |
|
7046 | 7046 | $title[1] = get_lang('ExercicesDetails'); |
7047 | 7047 | $line = ''; |
7048 | 7048 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7066,7 +7066,7 @@ discard block |
||
7066 | 7066 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
7067 | 7067 | |
7068 | 7068 | if (is_array($results)) { |
7069 | - for($i = 0; $i < sizeof($results); $i++) |
|
7069 | + for ($i = 0; $i < sizeof($results); $i++) |
|
7070 | 7070 | { |
7071 | 7071 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
7072 | 7072 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7078,8 +7078,8 @@ discard block |
||
7078 | 7078 | |
7079 | 7079 | // The Result of Tests |
7080 | 7080 | if (is_array($hpresults)) { |
7081 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7081 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
7083 | 7083 | |
7084 | 7084 | if ($title == '') |
7085 | 7085 | $title = basename($hpresults[$i][0]); |
@@ -7093,10 +7093,10 @@ discard block |
||
7093 | 7093 | } |
7094 | 7094 | |
7095 | 7095 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
7096 | - $line=get_lang('NoResult'); |
|
7096 | + $line = get_lang('NoResult'); |
|
7097 | 7097 | } |
7098 | 7098 | } else { |
7099 | - $new_view = substr_replace($view,'1',1,1); |
|
7099 | + $new_view = substr_replace($view, '1', 1, 1); |
|
7100 | 7100 | } |
7101 | 7101 | return array($title_line, $line); |
7102 | 7102 | } |
@@ -7112,7 +7112,7 @@ discard block |
||
7112 | 7112 | $user_id = intval($user_id); |
7113 | 7113 | $course_id = intval($course_id); |
7114 | 7114 | |
7115 | - if (substr($view,2,1) == '1') { |
|
7115 | + if (substr($view, 2, 1) == '1') { |
|
7116 | 7116 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7117 | 7117 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7118 | 7118 | WHERE |
@@ -7120,21 +7120,21 @@ discard block |
||
7120 | 7120 | u.upload_user_id = '$user_id' AND |
7121 | 7121 | u.c_id = '$course_id' |
7122 | 7122 | ORDER BY u.upload_date DESC"; |
7123 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7123 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7124 | 7124 | |
7125 | - $title[1]=get_lang('WorksDetails'); |
|
7126 | - $line=''; |
|
7127 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7125 | + $title[1] = get_lang('WorksDetails'); |
|
7126 | + $line = ''; |
|
7127 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | 7128 | |
7129 | 7129 | if (is_array($results)) { |
7130 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7130 | + for ($j = 0; $j < count($results); $j++) { |
|
7131 | 7131 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7132 | 7132 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7133 | 7133 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7134 | 7134 | } |
7135 | 7135 | |
7136 | 7136 | } else { |
7137 | - $line= get_lang('NoResult'); |
|
7137 | + $line = get_lang('NoResult'); |
|
7138 | 7138 | } |
7139 | 7139 | } |
7140 | 7140 | return array($title_line, $line); |
@@ -7150,9 +7150,9 @@ discard block |
||
7150 | 7150 | $courseId = api_get_course_int_id($courseCode); |
7151 | 7151 | $userId = intval($userId); |
7152 | 7152 | $line = null; |
7153 | - if (substr($view,3,1) == '1') { |
|
7154 | - $new_view = substr_replace($view,'0',3,1); |
|
7155 | - $title[1]=get_lang('LinksDetails'); |
|
7153 | + if (substr($view, 3, 1) == '1') { |
|
7154 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7155 | + $title[1] = get_lang('LinksDetails'); |
|
7156 | 7156 | $sql = "SELECT cl.title, cl.url |
7157 | 7157 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7158 | 7158 | WHERE sl.links_link_id = cl.id |
@@ -7160,16 +7160,16 @@ discard block |
||
7160 | 7160 | AND sl.links_user_id = $userId |
7161 | 7161 | GROUP BY cl.title, cl.url"; |
7162 | 7162 | $results = StatsUtils::getManyResults2Col($sql); |
7163 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7163 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | 7164 | if (is_array($results)) { |
7165 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7165 | + for ($j = 0; $j < count($results); $j++) { |
|
7166 | 7166 | $line .= $results[$j][0]."\n"; |
7167 | 7167 | } |
7168 | 7168 | } else { |
7169 | - $line=get_lang('NoResult'); |
|
7169 | + $line = get_lang('NoResult'); |
|
7170 | 7170 | } |
7171 | 7171 | } else { |
7172 | - $new_view = substr_replace($view,'1',3,1); |
|
7172 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7173 | 7173 | } |
7174 | 7174 | return array($title_line, $line); |
7175 | 7175 | } |
@@ -7191,9 +7191,9 @@ discard block |
||
7191 | 7191 | |
7192 | 7192 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7193 | 7193 | |
7194 | - if (substr($view,4,1) == '1') { |
|
7195 | - $new_view = substr_replace($view,'0',4,1); |
|
7196 | - $title[1]= get_lang('DocumentsDetails'); |
|
7194 | + if (substr($view, 4, 1) == '1') { |
|
7195 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7196 | + $title[1] = get_lang('DocumentsDetails'); |
|
7197 | 7197 | |
7198 | 7198 | $sql = "SELECT down_doc_path |
7199 | 7199 | FROM $downloads_table |
@@ -7206,14 +7206,14 @@ discard block |
||
7206 | 7206 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7207 | 7207 | $line = null; |
7208 | 7208 | if (is_array($results)) { |
7209 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7209 | + for ($j = 0; $j < count($results); $j++) { |
|
7210 | 7210 | $line .= $results[$j]."\n"; |
7211 | 7211 | } |
7212 | 7212 | } else { |
7213 | 7213 | $line = get_lang('NoResult'); |
7214 | 7214 | } |
7215 | 7215 | } else { |
7216 | - $new_view = substr_replace($view,'1',4,1); |
|
7216 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7217 | 7217 | } |
7218 | 7218 | return array($title_line, $line); |
7219 | 7219 | } |