Completed
Push — 1.10.x ( 284d08...23ef56 )
by Angel Fernando Quiroz
50:25
created
main/newscorm/resourcelinker.inc.php 1 patch
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 $use_anonymous = true;
18 18
 
19 19
 require_once '../inc/global.inc.php';
20
-if (!empty($_course['language'])){
21
-    $resource_linker_file =  api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php';
20
+if (!empty($_course['language'])) {
21
+    $resource_linker_file = api_get_path(SYS_CODE_PATH).'lang/'.$_course['language'].'/resourcelinker.inc.php';
22 22
     if (file_exists($resource_linker_file)) {
23 23
         require_once $resource_linker_file;
24 24
     }
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
         echo "<a href='".api_get_self()."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>";
48 48
     }
49 49
     if ($level && $level != 0 && $level != 1) {
50
-        $folder_up=$folder;
51
-        $folder_temp=explode('/',$folder);
52
-        $last=count($folder_temp)-1;
50
+        $folder_up = $folder;
51
+        $folder_temp = explode('/', $folder);
52
+        $last = count($folder_temp) - 1;
53 53
         unset($folder_temp[$last]);
54
-        $folder_up=implode('/',$folder_temp);
54
+        $folder_up = implode('/', $folder_temp);
55 55
         echo "<a href='".api_get_self()."?content=Document&amp;source_forum=".$_GET['source_forum']."&amp;folder=$folder_up&amp;source_id=$source_id&amp;action=$action&amp;learnpath_id=$learnpath_id&amp;chapter_id=$chapter_id&amp;originalresource=no'><img src='../img/folder_up.gif' border='0' />".get_lang('LevelUp')."</a>";
56 56
     }
57 57
 }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $result = Database::query($sql);
89 89
     while ($row = Database::fetch_array($result)) {
90 90
         if (!$folder) {
91
-            if (get_levels($row['path'])-1 == 1) {
91
+            if (get_levels($row['path']) - 1 == 1) {
92 92
                 // showing the right icon.
93 93
                 if (file_or_folder($row['path'])) {
94 94
                         echo '<img src="../img/file.gif" align="middle" />';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     echo "&folder=".substr($row['path'], 1)."&source_id=$source_id&source_forum=".$_GET['source_forum']."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".substr($row['path'], 1).'</a><br />';
104 104
                 } else {
105 105
                     echo substr($row['path'], 1).' ';
106
-                    echo showorhide_addresourcelink('Document',$row['id']);
106
+                    echo showorhide_addresourcelink('Document', $row['id']);
107 107
                     echo '<br />';
108 108
                 }
109 109
             }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $level = get_levels($folder) + 1;
114 114
 
115 115
             // We calculate each level of the database entry.
116
-            $file_level=get_levels($row['path'])-1;
116
+            $file_level = get_levels($row['path']) - 1;
117 117
             // If the level of the database entry is equal to the level we ar in, we put it into an array
118 118
             // as this is a potential good entry.
119 119
             if ($file_level == $level) {
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
     $addedresourceid = $_SESSION['addedresourceid'];
192 192
     if ($_SESSION['addedresource']) {
193 193
         foreach ($addedresource as $resource_type) {
194
-            $sql="INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES
194
+            $sql = "INSERT INTO $resource_table (c_id, source_type, source_id, resource_type, resource_id) VALUES
195 195
             ($course_id, '$source_type', '$source_id', '$resource_type', '".$addedresourceid[key($addedresource)]."')";
196 196
             Database::query($sql);
197
-            $i=key($addedresource);
197
+            $i = key($addedresource);
198 198
             next($addedresource);
199 199
         }
200
-        $_SESSION['addedresource']='';
201
-        $_SESSION['addedresourceid']='';
200
+        $_SESSION['addedresource'] = '';
201
+        $_SESSION['addedresourceid'] = '';
202 202
     }
203 203
 }
204 204
 
@@ -278,21 +278,21 @@  discard block
 block discarded – undo
278 278
             $dbTable = Database::get_course_table(TABLE_DOCUMENT);
279 279
             $result = Database::query("SELECT * FROM $dbTable WHERE c_id = $course_id AND id=$id");
280 280
             $myrow = Database::fetch_array($result);
281
-            $pathname = explode('/',$myrow['path']); // Making a correct name for the link.
282
-            $last = count($pathname) - 1;  // Making a correct name for the link.
283
-            $filename = $pathname[$last];  // Making a correct name for the link.
281
+            $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
282
+            $last = count($pathname) - 1; // Making a correct name for the link.
283
+            $filename = $pathname[$last]; // Making a correct name for the link.
284 284
             $image = choose_image($filename);
285 285
             $ext = explode('.', $filename);
286
-            $ext = strtolower($ext[sizeof($ext)-1]);
286
+            $ext = strtolower($ext[sizeof($ext) - 1]);
287 287
             $myrow['path'] = rawurlencode($myrow['path']);
288 288
 
289
-			$array_ext=array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png');
289
+			$array_ext = array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png');
290 290
 
291
-			if (api_browser_support('svg')){
292
-				$array_ext[]='svg';
291
+			if (api_browser_support('svg')) {
292
+				$array_ext[] = 'svg';
293 293
 			}
294
-			if (api_browser_support('ogg')){
295
-				$array_ext[]='ogg';
294
+			if (api_browser_support('ogg')) {
295
+				$array_ext[] = 'ogg';
296 296
 			}
297 297
 
298 298
             $in_frames = in_array($ext, $array_ext);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
     $length = ((($builder == 'builder') && ($icon == 'nolink')) ? 65 : 32);
336 336
 
337
-    if ($builder != 'builder') $origin = 'learnpath';	//origin = learnpath in student view
337
+    if ($builder != 'builder') $origin = 'learnpath'; //origin = learnpath in student view
338 338
     $linktype = $type;
339 339
     if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link';
340 340
 
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
     switch ($type) {
343 343
         case TOOL_CALENDAR_EVENT:
344 344
         case 'Agenda':
345
-            $TABLEAGENDA 		= Database::get_course_table(TABLE_AGENDA);
345
+            $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
346 346
             $result = Database::query("SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id=$id");
347 347
             $myrow = Database::fetch_array($result);
348 348
 
349 349
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
350
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
350
+            $result = Database::query($sql); $row = Database::fetch_array($result);
351 351
             if ($row['title'] != '') { $myrow['title'] = $row['title']; }
352 352
             $desc = $row['description'];
353 353
             $agenda_id = $row['item_id'];
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             if ($icon != 'nolink') {
357 357
                 if ($completed == 'completed') {
358 358
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
359
-                }	else {
359
+                } else {
360 360
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
361 361
                     //echo "&nbsp;";
362 362
                 }
@@ -368,17 +368,17 @@  discard block
 block discarded – undo
368 368
             if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); }
369 369
             if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; }
370 370
             if ($builder != 'builder') {
371
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length-3*$level))."</a>";
371
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
372 372
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Agenda&origin=$origin&agenda_id=$agenda_id#$id_in_path";
373 373
                 if ($desc != '') {
374 374
                     if ($icon != 'wrap') {
375
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
375
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
376 376
                     } else {
377
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
377
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
378 378
                     }
379 379
                 }
380 380
             } else {
381
-                echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>";
381
+                echo "<a href=\"../calendar/agenda.php?origin=$origin&agenda_id=$agenda_id\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
382 382
             }
383 383
             break;
384 384
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
             if ($icon != 'nolink') {
408 408
                 if ($completed == 'completed') {
409 409
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
410
-                }	else {
410
+                } else {
411 411
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
412 412
                     //echo "&nbsp;";
413 413
                 }
@@ -420,26 +420,26 @@  discard block
 block discarded – undo
420 420
                 return(true);
421 421
             }
422 422
 
423
-            if ($icon == 'nolink') { return(shorten($title,$length)); }
423
+            if ($icon == 'nolink') { return(shorten($title, $length)); }
424 424
             if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; }
425 425
             if ($builder != 'builder') {
426
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title, ($length-3*$level))."</a>";
426
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path\" class='$completed'>".shorten($title, ($length - 3 * $level))."</a>";
427 427
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Ad_Valvas&origin=$origin&ann_id=$ann_id#$id_in_path";
428 428
                 if ($desc != '') {
429 429
                     if ($icon != 'wrap') {
430
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
430
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
431 431
                     } else {
432
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
432
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
433 433
                     }
434 434
                 }
435 435
             } else {
436
-                echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title, ($length-3*$level))."</a>";
436
+                echo "<a href=\"../announcements/announcements.php?origin=$origin&ann_id=$ann_id\" class='$completed' target='_blank'>".shorten($title, ($length - 3 * $level))."</a>";
437 437
             }
