Completed
Push — 1.11.x ( 60645e...aacf46 )
by José
76:05 queued 37:57
created
main/inc/lib/fileUpload.lib.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -993,7 +993,9 @@
 block discarded – undo
993 993
                     if ($file != '.' && $file != '..') {
994 994
 
995 995
                         $filetype = 'file';
996
-                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
996
+                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) {
997
+                            $filetype = 'folder';
998
+                        }
997 999
 
998 1000
                         $safe_file = api_replace_dangerous_char($file, 'strict');
999 1001
                         @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
Please login to merge, or discard this patch.
Doc Comments   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
  * Returns the name without extension, used for the title
74 74
  *
75 75
  * @param string $name
76
- * @return name without the extension
76
+ * @return string without the extension
77 77
  */
78 78
 function get_document_title($name) {
79 79
     // If they upload .htaccess...
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  * This function checks if the upload succeeded
87 87
  *
88 88
  * @param array $uploaded_file ($_FILES)
89
- * @return true if upload succeeded
89
+ * @return boolean if upload succeeded
90 90
  */
91 91
 function process_uploaded_file($uploaded_file, $show_output = true)
92 92
 {
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
  * @param array  $courseInfo
1020 1020
  * @param array  $userInfo
1021 1021
  * @param array  $uploaded_file - follows the $_FILES Structure
1022
- * @param string $upload_path   - destination of the upload.
1022
+ * @param string $uploadPath   - destination of the upload.
1023 1023
  *                               This path is to append to $base_work_dir
1024 1024
  * @param string $base_work_dir  - base working directory of the module
1025 1025
  * @param int    $maxFilledSpace  - amount of bytes to not exceed in the base
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
  * @param int $session_id Session ID, if any
1201 1201
  * @param int $userId creator id
1202 1202
  * 
1203
- * @return int id if inserted document
1203
+ * @return string|false id if inserted document
1204 1204
  */
1205 1205
 function add_document(
1206 1206
     $_course,
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
  *
1335 1335
  * @author	Olivier Cauberghe <[email protected]>
1336 1336
  * @param	path+filename eg: /main/document/document.php
1337
- * @return	The directory depth
1337
+ * @return	integer directory depth
1338 1338
  */
1339 1339
 function get_levels($filename) {
1340 1340
     $levels = explode('/', $filename);
@@ -1351,6 +1351,8 @@  discard block
 block discarded – undo
1351 1351
  * @author	Olivier Cauberghe <[email protected]>
1352 1352
  * @param	path,filename
1353 1353
  * action:	Adds an entry to the document table with the default settings.
1354
+ * @param string $upload_path
1355
+ * @param string $filename
1354 1356
  */
1355 1357
 function set_default_settings($upload_path, $filename, $filetype = 'file')
1356 1358
 {
@@ -1777,6 +1779,7 @@  discard block
 block discarded – undo
1777 1779
 
1778 1780
 @author Roan Embrechts
1779 1781
 @version 0.6
1782
+ * @param string $buffer
1780 1783
  */
1781 1784
 function api_replace_links_in_string($upload_path, $buffer) {
1782 1785
     // Search for hyperlinks
@@ -2012,7 +2015,6 @@  discard block
 block discarded – undo
2012 2015
  * @param int $groupId
2013 2016
  * @param bool $output
2014 2017
  * @param array $parent
2015
- * @param string $uploadPath
2016 2018
  *
2017 2019
  */
2018 2020
 function add_all_documents_in_folder_to_database(
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 // (e.g. image upload in html editor).
90 90
                 $max_file_size = intval($_POST['MAX_FILE_SIZE']);
91 91
                 if ($show_output) {
92
-                    Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size));
92
+                    Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size));
93 93
                 }
94 94
 
95 95
                 return false;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             case 4:
104 104
                 // No file was uploaded.
105 105
                 if ($show_output) {
106
-                    Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'));
106
+                    Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst'));
107 107
                 }
108 108
 
109 109
                 return false;
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                             if ($output) {
446 446
                                 Display::addFlash(
447 447
                                     Display::return_message(
448
-                                        get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'),
448
+                                        get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'),
449 449
                                         'confirmation',
450 450
                                         false
451 451
                                     )
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
                             if (isset($_POST['moodle_import'])) {
585 585
                                 Display::addFlash(
586 586
                                     Display::display_confirmation_message(
587
-                                        get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle,
587
+                                        get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle,
588 588
                                         false,
589 589
                                         true
590 590
                                     )
591 591
                                 );
592 592
                             } else {
593 593
                                 Display::display_confirmation_message(
594
-                                    get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle,
594
+                                    get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle,
595 595
                                     false
596 596
                                 );
597 597
                             }
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                                 if (isset($_POST['moodle_import'])) {
669 669
                                     Display::addFlash(
670 670
                                         Display::display_confirmation_message(
671
-                                            get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle,
671
+                                            get_lang('UplUploadSucceeded').'<br /> '.$documentTitle,
672 672
                                             false,
673 673
                                             true
674 674
                                         )
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
 function dir_total_space($dir_path)
764 764
 {
765 765
     $save_dir = getcwd();
766
-    chdir($dir_path) ;
766
+    chdir($dir_path);
767 767
     $handle = opendir($dir_path);
768 768
     $sumSize = 0;
769 769
     $dirList = array();
770 770
     while ($element = readdir($handle)) {
771
-        if ( $element == '.' || $element == '..') {
771
+        if ($element == '.' || $element == '..') {
772 772
             continue; // Skip the current and parent directories
773 773
         }
774 774
         if (is_file($element)) {
@@ -779,11 +779,11 @@  discard block
 block discarded – undo
779 779
         }
780 780
     }
781 781
 
782
-    closedir($handle) ;
782
+    closedir($handle);
783 783
 
784 784
     if (sizeof($dirList) > 0) {
785 785
         foreach ($dirList as $j) {
786
-            $sizeDir = dir_total_space($j);	// Recursivity
786
+            $sizeDir = dir_total_space($j); // Recursivity
787 787
             $sumSize += $sizeDir;
788 788
         }
789 789
     }
@@ -817,63 +817,63 @@  discard block
 block discarded – undo
817 817
 
818 818
         static $mime_type = array();
819 819
 
820
-        $mime_type[] = 'application/msword';             $extension[] = '.doc';
821
-        $mime_type[] = 'application/rtf';                $extension[] = '.rtf';
822
-        $mime_type[] = 'application/vnd.ms-powerpoint';  $extension[] = '.ppt';
823
-        $mime_type[] = 'application/vnd.ms-excel';       $extension[] = '.xls';
824
-        $mime_type[] = 'application/pdf';                $extension[] = '.pdf';
825
-        $mime_type[] = 'application/postscript';         $extension[] = '.ps';
826
-        $mime_type[] = 'application/mac-binhex40';       $extension[] = '.hqx';
827
-        $mime_type[] = 'application/x-gzip';             $extension[] = 'tar.gz';
828
-        $mime_type[] = 'application/x-shockwave-flash';  $extension[] = '.swf';
829
-        $mime_type[] = 'application/x-stuffit';          $extension[] = '.sit';
830
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
831
-        $mime_type[] = 'application/zip';                $extension[] = '.zip';
832
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
833
-        $mime_type[] = 'text/html';                      $extension[] = '.html';
834
-        $mime_type[] = 'text/plain';                     $extension[] = '.txt';
835
-        $mime_type[] = 'text/rtf';                       $extension[] = '.rtf';
836
-        $mime_type[] = 'img/gif';                        $extension[] = '.gif';
837
-        $mime_type[] = 'img/jpeg';                       $extension[] = '.jpg';
838
-        $mime_type[] = 'img/png';                        $extension[] = '.png';
839
-        $mime_type[] = 'audio/midi';                     $extension[] = '.mid';
840
-        $mime_type[] = 'audio/mpeg';                     $extension[] = '.mp3';
841
-        $mime_type[] = 'audio/x-aiff';                   $extension[] = '.aif';
842
-        $mime_type[] = 'audio/x-pn-realaudio';           $extension[] = '.rm';
843
-        $mime_type[] = 'audio/x-pn-realaudio-plugin';    $extension[] = '.rpm';
844
-        $mime_type[] = 'audio/x-wav';                    $extension[] = '.wav';
845
-        $mime_type[] = 'video/mpeg';                     $extension[] = '.mpg';
846
-        $mime_type[] = 'video/mpeg4-generic';            $extension[] = '.mp4';
847
-        $mime_type[] = 'video/quicktime';                $extension[] = '.mov';
848
-        $mime_type[] = 'video/x-msvideo';                $extension[] = '.avi';
849
-
850
-        $mime_type[] = 'video/x-ms-wmv';                 $extension[] = '.wmv';
851
-        $mime_type[] = 'video/x-flv';                    $extension[] = '.flv';
852
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svg';
853
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svgz';
854
-        $mime_type[] = 'video/ogg';                  	 $extension[] = '.ogv';
855
-        $mime_type[] = 'audio/ogg';                  	 $extension[] = '.oga';
856
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogg';
857
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogx';
858
-        $mime_type[] = 'application/x-freemind';         $extension[] = '.mm';
859
-
860
-        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12';							$extension[] = '.docm';
861
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';	$extension[] = '.docx';
862
-        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12';							$extension[] = '.dotm';
863
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template';	$extension[] = '.dotx';
864
-        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12';					$extension[] = '.potm';
865
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template';		$extension[] = '.potx';
866
-        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';						$extension[] = '.ppam';
867
-        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';					$extension[] = '.ppsm';
868
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';	$extension[] = '.ppsx';
869
-        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';				$extension[] = '.pptm';
870
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';	$extension[] = '.pptx';
871
-        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12';							$extension[] = '.xlam';
872
-        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';						$extension[] = '.xlsb';
873
-        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12';							$extension[] = '.xlsm';
874
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';			$extension[] = '.xlsx';
875
-        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12';							$extension[] = '.xltm';
876
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template';		$extension[] = '.xltx';
820
+        $mime_type[] = 'application/msword'; $extension[] = '.doc';
821
+        $mime_type[] = 'application/rtf'; $extension[] = '.rtf';
822
+        $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt';
823
+        $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls';
824
+        $mime_type[] = 'application/pdf'; $extension[] = '.pdf';
825
+        $mime_type[] = 'application/postscript'; $extension[] = '.ps';
826
+        $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx';
827
+        $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz';
828
+        $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf';
829
+        $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit';
830
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
831
+        $mime_type[] = 'application/zip'; $extension[] = '.zip';
832
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
833
+        $mime_type[] = 'text/html'; $extension[] = '.html';
834
+        $mime_type[] = 'text/plain'; $extension[] = '.txt';
835
+        $mime_type[] = 'text/rtf'; $extension[] = '.rtf';
836
+        $mime_type[] = 'img/gif'; $extension[] = '.gif';
837
+        $mime_type[] = 'img/jpeg'; $extension[] = '.jpg';
838
+        $mime_type[] = 'img/png'; $extension[] = '.png';
839
+        $mime_type[] = 'audio/midi'; $extension[] = '.mid';
840
+        $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3';
841
+        $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif';
842
+        $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm';
843
+        $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm';
844
+        $mime_type[] = 'audio/x-wav'; $extension[] = '.wav';
845
+        $mime_type[] = 'video/mpeg'; $extension[] = '.mpg';
846
+        $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4';
847
+        $mime_type[] = 'video/quicktime'; $extension[] = '.mov';
848
+        $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi';
849
+
850
+        $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv';
851
+        $mime_type[] = 'video/x-flv'; $extension[] = '.flv';
852
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svg';
853
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz';
854
+        $mime_type[] = 'video/ogg'; $extension[] = '.ogv';
855
+        $mime_type[] = 'audio/ogg'; $extension[] = '.oga';
856
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogg';
857
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogx';
858
+        $mime_type[] = 'application/x-freemind'; $extension[] = '.mm';
859
+
860
+        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm';
861
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx';
862
+        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm';
863
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx';
864
+        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm';
865
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx';
866
+        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam';
867
+        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm';
868
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx';
869
+        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm';
870
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx';
871
+        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam';
872
+        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb';
873
+        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm';
874
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx';
875
+        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm';
876
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx';
877 877
 
878 878
         // Test on PC (files with no extension get application/octet-stream)
879 879
         //$mime_type[] = 'application/octet-stream';      $extension[] = '.ext';
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 
883 883
         foreach ($mime_type as $key => & $type) {
884 884
             if ($type == $file_type) {
885
-                $file_name .=  $extension[$key];
885
+                $file_name .= $extension[$key];
886 886
                 break;
887 887
             }
888 888
         }
@@ -958,12 +958,12 @@  discard block
 block discarded – undo
958 958
         }
959 959
 
960 960
         // It happens on Linux that $upload_path sometimes doesn't start with '/'
961
-        if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') {
961
+        if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') {
962 962
             $upload_path = '/'.$upload_path;
963 963
         }
964 964
 
965 965
         if ($upload_path[strlen($upload_path) - 1] == '/') {
966
-            $upload_path=substr($upload_path, 0, -1);
966
+            $upload_path = substr($upload_path, 0, -1);
967 967
         }
968 968
 
969 969
         /*	Uncompressing phase */
@@ -975,15 +975,15 @@  discard block
 block discarded – undo
975 975
             - add it to the database
976 976
             - parse & change relative html links
977 977
         */
978
-        if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
978
+        if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
979 979
             // Shell Method - if this is possible, it gains some speed
980
-            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']);
980
+            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']);
981 981
         } else {
982 982
             // PHP method - slower...
983 983
             $save_dir = getcwd();
984 984
             chdir($base_work_dir.$upload_path);
985 985
             $unzippingState = $zip_file->extract();
986
-            for ($j=0; $j < count($unzippingState); $j++) {
986
+            for ($j = 0; $j < count($unzippingState); $j++) {
987 987
                 $state = $unzippingState[$j];
988 988
 
989 989
                 // Fix relative links in html files
@@ -997,8 +997,8 @@  discard block
 block discarded – undo
997 997
                         if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
998 998
 
999 999
                         $safe_file = api_replace_dangerous_char($file);
1000
-                        @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
1001
-                        set_default_settings($upload_path, $safe_file,$filetype);
1000
+                        @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file);
1001
+                        set_default_settings($upload_path, $safe_file, $filetype);
1002 1002
                     }
1003 1003
                 }
1004 1004
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
     $zip = new PclZip($uploaded_file['tmp_name']);
1049 1049
 
1050 1050
     // Check the zip content (real size and file extension)
1051
-    $zip_content_array = (array)$zip->listContent();
1051
+    $zip_content_array = (array) $zip->listContent();
1052 1052
 
1053 1053
     $realSize = 0;
1054 1054
     foreach ($zip_content_array as & $this_content) {
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 function filter_extension(&$filename)
1151 1151
 {
1152 1152
     if (substr($filename, -1) == '/') {
1153
-        return 1;  // Authorize directories
1153
+        return 1; // Authorize directories
1154 1154
     }
1155 1155
     $blacklist = api_get_setting('upload_extensions_list_type');
1156 1156
     if ($blacklist != 'whitelist') { // if = blacklist
@@ -1375,9 +1375,9 @@  discard block
 block discarded – undo
1375 1375
     $upload_path = str_replace('//', '/', $upload_path);
1376 1376
 
1377 1377
     if ($upload_path == '/') {
1378
-        $upload_path='';
1378
+        $upload_path = '';
1379 1379
     } elseif (!empty($upload_path) && $upload_path[0] != '/') {
1380
-        $upload_path="/$upload_path";
1380
+        $upload_path = "/$upload_path";
1381 1381
     }
1382 1382
 
1383 1383
     $endchar = substr($filename, strlen($filename) - 1, 1);
@@ -1415,7 +1415,7 @@  discard block
 block discarded – undo
1415 1415
     $img_path_list = array();
1416 1416
 
1417 1417
     if (!$fp = fopen($html_file, 'r')) {
1418
-        return ;
1418
+        return;
1419 1419
     }
1420 1420
 
1421 1421
     // Aearch and store occurences of the <img> tag in an array
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
         $img_tag_list = $matches[0];
1436 1436
     }
1437 1437
 
1438
-    fclose ($fp);
1438
+    fclose($fp);
1439 1439
     unset($buffer);
1440 1440
 
1441 1441
     // Search the image file path from all the <IMG> tag detected
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 
1535 1535
     if (!is_dir($base_work_dir.$systemFolderName)) {
1536 1536
         $result = mkdir(
1537
-            $base_work_dir . $systemFolderName,
1537
+            $base_work_dir.$systemFolderName,
1538 1538
             api_get_permissions_for_new_directories(),
1539 1539
             true
1540 1540
         );
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
                     WHERE
1548 1548
                         c_id = $course_id AND
1549 1549
                         (
1550
-                            path = '" . Database::escape_string($systemFolderName). "'
1550
+                            path = '".Database::escape_string($systemFolderName)."'
1551 1551
                         )
1552 1552
             ";
1553 1553
 
@@ -1698,7 +1698,7 @@  discard block
 block discarded – undo
1698 1698
 
1699 1699
     // Fix the image tags
1700 1700
 
1701
-    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) {
1701
+    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) {
1702 1702
         $replace_what = $original_img_path[$i];
1703 1703
         // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif
1704 1704
         $exploded_file_path = explode('/', $new_img_path[$i]);
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
         .'</body>'
1740 1740
         .'</html>';
1741 1741
     if (file_exists($file_path)) {
1742
-        if (!($fp = fopen ($file_path, 'w'))) {
1742
+        if (!($fp = fopen($file_path, 'w'))) {
1743 1743
             return false;
1744 1744
         }
1745 1745
         return fwrite($fp, $file_content);
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
     // Open the file
1760 1760
     if (file_exists($full_file_name)) {
1761 1761
         $fp = fopen($full_file_name, 'r');
1762
-        $buffer = fread ($fp, filesize ($full_file_name));
1762
+        $buffer = fread($fp, filesize($full_file_name));
1763 1763
 
1764 1764
         // Parse the contents
1765 1765
         $new_html_content = api_replace_links_in_string($upload_path, $buffer);
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
         foreach ($tag_list as & $this_tag) {
1904 1904
             //Display::display_normal_message(htmlentities($this_tag)); //debug
1905
-            if ( preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) {
1905
+            if (preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) {
1906 1906
                 $file_path_list[] = $matches[1]; // older
1907 1907
                 $href_list[] = $matches[0]; // to also add target="_self"
1908 1908
             }
@@ -1923,9 +1923,9 @@  discard block
 block discarded – undo
1923 1923
 
1924 1924
                 // Fix the link to use download.php or showinframes.php
1925 1925
                 if (preg_match("/<a([\s]*[\"\/:'=a-z0-9]*){5}href[^<]*>/i", $tag_list[$count])) {
1926
-                    $replace_by[$count] = " $param_name =\"showinframes.php?file=" . $upload_path.$file_path_list[$count]."\" target=\"_self\" ";
1926
+                    $replace_by[$count] = " $param_name =\"showinframes.php?file=".$upload_path.$file_path_list[$count]."\" target=\"_self\" ";
1927 1927
                 } else {
1928
-                    $replace_by[$count] = " $param_name =\"download.php?doc_url=" . $upload_path.$file_path_list[$count]."\" ";
1928
+                    $replace_by[$count] = " $param_name =\"download.php?doc_url=".$upload_path.$file_path_list[$count]."\" ";
1929 1929
                 }
1930 1930
             } else {
1931 1931
                 // "mailto" or url already fixed, leave as is
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
             }
1935 1935
         } elseif ($is_absolute_hyperlink) {
1936 1936
             //$message .= "Absolute hyperlink, don't change, add target=_self: ";
1937
-            $replace_by[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_self\"";
1937
+            $replace_by[$count] = " $param_name=\"".$file_path_list[$count]."\" target =\"_self\"";
1938 1938
         } else {
1939 1939
             // Don't change anything
1940 1940
             //$message .= "Local anchor, don't change: ";
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
 {
1980 1980
     // Do we need a / or not?
1981 1981
     $added_slash = ($upload_path == '/') ? '' : '/';
1982
-    $folder_id      = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
1982
+    $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
1983 1983
     // Build the form
1984 1984
     $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>"
1985 1985
         ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">"
Please login to merge, or discard this patch.
main/inc/lib/agenda.lib.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3122,8 +3122,9 @@
 block discarded – undo
3122 3122
         global $DaysShort, $course_path;
3123 3123
         //Handle leap year
3124 3124
         $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3125
-        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3126
-            $numberofdays[2] = 29;
3125
+        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
3126
+                    $numberofdays[2] = 29;
3127
+        }
3127 3128
         //Get the first day of the month
3128 3129
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3129 3130
         //Start the week on monday
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1499,12 +1499,12 @@  discard block
 block discarded – undo
1499 1499
             }
1500 1500
 
1501 1501
             if (empty($session_id)) {
1502
-                $sessionCondition =  "
1502
+                $sessionCondition = "
1503 1503
                 (
1504 1504
                     agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0)
1505 1505
                 ) ";
1506 1506
             } else {
1507
-                $sessionCondition =  "
1507
+                $sessionCondition = "
1508 1508
                 (
1509 1509
                     agenda.session_id = $session_id AND
1510 1510
                     ip.session_id = $session_id
@@ -1543,13 +1543,13 @@  discard block
 block discarded – undo
1543 1543
             }
1544 1544
 
1545 1545
             if (empty($session_id)) {
1546
-                $sessionCondition =  "
1546
+                $sessionCondition = "
1547 1547
                 (
1548 1548
                     agenda.session_id = 0 AND
1549 1549
                     (ip.session_id IS NULL OR ip.session_id = 0)
1550 1550
                 ) ";
1551 1551
             } else {
1552
-                $sessionCondition =  "
1552
+                $sessionCondition = "
1553 1553
                 (
1554 1554
                     agenda.session_id = $session_id AND
1555 1555
                     ip.session_id = $session_id
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
             while ($row = Database::fetch_array($result, 'ASSOC')) {
1602 1602
                 $event = array();
1603 1603
                 $event['id'] = 'course_'.$row['id'];
1604
-                $event['unique_id']  = $row['iid'];
1604
+                $event['unique_id'] = $row['iid'];
1605 1605
                 // To avoid doubles
1606 1606
                 if (in_array($event['unique_id'], $eventsAdded)) {
1607 1607
                     continue;
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
             );
2152 2152
 
2153 2153
             $form->addLabel('',
2154
-                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2154
+                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2155 2155
 
2156 2156
 
2157 2157
             //if ($showAttachmentForm) {
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
                 $startDateTime = api_get_local_time($start->format('Y-m-d H:i:s'), $currentTimeZone, $start->format('e'));
2731 2731
                 $endDateTime = api_get_local_time($end->format('Y-m-d H:i'), $currentTimeZone, $end->format('e'));
2732
-                $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8');
2733
-                $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8');
2732
+                $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8');
2733
+                $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8');
2734 2734
 
2735 2735
                 $id = $this->addEvent(
2736 2736
                     $startDateTime,
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
 							ORDER BY start_date ";
2873 2873
             } else {
2874 2874
                 // if the user is not an administrator of that course
2875
-                if (is_array($group_memberships) && count($group_memberships)>0) {
2875
+                if (is_array($group_memberships) && count($group_memberships) > 0) {
2876 2876
                     $sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
2877 2877
 								FROM ".$TABLEAGENDA." agenda,
2878 2878
 									".$TABLE_ITEMPROPERTY." ip
@@ -2902,14 +2902,14 @@  discard block
 block discarded – undo
2902 2902
                 $agendaday = -1;
2903 2903
                 if ($item['start_date'] != '0000-00-00 00:00:00') {
2904 2904
                     $item['start_date'] = api_get_local_time($item['start_date']);
2905
-                    $item['start_date_tms']  = api_strtotime($item['start_date']);
2905
+                    $item['start_date_tms'] = api_strtotime($item['start_date']);
2906 2906
                     $agendaday = date("j", $item['start_date_tms']);
2907 2907
                 }
2908 2908
                 if ($item['end_date'] != '0000-00-00 00:00:00') {
2909 2909
                     $item['end_date'] = api_get_local_time($item['end_date']);
2910 2910
                 }
2911 2911
 
2912
-                $url  = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2912
+                $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2913 2913
 
2914 2914
                 $item['url'] = $url;
2915 2915
                 $item['course_name'] = $array_course_info['title'];
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
         }
2922 2922
 
2923 2923
         // sorting by hour for every day
2924
-        $agendaitems = array ();
2924
+        $agendaitems = array();
2925 2925
         while (list ($agendaday, $tmpitems) = each($items)) {
2926
-            if(!isset($agendaitems[$agendaday])) {
2926
+            if (!isset($agendaitems[$agendaday])) {
2927 2927
                 $agendaitems[$agendaday] = '';
2928 2928
             }
2929 2929
             sort($tmpitems);
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
             $end_year = $start_end_day_of_week['end']['year'];
3098 3098
             // in sql statements you have to use year-month-day for date calculations
3099 3099
             $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00";
3100
-            $start_filter  = api_get_utc_datetime($start_filter);
3100
+            $start_filter = api_get_utc_datetime($start_filter);
3101 3101
             $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59";
3102
-            $end_filter  = api_get_utc_datetime($end_filter);
3102
+            $end_filter = api_get_utc_datetime($end_filter);
3103 3103
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3104 3104
         }
3105 3105
         // 3. creating the SQL statement for getting the personal agenda items in DAY view
@@ -3107,18 +3107,18 @@  discard block
 block discarded – undo
3107 3107
             // we are in day view
3108 3108
             // we could use mysql date() function but this is only available from 4.1 and higher
3109 3109
             $start_filter = $year."-".$month."-".$day." 00:00:00";
3110
-            $start_filter  = api_get_utc_datetime($start_filter);
3110
+            $start_filter = api_get_utc_datetime($start_filter);
3111 3111
             $end_filter = $year."-".$month."-".$day." 23:59:59";
3112
-            $end_filter  = api_get_utc_datetime($end_filter);
3112
+            $end_filter = api_get_utc_datetime($end_filter);
3113 3113
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3114 3114
         }
3115 3115
 
3116 3116
         $result = Database::query($sql);
3117 3117
         while ($item = Database::fetch_array($result, 'ASSOC')) {
3118 3118
 
3119
-            $time_minute 	= api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
-            $item['date']   = api_get_local_time($item['date']);
3121
-            $item['start_date_tms']  = api_strtotime($item['date']);
3119
+            $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
+            $item['date'] = api_get_local_time($item['date']);
3121
+            $item['start_date_tms'] = api_strtotime($item['date']);
3122 3122
             $item['content'] = $item['text'];
3123 3123
 
3124 3124
             // we break the date field in the database into a date and a time part
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
             $second = $agendatime[2];
3139 3139
 
3140 3140
             if ($type == 'month_view') {
3141
-                $item['calendar_type']  = 'personal';
3141
+                $item['calendar_type'] = 'personal';
3142 3142
                 $item['start_date']  	= $item['date'];
3143 3143
                 $agendaitems[$day][] 	= $item;
3144 3144
                 continue;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
                 // this is the array construction for the DAY view
3164 3164
                 $halfhour = 2 * $agendatime['0'];
3165 3165
                 if ($agendatime['1'] >= '30') {
3166
-                    $halfhour = $halfhour +1;
3166
+                    $halfhour = $halfhour + 1;
3167 3167
                 }
3168 3168
 
3169 3169
                 //Display events by list
@@ -3187,22 +3187,22 @@  discard block
 block discarded – undo
3187 3187
     {
3188 3188
         global $DaysShort, $course_path;
3189 3189
         //Handle leap year
3190
-        $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3190
+        $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3191 3191
         if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3192 3192
             $numberofdays[2] = 29;
3193 3193
         //Get the first day of the month
3194 3194
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3195 3195
         //Start the week on monday
3196 3196
         $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
3197
-        $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:'');
3197
+        $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : '');
3198 3198
 
3199
-        $next_month = ($month == 1 ? 12 : $month -1);
3200
-        $prev_month = ($month == 12 ? 1 : $month +1);
3199
+        $next_month = ($month == 1 ? 12 : $month - 1);
3200
+        $prev_month = ($month == 12 ? 1 : $month + 1);
3201 3201
 
3202
-        $next_year = ($month == 1 ? $year -1 : $year);
3203
-        $prev_year = ($month == 12 ? $year +1 : $year);
3202
+        $next_year = ($month == 1 ? $year - 1 : $year);
3203
+        $prev_year = ($month == 12 ? $year + 1 : $year);
3204 3204
 
3205
-        if ($show_content)  {
3205
+        if ($show_content) {
3206 3206
             $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year);
3207 3207
             $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year);
3208 3208
         } else {
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
         $html .= '</div>';
3220 3220
         $html .= '<table id="agenda_list2" class="table table-bordered">';
3221 3221
         $html .= '<tr>';
3222
-        for ($ii = 1; $ii < 8; $ii ++) {
3222
+        for ($ii = 1; $ii < 8; $ii++) {
3223 3223
             $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>';
3224 3224
         }
3225 3225
         $html .= '</tr>';
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
         $today = getdate();
3229 3229
         while ($curday <= $numberofdays[$month]) {
3230 3230
             $html .= "<tr>";
3231
-            for ($ii = 0; $ii < 7; $ii ++) {
3231
+            for ($ii = 0; $ii < 7; $ii++) {
3232 3232
                 if (($curday == -1) && ($ii == $startdayofweek)) {
3233 3233
                     $curday = 1;
3234 3234
                 }
@@ -3242,21 +3242,21 @@  discard block
 block discarded – undo
3242 3242
                     $html .= "<td ".$class.">".$dayheader;
3243 3243
 
3244 3244
                     if (!empty($agendaitems[$curday])) {
3245
-                        $items =  $agendaitems[$curday];
3246
-                        $items =  msort($items, 'start_date_tms');
3245
+                        $items = $agendaitems[$curday];
3246
+                        $items = msort($items, 'start_date_tms');
3247 3247
 
3248
-                        foreach($items  as $value) {
3248
+                        foreach ($items  as $value) {
3249 3249
                             $value['title'] = Security::remove_XSS($value['title']);
3250 3250
                             $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
3251 3251
                             $end_time = '';
3252 3252
 
3253 3253
                             if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
3254
-                                $end_time    = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3254
+                                $end_time = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3255 3255
                             }
3256 3256
                             $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i>&nbsp;'.$end_time;
3257 3257
                             $time = '<i>'.$start_time.'</i>';
3258 3258
 
3259
-                            switch($value['calendar_type']) {
3259
+                            switch ($value['calendar_type']) {
3260 3260
                                 case 'personal':
3261 3261
                                     $bg_color = '#D0E7F4';
3262 3262
                                     $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL);
@@ -3308,7 +3308,7 @@  discard block
 block discarded – undo
3308 3308
                         }
3309 3309
                     }
3310 3310
                     $html .= "</td>";
3311
-                    $curday ++;
3311
+                    $curday++;
3312 3312
                 } else {
3313 3313
                     $html .= "<td></td>";
3314 3314
                 }
@@ -3329,18 +3329,18 @@  discard block
 block discarded – undo
3329 3329
      * where datestart and dateend are in yyyyMMddhhmmss format.
3330 3330
      * @TODO Implement really personal events (from user DB) and global events (from main DB)
3331 3331
      */
3332
-    public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='')
3332
+    public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '')
3333 3333
     {
3334
-        $items = array ();
3334
+        $items = array();
3335 3335
         if ($user_id != strval(intval($user_id))) { return $items; }
3336
-        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');}
3337
-        if (empty($date_end))   { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1));}
3336
+        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); }
3337
+        if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); }
3338 3338
         $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/';
3339
-        if(!preg_match($expr,$date_start)) { return $items; }
3340
-        if(!preg_match($expr,$date_end)) { return $items; }
3339
+        if (!preg_match($expr, $date_start)) { return $items; }
3340
+        if (!preg_match($expr, $date_end)) { return $items; }
3341 3341
 
3342 3342
         // get agenda-items for every course
3343
-        $courses = api_get_user_courses($user_id,false);
3343
+        $courses = api_get_user_courses($user_id, false);
3344 3344
         foreach ($courses as $id => $course) {
3345 3345
             $c = api_get_course_info_by_id($course['real_id']);
3346 3346
             //databases of the courses
@@ -3364,9 +3364,9 @@  discard block
 block discarded – undo
3364 3364
                     " ORDER BY start_date ";
3365 3365
             } else {
3366 3366
                 // if the user is not an administrator of that course, then...
3367
-                if (is_array($group_memberships) && count($group_memberships)>0)
3367
+                if (is_array($group_memberships) && count($group_memberships) > 0)
3368 3368
                 {
3369
-                    $sqlquery = "SELECT " .
3369
+                    $sqlquery = "SELECT ".
3370 3370
                         "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ".
3371 3371
                         " FROM ".$t_a." agenda, ".
3372 3372
                         $t_ip." ip ".
@@ -3394,13 +3394,13 @@  discard block
 block discarded – undo
3394 3394
 
3395 3395
             $result = Database::query($sqlquery);
3396 3396
             while ($item = Database::fetch_array($result)) {
3397
-                $agendaday = date("j",strtotime($item['start_date']));
3398
-                $month = date("n",strtotime($item['start_date']));
3399
-                $year = date("Y",strtotime($item['start_date']));
3397
+                $agendaday = date("j", strtotime($item['start_date']));
3398
+                $month = date("n", strtotime($item['start_date']));
3399
+                $year = date("Y", strtotime($item['start_date']));
3400 3400
                 $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
3401
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']);
3401
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']);
3402 3402
                 $start_date = $year.$month.$day.$hour.$min;
3403
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']);
3403
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']);
3404 3404
                 $end_date = $year.$month.$day.$hour.$min;
3405 3405
 
3406 3406
                 $items[] = array(
@@ -3429,7 +3429,7 @@  discard block
 block discarded – undo
3429 3429
         $user = api_get_user_id();
3430 3430
         $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user;
3431 3431
         $result = Database::query($sql);
3432
-        if(Database::num_rows($result)==1) {
3432
+        if (Database::num_rows($result) == 1) {
3433 3433
             $item = Database::fetch_array($result);
3434 3434
         } else {
3435 3435
             $item = null;
@@ -3451,9 +3451,9 @@  discard block
 block discarded – undo
3451 3451
         // step 2: we which day this is (0=sunday, 1=monday, ...)
3452 3452
         $number_day_in_week = date('w', $random_day_in_week);
3453 3453
         // step 3: we calculate the timestamp of the monday of the week we are in
3454
-        $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60);
3454
+        $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60);
3455 3455
         // step 4: we calculate the timestamp of the sunday of the week we are in
3456
-        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600;
3456
+        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600;
3457 3457
         // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year
3458 3458
         $start_day = date('j', $start_timestamp);
3459 3459
         $start_month = date('n', $start_timestamp);
Please login to merge, or discard this patch.
main/inc/lib/zombie/zombie_manager.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $count = intval($count);
80 80
         $from = intval($from);
81 81
 
82
-        $sql .=  " ORDER BY $column $direction";
82
+        $sql .= " ORDER BY $column $direction";
83 83
         $sql .= " LIMIT $count, $from ";
84 84
 
85 85
         $result = Database::query($sql);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     static function deactivate_zombies($ceiling)
94 94
     {
95 95
         $zombies = self::list_zombies($ceiling);
96
-        $ids  = array();
97
-        foreach($zombies as $zombie) {
96
+        $ids = array();
97
+        foreach ($zombies as $zombie) {
98 98
             $ids[] = $zombie['user_id'];
99 99
         }
100 100
         UserManager::deactivate_users($ids);
Please login to merge, or discard this patch.
main/inc/lib/userportal.lib.php 4 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
                 }
249 249
             }
250 250
 
251
-			if (trim($home_top_temp) == '' && api_is_platform_admin()) {
252
-				$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
253
-			} else {
254
-				$home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
255
-			}
256
-			$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
257
-			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
258
-		}
259
-
260
-		return $html;
261
-	}
251
+            if (trim($home_top_temp) == '' && api_is_platform_admin()) {
252
+                $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
253
+            } else {
254
+                $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
255
+            }
256
+            $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
257
+            $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
258
+        }
259
+
260
+        return $html;
261
+    }
262 262
 
263 263
     function return_notice()
264 264
     {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                     $thereIsSubCat = true;
510 510
                 } elseif (api_get_setting('show_empty_course_categories') == 'true') {
511 511
                     /* End changed code to eliminate the (0 courses) after empty categories. */
512
-                      $htmlListCat .= '<li>';
512
+                        $htmlListCat .= '<li>';
513 513
                     $htmlListCat .= $catLine['name'];
514 514
                     $htmlListCat .= "</li>";
515 515
                     $thereIsSubCat = true;
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
     }
640 640
 
641 641
     /**
642
-    * retrieves all the courses that the user has already subscribed to
643
-    * @author Patrick Cool <[email protected]>, Ghent University, Belgium
644
-    * @param int $user_id: the id of the user
645
-    * @return array an array containing all the information of the courses of the given user
646
-    */
642
+     * retrieves all the courses that the user has already subscribed to
643
+     * @author Patrick Cool <[email protected]>, Ghent University, Belgium
644
+     * @param int $user_id: the id of the user
645
+     * @return array an array containing all the information of the courses of the given user
646
+     */
647 647
     public function get_courses_of_user($user_id)
648 648
     {
649 649
         $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@
 block discarded – undo
338 338
 
339 339
         if (empty($certificatesItem) && empty($searchItem)) {
340 340
             return null;
341
-        }else{
341
+        } else{
342 342
             $content.= $certificatesItem;
343 343
             $content.= $searchItem;
344 344
         }
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -682,6 +682,7 @@  discard block
 block discarded – undo
682 682
     * retrieves all the courses that the user has already subscribed to
683 683
     * @author Patrick Cool <[email protected]>, Ghent University, Belgium
684 684
     * @param int $user_id: the id of the user
685
+    * @param integer $user_id
685 686
     * @return array an array containing all the information of the courses of the given user
686 687
     */
687 688
     public function get_courses_of_user($user_id)
@@ -732,8 +733,8 @@  discard block
 block discarded – undo
732 733
 
733 734
     /**
734 735
      * @todo use the template system
735
-     * @param $title
736
-     * @param $content
736
+     * @param string|null $title
737
+     * @param string $content
737 738
      * @param string $id
738 739
      * @param array $params
739 740
      * @param string $idAccordion
@@ -1704,8 +1705,8 @@  discard block
 block discarded – undo
1704 1705
 
1705 1706
     /**
1706 1707
      * Return HTML code for personal user course category
1707
-     * @param $id
1708
-     * @param $title
1708
+     * @param integer $id
1709
+     * @param string $title
1709 1710
      * @return string
1710 1711
      */
1711 1712
     private static function getHtmlForUserCategory($id, $title)
@@ -1726,7 +1727,7 @@  discard block
 block discarded – undo
1726 1727
     /**
1727 1728
      * return HTML code for course display in session view
1728 1729
      * @param array $courseInfo
1729
-     * @param $userCategoryId
1730
+     * @param integer $userCategoryId
1730 1731
      * @param bool $displayButton
1731 1732
      * @param $loadDirs
1732 1733
      * @return string
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
                 );
73 73
 
74 74
                 foreach ($exercises as $exercise_item) {
75
-                    $exercise_item['course_code']     = $course_code;
76
-                    $exercise_item['session_id']     = $session_id;
77
-                    $exercise_item['tms']     = api_strtotime($exercise_item['end_time'], 'UTC');
75
+                    $exercise_item['course_code'] = $course_code;
76
+                    $exercise_item['session_id'] = $session_id;
77
+                    $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
78 78
 
79 79
                     $exercise_list[] = $exercise_item;
80 80
                 }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                 }
197 197
             }
198 198
 
199
-            if ($show_menu && ($show_create_link || $show_course_link )) {
199
+            if ($show_menu && ($show_create_link || $show_course_link)) {
200 200
                 $show_menu = true;
201 201
             } else {
202 202
                 $show_menu = false;
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
         if ($show_menu) {
209 209
             $html .= '<ul class="nav nav-pills nav-stacked">';
210 210
             if ($show_create_link) {
211
-                $html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.Display::return_icon('new-course.png',  get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
211
+                $html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'.Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
212 212
             }
213 213
 
214 214
             if ($show_course_link) {
215 215
                 if (!api_is_drh() && !api_is_session_admin()) {
216
-                    $html .=  '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'. Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>';
216
+                    $html .= '<li class="list-course"><a href="'.api_get_path(WEB_CODE_PATH).'auth/courses.php">'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog')).get_lang('CourseCatalog').'</a></li>';
217 217
                 } else {
218
-                    $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
218
+                    $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
219 219
                 }
220 220
             }
221 221
             $html .= '</ul>';
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $html = '';
240 240
 
241 241
         if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) {
242
-            $open = @(string)file_get_contents($this->home.$_GET['include']);
242
+            $open = @(string) file_get_contents($this->home.$_GET['include']);
243 243
             $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
244 244
         } else {
245 245
             // Hiding home top when user not connected.
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
                     $home_top_temp = file_get_contents($this->home.'home_top.html');
270 270
                 } else {
271 271
                     if (file_exists($this->default_home.'home_top.html')) {
272
-                        $home_top_temp = file_get_contents($this->default_home . 'home_top.html');
272
+                        $home_top_temp = file_get_contents($this->default_home.'home_top.html');
273 273
                     }
274 274
                 }
275 275
             }
276 276
 
277 277
 			if (trim($home_top_temp) == '' && api_is_platform_admin()) {
278
-				$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
278
+				$home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>';
279 279
 			} else {
280
-				$home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
280
+				$home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>';
281 281
 			}
282 282
 			$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
283 283
 			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 
293 293
         $html = '';
294 294
         // Notice
295
-        $home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
295
+        $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
296 296
         if (empty($home_notice)) {
297
-            $home_notice = @(string)file_get_contents($this->home.'home_notice.html');
297
+            $home_notice = @(string) file_get_contents($this->home.'home_notice.html');
298 298
         }
299 299
 
300 300
         if (!empty($home_notice)) {
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         }
326 326
 
327 327
         $html = null;
328
-        $home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
328
+        $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
329 329
         if (!empty($home_menu)) {
330 330
             $home_menu_content = '<ul class="nav nav-pills nav-stacked">';
331 331
             $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
         if (!api_is_anonymous()) {
359 359
             $certificatesItem = Display::tag(
360 360
                 'li',
361
-                Display::url(Display::return_icon('graduation.png',get_lang('MyCertificates'),null,ICON_SIZE_SMALL).
361
+                Display::url(Display::return_icon('graduation.png', get_lang('MyCertificates'), null, ICON_SIZE_SMALL).
362 362
                     get_lang('MyCertificates'),
363
-                    api_get_path(WEB_CODE_PATH) . "gradebook/my_certificates.php"
363
+                    api_get_path(WEB_CODE_PATH)."gradebook/my_certificates.php"
364 364
                 )
365 365
             );
366 366
         }
@@ -370,29 +370,29 @@  discard block
 block discarded – undo
370 370
         if (api_get_setting('allow_public_certificates') == 'true') {
371 371
             $searchItem = Display::tag(
372 372
                 'li',
373
-                Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL).
373
+                Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL).
374 374
                     get_lang('Search'),
375
-                    api_get_path(WEB_CODE_PATH) . "gradebook/search.php"
375
+                    api_get_path(WEB_CODE_PATH)."gradebook/search.php"
376 376
                 )
377 377
             );
378 378
         }
379 379
 
380 380
         if (empty($certificatesItem) && empty($searchItem)) {
381 381
             return null;
382
-        }else{
383
-            $content.= $certificatesItem;
384
-            $content.= $searchItem;
382
+        } else {
383
+            $content .= $certificatesItem;
384
+            $content .= $searchItem;
385 385
         }
386 386
 
387 387
         if (api_get_setting('allow_skills_tool') == 'true') {
388 388
 
389
-            $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png',get_lang('MySkills'),null,ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'));
389
+            $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png', get_lang('MySkills'), null, ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'));
390 390
             $allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true';
391 391
             if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) {
392 392
                 $content .= Display::tag('li',
393 393
                     Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null,
394
-                            ICON_SIZE_SMALL) . get_lang('ManageSkills'),
395
-                        api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php'));
394
+                            ICON_SIZE_SMALL).get_lang('ManageSkills'),
395
+                        api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'));
396 396
             }
397 397
         }
398 398
         $content .= '</ul>';
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 
445 445
         // Get list of courses in category $category.
446 446
         $sql_get_course_list = "SELECT * FROM $main_course_table cours
447
-                                    WHERE category_code = '" . $category . "'
447
+                                    WHERE category_code = '".$category."'
448 448
                                     ORDER BY title, UPPER(visual_code)";
449 449
 
450 450
         // Showing only the courses of the current access_url_id.
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     FROM $main_category_table t1
492 492
                     LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id
493 493
                     LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)
494
-                    WHERE t1.parent_id ". (empty ($category) ? "IS NULL" : "='$category'")."
494
+                    WHERE t1.parent_id ".(empty ($category) ? "IS NULL" : "='$category'")."
495 495
                     GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count 
496 496
                     ORDER BY t1.tree_pos, t1.name";
497 497
 
@@ -567,10 +567,10 @@  discard block
 block discarded – undo
567 567
         }
568 568
         $result .= $htmlTitre;
569 569
         if ($thereIsSubCat) {
570
-            $result .=  $htmlListCat;
570
+            $result .= $htmlListCat;
571 571
         }
572 572
         while ($categoryName = Database::fetch_array($resCats)) {
573
-            $result .= '<h3>' . $categoryName['name'] . "</h3>\n";
573
+            $result .= '<h3>'.$categoryName['name']."</h3>\n";
574 574
         }
575 575
         $numrows = Database::num_rows($sql_result_courses);
576 576
         $courses_list_string = '';
@@ -668,12 +668,12 @@  discard block
 block discarded – undo
668 668
         if ($courses_shown > 0) {
669 669
             // Only display the list of courses and categories if there was more than
670 670
                     // 0 courses visible to the world (we're in the anonymous list here).
671
-            $result .=  $courses_list_string;
671
+            $result .= $courses_list_string;
672 672
         }
673 673
         if ($category != '') {
674
-            $result .=  '<p><a href="'.api_get_self().'"> ' .
674
+            $result .= '<p><a href="'.api_get_self().'"> '.
675 675
                 Display :: return_icon('back.png', get_lang('BackToHomePage')).
676
-                get_lang('BackToHomePage') . '</a></p>';
676
+                get_lang('BackToHomePage').'</a></p>';
677 677
         }
678 678
         return $result;
679 679
     }
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
     ) {
751 751
         if (!empty($idAccordion)) {
752 752
             $html = null;
753
-            $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL;
754
-            $html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL;
755
-            $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL;
756
-            $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>' . PHP_EOL;
757
-            $html .= '</h4></div>' . PHP_EOL;
758
-            $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL;
759
-            $html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
760
-            $html .= '</div></div></div>' . PHP_EOL;
753
+            $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">'.PHP_EOL;
754
+            $html .= '<div class="panel panel-default" id="'.$id.'">'.PHP_EOL;
755
+            $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">'.PHP_EOL;
756
+            $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>'.PHP_EOL;
757
+            $html .= '</h4></div>'.PHP_EOL;
758
+            $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">'.PHP_EOL;
759
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
760
+            $html .= '</div></div></div>'.PHP_EOL;
761 761
 
762 762
         } else {
763 763
             if (!empty($id)) {
@@ -766,9 +766,9 @@  discard block
 block discarded – undo
766 766
             $params['class'] = 'panel panel-default';
767 767
             $html = null;
768 768
             if (!empty($title)) {
769
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
769
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
770 770
             }
771
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
771
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
772 772
             $html = Display::div($html, $params);
773 773
         }
774 774
         return $html;
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
             $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
815 815
             $classes = '';
816 816
             if (!empty($usergroup_list)) {
817
-                foreach($usergroup_list as $group_id) {
817
+                foreach ($usergroup_list as $group_id) {
818 818
                     $data = $usergroup->get($group_id);
819 819
                     $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']);
820 820
                     $classes .= Display::tag('li', $data['name']);
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
             if (api_is_platform_admin()) {
824 824
                 $classes .= Display::tag(
825 825
                     'li',
826
-                    Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
826
+                    Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
827 827
                 );
828 828
             }
829 829
             if (!empty($classes)) {
@@ -845,11 +845,11 @@  discard block
 block discarded – undo
845 845
             $content = null;
846 846
 
847 847
             if (api_get_setting('allow_social_tool') == 'true') {
848
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php">
849
-                <img class="img-circle" src="' . $userPicture . '" ></a>';
848
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php">
849
+                <img class="img-circle" src="' . $userPicture.'" ></a>';
850 850
             } else {
851
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">
852
-                <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>';
851
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php">
852
+                <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>';
853 853
             }
854 854
 
855 855
             $html = self::show_right_block(
@@ -901,12 +901,12 @@  discard block
 block discarded – undo
901 901
             if (api_get_setting('allow_social_tool') == 'true') {
902 902
                 $link = '?f=social';
903 903
             }
904
-            $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
905
-            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
904
+            $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
905
+            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
906 906
 
907 907
             if (api_get_setting('allow_social_tool') == 'true') {
908 908
                 $total_invitations = Display::badge($total_invitations);
909
-                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
909
+                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
910 910
             }
911 911
 
912 912
             if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
         $editProfileUrl = Display::getProfileEditionLink($user_id);
924 924
 
925
-        $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.
925
+        $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'.
926 926
             Display::return_icon(
927 927
                 'edit-profile.png',
928 928
                 get_lang('EditProfile'),
@@ -1025,17 +1025,17 @@  discard block
 block discarded – undo
1025 1025
         if ($show_create_link) {
1026 1026
             $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">';
1027 1027
             if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) {
1028
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL);
1028
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL);
1029 1029
                 $my_account_content .= get_lang('CreateCourseRequest');
1030 1030
             } else {
1031
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL);
1031
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL);
1032 1032
                 $my_account_content .= get_lang('CourseCreate');
1033 1033
             }
1034 1034
             $my_account_content .= '</a></li>';
1035 1035
 
1036 1036
             if (SessionManager::allowToManageSessions()) {
1037 1037
                 $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">';
1038
-                $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL);
1038
+                $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL);
1039 1039
                 $my_account_content .= get_lang('AddSession');
1040 1040
                 $my_account_content .= '</a></li>';
1041 1041
             }
@@ -1043,21 +1043,21 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
         //Sort courses
1045 1045
         $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
1046
-        $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL);
1046
+        $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL);
1047 1047
         $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>';
1048 1048
 
1049 1049
         // Session history
1050 1050
         if (isset($_GET['history']) && intval($_GET['history']) == 1) {
1051
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1051
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1052 1052
         } else {
1053
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1053
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1054 1054
         }
1055 1055
 
1056 1056
         // Course catalog
1057 1057
 
1058 1058
         if ($show_course_link) {
1059 1059
             if (!api_is_drh()) {
1060
-                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1060
+                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1061 1061
             } else {
1062 1062
                 $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
1063 1063
             }
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 
1274 1274
                             $actions = null;
1275 1275
                             if (api_is_platform_admin()) {
1276
-                                $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id;
1276
+                                $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id;
1277 1277
                             }
1278 1278
 
1279 1279
                             $coachId = $session_box['id_coach'];
@@ -1284,12 +1284,12 @@  discard block
 block discarded – undo
1284 1284
                             $params['title'] = $session_box['title'];
1285 1285
                             //$params['subtitle'] = $extra_info;
1286 1286
                             $params['id_coach'] = $coachId;
1287
-                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId;
1287
+                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId;
1288 1288
                             $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
1289
-                            $params['coach_avatar'] =UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL);
1290
-                            $params['date'] =  $session_box['dates'];
1289
+                            $params['coach_avatar'] = UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL);
1290
+                            $params['date'] = $session_box['dates'];
1291 1291
                             $params['image'] = isset($imageField['value']) ? $imageField['value'] : null;
1292
-                            $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null;
1292
+                            $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
1293 1293
                             $params['edit_actions'] = $actions;
1294 1294
                             $params['show_description'] = $session_box['show_description'];
1295 1295
                             $params['description'] = $session_box['description'];
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
                                 //$sessionParams['show_link_to_session'] = !api_is_drh() && $sessionTitleLink;
1398 1398
                                 $sessionParams['course_list_session_style'] = $coursesListSessionStyle;
1399 1399
                                 $sessionParams['title'] = $session_box['title'];
1400
-                                $sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
1400
+                                $sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates'];
1401 1401
                                 $sessionParams['show_actions'] = api_is_platform_admin();
1402 1402
                                 $sessionParams['courses'] = $html_courses_session;
1403 1403
                                 $sessionParams['show_simple_session_info'] = false;
@@ -1447,14 +1447,14 @@  discard block
 block discarded – undo
1447 1447
                                 !empty($session_category_start_date) &&
1448 1448
                                 $session_category_start_date != '0000-00-00'
1449 1449
                             ) {
1450
-                                $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date;
1450
+                                $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date;
1451 1451
                             }
1452 1452
 
1453 1453
                             if (
1454 1454
                                 !empty($session_category_end_date) &&
1455 1455
                                 $session_category_end_date != '0000-00-00'
1456 1456
                             ) {
1457
-                                $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date;
1457
+                                $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date;
1458 1458
                             }
1459 1459
                         }
1460 1460
 
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
             $this->tpl->assign('all_courses', $allCoursesInSessions);
1481 1481
             $this->tpl->assign('session', $listSession);
1482
-            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
1482
+            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
1483 1483
             $this->tpl->assign('gamification_mode', $gamificationModeIsActive);
1484 1484
 
1485
-            if (api_get_configuration_value('view_grid_courses')){
1485
+            if (api_get_configuration_value('view_grid_courses')) {
1486 1486
                 $sessions_with_no_category = $this->tpl->fetch(
1487 1487
                     $this->tpl->get_template('/user_portal/grid_session.tpl')
1488 1488
                 );
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
         }
1495 1495
 
1496 1496
         return [
1497
-            'html' => $specialCourseList . $sessions_with_category.$sessions_with_no_category.$listCourse,
1497
+            'html' => $specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse,
1498 1498
             'session_count' => $sessionCount,
1499 1499
             'course_count' => $courseCount
1500 1500
         ];
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
                         $htmlCategory .= '<div class="panel panel-default">';
1642 1642
                     }
1643 1643
                     $htmlCategory .= '<div class="panel-body">';
1644
-                    $coursesInfo =  $listCourse['course'];
1644
+                    $coursesInfo = $listCourse['course'];
1645 1645
 
1646 1646
                     $htmlCategory .= self::getHtmlForCourse(
1647 1647
                         $coursesInfo,
@@ -1658,7 +1658,7 @@  discard block
 block discarded – undo
1658 1658
                             $listCategorySession['catSessionName']
1659 1659
                         );
1660 1660
                         // list of session
1661
-                        $htmlSession = '';    // start
1661
+                        $htmlSession = ''; // start
1662 1662
                         foreach ($listCategorySession['sessionList'] as $k => $listSession) {
1663 1663
                             // add session
1664 1664
                             $htmlSession .= '<div class="session-view-row">';
@@ -1675,8 +1675,8 @@  discard block
 block discarded – undo
1675 1675
                         $htmlSessionCategory .= $htmlSession;
1676 1676
                     }
1677 1677
                     $htmlSessionCategory .= '</div>'; // end session cat block
1678
-                    $htmlCategory .=  $htmlSessionCategory .'</div></div>' ;
1679
-                    $htmlCategory .= '';   // end course block
1678
+                    $htmlCategory .= $htmlSessionCategory.'</div></div>';
1679
+                    $htmlCategory .= ''; // end course block
1680 1680
                 }
1681 1681
                 $userCategoryHtml .= $htmlCategory;
1682 1682
             }
@@ -1703,11 +1703,11 @@  discard block
 block discarded – undo
1703 1703
                 }
1704 1704
             }
1705 1705
             $htmlCategory .= '';
1706
-            $userCategoryHtml .= $htmlCategory;   // end user cat block
1706
+            $userCategoryHtml .= $htmlCategory; // end user cat block
1707 1707
             if ($userCategoryId != 0) {
1708 1708
                 $userCategoryHtml .= '</div>';
1709 1709
             }
1710
-            $html .= $userCategoryHtml;   //
1710
+            $html .= $userCategoryHtml; //
1711 1711
         }
1712 1712
         $html .= '</div>';
1713 1713
 
@@ -1848,11 +1848,11 @@  discard block
 block discarded – undo
1848 1848
         $html = '';
1849 1849
 
1850 1850
         if ($categorySessionId == 0) {
1851
-            $class1 = 'session-view-lvl-2';    // session
1852
-            $class2 = 'session-view-lvl-4';    // got to course in session link
1851
+            $class1 = 'session-view-lvl-2'; // session
1852
+            $class2 = 'session-view-lvl-4'; // got to course in session link
1853 1853
         } else {
1854
-            $class1 = 'session-view-lvl-3';    // session
1855
-            $class2 = 'session-view-lvl-5';    // got to course in session link
1854
+            $class1 = 'session-view-lvl-3'; // session
1855
+            $class2 = 'session-view-lvl-5'; // got to course in session link
1856 1856
         }
1857 1857
 
1858 1858
         $icon = Display::return_icon(
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
         if ($listA['userCatTitle'] == $listB['userCatTitle']) {
1881 1881
             if ($listA['title'] == $listB['title']) {
1882 1882
                 return 0;
1883
-            } else if($listA['title'] > $listB['title']) {
1883
+            } else if ($listA['title'] > $listB['title']) {
1884 1884
                 return 1;
1885 1885
             } else {
1886 1886
                 return -1;
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
     {
1902 1902
         if ($listA['title'] == $listB['title']) {
1903 1903
             return 0;
1904
-        } else if($listA['title'] > $listB['title']) {
1904
+        } else if ($listA['title'] > $listB['title']) {
1905 1905
             return 1;
1906 1906
         } else {
1907 1907
             return -1;
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,8 +73,9 @@
 block discarded – undo
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
74 74
 $form->addButtonFilter(get_lang('Filter'));
75 75
 
76
-if (!empty($_REQUEST['course_code']))
76
+if (!empty($_REQUEST['course_code'])) {
77 77
     $selected_course = $_REQUEST['course_code'];
78
+}
78 79
 if (!empty($selected_course)) {
79 80
     $selected_course = api_get_course_info($selected_course);
80 81
     $course_list = array($selected_course);
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
17 17
 
18 18
 if (!$is_allowedToTrack) {
19
-	Display :: display_header(null);
20
-	api_not_allowed();
21
-	Display :: display_footer();
19
+    Display :: display_header(null);
20
+    api_not_allowed();
21
+    Display :: display_footer();
22 22
 }
23 23
 
24 24
 $export_to_csv = false;
25 25
 if (isset($_GET['export'])) {
26
-	$export_to_csv = true;
26
+    $export_to_csv = true;
27 27
 }
28 28
 
29 29
 if (api_is_platform_admin() ) {
30
-	$global = true;
30
+    $global = true;
31 31
 } else {
32
-	$global = false;
32
+    $global = false;
33 33
 }
34 34
 
35 35
 if ($global) {
36
-	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
38
-		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
36
+    $temp_course_list = CourseManager :: get_courses_list();
37
+    foreach($temp_course_list  as $temp_course_item) {
38
+        $course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
41 41
             'title' => $course_item['title'],
42 42
         );
43
-	}
43
+    }
44 44
 } else {
45 45
     $current_course['code'] = $_course['id'];
46
-	$course_list = array($current_course);
46
+    $course_list = array($current_course);
47 47
 }
48 48
 
49 49
 $new_course_select = array();
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55 55
 $form->addElement('select','course_code',get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+    $form->addElement('hidden','view','admin');
58 58
 } else {
59
-	//Get exam lists
59
+    //Get exam lists
60 60
     $course_id = api_get_course_int_id();
61
-	$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
-	$sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
61
+    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
+    $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
63 63
 	                 WHERE c_id = $course_id AND active='1'
64 64
 	                 ORDER BY quiz.title ASC";
65
-	$resultExercices = Database::query($sqlExercices);
66
-	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
68
-		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
-	}
70
-	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
65
+    $resultExercices = Database::query($sqlExercices);
66
+    $exercise_list[0] = get_lang('All');
67
+    while($a_exercices = Database::fetch_array($resultExercices)) {
68
+        $exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
+    }
70
+    $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
71 71
 }
72 72
 
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 if (!$export_to_csv) {
84
-	Display :: display_header(get_lang('Reporting'));
85
-	echo '<div class="actions" style ="font-size:10pt;">';
86
-	if ($global) {
84
+    Display :: display_header(get_lang('Reporting'));
85
+    echo '<div class="actions" style ="font-size:10pt;">';
86
+    if ($global) {
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
@@ -93,81 +93,81 @@  discard block
 block discarded – undo
93 93
                 &nbsp;'.get_lang('Print').'</a>
94 94
                 	</div>';
95 95
 
96
-		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
96
+        $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
97 97
         if (api_is_platform_admin()) {
98
-		  $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
98
+            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
99 99
         } else {
100 100
             $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';
101 101
         }
102
-		$menu_items[] = get_lang('ExamTracking');
103
-		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
106
-				echo $item;
107
-				if($key!=$nb_menu_items-1) {
108
-					echo ' | ';
109
-				}
110
-			}
111
-			echo '<br />';
112
-		}
113
-	} else {
114
-	    echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
102
+        $menu_items[] = get_lang('ExamTracking');
103
+        $nb_menu_items = count($menu_items);
104
+        if($nb_menu_items>1) {
105
+            foreach($menu_items as $key=> $item) {
106
+                echo $item;
107
+                if($key!=$nb_menu_items-1) {
108
+                    echo ' | ';
109
+                }
110
+            }
111
+            echo '<br />';
112
+        }
113
+    } else {
114
+        echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
115 115
 		     <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>&nbsp;|&nbsp';
116 116
         echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
117
-		echo ' | '.get_lang('ExamTracking').'';
117
+        echo ' | '.get_lang('ExamTracking').'';
118 118
         echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
119 119
             '.Display::return_icon('excel.gif').'
120 120
             &nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';
121 121
 
122
-	}
122
+    }
123 123
     echo '</div>';
124
-	echo '<br /><br />';
125
-	$form->display();
124
+    echo '<br /><br />';
125
+    $form->display();
126 126
 }
127 127
 $main_result = array();
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131 131
 foreach ($course_list  as $current_course ) {
132
-	$course_info = api_get_course_info($current_course['code']);
133
-	$_course = $course_info;
134
-
135
-	// Getting LP list
136
-	$list = new LearnpathList('', $current_course['code'], $session_id);
137
-	$lp_list = $list->get_flat_list();
138
-
139
-	// Looping LPs
140
-	$lps = array();
141
-	foreach ($lp_list as $lp_id =>$lp) {
142
-		$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
-		$attempt_result = array();
144
-		// Looping Chamilo Exercises in LP
145
-		foreach ($exercise_list as $exercise) {
146
-			$exercise_stats = Event::get_all_exercise_event_from_lp(
147
-				$exercise['path'],
148
-				$course_info['real_id'],
149
-				$session_id
150
-			);
151
-			// Looping Exercise Attempts
152
-			foreach ($exercise_stats as $stats) {
153
-				$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
-				$user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
-			}
156
-			$exercise_list_name[$exercise['id']] = $exercise['title'];
157
-		}
158
-		$lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
-		$lp_list_name[$lp_id] = $lp['lp_name'];
160
-	}
161
-	$main_result[$current_course['code']] = $lps;
132
+    $course_info = api_get_course_info($current_course['code']);
133
+    $_course = $course_info;
134
+
135
+    // Getting LP list
136
+    $list = new LearnpathList('', $current_course['code'], $session_id);
137
+    $lp_list = $list->get_flat_list();
138
+
139
+    // Looping LPs
140
+    $lps = array();
141
+    foreach ($lp_list as $lp_id =>$lp) {
142
+        $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
+        $attempt_result = array();
144
+        // Looping Chamilo Exercises in LP
145
+        foreach ($exercise_list as $exercise) {
146
+            $exercise_stats = Event::get_all_exercise_event_from_lp(
147
+                $exercise['path'],
148
+                $course_info['real_id'],
149
+                $session_id
150
+            );
151
+            // Looping Exercise Attempts
152
+            foreach ($exercise_stats as $stats) {
153
+                $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
+                $user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
+            }
156
+            $exercise_list_name[$exercise['id']] = $exercise['title'];
157
+        }
158
+        $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
+        $lp_list_name[$lp_id] = $lp['lp_name'];
160
+    }
161
+    $main_result[$current_course['code']] = $lps;
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165 165
     foreach($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167
-		$user_list_name[$user_id] = api_get_person_name(
168
-			$user_data['firstname'],
169
-			$user_data['lastname']
170
-		);
167
+        $user_list_name[$user_id] = api_get_person_name(
168
+            $user_data['firstname'],
169
+            $user_data['lastname']
170
+        );
171 171
     }
172 172
 }
173 173
 $export_array =  array();
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
                         $html_result .= Display::tag('td', $result);
208 208
 
209 209
                         $html_result .= '</tr>';
210
-						$export_array[] = array(
211
-							$course_code,
212
-							$lp_list_name[$lp_id],
213
-							$exercise_list_name[$exercise_id],
214
-							$user_list_name[$user_id],
215
-							$attempt,
216
-							api_get_local_time($attempt_data['exe_date']),
217
-							$result,
218
-						);
210
+                        $export_array[] = array(
211
+                            $course_code,
212
+                            $lp_list_name[$lp_id],
213
+                            $exercise_list_name[$exercise_id],
214
+                            $user_list_name[$user_id],
215
+                            $attempt,
216
+                            api_get_local_time($attempt_data['exe_date']),
217
+                            $result,
218
+                        );
219 219
                         $attempt++;
220 220
                     }
221 221
                 }
@@ -226,30 +226,30 @@  discard block
 block discarded – undo
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
229
-	echo $html_result;
229
+    echo $html_result;
230 230
 }
231 231
 $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls';
232 232
 if ($export_to_csv) {
233 233
     export_complete_report_csv($filename, $export_array);
234
-	exit;
234
+    exit;
235 235
 }
236 236
 
237 237
 function export_complete_report_csv($filename, $array)
238 238
 {
239
-	$header[] = array(
240
-		get_lang('Course'),
241
-		get_lang('LearningPath'),
242
-		get_lang('Exercise'),
243
-		get_lang('User'),
244
-		get_lang('Attempt'),
245
-		get_lang('Date'),
246
-		get_lang('Results'),
247
-	);
248
-	if (!empty($array)) {
249
-		$array = array_merge($header, $array);
250
-		Export :: arrayToCsv($array, $filename);
251
-	}
252
-	exit;
239
+    $header[] = array(
240
+        get_lang('Course'),
241
+        get_lang('LearningPath'),
242
+        get_lang('Exercise'),
243
+        get_lang('User'),
244
+        get_lang('Attempt'),
245
+        get_lang('Date'),
246
+        get_lang('Results'),
247
+    );
248
+    if (!empty($array)) {
249
+        $array = array_merge($header, $array);
250
+        Export :: arrayToCsv($array, $filename);
251
+    }
252
+    exit;
253 253
 
254 254
 }
255 255
 Display :: display_footer();
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
55
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+	$form->addElement('hidden', 'view', 'admin');
58 58
 } else {
59 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/tracking/toolaccess_details.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 $nameTools = get_lang('ToolName');
25 25
 
26
-$interbreadcrumb[]= array ("url"=>"courseLog.php", "name"=> "Statistics");
26
+$interbreadcrumb[] = array("url"=>"courseLog.php", "name"=> "Statistics");
27 27
 
28 28
 $htmlHeadXtra[] = "<style type='text/css'>
29 29
 /*<![CDATA[*/
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 td {border-bottom: thin dashed gray;}
41 41
 /*]]>*/
42 42
 </style>";
43
-Display::display_header($nameTools,"Tracking");
43
+Display::display_header($nameTools, "Tracking");
44 44
 ?>
45 45
 
46 46
 <h3>
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 // Defining the months of the year to allow translation of the months
60 60
 $MonthsShort = api_get_months_short();
61 61
 
62
-$tool=$_REQUEST['tool'];
63
-$period=$_REQUEST['period'];
64
-$reqdate=$_REQUEST['reqdate'];
62
+$tool = $_REQUEST['tool'];
63
+$period = $_REQUEST['period'];
64
+$reqdate = $_REQUEST['reqdate'];
65 65
 ?>
66 66
 <table width="100%" cellpadding="2" cellspacing="0" border="0">
67 67
 <?php
68 68
     $TABLETRACK_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
69 69
     $courseId = api_get_course_int_id();
70 70
     //stats for the current course
71
-    if(isset($_cid)) {
71
+    if (isset($_cid)) {
72 72
         // to see stats of one course user must be courseAdmin of this course
73 73
         $is_allowedToTrack = $is_courseAdmin;
74 74
         $courseCodeEqualcidIfNeeded = "AND c_id = '$courseId'";
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $is_allowedToTrack = $is_platformAdmin;
79 79
         $courseCodeEqualcidIfNeeded = "";
80 80
     }
81
-    if( $is_allowedToTrack) {
81
+    if ($is_allowedToTrack) {
82 82
         // list of all tools
83 83
         if (!isset($tool)) {
84 84
             $sql = "SELECT access_tool, count( access_tool )
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             echo "<tr>
91 91
                     <td>
92 92
                     ";
93
-            if(isset($_cid)) echo "<b>$_cid : </b>";
93
+            if (isset($_cid)) echo "<b>$_cid : </b>";
94 94
             echo "		<b>".get_lang('ToolList')."</b>
95 95
 					</td>
96 96
                 </tr>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 </tr>";
109 109
             if (is_array($results))
110 110
             {
111
-                for($j = 0 ; $j < count($results) ; $j++)
111
+                for ($j = 0; $j < count($results); $j++)
112 112
                 {
113 113
                         echo "<tr>";
114 114
                         echo "<td><a href='toolaccess_details.php?tool=".urlencode($results[$j][0])."'>".get_lang($results[$j][0])."</a></td>";
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
             $encodedTool = urlencode($tool);
132 132
             $tool = urldecode($tool);
133 133
 
134
-            if( !isset($reqdate) )
134
+            if (!isset($reqdate))
135 135
                 $reqdate = time();
136 136
             echo "<tr>
137 137
                     <td>
138 138
 					";
139
-            if(isset($_cid)) echo "<b>$_cid : </b>";
139
+            if (isset($_cid)) echo "<b>$_cid : </b>";
140 140
             echo "        <b>".get_lang($tool)."</b>
141 141
 					</td>
142 142
                 </tr>
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
             /* ------ display ------ */
146 146
             // displayed period
147 147
             echo "<tr><td>";
148
-            switch($period)
148
+            switch ($period)
149 149
             {
150 150
                 case "month" :
151
-                    echo $MonthsLong[date("n", $reqdate)-1].date(" Y", $reqdate);
151
+                    echo $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate);
152 152
                     break;
153 153
                 case "week" :
154
-                    $weeklowreqdate = ($reqdate-(86400*date("w" , $reqdate)));
155
-                    $weekhighreqdate = ($reqdate+(86400*(6-date("w" , $reqdate)) ));
156
-                    echo "<b>".$langFrom."</b> ".date("d " , $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate)-1].date(" Y" , $weeklowreqdate);
157
-                    echo " <b>".$langTo."</b> ".date("d " , $weekhighreqdate ).$MonthsLong[date("n", $weekhighreqdate)-1].date(" Y" , $weekhighreqdate);
154
+                    $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate)));
155
+                    $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate))));
156
+                    echo "<b>".$langFrom."</b> ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate);
157
+                    echo " <b>".$langTo."</b> ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate);
158 158
                     break;
159 159
                 // default == day
160 160
                 default :
161 161
                     $period = "day";
162 162
                 case "day" :
163
-                    echo $DaysLong[date("w" , $reqdate)].date(" d " , $reqdate).$MonthsLong[date("n", $reqdate)-1].date(" Y" , $reqdate);
163
+                    echo $DaysLong[date("w", $reqdate)].date(" d ", $reqdate).$MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate);
164 164
                     break;
165 165
             }
166 166
             echo "</tr></td>";
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
                     &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
175 175
 
176 176
                     ";
177
-            switch($period)
177
+            switch ($period)
178 178
             {
179 179
                 case "month" :
180 180
                     // previous and next date must be evaluated
181 181
                     // 30 days should be a good approximation
182
-                    $previousReqDate = mktime(1,1,1,date("m",$reqdate)-1,1,date("Y",$reqdate));
183
-                    $nextReqDate = mktime(1,1,1,date("m",$reqdate)+1,1,date("Y",$reqdate));
182
+                    $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate));
183
+                    $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate));
184 184
                     echo   "
185 185
                         [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$previousReqDate' class='specialLink'>$langPreviousMonth</a>]
186 186
                         [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$nextReqDate' class='specialLink'>$langNextMonth</a>]
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
                     break;
189 189
                 case "week" :
190 190
                     // previous and next date must be evaluated
191
-                    $previousReqDate = $reqdate - 7*86400;
192
-                    $nextReqDate = $reqdate + 7*86400;
191
+                    $previousReqDate = $reqdate - 7 * 86400;
192
+                    $nextReqDate = $reqdate + 7 * 86400;
193 193
                     echo   "
194 194
                         [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$previousReqDate' class='specialLink'>$langPreviousWeek</a>]
195 195
                         [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$nextReqDate' class='specialLink'>$langNextWeek</a>]
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
                 </tr>
214 214
             ";
215 215
             // display information about this period
216
-            switch($period)
216
+            switch ($period)
217 217
             {
218 218
                 // all days
219 219
                 case "month" :
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                                 ORDER BY access_date ASC";
227 227
 
228 228
                     $days_array = StatsUtils::daysTab($sql);
229
-                    StatsUtils::makeHitsTable($days_array,$langDay);
229
+                    StatsUtils::makeHitsTable($days_array, $langDay);
230 230
                     break;
231 231
                 // all days
232 232
                 case "week" :
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                                 ORDER BY access_date ASC";
240 240
 
241 241
                     $days_array = StatsUtils::daysTab($sql);
242
-                    StatsUtils::makeHitsTable($days_array,$langDay);
242
+                    StatsUtils::makeHitsTable($days_array, $langDay);
243 243
                     break;
244 244
                 // all hours
245 245
                 case "day"  :
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
                                     AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
252 252
                                 ORDER BY access_date ASC";
253 253
 
254
-                    $hours_array = StatsUtils::hoursTab($sql,$reqdate);
255
-                    StatsUtils::makeHitsTable($hours_array,$langHour);
254
+                    $hours_array = StatsUtils::hoursTab($sql, $reqdate);
255
+                    StatsUtils::makeHitsTable($hours_array, $langHour);
256 256
                     break;
257 257
             }
258 258
         }
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -90,7 +90,9 @@  discard block
 block discarded – undo
90 90
             echo "<tr>
91 91
                     <td>
92 92
                     ";
93
-            if(isset($_cid)) echo "<b>$_cid : </b>";
93
+            if(isset($_cid)) {
94
+                echo "<b>$_cid : </b>";
95
+            }
94 96
             echo "		<b>".get_lang('ToolList')."</b>
95 97
 					</td>
96 98
                 </tr>
@@ -116,27 +118,28 @@  discard block
 block discarded – undo
116 118
                         echo"</tr>";
117 119
                 }
118 120
 
119
-            }
120
-            else
121
+            } else
121 122
             {
122 123
                 echo "<tr>";
123 124
                 echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>";
124 125
                 echo"</tr>";
125 126
             }
126 127
             echo "</table></td></tr>";
127
-        }
128
-        else
128
+        } else
129 129
         {
130 130
             // this can prevent bug if there is special chars in $tool
131 131
             $encodedTool = urlencode($tool);
132 132
             $tool = urldecode($tool);
133 133
 
134
-            if( !isset($reqdate) )
135
-                $reqdate = time();
134
+            if( !isset($reqdate) ) {
135
+                            $reqdate = time();
136
+            }
136 137
             echo "<tr>
137 138
                     <td>
138 139
 					";
139
-            if(isset($_cid)) echo "<b>$_cid : </b>";
140
+            if(isset($_cid)) {
141
+                echo "<b>$_cid : </b>";
142
+            }
140 143
             echo "        <b>".get_lang($tool)."</b>
141 144
 					</td>
142 145
                 </tr>
Please login to merge, or discard this patch.
main/tracking/logins_details.php 3 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
     // check if uid is tutor of this group
76 76
     $courseId = api_get_course_int_id();
77 77
 
78
-    if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
78
+    if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
79 79
         if ($is_allowedToTrackEverybodyInCourse) {
80 80
             $sql = "SELECT u.firstname,u.lastname, u.email
81 81
                     FROM $TABLECOURSUSER cu , $TABLEUSER u
82 82
                     WHERE
83 83
                         cu.user_id = u.user_id AND
84
-                        cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
84
+                        cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
85 85
                         cu.c_id = '$courseId' AND
86 86
                         u.user_id = '$uInfo'";
87 87
         } else {
@@ -97,21 +97,21 @@  discard block
 block discarded – undo
97 97
             $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]);
98 98
 
99 99
             echo "<tr><td>";
100
-            echo $informationsAbout . " : <br>";
100
+            echo $informationsAbout." : <br>";
101 101
             echo "<ul>\n"
102
-            . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n"
103
-            . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n"
104
-            . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n"
102
+            . "<li>".get_lang('FirstName')." : ".$res[0]."</li>\n"
103
+            . "<li>".get_lang('LastName')." : ".$res[1]."</li>\n"
104
+            . "<li>".get_lang('Email')." : ".$res2."</li>\n"
105 105
             . "</ul>";
106 106
             echo "</td></tr>";
107 107
             /*             * ***** MENU ******* */
108 108
             echo "<tr>
109 109
                 <td>
110
-                [<a href='userLog.php?uInfo=$uInfo&view=$view'>" . get_lang('Back') . "</a>]
110
+                [<a href='userLog.php?uInfo=$uInfo&view=$view'>".get_lang('Back')."</a>]
111 111
         ";
112 112
             echo "  &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
113
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodWeek') . "</a>]
114
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodMonth') . "</a>]
113
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodWeek')."</a>]
114
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>]
115 115
                 &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
116 116
         ";
117 117
             switch ($period) {
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                     $previousReqDate = $reqdate - 7 * 86400;
121 121
                     $nextReqDate = $reqdate + 7 * 86400;
122 122
                     echo "
123
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousWeek') . "</a>]
124
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextWeek') . "</a>]
123
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousWeek')."</a>]
124
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextWeek')."</a>]
125 125
                 ";
126 126
                     break;
127 127
                 default :
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
                     $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate));
133 133
                     $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate));
134 134
                     echo "
135
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousMonth') . "</a>]
136
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextMonth') . "</a>]
135
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousMonth')."</a>]
136
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextMonth')."</a>]
137 137
                 ";
138 138
                     break;
139 139
             }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                         AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
154 154
                         GROUP BY DAYOFMONTH(access_date)
155 155
                         ORDER BY access_date ASC";
156
-                $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate);
156
+                $displayedDate = $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate);
157 157
                 break;
158 158
             case "week" :
159 159
                 $sql = "SELECT access_date
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
                         GROUP BY DAYOFMONTH(access_date)
166 166
                         ORDER BY access_date ASC";
167 167
                 $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate)));
