@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($height >= $max_size_for_picture) { |
48 | 48 | // scale width |
49 | 49 | $new_width = round($width * ($max_size_for_picture / $height)); |
50 | - $this->image_wrapper->resize($new_width, $max_size_for_picture, 0); |
|
50 | + $this->image_wrapper->resize($new_width, $max_size_for_picture, 0); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | public function __construct($path) |
151 | 151 | { |
152 | - parent::__construct($path); |
|
152 | + parent::__construct($path); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function set_image_wrapper() |
@@ -184,19 +184,19 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - public function get_image_size() |
|
187 | + public function get_image_size() |
|
188 | 188 | { |
189 | - $imagesize = array('width'=>0,'height'=>0); |
|
190 | - if ($this->image_validated) { |
|
189 | + $imagesize = array('width'=>0,'height'=>0); |
|
190 | + if ($this->image_validated) { |
|
191 | 191 | $imagesize = $this->image->getImageGeometry(); |
192 | - } |
|
193 | - return $imagesize; |
|
194 | - } |
|
192 | + } |
|
193 | + return $imagesize; |
|
194 | + } |
|
195 | 195 | |
196 | - //@todo implement border logic case for Imagick |
|
197 | - public function resize($thumbw, $thumbh, $border, $specific_size = false) |
|
196 | + //@todo implement border logic case for Imagick |
|
197 | + public function resize($thumbw, $thumbh, $border, $specific_size = false) |
|
198 | 198 | { |
199 | - if (!$this->image_validated) return false; |
|
199 | + if (!$this->image_validated) return false; |
|
200 | 200 | |
201 | 201 | if ($specific_size) { |
202 | 202 | $width = $thumbw; |
@@ -206,10 +206,10 @@ discard block |
||
206 | 206 | $width = (int)($this->width * $scale); |
207 | 207 | $height = (int)($this->height * $scale); |
208 | 208 | } |
209 | - $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
|
210 | - $this->width = $thumbw; |
|
211 | - $this->height = $thumbh; |
|
212 | - } |
|
209 | + $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
|
210 | + $this->width = $thumbw; |
|
211 | + $this->height = $thumbh; |
|
212 | + } |
|
213 | 213 | |
214 | 214 | /** |
215 | 215 | * @author José Loguercio <[email protected]> |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
225 | 225 | if (!$this->image_validated) return false; |
226 | 226 | $this->image->cropimage($width, $height, $x, $y); |
227 | - $this->width = $width; |
|
228 | - $this->height = $height; |
|
227 | + $this->width = $width; |
|
228 | + $this->height = $height; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
@@ -235,35 +235,35 @@ discard block |
||
235 | 235 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
236 | 236 | $type = $convert_file_to; |
237 | 237 | } |
238 | - switch ($type) { |
|
239 | - case 'jpeg': |
|
240 | - case 'jpg': |
|
241 | - if (!$file) header("Content-type: image/jpeg"); |
|
242 | - break; |
|
243 | - case 'png': |
|
244 | - if (!$file) header("Content-type: image/png"); |
|
245 | - break; |
|
246 | - case 'gif': |
|
247 | - if (!$file) header("Content-type: image/gif"); |
|
248 | - break; |
|
249 | - } |
|
250 | - $result = false; |
|
251 | - try { |
|
252 | - $result = $this->image->writeImage($file); |
|
253 | - } catch(ImagickException $e) { |
|
238 | + switch ($type) { |
|
239 | + case 'jpeg': |
|
240 | + case 'jpg': |
|
241 | + if (!$file) header("Content-type: image/jpeg"); |
|
242 | + break; |
|
243 | + case 'png': |
|
244 | + if (!$file) header("Content-type: image/png"); |
|
245 | + break; |
|
246 | + case 'gif': |
|
247 | + if (!$file) header("Content-type: image/gif"); |
|
248 | + break; |
|
249 | + } |
|
250 | + $result = false; |
|
251 | + try { |
|
252 | + $result = $this->image->writeImage($file); |
|
253 | + } catch(ImagickException $e) { |
|
254 | 254 | if ($this->debug) error_log($e->getMessage()); |
255 | 255 | } |
256 | 256 | |
257 | - if (!$file) { |
|
258 | - echo $this->image; |
|
259 | - $this->image->clear(); |
|
257 | + if (!$file) { |
|
258 | + echo $this->image; |
|
259 | + $this->image->clear(); |
|
260 | 260 | $this->image->destroy(); |
261 | - } else { |
|
262 | - $this->image->clear(); |
|
261 | + } else { |
|
262 | + $this->image->clear(); |
|
263 | 263 | $this->image->destroy(); |
264 | - return $result; |
|
265 | - } |
|
266 | - } |
|
264 | + return $result; |
|
265 | + } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | $this->fill_image_info(); |
286 | 286 | |
287 | 287 | switch ($this->type) { |
288 | - case 0: |
|
289 | - $handler = false; |
|
290 | - break; |
|
291 | - case 1 : |
|
288 | + case 0: |
|
289 | + $handler = false; |
|
290 | + break; |
|
291 | + case 1 : |
|
292 | 292 | $handler = @imagecreatefromgif($this->path); |
293 | 293 | $this->type = 'gif'; |
294 | 294 | break; |
295 | - case 2 : |
|
295 | + case 2 : |
|
296 | 296 | $handler = @imagecreatefromjpeg($this->path); |
297 | 297 | $this->type = 'jpg'; |
298 | 298 | break; |
299 | - case 3 : |
|
300 | - $handler = @imagecreatefrompng($this->path); |
|
301 | - $this->type = 'png'; |
|
302 | - break; |
|
299 | + case 3 : |
|
300 | + $handler = @imagecreatefrompng($this->path); |
|
301 | + $this->type = 'png'; |
|
302 | + break; |
|
303 | 303 | } |
304 | 304 | if ($handler) { |
305 | 305 | $this->image_validated = true; |
@@ -313,29 +313,29 @@ discard block |
||
313 | 313 | { |
314 | 314 | $return_array = array('width'=>0,'height'=>0); |
315 | 315 | if ($this->image_validated) { |
316 | - $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
316 | + $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
317 | 317 | } |
318 | 318 | return $return_array; |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | 321 | public function fill_image_info() |
322 | 322 | { |
323 | - if (file_exists($this->path)) { |
|
324 | - $image_info = getimagesize($this->path); |
|
325 | - $this->width = $image_info[0]; |
|
326 | - $this->height = $image_info[1]; |
|
327 | - $this->type = $image_info[2]; |
|
328 | - } else { |
|
329 | - $this->width = 0; |
|
330 | - $this->height = 0; |
|
331 | - $this->type = 0; |
|
332 | - } |
|
323 | + if (file_exists($this->path)) { |
|
324 | + $image_info = getimagesize($this->path); |
|
325 | + $this->width = $image_info[0]; |
|
326 | + $this->height = $image_info[1]; |
|
327 | + $this->type = $image_info[2]; |
|
328 | + } else { |
|
329 | + $this->width = 0; |
|
330 | + $this->height = 0; |
|
331 | + $this->type = 0; |
|
332 | + } |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
336 | 336 | { |
337 | 337 | if (!$this->image_validated) return false; |
338 | - if ($border == 1) { |
|
338 | + if ($border == 1) { |
|
339 | 339 | if ($specific_size) { |
340 | 340 | $width = $thumbw; |
341 | 341 | $height = $thumbh; |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | $width = (int)($this->width * $scale); |
345 | 345 | $height = (int)($this->height * $scale); |
346 | 346 | } |
347 | - $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | - $deltah = (int)(($thumbh - $height) / 2); |
|
349 | - $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
350 | - @imagealphablending($dst_img, false); |
|
351 | - @imagesavealpha($dst_img, true); |
|
352 | - if (!empty($this->color)) { |
|
353 | - @imagefill($dst_img, 0, 0, $this->color); |
|
354 | - } |
|
355 | - $this->width = $thumbw; |
|
356 | - $this->height = $thumbh; |
|
357 | - } elseif ($border == 0) { |
|
347 | + $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | + $deltah = (int)(($thumbh - $height) / 2); |
|
349 | + $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
350 | + @imagealphablending($dst_img, false); |
|
351 | + @imagesavealpha($dst_img, true); |
|
352 | + if (!empty($this->color)) { |
|
353 | + @imagefill($dst_img, 0, 0, $this->color); |
|
354 | + } |
|
355 | + $this->width = $thumbw; |
|
356 | + $this->height = $thumbh; |
|
357 | + } elseif ($border == 0) { |
|
358 | 358 | if ($specific_size) { |
359 | 359 | $width = $thumbw; |
360 | 360 | $height = $thumbh; |
@@ -363,19 +363,19 @@ discard block |
||
363 | 363 | $width = (int)($this->width * $scale); |
364 | 364 | $height = (int)($this->height * $scale); |
365 | 365 | } |
366 | - $deltaw = 0; |
|
367 | - $deltah = 0; |
|
368 | - $dst_img = @ImageCreateTrueColor($width, $height); |
|
369 | - @imagealphablending($dst_img, false); |
|
370 | - @imagesavealpha($dst_img, true); |
|
371 | - $this->width = $width; |
|
372 | - $this->height = $height; |
|
373 | - } |
|
374 | - $src_img = $this->bg; |
|
375 | - @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
376 | - $this->bg = $dst_img; |
|
377 | - @imagedestroy($src_img); |
|
378 | - } |
|
366 | + $deltaw = 0; |
|
367 | + $deltah = 0; |
|
368 | + $dst_img = @ImageCreateTrueColor($width, $height); |
|
369 | + @imagealphablending($dst_img, false); |
|
370 | + @imagesavealpha($dst_img, true); |
|
371 | + $this->width = $width; |
|
372 | + $this->height = $height; |
|
373 | + } |
|
374 | + $src_img = $this->bg; |
|
375 | + @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
376 | + $this->bg = $dst_img; |
|
377 | + @imagedestroy($src_img); |
|
378 | + } |
|
379 | 379 | |
380 | 380 | /** |
381 | 381 | * @author José Loguercio <[email protected]> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
390 | 390 | if (!$this->image_validated) return false; |
391 | 391 | $this->width = $width; |
392 | - $this->height = $height; |
|
392 | + $this->height = $height; |
|
393 | 393 | $src = null; |
394 | 394 | $dest = @imagecreatetruecolor($width, $height); |
395 | 395 | $type = $this->type; |
@@ -400,56 +400,56 @@ discard block |
||
400 | 400 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
401 | 401 | @imagejpeg($dest, $this->path); |
402 | 402 | break; |
403 | - case 'png' : |
|
403 | + case 'png' : |
|
404 | 404 | $src = @imagecreatefrompng($this->path); |
405 | 405 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
406 | 406 | @imagepng($dest, $this->path); |
407 | 407 | break; |
408 | - case 'gif' : |
|
409 | - $src = @imagecreatefromgif($this->path); |
|
408 | + case 'gif' : |
|
409 | + $src = @imagecreatefromgif($this->path); |
|
410 | 410 | @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height); |
411 | 411 | @imagegif($dest, $this->path); |
412 | - break; |
|
412 | + break; |
|
413 | 413 | default: return 0; |
414 | 414 | } |
415 | 415 | @imagedestroy($dest); |
416 | 416 | @imagedestroy($src); |
417 | 417 | } |
418 | 418 | |
419 | - public function send_image($file = '', $compress = -1, $convert_file_to = null) |
|
419 | + public function send_image($file = '', $compress = -1, $convert_file_to = null) |
|
420 | 420 | { |
421 | - if (!$this->image_validated) return false; |
|
421 | + if (!$this->image_validated) return false; |
|
422 | 422 | $compress = (int)$compress; |
423 | 423 | $type = $this->type; |
424 | 424 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
425 | 425 | $type = $convert_file_to; |
426 | 426 | } |
427 | - switch ($type) { |
|
428 | - case 'jpeg': |
|
429 | - case 'jpg': |
|
430 | - if (!$file) header("Content-type: image/jpeg"); |
|
431 | - if ($compress == -1) $compress = 100; |
|
432 | - return imagejpeg($this->bg, $file, $compress); |
|
433 | - break; |
|
434 | - case 'png': |
|
435 | - if (!$file) header("Content-type: image/png"); |
|
436 | - if ($compress != -1) { |
|
437 | - @imagetruecolortopalette($this->bg, true, $compress); |
|
438 | - } |
|
439 | - return imagepng($this->bg, $file, $compress); |
|
440 | - break; |
|
441 | - case 'gif': |
|
442 | - if (!$file) header("Content-type: image/gif"); |
|
443 | - if ($compress != -1) { |
|
444 | - @imagetruecolortopalette($this->bg, true, $compress); |
|
445 | - } |
|
446 | - return imagegif($this->bg, $file, $compress); |
|
447 | - break; |
|
448 | - default: return 0; |
|
449 | - } |
|
450 | - // TODO: Occupied memory is not released, because the following fragment of code is actually dead. |
|
451 | - @imagedestroy($this->bg); |
|
452 | - } |
|
427 | + switch ($type) { |
|
428 | + case 'jpeg': |
|
429 | + case 'jpg': |
|
430 | + if (!$file) header("Content-type: image/jpeg"); |
|
431 | + if ($compress == -1) $compress = 100; |
|
432 | + return imagejpeg($this->bg, $file, $compress); |
|
433 | + break; |
|
434 | + case 'png': |
|
435 | + if (!$file) header("Content-type: image/png"); |
|
436 | + if ($compress != -1) { |
|
437 | + @imagetruecolortopalette($this->bg, true, $compress); |
|
438 | + } |
|
439 | + return imagepng($this->bg, $file, $compress); |
|
440 | + break; |
|
441 | + case 'gif': |
|
442 | + if (!$file) header("Content-type: image/gif"); |
|
443 | + if ($compress != -1) { |
|
444 | + @imagetruecolortopalette($this->bg, true, $compress); |
|
445 | + } |
|
446 | + return imagegif($this->bg, $file, $compress); |
|
447 | + break; |
|
448 | + default: return 0; |
|
449 | + } |
|
450 | + // TODO: Occupied memory is not released, because the following fragment of code is actually dead. |
|
451 | + @imagedestroy($this->bg); |
|
452 | + } |
|
453 | 453 | |
454 | 454 | /** |
455 | 455 | * Convert image to black & white |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | $this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path; |
118 | - $this->set_image_wrapper(); //Creates image obj |
|
118 | + $this->set_image_wrapper(); //Creates image obj |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | abstract function set_image_wrapper(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
158 | 158 | try { |
159 | 159 | if (file_exists($this->path)) { |
160 | - $this->image = new Imagick($this->path); |
|
160 | + $this->image = new Imagick($this->path); |
|
161 | 161 | |
162 | 162 | if ($this->image) { |
163 | 163 | $this->fill_image_info(); //Fills height, width and type |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } else { |
166 | 166 | if ($this->debug) error_log('Image::image does not exist'); |
167 | 167 | } |
168 | - } catch(ImagickException $e) { |
|
168 | + } catch (ImagickException $e) { |
|
169 | 169 | if ($this->debug) error_log($e->getMessage()); |
170 | 170 | } |
171 | 171 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | public function get_image_size() |
188 | 188 | { |
189 | - $imagesize = array('width'=>0,'height'=>0); |
|
189 | + $imagesize = array('width'=>0, 'height'=>0); |
|
190 | 190 | if ($this->image_validated) { |
191 | 191 | $imagesize = $this->image->getImageGeometry(); |
192 | 192 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $height = $thumbh; |
204 | 204 | } else { |
205 | 205 | $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0; |
206 | - $width = (int)($this->width * $scale); |
|
207 | - $height = (int)($this->height * $scale); |
|
206 | + $width = (int) ($this->width * $scale); |
|
207 | + $height = (int) ($this->height * $scale); |
|
208 | 208 | } |
209 | 209 | $result = $this->image->resizeImage($width, $height, $this->filter, 1); |
210 | 210 | $this->width = $thumbw; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $result = false; |
251 | 251 | try { |
252 | 252 | $result = $this->image->writeImage($file); |
253 | - } catch(ImagickException $e) { |
|
253 | + } catch (ImagickException $e) { |
|
254 | 254 | if ($this->debug) error_log($e->getMessage()); |
255 | 255 | } |
256 | 256 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | |
312 | 312 | public function get_image_size() |
313 | 313 | { |
314 | - $return_array = array('width'=>0,'height'=>0); |
|
314 | + $return_array = array('width'=>0, 'height'=>0); |
|
315 | 315 | if ($this->image_validated) { |
316 | - $return_array = array('width'=>$this->width,'height'=>$this->height); |
|
316 | + $return_array = array('width'=>$this->width, 'height'=>$this->height); |
|
317 | 317 | } |
318 | 318 | return $return_array; |
319 | 319 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function fill_image_info() |
322 | 322 | { |
323 | 323 | if (file_exists($this->path)) { |
324 | - $image_info = getimagesize($this->path); |
|
324 | + $image_info = getimagesize($this->path); |
|
325 | 325 | $this->width = $image_info[0]; |
326 | 326 | $this->height = $image_info[1]; |
327 | 327 | $this->type = $image_info[2]; |
@@ -341,11 +341,11 @@ discard block |
||
341 | 341 | $height = $thumbh; |
342 | 342 | } else { |
343 | 343 | $scale = min($thumbw / $this->width, $thumbh / $this->height); |
344 | - $width = (int)($this->width * $scale); |
|
345 | - $height = (int)($this->height * $scale); |
|
344 | + $width = (int) ($this->width * $scale); |
|
345 | + $height = (int) ($this->height * $scale); |
|
346 | 346 | } |
347 | - $deltaw = (int)(($thumbw - $width) / 2); |
|
348 | - $deltah = (int)(($thumbh - $height) / 2); |
|
347 | + $deltaw = (int) (($thumbw - $width) / 2); |
|
348 | + $deltah = (int) (($thumbh - $height) / 2); |
|
349 | 349 | $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
350 | 350 | @imagealphablending($dst_img, false); |
351 | 351 | @imagesavealpha($dst_img, true); |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | $height = $thumbh; |
361 | 361 | } else { |
362 | 362 | $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0; |
363 | - $width = (int)($this->width * $scale); |
|
364 | - $height = (int)($this->height * $scale); |
|
363 | + $width = (int) ($this->width * $scale); |
|
364 | + $height = (int) ($this->height * $scale); |
|
365 | 365 | } |
366 | 366 | $deltaw = 0; |
367 | 367 | $deltah = 0; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
420 | 420 | { |
421 | 421 | if (!$this->image_validated) return false; |
422 | - $compress = (int)$compress; |
|
422 | + $compress = (int) $compress; |
|
423 | 423 | $type = $this->type; |
424 | 424 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
425 | 425 | $type = $convert_file_to; |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | * so that we can use black (0,0,0) as transparent, which is what |
464 | 464 | * the image is filled with when created. |
465 | 465 | */ |
466 | - $transparent = imagecolorallocate($dest_img, 0,0,0); |
|
466 | + $transparent = imagecolorallocate($dest_img, 0, 0, 0); |
|
467 | 467 | imagealphablending($dest_img, false); |
468 | 468 | imagesavealpha($dest_img, true); |
469 | 469 | imagecolortransparent($dest_img, $transparent); |
470 | - imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg)); |
|
470 | + imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg)); |
|
471 | 471 | imagefilter($dest_img, IMG_FILTER_GRAYSCALE); |
472 | 472 | $this->bg = $dest_img; |
473 | 473 |
@@ -154,7 +154,9 @@ discard block |
||
154 | 154 | |
155 | 155 | public function set_image_wrapper() |
156 | 156 | { |
157 | - if ($this->debug) error_log('Image::set_image_wrapper loaded'); |
|
157 | + if ($this->debug) { |
|
158 | + error_log('Image::set_image_wrapper loaded'); |
|
159 | + } |
|
158 | 160 | try { |
159 | 161 | if (file_exists($this->path)) { |
160 | 162 | $this->image = new Imagick($this->path); |
@@ -163,10 +165,14 @@ discard block |
||
163 | 165 | $this->fill_image_info(); //Fills height, width and type |
164 | 166 | } |
165 | 167 | } else { |
166 | - if ($this->debug) error_log('Image::image does not exist'); |
|
168 | + if ($this->debug) { |
|
169 | + error_log('Image::image does not exist'); |
|
170 | + } |
|
167 | 171 | } |
168 | 172 | } catch(ImagickException $e) { |
169 | - if ($this->debug) error_log($e->getMessage()); |
|
173 | + if ($this->debug) { |
|
174 | + error_log($e->getMessage()); |
|
175 | + } |
|
170 | 176 | } |
171 | 177 | } |
172 | 178 | |
@@ -180,7 +186,9 @@ discard block |
||
180 | 186 | |
181 | 187 | if (in_array($this->type, $this->allowed_extensions)) { |
182 | 188 | $this->image_validated = true; |
183 | - if ($this->debug) error_log('image_validated true'); |
|
189 | + if ($this->debug) { |
|
190 | + error_log('image_validated true'); |
|
191 | + } |
|
184 | 192 | } |
185 | 193 | } |
186 | 194 | |
@@ -196,7 +204,9 @@ discard block |
||
196 | 204 | //@todo implement border logic case for Imagick |
197 | 205 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
198 | 206 | { |
199 | - if (!$this->image_validated) return false; |
|
207 | + if (!$this->image_validated) { |
|
208 | + return false; |
|
209 | + } |
|
200 | 210 | |
201 | 211 | if ($specific_size) { |
202 | 212 | $width = $thumbw; |
@@ -222,7 +232,9 @@ discard block |
||
222 | 232 | */ |
223 | 233 | |
224 | 234 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
225 | - if (!$this->image_validated) return false; |
|
235 | + if (!$this->image_validated) { |
|
236 | + return false; |
|
237 | + } |
|
226 | 238 | $this->image->cropimage($width, $height, $x, $y); |
227 | 239 | $this->width = $width; |
228 | 240 | $this->height = $height; |
@@ -230,7 +242,9 @@ discard block |
||
230 | 242 | |
231 | 243 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
232 | 244 | { |
233 | - if (!$this->image_validated) return false; |
|
245 | + if (!$this->image_validated) { |
|
246 | + return false; |
|
247 | + } |
|
234 | 248 | $type = $this->type; |
235 | 249 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
236 | 250 | $type = $convert_file_to; |
@@ -238,20 +252,28 @@ discard block |
||
238 | 252 | switch ($type) { |
239 | 253 | case 'jpeg': |
240 | 254 | case 'jpg': |
241 | - if (!$file) header("Content-type: image/jpeg"); |
|
255 | + if (!$file) { |
|
256 | + header("Content-type: image/jpeg"); |
|
257 | + } |
|
242 | 258 | break; |
243 | 259 | case 'png': |
244 | - if (!$file) header("Content-type: image/png"); |
|
260 | + if (!$file) { |
|
261 | + header("Content-type: image/png"); |
|
262 | + } |
|
245 | 263 | break; |
246 | 264 | case 'gif': |
247 | - if (!$file) header("Content-type: image/gif"); |
|
265 | + if (!$file) { |
|
266 | + header("Content-type: image/gif"); |
|
267 | + } |
|
248 | 268 | break; |
249 | 269 | } |
250 | 270 | $result = false; |
251 | 271 | try { |
252 | 272 | $result = $this->image->writeImage($file); |
253 | 273 | } catch(ImagickException $e) { |
254 | - if ($this->debug) error_log($e->getMessage()); |
|
274 | + if ($this->debug) { |
|
275 | + error_log($e->getMessage()); |
|
276 | + } |
|
255 | 277 | } |
256 | 278 | |
257 | 279 | if (!$file) { |
@@ -334,7 +356,9 @@ discard block |
||
334 | 356 | |
335 | 357 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
336 | 358 | { |
337 | - if (!$this->image_validated) return false; |
|
359 | + if (!$this->image_validated) { |
|
360 | + return false; |
|
361 | + } |
|
338 | 362 | if ($border == 1) { |
339 | 363 | if ($specific_size) { |
340 | 364 | $width = $thumbw; |
@@ -387,7 +411,9 @@ discard block |
||
387 | 411 | * @param int $src_height the source height of the original image |
388 | 412 | */ |
389 | 413 | public function crop($x, $y, $width, $height, $src_width, $src_height) { |
390 | - if (!$this->image_validated) return false; |
|
414 | + if (!$this->image_validated) { |
|
415 | + return false; |
|
416 | + } |
|
391 | 417 | $this->width = $width; |
392 | 418 | $this->height = $height; |
393 | 419 | $src = null; |
@@ -418,7 +444,9 @@ discard block |
||
418 | 444 | |
419 | 445 | public function send_image($file = '', $compress = -1, $convert_file_to = null) |
420 | 446 | { |
421 | - if (!$this->image_validated) return false; |
|
447 | + if (!$this->image_validated) { |
|
448 | + return false; |
|
449 | + } |
|
422 | 450 | $compress = (int)$compress; |
423 | 451 | $type = $this->type; |
424 | 452 | if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) { |
@@ -427,19 +455,27 @@ discard block |
||
427 | 455 | switch ($type) { |
428 | 456 | case 'jpeg': |
429 | 457 | case 'jpg': |
430 | - if (!$file) header("Content-type: image/jpeg"); |
|
431 | - if ($compress == -1) $compress = 100; |
|
458 | + if (!$file) { |
|
459 | + header("Content-type: image/jpeg"); |
|
460 | + } |
|
461 | + if ($compress == -1) { |
|
462 | + $compress = 100; |
|
463 | + } |
|
432 | 464 | return imagejpeg($this->bg, $file, $compress); |
433 | 465 | break; |
434 | 466 | case 'png': |
435 | - if (!$file) header("Content-type: image/png"); |
|
467 | + if (!$file) { |
|
468 | + header("Content-type: image/png"); |
|
469 | + } |
|
436 | 470 | if ($compress != -1) { |
437 | 471 | @imagetruecolortopalette($this->bg, true, $compress); |
438 | 472 | } |
439 | 473 | return imagepng($this->bg, $file, $compress); |
440 | 474 | break; |
441 | 475 | case 'gif': |
442 | - if (!$file) header("Content-type: image/gif"); |
|
476 | + if (!$file) { |
|
477 | + header("Content-type: image/gif"); |
|
478 | + } |
|
443 | 479 | if ($compress != -1) { |
444 | 480 | @imagetruecolortopalette($this->bg, true, $compress); |
445 | 481 | } |
@@ -456,7 +492,9 @@ discard block |
||
456 | 492 | */ |
457 | 493 | function convert2bw() |
458 | 494 | { |
459 | - if (!$this->image_validated) return false; |
|
495 | + if (!$this->image_validated) { |
|
496 | + return false; |
|
497 | + } |
|
460 | 498 | |
461 | 499 | $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg)); |
462 | 500 | /* copy ignore the transparent color |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | return $image; |
64 | 64 | } |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $convert_file_to |
|
68 | + */ |
|
66 | 69 | public function send_image( |
67 | 70 | $file = '', |
68 | 71 | $compress = -1, |
@@ -144,6 +147,9 @@ discard block |
||
144 | 147 | public $image; |
145 | 148 | public $filter = Imagick::FILTER_LANCZOS; |
146 | 149 | |
150 | + /** |
|
151 | + * @param string $path |
|
152 | + */ |
|
147 | 153 | public function __construct($path) |
148 | 154 | { |
149 | 155 | parent::__construct($path); |
@@ -191,6 +197,10 @@ discard block |
||
191 | 197 | } |
192 | 198 | |
193 | 199 | //@todo implement border logic case for Imagick |
200 | + |
|
201 | + /** |
|
202 | + * @param integer $border |
|
203 | + */ |
|
194 | 204 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
195 | 205 | { |
196 | 206 | if (!$this->image_validated) return false; |
@@ -272,6 +282,9 @@ discard block |
||
272 | 282 | { |
273 | 283 | public $bg; |
274 | 284 | |
285 | + /** |
|
286 | + * @param string $path |
|
287 | + */ |
|
275 | 288 | function __construct($path) { |
276 | 289 | parent::__construct($path); |
277 | 290 | } |
@@ -329,6 +342,9 @@ discard block |
||
329 | 342 | } |
330 | 343 | } |
331 | 344 | |
345 | + /** |
|
346 | + * @param integer $border |
|
347 | + */ |
|
332 | 348 | public function resize($thumbw, $thumbh, $border, $specific_size = false) |
333 | 349 | { |
334 | 350 | if (!$this->image_validated) return false; |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ); |
26 | 26 | public $is_course_model = true; |
27 | 27 | |
28 | - public function __construct() |
|
28 | + public function __construct() |
|
29 | 29 | { |
30 | 30 | $this->table = Database::get_course_table(TABLE_TIMELINE); |
31 | - } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Get the count of elements |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Displays the title + grid |
54 | 54 | */ |
55 | - public function listing() |
|
55 | + public function listing() |
|
56 | 56 | { |
57 | - // action links |
|
58 | - $html = '<div class="actions">'; |
|
57 | + // action links |
|
58 | + $html = '<div class="actions">'; |
|
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | - $html .= '</div>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
61 | + $html .= '</div>'; |
|
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public function get_status_list() |
67 | 67 | { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70')); |
91 | 91 | //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250')); |
92 | - $status_list = $this->get_status_list(); |
|
92 | + $status_list = $this->get_status_list(); |
|
93 | 93 | $form->addElement('select', 'status', get_lang('Status'), $status_list); |
94 | 94 | if ($action == 'edit') { |
95 | 95 | //$form->addElement('text', 'created_at', get_lang('CreatedAt')); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | // Setting the rules |
175 | 175 | $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required'); |
176 | - return $form; |
|
176 | + return $form; |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | public function save_item($params) |
185 | 185 | { |
186 | 186 | $params['c_id'] = api_get_course_int_id(); |
187 | - $id = parent::save($params); |
|
188 | - if (!empty($id)) { |
|
189 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | - } |
|
191 | - return $id; |
|
187 | + $id = parent::save($params); |
|
188 | + if (!empty($id)) { |
|
189 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
190 | + } |
|
191 | + return $id; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | $params['c_id'] = api_get_course_int_id(); |
200 | 200 | $params['parent_id'] = '0'; |
201 | 201 | $params['type'] = 'default'; |
202 | - $id = parent::save($params); |
|
203 | - if (!empty($id)) { |
|
204 | - //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | - } |
|
206 | - return $id; |
|
202 | + $id = parent::save($params); |
|
203 | + if (!empty($id)) { |
|
204 | + //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
205 | + } |
|
206 | + return $id; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function delete($id) { |
210 | - parent::delete($id); |
|
211 | - //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
210 | + parent::delete($id); |
|
211 | + //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | public function get_url($id) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $item['asset'] = array( 'media' => $item['media'], |
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | - ); |
|
250 | + ); |
|
251 | 251 | |
252 | 252 | //Cleaning items |
253 | 253 | unset($item['id']); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct() |
29 | 29 | { |
30 | - $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
30 | + $this->table = Database::get_course_table(TABLE_TIMELINE); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function get_all($where_conditions = array()) |
48 | 48 | { |
49 | - return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC')); |
|
49 | + return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // action links |
58 | 58 | $html = '<div class="actions">'; |
59 | 59 | //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
60 | - $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>'; |
|
60 | + $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
61 | 61 | $html .= '</div>'; |
62 | 62 | $html .= Display::grid_html('timelines'); |
63 | 63 | return $html; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | unset($item['end_date']); |
246 | 246 | // Assets |
247 | - $item['asset'] = array( 'media' => $item['media'], |
|
247 | + $item['asset'] = array('media' => $item['media'], |
|
248 | 248 | 'credit' => $item['media_credit'], |
249 | 249 | 'caption' => $item['media_caption'], |
250 | 250 | ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
81 | 81 | $sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id"; |
82 | 82 | $res = Database::query($sql); |
83 | - $users = array (); |
|
83 | + $users = array(); |
|
84 | 84 | while ($user = Database::fetch_array($res, 'ASSOC')) { |
85 | 85 | $users[] = $user; |
86 | 86 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
118 | 118 | $courses = ClassManager :: get_courses($class_id); |
119 | 119 | if (count($courses) != 0) { |
120 | - $course_codes = array (); |
|
120 | + $course_codes = array(); |
|
121 | 121 | foreach ($courses as $index => $course) { |
122 | 122 | $course_codes[] = $course['course_code']; |
123 | 123 | $sql = "SELECT DISTINCT user_id FROM $table_class_user t1, $table_course_class t2 WHERE t1.class_id=t2.class_id AND course_code = '".$course['course_code']."' AND user_id = $user_id AND t2.class_id<>'$class_id'"; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
143 | 143 | $sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code"; |
144 | 144 | $res = Database::query($sql); |
145 | - $courses = array (); |
|
145 | + $courses = array(); |
|
146 | 146 | while ($course = Database::fetch_array($res, 'ASSOC')) { |
147 | 147 | $courses[] = $course; |
148 | 148 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); |
218 | 218 | $sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".Database::escape_string($course_code)."' AND cc.class_id = cl.id"; |
219 | 219 | $res = Database::query($sql); |
220 | - $classes = array (); |
|
220 | + $classes = array(); |
|
221 | 221 | while ($class = Database::fetch_array($res, 'ASSOC')) { |
222 | 222 | $classes[] = $class; |
223 | 223 | } |
@@ -2259,7 +2259,9 @@ discard block |
||
2259 | 2259 | $debug = false; |
2260 | 2260 | } |
2261 | 2261 | |
2262 | - if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2262 | + if ($debug) { |
|
2263 | + echo '<h1>Tracking::get_avg_student_score</h1>'; |
|
2264 | + } |
|
2263 | 2265 | $tbl_stats_exercices = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
2264 | 2266 | $tbl_stats_attempts = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
2265 | 2267 | |
@@ -2336,7 +2338,9 @@ discard block |
||
2336 | 2338 | $condition_user1 AND |
2337 | 2339 | session_id = $session_id |
2338 | 2340 | GROUP BY lp_id, user_id"; |
2339 | - if ($debug) echo $sql; |
|
2341 | + if ($debug) { |
|
2342 | + echo $sql; |
|
2343 | + } |
|
2340 | 2344 | |
2341 | 2345 | $rs_last_lp_view_id = Database::query($sql); |
2342 | 2346 | |
@@ -2352,7 +2356,9 @@ discard block |
||
2352 | 2356 | $lp_view_id = $row_lp_view['id']; |
2353 | 2357 | $lp_id = $row_lp_view['lp_id']; |
2354 | 2358 | $user_id = $row_lp_view['user_id']; |
2355 | - if ($debug) echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2359 | + if ($debug) { |
|
2360 | + echo '<h2>LP id '.$lp_id.'</h2>'; |
|
2361 | + } |
|
2356 | 2362 | |
2357 | 2363 | if ($get_only_latest_attempt_results) { |
2358 | 2364 | //Getting lp_items done by the user |
@@ -2409,7 +2415,9 @@ discard block |
||
2409 | 2415 | lp_i.c_id = $course_id AND |
2410 | 2416 | (lp_i.item_type='sco' OR lp_i.item_type='".TOOL_QUIZ."') |
2411 | 2417 | WHERE lp_view_id = $lp_view_id "; |
2412 | - if ($debug) echo $sql.'<br />'; |
|
2418 | + if ($debug) { |
|
2419 | + echo $sql.'<br />'; |
|
2420 | + } |
|
2413 | 2421 | $res_max_score = Database::query($sql); |
2414 | 2422 | |
2415 | 2423 | while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
@@ -2428,7 +2436,9 @@ discard block |
||
2428 | 2436 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2429 | 2437 | $score = $row_max_score['score']; |
2430 | 2438 | |
2431 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2439 | + if ($debug) { |
|
2440 | + echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2441 | + } |
|
2432 | 2442 | |
2433 | 2443 | if ($row_max_score['item_type'] == 'sco') { |
2434 | 2444 | /* Check if it is sco (easier to get max_score) |
@@ -2448,7 +2458,9 @@ discard block |
||
2448 | 2458 | if (!empty($max_score)) { |
2449 | 2459 | $lp_partial_total += $score/$max_score; |
2450 | 2460 | } |
2451 | - if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2461 | + if ($debug) { |
|
2462 | + echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2463 | + } |
|
2452 | 2464 | } else { |
2453 | 2465 | // Case of a TOOL_QUIZ element |
2454 | 2466 | $item_id = $row_max_score['iid']; |
@@ -2470,12 +2482,16 @@ discard block |
||
2470 | 2482 | ORDER BY exe_date DESC |
2471 | 2483 | LIMIT 1"; |
2472 | 2484 | |
2473 | - if ($debug) echo $sql .'<br />'; |
|
2485 | + if ($debug) { |
|
2486 | + echo $sql .'<br />'; |
|
2487 | + } |
|
2474 | 2488 | $result_last_attempt = Database::query($sql); |
2475 | 2489 | $num = Database :: num_rows($result_last_attempt); |
2476 | 2490 | if ($num > 0 ) { |
2477 | 2491 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2478 | - if ($debug) echo $id_last_attempt.'<br />'; |
|
2492 | + if ($debug) { |
|
2493 | + echo $id_last_attempt.'<br />'; |
|
2494 | + } |
|
2479 | 2495 | |
2480 | 2496 | // Within the last attempt number tracking, get the sum of |
2481 | 2497 | // the max_scores of all questions that it was |
@@ -2494,7 +2510,9 @@ discard block |
||
2494 | 2510 | q.c_id = $course_id |
2495 | 2511 | ) |
2496 | 2512 | AS t"; |
2497 | - if ($debug) echo '$sql: '.$sql.' <br />'; |
|
2513 | + if ($debug) { |
|
2514 | + echo '$sql: '.$sql.' <br />'; |
|
2515 | + } |
|
2498 | 2516 | $res_max_score_bis = Database::query($sql); |
2499 | 2517 | $row_max_score_bis = Database::fetch_array($res_max_score_bis); |
2500 | 2518 | |
@@ -2504,7 +2522,9 @@ discard block |
||
2504 | 2522 | if (!empty($max_score) && floatval($max_score) > 0) { |
2505 | 2523 | $lp_partial_total += $score/$max_score; |
2506 | 2524 | } |
2507 | - if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2525 | + if ($debug) { |
|
2526 | + echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
|
2527 | + } |
|
2508 | 2528 | } |
2509 | 2529 | } |
2510 | 2530 | |
@@ -2517,17 +2537,25 @@ discard block |
||
2517 | 2537 | $count_items++; |
2518 | 2538 | } |
2519 | 2539 | } |
2520 | - if ($debug) echo '$count_items: '.$count_items; |
|
2540 | + if ($debug) { |
|
2541 | + echo '$count_items: '.$count_items; |
|
2542 | + } |
|
2521 | 2543 | } |
2522 | 2544 | } //end for |
2523 | 2545 | |
2524 | 2546 | $score_of_scorm_calculate += $count_items ? (($lp_partial_total / $count_items) * 100) : 0; |
2525 | 2547 | |
2526 | - if ($debug) echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2527 | - if ($debug) echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2548 | + if ($debug) { |
|
2549 | + echo '<h3>$count_items '.$count_items.'</h3>'; |
|
2550 | + } |
|
2551 | + if ($debug) { |
|
2552 | + echo '<h3>$score_of_scorm_calculate '.$score_of_scorm_calculate.'</h3>'; |
|
2553 | + } |
|
2528 | 2554 | |
2529 | 2555 | $global_result += $score_of_scorm_calculate; |
2530 | - if ($debug) echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2556 | + if ($debug) { |
|
2557 | + echo '<h3>$global_result '.$global_result.'</h3>'; |
|
2558 | + } |
|
2531 | 2559 | } // end while |
2532 | 2560 | } |
2533 | 2561 | |
@@ -2540,7 +2568,9 @@ discard block |
||
2540 | 2568 | c_id = $course_id AND |
2541 | 2569 | (item_type = 'quiz' OR item_type = 'sco') AND |
2542 | 2570 | lp_id = ".$lp_id; |
2543 | - if ($debug) echo $sql; |
|
2571 | + if ($debug) { |
|
2572 | + echo $sql; |
|
2573 | + } |
|
2544 | 2574 | $result_have_quiz = Database::query($sql); |
2545 | 2575 | |
2546 | 2576 | if (Database::num_rows($result_have_quiz) > 0 ) { |
@@ -2551,19 +2581,29 @@ discard block |
||
2551 | 2581 | } |
2552 | 2582 | } |
2553 | 2583 | |
2554 | - if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2555 | - if ($debug) echo '<h3>Final return</h3>'; |
|
2584 | + if ($debug) { |
|
2585 | + echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>'; |
|
2586 | + } |
|
2587 | + if ($debug) { |
|
2588 | + echo '<h3>Final return</h3>'; |
|
2589 | + } |
|
2556 | 2590 | |
2557 | 2591 | if ($lp_with_quiz != 0) { |
2558 | 2592 | if (!$return_array) { |
2559 | 2593 | $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
2560 | - if ($debug) var_dump($score_of_scorm_calculate); |
|
2594 | + if ($debug) { |
|
2595 | + var_dump($score_of_scorm_calculate); |
|
2596 | + } |
|
2561 | 2597 | if (empty($lp_ids)) { |
2562 | - if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2598 | + if ($debug) { |
|
2599 | + echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
|
2600 | + } |
|
2563 | 2601 | } |
2564 | 2602 | return $score_of_scorm_calculate; |
2565 | 2603 | } else { |
2566 | - if ($debug) var_dump($global_result, $lp_with_quiz); |
|
2604 | + if ($debug) { |
|
2605 | + var_dump($global_result, $lp_with_quiz); |
|
2606 | + } |
|
2567 | 2607 | return array($global_result, $lp_with_quiz); |
2568 | 2608 | } |
2569 | 2609 | } else { |
@@ -3050,11 +3090,13 @@ discard block |
||
3050 | 3090 | |
3051 | 3091 | if (!empty ($id_session)) { |
3052 | 3092 | $sql .= ' WHERE session_course.session_id=' . $id_session; |
3053 | - if (api_is_multiple_url_enabled()) |
|
3054 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3055 | - } else { |
|
3056 | - if (api_is_multiple_url_enabled()) |
|
3057 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3093 | + if (api_is_multiple_url_enabled()) { |
|
3094 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + if (api_is_multiple_url_enabled()) { |
|
3098 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3099 | + } |
|
3058 | 3100 | } |
3059 | 3101 | |
3060 | 3102 | $result = Database::query($sql); |
@@ -3162,8 +3204,7 @@ discard block |
||
3162 | 3204 | if ($session['access_start_date'] == '0000-00-00 00:00:00' || empty($session['access_start_date']) |
3163 | 3205 | ) { |
3164 | 3206 | $session['status'] = get_lang('SessionActive'); |
3165 | - } |
|
3166 | - else { |
|
3207 | + } else { |
|
3167 | 3208 | $time_start = api_strtotime($session['access_start_date'], 'UTC'); |
3168 | 3209 | $time_end = api_strtotime($session['access_end_date'], 'UTC'); |
3169 | 3210 | if ($time_start < time() && time() < $time_end) { |
@@ -6599,8 +6640,9 @@ discard block |
||
6599 | 6640 | if (is_array($hpresults)) { |
6600 | 6641 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6601 | 6642 | $title = GetQuizName($hpresults[$i][0],''); |
6602 | - if ($title == '') |
|
6603 | - $title = basename($hpresults[$i][0]); |
|
6643 | + if ($title == '') { |
|
6644 | + $title = basename($hpresults[$i][0]); |
|
6645 | + } |
|
6604 | 6646 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6605 | 6647 | ?> |
6606 | 6648 | <tr> |
@@ -6972,8 +7014,9 @@ discard block |
||
6972 | 7014 | for($i = 0; $i < sizeof($hpresults); $i++) { |
6973 | 7015 | $title = GetQuizName($hpresults[$i][0],''); |
6974 | 7016 | |
6975 | - if ($title == '') |
|
6976 | - $title = basename($hpresults[$i][0]); |
|
7017 | + if ($title == '') { |
|
7018 | + $title = basename($hpresults[$i][0]); |
|
7019 | + } |
|
6977 | 7020 | |
6978 | 7021 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
6979 | 7022 |
@@ -1333,6 +1333,8 @@ discard block |
||
1333 | 1333 | * @param string type of time filter: 'last_week' or 'custom' |
1334 | 1334 | * @param string start date date('Y-m-d H:i:s') |
1335 | 1335 | * @param string end date date('Y-m-d H:i:s') |
1336 | + * @param string $start_date |
|
1337 | + * @param string $end_date |
|
1336 | 1338 | * @return timestamp $nb_seconds |
1337 | 1339 | */ |
1338 | 1340 | public static function get_time_spent_on_the_platform( |
@@ -1435,7 +1437,7 @@ discard block |
||
1435 | 1437 | * Get first connection date for a student |
1436 | 1438 | * @param int $student_id |
1437 | 1439 | * |
1438 | - * @return string|bool Date format long without day or false if there are no connections |
|
1440 | + * @return string|false Date format long without day or false if there are no connections |
|
1439 | 1441 | */ |
1440 | 1442 | public static function get_first_connection_date($student_id) |
1441 | 1443 | { |
@@ -1465,7 +1467,7 @@ discard block |
||
1465 | 1467 | * @param int $student_id |
1466 | 1468 | * @param bool $warning_message Show a warning message (optional) |
1467 | 1469 | * @param bool $return_timestamp True for returning results in timestamp (optional) |
1468 | - * @return string|int|bool Date format long without day, false if there are no connections or |
|
1470 | + * @return string Date format long without day, false if there are no connections or |
|
1469 | 1471 | * timestamp if parameter $return_timestamp is true |
1470 | 1472 | */ |
1471 | 1473 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
@@ -2762,6 +2764,9 @@ discard block |
||
2762 | 2764 | * @param array Limit average to listed lp ids |
2763 | 2765 | * @param int Session id (optional), if param $session_id is |
2764 | 2766 | * null(default) it'll return results including sessions, 0 = session is not filtered |
2767 | + * @param integer $student_id |
|
2768 | + * @param string $course_code |
|
2769 | + * @param integer $session_id |
|
2765 | 2770 | * @return int Total time |
2766 | 2771 | */ |
2767 | 2772 | public static function get_time_spent_in_lp($student_id, $course_code, $lp_ids = array(), $session_id = null) |
@@ -2831,6 +2836,8 @@ discard block |
||
2831 | 2836 | * @param int|array Student id(s) |
2832 | 2837 | * @param string Course code |
2833 | 2838 | * @param int Learning path id |
2839 | + * @param integer $student_id |
|
2840 | + * @param string $course_code |
|
2834 | 2841 | * @return int Total time |
2835 | 2842 | */ |
2836 | 2843 | public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) |
@@ -5504,7 +5511,7 @@ discard block |
||
5504 | 5511 | |
5505 | 5512 | /** |
5506 | 5513 | * @param FormValidator $form |
5507 | - * @return mixed |
|
5514 | + * @return FormValidator |
|
5508 | 5515 | */ |
5509 | 5516 | public static function setUserSearchForm($form) |
5510 | 5517 | { |
@@ -6985,7 +6992,7 @@ discard block |
||
6985 | 6992 | * @param int $user_id |
6986 | 6993 | * @param int $course_id |
6987 | 6994 | * @param int $session_id |
6988 | - * @return array |
|
6995 | + * @return string[] |
|
6989 | 6996 | */ |
6990 | 6997 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6998 | { |
@@ -7031,9 +7038,9 @@ discard block |
||
7031 | 7038 | /** |
7032 | 7039 | * Displays the exercise results for a specific user in a specific course. |
7033 | 7040 | * @param string $view |
7034 | - * @param int $user_id User ID |
|
7041 | + * @param int $userId User ID |
|
7035 | 7042 | * @param string $courseCode Course code |
7036 | - * @return array |
|
7043 | + * @return string[] |
|
7037 | 7044 | * @todo remove globals |
7038 | 7045 | */ |
7039 | 7046 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $extend_link = ''; |
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | case 'last_30_days': |
1366 | 1366 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
1367 | 1367 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
1368 | - break; |
|
1368 | + break; |
|
1369 | 1369 | case 'custom': |
1370 | 1370 | if (!empty($start_date) && !empty($end_date)) { |
1371 | 1371 | $start_date = Database::escape_string($start_date); |
@@ -1375,10 +1375,10 @@ discard block |
||
1375 | 1375 | break; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1378 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1379 | 1379 | FROM '.$tbl_track_login.' |
1380 | 1380 | WHERE '.$userCondition.$condition_time; |
1381 | - $rs = Database::query($sql); |
|
1381 | + $rs = Database::query($sql); |
|
1382 | 1382 | $row = Database::fetch_array($rs, 'ASSOC'); |
1383 | 1383 | $diff = $row['diff']; |
1384 | 1384 | |
@@ -1400,18 +1400,18 @@ discard block |
||
1400 | 1400 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1401 | 1401 | { |
1402 | 1402 | $courseId = intval($courseId); |
1403 | - $session_id = intval($session_id); |
|
1404 | - |
|
1405 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | - if (is_array($user_id)) { |
|
1407 | - $user_id = array_map('intval', $user_id); |
|
1408 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | - } else { |
|
1410 | - $user_id = intval($user_id); |
|
1411 | - $condition_user = " AND user_id = $user_id "; |
|
1412 | - } |
|
1413 | - |
|
1414 | - $sql = "SELECT |
|
1403 | + $session_id = intval($session_id); |
|
1404 | + |
|
1405 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | + if (is_array($user_id)) { |
|
1407 | + $user_id = array_map('intval', $user_id); |
|
1408 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | + } else { |
|
1410 | + $user_id = intval($user_id); |
|
1411 | + $condition_user = " AND user_id = $user_id "; |
|
1412 | + } |
|
1413 | + |
|
1414 | + $sql = "SELECT |
|
1415 | 1415 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1416 | 1416 | FROM $tbl_track_course |
1417 | 1417 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1426,9 +1426,9 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | $sql .= $condition_user; |
1428 | 1428 | $rs = Database::query($sql); |
1429 | - $row = Database::fetch_array($rs); |
|
1429 | + $row = Database::fetch_array($rs); |
|
1430 | 1430 | |
1431 | - return $row['nb_seconds']; |
|
1431 | + return $row['nb_seconds']; |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | /** |
@@ -1439,25 +1439,25 @@ discard block |
||
1439 | 1439 | */ |
1440 | 1440 | public static function get_first_connection_date($student_id) |
1441 | 1441 | { |
1442 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | - $sql = 'SELECT login_date |
|
1442 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | + $sql = 'SELECT login_date |
|
1444 | 1444 | FROM ' . $tbl_track_login . ' |
1445 | 1445 | WHERE login_user_id = ' . intval($student_id) . ' |
1446 | 1446 | ORDER BY login_date ASC |
1447 | 1447 | LIMIT 0,1'; |
1448 | 1448 | |
1449 | - $rs = Database::query($sql); |
|
1450 | - if (Database::num_rows($rs)>0) { |
|
1451 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1449 | + $rs = Database::query($sql); |
|
1450 | + if (Database::num_rows($rs)>0) { |
|
1451 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1452 | 1452 | return api_convert_and_format_date( |
1453 | 1453 | $first_login_date, |
1454 | 1454 | DATE_FORMAT_SHORT, |
1455 | 1455 | date_default_timezone_get() |
1456 | 1456 | ); |
1457 | - } |
|
1458 | - } |
|
1457 | + } |
|
1458 | + } |
|
1459 | 1459 | |
1460 | - return false; |
|
1460 | + return false; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | /** |
@@ -1470,38 +1470,38 @@ discard block |
||
1470 | 1470 | */ |
1471 | 1471 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1472 | 1472 | { |
1473 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | - $sql = 'SELECT login_date |
|
1473 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | + $sql = 'SELECT login_date |
|
1475 | 1475 | FROM ' . $table . ' |
1476 | 1476 | WHERE login_user_id = ' . intval($student_id) . ' |
1477 | 1477 | ORDER BY login_date |
1478 | 1478 | DESC LIMIT 0,1'; |
1479 | 1479 | |
1480 | - $rs = Database::query($sql); |
|
1481 | - if (Database::num_rows($rs) > 0) { |
|
1482 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | - $last_login_date = api_get_local_time($last_login_date); |
|
1484 | - if ($return_timestamp) { |
|
1485 | - return api_strtotime($last_login_date,'UTC'); |
|
1486 | - } else { |
|
1487 | - if (!$warning_message) { |
|
1488 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | - } else { |
|
1490 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | - $currentTimestamp = time(); |
|
1492 | - |
|
1493 | - //If the last connection is > than 7 days, the text is red |
|
1494 | - //345600 = 7 days in seconds |
|
1495 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | - } else { |
|
1498 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | - } |
|
1500 | - } |
|
1501 | - } |
|
1502 | - } |
|
1503 | - } |
|
1504 | - return false; |
|
1480 | + $rs = Database::query($sql); |
|
1481 | + if (Database::num_rows($rs) > 0) { |
|
1482 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | + $last_login_date = api_get_local_time($last_login_date); |
|
1484 | + if ($return_timestamp) { |
|
1485 | + return api_strtotime($last_login_date,'UTC'); |
|
1486 | + } else { |
|
1487 | + if (!$warning_message) { |
|
1488 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | + } else { |
|
1490 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | + $currentTimestamp = time(); |
|
1492 | + |
|
1493 | + //If the last connection is > than 7 days, the text is red |
|
1494 | + //345600 = 7 days in seconds |
|
1495 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | + } else { |
|
1498 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | + } |
|
1500 | + } |
|
1501 | + } |
|
1502 | + } |
|
1503 | + } |
|
1504 | + return false; |
|
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | /** |
@@ -1555,30 +1555,30 @@ discard block |
||
1555 | 1555 | $session_id = 0, |
1556 | 1556 | $convert_date = true |
1557 | 1557 | ) { |
1558 | - $student_id = intval($student_id); |
|
1558 | + $student_id = intval($student_id); |
|
1559 | 1559 | $courseId = intval($courseId); |
1560 | - $session_id = intval($session_id); |
|
1560 | + $session_id = intval($session_id); |
|
1561 | 1561 | |
1562 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | - $sql = 'SELECT login_course_date |
|
1562 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | + $sql = 'SELECT login_course_date |
|
1564 | 1564 | FROM '.$tbl_track_login.' |
1565 | 1565 | WHERE |
1566 | 1566 | user_id = '.$student_id.' AND |
1567 | 1567 | c_id = '.$courseId.' AND |
1568 | 1568 | session_id = '.$session_id.' |
1569 | 1569 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1570 | - $rs = Database::query($sql); |
|
1571 | - if (Database::num_rows($rs) > 0) { |
|
1572 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | - if ($convert_date) { |
|
1574 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | - } else { |
|
1576 | - return $first_login_date; |
|
1577 | - } |
|
1578 | - } |
|
1579 | - } |
|
1580 | - |
|
1581 | - return false; |
|
1570 | + $rs = Database::query($sql); |
|
1571 | + if (Database::num_rows($rs) > 0) { |
|
1572 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | + if ($convert_date) { |
|
1574 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | + } else { |
|
1576 | + return $first_login_date; |
|
1577 | + } |
|
1578 | + } |
|
1579 | + } |
|
1580 | + |
|
1581 | + return false; |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | /** |
@@ -1594,13 +1594,13 @@ discard block |
||
1594 | 1594 | $session_id = 0, |
1595 | 1595 | $convert_date = true |
1596 | 1596 | ) { |
1597 | - // protect data |
|
1598 | - $student_id = intval($student_id); |
|
1597 | + // protect data |
|
1598 | + $student_id = intval($student_id); |
|
1599 | 1599 | $courseId = $courseInfo['real_id']; |
1600 | - $session_id = intval($session_id); |
|
1600 | + $session_id = intval($session_id); |
|
1601 | 1601 | |
1602 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | - $sql = 'SELECT access_date |
|
1602 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | + $sql = 'SELECT access_date |
|
1604 | 1604 | FROM '.$tbl_track_e_access.' |
1605 | 1605 | WHERE access_user_id = '.$student_id.' AND |
1606 | 1606 | c_id = "'.$courseId.'" AND |
@@ -1608,39 +1608,39 @@ discard block |
||
1608 | 1608 | ORDER BY access_date DESC |
1609 | 1609 | LIMIT 0,1'; |
1610 | 1610 | |
1611 | - $rs = Database::query($sql); |
|
1612 | - if (Database::num_rows($rs) > 0) { |
|
1613 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1611 | + $rs = Database::query($sql); |
|
1612 | + if (Database::num_rows($rs) > 0) { |
|
1613 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1614 | 1614 | if (empty($last_login_date)) { |
1615 | 1615 | return false; |
1616 | 1616 | } |
1617 | 1617 | //see #5736 |
1618 | 1618 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1619 | - $now = time(); |
|
1620 | - //If the last connection is > than 7 days, the text is red |
|
1621 | - //345600 = 7 days in seconds |
|
1622 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | - if ($convert_date) { |
|
1619 | + $now = time(); |
|
1620 | + //If the last connection is > than 7 days, the text is red |
|
1621 | + //345600 = 7 days in seconds |
|
1622 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | + if ($convert_date) { |
|
1624 | 1624 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1625 | 1625 | $icon = api_is_allowed_to_edit() ? |
1626 | 1626 | '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1627 | 1627 | '.Display::return_icon('messagebox_warning.gif').' |
1628 | 1628 | </a>' |
1629 | 1629 | : null; |
1630 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | - } else { |
|
1632 | - return $last_login_date; |
|
1633 | - } |
|
1634 | - } else { |
|
1635 | - if ($convert_date) { |
|
1636 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | - } else { |
|
1638 | - return $last_login_date; |
|
1639 | - } |
|
1640 | - } |
|
1641 | - } |
|
1642 | - } |
|
1643 | - return false; |
|
1630 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | + } else { |
|
1632 | + return $last_login_date; |
|
1633 | + } |
|
1634 | + } else { |
|
1635 | + if ($convert_date) { |
|
1636 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | + } else { |
|
1638 | + return $last_login_date; |
|
1639 | + } |
|
1640 | + } |
|
1641 | + } |
|
1642 | + } |
|
1643 | + return false; |
|
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | /** |
@@ -1653,36 +1653,36 @@ discard block |
||
1653 | 1653 | */ |
1654 | 1654 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1655 | 1655 | { |
1656 | - if ($start < 0) { |
|
1657 | - $start = 0; |
|
1658 | - } |
|
1659 | - if (!isset($stop) or ($stop < 0)) { |
|
1660 | - $stop = api_get_utc_datetime(); |
|
1661 | - } |
|
1656 | + if ($start < 0) { |
|
1657 | + $start = 0; |
|
1658 | + } |
|
1659 | + if (!isset($stop) or ($stop < 0)) { |
|
1660 | + $stop = api_get_utc_datetime(); |
|
1661 | + } |
|
1662 | 1662 | |
1663 | 1663 | $start = Database::escape_string($start); |
1664 | 1664 | $stop = Database::escape_string($stop); |
1665 | 1665 | |
1666 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1666 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1667 | 1667 | |
1668 | 1668 | $courseId = intval($courseId); |
1669 | - $session_id = intval($session_id); |
|
1670 | - $count = 0; |
|
1669 | + $session_id = intval($session_id); |
|
1670 | + $count = 0; |
|
1671 | 1671 | |
1672 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | - $sql = "SELECT count(*) as count_connections |
|
1672 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | + $sql = "SELECT count(*) as count_connections |
|
1674 | 1674 | FROM $tbl_track_e_course_access |
1675 | 1675 | WHERE |
1676 | 1676 | c_id = $courseId AND |
1677 | 1677 | session_id = $session_id |
1678 | 1678 | $month_filter"; |
1679 | - $rs = Database::query($sql); |
|
1680 | - if (Database::num_rows($rs)>0) { |
|
1681 | - $row = Database::fetch_object($rs); |
|
1682 | - $count = $row->count_connections; |
|
1683 | - } |
|
1679 | + $rs = Database::query($sql); |
|
1680 | + if (Database::num_rows($rs)>0) { |
|
1681 | + $row = Database::fetch_object($rs); |
|
1682 | + $count = $row->count_connections; |
|
1683 | + } |
|
1684 | 1684 | |
1685 | - return $count; |
|
1685 | + return $count; |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | /** |
@@ -1693,25 +1693,25 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public static function count_course_per_student($user_id, $include_sessions = true) |
1695 | 1695 | { |
1696 | - $user_id = intval($user_id); |
|
1697 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1696 | + $user_id = intval($user_id); |
|
1697 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1699 | 1699 | |
1700 | - $sql = 'SELECT DISTINCT c_id |
|
1700 | + $sql = 'SELECT DISTINCT c_id |
|
1701 | 1701 | FROM ' . $tbl_course_rel_user . ' |
1702 | 1702 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1703 | - $rs = Database::query($sql); |
|
1704 | - $nb_courses = Database::num_rows($rs); |
|
1703 | + $rs = Database::query($sql); |
|
1704 | + $nb_courses = Database::num_rows($rs); |
|
1705 | 1705 | |
1706 | - if ($include_sessions) { |
|
1707 | - $sql = 'SELECT DISTINCT c_id |
|
1706 | + if ($include_sessions) { |
|
1707 | + $sql = 'SELECT DISTINCT c_id |
|
1708 | 1708 | FROM ' . $tbl_session_course_rel_user . ' |
1709 | 1709 | WHERE user_id = ' . $user_id; |
1710 | - $rs = Database::query($sql); |
|
1711 | - $nb_courses += Database::num_rows($rs); |
|
1712 | - } |
|
1710 | + $rs = Database::query($sql); |
|
1711 | + $nb_courses += Database::num_rows($rs); |
|
1712 | + } |
|
1713 | 1713 | |
1714 | - return $nb_courses; |
|
1714 | + return $nb_courses; |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1742,25 +1742,25 @@ discard block |
||
1742 | 1742 | $into_lp = 0 |
1743 | 1743 | ) { |
1744 | 1744 | $course_code = Database::escape_string($course_code); |
1745 | - $course_info = api_get_course_info($course_code); |
|
1746 | - if (!empty($course_info)) { |
|
1747 | - // table definition |
|
1748 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | - |
|
1751 | - // Compose a filter based on optional exercise given |
|
1752 | - $condition_quiz = ""; |
|
1753 | - if (!empty($exercise_id)) { |
|
1754 | - $exercise_id = intval($exercise_id); |
|
1755 | - $condition_quiz =" AND id = $exercise_id "; |
|
1756 | - } |
|
1757 | - |
|
1758 | - // Compose a filter based on optional session id given |
|
1759 | - $condition_session = ""; |
|
1760 | - if (isset($session_id)) { |
|
1761 | - $session_id = intval($session_id); |
|
1762 | - $condition_session = " AND session_id = $session_id "; |
|
1763 | - } |
|
1745 | + $course_info = api_get_course_info($course_code); |
|
1746 | + if (!empty($course_info)) { |
|
1747 | + // table definition |
|
1748 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | + |
|
1751 | + // Compose a filter based on optional exercise given |
|
1752 | + $condition_quiz = ""; |
|
1753 | + if (!empty($exercise_id)) { |
|
1754 | + $exercise_id = intval($exercise_id); |
|
1755 | + $condition_quiz =" AND id = $exercise_id "; |
|
1756 | + } |
|
1757 | + |
|
1758 | + // Compose a filter based on optional session id given |
|
1759 | + $condition_session = ""; |
|
1760 | + if (isset($session_id)) { |
|
1761 | + $session_id = intval($session_id); |
|
1762 | + $condition_session = " AND session_id = $session_id "; |
|
1763 | + } |
|
1764 | 1764 | if ($active_filter == 1) { |
1765 | 1765 | $condition_active = 'AND active <> -1'; |
1766 | 1766 | } elseif ($active_filter == 0) { |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | $select_lp_id = ', orig_lp_id as lp_id '; |
1777 | 1777 | } |
1778 | 1778 | |
1779 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1779 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1780 | 1780 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1781 | 1781 | $count_quiz = 0; |
1782 | 1782 | $countQuizResult = Database::query($sql); |
@@ -1784,21 +1784,21 @@ discard block |
||
1784 | 1784 | $count_quiz = Database::fetch_row($countQuizResult); |
1785 | 1785 | } |
1786 | 1786 | |
1787 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | - if (is_array($student_id)) { |
|
1787 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | + if (is_array($student_id)) { |
|
1789 | 1789 | $student_id = array_map('intval', $student_id); |
1790 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | - } else { |
|
1790 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | + } else { |
|
1792 | 1792 | $student_id = intval($student_id); |
1793 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | - } |
|
1793 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | + } |
|
1795 | 1795 | |
1796 | - if (empty($exercise_id)) { |
|
1797 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1796 | + if (empty($exercise_id)) { |
|
1797 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1798 | 1798 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1799 | 1799 | $result = Database::query($sql); |
1800 | 1800 | $exercise_list = array(); |
1801 | - $exercise_id = null; |
|
1801 | + $exercise_id = null; |
|
1802 | 1802 | if (!empty($result) && Database::num_rows($result)) { |
1803 | 1803 | while ($row = Database::fetch_array($result)) { |
1804 | 1804 | $exercise_list[] = $row['id']; |
@@ -1807,11 +1807,11 @@ discard block |
||
1807 | 1807 | if (!empty($exercise_list)) { |
1808 | 1808 | $exercise_id = implode("','",$exercise_list); |
1809 | 1809 | } |
1810 | - } |
|
1810 | + } |
|
1811 | 1811 | |
1812 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1812 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1813 | 1813 | |
1814 | - $sql = "SELECT |
|
1814 | + $sql = "SELECT |
|
1815 | 1815 | SUM(exe_result/exe_weighting*100) as avg_score, |
1816 | 1816 | COUNT(*) as num_attempts |
1817 | 1817 | $select_lp_id |
@@ -1825,20 +1825,20 @@ discard block |
||
1825 | 1825 | $condition_into_lp |
1826 | 1826 | ORDER BY exe_date DESC"; |
1827 | 1827 | |
1828 | - $res = Database::query($sql); |
|
1829 | - $row = Database::fetch_array($res); |
|
1830 | - $quiz_avg_score = null; |
|
1828 | + $res = Database::query($sql); |
|
1829 | + $row = Database::fetch_array($res); |
|
1830 | + $quiz_avg_score = null; |
|
1831 | 1831 | |
1832 | - if (!empty($row['avg_score'])) { |
|
1833 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | - } |
|
1832 | + if (!empty($row['avg_score'])) { |
|
1833 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | + } |
|
1835 | 1835 | |
1836 | - if(!empty($row['num_attempts'])) { |
|
1837 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | - } |
|
1839 | - if (is_array($student_id)) { |
|
1840 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | - } |
|
1836 | + if(!empty($row['num_attempts'])) { |
|
1837 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | + } |
|
1839 | + if (is_array($student_id)) { |
|
1840 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | + } |
|
1842 | 1842 | if ($into_lp == 0) { |
1843 | 1843 | return $quiz_avg_score; |
1844 | 1844 | } else { |
@@ -1861,9 +1861,9 @@ discard block |
||
1861 | 1861 | return array($quiz_avg_score, null); |
1862 | 1862 | } |
1863 | 1863 | } |
1864 | - } |
|
1865 | - } |
|
1866 | - return null; |
|
1864 | + } |
|
1865 | + } |
|
1866 | + return null; |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | /** |
@@ -1896,15 +1896,15 @@ discard block |
||
1896 | 1896 | $find_all_lp = 0 |
1897 | 1897 | ) { |
1898 | 1898 | $courseId = intval($courseId); |
1899 | - $student_id = intval($student_id); |
|
1900 | - $exercise_id = intval($exercise_id); |
|
1901 | - $session_id = intval($session_id); |
|
1899 | + $student_id = intval($student_id); |
|
1900 | + $exercise_id = intval($exercise_id); |
|
1901 | + $session_id = intval($session_id); |
|
1902 | 1902 | |
1903 | - $lp_id = intval($lp_id); |
|
1903 | + $lp_id = intval($lp_id); |
|
1904 | 1904 | $lp_item_id = intval($lp_item_id); |
1905 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1905 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1906 | 1906 | |
1907 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1907 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1908 | 1908 | WHERE ex.c_id = $courseId |
1909 | 1909 | AND ex.exe_exo_id = $exercise_id |
1910 | 1910 | AND status = '' |
@@ -1919,11 +1919,11 @@ discard block |
||
1919 | 1919 | AND orig_lp_item_id = $lp_item_id"; |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - $rs = Database::query($sql); |
|
1923 | - $row = Database::fetch_row($rs); |
|
1924 | - $count_attempts = $row[0]; |
|
1922 | + $rs = Database::query($sql); |
|
1923 | + $row = Database::fetch_row($rs); |
|
1924 | + $count_attempts = $row[0]; |
|
1925 | 1925 | |
1926 | - return $count_attempts; |
|
1926 | + return $count_attempts; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | /** |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | * @param int $user_id |
1934 | 1934 | * @param int $courseId |
1935 | 1935 | * @param int $session_id |
1936 | - */ |
|
1936 | + */ |
|
1937 | 1937 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1938 | 1938 | { |
1939 | 1939 | $courseId = intval($courseId); |
@@ -3597,8 +3597,8 @@ discard block |
||
3597 | 3597 | |
3598 | 3598 | $condition_session = ''; |
3599 | 3599 | if (isset($session_id)) { |
3600 | - $session_id = intval($session_id); |
|
3601 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3600 | + $session_id = intval($session_id); |
|
3601 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3602 | 3602 | } |
3603 | 3603 | |
3604 | 3604 | $groupId = intval($groupId); |
@@ -5503,9 +5503,9 @@ discard block |
||
5503 | 5503 | } |
5504 | 5504 | |
5505 | 5505 | /** |
5506 | - * @param FormValidator $form |
|
5507 | - * @return mixed |
|
5508 | - */ |
|
5506 | + * @param FormValidator $form |
|
5507 | + * @return mixed |
|
5508 | + */ |
|
5509 | 5509 | public static function setUserSearchForm($form) |
5510 | 5510 | { |
5511 | 5511 | global $_configuration; |
@@ -5785,26 +5785,26 @@ discard block |
||
5785 | 5785 | $session_id = api_get_session_id(); |
5786 | 5786 | $course_id = api_get_course_int_id(); |
5787 | 5787 | |
5788 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5788 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5790 | 5790 | |
5791 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5791 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5792 | 5792 | FROM $table_item_property track_resource, $table_user user |
5793 | 5793 | WHERE |
5794 | 5794 | track_resource.c_id = $course_id AND |
5795 | 5795 | track_resource.insert_user_id = user.user_id AND |
5796 | 5796 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5797 | 5797 | |
5798 | - if (isset($_GET['keyword'])) { |
|
5799 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | - $sql .= " AND ( |
|
5798 | + if (isset($_GET['keyword'])) { |
|
5799 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | + $sql .= " AND ( |
|
5801 | 5801 | user.username LIKE '%".$keyword."%' OR |
5802 | 5802 | lastedit_type LIKE '%".$keyword."%' OR |
5803 | 5803 | tool LIKE '%".$keyword."%' |
5804 | 5804 | )"; |
5805 | - } |
|
5805 | + } |
|
5806 | 5806 | |
5807 | - $sql .= " AND tool IN ( |
|
5807 | + $sql .= " AND tool IN ( |
|
5808 | 5808 | 'document', |
5809 | 5809 | 'learnpath', |
5810 | 5810 | 'quiz', |
@@ -5816,10 +5816,10 @@ discard block |
||
5816 | 5816 | 'thematic_advance', |
5817 | 5817 | 'thematic_plan' |
5818 | 5818 | )"; |
5819 | - $res = Database::query($sql); |
|
5820 | - $obj = Database::fetch_object($res); |
|
5819 | + $res = Database::query($sql); |
|
5820 | + $obj = Database::fetch_object($res); |
|
5821 | 5821 | |
5822 | - return $obj->total_number_of_items; |
|
5822 | + return $obj->total_number_of_items; |
|
5823 | 5823 | } |
5824 | 5824 | |
5825 | 5825 | /** |
@@ -5834,12 +5834,12 @@ discard block |
||
5834 | 5834 | $session_id = api_get_session_id(); |
5835 | 5835 | $course_id = api_get_course_int_id(); |
5836 | 5836 | |
5837 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | - $session_id = intval($session_id); |
|
5837 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | + $session_id = intval($session_id); |
|
5841 | 5841 | |
5842 | - $sql = "SELECT |
|
5842 | + $sql = "SELECT |
|
5843 | 5843 | tool as col0, |
5844 | 5844 | lastedit_type as col1, |
5845 | 5845 | ref as ref, |
@@ -5853,16 +5853,16 @@ discard block |
||
5853 | 5853 | track_resource.insert_user_id = user.user_id AND |
5854 | 5854 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5855 | 5855 | |
5856 | - if (isset($_GET['keyword'])) { |
|
5857 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | - $sql .= " AND ( |
|
5856 | + if (isset($_GET['keyword'])) { |
|
5857 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | + $sql .= " AND ( |
|
5859 | 5859 | user.username LIKE '%".$keyword."%' OR |
5860 | 5860 | lastedit_type LIKE '%".$keyword."%' OR |
5861 | 5861 | tool LIKE '%".$keyword."%' |
5862 | 5862 | ) "; |
5863 | - } |
|
5863 | + } |
|
5864 | 5864 | |
5865 | - $sql .= " AND tool IN ( |
|
5865 | + $sql .= " AND tool IN ( |
|
5866 | 5866 | 'document', |
5867 | 5867 | 'learnpath', |
5868 | 5868 | 'quiz', |
@@ -5875,41 +5875,41 @@ discard block |
||
5875 | 5875 | 'thematic_plan' |
5876 | 5876 | )"; |
5877 | 5877 | |
5878 | - if ($column == 0) { |
|
5879 | - $column = '0'; |
|
5880 | - } |
|
5881 | - if ($column != '' && $direction != '') { |
|
5882 | - if ($column != 2 && $column != 4) { |
|
5883 | - $sql .= " ORDER BY col$column $direction"; |
|
5884 | - } |
|
5885 | - } else { |
|
5886 | - $sql .= " ORDER BY col5 DESC "; |
|
5887 | - } |
|
5878 | + if ($column == 0) { |
|
5879 | + $column = '0'; |
|
5880 | + } |
|
5881 | + if ($column != '' && $direction != '') { |
|
5882 | + if ($column != 2 && $column != 4) { |
|
5883 | + $sql .= " ORDER BY col$column $direction"; |
|
5884 | + } |
|
5885 | + } else { |
|
5886 | + $sql .= " ORDER BY col5 DESC "; |
|
5887 | + } |
|
5888 | 5888 | |
5889 | 5889 | $from = intval($from); |
5890 | 5890 | $number_of_items = intval($number_of_items); |
5891 | 5891 | |
5892 | - $sql .= " LIMIT $from, $number_of_items "; |
|
5893 | - |
|
5894 | - $res = Database::query($sql); |
|
5895 | - $resources = array(); |
|
5896 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | - while ($row = Database::fetch_array($res)) { |
|
5898 | - $ref = $row['ref']; |
|
5899 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | - |
|
5902 | - $id = $table_name['id_tool']; |
|
5903 | - $recorset = false; |
|
5892 | + $sql .= " LIMIT $from, $number_of_items "; |
|
5904 | 5893 | |
5905 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | - $sql = "SELECT thematic_id FROM $table_tool |
|
5894 | + $res = Database::query($sql); |
|
5895 | + $resources = array(); |
|
5896 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | + while ($row = Database::fetch_array($res)) { |
|
5898 | + $ref = $row['ref']; |
|
5899 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | + |
|
5902 | + $id = $table_name['id_tool']; |
|
5903 | + $recorset = false; |
|
5904 | + |
|
5905 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | + $sql = "SELECT thematic_id FROM $table_tool |
|
5908 | 5908 | WHERE c_id = $course_id AND id = $ref"; |
5909 | - $rs_thematic = Database::query($sql); |
|
5910 | - if (Database::num_rows($rs_thematic)) { |
|
5911 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | - $thematic_id = $row_thematic['thematic_id']; |
|
5909 | + $rs_thematic = Database::query($sql); |
|
5910 | + if (Database::num_rows($rs_thematic)) { |
|
5911 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | + $thematic_id = $row_thematic['thematic_id']; |
|
5913 | 5913 | |
5914 | 5914 | $sql = "SELECT session.id, session.name, user.username |
5915 | 5915 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5918,9 +5918,9 @@ discard block |
||
5918 | 5918 | t.session_id = session.id AND |
5919 | 5919 | session.id_coach = user.user_id AND |
5920 | 5920 | t.id = $thematic_id"; |
5921 | - $recorset = Database::query($sql); |
|
5922 | - } |
|
5923 | - } else { |
|
5921 | + $recorset = Database::query($sql); |
|
5922 | + } |
|
5923 | + } else { |
|
5924 | 5924 | $sql = "SELECT session.id, session.name, user.username |
5925 | 5925 | FROM $table_tool tool, $table_session session, $table_user user |
5926 | 5926 | WHERE |
@@ -5928,127 +5928,127 @@ discard block |
||
5928 | 5928 | tool.session_id = session.id AND |
5929 | 5929 | session.id_coach = user.user_id AND |
5930 | 5930 | tool.$id = $ref"; |
5931 | - $recorset = Database::query($sql); |
|
5932 | - } |
|
5933 | - |
|
5934 | - if (!empty($recorset)) { |
|
5935 | - $obj = Database::fetch_object($recorset); |
|
5936 | - |
|
5937 | - $name_session = ''; |
|
5938 | - $coach_name = ''; |
|
5939 | - if (!empty($obj)) { |
|
5940 | - $name_session = $obj->name; |
|
5941 | - $coach_name = $obj->username; |
|
5942 | - } |
|
5943 | - |
|
5944 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | - $row[0] = ''; |
|
5946 | - if ($row['col6'] != 2) { |
|
5947 | - if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | - |
|
5949 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | - $thematic_tool_title = ''; |
|
5951 | - if (is_array($exp_thematic_tool)) { |
|
5952 | - foreach ($exp_thematic_tool as $exp) { |
|
5953 | - $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | - } |
|
5955 | - } else { |
|
5956 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | - } |
|
5958 | - |
|
5959 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | - } else { |
|
5961 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | - } |
|
5963 | - } else { |
|
5964 | - $row[0] = api_ucfirst($row['col0']); |
|
5965 | - } |
|
5966 | - $row[1] = get_lang($row[1]); |
|
5967 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | - $row[5] = ''; |
|
5969 | - //@todo Improve this code please |
|
5970 | - switch ($table_name['table_name']) { |
|
5971 | - case 'document' : |
|
5972 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5931 | + $recorset = Database::query($sql); |
|
5932 | + } |
|
5933 | + |
|
5934 | + if (!empty($recorset)) { |
|
5935 | + $obj = Database::fetch_object($recorset); |
|
5936 | + |
|
5937 | + $name_session = ''; |
|
5938 | + $coach_name = ''; |
|
5939 | + if (!empty($obj)) { |
|
5940 | + $name_session = $obj->name; |
|
5941 | + $coach_name = $obj->username; |
|
5942 | + } |
|
5943 | + |
|
5944 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | + $row[0] = ''; |
|
5946 | + if ($row['col6'] != 2) { |
|
5947 | + if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | + |
|
5949 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | + $thematic_tool_title = ''; |
|
5951 | + if (is_array($exp_thematic_tool)) { |
|
5952 | + foreach ($exp_thematic_tool as $exp) { |
|
5953 | + $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | + } |
|
5955 | + } else { |
|
5956 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | + } |
|
5958 | + |
|
5959 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | + } else { |
|
5961 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | + } |
|
5963 | + } else { |
|
5964 | + $row[0] = api_ucfirst($row['col0']); |
|
5965 | + } |
|
5966 | + $row[1] = get_lang($row[1]); |
|
5967 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | + $row[5] = ''; |
|
5969 | + //@todo Improve this code please |
|
5970 | + switch ($table_name['table_name']) { |
|
5971 | + case 'document' : |
|
5972 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5973 | 5973 | WHERE c_id = $course_id AND id = $ref"; |
5974 | - $rs_document = Database::query($sql); |
|
5975 | - $obj_document = Database::fetch_object($rs_document); |
|
5976 | - $row[5] = $obj_document->title; |
|
5974 | + $rs_document = Database::query($sql); |
|
5975 | + $obj_document = Database::fetch_object($rs_document); |
|
5976 | + $row[5] = $obj_document->title; |
|
5977 | 5977 | |
5978 | - break; |
|
5979 | - case 'announcement': |
|
5978 | + break; |
|
5979 | + case 'announcement': |
|
5980 | 5980 | $sql = "SELECT title FROM $table_tool |
5981 | 5981 | WHERE c_id = $course_id AND id = $ref"; |
5982 | - $rs_document = Database::query($sql); |
|
5983 | - $obj_document = Database::fetch_object($rs_document); |
|
5982 | + $rs_document = Database::query($sql); |
|
5983 | + $obj_document = Database::fetch_object($rs_document); |
|
5984 | 5984 | if ($obj_document) { |
5985 | 5985 | $row[5] = $obj_document->title; |
5986 | 5986 | } |
5987 | - break; |
|
5988 | - case 'glossary': |
|
5987 | + break; |
|
5988 | + case 'glossary': |
|
5989 | 5989 | $sql = "SELECT name FROM $table_tool |
5990 | 5990 | WHERE c_id = $course_id AND glossary_id = $ref"; |
5991 | - $rs_document = Database::query($sql); |
|
5992 | - $obj_document = Database::fetch_object($rs_document); |
|
5991 | + $rs_document = Database::query($sql); |
|
5992 | + $obj_document = Database::fetch_object($rs_document); |
|
5993 | 5993 | if ($obj_document) { |
5994 | 5994 | $row[5] = $obj_document->name; |
5995 | 5995 | } |
5996 | - break; |
|
5997 | - case 'lp': |
|
5996 | + break; |
|
5997 | + case 'lp': |
|
5998 | 5998 | $sql = "SELECT name |
5999 | 5999 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
6000 | - $rs_document = Database::query($sql); |
|
6001 | - $obj_document = Database::fetch_object($rs_document); |
|
6002 | - $row[5] = $obj_document->name; |
|
6003 | - break; |
|
6004 | - case 'quiz': |
|
6000 | + $rs_document = Database::query($sql); |
|
6001 | + $obj_document = Database::fetch_object($rs_document); |
|
6002 | + $row[5] = $obj_document->name; |
|
6003 | + break; |
|
6004 | + case 'quiz': |
|
6005 | 6005 | $sql = "SELECT title FROM $table_tool |
6006 | 6006 | WHERE c_id = $course_id AND id = $ref"; |
6007 | - $rs_document = Database::query($sql); |
|
6008 | - $obj_document = Database::fetch_object($rs_document); |
|
6007 | + $rs_document = Database::query($sql); |
|
6008 | + $obj_document = Database::fetch_object($rs_document); |
|
6009 | 6009 | if ($obj_document) { |
6010 | 6010 | $row[5] = $obj_document->title; |
6011 | 6011 | } |
6012 | - break; |
|
6013 | - case 'course_description': |
|
6012 | + break; |
|
6013 | + case 'course_description': |
|
6014 | 6014 | $sql = "SELECT title FROM $table_tool |
6015 | 6015 | WHERE c_id = $course_id AND id = $ref"; |
6016 | - $rs_document = Database::query($sql); |
|
6017 | - $obj_document = Database::fetch_object($rs_document); |
|
6016 | + $rs_document = Database::query($sql); |
|
6017 | + $obj_document = Database::fetch_object($rs_document); |
|
6018 | 6018 | if ($obj_document) { |
6019 | 6019 | $row[5] = $obj_document->title; |
6020 | 6020 | } |
6021 | - break; |
|
6022 | - case 'thematic': |
|
6023 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | - if (Database::num_rows($rs) > 0) { |
|
6025 | - $obj = Database::fetch_object($rs); |
|
6026 | - $row[5] = $obj->title; |
|
6027 | - } |
|
6028 | - break; |
|
6029 | - case 'thematic_advance': |
|
6030 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | - if (Database::num_rows($rs) > 0) { |
|
6032 | - $obj = Database::fetch_object($rs); |
|
6033 | - $row[5] = $obj->content; |
|
6034 | - } |
|
6035 | - break; |
|
6036 | - case 'thematic_plan': |
|
6037 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | - if (Database::num_rows($rs) > 0) { |
|
6039 | - $obj = Database::fetch_object($rs); |
|
6040 | - $row[5] = $obj->title; |
|
6041 | - } |
|
6042 | - break; |
|
6043 | - default: |
|
6044 | - break; |
|
6045 | - } |
|
6046 | - |
|
6047 | - $row2 = $name_session; |
|
6048 | - if (!empty($coach_name)) { |
|
6049 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | - } |
|
6051 | - $row[2] = $row2; |
|
6021 | + break; |
|
6022 | + case 'thematic': |
|
6023 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | + if (Database::num_rows($rs) > 0) { |
|
6025 | + $obj = Database::fetch_object($rs); |
|
6026 | + $row[5] = $obj->title; |
|
6027 | + } |
|
6028 | + break; |
|
6029 | + case 'thematic_advance': |
|
6030 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | + if (Database::num_rows($rs) > 0) { |
|
6032 | + $obj = Database::fetch_object($rs); |
|
6033 | + $row[5] = $obj->content; |
|
6034 | + } |
|
6035 | + break; |
|
6036 | + case 'thematic_plan': |
|
6037 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | + if (Database::num_rows($rs) > 0) { |
|
6039 | + $obj = Database::fetch_object($rs); |
|
6040 | + $row[5] = $obj->title; |
|
6041 | + } |
|
6042 | + break; |
|
6043 | + default: |
|
6044 | + break; |
|
6045 | + } |
|
6046 | + |
|
6047 | + $row2 = $name_session; |
|
6048 | + if (!empty($coach_name)) { |
|
6049 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | + } |
|
6051 | + $row[2] = $row2; |
|
6052 | 6052 | if (!empty($row['col3'])) { |
6053 | 6053 | $userInfo = api_get_user_info($row['user_id']); |
6054 | 6054 | |
@@ -6065,11 +6065,11 @@ discard block |
||
6065 | 6065 | $row[4] = $ip; |
6066 | 6066 | } |
6067 | 6067 | |
6068 | - $resources[] = $row; |
|
6069 | - } |
|
6070 | - } |
|
6068 | + $resources[] = $row; |
|
6069 | + } |
|
6070 | + } |
|
6071 | 6071 | |
6072 | - return $resources; |
|
6072 | + return $resources; |
|
6073 | 6073 | } |
6074 | 6074 | |
6075 | 6075 | /** |
@@ -6079,63 +6079,63 @@ discard block |
||
6079 | 6079 | */ |
6080 | 6080 | public static function get_tool_name_table($tool) |
6081 | 6081 | { |
6082 | - switch ($tool) { |
|
6083 | - case 'document': |
|
6084 | - $table_name = TABLE_DOCUMENT; |
|
6085 | - $link_tool = 'document/document.php'; |
|
6086 | - $id_tool = 'id'; |
|
6087 | - break; |
|
6088 | - case 'learnpath': |
|
6089 | - $table_name = TABLE_LP_MAIN; |
|
6090 | - $link_tool = 'lp/lp_controller.php'; |
|
6091 | - $id_tool = 'id'; |
|
6092 | - break; |
|
6093 | - case 'quiz': |
|
6094 | - $table_name = TABLE_QUIZ_TEST; |
|
6095 | - $link_tool = 'exercise/exercise.php'; |
|
6096 | - $id_tool = 'id'; |
|
6097 | - break; |
|
6098 | - case 'glossary': |
|
6099 | - $table_name = TABLE_GLOSSARY; |
|
6100 | - $link_tool = 'glossary/index.php'; |
|
6101 | - $id_tool = 'glossary_id'; |
|
6102 | - break; |
|
6103 | - case 'link': |
|
6104 | - $table_name = TABLE_LINK; |
|
6105 | - $link_tool = 'link/link.php'; |
|
6106 | - $id_tool = 'id'; |
|
6107 | - break; |
|
6108 | - case 'course_description': |
|
6109 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | - $link_tool = 'course_description/'; |
|
6111 | - $id_tool = 'id'; |
|
6112 | - break; |
|
6113 | - case 'announcement': |
|
6114 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | - $link_tool = 'announcements/announcements.php'; |
|
6116 | - $id_tool = 'id'; |
|
6117 | - break; |
|
6118 | - case 'thematic': |
|
6119 | - $table_name = TABLE_THEMATIC; |
|
6120 | - $link_tool = 'course_progress/index.php'; |
|
6121 | - $id_tool = 'id'; |
|
6122 | - break; |
|
6123 | - case 'thematic_advance': |
|
6124 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | - $link_tool = 'course_progress/index.php'; |
|
6126 | - $id_tool = 'id'; |
|
6127 | - break; |
|
6128 | - case 'thematic_plan': |
|
6129 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | - $link_tool = 'course_progress/index.php'; |
|
6131 | - $id_tool = 'id'; |
|
6132 | - break; |
|
6133 | - default: |
|
6134 | - $table_name = $tool; |
|
6135 | - break; |
|
6136 | - } |
|
6137 | - |
|
6138 | - return array( |
|
6082 | + switch ($tool) { |
|
6083 | + case 'document': |
|
6084 | + $table_name = TABLE_DOCUMENT; |
|
6085 | + $link_tool = 'document/document.php'; |
|
6086 | + $id_tool = 'id'; |
|
6087 | + break; |
|
6088 | + case 'learnpath': |
|
6089 | + $table_name = TABLE_LP_MAIN; |
|
6090 | + $link_tool = 'lp/lp_controller.php'; |
|
6091 | + $id_tool = 'id'; |
|
6092 | + break; |
|
6093 | + case 'quiz': |
|
6094 | + $table_name = TABLE_QUIZ_TEST; |
|
6095 | + $link_tool = 'exercise/exercise.php'; |
|
6096 | + $id_tool = 'id'; |
|
6097 | + break; |
|
6098 | + case 'glossary': |
|
6099 | + $table_name = TABLE_GLOSSARY; |
|
6100 | + $link_tool = 'glossary/index.php'; |
|
6101 | + $id_tool = 'glossary_id'; |
|
6102 | + break; |
|
6103 | + case 'link': |
|
6104 | + $table_name = TABLE_LINK; |
|
6105 | + $link_tool = 'link/link.php'; |
|
6106 | + $id_tool = 'id'; |
|
6107 | + break; |
|
6108 | + case 'course_description': |
|
6109 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | + $link_tool = 'course_description/'; |
|
6111 | + $id_tool = 'id'; |
|
6112 | + break; |
|
6113 | + case 'announcement': |
|
6114 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | + $link_tool = 'announcements/announcements.php'; |
|
6116 | + $id_tool = 'id'; |
|
6117 | + break; |
|
6118 | + case 'thematic': |
|
6119 | + $table_name = TABLE_THEMATIC; |
|
6120 | + $link_tool = 'course_progress/index.php'; |
|
6121 | + $id_tool = 'id'; |
|
6122 | + break; |
|
6123 | + case 'thematic_advance': |
|
6124 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | + $link_tool = 'course_progress/index.php'; |
|
6126 | + $id_tool = 'id'; |
|
6127 | + break; |
|
6128 | + case 'thematic_plan': |
|
6129 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | + $link_tool = 'course_progress/index.php'; |
|
6131 | + $id_tool = 'id'; |
|
6132 | + break; |
|
6133 | + default: |
|
6134 | + $table_name = $tool; |
|
6135 | + break; |
|
6136 | + } |
|
6137 | + |
|
6138 | + return array( |
|
6139 | 6139 | 'table_name' => $table_name, |
6140 | 6140 | 'link_tool' => $link_tool, |
6141 | 6141 | 'id_tool' => $id_tool |
@@ -6144,45 +6144,45 @@ discard block |
||
6144 | 6144 | |
6145 | 6145 | public static function display_additional_profile_fields() |
6146 | 6146 | { |
6147 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | - |
|
6150 | - // creating the form |
|
6151 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | - |
|
6153 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | - // the information the users have entered or selected. |
|
6155 | - $return .= '<select name="additional_profile_field">'; |
|
6156 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | - $extra_fields_to_show = 0; |
|
6158 | - foreach ($extra_fields as $key=>$field) { |
|
6159 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | - if ($field[6]==1 && $field[8] == 1) { |
|
6161 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | - $selected = 'selected="selected"'; |
|
6163 | - } else { |
|
6164 | - $selected = ''; |
|
6165 | - } |
|
6166 | - $extra_fields_to_show++; |
|
6167 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | - } |
|
6169 | - } |
|
6170 | - $return .= '</select>'; |
|
6171 | - |
|
6172 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | - foreach ($_GET as $key=>$value){ |
|
6174 | - if ($key <> 'additional_profile_field') { |
|
6175 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | - } |
|
6177 | - } |
|
6178 | - // the submit button |
|
6179 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | - $return .= '</form>'; |
|
6181 | - if ($extra_fields_to_show > 0) { |
|
6182 | - return $return; |
|
6183 | - } else { |
|
6184 | - return ''; |
|
6185 | - } |
|
6147 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | + |
|
6150 | + // creating the form |
|
6151 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | + |
|
6153 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | + // the information the users have entered or selected. |
|
6155 | + $return .= '<select name="additional_profile_field">'; |
|
6156 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | + $extra_fields_to_show = 0; |
|
6158 | + foreach ($extra_fields as $key=>$field) { |
|
6159 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | + if ($field[6]==1 && $field[8] == 1) { |
|
6161 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | + $selected = 'selected="selected"'; |
|
6163 | + } else { |
|
6164 | + $selected = ''; |
|
6165 | + } |
|
6166 | + $extra_fields_to_show++; |
|
6167 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | + } |
|
6169 | + } |
|
6170 | + $return .= '</select>'; |
|
6171 | + |
|
6172 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | + foreach ($_GET as $key=>$value){ |
|
6174 | + if ($key <> 'additional_profile_field') { |
|
6175 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | + } |
|
6177 | + } |
|
6178 | + // the submit button |
|
6179 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | + $return .= '</form>'; |
|
6181 | + if ($extra_fields_to_show > 0) { |
|
6182 | + return $return; |
|
6183 | + } else { |
|
6184 | + return ''; |
|
6185 | + } |
|
6186 | 6186 | } |
6187 | 6187 | |
6188 | 6188 | /** |
@@ -6201,31 +6201,31 @@ discard block |
||
6201 | 6201 | */ |
6202 | 6202 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6203 | 6203 | { |
6204 | - // Database table definition |
|
6205 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6204 | + // Database table definition |
|
6205 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6207 | 6207 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6208 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | - |
|
6210 | - if (!empty($users)) { |
|
6211 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | - foreach($users as $user_id) { |
|
6213 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | - $tag_list = array(); |
|
6215 | - foreach($user_result as $item) { |
|
6216 | - $tag_list[] = $item['tag']; |
|
6217 | - } |
|
6218 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | - } |
|
6220 | - } else { |
|
6221 | - $new_user_array = array(); |
|
6222 | - foreach ($users as $user_id) { |
|
6223 | - $new_user_array[]= "'".$user_id."'"; |
|
6224 | - } |
|
6225 | - $users = implode(',',$new_user_array); |
|
6208 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | + |
|
6210 | + if (!empty($users)) { |
|
6211 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | + foreach($users as $user_id) { |
|
6213 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | + $tag_list = array(); |
|
6215 | + foreach($user_result as $item) { |
|
6216 | + $tag_list[] = $item['tag']; |
|
6217 | + } |
|
6218 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | + } |
|
6220 | + } else { |
|
6221 | + $new_user_array = array(); |
|
6222 | + foreach ($users as $user_id) { |
|
6223 | + $new_user_array[]= "'".$user_id."'"; |
|
6224 | + } |
|
6225 | + $users = implode(',',$new_user_array); |
|
6226 | 6226 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6227 | - // Selecting only the necessary information NOT ALL the user list |
|
6228 | - $sql = "SELECT user.user_id, v.value |
|
6227 | + // Selecting only the necessary information NOT ALL the user list |
|
6228 | + $sql = "SELECT user.user_id, v.value |
|
6229 | 6229 | FROM $table_user user |
6230 | 6230 | INNER JOIN $table_user_field_values v |
6231 | 6231 | ON (user.user_id = v.item_id) |
@@ -6236,27 +6236,27 @@ discard block |
||
6236 | 6236 | v.field_id=".intval($field_id)." AND |
6237 | 6237 | user.user_id IN ($users)"; |
6238 | 6238 | |
6239 | - $result = Database::query($sql); |
|
6240 | - while($row = Database::fetch_array($result)) { |
|
6241 | - // get option value for field type double select by id |
|
6242 | - if (!empty($row['value'])) { |
|
6243 | - if ($result_extra_field['field_type'] == |
|
6239 | + $result = Database::query($sql); |
|
6240 | + while($row = Database::fetch_array($result)) { |
|
6241 | + // get option value for field type double select by id |
|
6242 | + if (!empty($row['value'])) { |
|
6243 | + if ($result_extra_field['field_type'] == |
|
6244 | 6244 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6245 | 6245 | ) { |
6246 | - $id_double_select = explode(';', $row['value']); |
|
6247 | - if (is_array($id_double_select)) { |
|
6248 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | - $row['value'] = ($value1.';'.$value2); |
|
6251 | - } |
|
6252 | - } |
|
6253 | - } |
|
6254 | - // get other value from extra field |
|
6255 | - $return[$row['user_id']][] = $row['value']; |
|
6256 | - } |
|
6257 | - } |
|
6258 | - } |
|
6259 | - return $return; |
|
6246 | + $id_double_select = explode(';', $row['value']); |
|
6247 | + if (is_array($id_double_select)) { |
|
6248 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | + $row['value'] = ($value1.';'.$value2); |
|
6251 | + } |
|
6252 | + } |
|
6253 | + } |
|
6254 | + // get other value from extra field |
|
6255 | + $return[$row['user_id']][] = $row['value']; |
|
6256 | + } |
|
6257 | + } |
|
6258 | + } |
|
6259 | + return $return; |
|
6260 | 6260 | } |
6261 | 6261 | |
6262 | 6262 | /** |
@@ -6265,18 +6265,18 @@ discard block |
||
6265 | 6265 | */ |
6266 | 6266 | public function count_student_in_course() |
6267 | 6267 | { |
6268 | - global $nbStudents; |
|
6269 | - return $nbStudents; |
|
6268 | + global $nbStudents; |
|
6269 | + return $nbStudents; |
|
6270 | 6270 | } |
6271 | 6271 | |
6272 | 6272 | public function sort_users($a, $b) |
6273 | 6273 | { |
6274 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6274 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | public function sort_users_desc($a, $b) |
6278 | 6278 | { |
6279 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6279 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6285,8 +6285,8 @@ discard block |
||
6285 | 6285 | */ |
6286 | 6286 | public static function get_number_of_users() |
6287 | 6287 | { |
6288 | - global $user_ids; |
|
6289 | - return count($user_ids); |
|
6288 | + global $user_ids; |
|
6289 | + return count($user_ids); |
|
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | /** |
@@ -6302,37 +6302,37 @@ discard block |
||
6302 | 6302 | { |
6303 | 6303 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6304 | 6304 | |
6305 | - $course_code = Database::escape_string($course_code); |
|
6306 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6305 | + $course_code = Database::escape_string($course_code); |
|
6306 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6308 | 6308 | |
6309 | - $access_url_id = api_get_current_access_url_id(); |
|
6309 | + $access_url_id = api_get_current_access_url_id(); |
|
6310 | 6310 | |
6311 | - // get all users data from a course for sortable with limit |
|
6312 | - if (is_array($user_ids)) { |
|
6313 | - $user_ids = array_map('intval', $user_ids); |
|
6314 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | - } else { |
|
6316 | - $user_ids = intval($user_ids); |
|
6317 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | - } |
|
6311 | + // get all users data from a course for sortable with limit |
|
6312 | + if (is_array($user_ids)) { |
|
6313 | + $user_ids = array_map('intval', $user_ids); |
|
6314 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | + } else { |
|
6316 | + $user_ids = intval($user_ids); |
|
6317 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | + } |
|
6319 | 6319 | |
6320 | - if (!empty($_GET['user_keyword'])) { |
|
6321 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | - $condition_user .= " AND ( |
|
6320 | + if (!empty($_GET['user_keyword'])) { |
|
6321 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | + $condition_user .= " AND ( |
|
6323 | 6323 | user.firstname LIKE '%".$keyword."%' OR |
6324 | 6324 | user.lastname LIKE '%".$keyword."%' OR |
6325 | 6325 | user.username LIKE '%".$keyword."%' OR |
6326 | 6326 | user.email LIKE '%".$keyword."%' |
6327 | 6327 | ) "; |
6328 | - } |
|
6328 | + } |
|
6329 | 6329 | |
6330 | 6330 | $url_table = null; |
6331 | 6331 | $url_condition = null; |
6332 | - if (api_is_multiple_url_enabled()) { |
|
6333 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | - } |
|
6332 | + if (api_is_multiple_url_enabled()) { |
|
6333 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | + } |
|
6336 | 6336 | |
6337 | 6337 | $invitedUsersCondition = ''; |
6338 | 6338 | |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6341 | 6341 | } |
6342 | 6342 | |
6343 | - $sql = "SELECT user.user_id as user_id, |
|
6343 | + $sql = "SELECT user.user_id as user_id, |
|
6344 | 6344 | user.official_code as col0, |
6345 | 6345 | user.lastname as col1, |
6346 | 6346 | user.firstname as col2, |
@@ -6348,17 +6348,17 @@ discard block |
||
6348 | 6348 | FROM $tbl_user as user $url_table |
6349 | 6349 | $condition_user $url_condition $invitedUsersCondition"; |
6350 | 6350 | |
6351 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | - $direction = 'ASC'; |
|
6353 | - } |
|
6351 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | + $direction = 'ASC'; |
|
6353 | + } |
|
6354 | 6354 | |
6355 | - $column = intval($column); |
|
6355 | + $column = intval($column); |
|
6356 | 6356 | |
6357 | - $from = intval($from); |
|
6358 | - $number_of_items = intval($number_of_items); |
|
6357 | + $from = intval($from); |
|
6358 | + $number_of_items = intval($number_of_items); |
|
6359 | 6359 | |
6360 | - $sql .= " ORDER BY col$column $direction "; |
|
6361 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6360 | + $sql .= " ORDER BY col$column $direction "; |
|
6361 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6362 | 6362 | |
6363 | 6363 | $res = Database::query($sql); |
6364 | 6364 | $users = array(); |
@@ -6392,7 +6392,7 @@ discard block |
||
6392 | 6392 | } |
6393 | 6393 | } |
6394 | 6394 | |
6395 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6395 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6396 | 6396 | $courseInfo = api_get_course_info($course_code); |
6397 | 6397 | $courseId = $courseInfo['real_id']; |
6398 | 6398 | |
@@ -6423,10 +6423,10 @@ discard block |
||
6423 | 6423 | $session_id |
6424 | 6424 | ); |
6425 | 6425 | |
6426 | - if (empty($avg_student_progress)) { |
|
6426 | + if (empty($avg_student_progress)) { |
|
6427 | 6427 | $avg_student_progress = 0; |
6428 | - } |
|
6429 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6428 | + } |
|
6429 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6430 | 6430 | |
6431 | 6431 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6432 | 6432 | $total_exercises, |
@@ -6446,11 +6446,11 @@ discard block |
||
6446 | 6446 | |
6447 | 6447 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6448 | 6448 | |
6449 | - if (is_numeric($avg_student_score)) { |
|
6450 | - $user['student_score'] = $avg_student_score.'%'; |
|
6451 | - } else { |
|
6452 | - $user['student_score'] = $avg_student_score; |
|
6453 | - } |
|
6449 | + if (is_numeric($avg_student_score)) { |
|
6450 | + $user['student_score'] = $avg_student_score.'%'; |
|
6451 | + } else { |
|
6452 | + $user['student_score'] = $avg_student_score; |
|
6453 | + } |
|
6454 | 6454 | |
6455 | 6455 | $user['count_assignments'] = Tracking::count_student_assignments( |
6456 | 6456 | $user['user_id'], |
@@ -6473,29 +6473,29 @@ discard block |
||
6473 | 6473 | $session_id |
6474 | 6474 | ); |
6475 | 6475 | |
6476 | - // we need to display an additional profile field |
|
6477 | - $user['additional'] = ''; |
|
6476 | + // we need to display an additional profile field |
|
6477 | + $user['additional'] = ''; |
|
6478 | 6478 | |
6479 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6479 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6481 | 6481 | is_array($additional_user_profile_info[$user['user_id']]) |
6482 | 6482 | ) { |
6483 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | - } |
|
6485 | - } |
|
6483 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | + } |
|
6485 | + } |
|
6486 | 6486 | |
6487 | 6487 | if (empty($session_id)) { |
6488 | 6488 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6489 | 6489 | } |
6490 | 6490 | |
6491 | - $user['link'] = '<center> |
|
6491 | + $user['link'] = '<center> |
|
6492 | 6492 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6493 | 6493 | '.Display::return_icon('2rightarrow.png').' |
6494 | 6494 | </a> |
6495 | 6495 | </center>'; |
6496 | 6496 | |
6497 | - // store columns in array $users |
|
6498 | - $is_western_name_order = api_is_western_name_order(); |
|
6497 | + // store columns in array $users |
|
6498 | + $is_western_name_order = api_is_western_name_order(); |
|
6499 | 6499 | $user_row = array(); |
6500 | 6500 | $user_row[]= $user['official_code']; //0 |
6501 | 6501 | if ($is_western_name_order) { |
@@ -6531,21 +6531,21 @@ discard block |
||
6531 | 6531 | |
6532 | 6532 | $users[] = $user_row; |
6533 | 6533 | |
6534 | - if ($export_csv) { |
|
6535 | - if (empty($session_id)) { |
|
6534 | + if ($export_csv) { |
|
6535 | + if (empty($session_id)) { |
|
6536 | 6536 | $user_row = array_map('strip_tags', $user_row); |
6537 | - unset($user_row[14]); |
|
6538 | - unset($user_row[15]); |
|
6537 | + unset($user_row[14]); |
|
6538 | + unset($user_row[15]); |
|
6539 | 6539 | } else { |
6540 | 6540 | $user_row = array_map('strip_tags', $user_row); |
6541 | 6541 | unset($user_row[13]); |
6542 | 6542 | unset($user_row[14]); |
6543 | 6543 | } |
6544 | 6544 | |
6545 | - $csv_content[] = $user_row; |
|
6546 | - } |
|
6547 | - } |
|
6548 | - return $users; |
|
6545 | + $csv_content[] = $user_row; |
|
6546 | + } |
|
6547 | + } |
|
6548 | + return $users; |
|
6549 | 6549 | } |
6550 | 6550 | } |
6551 | 6551 | |
@@ -6563,18 +6563,18 @@ discard block |
||
6563 | 6563 | */ |
6564 | 6564 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6565 | 6565 | { |
6566 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | - |
|
6568 | - // protected data |
|
6569 | - $user_id = intval($user_id); |
|
6570 | - $session_id = intval($session_id); |
|
6571 | - $course_id = Database::escape_string($course_id); |
|
6572 | - |
|
6573 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | - $tempView = $view; |
|
6575 | - if(substr($view,0,1) == '1') { |
|
6576 | - $new_view = substr_replace($view,'0',0,1); |
|
6577 | - echo " |
|
6566 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | + |
|
6568 | + // protected data |
|
6569 | + $user_id = intval($user_id); |
|
6570 | + $session_id = intval($session_id); |
|
6571 | + $course_id = Database::escape_string($course_id); |
|
6572 | + |
|
6573 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | + $tempView = $view; |
|
6575 | + if(substr($view,0,1) == '1') { |
|
6576 | + $new_view = substr_replace($view,'0',0,1); |
|
6577 | + echo " |
|
6578 | 6578 | <tr> |
6579 | 6579 | <td valign='top'> |
6580 | 6580 | <font color='#0000FF'>- </font>" . |
@@ -6582,9 +6582,9 @@ discard block |
||
6582 | 6582 | </td> |
6583 | 6583 | </tr> |
6584 | 6584 | "; |
6585 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6585 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6586 | 6586 | |
6587 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6587 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6588 | 6588 | FROM $track_access_table |
6589 | 6589 | WHERE access_user_id = $user_id |
6590 | 6590 | AND c_id = $course_id |
@@ -6592,11 +6592,11 @@ discard block |
||
6592 | 6592 | GROUP BY YEAR(access_date),MONTH(access_date) |
6593 | 6593 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6594 | 6594 | |
6595 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | - $results = getManyResults3Col($sql); |
|
6595 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | + $results = getManyResults3Col($sql); |
|
6597 | 6597 | |
6598 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | - echo "<tr> |
|
6598 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | + echo "<tr> |
|
6600 | 6600 | <td class='secLine'> |
6601 | 6601 | ".get_lang('LoginsTitleMonthColumn')." |
6602 | 6602 | </td> |
@@ -6604,36 +6604,36 @@ discard block |
||
6604 | 6604 | ".get_lang('LoginsTitleCountColumn')." |
6605 | 6605 | </td> |
6606 | 6606 | </tr>"; |
6607 | - $total = 0; |
|
6608 | - if (is_array($results)) { |
|
6609 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | - echo "<tr>"; |
|
6611 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6612 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | - echo"</tr>"; |
|
6614 | - $total = $total + $results[$j][1]; |
|
6615 | - } |
|
6616 | - echo "<tr>"; |
|
6617 | - echo "<td>".get_lang('Total')."</td>"; |
|
6618 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | - echo"</tr>"; |
|
6620 | - } else { |
|
6621 | - echo "<tr>"; |
|
6622 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | - echo"</tr>"; |
|
6624 | - } |
|
6625 | - echo "</table>"; |
|
6626 | - echo "</td></tr>"; |
|
6627 | - } else { |
|
6628 | - $new_view = substr_replace($view,'1',0,1); |
|
6629 | - echo " |
|
6607 | + $total = 0; |
|
6608 | + if (is_array($results)) { |
|
6609 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | + echo "<tr>"; |
|
6611 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6612 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | + echo"</tr>"; |
|
6614 | + $total = $total + $results[$j][1]; |
|
6615 | + } |
|
6616 | + echo "<tr>"; |
|
6617 | + echo "<td>".get_lang('Total')."</td>"; |
|
6618 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | + echo"</tr>"; |
|
6620 | + } else { |
|
6621 | + echo "<tr>"; |
|
6622 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | + echo"</tr>"; |
|
6624 | + } |
|
6625 | + echo "</table>"; |
|
6626 | + echo "</td></tr>"; |
|
6627 | + } else { |
|
6628 | + $new_view = substr_replace($view,'1',0,1); |
|
6629 | + echo " |
|
6630 | 6630 | <tr> |
6631 | 6631 | <td valign='top'> |
6632 | 6632 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6633 | 6633 | </td> |
6634 | 6634 | </tr> |
6635 | 6635 | "; |
6636 | - } |
|
6636 | + } |
|
6637 | 6637 | } |
6638 | 6638 | |
6639 | 6639 | /** |
@@ -6646,38 +6646,38 @@ discard block |
||
6646 | 6646 | */ |
6647 | 6647 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
6648 | 6648 | { |
6649 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6649 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6650 | 6650 | $courseId = api_get_course_int_id($courseCode); |
6651 | - if(substr($view,1,1) == '1') { |
|
6652 | - $new_view = substr_replace($view,'0',1,1); |
|
6653 | - echo "<tr> |
|
6651 | + if(substr($view,1,1) == '1') { |
|
6652 | + $new_view = substr_replace($view,'0',1,1); |
|
6653 | + echo "<tr> |
|
6654 | 6654 | <td valign='top'> |
6655 | 6655 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
6656 | 6656 | </td> |
6657 | 6657 | </tr>"; |
6658 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6658 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6659 | 6659 | |
6660 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6660 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6661 | 6661 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6662 | 6662 | WHERE te.c_id = $courseId |
6663 | 6663 | AND te.exe_user_id = ".intval($user_id)." |
6664 | 6664 | AND te.exe_exo_id = ce.id |
6665 | 6665 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6666 | 6666 | |
6667 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6667 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6668 | 6668 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6669 | 6669 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6670 | 6670 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6671 | 6671 | |
6672 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6672 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6673 | 6673 | |
6674 | - $NoTestRes = 0; |
|
6675 | - $NoHPTestRes = 0; |
|
6674 | + $NoTestRes = 0; |
|
6675 | + $NoHPTestRes = 0; |
|
6676 | 6676 | |
6677 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | - echo " |
|
6677 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | + echo " |
|
6681 | 6681 | <tr bgcolor='#E6E6E6'> |
6682 | 6682 | <td> |
6683 | 6683 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6690,28 +6690,28 @@ discard block |
||
6690 | 6690 | </td> |
6691 | 6691 | </tr>"; |
6692 | 6692 | |
6693 | - if (is_array($results)) { |
|
6694 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | - echo "<tr>\n"; |
|
6697 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | - echo "</tr>\n"; |
|
6701 | - } |
|
6702 | - } else { |
|
6703 | - // istvan begin |
|
6704 | - $NoTestRes = 1; |
|
6705 | - } |
|
6706 | - |
|
6707 | - // The Result of Tests |
|
6708 | - if (is_array($hpresults)) { |
|
6709 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | - if ($title == '') |
|
6712 | - $title = basename($hpresults[$i][0]); |
|
6713 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | - ?> |
|
6693 | + if (is_array($results)) { |
|
6694 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | + echo "<tr>\n"; |
|
6697 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | + echo "</tr>\n"; |
|
6701 | + } |
|
6702 | + } else { |
|
6703 | + // istvan begin |
|
6704 | + $NoTestRes = 1; |
|
6705 | + } |
|
6706 | + |
|
6707 | + // The Result of Tests |
|
6708 | + if (is_array($hpresults)) { |
|
6709 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | + if ($title == '') |
|
6712 | + $title = basename($hpresults[$i][0]); |
|
6713 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | + ?> |
|
6715 | 6715 | <tr> |
6716 | 6716 | <td class="content"><?php echo $title; ?></td> |
6717 | 6717 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6721,26 +6721,26 @@ discard block |
||
6721 | 6721 | |
6722 | 6722 | <?php |
6723 | 6723 | } |
6724 | - } else { |
|
6725 | - $NoHPTestRes = 1; |
|
6726 | - } |
|
6727 | - |
|
6728 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | - echo "<tr>\n"; |
|
6730 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | - echo "</tr>\n"; |
|
6732 | - } |
|
6733 | - echo "</table>"; |
|
6734 | - echo "</td>\n</tr>\n"; |
|
6735 | - } else { |
|
6736 | - $new_view = substr_replace($view,'1',1,1); |
|
6737 | - echo " |
|
6724 | + } else { |
|
6725 | + $NoHPTestRes = 1; |
|
6726 | + } |
|
6727 | + |
|
6728 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | + echo "<tr>\n"; |
|
6730 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | + echo "</tr>\n"; |
|
6732 | + } |
|
6733 | + echo "</table>"; |
|
6734 | + echo "</td>\n</tr>\n"; |
|
6735 | + } else { |
|
6736 | + $new_view = substr_replace($view,'1',1,1); |
|
6737 | + echo " |
|
6738 | 6738 | <tr> |
6739 | 6739 | <td valign='top'> |
6740 | 6740 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6741 | 6741 | </td> |
6742 | 6742 | </tr>"; |
6743 | - } |
|
6743 | + } |
|
6744 | 6744 | } |
6745 | 6745 | |
6746 | 6746 | /** |
@@ -6749,27 +6749,27 @@ discard block |
||
6749 | 6749 | */ |
6750 | 6750 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
6751 | 6751 | { |
6752 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6752 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6753 | 6753 | $_course = api_get_course_info_by_id($course_id); |
6754 | 6754 | |
6755 | - if (substr($view,2,1) == '1') { |
|
6756 | - $new_view = substr_replace($view,'0',2,1); |
|
6757 | - echo "<tr> |
|
6755 | + if (substr($view,2,1) == '1') { |
|
6756 | + $new_view = substr_replace($view,'0',2,1); |
|
6757 | + echo "<tr> |
|
6758 | 6758 | <td valign='top'> |
6759 | 6759 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
6760 | 6760 | </td> |
6761 | 6761 | </tr>"; |
6762 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6762 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6764 | 6764 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6765 | 6765 | WHERE u.upload_work_id = w.id |
6766 | 6766 | AND u.upload_user_id = '".intval($user_id)."' |
6767 | 6767 | AND u.c_id = '".intval($course_id)."' |
6768 | 6768 | ORDER BY u.upload_date DESC"; |
6769 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | - echo "<tr> |
|
6769 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | + echo "<tr> |
|
6773 | 6773 | <td class='secLine' width='40%'> |
6774 | 6774 | ".get_lang('WorkTitle')." |
6775 | 6775 | </td> |
@@ -6780,35 +6780,35 @@ discard block |
||
6780 | 6780 | ".get_lang('Date')." |
6781 | 6781 | </td> |
6782 | 6782 | </tr>"; |
6783 | - if (is_array($results)) { |
|
6784 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | - echo "<tr>"; |
|
6788 | - echo "<td class='content'>" |
|
6789 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | - ."</td>"; |
|
6791 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | - echo"</tr>"; |
|
6794 | - } |
|
6795 | - } else { |
|
6796 | - echo "<tr>"; |
|
6797 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | - echo"</tr>"; |
|
6799 | - } |
|
6800 | - echo "</table>"; |
|
6801 | - echo "</td></tr>"; |
|
6802 | - } else { |
|
6803 | - $new_view = substr_replace($view,'1',2,1); |
|
6804 | - echo " |
|
6783 | + if (is_array($results)) { |
|
6784 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | + echo "<tr>"; |
|
6788 | + echo "<td class='content'>" |
|
6789 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | + ."</td>"; |
|
6791 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | + echo"</tr>"; |
|
6794 | + } |
|
6795 | + } else { |
|
6796 | + echo "<tr>"; |
|
6797 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | + echo"</tr>"; |
|
6799 | + } |
|
6800 | + echo "</table>"; |
|
6801 | + echo "</td></tr>"; |
|
6802 | + } else { |
|
6803 | + $new_view = substr_replace($view,'1',2,1); |
|
6804 | + echo " |
|
6805 | 6805 | <tr> |
6806 | 6806 | <td valign='top'> |
6807 | 6807 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
6808 | 6808 | </td> |
6809 | 6809 | </tr> |
6810 | 6810 | "; |
6811 | - } |
|
6811 | + } |
|
6812 | 6812 | } |
6813 | 6813 | |
6814 | 6814 | /** |
@@ -6817,55 +6817,55 @@ discard block |
||
6817 | 6817 | */ |
6818 | 6818 | public function display_links_tracking_info($view, $user_id, $courseCode) |
6819 | 6819 | { |
6820 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6820 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6821 | 6821 | $courseId = api_get_course_int_id($courseCode); |
6822 | - if (substr($view,3,1) == '1') { |
|
6823 | - $new_view = substr_replace($view,'0',3,1); |
|
6824 | - echo " |
|
6822 | + if (substr($view,3,1) == '1') { |
|
6823 | + $new_view = substr_replace($view,'0',3,1); |
|
6824 | + echo " |
|
6825 | 6825 | <tr> |
6826 | 6826 | <td valign='top'> |
6827 | 6827 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
6828 | 6828 | </td> |
6829 | 6829 | </tr> |
6830 | 6830 | "; |
6831 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | - $sql = "SELECT cl.title, cl.url |
|
6831 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | + $sql = "SELECT cl.title, cl.url |
|
6833 | 6833 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
6834 | 6834 | WHERE sl.links_link_id = cl.id |
6835 | 6835 | AND sl.c_id = $courseId |
6836 | 6836 | AND sl.links_user_id = ".intval($user_id)." |
6837 | 6837 | GROUP BY cl.title, cl.url"; |
6838 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | - $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | - echo "<tr> |
|
6838 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | + $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | + echo "<tr> |
|
6842 | 6842 | <td class='secLine'> |
6843 | 6843 | ".get_lang('LinksTitleLinkColumn')." |
6844 | 6844 | </td> |
6845 | 6845 | </tr>"; |
6846 | - if (is_array($results)) { |
|
6847 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | - echo "<tr>"; |
|
6849 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | - echo"</tr>"; |
|
6851 | - } |
|
6852 | - } else { |
|
6853 | - echo "<tr>"; |
|
6854 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | - echo"</tr>"; |
|
6856 | - } |
|
6857 | - echo "</table>"; |
|
6858 | - echo "</td></tr>"; |
|
6859 | - } else { |
|
6860 | - $new_view = substr_replace($view,'1',3,1); |
|
6861 | - echo " |
|
6846 | + if (is_array($results)) { |
|
6847 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | + echo "<tr>"; |
|
6849 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | + echo"</tr>"; |
|
6851 | + } |
|
6852 | + } else { |
|
6853 | + echo "<tr>"; |
|
6854 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | + echo"</tr>"; |
|
6856 | + } |
|
6857 | + echo "</table>"; |
|
6858 | + echo "</td></tr>"; |
|
6859 | + } else { |
|
6860 | + $new_view = substr_replace($view,'1',3,1); |
|
6861 | + echo " |
|
6862 | 6862 | <tr> |
6863 | 6863 | <td valign='top'> |
6864 | 6864 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
6865 | 6865 | </td> |
6866 | 6866 | </tr> |
6867 | 6867 | "; |
6868 | - } |
|
6868 | + } |
|
6869 | 6869 | } |
6870 | 6870 | |
6871 | 6871 | /** |
@@ -6878,61 +6878,61 @@ discard block |
||
6878 | 6878 | */ |
6879 | 6879 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
6880 | 6880 | { |
6881 | - // protect data |
|
6881 | + // protect data |
|
6882 | 6882 | $user_id = intval($user_id); |
6883 | 6883 | $courseId = api_get_course_int_id($course_code); |
6884 | - $session_id = intval($session_id); |
|
6884 | + $session_id = intval($session_id); |
|
6885 | 6885 | |
6886 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | - if(substr($view,4,1) == '1') { |
|
6888 | - $new_view = substr_replace($view,'0',4,1); |
|
6889 | - echo " |
|
6886 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | + if(substr($view,4,1) == '1') { |
|
6888 | + $new_view = substr_replace($view,'0',4,1); |
|
6889 | + echo " |
|
6890 | 6890 | <tr> |
6891 | 6891 | <td valign='top'> |
6892 | 6892 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
6893 | 6893 | </td> |
6894 | 6894 | </tr> |
6895 | 6895 | "; |
6896 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6896 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6897 | 6897 | |
6898 | - $sql = "SELECT down_doc_path |
|
6898 | + $sql = "SELECT down_doc_path |
|
6899 | 6899 | FROM $downloads_table |
6900 | 6900 | WHERE c_id = $courseId |
6901 | 6901 | AND down_user_id = $user_id |
6902 | 6902 | AND down_session_id = $session_id |
6903 | 6903 | GROUP BY down_doc_path"; |
6904 | 6904 | |
6905 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | - $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | - echo "<tr> |
|
6905 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | + $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | + echo "<tr> |
|
6909 | 6909 | <td class='secLine'> |
6910 | 6910 | ".get_lang('DocumentsTitleDocumentColumn')." |
6911 | 6911 | </td> |
6912 | 6912 | </tr>"; |
6913 | - if (is_array($results)) { |
|
6914 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | - echo "<tr>"; |
|
6916 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | - echo"</tr>"; |
|
6918 | - } |
|
6919 | - } else { |
|
6920 | - echo "<tr>"; |
|
6921 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | - echo"</tr>"; |
|
6923 | - } |
|
6924 | - echo "</table>"; |
|
6925 | - echo "</td></tr>"; |
|
6926 | - } else { |
|
6927 | - $new_view = substr_replace($view,'1',4,1); |
|
6928 | - echo " |
|
6913 | + if (is_array($results)) { |
|
6914 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | + echo "<tr>"; |
|
6916 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | + echo"</tr>"; |
|
6918 | + } |
|
6919 | + } else { |
|
6920 | + echo "<tr>"; |
|
6921 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | + echo"</tr>"; |
|
6923 | + } |
|
6924 | + echo "</table>"; |
|
6925 | + echo "</td></tr>"; |
|
6926 | + } else { |
|
6927 | + $new_view = substr_replace($view,'1',4,1); |
|
6928 | + echo " |
|
6929 | 6929 | <tr> |
6930 | 6930 | <td valign='top'> |
6931 | 6931 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
6932 | 6932 | </td> |
6933 | 6933 | </tr> |
6934 | 6934 | "; |
6935 | - } |
|
6935 | + } |
|
6936 | 6936 | } |
6937 | 6937 | |
6938 | 6938 | /** |
@@ -6989,43 +6989,43 @@ discard block |
||
6989 | 6989 | */ |
6990 | 6990 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6991 | { |
6992 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | - |
|
6995 | - // protected data |
|
6996 | - $user_id = intval($user_id); |
|
6997 | - $session_id = intval($session_id); |
|
6998 | - $course_id = intval($course_id); |
|
6999 | - |
|
7000 | - $tempView = $view; |
|
7001 | - if (substr($view,0,1) == '1') { |
|
7002 | - $new_view = substr_replace($view,'0',0,1); |
|
7003 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6992 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | + |
|
6995 | + // protected data |
|
6996 | + $user_id = intval($user_id); |
|
6997 | + $session_id = intval($session_id); |
|
6998 | + $course_id = intval($course_id); |
|
6999 | + |
|
7000 | + $tempView = $view; |
|
7001 | + if (substr($view,0,1) == '1') { |
|
7002 | + $new_view = substr_replace($view,'0',0,1); |
|
7003 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7005 | 7005 | FROM $track_access_table |
7006 | 7006 | WHERE access_user_id = $user_id |
7007 | 7007 | AND c_id = $course_id |
7008 | 7008 | AND access_session_id = $session_id |
7009 | 7009 | GROUP BY YEAR(access_date),MONTH(access_date) |
7010 | 7010 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7011 | - //$results = getManyResults2Col($sql); |
|
7012 | - $results = getManyResults3Col($sql); |
|
7013 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | - $line=''; |
|
7015 | - $total = 0; |
|
7016 | - if (is_array($results)) { |
|
7017 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | - $total = $total + $results[$j][1]; |
|
7020 | - } |
|
7021 | - $line .= get_lang('Total').";".$total."\n"; |
|
7022 | - } else { |
|
7023 | - $line= get_lang('NoResult')."</center></td>"; |
|
7024 | - } |
|
7025 | - } else { |
|
7026 | - $new_view = substr_replace($view,'1',0,1); |
|
7027 | - } |
|
7028 | - return array($title_line, $line); |
|
7011 | + //$results = getManyResults2Col($sql); |
|
7012 | + $results = getManyResults3Col($sql); |
|
7013 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | + $line=''; |
|
7015 | + $total = 0; |
|
7016 | + if (is_array($results)) { |
|
7017 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | + $total = $total + $results[$j][1]; |
|
7020 | + } |
|
7021 | + $line .= get_lang('Total').";".$total."\n"; |
|
7022 | + } else { |
|
7023 | + $line= get_lang('NoResult')."</center></td>"; |
|
7024 | + } |
|
7025 | + } else { |
|
7026 | + $new_view = substr_replace($view,'1',0,1); |
|
7027 | + } |
|
7028 | + return array($title_line, $line); |
|
7029 | 7029 | } |
7030 | 7030 | |
7031 | 7031 | /** |
@@ -7038,67 +7038,67 @@ discard block |
||
7038 | 7038 | */ |
7039 | 7039 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
7040 | 7040 | { |
7041 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7041 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7042 | 7042 | $courseId = api_get_course_int_id($courseCode); |
7043 | 7043 | $userId = intval($userId); |
7044 | - if (substr($view,1,1) == '1') { |
|
7045 | - $new_view = substr_replace($view,'0',1,1); |
|
7046 | - $title[1] = get_lang('ExercicesDetails'); |
|
7047 | - $line = ''; |
|
7048 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7044 | + if (substr($view,1,1) == '1') { |
|
7045 | + $new_view = substr_replace($view,'0',1,1); |
|
7046 | + $title[1] = get_lang('ExercicesDetails'); |
|
7047 | + $line = ''; |
|
7048 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7049 | 7049 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
7050 | 7050 | WHERE te.c_id = $courseId |
7051 | 7051 | AND te.exe_user_id = $userId |
7052 | 7052 | AND te.exe_exo_id = ce.id |
7053 | 7053 | ORDER BY ce.title ASC, te.exe_date ASC"; |
7054 | 7054 | |
7055 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7055 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7056 | 7056 | FROM $TABLETRACK_HOTPOTATOES AS te |
7057 | 7057 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
7058 | 7058 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
7059 | 7059 | |
7060 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7060 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7061 | 7061 | |
7062 | - $NoTestRes = 0; |
|
7063 | - $NoHPTestRes = 0; |
|
7062 | + $NoTestRes = 0; |
|
7063 | + $NoHPTestRes = 0; |
|
7064 | 7064 | |
7065 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7065 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7067 | 7067 | |
7068 | - if (is_array($results)) { |
|
7069 | - for($i = 0; $i < sizeof($results); $i++) |
|
7070 | - { |
|
7071 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | - } |
|
7074 | - } else { |
|
7068 | + if (is_array($results)) { |
|
7069 | + for($i = 0; $i < sizeof($results); $i++) |
|
7070 | + { |
|
7071 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | + } |
|
7074 | + } else { |
|
7075 | 7075 | // istvan begin |
7076 | - $NoTestRes = 1; |
|
7077 | - } |
|
7078 | - |
|
7079 | - // The Result of Tests |
|
7080 | - if (is_array($hpresults)) { |
|
7081 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | - |
|
7084 | - if ($title == '') |
|
7085 | - $title = basename($hpresults[$i][0]); |
|
7086 | - |
|
7087 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | - |
|
7089 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | - } |
|
7091 | - } else { |
|
7092 | - $NoHPTestRes = 1; |
|
7093 | - } |
|
7094 | - |
|
7095 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | - $line=get_lang('NoResult'); |
|
7097 | - } |
|
7098 | - } else { |
|
7099 | - $new_view = substr_replace($view,'1',1,1); |
|
7100 | - } |
|
7101 | - return array($title_line, $line); |
|
7076 | + $NoTestRes = 1; |
|
7077 | + } |
|
7078 | + |
|
7079 | + // The Result of Tests |
|
7080 | + if (is_array($hpresults)) { |
|
7081 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | + $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | + |
|
7084 | + if ($title == '') |
|
7085 | + $title = basename($hpresults[$i][0]); |
|
7086 | + |
|
7087 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | + |
|
7089 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | + } |
|
7091 | + } else { |
|
7092 | + $NoHPTestRes = 1; |
|
7093 | + } |
|
7094 | + |
|
7095 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | + $line=get_lang('NoResult'); |
|
7097 | + } |
|
7098 | + } else { |
|
7099 | + $new_view = substr_replace($view,'1',1,1); |
|
7100 | + } |
|
7101 | + return array($title_line, $line); |
|
7102 | 7102 | } |
7103 | 7103 | |
7104 | 7104 | /** |
@@ -7107,37 +7107,37 @@ discard block |
||
7107 | 7107 | */ |
7108 | 7108 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7109 | 7109 | { |
7110 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7110 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7111 | 7111 | $_course = api_get_course_info(); |
7112 | 7112 | $user_id = intval($user_id); |
7113 | 7113 | $course_id = intval($course_id); |
7114 | 7114 | |
7115 | - if (substr($view,2,1) == '1') { |
|
7116 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7115 | + if (substr($view,2,1) == '1') { |
|
7116 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7117 | 7117 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7118 | 7118 | WHERE |
7119 | 7119 | u.upload_work_id = w.id AND |
7120 | 7120 | u.upload_user_id = '$user_id' AND |
7121 | 7121 | u.c_id = '$course_id' |
7122 | 7122 | ORDER BY u.upload_date DESC"; |
7123 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | - |
|
7125 | - $title[1]=get_lang('WorksDetails'); |
|
7126 | - $line=''; |
|
7127 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | - |
|
7129 | - if (is_array($results)) { |
|
7130 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | - } |
|
7135 | - |
|
7136 | - } else { |
|
7137 | - $line= get_lang('NoResult'); |
|
7138 | - } |
|
7139 | - } |
|
7140 | - return array($title_line, $line); |
|
7123 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | + |
|
7125 | + $title[1]=get_lang('WorksDetails'); |
|
7126 | + $line=''; |
|
7127 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | + |
|
7129 | + if (is_array($results)) { |
|
7130 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | + } |
|
7135 | + |
|
7136 | + } else { |
|
7137 | + $line= get_lang('NoResult'); |
|
7138 | + } |
|
7139 | + } |
|
7140 | + return array($title_line, $line); |
|
7141 | 7141 | } |
7142 | 7142 | |
7143 | 7143 | /** |
@@ -7146,32 +7146,32 @@ discard block |
||
7146 | 7146 | */ |
7147 | 7147 | public function display_links_tracking_info($view, $userId, $courseCode) |
7148 | 7148 | { |
7149 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7149 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7150 | 7150 | $courseId = api_get_course_int_id($courseCode); |
7151 | 7151 | $userId = intval($userId); |
7152 | 7152 | $line = null; |
7153 | - if (substr($view,3,1) == '1') { |
|
7154 | - $new_view = substr_replace($view,'0',3,1); |
|
7155 | - $title[1]=get_lang('LinksDetails'); |
|
7156 | - $sql = "SELECT cl.title, cl.url |
|
7153 | + if (substr($view,3,1) == '1') { |
|
7154 | + $new_view = substr_replace($view,'0',3,1); |
|
7155 | + $title[1]=get_lang('LinksDetails'); |
|
7156 | + $sql = "SELECT cl.title, cl.url |
|
7157 | 7157 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7158 | 7158 | WHERE sl.links_link_id = cl.id |
7159 | 7159 | AND sl.c_id = $courseId |
7160 | 7160 | AND sl.links_user_id = $userId |
7161 | 7161 | GROUP BY cl.title, cl.url"; |
7162 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | - if (is_array($results)) { |
|
7165 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | - $line .= $results[$j][0]."\n"; |
|
7167 | - } |
|
7168 | - } else { |
|
7169 | - $line=get_lang('NoResult'); |
|
7170 | - } |
|
7171 | - } else { |
|
7172 | - $new_view = substr_replace($view,'1',3,1); |
|
7173 | - } |
|
7174 | - return array($title_line, $line); |
|
7162 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | + if (is_array($results)) { |
|
7165 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | + $line .= $results[$j][0]."\n"; |
|
7167 | + } |
|
7168 | + } else { |
|
7169 | + $line=get_lang('NoResult'); |
|
7170 | + } |
|
7171 | + } else { |
|
7172 | + $new_view = substr_replace($view,'1',3,1); |
|
7173 | + } |
|
7174 | + return array($title_line, $line); |
|
7175 | 7175 | } |
7176 | 7176 | |
7177 | 7177 | /** |
@@ -7184,38 +7184,38 @@ discard block |
||
7184 | 7184 | */ |
7185 | 7185 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7186 | 7186 | { |
7187 | - // protect data |
|
7188 | - $user_id = intval($user_id); |
|
7187 | + // protect data |
|
7188 | + $user_id = intval($user_id); |
|
7189 | 7189 | $courseId = api_get_course_int_id($courseCode); |
7190 | - $session_id = intval($session_id); |
|
7190 | + $session_id = intval($session_id); |
|
7191 | 7191 | |
7192 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7192 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7193 | 7193 | |
7194 | - if (substr($view,4,1) == '1') { |
|
7195 | - $new_view = substr_replace($view,'0',4,1); |
|
7196 | - $title[1]= get_lang('DocumentsDetails'); |
|
7194 | + if (substr($view,4,1) == '1') { |
|
7195 | + $new_view = substr_replace($view,'0',4,1); |
|
7196 | + $title[1]= get_lang('DocumentsDetails'); |
|
7197 | 7197 | |
7198 | - $sql = "SELECT down_doc_path |
|
7198 | + $sql = "SELECT down_doc_path |
|
7199 | 7199 | FROM $downloads_table |
7200 | 7200 | WHERE c_id = $courseId |
7201 | 7201 | AND down_user_id = $user_id |
7202 | 7202 | AND down_session_id = $session_id |
7203 | 7203 | GROUP BY down_doc_path"; |
7204 | 7204 | |
7205 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7205 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7207 | 7207 | $line = null; |
7208 | - if (is_array($results)) { |
|
7209 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | - $line .= $results[$j]."\n"; |
|
7211 | - } |
|
7212 | - } else { |
|
7213 | - $line = get_lang('NoResult'); |
|
7214 | - } |
|
7215 | - } else { |
|
7216 | - $new_view = substr_replace($view,'1',4,1); |
|
7217 | - } |
|
7218 | - return array($title_line, $line); |
|
7208 | + if (is_array($results)) { |
|
7209 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | + $line .= $results[$j]."\n"; |
|
7211 | + } |
|
7212 | + } else { |
|
7213 | + $line = get_lang('NoResult'); |
|
7214 | + } |
|
7215 | + } else { |
|
7216 | + $new_view = substr_replace($view,'1',4,1); |
|
7217 | + } |
|
7218 | + return array($title_line, $line); |
|
7219 | 7219 | } |
7220 | 7220 | |
7221 | 7221 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $extendedAttempt = null, |
115 | 115 | $extendedAll = null, |
116 | 116 | $type = 'classic', |
117 | - $allowExtend = true |
|
117 | + $allowExtend = true |
|
118 | 118 | ) { |
119 | 119 | if (empty($courseInfo) || empty($lp_id)) { |
120 | 120 | return null; |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | $extend_all = 0; |
139 | 139 | |
140 | 140 | if ($origin == 'tracking') { |
141 | - $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; |
|
141 | + $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin; |
|
142 | 142 | } else { |
143 | - $url_suffix = '&lp_id=' . $lp_id; |
|
143 | + $url_suffix = '&lp_id='.$lp_id; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | if (!empty($extendedAll)) { |
147 | 147 | $extend_all_link = Display::url( |
148 | 148 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
149 | - api_get_self() . '?action=stats' . $url_suffix |
|
149 | + api_get_self().'?action=stats'.$url_suffix |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | $extend_all = 1; |
153 | 153 | } else { |
154 | 154 | $extend_all_link = Display::url( |
155 | 155 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), |
156 | - api_get_self() . '?action=stats&extend_all=1' . $url_suffix |
|
156 | + api_get_self().'?action=stats&extend_all=1'.$url_suffix |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | |
166 | 166 | $actionColumn = null; |
167 | 167 | if ($type == 'classic') { |
168 | - $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; |
|
168 | + $actionColumn = ' <th>'.get_lang('Actions').'</th>'; |
|
169 | 169 | } |
170 | 170 | $output .= '<div class="table-responsive">'; |
171 | 171 | $output .= '<table class="table tracking"> |
172 | 172 | <thead> |
173 | 173 | <tr class="table-header"> |
174 | - <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> |
|
174 | + <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ').'</th> |
|
175 | 175 | <th colspan="4"> |
176 | - ' . get_lang('ScormLessonTitle') .' |
|
176 | + ' . get_lang('ScormLessonTitle').' |
|
177 | 177 | </th> |
178 | 178 | <th colspan="2"> |
179 | - ' . get_lang('ScormStatus') . ' |
|
179 | + ' . get_lang('ScormStatus').' |
|
180 | 180 | </th> |
181 | 181 | <th colspan="2"> |
182 | - ' . get_lang('ScormScore') . ' |
|
182 | + ' . get_lang('ScormScore').' |
|
183 | 183 | </th> |
184 | 184 | <th colspan="2"> |
185 | - ' . get_lang('ScormTime') . ' |
|
185 | + ' . get_lang('ScormTime').' |
|
186 | 186 | </th> |
187 | 187 | '.$actionColumn.' |
188 | 188 | </tr> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | // Prepare statement to go through each attempt. |
246 | 246 | $viewCondition = null; |
247 | 247 | if (!empty($view)) { |
248 | - $viewCondition = " AND v.view_count = $view "; |
|
248 | + $viewCondition = " AND v.view_count = $view "; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | $sql = "SELECT |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | FROM $TBL_QUIZ |
294 | 294 | WHERE |
295 | 295 | c_id = $course_id AND |
296 | - id ='" . $my_path . "'"; |
|
296 | + id ='".$my_path."'"; |
|
297 | 297 | $res_result_disabled = Database::query($sql); |
298 | 298 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
299 | 299 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | if (!empty($inter_num)) { |
316 | 316 | $extend_link = Display::url( |
317 | 317 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
318 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
318 | + api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix |
|
319 | 319 | ); |
320 | 320 | } |
321 | 321 | $title = $row['mytitle']; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $action = null; |
335 | 335 | if ($type == 'classic') { |
336 | - $action = '<td></td>'; |
|
336 | + $action = '<td></td>'; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | if (in_array($row['item_type'], $chapterTypes)) { |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | $extend_this_attempt = 1; |
378 | 378 | $extend_attempt_link = Display::url( |
379 | 379 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
380 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
380 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
381 | 381 | ); |
382 | 382 | } else { // Same case if fold_attempt_id is set, so not implemented explicitly. |
383 | 383 | // The extend button for this attempt has not been clicked. |
384 | 384 | $extend_attempt_link = Display::url( |
385 | 385 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
386 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
386 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
387 | 387 | ); |
388 | 388 | } |
389 | 389 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | // Remove "NaN" if any (@todo: locate the source of these NaN) |
419 | - $time = str_replace('NaN', '00' . $h . '00\'00"', $time); |
|
419 | + $time = str_replace('NaN', '00'.$h.'00\'00"', $time); |
|
420 | 420 | |
421 | 421 | if ($row['item_type'] != 'dir') { |
422 | 422 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
@@ -444,13 +444,13 @@ discard block |
||
444 | 444 | $action = '<td></td>'; |
445 | 445 | } |
446 | 446 | |
447 | - $output .= '<tr class="' . $oddclass . '"> |
|
447 | + $output .= '<tr class="'.$oddclass.'"> |
|
448 | 448 | <td></td> |
449 | - <td>' . $extend_attempt_link . '</td> |
|
450 | - <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> |
|
451 | - <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> |
|
452 | - <td colspan="2">' . $view_score . '</td> |
|
453 | - <td colspan="2">' . $time . '</td> |
|
449 | + <td>' . $extend_attempt_link.'</td> |
|
450 | + <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td> |
|
451 | + <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td> |
|
452 | + <td colspan="2">' . $view_score.'</td> |
|
453 | + <td colspan="2">' . $time.'</td> |
|
454 | 454 | '.$action.' |
455 | 455 | </tr>'; |
456 | 456 | $attemptCount++; |
@@ -463,10 +463,10 @@ discard block |
||
463 | 463 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
464 | 464 | $temp[] = '/'; |
465 | 465 | } else { |
466 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
466 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
467 | 467 | } |
468 | 468 | } else { |
469 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
469 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
470 | 470 | } |
471 | 471 | $temp[] = $time; |
472 | 472 | $csv_content[] = $temp; |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | <td></td> |
504 | 504 | <td></td> |
505 | 505 | <td></td> |
506 | - <td>'.$interaction['order_id'] . '</td> |
|
507 | - <td>'.$interaction['id'] . '</td> |
|
506 | + <td>'.$interaction['order_id'].'</td> |
|
507 | + <td>'.$interaction['id'].'</td> |
|
508 | 508 | <td colspan="2">' . $interaction['type'].'</td> |
509 | - <td>'.$student_response . '</td> |
|
510 | - <td>'.$interaction['result'] . '</td> |
|
511 | - <td>'.$interaction['latency'] . '</td> |
|
512 | - <td>'.$interaction['time'] . '</td> |
|
509 | + <td>'.$student_response.'</td> |
|
510 | + <td>'.$interaction['result'].'</td> |
|
511 | + <td>'.$interaction['latency'].'</td> |
|
512 | + <td>'.$interaction['time'].'</td> |
|
513 | 513 | '.$action.' |
514 | 514 | </tr>'; |
515 | 515 | $counter++; |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | <td></td> |
527 | 527 | <td></td> |
528 | 528 | <td></td> |
529 | - <td>' . $interaction['order_id'] . '</td> |
|
530 | - <td colspan="2">' . $interaction['objective_id'] . '</td> |
|
531 | - <td colspan="2">' . $interaction['status'] .'</td> |
|
532 | - <td>' . $interaction['score_raw'] . '</td> |
|
533 | - <td>' . $interaction['score_max'] . '</td> |
|
534 | - <td>' . $interaction['score_min'] . '</td> |
|
529 | + <td>' . $interaction['order_id'].'</td> |
|
530 | + <td colspan="2">' . $interaction['objective_id'].'</td> |
|
531 | + <td colspan="2">' . $interaction['status'].'</td> |
|
532 | + <td>' . $interaction['score_raw'].'</td> |
|
533 | + <td>' . $interaction['score_max'].'</td> |
|
534 | + <td>' . $interaction['score_min'].'</td> |
|
535 | 535 | '.$action.' |
536 | 536 | </tr>'; |
537 | 537 | $counter++; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $my_path = Database::escape_string($my_path); |
555 | 555 | $sql = "SELECT results_disabled |
556 | 556 | FROM $TBL_QUIZ |
557 | - WHERE c_id = $course_id AND id ='" . $my_path . "'"; |
|
557 | + WHERE c_id = $course_id AND id ='".$my_path."'"; |
|
558 | 558 | $res_result_disabled = Database::query($sql); |
559 | 559 | $row_result_disabled = Database::fetch_row($res_result_disabled); |
560 | 560 | |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | $extend_this_attempt = 1; |
579 | 579 | $extend_attempt_link = Display::url( |
580 | 580 | Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
581 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix |
|
581 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix |
|
582 | 582 | ); |
583 | 583 | } else { |
584 | 584 | // Same case if fold_attempt_id is set, so not implemented explicitly. |
585 | 585 | // The extend button for this attempt has not been clicked. |
586 | 586 | $extend_attempt_link = Display::url( |
587 | 587 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
588 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
588 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
589 | 589 | ); |
590 | 590 | } |
591 | 591 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | if ($inter_num > 1) { |
601 | 601 | $extend_link = Display::url( |
602 | 602 | Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), |
603 | - api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix |
|
603 | + api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix |
|
604 | 604 | ); |
605 | 605 | } |
606 | 606 | |
@@ -616,15 +616,15 @@ discard block |
||
616 | 616 | |
617 | 617 | // Selecting the exe_id from stats attempts tables in order to look the max score value. |
618 | 618 | |
619 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
619 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
620 | 620 | WHERE |
621 | - exe_exo_id="' . $row['path'] . '" AND |
|
622 | - exe_user_id="' . $user_id . '" AND |
|
623 | - orig_lp_id = "' . $lp_id . '" AND |
|
624 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
625 | - c_id = ' . $course_id . ' AND |
|
621 | + exe_exo_id="' . $row['path'].'" AND |
|
622 | + exe_user_id="' . $user_id.'" AND |
|
623 | + orig_lp_id = "' . $lp_id.'" AND |
|
624 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
625 | + c_id = ' . $course_id.' AND |
|
626 | 626 | status <> "incomplete" AND |
627 | - session_id = ' . $session_id . ' |
|
627 | + session_id = ' . $session_id.' |
|
628 | 628 | ORDER BY exe_date DESC |
629 | 629 | LIMIT 1'; |
630 | 630 | |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | FROM $TBL_LP_ITEM_VIEW |
656 | 656 | WHERE |
657 | 657 | c_id = $course_id AND |
658 | - lp_item_id = '" . (int) $my_id . "' AND |
|
659 | - lp_view_id = '" . (int) $my_lp_view_id . "' |
|
658 | + lp_item_id = '".(int) $my_id."' AND |
|
659 | + lp_view_id = '" . (int) $my_lp_view_id."' |
|
660 | 660 | ORDER BY view_count DESC limit 1"; |
661 | 661 | $res_score = Database::query($sql); |
662 | 662 | $row_score = Database::fetch_array($res_score); |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | FROM $TBL_LP_ITEM_VIEW |
666 | 666 | WHERE |
667 | 667 | c_id = $course_id AND |
668 | - lp_item_id = '" . (int) $my_id . "' AND |
|
669 | - lp_view_id = '" . (int) $my_lp_view_id . "'"; |
|
668 | + lp_item_id = '".(int) $my_id."' AND |
|
669 | + lp_view_id = '" . (int) $my_lp_view_id."'"; |
|
670 | 670 | $res_time = Database::query($sql); |
671 | 671 | $row_time = Database::fetch_array($res_time); |
672 | 672 | |
@@ -725,16 +725,16 @@ discard block |
||
725 | 725 | } else { |
726 | 726 | $correct_test_link = '-'; |
727 | 727 | if ($row['item_type'] == 'quiz') { |
728 | - $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; |
|
729 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
728 | + $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin; |
|
729 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
730 | 730 | WHERE |
731 | - exe_exo_id="' . $row['path'] . '" AND |
|
732 | - exe_user_id="' . $user_id . '" AND |
|
733 | - orig_lp_id = "' . $lp_id . '" AND |
|
734 | - orig_lp_item_id = "' . $row['myid'] . '" AND |
|
735 | - c_id = ' . $course_id . ' AND |
|
731 | + exe_exo_id="' . $row['path'].'" AND |
|
732 | + exe_user_id="' . $user_id.'" AND |
|
733 | + orig_lp_id = "' . $lp_id.'" AND |
|
734 | + orig_lp_item_id = "' . $row['myid'].'" AND |
|
735 | + c_id = ' . $course_id.' AND |
|
736 | 736 | status <> "incomplete" AND |
737 | - session_id = ' . $session_id . ' |
|
737 | + session_id = ' . $session_id.' |
|
738 | 738 | ORDER BY exe_date DESC '; |
739 | 739 | |
740 | 740 | $resultLastAttempt = Database::query($sql); |
@@ -746,12 +746,12 @@ discard block |
||
746 | 746 | ) { |
747 | 747 | $correct_test_link = Display::url( |
748 | 748 | Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), |
749 | - api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
749 | + api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
750 | 750 | ); |
751 | 751 | } else { |
752 | 752 | $correct_test_link = Display::url( |
753 | 753 | Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), |
754 | - api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id |
|
754 | + api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id |
|
755 | 755 | ); |
756 | 756 | } |
757 | 757 | } |
@@ -761,14 +761,14 @@ discard block |
||
761 | 761 | |
762 | 762 | $action = null; |
763 | 763 | if ($type == 'classic') { |
764 | - $action = '<td>' . $correct_test_link . '</td>'; |
|
764 | + $action = '<td>'.$correct_test_link.'</td>'; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($lp_id == $my_lp_id && false) { |
768 | 768 | |
769 | - $output .= '<tr class =' . $oddclass . '> |
|
770 | - <td>' . $extend_link . '</td> |
|
771 | - <td colspan="4">' . $title . '</td> |
|
769 | + $output .= '<tr class ='.$oddclass.'> |
|
770 | + <td>' . $extend_link.'</td> |
|
771 | + <td colspan="4">' . $title.'</td> |
|
772 | 772 | <td colspan="2"> </td> |
773 | 773 | <td colspan="2"> </td> |
774 | 774 | <td colspan="2"> </td> |
@@ -793,13 +793,13 @@ discard block |
||
793 | 793 | $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); |
794 | 794 | } |
795 | 795 | } else { |
796 | - $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); |
|
796 | + $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | $output .= ' |
800 | 800 | <td>'.$extend_link.'</td> |
801 | - <td colspan="4">' . $title . '</td> |
|
802 | - <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td> |
|
801 | + <td colspan="4">' . $title.'</td> |
|
802 | + <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td> |
|
803 | 803 | <td colspan="2">'.$scoreItem.'</td> |
804 | 804 | <td colspan="2">'.$time.'</td> |
805 | 805 | '.$action.' |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
817 | 817 | $temp[] = '/'; |
818 | 818 | } else { |
819 | - $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
819 | + $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
820 | 820 | } |
821 | 821 | } else { |
822 | - $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1))); |
|
822 | + $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1))); |
|
823 | 823 | } |
824 | 824 | $temp[] = $time; |
825 | 825 | $csv_content[] = $temp; |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $action = null; |
832 | 832 | if ($type == 'classic') { |
833 | - $action = '<td></td>'; |
|
833 | + $action = '<td></td>'; |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | if ($extend_this_attempt || $extend_all) { |
@@ -867,11 +867,11 @@ discard block |
||
867 | 867 | <td></td> |
868 | 868 | <td></td> |
869 | 869 | <td></td> |
870 | - <td>' . $interaction['order_id'] . '</td> |
|
871 | - <td colspan="2">'.$interaction['objective_id'] . '</td> |
|
872 | - <td colspan="2">' . $interaction['status'] . '</td> |
|
870 | + <td>' . $interaction['order_id'].'</td> |
|
871 | + <td colspan="2">'.$interaction['objective_id'].'</td> |
|
872 | + <td colspan="2">' . $interaction['status'].'</td> |
|
873 | 873 | <td>' . $interaction['score_raw'].'</td> |
874 | - <td>' . $interaction['score_max'] .'</td> |
|
874 | + <td>' . $interaction['score_max'].'</td> |
|
875 | 875 | <td>' . $interaction['score_min'].'</td> |
876 | 876 | '.$action.' |
877 | 877 | </tr>'; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | // Attempts listing by exercise. |
883 | - if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) { |
|
883 | + if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { |
|
884 | 884 | // Get attempts of a exercise. |
885 | 885 | if (!empty($lp_id) && |
886 | 886 | !empty($lp_item_id) && |
@@ -895,15 +895,15 @@ discard block |
||
895 | 895 | $row_path = Database::fetch_array($res_path); |
896 | 896 | |
897 | 897 | if (Database::num_rows($res_path) > 0) { |
898 | - $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' |
|
898 | + $sql = 'SELECT * FROM '.$tbl_stats_exercices.' |
|
899 | 899 | WHERE |
900 | - exe_exo_id="' . (int) $row_path['path'] . '" AND |
|
900 | + exe_exo_id="' . (int) $row_path['path'].'" AND |
|
901 | 901 | status <> "incomplete" AND |
902 | - exe_user_id="' . $user_id . '" AND |
|
903 | - orig_lp_id = "' . (int) $lp_id . '" AND |
|
904 | - orig_lp_item_id = "' . (int) $lp_item_id . '" AND |
|
905 | - c_id = ' . $course_id . ' AND |
|
906 | - session_id = ' . $session_id . ' |
|
902 | + exe_user_id="' . $user_id.'" AND |
|
903 | + orig_lp_id = "' . (int) $lp_id.'" AND |
|
904 | + orig_lp_item_id = "' . (int) $lp_item_id.'" AND |
|
905 | + c_id = ' . $course_id.' AND |
|
906 | + session_id = ' . $session_id.' |
|
907 | 907 | ORDER BY exe_date'; |
908 | 908 | $res_attempts = Database::query($sql); |
909 | 909 | $num_attempts = Database::num_rows($res_attempts); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | if ($mktime_start_date && $mktime_exe_date) { |
922 | 922 | $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date); |
923 | 923 | $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime); |
924 | - $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); |
|
924 | + $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp); |
|
925 | 925 | } else { |
926 | 926 | $time_attemp = ' - '; |
927 | 927 | } |
@@ -947,33 +947,33 @@ discard block |
||
947 | 947 | $my_lesson_status = learnpathitem::humanize_status('incomplete'); |
948 | 948 | } |
949 | 949 | |
950 | - $output .= '<tr class="' . $oddclass . '" > |
|
950 | + $output .= '<tr class="'.$oddclass.'" > |
|
951 | 951 | <td></td> |
952 | - <td>' . $extend_attempt_link . '</td> |
|
953 | - <td colspan="3">' . get_lang('Attempt').' '. $n.'</td> |
|
954 | - <td colspan="2">' . $my_lesson_status . '</td> |
|
955 | - <td colspan="2">'.$view_score . '</td> |
|
956 | - <td colspan="2">'.$time_attemp . '</td>'; |
|
952 | + <td>' . $extend_attempt_link.'</td> |
|
953 | + <td colspan="3">' . get_lang('Attempt').' '.$n.'</td> |
|
954 | + <td colspan="2">' . $my_lesson_status.'</td> |
|
955 | + <td colspan="2">'.$view_score.'</td> |
|
956 | + <td colspan="2">'.$time_attemp.'</td>'; |
|
957 | 957 | if ($action == 'classic') { |
958 | 958 | if ($origin != 'tracking') { |
959 | 959 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
960 | 960 | $output .= '<td> |
961 | - <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> |
|
961 | + <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'"> |
|
962 | 962 | </td>'; |
963 | 963 | } else { |
964 | 964 | $output .= '<td> |
965 | - <a href="../exercise/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> |
|
966 | - <img src="' . Display::returnIconPath('quiz.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 |
||
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); |
1035 | - $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); |
|
1035 | + $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time); |
|
1036 | 1036 | |
1037 | 1037 | if (!$is_allowed_to_edit && $result_disabled_ext_all) { |
1038 | 1038 | $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); |
1039 | 1039 | } else { |
1040 | 1040 | if (is_numeric($total_score)) { |
1041 | - $final_score = $total_score . '%'; |
|
1041 | + $final_score = $total_score.'%'; |
|
1042 | 1042 | } else { |
1043 | 1043 | $final_score = $total_score; |
1044 | 1044 | } |
@@ -1054,19 +1054,19 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | $action = null; |
1056 | 1056 | if ($type == 'classic') { |
1057 | - $action = '<td></td>'; |
|
1057 | + $action = '<td></td>'; |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $output .= '<tr class="'.$oddclass.'"> |
1061 | 1061 | <td></td> |
1062 | 1062 | <td colspan="4"> |
1063 | - <i>' . get_lang('AccomplishedStepsTotal') .'</i> |
|
1063 | + <i>' . get_lang('AccomplishedStepsTotal').'</i> |
|
1064 | 1064 | </td> |
1065 | 1065 | <td colspan="2">'.$progress.'%</td> |
1066 | 1066 | <td colspan="2"> |
1067 | 1067 | ' . $final_score.' |
1068 | 1068 | </td> |
1069 | - <td colspan="2">' . $total_time . '</div> |
|
1069 | + <td colspan="2">' . $total_time.'</div> |
|
1070 | 1070 | '.$action.' |
1071 | 1071 | </tr>'; |
1072 | 1072 | |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
1411 | 1411 | if (is_array($user_id)) { |
1412 | 1412 | $user_id = array_map('intval', $user_id); |
1413 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1413 | + $condition_user = " AND user_id IN (".implode(',', $user_id).") "; |
|
1414 | 1414 | } else { |
1415 | 1415 | $user_id = intval($user_id); |
1416 | 1416 | $condition_user = " AND user_id = $user_id "; |
@@ -1446,13 +1446,13 @@ discard block |
||
1446 | 1446 | { |
1447 | 1447 | $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1448 | 1448 | $sql = 'SELECT login_date |
1449 | - FROM ' . $tbl_track_login . ' |
|
1450 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1449 | + FROM ' . $tbl_track_login.' |
|
1450 | + WHERE login_user_id = ' . intval($student_id).' |
|
1451 | 1451 | ORDER BY login_date ASC |
1452 | 1452 | LIMIT 0,1'; |
1453 | 1453 | |
1454 | 1454 | $rs = Database::query($sql); |
1455 | - if (Database::num_rows($rs)>0) { |
|
1455 | + if (Database::num_rows($rs) > 0) { |
|
1456 | 1456 | if ($first_login_date = Database::result($rs, 0, 0)) { |
1457 | 1457 | return api_convert_and_format_date( |
1458 | 1458 | $first_login_date, |
@@ -1477,8 +1477,8 @@ discard block |
||
1477 | 1477 | { |
1478 | 1478 | $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
1479 | 1479 | $sql = 'SELECT login_date |
1480 | - FROM ' . $table . ' |
|
1481 | - WHERE login_user_id = ' . intval($student_id) . ' |
|
1480 | + FROM ' . $table.' |
|
1481 | + WHERE login_user_id = ' . intval($student_id).' |
|
1482 | 1482 | ORDER BY login_date |
1483 | 1483 | DESC LIMIT 0,1'; |
1484 | 1484 | |
@@ -1487,18 +1487,18 @@ discard block |
||
1487 | 1487 | if ($last_login_date = Database::result($rs, 0, 0)) { |
1488 | 1488 | $last_login_date = api_get_local_time($last_login_date); |
1489 | 1489 | if ($return_timestamp) { |
1490 | - return api_strtotime($last_login_date,'UTC'); |
|
1490 | + return api_strtotime($last_login_date, 'UTC'); |
|
1491 | 1491 | } else { |
1492 | 1492 | if (!$warning_message) { |
1493 | 1493 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1494 | 1494 | } else { |
1495 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1495 | + $timestamp = api_strtotime($last_login_date, 'UTC'); |
|
1496 | 1496 | $currentTimestamp = time(); |
1497 | 1497 | |
1498 | 1498 | //If the last connection is > than 7 days, the text is red |
1499 | 1499 | //345600 = 7 days in seconds |
1500 | 1500 | if ($currentTimestamp - $timestamp > 604800) { |
1501 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1501 | + return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>'; |
|
1502 | 1502 | } else { |
1503 | 1503 | return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
1504 | 1504 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | $sql = "$select |
1534 | 1534 | FROM $tbl_track_login |
1535 | 1535 | WHERE |
1536 | - login_user_id IN (' ". implode("','", $studentList) . "' ) AND |
|
1536 | + login_user_id IN (' ".implode("','", $studentList)."' ) AND |
|
1537 | 1537 | login_date < '$date' |
1538 | 1538 | "; |
1539 | 1539 | $rs = Database::query($sql); |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | '.Display::return_icon('messagebox_warning.gif').' |
1633 | 1633 | </a>' |
1634 | 1634 | : null; |
1635 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1635 | + return $icon.Display::label($last_login_date, 'warning'); |
|
1636 | 1636 | } else { |
1637 | 1637 | return $last_login_date; |
1638 | 1638 | } |
@@ -1682,7 +1682,7 @@ discard block |
||
1682 | 1682 | session_id = $session_id |
1683 | 1683 | $month_filter"; |
1684 | 1684 | $rs = Database::query($sql); |
1685 | - if (Database::num_rows($rs)>0) { |
|
1685 | + if (Database::num_rows($rs) > 0) { |
|
1686 | 1686 | $row = Database::fetch_object($rs); |
1687 | 1687 | $count = $row->count_connections; |
1688 | 1688 | } |
@@ -1703,14 +1703,14 @@ discard block |
||
1703 | 1703 | $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
1704 | 1704 | |
1705 | 1705 | $sql = 'SELECT DISTINCT c_id |
1706 | - FROM ' . $tbl_course_rel_user . ' |
|
1706 | + FROM ' . $tbl_course_rel_user.' |
|
1707 | 1707 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1708 | 1708 | $rs = Database::query($sql); |
1709 | 1709 | $nb_courses = Database::num_rows($rs); |
1710 | 1710 | |
1711 | 1711 | if ($include_sessions) { |
1712 | 1712 | $sql = 'SELECT DISTINCT c_id |
1713 | - FROM ' . $tbl_session_course_rel_user . ' |
|
1713 | + FROM ' . $tbl_session_course_rel_user.' |
|
1714 | 1714 | WHERE user_id = ' . $user_id; |
1715 | 1715 | $rs = Database::query($sql); |
1716 | 1716 | $nb_courses += Database::num_rows($rs); |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | $condition_quiz = ""; |
1758 | 1758 | if (!empty($exercise_id)) { |
1759 | 1759 | $exercise_id = intval($exercise_id); |
1760 | - $condition_quiz =" AND id = $exercise_id "; |
|
1760 | + $condition_quiz = " AND id = $exercise_id "; |
|
1761 | 1761 | } |
1762 | 1762 | |
1763 | 1763 | // Compose a filter based on optional session id given |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | } |
1811 | 1811 | } |
1812 | 1812 | if (!empty($exercise_list)) { |
1813 | - $exercise_id = implode("','",$exercise_list); |
|
1813 | + $exercise_id = implode("','", $exercise_list); |
|
1814 | 1814 | } |
1815 | 1815 | } |
1816 | 1816 | |
@@ -1835,10 +1835,10 @@ discard block |
||
1835 | 1835 | $quiz_avg_score = null; |
1836 | 1836 | |
1837 | 1837 | if (!empty($row['avg_score'])) { |
1838 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1838 | + $quiz_avg_score = round($row['avg_score'], 2); |
|
1839 | 1839 | } |
1840 | 1840 | |
1841 | - if(!empty($row['num_attempts'])) { |
|
1841 | + if (!empty($row['num_attempts'])) { |
|
1842 | 1842 | $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
1843 | 1843 | } |
1844 | 1844 | if (is_array($student_id)) { |
@@ -1968,7 +1968,7 @@ discard block |
||
1968 | 1968 | $row = Database::fetch_row($rs); |
1969 | 1969 | $count = $row[0]; |
1970 | 1970 | } |
1971 | - $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%'; |
|
1971 | + $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%'; |
|
1972 | 1972 | return $count; |
1973 | 1973 | } |
1974 | 1974 | |
@@ -1993,7 +1993,7 @@ discard block |
||
1993 | 1993 | ); |
1994 | 1994 | |
1995 | 1995 | if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) { |
1996 | - $result += $best_attempt['exe_result']/$best_attempt['exe_weighting']; |
|
1996 | + $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting']; |
|
1997 | 1997 | } |
1998 | 1998 | } |
1999 | 1999 | $result = $result / count($exercise_list); |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | $query = sprintf($sql, intval($courseId), $sessionId); |
2031 | 2031 | $rs = Database::query($query); |
2032 | 2032 | $teachers = array(); |
2033 | - while ($teacher = Database::fetch_array($rs,'ASSOC')) { |
|
2033 | + while ($teacher = Database::fetch_array($rs, 'ASSOC')) { |
|
2034 | 2034 | $teachers[] = $teacher; |
2035 | 2035 | } |
2036 | 2036 | $data = array(); |
@@ -2154,7 +2154,7 @@ discard block |
||
2154 | 2154 | $data[] = array( |
2155 | 2155 | 'course' => $course['title'], |
2156 | 2156 | 'session' => $teacher['name'], |
2157 | - 'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'], |
|
2157 | + 'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'], |
|
2158 | 2158 | 'documents' => $totalDocuments, |
2159 | 2159 | 'links' => $totalLinks, |
2160 | 2160 | 'forums' => $totalForums, |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | for ($i = 0; $i < count($lpIdList); $i++) { |
2218 | 2218 | $placeHolders[] = '?'; |
2219 | 2219 | } |
2220 | - $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList; |
|
2220 | + $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList; |
|
2221 | 2221 | } |
2222 | 2222 | |
2223 | 2223 | if ($onlySeriousGame) { |
@@ -2237,14 +2237,14 @@ discard block |
||
2237 | 2237 | |
2238 | 2238 | $conditions = [ |
2239 | 2239 | " c_id = {$courseInfo['real_id']} ", |
2240 | - " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") " |
|
2240 | + " lp_view.lp_id IN(".implode(', ', $filteredLP).") " |
|
2241 | 2241 | ]; |
2242 | 2242 | |
2243 | 2243 | $groupBy = 'GROUP BY lp_id'; |
2244 | 2244 | |
2245 | 2245 | if (is_array($studentId)) { |
2246 | 2246 | $studentId = array_map('intval', $studentId); |
2247 | - $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ") "; |
|
2247 | + $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).") "; |
|
2248 | 2248 | |
2249 | 2249 | |
2250 | 2250 | } else { |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | // Compose a filter based on optional learning paths list given |
2380 | 2380 | $condition_lp = ""; |
2381 | 2381 | if (count($lp_ids) > 0) { |
2382 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2382 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | // Compose a filter based on optional session id |
@@ -2419,9 +2419,9 @@ discard block |
||
2419 | 2419 | // prepare filter on users |
2420 | 2420 | if (is_array($student_id)) { |
2421 | 2421 | array_walk($student_id, 'intval'); |
2422 | - $condition_user1 =" AND user_id IN (".implode(',', $student_id).") "; |
|
2422 | + $condition_user1 = " AND user_id IN (".implode(',', $student_id).") "; |
|
2423 | 2423 | } else { |
2424 | - $condition_user1 =" AND user_id = $student_id "; |
|
2424 | + $condition_user1 = " AND user_id = $student_id "; |
|
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | if ($count_row_lp > 0 && !empty($student_id)) { |
@@ -2464,7 +2464,7 @@ discard block |
||
2464 | 2464 | ORDER BY lp_item_id"; |
2465 | 2465 | $res_lp_item = Database::query($sql); |
2466 | 2466 | |
2467 | - while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) { |
|
2467 | + while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) { |
|
2468 | 2468 | $my_lp_item_id = $row_lp_item['lp_item_id']; |
2469 | 2469 | |
2470 | 2470 | // Getting the most recent attempt |
@@ -2487,8 +2487,8 @@ discard block |
||
2487 | 2487 | ORDER BY view_count DESC |
2488 | 2488 | LIMIT 1"; |
2489 | 2489 | $res_lp_item_result = Database::query($sql); |
2490 | - while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) { |
|
2491 | - $list[]= $row_max_score; |
|
2490 | + while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) { |
|
2491 | + $list[] = $row_max_score; |
|
2492 | 2492 | } |
2493 | 2493 | } |
2494 | 2494 | } else { |
@@ -2512,8 +2512,8 @@ discard block |
||
2512 | 2512 | if ($debug) echo $sql.'<br />'; |
2513 | 2513 | $res_max_score = Database::query($sql); |
2514 | 2514 | |
2515 | - while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) { |
|
2516 | - $list[]= $row_max_score; |
|
2515 | + while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) { |
|
2516 | + $list[] = $row_max_score; |
|
2517 | 2517 | } |
2518 | 2518 | } |
2519 | 2519 | |
@@ -2528,7 +2528,7 @@ discard block |
||
2528 | 2528 | $max_score_item_view = $row_max_score['max_score_item_view']; |
2529 | 2529 | $score = $row_max_score['score']; |
2530 | 2530 | |
2531 | - if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>'; |
|
2531 | + if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>'; |
|
2532 | 2532 | |
2533 | 2533 | if ($row_max_score['item_type'] == 'sco') { |
2534 | 2534 | /* Check if it is sco (easier to get max_score) |
@@ -2546,7 +2546,7 @@ discard block |
||
2546 | 2546 | } |
2547 | 2547 | // Avoid division by zero errors |
2548 | 2548 | if (!empty($max_score)) { |
2549 | - $lp_partial_total += $score/$max_score; |
|
2549 | + $lp_partial_total += $score / $max_score; |
|
2550 | 2550 | } |
2551 | 2551 | if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2552 | 2552 | } else { |
@@ -2570,10 +2570,10 @@ discard block |
||
2570 | 2570 | ORDER BY exe_date DESC |
2571 | 2571 | LIMIT 1"; |
2572 | 2572 | |
2573 | - if ($debug) echo $sql .'<br />'; |
|
2573 | + if ($debug) echo $sql.'<br />'; |
|
2574 | 2574 | $result_last_attempt = Database::query($sql); |
2575 | 2575 | $num = Database :: num_rows($result_last_attempt); |
2576 | - if ($num > 0 ) { |
|
2576 | + if ($num > 0) { |
|
2577 | 2577 | $id_last_attempt = Database :: result($result_last_attempt, 0, 0); |
2578 | 2578 | if ($debug) echo $id_last_attempt.'<br />'; |
2579 | 2579 | |
@@ -2602,13 +2602,13 @@ discard block |
||
2602 | 2602 | $max_score = $row_max_score_bis['maxscore']; |
2603 | 2603 | } |
2604 | 2604 | if (!empty($max_score) && floatval($max_score) > 0) { |
2605 | - $lp_partial_total += $score/$max_score; |
|
2605 | + $lp_partial_total += $score / $max_score; |
|
2606 | 2606 | } |
2607 | 2607 | if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />'; |
2608 | 2608 | } |
2609 | 2609 | } |
2610 | 2610 | |
2611 | - if (in_array($row_max_score['item_type'], array('quiz','sco'))) { |
|
2611 | + if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) { |
|
2612 | 2612 | // Normal way |
2613 | 2613 | if ($use_max_score[$lp_id]) { |
2614 | 2614 | $count_items++; |
@@ -2643,8 +2643,8 @@ discard block |
||
2643 | 2643 | if ($debug) echo $sql; |
2644 | 2644 | $result_have_quiz = Database::query($sql); |
2645 | 2645 | |
2646 | - if (Database::num_rows($result_have_quiz) > 0 ) { |
|
2647 | - $row = Database::fetch_array($result_have_quiz,'ASSOC'); |
|
2646 | + if (Database::num_rows($result_have_quiz) > 0) { |
|
2647 | + $row = Database::fetch_array($result_have_quiz, 'ASSOC'); |
|
2648 | 2648 | if (is_numeric($row['count']) && $row['count'] != 0) { |
2649 | 2649 | $lp_with_quiz++; |
2650 | 2650 | } |
@@ -2656,7 +2656,7 @@ discard block |
||
2656 | 2656 | |
2657 | 2657 | if ($lp_with_quiz != 0) { |
2658 | 2658 | if (!$return_array) { |
2659 | - $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2); |
|
2659 | + $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2); |
|
2660 | 2660 | if ($debug) var_dump($score_of_scorm_calculate); |
2661 | 2661 | if (empty($lp_ids)) { |
2662 | 2662 | if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>'; |
@@ -2730,9 +2730,9 @@ discard block |
||
2730 | 2730 | |
2731 | 2731 | if (is_array($student_id)) { |
2732 | 2732 | array_walk($student_id, 'intval'); |
2733 | - $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2733 | + $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") "; |
|
2734 | 2734 | } else { |
2735 | - $conditions[] =" lp_view.user_id = $student_id "; |
|
2735 | + $conditions[] = " lp_view.user_id = $student_id "; |
|
2736 | 2736 | } |
2737 | 2737 | |
2738 | 2738 | $conditionsToString = implode('AND ', $conditions); |
@@ -2756,7 +2756,7 @@ discard block |
||
2756 | 2756 | return 0; |
2757 | 2757 | } |
2758 | 2758 | |
2759 | - return ($row['sum_score'] / $row['sum_max_score'])*100; |
|
2759 | + return ($row['sum_score'] / $row['sum_max_score']) * 100; |
|
2760 | 2760 | |
2761 | 2761 | } |
2762 | 2762 | |
@@ -2786,7 +2786,7 @@ discard block |
||
2786 | 2786 | // Compose a filter based on optional learning paths list given |
2787 | 2787 | $condition_lp = ""; |
2788 | 2788 | if (count($lp_ids) > 0) { |
2789 | - $condition_lp =" AND id IN(".implode(',',$lp_ids).") "; |
|
2789 | + $condition_lp = " AND id IN(".implode(',', $lp_ids).") "; |
|
2790 | 2790 | } |
2791 | 2791 | |
2792 | 2792 | // Compose a filter based on optional session id |
@@ -2848,7 +2848,7 @@ discard block |
||
2848 | 2848 | |
2849 | 2849 | if (!empty($course)) { |
2850 | 2850 | |
2851 | - $course_id = $course['real_id']; |
|
2851 | + $course_id = $course['real_id']; |
|
2852 | 2852 | |
2853 | 2853 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
2854 | 2854 | $t_lpv = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -2862,8 +2862,8 @@ discard block |
||
2862 | 2862 | // calculates last connection time |
2863 | 2863 | if ($count_row_lp > 0) { |
2864 | 2864 | $sql = 'SELECT MAX(start_time) |
2865 | - FROM ' . $t_lpiv . ' AS item_view |
|
2866 | - INNER JOIN ' . $t_lpv . ' AS view |
|
2865 | + FROM ' . $t_lpiv.' AS item_view |
|
2866 | + INNER JOIN ' . $t_lpv.' AS view |
|
2867 | 2867 | ON item_view.lp_view_id = view.id |
2868 | 2868 | WHERE |
2869 | 2869 | item_view.c_id = '.$course_id.' AND |
@@ -2899,15 +2899,15 @@ discard block |
||
2899 | 2899 | |
2900 | 2900 | // At first, courses where $coach_id is coach of the course // |
2901 | 2901 | $sql = 'SELECT session_id, c_id |
2902 | - FROM ' . $tbl_session_course_user . ' |
|
2902 | + FROM ' . $tbl_session_course_user.' |
|
2903 | 2903 | WHERE user_id=' . $coach_id.' AND status=2'; |
2904 | 2904 | |
2905 | 2905 | if (api_is_multiple_url_enabled()) { |
2906 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2906 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2907 | 2907 | $access_url_id = api_get_current_access_url_id(); |
2908 | 2908 | if ($access_url_id != -1) { |
2909 | 2909 | $sql = 'SELECT scu.session_id, scu.c_id |
2910 | - FROM ' . $tbl_session_course_user . ' scu |
|
2910 | + FROM ' . $tbl_session_course_user.' scu |
|
2911 | 2911 | INNER JOIN '.$tbl_session_rel_access_url.' sru |
2912 | 2912 | ON (scu.session_id=sru.session_id) |
2913 | 2913 | WHERE |
@@ -2941,28 +2941,28 @@ discard block |
||
2941 | 2941 | |
2942 | 2942 | // Then, courses where $coach_id is coach of the session // |
2943 | 2943 | $sql = 'SELECT session_course_user.user_id |
2944 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2944 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2945 | 2945 | INNER JOIN '.$tbl_session_user.' sru |
2946 | 2946 | ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id |
2947 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2947 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2948 | 2948 | ON session_course.c_id = session_course_user.c_id |
2949 | 2949 | AND session_course_user.session_id = session_course.session_id |
2950 | - INNER JOIN ' . $tbl_session . ' as session |
|
2950 | + INNER JOIN ' . $tbl_session.' as session |
|
2951 | 2951 | ON session.id = session_course.session_id |
2952 | 2952 | AND session.id_coach = ' . $coach_id; |
2953 | 2953 | if (api_is_multiple_url_enabled()) { |
2954 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2954 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
2955 | 2955 | $access_url_id = api_get_current_access_url_id(); |
2956 | - if ($access_url_id != -1){ |
|
2956 | + if ($access_url_id != -1) { |
|
2957 | 2957 | $sql = 'SELECT session_course_user.user_id |
2958 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
2958 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
2959 | 2959 | INNER JOIN '.$tbl_session_user.' sru |
2960 | 2960 | ON session_course_user.user_id = sru.user_id AND |
2961 | 2961 | session_course_user.session_id = sru.session_id |
2962 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
2962 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
2963 | 2963 | ON session_course.c_id = session_course_user.c_id AND |
2964 | 2964 | session_course_user.session_id = session_course.session_id |
2965 | - INNER JOIN ' . $tbl_session . ' as session |
|
2965 | + INNER JOIN ' . $tbl_session.' as session |
|
2966 | 2966 | ON session.id = session_course.session_id AND |
2967 | 2967 | session.id_coach = ' . $coach_id.' |
2968 | 2968 | INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url |
@@ -2992,8 +2992,8 @@ discard block |
||
2992 | 2992 | |
2993 | 2993 | $students = []; |
2994 | 2994 | // At first, courses where $coach_id is coach of the course // |
2995 | - $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . ' |
|
2996 | - WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2'; |
|
2995 | + $sql = 'SELECT c_id FROM '.$tbl_session_course_user.' |
|
2996 | + WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2'; |
|
2997 | 2997 | $result = Database::query($sql); |
2998 | 2998 | |
2999 | 2999 | while ($a_courses = Database::fetch_array($result)) { |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | FROM $tbl_session_course_user AS srcru |
3004 | 3004 | WHERE |
3005 | 3005 | c_id = '$courseId' AND |
3006 | - session_id = '" . $id_session . "'"; |
|
3006 | + session_id = '".$id_session."'"; |
|
3007 | 3007 | $rs = Database::query($sql); |
3008 | 3008 | while ($row = Database::fetch_array($rs)) { |
3009 | 3009 | $students[$row['user_id']] = $row['user_id']; |
@@ -3011,15 +3011,15 @@ discard block |
||
3011 | 3011 | } |
3012 | 3012 | |
3013 | 3013 | // Then, courses where $coach_id is coach of the session |
3014 | - $sql = 'SELECT id_coach FROM ' . $tbl_session . ' |
|
3015 | - WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"'; |
|
3014 | + $sql = 'SELECT id_coach FROM '.$tbl_session.' |
|
3015 | + WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"'; |
|
3016 | 3016 | $result = Database::query($sql); |
3017 | 3017 | |
3018 | 3018 | //He is the session_coach so we select all the users in the session |
3019 | 3019 | if (Database::num_rows($result) > 0) { |
3020 | 3020 | $sql = 'SELECT DISTINCT srcru.user_id |
3021 | - FROM ' . $tbl_session_course_user . ' AS srcru |
|
3022 | - WHERE session_id="' . $id_session . '"'; |
|
3021 | + FROM ' . $tbl_session_course_user.' AS srcru |
|
3022 | + WHERE session_id="' . $id_session.'"'; |
|
3023 | 3023 | $result = Database::query($sql); |
3024 | 3024 | while ($row = Database::fetch_array($result)) { |
3025 | 3025 | $students[$row['user_id']] = $row['user_id']; |
@@ -3046,8 +3046,8 @@ discard block |
||
3046 | 3046 | |
3047 | 3047 | // At first, courses where $coach_id is coach of the course // |
3048 | 3048 | |
3049 | - $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . ' |
|
3050 | - WHERE user_id=' . $coach_id .' AND status=2'; |
|
3049 | + $sql = 'SELECT 1 FROM '.$tbl_session_course_user.' |
|
3050 | + WHERE user_id=' . $coach_id.' AND status=2'; |
|
3051 | 3051 | $result = Database::query($sql); |
3052 | 3052 | if (Database::num_rows($result) > 0) { |
3053 | 3053 | return true; |
@@ -3055,12 +3055,12 @@ discard block |
||
3055 | 3055 | |
3056 | 3056 | // Then, courses where $coach_id is coach of the session |
3057 | 3057 | $sql = 'SELECT session_course_user.user_id |
3058 | - FROM ' . $tbl_session_course_user . ' as session_course_user |
|
3059 | - INNER JOIN ' . $tbl_session_course . ' as session_course |
|
3058 | + FROM ' . $tbl_session_course_user.' as session_course_user |
|
3059 | + INNER JOIN ' . $tbl_session_course.' as session_course |
|
3060 | 3060 | ON session_course.c_id = session_course_user.c_id |
3061 | - INNER JOIN ' . $tbl_session . ' as session |
|
3061 | + INNER JOIN ' . $tbl_session.' as session |
|
3062 | 3062 | ON session.id = session_course.session_id |
3063 | - AND session.id_coach = ' . $coach_id . ' |
|
3063 | + AND session.id_coach = ' . $coach_id.' |
|
3064 | 3064 | WHERE user_id = ' . $student_id; |
3065 | 3065 | $result = Database::query($sql); |
3066 | 3066 | if (Database::num_rows($result) > 0) { |
@@ -3092,16 +3092,16 @@ discard block |
||
3092 | 3092 | // At first, courses where $coach_id is coach of the course. |
3093 | 3093 | |
3094 | 3094 | $sql = 'SELECT DISTINCT c.code |
3095 | - FROM ' . $tbl_session_course_user . ' sc |
|
3095 | + FROM ' . $tbl_session_course_user.' sc |
|
3096 | 3096 | INNER JOIN '.$tbl_course.' c |
3097 | 3097 | ON (c.id = sc.c_id) |
3098 | 3098 | WHERE user_id = ' . $coach_id.' AND status = 2'; |
3099 | 3099 | |
3100 | 3100 | if (api_is_multiple_url_enabled()) { |
3101 | 3101 | $access_url_id = api_get_current_access_url_id(); |
3102 | - if ($access_url_id != -1){ |
|
3102 | + if ($access_url_id != -1) { |
|
3103 | 3103 | $sql = 'SELECT DISTINCT c.code |
3104 | - FROM ' . $tbl_session_course_user . ' scu |
|
3104 | + FROM ' . $tbl_session_course_user.' scu |
|
3105 | 3105 | INNER JOIN '.$tbl_course.' c |
3106 | 3106 | ON (c.code = scu.c_id) |
3107 | 3107 | INNER JOIN '.$tbl_course_rel_access_url.' cru |
@@ -3114,7 +3114,7 @@ discard block |
||
3114 | 3114 | } |
3115 | 3115 | |
3116 | 3116 | if (!empty($id_session)) { |
3117 | - $sql .= ' AND session_id=' . $id_session; |
|
3117 | + $sql .= ' AND session_id='.$id_session; |
|
3118 | 3118 | } |
3119 | 3119 | |
3120 | 3120 | $courseList = array(); |
@@ -3126,25 +3126,25 @@ discard block |
||
3126 | 3126 | // Then, courses where $coach_id is coach of the session |
3127 | 3127 | |
3128 | 3128 | $sql = 'SELECT DISTINCT course.code |
3129 | - FROM ' . $tbl_session_course . ' as session_course |
|
3130 | - INNER JOIN ' . $tbl_session . ' as session |
|
3129 | + FROM ' . $tbl_session_course.' as session_course |
|
3130 | + INNER JOIN ' . $tbl_session.' as session |
|
3131 | 3131 | ON session.id = session_course.session_id |
3132 | - AND session.id_coach = ' . $coach_id . ' |
|
3133 | - INNER JOIN ' . $tbl_course . ' as course |
|
3132 | + AND session.id_coach = ' . $coach_id.' |
|
3133 | + INNER JOIN ' . $tbl_course.' as course |
|
3134 | 3134 | ON course.id = session_course.c_id'; |
3135 | 3135 | |
3136 | 3136 | if (api_is_multiple_url_enabled()) { |
3137 | 3137 | $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
3138 | 3138 | $access_url_id = api_get_current_access_url_id(); |
3139 | - if ($access_url_id != -1){ |
|
3139 | + if ($access_url_id != -1) { |
|
3140 | 3140 | $sql = 'SELECT DISTINCT c.code |
3141 | - FROM ' . $tbl_session_course . ' as session_course |
|
3141 | + FROM ' . $tbl_session_course.' as session_course |
|
3142 | 3142 | INNER JOIN '.$tbl_course.' c |
3143 | 3143 | ON (c.id = session_course.c_id) |
3144 | - INNER JOIN ' . $tbl_session . ' as session |
|
3144 | + INNER JOIN ' . $tbl_session.' as session |
|
3145 | 3145 | ON session.id = session_course.session_id |
3146 | - AND session.id_coach = ' . $coach_id . ' |
|
3147 | - INNER JOIN ' . $tbl_course . ' as course |
|
3146 | + AND session.id_coach = ' . $coach_id.' |
|
3147 | + INNER JOIN ' . $tbl_course.' as course |
|
3148 | 3148 | ON course.id = session_course.c_id |
3149 | 3149 | INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url |
3150 | 3150 | ON (course_rel_url.c_id = c.id)'; |
@@ -3152,12 +3152,12 @@ discard block |
||
3152 | 3152 | } |
3153 | 3153 | |
3154 | 3154 | if (!empty ($id_session)) { |
3155 | - $sql .= ' WHERE session_course.session_id=' . $id_session; |
|
3155 | + $sql .= ' WHERE session_course.session_id='.$id_session; |
|
3156 | 3156 | if (api_is_multiple_url_enabled()) |
3157 | - $sql .= ' AND access_url_id = '.$access_url_id; |
|
3158 | - } else { |
|
3157 | + $sql .= ' AND access_url_id = '.$access_url_id; |
|
3158 | + } else { |
|
3159 | 3159 | if (api_is_multiple_url_enabled()) |
3160 | - $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3160 | + $sql .= ' WHERE access_url_id = '.$access_url_id; |
|
3161 | 3161 | } |
3162 | 3162 | |
3163 | 3163 | $result = Database::query($sql); |
@@ -3213,7 +3213,7 @@ discard block |
||
3213 | 3213 | } |
3214 | 3214 | } |
3215 | 3215 | |
3216 | - $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3216 | + $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
3217 | 3217 | $access_url_id = api_get_current_access_url_id(); |
3218 | 3218 | |
3219 | 3219 | $sql = " |
@@ -3333,7 +3333,7 @@ discard block |
||
3333 | 3333 | // table definition |
3334 | 3334 | $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
3335 | 3335 | $tbl_document = Database :: get_course_table(TABLE_DOCUMENT); |
3336 | - $course_id = $a_course['real_id']; |
|
3336 | + $course_id = $a_course['real_id']; |
|
3337 | 3337 | if (is_array($student_id)) { |
3338 | 3338 | $studentList = array_map('intval', $student_id); |
3339 | 3339 | $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') "; |
@@ -3384,7 +3384,7 @@ discard block |
||
3384 | 3384 | $a_course = CourseManager::get_course_information($course_code); |
3385 | 3385 | if (!empty($a_course)) { |
3386 | 3386 | $course_id = $a_course['real_id']; |
3387 | - $conditions[]= " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3387 | + $conditions[] = " ip.c_id = $course_id AND pub.c_id = $course_id "; |
|
3388 | 3388 | } |
3389 | 3389 | |
3390 | 3390 | // table definition |
@@ -3393,14 +3393,14 @@ discard block |
||
3393 | 3393 | |
3394 | 3394 | if (is_array($student_id)) { |
3395 | 3395 | $studentList = array_map('intval', $student_id); |
3396 | - $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3396 | + $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') "; |
|
3397 | 3397 | } else { |
3398 | 3398 | $student_id = intval($student_id); |
3399 | - $conditions[]= " ip.insert_user_id = '$student_id' "; |
|
3399 | + $conditions[] = " ip.insert_user_id = '$student_id' "; |
|
3400 | 3400 | } |
3401 | 3401 | if (isset($session_id)) { |
3402 | 3402 | $session_id = intval($session_id); |
3403 | - $conditions[]= " pub.session_id = $session_id "; |
|
3403 | + $conditions[] = " pub.session_id = $session_id "; |
|
3404 | 3404 | } |
3405 | 3405 | $conditionToString = implode('AND', $conditions); |
3406 | 3406 | |
@@ -3433,8 +3433,8 @@ discard block |
||
3433 | 3433 | $courseCondition = null; |
3434 | 3434 | $conditions = array(); |
3435 | 3435 | if (!empty($courseInfo)) { |
3436 | - $course_id = $courseInfo['real_id']; |
|
3437 | - $conditions[]= " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3436 | + $course_id = $courseInfo['real_id']; |
|
3437 | + $conditions[] = " post.c_id = $course_id AND forum.c_id = $course_id "; |
|
3438 | 3438 | } |
3439 | 3439 | |
3440 | 3440 | // Table definition. |
@@ -3443,15 +3443,15 @@ discard block |
||
3443 | 3443 | |
3444 | 3444 | if (is_array($student_id)) { |
3445 | 3445 | $studentList = array_map('intval', $student_id); |
3446 | - $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3446 | + $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') "; |
|
3447 | 3447 | } else { |
3448 | 3448 | $student_id = intval($student_id); |
3449 | - $conditions[]= " post.poster_id = '$student_id' "; |
|
3449 | + $conditions[] = " post.poster_id = '$student_id' "; |
|
3450 | 3450 | } |
3451 | 3451 | |
3452 | 3452 | if (isset($session_id)) { |
3453 | 3453 | $session_id = intval($session_id); |
3454 | - $conditions[]= " forum.session_id = $session_id"; |
|
3454 | + $conditions[] = " forum.session_id = $session_id"; |
|
3455 | 3455 | } |
3456 | 3456 | |
3457 | 3457 | $conditionsToString = implode('AND ', $conditions); |
@@ -3486,7 +3486,7 @@ discard block |
||
3486 | 3486 | $condition_session = ''; |
3487 | 3487 | if (isset($session_id)) { |
3488 | 3488 | $session_id = intval($session_id); |
3489 | - $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3489 | + $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id'); |
|
3490 | 3490 | } |
3491 | 3491 | |
3492 | 3492 | $course_id = $courseInfo['real_id']; |
@@ -3542,7 +3542,7 @@ discard block |
||
3542 | 3542 | $condition_session = ''; |
3543 | 3543 | if (isset($session_id)) { |
3544 | 3544 | $session_id = intval($session_id); |
3545 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3545 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3546 | 3546 | } |
3547 | 3547 | |
3548 | 3548 | $groupId = intval($groupId); |
@@ -3603,7 +3603,7 @@ discard block |
||
3603 | 3603 | $condition_session = ''; |
3604 | 3604 | if (isset($session_id)) { |
3605 | 3605 | $session_id = intval($session_id); |
3606 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3606 | + $condition_session = ' AND f.session_id = '.$session_id; |
|
3607 | 3607 | } |
3608 | 3608 | |
3609 | 3609 | $groupId = intval($groupId); |
@@ -3682,7 +3682,7 @@ discard block |
||
3682 | 3682 | { |
3683 | 3683 | $student_id = intval($student_id); |
3684 | 3684 | $courseId = intval($courseId); |
3685 | - $session_id = intval($session_id); |
|
3685 | + $session_id = intval($session_id); |
|
3686 | 3686 | $date_time = ''; |
3687 | 3687 | |
3688 | 3688 | // table definition |
@@ -3751,7 +3751,7 @@ discard block |
||
3751 | 3751 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
3752 | 3752 | |
3753 | 3753 | $sql = 'SELECT 1 |
3754 | - FROM ' . $table . ' |
|
3754 | + FROM ' . $table.' |
|
3755 | 3755 | WHERE down_user_id = '.$student_id.' |
3756 | 3756 | AND c_id = "'.$courseId.'" |
3757 | 3757 | AND down_session_id = '.$session_id.' '; |
@@ -3829,30 +3829,30 @@ discard block |
||
3829 | 3829 | '.$inner.' |
3830 | 3830 | WHERE c.id = '.$courseId.' |
3831 | 3831 | GROUP BY stats_login.user_id |
3832 | - HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date '; |
|
3832 | + HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date '; |
|
3833 | 3833 | |
3834 | 3834 | if ($since == 'never') { |
3835 | 3835 | if (empty($session_id)) { |
3836 | 3836 | $sql = 'SELECT course_user.user_id |
3837 | - FROM ' . $table_course_rel_user . ' course_user |
|
3838 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3837 | + FROM ' . $table_course_rel_user.' course_user |
|
3838 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3839 | 3839 | ON course_user.user_id = stats_login.user_id AND |
3840 | - relation_type<>' . COURSE_RELATION_TYPE_RRHH . ' |
|
3841 | - INNER JOIN ' . $tableCourse . ' c |
|
3840 | + relation_type<>' . COURSE_RELATION_TYPE_RRHH.' |
|
3841 | + INNER JOIN ' . $tableCourse.' c |
|
3842 | 3842 | ON (c.id = course_user.c_id) |
3843 | 3843 | WHERE |
3844 | - course_user.c_id = ' . $courseId . ' AND |
|
3844 | + course_user.c_id = ' . $courseId.' AND |
|
3845 | 3845 | stats_login.login_course_date IS NULL |
3846 | 3846 | GROUP BY course_user.user_id'; |
3847 | 3847 | } else { |
3848 | 3848 | $sql = 'SELECT session_course_user.user_id |
3849 | 3849 | FROM '.$tbl_session_course_user.' session_course_user |
3850 | - LEFT JOIN ' . $tbl_track_login . ' stats_login |
|
3850 | + LEFT JOIN ' . $tbl_track_login.' stats_login |
|
3851 | 3851 | ON session_course_user.user_id = stats_login.user_id |
3852 | - INNER JOIN ' . $tableCourse . ' c |
|
3852 | + INNER JOIN ' . $tableCourse.' c |
|
3853 | 3853 | ON (c.id = session_course_user.c_id) |
3854 | 3854 | WHERE |
3855 | - session_course_user.c_id = ' . $courseId . ' AND |
|
3855 | + session_course_user.c_id = ' . $courseId.' AND |
|
3856 | 3856 | stats_login.login_course_date IS NULL |
3857 | 3857 | GROUP BY session_course_user.user_id'; |
3858 | 3858 | |
@@ -3861,7 +3861,7 @@ discard block |
||
3861 | 3861 | |
3862 | 3862 | $rs = Database::query($sql); |
3863 | 3863 | $inactive_users = array(); |
3864 | - while($user = Database::fetch_array($rs)) { |
|
3864 | + while ($user = Database::fetch_array($rs)) { |
|
3865 | 3865 | $inactive_users[] = $user['user_id']; |
3866 | 3866 | } |
3867 | 3867 | |
@@ -3883,10 +3883,10 @@ discard block |
||
3883 | 3883 | $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
3884 | 3884 | |
3885 | 3885 | $sql = 'SELECT '.$student_id.' |
3886 | - FROM ' . $table . ' |
|
3886 | + FROM ' . $table.' |
|
3887 | 3887 | WHERE |
3888 | - access_user_id=' . $student_id . ' AND |
|
3889 | - c_id="' . $courseId . '" AND |
|
3888 | + access_user_id=' . $student_id.' AND |
|
3889 | + c_id="' . $courseId.'" AND |
|
3890 | 3890 | access_session_id = "'.$session_id.'" '; |
3891 | 3891 | |
3892 | 3892 | $rs = Database::query($sql); |
@@ -3904,13 +3904,13 @@ discard block |
||
3904 | 3904 | { |
3905 | 3905 | $hr_dept_id = intval($hr_dept_id); |
3906 | 3906 | $a_students = array(); |
3907 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3907 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
3908 | 3908 | |
3909 | 3909 | $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user |
3910 | 3910 | WHERE hr_dept_id='.$hr_dept_id; |
3911 | 3911 | $rs = Database::query($sql); |
3912 | 3912 | |
3913 | - while($user = Database :: fetch_array($rs)) { |
|
3913 | + while ($user = Database :: fetch_array($rs)) { |
|
3914 | 3914 | $a_students[$user['user_id']] = $user['user_id']; |
3915 | 3915 | } |
3916 | 3916 | |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | $condition_session = ''; |
3936 | 3936 | if (isset($session_id)) { |
3937 | 3937 | $session_id = intval($session_id); |
3938 | - $condition_session = ' AND access_session_id = '. $session_id; |
|
3938 | + $condition_session = ' AND access_session_id = '.$session_id; |
|
3939 | 3939 | } |
3940 | 3940 | $sql = "SELECT |
3941 | 3941 | access_tool, |
@@ -4047,7 +4047,7 @@ discard block |
||
4047 | 4047 | if (!empty($date_from) && !empty($date_to)) { |
4048 | 4048 | $fieldStartDate = $fields['start_date']; |
4049 | 4049 | if (!isset($fields['end_date'])) { |
4050 | - $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ; |
|
4050 | + $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to); |
|
4051 | 4051 | } else { |
4052 | 4052 | $fieldEndDate = $fields['end_date']; |
4053 | 4053 | $where .= sprintf(" AND fieldStartDate >= '%s' |
@@ -4063,12 +4063,12 @@ discard block |
||
4063 | 4063 | $where |
4064 | 4064 | GROUP BY %s"; |
4065 | 4065 | $sql = sprintf($sql, |
4066 | - $fields['user'], //user field |
|
4067 | - $tableName, //FROM |
|
4068 | - $fields['course'], //course condition |
|
4069 | - $course['real_id'], //course condition |
|
4070 | - $fields['user'], //user condition |
|
4071 | - $userId, //user condition |
|
4066 | + $fields['user'], //user field |
|
4067 | + $tableName, //FROM |
|
4068 | + $fields['course'], //course condition |
|
4069 | + $course['real_id'], //course condition |
|
4070 | + $fields['user'], //user condition |
|
4071 | + $userId, //user condition |
|
4072 | 4072 | $fields['user'] //GROUP BY |
4073 | 4073 | ); |
4074 | 4074 | $rs = Database::query($sql); |
@@ -4076,7 +4076,7 @@ discard block |
||
4076 | 4076 | //iterate query |
4077 | 4077 | if (Database::num_rows($rs) > 0) { |
4078 | 4078 | while ($row = Database::fetch_array($rs)) { |
4079 | - $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total]: $row['total']; |
|
4079 | + $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total']; |
|
4080 | 4080 | } |
4081 | 4081 | } |
4082 | 4082 | } |
@@ -4099,11 +4099,11 @@ discard block |
||
4099 | 4099 | $courseId = api_get_course_int_id($course_code); |
4100 | 4100 | $data = array(); |
4101 | 4101 | |
4102 | - $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4102 | + $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
4103 | 4103 | $condition_session = ''; |
4104 | 4104 | if (isset($session_id)) { |
4105 | 4105 | $session_id = intval($session_id); |
4106 | - $condition_session = ' AND down_session_id = '. $session_id; |
|
4106 | + $condition_session = ' AND down_session_id = '.$session_id; |
|
4107 | 4107 | } |
4108 | 4108 | $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down |
4109 | 4109 | FROM $TABLETRACK_DOWNLOADS |
@@ -4288,7 +4288,7 @@ discard block |
||
4288 | 4288 | |
4289 | 4289 | $final_course_data = array(); |
4290 | 4290 | |
4291 | - foreach($my_course_data as $course_id => $value) { |
|
4291 | + foreach ($my_course_data as $course_id => $value) { |
|
4292 | 4292 | $final_course_data[$course_id] = $course_list[$course_id]; |
4293 | 4293 | } |
4294 | 4294 | $course_in_session[$my_session_id]['course_list'] = $final_course_data; |
@@ -4311,7 +4311,7 @@ discard block |
||
4311 | 4311 | '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).' |
4312 | 4312 | '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
4313 | 4313 | '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).' |
4314 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).' |
|
4314 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4315 | 4315 | '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
4316 | 4316 | '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
4317 | 4317 | </tr>'; |
@@ -4400,7 +4400,7 @@ discard block |
||
4400 | 4400 | $all_exercise_start_time = array(); |
4401 | 4401 | |
4402 | 4402 | foreach ($course_in_session as $my_session_id => $session_data) { |
4403 | - $course_list = $session_data['course_list']; |
|
4403 | + $course_list = $session_data['course_list']; |
|
4404 | 4404 | $user_count = count(SessionManager::get_users_by_session($my_session_id)); |
4405 | 4405 | $exercise_graph_name_list = array(); |
4406 | 4406 | //$user_results = array(); |
@@ -4445,20 +4445,20 @@ discard block |
||
4445 | 4445 | |
4446 | 4446 | $score = 0; |
4447 | 4447 | if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) { |
4448 | - $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100); |
|
4448 | + $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100); |
|
4449 | 4449 | } |
4450 | 4450 | $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0; |
4451 | 4451 | $all_exercise_start_time[] = $time; |
4452 | 4452 | $my_results[] = $score; |
4453 | - if (count($exercise_list)<=10) { |
|
4453 | + if (count($exercise_list) <= 10) { |
|
4454 | 4454 | $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30); |
4455 | - $exercise_graph_name_list[]= $title; |
|
4455 | + $exercise_graph_name_list[] = $title; |
|
4456 | 4456 | $all_exercise_graph_name_list[] = $title; |
4457 | 4457 | } else { |
4458 | 4458 | // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool |
4459 | 4459 | $title = cut($exercise_data['title'], 30); |
4460 | - $exercise_graph_name_list[]= $title; |
|
4461 | - $all_exercise_graph_name_list[]= $title; |
|
4460 | + $exercise_graph_name_list[] = $title; |
|
4461 | + $all_exercise_graph_name_list[] = $title; |
|
4462 | 4462 | } |
4463 | 4463 | } |
4464 | 4464 | } |
@@ -4491,7 +4491,7 @@ discard block |
||
4491 | 4491 | } |
4492 | 4492 | |
4493 | 4493 | $html .= Display::page_subheader( |
4494 | - Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions') |
|
4494 | + Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions') |
|
4495 | 4495 | ); |
4496 | 4496 | |
4497 | 4497 | $html .= '<div class="table-responsive">'; |
@@ -4545,7 +4545,7 @@ discard block |
||
4545 | 4545 | $courseInfo['real_id'], |
4546 | 4546 | $my_session_id |
4547 | 4547 | ); |
4548 | - if ($attempts > 1) { |
|
4548 | + if ($attempts > 1) { |
|
4549 | 4549 | $answered_exercises++; |
4550 | 4550 | } |
4551 | 4551 | } |
@@ -4558,7 +4558,7 @@ discard block |
||
4558 | 4558 | $all_average += $average; |
4559 | 4559 | } |
4560 | 4560 | |
4561 | - $all_average = $all_average / count($course_list); |
|
4561 | + $all_average = $all_average / count($course_list); |
|
4562 | 4562 | |
4563 | 4563 | if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) { |
4564 | 4564 | $html .= '<tr style="background-color:#FBF09D">'; |
@@ -4584,16 +4584,16 @@ discard block |
||
4584 | 4584 | } |
4585 | 4585 | $html .= '</tbody>'; |
4586 | 4586 | $html .= '</table></div><br />'; |
4587 | - $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') ); |
|
4587 | + $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;')); |
|
4588 | 4588 | |
4589 | 4589 | // Checking selected session. |
4590 | 4590 | |
4591 | 4591 | if (isset($_GET['session_id'])) { |
4592 | 4592 | $session_id_from_get = intval($_GET['session_id']); |
4593 | - $session_data = $course_in_session[$session_id_from_get]; |
|
4594 | - $course_list = $session_data['course_list']; |
|
4593 | + $session_data = $course_in_session[$session_id_from_get]; |
|
4594 | + $course_list = $session_data['course_list']; |
|
4595 | 4595 | |
4596 | - $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList')); |
|
4596 | + $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList')); |
|
4597 | 4597 | |
4598 | 4598 | $html .= '<div class="table-responsive">'; |
4599 | 4599 | $html .= '<table class="table table-hover table-striped">'; |
@@ -4602,15 +4602,15 @@ discard block |
||
4602 | 4602 | <thead> |
4603 | 4603 | <tr> |
4604 | 4604 | <th width="300px">'.get_lang('Course').'</th> |
4605 | - '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4606 | - '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4607 | - '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4608 | - '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4609 | - '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4610 | - '.Display::tag('th', get_lang('LPProgress') , array('class'=>'head')).' |
|
4611 | - '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4612 | - '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4613 | - '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4605 | + '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).' |
|
4606 | + '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).' |
|
4607 | + '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).' |
|
4608 | + '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).' |
|
4609 | + '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).' |
|
4610 | + '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).' |
|
4611 | + '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).' |
|
4612 | + '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).' |
|
4613 | + '.Display::tag('th', get_lang('Details'), array('class'=>'head')).' |
|
4614 | 4614 | </tr> |
4615 | 4615 | </thead> |
4616 | 4616 | <tbody> |
@@ -4629,14 +4629,14 @@ discard block |
||
4629 | 4629 | $count_exercises = count($exercises); |
4630 | 4630 | } |
4631 | 4631 | $answered_exercises = 0; |
4632 | - foreach($exercises as $exercise_item) { |
|
4632 | + foreach ($exercises as $exercise_item) { |
|
4633 | 4633 | $attempts = Event::count_exercise_attempts_by_user( |
4634 | 4634 | api_get_user_id(), |
4635 | 4635 | $exercise_item['id'], |
4636 | 4636 | $courseId, |
4637 | 4637 | $session_id_from_get |
4638 | 4638 | ); |
4639 | - if ($attempts > 1) { |
|
4639 | + if ($attempts > 1) { |
|
4640 | 4640 | $answered_exercises++; |
4641 | 4641 | } |
4642 | 4642 | } |
@@ -4645,7 +4645,7 @@ discard block |
||
4645 | 4645 | |
4646 | 4646 | // Average |
4647 | 4647 | $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get); |
4648 | - $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4648 | + $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get); |
|
4649 | 4649 | |
4650 | 4650 | $stats_array[$course_code] = array( |
4651 | 4651 | 'exercises' => $count_exercises, |
@@ -4722,7 +4722,7 @@ discard block |
||
4722 | 4722 | |
4723 | 4723 | if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) { |
4724 | 4724 | $details = '<a href="#">'; |
4725 | - $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4725 | + $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details')); |
|
4726 | 4726 | } else { |
4727 | 4727 | $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">'; |
4728 | 4728 | $details .= Display::return_icon('2rightarrow.png', get_lang('Details')); |
@@ -4822,7 +4822,7 @@ discard block |
||
4822 | 4822 | ); |
4823 | 4823 | |
4824 | 4824 | $html .= '<tr class="row_even">'; |
4825 | - $url = api_get_path(WEB_CODE_PATH) . "exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4825 | + $url = api_get_path(WEB_CODE_PATH)."exercise/overview.php?cidReq={$course_info['code']}&id_session=$session_id&exerciseId={$exercices['id']}"; |
|
4826 | 4826 | |
4827 | 4827 | if ($visible_return['value'] == true) { |
4828 | 4828 | $exercices['title'] = Display::url( |
@@ -4849,7 +4849,7 @@ discard block |
||
4849 | 4849 | ); |
4850 | 4850 | |
4851 | 4851 | $latest_attempt_url = ''; |
4852 | - $best_score = $position = $percentage_score_result = '-'; |
|
4852 | + $best_score = $position = $percentage_score_result = '-'; |
|
4853 | 4853 | $graph = $normal_graph = null; |
4854 | 4854 | |
4855 | 4855 | // Getting best results |
@@ -4881,11 +4881,11 @@ discard block |
||
4881 | 4881 | $weighting = $exercise_stat['exe_weighting']; |
4882 | 4882 | $exe_id = $exercise_stat['exe_id']; |
4883 | 4883 | |
4884 | - $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; |
|
4884 | + $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; |
|
4885 | 4885 | $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url); |
4886 | 4886 | $my_score = 0; |
4887 | 4887 | if (!empty($weighting) && intval($weighting) != 0) { |
4888 | - $my_score = $score/$weighting; |
|
4888 | + $my_score = $score / $weighting; |
|
4889 | 4889 | } |
4890 | 4890 | //@todo this function slows the page |
4891 | 4891 | if (is_int($user_list)) { |
@@ -4899,14 +4899,14 @@ discard block |
||
4899 | 4899 | } |
4900 | 4900 | $html .= Display::div( |
4901 | 4901 | $normal_graph, |
4902 | - array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') |
|
4902 | + array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none') |
|
4903 | 4903 | ); |
4904 | 4904 | |
4905 | 4905 | if (empty($graph)) { |
4906 | 4906 | $graph = '-'; |
4907 | 4907 | } else { |
4908 | 4908 | $graph = Display::url( |
4909 | - '<img src="' . $graph . '" >', |
|
4909 | + '<img src="'.$graph.'" >', |
|
4910 | 4910 | $normal_graph, |
4911 | 4911 | array( |
4912 | 4912 | 'id' => $exercices['id'], |
@@ -4940,7 +4940,7 @@ discard block |
||
4940 | 4940 | |
4941 | 4941 | // LP table results |
4942 | 4942 | $html .= '<div class="table-responsive">'; |
4943 | - $html .='<table class="table table-striped table-hover">'; |
|
4943 | + $html .= '<table class="table table-striped table-hover">'; |
|
4944 | 4944 | $html .= '<thead><tr>'; |
4945 | 4945 | $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000')); |
4946 | 4946 | $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000')); |
@@ -4976,7 +4976,7 @@ discard block |
||
4976 | 4976 | $time_spent_in_lp = api_time_to_hms($time_spent_in_lp); |
4977 | 4977 | |
4978 | 4978 | $html .= '<tr class="row_even">'; |
4979 | - $url = api_get_path(WEB_CODE_PATH) . "lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
4979 | + $url = api_get_path(WEB_CODE_PATH)."lp/lp_controller.php?cidReq={$course_code}&id_session=$session_id&lp_id=$lp_id&action=view"; |
|
4980 | 4980 | |
4981 | 4981 | if ($learnpath['lp_visibility'] == 0) { |
4982 | 4982 | $html .= Display::tag('td', $learnpath['lp_name']); |
@@ -4995,7 +4995,7 @@ discard block |
||
4995 | 4995 | if (!empty($last_connection_in_lp)) { |
4996 | 4996 | $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG); |
4997 | 4997 | } |
4998 | - $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px')); |
|
4998 | + $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px')); |
|
4999 | 4999 | $html .= "</tr>"; |
5000 | 5000 | } |
5001 | 5001 | } else { |
@@ -5005,7 +5005,7 @@ discard block |
||
5005 | 5005 | </td> |
5006 | 5006 | </tr>'; |
5007 | 5007 | } |
5008 | - $html .='</tbody></table></div>'; |
|
5008 | + $html .= '</tbody></table></div>'; |
|
5009 | 5009 | |
5010 | 5010 | $html .= self::displayUserSkills($user_id, $course_info['id'], $session_id); |
5011 | 5011 | } |
@@ -5034,7 +5034,7 @@ discard block |
||
5034 | 5034 | $myData->setSerieDescription('Serie1', get_lang('MyResults')); |
5035 | 5035 | $myData->setSerieDescription('Serie2', get_lang('AverageScore')); |
5036 | 5036 | $myData->setAxisUnit(0, '%'); |
5037 | - $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5037 | + $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5038 | 5038 | // Cache definition |
5039 | 5039 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5040 | 5040 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
@@ -5042,9 +5042,9 @@ discard block |
||
5042 | 5042 | |
5043 | 5043 | if ($myCache->isInCache($chartHash)) { |
5044 | 5044 | //if we already created the img |
5045 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5045 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5046 | 5046 | $myCache->saveFromCache($chartHash, $imgPath); |
5047 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5047 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5048 | 5048 | } else { |
5049 | 5049 | /* Define width, height and angle */ |
5050 | 5050 | $mainWidth = 860; |
@@ -5073,7 +5073,7 @@ discard block |
||
5073 | 5073 | /* Set the default font */ |
5074 | 5074 | $myPicture->setFontProperties( |
5075 | 5075 | array( |
5076 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5076 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5077 | 5077 | 'FontSize' => 10) |
5078 | 5078 | ); |
5079 | 5079 | /* Write the chart title */ |
@@ -5090,7 +5090,7 @@ discard block |
||
5090 | 5090 | /* Set the default font */ |
5091 | 5091 | $myPicture->setFontProperties( |
5092 | 5092 | array( |
5093 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5093 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5094 | 5094 | 'FontSize' => 6 |
5095 | 5095 | ) |
5096 | 5096 | ); |
@@ -5132,7 +5132,7 @@ discard block |
||
5132 | 5132 | /* Draw the line chart */ |
5133 | 5133 | $myPicture->setFontProperties( |
5134 | 5134 | array( |
5135 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
5135 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
5136 | 5136 | 'FontSize' => 10 |
5137 | 5137 | ) |
5138 | 5138 | ); |
@@ -5165,12 +5165,12 @@ discard block |
||
5165 | 5165 | ); |
5166 | 5166 | |
5167 | 5167 | $myCache->writeToCache($chartHash, $myPicture); |
5168 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5168 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5169 | 5169 | $myCache->saveFromCache($chartHash, $imgPath); |
5170 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5170 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5171 | 5171 | } |
5172 | 5172 | |
5173 | - $html = '<img src="' . $imgPath . '">'; |
|
5173 | + $html = '<img src="'.$imgPath.'">'; |
|
5174 | 5174 | |
5175 | 5175 | return $html; |
5176 | 5176 | } |
@@ -5191,12 +5191,12 @@ discard block |
||
5191 | 5191 | |
5192 | 5192 | foreach ($attempts as $attempt) { |
5193 | 5193 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5194 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5195 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5194 | + if ($attempt['exe_weighting'] != 0) { |
|
5195 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5196 | 5196 | } |
5197 | 5197 | } else { |
5198 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5199 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5198 | + if ($attempt['exe_weighting'] != 0) { |
|
5199 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5200 | 5200 | } |
5201 | 5201 | } |
5202 | 5202 | } |
@@ -5205,27 +5205,27 @@ discard block |
||
5205 | 5205 | rsort($my_exercise_result_array); |
5206 | 5206 | $my_exercise_result = 0; |
5207 | 5207 | if (isset($my_exercise_result_array[0])) { |
5208 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5208 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5209 | 5209 | } |
5210 | 5210 | |
5211 | 5211 | $max = 100; |
5212 | - $pieces = 5 ; |
|
5212 | + $pieces = 5; |
|
5213 | 5213 | $part = round($max / $pieces); |
5214 | 5214 | $x_axis = array(); |
5215 | 5215 | $final_array = array(); |
5216 | 5216 | $my_final_array = array(); |
5217 | 5217 | |
5218 | - for ($i=1; $i <=$pieces; $i++) { |
|
5218 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5219 | 5219 | $sum = 1; |
5220 | 5220 | if ($i == 1) { |
5221 | 5221 | $sum = 0; |
5222 | 5222 | } |
5223 | - $min = ($i-1)*$part + $sum; |
|
5224 | - $max = ($i)*$part; |
|
5225 | - $x_axis[]= $min." - ".$max; |
|
5223 | + $min = ($i - 1) * $part + $sum; |
|
5224 | + $max = ($i) * $part; |
|
5225 | + $x_axis[] = $min." - ".$max; |
|
5226 | 5226 | $count = 0; |
5227 | - foreach($exercise_result as $result) { |
|
5228 | - $percentage = $result*100; |
|
5227 | + foreach ($exercise_result as $result) { |
|
5228 | + $percentage = $result * 100; |
|
5229 | 5229 | //echo $percentage.' - '.$min.' - '.$max."<br />"; |
5230 | 5230 | if ($percentage >= $min && $percentage <= $max) { |
5231 | 5231 | //echo ' is > '; |
@@ -5233,7 +5233,7 @@ discard block |
||
5233 | 5233 | } |
5234 | 5234 | } |
5235 | 5235 | //echo '<br />'; |
5236 | - $final_array[]= $count; |
|
5236 | + $final_array[] = $count; |
|
5237 | 5237 | |
5238 | 5238 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5239 | 5239 | $my_final_array[] = 1; |
@@ -5243,9 +5243,9 @@ discard block |
||
5243 | 5243 | } |
5244 | 5244 | |
5245 | 5245 | //Fix to remove the data of the user with my data |
5246 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5246 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5247 | 5247 | if (!empty($my_final_array[$i])) { |
5248 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5248 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5249 | 5249 | $final_array[$i] = 0; |
5250 | 5250 | } |
5251 | 5251 | } |
@@ -5255,16 +5255,16 @@ discard block |
||
5255 | 5255 | $dataSet->addPoints($final_array, 'Serie1'); |
5256 | 5256 | $dataSet->addPoints($my_final_array, 'Serie2'); |
5257 | 5257 | $dataSet->normalize(100, "%"); |
5258 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5258 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5259 | 5259 | |
5260 | 5260 | // Cache definition |
5261 | 5261 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
5262 | 5262 | $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1))); |
5263 | 5263 | $chartHash = $myCache->getHash($dataSet); |
5264 | 5264 | if ($myCache->isInCache($chartHash)) { |
5265 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5265 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5266 | 5266 | $myCache->saveFromCache($chartHash, $imgPath); |
5267 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5267 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5268 | 5268 | } else { |
5269 | 5269 | /* Create the pChart object */ |
5270 | 5270 | $widthSize = 80; |
@@ -5280,7 +5280,7 @@ discard block |
||
5280 | 5280 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5281 | 5281 | |
5282 | 5282 | /* Set the default font */ |
5283 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5283 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize)); |
|
5284 | 5284 | |
5285 | 5285 | /* Do not write the chart title */ |
5286 | 5286 | |
@@ -5344,9 +5344,9 @@ discard block |
||
5344 | 5344 | |
5345 | 5345 | /* Save and write in cache */ |
5346 | 5346 | $myCache->writeToCache($chartHash, $myPicture); |
5347 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5347 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5348 | 5348 | $myCache->saveFromCache($chartHash, $imgPath); |
5349 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5349 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5350 | 5350 | } |
5351 | 5351 | |
5352 | 5352 | return $imgPath; |
@@ -5366,12 +5366,12 @@ discard block |
||
5366 | 5366 | } |
5367 | 5367 | foreach ($attempts as $attempt) { |
5368 | 5368 | if (api_get_user_id() == $attempt['exe_user_id']) { |
5369 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5370 | - $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5369 | + if ($attempt['exe_weighting'] != 0) { |
|
5370 | + $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5371 | 5371 | } |
5372 | 5372 | } else { |
5373 | - if ($attempt['exe_weighting'] != 0 ) { |
|
5374 | - $exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting']; |
|
5373 | + if ($attempt['exe_weighting'] != 0) { |
|
5374 | + $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting']; |
|
5375 | 5375 | } |
5376 | 5376 | } |
5377 | 5377 | } |
@@ -5380,32 +5380,32 @@ discard block |
||
5380 | 5380 | rsort($my_exercise_result_array); |
5381 | 5381 | $my_exercise_result = 0; |
5382 | 5382 | if (isset($my_exercise_result_array[0])) { |
5383 | - $my_exercise_result = $my_exercise_result_array[0] *100; |
|
5383 | + $my_exercise_result = $my_exercise_result_array[0] * 100; |
|
5384 | 5384 | } |
5385 | 5385 | |
5386 | 5386 | $max = 100; |
5387 | - $pieces = 5 ; |
|
5387 | + $pieces = 5; |
|
5388 | 5388 | $part = round($max / $pieces); |
5389 | 5389 | $x_axis = array(); |
5390 | 5390 | $final_array = array(); |
5391 | 5391 | $my_final_array = array(); |
5392 | 5392 | |
5393 | - for ($i=1; $i <=$pieces; $i++) { |
|
5393 | + for ($i = 1; $i <= $pieces; $i++) { |
|
5394 | 5394 | $sum = 1; |
5395 | 5395 | if ($i == 1) { |
5396 | 5396 | $sum = 0; |
5397 | 5397 | } |
5398 | - $min = ($i-1)*$part + $sum; |
|
5399 | - $max = ($i)*$part; |
|
5400 | - $x_axis[]= $min." - ".$max; |
|
5398 | + $min = ($i - 1) * $part + $sum; |
|
5399 | + $max = ($i) * $part; |
|
5400 | + $x_axis[] = $min." - ".$max; |
|
5401 | 5401 | $count = 0; |
5402 | - foreach($exercise_result as $result) { |
|
5403 | - $percentage = $result*100; |
|
5402 | + foreach ($exercise_result as $result) { |
|
5403 | + $percentage = $result * 100; |
|
5404 | 5404 | if ($percentage >= $min && $percentage <= $max) { |
5405 | 5405 | $count++; |
5406 | 5406 | } |
5407 | 5407 | } |
5408 | - $final_array[]= $count; |
|
5408 | + $final_array[] = $count; |
|
5409 | 5409 | |
5410 | 5410 | if ($my_exercise_result >= $min && $my_exercise_result <= $max) { |
5411 | 5411 | $my_final_array[] = 1; |
@@ -5416,9 +5416,9 @@ discard block |
||
5416 | 5416 | |
5417 | 5417 | //Fix to remove the data of the user with my data |
5418 | 5418 | |
5419 | - for($i = 0; $i<=count($my_final_array); $i++) { |
|
5419 | + for ($i = 0; $i <= count($my_final_array); $i++) { |
|
5420 | 5420 | if (!empty($my_final_array[$i])) { |
5421 | - $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5421 | + $my_final_array[$i] = $final_array[$i] + 1; //Add my result |
|
5422 | 5422 | $final_array[$i] = 0; |
5423 | 5423 | } |
5424 | 5424 | } |
@@ -5436,7 +5436,7 @@ discard block |
||
5436 | 5436 | $dataSet->setXAxisName(get_lang('Score')); |
5437 | 5437 | $dataSet->normalize(100, "%"); |
5438 | 5438 | |
5439 | - $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true); |
|
5439 | + $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true); |
|
5440 | 5440 | |
5441 | 5441 | // Cache definition |
5442 | 5442 | $cachePath = api_get_path(SYS_ARCHIVE_PATH); |
@@ -5444,9 +5444,9 @@ discard block |
||
5444 | 5444 | $chartHash = $myCache->getHash($dataSet); |
5445 | 5445 | |
5446 | 5446 | if ($myCache->isInCache($chartHash)) { |
5447 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5447 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5448 | 5448 | $myCache->saveFromCache($chartHash, $imgPath); |
5449 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5449 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5450 | 5450 | } else { |
5451 | 5451 | /* Create the pChart object */ |
5452 | 5452 | $widthSize = 480; |
@@ -5462,7 +5462,7 @@ discard block |
||
5462 | 5462 | $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0)); |
5463 | 5463 | |
5464 | 5464 | /* Set the default font */ |
5465 | - $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5465 | + $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10)); |
|
5466 | 5466 | |
5467 | 5467 | /* Write the chart title */ |
5468 | 5468 | $myPicture->drawText( |
@@ -5521,9 +5521,9 @@ discard block |
||
5521 | 5521 | |
5522 | 5522 | /* Write and save into cache */ |
5523 | 5523 | $myCache->writeToCache($chartHash, $myPicture); |
5524 | - $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
5524 | + $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
5525 | 5525 | $myCache->saveFromCache($chartHash, $imgPath); |
5526 | - $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
5526 | + $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
5527 | 5527 | } |
5528 | 5528 | |
5529 | 5529 | return $imgPath; |
@@ -5650,7 +5650,7 @@ discard block |
||
5650 | 5650 | $whereSessionParams .= $sessionIdx.','; |
5651 | 5651 | } |
5652 | 5652 | } |
5653 | - $whereSessionParams = substr($whereSessionParams,0,-1); |
|
5653 | + $whereSessionParams = substr($whereSessionParams, 0, -1); |
|
5654 | 5654 | } |
5655 | 5655 | |
5656 | 5656 | if (!empty($exerciseId)) { |
@@ -5711,7 +5711,7 @@ discard block |
||
5711 | 5711 | qq.position = rq.question_order AND |
5712 | 5712 | ta.question_id = rq.question_id |
5713 | 5713 | WHERE |
5714 | - te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")." |
|
5714 | + te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")." |
|
5715 | 5715 | AND q.c_id = $courseIdx |
5716 | 5716 | $where $order $limit"; |
5717 | 5717 | $sql_query = vsprintf($sql, $whereParams); |
@@ -5759,7 +5759,7 @@ discard block |
||
5759 | 5759 | // Now fill users data |
5760 | 5760 | $sqlUsers = "SELECT user_id, username, lastname, firstname |
5761 | 5761 | FROM $tuser |
5762 | - WHERE user_id IN (".implode(',',$userIds).")"; |
|
5762 | + WHERE user_id IN (".implode(',', $userIds).")"; |
|
5763 | 5763 | $resUsers = Database::query($sqlUsers); |
5764 | 5764 | while ($rowUser = Database::fetch_assoc($resUsers)) { |
5765 | 5765 | $users[$rowUser['user_id']] = $rowUser; |
@@ -5863,7 +5863,7 @@ discard block |
||
5863 | 5863 | <table class="table" id="skillList"> |
5864 | 5864 | <thead> |
5865 | 5865 | <tr> |
5866 | - <th>' . get_lang('AchievedSkills') . '</th> |
|
5866 | + <th>' . get_lang('AchievedSkills').'</th> |
|
5867 | 5867 | </tr> |
5868 | 5868 | </thead> |
5869 | 5869 | <tbody> |
@@ -5882,10 +5882,10 @@ discard block |
||
5882 | 5882 | |
5883 | 5883 | $html .= ' |
5884 | 5884 | <li class="thumbnail"> |
5885 | - <a href="' . api_get_path(WEB_PATH) . 'badge/' . $userSkill->getId() . '/user/' . $userId . '" target="_blank"> |
|
5886 | - <img class="img-responsive" title="' . $skill->getName() . '" src="' . $skill->getWebIconPath() . '" width="64" height="64"> |
|
5885 | + <a href="' . api_get_path(WEB_PATH).'badge/'.$userSkill->getId().'/user/'.$userId.'" target="_blank"> |
|
5886 | + <img class="img-responsive" title="' . $skill->getName().'" src="'.$skill->getWebIconPath().'" width="64" height="64"> |
|
5887 | 5887 | <div class="caption"> |
5888 | - <p class="text-center">' . $skill->getName() . '</p> |
|
5888 | + <p class="text-center">' . $skill->getName().'</p> |
|
5889 | 5889 | </div> |
5890 | 5890 | </a> |
5891 | 5891 | </li> |
@@ -5935,7 +5935,7 @@ discard block |
||
5935 | 5935 | WHERE |
5936 | 5936 | track_resource.c_id = $course_id AND |
5937 | 5937 | track_resource.insert_user_id = user.user_id AND |
5938 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5938 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5939 | 5939 | |
5940 | 5940 | if (isset($_GET['keyword'])) { |
5941 | 5941 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -5993,7 +5993,7 @@ discard block |
||
5993 | 5993 | WHERE |
5994 | 5994 | track_resource.c_id = $course_id AND |
5995 | 5995 | track_resource.insert_user_id = user.user_id AND |
5996 | - session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5996 | + session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
|
5997 | 5997 | |
5998 | 5998 | if (isset($_GET['keyword'])) { |
5999 | 5999 | $keyword = Database::escape_string(trim($_GET['keyword'])); |
@@ -6287,7 +6287,7 @@ discard block |
||
6287 | 6287 | public static function display_additional_profile_fields() |
6288 | 6288 | { |
6289 | 6289 | // getting all the extra profile fields that are defined by the platform administrator |
6290 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6290 | + $extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC'); |
|
6291 | 6291 | |
6292 | 6292 | // creating the form |
6293 | 6293 | $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
@@ -6299,8 +6299,8 @@ discard block |
||
6299 | 6299 | $extra_fields_to_show = 0; |
6300 | 6300 | foreach ($extra_fields as $key=>$field) { |
6301 | 6301 | // show only extra fields that are visible + and can be filtered, added by J.Montoya |
6302 | - if ($field[6]==1 && $field[8] == 1) { |
|
6303 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6302 | + if ($field[6] == 1 && $field[8] == 1) { |
|
6303 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) { |
|
6304 | 6304 | $selected = 'selected="selected"'; |
6305 | 6305 | } else { |
6306 | 6306 | $selected = ''; |
@@ -6312,8 +6312,8 @@ discard block |
||
6312 | 6312 | $return .= '</select>'; |
6313 | 6313 | |
6314 | 6314 | // the form elements for the $_GET parameters (because the form is passed through GET |
6315 | - foreach ($_GET as $key=>$value){ |
|
6316 | - if ($key <> 'additional_profile_field') { |
|
6315 | + foreach ($_GET as $key=>$value) { |
|
6316 | + if ($key <> 'additional_profile_field') { |
|
6317 | 6317 | $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
6318 | 6318 | } |
6319 | 6319 | } |
@@ -6350,21 +6350,21 @@ discard block |
||
6350 | 6350 | $result_extra_field = UserManager::get_extra_field_information($field_id); |
6351 | 6351 | |
6352 | 6352 | if (!empty($users)) { |
6353 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6354 | - foreach($users as $user_id) { |
|
6353 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) { |
|
6354 | + foreach ($users as $user_id) { |
|
6355 | 6355 | $user_result = UserManager::get_user_tags($user_id, $field_id); |
6356 | 6356 | $tag_list = array(); |
6357 | - foreach($user_result as $item) { |
|
6357 | + foreach ($user_result as $item) { |
|
6358 | 6358 | $tag_list[] = $item['tag']; |
6359 | 6359 | } |
6360 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6360 | + $return[$user_id][] = implode(', ', $tag_list); |
|
6361 | 6361 | } |
6362 | 6362 | } else { |
6363 | 6363 | $new_user_array = array(); |
6364 | 6364 | foreach ($users as $user_id) { |
6365 | - $new_user_array[]= "'".$user_id."'"; |
|
6365 | + $new_user_array[] = "'".$user_id."'"; |
|
6366 | 6366 | } |
6367 | - $users = implode(',',$new_user_array); |
|
6367 | + $users = implode(',', $new_user_array); |
|
6368 | 6368 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6369 | 6369 | // Selecting only the necessary information NOT ALL the user list |
6370 | 6370 | $sql = "SELECT user.user_id, v.value |
@@ -6379,7 +6379,7 @@ discard block |
||
6379 | 6379 | user.user_id IN ($users)"; |
6380 | 6380 | |
6381 | 6381 | $result = Database::query($sql); |
6382 | - while($row = Database::fetch_array($result)) { |
|
6382 | + while ($row = Database::fetch_array($result)) { |
|
6383 | 6383 | // get option value for field type double select by id |
6384 | 6384 | if (!empty($row['value'])) { |
6385 | 6385 | if ($result_extra_field['field_type'] == |
@@ -6418,7 +6418,7 @@ discard block |
||
6418 | 6418 | |
6419 | 6419 | public function sort_users_desc($a, $b) |
6420 | 6420 | { |
6421 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6421 | + return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6422 | 6422 | } |
6423 | 6423 | |
6424 | 6424 | /** |
@@ -6453,7 +6453,7 @@ discard block |
||
6453 | 6453 | // get all users data from a course for sortable with limit |
6454 | 6454 | if (is_array($user_ids)) { |
6455 | 6455 | $user_ids = array_map('intval', $user_ids); |
6456 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6456 | + $condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") "; |
|
6457 | 6457 | } else { |
6458 | 6458 | $user_ids = intval($user_ids); |
6459 | 6459 | $condition_user = " WHERE user.user_id = $user_ids "; |
@@ -6461,7 +6461,7 @@ discard block |
||
6461 | 6461 | |
6462 | 6462 | if (!empty($_GET['user_keyword'])) { |
6463 | 6463 | $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
6464 | - $condition_user .= " AND ( |
|
6464 | + $condition_user .= " AND ( |
|
6465 | 6465 | user.firstname LIKE '%".$keyword."%' OR |
6466 | 6466 | user.lastname LIKE '%".$keyword."%' OR |
6467 | 6467 | user.username LIKE '%".$keyword."%' OR |
@@ -6479,7 +6479,7 @@ discard block |
||
6479 | 6479 | $invitedUsersCondition = ''; |
6480 | 6480 | |
6481 | 6481 | if (!$includeInvitedUsers) { |
6482 | - $invitedUsersCondition = " AND user.status != " . INVITEE; |
|
6482 | + $invitedUsersCondition = " AND user.status != ".INVITEE; |
|
6483 | 6483 | } |
6484 | 6484 | |
6485 | 6485 | $sql = "SELECT user.user_id as user_id, |
@@ -6490,7 +6490,7 @@ discard block |
||
6490 | 6490 | FROM $tbl_user as user $url_table |
6491 | 6491 | $condition_user $url_condition $invitedUsersCondition"; |
6492 | 6492 | |
6493 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6493 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
6494 | 6494 | $direction = 'ASC'; |
6495 | 6495 | } |
6496 | 6496 | |
@@ -6627,7 +6627,7 @@ discard block |
||
6627 | 6627 | } |
6628 | 6628 | |
6629 | 6629 | if (empty($session_id)) { |
6630 | - $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
|
6630 | + $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys; |
|
6631 | 6631 | } |
6632 | 6632 | |
6633 | 6633 | $user['link'] = '<center> |
@@ -6639,37 +6639,37 @@ discard block |
||
6639 | 6639 | // store columns in array $users |
6640 | 6640 | $is_western_name_order = api_is_western_name_order(); |
6641 | 6641 | $user_row = array(); |
6642 | - $user_row[]= $user['official_code']; //0 |
|
6642 | + $user_row[] = $user['official_code']; //0 |
|
6643 | 6643 | if ($is_western_name_order) { |
6644 | - $user_row[]= $user['firstname']; |
|
6645 | - $user_row[]= $user['lastname']; |
|
6644 | + $user_row[] = $user['firstname']; |
|
6645 | + $user_row[] = $user['lastname']; |
|
6646 | 6646 | } else { |
6647 | - $user_row[]= $user['lastname']; |
|
6648 | - $user_row[]= $user['firstname']; |
|
6647 | + $user_row[] = $user['lastname']; |
|
6648 | + $user_row[] = $user['firstname']; |
|
6649 | 6649 | } |
6650 | - $user_row[]= $user['username']; |
|
6651 | - $user_row[]= $user['time']; |
|
6652 | - $user_row[]= $user['average_progress']; |
|
6653 | - $user_row[]= $user['exercise_progress']; |
|
6654 | - $user_row[]= $user['exercise_average_best_attempt']; |
|
6655 | - $user_row[]= $user['student_score']; |
|
6656 | - $user_row[]= $user['count_assignments']; |
|
6657 | - $user_row[]= $user['count_messages']; |
|
6650 | + $user_row[] = $user['username']; |
|
6651 | + $user_row[] = $user['time']; |
|
6652 | + $user_row[] = $user['average_progress']; |
|
6653 | + $user_row[] = $user['exercise_progress']; |
|
6654 | + $user_row[] = $user['exercise_average_best_attempt']; |
|
6655 | + $user_row[] = $user['student_score']; |
|
6656 | + $user_row[] = $user['count_assignments']; |
|
6657 | + $user_row[] = $user['count_messages']; |
|
6658 | 6658 | |
6659 | 6659 | $userGroupManager = new UserGroup(); |
6660 | 6660 | $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS); |
6661 | 6661 | |
6662 | 6662 | if (empty($session_id)) { |
6663 | - $user_row[]= $user['survey']; |
|
6663 | + $user_row[] = $user['survey']; |
|
6664 | 6664 | } |
6665 | 6665 | |
6666 | - $user_row[]= $user['first_connection']; |
|
6667 | - $user_row[]= $user['last_connection']; |
|
6666 | + $user_row[] = $user['first_connection']; |
|
6667 | + $user_row[] = $user['last_connection']; |
|
6668 | 6668 | if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
6669 | - $user_row[]= $user['additional']; |
|
6669 | + $user_row[] = $user['additional']; |
|
6670 | 6670 | } |
6671 | 6671 | |
6672 | - $user_row[]= $user['link']; |
|
6672 | + $user_row[] = $user['link']; |
|
6673 | 6673 | |
6674 | 6674 | $users[] = $user_row; |
6675 | 6675 | |
@@ -6714,8 +6714,8 @@ discard block |
||
6714 | 6714 | |
6715 | 6715 | $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
6716 | 6716 | $tempView = $view; |
6717 | - if(substr($view,0,1) == '1') { |
|
6718 | - $new_view = substr_replace($view,'0',0,1); |
|
6717 | + if (substr($view, 0, 1) == '1') { |
|
6718 | + $new_view = substr_replace($view, '0', 0, 1); |
|
6719 | 6719 | echo " |
6720 | 6720 | <tr> |
6721 | 6721 | <td valign='top'> |
@@ -6748,9 +6748,9 @@ discard block |
||
6748 | 6748 | </tr>"; |
6749 | 6749 | $total = 0; |
6750 | 6750 | if (is_array($results)) { |
6751 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6751 | + for ($j = 0; $j < count($results); $j++) { |
|
6752 | 6752 | echo "<tr>"; |
6753 | - 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>"; |
|
6753 | + 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>"; |
|
6754 | 6754 | echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
6755 | 6755 | echo"</tr>"; |
6756 | 6756 | $total = $total + $results[$j][1]; |
@@ -6767,7 +6767,7 @@ discard block |
||
6767 | 6767 | echo "</table>"; |
6768 | 6768 | echo "</td></tr>"; |
6769 | 6769 | } else { |
6770 | - $new_view = substr_replace($view,'1',0,1); |
|
6770 | + $new_view = substr_replace($view, '1', 0, 1); |
|
6771 | 6771 | echo " |
6772 | 6772 | <tr> |
6773 | 6773 | <td valign='top'> |
@@ -6790,8 +6790,8 @@ discard block |
||
6790 | 6790 | { |
6791 | 6791 | global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
6792 | 6792 | $courseId = api_get_course_int_id($courseCode); |
6793 | - if(substr($view,1,1) == '1') { |
|
6794 | - $new_view = substr_replace($view,'0',1,1); |
|
6793 | + if (substr($view, 1, 1) == '1') { |
|
6794 | + $new_view = substr_replace($view, '0', 1, 1); |
|
6795 | 6795 | echo "<tr> |
6796 | 6796 | <td valign='top'> |
6797 | 6797 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
@@ -6833,7 +6833,7 @@ discard block |
||
6833 | 6833 | </tr>"; |
6834 | 6834 | |
6835 | 6835 | if (is_array($results)) { |
6836 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6836 | + for ($i = 0; $i < sizeof($results); $i++) { |
|
6837 | 6837 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
6838 | 6838 | echo "<tr>\n"; |
6839 | 6839 | echo "<td class='content'>".$results[$i][0]."</td>\n"; |
@@ -6848,8 +6848,8 @@ discard block |
||
6848 | 6848 | |
6849 | 6849 | // The Result of Tests |
6850 | 6850 | if (is_array($hpresults)) { |
6851 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6852 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6851 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
6852 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
6853 | 6853 | if ($title == '') |
6854 | 6854 | $title = basename($hpresults[$i][0]); |
6855 | 6855 | $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
@@ -6875,7 +6875,7 @@ discard block |
||
6875 | 6875 | echo "</table>"; |
6876 | 6876 | echo "</td>\n</tr>\n"; |
6877 | 6877 | } else { |
6878 | - $new_view = substr_replace($view,'1',1,1); |
|
6878 | + $new_view = substr_replace($view, '1', 1, 1); |
|
6879 | 6879 | echo " |
6880 | 6880 | <tr> |
6881 | 6881 | <td valign='top'> |
@@ -6894,8 +6894,8 @@ discard block |
||
6894 | 6894 | global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
6895 | 6895 | $_course = api_get_course_info_by_id($course_id); |
6896 | 6896 | |
6897 | - if (substr($view,2,1) == '1') { |
|
6898 | - $new_view = substr_replace($view,'0',2,1); |
|
6897 | + if (substr($view, 2, 1) == '1') { |
|
6898 | + $new_view = substr_replace($view, '0', 2, 1); |
|
6899 | 6899 | echo "<tr> |
6900 | 6900 | <td valign='top'> |
6901 | 6901 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
@@ -6909,7 +6909,7 @@ discard block |
||
6909 | 6909 | AND u.c_id = '".intval($course_id)."' |
6910 | 6910 | ORDER BY u.upload_date DESC"; |
6911 | 6911 | echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
6912 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6912 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6913 | 6913 | echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
6914 | 6914 | echo "<tr> |
6915 | 6915 | <td class='secLine' width='40%'> |
@@ -6923,7 +6923,7 @@ discard block |
||
6923 | 6923 | </td> |
6924 | 6924 | </tr>"; |
6925 | 6925 | if (is_array($results)) { |
6926 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6926 | + for ($j = 0; $j < count($results); $j++) { |
|
6927 | 6927 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
6928 | 6928 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
6929 | 6929 | echo "<tr>"; |
@@ -6942,7 +6942,7 @@ discard block |
||
6942 | 6942 | echo "</table>"; |
6943 | 6943 | echo "</td></tr>"; |
6944 | 6944 | } else { |
6945 | - $new_view = substr_replace($view,'1',2,1); |
|
6945 | + $new_view = substr_replace($view, '1', 2, 1); |
|
6946 | 6946 | echo " |
6947 | 6947 | <tr> |
6948 | 6948 | <td valign='top'> |
@@ -6961,8 +6961,8 @@ discard block |
||
6961 | 6961 | { |
6962 | 6962 | global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
6963 | 6963 | $courseId = api_get_course_int_id($courseCode); |
6964 | - if (substr($view,3,1) == '1') { |
|
6965 | - $new_view = substr_replace($view,'0',3,1); |
|
6964 | + if (substr($view, 3, 1) == '1') { |
|
6965 | + $new_view = substr_replace($view, '0', 3, 1); |
|
6966 | 6966 | echo " |
6967 | 6967 | <tr> |
6968 | 6968 | <td valign='top'> |
@@ -6986,7 +6986,7 @@ discard block |
||
6986 | 6986 | </td> |
6987 | 6987 | </tr>"; |
6988 | 6988 | if (is_array($results)) { |
6989 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6989 | + for ($j = 0; $j < count($results); $j++) { |
|
6990 | 6990 | echo "<tr>"; |
6991 | 6991 | echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
6992 | 6992 | echo"</tr>"; |
@@ -6999,7 +6999,7 @@ discard block |
||
6999 | 6999 | echo "</table>"; |
7000 | 7000 | echo "</td></tr>"; |
7001 | 7001 | } else { |
7002 | - $new_view = substr_replace($view,'1',3,1); |
|
7002 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7003 | 7003 | echo " |
7004 | 7004 | <tr> |
7005 | 7005 | <td valign='top'> |
@@ -7026,8 +7026,8 @@ discard block |
||
7026 | 7026 | $session_id = intval($session_id); |
7027 | 7027 | |
7028 | 7028 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7029 | - if(substr($view,4,1) == '1') { |
|
7030 | - $new_view = substr_replace($view,'0',4,1); |
|
7029 | + if (substr($view, 4, 1) == '1') { |
|
7030 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7031 | 7031 | echo " |
7032 | 7032 | <tr> |
7033 | 7033 | <td valign='top'> |
@@ -7053,7 +7053,7 @@ discard block |
||
7053 | 7053 | </td> |
7054 | 7054 | </tr>"; |
7055 | 7055 | if (is_array($results)) { |
7056 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7056 | + for ($j = 0; $j < count($results); $j++) { |
|
7057 | 7057 | echo "<tr>"; |
7058 | 7058 | echo "<td class='content'>".$results[$j]."</td>"; |
7059 | 7059 | echo"</tr>"; |
@@ -7066,7 +7066,7 @@ discard block |
||
7066 | 7066 | echo "</table>"; |
7067 | 7067 | echo "</td></tr>"; |
7068 | 7068 | } else { |
7069 | - $new_view = substr_replace($view,'1',4,1); |
|
7069 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7070 | 7070 | echo " |
7071 | 7071 | <tr> |
7072 | 7072 | <td valign='top'> |
@@ -7100,11 +7100,11 @@ discard block |
||
7100 | 7100 | ORDER BY login_date DESC LIMIT 1"; |
7101 | 7101 | $ip = ''; |
7102 | 7102 | $res_ip = Database::query($sql_ip); |
7103 | - if ($res_ip !== false && Database::num_rows($res_ip)>0) { |
|
7103 | + if ($res_ip !== false && Database::num_rows($res_ip) > 0) { |
|
7104 | 7104 | $row_ip = Database::fetch_row($res_ip); |
7105 | 7105 | if ($return_as_link) { |
7106 | 7106 | $ip = Display::url( |
7107 | - (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7107 | + (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1], |
|
7108 | 7108 | array('title'=>get_lang('TraceIP'), 'target'=>'_blank') |
7109 | 7109 | ); |
7110 | 7110 | } else { |
@@ -7140,9 +7140,9 @@ discard block |
||
7140 | 7140 | $course_id = intval($course_id); |
7141 | 7141 | |
7142 | 7142 | $tempView = $view; |
7143 | - if (substr($view,0,1) == '1') { |
|
7144 | - $new_view = substr_replace($view,'0',0,1); |
|
7145 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7143 | + if (substr($view, 0, 1) == '1') { |
|
7144 | + $new_view = substr_replace($view, '0', 0, 1); |
|
7145 | + $title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7146 | 7146 | $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
7147 | 7147 | FROM $track_access_table |
7148 | 7148 | WHERE access_user_id = $user_id |
@@ -7152,20 +7152,20 @@ discard block |
||
7152 | 7152 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7153 | 7153 | //$results = getManyResults2Col($sql); |
7154 | 7154 | $results = getManyResults3Col($sql); |
7155 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7156 | - $line=''; |
|
7155 | + $title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7156 | + $line = ''; |
|
7157 | 7157 | $total = 0; |
7158 | 7158 | if (is_array($results)) { |
7159 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7159 | + for ($j = 0; $j < count($results); $j++) { |
|
7160 | 7160 | $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
7161 | 7161 | $total = $total + $results[$j][1]; |
7162 | 7162 | } |
7163 | 7163 | $line .= get_lang('Total').";".$total."\n"; |
7164 | 7164 | } else { |
7165 | - $line= get_lang('NoResult')."</center></td>"; |
|
7165 | + $line = get_lang('NoResult')."</center></td>"; |
|
7166 | 7166 | } |
7167 | 7167 | } else { |
7168 | - $new_view = substr_replace($view,'1',0,1); |
|
7168 | + $new_view = substr_replace($view, '1', 0, 1); |
|
7169 | 7169 | } |
7170 | 7170 | return array($title_line, $line); |
7171 | 7171 | } |
@@ -7183,8 +7183,8 @@ discard block |
||
7183 | 7183 | global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
7184 | 7184 | $courseId = api_get_course_int_id($courseCode); |
7185 | 7185 | $userId = intval($userId); |
7186 | - if (substr($view,1,1) == '1') { |
|
7187 | - $new_view = substr_replace($view,'0',1,1); |
|
7186 | + if (substr($view, 1, 1) == '1') { |
|
7187 | + $new_view = substr_replace($view, '0', 1, 1); |
|
7188 | 7188 | $title[1] = get_lang('ExercicesDetails'); |
7189 | 7189 | $line = ''; |
7190 | 7190 | $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
@@ -7208,7 +7208,7 @@ discard block |
||
7208 | 7208 | $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
7209 | 7209 | |
7210 | 7210 | if (is_array($results)) { |
7211 | - for($i = 0; $i < sizeof($results); $i++) |
|
7211 | + for ($i = 0; $i < sizeof($results); $i++) |
|
7212 | 7212 | { |
7213 | 7213 | $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
7214 | 7214 | $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
@@ -7220,8 +7220,8 @@ discard block |
||
7220 | 7220 | |
7221 | 7221 | // The Result of Tests |
7222 | 7222 | if (is_array($hpresults)) { |
7223 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7224 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7223 | + for ($i = 0; $i < sizeof($hpresults); $i++) { |
|
7224 | + $title = GetQuizName($hpresults[$i][0], ''); |
|
7225 | 7225 | |
7226 | 7226 | if ($title == '') |
7227 | 7227 | $title = basename($hpresults[$i][0]); |
@@ -7235,10 +7235,10 @@ discard block |
||
7235 | 7235 | } |
7236 | 7236 | |
7237 | 7237 | if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
7238 | - $line=get_lang('NoResult'); |
|
7238 | + $line = get_lang('NoResult'); |
|
7239 | 7239 | } |
7240 | 7240 | } else { |
7241 | - $new_view = substr_replace($view,'1',1,1); |
|
7241 | + $new_view = substr_replace($view, '1', 1, 1); |
|
7242 | 7242 | } |
7243 | 7243 | return array($title_line, $line); |
7244 | 7244 | } |
@@ -7254,7 +7254,7 @@ discard block |
||
7254 | 7254 | $user_id = intval($user_id); |
7255 | 7255 | $course_id = intval($course_id); |
7256 | 7256 | |
7257 | - if (substr($view,2,1) == '1') { |
|
7257 | + if (substr($view, 2, 1) == '1') { |
|
7258 | 7258 | $sql = "SELECT u.upload_date, w.title, w.author, w.url |
7259 | 7259 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7260 | 7260 | WHERE |
@@ -7262,21 +7262,21 @@ discard block |
||
7262 | 7262 | u.upload_user_id = '$user_id' AND |
7263 | 7263 | u.c_id = '$course_id' |
7264 | 7264 | ORDER BY u.upload_date DESC"; |
7265 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7265 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7266 | 7266 | |
7267 | - $title[1]=get_lang('WorksDetails'); |
|
7268 | - $line=''; |
|
7269 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7267 | + $title[1] = get_lang('WorksDetails'); |
|
7268 | + $line = ''; |
|
7269 | + $title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7270 | 7270 | |
7271 | 7271 | if (is_array($results)) { |
7272 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7272 | + for ($j = 0; $j < count($results); $j++) { |
|
7273 | 7273 | $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
7274 | 7274 | $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
7275 | 7275 | $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
7276 | 7276 | } |
7277 | 7277 | |
7278 | 7278 | } else { |
7279 | - $line= get_lang('NoResult'); |
|
7279 | + $line = get_lang('NoResult'); |
|
7280 | 7280 | } |
7281 | 7281 | } |
7282 | 7282 | return array($title_line, $line); |
@@ -7292,9 +7292,9 @@ discard block |
||
7292 | 7292 | $courseId = api_get_course_int_id($courseCode); |
7293 | 7293 | $userId = intval($userId); |
7294 | 7294 | $line = null; |
7295 | - if (substr($view,3,1) == '1') { |
|
7296 | - $new_view = substr_replace($view,'0',3,1); |
|
7297 | - $title[1]=get_lang('LinksDetails'); |
|
7295 | + if (substr($view, 3, 1) == '1') { |
|
7296 | + $new_view = substr_replace($view, '0', 3, 1); |
|
7297 | + $title[1] = get_lang('LinksDetails'); |
|
7298 | 7298 | $sql = "SELECT cl.title, cl.url |
7299 | 7299 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7300 | 7300 | WHERE sl.links_link_id = cl.id |
@@ -7302,16 +7302,16 @@ discard block |
||
7302 | 7302 | AND sl.links_user_id = $userId |
7303 | 7303 | GROUP BY cl.title, cl.url"; |
7304 | 7304 | $results = StatsUtils::getManyResults2Col($sql); |
7305 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7305 | + $title_line = get_lang('LinksTitleLinkColumn')."\n"; |
|
7306 | 7306 | if (is_array($results)) { |
7307 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7307 | + for ($j = 0; $j < count($results); $j++) { |
|
7308 | 7308 | $line .= $results[$j][0]."\n"; |
7309 | 7309 | } |
7310 | 7310 | } else { |
7311 | - $line=get_lang('NoResult'); |
|
7311 | + $line = get_lang('NoResult'); |
|
7312 | 7312 | } |
7313 | 7313 | } else { |
7314 | - $new_view = substr_replace($view,'1',3,1); |
|
7314 | + $new_view = substr_replace($view, '1', 3, 1); |
|
7315 | 7315 | } |
7316 | 7316 | return array($title_line, $line); |
7317 | 7317 | } |
@@ -7333,9 +7333,9 @@ discard block |
||
7333 | 7333 | |
7334 | 7334 | $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
7335 | 7335 | |
7336 | - if (substr($view,4,1) == '1') { |
|
7337 | - $new_view = substr_replace($view,'0',4,1); |
|
7338 | - $title[1]= get_lang('DocumentsDetails'); |
|
7336 | + if (substr($view, 4, 1) == '1') { |
|
7337 | + $new_view = substr_replace($view, '0', 4, 1); |
|
7338 | + $title[1] = get_lang('DocumentsDetails'); |
|
7339 | 7339 | |
7340 | 7340 | $sql = "SELECT down_doc_path |
7341 | 7341 | FROM $downloads_table |
@@ -7348,14 +7348,14 @@ discard block |
||
7348 | 7348 | $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
7349 | 7349 | $line = null; |
7350 | 7350 | if (is_array($results)) { |
7351 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7351 | + for ($j = 0; $j < count($results); $j++) { |
|
7352 | 7352 | $line .= $results[$j]."\n"; |
7353 | 7353 | } |
7354 | 7354 | } else { |
7355 | 7355 | $line = get_lang('NoResult'); |
7356 | 7356 | } |
7357 | 7357 | } else { |
7358 | - $new_view = substr_replace($view,'1',4,1); |
|
7358 | + $new_view = substr_replace($view, '1', 4, 1); |
|
7359 | 7359 | } |
7360 | 7360 | return array($title_line, $line); |
7361 | 7361 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $last_modified = 0; |
212 | 212 | $return = 0; |
213 | 213 | if (is_dir($dir)) { |
214 | - while(($entry = $dir->read()) !== false) |
|
214 | + while (($entry = $dir->read()) !== false) |
|
215 | 215 | { |
216 | 216 | if ($entry != '.' && $entry != '..') |
217 | 217 | continue; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | 'props.session_id' |
285 | 285 | ); |
286 | 286 | |
287 | - $visibility_rule = ' props.visibility ' . ($can_see_invisible ? '<> 2' : '= 1'); |
|
287 | + $visibility_rule = ' props.visibility '.($can_see_invisible ? '<> 2' : '= 1'); |
|
288 | 288 | |
289 | 289 | $sql = "SELECT SUM(table1.size) FROM ( |
290 | 290 | SELECT size |
@@ -213,16 +213,19 @@ |
||
213 | 213 | if (is_dir($dir)) { |
214 | 214 | while(($entry = $dir->read()) !== false) |
215 | 215 | { |
216 | - if ($entry != '.' && $entry != '..') |
|
217 | - continue; |
|
216 | + if ($entry != '.' && $entry != '..') { |
|
217 | + continue; |
|
218 | + } |
|
218 | 219 | |
219 | - if (!is_dir($dir_name.'/'.$entry)) |
|
220 | - $current_modified = filemtime($dir_name.'/'.$entry); |
|
221 | - elseif ($do_recursive) |
|
222 | - $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
220 | + if (!is_dir($dir_name.'/'.$entry)) { |
|
221 | + $current_modified = filemtime($dir_name.'/'.$entry); |
|
222 | + } elseif ($do_recursive) { |
|
223 | + $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true); |
|
224 | + } |
|
223 | 225 | |
224 | - if ($current_modified > $last_modified) |
|
225 | - $last_modified = $current_modified; |
|
226 | + if ($current_modified > $last_modified) { |
|
227 | + $last_modified = $current_modified; |
|
228 | + } |
|
226 | 229 | } |
227 | 230 | |
228 | 231 | $dir->close(); |
@@ -993,7 +993,9 @@ |
||
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); |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | $name_no_ext = substr($name, 0, strlen($name) - strlen(strstr($name, $ext))); |
64 | 64 | $n = 0; |
65 | 65 | $unique = ''; |
66 | - while (file_exists($path . $name_no_ext . $unique . $ext)) { |
|
67 | - $unique = '_' . ++$n; |
|
66 | + while (file_exists($path.$name_no_ext.$unique.$ext)) { |
|
67 | + $unique = '_'.++$n; |
|
68 | 68 | } |
69 | - return $name_no_ext . $unique . $ext; |
|
69 | + return $name_no_ext.$unique.$ext; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor). |
106 | 106 | $max_file_size = intval($_POST['MAX_FILE_SIZE']); |
107 | 107 | if ($show_output) { |
108 | - Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size)); |
|
108 | + Display::display_error_message(get_lang('UplExceedMaxPostSize').format_file_size($max_file_size)); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return false; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | case 4: |
120 | 120 | // No file was uploaded. |
121 | 121 | if ($show_output) { |
122 | - Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst')); |
|
122 | + Display::display_error_message(get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst')); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return false; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // Display success message with extra info to user |
460 | 460 | if ($output) { |
461 | 461 | Display::display_confirmation_message( |
462 | - get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'), |
|
462 | + get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'), |
|
463 | 463 | false |
464 | 464 | ); |
465 | 465 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // Display success message to user |
584 | 584 | if ($output) { |
585 | 585 | Display::display_confirmation_message( |
586 | - get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') .' '.$documentTitle, |
|
586 | + get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle, |
|
587 | 587 | false |
588 | 588 | ); |
589 | 589 | } |
@@ -730,12 +730,12 @@ discard block |
||
730 | 730 | function dir_total_space($dir_path) |
731 | 731 | { |
732 | 732 | $save_dir = getcwd(); |
733 | - chdir($dir_path) ; |
|
733 | + chdir($dir_path); |
|
734 | 734 | $handle = opendir($dir_path); |
735 | 735 | $sumSize = 0; |
736 | 736 | $dirList = array(); |
737 | 737 | while ($element = readdir($handle)) { |
738 | - if ( $element == '.' || $element == '..') { |
|
738 | + if ($element == '.' || $element == '..') { |
|
739 | 739 | continue; // Skip the current and parent directories |
740 | 740 | } |
741 | 741 | if (is_file($element)) { |
@@ -746,11 +746,11 @@ discard block |
||
746 | 746 | } |
747 | 747 | } |
748 | 748 | |
749 | - closedir($handle) ; |
|
749 | + closedir($handle); |
|
750 | 750 | |
751 | 751 | if (sizeof($dirList) > 0) { |
752 | 752 | foreach ($dirList as $j) { |
753 | - $sizeDir = dir_total_space($j); // Recursivity |
|
753 | + $sizeDir = dir_total_space($j); // Recursivity |
|
754 | 754 | $sumSize += $sizeDir; |
755 | 755 | } |
756 | 756 | } |
@@ -784,63 +784,63 @@ discard block |
||
784 | 784 | |
785 | 785 | static $mime_type = array(); |
786 | 786 | |
787 | - $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
788 | - $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
789 | - $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
790 | - $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
791 | - $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
792 | - $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
793 | - $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
794 | - $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
795 | - $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
796 | - $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
797 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
798 | - $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
799 | - $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
800 | - $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
801 | - $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
802 | - $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
803 | - $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
804 | - $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
805 | - $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
806 | - $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
807 | - $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
808 | - $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
809 | - $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
810 | - $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
811 | - $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
812 | - $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
813 | - $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
814 | - $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
815 | - $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
816 | - |
|
817 | - $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
818 | - $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
819 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
820 | - $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
821 | - $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
822 | - $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
823 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
824 | - $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
825 | - $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
826 | - |
|
827 | - $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
828 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
829 | - $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
830 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
831 | - $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
832 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
833 | - $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
834 | - $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
835 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
836 | - $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
837 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
838 | - $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
839 | - $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
840 | - $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
841 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
842 | - $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
843 | - $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
787 | + $mime_type[] = 'application/msword'; $extension[] = '.doc'; |
|
788 | + $mime_type[] = 'application/rtf'; $extension[] = '.rtf'; |
|
789 | + $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt'; |
|
790 | + $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls'; |
|
791 | + $mime_type[] = 'application/pdf'; $extension[] = '.pdf'; |
|
792 | + $mime_type[] = 'application/postscript'; $extension[] = '.ps'; |
|
793 | + $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx'; |
|
794 | + $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz'; |
|
795 | + $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf'; |
|
796 | + $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit'; |
|
797 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
798 | + $mime_type[] = 'application/zip'; $extension[] = '.zip'; |
|
799 | + $mime_type[] = 'application/x-tar'; $extension[] = '.tar'; |
|
800 | + $mime_type[] = 'text/html'; $extension[] = '.html'; |
|
801 | + $mime_type[] = 'text/plain'; $extension[] = '.txt'; |
|
802 | + $mime_type[] = 'text/rtf'; $extension[] = '.rtf'; |
|
803 | + $mime_type[] = 'img/gif'; $extension[] = '.gif'; |
|
804 | + $mime_type[] = 'img/jpeg'; $extension[] = '.jpg'; |
|
805 | + $mime_type[] = 'img/png'; $extension[] = '.png'; |
|
806 | + $mime_type[] = 'audio/midi'; $extension[] = '.mid'; |
|
807 | + $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3'; |
|
808 | + $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif'; |
|
809 | + $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm'; |
|
810 | + $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm'; |
|
811 | + $mime_type[] = 'audio/x-wav'; $extension[] = '.wav'; |
|
812 | + $mime_type[] = 'video/mpeg'; $extension[] = '.mpg'; |
|
813 | + $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4'; |
|
814 | + $mime_type[] = 'video/quicktime'; $extension[] = '.mov'; |
|
815 | + $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi'; |
|
816 | + |
|
817 | + $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv'; |
|
818 | + $mime_type[] = 'video/x-flv'; $extension[] = '.flv'; |
|
819 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svg'; |
|
820 | + $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz'; |
|
821 | + $mime_type[] = 'video/ogg'; $extension[] = '.ogv'; |
|
822 | + $mime_type[] = 'audio/ogg'; $extension[] = '.oga'; |
|
823 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogg'; |
|
824 | + $mime_type[] = 'application/ogg'; $extension[] = '.ogx'; |
|
825 | + $mime_type[] = 'application/x-freemind'; $extension[] = '.mm'; |
|
826 | + |
|
827 | + $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm'; |
|
828 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx'; |
|
829 | + $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm'; |
|
830 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx'; |
|
831 | + $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm'; |
|
832 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx'; |
|
833 | + $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam'; |
|
834 | + $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm'; |
|
835 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx'; |
|
836 | + $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm'; |
|
837 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx'; |
|
838 | + $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam'; |
|
839 | + $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb'; |
|
840 | + $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm'; |
|
841 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx'; |
|
842 | + $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm'; |
|
843 | + $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx'; |
|
844 | 844 | |
845 | 845 | // Test on PC (files with no extension get application/octet-stream) |
846 | 846 | //$mime_type[] = 'application/octet-stream'; $extension[] = '.ext'; |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | |
850 | 850 | foreach ($mime_type as $key => & $type) { |
851 | 851 | if ($type == $file_type) { |
852 | - $file_name .= $extension[$key]; |
|
852 | + $file_name .= $extension[$key]; |
|
853 | 853 | break; |
854 | 854 | } |
855 | 855 | } |
@@ -957,12 +957,12 @@ discard block |
||
957 | 957 | } |
958 | 958 | |
959 | 959 | // It happens on Linux that $upload_path sometimes doesn't start with '/' |
960 | - if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') { |
|
960 | + if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') { |
|
961 | 961 | $upload_path = '/'.$upload_path; |
962 | 962 | } |
963 | 963 | |
964 | 964 | if ($upload_path[strlen($upload_path) - 1] == '/') { |
965 | - $upload_path=substr($upload_path, 0, -1); |
|
965 | + $upload_path = substr($upload_path, 0, -1); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | /* Uncompressing phase */ |
@@ -974,15 +974,15 @@ discard block |
||
974 | 974 | - add it to the database |
975 | 975 | - parse & change relative html links |
976 | 976 | */ |
977 | - if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
977 | + if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC *** |
|
978 | 978 | // Shell Method - if this is possible, it gains some speed |
979 | - exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']); |
|
979 | + exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']); |
|
980 | 980 | } else { |
981 | 981 | // PHP method - slower... |
982 | 982 | $save_dir = getcwd(); |
983 | 983 | chdir($base_work_dir.$upload_path); |
984 | 984 | $unzippingState = $zip_file->extract(); |
985 | - for ($j=0; $j < count($unzippingState); $j++) { |
|
985 | + for ($j = 0; $j < count($unzippingState); $j++) { |
|
986 | 986 | $state = $unzippingState[$j]; |
987 | 987 | |
988 | 988 | // Fix relative links in html files |
@@ -996,8 +996,8 @@ discard block |
||
996 | 996 | if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder'; |
997 | 997 | |
998 | 998 | $safe_file = api_replace_dangerous_char($file, 'strict'); |
999 | - @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file); |
|
1000 | - set_default_settings($upload_path, $safe_file,$filetype); |
|
999 | + @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file); |
|
1000 | + set_default_settings($upload_path, $safe_file, $filetype); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $zip = new PclZip($uploaded_file['tmp_name']); |
1048 | 1048 | |
1049 | 1049 | // Check the zip content (real size and file extension) |
1050 | - $zip_content_array = (array)$zip->listContent(); |
|
1050 | + $zip_content_array = (array) $zip->listContent(); |
|
1051 | 1051 | |
1052 | 1052 | $realSize = 0; |
1053 | 1053 | foreach ($zip_content_array as & $this_content) { |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | function filter_extension(&$filename) |
1144 | 1144 | { |
1145 | 1145 | if (substr($filename, -1) == '/') { |
1146 | - return 1; // Authorize directories |
|
1146 | + return 1; // Authorize directories |
|
1147 | 1147 | } |
1148 | 1148 | $blacklist = api_get_setting('upload_extensions_list_type'); |
1149 | 1149 | if ($blacklist != 'whitelist') { // if = blacklist |
@@ -1369,9 +1369,9 @@ discard block |
||
1369 | 1369 | $upload_path = str_replace('//', '/', $upload_path); |
1370 | 1370 | |
1371 | 1371 | if ($upload_path == '/') { |
1372 | - $upload_path=''; |
|
1372 | + $upload_path = ''; |
|
1373 | 1373 | } elseif (!empty($upload_path) && $upload_path[0] != '/') { |
1374 | - $upload_path="/$upload_path"; |
|
1374 | + $upload_path = "/$upload_path"; |
|
1375 | 1375 | } |
1376 | 1376 | |
1377 | 1377 | $endchar = substr($filename, strlen($filename) - 1, 1); |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | $img_path_list = array(); |
1410 | 1410 | |
1411 | 1411 | if (!$fp = fopen($html_file, 'r')) { |
1412 | - return ; |
|
1412 | + return; |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | // Aearch and store occurences of the <img> tag in an array |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | $img_tag_list = $matches[0]; |
1430 | 1430 | } |
1431 | 1431 | |
1432 | - fclose ($fp); |
|
1432 | + fclose($fp); |
|
1433 | 1433 | unset($buffer); |
1434 | 1434 | |
1435 | 1435 | // Search the image file path from all the <IMG> tag detected |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | |
1530 | 1530 | if (!is_dir($base_work_dir.$systemFolderName)) { |
1531 | 1531 | $result = mkdir( |
1532 | - $base_work_dir . $systemFolderName, |
|
1532 | + $base_work_dir.$systemFolderName, |
|
1533 | 1533 | api_get_permissions_for_new_directories(), |
1534 | 1534 | true |
1535 | 1535 | ); |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | WHERE |
1543 | 1543 | c_id = $course_id AND |
1544 | 1544 | ( |
1545 | - path = '" . $systemFolderName . "' |
|
1545 | + path = '".$systemFolderName."' |
|
1546 | 1546 | ) |
1547 | 1547 | "; |
1548 | 1548 | |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | |
1696 | 1696 | // Fix the image tags |
1697 | 1697 | |
1698 | - for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) { |
|
1698 | + for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) { |
|
1699 | 1699 | $replace_what = $original_img_path[$i]; |
1700 | 1700 | // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif |
1701 | 1701 | $exploded_file_path = explode('/', $new_img_path[$i]); |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | .'</body>' |
1737 | 1737 | .'</html>'; |
1738 | 1738 | if (file_exists($file_path)) { |
1739 | - if (!($fp = fopen ($file_path, 'w'))) { |
|
1739 | + if (!($fp = fopen($file_path, 'w'))) { |
|
1740 | 1740 | return false; |
1741 | 1741 | } |
1742 | 1742 | return fwrite($fp, $file_content); |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | // Open the file |
1757 | 1757 | if (file_exists($full_file_name)) { |
1758 | 1758 | $fp = fopen($full_file_name, 'r'); |
1759 | - $buffer = fread ($fp, filesize ($full_file_name)); |
|
1759 | + $buffer = fread($fp, filesize($full_file_name)); |
|
1760 | 1760 | |
1761 | 1761 | // Parse the contents |
1762 | 1762 | $new_html_content = api_replace_links_in_string($upload_path, $buffer); |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | |
1900 | 1900 | foreach ($tag_list as & $this_tag) { |
1901 | 1901 | //Display::display_normal_message(htmlentities($this_tag)); //debug |
1902 | - if ( preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
1902 | + if (preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) { |
|
1903 | 1903 | $file_path_list[] = $matches[1]; // older |
1904 | 1904 | $href_list[] = $matches[0]; // to also add target="_self" |
1905 | 1905 | } |
@@ -1920,9 +1920,9 @@ discard block |
||
1920 | 1920 | |
1921 | 1921 | // Fix the link to use download.php or showinframes.php |
1922 | 1922 | if (preg_match("/<a([\s]*[\"\/:'=a-z0-9]*){5}href[^<]*>/i", $tag_list[$count])) { |
1923 | - $replace_by[$count] = " $param_name =\"showinframes.php?file=" . $upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
1923 | + $replace_by[$count] = " $param_name =\"showinframes.php?file=".$upload_path.$file_path_list[$count]."\" target=\"_self\" "; |
|
1924 | 1924 | } else { |
1925 | - $replace_by[$count] = " $param_name =\"download.php?doc_url=" . $upload_path.$file_path_list[$count]."\" "; |
|
1925 | + $replace_by[$count] = " $param_name =\"download.php?doc_url=".$upload_path.$file_path_list[$count]."\" "; |
|
1926 | 1926 | } |
1927 | 1927 | } else { |
1928 | 1928 | // "mailto" or url already fixed, leave as is |
@@ -1931,7 +1931,7 @@ discard block |
||
1931 | 1931 | } |
1932 | 1932 | } elseif ($is_absolute_hyperlink) { |
1933 | 1933 | //$message .= "Absolute hyperlink, don't change, add target=_self: "; |
1934 | - $replace_by[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_self\""; |
|
1934 | + $replace_by[$count] = " $param_name=\"".$file_path_list[$count]."\" target =\"_self\""; |
|
1935 | 1935 | } else { |
1936 | 1936 | // Don't change anything |
1937 | 1937 | //$message .= "Local anchor, don't change: "; |
@@ -1976,7 +1976,7 @@ discard block |
||
1976 | 1976 | { |
1977 | 1977 | // Do we need a / or not? |
1978 | 1978 | $added_slash = ($upload_path == '/') ? '' : '/'; |
1979 | - $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1979 | + $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path); |
|
1980 | 1980 | // Build the form |
1981 | 1981 | $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>" |
1982 | 1982 | ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">" |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * Returns the name without extension, used for the title |
74 | 74 | * |
75 | 75 | * @param string $name |
76 | - * @return name without the extension |
|
76 | + * @return string without the extension |
|
77 | 77 | */ |
78 | 78 | function get_document_title($name) { |
79 | 79 | // If they upload .htaccess... |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * This function checks if the upload succeeded |
87 | 87 | * |
88 | 88 | * @param array $uploaded_file ($_FILES) |
89 | - * @return true if upload succeeded |
|
89 | + * @return boolean if upload succeeded |
|
90 | 90 | */ |
91 | 91 | function process_uploaded_file($uploaded_file, $show_output = true) |
92 | 92 | { |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @param array $courseInfo |
1020 | 1020 | * @param array $userInfo |
1021 | 1021 | * @param array $uploaded_file - follows the $_FILES Structure |
1022 | - * @param string $upload_path - destination of the upload. |
|
1022 | + * @param string $uploadPath - destination of the upload. |
|
1023 | 1023 | * This path is to append to $base_work_dir |
1024 | 1024 | * @param string $base_work_dir - base working directory of the module |
1025 | 1025 | * @param int $maxFilledSpace - amount of bytes to not exceed in the base |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | * @param int $session_id Session ID, if any |
1201 | 1201 | * @param int $userId creator id |
1202 | 1202 | * |
1203 | - * @return int id if inserted document |
|
1203 | + * @return string|false id if inserted document |
|
1204 | 1204 | */ |
1205 | 1205 | function add_document( |
1206 | 1206 | $_course, |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | * |
1335 | 1335 | * @author Olivier Cauberghe <[email protected]> |
1336 | 1336 | * @param path+filename eg: /main/document/document.php |
1337 | - * @return The directory depth |
|
1337 | + * @return integer directory depth |
|
1338 | 1338 | */ |
1339 | 1339 | function get_levels($filename) { |
1340 | 1340 | $levels = explode('/', $filename); |
@@ -1351,6 +1351,8 @@ discard block |
||
1351 | 1351 | * @author Olivier Cauberghe <[email protected]> |
1352 | 1352 | * @param path,filename |
1353 | 1353 | * action: Adds an entry to the document table with the default settings. |
1354 | + * @param string $upload_path |
|
1355 | + * @param string $filename |
|
1354 | 1356 | */ |
1355 | 1357 | function set_default_settings($upload_path, $filename, $filetype = 'file') |
1356 | 1358 | { |
@@ -1777,6 +1779,7 @@ discard block |
||
1777 | 1779 | |
1778 | 1780 | @author Roan Embrechts |
1779 | 1781 | @version 0.6 |
1782 | + * @param string $buffer |
|
1780 | 1783 | */ |
1781 | 1784 | function api_replace_links_in_string($upload_path, $buffer) { |
1782 | 1785 | // Search for hyperlinks |
@@ -2012,7 +2015,6 @@ discard block |
||
2012 | 2015 | * @param int $groupId |
2013 | 2016 | * @param bool $output |
2014 | 2017 | * @param array $parent |
2015 | - * @param string $uploadPath |
|
2016 | 2018 | * |
2017 | 2019 | */ |
2018 | 2020 | function add_all_documents_in_folder_to_database( |
@@ -3122,8 +3122,9 @@ |
||
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 |
@@ -1499,12 +1499,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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> ('.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> ('.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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 = '- <i>'.api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG).'</i>'; |
|
3254 | + $end_time = '- <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> '.$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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -79,7 +79,7 @@ discard block |
||
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 |
||
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); |
@@ -248,17 +248,17 @@ discard block |
||
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 |
||
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 |
||
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); |
@@ -338,7 +338,7 @@ |
||
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 | } |
@@ -657,6 +657,7 @@ discard block |
||
657 | 657 | * retrieves all the courses that the user has already subscribed to |
658 | 658 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
659 | 659 | * @param int $user_id: the id of the user |
660 | + * @param integer $user_id |
|
660 | 661 | * @return array an array containing all the information of the courses of the given user |
661 | 662 | */ |
662 | 663 | public function get_courses_of_user($user_id) |
@@ -707,13 +708,13 @@ discard block |
||
707 | 708 | |
708 | 709 | /** |
709 | 710 | * @todo use the template system |
710 | - * @param $title |
|
711 | - * @param $content |
|
711 | + * @param string|null $title |
|
712 | + * @param string $content |
|
712 | 713 | * @param string $id |
713 | 714 | * @param array $params |
714 | 715 | * @param string $idAccordion |
715 | 716 | * @param string $idCollapse |
716 | - * @return null|string |
|
717 | + * @return string |
|
717 | 718 | */ |
718 | 719 | public function show_right_block( |
719 | 720 | $title, |
@@ -937,7 +938,7 @@ discard block |
||
937 | 938 | } |
938 | 939 | |
939 | 940 | /** |
940 | - * @return null|string |
|
941 | + * @return string |
|
941 | 942 | */ |
942 | 943 | public function return_course_block() |
943 | 944 | { |
@@ -1590,8 +1591,8 @@ discard block |
||
1590 | 1591 | |
1591 | 1592 | /** |
1592 | 1593 | * Return HTML code for personal user course category |
1593 | - * @param $id |
|
1594 | - * @param $title |
|
1594 | + * @param integer $id |
|
1595 | + * @param string $title |
|
1595 | 1596 | * @return string |
1596 | 1597 | */ |
1597 | 1598 | private static function getHtmlForUserCategory($id, $title) |
@@ -1612,7 +1613,7 @@ discard block |
||
1612 | 1613 | /** |
1613 | 1614 | * return HTML code for course display in session view |
1614 | 1615 | * @param array $courseInfo |
1615 | - * @param $userCategoryId |
|
1616 | + * @param integer $userCategoryId |
|
1616 | 1617 | * @param bool $displayButton |
1617 | 1618 | * @param $loadDirs |
1618 | 1619 | * @return string |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $exercise_list = array(); |
61 | 61 | if (!empty($personal_course_list)) { |
62 | - foreach($personal_course_list as $course_item) { |
|
62 | + foreach ($personal_course_list as $course_item) { |
|
63 | 63 | $course_code = $course_item['c']; |
64 | 64 | $session_id = $course_item['id_session']; |
65 | 65 | |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | $session_id |
69 | 69 | ); |
70 | 70 | |
71 | - foreach($exercises as $exercise_item) { |
|
72 | - $exercise_item['course_code'] = $course_code; |
|
73 | - $exercise_item['session_id'] = $session_id; |
|
74 | - $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
71 | + foreach ($exercises as $exercise_item) { |
|
72 | + $exercise_item['course_code'] = $course_code; |
|
73 | + $exercise_item['session_id'] = $session_id; |
|
74 | + $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC'); |
|
75 | 75 | |
76 | 76 | $exercise_list[] = $exercise_item; |
77 | 77 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | - if ($show_menu && ($show_create_link || $show_course_link )) { |
|
189 | + if ($show_menu && ($show_create_link || $show_course_link)) { |
|
190 | 190 | $show_menu = true; |
191 | 191 | } else { |
192 | 192 | $show_menu = false; |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | if ($show_menu) { |
199 | 199 | $html .= '<ul class="nav nav-pills nav-stacked">'; |
200 | 200 | if ($show_create_link) { |
201 | - $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>'; |
|
201 | + $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>'; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if ($show_course_link) { |
205 | 205 | if (!api_is_drh() && !api_is_session_admin()) { |
206 | - $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>'; |
|
206 | + $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>'; |
|
207 | 207 | } else { |
208 | - $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
208 | + $html .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | $html .= '</ul>'; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $html = ''; |
230 | 230 | |
231 | 231 | if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { |
232 | - $open = @(string)file_get_contents($this->home.$_GET['include']); |
|
232 | + $open = @(string) file_get_contents($this->home.$_GET['include']); |
|
233 | 233 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
234 | 234 | } else { |
235 | 235 | // Hiding home top when user not connected. |
@@ -259,15 +259,15 @@ discard block |
||
259 | 259 | $home_top_temp = file_get_contents($this->home.'home_top.html'); |
260 | 260 | } else { |
261 | 261 | if (file_exists($this->default_home.'home_top.html')) { |
262 | - $home_top_temp = file_get_contents($this->default_home . 'home_top.html'); |
|
262 | + $home_top_temp = file_get_contents($this->default_home.'home_top.html'); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | if (trim($home_top_temp) == '' && api_is_platform_admin()) { |
268 | - $home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>'; |
|
268 | + $home_top_temp = '<div class="welcome-mascot">'.get_lang('PortalHomepageDefaultIntroduction').'</div>'; |
|
269 | 269 | } else { |
270 | - $home_top_temp = '<div class="welcome-home-top-temp">' . $home_top_temp . '</div>'; |
|
270 | + $home_top_temp = '<div class="welcome-home-top-temp">'.$home_top_temp.'</div>'; |
|
271 | 271 | } |
272 | 272 | $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); |
273 | 273 | $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | |
283 | 283 | $html = ''; |
284 | 284 | // Notice |
285 | - $home_notice = @(string)file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html'); |
|
285 | + $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html'); |
|
286 | 286 | if (empty($home_notice)) { |
287 | - $home_notice = @(string)file_get_contents($this->home.'home_notice.html'); |
|
287 | + $home_notice = @(string) file_get_contents($this->home.'home_notice.html'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | if (!empty($home_notice)) { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | $html = null; |
318 | - $home_menu = @(string)file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html'); |
|
318 | + $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html'); |
|
319 | 319 | if (!empty($home_menu)) { |
320 | 320 | $home_menu_content = '<ul class="nav nav-pills nav-stacked">'; |
321 | 321 | $home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu))); |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | if (!api_is_anonymous()) { |
346 | 346 | $certificatesItem = Display::tag( |
347 | 347 | 'li', |
348 | - Display::url(Display::return_icon('graduation.png',get_lang('MyCertificates'),null,ICON_SIZE_SMALL). |
|
348 | + Display::url(Display::return_icon('graduation.png', get_lang('MyCertificates'), null, ICON_SIZE_SMALL). |
|
349 | 349 | get_lang('MyCertificates'), |
350 | - api_get_path(WEB_CODE_PATH) . "gradebook/my_certificates.php" |
|
350 | + api_get_path(WEB_CODE_PATH)."gradebook/my_certificates.php" |
|
351 | 351 | ) |
352 | 352 | ); |
353 | 353 | } |
@@ -357,29 +357,29 @@ discard block |
||
357 | 357 | if (api_get_setting('allow_public_certificates') == 'true') { |
358 | 358 | $searchItem = Display::tag( |
359 | 359 | 'li', |
360 | - Display::url(Display::return_icon('search_graduation.png',get_lang('Search'),null,ICON_SIZE_SMALL). |
|
360 | + Display::url(Display::return_icon('search_graduation.png', get_lang('Search'), null, ICON_SIZE_SMALL). |
|
361 | 361 | get_lang('Search'), |
362 | - api_get_path(WEB_CODE_PATH) . "gradebook/search.php" |
|
362 | + api_get_path(WEB_CODE_PATH)."gradebook/search.php" |
|
363 | 363 | ) |
364 | 364 | ); |
365 | 365 | } |
366 | 366 | |
367 | 367 | if (empty($certificatesItem) && empty($searchItem)) { |
368 | 368 | return null; |
369 | - }else{ |
|
370 | - $content.= $certificatesItem; |
|
371 | - $content.= $searchItem; |
|
369 | + } else { |
|
370 | + $content .= $certificatesItem; |
|
371 | + $content .= $searchItem; |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | if (api_get_setting('allow_skills_tool') == 'true') { |
375 | 375 | |
376 | - $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')); |
|
376 | + $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')); |
|
377 | 377 | $allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true'; |
378 | 378 | if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) { |
379 | 379 | $content .= Display::tag('li', |
380 | 380 | Display::url(Display::return_icon('edit-skill.png', get_lang('MySkills'), null, |
381 | - ICON_SIZE_SMALL) . get_lang('ManageSkills'), |
|
382 | - api_get_path(WEB_CODE_PATH) . 'admin/skills_wheel.php')); |
|
381 | + ICON_SIZE_SMALL).get_lang('ManageSkills'), |
|
382 | + api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php')); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | $content .= '</ul>'; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | FROM $main_category_table t1 |
479 | 479 | LEFT JOIN $main_category_table t2 ON t1.code=t2.parent_id |
480 | 480 | LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses) |
481 | - WHERE t1.parent_id ". (empty ($category) ? "IS NULL" : "='$category'")." |
|
481 | + WHERE t1.parent_id ".(empty ($category) ? "IS NULL" : "='$category'")." |
|
482 | 482 | GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; |
483 | 483 | |
484 | 484 | // Showing only the category of courses of the current access_url_id |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | } |
554 | 554 | $result .= $htmlTitre; |
555 | 555 | if ($thereIsSubCat) { |
556 | - $result .= $htmlListCat; |
|
556 | + $result .= $htmlListCat; |
|
557 | 557 | } |
558 | 558 | while ($categoryName = Database::fetch_array($resCats)) { |
559 | - $result .= '<h3>' . $categoryName['name'] . "</h3>\n"; |
|
559 | + $result .= '<h3>'.$categoryName['name']."</h3>\n"; |
|
560 | 560 | } |
561 | 561 | $numrows = Database::num_rows($sql_result_courses); |
562 | 562 | $courses_list_string = ''; |
@@ -654,12 +654,12 @@ discard block |
||
654 | 654 | if ($courses_shown > 0) { |
655 | 655 | // Only display the list of courses and categories if there was more than |
656 | 656 | // 0 courses visible to the world (we're in the anonymous list here). |
657 | - $result .= $courses_list_string; |
|
657 | + $result .= $courses_list_string; |
|
658 | 658 | } |
659 | 659 | if ($category != '') { |
660 | - $result .= '<p><a href="'.api_get_self().'"> ' . |
|
660 | + $result .= '<p><a href="'.api_get_self().'"> '. |
|
661 | 661 | Display :: return_icon('back.png', get_lang('BackToHomePage')). |
662 | - get_lang('BackToHomePage') . '</a></p>'; |
|
662 | + get_lang('BackToHomePage').'</a></p>'; |
|
663 | 663 | } |
664 | 664 | return $result; |
665 | 665 | } |
@@ -736,14 +736,14 @@ discard block |
||
736 | 736 | ) { |
737 | 737 | if (!empty($idAccordion)) { |
738 | 738 | $html = null; |
739 | - $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">' . PHP_EOL; |
|
740 | - $html .= '<div class="panel panel-default" id="'.$id.'">' . PHP_EOL; |
|
741 | - $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">' . PHP_EOL; |
|
742 | - $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>' . PHP_EOL; |
|
743 | - $html .= '</h4></div>' . PHP_EOL; |
|
744 | - $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">' . PHP_EOL; |
|
745 | - $html .= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
746 | - $html .= '</div></div></div>' . PHP_EOL; |
|
739 | + $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">'.PHP_EOL; |
|
740 | + $html .= '<div class="panel panel-default" id="'.$id.'">'.PHP_EOL; |
|
741 | + $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">'.PHP_EOL; |
|
742 | + $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>'.PHP_EOL; |
|
743 | + $html .= '</h4></div>'.PHP_EOL; |
|
744 | + $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">'.PHP_EOL; |
|
745 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
746 | + $html .= '</div></div></div>'.PHP_EOL; |
|
747 | 747 | |
748 | 748 | } else { |
749 | 749 | if (!empty($id)) { |
@@ -752,9 +752,9 @@ discard block |
||
752 | 752 | $params['class'] = 'panel panel-default'; |
753 | 753 | $html = null; |
754 | 754 | if (!empty($title)) { |
755 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
755 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
756 | 756 | } |
757 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
757 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
758 | 758 | $html = Display::div($html, $params); |
759 | 759 | } |
760 | 760 | return $html; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id()); |
801 | 801 | $classes = ''; |
802 | 802 | if (!empty($usergroup_list)) { |
803 | - foreach($usergroup_list as $group_id) { |
|
803 | + foreach ($usergroup_list as $group_id) { |
|
804 | 804 | $data = $usergroup->get($group_id); |
805 | 805 | $data['name'] = Display::url($data['name'], api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id']); |
806 | 806 | $classes .= Display::tag('li', $data['name']); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | if (api_is_platform_admin()) { |
810 | 810 | $classes .= Display::tag( |
811 | 811 | 'li', |
812 | - Display::url(get_lang('AddClasses') ,api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
812 | + Display::url(get_lang('AddClasses'), api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add') |
|
813 | 813 | ); |
814 | 814 | } |
815 | 815 | if (!empty($classes)) { |
@@ -831,11 +831,11 @@ discard block |
||
831 | 831 | $content = null; |
832 | 832 | |
833 | 833 | if (api_get_setting('allow_social_tool') == 'true') { |
834 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/social/home.php"> |
|
835 | - <img class="img-circle" src="' . $userPicture . '" ></a>'; |
|
834 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/social/home.php"> |
|
835 | + <img class="img-circle" src="' . $userPicture.'" ></a>'; |
|
836 | 836 | } else { |
837 | - $content .= '<a style="text-align:center" href="' . api_get_path(WEB_PATH) . 'main/auth/profile.php"> |
|
838 | - <img class="img-circle" title="' . get_lang('EditProfile') . '" src="' . $userPicture. '" ></a>'; |
|
837 | + $content .= '<a style="text-align:center" href="'.api_get_path(WEB_PATH).'main/auth/profile.php"> |
|
838 | + <img class="img-circle" title="' . get_lang('EditProfile').'" src="'.$userPicture.'" ></a>'; |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | $html = self::show_right_block( |
@@ -887,12 +887,12 @@ discard block |
||
887 | 887 | if (api_get_setting('allow_social_tool') == 'true') { |
888 | 888 | $link = '?f=social'; |
889 | 889 | } |
890 | - $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>'; |
|
891 | - $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>'; |
|
890 | + $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>'; |
|
891 | + $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>'; |
|
892 | 892 | |
893 | 893 | if (api_get_setting('allow_social_tool') == 'true') { |
894 | 894 | $total_invitations = Display::badge($total_invitations); |
895 | - $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>'; |
|
895 | + $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>'; |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) { |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | $editProfileUrl = Display::getProfileEditionLink($user_id); |
910 | 910 | |
911 | - $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'. |
|
911 | + $profile_content .= '<li class="profile-social"><a href="'.$editProfileUrl.'">'. |
|
912 | 912 | Display::return_icon( |
913 | 913 | 'edit-profile.png', |
914 | 914 | get_lang('EditProfile'), |
@@ -1005,17 +1005,17 @@ discard block |
||
1005 | 1005 | if ($show_create_link) { |
1006 | 1006 | $my_account_content .= '<li class="add-course"><a href="main/create_course/add_course.php">'; |
1007 | 1007 | if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) { |
1008 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CreateCourseRequest'),null,ICON_SIZE_SMALL); |
|
1008 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CreateCourseRequest'), null, ICON_SIZE_SMALL); |
|
1009 | 1009 | $my_account_content .= get_lang('CreateCourseRequest'); |
1010 | 1010 | } else { |
1011 | - $my_account_content .= Display::return_icon('new-course.png',get_lang('CourseCreate'),null,ICON_SIZE_SMALL); |
|
1011 | + $my_account_content .= Display::return_icon('new-course.png', get_lang('CourseCreate'), null, ICON_SIZE_SMALL); |
|
1012 | 1012 | $my_account_content .= get_lang('CourseCreate'); |
1013 | 1013 | } |
1014 | 1014 | $my_account_content .= '</a></li>'; |
1015 | 1015 | |
1016 | 1016 | if (SessionManager::allowToManageSessions()) { |
1017 | 1017 | $my_account_content .= '<li class="add-course"><a href="main/session/session_add.php">'; |
1018 | - $my_account_content .= Display::return_icon('session.png',get_lang('AddSession'),null,ICON_SIZE_SMALL); |
|
1018 | + $my_account_content .= Display::return_icon('session.png', get_lang('AddSession'), null, ICON_SIZE_SMALL); |
|
1019 | 1019 | $my_account_content .= get_lang('AddSession'); |
1020 | 1020 | $my_account_content .= '</a></li>'; |
1021 | 1021 | } |
@@ -1023,21 +1023,21 @@ discard block |
||
1023 | 1023 | |
1024 | 1024 | //Sort courses |
1025 | 1025 | $url = api_get_path(WEB_CODE_PATH).'auth/courses.php?action=sortmycourses'; |
1026 | - $img_order= Display::return_icon('order-course.png',get_lang('SortMyCourses'),null,ICON_SIZE_SMALL); |
|
1026 | + $img_order = Display::return_icon('order-course.png', get_lang('SortMyCourses'), null, ICON_SIZE_SMALL); |
|
1027 | 1027 | $my_account_content .= '<li class="order-course">'.Display::url($img_order.get_lang('SortMyCourses'), $url, array('class' => 'sort course')).'</li>'; |
1028 | 1028 | |
1029 | 1029 | // Session history |
1030 | 1030 | if (isset($_GET['history']) && intval($_GET['history']) == 1) { |
1031 | - $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>'; |
|
1031 | + $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>'; |
|
1032 | 1032 | } else { |
1033 | - $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>'; |
|
1033 | + $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>'; |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | // Course catalog |
1037 | 1037 | |
1038 | 1038 | if ($show_course_link) { |
1039 | 1039 | if (!api_is_drh()) { |
1040 | - $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>'; |
|
1040 | + $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>'; |
|
1041 | 1041 | } else { |
1042 | 1042 | $my_account_content .= '<li><a href="main/dashboard/index.php">'.get_lang('Dashboard').'</a></li>'; |
1043 | 1043 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | |
1231 | 1231 | $actions = null; |
1232 | 1232 | if (api_is_platform_admin()) { |
1233 | - $actions = api_get_path(WEB_CODE_PATH) .'session/resume_session.php?id_session='.$session_id; |
|
1233 | + $actions = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$session_id; |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | $coachId = $session_box['id_coach']; |
@@ -1241,12 +1241,12 @@ discard block |
||
1241 | 1241 | $params['title'] = $session_box['title']; |
1242 | 1242 | //$params['subtitle'] = $extra_info; |
1243 | 1243 | $params['id_coach'] = $coachId; |
1244 | - $params['coach_url'] = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=get_user_popup&user_id=' . $coachId; |
|
1244 | + $params['coach_url'] = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId; |
|
1245 | 1245 | $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null; |
1246 | - $params['coach_avatar'] =UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL); |
|
1247 | - $params['date'] = $session_box['dates']; |
|
1246 | + $params['coach_avatar'] = UserManager::getUserPicture($coachId, USER_IMAGE_SIZE_SMALL); |
|
1247 | + $params['date'] = $session_box['dates']; |
|
1248 | 1248 | $params['image'] = isset($imageField['value']) ? $imageField['value'] : null; |
1249 | - $params['duration'] = isset($session_box['duration']) ? ' ' . $session_box['duration'] : null; |
|
1249 | + $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null; |
|
1250 | 1250 | $params['edit_actions'] = $actions; |
1251 | 1251 | $params['show_description'] = $session_box['show_description']; |
1252 | 1252 | $params['description'] = $session_box['description']; |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | //$sessionParams['show_link_to_session'] = !api_is_drh() && $sessionTitleLink; |
1355 | 1355 | $sessionParams['course_list_session_style'] = $coursesListSessionStyle; |
1356 | 1356 | $sessionParams['title'] = $session_box['title']; |
1357 | - $sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ': '') . $session_box['dates']; |
|
1357 | + $sessionParams['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates']; |
|
1358 | 1358 | $sessionParams['show_actions'] = api_is_platform_admin(); |
1359 | 1359 | $sessionParams['courses'] = $html_courses_session; |
1360 | 1360 | $sessionParams['show_simple_session_info'] = false; |
@@ -1404,14 +1404,14 @@ discard block |
||
1404 | 1404 | !empty($session_category_start_date) && |
1405 | 1405 | $session_category_start_date != '0000-00-00' |
1406 | 1406 | ) { |
1407 | - $categoryParams['subtitle'] = get_lang('From') . ' ' . $session_category_start_date; |
|
1407 | + $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date; |
|
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | if ( |
1411 | 1411 | !empty($session_category_end_date) && |
1412 | 1412 | $session_category_end_date != '0000-00-00' |
1413 | 1413 | ) { |
1414 | - $categoryParams['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date; |
|
1414 | + $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date; |
|
1415 | 1415 | } |
1416 | 1416 | } |
1417 | 1417 | |
@@ -1436,10 +1436,10 @@ discard block |
||
1436 | 1436 | |
1437 | 1437 | $this->tpl->assign('all_courses', $allCoursesInSessions); |
1438 | 1438 | $this->tpl->assign('session', $listSession); |
1439 | - $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false)); |
|
1439 | + $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); |
|
1440 | 1440 | $this->tpl->assign('gamification_mode', $gamificationModeIsActive); |
1441 | 1441 | |
1442 | - if (api_get_configuration_value('view_grid_courses')){ |
|
1442 | + if (api_get_configuration_value('view_grid_courses')) { |
|
1443 | 1443 | $sessions_with_no_category = $this->tpl->fetch( |
1444 | 1444 | $this->tpl->get_template('/user_portal/grid_session.tpl') |
1445 | 1445 | ); |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | } else { |
1585 | 1585 | $htmlCategory .= '<div class="session-view-row" >'; |
1586 | 1586 | } |
1587 | - $coursesInfo = $listCourse['course']; |
|
1587 | + $coursesInfo = $listCourse['course']; |
|
1588 | 1588 | |
1589 | 1589 | $htmlCategory .= self::getHtmlForCourse( |
1590 | 1590 | $coursesInfo, |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | $listCategorySession['catSessionName'] |
1602 | 1602 | ); |
1603 | 1603 | // list of session |
1604 | - $htmlSession = ''; // start |
|
1604 | + $htmlSession = ''; // start |
|
1605 | 1605 | foreach ($listCategorySession['sessionList'] as $k => $listSession) { |
1606 | 1606 | // add session |
1607 | 1607 | $htmlSession .= '<div class="session-view-row">'; |
@@ -1618,8 +1618,8 @@ discard block |
||
1618 | 1618 | $htmlSessionCategory .= $htmlSession; |
1619 | 1619 | } |
1620 | 1620 | $htmlSessionCategory .= '</div>'; // end session cat block |
1621 | - $htmlCategory .= $htmlSessionCategory .'</div>' ; |
|
1622 | - $htmlCategory .= ''; // end course block |
|
1621 | + $htmlCategory .= $htmlSessionCategory.'</div>'; |
|
1622 | + $htmlCategory .= ''; // end course block |
|
1623 | 1623 | } |
1624 | 1624 | $userCategoryHtml .= $htmlCategory; |
1625 | 1625 | } |
@@ -1644,11 +1644,11 @@ discard block |
||
1644 | 1644 | } |
1645 | 1645 | } |
1646 | 1646 | $htmlCategory .= ''; |
1647 | - $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1647 | + $userCategoryHtml .= $htmlCategory; // end user cat block |
|
1648 | 1648 | if ($userCategoryId != 0) { |
1649 | 1649 | $userCategoryHtml .= '</div>'; |
1650 | 1650 | } |
1651 | - $html .= $userCategoryHtml; // |
|
1651 | + $html .= $userCategoryHtml; // |
|
1652 | 1652 | } |
1653 | 1653 | $html .= '</div>'; |
1654 | 1654 | |
@@ -1789,11 +1789,11 @@ discard block |
||
1789 | 1789 | $html = ''; |
1790 | 1790 | |
1791 | 1791 | if ($categorySessionId == 0) { |
1792 | - $class1 = 'session-view-lvl-2'; // session |
|
1793 | - $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1792 | + $class1 = 'session-view-lvl-2'; // session |
|
1793 | + $class2 = 'session-view-lvl-4'; // got to course in session link |
|
1794 | 1794 | } else { |
1795 | - $class1 = 'session-view-lvl-3'; // session |
|
1796 | - $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1795 | + $class1 = 'session-view-lvl-3'; // session |
|
1796 | + $class2 = 'session-view-lvl-5'; // got to course in session link |
|
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | $icon = Display::return_icon( |
@@ -1821,7 +1821,7 @@ discard block |
||
1821 | 1821 | if ($listA['userCatTitle'] == $listB['userCatTitle']) { |
1822 | 1822 | if ($listA['title'] == $listB['title']) { |
1823 | 1823 | return 0; |
1824 | - } else if($listA['title'] > $listB['title']) { |
|
1824 | + } else if ($listA['title'] > $listB['title']) { |
|
1825 | 1825 | return 1; |
1826 | 1826 | } else { |
1827 | 1827 | return -1; |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | { |
1843 | 1843 | if ($listA['title'] == $listB['title']) { |
1844 | 1844 | return 0; |
1845 | - } else if($listA['title'] > $listB['title']) { |
|
1845 | + } else if ($listA['title'] > $listB['title']) { |
|
1846 | 1846 | return 1; |
1847 | 1847 | } else { |
1848 | 1848 | return -1; |