438 438
             break;
439 439
 
440 440
         case TOOL_LINK:
441 441
         case 'Link':
442
-            $TABLETOOLLINK	= Database::get_course_table(TABLE_LINK);
442
+            $TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
443 443
             $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
444 444
             $myrow = Database::fetch_array($result);
445 445
 
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
             $result = Database::query($sql);
448 448
             $row = Database::fetch_array($result);
449 449
             if ($row['title'] != '') { $myrow['title'] = $row['title']; }
450
-            $desc=$row['description'];
450
+            $desc = $row['description'];
451 451
             echo str_repeat("&nbsp;&gt;", $level);
452 452
 
453 453
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "<td>"; }
454 454
             if ($icon != 'nolink') {
455 455
                 if ($completed == 'completed') {
456 456
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
457
-                }	else {
457
+                } else {
458 458
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
459 459
                     //echo "&nbsp;";
460 460
                 }
@@ -473,23 +473,23 @@  discard block
 block discarded – undo
473 473
             }
474 474
             $thelink = $myrow['url'];
475 475
             if ($builder != 'builder') {
476
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length-3*$level))."</a>";
477
-                $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path";
476
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
477
+                $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=$linktype&origin=$origin&thelink=$thelink#$id_in_path";
478 478
                 if ($desc != '') {
479 479
                     if ($icon != 'wrap') {
480
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
480
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
481 481
                     } else {
482
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
482
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
483 483
                     }
484 484
                 }
485 485
             } else {
486
-                echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>";
486
+                echo "<a href=\"$thelink\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
487 487
             }
488 488
             break;
489 489
 
490 490
         case TOOL_QUIZ:
491 491
         case 'Exercise':
492
-            $TBL_EXERCICES  = Database::get_course_table(TABLE_QUIZ_TEST);
492
+            $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
493 493
             $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id");
494 494
             $myrow = Database::fetch_array($result);
495 495
 
@@ -522,35 +522,35 @@  discard block
 block discarded – undo
522 522
             if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); }
523 523
             if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; }
