Passed
Push — 1.10.x ( 1f0c91...36635d )
by Angel Fernando Quiroz
43:44
created
main/dropbox/dropbox_submit.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -267,7 +267,9 @@
 block discarded – undo
267 267
 			   break;
268 268
 			}
269 269
 		}
270
-		if (!$found) die(get_lang('GeneralError').' (code 415)');
270
+		if (!$found) {
271
+		    die(get_lang('GeneralError').' (code 415)');
272
+		}
271 273
 
272 274
         echo '<form method="post" action="index.php">', "\n",
273 275
             '<input type="hidden" name="feedbackid" value="',
Please login to merge, or discard this patch.
main/course_progress/thematic_plan.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,17 +9,19 @@
 block discarded – undo
9 9
 
10 10
 // actions menu
11 11
 $new_thematic_plan_data = array();
12
-if (!empty($thematic_plan_data))
13
-foreach($thematic_plan_data as $thematic_item) {
12
+if (!empty($thematic_plan_data)) {
13
+    foreach($thematic_plan_data as $thematic_item) {
14 14
     $thematic_simple_list[] = $thematic_item['description_type'];
15
+}
15 16
     $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
16 17
 }
17 18
 
18 19
 $new_id = ADD_THEMATIC_PLAN;
19
-if (!empty($thematic_simple_list))
20
-foreach($thematic_simple_list as $item) {
20
+if (!empty($thematic_simple_list)) {
21
+    foreach($thematic_simple_list as $item) {
21 22
     if ($item >= ADD_THEMATIC_PLAN) {
22 23
         $new_id = $item + 1;
24
+}
23 25
         $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
24 26
     }
25 27
 }
Please login to merge, or discard this patch.
main/newscorm/lp_impress.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
         //just showing the src in a iframe ...
82 82
         $html .= '<h2>'.$toc['title'].'</h2>';
83 83
         $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
84
-    }else{
84
+    } else{
85 85
         $html .= "<div class='impress-title'>";
86 86
         $html .= '<h1>'.$toc['title'].'</h1>';
87 87
         $html .= "</div>";
Please login to merge, or discard this patch.
main/newscorm/storageapi.php 1 patch
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
         }
46 46
         break;
47 47
     case "stackgetall":
48
-        if (storage_can_set($_REQUEST['svuser']))
49
-            print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
48
+        if (storage_can_set($_REQUEST['svuser'])) {
49
+                    print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
+        }
50 51
         break;
51 52
     case "getposition":
52 53
         print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
@@ -87,8 +88,7 @@  discard block
 block discarded – undo
87 88
         } else {
88 89
             return $row['sv_value'];
89 90
         }
90
-    }
91
-    else {
91
+    } else {
92 92
         return null;
93 93
     }
94 94
 }
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
     if (Database::num_rows($res) > 0) {
145 145
         $row = Database::fetch_assoc($res);
146 146
         return $row['position'];
147
-    }
148
-    else {
147
+    } else {
149 148
         return null;
150 149
     }
151 150
 }
@@ -198,8 +197,7 @@  discard block
 block discarded – undo
198 197
     if ($resorder && $resinsert) {
199 198
         Database::query("commit");
200 199
         return 1;
201
-    }
202
-    else {
200
+    } else {
203 201
         Database::query("rollback");
204 202
         return 0;
205 203
     }
Please login to merge, or discard this patch.
main/newscorm/lp_controller.php 1 patch
Braces   +225 added lines, -121 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
 
@@ -369,11 +405,15 @@  discard block
 block discarded – undo
369 405
         if (!$is_allowed_to_edit) {
370 406
             api_not_allowed(true);
371 407
         }
372
-        if ($debug > 0) error_log('New LP - add item action triggered', 0);
408
+        if ($debug > 0) {
409
+            error_log('New LP - add item action triggered', 0);
410
+        }
373 411
 
