@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if ($show_output) { |
95 | 95 | Display::addFlash( |
96 | 96 | Display::return_message( |
97 | - get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size), |
|
97 | + get_lang('UplExceedMaxPostSize').format_file_size($max_file_size), |
|
98 | 98 | 'error' |
99 | 99 | ) |
100 | 100 | ); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | if ($show_output) { |
119 | 119 | Display::addFlash( |
120 | 120 | Display::return_message( |
121 | - get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'), |
|
121 | + get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst'), |
|
122 | 122 | 'error' |
123 | 123 | ) |
124 | 124 | ); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | if ($output) { |
473 | 473 | Display::addFlash( |
474 | 474 | Display::return_message( |
475 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'), |
|
475 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'), |
|
476 | 476 | 'confirmation', |
477 | 477 | false |
478 | 478 | ) |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | if ($output) { |
610 | 610 | Display::addFlash( |
611 | 611 | Display::return_message( |
612 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle, |
|
612 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
613 | 613 | 'success', |
614 | 614 | false |
615 | 615 | ) |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | if ($output) { |
687 | 687 | Display::addFlash( |
688 | 688 | Display::display_confirmation_message( |
689 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle, |
|
689 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle, |
|
690 | 690 | false, |
691 | 691 | true |
692 | 692 | ) |
@@ -772,12 +772,12 @@ discard block |
||
772 | 772 | function dir_total_space($dir_path) |
773 | 773 | { |
774 | 774 | $save_dir = getcwd(); |
775 | - chdir($dir_path) ; |
|
775 | + chdir($dir_path); |
|
776 | 776 | $handle = opendir($dir_path); |
777 | 777 | $sumSize = 0; |
778 | 778 | $dirList = array(); |
779 | 779 | while ($element = readdir($handle)) { |
780 | - if ( $element == '.' || $element == '..') { |
|
780 | + if ($element == '.' || $element == '..') { |
|
781 | 781 | continue; // Skip the current and parent directories |
782 | 782 | } |
783 | 783 | if (is_file($element)) { |
@@ -788,11 +788,11 @@ discard block |
||
788 | 788 | } |
789 | 789 | } |
790 | 790 | |
791 | - closedir($handle) ; |
|
791 | + closedir($handle); |
|
792 | 792 | |
793 | 793 | if (sizeof($dirList) > 0) { |
794 | 794 | foreach ($dirList as $j) { |
795 | - $sizeDir = dir_total_space($j); // Recursivity |
|
795 | + $sizeDir = dir_total_space($j); // Recursivity |
|
796 | 796 | $sumSize += $sizeDir; |
797 | 797 | } |
798 | 798 | } |
@@ -826,63 +826,63 @@ discard block |
||
826 | 826 | |
827 | 827 | static $mime_type = array(); |
828 | 828 | |
829 | - $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
830 | - $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
831 | - $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
832 | - $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
833 | - $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
834 | - $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
835 | - $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
836 | - $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
837 | - $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
838 | - $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
839 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
840 | - $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
841 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
842 | - $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
843 | - $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
844 | - $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
845 | - $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
846 | - $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
847 | - $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
848 | - $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
849 | - $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
850 | - $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
851 | - $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
852 | - $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
853 | - $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
854 | - $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
855 | - $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
856 | - $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
857 | - $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
858 | - |
|
859 | - $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
860 | - $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
861 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
862 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
863 | - $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
864 | - $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
865 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
866 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
867 | - $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
868 | - |
|
869 | - $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
870 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
871 | - $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
872 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
873 | - $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
874 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
875 | - $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
876 | - $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
877 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
878 | - $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
879 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
880 | - $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
881 | - $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
882 | - $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
883 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
884 | - $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
885 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
829 | + $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
830 | + $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
831 | + $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
832 | + $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
833 | + $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
834 | + $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
835 | + $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
836 | + $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
837 | + $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
838 | + $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
839 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
840 | + $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
841 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
842 | + $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
843 | + $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
844 | + $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
845 | + $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
846 | + $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
847 | + $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
848 | + $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
849 | + $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
850 | + $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
851 | + $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
852 | + $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
853 | + $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
854 | + $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
855 | + $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
856 | + $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
857 | + $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
858 | + |
|
859 | + $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
860 | + $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
861 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
862 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
863 | + $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
864 | + $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
865 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
866 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
867 | + $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
868 | + |
|
869 | + $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
870 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
871 | + $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
872 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
873 | + $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
874 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
875 | + $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
876 | + $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
877 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
878 | + $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
879 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
880 | + $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
881 | + $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
882 | + $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
883 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
884 | + $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
885 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
886 | 886 | |
887 | 887 | // Test on PC (files with no extension get application/octet-stream) |
888 | 888 | //$mime_type[] = 'application/octet-stream'; $extension[] = '.ext'; |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | |
892 | 892 | foreach ($mime_type as $key => & $type) { |
893 | 893 | if ($type == $file_type) { |
894 | - $file_name .= $extension[$key]; |
|
894 | + $file_name .= $extension[$key]; |
|
895 | 895 | break; |
896 | 896 | } |
897 | 897 | } |
@@ -967,12 +967,12 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | // It happens on Linux that $upload_path sometimes doesn't start with '/' |
970 | - if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') { |
|
970 | + if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { |
|
971 | 971 | $upload_path = '/'.$upload_path; |
972 | 972 | } |
973 | 973 | |
974 | 974 | if ($upload_path[strlen($upload_path) - 1] == '/') { |
975 | - $upload_path=substr($upload_path, 0, -1); |
|
975 | + $upload_path = substr($upload_path, 0, -1); |
|
976 | 976 | } |
977 | 977 | |
978 | 978 | /* Uncompressing phase */ |
@@ -984,15 +984,15 @@ discard block |
||
984 | 984 | - add it to the database |
985 | 985 | - parse & change relative html links |
986 | 986 | */ |
987 | - if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
987 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
988 | 988 | // Shell Method - if this is possible, it gains some speed |
989 | - exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']); |
|
989 | + exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
|
990 | 990 | } else { |
991 | 991 | // PHP method - slower... |
992 | 992 | $save_dir = getcwd(); |
993 | 993 | chdir($base_work_dir.$upload_path); |
994 | 994 | $unzippingState = $zip_file->extract(); |
995 | - for ($j=0; $j < count($unzippingState); $j++) { |
|
995 | + for ($j = 0; $j < count($unzippingState); $j++) { |
|
996 | 996 | $state = $unzippingState[$j]; |
997 | 997 | |
998 | 998 | // Fix relative links in html files |
@@ -1006,8 +1006,8 @@ discard block |
||
1006 | 1006 | if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
1007 | 1007 | |
1008 | 1008 | $safe_file = api_replace_dangerous_char($file); |
1009 | - @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
|
1010 | - set_default_settings($upload_path, $safe_file,$filetype); |
|
1009 | + @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
|
1010 | + set_default_settings($upload_path, $safe_file, $filetype); |
|
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | $zip = new PclZip($uploaded_file['tmp_name']); |
1058 | 1058 | |
1059 | 1059 | // Check the zip content (real size and file extension) |
1060 | - $zip_content_array = (array)$zip->listContent(); |
|
1060 | + $zip_content_array = (array) $zip->listContent(); |
|
1061 | 1061 | |
1062 | 1062 | $realSize = 0; |
1063 | 1063 | foreach ($zip_content_array as & $this_content) { |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | function filter_extension(&$filename) |
1160 | 1160 | { |
1161 | 1161 | if (substr($filename, -1) == '/') { |
1162 | - return 1; // Authorize directories |
|
1162 | + return 1; // Authorize directories |
|
1163 | 1163 | } |
1164 | 1164 | $blacklist = api_get_setting('upload_extensions_list_type'); |
1165 | 1165 | if ($blacklist != 'whitelist') { // if = blacklist |
@@ -1392,9 +1392,9 @@ discard block |
||
1392 | 1392 | $upload_path = str_replace('//', '/', $upload_path); |
1393 | 1393 | |
1394 | 1394 | if ($upload_path == '/') { |
1395 | - $upload_path=''; |
|
1395 | + $upload_path = ''; |
|
1396 | 1396 | } elseif (!empty($upload_path) && $upload_path[0] != '/') { |
1397 | - $upload_path="/$upload_path"; |
|
1397 | + $upload_path = "/$upload_path"; |
|
1398 | 1398 | } |
1399 | 1399 | |
1400 | 1400 | $endchar = substr($filename, strlen($filename) - 1, 1); |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | $img_path_list = array(); |
1433 | 1433 | |
1434 | 1434 | if (!$fp = fopen($html_file, 'r')) { |
1435 | - return ; |
|
1435 | + return; |
|
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | // Aearch and store occurences of the <img> tag in an array |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | $img_tag_list = $matches[0]; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | - fclose ($fp); |
|
1455 | + fclose($fp); |
|
1456 | 1456 | unset($buffer); |
1457 | 1457 | |
1458 | 1458 | // Search the image file path from all the <IMG> tag detected |
@@ -1551,7 +1551,7 @@ discard block |
||
1551 | 1551 | |
1552 | 1552 | if (!is_dir($base_work_dir.$systemFolderName)) { |
1553 | 1553 | $result = mkdir( |
1554 | - $base_work_dir . $systemFolderName, |
|
1554 | + $base_work_dir.$systemFolderName, |
|
1555 | 1555 | api_get_permissions_for_new_directories(), |
1556 | 1556 | true |
1557 | 1557 | ); |
@@ -1564,7 +1564,7 @@ discard block |
||
1564 | 1564 | WHERE |
1565 | 1565 | c_id = $course_id AND |
1566 | 1566 | ( |
1567 | - path = '" . Database::escape_string($systemFolderName). "' |
|
1567 | + path = '".Database::escape_string($systemFolderName)."' |
|
1568 | 1568 | ) |
1569 | 1569 | "; |
1570 | 1570 | |
@@ -1721,7 +1721,7 @@ discard block |
||
1721 | 1721 | |
1722 | 1722 | // Fix the image tags |
1723 | 1723 | |
1724 | - for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) { |
|
1724 | + for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) { |
|
1725 | 1725 | $replace_what = $original_img_path[$i]; |
1726 | 1726 | // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif |
1727 | 1727 | $exploded_file_path = explode('/', $new_img_path[$i]); |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | .'</body>' |
1763 | 1763 | .'</html>'; |
1764 | 1764 | if (file_exists($file_path)) { |
1765 | - if (!($fp = fopen ($file_path, 'w'))) { |
|
1765 | + if (!($fp = fopen($file_path, 'w'))) { |
|
1766 | 1766 | return false; |
1767 | 1767 | } |
1768 | 1768 | return fwrite($fp, $file_content); |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | { |
1800 | 1800 | // Do we need a / or not? |
1801 | 1801 | $added_slash = ($upload_path == '/') ? '' : '/'; |
1802 | - $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1802 | + $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1803 | 1803 | // Build the form |
1804 | 1804 | $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>" |
1805 | 1805 | ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">" |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | // is necessary verify check |
218 | 218 | if ($legal_type == 1) { |
219 | - if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) { |
|
219 | + if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) { |
|
220 | 220 | $legal_option = true; |
221 | 221 | } else { |
222 | 222 | $legal_option = false; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * Process external authentication |
505 | 505 | * on the basis of the given login name |
506 | 506 | */ |
507 | - $loginFailed = true; // Default initialisation. It could |
|
507 | + $loginFailed = true; // Default initialisation. It could |
|
508 | 508 | // change after the external authentication |
509 | 509 | $key = $uData['auth_source']; //'ldap','shibboleth'... |
510 | 510 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * Process external authentication |
550 | 550 | * on the basis of the given login name |
551 | 551 | */ |
552 | - $loginFailed = true; // Default initialisation. It could |
|
552 | + $loginFailed = true; // Default initialisation. It could |
|
553 | 553 | // change after the external authentication |
554 | 554 | $key = $uData['auth_source']; //'ldap','shibboleth'... |
555 | 555 | |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | } else { |
561 | 561 | // change after the external authentication |
562 | 562 | // login failed, Database::num_rows($result) <= 0 |
563 | - $loginFailed = true; // Default initialisation. It could |
|
563 | + $loginFailed = true; // Default initialisation. It could |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | // login failed, Database::num_rows($result) <= 0 |
567 | - $loginFailed = true; // Default initialisation. It could |
|
567 | + $loginFailed = true; // Default initialisation. It could |
|
568 | 568 | // change after the external authentication |
569 | 569 | |
570 | 570 | /* |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | include_once($thisAuthSource['newUser']); |
594 | 594 | } else { |
595 | 595 | error_log( |
596 | - 'Chamilo Authentication external file' . |
|
596 | + 'Chamilo Authentication external file'. |
|
597 | 597 | ' could not be found - this might prevent your system from using'. |
598 | 598 | ' the authentication process in the user creation process', |
599 | 599 | 0 |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | online_logout(null, false); |
706 | 706 | $osso->logout(); //redirects and exits |
707 | 707 | } |
708 | - } elseif (api_get_setting('openid_authentication')=='true') { |
|
708 | + } elseif (api_get_setting('openid_authentication') == 'true') { |
|
709 | 709 | if (!empty($_POST['openid_url'])) { |
710 | 710 | include api_get_path(SYS_CODE_PATH).'auth/openid/login.php'; |
711 | 711 | openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php'); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | if ($res['status'] == 'success') { |
719 | 719 | $id1 = Database::escape_string($res['openid.identity']); |
720 | 720 | //have another id with or without the final '/' |
721 | - $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/'); |
|
721 | + $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/'); |
|
722 | 722 | //lookup the user in the main database |
723 | 723 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
724 | 724 | $sql = "SELECT user_id, username, password, auth_source, active, expiration_date |
@@ -727,14 +727,14 @@ discard block |
||
727 | 727 | OR openid = '$id2' "; |
728 | 728 | $result = Database::query($sql); |
729 | 729 | if ($result !== false) { |
730 | - if (Database::num_rows($result)>0) { |
|
730 | + if (Database::num_rows($result) > 0) { |
|
731 | 731 | $uData = Database::fetch_array($result); |
732 | 732 | |
733 | 733 | if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) { |
734 | 734 | //the authentification of this user is managed by Chamilo itself |
735 | 735 | |
736 | 736 | // check if the account is active (not locked) |
737 | - if ($uData['active']=='1') { |
|
737 | + if ($uData['active'] == '1') { |
|
738 | 738 | // check if the expiration date has not been reached |
739 | 739 | if ($uData['expiration_date'] > date('Y-m-d H:i:s') |
740 | 740 | || empty($uData['expiration_date']) |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) |
814 | 814 | ) { |
815 | 815 | $cidReset = true; |
816 | - $gidReset = true; // As groups depend from courses, group id is reset |
|
816 | + $gidReset = true; // As groups depend from courses, group id is reset |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /* USER INIT */ |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
958 | 958 | |
959 | 959 | if (!empty($_GET['id_session'])) { |
960 | - $sql = 'SELECT name FROM '.$tbl_session . ' |
|
961 | - WHERE id="'.intval($_GET['id_session']) . '"'; |
|
960 | + $sql = 'SELECT name FROM '.$tbl_session.' |
|
961 | + WHERE id="'.intval($_GET['id_session']).'"'; |
|
962 | 962 | $rs = Database::query($sql); |
963 | 963 | if (Database::num_rows($rs)) { |
964 | 964 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | // Moreover, if we want to track a course with another session it can be usefull |
1046 | 1046 | if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) { |
1047 | 1047 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
1048 | - $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"'; |
|
1048 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"'; |
|
1049 | 1049 | $rs = Database::query($sql); |
1050 | 1050 | if (Database::num_rows($rs)) { |
1051 | 1051 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | $url = api_get_path(WEB_CODE_PATH).'auth/inscription.php'; |
1172 | - header("Location:". $url); |
|
1172 | + header("Location:".$url); |
|
1173 | 1173 | exit; |
1174 | 1174 | } |
1175 | 1175 | } |
@@ -1189,8 +1189,8 @@ discard block |
||
1189 | 1189 | if (Database::num_rows($result) > 0) { // this user have a recorded state for this course |
1190 | 1190 | $cuData = Database::fetch_array($result, 'ASSOC'); |
1191 | 1191 | |
1192 | - $is_courseAdmin = (bool)($cuData['status'] == 1); |
|
1193 | - $is_courseTutor = (bool)($cuData['is_tutor'] == 1); |
|
1192 | + $is_courseAdmin = (bool) ($cuData['status'] == 1); |
|
1193 | + $is_courseTutor = (bool) ($cuData['is_tutor'] == 1); |
|
1194 | 1194 | $is_courseMember = true; |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | // This user has no status related to this course |
1202 | 1202 | // The user is subscribed in a session? The user is a Session coach a Session admin ? |
1203 | 1203 | |
1204 | - $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1204 | + $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
1205 | 1205 | $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); |
1206 | 1206 | $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1207 | 1207 | |
@@ -1506,12 +1506,12 @@ discard block |
||
1506 | 1506 | ($logging_in && exist_firstpage_parameter()) |
1507 | 1507 | ) { |
1508 | 1508 | $redirectCourseDir = api_get_firstpage_parameter(); |
1509 | - api_delete_firstpage_parameter(); // delete the cookie |
|
1509 | + api_delete_firstpage_parameter(); // delete the cookie |
|
1510 | 1510 | |
1511 | 1511 | if (!isset($_SESSION['request_uri'])) { |
1512 | 1512 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1513 | 1513 | $_SESSION['noredirection'] = false; |
1514 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1514 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1515 | 1515 | } |
1516 | 1516 | } |
1517 | 1517 | } elseif (api_user_is_login() && exist_firstpage_parameter()) { |
@@ -1519,7 +1519,7 @@ discard block |
||
1519 | 1519 | api_delete_firstpage_parameter(); // delete the cookie |
1520 | 1520 | if (CourseManager::get_course_id_from_path($redirectCourseDir)) { |
1521 | 1521 | $_SESSION['noredirection'] = false; |
1522 | - $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/'; |
|
1522 | + $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/'; |
|
1523 | 1523 | } |
1524 | 1524 | } |
1525 | 1525 |
@@ -550,17 +550,17 @@ discard block |
||
550 | 550 | } |
551 | 551 | } |
552 | 552 | $max_cols_per_page = 12; //10 dates + 2 name and number |
553 | - $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10 |
|
553 | + $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2; //10 |
|
554 | 554 | $rows = count($data_table); |
555 | 555 | |
556 | 556 | if ($cols > $max_cols_per_page) { |
557 | - $number_tables = round(($cols-2)/$max_dates_per_page); |
|
557 | + $number_tables = round(($cols - 2) / $max_dates_per_page); |
|
558 | 558 | $headers = $data_table[0]; |
559 | 559 | $all = array(); |
560 | 560 | $tables = array(); |
561 | 561 | $changed = 1; |
562 | 562 | |
563 | - for ($i= 0; $i <= $rows; $i++) { |
|
563 | + for ($i = 0; $i <= $rows; $i++) { |
|
564 | 564 | $row = isset($data_table[$i]) ? $data_table[$i] : null; |
565 | 565 | $key = 1; |
566 | 566 | $max_dates_per_page = 10; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | foreach ($item as $value) { |
572 | 572 | if ($count_j >= $max_dates_per_page) { |
573 | 573 | $key++; |
574 | - $max_dates_per_page = $max_dates_per_page_original*$key; |
|
574 | + $max_dates_per_page = $max_dates_per_page_original * $key; |
|
575 | 575 | //magic hack |
576 | 576 | $tables[$key][$i][] = $tables[1][$i][0]; |
577 | 577 | $tables[$key][$i][] = $tables[1][$i][1]; |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | $form = new FormValidator( |
629 | 629 | 'search', |
630 | 630 | 'post', |
631 | - api_get_self() . '?' . api_get_cidreq( |
|
632 | - ) . '&action=calendar_logins' |
|
631 | + api_get_self().'?'.api_get_cidreq( |
|
632 | + ).'&action=calendar_logins' |
|
633 | 633 | ); |
634 | 634 | $form->addDateRangePicker('range', get_lang('DateRange')); |
635 | 635 | $form->addButton('submit', get_lang('Submit')); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
51 | 51 | } |
52 | 52 | |
53 | -$_SESSION['hotspot_coord']=array(); |
|
54 | -$newquestionList= isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : []; |
|
55 | -$questionList = $_SESSION['questionList']; |
|
53 | +$_SESSION['hotspot_coord'] = array(); |
|
54 | +$newquestionList = isset($_SESSION['newquestionList']) ? $_SESSION['newquestionList'] : []; |
|
55 | +$questionList = $_SESSION['questionList']; |
|
56 | 56 | |
57 | 57 | $exerciseId = intval($_GET['exerciseId']); |
58 | 58 | $exerciseType = intval($_GET['exerciseType']); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $choice_value = ''; |
84 | 84 | |
85 | -$user_array = substr($user_array,0,-1); |
|
85 | +$user_array = substr($user_array, 0, -1); |
|
86 | 86 | |
87 | -if (isset($_GET['choice'])){ |
|
87 | +if (isset($_GET['choice'])) { |
|
88 | 88 | $choice_value = intval($_GET['choice']); |
89 | 89 | } |
90 | 90 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | $choice = array(); |
134 | -$questionid= $questionList[$questionNum]; |
|
134 | +$questionid = $questionList[$questionNum]; |
|
135 | 135 | // $choice_value => value of the user selection |
136 | 136 | $choice[$questionid] = isset($choice_value) ? $choice_value : null; |
137 | 137 | |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $exerciseResult = $choice; |
149 | 149 | } else { |
150 | 150 | // gets the question ID from $choice. It is the key of the array |
151 | - list($key)=array_keys($choice); |
|
151 | + list($key) = array_keys($choice); |
|
152 | 152 | // if the user didn't already answer this question |
153 | - if(!isset($exerciseResult[$key])) { |
|
153 | + if (!isset($exerciseResult[$key])) { |
|
154 | 154 | // stores the user answer into the array |
155 | - $exerciseResult[$key]=$choice[$key]; |
|
155 | + $exerciseResult[$key] = $choice[$key]; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
@@ -178,26 +178,26 @@ discard block |
||
178 | 178 | |
179 | 179 | // creates a temporary Question object |
180 | 180 | if (in_array($questionid, $questionList)) { |
181 | - $objQuestionTmp = Question :: read($questionid); |
|
182 | - $questionName =$objQuestionTmp->selectTitle(); |
|
183 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
184 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
185 | - $answerType =$objQuestionTmp->selectType(); |
|
186 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
181 | + $objQuestionTmp = Question :: read($questionid); |
|
182 | + $questionName = $objQuestionTmp->selectTitle(); |
|
183 | + $questionDescription = $objQuestionTmp->selectDescription(); |
|
184 | + $questionWeighting = $objQuestionTmp->selectWeighting(); |
|
185 | + $answerType = $objQuestionTmp->selectType(); |
|
186 | + $quesId = $objQuestionTmp->selectId(); //added by priya saini |
|
187 | 187 | } |
188 | 188 | |
189 | -$objAnswerTmp=new Answer($questionid); |
|
190 | -$nbrAnswers=$objAnswerTmp->selectNbrAnswers(); |
|
189 | +$objAnswerTmp = new Answer($questionid); |
|
190 | +$nbrAnswers = $objAnswerTmp->selectNbrAnswers(); |
|
191 | 191 | //echo 'answe_type '.$answerType;echo '<br />'; |
192 | 192 | |
193 | 193 | $choice = $exerciseResult[$questionid]; |
194 | -$destination=array(); |
|
195 | -$comment=''; |
|
196 | -$next=1; |
|
194 | +$destination = array(); |
|
195 | +$comment = ''; |
|
196 | +$next = 1; |
|
197 | 197 | $_SESSION['hotspot_coord'] = array(); |
198 | 198 | $_SESSION['hotspot_dest'] = array(); |
199 | 199 | |
200 | -$overlap_color = $missing_color = $excess_color=false; |
|
200 | +$overlap_color = $missing_color = $excess_color = false; |
|
201 | 201 | $organs_at_risk_hit = 0; |
202 | 202 | $wrong_results = false; |
203 | 203 | $hot_spot_load = false; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $totalScore = 0; |
207 | 207 | |
208 | 208 | if (!empty($choice_value)) { |
209 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
209 | + for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
|
210 | 210 | $answer = $objAnswerTmp->selectAnswer($answerId); |
211 | 211 | $answerComment = $objAnswerTmp->selectComment($answerId); |
212 | 212 | $answerDestination = $objAnswerTmp->selectDestination($answerId); |
@@ -217,29 +217,29 @@ discard block |
||
217 | 217 | |
218 | 218 | //delineation |
219 | 219 | $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
220 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
221 | - if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
|
220 | + $answer_delineation_destination = $objAnswerTmp->selectDestination(1); |
|
221 | + if ($dbg_local > 0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination, 0); } |
|
222 | 222 | |
223 | - switch($answerType) { |
|
223 | + switch ($answerType) { |
|
224 | 224 | // for unique answer |
225 | 225 | case UNIQUE_ANSWER : |
226 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
226 | + $studentChoice = ($choice_value == $numAnswer) ? 1 : 0; |
|
227 | 227 | if ($studentChoice) { |
228 | - $questionScore +=$answerWeighting; |
|
229 | - $totalScore +=$answerWeighting; |
|
230 | - $newquestionList[]=$questionid; |
|
228 | + $questionScore += $answerWeighting; |
|
229 | + $totalScore += $answerWeighting; |
|
230 | + $newquestionList[] = $questionid; |
|
231 | 231 | } |
232 | 232 | break; |
233 | 233 | case HOT_SPOT_DELINEATION : |
234 | - $studentChoice=$choice[$answerId]; |
|
234 | + $studentChoice = $choice[$answerId]; |
|
235 | 235 | if ($studentChoice) { |
236 | - $newquestionList[]=$questionid; |
|
236 | + $newquestionList[] = $questionid; |
|
237 | 237 | } |
238 | - if ($answerId===1) { |
|
239 | - $questionScore +=$answerWeighting; |
|
240 | - $totalScore +=$answerWeighting; |
|
241 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
242 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
238 | + if ($answerId === 1) { |
|
239 | + $questionScore += $answerWeighting; |
|
240 | + $totalScore += $answerWeighting; |
|
241 | + $_SESSION['hotspot_coord'][1] = $delineation_cord; |
|
242 | + $_SESSION['hotspot_dest'][1] = $answer_delineation_destination; |
|
243 | 243 | } |
244 | 244 | break; |
245 | 245 | } |
@@ -251,27 +251,27 @@ discard block |
||
251 | 251 | $destination = $answerDestination; |
252 | 252 | $comment = $answerComment; |
253 | 253 | } |
254 | - } elseif($answerType == HOT_SPOT_DELINEATION) { |
|
254 | + } elseif ($answerType == HOT_SPOT_DELINEATION) { |
|
255 | 255 | if ($next) { |
256 | - if ($dbg_local>0) { error_log(__LINE__.' - next',0);} |
|
256 | + if ($dbg_local > 0) { error_log(__LINE__.' - next', 0); } |
|
257 | 257 | $hot_spot_load = true; //apparently the script is called twice |
258 | 258 | $user_answer = $user_array; |
259 | - $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php |
|
259 | + $_SESSION['exerciseResultCoordinates'][$questionid] = $user_answer; //needed for exercise_result.php |
|
260 | 260 | |
261 | 261 | // we compare only the delineation not the other points |
262 | - $answer_question = $_SESSION['hotspot_coord'][1]; |
|
263 | - $answerDestination = $_SESSION['hotspot_dest'][1]; |
|
262 | + $answer_question = $_SESSION['hotspot_coord'][1]; |
|
263 | + $answerDestination = $_SESSION['hotspot_dest'][1]; |
|
264 | 264 | |
265 | - $poly_user = convert_coordinates($user_answer,'/'); |
|
266 | - $poly_answer = convert_coordinates($answer_question,'|'); |
|
267 | - $max_coord = poly_get_max($poly_user,$poly_answer); |
|
265 | + $poly_user = convert_coordinates($user_answer, '/'); |
|
266 | + $poly_answer = convert_coordinates($answer_question, '|'); |
|
267 | + $max_coord = poly_get_max($poly_user, $poly_answer); |
|
268 | 268 | |
269 | 269 | if (empty($_GET['hotspot'])) { //no user response |
270 | 270 | $overlap = -2; |
271 | 271 | } else { |
272 | - $poly_user_compiled = poly_compile($poly_user,$max_coord); |
|
273 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord); |
|
274 | - $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord); |
|
272 | + $poly_user_compiled = poly_compile($poly_user, $max_coord); |
|
273 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord); |
|
274 | + $poly_results = poly_result($poly_answer_compiled, $poly_user_compiled, $max_coord); |
|
275 | 275 | |
276 | 276 | $overlap = $poly_results['both']; |
277 | 277 | $poly_answer_area = $poly_results['s1']; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels |
284 | - if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} |
|
284 | + if ($dbg_local > 0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0); } |
|
285 | 285 | if ($overlap < 1) { |
286 | 286 | //shortcut to avoid complicated calculations |
287 | 287 | $final_overlap = 0; |
@@ -289,27 +289,27 @@ discard block |
||
289 | 289 | $final_excess = 100; |
290 | 290 | } else { |
291 | 291 | // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon |
292 | - $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); |
|
293 | - if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} |
|
292 | + $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100); |
|
293 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final overlap is '.$final_overlap, 0); } |
|
294 | 294 | // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon |
295 | 295 | $final_missing = 100 - $final_overlap; |
296 | - if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} |
|
296 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final missing is '.$final_missing, 0); } |
|
297 | 297 | // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon |
298 | - $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); |
|
299 | - if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} |
|
298 | + $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100); |
|
299 | + if ($dbg_local > 1) { error_log(__LINE__.' - Final excess is '.$final_excess, 0); } |
|
300 | 300 | } |
301 | 301 | |
302 | - $destination_items= explode('@@', $answerDestination); |
|
302 | + $destination_items = explode('@@', $answerDestination); |
|
303 | 303 | $threadhold_total = $destination_items[0]; |
304 | - $threadhold_items=explode(';',$threadhold_total); |
|
304 | + $threadhold_items = explode(';', $threadhold_total); |
|
305 | 305 | $threadhold1 = $threadhold_items[0]; // overlap |
306 | 306 | $threadhold2 = $threadhold_items[1]; // excess |
307 | - $threadhold3 = $threadhold_items[2]; //missing |
|
307 | + $threadhold3 = $threadhold_items[2]; //missing |
|
308 | 308 | |
309 | 309 | // echo $final_overlap.' '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.' '. $threadhold3; |
310 | 310 | |
311 | 311 | // if is delineation |
312 | - if ($answerId===1) { |
|
312 | + if ($answerId === 1) { |
|
313 | 313 | //setting colors |
314 | 314 | if ($final_overlap >= $threadhold1) { |
315 | 315 | $overlap_color = true; //echo 'a'; |
@@ -325,40 +325,40 @@ discard block |
||
325 | 325 | |
326 | 326 | // if pass |
327 | 327 | //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) { |
328 | - if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) { |
|
329 | - $next=1; //go to the oars |
|
330 | - $result_comment=get_lang('Acceptable'); |
|
328 | + if ($final_overlap >= $threadhold1 && $final_missing <= $threadhold3 && $final_excess <= $threadhold2) { |
|
329 | + $next = 1; //go to the oars |
|
330 | + $result_comment = get_lang('Acceptable'); |
|
331 | 331 | } else { |
332 | - $next=1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results |
|
332 | + $next = 1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results |
|
333 | 333 | $wrong_results = true; |
334 | - $result_comment=get_lang('Unacceptable'); |
|
335 | - $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1); |
|
336 | - $answerDestination=$objAnswerTmp->selectDestination(1); |
|
337 | - $destination_items= explode('@@', $answerDestination); |
|
338 | - $try_hotspot=$destination_items[1]; |
|
339 | - $lp_hotspot=$destination_items[2]; |
|
340 | - $select_question_hotspot=$destination_items[3]; |
|
341 | - $url_hotspot=$destination_items[4]; |
|
334 | + $result_comment = get_lang('Unacceptable'); |
|
335 | + $special_comment = $comment = $answerDestination = $objAnswerTmp->selectComment(1); |
|
336 | + $answerDestination = $objAnswerTmp->selectDestination(1); |
|
337 | + $destination_items = explode('@@', $answerDestination); |
|
338 | + $try_hotspot = $destination_items[1]; |
|
339 | + $lp_hotspot = $destination_items[2]; |
|
340 | + $select_question_hotspot = $destination_items[3]; |
|
341 | + $url_hotspot = $destination_items[4]; |
|
342 | 342 | //echo 'show the feedback'; |
343 | 343 | } |
344 | - } elseif($answerId>1) { |
|
344 | + } elseif ($answerId > 1) { |
|
345 | 345 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
346 | - if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);} |
|
346 | + if ($dbg_local > 0) { error_log(__LINE__.' - answerId is of type noerror', 0); } |
|
347 | 347 | //type no error shouldn't be treated |
348 | 348 | $next = 1; |
349 | 349 | continue; |
350 | 350 | } |
351 | - if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} |
|
351 | + if ($dbg_local > 0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0); } |
|
352 | 352 | //check the intersection between the oar and the user |
353 | 353 | //echo 'user'; print_r($x_user_list); print_r($y_user_list); |
354 | 354 | //echo 'official';print_r($x_list);print_r($y_list); |
355 | 355 | //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list); |
356 | 356 | |
357 | 357 | //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); |
358 | - $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates |
|
358 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates |
|
359 | 359 | |
360 | - $poly_answer = convert_coordinates($delineation_cord,'|'); |
|
361 | - $max_coord = poly_get_max($poly_user,$poly_answer); //getting max coordinates |
|
360 | + $poly_answer = convert_coordinates($delineation_cord, '|'); |
|
361 | + $max_coord = poly_get_max($poly_user, $poly_answer); //getting max coordinates |
|
362 | 362 | $test = false; |
363 | 363 | // if ($answerId == 2 ){$test = true;} for test oars |
364 | 364 | |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | $overlap = false; |
367 | 367 | } else { |
368 | 368 | // poly_compile really works tested with gnuplot |
369 | - $poly_user_compiled = poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1 |
|
370 | - $poly_answer_compiled = poly_compile($poly_answer,$max_coord,$test); |
|
371 | - $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord); |
|
369 | + $poly_user_compiled = poly_compile($poly_user, $max_coord, $test); //$poly_user is already set when answerid = 1 |
|
370 | + $poly_answer_compiled = poly_compile($poly_answer, $max_coord, $test); |
|
371 | + $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | if ($overlap == false) { |
@@ -376,42 +376,42 @@ discard block |
||
376 | 376 | $next = 1; |
377 | 377 | continue; |
378 | 378 | } else { |
379 | - if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} |
|
379 | + if ($dbg_local > 0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0); } |
|
380 | 380 | |
381 | 381 | $organs_at_risk_hit++; |
382 | 382 | //show the feedback |
383 | - $next=1; |
|
384 | - $comment=$answerDestination=$objAnswerTmp->selectComment($answerId); |
|
385 | - $answerDestination=$objAnswerTmp->selectDestination($answerId); |
|
386 | - $destination_items= explode('@@', $answerDestination); |
|
387 | - $try_hotspot=$destination_items[1]; |
|
388 | - $lp_hotspot=$destination_items[2]; |
|
389 | - $select_question_hotspot=$destination_items[3]; |
|
390 | - $url_hotspot=$destination_items[4]; |
|
383 | + $next = 1; |
|
384 | + $comment = $answerDestination = $objAnswerTmp->selectComment($answerId); |
|
385 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
386 | + $destination_items = explode('@@', $answerDestination); |
|
387 | + $try_hotspot = $destination_items[1]; |
|
388 | + $lp_hotspot = $destination_items[2]; |
|
389 | + $select_question_hotspot = $destination_items[3]; |
|
390 | + $url_hotspot = $destination_items[4]; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } else { |
394 | 394 | // the first delineation feedback |
395 | - if ($dbg_local>0) { error_log(__LINE__.' first',0);} |
|
395 | + if ($dbg_local > 0) { error_log(__LINE__.' first', 0); } |
|
396 | 396 | //we send the error |
397 | 397 | } |
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
401 | 401 | if ($overlap_color) { |
402 | - $overlap_color='green'; |
|
402 | + $overlap_color = 'green'; |
|
403 | 403 | } else { |
404 | - $overlap_color='red'; |
|
404 | + $overlap_color = 'red'; |
|
405 | 405 | } |
406 | 406 | if ($missing_color) { |
407 | - $missing_color='green'; |
|
407 | + $missing_color = 'green'; |
|
408 | 408 | } else { |
409 | - $missing_color='red'; |
|
409 | + $missing_color = 'red'; |
|
410 | 410 | } |
411 | 411 | if ($excess_color) { |
412 | - $excess_color='green'; |
|
412 | + $excess_color = 'green'; |
|
413 | 413 | } else { |
414 | - $excess_color='red'; |
|
414 | + $excess_color = 'red'; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | if (!is_numeric($final_overlap)) { |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $final_excess = 0; |
426 | 426 | } |
427 | 427 | |
428 | - if ($final_excess>100) { |
|
428 | + if ($final_excess > 100) { |
|
429 | 429 | $final_excess = 100; |
430 | 430 | } |
431 | 431 | |
@@ -440,26 +440,26 @@ discard block |
||
440 | 440 | <tr class="row_even"> |
441 | 441 | <td><b>'.get_lang('Overlap').'</b></td> |
442 | 442 | <td>'.get_lang('Min').' '.$threadhold1.'</td> |
443 | - <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td> |
|
443 | + <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td> |
|
444 | 444 | </tr> |
445 | 445 | |
446 | 446 | <tr> |
447 | 447 | <td><b>'.get_lang('Excess').'</b></td> |
448 | 448 | <td>'.get_lang('Max').' '.$threadhold2.'</td> |
449 | - <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td> |
|
449 | + <td><div style="color:'.$excess_color.'">'.(($final_excess < 0) ? 0 : intval($final_excess)).'</div></td> |
|
450 | 450 | </tr> |
451 | 451 | |
452 | 452 | <tr class="row_even"> |
453 | 453 | <td><b>'.get_lang('Missing').'</b></td> |
454 | 454 | <td>'.get_lang('Max').' '.$threadhold3.'</td> |
455 | - <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
|
455 | + <td><div style="color:'.$missing_color.'">'.(($final_missing < 0) ? 0 : intval($final_missing)).'</div></td> |
|
456 | 456 | </tr> |
457 | 457 | </table>'; |
458 | 458 | //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
459 | 459 | } |
460 | 460 | $_SESSION['newquestionList'] = $newquestionList; |
461 | 461 | |
462 | -$links=''; |
|
462 | +$links = ''; |
|
463 | 463 | |
464 | 464 | if (isset($choice_value) && $choice_value == -1) { |
465 | 465 | if ($answerType != HOT_SPOT_DELINEATION) { |
@@ -471,32 +471,32 @@ discard block |
||
471 | 471 | |
472 | 472 | if ($answerType != HOT_SPOT_DELINEATION) { |
473 | 473 | if (!empty($destination)) { |
474 | - $item_list = explode('@@',$destination); |
|
474 | + $item_list = explode('@@', $destination); |
|
475 | 475 | //print_R($item_list); |
476 | 476 | $try = $item_list[0]; |
477 | 477 | $lp = $item_list[1]; |
478 | - $destinationid= $item_list[2]; |
|
479 | - $url=$item_list[3]; |
|
478 | + $destinationid = $item_list[2]; |
|
479 | + $url = $item_list[3]; |
|
480 | 480 | } |
481 | - $table_resume=''; |
|
481 | + $table_resume = ''; |
|
482 | 482 | } else { |
483 | 483 | $try = $try_hotspot; |
484 | 484 | $lp = $lp_hotspot; |
485 | - $destinationid= $select_question_hotspot; |
|
486 | - $url=$url_hotspot; |
|
487 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
485 | + $destinationid = $select_question_hotspot; |
|
486 | + $url = $url_hotspot; |
|
487 | + if ($organs_at_risk_hit == 0 && $wrong_results == false) { |
|
488 | 488 | // no error = no oar and no wrong result for delineation |
489 | 489 | //show if no error |
490 | 490 | //echo 'no error'; |
491 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
492 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
491 | + $comment = $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
492 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
493 | 493 | |
494 | 494 | //we send the error |
495 | - $destination_items= explode('@@', $answerDestination); |
|
496 | - $try=$destination_items[1]; |
|
497 | - $lp=$destination_items[2]; |
|
498 | - $destinationid=$destination_items[3]; |
|
499 | - $url=$destination_items[4]; |
|
495 | + $destination_items = explode('@@', $answerDestination); |
|
496 | + $try = $destination_items[1]; |
|
497 | + $lp = $destination_items[2]; |
|
498 | + $destinationid = $destination_items[3]; |
|
499 | + $url = $destination_items[4]; |
|
500 | 500 | $exerciseResult[$questionid] = 1; |
501 | 501 | } else { |
502 | 502 | $exerciseResult[$questionid] = 0; |
@@ -504,35 +504,35 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | // the link to retry the question |
507 | -if (isset($try) && $try==1) { |
|
508 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
509 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
507 | +if (isset($try) && $try == 1) { |
|
508 | + $num_value_array = (array_keys($questionList, $questionid)); |
|
509 | + $links .= Display :: return_icon('reload.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | // the link to theory (a learning path) |
513 | 513 | if (!empty($lp)) { |
514 | - $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
514 | + $lp_url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
515 | 515 | $list = new LearnpathList(api_get_user_id()); |
516 | 516 | $flat_list = $list->get_flat_list(); |
517 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
517 | + $links .= Display :: return_icon('theory.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
518 | 518 | } |
519 | -$links.='<br />'; |
|
519 | +$links .= '<br />'; |
|
520 | 520 | |
521 | 521 | // the link to an external website or link |
522 | 522 | if (!empty($url)) { |
523 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
523 | + $links .= Display :: return_icon('link.gif', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | // the link to finish the test |
527 | -if ($destinationid==-1) { |
|
528 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
527 | +if ($destinationid == -1) { |
|
528 | + $links .= Display :: return_icon('finish.gif', '', array('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
529 | 529 | } else { |
530 | 530 | // the link to other question |
531 | - if (in_array($destinationid,$questionList)) { |
|
531 | + if (in_array($destinationid, $questionList)) { |
|
532 | 532 | $objQuestionTmp = Question :: read($destinationid); |
533 | - $questionName=$objQuestionTmp->selectTitle(); |
|
534 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
535 | - $links.= Display :: return_icon('quiz.png', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
533 | + $questionName = $objQuestionTmp->selectTitle(); |
|
534 | + $num_value_array = (array_keys($questionList, $destinationid)); |
|
535 | + $links .= Display :: return_icon('quiz.png', '', array('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | </script>'; |
551 | 551 | |
552 | -if ($links!='') { |
|
552 | +if ($links != '') { |
|
553 | 553 | /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
554 | 554 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
555 | 555 | echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
@@ -558,15 +558,15 @@ discard block |
||
558 | 558 | if ($organs_at_risk_hit > 0) { |
559 | 559 | //$message='<p>'.get_lang('YourDelineation').'</p>'; |
560 | 560 | //$message.=$table_resume; |
561 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
561 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
562 | 562 | //if ($wrong_results) { } |
563 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
564 | - $message.='<p>'.$comment.'</p>'; |
|
563 | + $message .= '<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
564 | + $message .= '<p>'.$comment.'</p>'; |
|
565 | 565 | } else { |
566 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
567 | - $message.=$table_resume; |
|
568 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
569 | - $message.='<p>'.$comment.'</p>'; |
|
566 | + $message = '<p>'.get_lang('YourDelineation').'</p>'; |
|
567 | + $message .= $table_resume; |
|
568 | + $message .= '<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
569 | + $message .= '<p>'.$comment.'</p>'; |
|
570 | 570 | } |
571 | 571 | echo $message; |
572 | 572 | } else { |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | echo '<h3>'.$links.'</h3>'; |
576 | 576 | echo '</div>'; |
577 | 577 | |
578 | - $_SESSION['hot_spot_result']=$message; |
|
578 | + $_SESSION['hot_spot_result'] = $message; |
|
579 | 579 | $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
580 | 580 | //reseting the exerciseResult variable |
581 | - Session::write('exerciseResult',$exerciseResult); |
|
581 | + Session::write('exerciseResult', $exerciseResult); |
|
582 | 582 | |
583 | 583 | //save this variables just in case the exercise loads an LP with other exercise |
584 | 584 | $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $extendedAttempt = null, |
115 | 115 | $extendedAll = null, |
116 | 116 | $type = 'classic', |
117 | - $allowExtend = true |
|
117 | + $allowExtend = true |
|
118 | 118 | ) { |
119 | 119 | if (empty($courseInfo) || empty($lp_id)) { |
120 | 120 | return null; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | $extend_all = 0; |
139 | 139 | |
140 | 140 | if ($origin == 'tracking') { |
141 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
141 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
142 | 142 | } else { |
143 | - $url_suffix = '&lp_id=' . $lp_id; |
|
143 | + $url_suffix = '&lp_id='.$lp_id; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if (!empty($extendedAll)) { |
147 | 147 | $extend_all_link = Display::url( |
148 | 148 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
149 | - api_get_self() . '?action=stats' . $url_suffix |
|
149 | + api_get_self().'?action=stats'.$url_suffix |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | $extend_all = 1; |
153 | 153 | } else { |
154 | 154 | $extend_all_link = Display::url( |
155 | 155 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
156 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
156 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | |
166 | 166 | $actionColumn = null; |
167 | 167 | if ($type == 'classic') { |
168 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
168 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
169 | 169 | } |
170 | 170 | $output .= '<div class="table-responsive">'; |
171 | 171 | $output .= '<table class="table tracking"> |
172 | 172 | <thead> |
173 | 173 | <tr class="table-header"> |
174 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
174 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
175 | 175 | <th colspan="4"> |
176 | - ' . get_lang('ScormLessonTitle') .' |
|
176 | + ' . get_lang('ScormLessonTitle').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormStatus') . ' |
|
179 | + ' . get_lang('ScormStatus').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormScore') . ' |
|
182 | + ' . get_lang('ScormScore').' |
|
183 | 183 | </th> |
184 | 184 | <th colspan="2"> |
185 | - ' . get_lang('ScormTime') . ' |
|
185 | + ' . get_lang('ScormTime').' |
|
186 | 186 | </th> |
187 | 187 | '.$actionColumn.' |
188 | 188 | </tr> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // Prepare statement to go through each attempt. |
246 | 246 | $viewCondition = null; |
247 | 247 | if (!empty($view)) { |
248 | - $viewCondition = " AND v.view_count = $view "; |
|
248 | + $viewCondition = " AND v.view_count = $view "; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $sql = "SELECT |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | FROM $TBL_QUIZ |
294 | 294 | WHERE |
295 | 295 | c_id = $course_id AND |
296 | - id ='" . $my_path . "'"; |
|
296 | + id ='".$my_path."'"; |
|
297 | 297 | $res_result_disabled = Database::query($sql); |
298 | 298 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
299 | 299 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | 317 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
318 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $action = null; |
335 | 335 | if ($type == 'classic') { |
336 | - $action = '<td></td>'; |
|
336 | + $action = '<td></td>'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | $extend_this_attempt = 1; |
378 | 378 | $extend_attempt_link = Display::url( |
379 | 379 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
380 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
380 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
381 | 381 | ); |
382 | 382 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
383 | 383 | // The extend button for this attempt has not been clicked. |
384 | 384 | $extend_attempt_link = Display::url( |
385 | 385 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
386 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
386 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
387 | 387 | ); |
388 | 388 | } |
389 | 389 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
419 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
419 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
420 | 420 | |
421 | 421 | if ($row['item_type'] != 'dir') { |
422 | 422 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | $action = '<td></td>'; |
445 | 445 | } |
446 | 446 | |
447 | - $output .= '<tr class="' . $oddclass . '"> |
|
447 | + $output .= '<tr class="'.$oddclass.'"> |
|
448 | 448 | <td></td> |
449 | - <td>' . $extend_attempt_link . '</td> |
|
450 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
451 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
452 | - <td colspan="2">' . $view_score . '</td> |
|
453 | - <td colspan="2">' . $time . '</td> |
|
449 | + <td>' . $extend_attempt_link.'</td> |
|
450 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
451 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
452 | + <td colspan="2">' . $view_score.'</td> |
|
453 | + <td colspan="2">' . $time.'</td> |
|
454 | 454 | '.$action.' |
455 | 455 | </tr>'; |
456 | 456 | $attemptCount++; |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
464 | 464 | $temp[] = '/'; |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | } else { |
469 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
469 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
470 | 470 | } |
471 | 471 | $temp[] = $time; |
472 | 472 | $csv_content[] = $temp; |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | <td></td> |
504 | 504 | <td></td> |
505 | 505 | <td></td> |
506 | - <td>'.$interaction['order_id'] . '</td> |
|
507 | - <td>'.$interaction['id'] . '</td> |
|
506 | + <td>'.$interaction['order_id'].'</td> |
|
507 | + <td>'.$interaction['id'].'</td> |
|
508 | 508 | <td colspan="2">' . $interaction['type'].'</td> |
509 | - <td>'.$student_response . '</td> |
|
510 | - <td>'.$interaction['result'] . '</td> |
|
511 | - <td>'.$interaction['latency'] . '</td> |
|
512 | - <td>'.$interaction['time'] . '</td> |
|
509 | + <td>'.$student_response.'</td> |
|
510 | + <td>'.$interaction['result'].'</td> |
|
511 | + <td>'.$interaction['latency'].'</td> |
|
512 | + <td>'.$interaction['time'].'</td> |
|
513 | 513 | '.$action.' |
514 | 514 | </tr>'; |
515 | 515 | $counter++; |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | <td></td> |
527 | 527 | <td></td> |
528 | 528 | <td></td> |
529 | - <td>' . $interaction['order_id'] . '</td> |
|
530 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
531 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
532 | - <td>' . $interaction['score_raw'] . '</td> |
|
533 | - <td>' . $interaction['score_max'] . '</td> |
|
534 | - <td>' . $interaction['score_min'] . '</td> |
|
529 | + <td>' . $interaction['order_id'].'</td> |
|
530 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
531 | + <td colspan="2">' . $interaction['status'].'</td> |
|
532 | + <td>' . $interaction['score_raw'].'</td> |
|
533 | + <td>' . $interaction['score_max'].'</td> |
|
534 | + <td>' . $interaction['score_min'].'</td> |
|
535 | 535 | '.$action.' |
536 | 536 | </tr>'; |
537 | 537 | $counter++; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $my_path = Database::escape_string($my_path); |
555 | 555 | $sql = "SELECT results_disabled |
556 | 556 | FROM $TBL_QUIZ |
557 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
557 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
558 | 558 | $res_result_disabled = Database::query($sql); |
559 | 559 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
560 | 560 | |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | $extend_this_attempt = 1; |
579 | 579 | $extend_attempt_link = Display::url( |
580 | 580 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
581 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
581 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
582 | 582 | ); |
583 | 583 | } else { |
584 | 584 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
585 | 585 | // The extend button for this attempt has not been clicked. |
586 | 586 | $extend_attempt_link = Display::url( |
587 | 587 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
588 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
588 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
589 | 589 | ); |
590 | 590 | } |
591 | 591 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | if ($inter_num > 1) { |
601 | 601 | $extend_link = Display::url( |
602 | 602 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
603 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
603 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
604 | 604 | ); |
605 | 605 | } |
606 | 606 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | |
617 | 617 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
618 | 618 | |
619 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
619 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
620 | 620 | WHERE |
621 | - exe_exo_id="' . $row['path'] . '" AND |
|
622 | - exe_user_id="' . $user_id . '" AND |
|
623 | - orig_lp_id = "' . $lp_id . '" AND |
|
624 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
625 | - c_id = ' . $course_id . ' AND |
|
621 | + exe_exo_id="' . $row['path'].'" AND |
|
622 | + exe_user_id="' . $user_id.'" AND |
|
623 | + orig_lp_id = "' . $lp_id.'" AND |
|
624 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
625 | + c_id = ' . $course_id.' AND |
|
626 | 626 | status <> "incomplete" AND |
627 | - session_id = ' . $session_id . ' |
|
627 | + session_id = ' . $session_id.' |
|
628 | 628 | ORDER BY exe_date DESC |
629 | 629 | LIMIT 1'; |
630 | 630 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | FROM $TBL_LP_ITEM_VIEW |
656 | 656 | WHERE |
657 | 657 | c_id = $course_id AND |
658 | - lp_item_id = '" . (int) $my_id . "' AND |
|
659 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
658 | + lp_item_id = '".(int) $my_id."' AND |
|
659 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
660 | 660 | ORDER BY view_count DESC limit 1"; |
661 | 661 | $res_score = Database::query($sql); |
662 | 662 | $row_score = Database::fetch_array($res_score); |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | FROM $TBL_LP_ITEM_VIEW |
666 | 666 | WHERE |
667 | 667 | c_id = $course_id AND |
668 | - lp_item_id = '" . (int) $my_id . "' AND |
|
669 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
668 | + lp_item_id = '".(int) $my_id."' AND |
|
669 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
670 | 670 | $res_time = Database::query($sql); |
671 | 671 | $row_time = Database::fetch_array($res_time); |
672 | 672 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | } else { |
726 | 726 | $correct_test_link = '-'; |
727 | 727 | if ($row['item_type'] == 'quiz') { |
728 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
729 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
728 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
729 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
730 | 730 | WHERE |
731 | - exe_exo_id="' . $row['path'] . '" AND |
|
732 | - exe_user_id="' . $user_id . '" AND |
|
733 | - orig_lp_id = "' . $lp_id . '" AND |
|
734 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
735 | - c_id = ' . $course_id . ' AND |
|
731 | + exe_exo_id="' . $row['path'].'" AND |
|
732 | + exe_user_id="' . $user_id.'" AND |
|
733 | + orig_lp_id = "' . $lp_id.'" AND |
|
734 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
735 | + c_id = ' . $course_id.' AND |
|
736 | 736 | status <> "incomplete" AND |
737 | - session_id = ' . $session_id . ' |
|
737 | + session_id = ' . $session_id.' |
|
738 | 738 | ORDER BY exe_date DESC '; |
739 | 739 | |
740 | 740 | $resultLastAttempt = Database::query($sql); |
@@ -746,12 +746,12 @@ discard block |
||
746 | 746 | ) { |
747 | 747 | $correct_test_link = Display::url( |
748 | 748 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
749 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
749 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
750 | 750 | ); |
751 | 751 | } else { |
752 | 752 | $correct_test_link = Display::url( |
753 | 753 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
754 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
754 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
755 | 755 | ); |
756 | 756 | } |
757 | 757 | } |
@@ -761,14 +761,14 @@ discard block |
||
761 | 761 | |
762 | 762 | $action = null; |
763 | 763 | if ($type == 'classic') { |
764 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
764 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($lp_id == $my_lp_id && false) { |
768 | 768 | |
769 | - $output .= '<tr class =' . $oddclass . '> |
|
770 | - <td>' . $extend_link . '</td> |
|
771 | - <td colspan="4">' . $title . '</td> |
|
769 | + $output .= '<tr class ='.$oddclass.'> |
|
770 | + <td>' . $extend_link.'</td> |
|
771 | + <td colspan="4">' . $title.'</td> |
|
772 | 772 | <td colspan="2"> </td> |
773 | 773 | <td colspan="2"> </td> |
774 | 774 | <td colspan="2"> </td> |
@@ -793,13 +793,13 @@ discard block |
||
793 | 793 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
794 | 794 | } |
795 | 795 | } else { |
796 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
796 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | $output .= ' |
800 | 800 | <td>'.$extend_link.'</td> |
801 | - <td colspan="4">' . $title . '</td> |
|
802 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
801 | + <td colspan="4">' . $title.'</td> |
|
802 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
803 | 803 | <td colspan="2">'.$scoreItem.'</td> |
804 | 804 | <td colspan="2">'.$time.'</td> |
805 | 805 | '.$action.' |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
817 | 817 | $temp[] = '/'; |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | } else { |
822 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
822 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
823 | 823 | } |
824 | 824 | $temp[] = $time; |
825 | 825 | $csv_content[] = $temp; |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $action = null; |
832 | 832 | if ($type == 'classic') { |
833 | - $action = '<td></td>'; |
|
833 | + $action = '<td></td>'; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | if ($extend_this_attempt || $extend_all) { |
@@ -867,11 +867,11 @@ discard block |
||
867 | 867 | <td></td> |
868 | 868 | <td></td> |
869 | 869 | <td></td> |
870 | - <td>' . $interaction['order_id'] . '</td> |
|
871 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
872 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
870 | + <td>' . $interaction['order_id'].'</td> |
|
871 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
872 | + <td colspan="2">' . $interaction['status'].'</td> |
|
873 | 873 | <td>' . $interaction['score_raw'].'</td> |
874 | - <td>' . $interaction['score_max'] .'</td> |
|
874 | + <td>' . $interaction['score_max'].'</td> |
|
875 | 875 | <td>' . $interaction['score_min'].'</td> |
876 | 876 | '.$action.' |
877 | 877 | </tr>'; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | // Attempts listing by exercise. |
883 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
883 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
884 | 884 | // Get attempts of a exercise. |
885 | 885 | if (!empty($lp_id) && |
886 | 886 | !empty($lp_item_id) && |
@@ -895,15 +895,15 @@ discard block |
||
895 | 895 | $row_path = Database::fetch_array($res_path); |
896 | 896 | |
897 | 897 | if (Database::num_rows($res_path) > 0) { |
898 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
898 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
899 | 899 | WHERE |
900 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
900 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
901 | 901 | status <> "incomplete" AND |
902 | - exe_user_id="' . $user_id . '" AND |
|
903 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
904 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
905 | - c_id = ' . $course_id . ' AND |
|
906 | - session_id = ' . $session_id . ' |
|
902 | + exe_user_id="' . $user_id.'" AND |
|
903 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
904 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
905 | + c_id = ' . $course_id.' AND |
|
906 | + session_id = ' . $session_id.' |
|
907 | 907 | ORDER BY exe_date'; |
908 | 908 | $res_attempts = Database::query($sql); |
909 | 909 | $num_attempts = Database::num_rows($res_attempts); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | if ($mktime_start_date && $mktime_exe_date) { |
922 | 922 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
923 | 923 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
924 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
924 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
925 | 925 | } else { |
926 | 926 | $time_attemp = ' - '; |
927 | 927 | } |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
948 | 948 | } |
949 | 949 | |
950 | - $output .= '<tr class="' . $oddclass . '" > |
|
950 | + $output .= '<tr class="'.$oddclass.'" > |
|
951 | 951 | <td></td> |
952 | - <td>' . $extend_attempt_link . '</td> |
|
953 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
954 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
955 | - <td colspan="2">'.$view_score . '</td> |
|
956 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
952 | + <td>' . $extend_attempt_link.'</td> |
|
953 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
954 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
955 | + <td colspan="2">'.$view_score.'</td> |
|
956 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
957 | 957 | if ($action == 'classic') { |
958 | 958 | if ($origin != 'tracking') { |
959 | 959 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
960 | 960 | $output .= '<td> |
961 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
961 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
962 | 962 | </td>'; |
963 | 963 | } else { |
964 | 964 | $output .= '<td> |
965 | - <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
966 | - <img src="' . Display::returnIconPath('quiz.png').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
965 | + <a href="../exercise/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent"> |
|
966 | + <img src="' . Display::returnIconPath('quiz.png').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
967 | 967 | </a></td>'; |
968 | 968 | } |
969 | 969 | } else { |
970 | 970 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
971 | 971 | $output .= '<td> |
972 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; |
|
972 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>'; |
|
973 | 973 | } else { |
974 | 974 | $output .= '<td> |
975 | - <a href="../exercise/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> |
|
976 | - <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; |
|
975 | + <a href="../exercise/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent"> |
|
976 | + <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>'; |
|
977 | 977 | } |
978 | 978 | } |
979 | 979 | } |
@@ -1032,13 +1032,13 @@ discard block |
||
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1035 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1035 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1036 | 1036 | |
1037 | 1037 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1038 | 1038 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1039 | 1039 | } else { |
1040 | 1040 | if (is_numeric($total_score)) { |
1041 | - $final_score = $total_score . '%'; |
|
1041 | + $final_score = $total_score.'%'; |
|
1042 | 1042 | } else { |
1043 | 1043 | $final_score = $total_score; |
1044 | 1044 | } |
@@ -1054,19 +1054,19 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | $action = null; |
1056 | 1056 | if ($type == 'classic') { |
1057 | - $action = '<td></td>'; |
|
1057 | + $action = '<td></td>'; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $output .= '<tr class="'.$oddclass.'"> |
1061 | 1061 | <td></td> |
1062 | 1062 | <td colspan="4"> |
1063 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1063 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1064 | 1064 | </td> |
1065 | 1065 | <td colspan="2">'.$progress.'%</td> |
1066 | 1066 | <td colspan="2"> |
1067 | 1067 | ' . $final_score.' |
1068 | 1068 | </td> |
1069 | - <td colspan="2">' . $total_time . '</div> |
|
1069 | + <td colspan="2">' . $total_time.'</div> |
|
1070 | 1070 | '.$action.' |
1071 | 1071 | </tr>'; |
1072 | 1072 | |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1411 | 1411 | if (is_array($user_id)) { |
1412 | 1412 | $user_id = array_map('intval', $user_id); |
1413 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1413 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1414 | 1414 | } else { |
1415 | 1415 | $user_id = intval($user_id); |
1416 | 1416 | $condition_user = " AND user_id = $user_id "; |
@@ -1446,13 +1446,13 @@ discard block |
||
1446 | 1446 | { |
1447 | 1447 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1448 | 1448 | $sql = 'SELECT login_date |
1449 | - FROM ' . $tbl_track_login . ' |
|
1450 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1449 | + FROM ' . $tbl_track_login.' |
|
1450 | + WHERE login_user_id = ' . intval($student_id).' |
|
1451 | 1451 | ORDER BY login_date ASC |
1452 | 1452 | LIMIT 0,1'; |
1453 | 1453 | |
1454 | 1454 | $rs = Database::query($sql); |
1455 | - if (Database::num_rows($rs)>0) { |
|
1455 | + if (Database::num_rows($rs) > 0) { |
|
1456 | 1456 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1457 | 1457 | return api_convert_and_format_date( |
1458 | 1458 | $first_login_date, |
@@ -1477,8 +1477,8 @@ discard block |
||
1477 | 1477 | { |
1478 | 1478 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1479 | 1479 | $sql = 'SELECT login_date |
1480 | - FROM ' . $table . ' |
|
1481 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1480 | + FROM ' . $table.' |
|
1481 | + WHERE login_user_id = ' . intval($student_id).' |
|
1482 | 1482 | ORDER BY login_date |
1483 | 1483 | DESC LIMIT 0,1'; |
1484 | 1484 | |
@@ -1487,18 +1487,18 @@ discard block |
||
1487 | 1487 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1488 | 1488 | $last_login_date = api_get_local_time($last_login_date); |
1489 | 1489 | if ($return_timestamp) { |
1490 | - return api_strtotime($last_login_date,'UTC'); |
|
1490 | + return api_strtotime($last_login_date, 'UTC'); |
|
1491 | 1491 | } else { |
1492 | 1492 | if (!$warning_message) { |
1493 | 1493 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1494 | 1494 | } else { |
1495 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1495 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1496 | 1496 | $currentTimestamp = time(); |
1497 | 1497 | |
1498 | 1498 | //If the last connection is > than 7 days, the text is red |
1499 | 1499 | //345600 = 7 days in seconds |
1500 | 1500 | if ($currentTimestamp - $timestamp > 604800) { |
1501 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1501 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1502 | 1502 | } else { |
1503 | 1503 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1504 | 1504 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | $sql = "$select |
1534 | 1534 | FROM $tbl_track_login |
1535 | 1535 | WHERE |
1536 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1536 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1537 | 1537 | login_date < '$date' |
1538 | 1538 | "; |
1539 | 1539 | $rs = Database::query($sql); |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | '.Display::return_icon('messagebox_warning.gif').' |
1633 | 1633 | </a>' |
1634 | 1634 | : null; |
1635 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1635 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1636 | 1636 | } else { |
1637 | 1637 | return $last_login_date; |
1638 | 1638 | } |
@@ -1667,8 +1667,8 @@ discard block |
||
1667 | 1667 | |
1668 | 1668 | // Given we're storing in cache, round the start and end times |
1669 | 1669 | // to the lower minute |
1670 | - $roundedStart = substr($start, 0, -2) . '00'; |
|
1671 | - $roundedStop = substr($stop, 0, -2) . '00'; |
|
1670 | + $roundedStart = substr($start, 0, -2).'00'; |
|
1671 | + $roundedStop = substr($stop, 0, -2).'00'; |
|
1672 | 1672 | $roundedStart = Database::escape_string($roundedStart); |
1673 | 1673 | $roundedStop = Database::escape_string($roundedStop); |
1674 | 1674 | |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | $session_id = intval($session_id); |
1679 | 1679 | $count = 0; |
1680 | 1680 | $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1681 | - $sql = "SELECT count(*) as count_connections |
|
1681 | + $sql = "SELECT count(*) as count_connections |
|
1682 | 1682 | FROM $tbl_track_e_course_access |
1683 | 1683 | WHERE |
1684 | 1684 | c_id = $courseId AND |
@@ -1700,7 +1700,7 @@ discard block |
||
1700 | 1700 | $count = apcu_fetch($apc_var); |
1701 | 1701 | } else { |
1702 | 1702 | $rs = Database::query($sql); |
1703 | - if (Database::num_rows($rs)>0) { |
|
1703 | + if (Database::num_rows($rs) > 0) { |
|
1704 | 1704 | $row = Database::fetch_object($rs); |
1705 | 1705 | $count = $row->count_connections; |
1706 | 1706 | } |
@@ -1709,7 +1709,7 @@ discard block |
||
1709 | 1709 | } |
1710 | 1710 | } else { |
1711 | 1711 | $rs = Database::query($sql); |
1712 | - if (Database::num_rows($rs)>0) { |
|
1712 | + if (Database::num_rows($rs) > 0) { |
|
1713 | 1713 | $row = Database::fetch_object($rs); |
1714 | 1714 | $count = $row->count_connections; |
1715 | 1715 | } |
@@ -1731,14 +1731,14 @@ discard block |
||
1731 | 1731 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1732 | 1732 | |
1733 | 1733 | $sql = 'SELECT DISTINCT c_id |
1734 | - FROM ' . $tbl_course_rel_user . ' |
|
1734 | + FROM ' . $tbl_course_rel_user.' |
|
1735 | 1735 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1736 | 1736 | $rs = Database::query($sql); |
1737 | 1737 | $nb_courses = Database::num_rows($rs); |
1738 | 1738 | |
1739 | 1739 | if ($include_sessions) { |
1740 | 1740 | $sql = 'SELECT DISTINCT c_id |
1741 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1741 | + FROM ' . $tbl_session_course_rel_user.' |
|
1742 | 1742 | WHERE user_id = ' . $user_id; |
1743 | 1743 | $rs = Database::query($sql); |
1744 | 1744 | $nb_courses += Database::num_rows($rs); |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | $condition_quiz = ""; |
1786 | 1786 | if (!empty($exercise_id)) { |
1787 | 1787 | $exercise_id = intval($exercise_id); |
1788 | - $condition_quiz =" AND id = $exercise_id "; |
|
1788 | + $condition_quiz = " AND id = $exercise_id "; |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | 1791 | // Compose a filter based on optional session id given |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | } |
1839 | 1839 | } |
1840 | 1840 | if (!empty($exercise_list)) { |
1841 | - $exercise_id = implode("','",$exercise_list); |
|
1841 | + $exercise_id = implode("','", $exercise_list); |
|
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | |
@@ -1863,10 +1863,10 @@ discard block |
||
1863 | 1863 | $quiz_avg_score = null; |
1864 | 1864 | |
1865 | 1865 | if (!empty($row['avg_score'])) { |
1866 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1866 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | - if(!empty($row['num_attempts'])) { |
|
1869 | + if (!empty($row['num_attempts'])) { |
|
1870 | 1870 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1871 | 1871 | } |
1872 | 1872 | if (is_array($student_id)) { |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | $row = Database::fetch_row($rs); |
1997 | 1997 | $count = $row[0]; |
1998 | 1998 | } |
1999 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1999 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
2000 | 2000 | return $count; |
2001 | 2001 | } |
2002 | 2002 | |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | ); |
2022 | 2022 | |
2023 | 2023 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
2024 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
2024 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
2025 | 2025 | } |
2026 | 2026 | } |
2027 | 2027 | $result = $result / count($exercise_list); |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | $query = sprintf($sql, intval($courseId), $sessionId); |
2059 | 2059 | $rs = Database::query($query); |
2060 | 2060 | $teachers = array(); |
2061 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
2061 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
2062 | 2062 | $teachers[] = $teacher; |
2063 | 2063 | } |
2064 | 2064 | $data = array(); |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | $data[] = array( |
2183 | 2183 | 'course' => $course['title'], |
2184 | 2184 | 'session' => $teacher['name'], |
2185 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2185 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2186 | 2186 | 'documents' => $totalDocuments, |
2187 | 2187 | 'links' => $totalLinks, |
2188 | 2188 | 'forums' => $totalForums, |
@@ -2245,7 +2245,7 @@ discard block |
||
2245 | 2245 | for ($i = 0; $i < count($lpIdList); $i++) { |
2246 | 2246 | $placeHolders[] = '?'; |
2247 | 2247 | } |
2248 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
2248 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
2249 | 2249 | } |
2250 | 2250 | |
2251 | 2251 | if ($onlySeriousGame) { |
@@ -2265,14 +2265,14 @@ discard block |
||
2265 | 2265 | |
2266 | 2266 | $conditions = [ |
2267 | 2267 | " c_id = {$courseInfo['real_id']} ", |
2268 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2268 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2269 | 2269 | ]; |
2270 | 2270 | |
2271 | 2271 | $groupBy = 'GROUP BY lp_id'; |
2272 | 2272 | |
2273 | 2273 | if (is_array($studentId)) { |
2274 | 2274 | $studentId = array_map('intval', $studentId); |
2275 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2275 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2276 | 2276 | |
2277 | 2277 | |
2278 | 2278 | } else { |
@@ -2407,7 +2407,7 @@ discard block |
||
2407 | 2407 | // Compose a filter based on optional learning paths list given |
2408 | 2408 | $condition_lp = ""; |
2409 | 2409 | if (count($lp_ids) > 0) { |
2410 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2410 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2411 | 2411 | } |
2412 | 2412 | |
2413 | 2413 | // Compose a filter based on optional session id |
@@ -2447,9 +2447,9 @@ discard block |
||
2447 | 2447 | // prepare filter on users |
2448 | 2448 | if (is_array($student_id)) { |
2449 | 2449 | array_walk($student_id, 'intval'); |
2450 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2450 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2451 | 2451 | } else { |
2452 | - $condition_user1 =" AND user_id = $student_id "; |
|
2452 | + $condition_user1 = " AND user_id = $student_id "; |
|
2453 | 2453 | } |
2454 | 2454 | |
2455 | 2455 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2492,7 +2492,7 @@ discard block |
||
2492 | 2492 | ORDER BY lp_item_id"; |
2493 | 2493 | $res_lp_item = Database::query($sql); |
2494 | 2494 | |
2495 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2495 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2496 | 2496 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2497 | 2497 | |
2498 | 2498 | // Getting the most recent attempt |
@@ -2515,8 +2515,8 @@ discard block |
||
2515 | 2515 | ORDER BY view_count DESC |
2516 | 2516 | LIMIT 1"; |
2517 | 2517 | $res_lp_item_result = Database::query($sql); |
2518 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2519 | - $list[]= $row_max_score; |
|
2518 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2519 | + $list[] = $row_max_score; |
|
2520 | 2520 | } |
2521 | 2521 | } |
2522 | 2522 | } else { |
@@ -2540,8 +2540,8 @@ discard block |
||
2540 | 2540 | if ($debug) echo $sql.'<br />'; |
2541 | 2541 | $res_max_score = Database::query($sql); |
2542 | 2542 | |
2543 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2544 | - $list[]= $row_max_score; |
|
2543 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2544 | + $list[] = $row_max_score; |
|
2545 | 2545 | } |
2546 | 2546 | } |
2547 | 2547 | |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2557 | 2557 | $score = $row_max_score['score']; |
2558 | 2558 | |
2559 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2559 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2560 | 2560 | |
2561 | 2561 | if ($row_max_score['item_type'] == 'sco') { |
2562 | 2562 | /* Check if it is sco (easier to get max_score) |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | } |
2575 | 2575 | // Avoid division by zero errors |
2576 | 2576 | if (!empty($max_score)) { |
2577 | - $lp_partial_total += $score/$max_score; |
|
2577 | + $lp_partial_total += $score / $max_score; |
|
2578 | 2578 | } |
2579 | 2579 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2580 | 2580 | } else { |
@@ -2598,10 +2598,10 @@ discard block |
||
2598 | 2598 | ORDER BY exe_date DESC |
2599 | 2599 | LIMIT 1"; |
2600 | 2600 | |
2601 | - if ($debug) echo $sql .'<br />'; |
|
2601 | + if ($debug) echo $sql.'<br />'; |
|
2602 | 2602 | $result_last_attempt = Database::query($sql); |
2603 | 2603 | $num = Database :: num_rows($result_last_attempt); |
2604 | - if ($num > 0 ) { |
|
2604 | + if ($num > 0) { |
|
2605 | 2605 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2606 | 2606 | if ($debug) echo $id_last_attempt.'<br />'; |
2607 | 2607 | |
@@ -2630,13 +2630,13 @@ discard block |
||
2630 | 2630 | $max_score = $row_max_score_bis['maxscore']; |
2631 | 2631 | } |
2632 | 2632 | if (!empty($max_score) && floatval($max_score) > 0) { |
2633 | - $lp_partial_total += $score/$max_score; |
|
2633 | + $lp_partial_total += $score / $max_score; |
|
2634 | 2634 | } |
2635 | 2635 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2636 | 2636 | } |
2637 | 2637 | } |
2638 | 2638 | |
2639 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2639 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2640 | 2640 | // Normal way |
2641 | 2641 | if ($use_max_score[$lp_id]) { |
2642 | 2642 | $count_items++; |
@@ -2671,8 +2671,8 @@ discard block |
||
2671 | 2671 | if ($debug) echo $sql; |
2672 | 2672 | $result_have_quiz = Database::query($sql); |
2673 | 2673 | |
2674 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2675 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2674 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2675 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2676 | 2676 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2677 | 2677 | $lp_with_quiz++; |
2678 | 2678 | } |
@@ -2684,7 +2684,7 @@ discard block |
||
2684 | 2684 | |
2685 | 2685 | if ($lp_with_quiz != 0) { |
2686 | 2686 | if (!$return_array) { |
2687 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2687 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2688 | 2688 | if ($debug) var_dump($score_of_scorm_calculate); |
2689 | 2689 | if (empty($lp_ids)) { |
2690 | 2690 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2758,9 +2758,9 @@ discard block |
||
2758 | 2758 | |
2759 | 2759 | if (is_array($student_id)) { |
2760 | 2760 | array_walk($student_id, 'intval'); |
2761 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2761 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2762 | 2762 | } else { |
2763 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2763 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2764 | 2764 | } |
2765 | 2765 | |
2766 | 2766 | $conditionsToString = implode('AND ', $conditions); |
@@ -2814,7 +2814,7 @@ discard block |
||
2814 | 2814 | // Compose a filter based on optional learning paths list given |
2815 | 2815 | $condition_lp = ""; |
2816 | 2816 | if (count($lp_ids) > 0) { |
2817 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2817 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2818 | 2818 | } |
2819 | 2819 | |
2820 | 2820 | // Compose a filter based on optional session id |
@@ -2876,7 +2876,7 @@ discard block |
||
2876 | 2876 | |
2877 | 2877 | if (!empty($course)) { |
2878 | 2878 | |
2879 | - $course_id = $course['real_id']; |
|
2879 | + $course_id = $course['real_id']; |
|
2880 | 2880 | |
2881 | 2881 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2882 | 2882 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2890,8 +2890,8 @@ discard block |
||
2890 | 2890 | // calculates last connection time |
2891 | 2891 | if ($count_row_lp > 0) { |
2892 | 2892 | $sql = 'SELECT MAX(start_time) |
2893 | - FROM ' . $t_lpiv . ' AS item_view |
|
2894 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2893 | + FROM ' . $t_lpiv.' AS item_view |
|
2894 | + INNER JOIN ' . $t_lpv.' AS view |
|
2895 | 2895 | ON item_view.lp_view_id = view.id |
2896 | 2896 | WHERE |
2897 | 2897 | item_view.c_id = '.$course_id.' AND |
@@ -2927,15 +2927,15 @@ discard block |
||
2927 | 2927 | |
2928 | 2928 | // At first, courses where $coach_id is coach of the course // |
2929 | 2929 | $sql = 'SELECT session_id, c_id |
2930 | - FROM ' . $tbl_session_course_user . ' |
|
2930 | + FROM ' . $tbl_session_course_user.' |
|
2931 | 2931 | WHERE user_id=' . $coach_id.' AND status=2'; |
2932 | 2932 | |
2933 | 2933 | if (api_is_multiple_url_enabled()) { |
2934 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2934 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2935 | 2935 | $access_url_id = api_get_current_access_url_id(); |
2936 | 2936 | if ($access_url_id != -1) { |
2937 | 2937 | $sql = 'SELECT scu.session_id, scu.c_id |
2938 | - FROM ' . $tbl_session_course_user . ' scu |
|
2938 | + FROM ' . $tbl_session_course_user.' scu |
|
2939 | 2939 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2940 | 2940 | ON (scu.session_id=sru.session_id) |
2941 | 2941 | WHERE |
@@ -2969,28 +2969,28 @@ discard block |
||
2969 | 2969 | |
2970 | 2970 | // Then, courses where $coach_id is coach of the session // |
2971 | 2971 | $sql = 'SELECT session_course_user.user_id |
2972 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2972 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2973 | 2973 | INNER JOIN '.$tbl_session_user.' sru |
2974 | 2974 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2975 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2975 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2976 | 2976 | ON session_course.c_id = session_course_user.c_id |
2977 | 2977 | AND session_course_user.session_id = session_course.session_id |
2978 | - INNER JOIN ' . $tbl_session . ' as session |
|
2978 | + INNER JOIN ' . $tbl_session.' as session |
|
2979 | 2979 | ON session.id = session_course.session_id |
2980 | 2980 | AND session.id_coach = ' . $coach_id; |
2981 | 2981 | if (api_is_multiple_url_enabled()) { |
2982 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2982 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2983 | 2983 | $access_url_id = api_get_current_access_url_id(); |
2984 | - if ($access_url_id != -1){ |
|
2984 | + if ($access_url_id != -1) { |
|
2985 | 2985 | $sql = 'SELECT session_course_user.user_id |
2986 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2986 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2987 | 2987 | INNER JOIN '.$tbl_session_user.' sru |
2988 | 2988 | ON session_course_user.user_id = sru.user_id AND |
2989 | 2989 | session_course_user.session_id = sru.session_id |
2990 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2990 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2991 | 2991 | ON session_course.c_id = session_course_user.c_id AND |
2992 | 2992 | session_course_user.session_id = session_course.session_id |
2993 | - INNER JOIN ' . $tbl_session . ' as session |
|
2993 | + INNER JOIN ' . $tbl_session.' as session |
|
2994 | 2994 | ON session.id = session_course.session_id AND |
2995 | 2995 | session.id_coach = ' . $coach_id.' |
2996 | 2996 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -3020,8 +3020,8 @@ discard block |
||
3020 | 3020 | |
3021 | 3021 | $students = []; |
3022 | 3022 | // At first, courses where $coach_id is coach of the course // |
3023 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
3024 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
3023 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
3024 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
3025 | 3025 | $result = Database::query($sql); |
3026 | 3026 | |
3027 | 3027 | while ($a_courses = Database::fetch_array($result)) { |
@@ -3031,7 +3031,7 @@ discard block |
||
3031 | 3031 | FROM $tbl_session_course_user AS srcru |
3032 | 3032 | WHERE |
3033 | 3033 | c_id = '$courseId' AND |
3034 | - session_id = '" . $id_session . "'"; |
|
3034 | + session_id = '".$id_session."'"; |
|
3035 | 3035 | $rs = Database::query($sql); |
3036 | 3036 | while ($row = Database::fetch_array($rs)) { |
3037 | 3037 | $students[$row['user_id']] = $row['user_id']; |
@@ -3039,15 +3039,15 @@ discard block |
||
3039 | 3039 | } |
3040 | 3040 | |
3041 | 3041 | // Then, courses where $coach_id is coach of the session |
3042 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
3043 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
3042 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
3043 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
3044 | 3044 | $result = Database::query($sql); |
3045 | 3045 | |
3046 | 3046 | //He is the session_coach so we select all the users in the session |
3047 | 3047 | if (Database::num_rows($result) > 0) { |
3048 | 3048 | $sql = 'SELECT DISTINCT srcru.user_id |
3049 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
3050 | - WHERE session_id="' . $id_session . '"'; |
|
3049 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
3050 | + WHERE session_id="' . $id_session.'"'; |
|
3051 | 3051 | $result = Database::query($sql); |
3052 | 3052 | while ($row = Database::fetch_array($result)) { |
3053 | 3053 | $students[$row['user_id']] = $row['user_id']; |
@@ -3074,8 +3074,8 @@ discard block |
||
3074 | 3074 | |
3075 | 3075 | // At first, courses where $coach_id is coach of the course // |
3076 | 3076 | |
3077 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
3078 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
3077 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
3078 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
3079 | 3079 | $result = Database::query($sql); |
3080 | 3080 | if (Database::num_rows($result) > 0) { |
3081 | 3081 | return true; |
@@ -3083,12 +3083,12 @@ discard block |
||
3083 | 3083 | |
3084 | 3084 | // Then, courses where $coach_id is coach of the session |
3085 | 3085 | $sql = 'SELECT session_course_user.user_id |
3086 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
3087 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
3086 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
3087 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
3088 | 3088 | ON session_course.c_id = session_course_user.c_id |
3089 | - INNER JOIN ' . $tbl_session . ' as session |
|
3089 | + INNER JOIN ' . $tbl_session.' as session |
|
3090 | 3090 | ON session.id = session_course.session_id |
3091 | - AND session.id_coach = ' . $coach_id . ' |
|
3091 | + AND session.id_coach = ' . $coach_id.' |
|
3092 | 3092 | WHERE user_id = ' . $student_id; |
3093 | 3093 | $result = Database::query($sql); |
3094 | 3094 | if (Database::num_rows($result) > 0) { |
@@ -3120,16 +3120,16 @@ discard block |
||
3120 | 3120 | // At first, courses where $coach_id is coach of the course. |
3121 | 3121 | |
3122 | 3122 | $sql = 'SELECT DISTINCT c.code |
3123 | - FROM ' . $tbl_session_course_user . ' sc |
|
3123 | + FROM ' . $tbl_session_course_user.' sc |
|
3124 | 3124 | INNER JOIN '.$tbl_course.' c |
3125 | 3125 | ON (c.id = sc.c_id) |
3126 | 3126 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
3127 | 3127 | |
3128 | 3128 | if (api_is_multiple_url_enabled()) { |
3129 | 3129 | $access_url_id = api_get_current_access_url_id(); |
3130 | - if ($access_url_id != -1){ |
|
3130 | + if ($access_url_id != -1) { |
|
3131 | 3131 | $sql = 'SELECT DISTINCT c.code |
3132 | - FROM ' . $tbl_session_course_user . ' scu |
|
3132 | + FROM ' . $tbl_session_course_user.' scu |
|
3133 | 3133 | INNER JOIN '.$tbl_course.' c |
3134 | 3134 | ON (c.code = scu.c_id) |
3135 | 3135 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | } |
3143 | 3143 | |
3144 | 3144 | if (!empty($id_session)) { |
3145 | - $sql .= ' AND session_id=' . $id_session; |
|
3145 | + $sql .= ' AND session_id='.$id_session; |
|
3146 | 3146 | } |
3147 | 3147 | |
3148 | 3148 | $courseList = array(); |
@@ -3154,25 +3154,25 @@ discard block |
||
3154 | 3154 | // Then, courses where $coach_id is coach of the session |
3155 | 3155 | |
3156 | 3156 | $sql = 'SELECT DISTINCT course.code |
3157 | - FROM ' . $tbl_session_course . ' as session_course |
|
3158 | - INNER JOIN ' . $tbl_session . ' as session |
|
3157 | + FROM ' . $tbl_session_course.' as session_course |
|
3158 | + INNER JOIN ' . $tbl_session.' as session |
|
3159 | 3159 | ON session.id = session_course.session_id |
3160 | - AND session.id_coach = ' . $coach_id . ' |
|
3161 | - INNER JOIN ' . $tbl_course . ' as course |
|
3160 | + AND session.id_coach = ' . $coach_id.' |
|
3161 | + INNER JOIN ' . $tbl_course.' as course |
|
3162 | 3162 | ON course.id = session_course.c_id'; |
3163 | 3163 | |
3164 | 3164 | if (api_is_multiple_url_enabled()) { |
3165 | 3165 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3166 | 3166 | $access_url_id = api_get_current_access_url_id(); |
3167 | - if ($access_url_id != -1){ |
|
3167 | + if ($access_url_id != -1) { |
|
3168 | 3168 | $sql = 'SELECT DISTINCT c.code |
3169 | - FROM ' . $tbl_session_course . ' as session_course |
|
3169 | + FROM ' . $tbl_session_course.' as session_course |
|
3170 | 3170 | INNER JOIN '.$tbl_course.' c |
3171 | 3171 | ON (c.id = session_course.c_id) |
3172 | - INNER JOIN ' . $tbl_session . ' as session |
|
3172 | + INNER JOIN ' . $tbl_session.' as session |
|
3173 | 3173 | ON session.id = session_course.session_id |
3174 | - AND session.id_coach = ' . $coach_id . ' |
|
3175 | - INNER JOIN ' . $tbl_course . ' as course |
|
3174 | + AND session.id_coach = ' . $coach_id.' |
|
3175 | + INNER JOIN ' . $tbl_course.' as course |
|
3176 | 3176 | ON course.id = session_course.c_id |
3177 | 3177 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3178 | 3178 | ON (course_rel_url.c_id = c.id)'; |
@@ -3180,12 +3180,12 @@ discard block |
||
3180 | 3180 | } |
3181 | 3181 | |
3182 | 3182 | if (!empty ($id_session)) { |
3183 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3183 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3184 | 3184 | if (api_is_multiple_url_enabled()) |
3185 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3186 | - } else { |
|
3185 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3186 | + } else { |
|
3187 | 3187 | if (api_is_multiple_url_enabled()) |
3188 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3188 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3189 | 3189 | } |
3190 | 3190 | |
3191 | 3191 | $result = Database::query($sql); |
@@ -3241,7 +3241,7 @@ discard block |
||
3241 | 3241 | } |
3242 | 3242 | } |
3243 | 3243 | |
3244 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3244 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3245 | 3245 | $access_url_id = api_get_current_access_url_id(); |
3246 | 3246 | |
3247 | 3247 | $sql = " |
@@ -3365,7 +3365,7 @@ discard block |
||
3365 | 3365 | // table definition |
3366 | 3366 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3367 | 3367 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3368 | - $course_id = $a_course['real_id']; |
|
3368 | + $course_id = $a_course['real_id']; |
|
3369 | 3369 | if (is_array($student_id)) { |
3370 | 3370 | $studentList = array_map('intval', $student_id); |
3371 | 3371 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3418,7 +3418,7 @@ discard block |
||
3418 | 3418 | $a_course = CourseManager::get_course_information($course_code); |
3419 | 3419 | if (!empty($a_course)) { |
3420 | 3420 | $course_id = $a_course['real_id']; |
3421 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3421 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3422 | 3422 | } |
3423 | 3423 | |
3424 | 3424 | // table definition |
@@ -3427,14 +3427,14 @@ discard block |
||
3427 | 3427 | |
3428 | 3428 | if (is_array($student_id)) { |
3429 | 3429 | $studentList = array_map('intval', $student_id); |
3430 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3430 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3431 | 3431 | } else { |
3432 | 3432 | $student_id = intval($student_id); |
3433 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3433 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3434 | 3434 | } |
3435 | 3435 | if (isset($session_id)) { |
3436 | 3436 | $session_id = intval($session_id); |
3437 | - $conditions[]= " pub.session_id = $session_id "; |
|
3437 | + $conditions[] = " pub.session_id = $session_id "; |
|
3438 | 3438 | } |
3439 | 3439 | $conditionToString = implode('AND', $conditions); |
3440 | 3440 | |
@@ -3471,10 +3471,10 @@ discard block |
||
3471 | 3471 | $conditions = array(); |
3472 | 3472 | if (is_array($student_id)) { |
3473 | 3473 | $studentList = array_map('intval', $student_id); |
3474 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3474 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3475 | 3475 | } else { |
3476 | 3476 | $student_id = intval($student_id); |
3477 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3477 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3478 | 3478 | } |
3479 | 3479 | |
3480 | 3480 | $conditionsToString = implode('AND ', $conditions); |
@@ -3500,13 +3500,13 @@ discard block |
||
3500 | 3500 | if (!empty($courseInfo)) { |
3501 | 3501 | $forums = get_forums('', $courseCode, true, $session_id); |
3502 | 3502 | $course_id = $courseInfo['real_id']; |
3503 | - $conditions[]= " post.c_id = $course_id "; |
|
3503 | + $conditions[] = " post.c_id = $course_id "; |
|
3504 | 3504 | } |
3505 | 3505 | |
3506 | 3506 | if (!empty($forums)) { |
3507 | 3507 | $idList = array_column($forums, 'forum_id'); |
3508 | 3508 | $idListToString = implode("', '", $idList); |
3509 | - $conditions[]= " post.forum_id IN ('$idListToString')"; |
|
3509 | + $conditions[] = " post.forum_id IN ('$idListToString')"; |
|
3510 | 3510 | } |
3511 | 3511 | |
3512 | 3512 | $conditionsToString = implode('AND ', $conditions); |
@@ -3541,7 +3541,7 @@ discard block |
||
3541 | 3541 | $condition_session = ''; |
3542 | 3542 | if (isset($session_id)) { |
3543 | 3543 | $session_id = intval($session_id); |
3544 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3544 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3545 | 3545 | } |
3546 | 3546 | |
3547 | 3547 | $course_id = $courseInfo['real_id']; |
@@ -3597,7 +3597,7 @@ discard block |
||
3597 | 3597 | $condition_session = ''; |
3598 | 3598 | if (isset($session_id)) { |
3599 | 3599 | $session_id = intval($session_id); |
3600 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3600 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3601 | 3601 | } |
3602 | 3602 | |
3603 | 3603 | $groupId = intval($groupId); |
@@ -3658,7 +3658,7 @@ discard block |
||
3658 | 3658 | $condition_session = ''; |
3659 | 3659 | if (isset($session_id)) { |
3660 | 3660 | $session_id = intval($session_id); |
3661 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3661 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3662 | 3662 | } |
3663 | 3663 | |
3664 | 3664 | $groupId = intval($groupId); |
@@ -3737,7 +3737,7 @@ discard block |
||
3737 | 3737 | { |
3738 | 3738 | $student_id = intval($student_id); |
3739 | 3739 | $courseId = intval($courseId); |
3740 | - $session_id = intval($session_id); |
|
3740 | + $session_id = intval($session_id); |
|
3741 | 3741 | $date_time = ''; |
3742 | 3742 | |
3743 | 3743 | // table definition |
@@ -3806,7 +3806,7 @@ discard block |
||
3806 | 3806 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3807 | 3807 | |
3808 | 3808 | $sql = 'SELECT 1 |
3809 | - FROM ' . $table . ' |
|
3809 | + FROM ' . $table.' |
|
3810 | 3810 | WHERE down_user_id = '.$student_id.' |
3811 | 3811 | AND c_id = "'.$courseId.'" |
3812 | 3812 | AND down_session_id = '.$session_id.' '; |
@@ -3884,30 +3884,30 @@ discard block |
||
3884 | 3884 | '.$inner.' |
3885 | 3885 | WHERE c.id = '.$courseId.' |
3886 | 3886 | GROUP BY stats_login.user_id |
3887 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3887 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3888 | 3888 | |
3889 | 3889 | if ($since == 'never') { |
3890 | 3890 | if (empty($session_id)) { |
3891 | 3891 | $sql = 'SELECT course_user.user_id |
3892 | - FROM ' . $table_course_rel_user . ' course_user |
|
3893 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3892 | + FROM ' . $table_course_rel_user.' course_user |
|
3893 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3894 | 3894 | ON course_user.user_id = stats_login.user_id AND |
3895 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3896 | - INNER JOIN ' . $tableCourse . ' c |
|
3895 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3896 | + INNER JOIN ' . $tableCourse.' c |
|
3897 | 3897 | ON (c.id = course_user.c_id) |
3898 | 3898 | WHERE |
3899 | - course_user.c_id = ' . $courseId . ' AND |
|
3899 | + course_user.c_id = ' . $courseId.' AND |
|
3900 | 3900 | stats_login.login_course_date IS NULL |
3901 | 3901 | GROUP BY course_user.user_id'; |
3902 | 3902 | } else { |
3903 | 3903 | $sql = 'SELECT session_course_user.user_id |
3904 | 3904 | FROM '.$tbl_session_course_user.' session_course_user |
3905 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3905 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3906 | 3906 | ON session_course_user.user_id = stats_login.user_id |
3907 | - INNER JOIN ' . $tableCourse . ' c |
|
3907 | + INNER JOIN ' . $tableCourse.' c |
|
3908 | 3908 | ON (c.id = session_course_user.c_id) |
3909 | 3909 | WHERE |
3910 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3910 | + session_course_user.c_id = ' . $courseId.' AND |
|
3911 | 3911 | stats_login.login_course_date IS NULL |
3912 | 3912 | GROUP BY session_course_user.user_id'; |
3913 | 3913 | } |
@@ -3915,7 +3915,7 @@ discard block |
||
3915 | 3915 | |
3916 | 3916 | $rs = Database::query($sql); |
3917 | 3917 | $inactive_users = array(); |
3918 | - while($user = Database::fetch_array($rs)) { |
|
3918 | + while ($user = Database::fetch_array($rs)) { |
|
3919 | 3919 | $inactive_users[] = $user['user_id']; |
3920 | 3920 | } |
3921 | 3921 | |
@@ -3937,10 +3937,10 @@ discard block |
||
3937 | 3937 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3938 | 3938 | |
3939 | 3939 | $sql = 'SELECT '.$student_id.' |
3940 | - FROM ' . $table . ' |
|
3940 | + FROM ' . $table.' |
|
3941 | 3941 | WHERE |
3942 | - access_user_id=' . $student_id . ' AND |
|
3943 | - c_id="' . $courseId . '" AND |
|
3942 | + access_user_id=' . $student_id.' AND |
|
3943 | + c_id="' . $courseId.'" AND |
|
3944 | 3944 | access_session_id = "'.$session_id.'" '; |
3945 | 3945 | |
3946 | 3946 | $rs = Database::query($sql); |
@@ -3958,13 +3958,13 @@ discard block |
||
3958 | 3958 | { |
3959 | 3959 | $hr_dept_id = intval($hr_dept_id); |
3960 | 3960 | $a_students = array(); |
3961 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3961 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3962 | 3962 | |
3963 | 3963 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3964 | 3964 | WHERE hr_dept_id='.$hr_dept_id; |
3965 | 3965 | $rs = Database::query($sql); |
3966 | 3966 | |
3967 | - while($user = Database :: fetch_array($rs)) { |
|
3967 | + while ($user = Database :: fetch_array($rs)) { |
|
3968 | 3968 | $a_students[$user['user_id']] = $user['user_id']; |
3969 | 3969 | } |
3970 | 3970 | |
@@ -3989,7 +3989,7 @@ discard block |
||
3989 | 3989 | $condition_session = ''; |
3990 | 3990 | if (isset($session_id)) { |
3991 | 3991 | $session_id = intval($session_id); |
3992 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3992 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3993 | 3993 | } |
3994 | 3994 | $sql = "SELECT |
3995 | 3995 | access_tool, |
@@ -4101,7 +4101,7 @@ discard block |
||
4101 | 4101 | if (!empty($date_from) && !empty($date_to)) { |
4102 | 4102 | $fieldStartDate = $fields['start_date']; |
4103 | 4103 | if (!isset($fields['end_date'])) { |
4104 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
4104 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
4105 | 4105 | } else { |
4106 | 4106 | $fieldEndDate = $fields['end_date']; |
4107 | 4107 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4117,12 +4117,12 @@ discard block |
||
4117 | 4117 | $where |
4118 | 4118 | GROUP BY %s"; |
4119 | 4119 | $sql = sprintf($sql, |
4120 | - $fields['user'], //user field |
|
4121 | - $tableName, //FROM |
|
4122 | - $fields['course'], //course condition |
|
4123 | - $course['real_id'], //course condition |
|
4124 | - $fields['user'], //user condition |
|
4125 | - $userId, //user condition |
|
4120 | + $fields['user'], //user field |
|
4121 | + $tableName, //FROM |
|
4122 | + $fields['course'], //course condition |
|
4123 | + $course['real_id'], //course condition |
|
4124 | + $fields['user'], //user condition |
|
4125 | + $userId, //user condition |
|
4126 | 4126 | $fields['user'] //GROUP BY |
4127 | 4127 | ); |
4128 | 4128 | $rs = Database::query($sql); |
@@ -4130,7 +4130,7 @@ discard block |
||
4130 | 4130 | //iterate query |
4131 | 4131 | if (Database::num_rows($rs) > 0) { |
4132 | 4132 | while ($row = Database::fetch_array($rs)) { |
4133 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
4133 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
4134 | 4134 | } |
4135 | 4135 | } |
4136 | 4136 | } |
@@ -4153,11 +4153,11 @@ discard block |
||
4153 | 4153 | $courseId = api_get_course_int_id($course_code); |
4154 | 4154 | $data = array(); |
4155 | 4155 | |
4156 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4156 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4157 | 4157 | $condition_session = ''; |
4158 | 4158 | $session_id = intval($session_id); |
4159 | 4159 | if (!empty($session_id)) { |
4160 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4160 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4161 | 4161 | } |
4162 | 4162 | $sql = "SELECT |
4163 | 4163 | down_doc_path, |
@@ -4345,7 +4345,7 @@ discard block |
||
4345 | 4345 | |
4346 | 4346 | $final_course_data = array(); |
4347 | 4347 | |
4348 | - foreach($my_course_data as $course_id => $value) { |
|
4348 | + foreach ($my_course_data as $course_id => $value) { |
|
4349 | 4349 | $final_course_data[$course_id] = $course_list[$course_id]; |
4350 | 4350 | } |
4351 | 4351 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4368,7 +4368,7 @@ discard block |
||
4368 | 4368 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4369 | 4369 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4370 | 4370 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4371 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4371 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4372 | 4372 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4373 | 4373 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4374 | 4374 | </tr>'; |
@@ -4457,7 +4457,7 @@ discard block |
||
4457 | 4457 | $all_exercise_start_time = array(); |
4458 | 4458 | |
4459 | 4459 | foreach ($course_in_session as $my_session_id => $session_data) { |
4460 | - $course_list = $session_data['course_list']; |
|
4460 | + $course_list = $session_data['course_list']; |
|
4461 | 4461 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4462 | 4462 | $exercise_graph_name_list = array(); |
4463 | 4463 | //$user_results = array(); |
@@ -4502,20 +4502,20 @@ discard block |
||
4502 | 4502 | |
4503 | 4503 | $score = 0; |
4504 | 4504 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4505 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4505 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4506 | 4506 | } |
4507 | 4507 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4508 | 4508 | $all_exercise_start_time[] = $time; |
4509 | 4509 | $my_results[] = $score; |
4510 | - if (count($exercise_list)<=10) { |
|
4510 | + if (count($exercise_list) <= 10) { |
|
4511 | 4511 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4512 | - $exercise_graph_name_list[]= $title; |
|
4512 | + $exercise_graph_name_list[] = $title; |
|
4513 | 4513 | $all_exercise_graph_name_list[] = $title; |
4514 | 4514 | } else { |
4515 | 4515 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4516 | 4516 | $title = cut($exercise_data['title'], 30); |
4517 | - $exercise_graph_name_list[]= $title; |
|
4518 | - $all_exercise_graph_name_list[]= $title; |
|
4517 | + $exercise_graph_name_list[] = $title; |
|
4518 | + $all_exercise_graph_name_list[] = $title; |
|
4519 | 4519 | } |
4520 | 4520 | } |
4521 | 4521 | } |
@@ -4548,7 +4548,7 @@ discard block |
||
4548 | 4548 | } |
4549 | 4549 | |
4550 | 4550 | $html .= Display::page_subheader( |
4551 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4551 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4552 | 4552 | ); |
4553 | 4553 | |
4554 | 4554 | $html .= '<div class="table-responsive">'; |
@@ -4602,7 +4602,7 @@ discard block |
||
4602 | 4602 | $courseInfo['real_id'], |
4603 | 4603 | $my_session_id |
4604 | 4604 | ); |
4605 | - if ($attempts > 1) { |
|
4605 | + if ($attempts > 1) { |
|
4606 | 4606 | $answered_exercises++; |
4607 | 4607 | } |
4608 | 4608 | } |
@@ -4615,7 +4615,7 @@ discard block |
||
4615 | 4615 | $all_average += $average; |
4616 | 4616 | } |
4617 | 4617 | |
4618 | - $all_average = $all_average / count($course_list); |
|
4618 | + $all_average = $all_average / count($course_list); |
|
4619 | 4619 | |
4620 | 4620 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4621 | 4621 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4641,16 +4641,16 @@ discard block |
||
4641 | 4641 | } |
4642 | 4642 | $html .= '</tbody>'; |
4643 | 4643 | $html .= '</table></div><br />'; |
4644 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4644 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4645 | 4645 | |
4646 | 4646 | // Checking selected session. |
4647 | 4647 | |
4648 | 4648 | if (isset($_GET['session_id'])) { |
4649 | 4649 | $session_id_from_get = intval($_GET['session_id']); |
4650 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4651 | - $course_list = $session_data['course_list']; |
|
4650 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4651 | + $course_list = $session_data['course_list']; |
|
4652 | 4652 | |
4653 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4653 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4654 | 4654 | |
4655 | 4655 | $html .= '<div class="table-responsive">'; |
4656 | 4656 | $html .= '<table class="table table-hover table-striped">'; |
@@ -4659,15 +4659,15 @@ discard block |
||
4659 | 4659 | <thead> |
4660 | 4660 | <tr> |
4661 | 4661 | <th width="300px">'.get_lang('Course').'</th> |
4662 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4663 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4664 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4665 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4666 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4667 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4668 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4669 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4670 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4662 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4663 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4664 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4665 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4666 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4667 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4668 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4669 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4670 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4671 | 4671 | </tr> |
4672 | 4672 | </thead> |
4673 | 4673 | <tbody> |
@@ -4686,14 +4686,14 @@ discard block |
||
4686 | 4686 | $count_exercises = count($exercises); |
4687 | 4687 | } |
4688 | 4688 | $answered_exercises = 0; |
4689 | - foreach($exercises as $exercise_item) { |
|
4689 | + foreach ($exercises as $exercise_item) { |
|
4690 | 4690 | $attempts = Event::count_exercise_attempts_by_user( |
4691 | 4691 | api_get_user_id(), |
4692 | 4692 | $exercise_item['id'], |
4693 | 4693 | $courseId, |
4694 | 4694 | $session_id_from_get |
4695 | 4695 | ); |
4696 | - if ($attempts > 1) { |
|
4696 | + if ($attempts > 1) { |
|
4697 | 4697 | $answered_exercises++; |
4698 | 4698 | } |
4699 | 4699 | } |
@@ -4702,7 +4702,7 @@ discard block |
||
4702 | 4702 | |
4703 | 4703 | // Average |
4704 | 4704 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4705 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4705 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4706 | 4706 | |
4707 | 4707 | $stats_array[$course_code] = array( |
4708 | 4708 | 'exercises' => $count_exercises, |
@@ -4779,7 +4779,7 @@ discard block |
||
4779 | 4779 | |
4780 | 4780 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4781 | 4781 | $details = '<a href="#">'; |
4782 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4782 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4783 | 4783 | } else { |
4784 | 4784 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4785 | 4785 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4879,7 +4879,7 @@ discard block |
||
4879 | 4879 | ); |
4880 | 4880 | |
4881 | 4881 | $html .= '<tr class="row_even">'; |
4882 | - $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4882 | + $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4883 | 4883 | |
4884 | 4884 | if ($visible_return['value'] == true) { |
4885 | 4885 | $exercices['title'] = Display::url( |
@@ -4908,7 +4908,7 @@ discard block |
||
4908 | 4908 | ); |
4909 | 4909 | |
4910 | 4910 | $latest_attempt_url = ''; |
4911 | - $best_score = $position = $percentage_score_result = '-'; |
|
4911 | + $best_score = $position = $percentage_score_result = '-'; |
|
4912 | 4912 | $graph = $normal_graph = null; |
4913 | 4913 | |
4914 | 4914 | // Getting best results |
@@ -4940,11 +4940,11 @@ discard block |
||
4940 | 4940 | $weighting = $exercise_stat['exe_weighting']; |
4941 | 4941 | $exe_id = $exercise_stat['exe_id']; |
4942 | 4942 | |
4943 | - $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; |
|
4943 | + $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; |
|
4944 | 4944 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4945 | 4945 | $my_score = 0; |
4946 | 4946 | if (!empty($weighting) && intval($weighting) != 0) { |
4947 | - $my_score = $score/$weighting; |
|
4947 | + $my_score = $score / $weighting; |
|
4948 | 4948 | } |
4949 | 4949 | //@todo this function slows the page |
4950 | 4950 | if (is_int($user_list)) { |
@@ -4958,14 +4958,14 @@ discard block |
||
4958 | 4958 | } |
4959 | 4959 | $html .= Display::div( |
4960 | 4960 | $normal_graph, |
4961 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4961 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4962 | 4962 | ); |
4963 | 4963 | |
4964 | 4964 | if (empty($graph)) { |
4965 | 4965 | $graph = '-'; |
4966 | 4966 | } else { |
4967 | 4967 | $graph = Display::url( |
4968 | - '<img src="' . $graph . '" >', |
|
4968 | + '<img src="'.$graph.'" >', |
|
4969 | 4969 | $normal_graph, |
4970 | 4970 | array( |
4971 | 4971 | 'id' => $exercices['id'], |
@@ -4999,7 +4999,7 @@ discard block |
||
4999 | 4999 | |
5000 | 5000 | // LP table results |
5001 | 5001 | $html .= '<div class="table-responsive">'; |
5002 | - $html .='<table class="table table-striped table-hover">'; |
|
5002 | + $html .= '<table class="table table-striped table-hover">'; |
|
5003 | 5003 | $html .= '<thead><tr>'; |
5004 | 5004 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
5005 | 5005 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -5035,7 +5035,7 @@ discard block |
||
5035 | 5035 | $time_spent_in_lp = api_time_to_hms($time_spent_in_lp); |
5036 | 5036 | |
5037 | 5037 | $html .= '<tr class="row_even">'; |
5038 | - $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
5038 | + $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
5039 | 5039 | |
5040 | 5040 | if ($learnpath['lp_visibility'] == 0) { |
5041 | 5041 | $html .= Display::tag('td', $learnpath['lp_name']); |
@@ -5054,7 +5054,7 @@ discard block |
||
5054 | 5054 | if (!empty($last_connection_in_lp)) { |
5055 | 5055 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
5056 | 5056 | } |
5057 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
5057 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
5058 | 5058 | $html .= "</tr>"; |
5059 | 5059 | } |
5060 | 5060 | } else { |
@@ -5064,7 +5064,7 @@ discard block |
||
5064 | 5064 | </td> |
5065 | 5065 | </tr>'; |
5066 | 5066 | } |
5067 | - $html .='</tbody></table></div>'; |
|
5067 | + $html .= '</tbody></table></div>'; |
|
5068 | 5068 | |
5069 | 5069 | $html .= self::displayUserSkills($user_id, $course_info['id'], $session_id); |
5070 | 5070 | } |
@@ -5093,7 +5093,7 @@ discard block |
||
5093 | 5093 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
5094 | 5094 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
5095 | 5095 | $myData->setAxisUnit(0, '%'); |
5096 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5096 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5097 | 5097 | // Cache definition |
5098 | 5098 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5099 | 5099 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -5101,9 +5101,9 @@ discard block |
||
5101 | 5101 | |
5102 | 5102 | if ($myCache->isInCache($chartHash)) { |
5103 | 5103 | //if we already created the img |
5104 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5104 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5105 | 5105 | $myCache->saveFromCache($chartHash, $imgPath); |
5106 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5106 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5107 | 5107 | } else { |
5108 | 5108 | /* Define width, height and angle */ |
5109 | 5109 | $mainWidth = 860; |
@@ -5132,7 +5132,7 @@ discard block |
||
5132 | 5132 | /* Set the default font */ |
5133 | 5133 | $myPicture->setFontProperties( |
5134 | 5134 | array( |
5135 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5135 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5136 | 5136 | 'FontSize' => 10) |
5137 | 5137 | ); |
5138 | 5138 | /* Write the chart title */ |
@@ -5149,7 +5149,7 @@ discard block |
||
5149 | 5149 | /* Set the default font */ |
5150 | 5150 | $myPicture->setFontProperties( |
5151 | 5151 | array( |
5152 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5152 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5153 | 5153 | 'FontSize' => 6 |
5154 | 5154 | ) |
5155 | 5155 | ); |
@@ -5191,7 +5191,7 @@ discard block |
||
5191 | 5191 | /* Draw the line chart */ |
5192 | 5192 | $myPicture->setFontProperties( |
5193 | 5193 | array( |
5194 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5194 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5195 | 5195 | 'FontSize' => 10 |
5196 | 5196 | ) |
5197 | 5197 | ); |
@@ -5224,12 +5224,12 @@ discard block |
||
5224 | 5224 | ); |
5225 | 5225 | |
5226 | 5226 | $myCache->writeToCache($chartHash, $myPicture); |
5227 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5227 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5228 | 5228 | $myCache->saveFromCache($chartHash, $imgPath); |
5229 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5229 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5230 | 5230 | } |
5231 | 5231 | |
5232 | - $html = '<img src="' . $imgPath . '">'; |
|
5232 | + $html = '<img src="'.$imgPath.'">'; |
|
5233 | 5233 | |
5234 | 5234 | return $html; |
5235 | 5235 | } |
@@ -5250,12 +5250,12 @@ discard block |
||
5250 | 5250 | |
5251 | 5251 | foreach ($attempts as $attempt) { |
5252 | 5252 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5253 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5254 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5253 | + if ($attempt['exe_weighting'] != 0) { |
|
5254 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5255 | 5255 | } |
5256 | 5256 | } else { |
5257 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5258 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5257 | + if ($attempt['exe_weighting'] != 0) { |
|
5258 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5259 | 5259 | } |
5260 | 5260 | } |
5261 | 5261 | } |
@@ -5264,27 +5264,27 @@ discard block |
||
5264 | 5264 | rsort($my_exercise_result_array); |
5265 | 5265 | $my_exercise_result = 0; |
5266 | 5266 | if (isset($my_exercise_result_array[0])) { |
5267 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5267 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5268 | 5268 | } |
5269 | 5269 | |
5270 | 5270 | $max = 100; |
5271 | - $pieces = 5 ; |
|
5271 | + $pieces = 5; |
|
5272 | 5272 | $part = round($max / $pieces); |
5273 | 5273 | $x_axis = array(); |
5274 | 5274 | $final_array = array(); |
5275 | 5275 | $my_final_array = array(); |
5276 | 5276 | |
5277 | - for ($i=1; $i <=$pieces; $i++) { |
|
5277 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5278 | 5278 | $sum = 1; |
5279 | 5279 | if ($i == 1) { |
5280 | 5280 | $sum = 0; |
5281 | 5281 | } |
5282 | - $min = ($i-1)*$part + $sum; |
|
5283 | - $max = ($i)*$part; |
|
5284 | - $x_axis[]= $min." - ".$max; |
|
5282 | + $min = ($i - 1) * $part + $sum; |
|
5283 | + $max = ($i) * $part; |
|
5284 | + $x_axis[] = $min." - ".$max; |
|
5285 | 5285 | $count = 0; |
5286 | - foreach($exercise_result as $result) { |
|
5287 | - $percentage = $result*100; |
|
5286 | + foreach ($exercise_result as $result) { |
|
5287 | + $percentage = $result * 100; |
|
5288 | 5288 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5289 | 5289 | if ($percentage >= $min && $percentage <= $max) { |
5290 | 5290 | //echo ' is > '; |
@@ -5292,7 +5292,7 @@ discard block |
||
5292 | 5292 | } |
5293 | 5293 | } |
5294 | 5294 | //echo '<br />'; |
5295 | - $final_array[]= $count; |
|
5295 | + $final_array[] = $count; |
|
5296 | 5296 | |
5297 | 5297 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5298 | 5298 | $my_final_array[] = 1; |
@@ -5302,9 +5302,9 @@ discard block |
||
5302 | 5302 | } |
5303 | 5303 | |
5304 | 5304 | //Fix to remove the data of the user with my data |
5305 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5305 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5306 | 5306 | if (!empty($my_final_array[$i])) { |
5307 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5307 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5308 | 5308 | $final_array[$i] = 0; |
5309 | 5309 | } |
5310 | 5310 | } |
@@ -5314,16 +5314,16 @@ discard block |
||
5314 | 5314 | $dataSet->addPoints($final_array, 'Serie1'); |
5315 | 5315 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5316 | 5316 | $dataSet->normalize(100, "%"); |
5317 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5317 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5318 | 5318 | |
5319 | 5319 | // Cache definition |
5320 | 5320 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5321 | 5321 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5322 | 5322 | $chartHash = $myCache->getHash($dataSet); |
5323 | 5323 | if ($myCache->isInCache($chartHash)) { |
5324 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5324 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5325 | 5325 | $myCache->saveFromCache($chartHash, $imgPath); |
5326 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5326 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5327 | 5327 | } else { |
5328 | 5328 | /* Create the pChart object */ |
5329 | 5329 | $widthSize = 80; |
@@ -5339,7 +5339,7 @@ discard block |
||
5339 | 5339 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5340 | 5340 | |
5341 | 5341 | /* Set the default font */ |
5342 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5342 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5343 | 5343 | |
5344 | 5344 | /* Do not write the chart title */ |
5345 | 5345 | |
@@ -5403,9 +5403,9 @@ discard block |
||
5403 | 5403 | |
5404 | 5404 | /* Save and write in cache */ |
5405 | 5405 | $myCache->writeToCache($chartHash, $myPicture); |
5406 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5406 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5407 | 5407 | $myCache->saveFromCache($chartHash, $imgPath); |
5408 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5408 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5409 | 5409 | } |
5410 | 5410 | |
5411 | 5411 | return $imgPath; |
@@ -5425,12 +5425,12 @@ discard block |
||
5425 | 5425 | } |
5426 | 5426 | foreach ($attempts as $attempt) { |
5427 | 5427 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5428 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5429 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5428 | + if ($attempt['exe_weighting'] != 0) { |
|
5429 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5430 | 5430 | } |
5431 | 5431 | } else { |
5432 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5433 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5432 | + if ($attempt['exe_weighting'] != 0) { |
|
5433 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5434 | 5434 | } |
5435 | 5435 | } |
5436 | 5436 | } |
@@ -5439,32 +5439,32 @@ discard block |
||
5439 | 5439 | rsort($my_exercise_result_array); |
5440 | 5440 | $my_exercise_result = 0; |
5441 | 5441 | if (isset($my_exercise_result_array[0])) { |
5442 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5442 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5443 | 5443 | } |
5444 | 5444 | |
5445 | 5445 | $max = 100; |
5446 | - $pieces = 5 ; |
|
5446 | + $pieces = 5; |
|
5447 | 5447 | $part = round($max / $pieces); |
5448 | 5448 | $x_axis = array(); |
5449 | 5449 | $final_array = array(); |
5450 | 5450 | $my_final_array = array(); |
5451 | 5451 | |
5452 | - for ($i=1; $i <=$pieces; $i++) { |
|
5452 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5453 | 5453 | $sum = 1; |
5454 | 5454 | if ($i == 1) { |
5455 | 5455 | $sum = 0; |
5456 | 5456 | } |
5457 | - $min = ($i-1)*$part + $sum; |
|
5458 | - $max = ($i)*$part; |
|
5459 | - $x_axis[]= $min." - ".$max; |
|
5457 | + $min = ($i - 1) * $part + $sum; |
|
5458 | + $max = ($i) * $part; |
|
5459 | + $x_axis[] = $min." - ".$max; |
|
5460 | 5460 | $count = 0; |
5461 | - foreach($exercise_result as $result) { |
|
5462 | - $percentage = $result*100; |
|
5461 | + foreach ($exercise_result as $result) { |
|
5462 | + $percentage = $result * 100; |
|
5463 | 5463 | if ($percentage >= $min && $percentage <= $max) { |
5464 | 5464 | $count++; |
5465 | 5465 | } |
5466 | 5466 | } |
5467 | - $final_array[]= $count; |
|
5467 | + $final_array[] = $count; |
|
5468 | 5468 | |
5469 | 5469 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5470 | 5470 | $my_final_array[] = 1; |
@@ -5475,9 +5475,9 @@ discard block |
||
5475 | 5475 | |
5476 | 5476 | //Fix to remove the data of the user with my data |
5477 | 5477 | |
5478 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5478 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5479 | 5479 | if (!empty($my_final_array[$i])) { |
5480 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5480 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5481 | 5481 | $final_array[$i] = 0; |
5482 | 5482 | } |
5483 | 5483 | } |
@@ -5495,7 +5495,7 @@ discard block |
||
5495 | 5495 | $dataSet->setXAxisName(get_lang('Score')); |
5496 | 5496 | $dataSet->normalize(100, "%"); |
5497 | 5497 | |
5498 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5498 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5499 | 5499 | |
5500 | 5500 | // Cache definition |
5501 | 5501 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5503,9 +5503,9 @@ discard block |
||
5503 | 5503 | $chartHash = $myCache->getHash($dataSet); |
5504 | 5504 | |
5505 | 5505 | if ($myCache->isInCache($chartHash)) { |
5506 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5506 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5507 | 5507 | $myCache->saveFromCache($chartHash, $imgPath); |
5508 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5508 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5509 | 5509 | } else { |
5510 | 5510 | /* Create the pChart object */ |
5511 | 5511 | $widthSize = 480; |
@@ -5521,7 +5521,7 @@ discard block |
||
5521 | 5521 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5522 | 5522 | |
5523 | 5523 | /* Set the default font */ |
5524 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5524 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5525 | 5525 | |
5526 | 5526 | /* Write the chart title */ |
5527 | 5527 | $myPicture->drawText( |
@@ -5580,9 +5580,9 @@ discard block |
||
5580 | 5580 | |
5581 | 5581 | /* Write and save into cache */ |
5582 | 5582 | $myCache->writeToCache($chartHash, $myPicture); |
5583 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5583 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5584 | 5584 | $myCache->saveFromCache($chartHash, $imgPath); |
5585 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5585 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5586 | 5586 | } |
5587 | 5587 | |
5588 | 5588 | return $imgPath; |
@@ -5657,7 +5657,7 @@ discard block |
||
5657 | 5657 | $tquiz_answer = Database::get_course_table(TABLE_QUIZ_ANSWER); |
5658 | 5658 | $tquiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION); |
5659 | 5659 | $tquiz_rel_question = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); |
5660 | - $ttrack_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
5660 | + $ttrack_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
5661 | 5661 | $ttrack_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
5662 | 5662 | |
5663 | 5663 | $sessions = array(); |
@@ -5709,7 +5709,7 @@ discard block |
||
5709 | 5709 | $whereSessionParams .= $sessionIdx.','; |
5710 | 5710 | } |
5711 | 5711 | } |
5712 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5712 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5713 | 5713 | } |
5714 | 5714 | |
5715 | 5715 | if (!empty($exerciseId)) { |
@@ -5773,7 +5773,7 @@ discard block |
||
5773 | 5773 | qq.position = rq.question_order AND |
5774 | 5774 | ta.question_id = rq.question_id |
5775 | 5775 | WHERE |
5776 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5776 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5777 | 5777 | AND q.c_id = $courseIdx |
5778 | 5778 | $where $order $limit"; |
5779 | 5779 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5821,7 +5821,7 @@ discard block |
||
5821 | 5821 | // Now fill users data |
5822 | 5822 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5823 | 5823 | FROM $tuser |
5824 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5824 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5825 | 5825 | $resUsers = Database::query($sqlUsers); |
5826 | 5826 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5827 | 5827 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5925,7 +5925,7 @@ discard block |
||
5925 | 5925 | <table class="table" id="skillList"> |
5926 | 5926 | <thead> |
5927 | 5927 | <tr> |
5928 | - <th>' . get_lang('AchievedSkills') . '</th> |
|
5928 | + <th>' . get_lang('AchievedSkills').'</th> |
|
5929 | 5929 | </tr> |
5930 | 5930 | </thead> |
5931 | 5931 | <tbody> |
@@ -5944,10 +5944,10 @@ discard block |
||
5944 | 5944 | |
5945 | 5945 | $html .= ' |
5946 | 5946 | <li class="thumbnail"> |
5947 | - <a href="' . api_get_path(WEB_PATH) . 'badge/' . $userSkill->getId() . '/user/' . $userId . '" target="_blank"> |
|
5948 | - <img class="img-responsive" title="' . $skill->getName() . '" src="' . $skill->getWebIconPath() . '" width="64" height="64"> |
|
5947 | + <a href="' . api_get_path(WEB_PATH).'badge/'.$userSkill->getId().'/user/'.$userId.'" target="_blank"> |
|
5948 | + <img class="img-responsive" title="' . $skill->getName().'" src="'.$skill->getWebIconPath().'" width="64" height="64"> |
|
5949 | 5949 | <div class="caption"> |
5950 | - <p class="text-center">' . $skill->getName() . '</p> |
|
5950 | + <p class="text-center">' . $skill->getName().'</p> |
|
5951 | 5951 | </div> |
5952 | 5952 | </a> |
5953 | 5953 | </li> |
@@ -5997,7 +5997,7 @@ discard block |
||
5997 | 5997 | WHERE |
5998 | 5998 | track_resource.c_id = $course_id AND |
5999 | 5999 | track_resource.insert_user_id = user.user_id AND |
6000 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6000 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6001 | 6001 | |
6002 | 6002 | if (isset($_GET['keyword'])) { |
6003 | 6003 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6055,7 +6055,7 @@ discard block |
||
6055 | 6055 | WHERE |
6056 | 6056 | track_resource.c_id = $course_id AND |
6057 | 6057 | track_resource.insert_user_id = user.user_id AND |
6058 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6058 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
6059 | 6059 | |
6060 | 6060 | if (isset($_GET['keyword'])) { |
6061 | 6061 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6355,7 +6355,7 @@ discard block |
||
6355 | 6355 | public static function display_additional_profile_fields() |
6356 | 6356 | { |
6357 | 6357 | // getting all the extra profile fields that are defined by the platform administrator |
6358 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6358 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6359 | 6359 | |
6360 | 6360 | // creating the form |
6361 | 6361 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6367,8 +6367,8 @@ discard block |
||
6367 | 6367 | $extra_fields_to_show = 0; |
6368 | 6368 | foreach ($extra_fields as $key=>$field) { |
6369 | 6369 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6370 | - if ($field[6]==1 && $field[8] == 1) { |
|
6371 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6370 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6371 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6372 | 6372 | $selected = 'selected="selected"'; |
6373 | 6373 | } else { |
6374 | 6374 | $selected = ''; |
@@ -6380,8 +6380,8 @@ discard block |
||
6380 | 6380 | $return .= '</select>'; |
6381 | 6381 | |
6382 | 6382 | // the form elements for the $_GET parameters (because the form is passed through GET |
6383 | - foreach ($_GET as $key=>$value){ |
|
6384 | - if ($key <> 'additional_profile_field') { |
|
6383 | + foreach ($_GET as $key=>$value) { |
|
6384 | + if ($key <> 'additional_profile_field') { |
|
6385 | 6385 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6386 | 6386 | } |
6387 | 6387 | } |
@@ -6418,21 +6418,21 @@ discard block |
||
6418 | 6418 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6419 | 6419 | |
6420 | 6420 | if (!empty($users)) { |
6421 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6422 | - foreach($users as $user_id) { |
|
6421 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6422 | + foreach ($users as $user_id) { |
|
6423 | 6423 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6424 | 6424 | $tag_list = array(); |
6425 | - foreach($user_result as $item) { |
|
6425 | + foreach ($user_result as $item) { |
|
6426 | 6426 | $tag_list[] = $item['tag']; |
6427 | 6427 | } |
6428 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6428 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6429 | 6429 | } |
6430 | 6430 | } else { |
6431 | 6431 | $new_user_array = array(); |
6432 | 6432 | foreach ($users as $user_id) { |
6433 | - $new_user_array[]= "'".$user_id."'"; |
|
6433 | + $new_user_array[] = "'".$user_id."'"; |
|
6434 | 6434 | } |
6435 | - $users = implode(',',$new_user_array); |
|
6435 | + $users = implode(',', $new_user_array); |
|
6436 | 6436 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6437 | 6437 | // Selecting only the necessary information NOT ALL the user list |
6438 | 6438 | $sql = "SELECT user.user_id, v.value |
@@ -6447,7 +6447,7 @@ discard block |
||
6447 | 6447 | user.user_id IN ($users)"; |
6448 | 6448 | |
6449 | 6449 | $result = Database::query($sql); |
6450 | - while($row = Database::fetch_array($result)) { |
|
6450 | + while ($row = Database::fetch_array($result)) { |
|
6451 | 6451 | // get option value for field type double select by id |
6452 | 6452 | if (!empty($row['value'])) { |
6453 | 6453 | if ($result_extra_field['field_type'] == |
@@ -6486,7 +6486,7 @@ discard block |
||
6486 | 6486 | |
6487 | 6487 | public function sort_users_desc($a, $b) |
6488 | 6488 | { |
6489 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6489 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6490 | 6490 | } |
6491 | 6491 | |
6492 | 6492 | /** |
@@ -6521,7 +6521,7 @@ discard block |
||
6521 | 6521 | // get all users data from a course for sortable with limit |
6522 | 6522 | if (is_array($user_ids)) { |
6523 | 6523 | $user_ids = array_map('intval', $user_ids); |
6524 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6524 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6525 | 6525 | } else { |
6526 | 6526 | $user_ids = intval($user_ids); |
6527 | 6527 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6529,7 +6529,7 @@ discard block |
||
6529 | 6529 | |
6530 | 6530 | if (!empty($_GET['user_keyword'])) { |
6531 | 6531 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6532 | - $condition_user .= " AND ( |
|
6532 | + $condition_user .= " AND ( |
|
6533 | 6533 | user.firstname LIKE '%".$keyword."%' OR |
6534 | 6534 | user.lastname LIKE '%".$keyword."%' OR |
6535 | 6535 | user.username LIKE '%".$keyword."%' OR |
@@ -6547,7 +6547,7 @@ discard block |
||
6547 | 6547 | $invitedUsersCondition = ''; |
6548 | 6548 | |
6549 | 6549 | if (!$includeInvitedUsers) { |
6550 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6550 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6551 | 6551 | } |
6552 | 6552 | |
6553 | 6553 | $sql = "SELECT user.user_id as user_id, |
@@ -6558,7 +6558,7 @@ discard block |
||
6558 | 6558 | FROM $tbl_user as user $url_table |
6559 | 6559 | $condition_user $url_condition $invitedUsersCondition"; |
6560 | 6560 | |
6561 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6561 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6562 | 6562 | $direction = 'ASC'; |
6563 | 6563 | } |
6564 | 6564 | |
@@ -6694,7 +6694,7 @@ discard block |
||
6694 | 6694 | } |
6695 | 6695 | |
6696 | 6696 | if (empty($session_id)) { |
6697 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6697 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6698 | 6698 | } |
6699 | 6699 | |
6700 | 6700 | $user['link'] = '<center> |
@@ -6706,37 +6706,37 @@ discard block |
||
6706 | 6706 | // store columns in array $users |
6707 | 6707 | $is_western_name_order = api_is_western_name_order(); |
6708 | 6708 | $user_row = array(); |
6709 | - $user_row[]= $user['official_code']; //0 |
|
6709 | + $user_row[] = $user['official_code']; //0 |
|
6710 | 6710 | if ($is_western_name_order) { |
6711 | - $user_row[]= $user['firstname']; |
|
6712 | - $user_row[]= $user['lastname']; |
|
6711 | + $user_row[] = $user['firstname']; |
|
6712 | + $user_row[] = $user['lastname']; |
|
6713 | 6713 | } else { |
6714 | - $user_row[]= $user['lastname']; |
|
6715 | - $user_row[]= $user['firstname']; |
|
6714 | + $user_row[] = $user['lastname']; |
|
6715 | + $user_row[] = $user['firstname']; |
|
6716 | 6716 | } |
6717 | - $user_row[]= $user['username']; |
|
6718 | - $user_row[]= $user['time']; |
|
6719 | - $user_row[]= $user['average_progress']; |
|
6720 | - $user_row[]= $user['exercise_progress']; |
|
6721 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6722 | - $user_row[]= $user['student_score']; |
|
6723 | - $user_row[]= $user['count_assignments']; |
|
6724 | - $user_row[]= $user['count_messages']; |
|
6717 | + $user_row[] = $user['username']; |
|
6718 | + $user_row[] = $user['time']; |
|
6719 | + $user_row[] = $user['average_progress']; |
|
6720 | + $user_row[] = $user['exercise_progress']; |
|
6721 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6722 | + $user_row[] = $user['student_score']; |
|
6723 | + $user_row[] = $user['count_assignments']; |
|
6724 | + $user_row[] = $user['count_messages']; |
|
6725 | 6725 | |
6726 | 6726 | $userGroupManager = new UserGroup(); |
6727 | 6727 | $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); |
6728 | 6728 | |
6729 | 6729 | if (empty($session_id)) { |
6730 | - $user_row[]= $user['survey']; |
|
6730 | + $user_row[] = $user['survey']; |
|
6731 | 6731 | } |
6732 | 6732 | |
6733 | - $user_row[]= $user['first_connection']; |
|
6734 | - $user_row[]= $user['last_connection']; |
|
6733 | + $user_row[] = $user['first_connection']; |
|
6734 | + $user_row[] = $user['last_connection']; |
|
6735 | 6735 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6736 | - $user_row[]= $user['additional']; |
|
6736 | + $user_row[] = $user['additional']; |
|
6737 | 6737 | } |
6738 | 6738 | |
6739 | - $user_row[]= $user['link']; |
|
6739 | + $user_row[] = $user['link']; |
|
6740 | 6740 | |
6741 | 6741 | $users[] = $user_row; |
6742 | 6742 | |
@@ -6781,8 +6781,8 @@ discard block |
||
6781 | 6781 | |
6782 | 6782 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6783 | 6783 | $tempView = $view; |
6784 | - if(substr($view,0,1) == '1') { |
|
6785 | - $new_view = substr_replace($view,'0',0,1); |
|
6784 | + if (substr($view, 0, 1) == '1') { |
|
6785 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6786 | 6786 | echo " |
6787 | 6787 | <tr> |
6788 | 6788 | <td valign='top'> |
@@ -6815,9 +6815,9 @@ discard block |
||
6815 | 6815 | </tr>"; |
6816 | 6816 | $total = 0; |
6817 | 6817 | if (is_array($results)) { |
6818 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6818 | + for ($j = 0; $j < count($results); $j++) { |
|
6819 | 6819 | echo "<tr>"; |
6820 | - 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>"; |
|
6820 | + 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>"; |
|
6821 | 6821 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6822 | 6822 | echo"</tr>"; |
6823 | 6823 | $total = $total + $results[$j][1]; |
@@ -6834,7 +6834,7 @@ discard block |
||
6834 | 6834 | echo "</table>"; |
6835 | 6835 | echo "</td></tr>"; |
6836 | 6836 | } else { |
6837 | - $new_view = substr_replace($view,'1',0,1); |
|
6837 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6838 | 6838 | echo " |
6839 | 6839 | <tr> |
6840 | 6840 | <td valign='top'> |
@@ -6857,8 +6857,8 @@ discard block |
||
6857 | 6857 | { |
6858 | 6858 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6859 | 6859 | $courseId = api_get_course_int_id($courseCode); |
6860 | - if(substr($view,1,1) == '1') { |
|
6861 | - $new_view = substr_replace($view,'0',1,1); |
|
6860 | + if (substr($view, 1, 1) == '1') { |
|
6861 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6862 | 6862 | echo "<tr> |
6863 | 6863 | <td valign='top'> |
6864 | 6864 | <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>] |
@@ -6900,7 +6900,7 @@ discard block |
||
6900 | 6900 | </tr>"; |
6901 | 6901 | |
6902 | 6902 | if (is_array($results)) { |
6903 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6903 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6904 | 6904 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6905 | 6905 | echo "<tr>\n"; |
6906 | 6906 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6915,8 +6915,8 @@ discard block |
||
6915 | 6915 | |
6916 | 6916 | // The Result of Tests |
6917 | 6917 | if (is_array($hpresults)) { |
6918 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6919 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6918 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6919 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6920 | 6920 | if ($title == '') |
6921 | 6921 | $title = basename($hpresults[$i][0]); |
6922 | 6922 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6942,7 +6942,7 @@ discard block |
||
6942 | 6942 | echo "</table>"; |
6943 | 6943 | echo "</td>\n</tr>\n"; |
6944 | 6944 | } else { |
6945 | - $new_view = substr_replace($view,'1',1,1); |
|
6945 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6946 | 6946 | echo " |
6947 | 6947 | <tr> |
6948 | 6948 | <td valign='top'> |
@@ -6961,8 +6961,8 @@ discard block |
||
6961 | 6961 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6962 | 6962 | $_course = api_get_course_info_by_id($course_id); |
6963 | 6963 | |
6964 | - if (substr($view,2,1) == '1') { |
|
6965 | - $new_view = substr_replace($view,'0',2,1); |
|
6964 | + if (substr($view, 2, 1) == '1') { |
|
6965 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6966 | 6966 | echo "<tr> |
6967 | 6967 | <td valign='top'> |
6968 | 6968 | <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>] |
@@ -6976,7 +6976,7 @@ discard block |
||
6976 | 6976 | AND u.c_id = '".intval($course_id)."' |
6977 | 6977 | ORDER BY u.upload_date DESC"; |
6978 | 6978 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6979 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6979 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6980 | 6980 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6981 | 6981 | echo "<tr> |
6982 | 6982 | <td class='secLine' width='40%'> |
@@ -6990,7 +6990,7 @@ discard block |
||
6990 | 6990 | </td> |
6991 | 6991 | </tr>"; |
6992 | 6992 | if (is_array($results)) { |
6993 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6993 | + for ($j = 0; $j < count($results); $j++) { |
|
6994 | 6994 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6995 | 6995 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6996 | 6996 | echo "<tr>"; |
@@ -7009,7 +7009,7 @@ discard block |
||
7009 | 7009 | echo "</table>"; |
7010 | 7010 | echo "</td></tr>"; |
7011 | 7011 | } else { |
7012 | - $new_view = substr_replace($view,'1',2,1); |
|
7012 | + $new_view = substr_replace($view, '1', 2, 1); |
|
7013 | 7013 | echo " |
7014 | 7014 | <tr> |
7015 | 7015 | <td valign='top'> |
@@ -7028,8 +7028,8 @@ discard block |
||
7028 | 7028 | { |
7029 | 7029 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
7030 | 7030 | $courseId = api_get_course_int_id($courseCode); |
7031 | - if (substr($view,3,1) == '1') { |
|
7032 | - $new_view = substr_replace($view,'0',3,1); |
|
7031 | + if (substr($view, 3, 1) == '1') { |
|
7032 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7033 | 7033 | echo " |
7034 | 7034 | <tr> |
7035 | 7035 | <td valign='top'> |
@@ -7053,7 +7053,7 @@ discard block |
||
7053 | 7053 | </td> |
7054 | 7054 | </tr>"; |
7055 | 7055 | if (is_array($results)) { |
7056 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7056 | + for ($j = 0; $j < count($results); $j++) { |
|
7057 | 7057 | echo "<tr>"; |
7058 | 7058 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
7059 | 7059 | echo"</tr>"; |
@@ -7066,7 +7066,7 @@ discard block |
||
7066 | 7066 | echo "</table>"; |
7067 | 7067 | echo "</td></tr>"; |
7068 | 7068 | } else { |
7069 | - $new_view = substr_replace($view,'1',3,1); |
|
7069 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7070 | 7070 | echo " |
7071 | 7071 | <tr> |
7072 | 7072 | <td valign='top'> |
@@ -7093,8 +7093,8 @@ discard block |
||
7093 | 7093 | $session_id = intval($session_id); |
7094 | 7094 | |
7095 | 7095 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7096 | - if(substr($view,4,1) == '1') { |
|
7097 | - $new_view = substr_replace($view,'0',4,1); |
|
7096 | + if (substr($view, 4, 1) == '1') { |
|
7097 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7098 | 7098 | echo " |
7099 | 7099 | <tr> |
7100 | 7100 | <td valign='top'> |
@@ -7120,7 +7120,7 @@ discard block |
||
7120 | 7120 | </td> |
7121 | 7121 | </tr>"; |
7122 | 7122 | if (is_array($results)) { |
7123 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7123 | + for ($j = 0; $j < count($results); $j++) { |
|
7124 | 7124 | echo "<tr>"; |
7125 | 7125 | echo "<td class='content'>".$results[$j]."</td>"; |
7126 | 7126 | echo"</tr>"; |
@@ -7133,7 +7133,7 @@ discard block |
||
7133 | 7133 | echo "</table>"; |
7134 | 7134 | echo "</td></tr>"; |
7135 | 7135 | } else { |
7136 | - $new_view = substr_replace($view,'1',4,1); |
|
7136 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7137 | 7137 | echo " |
7138 | 7138 | <tr> |
7139 | 7139 | <td valign='top'> |
@@ -7167,11 +7167,11 @@ discard block |
||
7167 | 7167 | ORDER BY login_date DESC LIMIT 1"; |
7168 | 7168 | $ip = ''; |
7169 | 7169 | $res_ip = Database::query($sql_ip); |
7170 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
7170 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
7171 | 7171 | $row_ip = Database::fetch_row($res_ip); |
7172 | 7172 | if ($return_as_link) { |
7173 | 7173 | $ip = Display::url( |
7174 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7174 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7175 | 7175 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
7176 | 7176 | ); |
7177 | 7177 | } else { |
@@ -7207,9 +7207,9 @@ discard block |
||
7207 | 7207 | $course_id = intval($course_id); |
7208 | 7208 | |
7209 | 7209 | $tempView = $view; |
7210 | - if (substr($view,0,1) == '1') { |
|
7211 | - $new_view = substr_replace($view,'0',0,1); |
|
7212 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7210 | + if (substr($view, 0, 1) == '1') { |
|
7211 | + $new_view = substr_replace($view, '0', 0, 1); |
|
7212 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7213 | 7213 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
7214 | 7214 | FROM $track_access_table |
7215 | 7215 | WHERE access_user_id = $user_id |
@@ -7219,20 +7219,20 @@ discard block |
||
7219 | 7219 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7220 | 7220 | //$results = getManyResults2Col($sql); |
7221 | 7221 | $results = getManyResults3Col($sql); |
7222 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7223 | - $line=''; |
|
7222 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7223 | + $line = ''; |
|
7224 | 7224 | $total = 0; |
7225 | 7225 | if (is_array($results)) { |
7226 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7226 | + for ($j = 0; $j < count($results); $j++) { |
|
7227 | 7227 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
7228 | 7228 | $total = $total + $results[$j][1]; |
7229 | 7229 | } |
7230 | 7230 | $line .= get_lang('Total').";".$total."\n"; |
7231 | 7231 | } else { |
7232 | - $line= get_lang('NoResult')."</center></td>"; |
|
7232 | + $line = get_lang('NoResult')."</center></td>"; |
|
7233 | 7233 | } |
7234 | 7234 | } else { |
7235 | - $new_view = substr_replace($view,'1',0,1); |
|
7235 | + $new_view = substr_replace($view, '1', 0, 1); |
|
7236 | 7236 | } |
7237 | 7237 | return array($title_line, $line); |
7238 | 7238 | } |
@@ -7250,8 +7250,8 @@ discard block |
||
7250 | 7250 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
7251 | 7251 | $courseId = api_get_course_int_id($courseCode); |
7252 | 7252 | $userId = intval($userId); |
7253 | - if (substr($view,1,1) == '1') { |
|
7254 | - $new_view = substr_replace($view,'0',1,1); |
|
7253 | + if (substr($view, 1, 1) == '1') { |
|
7254 | + $new_view = substr_replace($view, '0', 1, 1); |
|
7255 | 7255 | $title[1] = get_lang('ExercicesDetails'); |
7256 | 7256 | $line = ''; |
7257 | 7257 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7275,7 +7275,7 @@ discard block |
||
7275 | 7275 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
7276 | 7276 | |
7277 | 7277 | if (is_array($results)) { |
7278 | - for($i = 0; $i < sizeof($results); $i++) |
|
7278 | + for ($i = 0; $i < sizeof($results); $i++) |
|
7279 | 7279 | { |
7280 | 7280 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
7281 | 7281 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7287,8 +7287,8 @@ discard block |
||
7287 | 7287 | |
7288 | 7288 | // The Result of Tests |
7289 | 7289 | if (is_array($hpresults)) { |
7290 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7291 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7290 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
7291 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
7292 | 7292 | |
7293 | 7293 | if ($title == '') |
7294 | 7294 | $title = basename($hpresults[$i][0]); |
@@ -7302,10 +7302,10 @@ discard block |
||
7302 | 7302 | } |
7303 | 7303 | |
7304 | 7304 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
7305 | - $line=get_lang('NoResult'); |
|
7305 | + $line = get_lang('NoResult'); |
|
7306 | 7306 | } |
7307 | 7307 | } else { |
7308 | - $new_view = substr_replace($view,'1',1,1); |
|
7308 | + $new_view = substr_replace($view, '1', 1, 1); |
|
7309 | 7309 | } |
7310 | 7310 | return array($title_line, $line); |
7311 | 7311 | } |
@@ -7321,7 +7321,7 @@ discard block |
||
7321 | 7321 | $user_id = intval($user_id); |
7322 | 7322 | $course_id = intval($course_id); |
7323 | 7323 | |
7324 | - if (substr($view,2,1) == '1') { |
|
7324 | + if (substr($view, 2, 1) == '1') { |
|
7325 | 7325 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7326 | 7326 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7327 | 7327 | WHERE |
@@ -7329,21 +7329,21 @@ discard block |
||
7329 | 7329 | u.upload_user_id = '$user_id' AND |
7330 | 7330 | u.c_id = '$course_id' |
7331 | 7331 | ORDER BY u.upload_date DESC"; |
7332 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7332 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7333 | 7333 | |
7334 | - $title[1]=get_lang('WorksDetails'); |
|
7335 | - $line=''; |
|
7336 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7334 | + $title[1] = get_lang('WorksDetails'); |
|
7335 | + $line = ''; |
|
7336 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7337 | 7337 | |
7338 | 7338 | if (is_array($results)) { |
7339 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7339 | + for ($j = 0; $j < count($results); $j++) { |
|
7340 | 7340 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7341 | 7341 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7342 | 7342 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7343 | 7343 | } |
7344 | 7344 | |
7345 | 7345 | } else { |
7346 | - $line= get_lang('NoResult'); |
|
7346 | + $line = get_lang('NoResult'); |
|
7347 | 7347 | } |
7348 | 7348 | } |
7349 | 7349 | return array($title_line, $line); |
@@ -7359,9 +7359,9 @@ discard block |
||
7359 | 7359 | $courseId = api_get_course_int_id($courseCode); |
7360 | 7360 | $userId = intval($userId); |
7361 | 7361 | $line = null; |
7362 | - if (substr($view,3,1) == '1') { |
|
7363 | - $new_view = substr_replace($view,'0',3,1); |
|
7364 | - $title[1]=get_lang('LinksDetails'); |
|
7362 | + if (substr($view, 3, 1) == '1') { |
|
7363 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7364 | + $title[1] = get_lang('LinksDetails'); |
|
7365 | 7365 | $sql = "SELECT cl.title, cl.url |
7366 | 7366 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7367 | 7367 | WHERE sl.links_link_id = cl.id |
@@ -7369,16 +7369,16 @@ discard block |
||
7369 | 7369 | AND sl.links_user_id = $userId |
7370 | 7370 | GROUP BY cl.title, cl.url"; |
7371 | 7371 | $results = StatsUtils::getManyResults2Col($sql); |
7372 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7372 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7373 | 7373 | if (is_array($results)) { |
7374 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7374 | + for ($j = 0; $j < count($results); $j++) { |
|
7375 | 7375 | $line .= $results[$j][0]."\n"; |
7376 | 7376 | } |
7377 | 7377 | } else { |
7378 | - $line=get_lang('NoResult'); |
|
7378 | + $line = get_lang('NoResult'); |
|
7379 | 7379 | } |
7380 | 7380 | } else { |
7381 | - $new_view = substr_replace($view,'1',3,1); |
|
7381 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7382 | 7382 | } |
7383 | 7383 | return array($title_line, $line); |
7384 | 7384 | } |
@@ -7400,9 +7400,9 @@ discard block |
||
7400 | 7400 | |
7401 | 7401 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7402 | 7402 | |
7403 | - if (substr($view,4,1) == '1') { |
|
7404 | - $new_view = substr_replace($view,'0',4,1); |
|
7405 | - $title[1]= get_lang('DocumentsDetails'); |
|
7403 | + if (substr($view, 4, 1) == '1') { |
|
7404 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7405 | + $title[1] = get_lang('DocumentsDetails'); |
|
7406 | 7406 | |
7407 | 7407 | $sql = "SELECT down_doc_path |
7408 | 7408 | FROM $downloads_table |
@@ -7415,14 +7415,14 @@ discard block |
||
7415 | 7415 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7416 | 7416 | $line = null; |
7417 | 7417 | if (is_array($results)) { |
7418 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7418 | + for ($j = 0; $j < count($results); $j++) { |
|
7419 | 7419 | $line .= $results[$j]."\n"; |
7420 | 7420 | } |
7421 | 7421 | } else { |
7422 | 7422 | $line = get_lang('NoResult'); |
7423 | 7423 | } |
7424 | 7424 | } else { |
7425 | - $new_view = substr_replace($view,'1',4,1); |
|
7425 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7426 | 7426 | } |
7427 | 7427 | return array($title_line, $line); |
7428 | 7428 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | Display::return_message($plugin->get_lang('OrderCancelled'), 'error', false) |
23 | 23 | ); |
24 | 24 | |
25 | - header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php'); |
|
25 | + header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php'); |
|
26 | 26 | exit; |
27 | 27 | } |
28 | 28 | |
@@ -30,6 +30,6 @@ discard block |
||
30 | 30 | Display::return_message($plugin->get_lang('ErrorOccurred'), 'error', false) |
31 | 31 | ); |
32 | 32 | |
33 | -header('Location: '. api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/service_catalog.php'); |
|
33 | +header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/service_catalog.php'); |
|
34 | 34 | |
35 | 35 | exit; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $toolbar .= Display::toolbarButton( |
62 | 62 | $plugin->get_lang('PaypalPayoutCommissions'), |
63 | - api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/paypal_payout.php', |
|
63 | + api_get_path(WEB_PLUGIN_PATH).'buycourses/src/paypal_payout.php', |
|
64 | 64 | 'paypal', |
65 | 65 | 'primary', |
66 | 66 | ['title' => $plugin->get_lang('PaypalPayoutCommissions')] |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $toolbar .= Display::toolbarButton( |
76 | 76 | $plugin->get_lang('PayoutReport'), |
77 | - api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/payout_report.php', |
|
77 | + api_get_path(WEB_PLUGIN_PATH).'buycourses/src/payout_report.php', |
|
78 | 78 | 'money', |
79 | 79 | 'info', |
80 | 80 | ['title' => $plugin->get_lang('PayoutReport')] |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | self::getHostName($_configuration); |
30 | 30 | |
31 | 31 | // We are on physical chamilo. Let original config play |
32 | - $virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/') . '/'; |
|
32 | + $virtualChamiloWebRoot = rtrim($_configuration['vchamilo_web_root'], '/').'/'; |
|
33 | 33 | |
34 | 34 | $virtualChamilo = []; |
35 | 35 | if ($_configuration['root_web'] == $virtualChamiloWebRoot) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | if (preg_match('#https?://#', $url)) { |
225 | 225 | header('location: '.$url); |
226 | 226 | } else { |
227 | - header('location: ' . api_get_path(WEB_PATH).$url); |
|
227 | + header('location: '.api_get_path(WEB_PATH).$url); |
|
228 | 228 | } |
229 | 229 | exit; |
230 | 230 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | // Making the command line (see 'vconfig.php' file for defining the right paths). |
410 | - $sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' ' ); |
|
410 | + $sqlcmd = $pgm.' -h'.$vchamilodata->db_host.(isset($vchamilodata->db_port) ? ' -P'.$vchamilodata->db_port.' ' : ' '); |
|
411 | 411 | $sqlcmd .= '-u'.$vchamilodata->db_user.' '.$databasePassword; |
412 | 412 | $sqlcmd .= '%DATABASE% < '; |
413 | 413 | |
@@ -487,10 +487,10 @@ discard block |
||
487 | 487 | //if ($CFG->ostype == 'WINDOWS') { |
488 | 488 | if (false) { |
489 | 489 | $cmd_main = "-h{$host} -P{$port} -u{$vchamilo->db_user} {$pass} {$vchamilo->main_database}"; |
490 | - $cmds[] = $cmd_main . ' > ' . $outputfilerad; |
|
490 | + $cmds[] = $cmd_main.' > '.$outputfilerad; |
|
491 | 491 | } else { |
492 | 492 | $cmd_main = "-h{$host} -P{$port} -u{$vchamilo->db_user} {$pass} {$vchamilo->main_database}"; |
493 | - $cmds[] = $cmd_main . ' > ' . escapeshellarg($outputfilerad); |
|
493 | + $cmds[] = $cmd_main.' > '.escapeshellarg($outputfilerad); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | $mysqldumpcmd = self::getConfig('vchamilo', 'cmd_mysqldump', true); |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | Display::return_message('You cannot use the same database as the chamilo master', 'error') |
938 | 938 | ); |
939 | 939 | |
940 | - return ; |
|
940 | + return; |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | $databaseName = $data->main_database; |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | 'error' |
952 | 952 | ) |
953 | 953 | ); |
954 | - return ; |
|
954 | + return; |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | $data->root_web = api_add_trailing_slash($data->root_web); |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | Display::addFlash( |
976 | 976 | Display::return_message('Cannot create slug from url: '.$data->root_web, 'error') |
977 | 977 | ); |
978 | - return ; |
|
978 | + return; |
|
979 | 979 | } |
980 | 980 | Database::insert($tablename, (array) $data); |
981 | 981 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | $newDatabase->sitename = $siteName; |
1118 | 1118 | $newDatabase->institution = $institution; |
1119 | 1119 | $slug = $newDatabase->slug = $data->slug = Virtual::getSlugFromUrl($data->root_web); |
1120 | - $id = Database::insert($table, (array)$newDatabase); |
|
1120 | + $id = Database::insert($table, (array) $newDatabase); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | $id = (int) $id; |
1295 | 1295 | $sql = "SELECT * FROM vchamilo WHERE id = $id"; |
1296 | 1296 | $result = Database::query($sql); |
1297 | - $vhost = (object) Database::fetch_array($result, 'ASSOC'); |
|
1297 | + $vhost = (object) Database::fetch_array($result, 'ASSOC'); |
|
1298 | 1298 | } |
1299 | 1299 | |
1300 | 1300 | return $vhost; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | $template = new Template(false); |
32 | -$template->assign('pageUrl', api_get_path(WEB_PATH) . "service/{$serviceId}/information/"); |
|
32 | +$template->assign('pageUrl', api_get_path(WEB_PATH)."service/{$serviceId}/information/"); |
|
33 | 33 | $template->assign('service', $service); |
34 | 34 | $template->assign('essence', Essence\Essence::instance()); |
35 | 35 |