524 524
             if ($builder != 'builder') {
525
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length-3*$level))."</a>";
525
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path\" class='$completed'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
526 526
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Exercise&origin=$origin&exerciseId=".$myrow["id"]."#$id_in_path";
527 527
                 if ($desc != '') {
528 528
                     if ($icon != 'wrap') {
529
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
529
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
530 530
                     } else {
531
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
531
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
532 532
                     }
533 533
                 }
534 534
             } else {
535
-                echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow['id']."\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length-3*$level))."</a>";
535
+                echo "<a href=\"../exercice/exercise_submit.php?origin=$origin&exerciseId=".$myrow['id']."\" class='$completed' target='_blank'>".shorten($myrow['title'], ($length - 3 * $level))."</a>";
536 536
             }
537 537
             break;
538 538
 
539 539
         case 'hotpotatoes':
540 540
         case 'HotPotatoes':
541
-            $TBL_DOCUMENT  = Database::get_course_table(TABLE_DOCUMENT);
541
+            $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
542 542
             $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
543 543
             $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id");
544 544
             $myrow = Database::fetch_array($result);
545 545
             $path = $myrow['path'];
546 546
             $name = GetQuizName($path, $documentPath);
547 547
 
548
-            if ($builder == 'builder') { $origin='builder'; }
548
+            if ($builder == 'builder') { $origin = 'builder'; }
549 549
               // This is needed for the exercise_submit.php can delete the session info about tests.
550 550
 
551 551
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
552
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
553
-            if ($row['title'] != '') { $name=$row['title']; }
552
+            $result = Database::query($sql); $row = Database::fetch_array($result);
553
+            if ($row['title'] != '') { $name = $row['title']; }
554 554
             $desc = $row['description'];
555 555
             echo str_repeat("&nbsp;&gt;", $level);
556 556
 
@@ -558,32 +558,32 @@  discard block
 block discarded – undo
558 558
             if ($icon != 'nolink') {
559 559
                 if ($completed == 'completed') {
560 560
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
561
-                }	else {
561
+                } else {
562 562
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
563 563
                     //echo "&nbsp;";
564 564
                 }
565 565
             }
566 566
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; }
567 567
 
568
-            if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
568
+            if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
569 569
 
570
-            if ($icon == 'nolink') { return(shorten($name,$length)); }
570
+            if ($icon == 'nolink') { return(shorten($name, $length)); }
571 571
             if ($icon == 'icon') { echo "<img src='../img/jqz.jpg' align=\"absmiddle\" alt='hot potatoes'>"; }
572 572
 
573 573
             $cid = $_course['official_code'];
574 574
 
575 575
             if ($builder != 'builder') {
576
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>";
576
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>";
577 577
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=HotPotatoes&origin=$origin&id=$id#$id_in_path";
578 578
                 if ($desc != '') {
579 579
                     if ($icon != 'wrap') {
580
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
580
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
581 581
                     } else {
582
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
582
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
583 583
                     }
584 584
                 }
585 585
             } else {
586
-                echo "&nbsp;<a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>";
586
+                echo "&nbsp;<a href=\"../exercice/showinframes.php?file=$path&cid=$cid&uid=".$_user['user_id']."\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
587 587
             }
588 588
             break;
589 589
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
             $myrow = Database::fetch_array($result);
595 595
 
596 596
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
597
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
597
+            $result = Database::query($sql); $row = Database::fetch_array($result);
598 598
             if ($row['title'] != '') { $myrow["forum_name"] = $row['title']; }
599 599
             $desc = $row['description'];
600 600
             echo str_repeat("&nbsp;&gt;", $level);
@@ -603,30 +603,30 @@  discard block
 block discarded – undo
603 603
             if ($icon != 'nolink') {
604 604
                 if ($completed == 'completed') {
605 605
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
606
-                }	else {
606
+                } else {
607 607
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
608 608
                     //echo "&nbsp;";
609 609
                 }
610 610
             }
611 611
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; }
612 612
 
613
-            if ($myrow["forum_name"]=='') { $type="Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
613
+            if ($myrow["forum_name"] == '') { $type = "Forum"; echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
614 614
 
615 615
             if ($icon == 'nolink') { return(shorten($myrow['forum_name'], $length)); }
616 616
             if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; }
617 617
             $forumparameters = "forum=".$myrow["forum_id"]."&md5=".$myrow["md5"];
618 618
             if ($builder != 'builder') {
619
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"],($length-3*$level))."</a>";
619
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path\" class='$completed'>".shorten($myrow["forum_name"], ($length - 3 * $level))."</a>";
620 620
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Forum&origin=$origin&forumparameters=$forumparameters#$id_in_path";
621 621
                 if ($desc != '') {
622 622
                     if ($icon != 'wrap') {
623
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div></td></tr>";
623
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
624 624
                     } else {
625
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>";
625
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
626 626
                     }
627 627
                 }
628 628
             } else {
629
-                echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"],($length-3*$level))."</a>";
629
+                echo "<a href=\"../phpbb/viewforum.php?$forumparameters\" class='$completed' target='_blank'>".shorten($myrow["forum_name"], ($length - 3 * $level))."</a>";
630 630
             }
631 631
             break;
632 632
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             $myrow = Database::fetch_array($result);
639 639
 
640 640
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
641
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
641
+            $result = Database::query($sql); $row = Database::fetch_array($result);
642 642
             if ($row['title'] != '') { $myrow['topic_title'] = $row['title']; }
643 643
             $desc = $row['description'];
644 644
             echo str_repeat("&nbsp;&gt;", $level);
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
             if ($icon != 'nolink') {
648 648
                 if ($completed == 'completed') {
649 649
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
650
-                }	else {
650
+                } else {
651 651
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
652 652
                     //echo "&nbsp;";
653 653
                 }
@@ -659,17 +659,17 @@  discard block
 block discarded – undo
659 659
             if ($icon == 'nolink') { return(shorten($myrow['topic_title'], $length)); }
660 660
             if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; }
661 661
             if ($builder != 'builder') {
662
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"], ($length-3*$level))."</a>";
662
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path\" class='$completed'>".shorten($myrow["topic_title"], ($length - 3 * $level))."</a>";
663 663
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path";
664 664
                 if ($desc != '') {
665 665
                     if ($icon != 'wrap') {
666
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div></td></tr>";
666
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
667 667
                     } else {
668
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>";
668
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
669 669
                     }
670 670
                 }
671 671
             } else {
672
-                echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"],($length-3*$level))."</a>";
672
+                echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["topic_title"], ($length - 3 * $level))."</a>";
673 673
             }