374 412
         if (!$lp_found) {
375 413
             //check if the learnpath ID was defined, otherwise send back to list
376
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
414
+            if ($debug > 0) {
415
+                error_log('New LP - No learnpath given for add item', 0);
416
+            }
377 417
             require 'lp_list.php';
378 418
         } else {
379 419
             $_SESSION['refresh'] = 1;
@@ -447,11 +487,15 @@  discard block
 block discarded – undo
447 487
         if (!$is_allowed_to_edit) {
448 488
             api_not_allowed(true);
449 489
         }
450
-        if ($debug > 0) error_log('New LP - add audio action triggered', 0);
490
+        if ($debug > 0) {
491
+            error_log('New LP - add audio action triggered', 0);
492
+        }
451 493
 
452 494
         if (!$lp_found) {
453 495
             //check if the learnpath ID was defined, otherwise send back to list
454
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
496
+            if ($debug > 0) {
497
+                error_log('New LP - No learnpath given for add audio', 0);
498
+            }
455 499
             require 'lp_list.php';
456 500
         } else {
457 501
             $_SESSION['refresh'] = 1;
@@ -525,7 +569,9 @@  discard block
 block discarded – undo
525 569
         if (!$is_allowed_to_edit) {
526 570
             api_not_allowed(true);
527 571
         }
528
-        if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
572
+        if ($debug > 0) {
573
+            error_log('New LP - add_lp action triggered', 0);
574
+        }
529 575
         if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
530 576
             $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
531 577
             $_SESSION['refresh'] = 1;
@@ -584,9 +630,10 @@  discard block
 block discarded – undo
584 630
         if (!$is_allowed_to_edit) {
585 631
             api_not_allowed(true);
586 632
         }
587
-        if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
588
-        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
589
-        else {
633
+        if ($debug > 0) {
634
+            error_log('New LP - admin_view action triggered', 0);
635
+        }
636
+        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; } else {
590 637
             $_SESSION['refresh'] = 1;
591 638
             require 'lp_admin_view.php';
592 639
         }
@@ -596,9 +643,10 @@  discard block
 block discarded – undo
596 643
             if (!$is_allowed_to_edit) {
597 644
                 api_not_allowed(true);
598 645
             }
599
-            if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
600
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
601
-            else {
646
+            if ($debug > 0) {
647
+                error_log('New LP - auto_launch action triggered', 0);
648
+            }
649
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
602 650
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
603 651
                 require 'lp_list.php';
604 652
                 exit;
@@ -609,10 +657,11 @@  discard block
 block discarded – undo
609 657
         if (!$is_allowed_to_edit) {
610 658
             api_not_allowed(true);
611 659
         }
612
-        if ($debug > 0) error_log('New LP - build action triggered', 0);
660
+        if ($debug > 0) {
661
+            error_log('New LP - build action triggered', 0);
662
+        }
613 663
 
614
-        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
615
-        else {
664
+        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } else {
616 665
             $_SESSION['refresh'] = 1;
617 666
             //require 'lp_build.php';
618 667
             $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
@@ -624,10 +673,11 @@  discard block
 block discarded – undo
624 673
         if (!$is_allowed_to_edit) {
625 674
             api_not_allowed(true);
626 675
         }
627
-        if ($debug > 0) error_log('New LP - edit item action triggered', 0);
676
+        if ($debug > 0) {
677
+            error_log('New LP - edit item action triggered', 0);
678
+        }
628 679
 
629
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
630
-        else {
680
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; } else {
631 681
             $_SESSION['refresh'] = 1;
632 682
             if (isset($_POST['submit_button']) && !empty($post_title)) {
633 683
 
@@ -677,9 +727,10 @@  discard block
 block discarded – undo
677 727
         if (!$is_allowed_to_edit) {
678 728
             api_not_allowed(true);
679 729
         }
680
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
681
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
682
-        else {
730
+        if ($debug > 0) {
731
+            error_log('New LP - edit item prereq action triggered', 0);
732
+        }
733
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
683 734
             if (isset($_POST['submit_button'])) {
684 735
                 //Updating the lp.modified_on
685 736
                 $_SESSION['oLP']->set_modified_on();
@@ -707,9 +758,10 @@  discard block
 block discarded – undo
707 758
         if (!$is_allowed_to_edit) {
708 759
             api_not_allowed(true);
709 760
         }
710
-        if ($debug > 0) error_log('New LP - move item action triggered', 0);
711
-        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
712
-        else {
761
+        if ($debug > 0) {
762
+            error_log('New LP - move item action triggered', 0);
763
+        }
764
+        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } else {
713 765
             $_SESSION['refresh'] = 1;
714 766
             if (isset($_POST['submit_button'])) {
715 767
                 //Updating the lp.modified_on
@@ -742,7 +794,9 @@  discard block
 block discarded – undo
742 794
         if (!$is_allowed_to_edit) {
743 795
             api_not_allowed(true);
744 796
         }
745
-        if ($debug > 0) error_log('New LP - view_item action triggered', 0);
797
+        if ($debug > 0) {
798
+            error_log('New LP - view_item action triggered', 0);
799
+        }
746 800
         if (!$lp_found) {
747 801
             error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
748 802
         } else {
@@ -754,7 +808,9 @@  discard block
 block discarded – undo
754 808
         if (!$is_allowed_to_edit) {
755 809
             api_not_allowed(true);
756 810
         }
757
-        if ($debug > 0) error_log('New LP - upload action triggered', 0);
811
+        if ($debug > 0) {
812
+            error_log('New LP - upload action triggered', 0);
813
+        }
758 814
         $cwdir = getcwd();
759 815
         require 'lp_upload.php';
760 816
         // Reinit current working directory as many functions in upload change it.
@@ -771,9 +827,10 @@  discard block
 block discarded – undo
771 827
             api_not_allowed(true);
772 828
         }
773 829
 
774
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
775
-        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
776
-        else {
830
+        if ($debug > 0) {
831
+            error_log('New LP - export action triggered', 0);
832
+        }
833
+        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } else {
777 834
             $_SESSION['oLP']->copy();
778 835
         }
779 836
         require 'lp_list.php';
@@ -786,9 +843,10 @@  discard block
 block discarded – undo
786 843
         if ($hideScormExportLink === 'true') {
787 844
             api_not_allowed(true);
788 845
         }
789
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
790
-        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
791
-        else {
846
+        if ($debug > 0) {
847
+            error_log('New LP - export action triggered', 0);
848
+        }
849
+        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } else {
792 850
             $_SESSION['oLP']->scorm_export();
793 851
             exit();
794 852
             //require 'lp_list.php';
@@ -803,7 +861,9 @@  discard block
 block discarded – undo
803 861
             api_not_allowed(true);
804 862
         }
805 863
 
806
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
864
+        if ($debug > 0) {
865
+            error_log('New LP - export action triggered', 0);
866
+        }
807 867
         if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
808 868
         } else {
809 869
             $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
@@ -817,9 +877,10 @@  discard block
 block discarded – undo
817 877
         if (!$is_allowed_to_edit) {
818 878
             api_not_allowed(true);
819 879
         }
820
-        if ($debug > 0) error_log('New LP - delete action triggered', 0);
821
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
822
-        else {
880
+        if ($debug > 0) {
881
+            error_log('New LP - delete action triggered', 0);
882
+        }
883
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } else {
823 884
             $_SESSION['refresh'] = 1;
824 885
             $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
825 886
             Session::erase('oLP');
@@ -831,9 +892,10 @@  discard block
 block discarded – undo
831 892
         if (!$is_allowed_to_edit) {
832 893
             api_not_allowed(true);
833 894
         }
834
-        if ($debug > 0) error_log('New LP - visibility action triggered', 0);
835
-        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
836
-        else {
895
+        if ($debug > 0) {
896
+            error_log('New LP - visibility action triggered', 0);
897
+        }
898
+        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } else {
837 899
             learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
838 900
             require 'lp_list.php';
839 901
         }
@@ -843,9 +905,10 @@  discard block
 block discarded – undo
843 905
         if (!$is_allowed_to_edit) {
844 906
             api_not_allowed(true);
845 907
         }
846
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
847
-        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
848
-        else {
908
+        if ($debug > 0) {
909
+            error_log('New LP - publish action triggered', 0);
910
+        }
911
+        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } else {
849 912
             learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
850 913
             require 'lp_list.php';
851 914
         }
@@ -855,7 +918,9 @@  discard block
 block discarded – undo
855 918
         if (!$is_allowed_to_edit) {
856 919
             api_not_allowed(true);
857 920
         }
858
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
921
+        if ($debug > 0) {
922
+            error_log('New LP - publish action triggered', 0);
923
+        }
859 924
         if (!$lp_found) {
860 925
             error_log('New LP - No learnpath given for publish', 0);
861 926
             require 'lp_list.php';
@@ -869,7 +934,9 @@  discard block
 block discarded – undo
869 934
         if (!$is_allowed_to_edit) {
870 935
             api_not_allowed(true);
871 936
         }
872
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
937
+        if ($debug > 0) {
938
+            error_log('New LP - publish action triggered', 0);
939
+        }
873 940
         if (!$lp_found) {
874 941
             error_log('New LP - No learnpath given for publish', 0);
875 942
             require 'lp_list.php';
@@ -882,9 +949,10 @@  discard block
 block discarded – undo
882 949
         if (!$is_allowed_to_edit) {
883 950
             api_not_allowed(true);
884 951
         }
885
-        if ($debug > 0) error_log('New LP - edit action triggered', 0);
886
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
887
-        else {
952
+        if ($debug > 0) {
953
+            error_log('New LP - edit action triggered', 0);
954
+        }
955
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
888 956
             $_SESSION['refresh'] = 1;
889 957
             require 'lp_edit.php';
890 958
         }
@@ -893,9 +961,10 @@  discard block
 block discarded – undo
893 961
         if (!$is_allowed_to_edit) {
894 962
             api_not_allowed(true);
895 963
         }
896
-        if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
897
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
898
-        else {
964
+        if ($debug > 0) {
965
+            error_log('New LP - update_lp action triggered', 0);
966
+        }
967
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
899 968
             $_SESSION['refresh'] = 1;
900 969
             $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
901 970
             $_SESSION['oLP']->set_name($lp_name);
@@ -962,8 +1031,9 @@  discard block
 block discarded – undo
962 1031
             );
963 1032
             $extraFieldValue->saveFieldValues($_REQUEST);
964 1033
 
965
-            if ($_FILES['lp_preview_image']['size'] > 0)
966
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1034
+            if ($_FILES['lp_preview_image']['size'] > 0) {
1035
+                            $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1036
+            }
967 1037
 
968 1038
             if (api_get_setting('search_enabled') === 'true') {
969 1039
                 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -1003,9 +1073,10 @@  discard block
 block discarded – undo
1003 1073
         if (!$is_allowed_to_edit) {
1004 1074
             api_not_allowed(true);
1005 1075
         }
1006
-        if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1007
-        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1008
-        else {
1076
+        if ($debug > 0) {
1077
+            error_log('New LP - add sub item action triggered', 0);
1078
+        }
1079
+        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } else {
1009 1080
             $_SESSION['refresh'] = 1;
1010 1081
             if (!empty($_REQUEST['parent_item_id'])) {
1011 1082
                 $_SESSION['from_learnpath']='yes';
@@ -1021,9 +1092,10 @@  discard block
 block discarded – undo
1021 1092
         if (!$is_allowed_to_edit) {
1022 1093
             api_not_allowed(true);
1023 1094
         }
1024
-        if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1025
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1026
-        else {
1095
+        if ($debug > 0) {
1096
+            error_log('New LP - delete item action triggered', 0);
1097
+        }
1098
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; } else {
1027 1099
             //$_SESSION['refresh'] = 1;
1028 1100
             if (!empty($_REQUEST['id'])) {
1029 1101
                 $_SESSION['oLP']->delete_item($_REQUEST['id']);
@@ -1038,9 +1110,10 @@  discard block
 block discarded – undo
1038 1110
         if (!$is_allowed_to_edit) {
1039 1111
             api_not_allowed(true);
1040 1112
         }
1041
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1042
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1043
-        else {
1113
+        if ($debug > 0) {
1114
+            error_log('New LP - edit item prereq action triggered', 0);
1115
+        }
1116
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
1044 1117
             if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1045 1118
                 $_SESSION['refresh'] = 1;
1046 1119
                 $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
@@ -1049,53 +1122,61 @@  discard block
 block discarded – undo
1049 1122
         }
1050 1123
         break;
1051 1124
     case 'restart':
1052
-        if ($debug > 0) error_log('New LP - restart action triggered', 0);
1053
-        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1054
-        else {
1125
+        if ($debug > 0) {
1126
+            error_log('New LP - restart action triggered', 0);
1127
+        }
1128
+        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } else {
1055 1129
             $_SESSION['oLP']->restart();
1056 1130
             require 'lp_view.php';
1057 1131
         }
1058 1132
         break;
1059 1133
     case 'last':
1060
-        if ($debug > 0) error_log('New LP - last action triggered', 0);
1061
-        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1062
-        else {
1134
+        if ($debug > 0) {
1135
+            error_log('New LP - last action triggered', 0);
1136
+        }
1137
+        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } else {
1063 1138
             $_SESSION['oLP']->last();
1064 1139
             require 'lp_view.php';
1065 1140
         }
1066 1141
         break;
1067 1142
     case 'first':
1068
-        if ($debug > 0) error_log('New LP - first action triggered', 0);
1069
-        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1070
-        else {
1143
+        if ($debug > 0) {
1144
+            error_log('New LP - first action triggered', 0);
1145
+        }
1146
+        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } else {
1071 1147
             $_SESSION['oLP']->first();
1072 1148
             require 'lp_view.php';
1073 1149
         }
1074 1150
         break;
1075 1151
     case 'next':
1076
-        if ($debug > 0) error_log('New LP - next action triggered', 0);
1077
-        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1078
-        else {
1152
+        if ($debug > 0) {
1153
+            error_log('New LP - next action triggered', 0);
1154
+        }
1155
+        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } else {
1079 1156
             $_SESSION['oLP']->next();
1080 1157
             require 'lp_view.php';
1081 1158
         }
1082 1159
         break;
1083 1160
     case 'previous':
1084
-        if ($debug > 0) error_log('New LP - previous action triggered', 0);
1085
-        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1086
-        else {
1161
+        if ($debug > 0) {
1162
+            error_log('New LP - previous action triggered', 0);
1163
+        }
1164
+        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } else {
1087 1165
             $_SESSION['oLP']->previous();
1088 1166
             require 'lp_view.php';
1089 1167
         }
1090 1168
         break;
1091 1169
     case 'content':
1092
-        if ($debug > 0) error_log('New LP - content action triggered', 0);
1093
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1170
+        if ($debug > 0) {
1171
+            error_log('New LP - content action triggered', 0);
1172
+        }
1173
+        if ($debug > 0) {
1174
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1175
+        }
1094 1176
         if (!$lp_found) {
1095 1177
             error_log('New LP - No learnpath given for content', 0);
1096 1178
             require 'lp_list.php';
1097
-        }
1098
-        else {
1179
+        } else {
1099 1180
             $_SESSION['oLP']->save_last();
1100 1181
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1101 1182
             $_SESSION['oLP']->start_current_item();
@@ -1103,8 +1184,9 @@  discard block
 block discarded – undo
1103 1184
         }
1104 1185
         break;
1105 1186
     case 'view':
1106
-        if ($debug > 0)
1107
-            error_log('New LP - view action triggered', 0);
1187
+        if ($debug > 0) {
1188
+                    error_log('New LP - view action triggered', 0);
1189
+        }
1108 1190
         if (!$lp_found) {
1109 1191
             error_log('New LP - No learnpath given for view', 0);
1110 1192
             require 'lp_list.php';
@@ -1117,17 +1199,19 @@  discard block
 block discarded – undo
1117 1199
         }
1118 1200
         break;
1119 1201
     case 'save':
1120
-        if ($debug > 0) error_log('New LP - save action triggered', 0);
1121
-        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1122
-        else {
1202
+        if ($debug > 0) {
1203
+            error_log('New LP - save action triggered', 0);
1204
+        }
1205
+        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } else {
1123 1206
             $_SESSION['oLP']->save_item();
1124 1207
             require 'lp_save.php';
1125 1208
         }
1126 1209
         break;
1127 1210
     case 'stats':
1128
-        if ($debug > 0) error_log('New LP - stats action triggered', 0);
1129
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1130
-        else {
1211
+        if ($debug > 0) {
1212
+            error_log('New LP - stats action triggered', 0);
1213
+        }
1214
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1131 1215
             $_SESSION['oLP']->save_current();
1132 1216
             $_SESSION['oLP']->save_last();
1133 1217
             $output = require 'lp_stats.php';
@@ -1135,7 +1219,9 @@  discard block
 block discarded – undo
1135 1219
         }
1136 1220
         break;
1137 1221
     case 'list':
1138
-        if ($debug > 0) error_log('New LP - list action triggered', 0);
1222
+        if ($debug > 0) {
1223
+            error_log('New LP - list action triggered', 0);
1224
+        }
1139 1225
         if ($lp_found) {
1140 1226
             $_SESSION['refresh'] = 1;
1141 1227
             $_SESSION['oLP']->save_last();
@@ -1144,7 +1230,9 @@  discard block
 block discarded – undo
1144 1230
         break;
1145 1231
     case 'mode':
1146 1232
         // Switch between fullscreen and embedded mode.
1147
-        if ($debug > 0) error_log('New LP - mode change triggered', 0);
1233
+        if ($debug > 0) {
1234
+            error_log('New LP - mode change triggered', 0);
1235
+        }
1148 1236
         $mode = $_REQUEST['mode'];
1149 1237
         if ($mode == 'fullscreen') {
1150 1238
             $_SESSION['oLP']->mode = 'fullscreen';
@@ -1158,7 +1246,9 @@  discard block
 block discarded – undo
1158 1246
         require 'lp_view.php';
1159 1247
         break;
1160 1248
     case 'switch_view_mode':
1161
-        if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1249
+        if ($debug > 0) {
1250
+            error_log('New LP - switch_view_mode action triggered', 0);
1251
+        }
1162 1252
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1163 1253
         if (Security::check_token('get')) {
1164 1254
             $_SESSION['refresh'] = 1;
@@ -1167,7 +1257,9 @@  discard block
 block discarded – undo
1167 1257
         require 'lp_list.php';
1168 1258
         break;
1169 1259
     case 'switch_force_commit':
1170
-        if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1260
+        if ($debug > 0) {
1261
+            error_log('New LP - switch_force_commit action triggered', 0);
1262
+        }
1171 1263
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1172 1264
         $_SESSION['refresh'] = 1;
1173 1265
         $_SESSION['oLP']->update_default_scorm_commit();
@@ -1190,25 +1282,33 @@  discard block
 block discarded – undo
1190 1282
 		break;
1191 1283
      */
1192 1284
 	case 'switch_attempt_mode':
1193
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1285
+		if($debug>0) {
1286
+		    error_log('New LP - switch_reinit action triggered',0);
1287
+		}
1194 1288
 		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195 1289
 		$_SESSION['refresh'] = 1;
1196 1290
 		$_SESSION['oLP']->switch_attempt_mode();
1197 1291
         require 'lp_list.php';
1198 1292
         break;
1199 1293
     case 'switch_scorm_debug':
1200
-        if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1294
+        if ($debug > 0) {
1295
+            error_log('New LP - switch_scorm_debug action triggered', 0);
1296
+        }
1201 1297
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1202 1298
         $_SESSION['refresh'] = 1;
1203 1299
         $_SESSION['oLP']->update_scorm_debug();
1204 1300
         require 'lp_list.php';
1205 1301
         break;
1206 1302
     case 'intro_cmdAdd':
1207
-        if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1303
+        if ($debug > 0) {
1304
+            error_log('New LP - intro_cmdAdd action triggered', 0);
1305
+        }
1208 1306
         // Add introduction section page.
1209 1307
         break;
1210 1308
     case 'js_api_refresh':
1211
-        if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1309
+        if ($debug > 0) {
1310
+            error_log('New LP - js_api_refresh action triggered', 0);
1311
+        }
1212 1312
         if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1213 1313
         if (isset($_REQUEST['item_id'])) {
1214 1314
             $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
@@ -1216,8 +1316,7 @@  discard block
 block discarded – undo
1216 1316
         require 'lp_message.php';
1217 1317
         break;
1218 1318
     case 'return_to_course_homepage':
1219
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1220
-        else {
1319
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1221 1320
             $_SESSION['oLP']->save_current();
1222 1321
             $_SESSION['oLP']->save_last();
1223 1322
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1235,8 +1334,9 @@  discard block
 block discarded – undo
1235 1334
         require 'lp_list_search.php';
1236 1335
         break;
1237 1336
     case 'impress':
1238
-        if ($debug > 0)
1239
-            error_log('New LP - view action triggered', 0);
1337
+        if ($debug > 0) {
1338
+                    error_log('New LP - view action triggered', 0);
1339
+        }
1240 1340
         if (!$lp_found) {
1241 1341
             error_log('New LP - No learnpath given for view', 0);
1242 1342
             require 'lp_list.php';
@@ -1386,12 +1486,16 @@  discard block
 block discarded – undo
1386 1486
         ]));
1387 1487
         break;
1388 1488
     default:
1389
-        if ($debug > 0) error_log('New LP - default action triggered', 0);
1489
+        if ($debug > 0) {
1490
+            error_log('New LP - default action triggered', 0);
1491
+        }
1390 1492
         require 'lp_list.php';
1391 1493
         break;
1392 1494
 }
1393 1495
 
1394 1496
 if (!empty($_SESSION['oLP'])) {
1395 1497
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1396
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1397
-}
1498
+    if ($debug > 0) {
1499
+        error_log('New LP - lpobject is serialized in session', 0);
1500
+    }
1501
+    }
Please login to merge, or discard this patch.
main/newscorm/resourcelinker.inc.php 1 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.
main/newscorm/learnpath.class.php 1 patch
Braces   +167 added lines, -117 removed lines patch added patch discarded remove patch
@@ -3935,8 +3935,9 @@  discard block
 block discarded – undo
3935 3935
                 WHERE c_id = ".$course_id."
3936 3936
                 ORDER BY display_order";
3937 3937
         $res = Database::query($sql);
3938
-        if ($res === false)
3939
-            return false;
3938
+        if ($res === false) {
3939
+                    return false;
3940
+        }
3940 3941
         $lps = array ();
3941 3942
         $lp_order = array ();
3942 3943
         $num = Database :: num_rows($res);
@@ -4536,8 +4537,9 @@  discard block
 block discarded – undo
4536 4537
         if ($this->debug > 0) {
4537 4538
             error_log('New LP - In learnpath::set_maker()', 0);
4538 4539
         }
4539
-        if (empty ($name))
4540
-            return false;
4540
+        if (empty ($name)) {
4541
+                    return false;
4542
+        }
4541 4543
         $this->maker = $name;
4542 4544
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4543 4545
         $course_id = api_get_course_int_id();
@@ -4602,8 +4604,9 @@  discard block
 block discarded – undo
4602 4604
     public function set_terms_by_prefix($terms_string, $prefix)
4603 4605
     {
4604 4606
         $course_id = api_get_course_int_id();
4605
-        if (api_get_setting('search_enabled') !== 'true')
4606
-            return false;
4607
+        if (api_get_setting('search_enabled') !== 'true') {
4608
+                    return false;
4609
+        }
4607 4610
 
4608 4611
         if (!extension_loaded('xapian')) {
4609 4612
             return false;
@@ -4616,8 +4619,9 @@  discard block
 block discarded – undo
4616 4619
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4617 4620
 
4618 4621
         // Don't do anything if no change, verify only at DB, not the search engine.
4619
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4620
-            return false;
4622
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4623
+                    return false;
4624
+        }
4621 4625
 
4622 4626
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4623 4627
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4809,8 +4813,9 @@  discard block
 block discarded – undo
4809 4813
         if ($this->debug > 0) {
4810 4814
             error_log('New LP - In learnpath::set_proximity()', 0);
4811 4815
         }
4812
-        if (empty ($name))
4813
-            return false;
4816
+        if (empty ($name)) {
4817
+                    return false;
4818
+        }
4814 4819
 
4815 4820
         $this->proximity = $name;
4816 4821
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5152,8 +5157,9 @@  discard block
 block discarded – undo
5152 5157
 
5153 5158
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5154 5159
         $res = Database::query($sql);
5155
-        if ($res === false)
5156
-            return false;
5160
+        if ($res === false) {
5161
+                    return false;
5162
+        }
5157 5163
 
5158 5164
         $num = Database :: num_rows($res);
5159 5165
         // First check the order is correct, globally (might be wrong because
@@ -5464,8 +5470,9 @@  discard block
 block discarded – undo
5464 5470
             $position[$key] = $row['display_order'];
5465 5471
         }
5466 5472
 
5467
-        if (count($array) > 0)
5468
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5473
+        if (count($array) > 0) {
5474
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5475
+        }
5469 5476
 
5470 5477
         return $array;
5471 5478
     }
@@ -6021,8 +6028,9 @@  discard block
 block discarded – undo
6021 6028
         $tmp_filename = $filename;
6022 6029
 
6023 6030
         $i = 0;
6024
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6025
-            $tmp_filename = $filename . '_' . ++ $i;
6031
+        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6032
+                    $tmp_filename = $filename . '_' . ++ $i;
6033
+        }
6026 6034
 
6027 6035
         $filename = $tmp_filename . '.'.$extension;
6028 6036
         if ($extension == 'html') {
@@ -6095,10 +6103,12 @@  discard block
 block discarded – undo
6095 6103
                     if ($new_comment || $new_title) {
6096 6104
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6097 6105
                         $ct = '';
6098
-                        if ($new_comment)
6099
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6100
-                        if ($new_title)
6101
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6106
+                        if ($new_comment) {
6107
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6108
+                        }
6109
+                        if ($new_title) {
6110
+                                                    $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6111
+                        }
6102 6112
 
6103 6113
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6104 6114
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6122,17 +6132,21 @@  discard block
 block discarded – undo
6122 6132
         // Please, do not modify this dirname formatting.
6123 6133
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6124 6134
 
6125
-        if (strstr($dir, '..'))
6126
-            $dir = '/';
6135
+        if (strstr($dir, '..')) {
6136
+                    $dir = '/';
6137
+        }
6127 6138
 
6128
-        if ($dir[0] == '.')
6129
-            $dir = substr($dir, 1);
6139
+        if ($dir[0] == '.') {
6140
+                    $dir = substr($dir, 1);
6141
+        }
6130 6142
 
6131
-        if ($dir[0] != '/')
6132
-            $dir = '/' . $dir;
6143
+        if ($dir[0] != '/') {
6144
+                    $dir = '/' . $dir;
6145
+        }
6133 6146
 
6134
-        if ($dir[strlen($dir) - 1] != '/')
6135
-            $dir .= '/';
6147
+        if ($dir[strlen($dir) - 1] != '/') {
6148
+                    $dir .= '/';
6149
+        }
6136 6150
 
6137 6151
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6138 6152
 
@@ -6198,8 +6212,9 @@  discard block
 block discarded – undo
6198 6212
                 }
6199 6213
                 $return .= '<div style="padding:10px;">';
6200 6214
 
6201
-                if ($msg != '')
6202
-                    $return .= $msg;
6215
+                if ($msg != '') {
6216
+                                    $return .= $msg;
6217
+                }
6203 6218
 
6204 6219
                 $return .= '<h3>'.$row['title'].'</h3>';
6205 6220
                 switch ($row['item_type']) {
@@ -6446,10 +6461,11 @@  discard block
 block discarded – undo
6446 6461
         $item_description 	= Security::remove_XSS($item_description);
6447 6462
 
6448 6463
         $legend = '<legend>';
6449
-        if ($id != 0 && is_array($extra_info))
6450
-            $parent = $extra_info['parent_item_id'];
6451
-        else
6452
-            $parent = 0;
6464
+        if ($id != 0 && is_array($extra_info)) {
6465
+                    $parent = $extra_info['parent_item_id'];
6466
+        } else {
6467
+                    $parent = 0;
6468
+        }
6453 6469
 
6454 6470
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6455 6471
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6527,8 +6543,9 @@  discard block
 block discarded – undo
6527 6543
                     $arrHide[] = $arrLP[$i]['id'];
6528 6544
                 }
6529 6545
             } else {
6530
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6531
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6546
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6547
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6548
+                }
6532 6549
             }
6533 6550
         }
6534 6551
         if (is_array($arrLP)) {
@@ -6717,11 +6734,13 @@  discard block
 block discarded – undo
6717 6734
         }
6718 6735
 
6719 6736
         $legend = '<legend>';
6720
-        if ($action == 'add')
6721
-            $legend .= get_lang('CreateTheExercise');
6722
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6723
-        else
6724
-            $legend .= get_lang('EditCurrentExecice');
6737
+        if ($action == 'add') {
6738
+                    $legend .= get_lang('CreateTheExercise');
6739
+        } elseif ($action == 'move') {
6740
+            $legend .= get_lang('MoveTheCurrentExercise');
6741
+        } else {
6742
+                    $legend .= get_lang('EditCurrentExecice');
6743
+        }
6725 6744
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6726 6745
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6727 6746
         }
@@ -6748,8 +6767,9 @@  discard block
 block discarded – undo
6748 6767
                         $arrHide[] = $arrLP[$i]['id'];
6749 6768
                     }
6750 6769
                 } else {
6751
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6752
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6770
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6771
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6772
+                    }
6753 6773
                 }
6754 6774
             }
6755 6775
 
@@ -6767,11 +6787,13 @@  discard block
 block discarded – undo
6767 6787
 
6768 6788
         for ($i = 0; $i < count($arrLP); $i++) {
6769 6789
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6770
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6790
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6791
+                                    $selected = 'selected="selected" ';
6792
+                } elseif ($action == 'add') {
6771 6793
                     $selected = 'selected="selected" ';
6772
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6773
-                else
6774
-                    $selected = '';
6794
+                } else {
6795
+                                    $selected = '';
6796
+                }
6775 6797
 
6776 6798
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6777 6799
             }
@@ -6798,9 +6820,11 @@  discard block
 block discarded – undo
6798 6820
                 $arrHide = array ();
6799 6821
                 for ($i = 0; $i < count($arrLP); $i++) {
6800 6822
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6801
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6802
-                            $s_selected_position = $arrLP[$i]['id'];
6803
-                        elseif ($action == 'add') $s_selected_position = 0;
6823
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6824
+                                                    $s_selected_position = $arrLP[$i]['id'];
6825
+                        } elseif ($action == 'add') {
6826
+                            $s_selected_position = 0;
6827
+                        }
6804 6828
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6805 6829
 
6806 6830
                     }
@@ -6897,11 +6921,13 @@  discard block
 block discarded – undo
6897 6921
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6898 6922
         unset($this->arrMenu);
6899 6923
 
6900
-        if ($action == 'add')
6901
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6902
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6903
-        else
6904
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6924
+        if ($action == 'add') {
6925
+                    $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6926
+        } elseif ($action == 'move') {
6927
+            $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6928
+        } else {
6929
+                    $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6930
+        }
6905 6931
 
6906 6932
         $legend .= '</legend>';
6907 6933
         $return = '<div class="sectioncomment">';
@@ -6934,8 +6960,9 @@  discard block
 block discarded – undo
6934 6960
                     $arrHide[] = $arrLP[$i]['id'];
6935 6961
                 }
6936 6962
             } else {
6937
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6938
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6963
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6964
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6965
+                }
6939 6966
             }
6940 6967
         }
6941 6968
         if (is_array($arrLP)) {
@@ -6953,11 +6980,13 @@  discard block
 block discarded – undo
6953 6980
 
6954 6981
         for ($i = 0; $i < count($arrLP); $i++) {
6955 6982
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6956
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6983
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6984
+                                    $selected = 'selected="selected" ';
6985
+                } elseif ($action == 'add') {
6957 6986
                     $selected = 'selected="selected" ';
6958
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6959
-                else
6960
-                    $selected = '';
6987
+                } else {
6988
+                                    $selected = '';
6989
+                }
6961 6990
 
6962 6991
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6963 6992
                     get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
@@ -6983,9 +7012,11 @@  discard block
 block discarded – undo
6983 7012
             $arrHide = array();
6984 7013
             for ($i = 0; $i < count($arrLP); $i++) {
6985 7014
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6986
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6987
-                        $s_selected_position = $arrLP[$i]['id'];
6988
-                    elseif ($action == 'add') $s_selected_position = 0;
7015
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7016
+                                            $s_selected_position = $arrLP[$i]['id'];
7017
+                    } elseif ($action == 'add') {
7018
+                        $s_selected_position = 0;
7019
+                    }
6989 7020
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6990 7021
                 }
6991 7022
             }
@@ -7089,11 +7120,13 @@  discard block
 block discarded – undo
7089 7120
         unset ($this->arrMenu);
7090 7121
 
7091 7122
         $return .= '<form method="POST">';
7092
-        if ($action == 'add')
7093
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7094
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7095
-        else
7096
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7123
+        if ($action == 'add') {
7124
+                    $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7125
+        } elseif ($action == 'move') {
7126
+            $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7127
+        } else {
7128
+                    $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7129
+        }
7097 7130
 
7098 7131
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7099 7132
         $return .= '<tr>';
@@ -7113,8 +7146,9 @@  discard block
 block discarded – undo
7113 7146
                     $arrHide[] = $arrLP[$i]['id'];
7114 7147
                 }
7115 7148
             } else {
7116
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7117
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7149
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7150
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7151
+                }
7118 7152
             }
