Completed
Push — 1.11.x ( 566ea6...b264ab )
by José
110:20 queued 69:00
created
main/inc/lib/internationalization_database/transliteration/xb4.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: xb4.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('dwaen', 'dwaenj', 'dwaenh', 'dwaed', 'dwael', 'dwaelg', 'dwaelm', 'dwaelb', 'dwaels', 'dwaelt', 'dwaelp', 'dwaelh', 'dwaem', 'dwaeb', 'dwaebs', 'dwaes',
5
+    'en' => array('dwaen', 'dwaenj', 'dwaenh', 'dwaed', 'dwael', 'dwaelg', 'dwaelm', 'dwaelb', 'dwaels', 'dwaelt', 'dwaelp', 'dwaelh', 'dwaem', 'dwaeb', 'dwaebs', 'dwaes',
6 6
     'dwaess', 'dwaeng', 'dwaej', 'dwaec', 'dwaek', 'dwaet', 'dwaep', 'dwaeh', 'doe', 'doeg', 'doegg', 'doegs', 'doen', 'doenj', 'doenh', 'doed',
7 7
     'doel', 'doelg', 'doelm', 'doelb', 'doels', 'doelt', 'doelp', 'doelh', 'doem', 'doeb', 'doebs', 'does', 'doess', 'doeng', 'doej', 'doec',
8 8
     'doek', 'doet', 'doep', 'doeh', 'dyo', 'dyog', 'dyogg', 'dyogs', 'dyon', 'dyonj', 'dyonh', 'dyod', 'dyol', 'dyolg', 'dyolm', 'dyolb',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/x02.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: x02.php,v 1.1.8.1 2008/06/12 20:34:31 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('A', 'a', 'A', 'a', 'E', 'e', 'E', 'e', 'I', 'i', 'I', 'i', 'O', 'o', 'O', 'o',
5
+    'en' => array('A', 'a', 'A', 'a', 'E', 'e', 'E', 'e', 'I', 'i', 'I', 'i', 'O', 'o', 'O', 'o',
6 6
     'R', 'r', 'R', 'r', 'U', 'u', 'U', 'u', 'S', 's', 'T', 't', 'Y', 'y', 'H', 'h',
7 7
     'N', 'd', 'OU', 'ou', 'Z', 'z', 'A', 'a', 'E', 'e', 'O', 'o', 'O', 'o', 'O', 'o',
8 8
     'O', 'o', 'Y', 'y', 'l', 'n', 't', 'j', 'db', 'qp', 'A', 'C', 'c', 'L', 'T', 's',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/x16.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: x16.php,v 1.1.8.1 2008/06/12 20:34:31 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('kka', 'kk', 'nu', 'no', 'ne', 'nee', 'ni', 'na', 'mu', 'mo', 'me', 'mee', 'mi', 'ma', 'yu', 'yo',
5
+    'en' => array('kka', 'kk', 'nu', 'no', 'ne', 'nee', 'ni', 'na', 'mu', 'mo', 'me', 'mee', 'mi', 'ma', 'yu', 'yo',
6 6
     'ye', 'yee', 'yi', 'ya', 'ju', 'ju', 'jo', 'je', 'jee', 'ji', 'ji', 'ja', 'jju', 'jjo', 'jje', 'jjee',
7 7
     'jji', 'jja', 'lu', 'lo', 'le', 'lee', 'li', 'la', 'dlu', 'dlo', 'dle', 'dlee', 'dli', 'dla', 'lhu', 'lho',
8 8
     'lhe', 'lhee', 'lhi', 'lha', 'tlhu', 'tlho', 'tlhe', 'tlhee', 'tlhi', 'tlha', 'tlu', 'tlo', 'tle', 'tlee', 'tli', 'tla',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/x6c.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: x6c.php,v 1.1.8.1 2008/06/12 20:34:31 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('Lu ', 'Mu ', 'Li ', 'Tong ', 'Rong ', 'Chang ', 'Pu ', 'Luo ', 'Zhan ', 'Sao ', 'Zhan ', 'Meng ', 'Luo ', 'Qu ', 'Die ', 'Shi ',
5
+    'en' => array('Lu ', 'Mu ', 'Li ', 'Tong ', 'Rong ', 'Chang ', 'Pu ', 'Luo ', 'Zhan ', 'Sao ', 'Zhan ', 'Meng ', 'Luo ', 'Qu ', 'Die ', 'Shi ',
6 6
     'Di ', 'Min ', 'Jue ', 'Mang ', 'Qi ', 'Pie ', 'Nai ', 'Qi ', 'Dao ', 'Xian ', 'Chuan ', 'Fen ', 'Ri ', 'Nei ', NULL, 'Fu ',
7 7
     'Shen ', 'Dong ', 'Qing ', 'Qi ', 'Yin ', 'Xi ', 'Hai ', 'Yang ', 'An ', 'Ya ', 'Ke ', 'Qing ', 'Ya ', 'Dong ', 'Dan ', 'Lu ',
8 8
     'Qing ', 'Yang ', 'Yun ', 'Yun ', 'Shui ', 'San ', 'Zheng ', 'Bing ', 'Yong ', 'Dang ', 'Shitamizu ', 'Le ', 'Ni ', 'Tun ', 'Fan ', 'Gui ',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/xb8.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: xb8.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('reoss', 'reong', 'reoj', 'reoc', 'reok', 'reot', 'reop', 'reoh', 're', 'reg', 'regg', 'regs', 'ren', 'renj', 'renh', 'red',
5
+    'en' => array('reoss', 'reong', 'reoj', 'reoc', 'reok', 'reot', 'reop', 'reoh', 're', 'reg', 'regg', 'regs', 'ren', 'renj', 'renh', 'red',
6 6
     'rel', 'relg', 'relm', 'relb', 'rels', 'relt', 'relp', 'relh', 'rem', 'reb', 'rebs', 'res', 'ress', 'reng', 'rej', 'rec',
7 7
     'rek', 'ret', 'rep', 'reh', 'ryeo', 'ryeog', 'ryeogg', 'ryeogs', 'ryeon', 'ryeonj', 'ryeonh', 'ryeod', 'ryeol', 'ryeolg', 'ryeolm', 'ryeolb',
8 8
     'ryeols', 'ryeolt', 'ryeolp', 'ryeolh', 'ryeom', 'ryeob', 'ryeobs', 'ryeos', 'ryeoss', 'ryeong', 'ryeoj', 'ryeoc', 'ryeok', 'ryeot', 'ryeop', 'ryeoh',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/xbd.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: xbd.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh',
5
+    'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh',
6 6
     'bwa', 'bwag', 'bwagg', 'bwags', 'bwan', 'bwanj', 'bwanh', 'bwad', 'bwal', 'bwalg', 'bwalm', 'bwalb', 'bwals', 'bwalt', 'bwalp', 'bwalh',
7 7
     'bwam', 'bwab', 'bwabs', 'bwas', 'bwass', 'bwang', 'bwaj', 'bwac', 'bwak', 'bwat', 'bwap', 'bwah', 'bwae', 'bwaeg', 'bwaegg', 'bwaegs',
8 8
     'bwaen', 'bwaenj', 'bwaenh', 'bwaed', 'bwael', 'bwaelg', 'bwaelm', 'bwaelb', 'bwaels', 'bwaelt', 'bwaelp', 'bwaelh', 'bwaem', 'bwaeb', 'bwaebs', 'bwaes',
Please login to merge, or discard this patch.
main/inc/lib/fileManage.lib.php 4 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
             Database::query($query);
34 34
             break;
35 35
         case 'update':
36
-            if ($new_path[0] == '.') $new_path = substr($new_path, 1);
36
+            if ($new_path[0] == '.') {
37
+                $new_path = substr($new_path, 1);
38
+            }
37 39
             $new_path = str_replace('//', '/', $new_path);
38 40
 
39 41
             // Attempt to update	- tested & working for root	dir
@@ -379,7 +381,9 @@  discard block
 block discarded – undo
379 381
 			chdir($path);
380 382
 			$handle = opendir($path);
381 383
 			while ($element = readdir($handle)) {
382
-				if ($element == '.' || $element == '..') continue;
384
+				if ($element == '.' || $element == '..') {
385
+				    continue;
386
+				}
383 387
                 // Skip the current and parent directories
384 388
 				if (is_dir($element)) {
385 389
 					$dir_array[] = $path.'/'.$element;
@@ -419,7 +423,9 @@  discard block
 block discarded – undo
419 423
 				chdir($directory);
420 424
 				$handle = opendir($directory);
421 425
 			   	while ($element = readdir($handle)) {
422
-					if ($element == '.' || $element == '..' || $element == '.htaccess') continue;
426
+					if ($element == '.' || $element == '..' || $element == '.htaccess') {
427
+					    continue;
428
+					}
423 429
                     // Skip the current and parent directories
424 430
 					if (!is_dir($element)) {
425 431
 						$element_array[] = $directory.'/'.$element;
@@ -469,7 +475,9 @@  discard block
 block discarded – undo
469 475
 	 */
470 476
 	function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v')
471 477
     {
472
-		if (!$default_visibility) $default_visibility = 'v';
478
+		if (!$default_visibility) {
479
+		    $default_visibility = 'v';
480
+		}
473 481
 
474 482
 		// Make sure path is not wrongly formed
475 483
 		$upload_path = !empty($upload_path) ? "/$upload_path" : '';
Please login to merge, or discard this patch.
Indentation   +185 added lines, -186 removed lines patch added patch discarded remove patch
@@ -170,37 +170,37 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function my_rename($file_path, $new_file_name) {
172 172
 
173
-	$save_dir = getcwd();
174
-	$path = dirname($file_path);
175
-	$old_file_name = basename($file_path);
176
-	$new_file_name = api_replace_dangerous_char($new_file_name);
177
-
178
-	// If no extension, take the old one
179
-	if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) {
180
-		$new_file_name .= substr($old_file_name, $dotpos);
181
-	}
182
-
183
-	// Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz'
184
-	// This is useful for folder names, where otherwise '.' would be sticky
185
-
186
-	// Extension PHP is not allowed, change to PHPS
187
-	$new_file_name = php2phps($new_file_name);
188
-
189
-	if ($new_file_name == $old_file_name) {
190
-		return $old_file_name;
191
-	}
192
-
193
-	if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) {
194
-		return false;
195
-	}
196
-	// On a Windows server, it would be better not to do the above check
197
-	// because it succeeds for some new names resembling the old name.
198
-	// But on Unix/Linux the check must be done because rename overwrites.
199
-
200
-	chdir($path);
201
-	$res = rename($old_file_name, $new_file_name) ? $new_file_name : false;
202
-	chdir($save_dir);
203
-	return $res;
173
+    $save_dir = getcwd();
174
+    $path = dirname($file_path);
175
+    $old_file_name = basename($file_path);
176
+    $new_file_name = api_replace_dangerous_char($new_file_name);
177
+
178
+    // If no extension, take the old one
179
+    if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) {
180
+        $new_file_name .= substr($old_file_name, $dotpos);
181
+    }
182
+
183
+    // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz'
184
+    // This is useful for folder names, where otherwise '.' would be sticky
185
+
186
+    // Extension PHP is not allowed, change to PHPS
187
+    $new_file_name = php2phps($new_file_name);
188
+
189
+    if ($new_file_name == $old_file_name) {
190
+        return $old_file_name;
191
+    }
192
+
193
+    if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) {
194
+        return false;
195
+    }
196
+    // On a Windows server, it would be better not to do the above check
197
+    // because it succeeds for some new names resembling the old name.
198
+    // But on Unix/Linux the check must be done because rename overwrites.
199
+
200
+    chdir($path);
201
+    $res = rename($old_file_name, $new_file_name) ? $new_file_name : false;
202
+    chdir($save_dir);
203
+    return $res;
204 204
 }
205 205
 
206 206
 /**
@@ -217,38 +217,38 @@  discard block
 block discarded – undo
217 217
  */
218 218
 function move($source, $target, $forceMove = false, $moveContent = false)
219 219
 {
220
-	if (check_name_exist($source)) {
221
-		$file_name = basename($source);
220
+    if (check_name_exist($source)) {
221
+        $file_name = basename($source);
222 222
         $isWindowsOS = api_is_windows_os();
223 223
         $canExec = function_exists('exec');
224 224
 
225
-		/* File case */
226
-		if (is_file($source)) {
227
-			if ($forceMove && !$isWindowsOS && $canExec) {
228
-				exec('mv ' . $source . ' ' . $target . '/' . $file_name);
229
-			} else {
230
-				copy($source, $target . '/' . $file_name);
231
-				unlink($source);
232
-			}
233
-			return true;
234
-		} elseif (is_dir($source)) {
235
-			/* Directory */
236
-			if ($forceMove && !$isWindowsOS && $canExec) {
237
-				if ($moveContent) {
238
-					$base = basename($source);
239
-					exec('mv '.$source.'/* '.$target.$base.'/');
240
-					exec('rm -rf '.$source);
241
-				} else {
242
-					exec('mv $source $target');
243
-				}
244
-			} else {
245
-				copyDirTo($source, $target);
246
-			}
247
-			return true;
248
-		}
249
-	} else {
250
-		return false;
251
-	}
225
+        /* File case */
226
+        if (is_file($source)) {
227
+            if ($forceMove && !$isWindowsOS && $canExec) {
228
+                exec('mv ' . $source . ' ' . $target . '/' . $file_name);
229
+            } else {
230
+                copy($source, $target . '/' . $file_name);
231
+                unlink($source);
232
+            }
233
+            return true;
234
+        } elseif (is_dir($source)) {
235
+            /* Directory */
236
+            if ($forceMove && !$isWindowsOS && $canExec) {
237
+                if ($moveContent) {
238
+                    $base = basename($source);
239
+                    exec('mv '.$source.'/* '.$target.$base.'/');
240
+                    exec('rm -rf '.$source);
241
+                } else {
242
+                    exec('mv $source $target');
243
+                }
244
+            } else {
245
+                copyDirTo($source, $target);
246
+            }
247
+            return true;
248
+        }
249
+    } else {
250
+        return false;
251
+    }
252 252
 }
253 253
 
254 254
 /**
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
  * @param 	string	$filename 		filename
280 280
  */
281 281
 function getextension($filename) {
282
-	$bouts = explode('.', $filename);
283
-	return array(array_pop($bouts), implode('.', $bouts));
282
+    $bouts = explode('.', $filename);
283
+    return array(array_pop($bouts), implode('.', $bouts));
284 284
 }
285 285
 
286 286
 /**
@@ -291,19 +291,19 @@  discard block
 block discarded – undo
291 291
  * @param 	boolean $recursive if true , include subdir in total
292 292
  */
293 293
 function dirsize($root, $recursive = true) {
294
-	$dir = @opendir($root);
295
-	$size = 0;
296
-	while ($file = @readdir($dir)) {
297
-		if (!in_array($file, array('.', '..'))) {
298
-			if (is_dir($root.'/'.$file)) {
299
-				$size += $recursive ? dirsize($root.'/'.$file) : 0;
300
-			} else {
301
-				$size += @filesize($root.'/'.$file);
302
-			}
303
-		}
304
-	}
305
-	@closedir($dir);
306
-	return $size;
294
+    $dir = @opendir($root);
295
+    $size = 0;
296
+    while ($file = @readdir($dir)) {
297
+        if (!in_array($file, array('.', '..'))) {
298
+            if (is_dir($root.'/'.$file)) {
299
+                $size += $recursive ? dirsize($root.'/'.$file) : 0;
300
+            } else {
301
+                $size += @filesize($root.'/'.$file);
302
+            }
303
+        }
304
+    }
305
+    @closedir($dir);
306
+    return $size;
307 307
 }
308 308
 
309 309
 /*	CLASS FileManager */
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 */
323 323
 class FileManager
324 324
 {
325
-	/**
325
+    /**
326 326
 		Returns a list of all directories, except the base dir,
327 327
 		of the current course. This function uses recursion.
328 328
 
@@ -330,131 +330,130 @@  discard block
 block discarded – undo
330 330
 
331 331
 		@author Roan Embrechts
332 332
 		@version 1.0.1
333
-	*/
334
-	function list_all_directories($path)
333
+     */
334
+    function list_all_directories($path)
335 335
     {
336
-		$result_array = array();
337
-		if (is_dir($path)) {
338
-			$save_dir = getcwd();
339
-			chdir($path);
340
-			$handle = opendir($path);
341
-			while ($element = readdir($handle)) {
342
-				if ($element == '.' || $element == '..') continue;
336
+        $result_array = array();
337
+        if (is_dir($path)) {
338
+            $save_dir = getcwd();
339
+            chdir($path);
340
+            $handle = opendir($path);
341
+            while ($element = readdir($handle)) {
342
+                if ($element == '.' || $element == '..') continue;
343 343
                 // Skip the current and parent directories
344
-				if (is_dir($element)) {
345
-					$dir_array[] = $path.'/'.$element;
346
-				}
347
-			}
348
-			closedir($handle);
349
-			// Recursive operation if subdirectories exist
350
-			$dir_number = sizeof($dir_array);
351
-			if ($dir_number > 0) {
352
-				for ($i = 0 ; $i < $dir_number ; $i++) {
353
-					$sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity
354
-					if (is_array($dir_array) && is_array($sub_dir_array)) {
355
-						$dir_array  =  array_merge($dir_array, $sub_dir_array); // Data merge
356
-					}
357
-				}
358
-			}
359
-			$result_array  =  $dir_array;
360
-			chdir($save_dir) ;
361
-		}
362
-		return $result_array ;
363
-	}
364
-
365
-	/**
344
+                if (is_dir($element)) {
345
+                    $dir_array[] = $path.'/'.$element;
346
+                }
347
+            }
348
+            closedir($handle);
349
+            // Recursive operation if subdirectories exist
350
+            $dir_number = sizeof($dir_array);
351
+            if ($dir_number > 0) {
352
+                for ($i = 0 ; $i < $dir_number ; $i++) {
353
+                    $sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity
354
+                    if (is_array($dir_array) && is_array($sub_dir_array)) {
355
+                        $dir_array  =  array_merge($dir_array, $sub_dir_array); // Data merge
356
+                    }
357
+                }
358
+            }
359
+            $result_array  =  $dir_array;
360
+            chdir($save_dir) ;
361
+        }
362
+        return $result_array ;
363
+    }
364
+
365
+    /**
366 366
 		This function receives a list of directories.
367 367
 		It returns a list of all files in these directories
368 368
 
369 369
 		@author Roan Embrechts
370 370
 		@version 1.0
371
-	*/
372
-	function list_all_files($dir_array)
371
+     */
372
+    function list_all_files($dir_array)
373 373
     {
374
-		$element_array = array();
375
-		if (is_dir($dir_array)) {
376
-
377
-			$save_dir = getcwd();
378
-			foreach ($dir_array as $directory) {
379
-				chdir($directory);
380
-				$handle = opendir($directory);
381
-			   	while ($element = readdir($handle)) {
382
-					if ($element == '.' || $element == '..' || $element == '.htaccess') continue;
374
+        $element_array = array();
375
+        if (is_dir($dir_array)) {
376
+
377
+            $save_dir = getcwd();
378
+            foreach ($dir_array as $directory) {
379
+                chdir($directory);
380
+                $handle = opendir($directory);
381
+                    while ($element = readdir($handle)) {
382
+                    if ($element == '.' || $element == '..' || $element == '.htaccess') continue;
383 383
                     // Skip the current and parent directories
384
-					if (!is_dir($element)) {
385
-						$element_array[] = $directory.'/'.$element;
386
-					}
387
-				}
388
-				closedir($handle);
389
-				chdir('..');
390
-				chdir($save_dir);
391
-			}
392
-		}
393
-
394
-		return $element_array;
395
-	}
396
-
397
-	/**
384
+                    if (!is_dir($element)) {
385
+                        $element_array[] = $directory.'/'.$element;
386
+                    }
387
+                }
388
+                closedir($handle);
389
+                chdir('..');
390
+                chdir($save_dir);
391
+            }
392
+        }
393
+
394
+        return $element_array;
395
+    }
396
+
397
+    /**
398 398
 		Loads contents of file $filename into memory and returns them as a string.
399 399
 		Function kept for compatibility with older PHP versions.
400 400
 		Function is binary safe (is needed on Windows)
401
-	*/
402
-	function compat_load_file($file_name)
401
+     */
402
+    function compat_load_file($file_name)
403 403
     {
404
-		$buffer = '';
405
-		if (file_exists($file_name)) {
406
-			$fp = fopen($file_name, 'rb');
407
-			$buffer = fread ($fp, filesize($file_name));
408
-			fclose ($fp);
409
-		}
410
-		return $buffer;
411
-	}
412
-
413
-	/**
414
-	 * Adds file/folder to document table in database
415
-	 * improvement from set_default_settings (see below):
416
-	 * take all info from function parameters
417
-	 * no global variables needed
418
-	 *
419
-	 * NOTE $glued_table should already have backticks around it
420
-	 * (get it from the database library, and it is done automatically)
421
-	 *
422
-	 * @param	path, filename, filetype,
423
-				$glued_table, default_visibility
404
+        $buffer = '';
405
+        if (file_exists($file_name)) {
406
+            $fp = fopen($file_name, 'rb');
407
+            $buffer = fread ($fp, filesize($file_name));
408
+            fclose ($fp);
409
+        }
410
+        return $buffer;
411
+    }
424 412
 
425
-	 * action:	Adds an entry to the document table with the default settings.
426
-	 * @author	Olivier Cauberghe <[email protected]>
427
-	 * @author	Roan Embrechts
428
-	 * @version 1.2
429
-	 */
430
-	function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v')
413
+    /**
414
+     * Adds file/folder to document table in database
415
+     * improvement from set_default_settings (see below):
416
+     * take all info from function parameters
417
+     * no global variables needed
418
+     *
419
+     * NOTE $glued_table should already have backticks around it
420
+     * (get it from the database library, and it is done automatically)
421
+     *
422
+     * @param	path, filename, filetype,
423
+				$glued_table, default_visibility
424
+     * action:	Adds an entry to the document table with the default settings.
425
+     * @author	Olivier Cauberghe <[email protected]>
426
+     * @author	Roan Embrechts
427
+     * @version 1.2
428
+     */
429
+    function set_default_settings($upload_path, $filename, $filetype = 'file', $glued_table, $default_visibility = 'v')
431 430
     {
432
-		if (!$default_visibility) $default_visibility = 'v';
433
-
434
-		// Make sure path is not wrongly formed
435
-		$upload_path = !empty($upload_path) ? "/$upload_path" : '';
436
-
437
-		$endchar = substr($filename, strlen($filename) - 1, 1);
438
-		if ($endchar == "\\" || $endchar == '/') {
439
-			$filename = substr($filename, 0, strlen($filename) - 1);
440
-		}
441
-
442
-		$full_file_name = $upload_path.'/'.$filename;
443
-		$full_file_name = str_replace("//", '/', $full_file_name);
444
-
445
-		$sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'";
446
-		$sql_result = Database::query($sql_query);
447
-		$result = Database::fetch_array($sql_result);
448
-		// Determine which query to execute
449
-		if ($result['number_existing'] > 0) {
450
-			// Entry exists, update
451
-			$query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype'
431
+        if (!$default_visibility) $default_visibility = 'v';
432
+
433
+        // Make sure path is not wrongly formed
434
+        $upload_path = !empty($upload_path) ? "/$upload_path" : '';
435
+
436
+        $endchar = substr($filename, strlen($filename) - 1, 1);
437
+        if ($endchar == "\\" || $endchar == '/') {
438
+            $filename = substr($filename, 0, strlen($filename) - 1);
439
+        }
440
+
441
+        $full_file_name = $upload_path.'/'.$filename;
442
+        $full_file_name = str_replace("//", '/', $full_file_name);
443
+
444
+        $sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'";
445
+        $sql_result = Database::query($sql_query);
446
+        $result = Database::fetch_array($sql_result);
447
+        // Determine which query to execute
448
+        if ($result['number_existing'] > 0) {
449
+            // Entry exists, update
450
+            $query = "UPDATE $glued_table SET path='$full_file_name',visibility='$default_visibility', filetype='$filetype'
452 451
 			          WHERE path='$full_file_name'";
453
-		} else {
454
-			// No entry exists, create new one
455
-			$query = "INSERT INTO $glued_table (path,visibility,filetype)
452
+        } else {
453
+            // No entry exists, create new one
454
+            $query = "INSERT INTO $glued_table (path,visibility,filetype)
456 455
 			          VALUES ('$full_file_name','$default_visibility','$filetype')";
457
-		}
458
-		Database::query($query);
459
-	}
456
+        }
457
+        Database::query($query);
458
+    }
460 459
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 		/* File case */
226 226
 		if (is_file($source)) {
227 227
 			if ($forceMove && !$isWindowsOS && $canExec) {
228
-				exec('mv ' . $source . ' ' . $target . '/' . $file_name);
228
+				exec('mv '.$source.' '.$target.'/'.$file_name);
229 229
 			} else {
230
-				copy($source, $target . '/' . $file_name);
230
+				copy($source, $target.'/'.$file_name);
231 231
 				unlink($source);
232 232
 			}
233 233
 			return true;
@@ -349,17 +349,17 @@  discard block
 block discarded – undo
349 349
 			// Recursive operation if subdirectories exist
350 350
 			$dir_number = sizeof($dir_array);
351 351
 			if ($dir_number > 0) {
352
-				for ($i = 0 ; $i < $dir_number ; $i++) {
352
+				for ($i = 0; $i < $dir_number; $i++) {
353 353
 					$sub_dir_array = FileManager::list_all_directories($dir_array[$i]); // Function recursivity
354 354
 					if (is_array($dir_array) && is_array($sub_dir_array)) {
355
-						$dir_array  =  array_merge($dir_array, $sub_dir_array); // Data merge
355
+						$dir_array = array_merge($dir_array, $sub_dir_array); // Data merge
356 356
 					}
357 357
 				}
358 358
 			}
359
-			$result_array  =  $dir_array;
360
-			chdir($save_dir) ;
359
+			$result_array = $dir_array;
360
+			chdir($save_dir);
361 361
 		}
362
-		return $result_array ;
362
+		return $result_array;
363 363
 	}
364 364
 
365 365
 	/**
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 		$buffer = '';
405 405
 		if (file_exists($file_name)) {
406 406
 			$fp = fopen($file_name, 'rb');
407
-			$buffer = fread ($fp, filesize($file_name));
408
-			fclose ($fp);
407
+			$buffer = fread($fp, filesize($file_name));
408
+			fclose($fp);
409 409
 		}
410 410
 		return $buffer;
411 411
 	}
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,6 +13,8 @@  discard block
 block discarded – undo
13 13
  * @param  - action (string) - action type require : 'delete' or 'update'
14 14
  * @param  - old_path (string) - old path info stored to change
15 15
  * @param  - new_path (string) - new path info to substitute
16
+ * @param string $action
17
+ * @param string $old_path
16 18
  * @desc Update the file or directory path in the document db document table
17 19
  *
18 20
  */
@@ -75,8 +77,8 @@  discard block
 block discarded – undo
75 77
  * Deletes a file or a directory
76 78
  *
77 79
  * @author - Hugues Peeters
78
- * @param  $file (String) - the path of file or directory to delete
79
- * @return boolean - true if the delete succeed, false otherwise.
80
+ * @param  string $file (String) - the path of file or directory to delete
81
+ * @return boolean|null - true if the delete succeed, false otherwise.
80 82
  * @see    - delete() uses check_name_exist() and removeDir() functions
81 83
  */
82 84
 function my_delete($file)
@@ -163,7 +165,7 @@  discard block
 block discarded – undo
163 165
  * @author Hugues Peeters <[email protected]>
164 166
  * @param  string $file_path complete path of the file or the directory
165 167
  * @param  string $new_file_name new name for the file or the directory
166
- * @return boolean true if succeed, false otherwise
168
+ * @return string|false true if succeed, false otherwise
167 169
  * @see rename() uses the check_name_exist() and php2phps() functions
168 170
  */
169 171
 function my_rename($file_path, $new_file_name) {
@@ -209,7 +211,7 @@  discard block
 block discarded – undo
209 211
  * @param  string $target the path of the new area
210 212
  * @param  bool $forceMove Whether to force a move or to make a copy (safer but slower) and then delete the original
211 213
  * @param	bool $moveContent In some cases (including migrations), we need to move the *content* and not the folder itself
212
- * @return bool true if the move succeed, false otherwise.
214
+ * @return boolean|null true if the move succeed, false otherwise.
213 215
  * @see move() uses check_name_exist() and copyDirTo() functions
214 216
  */
215 217
 function move($source, $target, $forceMove = false, $moveContent = false)
Please login to merge, or discard this patch.
main/inc/lib/login_redirection.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,30 +18,30 @@  discard block
 block discarded – undo
18 18
         if (api_is_student() && !api_get_setting('student_page_after_login') == '') {
19 19
             $redirect_url = html_entity_decode(api_get_setting('student_page_after_login'));
20 20
             if ($redirect_url[0] == "/") {
21
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
21
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
22 22
             }
23 23
         }
24 24
         if (api_is_teacher() && !api_get_setting('teacher_page_after_login') == '') {
25 25
             $redirect_url = html_entity_decode(api_get_setting('teacher_page_after_login'));
26 26
             if ($redirect_url[0] == "/") {
27
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
27
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
28 28
             }
29 29
         }
30 30
         if (api_is_drh() && !api_get_setting('drh_page_after_login') == '') {
31 31
             $redirect_url = html_entity_decode(api_get_setting('drh_page_after_login'));
32 32
             if ($redirect_url[0] == "/") {
33
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
33
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
34 34
             }
35 35
         }
36 36
         if (api_is_session_admin() && !api_get_setting('sessionadmin_page_after_login') == '') {
37 37
             $redirect_url = html_entity_decode(api_get_setting('sessionadmin_page_after_login'));
38 38
             if ($redirect_url[0] == "/") {
39
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
39
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
40 40
             }
41 41
         }
42 42
 
43 43
         if (!empty($redirect_url)) {
44
-            header('Location: ' . $redirect_url . $param);
44
+            header('Location: '.$redirect_url.$param);
45 45
             exit();
46 46
         }
47 47
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         if (CustomPages::enabled()) {
50 50
             CustomPages::display(CustomPages::INDEX_LOGGED);
51 51
         }
52
-        header('location: ' . api_get_path(WEB_PATH) . api_get_setting('page_after_login') . $param);
52
+        header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param);
53 53
         exit();
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6022,7 +6022,7 @@
 block discarded – undo
6022 6022
         ]);
6023 6023
     }
6024 6024
 
6025
-	/**
6025
+    /**
6026 6026
      * Get the count of user courses in session
6027 6027
      * @param int $sessionId The session id
6028 6028
      * @return array
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1588,8 +1588,10 @@  discard block
 block discarded – undo
1588 1588
         if (empty($session_visibility)) {
1589 1589
             $session_visibility = $session->getVisibility();
1590 1590
             //default status loaded if empty
1591
-            if (empty($session_visibility))
1592
-                $session_visibility = SESSION_VISIBLE_READ_ONLY; // by default readonly 1
1591
+            if (empty($session_visibility)) {
1592
+                            $session_visibility = SESSION_VISIBLE_READ_ONLY;
1593
+            }
1594
+            // by default readonly 1
1593 1595
         } else {
1594 1596
             if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) {
1595 1597
                 $session_visibility = SESSION_VISIBLE_READ_ONLY;
@@ -2792,10 +2794,11 @@  discard block
 block discarded – undo
2792 2794
                                 c_id = $courseId AND
2793 2795
                                 user_id = $user_id ";
2794 2796
                     $result = Database::query($sql);
2795
-                    if (Database::affected_rows($result) > 0)
2796
-                        return true;
2797
-                    else
2798
-                        return false;
2797
+                    if (Database::affected_rows($result) > 0) {
2798
+                                            return true;
2799
+                    } else {
2800
+                                            return false;
2801
+                    }
2799 2802
                 } else {
2800 2803
                     // The user is not subscribed to the session, so make sure
2801 2804
                     // he isn't subscribed to a course in this session either
@@ -2806,10 +2809,11 @@  discard block
 block discarded – undo
2806 2809
                                 c_id = $courseId AND
2807 2810
                                 user_id = $user_id ";
2808 2811
                     $result = Database::query($sql);
2809
-                    if (Database::affected_rows($result) > 0)
2810
-                        return true;
2811
-                    else
2812
-                        return false;
2812
+                    if (Database::affected_rows($result) > 0) {
2813
+                                            return true;
2814
+                    } else {
2815
+                                            return false;
2816
+                    }
2813 2817
                 }
2814 2818
             } else {
2815 2819
                 // Assign user as a coach to course
Please login to merge, or discard this patch.
Spacing   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                     return $msg;
144 144
                 }
145 145
             } else {
146
-                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'");
146
+                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
147 147
                 if (Database::num_rows($rs)) {
148 148
                     $msg = get_lang('SessionNameAlreadyExists');
149 149
                     return $msg;
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     public static function session_name_exists($name)
257 257
     {
258 258
         $name = Database::escape_string($name);
259
-        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
259
+        $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)."
260 260
                 WHERE name = '$name'";
261 261
         $result = Database::fetch_array(Database::query($sql));
262 262
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             $where .= " AND (
288 288
                             s.session_admin_id = $user_id  OR
289 289
                             sru.user_id = '$user_id' AND
290
-                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
290
+                            sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
291 291
                             )
292 292
                       ";
293 293
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             $where_condition = str_replace('category_name', 'sc.name', $where_condition);
306 306
             $where_condition = str_replace(
307 307
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
308
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
308
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
309 309
                 , $where_condition
310 310
             );
311 311
             $where_condition = str_replace(
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
             $access_url_id = api_get_current_access_url_id();
352 352
             if ($access_url_id != -1) {
353
-                $where.= " AND ar.access_url_id = $access_url_id ";
353
+                $where .= " AND ar.access_url_id = $access_url_id ";
354 354
 
355 355
                 $sql = "SELECT count(id) as total_rows FROM (
356 356
                 SELECT DISTINCT
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
             if (api_is_session_admin() &&
401 401
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
402 402
             ) {
403
-                $where .=" AND s.session_admin_id = $user_id ";
403
+                $where .= " AND s.session_admin_id = $user_id ";
404 404
             }
405 405
         }
406 406
 
407 407
         if (!api_is_platform_admin() && api_is_teacher() &&
408 408
             api_get_setting('allow_teachers_to_create_sessions') == 'true'
409 409
         ) {
410
-            $where .=" AND s.id_coach = $user_id ";
410
+            $where .= " AND s.id_coach = $user_id ";
411 411
         }
412 412
 
413 413
         $extra_field = new ExtraField('session');
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
         $query = "$select FROM $tbl_session s $inject_joins $where $inject_where";
458 458
 
459 459
         if (api_is_multiple_url_enabled()) {
460
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
460
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
461 461
             $access_url_id = api_get_current_access_url_id();
462 462
             if ($access_url_id != -1) {
463
-                $where.= " AND ar.access_url_id = $access_url_id ";
463
+                $where .= " AND ar.access_url_id = $access_url_id ";
464 464
                 $query = "$select
465 465
                         FROM $tbl_session s $inject_joins
466 466
                         INNER JOIN $table_access_url_rel_session ar
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                 INNER JOIN $tbl_lp l ON l.id = v.lp_id
565 565
                 INNER JOIN $tbl_user u ON u.user_id = v.user_id
566 566
                 INNER JOIN $tbl_course c
567
-                WHERE v.session_id = " . $sessionId;
567
+                WHERE v.session_id = ".$sessionId;
568 568
         $result_rows = Database::query($sql);
569 569
         $row = Database::fetch_array($result_rows);
570 570
         $num = $row['total_rows'];
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 
617 617
         $limit = null;
618 618
         if (!empty($options['limit'])) {
619
-            $limit = " LIMIT " . $options['limit'];
619
+            $limit = " LIMIT ".$options['limit'];
620 620
         }
621 621
 
622 622
         if (!empty($options['where'])) {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
         $order = null;
627 627
         if (!empty($options['order'])) {
628
-            $order = " ORDER BY " . $options['order'];
628
+            $order = " ORDER BY ".$options['order'];
629 629
         }
630 630
 
631 631
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -684,13 +684,13 @@  discard block
 block discarded – undo
684 684
             foreach ($lessons as $lesson) {
685 685
                 $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0;
686 686
                 $progress += $data[$lesson['id']];
687
-                $data[$lesson['id']] = $data[$lesson['id']] . '%';
687
+                $data[$lesson['id']] = $data[$lesson['id']].'%';
688 688
                 $count++;
689 689
             }
690 690
             if ($count == 0) {
691 691
                 $data['total'] = 0;
692 692
             } else {
693
-                $data['total'] = round($progress / $count, 2) . '%';
693
+                $data['total'] = round($progress / $count, 2).'%';
694 694
             }
695 695
             $table[] = $data;
696 696
         }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
         $limit = null;
733 733
         if (!empty($options['limit'])) {
734
-            $limit = " LIMIT " . $options['limit'];
734
+            $limit = " LIMIT ".$options['limit'];
735 735
         }
736 736
 
737 737
         if (!empty($options['where'])) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
         $order = null;
742 742
         if (!empty($options['order'])) {
743
-            $order = " ORDER BY " . $options['order'];
743
+            $order = " ORDER BY ".$options['order'];
744 744
         }
745 745
 
746 746
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 
843 843
         $limit = null;
844 844
         if (!empty($options['limit'])) {
845
-            $limit = " LIMIT " . $options['limit'];
845
+            $limit = " LIMIT ".$options['limit'];
846 846
         }
847 847
 
848 848
         if (!empty($options['where'])) {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 
852 852
         $order = null;
853 853
         if (!empty($options['order'])) {
854
-            $order = " ORDER BY " . $options['order'];
854
+            $order = " ORDER BY ".$options['order'];
855 855
         }
856 856
 
857 857
         //TODO, fix create report without session
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
         /**
885 885
          *  Lessons
886 886
          */
887
-        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s ";  //AND session_id = %s
887
+        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
888 888
         $sql_query = sprintf($sql, $course['real_id']);
889 889
         $result = Database::query($sql_query);
890 890
         $arrLesson = array(array());
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
893 893
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
894 894
             } else {
895
-                $arrLesson[$row['session_id']]['lessons_total'] ++;
895
+                $arrLesson[$row['session_id']]['lessons_total']++;
896 896
             }
897 897
         }
898 898
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
                 $course['real_id']
960 960
             );
961 961
             foreach ($user_list as $user_id) {
962
-                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1;
962
+                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
963 963
             }
964 964
         }
965 965
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
             $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']);
1014 1014
             $assignments_left = $assignments_total - $assignments_done;
1015 1015
             if (!empty($assignments_total)) {
1016
-                $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2);
1016
+                $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2);
1017 1017
             } else {
1018 1018
                 $assignments_progress = 0;
1019 1019
             }
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
             $wiki_read = $row['count'];
1044 1044
             $wiki_unread = $wiki_total - $wiki_read;
1045 1045
             if (!empty($wiki_total)) {
1046
-                $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2);
1046
+                $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2);
1047 1047
             } else {
1048 1048
                 $wiki_progress = 0;
1049 1049
             }
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
             $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0);
1053 1053
             $surveys_left = $surveys_total - $surveys_done;
1054 1054
             if (!empty($surveys_total)) {
1055
-                $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2);
1055
+                $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2);
1056 1056
             } else {
1057 1057
                 $surveys_progress = 0;
1058 1058
             }
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
             );
1066 1066
             $forums_left = $forums_total - $forums_done;
1067 1067
             if (!empty($forums_total)) {
1068
-                $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2);
1068
+                $forums_progress = round((($forums_done * 100) / $forums_total), 2);
1069 1069
             } else {
1070 1070
                 $forums_progress = 0;
1071 1071
             }