674 674
             break;
675 675
 
@@ -684,13 +684,13 @@  discard block
 block discarded – undo
684 684
 
685 685
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
686 686
             $result = Database::query($sql);
687
-            $row=Database::fetch_array($result);
687
+            $row = Database::fetch_array($result);
688 688
             if ($row['title'] != '') { $myrow['post_title'] = $row['title']; }
689 689
             $desc = $row['description'];
690 690
             echo str_repeat("&nbsp;&gt;", $level);
691 691
 
692
-            $posternom = $myrow['nom'];				$posterprenom = $myrow['prenom'];
693
-            $posttime = $myrow['post_time'];			$posttext = $myrow['post_text'];
692
+            $posternom = $myrow['nom']; $posterprenom = $myrow['prenom'];
693
+            $posttime = $myrow['post_time']; $posttext = $myrow['post_text'];
694 694
             $posttitle = $myrow['post_title'];
695 695
             $posttext = str_replace('"', "'", $posttext);
696 696
 
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
             if ($icon != 'nolink') {
699 699
                 if ($completed == 'completed') {
700 700
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
701
-                }	else {
701
+                } else {
702 702
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
703 703
                     //echo "&nbsp;";
704 704
                 }
@@ -710,19 +710,19 @@  discard block
 block discarded – undo
710 710
                 echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true);
711 711
             }
712 712
 
713
-            if ($icon == 'nolink') { return(shorten($myrow["post_title"],$length)); }
713
+            if ($icon == 'nolink') { return(shorten($myrow["post_title"], $length)); }
714 714
             if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; }
715 715
             if ($builder != 'builder') {
716
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow["post_title"],($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path";
716
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path\" class='$completed'>".shorten($myrow["post_title"], ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".intval($_GET['source_forum'])."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Post&origin=$origin&posternom=$posternom&posterprenom=$posterprenom&posttime=$posttime&posttext=$posttext&posttitle=$posttitle#$id_in_path";
717 717
                 if ($desc != '') {
718 718
                     if ($icon != 'wrap') {
719
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div></td></tr>";
719
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
720 720
                     } else {
721
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>";
721
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
722 722
                     }
723 723
                 }
724 724
             } else {
725
-                echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["post_title"],($length-3*$level))."</a>";
725
+                echo "<a href=\"../phpbb/viewtopic.php?topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."\" class='$completed' target='_blank'>".shorten($myrow["post_title"], ($length - 3 * $level))."</a>";
726 726
             }
727 727
             break;
728 728
 
@@ -735,14 +735,14 @@  discard block
 block discarded – undo
735 735
             $myrow = Database::fetch_array($result);
736 736
 
737 737
             $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
738
-            $last = count($pathname) - 1;  // Making a correct name for the link.
739
-            $filename=$pathname[$last];  // Making a correct name for the link.
738
+            $last = count($pathname) - 1; // Making a correct name for the link.
739
+            $filename = $pathname[$last]; // Making a correct name for the link.
740 740
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "<td>"; }
741 741
 
742 742
             echo str_repeat("&nbsp;&gt;", $level);
743 743
 