7119 7153
         }
7120 7154
 
@@ -7132,11 +7166,13 @@  discard block
 block discarded – undo
7132 7166
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7133 7167
         for ($i = 0; $i < count($arrLP); $i++) {
7134 7168
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7135
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7170
+                                    $selected = 'selected="selected" ';
7171
+                } elseif ($action == 'add') {
7136 7172
                     $selected = 'selected="selected" ';
7137
-                elseif ($action == 'add') $selected = 'selected="selected" ';
7138
-                else
7139
-                    $selected = '';
7173
+                } else {
7174
+                                    $selected = '';
7175
+                }
7140 7176
 
7141 7177
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7142 7178
             }
@@ -7165,9 +7201,11 @@  discard block
 block discarded – undo
7165 7201
             $arrHide = array();
7166 7202
             for ($i = 0; $i < count($arrLP); $i++) {
7167 7203
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7168
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7169
-                        $s_selected_position = $arrLP[$i]['id'];
7170
-                    elseif ($action == 'add') $s_selected_position = 0;
7204
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7205
+                                            $s_selected_position = $arrLP[$i]['id'];
7206
+                    } elseif ($action == 'add') {
7207
+                        $s_selected_position = 0;
7208
+                    }
7171 7209
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7172 7210
 
7173 7211
                 }