168
-                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) ));
169
-                $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate)
170
-                        . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate);
168
+                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate))));
169
+                $displayedDate = get_lang('From')." ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate)
170
+                        . " ".get_lang('To')." ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate);
171 171
                 break;
172 172
         }
173 173
         echo "<tr><td>";
174 174
         $results = StatsUtils::getManyResults1Col($sql);
175 175
         /*             * * display of the displayed period  ** */
176 176
         echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>";
177
-        echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>";
177
+        echo "<td bgcolor='#E6E6E6'>".$displayedDate."</td>";
178 178
         if (is_array($results)) {
179 179
             for ($j = 0; $j < sizeof($results); $j++) {
180 180
                 $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get());
181 181
                 echo "<tr>";
182
-                echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>";
182
+                echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>";
183 183
                 echo"</tr>";
184 184
                 // $limit is used to select only results between $results[$j] (current login) and next one
185
-                if ($j == ( sizeof($results) - 1 ))
185
+                if ($j == (sizeof($results) - 1))
186 186
                     $limit = date("Y-m-d H:i:s", $nextReqDate);
187 187
                 else
188 188
                     $limit = $results[$j + 1];
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                         FROM $TABLETRACK_ACCESS
193 193
                         WHERE access_user_id = $uInfo
194 194
                             AND access_tool IS NOT NULL
195
-                            AND access_date > '" . $results[$j] . "'
196
-                            AND access_date < '" . $limit . "'
195
+                            AND access_date > '".$results[$j]."'
196
+                            AND access_date < '" . $limit."'
197 197
                             AND c_id = $courseId
198 198
                         GROUP BY access_tool
199 199
                         ORDER BY access_tool ASC";
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
                     echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n";
205 205
                     for ($k = 0; $k < count($results2); $k++) {
206 206
                         echo "<tr>\n";
207
-                        echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n";
208
-                        echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n";
207
+                        echo "<td width='70%' style='padding-left : 60px;'>".get_lang($results2[$k][0])."</td>\n";
208
+                        echo "<td width='30%' align='right' style='padding-right : 40px'>".$results2[$k][1]." ".get_lang('Visits')."</td>\n";
209 209
                         echo "</tr>";
210 210
                     }
211 211
                     echo "</table>\n";
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             }
216 216
         } else {
217 217
             echo "<tr>";
218
-            echo "<td colspan='2' bgcolor='#eeeeee'>" . get_lang('NoResult') . "</td>";
218
+            echo "<td colspan='2' bgcolor='#eeeeee'>".get_lang('NoResult')."</td>";
219 219
             echo "</tr>";
220 220
         }