744 744
             if ($icon != 'nolink') {
745
-                if ($completed=='completed') {
745
+                if ($completed == 'completed') {
746 746
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
747 747
                 } else {
748 748
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
@@ -754,9 +754,9 @@  discard block
 block discarded – undo
754 754
 
755 755
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
756 756
             //error_log('New LP - Querying lp_item table: '.$sql, 0);
757
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
757
+            $result = Database::query($sql); $row = Database::fetch_array($result);
758 758
             if ($row['title'] != '') { $filename = $row['title']; }
759
-            $desc=$row['description'];
759
+            $desc = $row['description'];
760 760
 
761 761
             if (($myrow['path'] == '') && ($filename == '')) {
762 762
                 echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>";
@@ -767,22 +767,22 @@  discard block
 block discarded – undo
767 767
             if ($icon == 'icon') { echo "<img src='../img/$image' align=\"absmiddle\" alt='$image'>"; }
768 768
             if ($builder != 'builder')
769 769
             {
770
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename,($length-3*$level))."</a>";
770
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path\" class='$completed'>".shorten($filename, ($length - 3 * $level))."</a>";
771 771
                 if ($desc != '') {
772 772
                     if ($icon != 'wrap') {
773
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div></td></tr>";
773
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
774 774
                     } else {
775
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>";
775
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
776 776
                     }
777 777
                 } $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Document&origin=$origin&docurl=".$myrow["path"]."#$id_in_path";
778 778
             } else {
779
-                $enableDocumentParsing=yes;
779
+                $enableDocumentParsing = yes;
780 780
                 if (!$enableDocumentParsing) {
781 781
                     // This is the solution for the non-parsing version in the builder.
782 782
                     $file = urlencode($myrow['path']);
783
-                    echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>";
783
+                    echo "<a href='../document/showinframes.php?file=$file' class='$completed' $hyperlink_target_parameter>".shorten($filename, ($length - 3 * $level))."</a>";
784 784
                 } else {
785
-                    echo "<a href=\"../document/download.php?doc_url=".$myrow['path']."\" class='$completed' $hyperlink_target_parameter>".shorten($filename,($length-3*$level))."</a>";
785
+                    echo "<a href=\"../document/download.php?doc_url=".$myrow['path']."\" class='$completed' $hyperlink_target_parameter>".shorten($filename, ($length - 3 * $level))."</a>";
786 786
                 }
787 787
             }
788 788
             break;
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
794 794
             $result = Database::query($sql);
795 795
             $row = Database::fetch_array($result);
796
-            if ($row['title'] != '') { $name=$row['title']; }
796
+            if ($row['title'] != '') { $name = $row['title']; }
797 797
             $desc = $row['description'];
798 798
             echo str_repeat("&nbsp;&gt;", $level);
799 799
 
@@ -801,30 +801,30 @@  discard block
 block discarded – undo
801 801
             if ($icon != 'nolink') {
802 802
                 if ($completed == 'completed') {
803 803
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
804
-                }	else {
804
+                } else {
805 805
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
806 806
                     //echo "&nbsp;";
807 807
                 }
808 808
             }
809 809
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; }
810 810
 
811
-            if ($name=='') {
811
+            if ($name == '') {
812 812
                 echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true);
813 813
             }
814 814
 
815 815
             if ($icon == 'nolink') { return(shorten($name, $length)); }
816 816
             if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; }
817 817
             if ($builder != 'builder') {
818
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path";
818
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Assignments&origin=$origin#$id_in_path";
819 819
                 if ($desc != '') {
820 820
                     if ($icon != 'wrap') {
821
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>";
821
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>";
822 822
                     } else {
823
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>";
823
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>";
824 824
                     }
825 825
                 }
826 826
             } else {
827
-                echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
827
+                echo "<a href=\"../work/work.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
828 828
             }
829 829
             break;
830 830
 
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
             if ($icon != 'nolink') {
843 843
                 if ($completed == 'completed') {
844 844
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
845
-                }	else {
845
+                } else {
846 846
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
847 847
                     //echo "&nbsp;";
848 848
                 }
@@ -855,15 +855,15 @@  discard block
 block discarded – undo
855 855
             if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; }
856 856
 
857 857
             if ($builder != 'builder') {
858
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path";
858
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Dropbox&origin=$origin#$id_in_path";
859 859
                 if ($desc != '') {
860 860
                     if ($icon != 'wrap') {
861
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; }
861
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; }
862 862
                     else {
863
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
863
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>"; }
864 864
                 }
865 865
             } else {
866
-                echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
866
+                echo "<a href=\"../dropbox/index.php\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
867 867
             }
868 868
             break;
869 869
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         case 'Introduction_text':
872 872
             $name = get_lang('IntroductionText');
873 873
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
874
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
874
+            $result = Database::query($sql); $row = Database::fetch_array($result);
875 875
             if ($row['title'] != '') { $name = $row['title']; }
876 876
             $desc = $row['description'];
877 877
             echo str_repeat("&nbsp;&gt;", $level);
@@ -893,17 +893,17 @@  discard block
 block discarded – undo
893 893
             if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; }
894 894
 
895 895
             if ($builder != 'builder') {
896
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>";
896
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>";
897 897
                 $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path";
898 898
                 if ($desc != '') {
899 899
                     if ($icon != 'wrap') {
900
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; }
900
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; }
901 901
                     else {
902
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
902
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>"; }
903 903
                 }
904 904
             } else {
905 905
                 $s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1";
906
-                echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
906
+                echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
907 907
             }
908 908
             break;
909 909
 
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
         case 'Course_description':
912 912
             $name = get_lang('CourseDescription');
913 913
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
914
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
914
+            $result = Database::query($sql); $row = Database::fetch_array($result);
915 915
             if ($row['title'] != '') { $name = $row['title']; }
916 916
             $desc = $row['description'];
917 917
             echo str_repeat("&nbsp;&gt;", $level);
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             if ($icon != 'nolink') {
921 921
                 if ($completed == 'completed') {
922 922
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
923
-                }	else {
923
+                } else {
924 924
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
925 925
                     //echo "&nbsp;";
926 926
                 }
@@ -929,20 +929,20 @@  discard block
 block discarded – undo
929 929
 
930 930
             if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
931 931
 
932
-            if ($icon == 'nolink') { return(shorten($name,$length)); }
932
+            if ($icon == 'nolink') { return(shorten($name, $length)); }
933 933
             if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; }
934 934
 
935 935
             if ($builder != 'builder') {
936
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path";
936
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path";
937 937
                 if ($desc != '') {
938 938
                     if ($icon != 'wrap') {
939
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; }
939
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; }
940 940
                     else {
941
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
941
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>"; }
942 942
                 }
943 943
             } else {
944
-                $s=api_get_path(WEB_CODE_PATH)."course_description";
945
-                echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
944
+                $s = api_get_path(WEB_CODE_PATH)."course_description";
945
+                echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
946 946
             }
947 947
             break;