@@ -7180,8 +7218,7 @@  discard block
 block discarded – undo
7180 7218
             foreach ($arrHide as $key => $value) {
7181 7219
                 if ($key == $s_selected_position && $action == 'add') {
7182 7220
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7183
-                }
7184
-                elseif ($key == $id_prerequisite && $action == 'edit') {
7221
+                } elseif ($key == $id_prerequisite && $action == 'edit') {
7185 7222
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7186 7223
                 } else {
7187 7224
                     $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
@@ -7204,8 +7241,7 @@  discard block
 block discarded – undo
7204 7241
 
7205 7242
         if (is_numeric($extra_info)) {
7206 7243
             $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7207
-        }
7208
-        elseif (is_array($extra_info)) {
7244
+        } elseif (is_array($extra_info)) {
7209 7245
             $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7210 7246
         }
7211 7247
 
@@ -7259,8 +7295,9 @@  discard block
 block discarded – undo
7259 7295
                     lp_id = " . $this->lp_id . " AND
7260 7296
                     id != $id";
7261 7297
 
7262
-        if ($item_type == 'module')
7263
-            $sql .= " AND parent_item_id = 0";
7298
+        if ($item_type == 'module') {
7299
+                    $sql .= " AND parent_item_id = 0";
7300
+        }
7264 7301
 
7265 7302
         $result = Database::query($sql);
7266 7303
         $arrLP = array ();
@@ -7610,9 +7647,11 @@  discard block
 block discarded – undo
7610 7647
         //POSITION
7611 7648
         for ($i = 0; $i < count($arrLP); $i++) {
7612 7649
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7613
-                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7650
+                if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7651
+                                    $s_selected_position = $arrLP[$i]['id'];
7652
+                } elseif ($action == 'add') {
7614 7653
                     $s_selected_position = $arrLP[$i]['id'];
7615
-                elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7654
+                }
7616 7655
                 $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7617 7656
             }
7618 7657
         }