221 221
         echo "</table>";
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -182,10 +182,11 @@
 block discarded – undo
182 182
                 echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>";
183 183
                 echo"</tr>";
184 184
                 // $limit is used to select only results between $results[$j] (current login) and next one
185
-                if ($j == ( sizeof($results) - 1 ))
186
-                    $limit = date("Y-m-d H:i:s", $nextReqDate);
187
-                else
188
-                    $limit = $results[$j + 1];
185
+                if ($j == ( sizeof($results) - 1 )) {
186
+                                    $limit = date("Y-m-d H:i:s", $nextReqDate);
187
+                } else {
188
+                                    $limit = $results[$j + 1];
189
+                }
189 190
                 // select all access to tool between displayed date and next displayed date or now() if
190 191
                 // displayed date is the last login date
191 192
                 $sql = "SELECT access_tool, count(access_tool)
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
  * @author Patrick Cool
17 17
  * @author René Haentjens, added CSV file import (October 2004)
18 18
  * @package chamilo.link
19
-
20 19
  */
21 20
 
22 21
 // Including libraries
Please login to merge, or discard this patch.
main/tracking/course_log_groups.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 $action_links = '
100 100
 function action_formatter(cellvalue, options, rowObject) {
101
-    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
101
+    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
102 102
     '\';
103 103
 }';