@@ -1073,58 +1073,58 @@  discard block
 block discarded – undo
1073 1073
             //Overall Total
1074 1074
             $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6;
1075 1075
 
1076
-            $link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user[0] . '&details=true&course=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1077
-            $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1078
-            $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1079
-            $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>';
1080
-            $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1076
+            $link = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user[0].'&details=true&course='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1077
+            $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1078
+            $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1079
+            $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>';
1080
+            $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1081 1081
 
1082 1082
             $table[] = array(
1083 1083
                 'lastname' => $user[1],
1084 1084
                 'firstname' => $user[2],
1085 1085
                 'username' => $user[3],
1086 1086
                 #'profile'   => '',
1087
-                'total' => round($overall_total, 2) . '%',
1088
-                'courses' => sprintf($link, $course_description_progress . '%'),
1089
-                'lessons' => sprintf($link, $lessons_progress . '%'),
1090
-                'exercises' => sprintf($link, $exercises_progress . '%'),
1091
-                'forums' => sprintf($link, $forums_progress . '%'),
1092
-                'homeworks' => sprintf($link, $assignments_progress . '%'),
1093
-                'wikis' => sprintf($link, $wiki_progress . '%'),
1094
-                'surveys' => sprintf($link, $surveys_progress . '%'),
1087
+                'total' => round($overall_total, 2).'%',
1088
+                'courses' => sprintf($link, $course_description_progress.'%'),
1089
+                'lessons' => sprintf($link, $lessons_progress.'%'),
1090
+                'exercises' => sprintf($link, $exercises_progress.'%'),
1091
+                'forums' => sprintf($link, $forums_progress.'%'),
1092
+                'homeworks' => sprintf($link, $assignments_progress.'%'),
1093
+                'wikis' => sprintf($link, $wiki_progress.'%'),
1094
+                'surveys' => sprintf($link, $surveys_progress.'%'),
1095 1095
                 //course description
1096
-                'course_description_progress' => $course_description_progress . '%',
1096
+                'course_description_progress' => $course_description_progress.'%',
1097 1097
                 //lessons
1098 1098
                 'lessons_total' => sprintf($link, $lessons_total),
1099 1099
                 'lessons_done' => sprintf($link, $lessons_done),
1100 1100
                 'lessons_left' => sprintf($link, $lessons_left),
1101
-                'lessons_progress' => sprintf($link, $lessons_progress . '%'),
1101
+                'lessons_progress' => sprintf($link, $lessons_progress.'%'),
1102 1102
                 //exercises
1103 1103
                 'exercises_total' => sprintf($link, $exercises_total),
1104 1104
                 'exercises_done' => sprintf($link, $exercises_done),
1105 1105
                 'exercises_left' => sprintf($link, $exercises_left),
1106
-                'exercises_progress' => sprintf($link, $exercises_progress . '%'),
1106
+                'exercises_progress' => sprintf($link, $exercises_progress.'%'),
1107 1107
                 //forums
1108 1108
                 'forums_total' => sprintf($linkForum, $forums_total),
1109 1109
                 'forums_done' => sprintf($linkForum, $forums_done),
1110 1110
                 'forums_left' => sprintf($linkForum, $forums_left),
1111
-                'forums_progress' => sprintf($linkForum, $forums_progress . '%'),
1111
+                'forums_progress' => sprintf($linkForum, $forums_progress.'%'),
1112 1112
                 //assignments
1113 1113
                 'assignments_total' => sprintf($linkWork, $assignments_total),
1114 1114
                 'assignments_done' => sprintf($linkWork, $assignments_done),
1115 1115
                 'assignments_left' => sprintf($linkWork, $assignments_left),
1116
-                'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'),
1116
+                'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'),
1117 1117
                 //wiki
