Completed
Push — 1.10.x ( 812a9a...914b0e )
by Angel Fernando Quiroz
43:28
created
main/newscorm/lp_impress.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     api_get_group_id()
37 37
 );
38 38
 if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
39
-     api_not_allowed();
39
+        api_not_allowed();
40 40
 }
41 41
 
42 42
 if (empty($_SESSION['oLP'])) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     null,
36 36
     api_get_group_id()
37 37
 );
38
-if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
38
+if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
39 39
      api_not_allowed();
40 40
 }
41 41
 
@@ -73,22 +73,22 @@  discard block
 block discarded – undo
73 73
 $html = '';
74 74
 $step = 1;
75 75
 foreach ($list as $toc) {
76
-    $x = 1000*$step;
76
+    $x = 1000 * $step;
77 77
     $html .= '<div id="step-'.$step.'" class="step slide" data-x="'.$x.'" data-y="-1500"  >';
78 78
     $html .= '<div class="impress-content">';
79 79
     $src = $_SESSION['oLP']->get_link('http', $toc['id']);
80 80
     if ($toc['type'] !== 'dokeos_chapter') {
81 81
         //just showing the src in a iframe ...
82 82
         $html .= '<h2>'.$toc['title'].'</h2>';
83
-        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="' . $src . '"></iframe>';
84
-    }else{
83
+        $html .= '<iframe border="0" frameborder="0" style="width:100%;height:600px" src="'.$src.'"></iframe>';
84
+    } else {
85 85
         $html .= "<div class='impress-title'>";
86 86
         $html .= '<h1>'.$toc['title'].'</h1>';
87 87
         $html .= "</div>";
88 88
     }
89 89
     $html .= "</div>";
90 90
     $html .= "</div>";
91
-    $step ++;
91
+    $step++;
92 92
 }
93 93
 
94 94
 //Setting the template
Please login to merge, or discard this 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/scormOrganization.class.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
                     //if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
39 39
                     $children = $element->childNodes;
40 40
                     foreach ($children as $child) {
41
-                         switch ($child->nodeType) {
41
+                            switch ($child->nodeType) {
42 42
                             case XML_ELEMENT_NODE:
43 43
                                 switch ($child->tagName) {
44 44
                                     case 'item':
45 45
                                          $oItem = new scormItem('manifest', $child);
46
-                                         if ($oItem->identifier != '') {
46
+                                            if ($oItem->identifier != '') {
47 47
                                             $this->items[$oItem->identifier] = $oItem;
48
-                                         }
48
+                                            }
49 49
                                         break;
50 50
                                     case 'metadata':
51 51
                                         $this->metadata = new scormMetadata('manifest', $child);
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
                                         break;
59 59
                                 }
60 60
                                 break;
61
-                             case XML_TEXT_NODE:
61
+                                case XML_TEXT_NODE:
62 62
                                  break;
63
-                         }
63
+                            }
64 64
                     }
65 65
 
66 66
                     if ($element->hasAttributes()) {
67
-                         $attributes = $element->attributes;
68
-                         //$keep_href = '';
69
-                         foreach ($attributes as $attrib) {
70
-                             switch ($attrib->name) {
71
-                                 case 'identifier':
67
+                            $attributes = $element->attributes;
68
+                            //$keep_href = '';
69
+                            foreach ($attributes as $attrib) {
70
+                                switch ($attrib->name) {
71
+                                    case 'identifier':
72 72
                                      $this->identifier = $attrib->value;
73
-                                     break;
74
-                                 case 'structure':
73
+                                        break;
74
+                                    case 'structure':
75 75
                                      $this->structure = $attrib->value;
76
-                                     break;
77
-                             }
78
-                         }
76
+                                        break;
77
+                                }
78
+                            }
79 79
                     }
80 80
 
81 81
                     return true;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@
 block discarded – undo
98 98
         foreach ($this->items as $id => $dummy) {
99 99
             $abs_order = 0;
100 100
             // Passes the array as a pointer so it is modified in $list directly.
101
-            $this->items[$id]->get_flat_list($list,$abs_order, $i, 0);
101
+            $this->items[$id]->get_flat_list($list, $abs_order, $i, 0);
102 102
             $i++;
103 103
         }
104 104
 
Please login to merge, or discard this patch.
main/newscorm/storageapi.php 3 patches
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -15,52 +15,52 @@
 block discarded – undo
15 15
 }
16 16
 