948 948
 
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
953 953
             $result = Database::query($sql);
954 954
             $row = Database::fetch_array($result);
955
-            if ($row['title'] != '') { $name=$row['title']; }
955
+            if ($row['title'] != '') { $name = $row['title']; }
956 956
             $desc = $row['description'];
957 957
             echo str_repeat("&nbsp;&gt;", $level);
958 958
 
@@ -967,21 +967,21 @@  discard block
 block discarded – undo
967 967
             }
968 968
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; }
969 969
 
970
-            if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
970
+            if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
971 971
 
972 972
             if ($icon == 'nolink') { return(shorten($name, $length)); }
973 973
             if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; }
974 974
 
975 975
             if ($builder != 'builder') {
976
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path";
976
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Groups&origin=$origin#$id_in_path";
977 977
                 if ($desc != '') {
978 978
                     if ($icon != 'wrap') {
979
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; }
979
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; }
980 980
                     else {
981
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
981
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>"; }
982 982
                 }
983 983
             } else {
984
-                echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
984
+                echo "<a href=\"../group/group.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
985 985
             }
986 986
             break;
987 987
 
@@ -1006,21 +1006,21 @@  discard block
 block discarded – undo
1006 1006
             }
1007 1007
             if (($builder != 'builder') && ($icon != 'wrap')) { echo "</td><td>"; }
1008 1008
 
1009
-            if ($name=='') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
1009
+            if ($name == '') { echo "<span class='messagesmall'>".get_lang('StepDeleted1')." $type ".get_lang('StepDeleted2')."</span>"; return(true); }
1010 1010
 
1011
-            if ($icon == 'nolink') { return(shorten($name,$length)); }
1011
+            if ($icon == 'nolink') { return(shorten($name, $length)); }
1012 1012
             if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; }
1013 1013
 
1014 1014
             if ($builder != 'builder') {
1015
-                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name,($length-3*$level))."</a>"; $items[]=api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path";
1015
+                echo "<a href=\"".api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path\" class='$completed'>".shorten($name, ($length - 3 * $level))."</a>"; $items[] = api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Users&origin=$origin#$id_in_path";
1016 1016
                 if ($desc != '') {
1017 1017
                     if ($icon != 'wrap') {
1018
-                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; }
1018
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div></td></tr>"; }
1019 1019
                     else {
1020
-                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
1020
+                        echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length - 3 * $level))."</div>"; }
1021 1021
                 }
1022 1022
             } else {
1023
-                echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length-3*$level))."</a>";
1023
+                echo "<a href=\"../user/user.php?origin=$origin\" class='$completed' target='_blank'>".shorten($name, ($length - 3 * $level))."</a>";
1024 1024
             }
1025 1025
             break;
1026 1026
     }//end huge switch-statement
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
             $myrow = Database::fetch_array($result);
1060 1060
 
1061 1061
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1062
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
1062
+            $result = Database::query($sql); $row = Database::fetch_array($result);
1063 1063
             if ($row['title'] != '') { $myrow['title'] = $row['title']; }
1064 1064
             $desc = $row['description'];
1065 1065
             $agenda_id = $row['item_id'];
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
             break;
1085 1085
 
1086 1086
         case 'Link':
1087
-            $TABLETOOLLINK	= Database::get_course_table(TABLE_LINK);
1087
+            $TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
1088 1088
             $result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE c_id = $course_id AND id=$id");
1089 1089
             $myrow = Database::fetch_array($result);
1090 1090
 
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
             break;
1102 1102
 
1103 1103
         case 'Exercise':
1104
-            $TBL_EXERCICES  = Database::get_course_table(TABLE_QUIZ_TEST);
1104
+            $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
1105 1105
             $result = Database::query("SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id");
1106 1106
             $myrow = Database::fetch_array($result);
1107 1107
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
               // This is needed for the exercise_submit.php can delete the session info about tests.
1110 1110
 
1111 1111
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1112
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
1112
+            $result = Database::query($sql); $row = Database::fetch_array($result);
1113 1113
             if ($row['title'] != '') { $myrow['title'] = $row['title']; }
1114 1114
 
1115 1115
             if ($builder != 'builder') {
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
             }
1120 1120
             break;
1121 1121
         case 'HotPotatoes':
1122
-            $TBL_DOCUMENT  = Database::get_course_table(TABLE_DOCUMENT);
1122
+            $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
1123 1123
             $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
1124 1124
             $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id");
1125 1125
             $myrow = Database::fetch_array($result);
@@ -1137,14 +1137,14 @@  discard block
 block discarded – undo
1137 1137
             break;
1138 1138
         case 'Forum':
1139 1139
             //deprecated
1140
-            $TBL_FORUMS = Database::get_course_table(TABLE_FORUM);  // TODO: This is the old table name, it should be corrected.
1140
+            $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); // TODO: This is the old table name, it should be corrected.
1141 1141
             $result = Database::query("SELECT * FROM $TBL_FORUMS WHERE c_id = $course_id AND forum_id=$id");
1142 1142
             $myrow = Database::fetch_array($result);
1143 1143
 
1144 1144
             if ($builder == 'builder') { $origin = 'builder'; }
1145 1145
 
1146 1146
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1147
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
1147
+            $result = Database::query($sql); $row = Database::fetch_array($result);
1148 1148
             if ($row['title'] != '') { $myrow['forum_name'] = $row['title']; }
1149 1149
 
1150 1150
             if ($myrow['forum_name'] == '') { $type = 'Forum'; }
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
             $myrow = Database::fetch_array($result);
