Completed
Pull Request — 1.11.x (#1458)
by José
138:44 queued 104:05
created
main/inc/lib/conditional_login.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                     if (isset($condition['conditional_function']) && $condition['conditional_function']($user) == false) {
24 24
                         $_SESSION['conditional_login']['uid'] = $user['user_id'];
25 25
                         $_SESSION['conditional_login']['can_login'] = false;
26
-                        header("Location:". $condition['url']);
26
+                        header("Location:".$condition['url']);
27 27
                         exit();
28 28
                     }
29 29
                 }
Please login to merge, or discard this patch.
main/inc/lib/image.lib.php 4 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             if ($height >= $max_size_for_picture) {
48 48
                 // scale width
49 49
                 $new_width = round($width * ($max_size_for_picture / $height));
50
-                 $this->image_wrapper->resize($new_width, $max_size_for_picture, 0);
50
+                    $this->image_wrapper->resize($new_width, $max_size_for_picture, 0);
51 51
             }
52 52
         }
53 53
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function __construct($path)
151 151
     {
152
-          parent::__construct($path);
152
+            parent::__construct($path);
153 153
     }
154 154
 
155 155
     public function set_image_wrapper()
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
         }
185 185
     }
186 186
 
187
-	public function get_image_size()
187
+    public function get_image_size()
188 188
     {
189
-		$imagesize = array('width'=>0,'height'=>0);
190
-	    if ($this->image_validated) {
189
+        $imagesize = array('width'=>0,'height'=>0);
190
+        if ($this->image_validated) {
191 191
             $imagesize = $this->image->getImageGeometry();
192
-	    }
193
-	    return $imagesize;
194
-	}
192
+        }
193
+        return $imagesize;
194
+    }
195 195
 
196
-	//@todo implement border logic case for Imagick
197
-	public function resize($thumbw, $thumbh, $border, $specific_size = false)
196
+    //@todo implement border logic case for Imagick
197
+    public function resize($thumbw, $thumbh, $border, $specific_size = false)
198 198
     {
199
-	    if (!$this->image_validated) return false;
199
+        if (!$this->image_validated) return false;
200 200
 
201 201
         if ($specific_size) {
202 202
             $width = $thumbw;
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
             $width  = (int)($this->width * $scale);
207 207
             $height = (int)($this->height * $scale);
208 208
         }
209
-		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
210
-		$this->width  = $thumbw;
211
-		$this->height = $thumbh;
212
-	}
209
+        $result = $this->image->resizeImage($width, $height, $this->filter, 1);
210
+        $this->width  = $thumbw;
211
+        $this->height = $thumbh;
212
+    }
213 213
     
214 214
     /**
215 215
      * @author José Loguercio <[email protected]>
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
225 225
         if (!$this->image_validated) return false;
226 226
         $this->image->cropimage($width, $height, $x, $y);
227
-		$this->width  = $width;
228
-		$this->height = $height;
227
+        $this->width  = $width;
228
+        $this->height = $height;
229 229
     }
230 230
 
231 231
     public function send_image($file = '', $compress = -1, $convert_file_to = null)
@@ -235,35 +235,35 @@  discard block
 block discarded – undo
235 235
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
236 236
             $type = $convert_file_to;
237 237
         }
238
-		switch ($type) {
239
-		    case 'jpeg':
240
-			case 'jpg':
241
-				if (!$file) header("Content-type: image/jpeg");
242
-				break;
243
-			case 'png':
244
-				if (!$file) header("Content-type: image/png");
245
-				break;
246
-			case 'gif':
247
-				if (!$file) header("Content-type: image/gif");
248
-				break;
249
-		}
250
-		$result = false;
251
-		try {
252
-		    $result = $this->image->writeImage($file);
253
-		} catch(ImagickException $e) {
238
+        switch ($type) {
239
+            case 'jpeg':
240
+            case 'jpg':
241
+                if (!$file) header("Content-type: image/jpeg");
242
+                break;
243
+            case 'png':
244
+                if (!$file) header("Content-type: image/png");
245
+                break;
246
+            case 'gif':
247
+                if (!$file) header("Content-type: image/gif");
248
+                break;
249
+        }
250
+        $result = false;
251
+        try {
252
+            $result = $this->image->writeImage($file);
253
+        } catch(ImagickException $e) {
254 254
             if ($this->debug) error_log($e->getMessage());
255 255
         }
256 256
 
257
-		if (!$file) {
258
-		    echo $this->image;
259
-		    $this->image->clear();
257
+        if (!$file) {
258
+            echo $this->image;
259
+            $this->image->clear();
260 260
             $this->image->destroy();
261
-		} else {
262
-		    $this->image->clear();
261
+        } else {
262
+            $this->image->clear();
263 263
             $this->image->destroy();
264
-		    return $result;
265
-		}
266
-	}
264
+            return $result;
265
+        }
266
+    }
267 267
 
268 268
 }
269 269
 
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
         $this->fill_image_info();
286 286
 
287 287
         switch ($this->type) {
288
-        	case 0:
289
-        		$handler = false;
290
-        		break;
291
-		    case 1 :
288
+            case 0:
289
+                $handler = false;
290
+                break;
291
+            case 1 :
292 292
                 $handler = @imagecreatefromgif($this->path);
293 293
                 $this->type = 'gif';
294 294
                 break;
295
-		    case 2 :
295
+            case 2 :
296 296
                 $handler = @imagecreatefromjpeg($this->path);
297 297
                 $this->type = 'jpg';
298 298
                 break;
299
-		    case 3 :
300
-		        $handler = @imagecreatefrompng($this->path);
301
-		        $this->type = 'png';
302
-		        break;
299
+            case 3 :
300
+                $handler = @imagecreatefrompng($this->path);
301
+                $this->type = 'png';
302
+                break;
303 303
         }
304 304
         if ($handler) {
305 305
             $this->image_validated = true;
@@ -313,29 +313,29 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $return_array = array('width'=>0,'height'=>0);
315 315
         if ($this->image_validated) {
316
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
316
+            $return_array = array('width'=>$this->width,'height'=>$this->height);
317 317
         }
318 318
         return $return_array;
319
-	}
319
+    }
320 320
 
321 321
     public function fill_image_info()
322 322
     {
323
-    	if (file_exists($this->path)) {
324
-	        $image_info     = getimagesize($this->path);
325
-			$this->width    = $image_info[0];
326
-			$this->height   = $image_info[1];
327
-			$this->type     = $image_info[2];
328
-    	} else {
329
-    		$this->width    = 0;
330
-    		$this->height   = 0;
331
-    		$this->type     = 0;
332
-    	}
323
+        if (file_exists($this->path)) {
324
+            $image_info     = getimagesize($this->path);
325
+            $this->width    = $image_info[0];
326
+            $this->height   = $image_info[1];
327
+            $this->type     = $image_info[2];
328
+        } else {
329
+            $this->width    = 0;
330
+            $this->height   = 0;
331
+            $this->type     = 0;
332
+        }
333 333
     }
334 334
 
335 335
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
336 336
     {
337 337
         if (!$this->image_validated) return false;
338
-		if ($border == 1) {
338
+        if ($border == 1) {
339 339
             if ($specific_size) {
340 340
                 $width = $thumbw;
341 341
                 $height = $thumbh;
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
                 $width = (int)($this->width * $scale);
345 345
                 $height = (int)($this->height * $scale);
346 346
             }
347
-			$deltaw = (int)(($thumbw - $width) / 2);
348
-			$deltah = (int)(($thumbh - $height) / 2);
349
-			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350
-            		@imagealphablending($dst_img, false);
351
-		        @imagesavealpha($dst_img, true);
352
-			if (!empty($this->color)) {
353
-				@imagefill($dst_img, 0, 0, $this->color);
354
-			}
355
-			$this->width = $thumbw;
356
-			$this->height = $thumbh;
357
-		} elseif ($border == 0) {
347
+            $deltaw = (int)(($thumbw - $width) / 2);
348
+            $deltah = (int)(($thumbh - $height) / 2);
349
+            $dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350
+                    @imagealphablending($dst_img, false);
351
+                @imagesavealpha($dst_img, true);
352
+            if (!empty($this->color)) {
353
+                @imagefill($dst_img, 0, 0, $this->color);
354
+            }
355
+            $this->width = $thumbw;
356
+            $this->height = $thumbh;
357
+        } elseif ($border == 0) {
358 358
             if ($specific_size) {
359 359
                 $width = $thumbw;
360 360
                 $height = $thumbh;
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
                 $width  = (int)($this->width * $scale);
364 364
                 $height = (int)($this->height * $scale);
365 365
             }
366
-			$deltaw = 0;
367
-			$deltah = 0;
368
-			$dst_img = @ImageCreateTrueColor($width, $height);
369
-            		@imagealphablending($dst_img, false);
370
-		        @imagesavealpha($dst_img, true);
371
-			$this->width = $width;
372
-			$this->height = $height;
373
-		}
374
-		$src_img = $this->bg;
375
-		@ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img));
376
-		$this->bg = $dst_img;
377
-		@imagedestroy($src_img);
378
-	}
366
+            $deltaw = 0;
367
+            $deltah = 0;
368
+            $dst_img = @ImageCreateTrueColor($width, $height);
369
+                    @imagealphablending($dst_img, false);
370
+                @imagesavealpha($dst_img, true);
371
+            $this->width = $width;
372
+            $this->height = $height;
373
+        }
374
+        $src_img = $this->bg;
375
+        @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img));
376
+        $this->bg = $dst_img;
377
+        @imagedestroy($src_img);
378
+    }
379 379
     
380 380
     /**
381 381
      * @author José Loguercio <[email protected]>
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
390 390
         if (!$this->image_validated) return false;
391 391
         $this->width = $width;
392
-		$this->height = $height;
392
+        $this->height = $height;
393 393
         $src = null;
394 394
         $dest = @imagecreatetruecolor($width, $height);
395 395
         $type = $this->type;
@@ -400,56 +400,56 @@  discard block
 block discarded – undo
400 400
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
401 401
                 @imagejpeg($dest, $this->path);
402 402
                 break;
403
-		    case 'png' :
403
+            case 'png' :
404 404
                 $src = @imagecreatefrompng($this->path);
405 405
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
406 406
                 @imagepng($dest, $this->path);
407 407
                 break;
408
-		    case 'gif' :
409
-		        $src = @imagecreatefromgif($this->path);
408
+            case 'gif' :
409
+                $src = @imagecreatefromgif($this->path);
410 410
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
411 411
                 @imagegif($dest, $this->path);
412
-		        break;
412
+                break;
413 413
             default: return 0;
414 414
         }
415 415
         @imagedestroy($dest);
416 416
         @imagedestroy($src);
417 417
     }
418 418
 
419
-	public function send_image($file = '', $compress = -1, $convert_file_to = null)
419
+    public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 420
     {
421
-	    if (!$this->image_validated) return false;
421
+        if (!$this->image_validated) return false;
422 422
         $compress = (int)$compress;
423 423
         $type = $this->type;
424 424
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
425 425
             $type = $convert_file_to;
426 426
         }
427
-		switch ($type) {
428
-		    case 'jpeg':
429
-			case 'jpg':
430
-				if (!$file) header("Content-type: image/jpeg");
431
-				if ($compress == -1) $compress = 100;
432
-				return imagejpeg($this->bg, $file, $compress);
433
-				break;
434
-			case 'png':
435
-				if (!$file) header("Content-type: image/png");
436
-				if ($compress != -1) {
437
-					@imagetruecolortopalette($this->bg, true, $compress);
438
-				}
439
-				return imagepng($this->bg, $file, $compress);
440
-				break;
441
-			case 'gif':
442
-				if (!$file) header("Content-type: image/gif");
443
-				if ($compress != -1) {
444
-					@imagetruecolortopalette($this->bg, true, $compress);
445
-				}
446
-				return imagegif($this->bg, $file, $compress);
447
-				break;
448
-			default: return 0;
449
-		}
450
-		// TODO: Occupied memory is not released, because the following fragment of code is actually dead.
451
-		@imagedestroy($this->bg);
452
-	}
427
+        switch ($type) {
428
+            case 'jpeg':
429
+            case 'jpg':
430
+                if (!$file) header("Content-type: image/jpeg");
431
+                if ($compress == -1) $compress = 100;
432
+                return imagejpeg($this->bg, $file, $compress);
433
+                break;
434
+            case 'png':
435
+                if (!$file) header("Content-type: image/png");
436
+                if ($compress != -1) {
437
+                    @imagetruecolortopalette($this->bg, true, $compress);
438
+                }
439
+                return imagepng($this->bg, $file, $compress);
440
+                break;
441
+            case 'gif':
442
+                if (!$file) header("Content-type: image/gif");
443
+                if ($compress != -1) {
444
+                    @imagetruecolortopalette($this->bg, true, $compress);
445
+                }
446
+                return imagegif($this->bg, $file, $compress);
447
+                break;
448
+            default: return 0;
449
+        }
450
+        // TODO: Occupied memory is not released, because the following fragment of code is actually dead.
451
+        @imagedestroy($this->bg);
452
+    }
453 453
 
454 454
     /**
455 455
      * Convert image to black & white
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             return false;
116 116
         }
117 117
         $this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path;
118
-        $this->set_image_wrapper();  //Creates image obj
118
+        $this->set_image_wrapper(); //Creates image obj
119 119
     }
120 120
 
121 121
     abstract function set_image_wrapper();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         if ($this->debug) error_log('Image::set_image_wrapper loaded');
158 158
         try {
159 159
             if (file_exists($this->path)) {
160
-                $this->image     = new Imagick($this->path);
160
+                $this->image = new Imagick($this->path);
161 161
 
162 162
                 if ($this->image) {
163 163
                     $this->fill_image_info(); //Fills height, width and type
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             } else {
166 166
                 if ($this->debug) error_log('Image::image does not exist');
167 167
             }
168
-        } catch(ImagickException $e) {
168
+        } catch (ImagickException $e) {
169 169
             if ($this->debug) error_log($e->getMessage());
170 170
         }
171 171
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 	public function get_image_size()
188 188
     {
189
-		$imagesize = array('width'=>0,'height'=>0);
189
+		$imagesize = array('width'=>0, 'height'=>0);
190 190
 	    if ($this->image_validated) {
191 191
             $imagesize = $this->image->getImageGeometry();
192 192
 	    }
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
             $height = $thumbh;
204 204
         } else {
205 205
             $scale  = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
206
-            $width  = (int)($this->width * $scale);
207
-            $height = (int)($this->height * $scale);
206
+            $width  = (int) ($this->width * $scale);
207
+            $height = (int) ($this->height * $scale);
208 208
         }
209 209
 		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
210 210
 		$this->width  = $thumbw;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$result = false;
251 251
 		try {
252 252
 		    $result = $this->image->writeImage($file);
253
-		} catch(ImagickException $e) {
253
+		} catch (ImagickException $e) {
254 254
             if ($this->debug) error_log($e->getMessage());
255 255
         }
256 256
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 
312 312
     public function get_image_size()
313 313
     {
314
-        $return_array = array('width'=>0,'height'=>0);
314
+        $return_array = array('width'=>0, 'height'=>0);
315 315
         if ($this->image_validated) {
316
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
316
+	        $return_array = array('width'=>$this->width, 'height'=>$this->height);
317 317
         }
318 318
         return $return_array;
319 319
 	}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     public function fill_image_info()
322 322
     {
323 323
     	if (file_exists($this->path)) {
324
-	        $image_info     = getimagesize($this->path);
324
+	        $image_info = getimagesize($this->path);
325 325
 			$this->width    = $image_info[0];
326 326
 			$this->height   = $image_info[1];
327 327
 			$this->type     = $image_info[2];
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
                 $height = $thumbh;
342 342
             } else {
343 343
                 $scale = min($thumbw / $this->width, $thumbh / $this->height);
344
-                $width = (int)($this->width * $scale);
345
-                $height = (int)($this->height * $scale);
344
+                $width = (int) ($this->width * $scale);
345
+                $height = (int) ($this->height * $scale);
346 346
             }
347
-			$deltaw = (int)(($thumbw - $width) / 2);
348
-			$deltah = (int)(($thumbh - $height) / 2);
347
+			$deltaw = (int) (($thumbw - $width) / 2);
348
+			$deltah = (int) (($thumbh - $height) / 2);
349 349
 			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350 350
             		@imagealphablending($dst_img, false);
351 351
 		        @imagesavealpha($dst_img, true);
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
                 $height = $thumbh;
361 361
             } else {
362 362
                 $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
363
-                $width  = (int)($this->width * $scale);
364
-                $height = (int)($this->height * $scale);
363
+                $width  = (int) ($this->width * $scale);
364
+                $height = (int) ($this->height * $scale);
365 365
             }
366 366
 			$deltaw = 0;
367 367
 			$deltah = 0;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 420
     {
421 421
 	    if (!$this->image_validated) return false;
422
-        $compress = (int)$compress;
422
+        $compress = (int) $compress;
423 423
         $type = $this->type;
424 424
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
425 425
             $type = $convert_file_to;
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
          * so that we can use black (0,0,0) as transparent, which is what
464 464
          * the image is filled with when created.
465 465
          */
466
-        $transparent = imagecolorallocate($dest_img, 0,0,0);
466
+        $transparent = imagecolorallocate($dest_img, 0, 0, 0);
467 467
         imagealphablending($dest_img, false);
468 468
         imagesavealpha($dest_img, true);
469 469
         imagecolortransparent($dest_img, $transparent);
470
-        imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg));
470
+        imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg));
471 471
         imagefilter($dest_img, IMG_FILTER_GRAYSCALE);
472 472
         $this->bg = $dest_img;
473 473
 
Please login to merge, or discard this patch.
Braces   +57 added lines, -19 removed lines patch added patch discarded remove patch
@@ -154,7 +154,9 @@  discard block
 block discarded – undo
154 154
 
155 155
     public function set_image_wrapper()
156 156
     {
157
-        if ($this->debug) error_log('Image::set_image_wrapper loaded');
157
+        if ($this->debug) {
158
+            error_log('Image::set_image_wrapper loaded');
159
+        }
158 160
         try {
159 161
             if (file_exists($this->path)) {
160 162
                 $this->image     = new Imagick($this->path);
@@ -163,10 +165,14 @@  discard block
 block discarded – undo
163 165
                     $this->fill_image_info(); //Fills height, width and type
164 166
                 }
165 167
             } else {
166
-                if ($this->debug) error_log('Image::image does not exist');
168
+                if ($this->debug) {
169
+                    error_log('Image::image does not exist');
170
+                }
167 171
             }
168 172
         } catch(ImagickException $e) {
169
-            if ($this->debug) error_log($e->getMessage());
173
+            if ($this->debug) {
174
+                error_log($e->getMessage());
175
+            }
170 176
         }
171 177
     }
172 178
 
@@ -180,7 +186,9 @@  discard block
 block discarded – undo
180 186
 
181 187
         if (in_array($this->type, $this->allowed_extensions)) {
182 188
             $this->image_validated = true;
183
-            if ($this->debug) error_log('image_validated true');
189
+            if ($this->debug) {
190
+                error_log('image_validated true');
191
+            }
184 192
         }
185 193
     }
186 194
 
@@ -196,7 +204,9 @@  discard block
 block discarded – undo
196 204
 	//@todo implement border logic case for Imagick
197 205
 	public function resize($thumbw, $thumbh, $border, $specific_size = false)
198 206
     {
199
-	    if (!$this->image_validated) return false;
207
+	    if (!$this->image_validated) {
208
+	        return false;
209
+	    }
200 210
 
201 211
         if ($specific_size) {
202 212
             $width = $thumbw;
@@ -222,7 +232,9 @@  discard block
 block discarded – undo
222 232
      */
223 233
     
224 234
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
225
-        if (!$this->image_validated) return false;
235
+        if (!$this->image_validated) {
236
+            return false;
237
+        }
226 238
         $this->image->cropimage($width, $height, $x, $y);
227 239
 		$this->width  = $width;
228 240
 		$this->height = $height;
@@ -230,7 +242,9 @@  discard block
 block discarded – undo
230 242
 
231 243
     public function send_image($file = '', $compress = -1, $convert_file_to = null)
232 244
     {
233
-        if (!$this->image_validated) return false;
245
+        if (!$this->image_validated) {
246
+            return false;
247
+        }
234 248
         $type = $this->type;
235 249
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
236 250
             $type = $convert_file_to;
@@ -238,20 +252,28 @@  discard block
 block discarded – undo
238 252
 		switch ($type) {
239 253
 		    case 'jpeg':
240 254
 			case 'jpg':
241
-				if (!$file) header("Content-type: image/jpeg");
255
+				if (!$file) {
256
+				    header("Content-type: image/jpeg");
257
+				}
242 258
 				break;
243 259
 			case 'png':
244
-				if (!$file) header("Content-type: image/png");
260
+				if (!$file) {
261
+				    header("Content-type: image/png");
262
+				}
245 263
 				break;
246 264
 			case 'gif':
247
-				if (!$file) header("Content-type: image/gif");
265
+				if (!$file) {
266
+				    header("Content-type: image/gif");
267
+				}
248 268
 				break;
249 269
 		}
250 270
 		$result = false;
251 271
 		try {
252 272
 		    $result = $this->image->writeImage($file);
253 273
 		} catch(ImagickException $e) {
254
-            if ($this->debug) error_log($e->getMessage());
274
+            if ($this->debug) {
275
+                error_log($e->getMessage());
276
+            }
255 277
         }
256 278
 
257 279
 		if (!$file) {
@@ -334,7 +356,9 @@  discard block
 block discarded – undo
334 356
 
335 357
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
336 358
     {
337
-        if (!$this->image_validated) return false;
359
+        if (!$this->image_validated) {
360
+            return false;
361
+        }
338 362
 		if ($border == 1) {
339 363
             if ($specific_size) {
340 364
                 $width = $thumbw;
@@ -387,7 +411,9 @@  discard block
 block discarded – undo
387 411
      * @param int $src_height the source height of the original image
388 412
      */
389 413
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
390
-        if (!$this->image_validated) return false;
414
+        if (!$this->image_validated) {
415
+            return false;
416
+        }
391 417
         $this->width = $width;
392 418
 		$this->height = $height;
393 419
         $src = null;
@@ -418,7 +444,9 @@  discard block
 block discarded – undo
418 444
 
419 445
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 446
     {
421
-	    if (!$this->image_validated) return false;
447
+	    if (!$this->image_validated) {
448
+	        return false;
449
+	    }
422 450
         $compress = (int)$compress;
423 451
         $type = $this->type;
424 452
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
@@ -427,19 +455,27 @@  discard block
 block discarded – undo
427 455
 		switch ($type) {
428 456
 		    case 'jpeg':
429 457
 			case 'jpg':
430
-				if (!$file) header("Content-type: image/jpeg");
431
-				if ($compress == -1) $compress = 100;
458
+				if (!$file) {
459
+				    header("Content-type: image/jpeg");
460
+				}
461
+				if ($compress == -1) {
462
+				    $compress = 100;
463
+				}
432 464
 				return imagejpeg($this->bg, $file, $compress);
433 465
 				break;
434 466
 			case 'png':
435
-				if (!$file) header("Content-type: image/png");
467
+				if (!$file) {
468
+				    header("Content-type: image/png");
469
+				}
436 470
 				if ($compress != -1) {
437 471
 					@imagetruecolortopalette($this->bg, true, $compress);
438 472
 				}
439 473
 				return imagepng($this->bg, $file, $compress);
440 474
 				break;
441 475
 			case 'gif':
442
-				if (!$file) header("Content-type: image/gif");
476
+				if (!$file) {
477
+				    header("Content-type: image/gif");
478
+				}
443 479
 				if ($compress != -1) {
444 480
 					@imagetruecolortopalette($this->bg, true, $compress);
445 481
 				}
@@ -456,7 +492,9 @@  discard block
 block discarded – undo
456 492
      */
457 493
     function convert2bw()
458 494
     {
459
-        if (!$this->image_validated) return false;
495
+        if (!$this->image_validated) {
496
+            return false;
497
+        }
460 498
 
461 499
         $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg));
462 500
         /* copy ignore the transparent color
Please login to merge, or discard this patch.
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -63,6 +63,9 @@  discard block
 block discarded – undo
63 63
         return $image;
64 64
     }
65 65
 
66
+    /**
67
+     * @param string $convert_file_to
68
+     */
66 69
     public function send_image(
67 70
         $file = '',
68 71
         $compress = -1,
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
     public $image;
145 148
     public $filter = Imagick::FILTER_LANCZOS;
146 149
 
150
+    /**
151
+     * @param string $path
152
+     */
147 153
     public function __construct($path)
148 154
     {
149 155
           parent::__construct($path);
@@ -191,6 +197,10 @@  discard block
 block discarded – undo
191 197
 	}
192 198
 
193 199
 	//@todo implement border logic case for Imagick
200
+
201
+	/**
202
+	 * @param integer $border
203
+	 */
194 204
 	public function resize($thumbw, $thumbh, $border, $specific_size = false)
195 205
     {
196 206
 	    if (!$this->image_validated) return false;
@@ -272,6 +282,9 @@  discard block
 block discarded – undo
272 282
 {
273 283
     public $bg;
274 284
 
285
+    /**
286
+     * @param string $path
287
+     */
275 288
     function __construct($path) {
276 289
         parent::__construct($path);
277 290
     }
@@ -329,6 +342,9 @@  discard block
 block discarded – undo
329 342
     	}
330 343
     }
331 344
 
345
+    /**
346
+     * @param integer $border
347
+     */
332 348
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
333 349
     {
334 350
         if (!$this->image_validated) return false;
Please login to merge, or discard this patch.
main/inc/lib/timeline.lib.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
     );
26 26
     public $is_course_model = true;
27 27
 
28
-	public function __construct()
28
+    public function __construct()
29 29
     {
30 30
         $this->table =  Database::get_course_table(TABLE_TIMELINE);
31
-	}
31
+    }
32 32
 
33 33
     /**
34 34
      * Get the count of elements
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * Displays the title + grid
54 54
      */
55
-	public function listing()
55
+    public function listing()
56 56
     {
57
-		// action links
58
-		$html = '<div class="actions">';
57
+        // action links
58
+        $html = '<div class="actions">';
59 59
         //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
60
-		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
61
-		$html .= '</div>';
60
+        $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
61
+        $html .= '</div>';
62 62
         $html .= Display::grid_html('timelines');
63 63
         return $html;
64
-	}
64
+    }
65 65
 
66 66
     public function get_status_list()
67 67
     {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70'));
91 91
         //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250'));
92
-	    $status_list = $this->get_status_list();
92
+        $status_list = $this->get_status_list();
93 93
         $form->addElement('select', 'status', get_lang('Status'), $status_list);
94 94
         if ($action == 'edit') {
95 95
             //$form->addElement('text', 'created_at', get_lang('CreatedAt'));
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
         // Setting the rules
175 175
         $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required');
176
-		return $form;
176
+        return $form;
177 177
 
178 178
     }
179 179
 
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
     public function save_item($params)
185 185
     {
186 186
         $params['c_id'] = api_get_course_int_id();
187
-	    $id = parent::save($params);
188
-	    if (!empty($id)) {
189
-	    	//event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
190
-   		}
191
-   		return $id;
187
+        $id = parent::save($params);
188
+        if (!empty($id)) {
189
+            //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
190
+            }
191
+            return $id;
192 192
     }
193 193
 
194 194
     /**
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
         $params['c_id'] = api_get_course_int_id();
200 200
         $params['parent_id'] = '0';
201 201
         $params['type'] = 'default';
202
-	    $id = parent::save($params);
203
-	    if (!empty($id)) {
204
-	    	//event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
205
-   		}
206
-   		return $id;
202
+        $id = parent::save($params);
203
+        if (!empty($id)) {
204
+            //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
205
+            }
206
+            return $id;
207 207
     }
208 208
 
209 209
     public function delete($id) {
210
-	    parent::delete($id);
211
-	    //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
210
+        parent::delete($id);
211
+        //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
212 212
     }
213 213
 
214 214
     public function get_url($id) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $item['asset'] = array( 'media'     => $item['media'],
248 248
                                 'credit'    => $item['media_credit'],
249 249
                                 'caption'   => $item['media_caption'],
250
-         );
250
+            );
251 251
 
252 252
         //Cleaning items
253 253
         unset($item['id']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct()
29 29
     {
30
-        $this->table =  Database::get_course_table(TABLE_TIMELINE);
30
+        $this->table = Database::get_course_table(TABLE_TIMELINE);
31 31
 	}
32 32
 
33 33
     /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function get_all($where_conditions = array())
48 48
     {
49
-        return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC'));
49
+        return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC'));
50 50
     }
51 51
 
52 52
     /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		// action links
58 58
 		$html = '<div class="actions">';
59 59
         //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
60
-		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
60
+		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>';
61 61
 		$html .= '</div>';
62 62
         $html .= Display::grid_html('timelines');
63 63
         return $html;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         }
245 245
         unset($item['end_date']);
246 246
         // Assets
247
-        $item['asset'] = array( 'media'     => $item['media'],
247
+        $item['asset'] = array('media'     => $item['media'],
248 248
                                 'credit'    => $item['media_credit'],
249 249
                                 'caption'   => $item['media_caption'],
250 250
          );
Please login to merge, or discard this patch.
main/inc/lib/urlmanager.lib.php 3 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 class UrlManager
12 12
 {
13 13
     /**
14
-    * Creates a new url access
15
-    *
16
-    * @author Julio Montoya <[email protected]>,
17
-    *
18
-    * @param	string	$url The URL of the site
19
-    * @param	string  $description The description of the site
20
-    * @param	int		$active is active or not
21
-    * @return boolean if success
22
-    */
14
+     * Creates a new url access
15
+     *
16
+     * @author Julio Montoya <[email protected]>,
17
+     *
18
+     * @param	string	$url The URL of the site
19
+     * @param	string  $description The description of the site
20
+     * @param	int		$active is active or not
21
+     * @return boolean if success
22
+     */
23 23
     public static function add($url, $description, $active)
24 24
     {
25 25
         $tms = time();
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     /**
39
-    * Updates an URL access
40
-    * @author Julio Montoya <[email protected]>,
41
-    *
42
-    * @param	int 	$url_id The url id
43
-    * @param	string 	$url
44
-    * @param	string  $description The description of the site
45
-    * @param	int		$active is active or not
46
-    * @return 	boolean if success
47
-    */
39
+     * Updates an URL access
40
+     * @author Julio Montoya <[email protected]>,
41
+     *
42
+     * @param	int 	$url_id The url id
43
+     * @param	string 	$url
44
+     * @param	string  $description The description of the site
45
+     * @param	int		$active is active or not
46
+     * @return 	boolean if success
47
+     */
48 48
     public static function update($url_id, $url, $description, $active)
49 49
     {
50 50
         $url_id = intval($url_id);
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-    * Deletes an url
67
-    * @author Julio Montoya
68
-    * @param int $id url id
66
+     * Deletes an url
67
+     * @author Julio Montoya
68
+     * @param int $id url id
69 69
      *
70
-    * @return boolean true if success
71
-    * */
70
+     * @return boolean true if success
71
+     * */
72 72
     public static function delete($id)
73 73
     {
74 74
         $id = intval($id);
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
     }
201 201
 
202 202
     /**
203
-    * Gets the inner join of access_url and the course table
204
-    *
205
-    * @author Julio Montoya
206
-    * @param int  access url id
207
-    * @return array   Database::store_result of the result
208
-    **/
203
+     * Gets the inner join of access_url and the course table
204
+     *
205
+     * @author Julio Montoya
206
+     * @param int  access url id
207
+     * @return array   Database::store_result of the result
208
+     **/
209 209
     public static function get_url_rel_course_data($access_url_id = null)
210 210
     {
211 211
         $where = '';
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
     }
363 363
 
364 364
     /**
365
-    * Checks the relationship between an URL and a User (return the num_rows)
366
-    * @author Julio Montoya
367
-    * @param int user id
368
-    * @param int url id
369
-    * @return boolean true if success
370
-    * */
365
+     * Checks the relationship between an URL and a User (return the num_rows)
366
+     * @author Julio Montoya
367
+     * @param int user id
368
+     * @param int url id
369
+     * @return boolean true if success
370
+     * */
371 371
     public static function relation_url_user_exist($user_id, $url_id)
372 372
     {
373 373
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -377,15 +377,15 @@  discard block
 block discarded – undo
377 377
         $num = Database::num_rows($result);
378 378
 
379 379
         return $num;
380
-	}
380
+    }
381 381
 
382 382
     /**
383
-    * Checks the relationship between an URL and a Course (return the num_rows)
384
-    * @author Julio Montoya
385
-    * @param int $courseId
386
-    * @param int $urlId
387
-    * @return boolean true if success
388
-    * */
383
+     * Checks the relationship between an URL and a Course (return the num_rows)
384
+     * @author Julio Montoya
385
+     * @param int $courseId
386
+     * @param int $urlId
387
+     * @return boolean true if success
388
+     * */
389 389
     public static function relation_url_course_exist($courseId, $urlId)
390 390
     {
391 391
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
     }
421 421
 
422 422
     /**
423
-    * Checks the relationship between an URL and a Session (return the num_rows)
424
-    * @author Julio Montoya
425
-    * @param int user id
426
-    * @param int url id
427
-    * @return boolean true if success
428
-    * */
423
+     * Checks the relationship between an URL and a Session (return the num_rows)
424
+     * @author Julio Montoya
425
+     * @param int user id
426
+     * @param int url id
427
+     * @return boolean true if success
428
+     * */
429 429
     public static function relation_url_session_exist($session_id, $url_id)
430 430
     {
431 431
         $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
     }
738 738
 
739 739
     /**
740
-    * Deletes an url and user relationship
741
-    * @author Julio Montoya
742
-    * @param int user id
743
-    * @param int url id
740
+     * Deletes an url and user relationship
741
+     * @author Julio Montoya
742
+     * @param int user id
743
+     * @param int url id
744 744
      *
745
-    * @return boolean true if success
746
-    * */
745
+     * @return boolean true if success
746
+     * */
747 747
     public static function delete_url_rel_user($user_id, $url_id)
748 748
     {
749 749
         $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
     }
759 759
 
760 760
     /**
761
-    * Deletes an url and course relationship
762
-    * @author Julio Montoya
763
-    * @param  int  $courseId
764
-    * @param  int  $urlId
761
+     * Deletes an url and course relationship
762
+     * @author Julio Montoya
763
+     * @param  int  $courseId
764
+     * @param  int  $urlId
765 765
      *
766
-    * @return boolean true if success
767
-    * */
766
+     * @return boolean true if success
767
+     * */
768 768
     public static function delete_url_rel_course($courseId, $urlId)
769 769
     {
770 770
         $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
     }
815 815
 
816 816
     /**
817
-    * Deletes an url and session relationship
818
-    * @author Julio Montoya
819
-    * @param  char  course code
820
-    * @param  int url id
817
+     * Deletes an url and session relationship
818
+     * @author Julio Montoya
819
+     * @param  char  course code
820
+     * @param  int url id
821 821
      *
822
-    * @return boolean true if success
823
-    * */
822
+     * @return boolean true if success
823
+     * */
824 824
     public static function delete_url_rel_session($session_id, $url_id)
825 825
     {
826 826
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
Please login to merge, or discard this patch.
Doc Comments   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     * @param	string	$url The URL of the site
19 19
     * @param	string  $description The description of the site
20 20
     * @param	int		$active is active or not
21
-    * @return boolean if success
21
+    * @return Doctrine\DBAL\Driver\Statement|null if success
22 22
     */
23 23
     public static function add($url, $description, $active)
24 24
     {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     * @param	string 	$url
44 44
     * @param	string  $description The description of the site
45 45
     * @param	int		$active is active or not
46
-    * @return 	boolean if success
46
+    * @return 	Doctrine\DBAL\Driver\Statement|null if success
47 47
     */
48 48
     public static function update($url_id, $url, $description, $active)
49 49
     {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     * @author Julio Montoya
387 387
     * @param int user id
388 388
     * @param int url id
389
-    * @return boolean true if success
389
+    * @return integer true if success
390 390
     * */
391 391
     public static function relation_url_user_exist($user_id, $url_id)
392 392
     {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     * @author Julio Montoya
405 405
     * @param int $courseId
406 406
     * @param int $urlId
407
-    * @return boolean true if success
407
+    * @return integer true if success
408 408
     * */
409 409
     public static function relation_url_course_exist($courseId, $urlId)
410 410
     {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      * @author Julio Montoya
426 426
      * @param int $userGroupId
427 427
      * @param int $urlId
428
-     * @return boolean true if success
428
+     * @return integer true if success
429 429
      * */
430 430
     public static function relationUrlUsergroupExist($userGroupId, $urlId)
431 431
     {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     * @author Julio Montoya
446 446
     * @param int user id
447 447
     * @param int url id
448
-    * @return boolean true if success
448
+    * @return integer true if success
449 449
     * */
450 450
     public static function relation_url_session_exist($session_id, $url_id)
451 451
     {
@@ -568,6 +568,8 @@  discard block
 block discarded – undo
568 568
      * @author Julio Montoya
569 569
      * @param  array of course ids
570 570
      * @param  array of url_ids
571
+     * @param integer[] $courseCategoryList
572
+     * @param integer[] $urlList
571 573
      * @return array
572 574
      **/
573 575
     public static function addCourseCategoryListToUrl($courseCategoryList, $urlList)
@@ -598,7 +600,7 @@  discard block
 block discarded – undo
598 600
      * @author Julio Montoya
599 601
      * @param int $categoryCourseId
600 602
      * @param int $urlId
601
-     * @return boolean true if success
603
+     * @return integer true if success
602 604
      * */
603 605
     public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
604 606
     {
@@ -615,7 +617,7 @@  discard block
 block discarded – undo
615 617
     /**
616 618
      * @param int $userGroupId
617 619
      * @param int $urlId
618
-     * @return int
620
+     * @return string
619 621
      */
620 622
     public static function addUserGroupToUrl($userGroupId, $urlId)
621 623
     {
@@ -716,7 +718,7 @@  discard block
 block discarded – undo
716 718
      * @param int $courseId
717 719
      * @param int $url_id
718 720
      *
719
-     * @return resource
721
+     * @return boolean
720 722
      */
721 723
     public static function add_course_to_url($courseId, $url_id = 1)
722 724
     {
@@ -807,7 +809,7 @@  discard block
 block discarded – undo
807 809
     * @param  int  $courseId
808 810
     * @param  int  $urlId
809 811
      *
810
-    * @return boolean true if success
812
+    * @return Doctrine\DBAL\Driver\Statement|null true if success
811 813
     * */
812 814
     public static function delete_url_rel_course($courseId, $urlId)
813 815
     {
@@ -825,7 +827,7 @@  discard block
 block discarded – undo
825 827
      * @param  int $userGroupId
826 828
      * @param  int $urlId
827 829
      *
828
-     * @return boolean true if success
830
+     * @return Doctrine\DBAL\Driver\Statement|null true if success
829 831
      * */
830 832
     public static function delete_url_rel_usergroup($userGroupId, $urlId)
831 833
     {
@@ -844,7 +846,7 @@  discard block
 block discarded – undo
844 846
      * @param  int $userGroupId
845 847
      * @param  int $urlId
846 848
      *
847
-     * @return boolean true if success
849
+     * @return Doctrine\DBAL\Driver\Statement|null true if success
848 850
      * */
849 851
     public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
850 852
     {
@@ -862,8 +864,9 @@  discard block
 block discarded – undo
862 864
     * @author Julio Montoya
863 865
     * @param  char  course code
864 866
     * @param  int url id
867
+    * @param integer $url_id
865 868
      *
866
-    * @return boolean true if success
869
+    * @return Doctrine\DBAL\Driver\Statement|null true if success
867 870
     * */
868 871
     public static function delete_url_rel_session($session_id, $url_id)
869 872
     {
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public static function add($url, $description, $active)
24 24
     {
25 25
         $tms = time();
26
-        $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
26
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
27 27
         $sql = "INSERT INTO $table
28 28
                 SET url 	= '".Database::escape_string($url)."',
29 29
                 description = '".Database::escape_string($description)."',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $sql = "DELETE FROM $tableUser WHERE access_url_id = ".$id;
93 93
         Database::query($sql);
94 94
 
95
-        $sql= "DELETE FROM $table WHERE id = ".$id;
95
+        $sql = "DELETE FROM $table WHERE id = ".$id;
96 96
         Database::query($sql);
97 97
 
98 98
         return true;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function url_exist($url)
107 107
     {
108
-        $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
108
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
109 109
         $sql = "SELECT id FROM $table
110 110
                 WHERE url = '".Database::escape_string($url)."' ";
111 111
         $res = Database::query($sql);
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
      * */
140 140
     public static function url_count()
141 141
     {
142
-        $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
142
+        $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
143 143
         $sql = "SELECT count(id) as count_result FROM $table_access_url";
144 144
         $res = Database::query($sql);
145
-        $url = Database::fetch_array($res,'ASSOC');
145
+        $url = Database::fetch_array($res, 'ASSOC');
146 146
         $result = $url['count_result'];
147 147
 
148 148
         return $result;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 FROM $table
161 161
                 ORDER BY id";
162 162
         $res = Database::query($sql);
163
-        $urls = array ();
163
+        $urls = array();
164 164
         while ($url = Database::fetch_array($res)) {
165 165
             $urls[] = $url;
166 166
         }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      **/
278 278
     public static function get_url_rel_session_data($access_url_id = null)
279 279
     {
280
-        $where ='';
280
+        $where = '';
281 281
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
282 282
         $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
283 283
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $table_user_group = Database::get_main_table(TABLE_USERGROUP);
314 314
 
315 315
         if (!empty($access_url_id)) {
316
-            $where ="WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id);
316
+            $where = "WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id);
317 317
         }
318 318
 
319 319
         $sql = "SELECT id, name, access_url_id
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     public static function relation_url_user_exist($user_id, $url_id)
392 392
     {
393 393
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
394
-        $sql= "SELECT user_id FROM $table
394
+        $sql = "SELECT user_id FROM $table
395 395
                WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." ";
396 396
         $result = Database::query($sql);
397 397
         $num = Database::num_rows($result);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     public static function relation_url_course_exist($courseId, $urlId)
410 410
     {
411 411
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
412
-        $sql= "SELECT c_id FROM $table_url_rel_course
412
+        $sql = "SELECT c_id FROM $table_url_rel_course
413 413
                WHERE
414 414
                     access_url_id = ".intval($urlId)." AND
415 415
                     c_id = '".intval($courseId)."'";
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     public static function relationUrlUsergroupExist($userGroupId, $urlId)
431 431
     {
432 432
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
433
-        $sql= "SELECT usergroup_id FROM $table
433
+        $sql = "SELECT usergroup_id FROM $table
434 434
                WHERE 
435 435
                     access_url_id = ".intval($urlId)." AND
436 436
                     usergroup_id = ".intval($userGroupId);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
     * */
450 450
     public static function relation_url_session_exist($session_id, $url_id)
451 451
     {
452
-        $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
452
+        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
453 453
         $session_id = intval($session_id);
454
-        $url_id		= intval($url_id);
454
+        $url_id = intval($url_id);
455 455
         $sql = "SELECT session_id FROM $table_url_rel_session
456 456
                 WHERE
457 457
                     access_url_id = ".intval($url_id)." AND
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         if (is_array($user_list) && is_array($url_list)) {
478 478
             foreach ($url_list as $url_id) {
479 479
                 foreach ($user_list as $user_id) {
480
-                    $count = UrlManager::relation_url_user_exist($user_id,$url_id);
480
+                    $count = UrlManager::relation_url_user_exist($user_id, $url_id);
481 481
                     if ($count == 0) {
482 482
                         $sql = "INSERT INTO $table_url_rel_user
483 483
                                 SET 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param  array of url_ids
506 506
      * @return array
507 507
      **/
508
-    public static function add_courses_to_urls($course_list,$url_list)
508
+    public static function add_courses_to_urls($course_list, $url_list)
509 509
     {
510 510
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
511 511
         $result_array = array();
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                     $courseId = $courseInfo['real_id'];
518 518
 
519 519
                     $count = self::relation_url_course_exist($courseId, $url_id);
520
-                    if ($count==0) {
520
+                    if ($count == 0) {
521 521
                         $sql = "INSERT INTO $table_url_rel_course
522 522
                                 SET c_id = '".$courseId."', access_url_id = ".intval($url_id);
523 523
                         $result = Database::query($sql);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
604 604
     {
605 605
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
606
-        $sql= "SELECT course_category_id FROM $table
606
+        $sql = "SELECT course_category_id FROM $table
607 607
                WHERE access_url_id = ".intval($urlId)." AND
608 608
                      course_category_id = ".intval($categoryCourseId);
609 609
         $result = Database::query($sql);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
         $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
775 775
         $result = true;
776 776
         if (!empty($user_id) && !empty($url_id)) {
777
-            $sql= "DELETE FROM $table_url_rel_user
777
+            $sql = "DELETE FROM $table_url_rel_user
778 778
                    WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id);
779 779
             $result = Database::query($sql);
780 780
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
795 795
         $result = true;
796 796
         if (!empty($userId)) {
797
-            $sql= "DELETE FROM $table_url_rel_user
797
+            $sql = "DELETE FROM $table_url_rel_user
798 798
                    WHERE user_id = ".intval($userId);
799 799
             Database::query($sql);
800 800
         }
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
     * */
813 813
     public static function delete_url_rel_course($courseId, $urlId)
814 814
     {
815
-        $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
816
-        $sql= "DELETE FROM $table_url_rel_course
815
+        $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
816
+        $sql = "DELETE FROM $table_url_rel_course
817 817
                WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)."  ";
818 818
         $result = Database::query($sql);
819 819
 
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
     public static function delete_url_rel_usergroup($userGroupId, $urlId)
832 832
     {
833 833
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
834
-        $sql= "DELETE FROM $table
834
+        $sql = "DELETE FROM $table
835 835
                WHERE usergroup_id = '".intval($userGroupId)."' AND
836 836
                      access_url_id = ".intval($urlId);
837 837
         $result = Database::query($sql);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
851 851
     {
852 852
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
853
-        $sql= "DELETE FROM $table
853
+        $sql = "DELETE FROM $table
854 854
                WHERE course_category_id = '".intval($userGroupId)."' AND
855 855
                      access_url_id=".intval($urlId)."  ";
856 856
         $result = Database::query($sql);
@@ -869,9 +869,9 @@  discard block
 block discarded – undo
869 869
     public static function delete_url_rel_session($session_id, $url_id)
870 870
     {
871 871
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
872
-        $sql= "DELETE FROM $table_url_rel_session
872
+        $sql = "DELETE FROM $table_url_rel_session
873 873
                WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)."  ";
874
-        $result = Database::query($sql,'ASSOC');
874
+        $result = Database::query($sql, 'ASSOC');
875 875
 
876 876
         return $result;
877 877
     }
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
      * */
885 885
     public static function update_urls_rel_user($user_list, $access_url_id)
886 886
     {
887
-        $table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
887
+        $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
888 888
         $sql = "SELECT user_id 
889 889
                 FROM $table_url_rel_user 
890 890
                 WHERE access_url_id = ".intval($access_url_id);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
         $result = Database::query($sql);
941 941
 
942 942
         $existing_courses = array();
943
-        while ($row = Database::fetch_array($result)){
943
+        while ($row = Database::fetch_array($result)) {
944 944
             $existing_courses[] = $row['c_id'];
945 945
         }
946 946
 
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
         $result = Database::query($sql);
974 974
         $existingItems = array();
975 975
 
976
-        while ($row = Database::fetch_array($result)){
976
+        while ($row = Database::fetch_array($result)) {
977 977
             $existingItems[] = $row['usergroup_id'];
978 978
         }
979 979
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
         $result = Database::query($sql);
1007 1007
         $existingItems = array();
1008 1008
 
1009
-        while ($row = Database::fetch_array($result)){
1009
+        while ($row = Database::fetch_array($result)) {
1010 1010
             $existingItems[] = $row['course_category_id'];
1011 1011
         }
1012 1012
 
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
      * */
1047 1047
     public static function update_urls_rel_session($session_list, $access_url_id)
1048 1048
     {
1049
-        $table_url_rel_session	= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1049
+        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1050 1050
 
1051 1051
         $sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".intval($access_url_id);
1052 1052
         $result = Database::query($sql);
1053 1053
         $existing_sessions = array();
1054 1054
 
1055
-        while ($row = Database::fetch_array($result)){
1055
+        while ($row = Database::fetch_array($result)) {
1056 1056
             $existing_sessions[] = $row['session_id'];
1057 1057
         }
1058 1058
 
@@ -1082,13 +1082,13 @@  discard block
 block discarded – undo
1082 1082
      */
1083 1083
     public static function get_access_url_from_user($user_id)
1084 1084
     {
1085
-        $table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
1086
-        $table_url	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1085
+        $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
1086
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1087 1087
         $sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u
1088 1088
                 ON (url_rel_user.access_url_id = u.id)
1089 1089
                 WHERE user_id = ".intval($user_id);
1090 1090
         $result = Database::query($sql);
1091
-        $url_list = Database::store_result($result,'ASSOC');
1091
+        $url_list = Database::store_result($result, 'ASSOC');
1092 1092
 
1093 1093
         return $url_list;
1094 1094
     }
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
      */
1100 1100
     public static function get_access_url_from_course($courseId)
1101 1101
     {
1102
-        $table	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
1103
-        $table_url	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1102
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
1103
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1104 1104
         $sql = "SELECT url, access_url_id FROM $table c INNER JOIN $table_url u
1105 1105
                 ON (c.access_url_id = u.id)
1106 1106
                 WHERE c_id = ".intval($courseId);
1107 1107
 
1108 1108
         $result = Database::query($sql);
1109
-        $url_list = Database::store_result($result,'ASSOC');
1109
+        $url_list = Database::store_result($result, 'ASSOC');
1110 1110
         return $url_list;
1111 1111
     }
1112 1112
 
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
     public static function get_access_url_from_session($session_id)
1118 1118
     {
1119 1119
         $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1120
-        $table_url  = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1120
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1121 1121
         $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u
1122 1122
                 ON (url_rel_session.access_url_id = u.id)
1123 1123
                 WHERE session_id = ".intval($session_id);
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
      */
1134 1134
     public static function get_url_id($url)
1135 1135
     {
1136
-        $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1136
+        $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1137 1137
         $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'";
1138 1138
         $result = Database::query($sql);
1139 1139
         $access_url_id = Database::result($result, 0, 0);
Please login to merge, or discard this patch.
main/inc/lib/tracking.lib.php 4 patches
Braces   +74 added lines, -31 removed lines patch added patch discarded remove patch
@@ -2259,7 +2259,9 @@  discard block
 block discarded – undo
2259 2259
             $debug = false;
2260 2260
         }
2261 2261
 
2262
-        if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>';
2262
+        if ($debug) {
2263
+            echo '<h1>Tracking::get_avg_student_score</h1>';
2264
+        }
2263 2265
         $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
2264 2266
         $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
2265 2267
 
@@ -2336,7 +2338,9 @@  discard block
 block discarded – undo
2336 2338
                             $condition_user1 AND
2337 2339
                             session_id = $session_id
2338 2340
                         GROUP BY lp_id, user_id";
2339
-                if ($debug) echo $sql;
2341
+                if ($debug) {
2342
+                    echo $sql;
2343
+                }
2340 2344
 
2341 2345
                 $rs_last_lp_view_id = Database::query($sql);
2342 2346
 
@@ -2352,7 +2356,9 @@  discard block
 block discarded – undo
2352 2356
                         $lp_view_id = $row_lp_view['id'];
2353 2357
                         $lp_id      = $row_lp_view['lp_id'];
2354 2358
                         $user_id    = $row_lp_view['user_id'];
2355
-                        if ($debug) echo '<h2>LP id '.$lp_id.'</h2>';
2359
+                        if ($debug) {
2360
+                            echo '<h2>LP id '.$lp_id.'</h2>';
2361
+                        }
2356 2362
 
2357 2363
                         if ($get_only_latest_attempt_results) {
2358 2364
                             //Getting lp_items done by the user
@@ -2409,7 +2415,9 @@  discard block
 block discarded – undo
2409 2415
                                          lp_i.c_id  = $course_id AND
2410 2416
                                          (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."')
2411 2417
                                       WHERE lp_view_id = $lp_view_id ";
2412
-                            if ($debug) echo $sql.'<br />';
2418
+                            if ($debug) {
2419
+                                echo $sql.'<br />';
2420
+                            }
2413 2421
                             $res_max_score = Database::query($sql);
2414 2422
 
2415 2423
                             while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
@@ -2428,7 +2436,9 @@  discard block
 block discarded – undo
2428 2436
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2429 2437
                             $score = $row_max_score['score'];
2430 2438
 
2431
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2439
+                            if ($debug) {
2440
+                                echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2441
+                            }
2432 2442
 
2433 2443
                             if ($row_max_score['item_type'] == 'sco') {
2434 2444
                                 /* Check if it is sco (easier to get max_score)
@@ -2448,7 +2458,9 @@  discard block
 block discarded – undo
2448 2458
                                 if (!empty($max_score)) {
2449 2459
                                     $lp_partial_total += $score/$max_score;
2450 2460
                                 }
2451
-                                if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2461
+                                if ($debug) {
2462
+                                    echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2463
+                                }
2452 2464
                             } else {
2453 2465
                                 // Case of a TOOL_QUIZ element
2454 2466
                                 $item_id = $row_max_score['iid'];
@@ -2470,12 +2482,16 @@  discard block
 block discarded – undo
2470 2482
                                         ORDER BY exe_date DESC
2471 2483
                                         LIMIT 1";
2472 2484
 
2473
-                                if ($debug) echo $sql .'<br />';
2485
+                                if ($debug) {
2486
+                                    echo $sql .'<br />';
2487
+                                }
2474 2488
                                 $result_last_attempt = Database::query($sql);
2475 2489
                                 $num = Database :: num_rows($result_last_attempt);
2476 2490
                                 if ($num > 0 ) {
2477 2491
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2478
-                                    if ($debug) echo $id_last_attempt.'<br />';
2492
+                                    if ($debug) {
2493
+                                        echo $id_last_attempt.'<br />';
2494
+                                    }
2479 2495
 
2480 2496
                                     // Within the last attempt number tracking, get the sum of
2481 2497
                                     // the max_scores of all questions that it was
@@ -2494,7 +2510,9 @@  discard block
 block discarded – undo
2494 2510
                                                     q.c_id = $course_id
2495 2511
                                             )
2496 2512
                                             AS t";
2497
-                                    if ($debug) echo '$sql: '.$sql.' <br />';
2513
+                                    if ($debug) {
2514
+                                        echo '$sql: '.$sql.' <br />';
2515
+                                    }
2498 2516
                                     $res_max_score_bis = Database::query($sql);
2499 2517
                                     $row_max_score_bis = Database::fetch_array($res_max_score_bis);
2500 2518
 
@@ -2504,7 +2522,9 @@  discard block
 block discarded – undo
2504 2522
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2505 2523
                                         $lp_partial_total += $score/$max_score;
2506 2524
                                     }
2507
-                                    if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2525
+                                    if ($debug) {
2526
+                                        echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2527
+                                    }
2508 2528
                                 }
2509 2529
                             }
2510 2530
 
@@ -2517,17 +2537,25 @@  discard block
 block discarded – undo
2517 2537
                                         $count_items++;
2518 2538
                                     }
2519 2539
                                 }
2520
-                                if ($debug) echo '$count_items: '.$count_items;
2540
+                                if ($debug) {
2541
+                                    echo '$count_items: '.$count_items;
2542
+                                }
2521 2543
                             }
2522 2544
                         } //end for
2523 2545
 
2524 2546
                         $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0;
2525 2547
 
2526
-                        if ($debug) echo '<h3>$count_items '.$count_items.'</h3>';
2527
-                        if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>';
2548
+                        if ($debug) {
2549
+                            echo '<h3>$count_items '.$count_items.'</h3>';
2550
+                        }
2551
+                        if ($debug) {
2552
+                            echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>';
2553
+                        }
2528 2554
 
2529 2555
                         $global_result += $score_of_scorm_calculate;
2530
-                        if ($debug) echo '<h3>$global_result '.$global_result.'</h3>';
2556
+                        if ($debug) {
2557
+                            echo '<h3>$global_result '.$global_result.'</h3>';
2558
+                        }
2531 2559
                     } // end while
2532 2560
                 }
2533 2561
 
@@ -2540,7 +2568,9 @@  discard block
 block discarded – undo
2540 2568
                                 c_id = $course_id AND
2541 2569
                                 (item_type = 'quiz' OR item_type = 'sco') AND
2542 2570
                                 lp_id = ".$lp_id;
2543
-                    if ($debug) echo $sql;
2571
+                    if ($debug) {
2572
+                        echo $sql;
2573
+                    }
2544 2574
                     $result_have_quiz = Database::query($sql);
2545 2575
 
2546 2576
                     if (Database::num_rows($result_have_quiz) > 0 ) {
@@ -2551,19 +2581,29 @@  discard block
 block discarded – undo
2551 2581
                     }
2552 2582
                 }
2553 2583
 
2554
-                if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2555
-                if ($debug) echo '<h3>Final return</h3>';
2584
+                if ($debug) {
2585
+                    echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2586
+                }
2587
+                if ($debug) {
2588
+                    echo '<h3>Final return</h3>';
2589
+                }
2556 2590
 
2557 2591
                 if ($lp_with_quiz != 0) {
2558 2592
                     if (!$return_array) {
2559 2593
                         $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2560
-                        if ($debug) var_dump($score_of_scorm_calculate);
2594
+                        if ($debug) {
2595
+                            var_dump($score_of_scorm_calculate);
2596
+                        }
2561 2597
                         if (empty($lp_ids)) {
2562
-                            if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2598
+                            if ($debug) {
2599
+                                echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2600
+                            }
2563 2601
                         }
2564 2602
                         return $score_of_scorm_calculate;
2565 2603
                     } else {
2566
-                        if ($debug) var_dump($global_result, $lp_with_quiz);
2604
+                        if ($debug) {
2605
+                            var_dump($global_result, $lp_with_quiz);
2606
+                        }
2567 2607
                         return array($global_result, $lp_with_quiz);
2568 2608
                     }
2569 2609
                 } else {
@@ -3050,11 +3090,13 @@  discard block
 block discarded – undo
3050 3090
 
3051 3091
         if (!empty ($id_session)) {
3052 3092
             $sql .= ' WHERE session_course.session_id=' . $id_session;
3053
-            if (api_is_multiple_url_enabled())
3054
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3055
-        }  else {
3056
-            if (api_is_multiple_url_enabled())
3057
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3093
+            if (api_is_multiple_url_enabled()) {
3094
+                        $sql .=  ' AND access_url_id = '.$access_url_id;
3095
+            }
3096
+        } else {
3097
+            if (api_is_multiple_url_enabled()) {
3098
+                        $sql .=  ' WHERE access_url_id = '.$access_url_id;
3099
+            }
3058 3100
         }
3059 3101
 
3060 3102
         $result = Database::query($sql);
@@ -3162,8 +3204,7 @@  discard block
 block discarded – undo
3162 3204
                 if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date'])
3163 3205
                 ) {
3164 3206
                     $session['status'] = get_lang('SessionActive');
3165
-                }
3166
-                else {
3207
+                } else {
3167 3208
                     $time_start = api_strtotime($session['access_start_date'], 'UTC');
3168 3209
                     $time_end = api_strtotime($session['access_end_date'], 'UTC');
3169 3210
                     if ($time_start < time() && time() < $time_end) {
@@ -6599,8 +6640,9 @@  discard block
 block discarded – undo
6599 6640
     		if (is_array($hpresults)) {
6600 6641
     			for($i = 0; $i < sizeof($hpresults); $i++) {
6601 6642
     				$title = GetQuizName($hpresults[$i][0],'');
6602
-    				if ($title == '')
6603
-    				$title = basename($hpresults[$i][0]);
6643
+    				if ($title == '') {
6644
+    				    				$title = basename($hpresults[$i][0]);
6645
+    				}
6604 6646
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
6605 6647
     				?>
6606 6648
                     <tr>
@@ -6972,8 +7014,9 @@  discard block
 block discarded – undo
6972 7014
     			for($i = 0; $i < sizeof($hpresults); $i++) {
6973 7015
     				$title = GetQuizName($hpresults[$i][0],'');
6974 7016
 
6975
-    				if ($title == '')
6976
-    				$title = basename($hpresults[$i][0]);
7017
+    				if ($title == '') {
7018
+    				    				$title = basename($hpresults[$i][0]);
7019
+    				}
6977 7020
 
6978 7021
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
6979 7022
 
Please login to merge, or discard this patch.
Doc Comments   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1333,6 +1333,8 @@  discard block
 block discarded – undo
1333 1333
      * @param   string type of time filter: 'last_week' or 'custom'
1334 1334
      * @param   string  start date date('Y-m-d H:i:s')
1335 1335
      * @param   string  end date date('Y-m-d H:i:s')
1336
+     * @param string $start_date
1337
+     * @param string $end_date
1336 1338
      * @return timestamp $nb_seconds
1337 1339
      */
1338 1340
     public static function get_time_spent_on_the_platform(
@@ -1435,7 +1437,7 @@  discard block
 block discarded – undo
1435 1437
      * Get first connection date for a student
1436 1438
      * @param    int $student_id
1437 1439
      *
1438
-     * @return    string|bool Date format long without day or false if there are no connections
1440
+     * @return    string|false Date format long without day or false if there are no connections
1439 1441
      */
1440 1442
     public static function get_first_connection_date($student_id)
1441 1443
     {
@@ -1465,7 +1467,7 @@  discard block
 block discarded – undo
1465 1467
      * @param int $student_id
1466 1468
      * @param bool $warning_message Show a warning message (optional)
1467 1469
      * @param bool $return_timestamp True for returning results in timestamp (optional)
1468
-     * @return string|int|bool Date format long without day, false if there are no connections or
1470
+     * @return string Date format long without day, false if there are no connections or
1469 1471
      * timestamp if parameter $return_timestamp is true
1470 1472
      */
1471 1473
     public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false)
@@ -2762,6 +2764,9 @@  discard block
 block discarded – undo
2762 2764
      * @param     array         Limit average to listed lp ids
2763 2765
      * @param     int            Session id (optional), if param $session_id is
2764 2766
      * null(default) it'll return results including sessions, 0 = session is not filtered
2767
+     * @param integer $student_id
2768
+     * @param string $course_code
2769
+     * @param integer $session_id
2765 2770
      * @return     int         Total time
2766 2771
      */
2767 2772
     public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null)
@@ -2831,6 +2836,8 @@  discard block
 block discarded – undo
2831 2836
      * @param     int|array    Student id(s)
2832 2837
      * @param     string         Course code
2833 2838
      * @param     int         Learning path id
2839
+     * @param integer $student_id
2840
+     * @param string $course_code
2834 2841
      * @return     int         Total time
2835 2842
      */
2836 2843
     public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0)
@@ -5504,7 +5511,7 @@  discard block
 block discarded – undo
5504 5511
 
5505 5512
     /**
5506 5513
     * @param FormValidator $form
5507
-    * @return mixed
5514
+    * @return FormValidator
5508 5515
     */
5509 5516
     public static function setUserSearchForm($form)
5510 5517
     {
@@ -6985,7 +6992,7 @@  discard block
 block discarded – undo
6985 6992
      * @param int $user_id
6986 6993
      * @param int $course_id
6987 6994
      * @param int $session_id
6988
-     * @return array
6995
+     * @return string[]
6989 6996
      */
6990 6997
     public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
6991 6998
     {
@@ -7031,9 +7038,9 @@  discard block
 block discarded – undo
7031 7038
     /**
7032 7039
      * Displays the exercise results for a specific user in a specific course.
7033 7040
      * @param   string $view
7034
-     * @param   int $user_id    User ID
7041
+     * @param   int $userId    User ID
7035 7042
      * @param   string  $courseCode Course code
7036
-     * @return array
7043
+     * @return string[]
7037 7044
      * @todo remove globals
7038 7045
      */
7039 7046
     public function display_exercise_tracking_info($view, $userId, $courseCode)
Please login to merge, or discard this patch.
Indentation   +849 added lines, -849 removed lines patch added patch discarded remove patch
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
                     $extend_link = '';
315 315
                     if (!empty($inter_num)) {
316 316
                         $extend_link = Display::url(
317
-                              Display::return_icon('visible.gif', get_lang('HideAttemptView')),
318
-                              api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
317
+                                Display::return_icon('visible.gif', get_lang('HideAttemptView')),
318
+                                api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
319 319
                         );
320 320
                     }
321 321
                     $title = $row['mytitle'];
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
                 $newDate = new DateTime('-30 days', new DateTimeZone('UTC'));
1371 1371
                 $condition_time = " AND (login_date >= '{$newDate->format('Y-m-d H:i:s')}'";
1372 1372
                 $condition_time .= "AND logout_date <= '{$today->format('Y-m-d H:i:s')}') ";
1373
-               break;
1373
+                break;
1374 1374
             case 'custom':
1375 1375
                 if (!empty($start_date) && !empty($end_date)) {
1376 1376
                     $start_date = Database::escape_string($start_date);
@@ -1380,10 +1380,10 @@  discard block
 block discarded – undo
1380 1380
                 break;
1381 1381
         }
1382 1382
 
1383
-    	$sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff
1383
+        $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff
1384 1384
     	        FROM '.$tbl_track_login.'
1385 1385
                 WHERE '.$userCondition.$condition_time;
1386
-    	$rs = Database::query($sql);
1386
+        $rs = Database::query($sql);
1387 1387
         $row = Database::fetch_array($rs, 'ASSOC');
1388 1388
         $diff = $row['diff'];
1389 1389
 
@@ -1405,18 +1405,18 @@  discard block
 block discarded – undo
1405 1405
     public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0)
1406 1406
     {
1407 1407
         $courseId = intval($courseId);
1408
-    	$session_id  = intval($session_id);
1409
-
1410
-    	$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1411
-    	if (is_array($user_id)) {
1412
-    	    $user_id = array_map('intval', $user_id);
1413
-    		$condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1414
-    	} else {
1415
-    		$user_id = intval($user_id);
1416
-    		$condition_user = " AND user_id = $user_id ";
1417
-    	}
1418
-
1419
-    	$sql = "SELECT
1408
+        $session_id  = intval($session_id);
1409
+
1410
+        $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1411
+        if (is_array($user_id)) {
1412
+            $user_id = array_map('intval', $user_id);
1413
+            $condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1414
+        } else {
1415
+            $user_id = intval($user_id);
1416
+            $condition_user = " AND user_id = $user_id ";
1417
+        }
1418
+
1419
+        $sql = "SELECT
1420 1420
     	        SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds
1421 1421
                 FROM $tbl_track_course
1422 1422
                 WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) ";
@@ -1431,9 +1431,9 @@  discard block
 block discarded – undo
1431 1431
 
1432 1432
         $sql .= $condition_user;
1433 1433
         $rs = Database::query($sql);
1434
-    	$row = Database::fetch_array($rs);
1434
+        $row = Database::fetch_array($rs);
1435 1435
 
1436
-    	return $row['nb_seconds'];
1436
+        return $row['nb_seconds'];
1437 1437
     }
1438 1438
 
1439 1439
     /**
@@ -1444,25 +1444,25 @@  discard block
 block discarded – undo
1444 1444
      */
1445 1445
     public static function get_first_connection_date($student_id)
1446 1446
     {
1447
-    	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1448
-    	$sql = 'SELECT login_date
1447
+        $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1448
+        $sql = 'SELECT login_date
1449 1449
     	        FROM ' . $tbl_track_login . '
1450 1450
                 WHERE login_user_id = ' . intval($student_id) . '
1451 1451
                 ORDER BY login_date ASC
1452 1452
                 LIMIT 0,1';
1453 1453
 
1454
-    	$rs = Database::query($sql);
1455
-    	if (Database::num_rows($rs)>0) {
1456
-    		if ($first_login_date = Database::result($rs, 0, 0)) {
1454
+        $rs = Database::query($sql);
1455
+        if (Database::num_rows($rs)>0) {
1456
+            if ($first_login_date = Database::result($rs, 0, 0)) {
1457 1457
                 return api_convert_and_format_date(
1458 1458
                     $first_login_date,
1459 1459
                     DATE_FORMAT_SHORT,
1460 1460
                     date_default_timezone_get()
1461 1461
                 );
1462
-    		}
1463
-    	}
1462
+            }
1463
+        }
1464 1464
 
1465
-    	return false;
1465
+        return false;
1466 1466
     }
1467 1467
 
1468 1468
     /**
@@ -1475,38 +1475,38 @@  discard block
 block discarded – undo
1475 1475
      */
1476 1476
     public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false)
1477 1477
     {
1478
-    	$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1479
-    	$sql = 'SELECT login_date
1478
+        $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1479
+        $sql = 'SELECT login_date
1480 1480
     	        FROM ' . $table . '
1481 1481
                 WHERE login_user_id = ' . intval($student_id) . '
1482 1482
                 ORDER BY login_date
1483 1483
                 DESC LIMIT 0,1';
1484 1484
 
1485
-    	$rs = Database::query($sql);
1486
-    	if (Database::num_rows($rs) > 0) {
1487
-    		if ($last_login_date = Database::result($rs, 0, 0)) {
1488
-    			$last_login_date = api_get_local_time($last_login_date);
1489
-    			if ($return_timestamp) {
1490
-    				return api_strtotime($last_login_date,'UTC');
1491
-    			} else {
1492
-    				if (!$warning_message) {
1493
-    					return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1494
-    				} else {
1495
-    					$timestamp = api_strtotime($last_login_date,'UTC');
1496
-    					$currentTimestamp = time();
1497
-
1498
-    					//If the last connection is > than 7 days, the text is red
1499
-    					//345600 = 7 days in seconds
1500
-    					if ($currentTimestamp - $timestamp > 604800) {
1501
-    						return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1502
-    					} else {
1503
-    						return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1504
-    					}
1505
-    				}
1506
-    			}
1507
-    		}
1508
-    	}
1509
-    	return false;
1485
+        $rs = Database::query($sql);
1486
+        if (Database::num_rows($rs) > 0) {
1487
+            if ($last_login_date = Database::result($rs, 0, 0)) {
1488
+                $last_login_date = api_get_local_time($last_login_date);
1489
+                if ($return_timestamp) {
1490
+                    return api_strtotime($last_login_date,'UTC');
1491
+                } else {
1492
+                    if (!$warning_message) {
1493
+                        return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1494
+                    } else {
1495
+                        $timestamp = api_strtotime($last_login_date,'UTC');
1496
+                        $currentTimestamp = time();
1497
+
1498
+                        //If the last connection is > than 7 days, the text is red
1499
+                        //345600 = 7 days in seconds
1500
+                        if ($currentTimestamp - $timestamp > 604800) {
1501
+                            return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1502
+                        } else {
1503
+                            return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1504
+                        }
1505
+                    }
1506
+                }
1507
+            }
1508
+        }
1509
+        return false;
1510 1510
     }
1511 1511
 
1512 1512
     /**
@@ -1560,30 +1560,30 @@  discard block
 block discarded – undo
1560 1560
         $session_id = 0,
1561 1561
         $convert_date = true
1562 1562
     ) {
1563
-    	$student_id  = intval($student_id);
1563
+        $student_id  = intval($student_id);
1564 1564
         $courseId = intval($courseId);
1565
-    	$session_id  = intval($session_id);
1565
+        $session_id  = intval($session_id);
1566 1566
 
1567
-    	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1568
-    	$sql = 'SELECT login_course_date
1567
+        $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1568
+        $sql = 'SELECT login_course_date
1569 1569
     	        FROM '.$tbl_track_login.'
1570 1570
                 WHERE
1571 1571
                     user_id = '.$student_id.' AND
1572 1572
                     c_id = '.$courseId.' AND
1573 1573
                     session_id = '.$session_id.'
1574 1574
                 ORDER BY login_course_date ASC LIMIT 0,1';
1575
-    	$rs = Database::query($sql);
1576
-    	if (Database::num_rows($rs) > 0) {
1577
-    		if ($first_login_date = Database::result($rs, 0, 0)) {
1578
-    			if ($convert_date) {
1579
-    				return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT);
1580
-    			} else {
1581
-    				return $first_login_date;
1582
-    			}
1583
-    		}
1584
-    	}
1585
-
1586
-    	return false;
1575
+        $rs = Database::query($sql);
1576
+        if (Database::num_rows($rs) > 0) {
1577
+            if ($first_login_date = Database::result($rs, 0, 0)) {
1578
+                if ($convert_date) {
1579
+                    return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT);
1580
+                } else {
1581
+                    return $first_login_date;
1582
+                }
1583
+            }
1584
+        }
1585
+
1586
+        return false;
1587 1587
     }
1588 1588
 
1589 1589
     /**
@@ -1599,13 +1599,13 @@  discard block
 block discarded – undo
1599 1599
         $session_id = 0,
1600 1600
         $convert_date = true
1601 1601
     ) {
1602
-    	// protect data
1603
-    	$student_id  = intval($student_id);
1602
+        // protect data
1603
+        $student_id  = intval($student_id);
1604 1604
         $courseId = $courseInfo['real_id'];
1605
-    	$session_id  = intval($session_id);
1605
+        $session_id  = intval($session_id);
1606 1606
 
1607
-    	$tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
1608
-    	$sql = 'SELECT access_date
1607
+        $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
1608
+        $sql = 'SELECT access_date
1609 1609
                 FROM '.$tbl_track_e_access.'
1610 1610
                 WHERE   access_user_id = '.$student_id.' AND
1611 1611
                         c_id = "'.$courseId.'" AND
@@ -1613,39 +1613,39 @@  discard block
 block discarded – undo
1613 1613
                 ORDER BY access_date DESC
1614 1614
                 LIMIT 0,1';
1615 1615
 
1616
-    	$rs = Database::query($sql);
1617
-    	if (Database::num_rows($rs) > 0) {
1618
-    		if ($last_login_date = Database::result($rs, 0, 0)) {
1616
+        $rs = Database::query($sql);
1617
+        if (Database::num_rows($rs) > 0) {
1618
+            if ($last_login_date = Database::result($rs, 0, 0)) {
1619 1619
                 if (empty($last_login_date)) {
1620 1620
                     return false;
1621 1621
                 }
1622 1622
                 //see #5736
1623 1623
                 $last_login_date_timestamp = api_strtotime($last_login_date);
1624
-    			$now = time();
1625
-    			//If the last connection is > than 7 days, the text is red
1626
-    			//345600 = 7 days in seconds
1627
-    			if ($now - $last_login_date_timestamp > 604800) {
1628
-    				if ($convert_date) {
1624
+                $now = time();
1625
+                //If the last connection is > than 7 days, the text is red
1626
+                //345600 = 7 days in seconds
1627
+                if ($now - $last_login_date_timestamp > 604800) {
1628
+                    if ($convert_date) {
1629 1629
                         $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
1630 1630
                         $icon = api_is_allowed_to_edit() ?
1631 1631
                             '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'">
1632 1632
                               '.Display::return_icon('messagebox_warning.gif').'
1633 1633
                              </a>'
1634 1634
                             : null;
1635
-    					return $icon. Display::label($last_login_date, 'warning');
1636
-    				} else {
1637
-    					return $last_login_date;
1638
-    				}
1639
-    			} else {
1640
-    				if ($convert_date) {
1641
-    					return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
1642
-    				} else {
1643
-    					return $last_login_date;
1644
-    				}
1645
-    			}
1646
-    		}
1647
-    	}
1648
-    	return false;
1635
+                        return $icon. Display::label($last_login_date, 'warning');
1636
+                    } else {
1637
+                        return $last_login_date;
1638
+                    }
1639
+                } else {
1640
+                    if ($convert_date) {
1641
+                        return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT);
1642
+                    } else {
1643
+                        return $last_login_date;
1644
+                    }
1645
+                }
1646
+            }
1647
+        }
1648
+        return false;
1649 1649
     }
1650 1650
 
1651 1651
     /**
@@ -1659,11 +1659,11 @@  discard block
 block discarded – undo
1659 1659
     public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null)
1660 1660
     {
1661 1661
         if ($start < 0) {
1662
-    		$start = 0;
1663
-    	}
1664
-    	if (!isset($stop) or ($stop < 0)) {
1665
-    		$stop = api_get_utc_datetime();
1666
-    	}
1662
+            $start = 0;
1663
+        }
1664
+        if (!isset($stop) or ($stop < 0)) {
1665
+            $stop = api_get_utc_datetime();
1666
+        }
1667 1667
 
1668 1668
         // Given we're storing in cache, round the start and end times
1669 1669
         // to the lower minute
@@ -1672,11 +1672,11 @@  discard block
 block discarded – undo
1672 1672
         $roundedStart = Database::escape_string($roundedStart);
1673 1673
         $roundedStop = Database::escape_string($roundedStop);
1674 1674
 
1675
-    	$month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' ";
1675
+        $month_filter = " AND login_course_date > '$roundedStart' AND login_course_date < '$roundedStop' ";
1676 1676
 
1677 1677
         $courseId = intval($courseId);
1678
-    	$session_id  = intval($session_id);
1679
-    	$count = 0;
1678
+        $session_id  = intval($session_id);
1679
+        $count = 0;
1680 1680
         $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1681 1681
         $sql =  "SELECT count(*) as count_connections
1682 1682
                 FROM $tbl_track_e_course_access
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             }
1716 1716
         }
1717 1717
 
1718
-    	return $count;
1718
+        return $count;
1719 1719
     }
1720 1720
 
1721 1721
     /**
@@ -1726,25 +1726,25 @@  discard block
 block discarded – undo
1726 1726
      */
1727 1727
     public static function count_course_per_student($user_id, $include_sessions = true)
1728 1728
     {
1729
-    	$user_id = intval($user_id);
1730
-    	$tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
1731
-    	$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1729
+        $user_id = intval($user_id);
1730
+        $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
1731
+        $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1732 1732
 
1733
-    	$sql = 'SELECT DISTINCT c_id
1733
+        $sql = 'SELECT DISTINCT c_id
1734 1734
                 FROM ' . $tbl_course_rel_user . '
1735 1735
                 WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH;
1736
-    	$rs = Database::query($sql);
1737
-    	$nb_courses = Database::num_rows($rs);
1736
+        $rs = Database::query($sql);
1737
+        $nb_courses = Database::num_rows($rs);
1738 1738
 
1739
-    	if ($include_sessions) {
1740
-    		$sql = 'SELECT DISTINCT c_id
1739
+        if ($include_sessions) {
1740
+            $sql = 'SELECT DISTINCT c_id
1741 1741
                     FROM ' . $tbl_session_course_rel_user . '
1742 1742
                     WHERE user_id = ' . $user_id;
1743
-    		$rs = Database::query($sql);
1744
-    		$nb_courses += Database::num_rows($rs);
1745
-    	}
1743
+            $rs = Database::query($sql);
1744
+            $nb_courses += Database::num_rows($rs);
1745
+        }
1746 1746
 
1747
-    	return $nb_courses;
1747
+        return $nb_courses;
1748 1748
     }
1749 1749
 
1750 1750
     /**
@@ -1775,25 +1775,25 @@  discard block
 block discarded – undo
1775 1775
         $into_lp = 0
1776 1776
     ) {
1777 1777
         $course_code = Database::escape_string($course_code);
1778
-    	$course_info = api_get_course_info($course_code);
1779
-    	if (!empty($course_info)) {
1780
-    		// table definition
1781
-    		$tbl_course_quiz     = Database::get_course_table(TABLE_QUIZ_TEST);
1782
-    		$tbl_stats_exercise  = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
1783
-
1784
-    		// Compose a filter based on optional exercise given
1785
-    		$condition_quiz = "";
1786
-    		if (!empty($exercise_id)) {
1787
-    			$exercise_id = intval($exercise_id);
1788
-    			$condition_quiz =" AND id = $exercise_id ";
1789
-    		}
1790
-
1791
-    		// Compose a filter based on optional session id given
1792
-    		$condition_session = "";
1793
-    		if (isset($session_id)) {
1794
-    			$session_id = intval($session_id);
1795
-    			$condition_session = " AND session_id = $session_id ";
1796
-    		}
1778
+        $course_info = api_get_course_info($course_code);
1779
+        if (!empty($course_info)) {
1780
+            // table definition
1781
+            $tbl_course_quiz     = Database::get_course_table(TABLE_QUIZ_TEST);
1782
+            $tbl_stats_exercise  = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
1783
+
1784
+            // Compose a filter based on optional exercise given
1785
+            $condition_quiz = "";
1786
+            if (!empty($exercise_id)) {
1787
+                $exercise_id = intval($exercise_id);
1788
+                $condition_quiz =" AND id = $exercise_id ";
1789
+            }
1790
+
1791
+            // Compose a filter based on optional session id given
1792
+            $condition_session = "";
1793
+            if (isset($session_id)) {
1794
+                $session_id = intval($session_id);
1795
+                $condition_session = " AND session_id = $session_id ";
1796
+            }
1797 1797
             if ($active_filter == 1) {
1798 1798
                 $condition_active = 'AND active <> -1';
1799 1799
             } elseif ($active_filter == 0) {
@@ -1809,7 +1809,7 @@  discard block
 block discarded – undo
1809 1809
                 $select_lp_id = ', orig_lp_id as lp_id ';
1810 1810
             }
1811 1811
 
1812
-    		$sql = "SELECT count(id) FROM $tbl_course_quiz
1812
+            $sql = "SELECT count(id) FROM $tbl_course_quiz
1813 1813
     				WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz ";
1814 1814
             $count_quiz = 0;
1815 1815
             $countQuizResult = Database::query($sql);
@@ -1817,21 +1817,21 @@  discard block
 block discarded – undo
1817 1817
                 $count_quiz = Database::fetch_row($countQuizResult);
1818 1818
             }
1819 1819
 
1820
-    		if (!empty($count_quiz[0]) && !empty($student_id)) {
1821
-    			if (is_array($student_id)) {
1820
+            if (!empty($count_quiz[0]) && !empty($student_id)) {
1821
+                if (is_array($student_id)) {
1822 1822
                     $student_id = array_map('intval', $student_id);
1823
-    				$condition_user = " AND exe_user_id IN (".implode(',', $student_id).") ";
1824
-    			} else {
1823
+                    $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") ";
1824
+                } else {
1825 1825
                     $student_id = intval($student_id);
1826
-    				$condition_user = " AND exe_user_id = '$student_id' ";
1827
-    			}
1826
+                    $condition_user = " AND exe_user_id = '$student_id' ";
1827
+                }
1828 1828
 
1829
-    			if (empty($exercise_id)) {
1830
-    				$sql = "SELECT id FROM $tbl_course_quiz
1829
+                if (empty($exercise_id)) {
1830
+                    $sql = "SELECT id FROM $tbl_course_quiz
1831 1831
     						WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz";
1832 1832
                     $result = Database::query($sql);
1833 1833
                     $exercise_list = array();
1834
-    				$exercise_id = null;
1834
+                    $exercise_id = null;
1835 1835
                     if (!empty($result) && Database::num_rows($result)) {
1836 1836
                         while ($row = Database::fetch_array($result)) {
1837 1837
                             $exercise_list[] = $row['id'];
@@ -1840,11 +1840,11 @@  discard block
 block discarded – undo
1840 1840
                     if (!empty($exercise_list)) {
1841 1841
                         $exercise_id = implode("','",$exercise_list);
1842 1842
                     }
1843
-    			}
1843
+                }
1844 1844
 
1845
-    			$count_quiz = Database::fetch_row(Database::query($sql));
1845
+                $count_quiz = Database::fetch_row(Database::query($sql));
1846 1846
 
1847
-    			$sql = "SELECT
1847
+                $sql = "SELECT
1848 1848
     			        SUM(exe_result/exe_weighting*100) as avg_score,
1849 1849
     			        COUNT(*) as num_attempts
1850 1850
     			        $select_lp_id
@@ -1858,20 +1858,20 @@  discard block
 block discarded – undo
1858 1858
                             $condition_into_lp
1859 1859
                         ORDER BY exe_date DESC";
1860 1860
 
1861
-    			$res = Database::query($sql);
1862
-    			$row = Database::fetch_array($res);
1863
-    			$quiz_avg_score = null;
1861
+                $res = Database::query($sql);
1862
+                $row = Database::fetch_array($res);
1863
+                $quiz_avg_score = null;
1864 1864
 
1865
-    			if (!empty($row['avg_score'])) {
1866
-    				$quiz_avg_score = round($row['avg_score'],2);
1867
-    			}
1865
+                if (!empty($row['avg_score'])) {
1866
+                    $quiz_avg_score = round($row['avg_score'],2);
1867
+                }
1868 1868
 
1869
-    			if(!empty($row['num_attempts'])) {
1870
-    				$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1871
-    			}
1872
-    			if (is_array($student_id)) {
1873
-    				$quiz_avg_score = round($quiz_avg_score / count($student_id), 2);
1874
-    			}
1869
+                if(!empty($row['num_attempts'])) {
1870
+                    $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1871
+                }
1872
+                if (is_array($student_id)) {
1873
+                    $quiz_avg_score = round($quiz_avg_score / count($student_id), 2);
1874
+                }
1875 1875
                 if ($into_lp == 0) {
1876 1876
                     return $quiz_avg_score;
1877 1877
                 } else {
@@ -1894,9 +1894,9 @@  discard block
 block discarded – undo
1894 1894
                         return array($quiz_avg_score, null);
1895 1895
                     }
1896 1896
                 }
1897
-    		}
1898
-    	}
1899
-    	return null;
1897
+            }
1898
+        }
1899
+        return null;
1900 1900
     }
1901 1901
 
1902 1902
     /**
@@ -1929,15 +1929,15 @@  discard block
 block discarded – undo
1929 1929
         $find_all_lp = 0
1930 1930
     ) {
1931 1931
         $courseId = intval($courseId);
1932
-    	$student_id  = intval($student_id);
1933
-    	$exercise_id = intval($exercise_id);
1934
-    	$session_id  = intval($session_id);
1932
+        $student_id  = intval($student_id);
1933
+        $exercise_id = intval($exercise_id);
1934
+        $session_id  = intval($session_id);
1935 1935
 
1936
-    	$lp_id = intval($lp_id);
1936
+        $lp_id = intval($lp_id);
1937 1937
         $lp_item_id = intval($lp_item_id);
1938
-    	$tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
1938
+        $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
1939 1939
 
1940
-    	$sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex
1940
+        $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex
1941 1941
                 WHERE  ex.c_id = $courseId
1942 1942
                 AND ex.exe_exo_id = $exercise_id
1943 1943
                 AND status = ''
@@ -1952,11 +1952,11 @@  discard block
 block discarded – undo
1952 1952
                 AND orig_lp_item_id = $lp_item_id";
1953 1953
         }
1954 1954
 
1955
-    	$rs = Database::query($sql);
1956
-    	$row = Database::fetch_row($rs);
1957
-    	$count_attempts = $row[0];
1955
+        $rs = Database::query($sql);
1956
+        $row = Database::fetch_row($rs);
1957
+        $count_attempts = $row[0];
1958 1958
 
1959
-    	return $count_attempts;
1959
+        return $count_attempts;
1960 1960
     }
1961 1961
 
1962 1962
     /**
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
      * @param int    $user_id
1967 1967
      * @param int    $courseId
1968 1968
      * @param int    $session_id
1969
-    */
1969
+     */
1970 1970
     public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id)
1971 1971
     {
1972 1972
         $courseId = intval($courseId);
@@ -3634,8 +3634,8 @@  discard block
 block discarded – undo
3634 3634
 
3635 3635
         $condition_session = '';
3636 3636
         if (isset($session_id)) {
3637
-             $session_id = intval($session_id);
3638
-             $condition_session = ' AND f.session_id = '. $session_id;
3637
+                $session_id = intval($session_id);
3638
+                $condition_session = ' AND f.session_id = '. $session_id;
3639 3639
         }
3640 3640
 
3641 3641
         $groupId = intval($groupId);
@@ -5564,9 +5564,9 @@  discard block
 block discarded – undo
5564 5564
     }
5565 5565
 
5566 5566
     /**
5567
-    * @param FormValidator $form
5568
-    * @return mixed
5569
-    */
5567
+     * @param FormValidator $form
5568
+     * @return mixed
5569
+     */
5570 5570
     public static function setUserSearchForm($form)
5571 5571
     {
5572 5572
         global $_configuration;
@@ -5961,26 +5961,26 @@  discard block
 block discarded – undo
5961 5961
         $session_id = api_get_session_id();
5962 5962
         $course_id = api_get_course_int_id();
5963 5963
 
5964
-    	$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
5965
-    	$table_user = Database :: get_main_table(TABLE_MAIN_USER);
5964
+        $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
5965
+        $table_user = Database :: get_main_table(TABLE_MAIN_USER);
5966 5966
 
5967
-    	$sql = "SELECT count(tool) AS total_number_of_items
5967
+        $sql = "SELECT count(tool) AS total_number_of_items
5968 5968
     	        FROM $table_item_property track_resource, $table_user user
5969 5969
     	        WHERE
5970 5970
                     track_resource.c_id = $course_id AND
5971 5971
                     track_resource.insert_user_id = user.user_id AND
5972 5972
                     session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5973 5973
 
5974
-    	if (isset($_GET['keyword'])) {
5975
-    		$keyword = Database::escape_string(trim($_GET['keyword']));
5976
-    		$sql .= " AND (
5974
+        if (isset($_GET['keyword'])) {
5975
+            $keyword = Database::escape_string(trim($_GET['keyword']));
5976
+            $sql .= " AND (
5977 5977
     		            user.username LIKE '%".$keyword."%' OR
5978 5978
     		            lastedit_type LIKE '%".$keyword."%' OR
5979 5979
     		            tool LIKE '%".$keyword."%'
5980 5980
                     )";
5981
-    	}
5981
+        }
5982 5982
 
5983
-    	$sql .= " AND tool IN (
5983
+        $sql .= " AND tool IN (
5984 5984
     	            'document',
5985 5985
     	            'learnpath',
5986 5986
     	            'quiz',
@@ -5992,10 +5992,10 @@  discard block
 block discarded – undo
5992 5992
     	            'thematic_advance',
5993 5993
     	            'thematic_plan'
5994 5994
                 )";
5995
-    	$res = Database::query($sql);
5996
-    	$obj = Database::fetch_object($res);
5995
+        $res = Database::query($sql);
5996
+        $obj = Database::fetch_object($res);
5997 5997
 
5998
-    	return $obj->total_number_of_items;
5998
+        return $obj->total_number_of_items;
5999 5999
     }
6000 6000
 
6001 6001
     /**
@@ -6010,12 +6010,12 @@  discard block
 block discarded – undo
6010 6010
         $session_id = api_get_session_id();
6011 6011
         $course_id = api_get_course_int_id();
6012 6012
 
6013
-    	$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
6014
-    	$table_user = Database :: get_main_table(TABLE_MAIN_USER);
6015
-    	$table_session = Database :: get_main_table(TABLE_MAIN_SESSION);
6016
-    	$session_id = intval($session_id);
6013
+        $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
6014
+        $table_user = Database :: get_main_table(TABLE_MAIN_USER);
6015
+        $table_session = Database :: get_main_table(TABLE_MAIN_SESSION);
6016
+        $session_id = intval($session_id);
6017 6017
 
6018
-    	$sql = "SELECT
6018
+        $sql = "SELECT
6019 6019
                     tool as col0,
6020 6020
                     lastedit_type as col1,
6021 6021
                     ref as ref,
@@ -6029,16 +6029,16 @@  discard block
 block discarded – undo
6029 6029
                   track_resource.insert_user_id = user.user_id AND
6030 6030
                   session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6031 6031
 
6032
-    	if (isset($_GET['keyword'])) {
6033
-    		$keyword = Database::escape_string(trim($_GET['keyword']));
6034
-    		$sql .= " AND (
6032
+        if (isset($_GET['keyword'])) {
6033
+            $keyword = Database::escape_string(trim($_GET['keyword']));
6034
+            $sql .= " AND (
6035 6035
     		            user.username LIKE '%".$keyword."%' OR
6036 6036
     		            lastedit_type LIKE '%".$keyword."%' OR
6037 6037
     		            tool LIKE '%".$keyword."%'
6038 6038
                      ) ";
6039
-    	}
6039
+        }
6040 6040
 
6041
-    	$sql .= " AND tool IN (
6041
+        $sql .= " AND tool IN (
6042 6042
     	            'document',
6043 6043
     	            'learnpath',
6044 6044
     	            'quiz',
@@ -6051,41 +6051,41 @@  discard block
 block discarded – undo
6051 6051
     	            'thematic_plan'
6052 6052
                 )";
6053 6053
 
6054
-    	if ($column == 0) {
6055
-    		$column = '0';
6056
-    	}
6057
-    	if ($column != '' && $direction != '') {
6058
-    		if ($column != 2 && $column != 4) {
6059
-    			$sql .= " ORDER BY col$column $direction";
6060
-    		}
6061
-    	} else {
6062
-    		$sql .= " ORDER BY col5 DESC ";
6063
-    	}
6054
+        if ($column == 0) {
6055
+            $column = '0';
6056
+        }
6057
+        if ($column != '' && $direction != '') {
6058
+            if ($column != 2 && $column != 4) {
6059
+                $sql .= " ORDER BY col$column $direction";
6060
+            }
6061
+        } else {
6062
+            $sql .= " ORDER BY col5 DESC ";
6063
+        }
6064 6064
 
6065 6065
         $from = intval($from);
6066 6066
         $number_of_items = intval($number_of_items);
6067 6067
 
6068
-    	$sql .= " LIMIT $from, $number_of_items ";
6069
-
6070
-    	$res = Database::query($sql);
6071
-    	$resources = array();
6072
-    	$thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan');
6073
-    	while ($row = Database::fetch_array($res)) {
6074
-    		$ref = $row['ref'];
6075
-    		$table_name = TrackingCourseLog::get_tool_name_table($row['col0']);
6076
-    		$table_tool = Database :: get_course_table($table_name['table_name']);
6068
+        $sql .= " LIMIT $from, $number_of_items ";
6077 6069
 
6078
-    		$id = $table_name['id_tool'];
6079
-    		$recorset = false;
6080
-
6081
-    		if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) {
6082
-    			$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
6083
-    			$sql = "SELECT thematic_id FROM $table_tool
6070
+        $res = Database::query($sql);
6071
+        $resources = array();
6072
+        $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan');
6073
+        while ($row = Database::fetch_array($res)) {
6074
+            $ref = $row['ref'];
6075
+            $table_name = TrackingCourseLog::get_tool_name_table($row['col0']);
6076
+            $table_tool = Database :: get_course_table($table_name['table_name']);
6077
+
6078
+            $id = $table_name['id_tool'];
6079
+            $recorset = false;
6080
+
6081
+            if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) {
6082
+                $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
6083
+                $sql = "SELECT thematic_id FROM $table_tool
6084 6084
     			        WHERE c_id = $course_id AND id = $ref";
6085
-    			$rs_thematic  = Database::query($sql);
6086
-    			if (Database::num_rows($rs_thematic)) {
6087
-    				$row_thematic = Database::fetch_array($rs_thematic);
6088
-    				$thematic_id = $row_thematic['thematic_id'];
6085
+                $rs_thematic  = Database::query($sql);
6086
+                if (Database::num_rows($rs_thematic)) {
6087
+                    $row_thematic = Database::fetch_array($rs_thematic);
6088
+                    $thematic_id = $row_thematic['thematic_id'];
6089 6089
 
6090 6090
                     $sql = "SELECT session.id, session.name, user.username
6091 6091
                             FROM $tbl_thematic t, $table_session session, $table_user user
@@ -6094,9 +6094,9 @@  discard block
 block discarded – undo
6094 6094
                               t.session_id = session.id AND
6095 6095
                               session.id_coach = user.user_id AND
6096 6096
                               t.id = $thematic_id";
6097
-    				$recorset = Database::query($sql);
6098
-    			}
6099
-    		} else {
6097
+                    $recorset = Database::query($sql);
6098
+                }
6099
+            } else {
6100 6100
                 $sql = "SELECT session.id, session.name, user.username
6101 6101
                           FROM $table_tool tool, $table_session session, $table_user user
6102 6102
     			          WHERE
@@ -6104,134 +6104,134 @@  discard block
 block discarded – undo
6104 6104
     			              tool.session_id = session.id AND
6105 6105
     			              session.id_coach = user.user_id AND
6106 6106
     			              tool.$id = $ref";
6107
-    			$recorset = Database::query($sql);
6108
-    		}
6109
-
6110
-    		if (!empty($recorset)) {
6111
-    			$obj = Database::fetch_object($recorset);
6112
-
6113
-    			$name_session = '';
6114
-    			$coach_name = '';
6115
-    			if (!empty($obj)) {
6116
-    				$name_session = $obj->name;
6117
-    				$coach_name   = $obj->username;
6118
-    			}
6119
-
6120
-    			$url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool'];
6121
-    			$row[0] = '';
6122
-    			if ($row['col6'] != 2) {
6123
-    				if (in_array($row['col0'], $thematic_tools)) {
6124
-
6125
-    					$exp_thematic_tool = explode('_', $row['col0']);
6126
-    					$thematic_tool_title = '';
6127
-    					if (is_array($exp_thematic_tool)) {
6128
-    						foreach ($exp_thematic_tool as $exp) {
6129
-    							$thematic_tool_title .= api_ucfirst($exp);
6130
-    						}
6131
-    					} else {
6132
-    						$thematic_tool_title = api_ucfirst($row['col0']);
6133
-    					}
6134
-
6135
-    					$row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>';
6136
-    				} else {
6137
-    					$row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>';
6138
-    				}
6139
-    			} else {
6140
-    				$row[0] = api_ucfirst($row['col0']);
6141
-    			}
6142
-    			$row[1] = get_lang($row[1]);
6143
-    			$row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get());
6144
-    			$row[5] = '';
6145
-    			//@todo Improve this code please
6146
-    			switch ($table_name['table_name']) {
6147
-    				case 'document':
6148
-    					$sql = "SELECT tool.title as title FROM $table_tool tool
6107
+                $recorset = Database::query($sql);
6108
+            }
6109
+
6110
+            if (!empty($recorset)) {
6111
+                $obj = Database::fetch_object($recorset);
6112
+
6113
+                $name_session = '';
6114
+                $coach_name = '';
6115
+                if (!empty($obj)) {
6116
+                    $name_session = $obj->name;
6117
+                    $coach_name   = $obj->username;
6118
+                }
6119
+
6120
+                $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool'];
6121
+                $row[0] = '';
6122
+                if ($row['col6'] != 2) {
6123
+                    if (in_array($row['col0'], $thematic_tools)) {
6124
+
6125
+                        $exp_thematic_tool = explode('_', $row['col0']);
6126
+                        $thematic_tool_title = '';
6127
+                        if (is_array($exp_thematic_tool)) {
6128
+                            foreach ($exp_thematic_tool as $exp) {
6129
+                                $thematic_tool_title .= api_ucfirst($exp);
6130
+                            }
6131
+                        } else {
6132
+                            $thematic_tool_title = api_ucfirst($row['col0']);
6133
+                        }
6134
+
6135
+                        $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>';
6136
+                    } else {
6137
+                        $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>';
6138
+                    }
6139
+                } else {
6140
+                    $row[0] = api_ucfirst($row['col0']);
6141
+                }
6142
+                $row[1] = get_lang($row[1]);
6143
+                $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get());
6144
+                $row[5] = '';
6145
+                //@todo Improve this code please
6146
+                switch ($table_name['table_name']) {
6147
+                    case 'document':
6148
+                        $sql = "SELECT tool.title as title FROM $table_tool tool
6149 6149
                                 WHERE c_id = $course_id AND id = $ref";
6150
-    					$rs_document = Database::query($sql);
6151
-    					$obj_document = Database::fetch_object($rs_document);
6150
+                        $rs_document = Database::query($sql);
6151
+                        $obj_document = Database::fetch_object($rs_document);
6152 6152
                         if ($obj_document) {
6153 6153
                             $row[5] = $obj_document->title;
6154 6154
                         }
6155
-    					break;
6156
-    				case 'announcement':
6155
+                        break;
6156
+                    case 'announcement':
6157 6157
                         $sql = "SELECT title FROM $table_tool
6158 6158
                                 WHERE c_id = $course_id AND id = $ref";
6159
-    					$rs_document = Database::query($sql);
6160
-    					$obj_document = Database::fetch_object($rs_document);
6159
+                        $rs_document = Database::query($sql);
6160
+                        $obj_document = Database::fetch_object($rs_document);
6161 6161
                         if ($obj_document) {
6162 6162
                             $row[5] = $obj_document->title;
6163 6163
                         }
6164
-    					break;
6165
-    				case 'glossary':
6164
+                        break;
6165
+                    case 'glossary':
6166 6166
                         $sql = "SELECT name FROM $table_tool
6167 6167
     					        WHERE c_id = $course_id AND glossary_id = $ref";
6168
-    					$rs_document = Database::query($sql);
6169
-    					$obj_document = Database::fetch_object($rs_document);
6168
+                        $rs_document = Database::query($sql);
6169
+                        $obj_document = Database::fetch_object($rs_document);
6170 6170
                         if ($obj_document) {
6171 6171
                             $row[5] = $obj_document->name;
6172 6172
                         }
6173
-    					break;
6174
-    				case 'lp':
6173
+                        break;
6174
+                    case 'lp':
6175 6175
                         $sql = "SELECT name
6176 6176
                                 FROM $table_tool WHERE c_id = $course_id AND id = $ref";
6177
-    					$rs_document = Database::query($sql);
6178
-    					$obj_document = Database::fetch_object($rs_document);
6179
-    					$row[5] = $obj_document->name;
6180
-    					break;
6181
-    				case 'quiz':
6177
+                        $rs_document = Database::query($sql);
6178
+                        $obj_document = Database::fetch_object($rs_document);
6179
+                        $row[5] = $obj_document->name;
6180
+                        break;
6181
+                    case 'quiz':
6182 6182
                         $sql = "SELECT title FROM $table_tool
6183 6183
                                 WHERE c_id = $course_id AND id = $ref";
6184
-    					$rs_document = Database::query($sql);
6185
-    					$obj_document = Database::fetch_object($rs_document);
6184
+                        $rs_document = Database::query($sql);
6185
+                        $obj_document = Database::fetch_object($rs_document);
6186 6186
                         if ($obj_document) {
6187 6187
                             $row[5] = $obj_document->title;
6188 6188
                         }
6189
-    					break;
6190
-    				case 'course_description':
6189
+                        break;
6190
+                    case 'course_description':
6191 6191
                         $sql = "SELECT title FROM $table_tool
6192 6192
                                 WHERE c_id = $course_id AND id = $ref";
6193
-    					$rs_document = Database::query($sql);
6194
-    					$obj_document = Database::fetch_object($rs_document);
6193
+                        $rs_document = Database::query($sql);
6194
+                        $obj_document = Database::fetch_object($rs_document);
6195 6195
                         if ($obj_document) {
6196 6196
                             $row[5] = $obj_document->title;
6197 6197
                         }
6198
-    					break;
6199
-    				case 'thematic':
6200
-    					$rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6201
-    					if (Database::num_rows($rs) > 0) {
6202
-    						$obj = Database::fetch_object($rs);
6198
+                        break;
6199
+                    case 'thematic':
6200
+                        $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6201
+                        if (Database::num_rows($rs) > 0) {
6202
+                            $obj = Database::fetch_object($rs);
6203 6203
                             if ($obj) {
6204 6204
                                 $row[5] = $obj->title;
6205 6205
                             }
6206
-    					}
6207
-    					break;
6208
-    				case 'thematic_advance':
6209
-    					$rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6210
-    					if (Database::num_rows($rs) > 0) {
6211
-    						$obj = Database::fetch_object($rs);
6206
+                        }
6207
+                        break;
6208
+                    case 'thematic_advance':
6209
+                        $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6210
+                        if (Database::num_rows($rs) > 0) {
6211
+                            $obj = Database::fetch_object($rs);
6212 6212
                             if ($obj) {
6213 6213
                                 $row[5] = $obj->content;
6214 6214
                             }
6215
-    					}
6216
-    					break;
6217
-    				case 'thematic_plan':
6218
-    					$rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6219
-    					if (Database::num_rows($rs) > 0) {
6220
-    						$obj = Database::fetch_object($rs);
6215
+                        }
6216
+                        break;
6217
+                    case 'thematic_plan':
6218
+                        $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref");
6219
+                        if (Database::num_rows($rs) > 0) {
6220
+                            $obj = Database::fetch_object($rs);
6221 6221
                             if ($obj) {
6222 6222
                                 $row[5] = $obj->title;
6223 6223
                             }
6224
-    					}
6225
-    					break;
6226
-    				default:
6227
-    					break;
6228
-    			}
6229
-
6230
-    			$row2 = $name_session;
6231
-    			if (!empty($coach_name)) {
6232
-    				$row2 .= '<br />'.get_lang('Coach').': '.$coach_name;
6233
-    			}
6234
-    			$row[2] = $row2;
6224
+                        }
6225
+                        break;
6226
+                    default:
6227
+                        break;
6228
+                }
6229
+
6230
+                $row2 = $name_session;
6231
+                if (!empty($coach_name)) {
6232
+                    $row2 .= '<br />'.get_lang('Coach').': '.$coach_name;
6233
+                }
6234
+                $row[2] = $row2;
6235 6235
                 if (!empty($row['col3'])) {
6236 6236
                     $userInfo = api_get_user_info($row['user_id']);
6237 6237
                     $row['col3'] = Display::url(
@@ -6247,11 +6247,11 @@  discard block
 block discarded – undo
6247 6247
                     $row[4] = $ip;
6248 6248
                 }
6249 6249
 
6250
-    			$resources[] = $row;
6251
-    		}
6252
-    	}
6250
+                $resources[] = $row;
6251
+            }
6252
+        }
6253 6253
 
6254
-    	return $resources;
6254
+        return $resources;
6255 6255
     }
6256 6256
 
6257 6257
     /**
@@ -6261,63 +6261,63 @@  discard block
 block discarded – undo
6261 6261
      */
6262 6262
     public static function get_tool_name_table($tool)
6263 6263
     {
6264
-    	switch ($tool) {
6265
-    		case 'document':
6266
-    			$table_name = TABLE_DOCUMENT;
6267
-    			$link_tool = 'document/document.php';
6268
-    			$id_tool = 'id';
6269
-    			break;
6270
-    		case 'learnpath':
6271
-    			$table_name = TABLE_LP_MAIN;
6272
-    			$link_tool = 'lp/lp_controller.php';
6273
-    			$id_tool = 'id';
6274
-    			break;
6275
-    		case 'quiz':
6276
-    			$table_name = TABLE_QUIZ_TEST;
6277
-    			$link_tool = 'exercise/exercise.php';
6278
-    			$id_tool = 'id';
6279
-    			break;
6280
-    		case 'glossary':
6281
-    			$table_name = TABLE_GLOSSARY;
6282
-    			$link_tool = 'glossary/index.php';
6283
-    			$id_tool = 'glossary_id';
6284
-    			break;
6285
-    		case 'link':
6286
-    			$table_name = TABLE_LINK;
6287
-    			$link_tool = 'link/link.php';
6288
-    			$id_tool = 'id';
6289
-    			break;
6290
-    		case 'course_description':
6291
-    			$table_name = TABLE_COURSE_DESCRIPTION;
6292
-    			$link_tool = 'course_description/';
6293
-    			$id_tool = 'id';
6294
-    			break;
6295
-    		case 'announcement':
6296
-    			$table_name = TABLE_ANNOUNCEMENT;
6297
-    			$link_tool = 'announcements/announcements.php';
6298
-    			$id_tool = 'id';
6299
-    			break;
6300
-    		case 'thematic':
6301
-    			$table_name = TABLE_THEMATIC;
6302
-    			$link_tool = 'course_progress/index.php';
6303
-    			$id_tool = 'id';
6304
-    			break;
6305
-    		case 'thematic_advance':
6306
-    			$table_name = TABLE_THEMATIC_ADVANCE;
6307
-    			$link_tool = 'course_progress/index.php';
6308
-    			$id_tool = 'id';
6309
-    			break;
6310
-    		case 'thematic_plan':
6311
-    			$table_name = TABLE_THEMATIC_PLAN;
6312
-    			$link_tool = 'course_progress/index.php';
6313
-    			$id_tool = 'id';
6314
-    			break;
6315
-    		default:
6316
-    			$table_name = $tool;
6317
-    		break;
6318
-    	}
6319
-
6320
-    	return array(
6264
+        switch ($tool) {
6265
+            case 'document':
6266
+                $table_name = TABLE_DOCUMENT;
6267
+                $link_tool = 'document/document.php';
6268
+                $id_tool = 'id';
6269
+                break;
6270
+            case 'learnpath':
6271
+                $table_name = TABLE_LP_MAIN;
6272
+                $link_tool = 'lp/lp_controller.php';
6273
+                $id_tool = 'id';
6274
+                break;
6275
+            case 'quiz':
6276
+                $table_name = TABLE_QUIZ_TEST;
6277
+                $link_tool = 'exercise/exercise.php';
6278
+                $id_tool = 'id';
6279
+                break;
6280
+            case 'glossary':
6281
+                $table_name = TABLE_GLOSSARY;
6282
+                $link_tool = 'glossary/index.php';
6283
+                $id_tool = 'glossary_id';
6284
+                break;
6285
+            case 'link':
6286
+                $table_name = TABLE_LINK;
6287
+                $link_tool = 'link/link.php';
6288
+                $id_tool = 'id';
6289
+                break;
6290
+            case 'course_description':
6291
+                $table_name = TABLE_COURSE_DESCRIPTION;
6292
+                $link_tool = 'course_description/';
6293
+                $id_tool = 'id';
6294
+                break;
6295
+            case 'announcement':
6296
+                $table_name = TABLE_ANNOUNCEMENT;
6297
+                $link_tool = 'announcements/announcements.php';
6298
+                $id_tool = 'id';
6299
+                break;
6300
+            case 'thematic':
6301
+                $table_name = TABLE_THEMATIC;
6302
+                $link_tool = 'course_progress/index.php';
6303
+                $id_tool = 'id';
6304
+                break;
6305
+            case 'thematic_advance':
6306
+                $table_name = TABLE_THEMATIC_ADVANCE;
6307
+                $link_tool = 'course_progress/index.php';
6308
+                $id_tool = 'id';
6309
+                break;
6310
+            case 'thematic_plan':
6311
+                $table_name = TABLE_THEMATIC_PLAN;
6312
+                $link_tool = 'course_progress/index.php';
6313
+                $id_tool = 'id';
6314
+                break;
6315
+            default:
6316
+                $table_name = $tool;
6317
+            break;
6318
+        }
6319
+
6320
+        return array(
6321 6321
             'table_name' => $table_name,
6322 6322
             'link_tool' => $link_tool,
6323 6323
             'id_tool' => $id_tool
@@ -6326,45 +6326,45 @@  discard block
 block discarded – undo
6326 6326
 
6327 6327
     public static function display_additional_profile_fields()
6328 6328
     {
6329
-    	// getting all the extra profile fields that are defined by the platform administrator
6330
-    	$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6331
-
6332
-    	// creating the form
6333
-    	$return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
6334
-
6335
-    	// the select field with the additional user profile fields (= this is where we select the field of which we want to see
6336
-    	// the information the users have entered or selected.
6337
-    	$return .= '<select name="additional_profile_field">';
6338
-    	$return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>';
6339
-    	$extra_fields_to_show = 0;
6340
-    	foreach ($extra_fields as $key=>$field) {
6341
-    		// show only extra fields that are visible + and can be filtered, added by J.Montoya
6342
-    		if ($field[6]==1 && $field[8] == 1) {
6343
-    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6344
-    				$selected = 'selected="selected"';
6345
-    			} else {
6346
-    				$selected = '';
6347
-    			}
6348
-    			$extra_fields_to_show++;
6349
-    			$return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>';
6350
-    		}
6351
-    	}
6352
-    	$return .= '</select>';
6353
-
6354
-    	// the form elements for the $_GET parameters (because the form is passed through GET
6355
-    	foreach ($_GET as $key=>$value){
6356
-    		if ($key <> 'additional_profile_field')    {
6357
-    			$return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6358
-    		}
6359
-    	}
6360
-    	// the submit button
6361
-    	$return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>';
6362
-    	$return .= '</form>';
6363
-    	if ($extra_fields_to_show > 0) {
6364
-    		return $return;
6365
-    	} else {
6366
-    		return '';
6367
-    	}
6329
+        // getting all the extra profile fields that are defined by the platform administrator
6330
+        $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6331
+
6332
+        // creating the form
6333
+        $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
6334
+
6335
+        // the select field with the additional user profile fields (= this is where we select the field of which we want to see
6336
+        // the information the users have entered or selected.
6337
+        $return .= '<select name="additional_profile_field">';
6338
+        $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>';
6339
+        $extra_fields_to_show = 0;
6340
+        foreach ($extra_fields as $key=>$field) {
6341
+            // show only extra fields that are visible + and can be filtered, added by J.Montoya
6342
+            if ($field[6]==1 && $field[8] == 1) {
6343
+                if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6344
+                    $selected = 'selected="selected"';
6345
+                } else {
6346
+                    $selected = '';
6347
+                }
6348
+                $extra_fields_to_show++;
6349
+                $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>';
6350
+            }
6351
+        }
6352
+        $return .= '</select>';
6353
+
6354
+        // the form elements for the $_GET parameters (because the form is passed through GET
6355
+        foreach ($_GET as $key=>$value){
6356
+            if ($key <> 'additional_profile_field')    {
6357
+                $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6358
+            }
6359
+        }
6360
+        // the submit button
6361
+        $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>';
6362
+        $return .= '</form>';
6363
+        if ($extra_fields_to_show > 0) {
6364
+            return $return;
6365
+        } else {
6366
+            return '';
6367
+        }
6368 6368
     }
6369 6369
 
6370 6370
     /**
@@ -6383,31 +6383,31 @@  discard block
 block discarded – undo
6383 6383
      */
6384 6384
     public static function get_addtional_profile_information_of_field_by_user($field_id, $users)
6385 6385
     {
6386
-    	// Database table definition
6387
-    	$table_user = Database::get_main_table(TABLE_MAIN_USER);
6388
-    	$table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6386
+        // Database table definition
6387
+        $table_user = Database::get_main_table(TABLE_MAIN_USER);
6388
+        $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6389 6389
         $extraField = Database::get_main_table(TABLE_EXTRA_FIELD);
6390
-    	$result_extra_field = UserManager::get_extra_field_information($field_id);
6391
-
6392
-    	if (!empty($users)) {
6393
-    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6394
-    			foreach($users as $user_id) {
6395
-    				$user_result = UserManager::get_user_tags($user_id, $field_id);
6396
-    				$tag_list = array();
6397
-    				foreach($user_result as $item) {
6398
-    					$tag_list[] = $item['tag'];
6399
-    				}
6400
-    				$return[$user_id][] = implode(', ',$tag_list);
6401
-    			}
6402
-    		} else {
6403
-    			$new_user_array = array();
6404
-    			foreach ($users as $user_id) {
6405
-    				$new_user_array[]= "'".$user_id."'";
6406
-    			}
6407
-    			$users = implode(',',$new_user_array);
6390
+        $result_extra_field = UserManager::get_extra_field_information($field_id);
6391
+
6392
+        if (!empty($users)) {
6393
+            if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6394
+                foreach($users as $user_id) {
6395
+                    $user_result = UserManager::get_user_tags($user_id, $field_id);
6396
+                    $tag_list = array();
6397
+                    foreach($user_result as $item) {
6398
+                        $tag_list[] = $item['tag'];
6399
+                    }
6400
+                    $return[$user_id][] = implode(', ',$tag_list);
6401
+                }
6402
+            } else {
6403
+                $new_user_array = array();
6404
+                foreach ($users as $user_id) {
6405
+                    $new_user_array[]= "'".$user_id."'";
6406
+                }
6407
+                $users = implode(',',$new_user_array);
6408 6408
                 $extraFieldType = EntityExtraField::USER_FIELD_TYPE;
6409
-    			// Selecting only the necessary information NOT ALL the user list
6410
-    			$sql = "SELECT user.user_id, v.value
6409
+                // Selecting only the necessary information NOT ALL the user list
6410
+                $sql = "SELECT user.user_id, v.value
6411 6411
     			        FROM $table_user user
6412 6412
     			        INNER JOIN $table_user_field_values v
6413 6413
                         ON (user.user_id = v.item_id)
@@ -6418,27 +6418,27 @@  discard block
 block discarded – undo
6418 6418
                             v.field_id=".intval($field_id)." AND
6419 6419
                             user.user_id IN ($users)";
6420 6420
 
6421
-    			$result = Database::query($sql);
6422
-    			while($row = Database::fetch_array($result)) {
6423
-    				// get option value for field type double select by id
6424
-    				if (!empty($row['value'])) {
6425
-    					if ($result_extra_field['field_type'] ==
6421
+                $result = Database::query($sql);
6422
+                while($row = Database::fetch_array($result)) {
6423
+                    // get option value for field type double select by id
6424
+                    if (!empty($row['value'])) {
6425
+                        if ($result_extra_field['field_type'] ==
6426 6426
                             ExtraField::FIELD_TYPE_DOUBLE_SELECT
6427 6427
                         ) {
6428
-    						$id_double_select = explode(';', $row['value']);
6429
-    						if (is_array($id_double_select)) {
6430
-    							$value1 = $result_extra_field['options'][$id_double_select[0]]['option_value'];
6431
-    							$value2 = $result_extra_field['options'][$id_double_select[1]]['option_value'];
6432
-    							$row['value'] = ($value1.';'.$value2);
6433
-    						}
6434
-    					}
6435
-    				}
6436
-    				// get other value from extra field
6437
-    				$return[$row['user_id']][] = $row['value'];
6438
-    			}
6439
-    		}
6440
-    	}
6441
-    	return $return;
6428
+                            $id_double_select = explode(';', $row['value']);
6429
+                            if (is_array($id_double_select)) {
6430
+                                $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value'];
6431
+                                $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value'];
6432
+                                $row['value'] = ($value1.';'.$value2);
6433
+                            }
6434
+                        }
6435
+                    }
6436
+                    // get other value from extra field
6437
+                    $return[$row['user_id']][] = $row['value'];
6438
+                }
6439
+            }
6440
+        }
6441
+        return $return;
6442 6442
     }
6443 6443
 
6444 6444
     /**
@@ -6447,18 +6447,18 @@  discard block
 block discarded – undo
6447 6447
      */
6448 6448
     public function count_student_in_course()
6449 6449
     {
6450
-    	global $nbStudents;
6451
-    	return $nbStudents;
6450
+        global $nbStudents;
6451
+        return $nbStudents;
6452 6452
     }
6453 6453
 
6454 6454
     public function sort_users($a, $b)
6455 6455
     {
6456
-    	return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']])));
6456
+        return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']])));
6457 6457
     }
6458 6458
 
6459 6459
     public function sort_users_desc($a, $b)
6460 6460
     {
6461
-    	return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6461
+        return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6462 6462
     }
6463 6463
 
6464 6464
     /**
@@ -6467,8 +6467,8 @@  discard block
 block discarded – undo
6467 6467
      */
6468 6468
     public static function get_number_of_users()
6469 6469
     {
6470
-    	global $user_ids;
6471
-    	return count($user_ids);
6470
+        global $user_ids;
6471
+        return count($user_ids);
6472 6472
     }
6473 6473
 
6474 6474
     /**
@@ -6484,37 +6484,37 @@  discard block
 block discarded – undo
6484 6484
     {
6485 6485
         global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id;
6486 6486
 
6487
-    	$course_code = Database::escape_string($course_code);
6488
-    	$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
6489
-    	$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
6487
+        $course_code = Database::escape_string($course_code);
6488
+        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
6489
+        $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
6490 6490
 
6491
-    	$access_url_id = api_get_current_access_url_id();
6491
+        $access_url_id = api_get_current_access_url_id();
6492 6492
 
6493
-    	// get all users data from a course for sortable with limit
6494
-    	if (is_array($user_ids)) {
6495
-    		$user_ids = array_map('intval', $user_ids);
6496
-    		$condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6497
-    	} else {
6498
-    		$user_ids = intval($user_ids);
6499
-    		$condition_user = " WHERE user.user_id = $user_ids ";
6500
-    	}
6493
+        // get all users data from a course for sortable with limit
6494
+        if (is_array($user_ids)) {
6495
+            $user_ids = array_map('intval', $user_ids);
6496
+            $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6497
+        } else {
6498
+            $user_ids = intval($user_ids);
6499
+            $condition_user = " WHERE user.user_id = $user_ids ";
6500
+        }
6501 6501
 
6502
-    	if (!empty($_GET['user_keyword'])) {
6503
-    		$keyword = trim(Database::escape_string($_GET['user_keyword']));
6504
-    		$condition_user .=  " AND (
6502
+        if (!empty($_GET['user_keyword'])) {
6503
+            $keyword = trim(Database::escape_string($_GET['user_keyword']));
6504
+            $condition_user .=  " AND (
6505 6505
                 user.firstname LIKE '%".$keyword."%' OR
6506 6506
                 user.lastname LIKE '%".$keyword."%'  OR
6507 6507
                 user.username LIKE '%".$keyword."%'  OR
6508 6508
                 user.email LIKE '%".$keyword."%'
6509 6509
              ) ";
6510
-    	}
6510
+        }
6511 6511
 
6512 6512
         $url_table = null;
6513 6513
         $url_condition = null;
6514
-    	if (api_is_multiple_url_enabled()) {
6515
-    		$url_table = ", ".$tbl_url_rel_user." as url_users";
6516
-    		$url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'";
6517
-    	}
6514
+        if (api_is_multiple_url_enabled()) {
6515
+            $url_table = ", ".$tbl_url_rel_user." as url_users";
6516
+            $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'";
6517
+        }
6518 6518
 
6519 6519
         $invitedUsersCondition = '';
6520 6520
 
@@ -6522,7 +6522,7 @@  discard block
 block discarded – undo
6522 6522
             $invitedUsersCondition = " AND user.status != " . INVITEE;
6523 6523
         }
6524 6524
 
6525
-    	$sql = "SELECT  user.user_id as user_id,
6525
+        $sql = "SELECT  user.user_id as user_id,
6526 6526
                     user.official_code  as col0,
6527 6527
                     user.lastname       as col1,
6528 6528
                     user.firstname      as col2,
@@ -6530,16 +6530,16 @@  discard block
 block discarded – undo
6530 6530
                 FROM $tbl_user as user $url_table
6531 6531
     	        $condition_user $url_condition $invitedUsersCondition";
6532 6532
 
6533
-    	if (!in_array($direction, array('ASC','DESC'))) {
6534
-    		$direction = 'ASC';
6535
-    	}
6533
+        if (!in_array($direction, array('ASC','DESC'))) {
6534
+            $direction = 'ASC';
6535
+        }
6536 6536
 
6537
-    	$column = intval($column);
6538
-    	$from = intval($from);
6539
-    	$number_of_items = intval($number_of_items);
6537
+        $column = intval($column);
6538
+        $from = intval($from);
6539
+        $number_of_items = intval($number_of_items);
6540 6540
 
6541
-    	$sql .= " ORDER BY col$column $direction ";
6542
-    	$sql .= " LIMIT $from,$number_of_items";
6541
+        $sql .= " ORDER BY col$column $direction ";
6542
+        $sql .= " LIMIT $from,$number_of_items";
6543 6543
 
6544 6544
         $res = Database::query($sql);
6545 6545
         $users = array();
@@ -6573,7 +6573,7 @@  discard block
 block discarded – undo
6573 6573
             }
6574 6574
         }
6575 6575
 
6576
-    	while ($user = Database::fetch_array($res, 'ASSOC')) {
6576
+        while ($user = Database::fetch_array($res, 'ASSOC')) {
6577 6577
             $courseInfo = api_get_course_info($course_code);
6578 6578
             $courseId = $courseInfo['real_id'];
6579 6579
 
@@ -6604,10 +6604,10 @@  discard block
 block discarded – undo
6604 6604
                 $session_id
6605 6605
             );
6606 6606
 
6607
-    		if (empty($avg_student_progress)) {
6607
+            if (empty($avg_student_progress)) {
6608 6608
                 $avg_student_progress = 0;
6609
-    		}
6610
-    		$user['average_progress'] = $avg_student_progress.'%';
6609
+            }
6610
+            $user['average_progress'] = $avg_student_progress.'%';
6611 6611
 
6612 6612
             $total_user_exercise = Tracking::get_exercise_student_progress(
6613 6613
                 $total_exercises,
@@ -6627,11 +6627,11 @@  discard block
 block discarded – undo
6627 6627
 
6628 6628
             $user['exercise_average_best_attempt'] = $total_user_exercise;
6629 6629
 
6630
-    		if (is_numeric($avg_student_score)) {
6631
-    			$user['student_score']  = $avg_student_score.'%';
6632
-    		} else {
6633
-    			$user['student_score']  = $avg_student_score;
6634
-    		}
6630
+            if (is_numeric($avg_student_score)) {
6631
+                $user['student_score']  = $avg_student_score.'%';
6632
+            } else {
6633
+                $user['student_score']  = $avg_student_score;
6634
+            }
6635 6635
 
6636 6636
             $user['count_assignments'] = Tracking::count_student_assignments(
6637 6637
                 $user['user_id'],
@@ -6654,29 +6654,29 @@  discard block
 block discarded – undo
6654 6654
                 $session_id
6655 6655
             );
6656 6656
 
6657
-    		// we need to display an additional profile field
6658
-    		$user['additional'] = '';
6657
+            // we need to display an additional profile field
6658
+            $user['additional'] = '';
6659 6659
 
6660
-    		if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6661
-    			if (isset($additional_user_profile_info[$user['user_id']]) &&
6660
+            if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6661
+                if (isset($additional_user_profile_info[$user['user_id']]) &&
6662 6662
                     is_array($additional_user_profile_info[$user['user_id']])
6663 6663
                 ) {
6664
-    				$user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]);
6665
-    			}
6666
-    		}
6664
+                    $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]);
6665
+                }
6666
+            }
6667 6667
 
6668 6668
             if (empty($session_id)) {
6669 6669
                 $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys;
6670 6670
             }
6671 6671
 
6672
-    		$user['link'] = '<center>
6672
+            $user['link'] = '<center>
6673 6673
                              <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'">
6674 6674
     		                 '.Display::return_icon('2rightarrow.png').'
6675 6675
     		                 </a>
6676 6676
                          </center>';
6677 6677
 
6678
-    		// store columns in array $users
6679
-    		$is_western_name_order = api_is_western_name_order();
6678
+            // store columns in array $users
6679
+            $is_western_name_order = api_is_western_name_order();
6680 6680
             $user_row = array();
6681 6681
             $user_row[]= $user['official_code']; //0
6682 6682
             if ($is_western_name_order) {
@@ -6712,21 +6712,21 @@  discard block
 block discarded – undo
6712 6712
 
6713 6713
             $users[] = $user_row;
6714 6714
 
6715
-    		if ($export_csv) {
6716
-    		    if (empty($session_id)) {
6715
+            if ($export_csv) {
6716
+                if (empty($session_id)) {
6717 6717
                     $user_row = array_map('strip_tags', $user_row);
6718
-    			    unset($user_row[14]);
6719
-    			    unset($user_row[15]);
6718
+                    unset($user_row[14]);
6719
+                    unset($user_row[15]);
6720 6720
                 } else {
6721 6721
                     $user_row = array_map('strip_tags', $user_row);
6722 6722
                     unset($user_row[13]);
6723 6723
                     unset($user_row[14]);
6724 6724
                 }
6725 6725
 
6726
-    			$csv_content[] = $user_row;
6727
-    		}
6728
-    	}
6729
-    	return $users;
6726
+                $csv_content[] = $user_row;
6727
+            }
6728
+        }
6729
+        return $users;
6730 6730
     }
6731 6731
 }
6732 6732
 
@@ -6744,18 +6744,18 @@  discard block
 block discarded – undo
6744 6744
      */
6745 6745
     public static function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
6746 6746
     {
6747
-    	$MonthsLong = $GLOBALS['MonthsLong'];
6748
-
6749
-    	// protected data
6750
-    	$user_id = intval($user_id);
6751
-    	$session_id = intval($session_id);
6752
-    	$course_id = Database::escape_string($course_id);
6753
-
6754
-    	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6755
-    	$tempView = $view;
6756
-    	if(substr($view,0,1) == '1') {
6757
-    		$new_view = substr_replace($view,'0',0,1);
6758
-    		echo "
6747
+        $MonthsLong = $GLOBALS['MonthsLong'];
6748
+
6749
+        // protected data
6750
+        $user_id = intval($user_id);
6751
+        $session_id = intval($session_id);
6752
+        $course_id = Database::escape_string($course_id);
6753
+
6754
+        $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6755
+        $tempView = $view;
6756
+        if(substr($view,0,1) == '1') {
6757
+            $new_view = substr_replace($view,'0',0,1);
6758
+            echo "
6759 6759
                 <tr>
6760 6760
                     <td valign='top'>
6761 6761
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font>" .
@@ -6763,9 +6763,9 @@  discard block
 block discarded – undo
6763 6763
                     </td>
6764 6764
                 </tr>
6765 6765
                 ";
6766
-    		echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>";
6766
+            echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>";
6767 6767
 
6768
-    		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
6768
+            $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
6769 6769
                         FROM $track_access_table
6770 6770
                         WHERE access_user_id = $user_id
6771 6771
                         AND c_id = $course_id
@@ -6773,11 +6773,11 @@  discard block
 block discarded – undo
6773 6773
                         GROUP BY YEAR(access_date),MONTH(access_date)
6774 6774
                         ORDER BY YEAR(access_date),MONTH(access_date) ASC";
6775 6775
 
6776
-    		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6777
-    		$results = getManyResults3Col($sql);
6776
+            echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6777
+            $results = getManyResults3Col($sql);
6778 6778
 
6779
-    		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6780
-    		echo "<tr>
6779
+            echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6780
+            echo "<tr>
6781 6781
                     <td class='secLine'>
6782 6782
                     ".get_lang('LoginsTitleMonthColumn')."
6783 6783
                     </td>
@@ -6785,36 +6785,36 @@  discard block
 block discarded – undo
6785 6785
                     ".get_lang('LoginsTitleCountColumn')."
6786 6786
                     </td>
6787 6787
                 </tr>";
6788
-    		$total = 0;
6789
-    		if (is_array($results)) {
6790
-    			for($j = 0 ; $j < count($results) ; $j++) {
6791
-    				echo "<tr>";
6792
-    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6793
-    				echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6794
-    				echo"</tr>";
6795
-    				$total = $total + $results[$j][1];
6796
-    			}
6797
-    			echo "<tr>";
6798
-    			echo "<td>".get_lang('Total')."</td>";
6799
-    			echo "<td align='right' class='content'>".$total."</td>";
6800
-    			echo"</tr>";
6801
-    		} else {
6802
-    			echo "<tr>";
6803
-    			echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>";
6804
-    			echo"</tr>";
6805
-    		}
6806
-    		echo "</table>";
6807
-    		echo "</td></tr>";
6808
-    	} else {
6809
-    		$new_view = substr_replace($view,'1',0,1);
6810
-    		echo "
6788
+            $total = 0;
6789
+            if (is_array($results)) {
6790
+                for($j = 0 ; $j < count($results) ; $j++) {
6791
+                    echo "<tr>";
6792
+                    echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6793
+                    echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6794
+                    echo"</tr>";
6795
+                    $total = $total + $results[$j][1];
6796
+                }
6797
+                echo "<tr>";
6798
+                echo "<td>".get_lang('Total')."</td>";
6799
+                echo "<td align='right' class='content'>".$total."</td>";
6800
+                echo"</tr>";
6801
+            } else {
6802
+                echo "<tr>";
6803
+                echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>";
6804
+                echo"</tr>";
6805
+            }
6806
+            echo "</table>";
6807
+            echo "</td></tr>";
6808
+        } else {
6809
+            $new_view = substr_replace($view,'1',0,1);
6810
+            echo "
6811 6811
                 <tr>
6812 6812
                     <td valign='top'>
6813 6813
                     +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a>
6814 6814
                     </td>
6815 6815
                 </tr>
6816 6816
             ";
6817
-    	}
6817
+        }
6818 6818
     }
6819 6819
 
6820 6820
     /**
@@ -6827,38 +6827,38 @@  discard block
 block discarded – undo
6827 6827
      */
6828 6828
     public static function display_exercise_tracking_info($view, $user_id, $courseCode)
6829 6829
     {
6830
-    	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6830
+        global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6831 6831
         $courseId = api_get_course_int_id($courseCode);
6832
-    	if(substr($view,1,1) == '1') {
6833
-    		$new_view = substr_replace($view,'0',1,1);
6834
-    		echo "<tr>
6832
+        if(substr($view,1,1) == '1') {
6833
+            $new_view = substr_replace($view,'0',1,1);
6834
+            echo "<tr>
6835 6835
                     <td valign='top'>
6836 6836
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>]
6837 6837
                     </td>
6838 6838
                 </tr>";
6839
-    		echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />";
6839
+            echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />";
6840 6840
 
6841
-    		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
6841
+            $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
6842 6842
                     FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te
6843 6843
                     WHERE te.c_id = $courseId
6844 6844
                         AND te.exe_user_id = ".intval($user_id)."
6845 6845
                         AND te.exe_exo_id = ce.id
6846 6846
                     ORDER BY ce.title ASC, te.exe_date ASC";
6847 6847
 
6848
-    		$hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
6848
+            $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
6849 6849
                         FROM $TBL_TRACK_HOTPOTATOES AS te
6850 6850
                         WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId
6851 6851
                         ORDER BY te.c_id ASC, te.exe_date ASC";
6852 6852
 
6853
-    		$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
6853
+            $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
6854 6854
 
6855
-    		$NoTestRes = 0;
6856
-    		$NoHPTestRes = 0;
6855
+            $NoTestRes = 0;
6856
+            $NoHPTestRes = 0;
6857 6857
 
6858
-    		echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n";
6859
-    		$results = StatsUtils::getManyResultsXCol($sql, 4);
6860
-    		echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n";
6861
-    		echo "
6858
+            echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n";
6859
+            $results = StatsUtils::getManyResultsXCol($sql, 4);
6860
+            echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n";
6861
+            echo "
6862 6862
                 <tr bgcolor='#E6E6E6'>
6863 6863
                     <td>
6864 6864
                     ".get_lang('ExercicesTitleExerciceColumn')."
@@ -6871,28 +6871,28 @@  discard block
 block discarded – undo
6871 6871
                     </td>
6872 6872
                 </tr>";
6873 6873
 
6874
-    		if (is_array($results)) {
6875
-    			for($i = 0; $i < sizeof($results); $i++) {
6876
-    				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6877
-    				echo "<tr>\n";
6878
-    				echo "<td class='content'>".$results[$i][0]."</td>\n";
6879
-    				echo "<td class='content'>".$display_date."</td>\n";
6880
-    				echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n";
6881
-    				echo "</tr>\n";
6882
-    			}
6883
-    		} else {
6884
-    			// istvan begin
6885
-    			$NoTestRes = 1;
6886
-    		}
6887
-
6888
-    		// The Result of Tests
6889
-    		if (is_array($hpresults)) {
6890
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6891
-    				$title = GetQuizName($hpresults[$i][0],'');
6892
-    				if ($title == '')
6893
-    				$title = basename($hpresults[$i][0]);
6894
-    				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
6895
-    				?>
6874
+            if (is_array($results)) {
6875
+                for($i = 0; $i < sizeof($results); $i++) {
6876
+                    $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6877
+                    echo "<tr>\n";
6878
+                    echo "<td class='content'>".$results[$i][0]."</td>\n";
6879
+                    echo "<td class='content'>".$display_date."</td>\n";
6880
+                    echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n";
6881
+                    echo "</tr>\n";
6882
+                }
6883
+            } else {
6884
+                // istvan begin
6885
+                $NoTestRes = 1;
6886
+            }
6887
+
6888
+            // The Result of Tests
6889
+            if (is_array($hpresults)) {
6890
+                for($i = 0; $i < sizeof($hpresults); $i++) {
6891
+                    $title = GetQuizName($hpresults[$i][0],'');
6892
+                    if ($title == '')
6893
+                    $title = basename($hpresults[$i][0]);
6894
+                    $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
6895
+                    ?>
6896 6896
                     <tr>
6897 6897
                         <td class="content"><?php echo $title; ?></td>
6898 6898
                         <td class="content" align="center"><?php echo $display_date; ?></td>
@@ -6902,26 +6902,26 @@  discard block
 block discarded – undo
6902 6902
 
6903 6903
                     <?php
6904 6904
                 }
6905
-    		} else {
6906
-    			$NoHPTestRes = 1;
6907
-    		}
6908
-
6909
-    		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
6910
-    			echo "<tr>\n";
6911
-    			echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n";
6912
-    			echo "</tr>\n";
6913
-    		}
6914
-    		echo "</table>";
6915
-    		echo "</td>\n</tr>\n";
6916
-    	} else {
6917
-    		$new_view = substr_replace($view,'1',1,1);
6918
-    		echo "
6905
+            } else {
6906
+                $NoHPTestRes = 1;
6907
+            }
6908
+
6909
+            if ($NoTestRes == 1 && $NoHPTestRes == 1) {
6910
+                echo "<tr>\n";
6911
+                echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n";
6912
+                echo "</tr>\n";
6913
+            }
6914
+            echo "</table>";
6915
+            echo "</td>\n</tr>\n";
6916
+        } else {
6917
+            $new_view = substr_replace($view,'1',1,1);
6918
+            echo "
6919 6919
                 <tr>
6920 6920
                     <td valign='top'>
6921 6921
                         +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a>
6922 6922
                     </td>
6923 6923
                 </tr>";
6924
-    	}
6924
+        }
6925 6925
     }
6926 6926
 
6927 6927
     /**
@@ -6930,27 +6930,27 @@  discard block
 block discarded – undo
6930 6930
      */
6931 6931
     public static function display_student_publications_tracking_info($view, $user_id, $course_id)
6932 6932
     {
6933
-    	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6933
+        global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6934 6934
         $_course = api_get_course_info_by_id($course_id);
6935 6935
 
6936
-    	if (substr($view,2,1) == '1') {
6937
-    		$new_view = substr_replace($view,'0',2,1);
6938
-    		echo "<tr>
6936
+        if (substr($view,2,1) == '1') {
6937
+            $new_view = substr_replace($view,'0',2,1);
6938
+            echo "<tr>
6939 6939
                     <td valign='top'>
6940 6940
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
6941 6941
                     </td>
6942 6942
                 </tr>";
6943
-    		echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>";
6944
-    		$sql = "SELECT u.upload_date, w.title, w.author,w.url
6943
+            echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>";
6944
+            $sql = "SELECT u.upload_date, w.title, w.author,w.url
6945 6945
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
6946 6946
                     WHERE u.upload_work_id = w.id
6947 6947
                         AND u.upload_user_id = '".intval($user_id)."'
6948 6948
                         AND u.c_id = '".intval($course_id)."'
6949 6949
                     ORDER BY u.upload_date DESC";
6950
-    		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6951
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
6952
-    		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6953
-    		echo "<tr>
6950
+            echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6951
+            $results = StatsUtils::getManyResultsXCol($sql,4);
6952
+            echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6953
+            echo "<tr>
6954 6954
                     <td class='secLine' width='40%'>
6955 6955
                     ".get_lang('WorkTitle')."
6956 6956
                     </td>
@@ -6961,35 +6961,35 @@  discard block
 block discarded – undo
6961 6961
                     ".get_lang('Date')."
6962 6962
                     </td>
6963 6963
                 </tr>";
6964
-    		if (is_array($results)) {
6965
-    			for($j = 0 ; $j < count($results) ; $j++) {
6966
-    				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6967
-    				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6968
-    				echo "<tr>";
6969
-    				echo "<td class='content'>"
6970
-    				."<a href ='".$pathToFile."'>".$results[$j][1]."</a>"
6971
-    				."</td>";
6972
-    				echo "<td class='content'>".$results[$j][2]."</td>";
6973
-    				echo "<td class='content'>".$beautifulDate."</td>";
6974
-    				echo"</tr>";
6975
-    			}
6976
-    		} else {
6977
-    			echo "<tr>";
6978
-    			echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>";
6979
-    			echo"</tr>";
6980
-    		}
6981
-    		echo "</table>";
6982
-    		echo "</td></tr>";
6983
-    	} else {
6984
-    		$new_view = substr_replace($view,'1',2,1);
6985
-    		echo "
6964
+            if (is_array($results)) {
6965
+                for($j = 0 ; $j < count($results) ; $j++) {
6966
+                    $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6967
+                    $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6968
+                    echo "<tr>";
6969
+                    echo "<td class='content'>"
6970
+                    ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>"
6971
+                    ."</td>";
6972
+                    echo "<td class='content'>".$results[$j][2]."</td>";
6973
+                    echo "<td class='content'>".$beautifulDate."</td>";
6974
+                    echo"</tr>";
6975
+                }
6976
+            } else {
6977
+                echo "<tr>";
6978
+                echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>";
6979
+                echo"</tr>";
6980
+            }
6981
+            echo "</table>";
6982
+            echo "</td></tr>";
6983
+        } else {
6984
+            $new_view = substr_replace($view,'1',2,1);
6985
+            echo "
6986 6986
                 <tr>
6987 6987
                     <td valign='top'>
6988 6988
                     +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a>
6989 6989
                     </td>
6990 6990
                 </tr>
6991 6991
             ";
6992
-    	}
6992
+        }
6993 6993
     }
6994 6994
 
6995 6995
     /**
@@ -6998,55 +6998,55 @@  discard block
 block discarded – undo
6998 6998
      */
6999 6999
     public static function display_links_tracking_info($view, $user_id, $courseCode)
7000 7000
     {
7001
-    	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7001
+        global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7002 7002
         $courseId = api_get_course_int_id($courseCode);
7003
-    	if (substr($view,3,1) == '1') {
7004
-    		$new_view = substr_replace($view,'0',3,1);
7005
-    		echo "
7003
+        if (substr($view,3,1) == '1') {
7004
+            $new_view = substr_replace($view,'0',3,1);
7005
+            echo "
7006 7006
                 <tr>
7007 7007
                         <td valign='top'>
7008 7008
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('LinksAccess')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>]
7009 7009
                         </td>
7010 7010
                 </tr>
7011 7011
             ";
7012
-    		echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>";
7013
-    		$sql = "SELECT cl.title, cl.url
7012
+            echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>";
7013
+            $sql = "SELECT cl.title, cl.url
7014 7014
                     FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7015 7015
                     WHERE sl.links_link_id = cl.id
7016 7016
                         AND sl.c_id = $courseId
7017 7017
                         AND sl.links_user_id = ".intval($user_id)."
7018 7018
                     GROUP BY cl.title, cl.url";
7019
-    		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
7020
-    		$results = StatsUtils::getManyResults2Col($sql);
7021
-    		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
7022
-    		echo "<tr>
7019
+            echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
7020
+            $results = StatsUtils::getManyResults2Col($sql);
7021
+            echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
7022
+            echo "<tr>
7023 7023
                     <td class='secLine'>
7024 7024
                     ".get_lang('LinksTitleLinkColumn')."
7025 7025
                     </td>
7026 7026
                 </tr>";
7027
-    		if (is_array($results)) {
7028
-    			for($j = 0 ; $j < count($results) ; $j++) {
7029
-    				echo "<tr>";
7030
-    				echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
7031
-    				echo"</tr>";
7032
-    			}
7033
-    		} else {
7034
-    			echo "<tr>";
7035
-    			echo "<td ><center>".get_lang('NoResult')."</center></td>";
7036
-    			echo"</tr>";
7037
-    		}
7038
-    		echo "</table>";
7039
-    		echo "</td></tr>";
7040
-    	} else {
7041
-    		$new_view = substr_replace($view,'1',3,1);
7042
-    		echo "
7027
+            if (is_array($results)) {
7028
+                for($j = 0 ; $j < count($results) ; $j++) {
7029
+                    echo "<tr>";
7030
+                    echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
7031
+                    echo"</tr>";
7032
+                }
7033
+            } else {
7034
+                echo "<tr>";
7035
+                echo "<td ><center>".get_lang('NoResult')."</center></td>";
7036
+                echo"</tr>";
7037
+            }
7038
+            echo "</table>";
7039
+            echo "</td></tr>";
7040
+        } else {
7041
+            $new_view = substr_replace($view,'1',3,1);
7042
+            echo "
7043 7043
                 <tr>
7044 7044
                     <td valign='top'>
7045 7045
                     +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a>
7046 7046
                     </td>
7047 7047
                 </tr>
7048 7048
             ";
7049
-    	}
7049
+        }
7050 7050
     }
7051 7051
 
7052 7052
     /**
@@ -7059,61 +7059,61 @@  discard block
 block discarded – undo
7059 7059
      */
7060 7060
     public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0)
7061 7061
     {
7062
-    	// protect data
7062
+        // protect data
7063 7063
         $user_id = intval($user_id);
7064 7064
         $courseId = api_get_course_int_id($course_code);
7065
-    	$session_id = intval($session_id);
7065
+        $session_id = intval($session_id);
7066 7066
 
7067
-    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7068
-    	if(substr($view,4,1) == '1') {
7069
-    		$new_view = substr_replace($view,'0',4,1);
7070
-    		echo "
7067
+        $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7068
+        if(substr($view,4,1) == '1') {
7069
+            $new_view = substr_replace($view,'0',4,1);
7070
+            echo "
7071 7071
                 <tr>
7072 7072
                     <td valign='top'>
7073 7073
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('DocumentsAccess')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>]
7074 7074
                     </td>
7075 7075
                 </tr>
7076 7076
             ";
7077
-    		echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>";
7077
+            echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>";
7078 7078
 
7079
-    		$sql = "SELECT down_doc_path
7079
+            $sql = "SELECT down_doc_path
7080 7080
                     FROM $downloads_table
7081 7081
                     WHERE c_id = $courseId
7082 7082
                         AND down_user_id = $user_id
7083 7083
                         AND down_session_id = $session_id
7084 7084
                     GROUP BY down_doc_path";
7085 7085
 
7086
-    		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
7087
-    		$results = StatsUtils::getManyResults1Col($sql);
7088
-    		echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>";
7089
-    		echo "<tr>
7086
+            echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
7087
+            $results = StatsUtils::getManyResults1Col($sql);
7088
+            echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>";
7089
+            echo "<tr>
7090 7090
                     <td class='secLine'>
7091 7091
                     ".get_lang('DocumentsTitleDocumentColumn')."
7092 7092
                     </td>
7093 7093
                 </tr>";
7094
-    		if (is_array($results)) {
7095
-    			for($j = 0 ; $j < count($results) ; $j++) {
7096
-    				echo "<tr>";
7097
-    				echo "<td class='content'>".$results[$j]."</td>";
7098
-    				echo"</tr>";
7099
-    			}
7100
-    		} else {
7101
-    			echo "<tr>";
7102
-    			echo "<td><center>".get_lang('NoResult')."</center></td>";
7103
-    			echo"</tr>";
7104
-    		}
7105
-    		echo "</table>";
7106
-    		echo "</td></tr>";
7107
-    	} else {
7108
-    		$new_view = substr_replace($view,'1',4,1);
7109
-    		echo "
7094
+            if (is_array($results)) {
7095
+                for($j = 0 ; $j < count($results) ; $j++) {
7096
+                    echo "<tr>";
7097
+                    echo "<td class='content'>".$results[$j]."</td>";
7098
+                    echo"</tr>";
7099
+                }
7100
+            } else {
7101
+                echo "<tr>";
7102
+                echo "<td><center>".get_lang('NoResult')."</center></td>";
7103
+                echo"</tr>";
7104
+            }
7105
+            echo "</table>";
7106
+            echo "</td></tr>";
7107
+        } else {
7108
+            $new_view = substr_replace($view,'1',4,1);
7109
+            echo "
7110 7110
                 <tr>
7111 7111
                     <td valign='top'>
7112 7112
                     +<font color='#0000FF'>&nbsp;&nbsp;</font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a>
7113 7113
                     </td>
7114 7114
                 </tr>
7115 7115
             ";
7116
-    	}
7116
+        }
7117 7117
     }
7118 7118
 
7119 7119
     /**
@@ -7170,43 +7170,43 @@  discard block
 block discarded – undo
7170 7170
      */
7171 7171
     public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0)
7172 7172
     {
7173
-    	$MonthsLong = $GLOBALS['MonthsLong'];
7174
-    	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
7175
-
7176
-    	// protected data
7177
-    	$user_id    = intval($user_id);
7178
-    	$session_id = intval($session_id);
7179
-    	$course_id  = intval($course_id);
7180
-
7181
-    	$tempView = $view;
7182
-    	if (substr($view,0,1) == '1') {
7183
-    		$new_view = substr_replace($view,'0',0,1);
7184
-    		$title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7185
-    		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
7173
+        $MonthsLong = $GLOBALS['MonthsLong'];
7174
+        $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
7175
+
7176
+        // protected data
7177
+        $user_id    = intval($user_id);
7178
+        $session_id = intval($session_id);
7179
+        $course_id  = intval($course_id);
7180
+
7181
+        $tempView = $view;
7182
+        if (substr($view,0,1) == '1') {
7183
+            $new_view = substr_replace($view,'0',0,1);
7184
+            $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7185
+            $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
7186 7186
                     FROM $track_access_table
7187 7187
                     WHERE access_user_id = $user_id
7188 7188
                     AND c_id = $course_id
7189 7189
                     AND access_session_id = $session_id
7190 7190
                     GROUP BY YEAR(access_date),MONTH(access_date)
7191 7191
                     ORDER BY YEAR(access_date),MONTH(access_date) ASC";
7192
-    		//$results = getManyResults2Col($sql);
7193
-    		$results = getManyResults3Col($sql);
7194
-    		$title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7195
-    		$line='';
7196
-    		$total = 0;
7197
-    		if (is_array($results)) {
7198
-    			for($j = 0 ; $j < count($results) ; $j++) {
7199
-    				$line .= $results[$j][0].';'.$results[$j][1]."\n";
7200
-    				$total = $total + $results[$j][1];
7201
-    			}
7202
-    			$line .= get_lang('Total').";".$total."\n";
7203
-    		} else {
7204
-    			$line= get_lang('NoResult')."</center></td>";
7205
-    		}
7206
-    	} else {
7207
-    		$new_view = substr_replace($view,'1',0,1);
7208
-    	}
7209
-    	return array($title_line, $line);
7192
+            //$results = getManyResults2Col($sql);
7193
+            $results = getManyResults3Col($sql);
7194
+            $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7195
+            $line='';
7196
+            $total = 0;
7197
+            if (is_array($results)) {
7198
+                for($j = 0 ; $j < count($results) ; $j++) {
7199
+                    $line .= $results[$j][0].';'.$results[$j][1]."\n";
7200
+                    $total = $total + $results[$j][1];
7201
+                }
7202
+                $line .= get_lang('Total').";".$total."\n";
7203
+            } else {
7204
+                $line= get_lang('NoResult')."</center></td>";
7205
+            }
7206
+        } else {
7207
+            $new_view = substr_replace($view,'1',0,1);
7208
+        }
7209
+        return array($title_line, $line);
7210 7210
     }
7211 7211
 
7212 7212
     /**
@@ -7219,67 +7219,67 @@  discard block
 block discarded – undo
7219 7219
      */
7220 7220
     public function display_exercise_tracking_info($view, $userId, $courseCode)
7221 7221
     {
7222
-    	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
7222
+        global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
7223 7223
         $courseId = api_get_course_int_id($courseCode);
7224 7224
         $userId = intval($userId);
7225
-    	if (substr($view,1,1) == '1') {
7226
-    		$new_view = substr_replace($view,'0',1,1);
7227
-    		$title[1] = get_lang('ExercicesDetails');
7228
-    		$line = '';
7229
-    		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
7225
+        if (substr($view,1,1) == '1') {
7226
+            $new_view = substr_replace($view,'0',1,1);
7227
+            $title[1] = get_lang('ExercicesDetails');
7228
+            $line = '';
7229
+            $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
7230 7230
                     FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te
7231 7231
                     WHERE te.c_id = $courseId
7232 7232
                         AND te.exe_user_id = $userId
7233 7233
                         AND te.exe_exo_id = ce.id
7234 7234
                     ORDER BY ce.title ASC, te.exe_date ASC";
7235 7235
 
7236
-    		$hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
7236
+            $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
7237 7237
                         FROM $TABLETRACK_HOTPOTATOES AS te
7238 7238
                         WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId
7239 7239
                         ORDER BY te.c_id ASC, te.exe_date ASC";
7240 7240
 
7241
-    		$hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
7241
+            $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4);
7242 7242
 
7243
-    		$NoTestRes = 0;
7244
-    		$NoHPTestRes = 0;
7243
+            $NoTestRes = 0;
7244
+            $NoHPTestRes = 0;
7245 7245
 
7246
-    		$results = StatsUtils::getManyResultsXCol($sql, 4);
7247
-    		$title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
7246
+            $results = StatsUtils::getManyResultsXCol($sql, 4);
7247
+            $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
7248 7248
 
7249
-    		if (is_array($results)) {
7250
-    			for($i = 0; $i < sizeof($results); $i++)
7251
-    			{
7252
-    				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
7253
-    				$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
7254
-    			}
7255
-    		} else {
7249
+            if (is_array($results)) {
7250
+                for($i = 0; $i < sizeof($results); $i++)
7251
+                {
7252
+                    $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
7253
+                    $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
7254
+                }
7255
+            } else {
7256 7256
                 // istvan begin
7257
-    			$NoTestRes = 1;
7258
-    		}
7259
-
7260
-    		// The Result of Tests
7261
-    		if (is_array($hpresults)) {
7262
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
7263
-    				$title = GetQuizName($hpresults[$i][0],'');
7264
-
7265
-    				if ($title == '')
7266
-    				$title = basename($hpresults[$i][0]);
7267
-
7268
-    				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
7269
-
7270
-    				$line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n";
7271
-    			}
7272
-    		} else {
7273
-    			$NoHPTestRes = 1;
7274
-    		}
7275
-
7276
-    		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
7277
-    			$line=get_lang('NoResult');
7278
-    		}
7279
-    	} else {
7280
-    		$new_view = substr_replace($view,'1',1,1);
7281
-    	}
7282
-    	return array($title_line, $line);
7257
+                $NoTestRes = 1;
7258
+            }
7259
+
7260
+            // The Result of Tests
7261
+            if (is_array($hpresults)) {
7262
+                for($i = 0; $i < sizeof($hpresults); $i++) {
7263
+                    $title = GetQuizName($hpresults[$i][0],'');
7264
+
7265
+                    if ($title == '')
7266
+                    $title = basename($hpresults[$i][0]);
7267
+
7268
+                    $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
7269
+
7270
+                    $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n";
7271
+                }
7272
+            } else {
7273
+                $NoHPTestRes = 1;
7274
+            }
7275
+
7276
+            if ($NoTestRes == 1 && $NoHPTestRes == 1) {
7277
+                $line=get_lang('NoResult');
7278
+            }
7279
+        } else {
7280
+            $new_view = substr_replace($view,'1',1,1);
7281
+        }
7282
+        return array($title_line, $line);
7283 7283
     }
7284 7284
 
7285 7285
     /**
@@ -7288,37 +7288,37 @@  discard block
 block discarded – undo
7288 7288
      */
7289 7289
     public function display_student_publications_tracking_info($view, $user_id, $course_id)
7290 7290
     {
7291
-    	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
7291
+        global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
7292 7292
         $_course = api_get_course_info();
7293 7293
         $user_id = intval($user_id);
7294 7294
         $course_id = intval($course_id);
7295 7295
 
7296
-    	if (substr($view,2,1) == '1') {
7297
-    		$sql = "SELECT u.upload_date, w.title, w.author, w.url
7296
+        if (substr($view,2,1) == '1') {
7297
+            $sql = "SELECT u.upload_date, w.title, w.author, w.url
7298 7298
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
7299 7299
                     WHERE
7300 7300
                         u.upload_work_id = w.id AND
7301 7301
                         u.upload_user_id = '$user_id' AND
7302 7302
                         u.c_id = '$course_id'
7303 7303
                     ORDER BY u.upload_date DESC";
7304
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
7305
-
7306
-    		$title[1]=get_lang('WorksDetails');
7307
-    		$line='';
7308
-    		$title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7309
-
7310
-    		if (is_array($results)) {
7311
-    			for($j = 0 ; $j < count($results) ; $j++) {
7312
-    				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7313
-    				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7314
-    				$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7315
-    			}
7316
-
7317
-    		} else {
7318
-    			$line= get_lang('NoResult');
7319
-    		}
7320
-    	}
7321
-    	return array($title_line, $line);
7304
+            $results = StatsUtils::getManyResultsXCol($sql,4);
7305
+
7306
+            $title[1]=get_lang('WorksDetails');
7307
+            $line='';
7308
+            $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7309
+
7310
+            if (is_array($results)) {
7311
+                for($j = 0 ; $j < count($results) ; $j++) {
7312
+                    $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7313
+                    $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7314
+                    $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7315
+                }
7316
+
7317
+            } else {
7318
+                $line= get_lang('NoResult');
7319
+            }
7320
+        }
7321
+        return array($title_line, $line);
7322 7322
     }
7323 7323
 
7324 7324
     /**
@@ -7327,32 +7327,32 @@  discard block
 block discarded – undo
7327 7327
      */
7328 7328
     public function display_links_tracking_info($view, $userId, $courseCode)
7329 7329
     {
7330
-    	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7330
+        global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7331 7331
         $courseId = api_get_course_int_id($courseCode);
7332 7332
         $userId = intval($userId);
7333 7333
         $line = null;
7334
-    	if (substr($view,3,1) == '1') {
7335
-    		$new_view = substr_replace($view,'0',3,1);
7336
-    		$title[1]=get_lang('LinksDetails');
7337
-    		$sql = "SELECT cl.title, cl.url
7334
+        if (substr($view,3,1) == '1') {
7335
+            $new_view = substr_replace($view,'0',3,1);
7336
+            $title[1]=get_lang('LinksDetails');
7337
+            $sql = "SELECT cl.title, cl.url
7338 7338
                         FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7339 7339
                         WHERE sl.links_link_id = cl.id
7340 7340
                             AND sl.c_id = $courseId
7341 7341
                             AND sl.links_user_id = $userId
7342 7342
                         GROUP BY cl.title, cl.url";
7343
-    		$results = StatsUtils::getManyResults2Col($sql);
7344
-    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7345
-    		if (is_array($results)) {
7346
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7347
-    				$line .= $results[$j][0]."\n";
7348
-    			}
7349
-    		} else {
7350
-    			$line=get_lang('NoResult');
7351
-    		}
7352
-    	} else {
7353
-    		$new_view = substr_replace($view,'1',3,1);
7354
-    	}
7355
-    	return array($title_line, $line);
7343
+            $results = StatsUtils::getManyResults2Col($sql);
7344
+            $title_line= get_lang('LinksTitleLinkColumn')."\n";
7345
+            if (is_array($results)) {
7346
+                for ($j = 0 ; $j < count($results) ; $j++) {
7347
+                    $line .= $results[$j][0]."\n";
7348
+                }
7349
+            } else {
7350
+                $line=get_lang('NoResult');
7351
+            }
7352
+        } else {
7353
+            $new_view = substr_replace($view,'1',3,1);
7354
+        }
7355
+        return array($title_line, $line);
7356 7356
     }
7357 7357
 
7358 7358
     /**
@@ -7365,38 +7365,38 @@  discard block
 block discarded – undo
7365 7365
      */
7366 7366
     public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0)
7367 7367
     {
7368
-    	// protect data
7369
-    	$user_id     = intval($user_id);
7368
+        // protect data
7369
+        $user_id     = intval($user_id);
7370 7370
         $courseId = api_get_course_int_id($courseCode);
7371
-    	$session_id = intval($session_id);
7371
+        $session_id = intval($session_id);
7372 7372
 
7373
-    	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7373
+        $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7374 7374
 
7375
-    	if (substr($view,4,1) == '1') {
7376
-    		$new_view = substr_replace($view,'0',4,1);
7377
-    		$title[1]= get_lang('DocumentsDetails');
7375
+        if (substr($view,4,1) == '1') {
7376
+            $new_view = substr_replace($view,'0',4,1);
7377
+            $title[1]= get_lang('DocumentsDetails');
7378 7378
 
7379
-    		$sql = "SELECT down_doc_path
7379
+            $sql = "SELECT down_doc_path
7380 7380
                         FROM $downloads_table
7381 7381
                         WHERE c_id = $courseId
7382 7382
                             AND down_user_id = $user_id
7383 7383
                             AND down_session_id = $session_id
7384 7384
                         GROUP BY down_doc_path";
7385 7385
 
7386
-    		$results = StatsUtils::getManyResults1Col($sql);
7387
-    		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7386
+            $results = StatsUtils::getManyResults1Col($sql);
7387
+            $title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7388 7388
             $line = null;
7389
-    		if (is_array($results)) {
7390
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7391
-    				$line .= $results[$j]."\n";
7392
-    			}
7393
-    		} else {
7394
-    			$line = get_lang('NoResult');
7395
-    		}
7396
-    	} else {
7397
-    		$new_view = substr_replace($view,'1',4,1);
7398
-    	}
7399
-    	return array($title_line, $line);
7389
+            if (is_array($results)) {
7390
+                for ($j = 0 ; $j < count($results) ; $j++) {
7391
+                    $line .= $results[$j]."\n";
7392
+                }
7393
+            } else {
7394
+                $line = get_lang('NoResult');
7395
+            }
7396
+        } else {
7397
+            $new_view = substr_replace($view,'1',4,1);
7398
+        }
7399
+        return array($title_line, $line);
7400 7400
     }
7401 7401
 
7402 7402
     /**
Please login to merge, or discard this patch.
Spacing   +433 added lines, -433 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $extendedAttempt = null,
115 115
         $extendedAll = null,
116 116
         $type = 'classic',
117
-        $allowExtend =  true
117
+        $allowExtend = true
118 118
     ) {
119 119
         if (empty($courseInfo) || empty($lp_id)) {
120 120
             return null;
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
         $extend_all = 0;
139 139
 
140 140
         if ($origin == 'tracking') {
141
-            $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
141
+            $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin;
142 142
         } else {
143
-            $url_suffix = '&lp_id=' . $lp_id;
143
+            $url_suffix = '&lp_id='.$lp_id;
144 144
         }
145 145
 
146 146
         if (!empty($extendedAll)) {
147 147
             $extend_all_link = Display::url(
148 148
                 Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
149
-                api_get_self() . '?action=stats' . $url_suffix
149
+                api_get_self().'?action=stats'.$url_suffix
150 150
             );
151 151
 
152 152
             $extend_all = 1;
153 153
         } else {
154 154
             $extend_all_link = Display::url(
155 155
                 Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')),
156
-                api_get_self() . '?action=stats&extend_all=1' . $url_suffix
156
+                api_get_self().'?action=stats&extend_all=1'.$url_suffix
157 157
             );
158 158
         }
159 159
 
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 
166 166
         $actionColumn = null;
167 167
         if ($type == 'classic') {
168
-            $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
168
+            $actionColumn = ' <th>'.get_lang('Actions').'</th>';
169 169
         }
170 170
         $output .= '<div class="table-responsive">';
171 171
         $output .= '<table class="table tracking">
172 172
             <thead>
173 173
             <tr class="table-header">
174
-                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;') . '</th>
174
+                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;').'</th>
175 175
                 <th colspan="4">
176
-                    ' . get_lang('ScormLessonTitle') .'
176
+                    ' . get_lang('ScormLessonTitle').'
177 177
                 </th>
178 178
                 <th colspan="2">
179
-                    ' . get_lang('ScormStatus') . '
179
+                    ' . get_lang('ScormStatus').'
180 180
                 </th>
181 181
                 <th colspan="2">
182
-                    ' . get_lang('ScormScore') . '
182
+                    ' . get_lang('ScormScore').'
183 183
                 </th>
184 184
                 <th colspan="2">
185
-                    ' . get_lang('ScormTime') . '
185
+                    ' . get_lang('ScormTime').'
186 186
                 </th>
187 187
                 '.$actionColumn.'
188 188
                 </tr>
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 // Prepare statement to go through each attempt.
246 246
                 $viewCondition = null;
247 247
                 if (!empty($view)) {
248
-                    $viewCondition =  " AND v.view_count = $view  ";
248
+                    $viewCondition = " AND v.view_count = $view  ";
249 249
                 }
250 250
 
251 251
                 $sql = "SELECT
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                                 FROM $TBL_QUIZ
294 294
                                 WHERE
295 295
                                     c_id = $course_id AND
296
-                                    id ='" . $my_path . "'";
296
+                                    id ='".$my_path."'";
297 297
                         $res_result_disabled = Database::query($sql);
298 298
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
299 299
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                     if (!empty($inter_num)) {
316 316
                         $extend_link = Display::url(
317 317
                               Display::return_icon('visible.gif', get_lang('HideAttemptView')),
318
-                              api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
318
+                              api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix
319 319
                         );
320 320
                     }
321 321
                     $title = $row['mytitle'];
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
                     $action = null;
335 335
                     if ($type == 'classic') {
336
-                        $action =  '<td></td>';
336
+                        $action = '<td></td>';
337 337
                     }
338 338
 
339 339
                     if (in_array($row['item_type'], $chapterTypes)) {
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
                                 $extend_this_attempt = 1;
378 378
                                 $extend_attempt_link = Display::url(
379 379
                                     Display::return_icon('visible.gif', get_lang('HideAttemptView')),
380
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
380
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
381 381
                                 );
382 382
                             } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
383 383
                                 // The extend button for this attempt has not been clicked.
384 384
                                 $extend_attempt_link = Display::url(
385 385
                                     Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
386
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
386
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
387 387
                                 );
388 388
                             }
389 389
                         }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                         }
417 417
 
418 418
                         // Remove "NaN" if any (@todo: locate the source of these NaN)
419
-                        $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
419
+                        $time = str_replace('NaN', '00'.$h.'00\'00"', $time);
420 420
 
421 421
                         if ($row['item_type'] != 'dir') {
422 422
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
                                 $action = '<td></td>';
445 445
                             }
446 446
 
447
-                            $output .= '<tr class="' . $oddclass . '">
447
+                            $output .= '<tr class="'.$oddclass.'">
448 448
                                     <td></td>
449
-                                    <td>' . $extend_attempt_link . '</td>
450
-                                    <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td>
451
-                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
452
-                                    <td colspan="2">' . $view_score . '</td>
453
-                                    <td colspan="2">' . $time . '</td>
449
+                                    <td>' . $extend_attempt_link.'</td>
450
+                                    <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td>
451
+                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td>
452
+                                    <td colspan="2">' . $view_score.'</td>
453
+                                    <td colspan="2">' . $time.'</td>
454 454
                                     '.$action.'
455 455
                                 </tr>';
456 456
                             $attemptCount++;
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
                                     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
464 464
                                         $temp[] = '/';
465 465
                                     } else {
466
-                                        $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
466
+                                        $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
467 467
                                     }
468 468
                                 } else {
469
-                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
469
+                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
470 470
                                 }
471 471
                                 $temp[] = $time;
472 472
                                 $csv_content[] = $temp;
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
                                         <td></td>
504 504
                                         <td></td>
505 505
                                         <td></td>
506
-                                        <td>'.$interaction['order_id'] . '</td>
507
-                                        <td>'.$interaction['id'] . '</td>
506
+                                        <td>'.$interaction['order_id'].'</td>
507
+                                        <td>'.$interaction['id'].'</td>
508 508
                                         <td colspan="2">' . $interaction['type'].'</td>
509
-                                        <td>'.$student_response . '</td>
510
-                                        <td>'.$interaction['result'] . '</td>
511
-                                        <td>'.$interaction['latency'] . '</td>
512
-                                        <td>'.$interaction['time'] . '</td>
509
+                                        <td>'.$student_response.'</td>
510
+                                        <td>'.$interaction['result'].'</td>
511
+                                        <td>'.$interaction['latency'].'</td>
512
+                                        <td>'.$interaction['time'].'</td>
513 513
                                         '.$action.'
514 514
                                     </tr>';
515 515
                                 $counter++;
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
                                         <td></td>
527 527
                                         <td></td>
528 528
                                         <td></td>
529
-                                        <td>' . $interaction['order_id'] . '</td>
530
-                                        <td colspan="2">' . $interaction['objective_id'] . '</td>
531
-                                        <td colspan="2">' . $interaction['status'] .'</td>
532
-                                        <td>' . $interaction['score_raw'] . '</td>
533
-                                        <td>' . $interaction['score_max'] . '</td>
534
-                                        <td>' . $interaction['score_min'] . '</td>
529
+                                        <td>' . $interaction['order_id'].'</td>
530
+                                        <td colspan="2">' . $interaction['objective_id'].'</td>
531
+                                        <td colspan="2">' . $interaction['status'].'</td>
532
+                                        <td>' . $interaction['score_raw'].'</td>
533
+                                        <td>' . $interaction['score_max'].'</td>
534
+                                        <td>' . $interaction['score_min'].'</td>
535 535
                                         '.$action.'
536 536
                                      </tr>';
537 537
                                 $counter++;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                         $my_path = Database::escape_string($my_path);
555 555
                         $sql = "SELECT results_disabled
556 556
                                 FROM $TBL_QUIZ
557
-                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
557
+                                WHERE c_id = $course_id AND id ='".$my_path."'";
558 558
                         $res_result_disabled = Database::query($sql);
559 559
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
560 560
 
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
                             $extend_this_attempt = 1;
579 579
                             $extend_attempt_link = Display::url(
580 580
                                 Display::return_icon('visible.gif', get_lang('HideAttemptView')),
581
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
581
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
582 582
                             );
583 583
                         } else {
584 584
                             // Same case if fold_attempt_id is set, so not implemented explicitly.
585 585
                             // The extend button for this attempt has not been clicked.
586 586
                             $extend_attempt_link = Display::url(
587 587
                                 Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
588
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
588
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
589 589
                             );
590 590
                         }
591 591
                     }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
                     if ($inter_num > 1) {
601 601
                         $extend_link = Display::url(
602 602
                             Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
603
-                            api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
603
+                            api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
604 604
                         );
605 605
                     }
606 606
 
@@ -616,15 +616,15 @@  discard block
 block discarded – undo
616 616
 
617 617
                     // Selecting the exe_id from stats attempts tables in order to look the max score value.
618 618
 
619
-                    $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
619
+                    $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
620 620
                              WHERE
621
-                                exe_exo_id="' . $row['path'] . '" AND
622
-                                exe_user_id="' . $user_id . '" AND
623
-                                orig_lp_id = "' . $lp_id . '" AND
624
-                                orig_lp_item_id = "' . $row['myid'] . '" AND
625
-                                c_id = ' . $course_id . ' AND
621
+                                exe_exo_id="' . $row['path'].'" AND
622
+                                exe_user_id="' . $user_id.'" AND
623
+                                orig_lp_id = "' . $lp_id.'" AND
624
+                                orig_lp_item_id = "' . $row['myid'].'" AND
625
+                                c_id = ' . $course_id.' AND
626 626
                                 status <> "incomplete" AND
627
-                                session_id = ' . $session_id . '
627
+                                session_id = ' . $session_id.'
628 628
                              ORDER BY exe_date DESC
629 629
                              LIMIT 1';
630 630
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
                                         FROM $TBL_LP_ITEM_VIEW
656 656
                                         WHERE
657 657
                                             c_id = $course_id AND
658
-                                            lp_item_id = '" . (int) $my_id . "' AND
659
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'
658
+                                            lp_item_id = '".(int) $my_id."' AND
659
+                                            lp_view_id = '" . (int) $my_lp_view_id."'
660 660
                                         ORDER BY view_count DESC limit 1";
661 661
                                 $res_score = Database::query($sql);
662 662
                                 $row_score = Database::fetch_array($res_score);
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
                                         FROM $TBL_LP_ITEM_VIEW
666 666
                                         WHERE
667 667
                                             c_id = $course_id AND
668
-                                            lp_item_id = '" . (int) $my_id . "' AND
669
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'";
668
+                                            lp_item_id = '".(int) $my_id."' AND
669
+                                            lp_view_id = '" . (int) $my_lp_view_id."'";
670 670
                                 $res_time = Database::query($sql);
671 671
                                 $row_time = Database::fetch_array($res_time);
672 672
 
@@ -725,16 +725,16 @@  discard block
 block discarded – undo
725 725
                     } else {
726 726
                         $correct_test_link = '-';
727 727
                         if ($row['item_type'] == 'quiz') {
728
-                            $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin;
729
-                            $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
728
+                            $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin;
729
+                            $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
730 730
                                      WHERE
731
-                                        exe_exo_id="' . $row['path'] . '" AND
732
-                                        exe_user_id="' . $user_id . '" AND
733
-                                        orig_lp_id = "' . $lp_id . '" AND
734
-                                        orig_lp_item_id = "' . $row['myid'] . '" AND
735
-                                        c_id = ' . $course_id . ' AND
731
+                                        exe_exo_id="' . $row['path'].'" AND
732
+                                        exe_user_id="' . $user_id.'" AND
733
+                                        orig_lp_id = "' . $lp_id.'" AND
734
+                                        orig_lp_item_id = "' . $row['myid'].'" AND
735
+                                        c_id = ' . $course_id.' AND
736 736
                                         status <> "incomplete" AND
737
-                                        session_id = ' . $session_id . '
737
+                                        session_id = ' . $session_id.'
738 738
                                      ORDER BY exe_date DESC ';
739 739
 
740 740
                             $resultLastAttempt = Database::query($sql);
@@ -746,12 +746,12 @@  discard block
 block discarded – undo
746 746
                                 ) {
747 747
                                     $correct_test_link = Display::url(
748 748
                                         Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
749
-                                        api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
749
+                                        api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
750 750
                                     );
751 751
                                 } else {
752 752
                                     $correct_test_link = Display::url(
753 753
                                         Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')),
754
-                                        api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
754
+                                        api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
755 755
                                     );
756 756
                                 }
757 757
                             }
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
 
762 762
                         $action = null;
763 763
                         if ($type == 'classic') {
764
-                            $action =  '<td>' . $correct_test_link . '</td>';
764
+                            $action = '<td>'.$correct_test_link.'</td>';
765 765
                         }
766 766
 
767 767
                         if ($lp_id == $my_lp_id && false) {
768 768
 
769
-                            $output .= '<tr class =' . $oddclass . '>
770
-                                    <td>' . $extend_link . '</td>
771
-                                    <td colspan="4">' . $title . '</td>
769
+                            $output .= '<tr class ='.$oddclass.'>
770
+                                    <td>' . $extend_link.'</td>
771
+                                    <td colspan="4">' . $title.'</td>
772 772
                                     <td colspan="2">&nbsp;</td>
773 773
                                     <td colspan="2">&nbsp;</td>
774 774
                                     <td colspan="2">&nbsp;</td>
@@ -793,13 +793,13 @@  discard block
 block discarded – undo
793 793
                                     $scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
794 794
                                 }
795 795
                             } else {
796
-                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
796
+                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore);
797 797
                             }
798 798
 
799 799
                             $output .= '
800 800
                                 <td>'.$extend_link.'</td>
801
-                                <td colspan="4">' . $title . '</td>
802
-                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td>
801
+                                <td colspan="4">' . $title.'</td>
802
+                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td>
803 803
                                 <td colspan="2">'.$scoreItem.'</td>
804 804
                                 <td colspan="2">'.$time.'</td>
805 805
                                 '.$action.'
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
817 817
                                     $temp[] = '/';
818 818
                                 } else {
819
-                                    $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
819
+                                    $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
820 820
                                 }
821 821
                             } else {
822
-                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
822
+                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
823 823
                             }
824 824
                             $temp[] = $time;
825 825
                             $csv_content[] = $temp;
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 
831 831
                     $action = null;
832 832
                     if ($type == 'classic') {
833
-                        $action =  '<td></td>';
833
+                        $action = '<td></td>';
834 834
                     }
835 835
 
836 836
                     if ($extend_this_attempt || $extend_all) {
@@ -867,11 +867,11 @@  discard block
 block discarded – undo
867 867
                                     <td></td>
868 868
                                     <td></td>
869 869
                                     <td></td>
870
-                                    <td>' . $interaction['order_id'] . '</td>
871
-                                    <td colspan="2">'.$interaction['objective_id'] . '</td>
872
-                                    <td colspan="2">' . $interaction['status'] . '</td>
870
+                                    <td>' . $interaction['order_id'].'</td>
871
+                                    <td colspan="2">'.$interaction['objective_id'].'</td>
872
+                                    <td colspan="2">' . $interaction['status'].'</td>
873 873
                                     <td>' . $interaction['score_raw'].'</td>
874
-                                    <td>' . $interaction['score_max'] .'</td>
874
+                                    <td>' . $interaction['score_max'].'</td>
875 875
                                     <td>' . $interaction['score_min'].'</td>
876 876
                                     '.$action.'
877 877
                                </tr>';
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
                     }
881 881
 
882 882
                     // Attempts listing by exercise.
883
-                    if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) {
883
+                    if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) {
884 884
                         // Get attempts of a exercise.
885 885
                         if (!empty($lp_id) &&
886 886
                             !empty($lp_item_id) &&
@@ -895,15 +895,15 @@  discard block
 block discarded – undo
895 895
                             $row_path = Database::fetch_array($res_path);
896 896
 
897 897
                             if (Database::num_rows($res_path) > 0) {
898
-                                $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
898
+                                $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
899 899
                                         WHERE
900
-                                            exe_exo_id="' . (int) $row_path['path'] . '" AND
900
+                                            exe_exo_id="' . (int) $row_path['path'].'" AND
901 901
                                             status <> "incomplete" AND
902
-                                            exe_user_id="' . $user_id . '" AND
903
-                                            orig_lp_id = "' . (int) $lp_id . '" AND
904
-                                            orig_lp_item_id = "' . (int) $lp_item_id . '" AND
905
-                                            c_id = ' . $course_id . '  AND
906
-                                            session_id = ' . $session_id . '
902
+                                            exe_user_id="' . $user_id.'" AND
903
+                                            orig_lp_id = "' . (int) $lp_id.'" AND
904
+                                            orig_lp_item_id = "' . (int) $lp_item_id.'" AND
905
+                                            c_id = ' . $course_id.'  AND
906
+                                            session_id = ' . $session_id.'
907 907
                                         ORDER BY exe_date';
908 908
                                 $res_attempts = Database::query($sql);
909 909
                                 $num_attempts = Database::num_rows($res_attempts);
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                                         if ($mktime_start_date && $mktime_exe_date) {
922 922
                                             $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date);
923 923
                                             $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime);
924
-                                            $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
924
+                                            $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
925 925
                                         } else {
926 926
                                             $time_attemp = ' - ';
927 927
                                         }
@@ -947,33 +947,33 @@  discard block
 block discarded – undo
947 947
                                             $my_lesson_status = learnpathitem::humanize_status('incomplete');
948 948
                                         }
949 949
 
950
-                                        $output .= '<tr class="' . $oddclass . '" >
950
+                                        $output .= '<tr class="'.$oddclass.'" >
951 951
                                         <td></td>
952
-                                        <td>' . $extend_attempt_link . '</td>
953
-                                        <td colspan="3">' . get_lang('Attempt').' '. $n.'</td>
954
-                                        <td colspan="2">' . $my_lesson_status . '</td>
955
-                                        <td colspan="2">'.$view_score . '</td>
956
-                                        <td colspan="2">'.$time_attemp . '</td>';
952
+                                        <td>' . $extend_attempt_link.'</td>
953
+                                        <td colspan="3">' . get_lang('Attempt').' '.$n.'</td>
954
+                                        <td colspan="2">' . $my_lesson_status.'</td>
955
+                                        <td colspan="2">'.$view_score.'</td>
956
+                                        <td colspan="2">'.$time_attemp.'</td>';
957 957
                                         if ($action == 'classic') {
958 958
                                             if ($origin != 'tracking') {
959 959
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
960 960
                                                     $output .= '<td>
961
-                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
961
+                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
962 962
                                                             </td>';
963 963
                                                 } else {
964 964
                                                     $output .= '<td>
965
-                                                            <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
966
-                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
965
+                                                            <a href="../exercise/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent">
966
+                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
967 967
                                                             </a></td>';
968 968
                                                 }
969 969
                                             } else {
970 970
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
971 971
                                                     $output .= '<td>
972
-                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
972
+                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>';
973 973
                                                 } else {
974 974
                                                     $output .= '<td>
975
-                                                                    <a href="../exercise/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
976
-                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
975
+                                                                    <a href="../exercise/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent">
976
+                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
977 977
                                                 }
978 978
                                             }
979 979
                                         }
@@ -1032,13 +1032,13 @@  discard block
 block discarded – undo
1032 1032
         }
1033 1033
 
1034 1034
         $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
1035
-        $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
1035
+        $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time);
1036 1036
 
1037 1037
         if (!$is_allowed_to_edit && $result_disabled_ext_all) {
1038 1038
             $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
1039 1039
         } else {
1040 1040
             if (is_numeric($total_score)) {
1041
-                $final_score = $total_score . '%';
1041
+                $final_score = $total_score.'%';
1042 1042
             } else {
1043 1043
                 $final_score = $total_score;
1044 1044
             }
@@ -1054,19 +1054,19 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
         $action = null;
1056 1056
         if ($type == 'classic') {
1057
-            $action =  '<td></td>';
1057
+            $action = '<td></td>';
1058 1058
         }
1059 1059
 
1060 1060
         $output .= '<tr class="'.$oddclass.'">
1061 1061
                 <td></td>
1062 1062
                 <td colspan="4">
1063
-                    <i>' . get_lang('AccomplishedStepsTotal') .'</i>
1063
+                    <i>' . get_lang('AccomplishedStepsTotal').'</i>
1064 1064
                 </td>
1065 1065
                 <td colspan="2">'.$progress.'%</td>
1066 1066
                 <td colspan="2">
1067 1067
                     ' . $final_score.'
1068 1068
                 </td>
1069
-                <td colspan="2">' . $total_time . '</div>
1069
+                <td colspan="2">' . $total_time.'</div>
1070 1070
                 '.$action.'
1071 1071
            </tr>';
1072 1072
 
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     	$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1411 1411
     	if (is_array($user_id)) {
1412 1412
     	    $user_id = array_map('intval', $user_id);
1413
-    		$condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1413
+    		$condition_user = " AND user_id IN (".implode(',', $user_id).") ";
1414 1414
     	} else {
1415 1415
     		$user_id = intval($user_id);
1416 1416
     		$condition_user = " AND user_id = $user_id ";
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
     {
1447 1447
     	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1448 1448
     	$sql = 'SELECT login_date
1449
-    	        FROM ' . $tbl_track_login . '
1450
-                WHERE login_user_id = ' . intval($student_id) . '
1449
+    	        FROM ' . $tbl_track_login.'
1450
+                WHERE login_user_id = ' . intval($student_id).'
1451 1451
                 ORDER BY login_date ASC
1452 1452
                 LIMIT 0,1';
1453 1453
 
1454 1454
     	$rs = Database::query($sql);
1455
-    	if (Database::num_rows($rs)>0) {
1455
+    	if (Database::num_rows($rs) > 0) {
1456 1456
     		if ($first_login_date = Database::result($rs, 0, 0)) {
1457 1457
                 return api_convert_and_format_date(
1458 1458
                     $first_login_date,
@@ -1477,8 +1477,8 @@  discard block
 block discarded – undo
1477 1477
     {
1478 1478
     	$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1479 1479
     	$sql = 'SELECT login_date
1480
-    	        FROM ' . $table . '
1481
-                WHERE login_user_id = ' . intval($student_id) . '
1480
+    	        FROM ' . $table.'
1481
+                WHERE login_user_id = ' . intval($student_id).'
1482 1482
                 ORDER BY login_date
1483 1483
                 DESC LIMIT 0,1';
1484 1484
 
@@ -1487,18 +1487,18 @@  discard block
 block discarded – undo
1487 1487
     		if ($last_login_date = Database::result($rs, 0, 0)) {
1488 1488
     			$last_login_date = api_get_local_time($last_login_date);
1489 1489
     			if ($return_timestamp) {
1490
-    				return api_strtotime($last_login_date,'UTC');
1490
+    				return api_strtotime($last_login_date, 'UTC');
1491 1491
     			} else {
1492 1492
     				if (!$warning_message) {
1493 1493
     					return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1494 1494
     				} else {
1495
-    					$timestamp = api_strtotime($last_login_date,'UTC');
1495
+    					$timestamp = api_strtotime($last_login_date, 'UTC');
1496 1496
     					$currentTimestamp = time();
1497 1497
 
1498 1498
     					//If the last connection is > than 7 days, the text is red
1499 1499
     					//345600 = 7 days in seconds
1500 1500
     					if ($currentTimestamp - $timestamp > 604800) {
1501
-    						return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1501
+    						return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>';
1502 1502
     					} else {
1503 1503
     						return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1504 1504
     					}
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
         $sql = "$select
1534 1534
                 FROM $tbl_track_login
1535 1535
                 WHERE
1536
-                    login_user_id IN (' ". implode("','", $studentList) . "' ) AND
1536
+                    login_user_id IN (' ".implode("','", $studentList)."' ) AND
1537 1537
                     login_date < '$date'
1538 1538
                 ";
1539 1539
         $rs = Database::query($sql);
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
                               '.Display::return_icon('messagebox_warning.gif').'
1633 1633
                              </a>'
1634 1634
                             : null;
1635
-    					return $icon. Display::label($last_login_date, 'warning');
1635
+    					return $icon.Display::label($last_login_date, 'warning');
1636 1636
     				} else {
1637 1637
     					return $last_login_date;
1638 1638
     				}
@@ -1667,8 +1667,8 @@  discard block
 block discarded – undo
1667 1667
 
1668 1668
         // Given we're storing in cache, round the start and end times
1669 1669
         // to the lower minute
1670
-        $roundedStart = substr($start, 0, -2) . '00';
1671
-        $roundedStop = substr($stop, 0, -2) . '00';
1670
+        $roundedStart = substr($start, 0, -2).'00';
1671
+        $roundedStop = substr($stop, 0, -2).'00';
1672 1672
         $roundedStart = Database::escape_string($roundedStart);
1673 1673
         $roundedStop = Database::escape_string($roundedStop);
1674 1674
 
@@ -1678,7 +1678,7 @@  discard block
 block discarded – undo
1678 1678
     	$session_id  = intval($session_id);
1679 1679
     	$count = 0;
1680 1680
         $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1681
-        $sql =  "SELECT count(*) as count_connections
1681
+        $sql = "SELECT count(*) as count_connections
1682 1682
                 FROM $tbl_track_e_course_access
1683 1683
                 WHERE
1684 1684
                     c_id = $courseId AND
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
                 $count = apcu_fetch($apc_var);
1701 1701
             } else {
1702 1702
                 $rs = Database::query($sql);
1703
-                if (Database::num_rows($rs)>0) {
1703
+                if (Database::num_rows($rs) > 0) {
1704 1704
                     $row = Database::fetch_object($rs);
1705 1705
                     $count = $row->count_connections;
1706 1706
                 }
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             }
1710 1710
         } else {
1711 1711
             $rs = Database::query($sql);
1712
-            if (Database::num_rows($rs)>0) {
1712
+            if (Database::num_rows($rs) > 0) {
1713 1713
                 $row = Database::fetch_object($rs);
1714 1714
                 $count = $row->count_connections;
1715 1715
             }
@@ -1731,14 +1731,14 @@  discard block
 block discarded – undo
1731 1731
     	$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1732 1732
 
1733 1733
     	$sql = 'SELECT DISTINCT c_id
1734
-                FROM ' . $tbl_course_rel_user . '
1734
+                FROM ' . $tbl_course_rel_user.'
1735 1735
                 WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH;
1736 1736
     	$rs = Database::query($sql);
1737 1737
     	$nb_courses = Database::num_rows($rs);
1738 1738
 
1739 1739
     	if ($include_sessions) {
1740 1740
     		$sql = 'SELECT DISTINCT c_id
1741
-                    FROM ' . $tbl_session_course_rel_user . '
1741
+                    FROM ' . $tbl_session_course_rel_user.'
1742 1742
                     WHERE user_id = ' . $user_id;
1743 1743
     		$rs = Database::query($sql);
1744 1744
     		$nb_courses += Database::num_rows($rs);
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
     		$condition_quiz = "";
1786 1786
     		if (!empty($exercise_id)) {
1787 1787
     			$exercise_id = intval($exercise_id);
1788
-    			$condition_quiz =" AND id = $exercise_id ";
1788
+    			$condition_quiz = " AND id = $exercise_id ";
1789 1789
     		}
1790 1790
 
1791 1791
     		// Compose a filter based on optional session id given
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
                         }
1839 1839
                     }
1840 1840
                     if (!empty($exercise_list)) {
1841
-                        $exercise_id = implode("','",$exercise_list);
1841
+                        $exercise_id = implode("','", $exercise_list);
1842 1842
                     }
1843 1843
     			}
1844 1844
 
@@ -1863,10 +1863,10 @@  discard block
 block discarded – undo
1863 1863
     			$quiz_avg_score = null;
1864 1864
 
1865 1865
     			if (!empty($row['avg_score'])) {
1866
-    				$quiz_avg_score = round($row['avg_score'],2);
1866
+    				$quiz_avg_score = round($row['avg_score'], 2);
1867 1867
     			}
1868 1868
 
1869
-    			if(!empty($row['num_attempts'])) {
1869
+    			if (!empty($row['num_attempts'])) {
1870 1870
     				$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1871 1871
     			}
1872 1872
     			if (is_array($student_id)) {
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
             $row = Database::fetch_row($rs);
1997 1997
             $count = $row[0];
1998 1998
         }
1999
-        $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%';
1999
+        $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%';
2000 2000
         return $count;
2001 2001
     }
2002 2002
 
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
                 );
2022 2022
 
2023 2023
                 if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) {
2024
-                    $result += $best_attempt['exe_result']/$best_attempt['exe_weighting'];
2024
+                    $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting'];
2025 2025
                 }
2026 2026
             }
2027 2027
             $result = $result / count($exercise_list);
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
         $query = sprintf($sql, intval($courseId), $sessionId);
2059 2059
         $rs = Database::query($query);
2060 2060
         $teachers = array();
2061
-        while ($teacher = Database::fetch_array($rs,'ASSOC')) {
2061
+        while ($teacher = Database::fetch_array($rs, 'ASSOC')) {
2062 2062
             $teachers[] = $teacher;
2063 2063
         }
2064 2064
         $data = array();
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
             $data[] = array(
2183 2183
                 'course' => $course['title'],
2184 2184
                 'session' => $teacher['name'],
2185
-                'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'],
2185
+                'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'],
2186 2186
                 'documents' => $totalDocuments,
2187 2187
                 'links' => $totalLinks,
2188 2188
                 'forums' => $totalForums,
@@ -2245,7 +2245,7 @@  discard block
 block discarded – undo
2245 2245
             for ($i = 0; $i < count($lpIdList); $i++) {
2246 2246
                 $placeHolders[] = '?';
2247 2247
             }
2248
-            $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList;
2248
+            $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList;
2249 2249
         }
2250 2250
 
2251 2251
         if ($onlySeriousGame) {
@@ -2265,14 +2265,14 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
         $conditions = [
2267 2267
             " c_id = {$courseInfo['real_id']} ",
2268
-            " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") "
2268
+            " lp_view.lp_id IN(".implode(', ', $filteredLP).") "
2269 2269
         ];
2270 2270
 
2271 2271
         $groupBy = 'GROUP BY lp_id';
2272 2272
 
2273 2273
         if (is_array($studentId)) {
2274 2274
             $studentId = array_map('intval', $studentId);
2275
-            $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ")  ";
2275
+            $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).")  ";
2276 2276
 
2277 2277
 
2278 2278
         } else {
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
             // Compose a filter based on optional learning paths list given
2408 2408
             $condition_lp = "";
2409 2409
             if (count($lp_ids) > 0) {
2410
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2410
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2411 2411
             }
2412 2412
 
2413 2413
             // Compose a filter based on optional session id
@@ -2447,9 +2447,9 @@  discard block
 block discarded – undo
2447 2447
             // prepare filter on users
2448 2448
             if (is_array($student_id)) {
2449 2449
                 array_walk($student_id, 'intval');
2450
-                $condition_user1 =" AND user_id IN (".implode(',', $student_id).") ";
2450
+                $condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
2451 2451
             } else {
2452
-                $condition_user1 =" AND user_id = $student_id ";
2452
+                $condition_user1 = " AND user_id = $student_id ";
2453 2453
             }
2454 2454
 
2455 2455
             if ($count_row_lp > 0 && !empty($student_id)) {
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
                                     ORDER BY lp_item_id";
2493 2493
                             $res_lp_item = Database::query($sql);
2494 2494
 
2495
-                            while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) {
2495
+                            while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) {
2496 2496
                                 $my_lp_item_id = $row_lp_item['lp_item_id'];
2497 2497
 
2498 2498
                                 // Getting the most recent attempt
@@ -2515,8 +2515,8 @@  discard block
 block discarded – undo
2515 2515
                                         ORDER BY view_count DESC
2516 2516
                                         LIMIT 1";
2517 2517
                                 $res_lp_item_result = Database::query($sql);
2518
-                                while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) {
2519
-                                    $list[]= $row_max_score;
2518
+                                while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) {
2519
+                                    $list[] = $row_max_score;
2520 2520
                                 }
2521 2521
                             }
2522 2522
                         } else {
@@ -2540,8 +2540,8 @@  discard block
 block discarded – undo
2540 2540
                             if ($debug) echo $sql.'<br />';
2541 2541
                             $res_max_score = Database::query($sql);
2542 2542
 
2543
-                            while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
2544
-                                $list[]= $row_max_score;
2543
+                            while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) {
2544
+                                $list[] = $row_max_score;
2545 2545
                             }
2546 2546
                         }
2547 2547
 
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2557 2557
                             $score = $row_max_score['score'];
2558 2558
 
2559
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2559
+                            if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2560 2560
 
2561 2561
                             if ($row_max_score['item_type'] == 'sco') {
2562 2562
                                 /* Check if it is sco (easier to get max_score)
@@ -2574,7 +2574,7 @@  discard block
 block discarded – undo
2574 2574
                                 }
2575 2575
                                 // Avoid division by zero errors
2576 2576
                                 if (!empty($max_score)) {
2577
-                                    $lp_partial_total += $score/$max_score;
2577
+                                    $lp_partial_total += $score / $max_score;
2578 2578
                                 }
2579 2579
                                 if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2580 2580
                             } else {
@@ -2598,10 +2598,10 @@  discard block
 block discarded – undo
2598 2598
                                         ORDER BY exe_date DESC
2599 2599
                                         LIMIT 1";
2600 2600
 
2601
-                                if ($debug) echo $sql .'<br />';
2601
+                                if ($debug) echo $sql.'<br />';
2602 2602
                                 $result_last_attempt = Database::query($sql);
2603 2603
                                 $num = Database :: num_rows($result_last_attempt);
2604
-                                if ($num > 0 ) {
2604
+                                if ($num > 0) {
2605 2605
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2606 2606
                                     if ($debug) echo $id_last_attempt.'<br />';
2607 2607
 
@@ -2630,13 +2630,13 @@  discard block
 block discarded – undo
2630 2630
                                         $max_score = $row_max_score_bis['maxscore'];
2631 2631
                                     }
2632 2632
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2633
-                                        $lp_partial_total += $score/$max_score;
2633
+                                        $lp_partial_total += $score / $max_score;
2634 2634
                                     }
2635 2635
                                     if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2636 2636
                                 }
2637 2637
                             }
2638 2638
 
2639
-                            if (in_array($row_max_score['item_type'], array('quiz','sco'))) {
2639
+                            if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) {
2640 2640
                                 // Normal way
2641 2641
                                 if ($use_max_score[$lp_id]) {
2642 2642
                                     $count_items++;
@@ -2671,8 +2671,8 @@  discard block
 block discarded – undo
2671 2671
                     if ($debug) echo $sql;
2672 2672
                     $result_have_quiz = Database::query($sql);
2673 2673
 
2674
-                    if (Database::num_rows($result_have_quiz) > 0 ) {
2675
-                        $row = Database::fetch_array($result_have_quiz,'ASSOC');
2674
+                    if (Database::num_rows($result_have_quiz) > 0) {
2675
+                        $row = Database::fetch_array($result_have_quiz, 'ASSOC');
2676 2676
                         if (is_numeric($row['count']) && $row['count'] != 0) {
2677 2677
                             $lp_with_quiz++;
2678 2678
                         }
@@ -2684,7 +2684,7 @@  discard block
 block discarded – undo
2684 2684
 
2685 2685
                 if ($lp_with_quiz != 0) {
2686 2686
                     if (!$return_array) {
2687
-                        $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2687
+                        $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2);
2688 2688
                         if ($debug) var_dump($score_of_scorm_calculate);
2689 2689
                         if (empty($lp_ids)) {
2690 2690
                             if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
@@ -2758,9 +2758,9 @@  discard block
 block discarded – undo
2758 2758
 
2759 2759
         if (is_array($student_id)) {
2760 2760
             array_walk($student_id, 'intval');
2761
-            $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") ";
2761
+            $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") ";
2762 2762
         } else {
2763
-            $conditions[] =" lp_view.user_id = $student_id ";
2763
+            $conditions[] = " lp_view.user_id = $student_id ";
2764 2764
         }
2765 2765
 
2766 2766
         $conditionsToString = implode('AND ', $conditions);
@@ -2784,7 +2784,7 @@  discard block
 block discarded – undo
2784 2784
             return 0;
2785 2785
         }
2786 2786
 
2787
-        return ($row['sum_score'] / $row['sum_max_score'])*100;
2787
+        return ($row['sum_score'] / $row['sum_max_score']) * 100;
2788 2788
 
2789 2789
     }
2790 2790
 
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
             // Compose a filter based on optional learning paths list given
2815 2815
             $condition_lp = "";
2816 2816
             if (count($lp_ids) > 0) {
2817
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2817
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2818 2818
             }
2819 2819
 
2820 2820
             // Compose a filter based on optional session id
@@ -2876,7 +2876,7 @@  discard block
 block discarded – undo
2876 2876
 
2877 2877
         if (!empty($course)) {
2878 2878
 
2879
-            $course_id	 = $course['real_id'];
2879
+            $course_id = $course['real_id'];
2880 2880
 
2881 2881
             $lp_table    = Database :: get_course_table(TABLE_LP_MAIN);
2882 2882
             $t_lpv       = Database :: get_course_table(TABLE_LP_VIEW);
@@ -2890,8 +2890,8 @@  discard block
 block discarded – undo
2890 2890
             // calculates last connection time
2891 2891
             if ($count_row_lp > 0) {
2892 2892
                 $sql = 'SELECT MAX(start_time)
2893
-                        FROM ' . $t_lpiv . ' AS item_view
2894
-                        INNER JOIN ' . $t_lpv . ' AS view
2893
+                        FROM ' . $t_lpiv.' AS item_view
2894
+                        INNER JOIN ' . $t_lpv.' AS view
2895 2895
                             ON item_view.lp_view_id = view.id
2896 2896
                         WHERE
2897 2897
                             item_view.c_id 		= '.$course_id.' AND
@@ -2927,15 +2927,15 @@  discard block
 block discarded – undo
2927 2927
 
2928 2928
         // At first, courses where $coach_id is coach of the course //
2929 2929
         $sql = 'SELECT session_id, c_id
2930
-                FROM ' . $tbl_session_course_user . '
2930
+                FROM ' . $tbl_session_course_user.'
2931 2931
                 WHERE user_id=' . $coach_id.' AND status=2';
2932 2932
 
2933 2933
         if (api_is_multiple_url_enabled()) {
2934
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2934
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2935 2935
             $access_url_id = api_get_current_access_url_id();
2936 2936
             if ($access_url_id != -1) {
2937 2937
                 $sql = 'SELECT scu.session_id, scu.c_id
2938
-                    FROM ' . $tbl_session_course_user . ' scu
2938
+                    FROM ' . $tbl_session_course_user.' scu
2939 2939
                     INNER JOIN '.$tbl_session_rel_access_url.'  sru
2940 2940
                     ON (scu.session_id=sru.session_id)
2941 2941
                     WHERE
@@ -2969,28 +2969,28 @@  discard block
 block discarded – undo
2969 2969
 
2970 2970
         // Then, courses where $coach_id is coach of the session    //
2971 2971
         $sql = 'SELECT session_course_user.user_id
2972
-                FROM ' . $tbl_session_course_user . ' as session_course_user
2972
+                FROM ' . $tbl_session_course_user.' as session_course_user
2973 2973
                 INNER JOIN     '.$tbl_session_user.' sru
2974 2974
                 ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id
2975
-                INNER JOIN ' . $tbl_session_course . ' as session_course
2975
+                INNER JOIN ' . $tbl_session_course.' as session_course
2976 2976
                 ON session_course.c_id = session_course_user.c_id
2977 2977
                 AND session_course_user.session_id = session_course.session_id
2978
-                INNER JOIN ' . $tbl_session . ' as session
2978
+                INNER JOIN ' . $tbl_session.' as session
2979 2979
                 ON session.id = session_course.session_id
2980 2980
                 AND session.id_coach = ' . $coach_id;
2981 2981
         if (api_is_multiple_url_enabled()) {
2982
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2982
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2983 2983
             $access_url_id = api_get_current_access_url_id();
2984
-            if ($access_url_id != -1){
2984
+            if ($access_url_id != -1) {
2985 2985
                 $sql = 'SELECT session_course_user.user_id
2986
-                        FROM ' . $tbl_session_course_user . ' as session_course_user
2986
+                        FROM ' . $tbl_session_course_user.' as session_course_user
2987 2987
                         INNER JOIN     '.$tbl_session_user.' sru
2988 2988
                             ON session_course_user.user_id = sru.user_id AND
2989 2989
                                session_course_user.session_id = sru.session_id
2990
-                        INNER JOIN ' . $tbl_session_course . ' as session_course
2990
+                        INNER JOIN ' . $tbl_session_course.' as session_course
2991 2991
                             ON session_course.c_id = session_course_user.c_id AND
2992 2992
                             session_course_user.session_id = session_course.session_id
2993
-                        INNER JOIN ' . $tbl_session . ' as session
2993
+                        INNER JOIN ' . $tbl_session.' as session
2994 2994
                             ON session.id = session_course.session_id AND
2995 2995
                             session.id_coach = ' . $coach_id.'
2996 2996
                         INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
@@ -3020,8 +3020,8 @@  discard block
 block discarded – undo
3020 3020
 
3021 3021
         $students = [];
3022 3022
         // At first, courses where $coach_id is coach of the course //
3023
-        $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . '
3024
-                WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2';
3023
+        $sql = 'SELECT c_id FROM '.$tbl_session_course_user.'
3024
+                WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2';
3025 3025
         $result = Database::query($sql);
3026 3026
 
3027 3027
         while ($a_courses = Database::fetch_array($result)) {
@@ -3031,7 +3031,7 @@  discard block
 block discarded – undo
3031 3031
                     FROM $tbl_session_course_user AS srcru
3032 3032
                     WHERE
3033 3033
                         c_id = '$courseId' AND
3034
-                        session_id = '" . $id_session . "'";
3034
+                        session_id = '".$id_session."'";
3035 3035
             $rs = Database::query($sql);
3036 3036
             while ($row = Database::fetch_array($rs)) {
3037 3037
                 $students[$row['user_id']] = $row['user_id'];
@@ -3039,15 +3039,15 @@  discard block
 block discarded – undo
3039 3039
         }
3040 3040
 
3041 3041
         // Then, courses where $coach_id is coach of the session
3042
-        $sql = 'SELECT id_coach FROM ' . $tbl_session . '
3043
-                WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"';
3042
+        $sql = 'SELECT id_coach FROM '.$tbl_session.'
3043
+                WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"';
3044 3044
         $result = Database::query($sql);
3045 3045
 
3046 3046
         //He is the session_coach so we select all the users in the session
3047 3047
         if (Database::num_rows($result) > 0) {
3048 3048
             $sql = 'SELECT DISTINCT srcru.user_id
3049
-                    FROM ' . $tbl_session_course_user . ' AS srcru
3050
-                    WHERE session_id="' . $id_session . '"';
3049
+                    FROM ' . $tbl_session_course_user.' AS srcru
3050
+                    WHERE session_id="' . $id_session.'"';
3051 3051
             $result = Database::query($sql);
3052 3052
             while ($row = Database::fetch_array($result)) {
3053 3053
                 $students[$row['user_id']] = $row['user_id'];
@@ -3074,8 +3074,8 @@  discard block
 block discarded – undo
3074 3074
 
3075 3075
         // At first, courses where $coach_id is coach of the course //
3076 3076
 
3077
-        $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . '
3078
-                WHERE user_id=' . $coach_id .' AND status=2';
3077
+        $sql = 'SELECT 1 FROM '.$tbl_session_course_user.'
3078
+                WHERE user_id=' . $coach_id.' AND status=2';
3079 3079
         $result = Database::query($sql);
3080 3080
         if (Database::num_rows($result) > 0) {
3081 3081
             return true;
@@ -3083,12 +3083,12 @@  discard block
 block discarded – undo
3083 3083
 
3084 3084
         // Then, courses where $coach_id is coach of the session
3085 3085
         $sql = 'SELECT session_course_user.user_id
3086
-                FROM ' . $tbl_session_course_user . ' as session_course_user
3087
-                INNER JOIN ' . $tbl_session_course . ' as session_course
3086
+                FROM ' . $tbl_session_course_user.' as session_course_user
3087
+                INNER JOIN ' . $tbl_session_course.' as session_course
3088 3088
                     ON session_course.c_id = session_course_user.c_id
3089
-                INNER JOIN ' . $tbl_session . ' as session
3089
+                INNER JOIN ' . $tbl_session.' as session
3090 3090
                     ON session.id = session_course.session_id
3091
-                    AND session.id_coach = ' . $coach_id . '
3091
+                    AND session.id_coach = ' . $coach_id.'
3092 3092
                 WHERE user_id = ' . $student_id;
3093 3093
         $result = Database::query($sql);
3094 3094
         if (Database::num_rows($result) > 0) {
@@ -3120,16 +3120,16 @@  discard block
 block discarded – undo
3120 3120
         // At first, courses where $coach_id is coach of the course.
3121 3121
 
3122 3122
         $sql = 'SELECT DISTINCT c.code
3123
-                FROM ' . $tbl_session_course_user . ' sc
3123
+                FROM ' . $tbl_session_course_user.' sc
3124 3124
                 INNER JOIN '.$tbl_course.' c
3125 3125
                 ON (c.id = sc.c_id)
3126 3126
                 WHERE user_id = ' . $coach_id.' AND status = 2';
3127 3127
 
3128 3128
         if (api_is_multiple_url_enabled()) {
3129 3129
             $access_url_id = api_get_current_access_url_id();
3130
-            if ($access_url_id != -1){
3130
+            if ($access_url_id != -1) {
3131 3131
                 $sql = 'SELECT DISTINCT c.code
3132
-                        FROM ' . $tbl_session_course_user . ' scu
3132
+                        FROM ' . $tbl_session_course_user.' scu
3133 3133
                         INNER JOIN '.$tbl_course.' c
3134 3134
                         ON (c.code = scu.c_id)
3135 3135
                         INNER JOIN '.$tbl_course_rel_access_url.' cru
@@ -3142,7 +3142,7 @@  discard block
 block discarded – undo
3142 3142
         }
3143 3143
 
3144 3144
         if (!empty($id_session)) {
3145
-            $sql .= ' AND session_id=' . $id_session;
3145
+            $sql .= ' AND session_id='.$id_session;
3146 3146
         }
3147 3147
 
3148 3148
         $courseList = array();
@@ -3154,25 +3154,25 @@  discard block
 block discarded – undo
3154 3154
         // Then, courses where $coach_id is coach of the session
3155 3155
 
3156 3156
         $sql = 'SELECT DISTINCT course.code
3157
-                FROM ' . $tbl_session_course . ' as session_course
3158
-                INNER JOIN ' . $tbl_session . ' as session
3157
+                FROM ' . $tbl_session_course.' as session_course
3158
+                INNER JOIN ' . $tbl_session.' as session
3159 3159
                     ON session.id = session_course.session_id
3160
-                    AND session.id_coach = ' . $coach_id . '
3161
-                INNER JOIN ' . $tbl_course . ' as course
3160
+                    AND session.id_coach = ' . $coach_id.'
3161
+                INNER JOIN ' . $tbl_course.' as course
3162 3162
                     ON course.id = session_course.c_id';
3163 3163
 
3164 3164
         if (api_is_multiple_url_enabled()) {
3165 3165
             $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
3166 3166
             $access_url_id = api_get_current_access_url_id();
3167
-            if ($access_url_id != -1){
3167
+            if ($access_url_id != -1) {
3168 3168
                 $sql = 'SELECT DISTINCT c.code
3169
-                    FROM ' . $tbl_session_course . ' as session_course
3169
+                    FROM ' . $tbl_session_course.' as session_course
3170 3170
                     INNER JOIN '.$tbl_course.' c
3171 3171
                     ON (c.id = session_course.c_id)
3172
-                    INNER JOIN ' . $tbl_session . ' as session
3172
+                    INNER JOIN ' . $tbl_session.' as session
3173 3173
                     ON session.id = session_course.session_id
3174
-                        AND session.id_coach = ' . $coach_id . '
3175
-                    INNER JOIN ' . $tbl_course . ' as course
3174
+                        AND session.id_coach = ' . $coach_id.'
3175
+                    INNER JOIN ' . $tbl_course.' as course
3176 3176
                         ON course.id = session_course.c_id
3177 3177
                      INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url
3178 3178
                     ON (course_rel_url.c_id = c.id)';
@@ -3180,12 +3180,12 @@  discard block
 block discarded – undo
3180 3180
         }
3181 3181
 
3182 3182
         if (!empty ($id_session)) {
3183
-            $sql .= ' WHERE session_course.session_id=' . $id_session;
3183
+            $sql .= ' WHERE session_course.session_id='.$id_session;
3184 3184
             if (api_is_multiple_url_enabled())
3185
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3186
-        }  else {
3185
+            $sql .= ' AND access_url_id = '.$access_url_id;
3186
+        } else {
3187 3187
             if (api_is_multiple_url_enabled())
3188
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3188
+            $sql .= ' WHERE access_url_id = '.$access_url_id;
3189 3189
         }
3190 3190
 
3191 3191
         $result = Database::query($sql);
@@ -3241,7 +3241,7 @@  discard block
 block discarded – undo
3241 3241
             }
3242 3242
         }
3243 3243
 
3244
-        $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3244
+        $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3245 3245
         $access_url_id = api_get_current_access_url_id();
3246 3246
 
3247 3247
         $sql = "
@@ -3365,7 +3365,7 @@  discard block
 block discarded – undo
3365 3365
             // table definition
3366 3366
             $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
3367 3367
             $tbl_document = Database :: get_course_table(TABLE_DOCUMENT);
3368
-            $course_id	 = $a_course['real_id'];
3368
+            $course_id = $a_course['real_id'];
3369 3369
             if (is_array($student_id)) {
3370 3370
                 $studentList = array_map('intval', $student_id);
3371 3371
                 $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') ";
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
         $a_course = CourseManager::get_course_information($course_code);
3417 3417
         if (!empty($a_course)) {
3418 3418
             $course_id = $a_course['real_id'];
3419
-            $conditions[]= " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3419
+            $conditions[] = " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3420 3420
         }
3421 3421
 
3422 3422
         // table definition
@@ -3425,14 +3425,14 @@  discard block
 block discarded – undo
3425 3425
 
3426 3426
         if (is_array($student_id)) {
3427 3427
             $studentList = array_map('intval', $student_id);
3428
-            $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3428
+            $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3429 3429
         } else {
3430 3430
             $student_id = intval($student_id);
3431
-            $conditions[]= " ip.insert_user_id = '$student_id' ";
3431
+            $conditions[] = " ip.insert_user_id = '$student_id' ";
3432 3432
         }
3433 3433
         if (isset($session_id)) {
3434 3434
             $session_id = intval($session_id);
3435
-            $conditions[]= " pub.session_id = $session_id ";
3435
+            $conditions[] = " pub.session_id = $session_id ";
3436 3436
         }
3437 3437
         $conditionToString = implode('AND', $conditions);
3438 3438
 
@@ -3465,8 +3465,8 @@  discard block
 block discarded – undo
3465 3465
         $courseCondition = null;
3466 3466
         $conditions = array();
3467 3467
         if (!empty($courseInfo)) {
3468
-            $course_id	    = $courseInfo['real_id'];
3469
-            $conditions[]= " post.c_id  = $course_id AND forum.c_id = $course_id ";
3468
+            $course_id = $courseInfo['real_id'];
3469
+            $conditions[] = " post.c_id  = $course_id AND forum.c_id = $course_id ";
3470 3470
         }
3471 3471
 
3472 3472
         // Table definition.
@@ -3475,15 +3475,15 @@  discard block
 block discarded – undo
3475 3475
 
3476 3476
         if (is_array($student_id)) {
3477 3477
             $studentList = array_map('intval', $student_id);
3478
-            $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') ";
3478
+            $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') ";
3479 3479
         } else {
3480 3480
             $student_id = intval($student_id);
3481
-            $conditions[]= " post.poster_id = '$student_id' ";
3481
+            $conditions[] = " post.poster_id = '$student_id' ";
3482 3482
         }
3483 3483
 
3484 3484
         if (isset($session_id)) {
3485 3485
             $session_id = intval($session_id);
3486
-            $conditions[]= " forum.session_id = $session_id";
3486
+            $conditions[] = " forum.session_id = $session_id";
3487 3487
         }
3488 3488
 
3489 3489
         $conditionsToString = implode('AND ', $conditions);
@@ -3518,7 +3518,7 @@  discard block
 block discarded – undo
3518 3518
             $condition_session = '';
3519 3519
             if (isset($session_id)) {
3520 3520
                 $session_id = intval($session_id);
3521
-                $condition_session = api_get_session_condition($session_id, true,  false, 'f.session_id');
3521
+                $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id');
3522 3522
             }
3523 3523
 
3524 3524
             $course_id = $courseInfo['real_id'];
@@ -3574,7 +3574,7 @@  discard block
 block discarded – undo
3574 3574
         $condition_session = '';
3575 3575
         if (isset($session_id)) {
3576 3576
             $session_id = intval($session_id);
3577
-            $condition_session = ' AND f.session_id = '. $session_id;
3577
+            $condition_session = ' AND f.session_id = '.$session_id;
3578 3578
         }
3579 3579
 
3580 3580
         $groupId = intval($groupId);
@@ -3635,7 +3635,7 @@  discard block
 block discarded – undo
3635 3635
         $condition_session = '';
3636 3636
         if (isset($session_id)) {
3637 3637
              $session_id = intval($session_id);
3638
-             $condition_session = ' AND f.session_id = '. $session_id;
3638
+             $condition_session = ' AND f.session_id = '.$session_id;
3639 3639
         }
3640 3640
 
3641 3641
         $groupId = intval($groupId);
@@ -3714,7 +3714,7 @@  discard block
 block discarded – undo
3714 3714
     {
3715 3715
         $student_id = intval($student_id);
3716 3716
         $courseId = intval($courseId);
3717
-        $session_id    = intval($session_id);
3717
+        $session_id = intval($session_id);
3718 3718
         $date_time  = '';
3719 3719
 
3720 3720
         // table definition
@@ -3783,7 +3783,7 @@  discard block
 block discarded – undo
3783 3783
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
3784 3784
 
3785 3785
         $sql = 'SELECT 1
3786
-                FROM ' . $table . '
3786
+                FROM ' . $table.'
3787 3787
                 WHERE down_user_id = '.$student_id.'
3788 3788
                 AND c_id  = "'.$courseId.'"
3789 3789
                 AND down_session_id = '.$session_id.' ';
@@ -3861,30 +3861,30 @@  discard block
 block discarded – undo
3861 3861
                 '.$inner.'
3862 3862
                 WHERE c.id = '.$courseId.'
3863 3863
                 GROUP BY stats_login.user_id
3864
-                HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date ';
3864
+                HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date ';
3865 3865
 
3866 3866
         if ($since == 'never') {
3867 3867
             if (empty($session_id)) {
3868 3868
                 $sql = 'SELECT course_user.user_id
3869
-                        FROM ' . $table_course_rel_user . ' course_user
3870
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3869
+                        FROM ' . $table_course_rel_user.' course_user
3870
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3871 3871
                         ON course_user.user_id = stats_login.user_id AND
3872
-                        relation_type<>' . COURSE_RELATION_TYPE_RRHH . '
3873
-                        INNER JOIN ' . $tableCourse . ' c
3872
+                        relation_type<>' . COURSE_RELATION_TYPE_RRHH.'
3873
+                        INNER JOIN ' . $tableCourse.' c
3874 3874
                         ON (c.id = course_user.c_id)
3875 3875
                         WHERE
3876
-                            course_user.c_id = ' . $courseId . ' AND
3876
+                            course_user.c_id = ' . $courseId.' AND
3877 3877
                             stats_login.login_course_date IS NULL
3878 3878
                         GROUP BY course_user.user_id';
3879 3879
             } else {
3880 3880
                 $sql = 'SELECT session_course_user.user_id
3881 3881
                         FROM '.$tbl_session_course_user.' session_course_user
3882
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3882
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3883 3883
                         ON session_course_user.user_id = stats_login.user_id
3884
-                        INNER JOIN ' . $tableCourse . ' c
3884
+                        INNER JOIN ' . $tableCourse.' c
3885 3885
                         ON (c.id = session_course_user.c_id)
3886 3886
                         WHERE
3887
-                            session_course_user.c_id = ' . $courseId . ' AND
3887
+                            session_course_user.c_id = ' . $courseId.' AND
3888 3888
                             stats_login.login_course_date IS NULL
3889 3889
                         GROUP BY session_course_user.user_id';
3890 3890
 
@@ -3893,7 +3893,7 @@  discard block
 block discarded – undo
3893 3893
 
3894 3894
         $rs = Database::query($sql);
3895 3895
         $inactive_users = array();
3896
-        while($user = Database::fetch_array($rs)) {
3896
+        while ($user = Database::fetch_array($rs)) {
3897 3897
             $inactive_users[] = $user['user_id'];
3898 3898
         }
3899 3899
 
@@ -3915,10 +3915,10 @@  discard block
 block discarded – undo
3915 3915
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
3916 3916
 
3917 3917
         $sql = 'SELECT '.$student_id.'
3918
-                FROM ' . $table . '
3918
+                FROM ' . $table.'
3919 3919
                 WHERE
3920
-                    access_user_id=' . $student_id . ' AND
3921
-                    c_id="' . $courseId . '" AND
3920
+                    access_user_id=' . $student_id.' AND
3921
+                    c_id="' . $courseId.'" AND
3922 3922
                     access_session_id = "'.$session_id.'" ';
3923 3923
 
3924 3924
         $rs = Database::query($sql);
@@ -3936,13 +3936,13 @@  discard block
 block discarded – undo
3936 3936
     {
3937 3937
         $hr_dept_id = intval($hr_dept_id);
3938 3938
         $a_students = array();
3939
-        $tbl_user     = Database :: get_main_table(TABLE_MAIN_USER);
3939
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
3940 3940
 
3941 3941
         $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user
3942 3942
                 WHERE hr_dept_id='.$hr_dept_id;
3943 3943
         $rs = Database::query($sql);
3944 3944
 
3945
-        while($user = Database :: fetch_array($rs)) {
3945
+        while ($user = Database :: fetch_array($rs)) {
3946 3946
             $a_students[$user['user_id']] = $user['user_id'];
3947 3947
         }
3948 3948
 
@@ -3967,7 +3967,7 @@  discard block
 block discarded – undo
3967 3967
         $condition_session     = '';
3968 3968
         if (isset($session_id)) {
3969 3969
             $session_id = intval($session_id);
3970
-            $condition_session = ' AND access_session_id = '. $session_id;
3970
+            $condition_session = ' AND access_session_id = '.$session_id;
3971 3971
         }
3972 3972
         $sql = "SELECT
3973 3973
                     access_tool,
@@ -4079,7 +4079,7 @@  discard block
 block discarded – undo
4079 4079
             if (!empty($date_from) && !empty($date_to)) {
4080 4080
                 $fieldStartDate = $fields['start_date'];
4081 4081
                 if (!isset($fields['end_date'])) {
4082
-                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ;
4082
+                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to);
4083 4083
                 } else {
4084 4084
                     $fieldEndDate = $fields['end_date'];
4085 4085
                     $where .= sprintf(" AND fieldStartDate >= '%s'
@@ -4095,12 +4095,12 @@  discard block
 block discarded – undo
4095 4095
                 $where
4096 4096
                 GROUP BY %s";
4097 4097
             $sql = sprintf($sql,
4098
-                $fields['user'],    //user field
4099
-                $tableName,         //FROM
4100
-                $fields['course'],  //course condition
4101
-                $course['real_id'],    //course condition
4102
-                $fields['user'],    //user condition
4103
-                $userId,            //user condition
4098
+                $fields['user'], //user field
4099
+                $tableName, //FROM
4100
+                $fields['course'], //course condition
4101
+                $course['real_id'], //course condition
4102
+                $fields['user'], //user condition
4103
+                $userId, //user condition
4104 4104
                 $fields['user']     //GROUP BY
4105 4105
                 );
4106 4106
             $rs = Database::query($sql);
@@ -4108,7 +4108,7 @@  discard block
 block discarded – undo
4108 4108
             //iterate query
4109 4109
             if (Database::num_rows($rs) > 0) {
4110 4110
                 while ($row = Database::fetch_array($rs)) {
4111
-                    $data[$row['user']] = (isset($data[$row['user']])) ?  $data[$row['user']] + $row[total]: $row['total'];
4111
+                    $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total'];
4112 4112
                 }
4113 4113
             }
4114 4114
         }
@@ -4131,11 +4131,11 @@  discard block
 block discarded – undo
4131 4131
         $courseId = api_get_course_int_id($course_code);
4132 4132
         $data = array();
4133 4133
 
4134
-        $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4134
+        $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4135 4135
         $condition_session = '';
4136 4136
         if (isset($session_id)) {
4137 4137
             $session_id = intval($session_id);
4138
-            $condition_session = ' AND down_session_id = '. $session_id;
4138
+            $condition_session = ' AND down_session_id = '.$session_id;
4139 4139
         }
4140 4140
         $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down
4141 4141
                 FROM $TABLETRACK_DOWNLOADS
@@ -4320,7 +4320,7 @@  discard block
 block discarded – undo
4320 4320
 
4321 4321
             $final_course_data = array();
4322 4322
 
4323
-            foreach($my_course_data as $course_id => $value) {
4323
+            foreach ($my_course_data as $course_id => $value) {
4324 4324
                 $final_course_data[$course_id] = $course_list[$course_id];
4325 4325
             }
4326 4326
             $course_in_session[$my_session_id]['course_list'] = $final_course_data;
@@ -4343,7 +4343,7 @@  discard block
 block discarded – undo
4343 4343
                           '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
4344 4344
                           '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4345 4345
                           '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
4346
-                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).'
4346
+                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4347 4347
                           '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4348 4348
                           '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4349 4349
                         </tr>';
@@ -4432,7 +4432,7 @@  discard block
 block discarded – undo
4432 4432
             $all_exercise_start_time = array();
4433 4433
 
4434 4434
             foreach ($course_in_session as $my_session_id => $session_data) {
4435
-                $course_list  = $session_data['course_list'];
4435
+                $course_list = $session_data['course_list'];
4436 4436
                 $user_count = count(SessionManager::get_users_by_session($my_session_id));
4437 4437
                 $exercise_graph_name_list = array();
4438 4438
                 //$user_results = array();
@@ -4477,20 +4477,20 @@  discard block
 block discarded – undo
4477 4477
 
4478 4478
                             $score = 0;
4479 4479
                             if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
4480
-                                $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
4480
+                                $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
4481 4481
                             }
4482 4482
                             $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
4483 4483
                             $all_exercise_start_time[] = $time;
4484 4484
                             $my_results[] = $score;
4485
-                            if (count($exercise_list)<=10) {
4485
+                            if (count($exercise_list) <= 10) {
4486 4486
                                 $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
4487
-                                $exercise_graph_name_list[]= $title;
4487
+                                $exercise_graph_name_list[] = $title;
4488 4488
                                 $all_exercise_graph_name_list[] = $title;
4489 4489
                             } else {
4490 4490
                                 // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
4491 4491
                                 $title = cut($exercise_data['title'], 30);
4492
-                                $exercise_graph_name_list[]= $title;
4493
-                                $all_exercise_graph_name_list[]= $title;
4492
+                                $exercise_graph_name_list[] = $title;
4493
+                                $all_exercise_graph_name_list[] = $title;
4494 4494
                             }
4495 4495
                         }
4496 4496
                     }
@@ -4523,7 +4523,7 @@  discard block
 block discarded – undo
4523 4523
             }
4524 4524
 
4525 4525
             $html .= Display::page_subheader(
4526
-                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions')
4526
+                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions')
4527 4527
             );
4528 4528
 
4529 4529
             $html .= '<div class="table-responsive">';
@@ -4577,7 +4577,7 @@  discard block
 block discarded – undo
4577 4577
                                 $courseInfo['real_id'],
4578 4578
                                 $my_session_id
4579 4579
                             );
4580
-                            if ($attempts > 1)  {
4580
+                            if ($attempts > 1) {
4581 4581
                                 $answered_exercises++;
4582 4582
                             }
4583 4583
                         }
@@ -4590,7 +4590,7 @@  discard block
 block discarded – undo
4590 4590
                     $all_average += $average;
4591 4591
                 }
4592 4592
 
4593
-                $all_average = $all_average /  count($course_list);
4593
+                $all_average = $all_average / count($course_list);
4594 4594
 
4595 4595
                 if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
4596 4596
                     $html .= '<tr style="background-color:#FBF09D">';
@@ -4616,16 +4616,16 @@  discard block
 block discarded – undo
4616 4616
             }
4617 4617
             $html .= '</tbody>';
4618 4618
             $html .= '</table></div><br />';
4619
-            $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
4619
+            $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;'));
4620 4620
 
4621 4621
             // Checking selected session.
4622 4622
 
4623 4623
             if (isset($_GET['session_id'])) {
4624 4624
                 $session_id_from_get = intval($_GET['session_id']);
4625
-                $session_data 	= $course_in_session[$session_id_from_get];
4626
-                $course_list 	= $session_data['course_list'];
4625
+                $session_data = $course_in_session[$session_id_from_get];
4626
+                $course_list = $session_data['course_list'];
4627 4627
 
4628
-                $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList'));
4628
+                $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList'));
4629 4629
 
4630 4630
                 $html .= '<div class="table-responsive">';
4631 4631
                 $html .= '<table class="table table-hover table-striped">';
@@ -4634,15 +4634,15 @@  discard block
 block discarded – undo
4634 4634
                     <thead>
4635 4635
                     <tr>
4636 4636
                       <th width="300px">'.get_lang('Course').'</th>
4637
-                      '.Display::tag('th', get_lang('PublishedExercises'),    	array('class'=>'head')).'
4638
-                      '.Display::tag('th', get_lang('NewExercises'),    		array('class'=>'head')).'
4639
-                      '.Display::tag('th', get_lang('MyAverage'), 				array('class'=>'head')).'
4640
-                      '.Display::tag('th', get_lang('AverageExerciseResult'), 	array('class'=>'head')).'
4641
-                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'),    array('class'=>'head')).'
4642
-                      '.Display::tag('th', get_lang('LPProgress')     ,      	array('class'=>'head')).'
4643
-                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4644
-                      '.Display::tag('th', get_lang('LastConnexion'),         	array('class'=>'head')).'
4645
-                      '.Display::tag('th', get_lang('Details'),               	array('class'=>'head')).'
4637
+                      '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).'
4638
+                      '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
4639
+                      '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).'
4640
+                      '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
4641
+                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4642
+                      '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).'
4643
+                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4644
+                      '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4645
+                      '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4646 4646
                     </tr>
4647 4647
                     </thead>
4648 4648
                     <tbody>
@@ -4661,14 +4661,14 @@  discard block
 block discarded – undo
4661 4661
                         $count_exercises = count($exercises);
4662 4662
                     }
4663 4663
                     $answered_exercises = 0;
4664
-                    foreach($exercises as $exercise_item) {
4664
+                    foreach ($exercises as $exercise_item) {
4665 4665
                         $attempts = Event::count_exercise_attempts_by_user(
4666 4666
                             api_get_user_id(),
4667 4667
                             $exercise_item['id'],
4668 4668
                             $courseId,
4669 4669
                             $session_id_from_get
4670 4670
                         );
4671
-                        if ($attempts > 1)  {
4671
+                        if ($attempts > 1) {
4672 4672
                             $answered_exercises++;
4673 4673
                         }
4674 4674
                     }
@@ -4677,7 +4677,7 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
                     // Average
4679 4679
                     $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get);
4680
-                    $my_average	= ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4680
+                    $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4681 4681
 
4682 4682
                     $stats_array[$course_code] = array(
4683 4683
                         'exercises' => $count_exercises,
@@ -4754,7 +4754,7 @@  discard block
 block discarded – undo
4754 4754
 
4755 4755
                     if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
4756 4756
                         $details = '<a href="#">';
4757
-                        $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4757
+                        $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4758 4758
                     } else {
4759 4759
                         $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">';
4760 4760
                         $details .= Display::return_icon('2rightarrow.png', get_lang('Details'));
@@ -4854,7 +4854,7 @@  discard block
 block discarded – undo
4854 4854
                     );
4855 4855
 
4856 4856
                     $html .= '<tr class="row_even">';
4857
-                    $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
4857
+                    $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}";
4858 4858
 
4859 4859
                     if ($visible_return['value'] == true) {
4860 4860
                         $exercices['title'] = Display::url(
@@ -4883,7 +4883,7 @@  discard block
 block discarded – undo
4883 4883
                         );
4884 4884
 
4885 4885
                         $latest_attempt_url = '';
4886
-                        $best_score = $position = $percentage_score_result  = '-';
4886
+                        $best_score = $position = $percentage_score_result = '-';
4887 4887
                         $graph = $normal_graph = null;
4888 4888
 
4889 4889
                         // Getting best results
@@ -4915,11 +4915,11 @@  discard block
 block discarded – undo
4915 4915
                                 $weighting      = $exercise_stat['exe_weighting'];
4916 4916
                                 $exe_id         = $exercise_stat['exe_id'];
4917 4917
 
4918
-                                $latest_attempt_url .= api_get_path(WEB_CODE_PATH) . 'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id;
4918
+                                $latest_attempt_url .= api_get_path(WEB_CODE_PATH).'exercise/result.php?id='.$exe_id.'&cidReq='.$course_info['code'].'&show_headers=1&id_session='.$session_id;
4919 4919
                                 $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
4920 4920
                                 $my_score = 0;
4921 4921
                                 if (!empty($weighting) && intval($weighting) != 0) {
4922
-                                    $my_score = $score/$weighting;
4922
+                                    $my_score = $score / $weighting;
4923 4923
                                 }
4924 4924
                                 //@todo this function slows the page
4925 4925
                                 if (is_int($user_list)) {
@@ -4933,14 +4933,14 @@  discard block
 block discarded – undo
4933 4933
                         }
4934 4934
                         $html .= Display::div(
4935 4935
                             $normal_graph,
4936
-                            array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none')
4936
+                            array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none')
4937 4937
                         );
4938 4938
 
4939 4939
                         if (empty($graph)) {
4940 4940
                             $graph = '-';
4941 4941
                         } else {
4942 4942
                             $graph = Display::url(
4943
-                                '<img src="' . $graph . '" >',
4943
+                                '<img src="'.$graph.'" >',
4944 4944
                                 $normal_graph,
4945 4945
                                 array(
4946 4946
                                     'id' => $exercices['id'],
@@ -4974,7 +4974,7 @@  discard block
 block discarded – undo
4974 4974
 
4975 4975
             // LP table results
4976 4976
             $html .= '<div class="table-responsive">';
4977
-            $html .='<table class="table table-striped table-hover">';
4977
+            $html .= '<table class="table table-striped table-hover">';
4978 4978
             $html .= '<thead><tr>';
4979 4979
             $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000'));
4980 4980
             $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000'));
@@ -5010,7 +5010,7 @@  discard block
 block discarded – undo
5010 5010
                     $time_spent_in_lp = api_time_to_hms($time_spent_in_lp);
5011 5011
 
5012 5012
                     $html .= '<tr class="row_even">';
5013
-                    $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view";
5013
+                    $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view";
5014 5014
 
5015 5015
                     if ($learnpath['lp_visibility'] == 0) {
5016 5016
                         $html .= Display::tag('td', $learnpath['lp_name']);
@@ -5029,7 +5029,7 @@  discard block
 block discarded – undo
5029 5029
                     if (!empty($last_connection_in_lp)) {
5030 5030
                         $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG);
5031 5031
                     }
5032
-                    $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px'));
5032
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px'));
5033 5033
                     $html .= "</tr>";
5034 5034
                 }
5035 5035
             } else {
@@ -5039,7 +5039,7 @@  discard block
 block discarded – undo
5039 5039
                         </td>
5040 5040
                       </tr>';
5041 5041
             }
5042
-            $html .='</tbody></table></div>';
5042
+            $html .= '</tbody></table></div>';
5043 5043
 
5044 5044
             $html .= self::displayUserSkills($user_id, $course_info['id'], $session_id);
5045 5045
         }
@@ -5068,7 +5068,7 @@  discard block
 block discarded – undo
5068 5068
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
5069 5069
         $myData->setSerieDescription('Serie2', get_lang('AverageScore'));
5070 5070
         $myData->setAxisUnit(0, '%');
5071
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5071
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5072 5072
         // Cache definition
5073 5073
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5074 5074
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
@@ -5076,9 +5076,9 @@  discard block
 block discarded – undo
5076 5076
 
5077 5077
         if ($myCache->isInCache($chartHash)) {
5078 5078
             //if we already created the img
5079
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5079
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5080 5080
             $myCache->saveFromCache($chartHash, $imgPath);
5081
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5081
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5082 5082
         } else {
5083 5083
             /* Define width, height and angle */
5084 5084
             $mainWidth = 860;
@@ -5107,7 +5107,7 @@  discard block
 block discarded – undo
5107 5107
             /* Set the default font */
5108 5108
             $myPicture->setFontProperties(
5109 5109
                 array(
5110
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5110
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5111 5111
                     'FontSize' => 10)
5112 5112
             );
5113 5113
             /* Write the chart title */
@@ -5124,7 +5124,7 @@  discard block
 block discarded – undo
5124 5124
             /* Set the default font */
5125 5125
             $myPicture->setFontProperties(
5126 5126
                 array(
5127
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5127
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5128 5128
                     'FontSize' => 6
5129 5129
                 )
5130 5130
             );
@@ -5166,7 +5166,7 @@  discard block
 block discarded – undo
5166 5166
             /* Draw the line chart */
5167 5167
             $myPicture->setFontProperties(
5168 5168
                 array(
5169
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5169
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5170 5170
                     'FontSize' => 10
5171 5171
                 )
5172 5172
             );
@@ -5199,12 +5199,12 @@  discard block
 block discarded – undo
5199 5199
             );
5200 5200
 
5201 5201
             $myCache->writeToCache($chartHash, $myPicture);
5202
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5202
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5203 5203
             $myCache->saveFromCache($chartHash, $imgPath);
5204
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5204
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5205 5205
         }
5206 5206
 
5207
-        $html = '<img src="' . $imgPath . '">';
5207
+        $html = '<img src="'.$imgPath.'">';
5208 5208
 
5209 5209
         return $html;
5210 5210
     }
@@ -5225,12 +5225,12 @@  discard block
 block discarded – undo
5225 5225
 
5226 5226
         foreach ($attempts as $attempt) {
5227 5227
             if (api_get_user_id() == $attempt['exe_user_id']) {
5228
-                if ($attempt['exe_weighting'] != 0 ) {
5229
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5228
+                if ($attempt['exe_weighting'] != 0) {
5229
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5230 5230
                 }
5231 5231
             } else {
5232
-                if ($attempt['exe_weighting'] != 0 ) {
5233
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5232
+                if ($attempt['exe_weighting'] != 0) {
5233
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5234 5234
                 }
5235 5235
             }
5236 5236
         }
@@ -5239,27 +5239,27 @@  discard block
 block discarded – undo
5239 5239
         rsort($my_exercise_result_array);
5240 5240
         $my_exercise_result = 0;
5241 5241
         if (isset($my_exercise_result_array[0])) {
5242
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5242
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5243 5243
         }
5244 5244
 
5245 5245
         $max     = 100;
5246
-        $pieces  = 5 ;
5246
+        $pieces  = 5;
5247 5247
         $part    = round($max / $pieces);
5248 5248
         $x_axis = array();
5249 5249
         $final_array = array();
5250 5250
         $my_final_array = array();
5251 5251
 
5252
-        for ($i=1; $i <=$pieces; $i++) {
5252
+        for ($i = 1; $i <= $pieces; $i++) {
5253 5253
             $sum = 1;
5254 5254
             if ($i == 1) {
5255 5255
                 $sum = 0;
5256 5256
             }
5257
-            $min = ($i-1)*$part + $sum;
5258
-            $max = ($i)*$part;
5259
-            $x_axis[]= $min." - ".$max;
5257
+            $min = ($i - 1) * $part + $sum;
5258
+            $max = ($i) * $part;
5259
+            $x_axis[] = $min." - ".$max;
5260 5260
             $count = 0;
5261
-            foreach($exercise_result as $result) {
5262
-                $percentage = $result*100;
5261
+            foreach ($exercise_result as $result) {
5262
+                $percentage = $result * 100;
5263 5263
                 //echo $percentage.' - '.$min.' - '.$max."<br />";
5264 5264
                 if ($percentage >= $min && $percentage <= $max) {
5265 5265
                     //echo ' is > ';
@@ -5267,7 +5267,7 @@  discard block
 block discarded – undo
5267 5267
                 }
5268 5268
             }
5269 5269
             //echo '<br />';
5270
-            $final_array[]= $count;
5270
+            $final_array[] = $count;
5271 5271
 
5272 5272
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5273 5273
                 $my_final_array[] = 1;
@@ -5277,9 +5277,9 @@  discard block
 block discarded – undo
5277 5277
         }
5278 5278
 
5279 5279
         //Fix to remove the data of the user with my data
5280
-        for($i = 0; $i<=count($my_final_array); $i++) {
5280
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5281 5281
             if (!empty($my_final_array[$i])) {
5282
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5282
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5283 5283
                 $final_array[$i] = 0;
5284 5284
             }
5285 5285
         }
@@ -5289,16 +5289,16 @@  discard block
 block discarded – undo
5289 5289
         $dataSet->addPoints($final_array, 'Serie1');
5290 5290
         $dataSet->addPoints($my_final_array, 'Serie2');
5291 5291
         $dataSet->normalize(100, "%");
5292
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5292
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5293 5293
 
5294 5294
         // Cache definition
5295 5295
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5296 5296
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
5297 5297
         $chartHash = $myCache->getHash($dataSet);
5298 5298
         if ($myCache->isInCache($chartHash)) {
5299
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5299
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5300 5300
             $myCache->saveFromCache($chartHash, $imgPath);
5301
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5301
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5302 5302
         } else {
5303 5303
             /* Create the pChart object */
5304 5304
             $widthSize = 80;
@@ -5314,7 +5314,7 @@  discard block
 block discarded – undo
5314 5314
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5315 5315
 
5316 5316
             /* Set the default font */
5317
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5317
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5318 5318
 
5319 5319
             /* Do not write the chart title */
5320 5320
 
@@ -5378,9 +5378,9 @@  discard block
 block discarded – undo
5378 5378
 
5379 5379
             /* Save and write in cache */
5380 5380
             $myCache->writeToCache($chartHash, $myPicture);
5381
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5381
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5382 5382
             $myCache->saveFromCache($chartHash, $imgPath);
5383
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5383
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5384 5384
         }
5385 5385
 
5386 5386
         return $imgPath;
@@ -5400,12 +5400,12 @@  discard block
 block discarded – undo
5400 5400
         }
5401 5401
         foreach ($attempts as $attempt) {
5402 5402
             if (api_get_user_id() == $attempt['exe_user_id']) {
5403
-                if ($attempt['exe_weighting'] != 0 ) {
5404
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5403
+                if ($attempt['exe_weighting'] != 0) {
5404
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5405 5405
                 }
5406 5406
             } else {
5407
-                if ($attempt['exe_weighting'] != 0 ) {
5408
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5407
+                if ($attempt['exe_weighting'] != 0) {
5408
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5409 5409
                 }
5410 5410
             }
5411 5411
         }
@@ -5414,32 +5414,32 @@  discard block
 block discarded – undo
5414 5414
         rsort($my_exercise_result_array);
5415 5415
         $my_exercise_result = 0;
5416 5416
         if (isset($my_exercise_result_array[0])) {
5417
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5417
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5418 5418
         }
5419 5419
 
5420 5420
         $max = 100;
5421
-        $pieces = 5 ;
5421
+        $pieces = 5;
5422 5422
         $part = round($max / $pieces);
5423 5423
         $x_axis = array();
5424 5424
         $final_array = array();
5425 5425
         $my_final_array = array();
5426 5426
 
5427
-        for ($i=1; $i <=$pieces; $i++) {
5427
+        for ($i = 1; $i <= $pieces; $i++) {
5428 5428
             $sum = 1;
5429 5429
             if ($i == 1) {
5430 5430
                 $sum = 0;
5431 5431
             }
5432
-            $min = ($i-1)*$part + $sum;
5433
-            $max = ($i)*$part;
5434
-            $x_axis[]= $min." - ".$max;
5432
+            $min = ($i - 1) * $part + $sum;
5433
+            $max = ($i) * $part;
5434
+            $x_axis[] = $min." - ".$max;
5435 5435
             $count = 0;
5436
-            foreach($exercise_result as $result) {
5437
-                $percentage = $result*100;
5436
+            foreach ($exercise_result as $result) {
5437
+                $percentage = $result * 100;
5438 5438
                 if ($percentage >= $min && $percentage <= $max) {
5439 5439
                     $count++;
5440 5440
                 }
5441 5441
             }
5442
-            $final_array[]= $count;
5442
+            $final_array[] = $count;
5443 5443
 
5444 5444
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5445 5445
                 $my_final_array[] = 1;
@@ -5450,9 +5450,9 @@  discard block
 block discarded – undo
5450 5450
 
5451 5451
         //Fix to remove the data of the user with my data
5452 5452
 
5453
-        for($i = 0; $i<=count($my_final_array); $i++) {
5453
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5454 5454
             if (!empty($my_final_array[$i])) {
5455
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5455
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5456 5456
                 $final_array[$i] = 0;
5457 5457
             }
5458 5458
         }
@@ -5470,7 +5470,7 @@  discard block
 block discarded – undo
5470 5470
         $dataSet->setXAxisName(get_lang('Score'));
5471 5471
         $dataSet->normalize(100, "%");
5472 5472
 
5473
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5473
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5474 5474
 
5475 5475
         // Cache definition
5476 5476
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -5478,9 +5478,9 @@  discard block
 block discarded – undo
5478 5478
         $chartHash = $myCache->getHash($dataSet);
5479 5479
 
5480 5480
         if ($myCache->isInCache($chartHash)) {
5481
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5481
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5482 5482
             $myCache->saveFromCache($chartHash, $imgPath);
5483
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5483
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5484 5484
         } else {
5485 5485
             /* Create the pChart object */
5486 5486
             $widthSize = 480;
@@ -5496,7 +5496,7 @@  discard block
 block discarded – undo
5496 5496
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5497 5497
 
5498 5498
             /* Set the default font */
5499
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5499
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5500 5500
 
5501 5501
             /* Write the chart title */
5502 5502
             $myPicture->drawText(
@@ -5555,9 +5555,9 @@  discard block
 block discarded – undo
5555 5555
 
5556 5556
             /* Write and save into cache */
5557 5557
             $myCache->writeToCache($chartHash, $myPicture);
5558
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5558
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5559 5559
             $myCache->saveFromCache($chartHash, $imgPath);
5560
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5560
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5561 5561
         }
5562 5562
 
5563 5563
         return $imgPath;
@@ -5684,7 +5684,7 @@  discard block
 block discarded – undo
5684 5684
                         $whereSessionParams .= $sessionIdx.',';
5685 5685
                     }
5686 5686
                 }
5687
-                $whereSessionParams = substr($whereSessionParams,0,-1);
5687
+                $whereSessionParams = substr($whereSessionParams, 0, -1);
5688 5688
             }
5689 5689
 
5690 5690
             if (!empty($exerciseId)) {
@@ -5745,7 +5745,7 @@  discard block
 block discarded – undo
5745 5745
                     qq.position = rq.question_order AND
5746 5746
                     ta.question_id = rq.question_id
5747 5747
                 WHERE
5748
-                    te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."
5748
+                    te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")."
5749 5749
                     AND q.c_id = $courseIdx
5750 5750
                     $where $order $limit";
5751 5751
             $sql_query = vsprintf($sql, $whereParams);
@@ -5793,7 +5793,7 @@  discard block
 block discarded – undo
5793 5793
             // Now fill users data
5794 5794
             $sqlUsers = "SELECT user_id, username, lastname, firstname
5795 5795
                          FROM $tuser
5796
-                         WHERE user_id IN (".implode(',',$userIds).")";
5796
+                         WHERE user_id IN (".implode(',', $userIds).")";
5797 5797
             $resUsers = Database::query($sqlUsers);
5798 5798
             while ($rowUser = Database::fetch_assoc($resUsers)) {
5799 5799
                 $users[$rowUser['user_id']] = $rowUser;
@@ -5897,7 +5897,7 @@  discard block
 block discarded – undo
5897 5897
                 <table class="table" id="skillList">
5898 5898
                     <thead>
5899 5899
                         <tr>
5900
-                            <th>' . get_lang('AchievedSkills') . '</th>
5900
+                            <th>' . get_lang('AchievedSkills').'</th>
5901 5901
                         </tr>
5902 5902
                     </thead>
5903 5903
                     <tbody>
@@ -5916,10 +5916,10 @@  discard block
 block discarded – undo
5916 5916
 
5917 5917
                 $html .= '
5918 5918
                                             <li class="thumbnail">
5919
-                                                <a href="' . api_get_path(WEB_PATH) . 'badge/' . $userSkill->getId() . '/user/' . $userId . '" target="_blank">
5920
-                                                    <img class="img-responsive" title="' . $skill->getName() . '" src="' . $skill->getWebIconPath() . '" width="64" height="64">
5919
+                                                <a href="' . api_get_path(WEB_PATH).'badge/'.$userSkill->getId().'/user/'.$userId.'" target="_blank">
5920
+                                                    <img class="img-responsive" title="' . $skill->getName().'" src="'.$skill->getWebIconPath().'" width="64" height="64">
5921 5921
                                                     <div class="caption">
5922
-                                                        <p class="text-center">' . $skill->getName() . '</p>
5922
+                                                        <p class="text-center">' . $skill->getName().'</p>
5923 5923
                                                     </div>
5924 5924
                                                 </a>
5925 5925
                                             </li>
@@ -5969,7 +5969,7 @@  discard block
 block discarded – undo
5969 5969
     	        WHERE
5970 5970
                     track_resource.c_id = $course_id AND
5971 5971
                     track_resource.insert_user_id = user.user_id AND
5972
-                    session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5972
+                    session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5973 5973
 
5974 5974
     	if (isset($_GET['keyword'])) {
5975 5975
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6027,7 +6027,7 @@  discard block
 block discarded – undo
6027 6027
                 WHERE
6028 6028
                   track_resource.c_id = $course_id AND
6029 6029
                   track_resource.insert_user_id = user.user_id AND
6030
-                  session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6030
+                  session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
6031 6031
 
6032 6032
     	if (isset($_GET['keyword'])) {
6033 6033
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6327,7 +6327,7 @@  discard block
 block discarded – undo
6327 6327
     public static function display_additional_profile_fields()
6328 6328
     {
6329 6329
     	// getting all the extra profile fields that are defined by the platform administrator
6330
-    	$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6330
+    	$extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC');
6331 6331
 
6332 6332
     	// creating the form
6333 6333
     	$return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
@@ -6339,8 +6339,8 @@  discard block
 block discarded – undo
6339 6339
     	$extra_fields_to_show = 0;
6340 6340
     	foreach ($extra_fields as $key=>$field) {
6341 6341
     		// show only extra fields that are visible + and can be filtered, added by J.Montoya
6342
-    		if ($field[6]==1 && $field[8] == 1) {
6343
-    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6342
+    		if ($field[6] == 1 && $field[8] == 1) {
6343
+    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) {
6344 6344
     				$selected = 'selected="selected"';
6345 6345
     			} else {
6346 6346
     				$selected = '';
@@ -6352,8 +6352,8 @@  discard block
 block discarded – undo
6352 6352
     	$return .= '</select>';
6353 6353
 
6354 6354
     	// the form elements for the $_GET parameters (because the form is passed through GET
6355
-    	foreach ($_GET as $key=>$value){
6356
-    		if ($key <> 'additional_profile_field')    {
6355
+    	foreach ($_GET as $key=>$value) {
6356
+    		if ($key <> 'additional_profile_field') {
6357 6357
     			$return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6358 6358
     		}
6359 6359
     	}
@@ -6390,21 +6390,21 @@  discard block
 block discarded – undo
6390 6390
     	$result_extra_field = UserManager::get_extra_field_information($field_id);
6391 6391
 
6392 6392
     	if (!empty($users)) {
6393
-    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6394
-    			foreach($users as $user_id) {
6393
+    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) {
6394
+    			foreach ($users as $user_id) {
6395 6395
     				$user_result = UserManager::get_user_tags($user_id, $field_id);
6396 6396
     				$tag_list = array();
6397
-    				foreach($user_result as $item) {
6397
+    				foreach ($user_result as $item) {
6398 6398
     					$tag_list[] = $item['tag'];
6399 6399
     				}
6400
-    				$return[$user_id][] = implode(', ',$tag_list);
6400
+    				$return[$user_id][] = implode(', ', $tag_list);
6401 6401
     			}
6402 6402
     		} else {
6403 6403
     			$new_user_array = array();
6404 6404
     			foreach ($users as $user_id) {
6405
-    				$new_user_array[]= "'".$user_id."'";
6405
+    				$new_user_array[] = "'".$user_id."'";
6406 6406
     			}
6407
-    			$users = implode(',',$new_user_array);
6407
+    			$users = implode(',', $new_user_array);
6408 6408
                 $extraFieldType = EntityExtraField::USER_FIELD_TYPE;
6409 6409
     			// Selecting only the necessary information NOT ALL the user list
6410 6410
     			$sql = "SELECT user.user_id, v.value
@@ -6419,7 +6419,7 @@  discard block
 block discarded – undo
6419 6419
                             user.user_id IN ($users)";
6420 6420
 
6421 6421
     			$result = Database::query($sql);
6422
-    			while($row = Database::fetch_array($result)) {
6422
+    			while ($row = Database::fetch_array($result)) {
6423 6423
     				// get option value for field type double select by id
6424 6424
     				if (!empty($row['value'])) {
6425 6425
     					if ($result_extra_field['field_type'] ==
@@ -6458,7 +6458,7 @@  discard block
 block discarded – undo
6458 6458
 
6459 6459
     public function sort_users_desc($a, $b)
6460 6460
     {
6461
-    	return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6461
+    	return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6462 6462
     }
6463 6463
 
6464 6464
     /**
@@ -6493,7 +6493,7 @@  discard block
 block discarded – undo
6493 6493
     	// get all users data from a course for sortable with limit
6494 6494
     	if (is_array($user_ids)) {
6495 6495
     		$user_ids = array_map('intval', $user_ids);
6496
-    		$condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6496
+    		$condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") ";
6497 6497
     	} else {
6498 6498
     		$user_ids = intval($user_ids);
6499 6499
     		$condition_user = " WHERE user.user_id = $user_ids ";
@@ -6501,7 +6501,7 @@  discard block
 block discarded – undo
6501 6501
 
6502 6502
     	if (!empty($_GET['user_keyword'])) {
6503 6503
     		$keyword = trim(Database::escape_string($_GET['user_keyword']));
6504
-    		$condition_user .=  " AND (
6504
+    		$condition_user .= " AND (
6505 6505
                 user.firstname LIKE '%".$keyword."%' OR
6506 6506
                 user.lastname LIKE '%".$keyword."%'  OR
6507 6507
                 user.username LIKE '%".$keyword."%'  OR
@@ -6519,7 +6519,7 @@  discard block
 block discarded – undo
6519 6519
         $invitedUsersCondition = '';
6520 6520
 
6521 6521
         if (!$includeInvitedUsers) {
6522
-            $invitedUsersCondition = " AND user.status != " . INVITEE;
6522
+            $invitedUsersCondition = " AND user.status != ".INVITEE;
6523 6523
         }
6524 6524
 
6525 6525
     	$sql = "SELECT  user.user_id as user_id,
@@ -6530,7 +6530,7 @@  discard block
 block discarded – undo
6530 6530
                 FROM $tbl_user as user $url_table
6531 6531
     	        $condition_user $url_condition $invitedUsersCondition";
6532 6532
 
6533
-    	if (!in_array($direction, array('ASC','DESC'))) {
6533
+    	if (!in_array($direction, array('ASC', 'DESC'))) {
6534 6534
     		$direction = 'ASC';
6535 6535
     	}
6536 6536
 
@@ -6666,7 +6666,7 @@  discard block
 block discarded – undo
6666 6666
     		}
6667 6667
 
6668 6668
             if (empty($session_id)) {
6669
-                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys;
6669
+                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys;
6670 6670
             }
6671 6671
 
6672 6672
     		$user['link'] = '<center>
@@ -6678,37 +6678,37 @@  discard block
 block discarded – undo
6678 6678
     		// store columns in array $users
6679 6679
     		$is_western_name_order = api_is_western_name_order();
6680 6680
             $user_row = array();
6681
-            $user_row[]= $user['official_code']; //0
6681
+            $user_row[] = $user['official_code']; //0
6682 6682
             if ($is_western_name_order) {
6683
-                $user_row[]= $user['firstname'];
6684
-                $user_row[]= $user['lastname'];
6683
+                $user_row[] = $user['firstname'];
6684
+                $user_row[] = $user['lastname'];
6685 6685
             } else {
6686
-                $user_row[]= $user['lastname'];
6687
-                $user_row[]= $user['firstname'];
6686
+                $user_row[] = $user['lastname'];
6687
+                $user_row[] = $user['firstname'];
6688 6688
             }
6689
-            $user_row[]= $user['username'];
6690
-            $user_row[]= $user['time'];
6691
-            $user_row[]= $user['average_progress'];
6692
-            $user_row[]= $user['exercise_progress'];
6693
-            $user_row[]= $user['exercise_average_best_attempt'];
6694
-            $user_row[]= $user['student_score'];
6695
-            $user_row[]= $user['count_assignments'];
6696
-            $user_row[]= $user['count_messages'];
6689
+            $user_row[] = $user['username'];
6690
+            $user_row[] = $user['time'];
6691
+            $user_row[] = $user['average_progress'];
6692
+            $user_row[] = $user['exercise_progress'];
6693
+            $user_row[] = $user['exercise_average_best_attempt'];
6694
+            $user_row[] = $user['student_score'];
6695
+            $user_row[] = $user['count_assignments'];
6696
+            $user_row[] = $user['count_messages'];
6697 6697
 
6698 6698
             $userGroupManager = new UserGroup();
6699 6699
             $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS);
6700 6700
 
6701 6701
             if (empty($session_id)) {
6702
-                $user_row[]= $user['survey'];
6702
+                $user_row[] = $user['survey'];
6703 6703
             }
6704 6704
 
6705
-            $user_row[]= $user['first_connection'];
6706
-            $user_row[]= $user['last_connection'];
6705
+            $user_row[] = $user['first_connection'];
6706
+            $user_row[] = $user['last_connection'];
6707 6707
             if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6708
-                $user_row[]= $user['additional'];
6708
+                $user_row[] = $user['additional'];
6709 6709
             }
6710 6710
 
6711
-            $user_row[]= $user['link'];
6711
+            $user_row[] = $user['link'];
6712 6712
 
6713 6713
             $users[] = $user_row;
6714 6714
 
@@ -6753,8 +6753,8 @@  discard block
 block discarded – undo
6753 6753
 
6754 6754
     	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6755 6755
     	$tempView = $view;
6756
-    	if(substr($view,0,1) == '1') {
6757
-    		$new_view = substr_replace($view,'0',0,1);
6756
+    	if (substr($view, 0, 1) == '1') {
6757
+    		$new_view = substr_replace($view, '0', 0, 1);
6758 6758
     		echo "
6759 6759
                 <tr>
6760 6760
                     <td valign='top'>
@@ -6787,9 +6787,9 @@  discard block
 block discarded – undo
6787 6787
                 </tr>";
6788 6788
     		$total = 0;
6789 6789
     		if (is_array($results)) {
6790
-    			for($j = 0 ; $j < count($results) ; $j++) {
6790
+    			for ($j = 0; $j < count($results); $j++) {
6791 6791
     				echo "<tr>";
6792
-    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6792
+    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>";
6793 6793
     				echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6794 6794
     				echo"</tr>";
6795 6795
     				$total = $total + $results[$j][1];
@@ -6806,7 +6806,7 @@  discard block
 block discarded – undo
6806 6806
     		echo "</table>";
6807 6807
     		echo "</td></tr>";
6808 6808
     	} else {
6809
-    		$new_view = substr_replace($view,'1',0,1);
6809
+    		$new_view = substr_replace($view, '1', 0, 1);
6810 6810
     		echo "
6811 6811
                 <tr>
6812 6812
                     <td valign='top'>
@@ -6829,8 +6829,8 @@  discard block
 block discarded – undo
6829 6829
     {
6830 6830
     	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6831 6831
         $courseId = api_get_course_int_id($courseCode);
6832
-    	if(substr($view,1,1) == '1') {
6833
-    		$new_view = substr_replace($view,'0',1,1);
6832
+    	if (substr($view, 1, 1) == '1') {
6833
+    		$new_view = substr_replace($view, '0', 1, 1);
6834 6834
     		echo "<tr>
6835 6835
                     <td valign='top'>
6836 6836
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>]
@@ -6872,7 +6872,7 @@  discard block
 block discarded – undo
6872 6872
                 </tr>";
6873 6873
 
6874 6874
     		if (is_array($results)) {
6875
-    			for($i = 0; $i < sizeof($results); $i++) {
6875
+    			for ($i = 0; $i < sizeof($results); $i++) {
6876 6876
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6877 6877
     				echo "<tr>\n";
6878 6878
     				echo "<td class='content'>".$results[$i][0]."</td>\n";
@@ -6887,8 +6887,8 @@  discard block
 block discarded – undo
6887 6887
 
6888 6888
     		// The Result of Tests
6889 6889
     		if (is_array($hpresults)) {
6890
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6891
-    				$title = GetQuizName($hpresults[$i][0],'');
6890
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
6891
+    				$title = GetQuizName($hpresults[$i][0], '');
6892 6892
     				if ($title == '')
6893 6893
     				$title = basename($hpresults[$i][0]);
6894 6894
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
@@ -6914,7 +6914,7 @@  discard block
 block discarded – undo
6914 6914
     		echo "</table>";
6915 6915
     		echo "</td>\n</tr>\n";
6916 6916
     	} else {
6917
-    		$new_view = substr_replace($view,'1',1,1);
6917
+    		$new_view = substr_replace($view, '1', 1, 1);
6918 6918
     		echo "
6919 6919
                 <tr>
6920 6920
                     <td valign='top'>
@@ -6933,8 +6933,8 @@  discard block
 block discarded – undo
6933 6933
     	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6934 6934
         $_course = api_get_course_info_by_id($course_id);
6935 6935
 
6936
-    	if (substr($view,2,1) == '1') {
6937
-    		$new_view = substr_replace($view,'0',2,1);
6936
+    	if (substr($view, 2, 1) == '1') {
6937
+    		$new_view = substr_replace($view, '0', 2, 1);
6938 6938
     		echo "<tr>
6939 6939
                     <td valign='top'>
6940 6940
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
@@ -6948,7 +6948,7 @@  discard block
 block discarded – undo
6948 6948
                         AND u.c_id = '".intval($course_id)."'
6949 6949
                     ORDER BY u.upload_date DESC";
6950 6950
     		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6951
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
6951
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
6952 6952
     		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6953 6953
     		echo "<tr>
6954 6954
                     <td class='secLine' width='40%'>
@@ -6962,7 +6962,7 @@  discard block
 block discarded – undo
6962 6962
                     </td>
6963 6963
                 </tr>";
6964 6964
     		if (is_array($results)) {
6965
-    			for($j = 0 ; $j < count($results) ; $j++) {
6965
+    			for ($j = 0; $j < count($results); $j++) {
6966 6966
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6967 6967
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6968 6968
     				echo "<tr>";
@@ -6981,7 +6981,7 @@  discard block
 block discarded – undo
6981 6981
     		echo "</table>";
6982 6982
     		echo "</td></tr>";
6983 6983
     	} else {
6984
-    		$new_view = substr_replace($view,'1',2,1);
6984
+    		$new_view = substr_replace($view, '1', 2, 1);
6985 6985
     		echo "
6986 6986
                 <tr>
6987 6987
                     <td valign='top'>
@@ -7000,8 +7000,8 @@  discard block
 block discarded – undo
7000 7000
     {
7001 7001
     	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
7002 7002
         $courseId = api_get_course_int_id($courseCode);
7003
-    	if (substr($view,3,1) == '1') {
7004
-    		$new_view = substr_replace($view,'0',3,1);
7003
+    	if (substr($view, 3, 1) == '1') {
7004
+    		$new_view = substr_replace($view, '0', 3, 1);
7005 7005
     		echo "
7006 7006
                 <tr>
7007 7007
                         <td valign='top'>
@@ -7025,7 +7025,7 @@  discard block
 block discarded – undo
7025 7025
                     </td>
7026 7026
                 </tr>";
7027 7027
     		if (is_array($results)) {
7028
-    			for($j = 0 ; $j < count($results) ; $j++) {
7028
+    			for ($j = 0; $j < count($results); $j++) {
7029 7029
     				echo "<tr>";
7030 7030
     				echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
7031 7031
     				echo"</tr>";
@@ -7038,7 +7038,7 @@  discard block
 block discarded – undo
7038 7038
     		echo "</table>";
7039 7039
     		echo "</td></tr>";
7040 7040
     	} else {
7041
-    		$new_view = substr_replace($view,'1',3,1);
7041
+    		$new_view = substr_replace($view, '1', 3, 1);
7042 7042
     		echo "
7043 7043
                 <tr>
7044 7044
                     <td valign='top'>
@@ -7065,8 +7065,8 @@  discard block
 block discarded – undo
7065 7065
     	$session_id = intval($session_id);
7066 7066
 
7067 7067
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7068
-    	if(substr($view,4,1) == '1') {
7069
-    		$new_view = substr_replace($view,'0',4,1);
7068
+    	if (substr($view, 4, 1) == '1') {
7069
+    		$new_view = substr_replace($view, '0', 4, 1);
7070 7070
     		echo "
7071 7071
                 <tr>
7072 7072
                     <td valign='top'>
@@ -7092,7 +7092,7 @@  discard block
 block discarded – undo
7092 7092
                     </td>
7093 7093
                 </tr>";
7094 7094
     		if (is_array($results)) {
7095
-    			for($j = 0 ; $j < count($results) ; $j++) {
7095
+    			for ($j = 0; $j < count($results); $j++) {
7096 7096
     				echo "<tr>";
7097 7097
     				echo "<td class='content'>".$results[$j]."</td>";
7098 7098
     				echo"</tr>";
@@ -7105,7 +7105,7 @@  discard block
 block discarded – undo
7105 7105
     		echo "</table>";
7106 7106
     		echo "</td></tr>";
7107 7107
     	} else {
7108
-    		$new_view = substr_replace($view,'1',4,1);
7108
+    		$new_view = substr_replace($view, '1', 4, 1);
7109 7109
     		echo "
7110 7110
                 <tr>
7111 7111
                     <td valign='top'>
@@ -7139,11 +7139,11 @@  discard block
 block discarded – undo
7139 7139
                    ORDER BY login_date DESC LIMIT 1";
7140 7140
         $ip = '';
7141 7141
         $res_ip = Database::query($sql_ip);
7142
-        if ($res_ip !== false && Database::num_rows($res_ip)>0) {
7142
+        if ($res_ip !== false && Database::num_rows($res_ip) > 0) {
7143 7143
             $row_ip = Database::fetch_row($res_ip);
7144 7144
             if ($return_as_link) {
7145 7145
                 $ip = Display::url(
7146
-                    (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7146
+                    (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7147 7147
                     array('title'=>get_lang('TraceIP'), 'target'=>'_blank')
7148 7148
                 );
7149 7149
             } else {
@@ -7179,9 +7179,9 @@  discard block
 block discarded – undo
7179 7179
     	$course_id  = intval($course_id);
7180 7180
 
7181 7181
     	$tempView = $view;
7182
-    	if (substr($view,0,1) == '1') {
7183
-    		$new_view = substr_replace($view,'0',0,1);
7184
-    		$title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7182
+    	if (substr($view, 0, 1) == '1') {
7183
+    		$new_view = substr_replace($view, '0', 0, 1);
7184
+    		$title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7185 7185
     		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
7186 7186
                     FROM $track_access_table
7187 7187
                     WHERE access_user_id = $user_id
@@ -7191,20 +7191,20 @@  discard block
 block discarded – undo
7191 7191
                     ORDER BY YEAR(access_date),MONTH(access_date) ASC";
7192 7192
     		//$results = getManyResults2Col($sql);
7193 7193
     		$results = getManyResults3Col($sql);
7194
-    		$title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7195
-    		$line='';
7194
+    		$title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7195
+    		$line = '';
7196 7196
     		$total = 0;
7197 7197
     		if (is_array($results)) {
7198
-    			for($j = 0 ; $j < count($results) ; $j++) {
7198
+    			for ($j = 0; $j < count($results); $j++) {
7199 7199
     				$line .= $results[$j][0].';'.$results[$j][1]."\n";
7200 7200
     				$total = $total + $results[$j][1];
7201 7201
     			}
7202 7202
     			$line .= get_lang('Total').";".$total."\n";
7203 7203
     		} else {
7204
-    			$line= get_lang('NoResult')."</center></td>";
7204
+    			$line = get_lang('NoResult')."</center></td>";
7205 7205
     		}
7206 7206
     	} else {
7207
-    		$new_view = substr_replace($view,'1',0,1);
7207
+    		$new_view = substr_replace($view, '1', 0, 1);
7208 7208
     	}
7209 7209
     	return array($title_line, $line);
7210 7210
     }
@@ -7222,8 +7222,8 @@  discard block
 block discarded – undo
7222 7222
     	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
7223 7223
         $courseId = api_get_course_int_id($courseCode);
7224 7224
         $userId = intval($userId);
7225
-    	if (substr($view,1,1) == '1') {
7226
-    		$new_view = substr_replace($view,'0',1,1);
7225
+    	if (substr($view, 1, 1) == '1') {
7226
+    		$new_view = substr_replace($view, '0', 1, 1);
7227 7227
     		$title[1] = get_lang('ExercicesDetails');
7228 7228
     		$line = '';
7229 7229
     		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
@@ -7247,7 +7247,7 @@  discard block
 block discarded – undo
7247 7247
     		$title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
7248 7248
 
7249 7249
     		if (is_array($results)) {
7250
-    			for($i = 0; $i < sizeof($results); $i++)
7250
+    			for ($i = 0; $i < sizeof($results); $i++)
7251 7251
     			{
7252 7252
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
7253 7253
     				$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
@@ -7259,8 +7259,8 @@  discard block
 block discarded – undo
7259 7259
 
7260 7260
     		// The Result of Tests
7261 7261
     		if (is_array($hpresults)) {
7262
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
7263
-    				$title = GetQuizName($hpresults[$i][0],'');
7262
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
7263
+    				$title = GetQuizName($hpresults[$i][0], '');
7264 7264
 
7265 7265
     				if ($title == '')
7266 7266
     				$title = basename($hpresults[$i][0]);
@@ -7274,10 +7274,10 @@  discard block
 block discarded – undo
7274 7274
     		}
7275 7275
 
7276 7276
     		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
7277
-    			$line=get_lang('NoResult');
7277
+    			$line = get_lang('NoResult');
7278 7278
     		}
7279 7279
     	} else {
7280
-    		$new_view = substr_replace($view,'1',1,1);
7280
+    		$new_view = substr_replace($view, '1', 1, 1);
7281 7281
     	}
7282 7282
     	return array($title_line, $line);
7283 7283
     }
@@ -7293,7 +7293,7 @@  discard block
 block discarded – undo
7293 7293
         $user_id = intval($user_id);
7294 7294
         $course_id = intval($course_id);
7295 7295
 
7296
-    	if (substr($view,2,1) == '1') {
7296
+    	if (substr($view, 2, 1) == '1') {
7297 7297
     		$sql = "SELECT u.upload_date, w.title, w.author, w.url
7298 7298
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
7299 7299
                     WHERE
@@ -7301,21 +7301,21 @@  discard block
 block discarded – undo
7301 7301
                         u.upload_user_id = '$user_id' AND
7302 7302
                         u.c_id = '$course_id'
7303 7303
                     ORDER BY u.upload_date DESC";
7304
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
7304
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
7305 7305
 
7306
-    		$title[1]=get_lang('WorksDetails');
7307
-    		$line='';
7308
-    		$title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7306
+    		$title[1] = get_lang('WorksDetails');
7307
+    		$line = '';
7308
+    		$title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7309 7309
 
7310 7310
     		if (is_array($results)) {
7311
-    			for($j = 0 ; $j < count($results) ; $j++) {
7311
+    			for ($j = 0; $j < count($results); $j++) {
7312 7312
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7313 7313
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7314 7314
     				$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7315 7315
     			}
7316 7316
 
7317 7317
     		} else {
7318
-    			$line= get_lang('NoResult');
7318
+    			$line = get_lang('NoResult');
7319 7319
     		}
7320 7320
     	}
7321 7321
     	return array($title_line, $line);
@@ -7331,9 +7331,9 @@  discard block
 block discarded – undo
7331 7331
         $courseId = api_get_course_int_id($courseCode);
7332 7332
         $userId = intval($userId);
7333 7333
         $line = null;
7334
-    	if (substr($view,3,1) == '1') {
7335
-    		$new_view = substr_replace($view,'0',3,1);
7336
-    		$title[1]=get_lang('LinksDetails');
7334
+    	if (substr($view, 3, 1) == '1') {
7335
+    		$new_view = substr_replace($view, '0', 3, 1);
7336
+    		$title[1] = get_lang('LinksDetails');
7337 7337
     		$sql = "SELECT cl.title, cl.url
7338 7338
                         FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7339 7339
                         WHERE sl.links_link_id = cl.id
@@ -7341,16 +7341,16 @@  discard block
 block discarded – undo
7341 7341
                             AND sl.links_user_id = $userId
7342 7342
                         GROUP BY cl.title, cl.url";
7343 7343
     		$results = StatsUtils::getManyResults2Col($sql);
7344
-    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7344
+    		$title_line = get_lang('LinksTitleLinkColumn')."\n";
7345 7345
     		if (is_array($results)) {
7346
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7346
+    			for ($j = 0; $j < count($results); $j++) {
7347 7347
     				$line .= $results[$j][0]."\n";
7348 7348
     			}
7349 7349
     		} else {
7350
-    			$line=get_lang('NoResult');
7350
+    			$line = get_lang('NoResult');
7351 7351
     		}
7352 7352
     	} else {
7353
-    		$new_view = substr_replace($view,'1',3,1);
7353
+    		$new_view = substr_replace($view, '1', 3, 1);
7354 7354
     	}
7355 7355
     	return array($title_line, $line);
7356 7356
     }
@@ -7372,9 +7372,9 @@  discard block
 block discarded – undo
7372 7372
 
7373 7373
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7374 7374
 
7375
-    	if (substr($view,4,1) == '1') {
7376
-    		$new_view = substr_replace($view,'0',4,1);
7377
-    		$title[1]= get_lang('DocumentsDetails');
7375
+    	if (substr($view, 4, 1) == '1') {
7376
+    		$new_view = substr_replace($view, '0', 4, 1);
7377
+    		$title[1] = get_lang('DocumentsDetails');
7378 7378
 
7379 7379
     		$sql = "SELECT down_doc_path
7380 7380
                         FROM $downloads_table
@@ -7387,14 +7387,14 @@  discard block
 block discarded – undo
7387 7387
     		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7388 7388
             $line = null;
7389 7389
     		if (is_array($results)) {
7390
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7390
+    			for ($j = 0; $j < count($results); $j++) {
7391 7391
     				$line .= $results[$j]."\n";
7392 7392
     			}
7393 7393
     		} else {
7394 7394
     			$line = get_lang('NoResult');
7395 7395
     		}
7396 7396
     	} else {
7397
-    		$new_view = substr_replace($view,'1',4,1);
7397
+    		$new_view = substr_replace($view, '1', 4, 1);
7398 7398
     	}
7399 7399
     	return array($title_line, $line);
7400 7400
     }
Please login to merge, or discard this patch.
main/inc/lib/fileUpload.lib.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -993,7 +993,9 @@
 block discarded – undo
993 993
                     if ($file != '.' && $file != '..') {
994 994
 
995 995
                         $filetype = 'file';
996
-                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
996
+                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) {
997
+                            $filetype = 'folder';
998
+                        }
997 999
 
998 1000
                         $safe_file = api_replace_dangerous_char($file, 'strict');
999 1001
                         @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
  * Returns the name without extension, used for the title
54 54
  *
55 55
  * @param string $name
56
- * @return name without the extension
56
+ * @return string without the extension
57 57
  */
58 58
 function get_document_title($name)
59 59
 {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * This function checks if the upload succeeded
68 68
  *
69 69
  * @param array $uploaded_file ($_FILES)
70
- * @return true if upload succeeded
70
+ * @return boolean if upload succeeded
71 71
  */
72 72
 function process_uploaded_file($uploaded_file, $show_output = true)
73 73
 {
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
  * @param array  $courseInfo
1026 1026
  * @param array  $userInfo
1027 1027
  * @param array  $uploaded_file - follows the $_FILES Structure
1028
- * @param string $upload_path   - destination of the upload.
1028
+ * @param string $uploadPath   - destination of the upload.
1029 1029
  *                               This path is to append to $base_work_dir
1030 1030
  * @param string $base_work_dir  - base working directory of the module
1031 1031
  * @param int    $maxFilledSpace  - amount of bytes to not exceed in the base
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
  * @param int $session_id Session ID, if any
1213 1213
  * @param int $userId creator id
1214 1214
  *
1215
- * @return int id if inserted document
1215
+ * @return string|false id if inserted document
1216 1216
  */
1217 1217
 function add_document(
1218 1218
     $_course,
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
  *
1347 1347
  * @author	Olivier Cauberghe <[email protected]>
1348 1348
  * @param	path+filename eg: /main/document/document.php
1349
- * @return	The directory depth
1349
+ * @return	integer directory depth
1350 1350
  */
1351 1351
 function get_levels($filename) {
1352 1352
     $levels = explode('/', $filename);
@@ -1363,6 +1363,8 @@  discard block
 block discarded – undo
1363 1363
  * @author	Olivier Cauberghe <[email protected]>
1364 1364
  * @param	path,filename
1365 1365
  * action:	Adds an entry to the document table with the default settings.
1366
+ * @param string $upload_path
1367
+ * @param string $filename
1366 1368
  */
1367 1369
 function set_default_settings($upload_path, $filename, $filetype = 'file')
1368 1370
 {
@@ -1818,7 +1820,6 @@  discard block
 block discarded – undo
1818 1820
  * @param int $groupId
1819 1821
  * @param bool $output
1820 1822
  * @param array $parent
1821
- * @param string $uploadPath
1822 1823
  *
1823 1824
  */
1824 1825
 function add_all_documents_in_folder_to_database(
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 // (e.g. image upload in html editor).
90 90
                 $max_file_size = intval($_POST['MAX_FILE_SIZE']);
91 91
                 if ($show_output) {
92
-                    Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size));
92
+                    Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size));
93 93
                 }
94 94
 
95 95
                 return false;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             case 4:
104 104
                 // No file was uploaded.
105 105
                 if ($show_output) {
106
-                    Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'));
106
+                    Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst'));
107 107
                 }
108 108
 
109 109
                 return false;
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
                             if ($output) {
448 448
                                 Display::addFlash(
449 449
                                     Display::return_message(
450
-                                        get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'),
450
+                                        get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'),
451 451
                                         'confirmation',
452 452
                                         false
453 453
                                     )
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
                             if (isset($_POST['moodle_import'])) {
587 587
                                 Display::addFlash(
588 588
                                     Display::display_confirmation_message(
589
-                                        get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle,
589
+                                        get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle,
590 590
                                         false,
591 591
                                         true
592 592
                                     )
593 593
                                 );
594 594
                             } else {
595 595
                                 Display::display_confirmation_message(
596
-                                    get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle,
596
+                                    get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle,
597 597
                                     false
598 598
                                 );
599 599
                             }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                                 if (isset($_POST['moodle_import'])) {
671 671
                                     Display::addFlash(
672 672
                                         Display::display_confirmation_message(
673
-                                            get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle,
673
+                                            get_lang('UplUploadSucceeded').'<br /> '.$documentTitle,
674 674
                                             false,
675 675
                                             true
676 676
                                         )
@@ -765,12 +765,12 @@  discard block
 block discarded – undo
765 765
 function dir_total_space($dir_path)
766 766
 {
767 767
     $save_dir = getcwd();
768
-    chdir($dir_path) ;
768
+    chdir($dir_path);
769 769
     $handle = opendir($dir_path);
770 770
     $sumSize = 0;
771 771
     $dirList = array();
772 772
     while ($element = readdir($handle)) {
773
-        if ( $element == '.' || $element == '..') {
773
+        if ($element == '.' || $element == '..') {
774 774
             continue; // Skip the current and parent directories
775 775
         }
776 776
         if (is_file($element)) {
@@ -781,11 +781,11 @@  discard block
 block discarded – undo
781 781
         }
782 782
     }
783 783
 
784
-    closedir($handle) ;
784
+    closedir($handle);
785 785
 
786 786
     if (sizeof($dirList) > 0) {
787 787
         foreach ($dirList as $j) {
788
-            $sizeDir = dir_total_space($j);	// Recursivity
788
+            $sizeDir = dir_total_space($j); // Recursivity
789 789
             $sumSize += $sizeDir;
790 790
         }
791 791
     }
@@ -819,63 +819,63 @@  discard block
 block discarded – undo
819 819
 
820 820
         static $mime_type = array();
821 821
 
822
-        $mime_type[] = 'application/msword';             $extension[] = '.doc';
823
-        $mime_type[] = 'application/rtf';                $extension[] = '.rtf';
824
-        $mime_type[] = 'application/vnd.ms-powerpoint';  $extension[] = '.ppt';
825
-        $mime_type[] = 'application/vnd.ms-excel';       $extension[] = '.xls';
826
-        $mime_type[] = 'application/pdf';                $extension[] = '.pdf';
827
-        $mime_type[] = 'application/postscript';         $extension[] = '.ps';
828
-        $mime_type[] = 'application/mac-binhex40';       $extension[] = '.hqx';
829
-        $mime_type[] = 'application/x-gzip';             $extension[] = 'tar.gz';
830
-        $mime_type[] = 'application/x-shockwave-flash';  $extension[] = '.swf';
831
-        $mime_type[] = 'application/x-stuffit';          $extension[] = '.sit';
832
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
833
-        $mime_type[] = 'application/zip';                $extension[] = '.zip';
834
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
835
-        $mime_type[] = 'text/html';                      $extension[] = '.html';
836
-        $mime_type[] = 'text/plain';                     $extension[] = '.txt';
837
-        $mime_type[] = 'text/rtf';                       $extension[] = '.rtf';
838
-        $mime_type[] = 'img/gif';                        $extension[] = '.gif';
839
-        $mime_type[] = 'img/jpeg';                       $extension[] = '.jpg';
840
-        $mime_type[] = 'img/png';                        $extension[] = '.png';
841
-        $mime_type[] = 'audio/midi';                     $extension[] = '.mid';
842
-        $mime_type[] = 'audio/mpeg';                     $extension[] = '.mp3';
843
-        $mime_type[] = 'audio/x-aiff';                   $extension[] = '.aif';
844
-        $mime_type[] = 'audio/x-pn-realaudio';           $extension[] = '.rm';
845
-        $mime_type[] = 'audio/x-pn-realaudio-plugin';    $extension[] = '.rpm';
846
-        $mime_type[] = 'audio/x-wav';                    $extension[] = '.wav';
847
-        $mime_type[] = 'video/mpeg';                     $extension[] = '.mpg';
848
-        $mime_type[] = 'video/mpeg4-generic';            $extension[] = '.mp4';
849
-        $mime_type[] = 'video/quicktime';                $extension[] = '.mov';
850
-        $mime_type[] = 'video/x-msvideo';                $extension[] = '.avi';
851
-
852
-        $mime_type[] = 'video/x-ms-wmv';                 $extension[] = '.wmv';
853
-        $mime_type[] = 'video/x-flv';                    $extension[] = '.flv';
854
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svg';
855
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svgz';
856
-        $mime_type[] = 'video/ogg';                  	 $extension[] = '.ogv';
857
-        $mime_type[] = 'audio/ogg';                  	 $extension[] = '.oga';
858
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogg';
859
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogx';
860
-        $mime_type[] = 'application/x-freemind';         $extension[] = '.mm';
861
-
862
-        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12';							$extension[] = '.docm';
863
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';	$extension[] = '.docx';
864
-        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12';							$extension[] = '.dotm';
865
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template';	$extension[] = '.dotx';
866
-        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12';					$extension[] = '.potm';
867
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template';		$extension[] = '.potx';
868
-        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';						$extension[] = '.ppam';
869
-        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';					$extension[] = '.ppsm';
870
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';	$extension[] = '.ppsx';
871
-        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';				$extension[] = '.pptm';
872
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';	$extension[] = '.pptx';
873
-        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12';							$extension[] = '.xlam';
874
-        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';						$extension[] = '.xlsb';
875
-        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12';							$extension[] = '.xlsm';
876
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';			$extension[] = '.xlsx';
877
-        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12';							$extension[] = '.xltm';
878
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template';		$extension[] = '.xltx';
822
+        $mime_type[] = 'application/msword'; $extension[] = '.doc';
823
+        $mime_type[] = 'application/rtf'; $extension[] = '.rtf';
824
+        $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt';
825
+        $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls';
826
+        $mime_type[] = 'application/pdf'; $extension[] = '.pdf';
827
+        $mime_type[] = 'application/postscript'; $extension[] = '.ps';
828
+        $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx';
829
+        $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz';
830
+        $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf';
831
+        $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit';
832
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
833
+        $mime_type[] = 'application/zip'; $extension[] = '.zip';
834
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
835
+        $mime_type[] = 'text/html'; $extension[] = '.html';
836
+        $mime_type[] = 'text/plain'; $extension[] = '.txt';
837
+        $mime_type[] = 'text/rtf'; $extension[] = '.rtf';
838
+        $mime_type[] = 'img/gif'; $extension[] = '.gif';
839
+        $mime_type[] = 'img/jpeg'; $extension[] = '.jpg';
840
+        $mime_type[] = 'img/png'; $extension[] = '.png';
841
+        $mime_type[] = 'audio/midi'; $extension[] = '.mid';
842
+        $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3';
843
+        $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif';
844
+        $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm';
845
+        $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm';
846
+        $mime_type[] = 'audio/x-wav'; $extension[] = '.wav';
847
+        $mime_type[] = 'video/mpeg'; $extension[] = '.mpg';
848
+        $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4';
849
+        $mime_type[] = 'video/quicktime'; $extension[] = '.mov';
850
+        $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi';
851
+
852
+        $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv';
853
+        $mime_type[] = 'video/x-flv'; $extension[] = '.flv';
854
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svg';
855
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz';
856
+        $mime_type[] = 'video/ogg'; $extension[] = '.ogv';
857
+        $mime_type[] = 'audio/ogg'; $extension[] = '.oga';
858
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogg';
859
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogx';
860
+        $mime_type[] = 'application/x-freemind'; $extension[] = '.mm';
861
+
862
+        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm';
863
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx';
864
+        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm';
865
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx';
866
+        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm';
867
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx';
868
+        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam';
869
+        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm';
870
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx';
871
+        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm';
872
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx';
873
+        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam';
874
+        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb';
875
+        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm';
876
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx';
877
+        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm';
878
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx';
879 879
 
880 880
         // Test on PC (files with no extension get application/octet-stream)
881 881
         //$mime_type[] = 'application/octet-stream';      $extension[] = '.ext';
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
         foreach ($mime_type as $key => & $type) {
886 886
             if ($type == $file_type) {
887
-                $file_name .=  $extension[$key];
887
+                $file_name .= $extension[$key];
888 888
                 break;
889 889
             }
890 890
         }
@@ -960,12 +960,12 @@  discard block
 block discarded – undo
960 960
         }
961 961
 
962 962
         // It happens on Linux that $upload_path sometimes doesn't start with '/'
963
-        if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') {
963
+        if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') {
964 964
             $upload_path = '/'.$upload_path;
965 965
         }
966 966
 
967 967
         if ($upload_path[strlen($upload_path) - 1] == '/') {
968
-            $upload_path=substr($upload_path, 0, -1);
968
+            $upload_path = substr($upload_path, 0, -1);
969 969
         }
970 970
 
971 971
         /*	Uncompressing phase */
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
             - add it to the database
978 978
             - parse & change relative html links
979 979
         */
980
-        if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
980
+        if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
981 981
             // Shell Method - if this is possible, it gains some speed
982
-            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']);
982
+            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']);
983 983
         } else {
984 984
             // PHP method - slower...
985 985
             $save_dir = getcwd();
986 986
             chdir($base_work_dir.$upload_path);
987 987
             $unzippingState = $zip_file->extract();
988
-            for ($j=0; $j < count($unzippingState); $j++) {
988
+            for ($j = 0; $j < count($unzippingState); $j++) {
989 989
                 $state = $unzippingState[$j];
990 990
 
991 991
                 // Fix relative links in html files
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
                         if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
1000 1000
 
1001 1001
                         $safe_file = api_replace_dangerous_char($file);
1002
-                        @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
1003
-                        set_default_settings($upload_path, $safe_file,$filetype);
1002
+                        @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file);
1003
+                        set_default_settings($upload_path, $safe_file, $filetype);
1004 1004
                     }
1005 1005
                 }
1006 1006
 
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
     $zip = new PclZip($uploaded_file['tmp_name']);
1051 1051
 
1052 1052
     // Check the zip content (real size and file extension)
1053
-    $zip_content_array = (array)$zip->listContent();
1053
+    $zip_content_array = (array) $zip->listContent();
1054 1054
 
1055 1055
     $realSize = 0;
1056 1056
     foreach ($zip_content_array as & $this_content) {
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 function filter_extension(&$filename)
1153 1153
 {
1154 1154
     if (substr($filename, -1) == '/') {
1155
-        return 1;  // Authorize directories
1155
+        return 1; // Authorize directories
1156 1156
     }
1157 1157
     $blacklist = api_get_setting('upload_extensions_list_type');
1158 1158
     if ($blacklist != 'whitelist') { // if = blacklist
@@ -1378,9 +1378,9 @@  discard block
 block discarded – undo
1378 1378
     $upload_path = str_replace('//', '/', $upload_path);
1379 1379
 
1380 1380
     if ($upload_path == '/') {
1381
-        $upload_path='';
1381
+        $upload_path = '';
1382 1382
     } elseif (!empty($upload_path) && $upload_path[0] != '/') {
1383
-        $upload_path="/$upload_path";
1383
+        $upload_path = "/$upload_path";
1384 1384
     }
1385 1385
 
1386 1386
     $endchar = substr($filename, strlen($filename) - 1, 1);
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
     $img_path_list = array();
1419 1419
 
1420 1420
     if (!$fp = fopen($html_file, 'r')) {
1421
-        return ;
1421
+        return;
1422 1422
     }
1423 1423
 
1424 1424
     // Aearch and store occurences of the <img> tag in an array
@@ -1438,7 +1438,7 @@  discard block
 block discarded – undo
1438 1438
         $img_tag_list = $matches[0];
1439 1439
     }
1440 1440
 
1441
-    fclose ($fp);
1441
+    fclose($fp);
1442 1442
     unset($buffer);
1443 1443
 
1444 1444
     // Search the image file path from all the <IMG> tag detected
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 
1538 1538
     if (!is_dir($base_work_dir.$systemFolderName)) {
1539 1539
         $result = mkdir(
1540
-            $base_work_dir . $systemFolderName,
1540
+            $base_work_dir.$systemFolderName,
1541 1541
             api_get_permissions_for_new_directories(),
1542 1542
             true
1543 1543
         );
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
                     WHERE
1551 1551
                         c_id = $course_id AND
1552 1552
                         (
1553
-                            path = '" . Database::escape_string($systemFolderName). "'
1553
+                            path = '".Database::escape_string($systemFolderName)."'
1554 1554
                         )
1555 1555
             ";
1556 1556
 
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
 
1702 1702
     // Fix the image tags
1703 1703
 
1704
-    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) {
1704
+    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) {
1705 1705
         $replace_what = $original_img_path[$i];
1706 1706
         // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif
1707 1707
         $exploded_file_path = explode('/', $new_img_path[$i]);
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
         .'</body>'
1743 1743
         .'</html>';
1744 1744
     if (file_exists($file_path)) {
1745
-        if (!($fp = fopen ($file_path, 'w'))) {
1745
+        if (!($fp = fopen($file_path, 'w'))) {
1746 1746
             return false;
1747 1747
         }
1748 1748
         return fwrite($fp, $file_content);
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 {
1780 1780
     // Do we need a / or not?
1781 1781
     $added_slash = ($upload_path == '/') ? '' : '/';
1782
-    $folder_id      = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
1782
+    $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
1783 1783
     // Build the form
1784 1784
     $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>"
1785 1785
         ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">"
Please login to merge, or discard this patch.
main/inc/lib/agenda.lib.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3122,8 +3122,9 @@
 block discarded – undo
3122 3122
         global $DaysShort, $course_path;
3123 3123
         //Handle leap year
3124 3124
         $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3125
-        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3126
-            $numberofdays[2] = 29;
3125
+        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
3126
+                    $numberofdays[2] = 29;
3127
+        }
3127 3128
         //Get the first day of the month
3128 3129
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3129 3130
         //Start the week on monday
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1499,12 +1499,12 @@  discard block
 block discarded – undo
1499 1499
             }
1500 1500
 
1501 1501
             if (empty($session_id)) {
1502
-                $sessionCondition =  "
1502
+                $sessionCondition = "
1503 1503
                 (
1504 1504
                     agenda.session_id = 0 AND (ip.session_id IS NULL OR ip.session_id = 0)
1505 1505
                 ) ";
1506 1506
             } else {
1507
-                $sessionCondition =  "
1507
+                $sessionCondition = "
1508 1508
                 (
1509 1509
                     agenda.session_id = $session_id AND
1510 1510
                     ip.session_id = $session_id
@@ -1543,13 +1543,13 @@  discard block
 block discarded – undo
1543 1543
             }
1544 1544
 
1545 1545
             if (empty($session_id)) {
1546
-                $sessionCondition =  "
1546
+                $sessionCondition = "
1547 1547
                 (
1548 1548
                     agenda.session_id = 0 AND
1549 1549
                     (ip.session_id IS NULL OR ip.session_id = 0)
1550 1550
                 ) ";
1551 1551
             } else {
1552
-                $sessionCondition =  "
1552
+                $sessionCondition = "
1553 1553
                 (
1554 1554
                     agenda.session_id = $session_id AND
1555 1555
                     ip.session_id = $session_id
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
             while ($row = Database::fetch_array($result, 'ASSOC')) {
1602 1602
                 $event = array();
1603 1603
                 $event['id'] = 'course_'.$row['id'];
1604
-                $event['unique_id']  = $row['iid'];
1604
+                $event['unique_id'] = $row['iid'];
1605 1605
                 // To avoid doubles
1606 1606
                 if (in_array($event['unique_id'], $eventsAdded)) {
1607 1607
                     continue;
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
             );
2152 2152
 
2153 2153
             $form->addLabel('',
2154
-                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2154
+                '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">'.get_lang('AddOneMoreFile').'</a></span>&nbsp;('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')');
2155 2155
 
2156 2156
 
2157 2157
             //if ($showAttachmentForm) {
@@ -2729,8 +2729,8 @@  discard block
 block discarded – undo
2729 2729
 
2730 2730
                 $startDateTime = api_get_local_time($start->format('Y-m-d H:i:s'), $currentTimeZone, $start->format('e'));
2731 2731
                 $endDateTime = api_get_local_time($end->format('Y-m-d H:i'), $currentTimeZone, $end->format('e'));
2732
-                $title = api_convert_encoding((string)$event->summary, $charset, 'UTF-8');
2733
-                $description = api_convert_encoding((string)$event->description, $charset, 'UTF-8');
2732
+                $title = api_convert_encoding((string) $event->summary, $charset, 'UTF-8');
2733
+                $description = api_convert_encoding((string) $event->description, $charset, 'UTF-8');
2734 2734
 
2735 2735
                 $id = $this->addEvent(
2736 2736
                     $startDateTime,
@@ -2872,7 +2872,7 @@  discard block
 block discarded – undo
2872 2872
 							ORDER BY start_date ";
2873 2873
             } else {
2874 2874
                 // if the user is not an administrator of that course
2875
-                if (is_array($group_memberships) && count($group_memberships)>0) {
2875
+                if (is_array($group_memberships) && count($group_memberships) > 0) {
2876 2876
                     $sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
2877 2877
 								FROM ".$TABLEAGENDA." agenda,
2878 2878
 									".$TABLE_ITEMPROPERTY." ip
@@ -2902,14 +2902,14 @@  discard block
 block discarded – undo
2902 2902
                 $agendaday = -1;
2903 2903
                 if ($item['start_date'] != '0000-00-00 00:00:00') {
2904 2904
                     $item['start_date'] = api_get_local_time($item['start_date']);
2905
-                    $item['start_date_tms']  = api_strtotime($item['start_date']);
2905
+                    $item['start_date_tms'] = api_strtotime($item['start_date']);
2906 2906
                     $agendaday = date("j", $item['start_date_tms']);
2907 2907
                 }
2908 2908
                 if ($item['end_date'] != '0000-00-00 00:00:00') {
2909 2909
                     $item['end_date'] = api_get_local_time($item['end_date']);
2910 2910
                 }
2911 2911
 
2912
-                $url  = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2912
+                $url = api_get_path(WEB_CODE_PATH)."calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
2913 2913
 
2914 2914
                 $item['url'] = $url;
2915 2915
                 $item['course_name'] = $array_course_info['title'];
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
         }
2922 2922
 
2923 2923
         // sorting by hour for every day
2924
-        $agendaitems = array ();
2924
+        $agendaitems = array();
2925 2925
         while (list ($agendaday, $tmpitems) = each($items)) {
2926
-            if(!isset($agendaitems[$agendaday])) {
2926
+            if (!isset($agendaitems[$agendaday])) {
2927 2927
                 $agendaitems[$agendaday] = '';
2928 2928
             }
2929 2929
             sort($tmpitems);
@@ -3097,9 +3097,9 @@  discard block
 block discarded – undo
3097 3097
             $end_year = $start_end_day_of_week['end']['year'];
3098 3098
             // in sql statements you have to use year-month-day for date calculations
3099 3099
             $start_filter = $start_year."-".$start_month."-".$start_day." 00:00:00";
3100
-            $start_filter  = api_get_utc_datetime($start_filter);
3100
+            $start_filter = api_get_utc_datetime($start_filter);
3101 3101
             $end_filter = $end_year."-".$end_month."-".$end_day." 23:59:59";
3102
-            $end_filter  = api_get_utc_datetime($end_filter);
3102
+            $end_filter = api_get_utc_datetime($end_filter);
3103 3103
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3104 3104
         }
3105 3105
         // 3. creating the SQL statement for getting the personal agenda items in DAY view
@@ -3107,18 +3107,18 @@  discard block
 block discarded – undo
3107 3107
             // we are in day view
3108 3108
             // we could use mysql date() function but this is only available from 4.1 and higher
3109 3109
             $start_filter = $year."-".$month."-".$day." 00:00:00";
3110
-            $start_filter  = api_get_utc_datetime($start_filter);
3110
+            $start_filter = api_get_utc_datetime($start_filter);
3111 3111
             $end_filter = $year."-".$month."-".$day." 23:59:59";
3112
-            $end_filter  = api_get_utc_datetime($end_filter);
3112
+            $end_filter = api_get_utc_datetime($end_filter);
3113 3113
             $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' AND date>='".$start_filter."' AND date<='".$end_filter."'";
3114 3114
         }
3115 3115
 
3116 3116
         $result = Database::query($sql);
3117 3117
         while ($item = Database::fetch_array($result, 'ASSOC')) {
3118 3118
 
3119
-            $time_minute 	= api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
-            $item['date']   = api_get_local_time($item['date']);
3121
-            $item['start_date_tms']  = api_strtotime($item['date']);
3119
+            $time_minute = api_convert_and_format_date($item['date'], TIME_NO_SEC_FORMAT);
3120
+            $item['date'] = api_get_local_time($item['date']);
3121
+            $item['start_date_tms'] = api_strtotime($item['date']);
3122 3122
             $item['content'] = $item['text'];
3123 3123
 
3124 3124
             // we break the date field in the database into a date and a time part
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
             $second = $agendatime[2];
3139 3139
 
3140 3140
             if ($type == 'month_view') {
3141
-                $item['calendar_type']  = 'personal';
3141
+                $item['calendar_type'] = 'personal';
3142 3142
                 $item['start_date']  	= $item['date'];
3143 3143
                 $agendaitems[$day][] 	= $item;
3144 3144
                 continue;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
                 // this is the array construction for the DAY view
3164 3164
                 $halfhour = 2 * $agendatime['0'];
3165 3165
                 if ($agendatime['1'] >= '30') {
3166
-                    $halfhour = $halfhour +1;
3166
+                    $halfhour = $halfhour + 1;
3167 3167
                 }
3168 3168
 
3169 3169
                 //Display events by list
@@ -3187,22 +3187,22 @@  discard block
 block discarded – undo
3187 3187
     {
3188 3188
         global $DaysShort, $course_path;
3189 3189
         //Handle leap year
3190
-        $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3190
+        $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3191 3191
         if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3192 3192
             $numberofdays[2] = 29;
3193 3193
         //Get the first day of the month
3194 3194
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3195 3195
         //Start the week on monday
3196 3196
         $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
3197
-        $g_cc = (isset($_GET['courseCode'])?$_GET['courseCode']:'');
3197
+        $g_cc = (isset($_GET['courseCode']) ? $_GET['courseCode'] : '');
3198 3198
 
3199
-        $next_month = ($month == 1 ? 12 : $month -1);
3200
-        $prev_month = ($month == 12 ? 1 : $month +1);
3199
+        $next_month = ($month == 1 ? 12 : $month - 1);
3200
+        $prev_month = ($month == 12 ? 1 : $month + 1);
3201 3201
 
3202
-        $next_year = ($month == 1 ? $year -1 : $year);
3203
-        $prev_year = ($month == 12 ? $year +1 : $year);
3202
+        $next_year = ($month == 1 ? $year - 1 : $year);
3203
+        $prev_year = ($month == 12 ? $year + 1 : $year);
3204 3204
 
3205
-        if ($show_content)  {
3205
+        if ($show_content) {
3206 3206
             $back_url = Display::url(get_lang('Previous'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$next_month."&year=".$next_year);
3207 3207
             $next_url = Display::url(get_lang('Next'), api_get_self()."?coursePath=".urlencode($course_path)."&courseCode=".Security::remove_XSS($g_cc)."&action=view&view=month&month=".$prev_month."&year=".$prev_year);
3208 3208
         } else {
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
         $html .= '</div>';
3220 3220
         $html .= '<table id="agenda_list2" class="table table-bordered">';
3221 3221
         $html .= '<tr>';
3222
-        for ($ii = 1; $ii < 8; $ii ++) {
3222
+        for ($ii = 1; $ii < 8; $ii++) {
3223 3223
             $html .= '<td class="weekdays">'.$DaysShort[$ii % 7].'</td>';
3224 3224
         }
3225 3225
         $html .= '</tr>';
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
         $today = getdate();
3229 3229
         while ($curday <= $numberofdays[$month]) {
3230 3230
             $html .= "<tr>";
3231
-            for ($ii = 0; $ii < 7; $ii ++) {
3231
+            for ($ii = 0; $ii < 7; $ii++) {
3232 3232
                 if (($curday == -1) && ($ii == $startdayofweek)) {
3233 3233
                     $curday = 1;
3234 3234
                 }
@@ -3242,21 +3242,21 @@  discard block
 block discarded – undo
3242 3242
                     $html .= "<td ".$class.">".$dayheader;
3243 3243
 
3244 3244
                     if (!empty($agendaitems[$curday])) {
3245
-                        $items =  $agendaitems[$curday];
3246
-                        $items =  msort($items, 'start_date_tms');
3245
+                        $items = $agendaitems[$curday];
3246
+                        $items = msort($items, 'start_date_tms');
3247 3247
 
3248
-                        foreach($items  as $value) {
3248
+                        foreach ($items  as $value) {
3249 3249
                             $value['title'] = Security::remove_XSS($value['title']);
3250 3250
                             $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
3251 3251
                             $end_time = '';
3252 3252
 
3253 3253
                             if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
3254
-                                $end_time    = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3254
+                                $end_time = '-&nbsp;<i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>';
3255 3255
                             }
3256 3256
                             $complete_time = '<i>'.api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG).'</i>&nbsp;'.$end_time;
3257 3257
                             $time = '<i>'.$start_time.'</i>';
3258 3258
 
3259
-                            switch($value['calendar_type']) {
3259
+                            switch ($value['calendar_type']) {
3260 3260
                                 case 'personal':
3261 3261
                                     $bg_color = '#D0E7F4';
3262 3262
                                     $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL);
@@ -3308,7 +3308,7 @@  discard block
 block discarded – undo
3308 3308
                         }
3309 3309
                     }
3310 3310
                     $html .= "</td>";
3311
-                    $curday ++;
3311
+                    $curday++;
3312 3312
                 } else {
3313 3313
                     $html .= "<td></td>";
3314 3314
                 }
@@ -3329,18 +3329,18 @@  discard block
 block discarded – undo
3329 3329
      * where datestart and dateend are in yyyyMMddhhmmss format.
3330 3330
      * @TODO Implement really personal events (from user DB) and global events (from main DB)
3331 3331
      */
3332
-    public static function get_personal_agenda_items_between_dates($user_id, $date_start='', $date_end='')
3332
+    public static function get_personal_agenda_items_between_dates($user_id, $date_start = '', $date_end = '')
3333 3333
     {
3334
-        $items = array ();
3334
+        $items = array();
3335 3335
         if ($user_id != strval(intval($user_id))) { return $items; }
3336
-        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s');}
3337
-        if (empty($date_end))   { $date_end = date('Y-m-d H:i:s',mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1));}
3336
+        if (empty($date_start)) { $date_start = date('Y-m-d H:i:s'); }
3337
+        if (empty($date_end)) { $date_end = date('Y-m-d H:i:s', mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); }
3338 3338
         $expr = '/\d{4}-\d{2}-\d{2}\ \d{2}:\d{2}:\d{2}/';
3339
-        if(!preg_match($expr,$date_start)) { return $items; }
3340
-        if(!preg_match($expr,$date_end)) { return $items; }
3339
+        if (!preg_match($expr, $date_start)) { return $items; }
3340
+        if (!preg_match($expr, $date_end)) { return $items; }
3341 3341
 
3342 3342
         // get agenda-items for every course
3343
-        $courses = api_get_user_courses($user_id,false);
3343
+        $courses = api_get_user_courses($user_id, false);
3344 3344
         foreach ($courses as $id => $course) {
3345 3345
             $c = api_get_course_info_by_id($course['real_id']);
3346 3346
             //databases of the courses
@@ -3364,9 +3364,9 @@  discard block
 block discarded – undo
3364 3364
                     " ORDER BY start_date ";
3365 3365
             } else {
3366 3366
                 // if the user is not an administrator of that course, then...
3367
-                if (is_array($group_memberships) && count($group_memberships)>0)
3367
+                if (is_array($group_memberships) && count($group_memberships) > 0)
3368 3368
                 {
3369
-                    $sqlquery = "SELECT " .
3369
+                    $sqlquery = "SELECT ".
3370 3370
                         "DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref ".
3371 3371
                         " FROM ".$t_a." agenda, ".
3372 3372
                         $t_ip." ip ".
@@ -3394,13 +3394,13 @@  discard block
 block discarded – undo
3394 3394
 
3395 3395
             $result = Database::query($sqlquery);
3396 3396
             while ($item = Database::fetch_array($result)) {
3397
-                $agendaday = date("j",strtotime($item['start_date']));
3398
-                $month = date("n",strtotime($item['start_date']));
3399
-                $year = date("Y",strtotime($item['start_date']));
3397
+                $agendaday = date("j", strtotime($item['start_date']));
3398
+                $month = date("n", strtotime($item['start_date']));
3399
+                $year = date("Y", strtotime($item['start_date']));
3400 3400
                 $URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($course["code"])."&day=$agendaday&month=$month&year=$year#$agendaday";
3401
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['start_date']);
3401
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['start_date']);
3402 3402
                 $start_date = $year.$month.$day.$hour.$min;
3403
-                list($year,$month,$day,$hour,$min,$sec) = split('[-: ]',$item['end_date']);
3403
+                list($year, $month, $day, $hour, $min, $sec) = split('[-: ]', $item['end_date']);
3404 3404
                 $end_date = $year.$month.$day.$hour.$min;
3405 3405
 
3406 3406
                 $items[] = array(
@@ -3429,7 +3429,7 @@  discard block
 block discarded – undo
3429 3429
         $user = api_get_user_id();
3430 3430
         $sql = " SELECT * FROM ".$tbl_personal_agenda." WHERE id=".$id." AND user = ".$user;
3431 3431
         $result = Database::query($sql);
3432
-        if(Database::num_rows($result)==1) {
3432
+        if (Database::num_rows($result) == 1) {
3433 3433
             $item = Database::fetch_array($result);
3434 3434
         } else {
3435 3435
             $item = null;
@@ -3451,9 +3451,9 @@  discard block
 block discarded – undo
3451 3451
         // step 2: we which day this is (0=sunday, 1=monday, ...)
3452 3452
         $number_day_in_week = date('w', $random_day_in_week);
3453 3453
         // step 3: we calculate the timestamp of the monday of the week we are in
3454
-        $start_timestamp = $random_day_in_week - (($number_day_in_week -1) * 24 * 60 * 60);
3454
+        $start_timestamp = $random_day_in_week - (($number_day_in_week - 1) * 24 * 60 * 60);
3455 3455
         // step 4: we calculate the timestamp of the sunday of the week we are in
3456
-        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week +1) * 24 * 60 * 60) - 3600;
3456
+        $end_timestamp = $random_day_in_week + ((7 - $number_day_in_week + 1) * 24 * 60 * 60) - 3600;
3457 3457
         // step 5: calculating the start_day, end_day, start_month, end_month, start_year, end_year
3458 3458
         $start_day = date('j', $start_timestamp);
3459 3459
         $start_month = date('n', $start_timestamp);
Please login to merge, or discard this patch.
main/inc/lib/zombie/zombie_manager.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $count = intval($count);
80 80
         $from = intval($from);
81 81
 
82
-        $sql .=  " ORDER BY $column $direction";
82
+        $sql .= " ORDER BY $column $direction";
83 83
         $sql .= " LIMIT $count, $from ";
84 84
 
85 85
         $result = Database::query($sql);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     static function deactivate_zombies($ceiling)
94 94
     {
95 95
         $zombies = self::list_zombies($ceiling);
96
-        $ids  = array();
97
-        foreach($zombies as $zombie) {
96
+        $ids = array();
97
+        foreach ($zombies as $zombie) {
98 98
             $ids[] = $zombie['user_id'];
99 99
         }
100 100
         UserManager::deactivate_users($ids);
Please login to merge, or discard this patch.
main/inc/lib/userportal.lib.php 4 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
                 }
249 249
             }
250 250
 
251
-			if (trim($home_top_temp) == '' && api_is_platform_admin()) {
252
-				$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
253
-			} else {
254
-				$home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
255
-			}
256
-			$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
257
-			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
258
-		}
259
-
260
-		return $html;
261
-	}
251
+            if (trim($home_top_temp) == '' && api_is_platform_admin()) {
252
+                $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
253
+            } else {
254
+                $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
255
+            }
256
+            $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
257
+            $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
258
+        }
259
+
260
+        return $html;
261
+    }
262 262
 
263 263
     function return_notice()
264 264
     {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                     $thereIsSubCat = true;
510 510
                 } elseif (api_get_setting('show_empty_course_categories') == 'true') {
511 511
                     /* End changed code to eliminate the (0 courses) after empty categories. */
512
-                      $htmlListCat .= '<li>';
512
+                        $htmlListCat .= '<li>';
513 513
                     $htmlListCat .= $catLine['name'];
514 514
                     $htmlListCat .= "</li>";
515 515
                     $thereIsSubCat = true;
@@ -639,11 +639,11 @@  discard block
 block discarded – undo
639 639
     }
640 640
 
641 641
     /**
642
-    * retrieves all the courses that the user has already subscribed to
643
-    * @author Patrick Cool <[email protected]>, Ghent University, Belgium
644
-    * @param int $user_id: the id of the user
645
-    * @return array an array containing all the information of the courses of the given user
646
-    */
642
+     * retrieves all the courses that the user has already subscribed to
643
+     * @author Patrick Cool <[email protected]>, Ghent University, Belgium
644
+     * @param int $user_id: the id of the user
645
+     * @return array an array containing all the information of the courses of the given user
646
+     */
647 647
     public function get_courses_of_user($user_id)
648 648
     {
649 649
         $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@
 block discarded – undo
338 338
 
339 339
         if (empty($certificatesItem) && empty($searchItem)) {
340 340
             return null;
341
-        }else{
341
+        } else{
342 342
             $content.= $certificatesItem;
343 343
             $content.= $searchItem;
344 344
         }
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -682,6 +682,7 @@  discard block
 block discarded – undo
682 682
     * retrieves all the courses that the user has already subscribed to
683 683
     * @author Patrick Cool <[email protected]>, Ghent University, Belgium
684 684
     * @param int $user_id: the id of the user
685
+    * @param integer $user_id
685 686
     * @return array an array containing all the information of the courses of the given user
686 687
     */
687 688
     public function get_courses_of_user($user_id)
@@ -732,8 +733,8 @@  discard block
 block discarded – undo
732 733
 
733 734
     /**
734 735
      * @todo use the template system
735
-     * @param $title
736
-     * @param $content
736
+     * @param string|null $title
737
+     * @param string $content
737 738
      * @param string $id
738 739
      * @param array $params
739 740
      * @param string $idAccordion
@@ -1704,8 +1705,8 @@  discard block
 block discarded – undo
1704 1705
 
1705 1706
     /**
1706 1707
      * Return HTML code for personal user course category
1707
-     * @param $id
1708
-     * @param $title
1708
+     * @param integer $id
1709
+     * @param string $title
1709 1710
      * @return string
1710 1711
      */
1711 1712
     private static function getHtmlForUserCategory($id, $title)
@@ -1726,7 +1727,7 @@  discard block
 block discarded – undo
1726 1727
     /**
1727 1728
      * return HTML code for course display in session view
1728 1729
      * @param array $courseInfo
1729
-     * @param $userCategoryId
1730
+     * @param integer $userCategoryId
1730 1731
      * @param bool $displayButton
1731 1732
      * @param $loadDirs
1732 1733
      * @return string
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
                 );
73 73
 
74 74
                 foreach ($exercises as $exercise_item) {
75
-                    $exercise_item['course_code']     = $course_code;
76
-                    $exercise_item['session_id']     = $session_id;
77
-                    $exercise_item['tms']     = api_strtotime($exercise_item['end_time'], 'UTC');
75
+                    $exercise_item['course_code'] = $course_code;
76
+                    $exercise_item['session_id'] = $session_id;
77
+                    $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
78 78
 
79 79
                     $exercise_list[] = $exercise_item;
80 80
                 }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 $show_create_link = true;
199 199
             }
200 200
 
201
-            if ($show_menu && ($show_create_link || $show_course_link )) {
201
+            if ($show_menu && ($show_create_link || $show_course_link)) {
202 202
                 $show_menu = true;
203 203
             } else {
204 204
                 $show_menu = false;
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
         if ($show_menu) {
211 211
             $html .= '<ul class="nav nav-pills nav-stacked">';
212 212
             if ($show_create_link) {
213
-                $html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.Display::return_icon('new-course.png',  get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
213
+                $html .= '<li class="add-course"><a href="'.api_get_path(WEB_CODE_PATH).'create_course/add_course.php">'.Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
214 214
             }
215 215
 
216 216
             if ($show_course_link) {
217 217
                 if (!api_is_drh() && !api_is_session_admin()) {
218
-                    $html .=  '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'. Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>';
218
+                    $html .= '<li class="list-course"><a href="'.api_get_path(WEB_CODE_PATH).'auth/courses.php">'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog')).get_lang('CourseCatalog').'</a></li>';
219 219
                 } else {
220
-                    $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
220
+                    $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
221 221
                 }
222 222
             }
223 223
             $html .= '</ul>';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $html = '';
242 242
 
243 243
         if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) {
244
-            $open = @(string)file_get_contents($this->home.$_GET['include']);
244
+            $open = @(string) file_get_contents($this->home.$_GET['include']);
245 245
             $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
246 246
         } else {
247 247
             // Hiding home top when user not connected.
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
                     $home_top_temp = file_get_contents($this->home.'home_top.html');
272 272
                 } else {
273 273
                     if (file_exists($this->default_home.'home_top.html')) {
274
-                        $home_top_temp = file_get_contents($this->default_home . 'home_top.html');
274
+                        $home_top_temp = file_get_contents($this->default_home.'home_top.html');
275 275
                     }
276 276
                 }
277 277
             }
278 278
 
279 279
 			if (trim($home_top_temp) == '' && api_is_platform_admin()) {
280
-				$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
280
+				$home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>';
281 281
 			} else {
282
-				$home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>';
282
+				$home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>';
283 283
 			}
284 284
 			$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
285 285
 			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 
295 295
         $html = '';
296 296
         // Notice
297
-        $home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
297
+        $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');
298 298
         if (empty($home_notice)) {
299
-            $home_notice = @(string)file_get_contents($this->home.'home_notice.html');
299
+            $home_notice = @(string) file_get_contents($this->home.'home_notice.html');
300 300
         }
301 301
 
302 302
         if (!empty($home_notice)) {
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         }
328 328
 
329 329
         $html = null;
330
-        $home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
330
+        $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');
331 331
         if (!empty($home_menu)) {
332 332
             $home_menu_content = '<ul class="nav nav-pills nav-stacked">';
333 333
             $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
         if (!api_is_anonymous()) {
361 361
             $certificatesItem = Display::tag(
362 362
                 'li',
363
-                Display::url(Display::return_icon('graduation.png',get_lang('MyCertificates'),null,ICON_SIZE_SMALL).
363
+                Display::url(Display::return_icon('graduation.png', get_lang('MyCertificates'), null, ICON_SIZE_SMALL).
364 364
                     get_lang('MyCertificates'),
365
-                    api_get_path(WEB_CODE_PATH) . "gradebook/my_certificates.php"
365
+                    api_get_path(WEB_CODE_PATH)."gradebook/my_certificates.php"
366 366
                 )
367 367
             );
368 368
         }
@@ -372,29 +372,29 @@  discard block
 block discarded – undo
372 372
         if (api_get_setting('allow_public_certificates') == 'true') {
373 373
             $searchItem = Display::tag(
374 374
                 'li',
375
-                Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL).
375
+                Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL).
376 376
                     get_lang('Search'),
377
-                    api_get_path(WEB_CODE_PATH) . "gradebook/search.php"
377
+                    api_get_path(WEB_CODE_PATH)."gradebook/search.php"
378 378
                 )
379 379
             );
380 380
         }
381 381
 
382 382
         if (empty($certificatesItem) && empty($searchItem)) {
383 383
             return null;
384
-        }else{
385
-            $content.= $certificatesItem;
386
-            $content.= $searchItem;
384
+        } else {
385
+            $content .= $certificatesItem;
386
+            $content .= $searchItem;
387 387
         }
388 388
 
389 389
         if (api_get_setting('allow_skills_tool') == 'true') {
390 390
 
391
-            $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png',get_lang('MySkills'),null,ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'));
391
+            $content .= Display::tag('li', Display::url(Display::return_icon('skill-badges.png', get_lang('MySkills'), null, ICON_SIZE_SMALL).get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/my_skills_report.php'));
392 392
             $allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true';
393 393
             if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) {
394 394
                 $content .= Display::tag('li',
395 395
                     Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null,
396
-                            ICON_SIZE_SMALL) . get_lang('ManageSkills'),
397
-                        api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php'));
396
+                            ICON_SIZE_SMALL).get_lang('ManageSkills'),
397
+                        api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php'));
398 398
             }
399 399
         }
400 400
         $content .= '</ul>';
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
         // Get list of courses in category $category.
448 448
         $sql_get_course_list = "SELECT * FROM $main_course_table cours
449
-                                    WHERE category_code = '" . $category . "'
449
+                                    WHERE category_code = '".$category."'
450 450
                                     ORDER BY title, UPPER(visual_code)";
451 451
 
452 452
         // Showing only the courses of the current access_url_id.
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                     FROM $main_category_table t1
494 494
                     LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id
495 495
                     LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)
496
-                    WHERE t1.parent_id ". (empty ($category) ? "IS NULL" : "='$category'")."
496
+                    WHERE t1.parent_id ".(empty ($category) ? "IS NULL" : "='$category'")."
497 497
                     GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count 
498 498
                     ORDER BY t1.tree_pos, t1.name";
499 499
 
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
         }
570 570
         $result .= $htmlTitre;
571 571
         if ($thereIsSubCat) {
572
-            $result .=  $htmlListCat;
572
+            $result .= $htmlListCat;
573 573
         }
574 574
         while ($categoryName = Database::fetch_array($resCats)) {
575
-            $result .= '<h3>' . $categoryName['name'] . "</h3>\n";
575
+            $result .= '<h3>'.$categoryName['name']."</h3>\n";
576 576
         }
577 577
         $numrows = Database::num_rows($sql_result_courses);
578 578
         $courses_list_string = '';
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
         if ($courses_shown > 0) {
671 671
             // Only display the list of courses and categories if there was more than
672 672
                     // 0 courses visible to the world (we're in the anonymous list here).
673
-            $result .=  $courses_list_string;
673
+            $result .= $courses_list_string;
674 674
         }
675 675
         if ($category != '') {
676
-            $result .=  '<p><a href="'.api_get_self().'"> ' .
676
+            $result .= '<p><a href="'.api_get_self().'"> '.
677 677
                 Display :: return_icon('back.png', get_lang('BackToHomePage')).
678
-                get_lang('BackToHomePage') . '</a></p>';
678
+                get_lang('BackToHomePage').'</a></p>';
679 679
         }
680 680
         return $result;
681 681
     }
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
     ) {
753 753
         if (!empty($idAccordion)) {
754 754
             $html = null;
755
-            $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL;
756
-            $html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL;
757
-            $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL;
758
-            $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>' . PHP_EOL;
759
-            $html .= '</h4></div>' . PHP_EOL;
760
-            $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL;
761
-            $html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
762
-            $html .= '</div></div></div>' . PHP_EOL;
755
+            $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">'.PHP_EOL;
756
+            $html .= '<div class="panel panel-default" id="'.$id.'">'.PHP_EOL;
757
+            $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">'.PHP_EOL;
758
+            $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>'.PHP_EOL;
759
+            $html .= '</h4></div>'.PHP_EOL;
760
+            $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">'.PHP_EOL;
761
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
762
+            $html .= '</div></div></div>'.PHP_EOL;
763 763
 
764 764
         } else {
765 765
             if (!empty($id)) {
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
             $params['class'] = 'panel panel-default';
769 769
             $html = null;
770 770
             if (!empty($title)) {
771
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
771
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
772 772
             }
773
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
773
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
774 774
             $html = Display::div($html, $params);
775 775
         }
776 776
         return $html;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
             $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
817 817
             $classes = '';
818 818
             if (!empty($usergroup_list)) {
819
-                foreach($usergroup_list as $group_id) {
819
+                foreach ($usergroup_list as $group_id) {
820 820
                     $data = $usergroup->get($group_id);
821 821
                     $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']);
822 822
                     $classes .= Display::tag('li', $data['name']);
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
             if (api_is_platform_admin()) {
826 826
                 $classes .= Display::tag(
827 827
                     'li',
828
-                    Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
828
+                    Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add')
829 829
                 );
830 830
             }
831 831
             if (!empty($classes)) {
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
             $content = null;
848 848
 
849 849
             if (api_get_setting('allow_social_tool') == 'true') {
850
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php">
851
-                <img class="img-circle" src="' . $userPicture . '" ></a>';
850
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php">
851
+                <img class="img-circle" src="' . $userPicture.'" ></a>';
852 852
             } else {
853
-                $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php">
854
-                <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>';
853
+                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php">
854
+                <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>';
855 855
             }
856 856
 
857 857
             $html = self::show_right_block(
@@ -903,12 +903,12 @@  discard block
 block discarded – undo
903 903
             if (api_get_setting('allow_social_tool') == 'true') {
904 904
                 $link = '?f=social';
905 905
             }
906
-            $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png',get_lang('Inbox'),null,ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
907
-            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png',get_lang('Compose'),null,ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
906
+            $profile_content .= '<li class="inbox-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_SMALL).get_lang('Inbox').$cant_msg.' </a></li>';
907
+            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.Display::return_icon('new-message.png', get_lang('Compose'), null, ICON_SIZE_SMALL).get_lang('Compose').' </a></li>';
908 908
 
909 909
             if (api_get_setting('allow_social_tool') == 'true') {
910 910
                 $total_invitations = Display::badge($total_invitations);
911
-                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png',get_lang('PendingInvitations'),null,ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
911
+                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('invitations.png', get_lang('PendingInvitations'), null, ICON_SIZE_SMALL).get_lang('PendingInvitations').$total_invitations.'</a></li>';
912 912
             }
913 913
 
914 914
             if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 
925 925
         $editProfileUrl = Display::getProfileEditionLink($user_id);
926 926
 
927
-        $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.
927
+        $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'.
928 928
             Display::return_icon(
929 929
                 'edit-profile.png',
930 930
                 get_lang('EditProfile'),
@@ -1027,17 +1027,17 @@  discard block
 block discarded – undo
1027 1027
         if ($show_create_link) {
1028 1028
             $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">';
1029 1029
             if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) {
1030
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL);
1030
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL);
1031 1031
                 $my_account_content .= get_lang('CreateCourseRequest');
1032 1032
             } else {
1033
-                $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL);
1033
+                $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL);
1034 1034
                 $my_account_content .= get_lang('CourseCreate');
1035 1035
             }
1036 1036
             $my_account_content .= '</a></li>';
1037 1037
 
1038 1038
             if (SessionManager::allowToManageSessions()) {
1039 1039
                 $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">';
1040
-                $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL);
1040
+                $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL);
1041 1041
                 $my_account_content .= get_lang('AddSession');
1042 1042
                 $my_account_content .= '</a></li>';
1043 1043
             }
@@ -1045,21 +1045,21 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
         //Sort courses
1047 1047
         $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses';
1048
-        $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL);
1048
+        $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL);
1049 1049
         $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>';
1050 1050
 
1051 1051
         // Session history
1052 1052
         if (isset($_GET['history']) && intval($_GET['history']) == 1) {
1053
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png',get_lang('DisplayTrainingList'),null,ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1053
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php">'.Display::return_icon('history-course.png', get_lang('DisplayTrainingList'), null, ICON_SIZE_SMALL).get_lang('DisplayTrainingList').'</a></li>';
1054 1054
         } else {
1055
-            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png',get_lang('HistoryTrainingSessions'),null,ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1055
+            $my_account_content .= '<li class="history-course"><a href="user_portal.php?history=1" >'.Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions'), null, ICON_SIZE_SMALL).get_lang('HistoryTrainingSessions').'</a></li>';
1056 1056
         }
1057 1057
 
1058 1058
         // Course catalog
1059 1059
 
1060 1060
         if ($show_course_link) {
1061 1061
             if (!api_is_drh()) {
1062
-                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png',get_lang('CourseCatalog'),null,ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1062
+                $my_account_content .= '<li class="list-course"><a href="main/auth/courses.php" >'.Display::return_icon('catalog-course.png', get_lang('CourseCatalog'), null, ICON_SIZE_SMALL).get_lang('CourseCatalog').'</a></li>';
1063 1063
             } else {
1064 1064
                 $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
1065 1065
             }
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
                             $actions = null;
1263 1263
                             if (api_is_platform_admin()) {
1264
-                                $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id;
1264
+                                $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id;
1265 1265
                             }
1266 1266
 
1267 1267
                             $coachId = $session_box['id_coach'];
@@ -1271,12 +1271,12 @@  discard block
 block discarded – undo
1271 1271
                             $params['category_id'] = $session_box['category_id'];
1272 1272
                             $params['title'] = $session_box['title'];
1273 1273
                             $params['id_coach'] = $coachId;
1274
-                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId;
1274
+                            $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId;
1275 1275
                             $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
1276 1276
                             $params['coach_avatar'] = UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL);
1277 1277
                             $params['date'] = $session_box['dates'];
1278 1278
                             $params['image'] = isset($imageField['value']) ? $imageField['value'] : null;
1279
-                            $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null;
1279
+                            $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
1280 1280
                             $params['edit_actions'] = $actions;
1281 1281
                             $params['show_description'] = $session_box['show_description'];
1282 1282
                             $params['description'] = $session_box['description'];
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
                                 $sessionParams[0]['date'] = $session_box['dates'];
1377 1377
                                 $sessionParams[0]['course_list_session_style'] = $coursesListSessionStyle;
1378 1378
                                 $sessionParams[0]['title'] = $session_box['title'];
1379
-                                $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates'];
1379
+                                $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates'];
1380 1380
                                 $sessionParams[0]['show_actions'] = api_is_platform_admin();
1381 1381
                                 $sessionParams[0]['courses'] = $html_courses_session;
1382 1382
                                 $sessionParams[0]['show_simple_session_info'] = false;
@@ -1423,13 +1423,13 @@  discard block
 block discarded – undo
1423 1423
                             if (
1424 1424
                                 !empty($session_category_start_date)
1425 1425
                             ) {
1426
-                                $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date;
1426
+                                $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date;
1427 1427
                             }
1428 1428
 
1429 1429
                             if (
1430 1430
                                 !empty($session_category_end_date)
1431 1431
                             ) {
1432
-                                $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date;
1432
+                                $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date;
1433 1433
                             }
1434 1434
                         }
1435 1435
 
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 
1455 1455
             $this->tpl->assign('all_courses', $allCoursesInSessions);
1456 1456
             $this->tpl->assign('session', $listSession);
1457
-            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
1457
+            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
1458 1458
             $this->tpl->assign('gamification_mode', $gamificationModeIsActive);
1459 1459
 
1460 1460
             if (api_get_configuration_value('view_grid_courses')) {
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
         }
1470 1470
 
1471 1471
         return [
1472
-            'html' => $specialCourseList . $sessions_with_category.$sessions_with_no_category.$listCourse,
1472
+            'html' => $specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse,
1473 1473
             'session_count' => $sessionCount,
1474 1474
             'course_count' => $courseCount
1475 1475
         ];
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
                         $htmlCategory .= '<div class="panel panel-default">';
1617 1617
                     }
1618 1618
                     $htmlCategory .= '<div class="panel-body">';
1619
-                    $coursesInfo =  $listCourse['course'];
1619
+                    $coursesInfo = $listCourse['course'];
1620 1620
 
1621 1621
                     $htmlCategory .= self::getHtmlForCourse(
1622 1622
                         $coursesInfo,
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
                             $listCategorySession['catSessionName']
1634 1634
                         );
1635 1635
                         // list of session
1636
-                        $htmlSession = '';    // start
1636
+                        $htmlSession = ''; // start
1637 1637
                         foreach ($listCategorySession['sessionList'] as $k => $listSession) {
1638 1638
                             // add session
1639 1639
                             $htmlSession .= '<div class="session-view-row">';
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
                         $htmlSessionCategory .= $htmlSession;
1651 1651
                     }
1652 1652
                     $htmlSessionCategory .= '</div>'; // end session cat block
1653
-                    $htmlCategory .=  $htmlSessionCategory .'</div></div>' ;
1654
-                    $htmlCategory .= '';   // end course block
1653
+                    $htmlCategory .= $htmlSessionCategory.'</div></div>';
1654
+                    $htmlCategory .= ''; // end course block
1655 1655
                 }
1656 1656
                 $userCategoryHtml .= $htmlCategory;
1657 1657
             }
@@ -1678,11 +1678,11 @@  discard block
 block discarded – undo
1678 1678
                 }
1679 1679
             }
1680 1680
             $htmlCategory .= '';
1681
-            $userCategoryHtml .= $htmlCategory;   // end user cat block
1681
+            $userCategoryHtml .= $htmlCategory; // end user cat block
1682 1682
             if ($userCategoryId != 0) {
1683 1683
                 $userCategoryHtml .= '</div>';
1684 1684
             }
1685
-            $html .= $userCategoryHtml;   //
1685
+            $html .= $userCategoryHtml; //
1686 1686
         }
1687 1687
         $html .= '</div>';
1688 1688
 
@@ -1823,11 +1823,11 @@  discard block
 block discarded – undo
1823 1823
         $html = '';
1824 1824
 
1825 1825
         if ($categorySessionId == 0) {
1826
-            $class1 = 'session-view-lvl-2';    // session
1827
-            $class2 = 'session-view-lvl-4';    // got to course in session link
1826
+            $class1 = 'session-view-lvl-2'; // session
1827
+            $class2 = 'session-view-lvl-4'; // got to course in session link
1828 1828
         } else {
1829
-            $class1 = 'session-view-lvl-3';    // session
1830
-            $class2 = 'session-view-lvl-5';    // got to course in session link
1829
+            $class1 = 'session-view-lvl-3'; // session
1830
+            $class2 = 'session-view-lvl-5'; // got to course in session link
1831 1831
         }
1832 1832
 
1833 1833
         $icon = Display::return_icon(
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
         if ($listA['userCatTitle'] == $listB['userCatTitle']) {
1856 1856
             if ($listA['title'] == $listB['title']) {
1857 1857
                 return 0;
1858
-            } else if($listA['title'] > $listB['title']) {
1858
+            } else if ($listA['title'] > $listB['title']) {
1859 1859
                 return 1;
1860 1860
             } else {
1861 1861
                 return -1;
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
     {
1877 1877
         if ($listA['title'] == $listB['title']) {
1878 1878
             return 0;
1879
-        } else if($listA['title'] > $listB['title']) {
1879
+        } else if ($listA['title'] > $listB['title']) {
1880 1880
             return 1;
1881 1881
         } else {
1882 1882
             return -1;
Please login to merge, or discard this patch.