17 17
 switch ($_REQUEST['action']) {
18
-    case "get":
19
-        print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
20
-        break;
21
-    case "set":
22
-        if (storage_can_set($_REQUEST['svuser'])) {
23
-            print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
24
-        }
25
-        break;
26
-    case "getall":
27
-        print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
28
-        break;
29
-    case "stackpush":
30
-        if (storage_can_set($_REQUEST['svuser'])) {
31
-            print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
32
-        }
33
-        break;
34
-    case "stackpop":
35
-        if (storage_can_set($_REQUEST['svuser'])) {
36
-            print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
37
-        }
38
-        break;
39
-    case "stacklength":
40
-        print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
41
-        break;
42
-    case "stackclear":
43
-        if (storage_can_set($_REQUEST['svuser'])) {
44
-            print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
45
-        }
46
-        break;
47
-    case "stackgetall":
48
-        if (storage_can_set($_REQUEST['svuser']))
49
-            print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
-        break;
51
-    case "getposition":
52
-        print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
53
-        break;
54
-    case "getleaders":
55
-        print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
56
-        break;
57
-    case "usersgetall":
58
-// security issue
59
-        print "NOT allowed, security issue, see sources";
60
-//		print storage_get_all_users();
61
-        break;
62
-    default:
63
-        // Do nothing
18
+        case "get":
19
+            print storage_get($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
20
+            break;
21
+        case "set":
22
+            if (storage_can_set($_REQUEST['svuser'])) {
23
+                print storage_set($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
24
+            }
25
+            break;
26
+        case "getall":
27
+            print storage_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco']);
28
+            break;
29
+        case "stackpush":
30
+            if (storage_can_set($_REQUEST['svuser'])) {
31
+                print storage_stack_push($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svvalue']);
32
+            }
33
+            break;
34
+        case "stackpop":
35
+            if (storage_can_set($_REQUEST['svuser'])) {
36
+                print storage_stack_pop($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
37
+            }
38
+            break;
39
+        case "stacklength":
40
+            print storage_stack_length($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
41
+            break;
42
+        case "stackclear":
43
+            if (storage_can_set($_REQUEST['svuser'])) {
44
+                print storage_stack_clear($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
45
+            }
46
+            break;
47
+        case "stackgetall":
48
+            if (storage_can_set($_REQUEST['svuser']))
49
+                print storage_stack_getall($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey']);
50
+            break;
51
+        case "getposition":
52
+            print storage_get_position($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc']);
53
+            break;
54
+        case "getleaders":
55
+            print storage_get_leaders($_REQUEST['svuser'], $_REQUEST['svcourse'], $_REQUEST['svsco'], $_REQUEST['svkey'], $_REQUEST['svasc'], $_REQUEST['svlength']);
56
+            break;
57
+        case "usersgetall":
58
+    // security issue
59
+            print "NOT allowed, security issue, see sources";
60
+    //		print storage_get_all_users();
61
+            break;
62
+        default:
63
+            // Do nothing
64 64
 }
65 65
 
66 66
 function storage_can_set($sv_user) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         and sco_id = '$sv_sco'
104 104
         and course_id = '$sv_course'
105 105
         and sv_key = '$sv_key'
106
-        order by sv_value ".($sv_asc ? "ASC": "DESC")." limit $sv_length";
106
+        order by sv_value ".($sv_asc ? "ASC" : "DESC")." limit $sv_length";
107 107
 //	$sql_data = "select sv.user_id as user_id, sv_key as variable, sv_value as value
108 108
 //		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv
109 109
 //		where sv.user_id in (select u2.user_id from ($sql_leaders) u2)
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         and search.sco_id = '$sv_sco'
136 136
         and search.course_id = '$sv_course'
137 137
         and search.sv_key = '$sv_key'
138
-        and list.sv_value ".($sv_asc ? "<=": ">=")." search.sv_value
138
+        and list.sv_value ".($sv_asc ? "<=" : ">=")." search.sv_value
139 139
         and list.sco_id = search.sco_id
140 140
         and list.course_id = search.course_id
141 141
         and list.sv_key = search.sv_key
Please login to merge, or discard this 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_view_item.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 // Using the resource linker as a tool for adding resources to the learning path.
66 66
 if ($action == 'add' && $type == 'learnpathitem') {
67
-     $htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
67
+        $htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
68 68
 }
69 69
 if ((!$is_allowed_to_edit) || ($isStudentView)) {
70 70
     error_log('New LP - User not authorized in lp_view_item.php');
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 // Theme calls
99 99
 $show_learn_path = true;
100 100
 if (isset($_SESSION['oLP']) && is_object($_SESSION['oLP'])) {
101
-	$lp_theme_css = $_SESSION['oLP']->get_theme();
101
+    $lp_theme_css = $_SESSION['oLP']->get_theme();
102 102
 }
103 103
 
104 104
 if ($mode == 'fullpage') {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 if (isset($_GET['lp_item_id'])) {
20 20
 
21 21
     // Get parameter only came from lp_view.php.
22
-    $lp_item_id  = intval($_GET['lp_item_id']);
22
+    $lp_item_id = intval($_GET['lp_item_id']);
23 23
     if (isset($_SESSION['lpobject'])) {
24 24
         $oLP = unserialize($_SESSION['lpobject']);
25 25
     }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
57 57
 $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
58 58
 
59
-$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int)$_REQUEST['isStudentView']);
60
-$learnpath_id = (int)$_REQUEST['lp_id'];
59
+$isStudentView = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
60
+$learnpath_id = (int) $_REQUEST['lp_id'];
61 61
 
62 62
 // Using the resource linker as a tool for adding resources to the learning path.
63 63
 if ($action == 'add' && $type == 'learnpathitem') {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 /* SHOWING THE ADMIN TOOLS	*/
79 79
 
80 80
 if (api_is_in_gradebook()) {
81
-    $interbreadcrumb[] = array (
81
+    $interbreadcrumb[] = array(
82 82
         'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(),
83 83
         'name' => get_lang('ToolGradebook')
84 84
     );
Please login to merge, or discard this patch.
main/newscorm/scormMetadata.class.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -39,60 +39,60 @@
 block discarded – undo
39 39
                 case 'manifest': // Do the same as the default.
40 40
                      $children = $element->childNodes;
41 41
                     foreach ($children as $child) {
42
-                         switch ($child->nodeType) {
43
-                             case XML_ELEMENT_NODE:
42
+                            switch ($child->nodeType) {
43
+                                case XML_ELEMENT_NODE:
44 44
                                 // Could be 'lom', 'schema', 'schemaversion' or 'location'.
45 45
                                  switch ($child->tagName) {
46
-                                     case 'lom':
46
+                                        case 'lom':
47 47
                                          $childchildren = $child->childNodes;
48
-                                         foreach ($childchildren as $childchild) {
49
-                                             $this->lom = $childchild->nodeValue;
50
-                                         }
51
-                                         break;
52
-                                     case 'schema':
48
+                                            foreach ($childchildren as $childchild) {
49
+                                                $this->lom = $childchild->nodeValue;
50
+                                            }
51
+                                            break;
52
+                                        case 'schema':
53 53
                                          $childchildren = $child->childNodes;
54
-                                         foreach ($childchildren as $childchild) {
55
-                                             // There is generally only one child here.
56
-                                             $this->schema = $childchild->nodeValue;
57
-                                         }
58
-                                         break;
59
-                                     case 'schemaversion':
54
+                                            foreach ($childchildren as $childchild) {
55
+                                                // There is generally only one child here.
56
+                                                $this->schema = $childchild->nodeValue;
57
+                                            }
58
+                                            break;
59
+                                        case 'schemaversion':
60 60
                                          $childchildren = $child->childNodes;
61
-                                         foreach ($childchildren as $childchild) {
62
-                                             // There is generally only one child here.
63
-                                             $this->schemaversion = $childchild->nodeValue;
64
-                                         }
65
-                                         break;
66
-                                     case 'location':
61
+                                            foreach ($childchildren as $childchild) {
62
+                                                // There is generally only one child here.
63
+                                                $this->schemaversion = $childchild->nodeValue;
64
+                                            }
65
+                                            break;
66
+                                        case 'location':
67 67
                                          $childchildren = $child->childNodes;
68
-                                         foreach ($childchildren as $childchild) {
69
-                                             // There is generally only one child here.
70
-                                             $this->location = $childchild->nodeValue;
71
-                                         }
72
-                                         break;
73
-                                 }
74
-                                 break;
75
-                             case XML_TEXT_NODE:
68
+                                            foreach ($childchildren as $childchild) {
69
+                                                // There is generally only one child here.
70
+                                                $this->location = $childchild->nodeValue;
71
+                                            }
72
+                                            break;
73
+                                    }
74
+                                    break;
75
+                                case XML_TEXT_NODE:
76 76
                                  if (trim($child->textContent) != '') {
77
-                                     if (count($children == 1)) {
78
-                                         // If this is the only child at this level and it is a content... save differently.
79
-                                         $this->text = $child->textContent;
80
-                                     } else {
81
-                                         $this->text[$element->tagName] = $child->textContent;
82
-                                     }
83
-                                 }
84
-                                 break;
85
-                         }
86
-                     }
87
-                     $attributes = $element->attributes;
88
-                     //$keep_href = '';
89
-                     if (is_array($attributes)) {
90
-                         foreach ($attributes as $attrib) {
91
-                             if (trim($attrib->value) != ''){
92
-                                 $this->attribs[$attrib->name] = $attrib->value;
93
-                             }
94
-                         }
95
-                     }
77
+                                        if (count($children == 1)) {
78
+                                            // If this is the only child at this level and it is a content... save differently.
79
+                                            $this->text = $child->textContent;
80
+                                        } else {
81
+                                            $this->text[$element->tagName] = $child->textContent;
82
+                                        }
83
+                                    }
84
+                                    break;
85
+                            }
86
+                        }
87
+                        $attributes = $element->attributes;
88
+                        //$keep_href = '';
89
+                        if (is_array($attributes)) {
90
+                            foreach ($attributes as $attrib) {
91
+                                if (trim($attrib->value) != ''){
92
+                                    $this->attribs[$attrib->name] = $attrib->value;
93
+                                }
94
+                            }
95
+                        }
96 96
                     return true;
97 97
                     //break;
98 98
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
                      //$keep_href = '';
89 89
                      if (is_array($attributes)) {
90 90
                          foreach ($attributes as $attrib) {
91
-                             if (trim($attrib->value) != ''){
91
+                             if (trim($attrib->value) != '') {
92 92
                                  $this->attribs[$attrib->name] = $attrib->value;
93 93
                              }
94 94
                          }
Please login to merge, or discard this patch.
main/newscorm/scormItem.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                                         }
101 101
                                         break;
102 102
                                     case 'item':
103
-                                        $oItem = new scormItem('manifest',$child);
103
+                                        $oItem = new scormItem('manifest', $child);
104 104
                                         if ($oItem->identifier != '') {
105 105
                                             $this->sub_items[$oItem->identifier] = $oItem;
106 106
                                         }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                         $attributes = $element->attributes;
120 120
                         //$keep_href = '';
121 121
                         foreach ($attributes as $attrib) {
122
-                            switch($attrib->name){
122
+                            switch ($attrib->name) {
123 123
                                 case 'identifier':
124 124
                                     $this->identifier = $attrib->value;
125 125
                                     break;
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
         );
173 173
         $abs_order++;
174 174
         $i = 1;
175
-        foreach($this->sub_items as $id => $dummy) {
176
-            $oSubitem =& $this->sub_items[$id];
175
+        foreach ($this->sub_items as $id => $dummy) {
176
+            $oSubitem = & $this->sub_items[$id];
177 177
             $oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
178 178
             $i++;
179 179
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         parent::save($from_outside, $prereqs_complete);
189 189
         // Under certain conditions, the scorm_contact should not be set, because no scorm signal was sent.
190 190
         $this->scorm_contact = true;
191
-        if (!$this->scorm_contact){
191
+        if (!$this->scorm_contact) {
192 192
             //error_log('New LP - was expecting SCORM message but none received', 0);
193 193
         }
194 194
     }
Please login to merge, or discard this patch.
main/newscorm/lp_controller.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
                 if (isset($_REQUEST['activate_start_date_check']) &&
539 539
                     $_REQUEST['activate_start_date_check'] == 1
540 540
                 ) {
541
-                	$publicated_on = $_REQUEST['publicated_on'];
541
+                    $publicated_on = $_REQUEST['publicated_on'];
542 542
                 } else {
543
-                	$publicated_on = null;
543
+                    $publicated_on = null;
544 544
                 }
545 545
 
546 546
                 if (isset($_REQUEST['activate_end_date_check']) &&
547 547
                     $_REQUEST['activate_end_date_check'] == 1
548 548
                 ) {
549
-                	$expired_on = $_REQUEST['expired_on'];
549
+                    $expired_on = $_REQUEST['expired_on'];
550 550
                 } else {
551
-                	$expired_on = null;
551
+                    $expired_on = null;
552 552
                 }
553 553
 
554 554
                 $new_lp_id = learnpath::add_lp(
@@ -937,9 +937,9 @@  discard block
 block discarded – undo
937 937
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
938 938
 
939 939
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
940
-            	$publicated_on  = $_REQUEST['publicated_on'];
940
+                $publicated_on  = $_REQUEST['publicated_on'];
941 941
             } else {
942
-            	$publicated_on = null;
942
+                $publicated_on = null;
943 943
             }
944 944
 
945 945
             if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
         } elseif ($mode == 'embedded') {
1152 1152
             $_SESSION['oLP']->mode = 'embedded';
1153 1153
         } elseif ($mode == 'embedframe') {
1154
-        	$_SESSION['oLP']->mode = 'embedframe';
1154
+            $_SESSION['oLP']->mode = 'embedframe';
1155 1155
         } elseif ($mode == 'impress') {
1156 1156
             $_SESSION['oLP']->mode = 'impress';
1157 1157
         }
@@ -1189,11 +1189,11 @@  discard block
 block discarded – undo
1189 1189
 		require 'lp_list.php';
1190 1190
 		break;
1191 1191
      */
1192
-	case 'switch_attempt_mode':
1193
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1194
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
-		$_SESSION['refresh'] = 1;
1196
-		$_SESSION['oLP']->switch_attempt_mode();
1192
+    case 'switch_attempt_mode':
1193
+        if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1194
+        if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
+        $_SESSION['refresh'] = 1;
1196
+        $_SESSION['oLP']->switch_attempt_mode();
1197 1197
         require 'lp_list.php';
1198 1198
         break;
1199 1199
     case 'switch_scorm_debug':
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 // Including the global initialization file.
27 27
 require_once '../inc/global.inc.php';
28
-$current_course_tool  = TOOL_LEARNPATH;
28
+$current_course_tool = TOOL_LEARNPATH;
29 29
 $_course = api_get_course_info();
30 30
 
31 31
 $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
     ) {
38 38
         $htmlHeadXtra[] = '<script>
39 39
     <!--
40
-        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path() . '\';
40
+        var jQueryFrameReadyConfigPath = \'' . api_get_jquery_web_path().'\';
41 41
     -->
42 42
     </script>';
43
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
-    $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
43
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
44
+    $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
45 45
     }
46 46
 }
47 47
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
 $course_id = api_get_course_int_id();
270 270
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
271
+if ($debug > 0) error_log('New LP - Passed data remains check', 0);
272 272
 
273 273
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274 274
     if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             if (Database::num_rows($res)) {
293 293
                 $row = Database::fetch_array($res);
294 294
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
295
+                if ($debug > 0) error_log('New LP - found row - type '.$type.' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296 296
                 switch ($type) {
297 297
                     case 1:
298 298
                         if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
                 $editPrerequisite = $_SESSION['oLP']->edit_item_prereq(
690 690
                     $_GET['id'],
691 691
                     $_POST['prerequisites'],
692
-                    $_POST['min_' . $_POST['prerequisites']],
693
-                    $_POST['max_' . $_POST['prerequisites']]
692
+                    $_POST['min_'.$_POST['prerequisites']],
693
+                    $_POST['max_'.$_POST['prerequisites']]
694 694
                 );
695 695
 
696 696
                 if ($editPrerequisite) {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             $_SESSION['oLP']->setSubscribeUsers($_REQUEST['subscribe_users']);
940 940
 
941 941
             if (isset($_REQUEST['activate_start_date_check']) && $_REQUEST['activate_start_date_check'] == 1) {
942
-            	$publicated_on  = $_REQUEST['publicated_on'];
942
+            	$publicated_on = $_REQUEST['publicated_on'];
943 943
             } else {
944 944
             	$publicated_on = null;
945 945
             }
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
         else {
1011 1011
             $_SESSION['refresh'] = 1;
1012 1012
             if (!empty($_REQUEST['parent_item_id'])) {
1013
-                $_SESSION['from_learnpath']='yes';
1013
+                $_SESSION['from_learnpath'] = 'yes';
1014 1014
                 $_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.Security::remove_XSS($_REQUEST['lp_id']);
1015 1015
                 require 'resourcelinker.php';
1016 1016
             } else {
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
             error_log('New LP - No learnpath given for view', 0);
1112 1112
             require 'lp_list.php';
1113 1113
         } else {
1114
-            if ($debug > 0) {error_log('New LP - Trying to set current item to ' . $_REQUEST['item_id'], 0); }
1115
-            if ( !empty($_REQUEST['item_id']) ) {
1114
+            if ($debug > 0) {error_log('New LP - Trying to set current item to '.$_REQUEST['item_id'], 0); }
1115
+            if (!empty($_REQUEST['item_id'])) {
1116 1116
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1117 1117
             }
1118 1118
             require 'lp_view.php';
@@ -1192,8 +1192,8 @@  discard block
 block discarded – undo
1192 1192
 		break;
1193 1193
      */
1194 1194
 	case 'switch_attempt_mode':
1195
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1196
-		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1195
+		if ($debug > 0) error_log('New LP - switch_reinit action triggered', 0);
1196
+		if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1197 1197
 		$_SESSION['refresh'] = 1;
1198 1198
 		$_SESSION['oLP']->switch_attempt_mode();
1199 1199
         require 'lp_list.php';
@@ -1243,8 +1243,8 @@  discard block
 block discarded – undo
1243 1243
             error_log('New LP - No learnpath given for view', 0);
1244 1244
             require 'lp_list.php';
1245 1245
         } else {
1246
-            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to ' . $_REQUEST['item_id'], 0); }
1247
-            if (!empty($_REQUEST['item_id']) ) {
1246
+            if ($debug > 0) {error_log('New LP - Trying to impress this LP item to '.$_REQUEST['item_id'], 0); }
1247
+            if (!empty($_REQUEST['item_id'])) {
1248 1248
                 $_SESSION['oLP']->set_current_item($_REQUEST['item_id']);
1249 1249
             }
1250 1250
             require 'lp_impress.php';
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
                     $_SESSION['oLP']->lp_session_id
1308 1308
                 );
1309 1309
 
1310
-                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id']: 0;
1310
+                $forumCategoryId = !empty($forumCategory) ? $forumCategory['cat_id'] : 0;
1311 1311
 
1312 1312
                 if (empty($forumCategoryId)) {
1313 1313
                     $forumCategoryId = store_forumcategory(
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
             }
1340 1340
         }
1341 1341
 
1342
-        header('Location:' . api_get_self() . '?' . http_build_query([
1342
+        header('Location:'.api_get_self().'?'.http_build_query([
1343 1343
             'action' => 'add_item',
1344 1344
             'type' => 'step',
1345 1345
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
             }
1382 1382
         }
1383 1383
 
1384
-        header('Location:' . api_get_self() . '?' . http_build_query([
1384
+        header('Location:'.api_get_self().'?'.http_build_query([
1385 1385
             'action' => 'add_item',
1386 1386
             'type' => 'step',
1387 1387
             'lp_id' => $_SESSION['oLP']->lp_id
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
         $_SESSION['oLP']->getFinalItemForm();
1406 1406
 
1407
-        $redirectTo = api_get_self() . '?' . http_build_query([
1407
+        $redirectTo = api_get_self().'?'.http_build_query([
1408 1408
             'action' => 'add_item',
1409 1409
             'type' => 'step',
1410 1410
             'lp_id' => intval($_SESSION['oLP']->lp_id)
Please login to merge, or discard this patch.
Braces   +233 added lines, -122 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 $use_anonymous = true;
14 14
 
15 15
 $debug = 0;
16
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
16
+if ($debug > 0) {
17
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
18
+}
17 19
 
18 20
 // Language files that needs to be included.
19 21
 if (isset($_GET['action'])) {
@@ -231,10 +233,14 @@  discard block
 block discarded – undo
231 233
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
232 234
     Session::erase('refresh');
233 235
     $myrefresh = 1;
234
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
235
-}
236
+    if ($debug > 0) {
237
+        error_log('New LP - Refresh asked', 0);
238
+    }
239
+    }
236 240
 
237
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
241
+if ($debug > 0) {
242
+    error_log('New LP - Passed refresh check', 0);
243
+}
238 244
 
239 245
 if (!empty($_REQUEST['dialog_box'])) {
240 246
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -244,17 +250,23 @@  discard block
 block discarded – undo
244 250
 $lp_found = false;
245 251
 
246 252
 if (isset($_SESSION['lpobject'])) {
247
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
253
+    if ($debug > 0) {
254
+        error_log('New LP - SESSION[lpobject] is defined', 0);
255
+    }
248 256
     $oLP = unserialize($_SESSION['lpobject']);
249 257
     if (isset($oLP) && is_object($oLP)) {
250
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
258
+        if ($debug > 0) {
259
+            error_log('New LP - oLP is object', 0);
260
+        }
251 261
         if ($myrefresh == 1 OR
252 262
             empty($oLP->cc) OR
253 263
             $oLP->cc != api_get_course_id() OR
254 264
             $oLP->lp_view_session_id != $session_id OR
255 265
             $oLP->scorm_debug == '1'
256 266
         ) {
257
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
267
+            if ($debug > 0) {
268
+                error_log('New LP - Course has changed, discard lp object', 0);
269
+            }
258 270
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
259 271
             $oLP = null;
260 272
             Session::erase('oLP');
@@ -268,13 +280,19 @@  discard block
 block discarded – undo
268 280
 
269 281
 $course_id = api_get_course_int_id();
270 282
 
271
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
283
+if ($debug>0) {
284
+    error_log('New LP - Passed data remains check', 0);
285
+}
272 286
 
273 287
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
274
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
288
+    if ($debug > 0) {
289
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
290
+    }
275 291
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
276 292
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
277
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
293
+        if ($debug > 0) {
294
+            error_log('New LP - lp_id is defined', 0);
295
+        }
278 296
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
279 297
         // right object.
280 298
         if (!empty($_REQUEST['lp_id'])) {
@@ -286,49 +304,67 @@  discard block
 block discarded – undo
286 304
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
287 305
         if (is_numeric($lp_id)) {
288 306
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
289
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
307
+            if ($debug > 0) {
308
+                error_log('New LP - querying '.$sel, 0);
309
+            }
290 310
             $res = Database::query($sel);
291 311
 
292 312
             if (Database::num_rows($res)) {
293 313
                 $row = Database::fetch_array($res);
294 314
                 $type = $row['lp_type'];
295
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
315
+                if ($debug > 0) {
316
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
317
+                }
296 318
                 switch ($type) {
297 319
                     case 1:
298
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
320
+                        if ($debug > 0) {
321
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
322
+                        }
299 323
 
300 324
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
301 325
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
302 326
                         break;
303 327
                     case 2:
304
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
328
+                        if ($debug > 0) {
329
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
330
+                        }
305 331
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
306 332
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
307 333
                         break;
308 334
                     case 3:
309
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        if ($debug > 0) {
336
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
337
+                        }
310 338
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
311 339
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
312 340
                         break;
313 341
                     default:
314
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
342
+                        if ($debug > 0) {
343
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
344
+                        }
315 345
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
316 346
                         if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); }
317 347
                         break;
318 348
                 }
319 349
             }
320 350
         } else {
321
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
351
+            if ($debug > 0) {
352
+                error_log('New LP - Request[lp_id] is not numeric', 0);
353
+            }
322 354
         }
323 355
     } else {
324
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
356
+        if ($debug > 0) {
357
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
358
+        }
325 359
     }
326 360
     if ($lp_found) {
327 361
         $_SESSION['oLP'] = $oLP;
328 362
     }
329 363
 }
330 364
 
331
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
365
+if ($debug > 0) {
366
+    error_log('New LP - Passed oLP creation check', 0);
367
+}
332 368
 
333 369
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
334 370
 
@@ -372,11 +408,15 @@  discard block
 block discarded – undo
372 408
         if (!$is_allowed_to_edit) {
373 409
             api_not_allowed(true);
374 410
         }
375
-        if ($debug > 0) error_log('New LP - add item action triggered', 0);
411
+        if ($debug > 0) {
412
+            error_log('New LP - add item action triggered', 0);
413
+        }
376 414
 
377 415
         if (!$lp_found) {
378 416
             //check if the learnpath ID was defined, otherwise send back to list
379
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
417
+            if ($debug > 0) {
418
+                error_log('New LP - No learnpath given for add item', 0);
419
+            }
380 420
             require 'lp_list.php';
381 421
         } else {
382 422
             $_SESSION['refresh'] = 1;
@@ -450,11 +490,15 @@  discard block
 block discarded – undo
450 490
         if (!$is_allowed_to_edit) {
451 491
             api_not_allowed(true);
452 492
         }
453
-        if ($debug > 0) error_log('New LP - add audio action triggered', 0);
493
+        if ($debug > 0) {
494
+            error_log('New LP - add audio action triggered', 0);
495
+        }
454 496
 
455 497
         if (!$lp_found) {
456 498
             //check if the learnpath ID was defined, otherwise send back to list
457
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
499
+            if ($debug > 0) {
500
+                error_log('New LP - No learnpath given for add audio', 0);
501
+            }
458 502
             require 'lp_list.php';
459 503
         } else {
460 504
             $_SESSION['refresh'] = 1;
@@ -528,7 +572,9 @@  discard block
 block discarded – undo
528 572
         if (!$is_allowed_to_edit) {
529 573
             api_not_allowed(true);
530 574
         }
531
-        if ($debug > 0) error_log('New LP - add_lp action triggered', 0);
575
+        if ($debug > 0) {
576
+            error_log('New LP - add_lp action triggered', 0);
577
+        }
532 578
         if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) {
533 579
             $_REQUEST['lp_name'] = trim($_REQUEST['lp_name']);
534 580
             $_SESSION['refresh'] = 1;
@@ -587,9 +633,10 @@  discard block
 block discarded – undo
587 633
         if (!$is_allowed_to_edit) {
588 634
             api_not_allowed(true);
589 635
         }
590
-        if ($debug > 0) error_log('New LP - admin_view action triggered', 0);
591
-        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; }
592
-        else {
636
+        if ($debug > 0) {
637
+            error_log('New LP - admin_view action triggered', 0);
638
+        }
639
+        if (!$lp_found) { error_log('New LP - No learnpath given for admin_view', 0); require 'lp_list.php'; } else {
593 640
             $_SESSION['refresh'] = 1;
594 641
             require 'lp_admin_view.php';
595 642
         }
@@ -599,9 +646,10 @@  discard block
 block discarded – undo
599 646
             if (!$is_allowed_to_edit) {
600 647
                 api_not_allowed(true);
601 648
             }
602
-            if ($debug > 0) error_log('New LP - auto_launch action triggered', 0);
603
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
604
-            else {
649
+            if ($debug > 0) {
650
+                error_log('New LP - auto_launch action triggered', 0);
651
+            }
652
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
605 653
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
606 654
                 require 'lp_list.php';
607 655
                 exit;
@@ -612,10 +660,11 @@  discard block
 block discarded – undo
612 660
         if (!$is_allowed_to_edit) {
613 661
             api_not_allowed(true);
614 662
         }
615
-        if ($debug > 0) error_log('New LP - build action triggered', 0);
663
+        if ($debug > 0) {
664
+            error_log('New LP - build action triggered', 0);
665
+        }
616 666
 
617
-        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; }
618
-        else {
667
+        if (!$lp_found) { error_log('New LP - No learnpath given for build', 0); require 'lp_list.php'; } else {
619 668
             $_SESSION['refresh'] = 1;
620 669
             //require 'lp_build.php';
621 670
             $url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id);
@@ -627,10 +676,11 @@  discard block
 block discarded – undo
627 676
         if (!$is_allowed_to_edit) {
628 677
             api_not_allowed(true);
629 678
         }
630
-        if ($debug > 0) error_log('New LP - edit item action triggered', 0);
679
+        if ($debug > 0) {
680
+            error_log('New LP - edit item action triggered', 0);
681
+        }
631 682
 
632
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; }
633
-        else {
683
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; } else {
634 684
             $_SESSION['refresh'] = 1;
635 685
             if (isset($_POST['submit_button']) && !empty($post_title)) {
636 686
 
@@ -680,9 +730,10 @@  discard block
 block discarded – undo
680 730
         if (!$is_allowed_to_edit) {
681 731
             api_not_allowed(true);
682 732
         }
683
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
684
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
685
-        else {
733
+        if ($debug > 0) {
734
+            error_log('New LP - edit item prereq action triggered', 0);
735
+        }
736
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
686 737
             if (isset($_POST['submit_button'])) {
687 738
                 //Updating the lp.modified_on
688 739
                 $_SESSION['oLP']->set_modified_on();
@@ -710,9 +761,10 @@  discard block
 block discarded – undo
710 761
         if (!$is_allowed_to_edit) {
711 762
             api_not_allowed(true);
712 763
         }
713
-        if ($debug > 0) error_log('New LP - move item action triggered', 0);
714
-        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; }
715
-        else {
764
+        if ($debug > 0) {
765
+            error_log('New LP - move item action triggered', 0);
766
+        }
767
+        if (!$lp_found) { error_log('New LP - No learnpath given for move item', 0); require 'lp_list.php'; } else {
716 768
             $_SESSION['refresh'] = 1;
717 769
             if (isset($_POST['submit_button'])) {
718 770
                 //Updating the lp.modified_on
@@ -745,7 +797,9 @@  discard block
 block discarded – undo
745 797
         if (!$is_allowed_to_edit) {
746 798
             api_not_allowed(true);
747 799
         }
748
-        if ($debug > 0) error_log('New LP - view_item action triggered', 0);
800
+        if ($debug > 0) {
801
+            error_log('New LP - view_item action triggered', 0);
802
+        }
749 803
         if (!$lp_found) {
750 804
             error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php';
751 805
         } else {
@@ -757,7 +811,9 @@  discard block
 block discarded – undo
757 811
         if (!$is_allowed_to_edit) {
758 812
             api_not_allowed(true);
759 813
         }
760
-        if ($debug > 0) error_log('New LP - upload action triggered', 0);
814
+        if ($debug > 0) {
815
+            error_log('New LP - upload action triggered', 0);
816
+        }
761 817
         $cwdir = getcwd();
762 818
         require 'lp_upload.php';
763 819
         // Reinit current working directory as many functions in upload change it.
@@ -774,9 +830,10 @@  discard block
 block discarded – undo
774 830
             api_not_allowed(true);
775 831
         }
776 832
 
777
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
778
-        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; }
779
-        else {
833
+        if ($debug > 0) {
834
+            error_log('New LP - export action triggered', 0);
835
+        }
836
+        if (!$lp_found) { error_log('New LP - No learnpath given for copy', 0); require 'lp_list.php'; } else {
780 837
             $_SESSION['oLP']->copy();
781 838
         }
782 839
         require 'lp_list.php';
@@ -789,9 +846,10 @@  discard block
 block discarded – undo
789 846
         if ($hideScormExportLink === 'true') {
790 847
             api_not_allowed(true);
791 848
         }
792
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
793
-        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; }
794
-        else {
849
+        if ($debug > 0) {
850
+            error_log('New LP - export action triggered', 0);
851
+        }
852
+        if (!$lp_found) { error_log('New LP - No learnpath given for export', 0); require 'lp_list.php'; } else {
795 853
             $_SESSION['oLP']->scorm_export();
796 854
             exit();
797 855
             //require 'lp_list.php';
@@ -806,7 +864,9 @@  discard block
 block discarded – undo
806 864
             api_not_allowed(true);
807 865
         }
808 866
 
809
-        if ($debug > 0) error_log('New LP - export action triggered', 0);
867
+        if ($debug > 0) {
868
+            error_log('New LP - export action triggered', 0);
869
+        }
810 870
         if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php';
811 871
         } else {
812 872
             $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']);
@@ -820,9 +880,10 @@  discard block
 block discarded – undo
820 880
         if (!$is_allowed_to_edit) {
821 881
             api_not_allowed(true);
822 882
         }
823
-        if ($debug > 0) error_log('New LP - delete action triggered', 0);
824
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; }
825
-        else {
883
+        if ($debug > 0) {
884
+            error_log('New LP - delete action triggered', 0);
885
+        }
886
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete', 0); require 'lp_list.php'; } else {
826 887
             $_SESSION['refresh'] = 1;
827 888
             $_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove');
828 889
             Session::erase('oLP');
@@ -834,9 +895,10 @@  discard block
 block discarded – undo
834 895
         if (!$is_allowed_to_edit) {
835 896
             api_not_allowed(true);
836 897
         }
837
-        if ($debug > 0) error_log('New LP - visibility action triggered', 0);
838
-        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; }
839
-        else {
898
+        if ($debug > 0) {
899
+            error_log('New LP - visibility action triggered', 0);
900
+        }
901
+        if (!$lp_found) { error_log('New LP - No learnpath given for visibility', 0); require 'lp_list.php'; } else {
840 902
             learnpath::toggle_visibility($_REQUEST['lp_id'], $_REQUEST['new_status']);
841 903
             require 'lp_list.php';
842 904
         }
@@ -846,9 +908,10 @@  discard block
 block discarded – undo
846 908
         if (!$is_allowed_to_edit) {
847 909
             api_not_allowed(true);
848 910
         }
849
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
850
-        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; }
851
-        else {
911
+        if ($debug > 0) {
912
+            error_log('New LP - publish action triggered', 0);
913
+        }
914
+        if (!$lp_found) { error_log('New LP - No learnpath given for publish', 0); require 'lp_list.php'; } else {
852 915
             learnpath::toggle_publish($_REQUEST['lp_id'], $_REQUEST['new_status']);
853 916
             require 'lp_list.php';
854 917
         }
@@ -858,7 +921,9 @@  discard block
 block discarded – undo
858 921
         if (!$is_allowed_to_edit) {
859 922
             api_not_allowed(true);
860 923
         }
861
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
924
+        if ($debug > 0) {
925
+            error_log('New LP - publish action triggered', 0);
926
+        }
862 927
         if (!$lp_found) {
863 928
             error_log('New LP - No learnpath given for publish', 0);
864 929
             require 'lp_list.php';
@@ -872,7 +937,9 @@  discard block
 block discarded – undo
872 937
         if (!$is_allowed_to_edit) {
873 938
             api_not_allowed(true);
874 939
         }
875
-        if ($debug > 0) error_log('New LP - publish action triggered', 0);
940
+        if ($debug > 0) {
941
+            error_log('New LP - publish action triggered', 0);
942
+        }
876 943
         if (!$lp_found) {
877 944
             error_log('New LP - No learnpath given for publish', 0);
878 945
             require 'lp_list.php';
@@ -885,9 +952,10 @@  discard block
 block discarded – undo
885 952
         if (!$is_allowed_to_edit) {
886 953
             api_not_allowed(true);
887 954
         }
888
-        if ($debug > 0) error_log('New LP - edit action triggered', 0);
889
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
890
-        else {
955
+        if ($debug > 0) {
956
+            error_log('New LP - edit action triggered', 0);
957
+        }
958
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
891 959
             $_SESSION['refresh'] = 1;
892 960
             require 'lp_edit.php';
893 961
         }
@@ -896,9 +964,10 @@  discard block
 block discarded – undo
896 964
         if (!$is_allowed_to_edit) {
897 965
             api_not_allowed(true);
898 966
         }
899
-        if ($debug > 0) error_log('New LP - update_lp action triggered', 0);
900
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; }
901
-        else {
967
+        if ($debug > 0) {
968
+            error_log('New LP - update_lp action triggered', 0);
969
+        }
970
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit', 0); require 'lp_list.php'; } else {
902 971
             $_SESSION['refresh'] = 1;
903 972
             $lp_name = Security::remove_XSS($_REQUEST['lp_name']);
904 973
             $_SESSION['oLP']->set_name($lp_name);
@@ -965,8 +1034,9 @@  discard block
 block discarded – undo
965 1034
             );
966 1035
             $extraFieldValue->saveFieldValues($_REQUEST);
967 1036
 
968
-            if ($_FILES['lp_preview_image']['size'] > 0)
969
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1037
+            if ($_FILES['lp_preview_image']['size'] > 0) {
1038
+                            $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1039
+            }
970 1040
 
971 1041
             if (api_get_setting('search_enabled') === 'true') {
972 1042
                 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -1006,9 +1076,10 @@  discard block
 block discarded – undo
1006 1076
         if (!$is_allowed_to_edit) {
1007 1077
             api_not_allowed(true);
1008 1078
         }
1009
-        if ($debug > 0) error_log('New LP - add sub item action triggered', 0);
1010
-        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; }
1011
-        else {
1079
+        if ($debug > 0) {
1080
+            error_log('New LP - add sub item action triggered', 0);
1081
+        }
1082
+        if (!$lp_found) { error_log('New LP - No learnpath given for add sub item', 0); require 'lp_list.php'; } else {
1012 1083
             $_SESSION['refresh'] = 1;
1013 1084
             if (!empty($_REQUEST['parent_item_id'])) {
1014 1085
                 $_SESSION['from_learnpath']='yes';
@@ -1024,9 +1095,10 @@  discard block
 block discarded – undo
1024 1095
         if (!$is_allowed_to_edit) {
1025 1096
             api_not_allowed(true);
1026 1097
         }
1027
-        if ($debug > 0) error_log('New LP - delete item action triggered', 0);
1028
-        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; }
1029
-        else {
1098
+        if ($debug > 0) {
1099
+            error_log('New LP - delete item action triggered', 0);
1100
+        }
1101
+        if (!$lp_found) { error_log('New LP - No learnpath given for delete item', 0); require 'lp_list.php'; } else {
1030 1102
             //$_SESSION['refresh'] = 1;
1031 1103
             if (!empty($_REQUEST['id'])) {
1032 1104
                 $_SESSION['oLP']->delete_item($_REQUEST['id']);
@@ -1041,9 +1113,10 @@  discard block
 block discarded – undo
1041 1113
         if (!$is_allowed_to_edit) {
1042 1114
             api_not_allowed(true);
1043 1115
         }
1044
-        if ($debug > 0) error_log('New LP - edit item prereq action triggered', 0);
1045
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
1046
-        else {
1116
+        if ($debug > 0) {
1117
+            error_log('New LP - edit item prereq action triggered', 0);
1118
+        }
1119
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
1047 1120
             if (!empty($_REQUEST['id']) && !empty($_REQUEST['submit_item'])) {
1048 1121
                 $_SESSION['refresh'] = 1;
1049 1122
                 $_SESSION['oLP']->edit_item_prereq($_REQUEST['id'], $_REQUEST['prereq']);
@@ -1052,64 +1125,80 @@  discard block
 block discarded – undo
1052 1125
         }
1053 1126
         break;
1054 1127
     case 'restart':
1055
-        if ($debug > 0) error_log('New LP - restart action triggered', 0);
1056
-        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; }
1057
-        else {
1128
+        if ($debug > 0) {
1129
+            error_log('New LP - restart action triggered', 0);
1130
+        }
1131
+        if (!$lp_found) { error_log('New LP - No learnpath given for restart', 0); require 'lp_list.php'; } else {
1058 1132
             $_SESSION['oLP']->restart();
1059 1133
             require 'lp_view.php';
1060 1134
         }
1061 1135
         break;
1062 1136
     case 'last':
1063
-        if ($debug > 0) error_log('New LP - last action triggered', 0);
1064
-        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; }
1065
-        else {
1137
+        if ($debug > 0) {
1138
+            error_log('New LP - last action triggered', 0);
1139
+        }
1140
+        if (!$lp_found) { error_log('New LP - No learnpath given for last', 0); require 'lp_list.php'; } else {
1066 1141
             $_SESSION['oLP']->last();
1067 1142
             require 'lp_view.php';
1068 1143
         }
1069 1144
         break;
1070 1145
     case 'first':
1071
-        if ($debug > 0) error_log('New LP - first action triggered', 0);
1072
-        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; }
1073
-        else {
1146
+        if ($debug > 0) {
1147
+            error_log('New LP - first action triggered', 0);
1148
+        }
1149
+        if (!$lp_found) { error_log('New LP - No learnpath given for first', 0); require 'lp_list.php'; } else {
1074 1150
             $_SESSION['oLP']->first();
1075 1151
             require 'lp_view.php';
1076 1152
         }
1077 1153
         break;
1078 1154
     case 'next':
1079
-        if ($debug > 0) error_log('New LP - next action triggered', 0);
1080
-        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; }
1081
-        else {
1155
+        if ($debug > 0) {
1156
+            error_log('New LP - next action triggered', 0);
1157
+        }
1158
+        if (!$lp_found) { error_log('New LP - No learnpath given for next', 0); require 'lp_list.php'; } else {
1082 1159
             $_SESSION['oLP']->next();
1083 1160
             require 'lp_view.php';
1084 1161
         }
1085 1162
         break;
1086 1163
     case 'previous':
1087
-        if ($debug > 0) error_log('New LP - previous action triggered', 0);
1088
-        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; }
1089
-        else {
1164
+        if ($debug > 0) {
1165
+            error_log('New LP - previous action triggered', 0);
1166
+        }
1167
+        if (!$lp_found) { error_log('New LP - No learnpath given for previous', 0); require 'lp_list.php'; } else {
1090 1168
             $_SESSION['oLP']->previous();
1091 1169
             require 'lp_view.php';
1092 1170
         }
1093 1171
         break;
1094 1172
     case 'content':
1095
-        if ($debug > 0) error_log('New LP - content action triggered', 0);
1096
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1173
+        if ($debug > 0) {
1174
+            error_log('New LP - content action triggered', 0);
1175
+        }
1176
+        if ($debug > 0) {
1177
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1178
+        }
1097 1179
         if (!$lp_found) {
1098 1180
             error_log('New LP - No learnpath given for content', 0);
1099 1181
             require 'lp_list.php';
1100 1182
         } else {
1101
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1183
+            if ($debug > 0) {
1184
+                error_log('New LP - save_last()', 0);
1185
+            }
1102 1186
             $_SESSION['oLP']->save_last();
1103
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1187
+            if ($debug > 0) {
1188
+                error_log('New LP - set_current_item()', 0);
1189
+            }
1104 1190
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1105
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1191
+            if ($debug > 0) {
1192
+                error_log('New LP - start_current_item()', 0);
1193
+            }
1106 1194
             $_SESSION['oLP']->start_current_item();
1107 1195
             require 'lp_content.php';
1108 1196
         }
1109 1197
         break;
1110 1198
     case 'view':
1111
-        if ($debug > 0)
1112
-            error_log('New LP - view action triggered', 0);
1199
+        if ($debug > 0) {
1200
+                    error_log('New LP - view action triggered', 0);
1201
+        }
1113 1202
         if (!$lp_found) {
1114 1203
             error_log('New LP - No learnpath given for view', 0);
1115 1204
             require 'lp_list.php';
@@ -1122,17 +1211,19 @@  discard block
 block discarded – undo
1122 1211
         }
1123 1212
         break;
1124 1213
     case 'save':
1125
-        if ($debug > 0) error_log('New LP - save action triggered', 0);
1126
-        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; }
1127
-        else {
1214
+        if ($debug > 0) {
1215
+            error_log('New LP - save action triggered', 0);
1216
+        }
1217
+        if (!$lp_found) { error_log('New LP - No learnpath given for save', 0); require 'lp_list.php'; } else {
1128 1218
             $_SESSION['oLP']->save_item();
1129 1219
             require 'lp_save.php';
1130 1220
         }
1131 1221
         break;
1132 1222
     case 'stats':
1133
-        if ($debug > 0) error_log('New LP - stats action triggered', 0);
1134
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1135
-        else {
1223
+        if ($debug > 0) {
1224
+            error_log('New LP - stats action triggered', 0);
1225
+        }
1226
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1136 1227
             $_SESSION['oLP']->save_current();
1137 1228
             $_SESSION['oLP']->save_last();
1138 1229
             $output = require 'lp_stats.php';
@@ -1140,7 +1231,9 @@  discard block
 block discarded – undo
1140 1231
         }
1141 1232
         break;
1142 1233
     case 'list':
1143
-        if ($debug > 0) error_log('New LP - list action triggered', 0);
1234
+        if ($debug > 0) {
1235
+            error_log('New LP - list action triggered', 0);
1236
+        }
1144 1237
         if ($lp_found) {
1145 1238
             $_SESSION['refresh'] = 1;
1146 1239
             $_SESSION['oLP']->save_last();
@@ -1149,7 +1242,9 @@  discard block
 block discarded – undo
1149 1242
         break;
1150 1243
     case 'mode':
1151 1244
         // Switch between fullscreen and embedded mode.
1152
-        if ($debug > 0) error_log('New LP - mode change triggered', 0);
1245
+        if ($debug > 0) {
1246
+            error_log('New LP - mode change triggered', 0);
1247
+        }
1153 1248
         $mode = $_REQUEST['mode'];
1154 1249
         if ($mode == 'fullscreen') {
1155 1250
             $_SESSION['oLP']->mode = 'fullscreen';
@@ -1163,7 +1258,9 @@  discard block
 block discarded – undo
1163 1258
         require 'lp_view.php';
1164 1259
         break;
1165 1260
     case 'switch_view_mode':
1166
-        if ($debug > 0) error_log('New LP - switch_view_mode action triggered', 0);
1261
+        if ($debug > 0) {
1262
+            error_log('New LP - switch_view_mode action triggered', 0);
1263
+        }
1167 1264
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1168 1265
         if (Security::check_token('get')) {
1169 1266
             $_SESSION['refresh'] = 1;
@@ -1172,7 +1269,9 @@  discard block
 block discarded – undo
1172 1269
         require 'lp_list.php';
1173 1270
         break;
1174 1271
     case 'switch_force_commit':
1175
-        if ($debug > 0) error_log('New LP - switch_force_commit action triggered', 0);
1272
+        if ($debug > 0) {
1273
+            error_log('New LP - switch_force_commit action triggered', 0);
1274
+        }
1176 1275
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1177 1276
         $_SESSION['refresh'] = 1;
1178 1277
         $_SESSION['oLP']->update_default_scorm_commit();
@@ -1195,25 +1294,33 @@  discard block
 block discarded – undo
1195 1294
 		break;
1196 1295
      */
1197 1296
 	case 'switch_attempt_mode':
1198
-		if($debug>0) error_log('New LP - switch_reinit action triggered',0);
1297
+		if($debug>0) {
1298
+		    error_log('New LP - switch_reinit action triggered',0);
1299
+		}
1199 1300
 		if(!$lp_found){ error_log('New LP - No learnpath given for switch',0); require 'lp_list.php'; }
1200 1301
 		$_SESSION['refresh'] = 1;
1201 1302
 		$_SESSION['oLP']->switch_attempt_mode();
1202 1303
         require 'lp_list.php';
1203 1304
         break;
1204 1305
     case 'switch_scorm_debug':
1205
-        if ($debug > 0) error_log('New LP - switch_scorm_debug action triggered', 0);
1306
+        if ($debug > 0) {
1307
+            error_log('New LP - switch_scorm_debug action triggered', 0);
1308
+        }
1206 1309
         if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; }
1207 1310
         $_SESSION['refresh'] = 1;
1208 1311
         $_SESSION['oLP']->update_scorm_debug();
1209 1312
         require 'lp_list.php';
1210 1313
         break;
1211 1314
     case 'intro_cmdAdd':
1212
-        if ($debug > 0) error_log('New LP - intro_cmdAdd action triggered', 0);
1315
+        if ($debug > 0) {
1316
+            error_log('New LP - intro_cmdAdd action triggered', 0);
1317
+        }
1213 1318
         // Add introduction section page.
1214 1319
         break;
1215 1320
     case 'js_api_refresh':
1216
-        if ($debug > 0) error_log('New LP - js_api_refresh action triggered', 0);
1321
+        if ($debug > 0) {
1322
+            error_log('New LP - js_api_refresh action triggered', 0);
1323
+        }
1217 1324
         if (!$lp_found) { error_log('New LP - No learnpath given for js_api_refresh', 0); require 'lp_message.php'; }
1218 1325
         if (isset($_REQUEST['item_id'])) {
1219 1326
             $htmlHeadXtra[] = $_SESSION['oLP']->get_js_info($_REQUEST['item_id']);
@@ -1221,8 +1328,7 @@  discard block
 block discarded – undo
1221 1328
         require 'lp_message.php';
1222 1329
         break;
1223 1330
     case 'return_to_course_homepage':
1224
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1225
-        else {
1331
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1226 1332
             $_SESSION['oLP']->save_current();
1227 1333
             $_SESSION['oLP']->save_last();
1228 1334
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1240,8 +1346,9 @@  discard block
 block discarded – undo
1240 1346
         require 'lp_list_search.php';
1241 1347
         break;
1242 1348
     case 'impress':
1243
-        if ($debug > 0)
1244
-            error_log('New LP - view action triggered', 0);
1349
+        if ($debug > 0) {
1350
+                    error_log('New LP - view action triggered', 0);
1351
+        }
1245 1352
         if (!$lp_found) {
1246 1353
             error_log('New LP - No learnpath given for view', 0);
1247 1354
             require 'lp_list.php';
@@ -1413,15 +1520,19 @@  discard block
 block discarded – undo
1413 1520
         ]);
1414 1521
         break;
1415 1522
     default:
1416
-        if ($debug > 0) error_log('New LP - default action triggered', 0);
1523
+        if ($debug > 0) {
1524
+            error_log('New LP - default action triggered', 0);
1525
+        }
1417 1526
         require 'lp_list.php';
1418 1527
         break;
1419 1528
 }
1420 1529
 
1421 1530
 if (!empty($_SESSION['oLP'])) {
1422 1531
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1423
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1424
-}
1532
+    if ($debug > 0) {
1533
+        error_log('New LP - lpobject is serialized in session', 0);
1534
+    }
1535
+    }
1425 1536
 
1426 1537
 if (!empty($redirectTo)) {
1427 1538
     header("Location: $redirectTo");
Please login to merge, or discard this patch.
main/newscorm/lp_add.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     Course admin section
69 69
     - all the functions not available for students - always available in this case (page only shown to admin)
70 70
 */
71
-if (isset($_SESSION['gradebook'])){
71
+if (isset($_SESSION['gradebook'])) {
72 72
     $gradebook = $_SESSION['gradebook'];
73 73
 }
74 74
 
75
-if (!empty($gradebook) && $gradebook=='view') {
76
-    $interbreadcrumb[]= array (
75
+if (!empty($gradebook) && $gradebook == 'view') {
76
+    $interbreadcrumb[] = array(
77 77
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
78 78
         'name' => get_lang('ToolGradebook')
79 79
     );
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 echo '<div class="actions">';
87 87
 echo '<a href="lp_controller.php?cidReq='.$_course['sysCode'].'">'.
88
-        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
88
+        Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
89 89
 echo '</div>';
90 90
 
91 91
 Display::display_normal_message(get_lang('AddLpIntro'), false);
@@ -119,22 +119,22 @@  discard block
 block discarded – undo
119 119
 
120 120
 // Start date
121 121
 $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
122
-$form->addElement('html','<div id="start_date_div" style="display:block;">');
122
+$form->addElement('html', '<div id="start_date_div" style="display:block;">');
123 123
 $form->addElement('DatePicker', 'publicated_on', get_lang('PublicationDate'));
124
-$form->addElement('html','</div>');
124
+$form->addElement('html', '</div>');
125 125
 
126 126
 //End date
127 127
 $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
128
-$form->addElement('html','<div id="end_date_div" style="display:none;">');
128
+$form->addElement('html', '<div id="end_date_div" style="display:none;">');
129 129
 $form->addElement('DatePicker', 'expired_on', get_lang('ExpirationDate'));
130
-$form->addElement('html','</div>');
130
+$form->addElement('html', '</div>');
131 131
 
132
-$form->addElement('html','</div>');
132
+$form->addElement('html', '</div>');
133 133
 
134
-$defaults['activate_start_date_check']  = 1;
134
+$defaults['activate_start_date_check'] = 1;
135 135
 
136 136
 $defaults['publicated_on'] = date('Y-m-d 08:00:00');
137
-$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400);
137
+$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400);
138 138
 
139 139
 $form->setDefaults($defaults);
140 140
 $form->addButtonCreate(get_lang('CreateLearningPath'));
Please login to merge, or discard this patch.
main/newscorm/audiorecorder.inc.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,11 +58,11 @@
 block discarded – undo
58 58
 if (!empty($path_to_lzx)) {
59 59
     $recorder_content = sprintf("<object type=\"application/x-shockwave-flash\" data=\"%s\" ".
60 60
             "width='$width' height='$height'>".
61
-             "<param name=\"movie\" value=\"%s\">".
62
-         "<param name=\"quality\" value=\"high\">".
63
-         "<param name=\"scale\" value=\"noscale\">".
64
-         "<param name=\"salign\" value=\"LT\">".
65
-         "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
61
+                "<param name=\"movie\" value=\"%s\">".
62
+            "<param name=\"quality\" value=\"high\">".
63
+            "<param name=\"scale\" value=\"noscale\">".
64
+            "<param name=\"salign\" value=\"LT\">".
65
+            "<param name=\"menu\" value=\"false\"></object>", $path_to_lzx, $path_to_lzx);
66 66
     if ($audio_recorder_studentview == 'false') {
67 67
         echo '<script type="text/javascript">
68 68
         function show_audiorecorder() {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 if ($audio_recorder_studentview == 'false') {
32 32
     $width = 295;
33
-    $height= 90;
33
+    $height = 90;
34 34
     $player = 'recorder2.swf';
35 35
     $server = (api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? 'rtmpt://' : 'rtmp://').api_get_setting('service_visio', 'visio_host').':'.(api_get_setting('service_visio', 'visio_use_rtmpt') == 'true' ? '80' : api_get_setting('service_visio', 'visio_port')).'/recorder';
36 36
     $post_uri = urlencode($web_path.'conference/audiopost.php?course_code='.api_get_course_id().'&user_id='.api_get_user_id().'&checker='.md5(api_get_course_id().api_get_user_id().gmdate('Ymd').$_configuration['security_key']));
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $player = 'player2.swf';
43 43
     $cp = api_get_course_path();
44 44
     $docs = Database::get_course_table(TABLE_DOCUMENT);
45
-    $select = "SELECT * FROM $docs " .
46
-            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' " .
45
+    $select = "SELECT * FROM $docs ".
46
+            " WHERE c_id = $course_id AND path like BINARY '/audio/lpi".intval($audio_recorder_item_id)."-%' AND filetype='file' ".
47 47
             " ORDER BY path DESC";
48 48
     $res = Database::query($select);
49 49
     if (Database::num_rows($res) > 0) {
Please login to merge, or discard this patch.