@@ -7645,9 +7684,11 @@  discard block
 block discarded – undo
7645 7684
 
7646 7685
             for ($i = 0; $i < count($arrLP); $i++) {
7647 7686
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7648
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7687
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7688
+                                            $s_selected_position = $arrLP[$i]['id'];
7689
+                    } elseif ($action == 'add') {
7649 7690
                         $s_selected_position = $arrLP[$i]['id'];
7650
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7691
+                    }
7651 7692
 
7652 7693
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7653 7694
 
@@ -7658,17 +7699,18 @@  discard block
 block discarded – undo
7658 7699
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7659 7700
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7660 7701
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $edit == 'true')) {
7661
-                    if (isset ($_POST['content']))
7662
-                        $content = stripslashes($_POST['content']);
7663
-                    elseif (is_array($extra_info)) {
7702
+                    if (isset ($_POST['content'])) {
7703
+                                            $content = stripslashes($_POST['content']);
7704
+                    } elseif (is_array($extra_info)) {
7664 7705
                         //If it's an html document or a text file
7665 7706
                         if (!$no_display_edit_textarea) {
7666 7707
                             $content = $this->display_document($extra_info['path'], false, false);
7667 7708
                         }
7668
-                    } elseif (is_numeric($extra_info))
7669
-                        $content = $this->display_document($extra_info, false, false);
7670
-                    else
7671
-                        $content = '';
7709
+                    } elseif (is_numeric($extra_info)) {
7710
+                                            $content = $this->display_document($extra_info, false, false);
7711
+                    } else {
7712
+                                            $content = '';
7713
+                    }
7672 7714
 
7673 7715
                     if (!$no_display_edit_textarea) {
7674 7716
                         // We need to calculate here some specific settings for the online editor.
@@ -7822,11 +7864,13 @@  discard block
 block discarded – undo
7822 7864
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7823 7865
         unset ($this->arrMenu);
7824 7866
 
7825
-        if ($action == 'add')
7826
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7827
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7828
-        else
7829
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7867
+        if ($action == 'add') {
7868
+                    $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7869
+        } elseif ($action == 'move') {
7870
+            $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7871
+        } else {
7872
+                    $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7873
+        }
7830 7874
 
7831 7875
         $legend .= '</legend>';
7832 7876
 
@@ -7861,8 +7905,9 @@  discard block
 block discarded – undo
7861 7905
                     $arrHide[] = $arrLP[$i]['id'];
7862 7906
                 }
7863 7907
             } else {
7864
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7865
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7908
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7909
+                                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7910
+                }
7866 7911
             }
