Completed
Push — 1.10.x ( e39098...d9ba33 )
by Julito
34:46
created
main/newscorm/lp_controller.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
                 if (isset($_REQUEST['activate_start_date_check']) &&
539 539
                     $_REQUEST['activate_start_date_check'] == 1
540 540
                 ) {
541
-                	$publicated_on = $_REQUEST['publicated_on'];
541
+                    $publicated_on = $_REQUEST['publicated_on'];
542 542
                 } else {
543
-                	$publicated_on = null;
543
+                    $publicated_on = null;
544 544
                 }
545 545
 
546 546
                 if (isset($_REQUEST['activate_end_date_check']) &&
547 547
                     $_REQUEST['activate_end_date_check'] == 1
548 548
                 ) {
549
-                	$expired_on = $_REQUEST['expired_on'];
549
+                    $expired_on = $_REQUEST['expired_on'];
550 550
                 } else {
551
-                	$expired_on = null;
551
+                    $expired_on = null;
552 552
                 }
553 553
 
554 554
                 $new_lp_id = learnpath::add_lp(
@@ -937,9 +937,9 @@  discard block
 block discarded – undo
937 937
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
938 938
 
939 939
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
940
-            	$publicated_on  = $_REQUEST['publicated_on'];
940
+                $publicated_on  = $_REQUEST['publicated_on'];
941 941
             } else {
942
-            	$publicated_on = null;
942
+                $publicated_on = null;
943 943
             }
944 944
 
945 945
             if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
         } elseif ($mode == 'embedded') {
1152 1152
             $_SESSION['oLP']->mode = 'embedded';
1153 1153
         } elseif ($mode == 'embedframe') {
1154
-        	$_SESSION['oLP']->mode = 'embedframe';
1154
+            $_SESSION['oLP']->mode = 'embedframe';
1155 1155
         } elseif ($mode == 'impress') {
1156 1156
             $_SESSION['oLP']->mode = 'impress';
1157 1157
         }
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 		require 'lp_list.php';
1190 1190
 		break;
1191 1191
      */
1192
-	case 'switch_attempt_mode':
1193
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1194
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
-		$_SESSION['refresh'] = 1;
1196
-		$_SESSION['oLP']->switch_attempt_mode();
1192
+    case 'switch_attempt_mode':
1193
+        if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1194
+        if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
+        $_SESSION['refresh'] = 1;
1196
+        $_SESSION['oLP']->switch_attempt_mode();
1197 1197
         require 'lp_list.php';
1198 1198
         break;
1199 1199
     case 'switch_scorm_debug':
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Including the global initialization file.
27 27
 require_once '../inc/global.inc.php';
28
-$current_course_tool  = TOOL_LEARNPATH;
28
+$current_course_tool = TOOL_LEARNPATH;
29 29
 $_course = api_get_course_info();
30 30
 
31 31
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
     ) {
38 38
         $htmlHeadXtra[] = '<script>
39 39
     <!--
40
-        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\';
40
+        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\';
41 41
     -->
42 42
     </script>';
43
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
43
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
45 45
     }
46 46
 }
47 47
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
 $course_id = api_get_course_int_id();
270 270
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
271
+if ($debug > 0) error_log('New LP - Passed data remains check', 0);
272 272
 