1118 1118
                 'wiki_total' => sprintf($linkWiki, $wiki_total),
1119 1119
                 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions),
1120 1120
                 'wiki_read' => sprintf($linkWiki, $wiki_read),
1121 1121
                 'wiki_unread' => sprintf($linkWiki, $wiki_unread),
1122
-                'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'),
1122
+                'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'),
1123 1123
                 //survey
1124 1124
                 'surveys_total' => sprintf($linkSurvey, $surveys_total),
1125 1125
                 'surveys_done' => sprintf($linkSurvey, $surveys_done),
1126 1126
                 'surveys_left' => sprintf($linkSurvey, $surveys_left),
1127
-                'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'),
1127
+                'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'),
1128 1128
             );
1129 1129
         }
1130 1130
 
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 
1205 1205
         $limit = null;
1206 1206
         if (!empty($options['limit'])) {
1207
-            $limit = " LIMIT " . $options['limit'];
1207
+            $limit = " LIMIT ".$options['limit'];
1208 1208
         }
1209 1209
 
1210 1210
         if (!empty($options['where'])) {
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 
1214 1214
         $order = null;
1215 1215
         if (!empty($options['order'])) {
1216
-            $order = " ORDER BY " . $options['order'];
1216
+            $order = " ORDER BY ".$options['order'];
1217 1217
         }
1218 1218
 
1219 1219
         //TODO add course name
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
                     " : "
1227 1227
                     u.lastname,
1228 1228
                     u.firstname,
1229
-                ") . "
1229
+                ")."
1230 1230
                 a.logout_course_date,
1231 1231
                 a.counter,
1232 1232
                 c.title,
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
             if (Database::num_rows($result) > 0) {
1309 1309
                 $row = Database::fetch_array($result);
1310 1310
                 $count = $row['count'] + 1;
1311
-                $session_name = $session_name . '_' . $count;
1311
+                $session_name = $session_name.'_'.$count;
1312 1312
                 $result = self::session_name_exists($session_name);
1313 1313
                 if (!$result) {
1314 1314
                     return $session_name;
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
             return false;
1390 1390
         } else {
1391
-            $sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'";
1391
+            $sql = "SELECT id FROM $tbl_session WHERE name='".Database::escape_string($name)."'";
1392 1392
             $rs = Database::query($sql);
1393 1393
             $exists = false;
1394 1394
             while ($row = Database::fetch_array($rs)) {
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
         // Delete users from the session
1755 1755
         if ($empty_users === true) {
1756 1756
             $sql = "DELETE FROM $tbl_session_rel_user
1757
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1757
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1758 1758
             Database::query($sql);
1759 1759
         }
1760 1760
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
             $enreg_user = Database::escape_string($enreg_user);
1766 1766
             $nbr_users++;
1767 1767
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1768
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1768
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1769 1769
             Database::query($sql);
1770 1770
         }
1771 1771
 
@@ -1855,9 +1855,9 @@  discard block
 block discarded – undo
1855 1855
         is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
1856 1856
 
1857 1857
         $statusCondition = null;
1858
-        if (isset($status) && !is_null($status))  {
1858
+        if (isset($status) && !is_null($status)) {
1859 1859
             $status = intval($status);
1860
-            $statusCondition  = " AND status = $status";
1860
+            $statusCondition = " AND status = $status";
1861 1861
         }
1862 1862
 
1863 1863
         foreach ($userList as $userId) {
@@ -1989,7 +1989,7 @@  discard block
 block discarded – undo
1989 1989
             if (empty($count)) {
1990 1990
                 // If user is not registered to a session then add it.
1991 1991
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
1992
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
1992
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
1993 1993
                 Database::query($sql);
1994 1994
 
1995 1995
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2032,7 +2032,7 @@  discard block
 block discarded – undo
2032 2032
 		               WHERE
2033 2033
                             session_id = $session_id AND
2034 2034
 		                    user_id = $user_id AND
2035
-		                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2035
+		                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2036 2036
         $result = Database::query($delete_sql);
2037 2037
         $return = Database::affected_rows($result);
2038 2038
 
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
                 FROM $tbl_session_rel_user
2117 2117
                 WHERE
2118 2118
                     session_id = $sessionId AND
2119
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2119
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2120 2120
         $result = Database::query($sql);
2121 2121
         $user_list = Database::store_result($result);
2122 2122
 
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 
2129 2129
                     $sql = "DELETE FROM $tbl_session_rel_course
2130 2130
                             WHERE
2131
-                                c_id = " . $existingCourse['c_id'] . " AND
2131
+                                c_id = ".$existingCourse['c_id']." AND
2132 2132
                                 session_id = $sessionId";
2133 2133
                     Database::query($sql);
2134 2134
 
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2192 2192
 
2193 2193
                             $cat->set_session_id($sessionId);
2194
-                            $oldCategoryId= $cat->get_id();
2194
+                            $oldCategoryId = $cat->get_id();
2195 2195
                             $newId = $cat->add();
2196 2196
                             $newCategoryIdList[$oldCategoryId] = $newId;
2197 2197
 
@@ -2379,8 +2379,8 @@  discard block
 block discarded – undo
2379 2379
         $return_value = false;
2380 2380
         $sql = "SELECT c_id FROM $tbl_session_course
2381 2381
                 WHERE
2382
-                  session_id = " . intval($session_id) . " AND
2383
-                  c_id = " . intval($courseId) . "";
2382
+                  session_id = ".intval($session_id)." AND
2383
+                  c_id = " . intval($courseId)."";
2384 2384
         $result = Database::query($sql);
2385 2385
         $num = Database::num_rows($result);
2386 2386
         if ($num > 0) {
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
         }
2404 2404
 
2405 2405
         $sql = 'SELECT *
2406
-		        FROM ' . $tbl_session . '
2407
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2406
+		        FROM ' . $tbl_session.'
2407
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2408 2408
         $result = Database::query($sql);
2409 2409
         $num = Database::num_rows($result);
2410 2410
         if ($num > 0) {
@@ -2444,8 +2444,8 @@  discard block
 block discarded – undo
2444 2444
         $month_end = intval($smonth_end);
2445 2445
         $day_end = intval($sday_end);
2446 2446
 
2447
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2448
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2447
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2448
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2449 2449
 
2450 2450
         if (empty($name)) {
2451 2451
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
         $month_end = intval($smonth_end);
2518 2518
         $day_end = intval($sday_end);
2519 2519
         $id = intval($id);
2520
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2521
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2520
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2521
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2522 2522
 
2523 2523
         if (empty($name)) {
2524 2524
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2538,13 +2538,13 @@  discard block
 block discarded – undo
2538 2538
         if ($date_end <> null) {
2539 2539
             $sql = "UPDATE $tbl_session_category
2540 2540
                     SET
2541
-                        name = '" . Database::escape_string($name) . "',
2541
+                        name = '".Database::escape_string($name)."',
2542 2542
                         date_start = '$date_start' ,
2543 2543
                         date_end = '$date_end'
2544 2544
                     WHERE id= $id";
2545 2545
         } else {
2546 2546
             $sql = "UPDATE $tbl_session_category SET
2547
-                        name = '" . Database::escape_string($name) . "',
2547
+                        name = '".Database::escape_string($name)."',
2548 2548
                         date_start = '$date_start',
2549 2549
                         date_end = NULL
2550 2550
                     WHERE id= $id";
@@ -2574,10 +2574,10 @@  discard block
 block discarded – undo
2574 2574
 
2575 2575
         //Setting session_category_id to 0
2576 2576
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2577
-                WHERE session_category_id IN (" . $id_checked . ")";
2577
+                WHERE session_category_id IN (".$id_checked.")";
2578 2578
         Database::query($sql);
2579 2579
 
2580
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2580
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2581 2581
         $result = Database::query($sql);
2582 2582
         while ($rows = Database::fetch_array($result)) {
2583 2583
             $session_id = $rows['id'];
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
                 }
2590 2590
             }
2591 2591
         }
2592
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2592
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2593 2593
         Database::query($sql);
2594 2594
 
2595 2595
         // Add event to system log
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
                 $value = Database::escape_string($options['value']);
2663 2663
                 $sql_query .= ' AND ';
2664 2664
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2665
-                    $sql_query .= $field . " $operator '" . $value . "'";
2665
+                    $sql_query .= $field." $operator '".$value."'";
2666 2666
                 }
2667 2667
             }
2668 2668
         }
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
     {
2730 2730
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2731 2731
         $id = api_get_current_access_url_id();
2732
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2733
-                WHERE access_url_id = ' . $id . '
2732
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2733
+                WHERE access_url_id = ' . $id.'
2734 2734
                 ORDER BY name ASC';
2735 2735
         $result = Database::query($sql);
2736 2736
         if (Database::num_rows($result) > 0) {
@@ -2909,11 +2909,11 @@  discard block
 block discarded – undo
2909 2909
                         INNER JOIN $tbl_session_rel_access_url a ON (a.session_id = s.session_id)
2910 2910
                         WHERE
2911 2911
                             s.user_id = $userId AND
2912
-                            relation_type=" . SESSION_RELATION_TYPE_RRHH . " AND
2913
-                            access_url_id = " . api_get_current_access_url_id() . "";
2912
+                            relation_type=".SESSION_RELATION_TYPE_RRHH." AND
2913
+                            access_url_id = " . api_get_current_access_url_id()."";
2914 2914
             } else {
2915 2915
                 $sql = "SELECT session_id FROM $tbl_session_rel_user s
2916
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH . "";
2916
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH."";
2917 2917
             }
2918 2918
             $result = Database::query($sql);
2919 2919
 
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
                             WHERE
2924 2924
                                 session_id = {$row['session_id']} AND
2925 2925
                                 user_id = $userId AND
2926
-                                relation_type=" . SESSION_RELATION_TYPE_RRHH . " ";
2926
+                                relation_type=".SESSION_RELATION_TYPE_RRHH." ";
2927 2927
                     Database::query($sql);
2928 2928
                 }
2929 2929
             }
@@ -2937,8 +2937,8 @@  discard block
 block discarded – undo
2937 2937
                         VALUES (
2938 2938
                             $session_id,
2939 2939
                             $userId,
2940
-                            '" . SESSION_RELATION_TYPE_RRHH . "',
2941
-                            '" . api_get_utc_datetime() . "'
2940
+                            '".SESSION_RELATION_TYPE_RRHH."',
2941
+                            '" . api_get_utc_datetime()."'
2942 2942
                         )";
2943 2943
 
2944 2944
                 Database::query($sql);
@@ -2980,8 +2980,8 @@  discard block
 block discarded – undo
2980 2980
                     WHERE
2981 2981
                         sru.user_id = '$userId' AND
2982 2982
                         sru.session_id = '$sessionId' AND
2983
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
2984
-                        access_url_id = " . api_get_current_access_url_id() . "
2983
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
2984
+                        access_url_id = " . api_get_current_access_url_id()."
2985 2985
                         ";
2986 2986
         } else {
2987 2987
             $sql = "$select FROM $tbl_session s
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
                         sru.session_id = s.id AND
2991 2991
                         sru.user_id = '$userId' AND
2992 2992
                         sru.session_id = '$sessionId' AND
2993
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
2993
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
2994 2994
                     ";
2995 2995
         }
2996 2996
 
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
 
3089 3089
         $limitCondition = null;
3090 3090
         if (!empty($start) && !empty($limit)) {
3091
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3091
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3092 3092
         }
3093 3093
 
3094 3094
         if (empty($orderCondition)) {
@@ -3166,26 +3166,26 @@  discard block
 block discarded – undo
3166 3166
 
3167 3167
         $sessions = array();
3168 3168
         if (Database::num_rows($result) > 0) {
3169
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3170
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3169
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3170
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3171 3171
             $imgPath = Display::returnIconPath('session_default_small.png');
3172 3172
 
3173 3173
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3174
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3174
+            $sql = "SELECT id FROM ".$tableExtraFields."
3175 3175
                     WHERE extra_field_type = 3 AND variable='image'";
3176 3176
             $resultField = Database::query($sql);
3177 3177
             $imageFieldId = Database::fetch_assoc($resultField);
3178 3178
 
3179 3179
             while ($row = Database::fetch_array($result)) {
3180 3180
 
3181
-                $row['image'] =  null;
3182
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3181
+                $row['image'] = null;
3182
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3183 3183
 
3184 3184
                 if (is_file($sessionImage)) {
3185
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3185
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3186 3186
                     $row['image'] = $sessionImage;
3187 3187
                 } else {
3188
-                    $row['image'] =  $imgPath;
3188
+                    $row['image'] = $imgPath;
3189 3189
                 }
3190 3190
 
3191 3191
                 $sessions[$row['id']] = $row;
@@ -3255,7 +3255,7 @@  discard block
 block discarded – undo
3255 3255
                 return intval($count[0]);
3256 3256
             }
3257 3257
 
3258
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3258
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3259 3259
                 $courses[$row['real_id']] = $row;
3260 3260
             }
3261 3261
         }
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
         }
3300 3300
 
3301 3301
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3302
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3302
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3303 3303
 
3304 3304
         if ($getCount) {
3305 3305
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3324,7 +3324,7 @@  discard block
 block discarded – undo
3324 3324
 		        ";
3325 3325
         if ($getCount) {
3326 3326
             $result = Database::query($sql);
3327
-            $row = Database::fetch_array($result,'ASSOC');
3327
+            $row = Database::fetch_array($result, 'ASSOC');
3328 3328
             return $row['count'];
3329 3329
         }
3330 3330
 
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
         $courses = array();
3340 3340
 
3341 3341
         if ($num_rows > 0) {
3342
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3342
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3343 3343
                 $courses[$row['id']] = $row;
3344 3344
             }
3345 3345
         }
@@ -3417,7 +3417,7 @@  discard block
 block discarded – undo
3417 3417
         $result = Database::query($sql);
3418 3418
         $num_rows = Database::num_rows($result);
3419 3419
         if ($num_rows > 0) {
3420
-            $row = Database::fetch_array($result,'ASSOC');
3420
+            $row = Database::fetch_array($result, 'ASSOC');
3421 3421
             return $row['count'];
3422 3422
         }
3423 3423
 
@@ -3529,9 +3529,9 @@  discard block
 block discarded – undo
3529 3529
 
3530 3530
             if ($access_url_id != -1) {
3531 3531
                 $sql = 'SELECT DISTINCT session.*
3532
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3532
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3533 3533
                     ON (session.id = session_rel_url.session_id)
3534
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3534
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3535 3535
             }
3536 3536
         }
3537 3537
         $sql .= ' ORDER by name';
@@ -3565,8 +3565,8 @@  discard block
 block discarded – undo
3565 3565
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3566 3566
                 WHERE
3567 3567
                     session_rcru.user_id = user.user_id AND
3568
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3569
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3568
+                    session_rcru.session_id = '".intval($session_id)."' AND
3569
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3570 3570
                     user.user_id = " . intval($user_id);
3571 3571
 
3572 3572
         $result = Database::query($sql);
@@ -3597,8 +3597,8 @@  discard block
 block discarded – undo
3597 3597
         $sql = "SELECT session_rcru.status
3598 3598
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3599 3599
                 WHERE session_rcru.user_id = user.user_id AND
3600
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3601
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3600
+                    session_rcru.session_id = '".intval($session_id)."' AND
3601
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3602 3602
                     user.user_id = " . intval($user_id);
3603 3603
         $result = Database::query($sql);
3604 3604
         $status = false;
@@ -3675,7 +3675,7 @@  discard block
 block discarded – undo
3675 3675
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3676 3676
         $now = time() - date('Z');
3677 3677
         // Timestamp in one month
3678
-        $inOneMonth = $now + (30*24*3600);
3678
+        $inOneMonth = $now + (30 * 24 * 3600);
3679 3679
         $inOneMonth = api_get_local_time($inOneMonth);
3680 3680
         if (api_strtotime($s['access_start_date']) < $now) {
3681 3681
             $s['access_start_date'] = api_get_local_time($now);
@@ -3697,16 +3697,16 @@  discard block
 block discarded – undo
3697 3697
         }
3698 3698
         // Now try to create the session
3699 3699
         $sid = self::create_session(
3700
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3700
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3701 3701
             $s['access_start_date'],
3702 3702
             $s['access_end_date'],
3703 3703
             $s['display_start_date'],
3704 3704
             $s['display_end_date'],
3705 3705
             $s['coach_access_start_date'],
3706 3706
             $s['coach_access_end_date'],
3707
-            (int)$s['id_coach'],
3707
+            (int) $s['id_coach'],
3708 3708
             $s['session_category_id'],
3709
-            (int)$s['visibility'],
3709
+            (int) $s['visibility'],
3710 3710
             true
3711 3711
         );
3712 3712
 
@@ -3820,7 +3820,7 @@  discard block
 block discarded – undo
3820 3820
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
3821 3821
         $sql = "SELECT DISTINCT id
3822 3822
 	         	FROM $session_table
3823
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
3823
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
3824 3824
         $result = Database::query($sql);
3825 3825
         if ($result && Database::num_rows($result)) {
3826 3826
             return true;
@@ -3839,7 +3839,7 @@  discard block
 block discarded – undo
3839 3839
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3840 3840
         $sql = "SELECT count(id) FROM $session_table s";
3841 3841
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
3842
-            $sql .= ", $access_url_rel_session_table u " .
3842
+            $sql .= ", $access_url_rel_session_table u ".
3843 3843
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
3844 3844
         }
3845 3845
         $res = Database::query($sql);
@@ -4090,7 +4090,7 @@  discard block
 block discarded – undo
4090 4090
 
4091 4091
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4092 4092
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4093
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4093
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4094 4094
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4095 4095
 
4096 4096
         $sessions = array();
@@ -4184,10 +4184,10 @@  discard block
 block discarded – undo
4184 4184
                     $suffix = null;
4185 4185
                     while (!$unique_name) {
4186 4186
                         if ($i > 1) {
4187
-                            $suffix = ' - ' . $i;
4187
+                            $suffix = ' - '.$i;
4188 4188
                         }
4189
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4190
-                                WHERE name="' . $session_name . $suffix . '"';
4189
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4190
+                                WHERE name="' . $session_name.$suffix.'"';
4191 4191
                         $rs = Database::query($sql);
4192 4192
 
4193 4193
                         if (Database::result($rs, 0, 0)) {
@@ -4205,13 +4205,13 @@  discard block
 block discarded – undo
4205 4205
 
4206 4206
                     // Creating the session.
4207 4207
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4208
-                            name = '" . $session_name . "',
4208
+                            name = '".$session_name."',
4209 4209
                             id_coach = '$coach_id',
4210 4210
                             access_start_date = '$date_start',
4211 4211
                             access_end_date = '$date_end',
4212 4212
                             visibility = '$visibilityAfterExpirationPerSession',
4213 4213
                             $sessionCondition
4214
-                            session_admin_id = " . intval($defaultUserId) . $extraParameters . $extraSessionParameters;
4214
+                            session_admin_id = ".intval($defaultUserId).$extraParameters.$extraSessionParameters;
4215 4215
                     Database::query($sql);
4216 4216
 
4217 4217
                     $session_id = Database::insert_id();
@@ -4251,7 +4251,7 @@  discard block
 block discarded – undo
4251 4251
                                 access_start_date = '$date_start',
4252 4252
                                 access_end_date = '$date_end',
4253 4253
                                 visibility = '$visibilityAfterExpirationPerSession',
4254
-                                session_category_id = '$session_category_id' " . $extraParameters . $extraSessionParameters;
4254
+                                session_category_id = '$session_category_id' ".$extraParameters.$extraSessionParameters;
4255 4255
 
4256 4256
                         Database::query($sql);
4257 4257
 
@@ -4271,7 +4271,7 @@  discard block
 block discarded – undo
4271 4271
 
4272 4272
                             // Delete session-user relation only for students
4273 4273
                             $sql = "DELETE FROM $tbl_session_user
4274
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4274
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4275 4275
                             Database::query($sql);
4276 4276
 
4277 4277
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4359,7 +4359,7 @@  discard block
 block discarded – undo
4359 4359
 
4360 4360
                             // Delete session-user relation only for students
4361 4361
                             $sql = "DELETE FROM $tbl_session_user
4362
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4362
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4363 4363
                             Database::query($sql);
4364 4364
 
4365 4365
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4402,7 +4402,7 @@  discard block
 block discarded – undo
4402 4402
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4403 4403
                                     user_id = '$user_id',
4404 4404
                                     session_id = '$session_id',
4405
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4405
+                                    registered_at = '".api_get_utc_datetime()."'";
4406 4406
                             Database::query($sql);
4407 4407
                             if ($debug) {
4408 4408
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5040,7 +5040,7 @@  discard block
 block discarded – undo
5040 5040
 
5041 5041
         if (!empty($lastConnectionDate)) {
5042 5042
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5043
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5043
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5044 5044
         }
5045 5045
 
5046 5046
         if (!empty($keyword)) {
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
         $result = Database::query($sql);
5100 5100
         $result = Database::store_result($result);
5101 5101
 
5102
-        return $result ;
5102
+        return $result;
5103 5103
     }
5104 5104
 
5105 5105
     /**
@@ -5159,7 +5159,7 @@  discard block
 block discarded – undo
5159 5159
                     $userToString = null;
5160 5160
                     foreach ($userList as $userInfo) {
5161 5161
                         $newUserList[] = $userInfo['user_id'];
5162
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5162
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5163 5163
                     }
5164 5164
 
5165 5165
                     if (!empty($sessionsDestination)) {
@@ -5172,7 +5172,7 @@  discard block
 block discarded – undo
5172 5172
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5173 5173
                                 continue;
5174 5174
                             }
5175
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5175
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5176 5176
                             SessionManager::suscribe_users_to_session(
5177 5177
                                 $sessionDestinationId,
5178 5178
                                 $newUserList,
@@ -5223,7 +5223,7 @@  discard block
 block discarded – undo
5223 5223
                 }
5224 5224
             }
5225 5225
         }
5226
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5226
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5227 5227
 
5228 5228
         $htmlResult = null;
5229 5229
 
@@ -5238,7 +5238,7 @@  discard block
 block discarded – undo
5238 5238
                     $sessionInfo = self::fetch($sessionId);
5239 5239
                     $htmlResult .= '<br />';
5240 5240
                     $htmlResult .= Display::url(
5241
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5241
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5242 5242
                     );
5243 5243
                     $teacherList = array();
5244 5244
                     foreach ($coachList as $coachId) {
@@ -5351,7 +5351,7 @@  discard block
 block discarded – undo
5351 5351
                 }
5352 5352
 
5353 5353
                 $sessionIdList = array_map('intval', $sessionIdList);
5354
-                $sessionToString = implode("', '",  $sessionIdList);
5354
+                $sessionToString = implode("', '", $sessionIdList);
5355 5355
 
5356 5356
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5357 5357
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5363,7 +5363,7 @@  discard block
 block discarded – undo
5363 5363
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5364 5364
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5365 5365
                 $result = Database::query($sql);
5366
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5366
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5367 5367
                     $teacherListId[$row['user_id']] = $row['user_id'];
5368 5368
                 }
5369 5369
             } else {
@@ -5438,7 +5438,7 @@  discard block
 block discarded – undo
5438 5438
         $toolList = self::getCourseToolToBeManaged();
5439 5439
 
5440 5440
         foreach ($toolList as $tool) {
5441
-            $method = 'add' . $tool;
5441
+            $method = 'add'.$tool;
5442 5442
             if (method_exists(get_class(), $method)) {
5443 5443
                 self::$method($sessionId, $courseId);
5444 5444
             }
@@ -5457,7 +5457,7 @@  discard block
 block discarded – undo
5457 5457
         $toolList = self::getCourseToolToBeManaged();
5458 5458
 
5459 5459
         foreach ($toolList as $tool) {
5460
-            $method = 'remove' . $tool;
5460
+            $method = 'remove'.$tool;
5461 5461
             if (method_exists(get_class(), $method)) {
5462 5462
                 self::$method($sessionId, $courseId);
5463 5463
             }
@@ -5575,18 +5575,18 @@  discard block
 block discarded – undo
5575 5575
                         }
5576 5576
                     }
5577 5577
 
5578
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5578
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5579 5579
 
5580 5580
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5581
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5581
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5582 5582
                         continue;
5583 5583
                     }
5584 5584
 
5585 5585
                     if (!empty($sessionList)) {
5586
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5587
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5586
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5587
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5588 5588
                     } else {
5589
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5589
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5590 5590
                     }
5591 5591
                 }
5592 5592
             }
@@ -5766,8 +5766,8 @@  discard block
 block discarded – undo
5766 5766
 
5767 5767
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
5768 5768
 
5769
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
5770
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
5769
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
5770
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
5771 5771
 
5772 5772
         return $leftDays;
5773 5773
     }
@@ -6049,7 +6049,7 @@  discard block
 block discarded – undo
6049 6049
         $sql = "SELECT COUNT(1) as count, u.id, scu.status status_in_session, u.status user_status
6050 6050
                 FROM $tableSessionRelCourseRelUser scu
6051 6051
                 INNER JOIN $tableUser u ON scu.user_id = u.id
6052
-                WHERE scu.session_id = " . intval($sessionId) ."
6052
+                WHERE scu.session_id = ".intval($sessionId)."
6053 6053
                 GROUP BY u.id";
6054 6054
 
6055 6055
         $result = Database::query($sql);
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6085 6085
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6086 6086
             // Join session field and session field values tables
6087
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6087
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6088 6088
             $fieldsArray = array();
6089 6089
             foreach ($extraFields as $field) {
6090 6090
                 $fieldsArray[] = Database::escape_string($field);
@@ -6127,14 +6127,14 @@  discard block
 block discarded – undo
6127 6127
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6128 6128
                     $whereParams .= ', ?';
6129 6129
                 }
6130
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6131
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6130
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6131
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6132 6132
             }
6133 6133
             // Get session fields
6134 6134
             $extraField = new ExtraField('session');
6135 6135
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6136 6136
             $fieldsList = $extraField->get_all(array(
6137
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6137
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6138 6138
             ));
6139 6139
             // Index session fields
6140 6140
             foreach ($fieldsList as $field) {
@@ -6143,7 +6143,7 @@  discard block
 block discarded – undo
6143 6143
             // Get session field values
6144 6144
             $extra = new ExtraFieldValue('session');
6145 6145
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6146
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6146
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6147 6147
             // Add session fields values to session list
6148 6148
             foreach ($sessionList as $id => &$session) {
6149 6149
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6196,7 +6196,7 @@  discard block
 block discarded – undo
6196 6196
             // Check the result
6197 6197
             if ($result < 1) {
6198 6198
                 // If not found any result, update error message
6199
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6199
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6200 6200
             } elseif (count($result) > 1 && !$force) {
6201 6201
                 // If found more than one result and force is disabled, update error message
6202 6202
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6255,7 +6255,7 @@  discard block
 block discarded – undo
6255 6255
             // Check if session list query had result
6256 6256
             if (!empty($sessionList)) {
6257 6257
                 // implode all session id
6258
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6258
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6259 6259
                 // Get all field variables
6260 6260
                 $sessionFieldList = Database::select(
6261 6261
                     'id, variable',
@@ -6342,7 +6342,7 @@  discard block
 block discarded – undo
6342 6342
                 return $sessionList;
6343 6343
             } else {
6344 6344
                 // Not found result, update error message
6345
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6345
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6346 6346
             }
6347 6347
         }
6348 6348
 
@@ -6446,7 +6446,7 @@  discard block
 block discarded – undo
6446 6446
 
6447 6447
         $sessionExtraField = new ExtraField('session');
6448 6448
         $fieldList = $sessionExtraField->get_all(array(
6449
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6449
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6450 6450
         ));
6451 6451
 
6452 6452
         $fields = array();
@@ -6460,7 +6460,7 @@  discard block
 block discarded – undo
6460 6460
         $extra = new ExtraFieldValue('session');
6461 6461
         $sessionFieldValueList = $extra->get_all(
6462 6462
             array(
6463
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6463
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6464 6464
             )
6465 6465
         );
6466 6466
 
@@ -6531,7 +6531,7 @@  discard block
 block discarded – undo
6531 6531
                 FROM $sessionTable s
6532 6532
                 INNER JOIN $sessionUserTable sru ON s.id = sru.id_session
6533 6533
                 WHERE
6534
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6534
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6535 6535
                     AND sru.relation_type = 0
6536 6536
                 )";
6537 6537
 
@@ -6547,7 +6547,7 @@  discard block
 block discarded – undo
6547 6547
                         WHERE
6548 6548
                             srau.access_url_id = $accessUrlId
6549 6549
                             AND (
6550
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6550
+                                sru.id_user IN (".implode(', ', $userIdList).")
6551 6551
                                 AND sru.relation_type = 0
6552 6552
                             )";
6553 6553
             }
@@ -6568,7 +6568,7 @@  discard block
 block discarded – undo
6568 6568
      */
6569 6569
     public static function getSessionVisibility($sessionInfo)
6570 6570
     {
6571
-        switch($sessionInfo['visibility']) {
6571
+        switch ($sessionInfo['visibility']) {
6572 6572
             case 1:
6573 6573
                 return get_lang('ReadOnly');
6574 6574
             case 2:
@@ -6599,7 +6599,7 @@  discard block
 block discarded – undo
6599 6599
 
6600 6600
         $result = '';
6601 6601
         if (!empty($startDateToLocal) && !empty($endDateToLocal)) {
6602
-            $result =  sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6602
+            $result = sprintf(get_lang('FromDateXToDateY'), $startDateToLocal, $endDateToLocal);
6603 6603
         } else {
6604 6604
             if (!empty($startDateToLocal)) {
6605 6605
                 $result = get_lang('From').' '.$startDateToLocal;
@@ -6742,7 +6742,7 @@  discard block
 block discarded – undo
6742 6742
                     get_lang('CoachName'),
6743 6743
                     null,
6744 6744
                     [
6745
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
6745
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
6746 6746
                         'width' => '100%',
6747 6747
                     ]
6748 6748
                 );
@@ -6753,7 +6753,7 @@  discard block
 block discarded – undo
6753 6753
         $form->addHtml('<div id="ajax_list_coachs"></div>');
6754 6754
 
6755 6755
         $form->addButtonAdvancedSettings('advanced_params');
6756
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
6756
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
6757 6757
 
6758 6758
         $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
6759 6759
             'id' => 'session_category'
@@ -6891,7 +6891,7 @@  discard block
 block discarded – undo
6891 6891
         $extra_field = new ExtraField('session');
6892 6892
         $extra = $extra_field->addElements($form, $sessionId);
6893 6893
 
6894
-        $form->addElement('html','</div>');
6894
+        $form->addElement('html', '</div>');
6895 6895
 
6896 6896
         $js = $extra['jquery_ready_content'];
6897 6897
 
@@ -6922,16 +6922,16 @@  discard block
 block discarded – undo
6922 6922
         if (api_is_session_admin() &&
6923 6923
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
6924 6924
         ) {
6925
-            $where.=" WHERE s.session_admin_id = $user_id ";
6925
+            $where .= " WHERE s.session_admin_id = $user_id ";
6926 6926
         }
6927 6927
 
6928 6928
         if (!empty($options['where'])) {
6929 6929
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
6930
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
6930
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
6931 6931
 
6932 6932
             $options['where'] = str_replace(
6933 6933
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
6934
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
6934
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
6935 6935
                 , $options['where']
6936 6936
             );
6937 6937
 
@@ -6973,10 +6973,10 @@  discard block
 block discarded – undo
6973 6973
                        $where ";
6974 6974
 
6975 6975
         if (api_is_multiple_url_enabled()) {
6976
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6976
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
6977 6977
             $access_url_id = api_get_current_access_url_id();
6978 6978
             if ($access_url_id != -1) {
6979
-                $where.= " AND ar.access_url_id = $access_url_id ";
6979
+                $where .= " AND ar.access_url_id = $access_url_id ";
6980 6980
 
6981 6981
                 $query_rows = "SELECT count(*) as total_rows
6982 6982
                                FROM $tbl_session s
@@ -7021,12 +7021,12 @@  discard block
 block discarded – undo
7021 7021
                     //get_lang('CourseTitle'),
7022 7022
                     get_lang('Visibility'),
7023 7023
                 );
7024
-                $column_model = array (
7025
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7026
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7027
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7028
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7029
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7024
+                $column_model = array(
7025
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7026
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7027
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7028
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7029
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7030 7030
                 );
7031 7031
                 break;
7032 7032
             case 'complete':
@@ -7039,12 +7039,12 @@  discard block
 block discarded – undo
7039 7039
                     get_lang('Visibility'),
7040 7040
                     get_lang('CourseTitle'),
7041 7041
                 );
7042
-                $column_model = array (
7043
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7044
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7045
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7046
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7047
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7042
+                $column_model = array(
7043
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7044
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7045
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7046
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7047
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7048 7048
                         // for the bottom bar
7049 7049
                         'searchoptions' => array(
7050 7050
                             'defaultValue'  => '1',
@@ -7052,8 +7052,8 @@  discard block
 block discarded – undo
7052 7052
                         // for the top bar
7053 7053
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7054 7054
                     ),
7055
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7056
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7055
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7056
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7057 7057
                 );
7058 7058
                 break;
7059 7059
         }
@@ -7062,14 +7062,14 @@  discard block
 block discarded – undo
7062 7062
         $session_field = new ExtraField('session');
7063 7063
         $rules = $session_field->getRules($columns, $column_model);
7064 7064
 
7065
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7065
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7066 7066
         $columns[] = get_lang('Actions');
7067 7067
 
7068 7068
         foreach ($column_model as $col_model) {
7069 7069
             $simple_column_name[] = $col_model['name'];
7070 7070
         }
7071 7071
 
7072
-        $return_array =  array(
7072
+        $return_array = array(
7073 7073
             'columns' => $columns,
7074 7074
             'column_model' => $column_model,
7075 7075
             'rules' => $rules,
@@ -7158,7 +7158,7 @@  discard block
 block discarded – undo
7158 7158
             if (api_is_session_admin() &&
7159 7159
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7160 7160
             ) {
7161
-                $where.=" AND s.session_admin_id = $user_id ";
7161
+                $where .= " AND s.session_admin_id = $user_id ";
7162 7162
             }
7163 7163
         }
7164 7164
 
@@ -7241,11 +7241,11 @@  discard block
 block discarded – undo
7241 7241
             }
7242 7242
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7243 7243
 
7244
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7244
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7245 7245
 
7246 7246
             $options['where'] = str_replace(
7247 7247
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7248
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7248
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7249 7249
                 , $options['where']
7250 7250
             );
7251 7251
 
@@ -7280,10 +7280,10 @@  discard block
 block discarded – undo
7280 7280
             $where;
7281 7281
 
7282 7282
         if (api_is_multiple_url_enabled()) {
7283
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7283
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7284 7284
             $access_url_id = api_get_current_access_url_id();
7285 7285
             if ($access_url_id != -1) {
7286
-                $where.= " AND ar.access_url_id = $access_url_id ";
7286
+                $where .= " AND ar.access_url_id = $access_url_id ";
7287 7287
                 $query = "$select
7288 7288
                     FROM $tbl_session s
7289 7289
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7310,7 +7310,7 @@  discard block
 block discarded – undo
7310 7310
         $formatted_sessions = array();
7311 7311
 
7312 7312
         if (Database::num_rows($result)) {
7313
-            $sessions   = Database::store_result($result, 'ASSOC');
7313
+            $sessions = Database::store_result($result, 'ASSOC');
7314 7314
             foreach ($sessions as $session) {
7315 7315
                 $session_id = $session['id'];
7316 7316
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7325,14 +7325,14 @@  discard block
 block discarded – undo
7325 7325
 
7326 7326
                 switch ($session['visibility']) {
7327 7327
                     case SESSION_VISIBLE_READ_ONLY: //1
7328
-                        $session['visibility'] =  get_lang('ReadOnly');
7328
+                        $session['visibility'] = get_lang('ReadOnly');
7329 7329
                         break;
7330 7330
                     case SESSION_VISIBLE:           //2
7331 7331
                     case SESSION_AVAILABLE:         //4
7332
-                        $session['visibility'] =  get_lang('Visible');
7332
+                        $session['visibility'] = get_lang('Visible');
7333 7333
                         break;
7334 7334
                     case SESSION_INVISIBLE:         //3
7335
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7335
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7336 7336
                         break;
7337 7337
                 }
7338 7338
 
@@ -7408,7 +7408,7 @@  discard block
 block discarded – undo
7408 7408
         if (empty($session)) {
7409 7409
             return false;
7410 7410
         }
7411
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7411
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7412 7412
     }
7413 7413
 
7414 7414
     /**
@@ -7426,7 +7426,7 @@  discard block
 block discarded – undo
7426 7426
             return false;
7427 7427
         }
7428 7428
         if (empty($courseId)) {
7429
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7429
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7430 7430
         } else {
7431 7431
             $courseInfo = api_get_course_info_by_id($courseId);
7432 7432
             if ($courseInfo) {
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
             // sort $listCat by catSessionName
7673 7673
             usort($listCat, 'self::compareBySessionName');
7674 7674
             // in each catSession sort sessionList by sessionName
7675
-            foreach($listCat as $i => $listCatSessionInfo) {
7675
+            foreach ($listCat as $i => $listCatSessionInfo) {
7676 7676
                 $listSessionList = $listCatSessionInfo['sessionList'];
7677 7677
                 usort($listSessionList, 'self::compareCatSessionInfo');
7678 7678
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -7687,8 +7687,8 @@  discard block
 block discarded – undo
7687 7687
             );
7688 7688
 
7689 7689
             $userCatId = intval($userCatId);
7690
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
7691
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
7690
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
7691
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
7692 7692
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
7693 7693
         }
7694 7694
 
@@ -7714,7 +7714,7 @@  discard block
 block discarded – undo
7714 7714
     {
7715 7715
         if ($listA['sessionName'] == $listB['sessionName']) {
7716 7716
             return 0;
7717
-        } else if($listA['sessionName'] > $listB['sessionName']) {
7717
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
7718 7718
             return 1;
7719 7719
         } else {
7720 7720
             return -1;
@@ -7734,7 +7734,7 @@  discard block
 block discarded – undo
7734 7734
             return 1;
7735 7735
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
7736 7736
             return 0;
7737
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
7737
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
7738 7738
             return 1;
7739 7739
         } else {
7740 7740
             return -1;
@@ -7750,7 +7750,7 @@  discard block
 block discarded – undo
7750 7750
     {
7751 7751
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
7752 7752
             return 0;
7753
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7753
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7754 7754
             return 1;
7755 7755
         } else {
7756 7756
             return -1;
@@ -7766,7 +7766,7 @@  discard block
 block discarded – undo
7766 7766
     {
7767 7767
         if ($listA['title'] == $listB['title']) {
7768 7768
             return 0;
7769
-        } else if($listA['title'] > $listB['title']) {
7769
+        } else if ($listA['title'] > $listB['title']) {
7770 7770
             return 1;
7771 7771
         } else {
7772 7772
             return -1;
@@ -7812,8 +7812,8 @@  discard block
 block discarded – undo
7812 7812
 
7813 7813
                 $marginShift = 20;
7814 7814
                 if ($catSessionName != '') {
7815
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
7816
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
7815
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
7816
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
7817 7817
                     $marginShift = 40;
7818 7818
                 }
7819 7819
 
Please login to merge, or discard this patch.
Doc Comments   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
      * @param string    $description
1337 1337
      * @param int       $showDescription
1338 1338
      * @param int       $duration
1339
-     * @param array     $extraFields
1339
+     * @param boolean|null     $extraFields
1340 1340
      * @param int       $sessionAdminId
1341 1341
      * @param boolean $sendSubscriptionNotification Optional.
1342 1342
      *          Whether send a mail notification to users being subscribed
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
      * @param array $user_list
1566 1566
      * @param int $session_visibility
1567 1567
      * @param bool $empty_users
1568
-     * @return bool
1568
+     * @return false|null
1569 1569
      */
1570 1570
     public static function suscribe_users_to_session(
1571 1571
         $id_session,
@@ -1837,7 +1837,7 @@  discard block
 block discarded – undo
1837 1837
      * @param array $courseInfo
1838 1838
      * @param int $status
1839 1839
      * @param bool $updateTotal
1840
-     * @return bool
1840
+     * @return false|null
1841 1841
      */
1842 1842
     public static function removeUsersFromCourseSession(
1843 1843
         $userList,
@@ -1903,7 +1903,7 @@  discard block
 block discarded – undo
1903 1903
      * @param string $course_code
1904 1904
      * @param int $session_visibility
1905 1905
      * @param bool $removeUsersNotInList
1906
-     * @return bool
1906
+     * @return false|null
1907 1907
      */
1908 1908
     public static function subscribe_users_to_session_course(
1909 1909
         $user_list,
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
      * @param	bool	$removeExistingCoursesWithUsers Whether to unsubscribe
2087 2087
      * existing courses and users (true, default) or not (false)
2088 2088
      * @param $copyEvaluation from base course to session course
2089
-     * @return	void	Nothing, or false on error
2089
+     * @return	false|null	Nothing, or false on error
2090 2090
      * */
2091 2091
     public static function add_courses_to_session(
2092 2092
         $sessionId,
@@ -2282,6 +2282,8 @@  discard block
 block discarded – undo
2282 2282
      *
2283 2283
      * @param int Session id
2284 2284
      * @param int Course id
2285
+     * @param integer $session_id
2286
+     * @param integer $course_id
2285 2287
      * @return bool True in case of success, false otherwise
2286 2288
      */
2287 2289
     public static function unsubscribe_course_from_session($session_id, $course_id)
@@ -2337,7 +2339,7 @@  discard block
 block discarded – undo
2337 2339
      * @param	string	$variable Field's internal variable name
2338 2340
      * @param	int		$fieldType Field's type
2339 2341
      * @param	string	$displayText Field's language var name
2340
-     * @return int     new extra field id
2342
+     * @return boolean     new extra field id
2341 2343
      */
2342 2344
     public static function create_session_extra_field($variable, $fieldType, $displayText)
2343 2345
     {
@@ -2561,7 +2563,7 @@  discard block
 block discarded – undo
2561 2563
      * @param	array	id_checked
2562 2564
      * @param	bool	include delete session
2563 2565
      * @param	bool	optional, true if the function is called by a webservice, false otherwise.
2564
-     * @return	void	Nothing, or false on error
2566
+     * @return	boolean	Nothing, or false on error
2565 2567
      * The parameters is a array to delete sessions
2566 2568
      * */
2567 2569
     public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
@@ -3056,6 +3058,7 @@  discard block
 block discarded – undo
3056 3058
      * @param string $orderCondition
3057 3059
      * @param string $keyword
3058 3060
      * @param string $description
3061
+     * @param integer $status
3059 3062
      * @return array sessions
3060 3063
      */
3061 3064
     public static function getSessionsFollowedByUser(
@@ -3268,8 +3271,8 @@  discard block
 block discarded – undo
3268 3271
     /**
3269 3272
      * Gets the list of courses by session filtered by access_url
3270 3273
      *
3271
-     * @param $userId
3272
-     * @param $sessionId
3274
+     * @param integer $userId
3275
+     * @param null|integer $sessionId
3273 3276
      * @param null $from
3274 3277
      * @param null $limit
3275 3278
      * @param null $column
@@ -3394,6 +3397,7 @@  discard block
 block discarded – undo
3394 3397
     /**
3395 3398
      * Gets the count of courses by session filtered by access_url
3396 3399
      * @param int session id
3400
+     * @param integer $session_id
3397 3401
      * @return array list of courses
3398 3402
      */
3399 3403
     public static function getCourseCountBySessionId($session_id, $keyword = null)
@@ -3645,6 +3649,7 @@  discard block
 block discarded – undo
3645 3649
      * Updates a session status
3646 3650
      * @param	int 	session id
3647 3651
      * @param	int 	status
3652
+     * @param integer $status
3648 3653
      */
3649 3654
     public static function set_session_status($session_id, $status)
3650 3655
     {
@@ -3960,7 +3965,7 @@  discard block
 block discarded – undo
3960 3965
 
3961 3966
     /**
3962 3967
      * @param $id
3963
-     * @return bool
3968
+     * @return null|boolean
3964 3969
      */
3965 3970
     public static function protect_teacher_session_edit($id)
3966 3971
     {
@@ -4024,7 +4029,7 @@  discard block
 block discarded – undo
4024 4029
      *  true: if the session exists it will be updated.
4025 4030
      *  false: if session exists a new session will be created adding a counter session1, session2, etc
4026 4031
      * @param int $defaultUserId
4027
-     * @param mixed $logger
4032
+     * @param Logger $logger
4028 4033
      * @param array $extraFields convert a file row to an extra field. Example in CSV file there's a SessionID then it will
4029 4034
      * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
4030 4035
      * @param string $extraFieldId
@@ -5266,7 +5271,6 @@  discard block
 block discarded – undo
5266 5271
      * @param string $lastConnectionDate
5267 5272
      * @param array $sessionIdList
5268 5273
      * @param array $studentIdList
5269
-     * @param int $userStatus STUDENT|COURSEMANAGER constants
5270 5274
      *
5271 5275
      * @return array|int
5272 5276
      */
@@ -5418,7 +5422,7 @@  discard block
 block discarded – undo
5418 5422
     /**
5419 5423
      * Get the list of course tools that have to be dealt with in case of
5420 5424
      * registering any course to a session
5421
-     * @return array The list of tools to be dealt with (literal names)
5425
+     * @return string[] The list of tools to be dealt with (literal names)
5422 5426
      */
5423 5427
     public static function getCourseToolToBeManaged()
5424 5428
     {
@@ -5432,7 +5436,7 @@  discard block
 block discarded – undo
5432 5436
      * Calls the methods bound to each tool when a course is registered into a session
5433 5437
      * @param int $sessionId
5434 5438
      * @param int $courseId
5435
-     * @return void
5439
+     * @return boolean|null
5436 5440
      */
5437 5441
     public static function installCourse($sessionId, $courseId)
5438 5442
     {
@@ -6072,6 +6076,7 @@  discard block
 block discarded – undo
6072 6076
      * @param int $categoryId The internal ID of the session category
6073 6077
      * @param string $target Value to search for in the session field values
6074 6078
      * @param array $extraFields A list of fields to be scanned and returned
6079
+     * @param DateTime $publicationDate
6075 6080
      * @return mixed
6076 6081
      */
6077 6082
     public static function getShortSessionListAndExtraByCategory($categoryId, $target, $extraFields = null, $publicationDate = null)
@@ -6584,6 +6589,8 @@  discard block
 block discarded – undo
6584 6589
      * Converts "start date" and "end date" to "From start date to end date" string
6585 6590
      * @param string $startDate
6586 6591
      * @param string $endDate
6592
+     * @param boolean $showTime
6593
+     * @param boolean $dateHuman
6587 6594
      *
6588 6595
      * @return string
6589 6596
      */
@@ -7402,7 +7409,7 @@  discard block
 block discarded – undo
7402 7409
     /**
7403 7410
      * Get link to the admin page for this session
7404 7411
      * @param   int $id Session ID
7405
-     * @return mixed    URL to the admin page to manage the session, or false on error
7412
+     * @return false|string    URL to the admin page to manage the session, or false on error
7406 7413
      */
7407 7414
     public static function getAdminPath($id)
7408 7415
     {
@@ -7419,7 +7426,7 @@  discard block
 block discarded – undo
7419 7426
      * If a course is provided, build the link to the course
7420 7427
      * @param   int $id Session ID
7421 7428
      * @param   int $courseId Course ID (optional) in case the link has to send straight to the course
7422
-     * @return mixed    URL to the page to use the session, or false on error
7429
+     * @return false|string    URL to the page to use the session, or false on error
7423 7430
      */
7424 7431
     public static function getPath($id, $courseId = 0)
7425 7432
     {
@@ -7517,7 +7524,7 @@  discard block
 block discarded – undo
7517 7524
     /**
7518 7525
      * Return true if coach is allowed to access this session
7519 7526
      * @param int $sessionId
7520
-     * @return bool
7527
+     * @return integer
7521 7528
      */
7522 7529
     public static function isSessionDateOkForCoach($sessionId)
7523 7530
     {
Please login to merge, or discard this patch.