1168 1168
 
1169 1169
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1170
-            $result = Database::query($sql);	$row = Database::fetch_array($result);
1170
+            $result = Database::query($sql); $row = Database::fetch_array($result);
1171 1171
 
1172 1172
             if ($builder != 'builder') {
1173 1173
                 $link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Thread&origin=$origin&topic=".$myrow["topic_id"]."&forum=".$myrow["forum_id"]."&md5=".$myrow["md5"]."#$id_in_path";
@@ -1191,8 +1191,8 @@  discard block
 block discarded – undo
1191 1191
             $desc = $row['description'];
1192 1192
             //$link .= str_repeat("&nbsp;&gt;", $level);
1193 1193
 
1194
-            $posternom = $myrow['nom'];				$posterprenom = $myrow['prenom'];
1195
-            $posttime = $myrow['post_time'];		$posttext = $myrow['post_text'];
1194
+            $posternom = $myrow['nom']; $posterprenom = $myrow['prenom'];
1195
+            $posttime = $myrow['post_time']; $posttext = $myrow['post_text'];
1196 1196
             $posttitle = $myrow['post_title'];
1197 1197
             $posttext = str_replace('"', "'", $posttext);
1198 1198
 
@@ -1209,8 +1209,8 @@  discard block
 block discarded – undo
1209 1209
             $myrow = Database::fetch_array($result);
1210 1210
 
1211 1211
             $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
1212
-            $last = count($pathname) - 1;  // Making a correct name for the link.
1213
-            $filename = $pathname[$last];  // Making a correct name for the link.
1212
+            $last = count($pathname) - 1; // Making a correct name for the link.
1213
+            $filename = $pathname[$last]; // Making a correct name for the link.
1214 1214
 
1215 1215
             $sql = "select * from $tbl_lp_item where c_id = $course_id AND id=$id_in_path";
1216 1216
             $result = Database::query($sql);
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
     unset($addedresource[$resource_key]);
1289 1289
     unset($addedresourceid[$resource_key]);
1290 1290
     $_SESSION['addedresource'] = $addedresource;
1291
-    $_SESSION['addedresourceid'] = $addedresourceid ;
1291
+    $_SESSION['addedresourceid'] = $addedresourceid;
1292 1292
 }
1293 1293
 
1294 1294
 /**
@@ -1363,11 +1363,11 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
     $sql = "SELECT * FROM $TABLERESOURCE
1365 1365
             WHERE c_id = $course_id AND source_type='$type' and source_id=$id";
1366
-    $result=Database::query($sql);
1367
-    while ($row=Database::fetch_array($result))
1366
+    $result = Database::query($sql);
1367
+    while ($row = Database::fetch_array($result))
1368 1368
     {
1369
-        $addedresource[]=$row["resource_type"];
1370
-        $addedresourceid[]=$row["resource_id"];
1369
+        $addedresource[] = $row["resource_type"];
1370
+        $addedresourceid[] = $row["resource_id"];
1371 1371
     }
1372 1372
     $_SESSION['addedresource'] = $addedresource;
1373 1373
     $_SESSION['addedresourceid'] = $addedresourceid;
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
     $sql = "SELECT * FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
1415 1415
     $result = Database::query($sql);
1416
-    while ($row=Database::fetch_array($result)) {
1416
+    while ($row = Database::fetch_array($result)) {
1417 1417
         if ($origin != 'learnpath') {
1418
-            display_addedresource_link($row['resource_type'], $row['resource_id'], $style) ;
1418
+            display_addedresource_link($row['resource_type'], $row['resource_id'], $style);
1419 1419
         } else {
1420
-            display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'],'agendaitems','','builder','icon') ; echo "<br>";
1420
+            display_addedresource_link_in_learnpath($row['resource_type'], $row['resource_id'], 'agendaitems', '', 'builder', 'icon'); echo "<br>";
1421 1421
         }
1422 1422
     }
1423 1423
 }
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
     if (is_array($_SESSION['addedresource'])) {
1481 1481
         foreach ($addedresource as $toolcompare) {
1482
-            if ($toolcompare==$type && $addedresourceid[key($addedresource)] == $id) {
1482
+            if ($toolcompare == $type && $addedresourceid[key($addedresource)] == $id) {
1483 1483
                 $show = 0;
1484 1484
             }
1485 1485
             next($addedresource);
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
  * @param boolean	Open in a new window (true) or in the current frame/window (false)?
1514 1514
  * @todo use the constants for the type definitions.
1515 1515
  */