273 273
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274 274
     if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             if (Database::num_rows($res)) {
293 293
                 $row = Database::fetch_array($res);
294 294
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
295
+                if ($debug > 0) error_log('New LP - found row - type '.$type.' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296 296
                 switch ($type) {
297 297
                     case 1:
298 298
                         if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                 $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
690 690
                     $_GET['id'],
691 691
                     $_POST['prerequisites'],
692
-                    $_POST['min_' . $_POST['prerequisites']],
693
-                    $_POST['max_' . $_POST['prerequisites']]
692
+                    $_POST['min_'.$_POST['prerequisites']],
693
+                    $_POST['max_'.$_POST['prerequisites']]
694 694
                 );
695 695
 
696 696
                 if ($editPrerequisite) {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
940 940
 
941 941
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
942
-            	$publicated_on  = $_REQUEST['publicated_on'];
942
+            	$publicated_on = $_REQUEST['publicated_on'];
943 943
             } else {
944 944
             	$publicated_on = null;
945 945
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         else {
1011 1011
             $_SESSION['refresh'] = 1;
1012 1012
             if (!empty($_REQUEST['parent_item_id'])) {
1013
-                $_SESSION['from_learnpath']='yes';
1013
+                $_SESSION['from_learnpath'] = 'yes';
1014 1014
                 $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1015 1015
                 require 'resourcelinker.php';
1016 1016
             } else {
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
             error_log('New LP - No learnpath given for view', 0);
1112 1112
             require 'lp_list.php';
1113 1113
         } else {
1114
-            if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1115
-            if ( !empty($_REQUEST['item_id']) ) {
1114
+            if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); }
1115
+            if (!empty($_REQUEST['item_id'])) {
1116 1116
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1117 1117
             }
1118 1118
             require 'lp_view.php';
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 		break;
1193 1193
      */
1194 1194
 	case 'switch_attempt_mode':
1195
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1196
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
+		if ($debug > 0) error_log('New LP - switch_reinit action triggered', 0);
1196
+		if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1197 1197
 		$_SESSION['refresh'] = 1;
1198 1198
 		$_SESSION['oLP']->switch_attempt_mode();
1199 1199
         require 'lp_list.php';
@@ -1243,8 +1243,8 @@  discard block
 block discarded – undo
1243 1243
             error_log('New LP - No learnpath given for view', 0);
1244 1244
             require 'lp_list.php';
1245 1245
         } else {
1246
-            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1247
-            if (!empty($_REQUEST['item_id']) ) {
1246
+            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); }
1247
+            if (!empty($_REQUEST['item_id'])) {
1248 1248
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1249 1249
             }
1250 1250
             require 'lp_impress.php';
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                     $_SESSION['oLP']->lp_session_id
1308 1308
                 );
1309 1309
 
1310
-                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1310
+                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0;
1311 1311
 
1312 1312
                 if (empty($forumCategoryId)) {
1313 1313
                     $forumCategoryId = store_forumcategory(
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
             }
1340 1340
         }
1341 1341
 
1342
-        header('Location:' . api_get_self() . '?' . http_build_query([
1342
+        header('Location:'.api_get_self().'?'.http_build_query([
1343 1343
             'action' => 'add_item',
1344 1344
             'type' => 'step',
1345 1345
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
             }
1382 1382
         }
1383 1383
 
1384
-        header('Location:' . api_get_self() . '?' . http_build_query([
1384
+        header('Location:'.api_get_self().'?'.http_build_query([
1385 1385
             'action' => 'add_item',
1386 1386
             'type' => 'step',
1387 1387
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
         $_SESSION['oLP']->getFinalItemForm();
1406 1406
 
1407
-        $redirectTo = api_get_self() . '?' . http_build_query([
1407
+        $redirectTo = api_get_self().'?'.http_build_query([
1408 1408
             'action' => 'add_item',
1409 1409
             'type' => 'step',
1410 1410
             'lp_id' => intval($_SESSION['oLP']->lp_id)
Please login to merge, or discard this patch.
Braces   +233 added lines, -122 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 $use_anonymous = true;
14 14
 
15 15
 $debug = 0;
16
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
16
+if ($debug > 0) {
17
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
18
+}
17 19
 
18 20
 // Language files that needs to be included.
19 21
 if (isset($_GET['action'])) {
@@ -231,10 +233,14 @@  discard block
 block discarded – undo
231 233
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
232 234
     Session::erase('refresh');
233 235
     $myrefresh = 1;
234
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
235
-}
236
+    if ($debug > 0) {
237
+        error_log('New LP - Refresh asked', 0);
238
+    }
239
+    }
236 240
 
237
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
241
+if ($debug > 0) {
242
+    error_log('New LP - Passed refresh check', 0);
243
+}
238 244
 
239 245
 if (!empty($_REQUEST['dialog_box'])) {
240 246
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -244,17 +250,23 @@  discard block
 block discarded – undo
244 250
 $lp_found = false;
245 251
 
246 252
 if (isset($_SESSION['lpobject'])) {
247
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
253
+    if ($debug > 0) {
254
+        error_log('New LP - SESSION[lpobject] is defined', 0);
255
+    }
248 256
     $oLP = unserialize($_SESSION['lpobject']);
249 257
     if (isset($oLP) && is_object($oLP)) {
250
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
258
+        if ($debug > 0) {
259
+            error_log('New LP - oLP is object', 0);
260
+        }
251 261
         if ($myrefresh == 1 OR
252 262
             empty($oLP->cc) OR
253 263
             $oLP->cc != api_get_course_id() OR
254 264
             $oLP->lp_view_session_id != $session_id OR
255 265
             $oLP->scorm_debug == '1'
256 266
         ) {
257
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
267
+            if ($debug > 0) {
268
+                error_log('New LP - Course has changed, discard lp object', 0);
269
+            }
258 270
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
259 271
             $oLP = null;
260 272
             Session::erase('oLP');
@@ -268,13 +280,19 @@  discard block
 block discarded – undo
268 280
 
269 281
 $course_id = api_get_course_int_id();
270 282
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
283
+if ($debug>0) {
284
+    error_log('New LP - Passed data remains check', 0);
285
+}
272 286
 
273 287
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
288
+    if ($debug > 0) {
289
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
290
+    }
275 291
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
276 292
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
277
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
293
+        if ($debug > 0) {
294
+            error_log('New LP - lp_id is defined', 0);
295
+        }
278 296
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
279 297
         // right object.
280 298
         if (!empty($_REQUEST['lp_id'])) {
@@ -286,49 +304,67 @@  discard block
 block discarded – undo
286 304
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
287 305
         if (is_numeric($lp_id)) {
288 306
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
289
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
307
+            if ($debug > 0) {
308
+                error_log('New LP - querying '.$sel, 0);
309
+            }
290 310
             $res = Database::query($sel);
291 311
 
292 312
             if (Database::num_rows($res)) {
293 313
                 $row = Database::fetch_array($res);
294 314
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
315
+                if ($debug > 0) {
316
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
317
+                }
296 318
                 switch ($type) {
297 319
                     case 1:
298
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
320
+                        if ($debug > 0) {
321
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
322
+                        }
299 323
 
300 324
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
301 325
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
302 326
                         break;
303 327
                     case 2:
304
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
328
+                        if ($debug > 0) {
329
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
330
+                        }
305 331
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
306 332
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
307 333
                         break;
308 334
                     case 3:
309
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        if ($debug > 0) {
336
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
337
+                        }
310 338
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
311 339
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
312 340
                         break;
313 341
                     default:
314
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
342
+                        if ($debug > 0) {
343
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
344
+                        }
315 345
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
316 346
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
317 347
                         break;
318 348
                 }
319 349
             }
320 350
         } else {
321
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
351
+            if ($debug > 0) {
352
+                error_log('New LP - Request[lp_id] is not numeric', 0);
353
+            }
322 354
         }
323 355
     } else {
324
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
356
+        if ($debug > 0) {
357
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
358
+        }
325 359
     }
326 360
     if ($lp_found) {
327 361
         $_SESSION['oLP'] = $oLP;
328 362
     }
329 363
 }
330 364
 
331
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
365
+if ($debug > 0) {
366
+    error_log('New LP - Passed oLP creation check', 0);
367
+}
332 368
 
333 369
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
334 370
 
@@ -372,11 +408,15 @@  discard block
 block discarded – undo
372 408
         if (!$is_allowed_to_edit) {
373 409
             api_not_allowed(true);
374 410
         }
375
-        if ($debug > 0) error_log('New LP - add item action triggered', 0);
411
+        if ($debug > 0) {
412
+            error_log('New LP - add item action triggered', 0);
413
+        }
376 414
 
377 415
         if (!$lp_found) {
378 416
             //check if the learnpath ID was defined, otherwise send back to list
379
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
417
+            if ($debug > 0) {
418
+                error_log('New LP - No learnpath given for add item', 0);
419
+            }
380 420
             require 'lp_list.php';
381 421
         } else {
382 422
             $_SESSION['refresh'] = 1;
@@ -450,11 +490,15 @@  discard block
 block discarded – undo
450 490
         if (!$is_allowed_to_edit) {
451 491
             api_not_allowed(true);
452 492
         }
453
-        if ($debug > 0) error_log('New LP - add audio action triggered', 0);
493
+        if ($debug > 0) {
494
+            error_log('New LP - add audio action triggered', 0);
495
+        }
454 496
 
455 497
         if (!$lp_found) {
456 498
             //check if the learnpath ID was defined, otherwise send back to list
457
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
499
+            if ($debug > 0) {
500
+                error_log('New LP - No learnpath given for add audio', 0);
501
+            }
458 502
             require 'lp_list.php';
459 503
         } else {
460 504
             $_SESSION['refresh'] = 1;
@@ -528,7 +572,9 @@  discard block
 block discarded – undo
528 572
         if (!$is_allowed_to_edit) {
529 573
             api_not_allowed(true);
530 574
         }
531
-        if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
575
+        if ($debug > 0) {
576
+            error_log('New LP - add_lp action triggered', 0);
577
+        }
532 578
         if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
533 579
             $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
534 580
             $_SESSION['refresh'] = 1;
@@ -587,9 +633,10 @@  discard block
 block discarded – undo
587 633
         if (!$is_allowed_to_edit) {
588 634
             api_not_allowed(true);
589 635
         }
590
-        if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
591
-        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
592
-        else {
636
+        if ($debug > 0) {
637
+            error_log('New LP - admin_view action triggered', 0);
638
+        }
639
+        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; } else {
593 640
             $_SESSION['refresh'] = 1;
594 641
             require 'lp_admin_view.php';
595 642
         }
@@ -599,9 +646,10 @@  discard block
 block discarded – undo
599 646
             if (!$is_allowed_to_edit) {
600 647
                 api_not_allowed(true);
601 648
             }
602
-            if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
603
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
604
-            else {
649
+            if ($debug > 0) {
650
+                error_log('New LP - auto_launch action triggered', 0);
651
+            }
652
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
605 653
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
606 654
                 require 'lp_list.php';
607 655
                 exit;
@@ -612,10 +660,11 @@  discard block
 block discarded – undo
612 660
         if (!$is_allowed_to_edit) {
613 661
             api_not_allowed(true);
614 662
         }
615
-        if ($debug > 0) error_log('New LP - build action triggered', 0);
663
+        if ($debug > 0) {
664
+            error_log('New LP - build action triggered', 0);
665
+        }
616 666
 
617
-        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
618
-        else {
667
+        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } else {
619 668
             $_SESSION['refresh'] = 1;
620 669
             //require 'lp_build.php';
621 670
             $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
@@ -627,10 +676,11 @@  discard block
 block discarded – undo
627 676
         if (!$is_allowed_to_edit) {
628 677
             api_not_allowed(true);
629 678
         }
630
-        if ($debug > 0) error_log('New LP - edit item action triggered', 0);
679
+        if ($debug > 0) {
680
+            error_log('New LP - edit item action triggered', 0);
681
+        }
631 682
 
632
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
633
-        else {
683
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; } else {
634 684
             $_SESSION['refresh'] = 1;
635 685
             if (isset($_POST['submit_button']) && !empty($post_title)) {
636 686
 
@@ -680,9 +730,10 @@  discard block
 block discarded – undo
680 730
         if (!$is_allowed_to_edit) {
681 731
             api_not_allowed(true);
682 732
         }
683
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
684
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
685
-        else {
733
+        if ($debug > 0) {
734
+            error_log('New LP - edit item prereq action triggered', 0);
735
+        }
736
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
686 737
             if (isset($_POST['submit_button'])) {
687 738
                 //Updating the lp.modified_on
688 739
                 $_SESSION['oLP']->set_modified_on();
@@ -710,9 +761,10 @@  discard block
 block discarded – undo
710 761
         if (!$is_allowed_to_edit) {
711 762
             api_not_allowed(true);
712 763
         }
713
-        if ($debug > 0) error_log('New LP - move item action triggered', 0);
714
-        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
715
-        else {
764
+        if ($debug > 0) {
765
+            error_log('New LP - move item action triggered', 0);
766
+        }
767
+        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } else {
716 768
             $_SESSION['refresh'] = 1;
717 769
             if (isset($_POST['submit_button'])) {
718 770
                 //Updating the lp.modified_on
@@ -745,7 +797,9 @@  discard block
 block discarded – undo
745 797
         if (!$is_allowed_to_edit) {
746 798
             api_not_allowed(true);
747 799
         }
748
-        if ($debug > 0) error_log('New LP - view_item action triggered', 0);
800
+        if ($debug > 0) {
801
+            error_log('New LP - view_item action triggered', 0);
802
+        }
749 803
         if (!$lp_found) {
750 804
             error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
751 805
         } else {
@@ -757,7 +811,9 @@  discard block
 block discarded – undo
757 811
         if (!$is_allowed_to_edit) {
758 812
             api_not_allowed(true);
759 813
         }
760
-        if ($debug > 0) error_log('New LP - upload action triggered', 0);
814
+        if ($debug > 0) {
815
+            error_log('New LP - upload action triggered', 0);
816
+        }
761 817
         $cwdir = getcwd();
762 818
         require 'lp_upload.php';
763 819
         // Reinit current working directory as many functions in upload change it.
@@ -774,9 +830,10 @@  discard block
 block discarded – undo
774 830
             api_not_allowed(true);
775 831
         }
776 832
 
777
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
778
-        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
779
-        else {
833
+        if ($debug > 0) {
834
+            error_log('New LP - export action triggered', 0);
835
+        }
836
+        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } else {
780 837
             $_SESSION['oLP']->copy();
781 838
         }
782 839
         require 'lp_list.php';
@@ -789,9 +846,10 @@  discard block
 block discarded – undo
789 846
         if ($hideScormExportLink === 'true') {
790 847
             api_not_allowed(true);
791 848
         }
792
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
793
-        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
794
-        else {
849
+        if ($debug > 0) {
850
+            error_log('New LP - export action triggered', 0);
851
+        }
852
+        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } else {
795 853
             $_SESSION['oLP']->scorm_export();
796 854
             exit();
797 855
             //require 'lp_list.php';
@@ -806,7 +864,9 @@  discard block
 block discarded – undo
806 864
             api_not_allowed(true);
807 865
         }
808 866
 
809
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
867
+        if ($debug > 0) {
868
+            error_log('New LP - export action triggered', 0);
869
+        }
810 870
         if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
811 871
         } else {
812 872
             $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
@@ -820,9 +880,10 @@  discard block
 block discarded – undo
820 880
         if (!$is_allowed_to_edit) {
821 881
             api_not_allowed(true);
822 882
         }
823
-        if ($debug > 0) error_log('New LP - delete action triggered', 0);
824
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
825
-        else {
883
+        if ($debug > 0) {
884
+            error_log('New LP - delete action triggered', 0);
885
+        }
886
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } else {
826 887
             $_SESSION['refresh'] = 1;
827 888
             $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
828 889
             Session::erase('oLP');
@@ -834,9 +895,10 @@  discard block
 block discarded – undo
834 895
         if (!$is_allowed_to_edit) {
835 896
             api_not_allowed(true);
836 897
         }
837
-        if ($debug > 0) error_log('New LP - visibility action triggered', 0);
838
-        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
839
-        else {
898
+        if ($debug > 0) {
899
+            error_log('New LP - visibility action triggered', 0);
900
+        }
901
+        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } else {
840 902
             learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
841 903
             require 'lp_list.php';
842 904
         }
@@ -846,9 +908,10 @@  discard block
 block discarded – undo
846 908
         if (!$is_allowed_to_edit) {
847 909
             api_not_allowed(true);
848 910
         }
849
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
850
-        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
851
-        else {
911
+        if ($debug > 0) {
912
+            error_log('New LP - publish action triggered', 0);
913
+        }
914
+        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } else {
852 915
             learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
853 916
             require 'lp_list.php';
854 917
         }
@@ -858,7 +921,9 @@  discard block
 block discarded – undo
858 921
         if (!$is_allowed_to_edit) {
859 922
             api_not_allowed(true);
860 923
         }
861
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
924
+        if ($debug > 0) {
925
+            error_log('New LP - publish action triggered', 0);
926
+        }
862 927
         if (!$lp_found) {
863 928
             error_log('New LP - No learnpath given for publish', 0);
864 929
             require 'lp_list.php';
@@ -872,7 +937,9 @@  discard block
 block discarded – undo
872 937
         if (!$is_allowed_to_edit) {
873 938
             api_not_allowed(true);
874 939
         }
875
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
940
+        if ($debug > 0) {
941
+            error_log('New LP - publish action triggered', 0);
942
+        }
876 943
         if (!$lp_found) {
877 944
             error_log('New LP - No learnpath given for publish', 0);
878 945
             require 'lp_list.php';
@@ -885,9 +952,10 @@  discard block
 block discarded – undo
885 952
         if (!$is_allowed_to_edit) {
886 953
             api_not_allowed(true);
887 954
         }
888
-        if ($debug > 0) error_log('New LP - edit action triggered', 0);
889
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
890
-        else {
955
+        if ($debug > 0) {
956
+            error_log('New LP - edit action triggered', 0);
957
+        }
958
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
891 959
             $_SESSION['refresh'] = 1;
892 960
             require 'lp_edit.php';
893 961
         }
@@ -896,9 +964,10 @@  discard block
 block discarded – undo
896 964
         if (!$is_allowed_to_edit) {
897 965
             api_not_allowed(true);
898 966
         }
899
-        if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
900
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
901
-        else {
967
+        if ($debug > 0) {
968
+            error_log('New LP - update_lp action triggered', 0);
969
+        }
970
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
902 971
             $_SESSION['refresh'] = 1;
903 972
             $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
904 973
             $_SESSION['oLP']->set_name($lp_name);
@@ -965,8 +1034,9 @@  discard block
 block discarded – undo
965 1034
             );
966 1035
             $extraFieldValue->saveFieldValues($_REQUEST);
967 1036
 
968
-            if ($_FILES['lp_preview_image']['size'] > 0)
969
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1037
+            if ($_FILES['lp_preview_image']['size'] > 0) {
1038
+                            $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1039
+            }
970 1040
 
971 1041
             if (api_get_setting('search_enabled') === 'true') {
972 1042
                 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -1006,9 +1076,10 @@  discard block
 block discarded – undo
1006 1076
         if (!$is_allowed_to_edit) {
1007 1077
             api_not_allowed(true);
1008 1078
         }
1009
-        if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1010
-        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1011
-        else {
1079
+        if ($debug > 0) {
1080
+            error_log('New LP - add sub item action triggered', 0);
1081
+        }
1082
+        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } else {
1012 1083
             $_SESSION['refresh'] = 1;
1013 1084
             if (!empty($_REQUEST['parent_item_id'])) {
1014 1085
                 $_SESSION['from_learnpath']='yes';
@@ -1024,9 +1095,10 @@  discard block
 block discarded – undo
1024 1095
         if (!$is_allowed_to_edit) {
1025 1096
             api_not_allowed(true);
1026 1097
         }
1027
-        if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1028
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1029
-        else {
1098
+        if ($debug > 0) {
1099
+            error_log('New LP - delete item action triggered', 0);
1100
+        }
1101
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; } else {
1030 1102
             //$_SESSION['refresh'] = 1;
1031 1103
             if (!empty($_REQUEST['id'])) {
1032 1104
                 $_SESSION['oLP']->delete_item($_REQUEST['id']);
@@ -1041,9 +1113,10 @@  discard block
 block discarded – undo
1041 1113
         if (!$is_allowed_to_edit) {
1042 1114
             api_not_allowed(true);
1043 1115
         }
1044
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1045
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1046
-        else {
1116
+        if ($debug > 0) {
1117
+            error_log('New LP - edit item prereq action triggered', 0);
1118
+        }
1119
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
1047 1120
             if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1048 1121
                 $_SESSION['refresh'] = 1;
1049 1122
                 $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
@@ -1052,64 +1125,80 @@  discard block
 block discarded – undo
1052 1125
         }
1053 1126
         break;
1054 1127
     case 'restart':
1055
-        if ($debug > 0) error_log('New LP - restart action triggered', 0);
1056
-        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1057
-        else {
1128
+        if ($debug > 0) {
1129
+            error_log('New LP - restart action triggered', 0);
1130
+        }
1131
+        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } else {
1058 1132
             $_SESSION['oLP']->restart();
1059 1133
             require 'lp_view.php';
1060 1134
         }
1061 1135
         break;
1062 1136
     case 'last':
1063
-        if ($debug > 0) error_log('New LP - last action triggered', 0);
1064
-        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1065
-        else {
1137
+        if ($debug > 0) {
1138
+            error_log('New LP - last action triggered', 0);
1139
+        }
1140
+        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } else {
1066 1141
             $_SESSION['oLP']->last();
1067 1142
             require 'lp_view.php';
1068 1143
         }
1069 1144
         break;
1070 1145
     case 'first':
1071
-        if ($debug > 0) error_log('New LP - first action triggered', 0);
1072
-        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1073
-        else {
1146
+        if ($debug > 0) {
1147
+            error_log('New LP - first action triggered', 0);
1148
+        }
1149
+        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } else {
1074 1150
             $_SESSION['oLP']->first();
1075 1151
             require 'lp_view.php';
1076 1152
         }
1077 1153
         break;
1078 1154
     case 'next':
1079
-        if ($debug > 0) error_log('New LP - next action triggered', 0);
1080
-        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1081
-        else {
1155
+        if ($debug > 0) {
1156
+            error_log('New LP - next action triggered', 0);
1157
+        }
1158
+        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } else {
1082 1159
             $_SESSION['oLP']->next();
1083 1160
             require 'lp_view.php';
1084 1161
         }
1085 1162
         break;
1086 1163
     case 'previous':
1087
-        if ($debug > 0) error_log('New LP - previous action triggered', 0);
1088
-        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1089
-        else {
1164
+        if ($debug > 0) {
1165
+            error_log('New LP - previous action triggered', 0);
1166
+        }
1167
+        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } else {
1090 1168
             $_SESSION['oLP']->previous();
1091 1169
             require 'lp_view.php';
1092 1170
         }
1093 1171
         break;
1094 1172
     case 'content':
1095
-        if ($debug > 0) error_log('New LP - content action triggered', 0);
1096
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1173
+        if ($debug > 0) {
1174
+            error_log('New LP - content action triggered', 0);
1175
+        }
1176
+        if ($debug > 0) {
1177
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1178
+        }
1097 1179
         if (!$lp_found) {
1098 1180
             error_log('New LP - No learnpath given for content', 0);
1099 1181
             require 'lp_list.php';
1100 1182
         } else {
1101
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1183
+            if ($debug > 0) {
1184
+                error_log('New LP - save_last()', 0);
1185
+            }
1102 1186
             $_SESSION['oLP']->save_last();
1103
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1187
+            if ($debug > 0) {
1188
+                error_log('New LP - set_current_item()', 0);
1189
+            }
1104 1190
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1105
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1191
+            if ($debug > 0) {
1192
+                error_log('New LP - start_current_item()', 0);
1193
+            }
1106 1194
             $_SESSION['oLP']->start_current_item();
1107 1195
             require 'lp_content.php';
1108 1196
         }
1109 1197
         break;
1110 1198
     case 'view':
1111
-        if ($debug > 0)
1112
-            error_log('New LP - view action triggered', 0);
1199
+        if ($debug > 0) {
1200
+                    error_log('New LP - view action triggered', 0);
1201
+        }
1113 1202
         if (!$lp_found) {
1114 1203
             error_log('New LP - No learnpath given for view', 0);
1115 1204
             require 'lp_list.php';
@@ -1122,17 +1211,19 @@  discard block
 block discarded – undo
1122 1211
         }
1123 1212
         break;
1124 1213
     case 'save':
1125
-        if ($debug > 0) error_log('New LP - save action triggered', 0);
1126
-        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1127
-        else {
1214
+        if ($debug > 0) {
1215
+            error_log('New LP - save action triggered', 0);
1216
+        }
1217
+        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } else {
1128 1218
             $_SESSION['oLP']->save_item();
1129 1219
             require 'lp_save.php';
1130 1220
         }
1131 1221
         break;
1132 1222
     case 'stats':
1133
-        if ($debug > 0) error_log('New LP - stats action triggered', 0);
1134
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1135
-        else {
1223
+        if ($debug > 0) {
1224
+            error_log('New LP - stats action triggered', 0);
1225
+        }
1226
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1136 1227
             $_SESSION['oLP']->save_current();
1137 1228
             $_SESSION['oLP']->save_last();
1138 1229
             $output = require 'lp_stats.php';
@@ -1140,7 +1231,9 @@  discard block
 block discarded – undo
1140 1231
         }
1141 1232
         break;
1142 1233
     case 'list':
1143
-        if ($debug > 0) error_log('New LP - list action triggered', 0);
1234
+        if ($debug > 0) {
1235
+            error_log('New LP - list action triggered', 0);
1236
+        }
1144 1237
         if ($lp_found) {
1145 1238
             $_SESSION['refresh'] = 1;
1146 1239
             $_SESSION['oLP']->save_last();
@@ -1149,7 +1242,9 @@  discard block
 block discarded – undo
1149 1242
         break;
1150 1243
     case 'mode':
1151 1244
         // Switch between fullscreen and embedded mode.
1152
-        if ($debug > 0) error_log('New LP - mode change triggered', 0);
1245
+        if ($debug > 0) {
1246
+            error_log('New LP - mode change triggered', 0);
1247
+        }
1153 1248
         $mode = $_REQUEST['mode'];
1154 1249
         if ($mode == 'fullscreen') {
1155 1250
             $_SESSION['oLP']->mode = 'fullscreen';
@@ -1163,7 +1258,9 @@  discard block
 block discarded – undo
1163 1258
         require 'lp_view.php';
1164 1259
         break;
1165 1260
     case 'switch_view_mode':
1166
-        if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1261
+        if ($debug > 0) {
1262
+            error_log('New LP - switch_view_mode action triggered', 0);
1263
+        }
1167 1264
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1168 1265
         if (Security::check_token('get')) {
1169 1266
             $_SESSION['refresh'] = 1;
@@ -1172,7 +1269,9 @@  discard block
 block discarded – undo
1172 1269
         require 'lp_list.php';
1173 1270
         break;
1174 1271
     case 'switch_force_commit':
1175
-        if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1272
+        if ($debug > 0) {
1273
+            error_log('New LP - switch_force_commit action triggered', 0);
1274
+        }
1176 1275
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1177 1276
         $_SESSION['refresh'] = 1;
1178 1277
         $_SESSION['oLP']->update_default_scorm_commit();
@@ -1195,25 +1294,33 @@  discard block
 block discarded – undo
1195 1294
 		break;
1196 1295
      */
1197 1296
 	case 'switch_attempt_mode':
1198
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1297
+		if($debug>0) {
1298
+		    error_log('New LP - switch_reinit action triggered',0);
1299
+		}
1199 1300
 		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1200 1301
 		$_SESSION['refresh'] = 1;
1201 1302
 		$_SESSION['oLP']->switch_attempt_mode();
1202 1303
         require 'lp_list.php';
1203 1304
         break;
1204 1305
     case 'switch_scorm_debug':
1205
-        if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1306
+        if ($debug > 0) {
1307
+            error_log('New LP - switch_scorm_debug action triggered', 0);
1308
+        }
1206 1309
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1207 1310
         $_SESSION['refresh'] = 1;
1208 1311
         $_SESSION['oLP']->update_scorm_debug();
1209 1312
         require 'lp_list.php';
1210 1313
         break;
1211 1314
     case 'intro_cmdAdd':
1212
-        if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1315
+        if ($debug > 0) {
1316
+            error_log('New LP - intro_cmdAdd action triggered', 0);
1317
+        }
1213 1318
         // Add introduction section page.
1214 1319
         break;
1215 1320
     case 'js_api_refresh':
1216
-        if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1321
+        if ($debug > 0) {
1322
+            error_log('New LP - js_api_refresh action triggered', 0);
1323
+        }
1217 1324
         if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1218 1325
         if (isset($_REQUEST['item_id'])) {
1219 1326
             $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
@@ -1221,8 +1328,7 @@  discard block
 block discarded – undo
1221 1328
         require 'lp_message.php';
1222 1329
         break;
1223 1330
     case 'return_to_course_homepage':
1224
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1225
-        else {
1331
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1226 1332
             $_SESSION['oLP']->save_current();
1227 1333
             $_SESSION['oLP']->save_last();
1228 1334
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1240,8 +1346,9 @@  discard block
 block discarded – undo
1240 1346
         require 'lp_list_search.php';
1241 1347
         break;
1242 1348
     case 'impress':
1243
-        if ($debug > 0)
1244
-            error_log('New LP - view action triggered', 0);
1349
+        if ($debug > 0) {
1350
+                    error_log('New LP - view action triggered', 0);
1351
+        }
1245 1352
         if (!$lp_found) {
1246 1353
             error_log('New LP - No learnpath given for view', 0);
1247 1354
             require 'lp_list.php';
@@ -1413,15 +1520,19 @@  discard block
 block discarded – undo
1413 1520
         ]);
1414 1521
         break;
1415 1522
     default:
1416
-        if ($debug > 0) error_log('New LP - default action triggered', 0);
1523
+        if ($debug > 0) {
1524
+            error_log('New LP - default action triggered', 0);
1525
+        }
1417 1526
         require 'lp_list.php';
1418 1527
         break;
1419 1528
 }
1420 1529
 
1421 1530
 if (!empty($_SESSION['oLP'])) {
1422 1531
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1423
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1424
-}
1532
+    if ($debug > 0) {
1533
+        error_log('New LP - lpobject is serialized in session', 0);
1534
+    }
1535
+    }
1425 1536
 
1426 1537
 if (!empty($redirectTo)) {
1427 1538
     header("Location: $redirectTo");
Please login to merge, or discard this patch.
main/newscorm/resourcelinker.inc.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 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';
293
-			}
294
-			if (api_browser_support('ogg')){
295
-				$array_ext[]='ogg';
296
-			}
291
+            if (api_browser_support('svg')){
292
+                $array_ext[]='svg';
293
+            }
294
+            if (api_browser_support('ogg')){
295
+                $array_ext[]='ogg';
296
+            }
297 297
 
298 298
             $in_frames = in_array($ext, $array_ext);
299 299
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
             $result = Database::query($sql);
393 393
             $row = Database::fetch_array($result);
394 394
             if ($row['title'] != '') {
395
-                 $myrow['content'] = $row['title'];
395
+                    $myrow['content'] = $row['title'];
396 396
             }
397 397
             $desc = $row['description'];
398 398
             $ann_id = $row['item_id'];
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); }
470 470
             if ($icon == 'icon') {
471 471
                 if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; }
472
-                   else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; }
472
+                    else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; }
473 473
             }
474 474
             $thelink = $myrow['url'];
475 475
             if ($builder != 'builder') {
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
             $myrow = Database::fetch_array($result);
495 495
 
496 496
             if ($builder == 'builder') { $origin = 'builder'; }
497
-              // This is needed for the exercise_submit.php can delete the session info about tests.
497
+                // This is needed for the exercise_submit.php can delete the session info about tests.
498 498
 
499 499
             $sql = "select * from $tbl_lp_item where id=$id_in_path";
500 500
             $result = Database::query($sql);
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
             $name = GetQuizName($path, $documentPath);
547 547
 
548 548
             if ($builder == 'builder') { $origin='builder'; }
549
-              // This is needed for the exercise_submit.php can delete the session info about tests.
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 552
             $result = Database::query($sql);	$row = Database::fetch_array($result);
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             $myrow = Database::fetch_array($result);
1107 1107
 
1108 1108
             if ($builder == 'builder') { $origin = 'builder'; }
1109
-              // This is needed for the exercise_submit.php can delete the session info about tests.
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 1112
             $result = Database::query($sql);	$row = Database::fetch_array($result);
@@ -1330,10 +1330,10 @@  discard block
 block discarded – undo
1330 1330
  */
1331 1331
 function delete_all_resources_type($type)
1332 1332
 {
1333
-  $course_id = api_get_course_int_id();
1334
-  $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
1335
-  $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
1336
-  Database::query($sql);
1333
+    $course_id = api_get_course_int_id();
1334
+    $TABLERESOURCE = Database::get_course_table(TABLE_LINKED_RESOURCES);
1335
+    $sql = "DELETE FROM $TABLERESOURCE WHERE c_id = $course_id AND source_type='$type'";
1336
+    Database::query($sql);
1337 1337
 }
1338 1338
 
1339 1339
 /**
Please login to merge, or discard this patch.
Braces   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -334,9 +334,14 @@  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') {
338
+        $origin = 'learnpath';
339
+    }
340
+    //origin = learnpath in student view
338 341
     $linktype = $type;
339
-    if (($type == 'Link _self') or ($type == 'Link _blank')) $type = 'Link';
342
+    if (($type == 'Link _self') or ($type == 'Link _blank')) {
343
+        $type = 'Link';
344
+    }
340 345
 
341 346
     // YW switched litteral tool names to use of constants declared in main_api.lib.php
342 347
     switch ($type) {
@@ -356,7 +361,7 @@  discard block
 block discarded – undo
356 361
             if ($icon != 'nolink') {
357 362
                 if ($completed == 'completed') {
358 363
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
359
-                }	else {
364
+                } else {
360 365
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
361 366
                     //echo "&nbsp;";
362 367
                 }
@@ -407,7 +412,7 @@  discard block
 block discarded – undo
407 412
             if ($icon != 'nolink') {
408 413
                 if ($completed == 'completed') {
409 414
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
410
-                }	else {
415
+                } else {
411 416
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
412 417
                     //echo "&nbsp;";
413 418
                 }
@@ -454,7 +459,7 @@  discard block
 block discarded – undo
454 459
             if ($icon != 'nolink') {
455 460
                 if ($completed == 'completed') {
456 461
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
457
-                }	else {
462
+                } else {
458 463
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
459 464
                     //echo "&nbsp;";
460 465
                 }
@@ -468,8 +473,7 @@  discard block
 block discarded – undo
468 473
 
469 474
             if ($icon == 'nolink') { return(shorten($myrow['title'], $length)); }
470 475
             if ($icon == 'icon') {
471
-                if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; }
472
-                   else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; }
476
+                if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; }
473 477
             }
474 478
             $thelink = $myrow['url'];
475 479
             if ($builder != 'builder') {
@@ -558,7 +562,7 @@  discard block
 block discarded – undo
558 562
             if ($icon != 'nolink') {
559 563
                 if ($completed == 'completed') {
560 564
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
561
-                }	else {
565
+                } else {
562 566
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
563 567
                     //echo "&nbsp;";
564 568
                 }
@@ -603,7 +607,7 @@  discard block
 block discarded – undo
603 607
             if ($icon != 'nolink') {
604 608
                 if ($completed == 'completed') {
605 609
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
606
-                }	else {
610
+                } else {
607 611
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
608 612
                     //echo "&nbsp;";
609 613
                 }
@@ -647,7 +651,7 @@  discard block
 block discarded – undo
647 651
             if ($icon != 'nolink') {
648 652
                 if ($completed == 'completed') {
649 653
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
650
-                }	else {
654
+                } else {
651 655
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
652 656
                     //echo "&nbsp;";
653 657
                 }
@@ -698,7 +702,7 @@  discard block
 block discarded – undo
698 702
             if ($icon != 'nolink') {
699 703
                 if ($completed == 'completed') {
700 704
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
701
-                }	else {
705
+                } else {
702 706
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
703 707
                     //echo "&nbsp;";
704 708
                 }
@@ -801,7 +805,7 @@  discard block
 block discarded – undo
801 805
             if ($icon != 'nolink') {
802 806
                 if ($completed == 'completed') {
803 807
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
804
-                }	else {
808
+                } else {
805 809
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
806 810
                     //echo "&nbsp;";
807 811
                 }
@@ -842,7 +846,7 @@  discard block
 block discarded – undo
842 846
             if ($icon != 'nolink') {
843 847
                 if ($completed == 'completed') {
844 848
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
845
-                }	else {
849
+                } else {
846 850
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
847 851
                     //echo "&nbsp;";
848 852
                 }
@@ -858,8 +862,7 @@  discard block
 block discarded – undo
858 862
                 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 863
                 if ($desc != '') {
860 864
                     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>"; }
862
-                    else {
865
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else {
863 866
                         echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
864 867
                 }
865 868
             } else {
@@ -897,8 +900,7 @@  discard block
 block discarded – undo
897 900
                 $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 901
                 if ($desc != '') {
899 902
                     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>"; }
901
-                    else {
903
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else {
902 904
                         echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
903 905
                 }
904 906
             } else {
@@ -920,7 +922,7 @@  discard block
 block discarded – undo
920 922
             if ($icon != 'nolink') {
921 923
                 if ($completed == 'completed') {
922 924
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>";
923
-                }	else {
925
+                } else {
924 926
                     echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>";
925 927
                     //echo "&nbsp;";
926 928
                 }
@@ -936,8 +938,7 @@  discard block
 block discarded – undo
936 938
                 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 939
                 if ($desc != '') {
938 940
                     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>"; }
940
-                    else {
941
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else {
941 942
                         echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
942 943
                 }
943 944
             } else {
@@ -976,8 +977,7 @@  discard block
 block discarded – undo
976 977
                 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 978
                 if ($desc != '') {
978 979
                     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>"; }
980
-                    else {
980
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else {
981 981
                         echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
982 982
                 }
983 983
             } else {
@@ -1015,8 +1015,7 @@  discard block
 block discarded – undo
1015 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>"; }
1019
-                    else {
1018
+                        echo "</tr><tr><td></td><td></td><td><div class='description'>&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div></td></tr>"; } else {
1020 1019
                         echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc, ($length-3*$level))."</div>"; }
1021 1020
                 }
1022 1021
             } else {
@@ -1346,11 +1345,12 @@  discard block
 block discarded – undo
1346 1345
             WHERE c_id = $course_id AND source_type='$type' and source_id='$id'";
1347 1346
     $result = Database::query($sql);
1348 1347
     $number_added = Database::num_rows($result);
1349
-    if ($number_added != 0)
1350
-        return true;
1351
-    else
1352
-        return false;
1353
-}
1348
+    if ($number_added != 0) {
1349
+            return true;
1350
+    } else {
1351
+            return false;
1352
+    }
1353
+    }
1354 1354
 
1355 1355
 /**
1356 1356
  * this function is to load the resources that were added to a specific item
@@ -1459,8 +1459,7 @@  discard block
 block discarded – undo
1459 1459
             next($addedresource);
1460 1460
         }
1461 1461
         echo '</table>';
1462
-    }
1463
-    else { // it is a string
1462
+    } else { // it is a string
1464 1463
         echo '';
1465 1464
     }
1466 1465
 } // end of the display_resources function
@@ -1492,8 +1491,7 @@  discard block
 block discarded – undo
1492 1491
                 echo "<a href='".api_get_self()."?content=".$type."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>";
1493 1492
             }
1494 1493
         }
1495
-    }
1496
-    else { // if it is not an array, it is a string
1494
+    } else { // if it is not an array, it is a string
1497 1495
         if ($_SESSION['addedresource'] !== $type || $_SESSION['addedresourceid'] !== $id) {
1498 1496
             if ($from_learnpath) { $lang_add_it_or_resource = get_lang('AddIt'); } else { $lang_add_it_or_resource = get_lang('AddResource'); }
1499 1497
             echo "<a href='".api_get_self()."?content=".$type."&folder=".$folder."&source_forum=".$_GET['source_forum']."&add=".$id."&source_id=$source_id&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no&target=$target'>".$lang_add_it_or_resource."</a>";
@@ -1519,7 +1517,9 @@  discard block
 block discarded – undo
1519 1517
     $course_id = api_get_course_int_id();
1520 1518
 
1521 1519
     // Styling the link of the added resource
1522
-    if ($style != '') $styling = ' class="'.$style.'"';
1520
+    if ($style != '') {
1521
+        $styling = ' class="'.$style.'"';
1522
+    }
1523 1523
     if ($new_window) { $target = ' target = "_blank" '; } else { $target = ' target = "_self" '; }
1524 1524
 
1525 1525
     $output = '';
Please login to merge, or discard this 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.
main/newscorm/lp_add.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     Course admin section
69 69
     - all the functions not available for students - always available in this case (page only shown to admin)
70 70
 */
71
-if (isset($_SESSION['gradebook'])){
71
+if (isset($_SESSION['gradebook'])) {
72 72
     $gradebook = $_SESSION['gradebook'];
73 73
 }
74 74
 
75
-if (!empty($gradebook) && $gradebook=='view') {
76
-    $interbreadcrumb[]= array (
75
+if (!empty($gradebook) && $gradebook == 'view') {
76
+    $interbreadcrumb[] = array(
77 77
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
78 78
         'name' => get_lang('ToolGradebook')
79 79
     );
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 echo '<div class="actions">';
87 87
 echo '<a href="lp_controller.php?cidReq='.$_course['sysCode'].'">'.
88
-        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
88
+        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
89 89
 echo '</div>';
90 90
 
91 91
 Display::display_normal_message(get_lang('AddLpIntro'), false);
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
 
120 120
 // Start date
121 121
 $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
122
-$form->addElement('html','<div id="start_date_div" style="display:block;">');
122
+$form->addElement('html', '<div id="start_date_div" style="display:block;">');
123 123
 $form->addElement('DatePicker', 'publicated_on', get_lang('PublicationDate'));
124
-$form->addElement('html','</div>');
124
+$form->addElement('html', '</div>');
125 125
 
126 126
 //End date
127 127
 $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
128
-$form->addElement('html','<div id="end_date_div" style="display:none;">');
128
+$form->addElement('html', '<div id="end_date_div" style="display:none;">');
129 129
 $form->addElement('DatePicker', 'expired_on', get_lang('ExpirationDate'));
130
-$form->addElement('html','</div>');
130
+$form->addElement('html', '</div>');
131 131
 
132
-$form->addElement('html','</div>');
132
+$form->addElement('html', '</div>');
133 133
 
134
-$defaults['activate_start_date_check']  = 1;
134
+$defaults['activate_start_date_check'] = 1;
135 135
 
136 136
 $defaults['publicated_on'] = date('Y-m-d 08:00:00');
137
-$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400);
137
+$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400);
138 138
 
139 139
 $form->setDefaults($defaults);
140 140
 $form->addButtonCreate(get_lang('CreateLearningPath'));
Please login to merge, or discard this patch.
main/newscorm/audiorecorder.inc.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@
 block discarded – undo
58 58
 if (!empty($path_to_lzx)) {
59 59
     $recorder_content = sprintf("<object type=\"application/x-shockwave-flash\" data=\"%s\" ".
60 60
             "width='$width' height='$height'>".
61
-             "<param name=\"movie\" value=\"%s\">".
62
-         "<param name=\"quality\" value=\"high\">".
63
-         "<param name=\"scale\" value=\"noscale\">".
64
-         "<param name=\"salign\" value=\"LT\">".
65
-         "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
61
+                "<param name=\"movie\" value=\"%s\">".
62
+            "<param name=\"quality\" value=\"high\">".
63
+            "<param name=\"scale\" value=\"noscale\">".
64
+            "<param name=\"salign\" value=\"LT\">".
65
+            "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
66 66
     if ($audio_recorder_studentview == 'false') {
67 67
         echo '<script type="text/javascript">
68 68
         function show_audiorecorder() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 if ($audio_recorder_studentview == 'false') {
32 32
     $width = 295;
33
-    $height= 90;
33
+    $height = 90;
34 34
     $player = 'recorder2.swf';
35 35
     $server = (api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? 'rtmpt://' : 'rtmp://').api_get_setting('service_visio', 'visio_host').':'.(api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? '80' : api_get_setting('service_visio', 'visio_port')).'/recorder';
36 36
     $post_uri = urlencode($web_path.'conference/audiopost.php?course_code='.api_get_course_id().'&user_id='.api_get_user_id().'&checker='.md5(api_get_course_id().api_get_user_id().gmdate('Ymd').$_configuration['security_key']));
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $player = 'player2.swf';
43 43
     $cp = api_get_course_path();
44 44
     $docs = Database::get_course_table(TABLE_DOCUMENT);
45
-    $select = "SELECT * FROM $docs " .
46
-            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' " .
45
+    $select = "SELECT * FROM $docs ".
46
+            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' ".
47 47
             " ORDER BY path DESC";
48 48
     $res = Database::query($select);
49 49
     if (Database::num_rows($res) > 0) {
Please login to merge, or discard this patch.
main/newscorm/lp_build.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
 // Using the resource linker as a tool for adding resources to the learning path.
37 37
 if ($action=="add" and $type=="learnpathitem") {
38
-     $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
38
+        $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
39 39
 }
40 40
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
41 41
     error_log('New LP - User not authorized in lp_build.php');
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
 $isStudentView  = (int) $_REQUEST['isStudentView'];
31 31
 $learnpath_id   = (int) $_REQUEST['lp_id'];
32
-$submit			= $_POST['submit_button'];
32
+$submit = $_POST['submit_button'];
33 33
 
34 34
 /* MAIN CODE */
35 35
 
36 36
 // Using the resource linker as a tool for adding resources to the learning path.
37
-if ($action=="add" and $type=="learnpathitem") {
37
+if ($action == "add" and $type == "learnpathitem") {
38 38
      $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
39 39
 }
40 40
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 if ($learnpath_id == 0) {
52 52
     $is_new = true;
53 53
 
54
-    $sql        = "SELECT id FROM " . $tbl_lp . " WHERE c_id = $course_id ORDER BY id DESC LIMIT 0, 1";
54
+    $sql        = "SELECT id FROM ".$tbl_lp." WHERE c_id = $course_id ORDER BY id DESC LIMIT 0, 1";
55 55
     $result     = Database::query($sql);
56 56
     $row        = Database::fetch_array($result);
57 57
     $learnpath_id = $row['id'];
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 }
74 74
 
75 75
 if (!empty($gradebook) && $gradebook == 'view') {
76
-    $interbreadcrumb[] = array (
77
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
76
+    $interbreadcrumb[] = array(
77
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
78 78
         'name' => get_lang('ToolGradebook')
79 79
     );
80 80
 }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 $interbreadcrumb[] = array('url' => '#', "name" => $therow['name']);
83 83
 
84 84
 // Theme calls.
85
-$lp_theme_css=$_SESSION['oLP']->get_theme();
85
+$lp_theme_css = $_SESSION['oLP']->get_theme();
86 86
 $show_learn_path = true;
87 87
 Display::display_header('', 'Path');
88 88
 $suredel = trim(get_lang('AreYouSureToDeleteJS'));
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 
133 133
     echo '<ul id="lp_overview" class="thumbnails">';
134 134
 
135
-    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
135
+    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=add_item&type=step&lp_id='.$_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
136 136
 
137 137
 //    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=admin_view&updateaudio=true&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png');
138 138
 
139
-    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
139
+    echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
140 140
 
141 141
     //echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png');
142 142
 
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 
149 149
 function show_block($link, $title, $subtitle, $icon) {
150 150
     $html = '<li class="col-md-4">';
151
-        $html .=  '<div class="thumbnail">';
152
-        $html .=  '<a href="'.$link.'" title="'.$title.'">';
153
-        $html .=  Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
154
-        $html .=  '</a>';
155
-        $html .=  '<div class="caption">';
156
-        $html .=  '<strong>'.$title.'</strong></a> '.$subtitle;
157
-        $html .=  '</div>';
158
-        $html .=  '</div>';
159
-    $html .=  '</li>';
151
+        $html .= '<div class="thumbnail">';
152
+        $html .= '<a href="'.$link.'" title="'.$title.'">';
153
+        $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
154
+        $html .= '</a>';
155
+        $html .= '<div class="caption">';
156
+        $html .= '<strong>'.$title.'</strong></a> '.$subtitle;
157
+        $html .= '</div>';
158
+        $html .= '</div>';
159
+    $html .= '</li>';
160 160
     return $html;
161 161
 }
162 162
 
Please login to merge, or discard this patch.
main/newscorm/aicc_hacp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 //$_user							= $_SESSION['_user'];
56 56
 $file = $_SESSION['file'];
57 57
 $oLP = unserialize($_SESSION['lpobject']);
58
-$oItem =& $oLP->items[$oLP->current];
58
+$oItem = & $oLP->items[$oLP->current];
59 59
 if (!is_object($oItem)) {
60 60
     error_log('New LP - aicc_hacp - Could not load oItem item', 0);
61 61
     exit;
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
     'evaluation' => array(),
70 70
     'student_data' => array(),
71 71
 );
72
-$convert_enc = array('%25','%0D','%0A','%09','%20','%2D','%2F','%3B','%3F','%7B','%7D','%7C','%5C','%5E','%7E','%5B','%5D','%60','%23','%3E','%3C','%22');
73
-$convert_dec = array('%',"\r","\n","\t",' ','-','/',';','?','{','}','|','\\','^','~','[',']','`','#','>','<','"');
72
+$convert_enc = array('%25', '%0D', '%0A', '%09', '%20', '%2D', '%2F', '%3B', '%3F', '%7B', '%7D', '%7C', '%5C', '%5E', '%7E', '%5B', '%5D', '%60', '%23', '%3E', '%3C', '%22');
73
+$convert_dec = array('%', "\r", "\n", "\t", ' ', '-', '/', ';', '?', '{', '}', '|', '\\', '^', '~', '[', ']', '`', '#', '>', '<', '"');
74 74
 $crlf = "\r\n";
75 75
 //$tab = "\t";
76 76
 $tab = "";
Please login to merge, or discard this patch.
main/newscorm/aiccItem.class.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 default:
49 49
                      //if($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function
50 50
                      foreach ($params as $a => $value) {
51
-                         switch ($a) {
51
+                            switch ($a) {
52 52
                             case 'system_id':
53 53
                                 $this->identifier = Database::escape_string(strtolower($value));
54 54
                                 break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                             case 'web_launch':
83 83
                                 $this->parameters = Database::escape_string($value);
84 84
                                 break;
85
-                         }
86
-                     }
85
+                            }
86
+                        }
87 87
 
88 88
                     return true;
89 89
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
         $abs_order++;
118 118
         $i = 1;
119 119
         foreach ($this->sub_items as $id => $dummy) {
120
-            $oSubitem =& $this->sub_items[$id];
120
+            $oSubitem = & $this->sub_items[$id];
121 121
             $oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
122 122
             $i++;
123 123
         }
Please login to merge, or discard this patch.
main/newscorm/lp_subscribe_users.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
     exit;
164 164
 } else {
165 165
     $headers = [get_lang('SubscribeUsersToLp'), get_lang('SubscribeGroupsToLp')];
166
-    $tabs = Display::tabs($headers, [$formUsers->toHtml(),$form->toHtml()]);
166
+    $tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
167 167
     $tpl->assign('tabs', $tabs);
168 168
 }
169 169
 
Please login to merge, or discard this patch.
main/newscorm/learnpathList.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                     ";
106 106
         $res = Database::query($sql);
107 107
         $names = array();
108
-        while ($row = Database::fetch_array($res,'ASSOC')) {
108
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
109 109
             // Use domesticate here instead of Database::escape_string because
110 110
             // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
111 111
             // is done using domesticate()
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         $lessons = array();
237 237
         while ($row = Database::fetch_array($result)) {
238
-            if (api_get_item_visibility($course, 'learnpath', $row['id'],  $session_id)) {
238
+            if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
239 239
                 $lessons[$row['id']] = $row;
240 240
             }
241 241
         }
Please login to merge, or discard this patch.