7867 7912
         }
7868 7913
 
@@ -7881,12 +7926,13 @@  discard block
 block discarded – undo
7881 7926
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7882 7927
         for ($i = 0; $i < count($arrLP); $i++) {
7883 7928
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7884
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7885
-                    $selected = 'selected="selected" ';
7886
-                elseif ($action == 'add')
7887
-                    $selected = 'selected="selected" ';
7888
-                else
7889
-                    $selected = '';
7929
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7930
+                                    $selected = 'selected="selected" ';
7931
+                } elseif ($action == 'add') {
7932
+                                    $selected = 'selected="selected" ';
7933
+                } else {
7934
+                                    $selected = '';
7935
+                }
7890 7936
 
7891 7937
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7892 7938
             }
@@ -7913,9 +7959,11 @@  discard block
 block discarded – undo
7913 7959
             $arrHide = array();
7914 7960
             for ($i = 0; $i < count($arrLP); $i++) {
7915 7961
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7916
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7917
-                        $s_selected_position = $arrLP[$i]['id'];
7918
-                    elseif ($action == 'add') $s_selected_position = 0;
7962
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7963
+                                            $s_selected_position = $arrLP[$i]['id'];
7964
+                    } elseif ($action == 'add') {
7965
+                        $s_selected_position = 0;
7966
+                    }
7919 7967
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7920 7968
 