1516
-function rl_get_html_resource_link($course_code, $type, $id, $style='', $new_window = true) {
1516
+function rl_get_html_resource_link($course_code, $type, $id, $style = '', $new_window = true) {
1517 1517
     $_course = api_get_course_info($course_code);
1518 1518
 
1519 1519
     $course_id = api_get_course_int_id();
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
         case TOOL_THREAD:  //=topics
1560 1560
             //$tbl_forum 		= Database::get_course_table(TABLE_FORUM);
1561 1561
             //$tbl_thread 	= Database::get_course_table(TABLE_FORUM_THREAD);
1562
-            $tbl_post 		= Database::get_course_table(TABLE_FORUM_POST);
1562
+            $tbl_post = Database::get_course_table(TABLE_FORUM_POST);
1563 1563
             // grabbing the title of the post
1564 1564
             $sql_title = "SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=".$id;
1565 1565
             $result_title = Database::query($sql_title);
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id");
1580 1580
             $myrow = Database::fetch_array($result);
1581 1581
             $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
1582
-            $last = count($pathname) - 1;  // Making a correct name for the link.
1583
-            $filename = $pathname[$last];  // Making a correct name for the link.
1582
+            $last = count($pathname) - 1; // Making a correct name for the link.
1583
+            $filename = $pathname[$last]; // Making a correct name for the link.
1584 1584
             $image = choose_image($filename);
1585 1585
             $ext = explode('.', $filename);
1586 1586
             $ext = strtolower($ext[sizeof($ext) - 1]);
@@ -1656,8 +1656,8 @@  discard block
 block discarded – undo
1656 1656
             if (!empty($id)) {
1657 1657
                 $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
1658 1658
                 $sql = "SELECT * FROM $TBL_EXERCICES WHERE c_id = $course_id AND id=$id";
1659
-                $result= Database::query($sql);
1660
-                $myrow=Database::fetch_array($result);
1659
+                $result = Database::query($sql);
1660
+                $myrow = Database::fetch_array($result);
1661 1661
                 if ($row_item['title'] != '') {
1662 1662
                     $myrow['title'] = $row_item['title'];
1663 1663
                 }
@@ -1669,8 +1669,8 @@  discard block
 block discarded – undo
1669 1669
             $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND id=$id");
1670 1670
             $myrow = Database::fetch_array($result);
1671 1671
             $path = $myrow['path'];
1672
-            $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.'' .
1673
-                    '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().'' .
1672
+            $link .= $main_dir_path.'exercice/showinframes.php?file='.$path.''.
1673
+                    '&origin='.$origin.'&cid='.$course_code.'&uid='.api_get_user_id().''.
1674 1674
                     '&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$id_in_path.'&lp_view_id='.$lpViewId;
1675 1675
             break;
1676 1676
         case TOOL_FORUM:
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
                 $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id";
1683 1683
                 $result = Database::query($sql);
1684 1684
                 $myrow = Database::fetch_array($result);
1685
-                $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.'' .
1685
+                $link .= $main_dir_path.'forum/viewthread.php?origin=learnpath&thread='.$id.''.
1686 1686
                         '&forum='.$myrow['forum_id'].'&lp=true';
1687 1687
             }
1688 1688
             break;
@@ -1698,14 +1698,14 @@  discard block
 block discarded – undo
1698 1698
             $posttitle = $title;
1699 1699
             $posttext = str_replace('"', "'", $posttext);
1700 1700
 
1701
-            $link .= $main_dir_path.'forum/viewthread.php?post='.$id.'' .
1702
-                    '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].'' .
1701
+            $link .= $main_dir_path.'forum/viewthread.php?post='.$id.''.
1702
+                    '&thread='.$myrow['thread_id'].'&forum='.$myrow['forum_id'].''.
1703 1703
                     '&lp=true';
1704 1704
             break;
1705 1705
         case TOOL_DOCUMENT:
1706 1706
             $document = $em
1707 1707
                 ->getRepository('ChamiloCourseBundle:CDocument')
1708
-                ->findOneBy(['cId' => $course_id,  'id' => $id]);
1708
+                ->findOneBy(['cId' => $course_id, 'id' => $id]);
1709 1709
 
1710 1710
             if (!$document) {
1711 1711
                 break;
@@ -1717,9 +1717,9 @@  discard block
 block discarded – undo
1717 1717
             $showDirectUrl = !in_array($extension, $jplayer_supported_files);
1718 1718
 
1719 1719
             if ($showDirectUrl) {
1720
-                $link = $main_course_path . 'document' . $document->getPath() . '?' . api_get_cidreq();
1720
+                $link = $main_course_path.'document'.$document->getPath().'?'.api_get_cidreq();
1721 1721
             } else {
1722
-                $link = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?' . http_build_query([
1722
+                $link = api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.http_build_query([
1723 1723
                     'cidReq' => $course_code,
1724 1724
                     'id' => $id,
1725 1725
                     'origin' => 'learnpathitem'
@@ -1728,8 +1728,8 @@  discard block
 block discarded – undo
1728 1728
 
1729 1729
             $openmethod = 2;
1730 1730
             $officedoc = false;
1731
-            Session::write('openmethod',$openmethod);
1732
-            Session::write('officedoc',$officedoc);
1731
+            Session::write('openmethod', $openmethod);
1732
+            Session::write('officedoc', $officedoc);
1733 1733
             break;
1734 1734
         case TOOL_LP_FINAL_ITEM:
1735 1735
             $link .= api_get_path(WEB_CODE_PATH).'newscorm/lp_final_item.php?'.api_get_cidreq().'&id='.$id.'&lp_id='.$learnpath_id;
@@ -1856,8 +1856,8 @@  discard block
 block discarded – undo
1856 1856
             $result = Database::query("SELECT * FROM $tbl_doc WHERE c_id = $course_id AND id=$id");
1857 1857
             $myrow = Database::fetch_array($result);
1858 1858
             $pathname = explode('/', $myrow['path']); // Making a correct name for the link.
1859
-            $last = count($pathname) - 1;  // Making a correct name for the link.
1860
-            $filename = $pathname[$last];  // Making a correct name for the link.
1859
+            $last = count($pathname) - 1; // Making a correct name for the link.
1860
+            $filename = $pathname[$last]; // Making a correct name for the link.
1861 1861
             $image = choose_image($filename);
1862 1862
             $ext = explode('.', $filename);
1863 1863
             $ext = strtolower($ext[sizeof($ext) - 1]);
Please login to merge, or discard this patch.