104 104
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 $htmlHeadXtra[] = '
109 109
 <script>
110 110
 $(function() {
111
-    '.Display::grid_js('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).'
111
+    '.Display::grid_js('group_users', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
112 112
 });
113 113
 </script>';
114 114
 
Please login to merge, or discard this patch.
main/tracking/course_log_tools.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 // getting all the students of the course
80 80
 if (empty($session_id)) {
81
-	// Registered students in a course outside session.
81
+    // Registered students in a course outside session.
82 82
     $a_students = CourseManager:: get_student_list_from_course_code(
83 83
         api_get_course_id(),
84 84
         false,
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         api_get_group_id()
90 90
     );
91 91
 } else {
92
-	// Registered students in session.
92
+    // Registered students in session.
93 93
     $a_students = CourseManager:: get_student_list_from_course_code(
94 94
         api_get_course_id(),
95 95
         true,
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
 // Breadcrumbs.
67 67
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
68
-    $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
69
-    $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
68
+    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
69
+    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
70 70
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview'));
71 71
 }
72 72
 
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
 echo '<span style="float:right; padding-top:0px;">';
136 136
 echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
137
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
137
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
138 138
 
139 139
 echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&id_session='.api_get_session_id().'&export=csv">
140
-	'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
140
+	'.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
141 141
 
142 142
 echo '</span>';
143 143
 echo '</div>';
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%';
251 251
             $url = api_get_path(
252 252
                     WEB_CODE_PATH
253
-                ) . 'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params;
253
+                ).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params;
254 254
 
255 255
             echo '<tr><td>'.Display::url(
256 256
                     $quiz['title'],
Please login to merge, or discard this patch.