7921 7969
                 }
@@ -8122,9 +8170,11 @@  discard block
 block discarded – undo
8122 8170
             $arrHide = array ();
8123 8171
             for ($i = 0; $i < count($arrLP); $i++) {
8124 8172
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8125
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8126
-                        $s_selected_position = $arrLP[$i]['id'];
8127
-                    elseif ($action == 'add') $s_selected_position = 0;
8173
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8174
+                                            $s_selected_position = $arrLP[$i]['id'];
8175
+                    } elseif ($action == 'add') {
8176
+                        $s_selected_position = 0;
8177
+                    }
8128 8178
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8129 8179
 
8130 8180
                 }
@@ -9683,9 +9733,9 @@  discard block
 block discarded – undo
9683 9733
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9684 9734
         $extra_files = scandir($main_code_path);
9685 9735
         foreach ($extra_files as $extra_file) {
9686
-            if (strpos($extra_file, '.') === 0)
9687
-                continue;
9688
-            else {
9736
+            if (strpos($extra_file, '.') === 0) {
9737
+                            continue;
9738
+            } else {
9689 9739
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9690 9740
                 $this->create_path($dest_file);
9691 9741
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.
main/newscorm/openoffice_text_document.class.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,8 +119,9 @@
 block discarded – undo
119 119
 
120 120
         for ($i = 0; $i<count($matches[0]); $i++) {
121 121
 
122
-            if (empty($matches[1][$i]))
123
-                continue;
122
+            if (empty($matches[1][$i])) {
123
+                            continue;
124
+            }
124 125
 
125 126
             $content = api_strstr($content, $matches[0][$i]);
126 127
             if ($i + 1 !== count($matches[0])) {
Please login to merge, or discard this patch.
main/newscorm/resourcelinker.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,7 @@
 block discarded – undo
341 341
         case '1': // coming from Agenda
342 342
             if ($action == 'edit') {
343 343
                 $url = "../calendar/agenda.php?action=edit&id=49&originalresource=$originalresource";
344
-            }
345
-            elseif ($action == 'add') {
344
+            } elseif ($action == 'add') {
346 345
                 $url = "../calendar/agenda.php?action=add&originalresource=$originalresource";
347 346
             } else {
348 347
                 $url = "../calendar/agenda.php?action=add";
Please login to merge, or discard this patch.