Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/lp/storageapi.php 1 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.
main/lp/lp_content.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
 // Define the 'doc.inc.php' as language file.
107 107
 $nameTools = $_SESSION['oLP']->get_name();
108 108
 $interbreadcrumb[] = array(
109
-    'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_list.php?'.api_get_cidreq(),
109
+    'url' => api_get_path(WEB_CODE_PATH).'lp/lp_list.php?'.api_get_cidreq(),
110 110
     'name' => get_lang('Doc'),
111 111
 );
112 112
 // Update global setting to avoid displaying right menu.
Please login to merge, or discard this patch.
main/lp/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/lp/lp_report.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 // View
108 108
 $interbreadcrumb[] = [
109
-    'url' => api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq(),
109
+    'url' => api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq(),
110 110
     'name' => get_lang('LearningPaths')
111 111
 ];
112 112
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         array(),
118 118
         ICON_SIZE_MEDIUM
119 119
     ),
120
-    api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq()
120
+    api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq()
121 121
 );
122 122
 
123 123
 $template = new Template(get_lang('StudentScore'));
Please login to merge, or discard this patch.
main/lp/aiccItem.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
         $abs_order++;
118 118
         $i = 1;
119 119
         foreach ($this->sub_items as $id => $dummy) {
120
-            $oSubitem =& $this->sub_items[$id];
120
+            $oSubitem = & $this->sub_items[$id];
121 121
             $oSubitem->get_flat_list($list, $abs_order, $i, $level + 1);
122 122
             $i++;
123 123
         }
Please login to merge, or discard this patch.
main/lp/lp_subscribe_users.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
163 163
     exit;
164 164
 } else {
165 165
     $headers = [get_lang('SubscribeUsersToLp'), get_lang('SubscribeGroupsToLp')];
166
-    $tabs = Display::tabs($headers, [$formUsers->toHtml(),$form->toHtml()]);
166
+    $tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
167 167
     $tpl->assign('tabs', $tabs);
168 168
 }
169 169
 
Please login to merge, or discard this patch.
main/lp/scormOrganization.class.php 1 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/lp/aicc.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class aicc extends learnpath
13 13
 {
14 14
     public $config = array();
15
-    public $config_basename = '';	// The configuration files might be multiple and might have
15
+    public $config_basename = ''; // The configuration files might be multiple and might have
16 16
                                     // funny names. We need to keep the name of that file while we
17 17
                                     // install the content.
18 18
     public $config_files = array();
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     public $cstlist = array();
33 33
     public $orelist = array();
34 34
 
35
-    public $subdir = '';	// Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
-    public $zipname = '';	// Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
-    public $lastzipnameindex = 0;	// Keeps an index of the number of uses of the zipname so far.
35
+    public $subdir = ''; // Path between the scorm/ directory and the config files e.g. maritime_nav/maritime_nav. This is the path that will be used in the lp_path when importing a package.
36
+    public $zipname = ''; // Keeps the zipfile safe for the object's life so that we can use it if there is no title available.
37
+    public $lastzipnameindex = 0; // Keeps an index of the number of uses of the zipname so far.
38 38
     public $config_encoding = 'ISO-8859-1';
39 39
     public $debug = 0;
40 40
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             //echo '<pre>des:'.print_r($des_params, true).'</pre>';
133 133
             if ($this->debug > 1) { error_log('New LP - In aicc::parse_config_files() - '.$des_file.' has been parsed', 0); }
134 134
             // Distribute des params into the aicc object.
135
-            foreach ($des_params as $des){
135
+            foreach ($des_params as $des) {
136 136
                 // One AU in AICC is equivalent to one SCO in SCORM (scormItem class).
137 137
                 $oDes = new aiccResource('config', $des);
138 138
                 $this->deslist[$oDes->identifier] = $oDes;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 
243 243
         $this->config_encoding = "ISO-8859-1"; // TODO: We may apply detection for this value, see the function api_detect_encoding().
244 244
 
245
-        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)" .
246
-                "VALUES " .
247
-                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."'," .
248
-                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."'," .
245
+        $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib, content_maker,display_order)".
246
+                "VALUES ".
247
+                "($course_id, 3, '".$this->course_title."', '".$this->course_id."','".$this->course_description."',".
248
+                "'".$this->subdir."', 0, 'embedded', '".$this->config_encoding."',".
249 249
                 "'aicc_api.php','".$this->course_creator."',$dsp)";
250
-        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '. $sql, 0); }
250
+        if ($this->debug > 2) { error_log('New LP - In import_aicc(), inserting path: '.$sql, 0); }
251 251
         Database::query($sql);
252 252
         $lp_id = Database::insert_id();
253 253
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
         $previous = 0;
278 278
         foreach ($this->aulist as $identifier => $dummy) {
279
-            $oAu =& $this->aulist[$identifier];
279
+            $oAu = & $this->aulist[$identifier];
280 280
             //echo "Item ".$oAu->identifier;
281 281
             $field_add = '';
282 282
             $value_add = '';
@@ -294,12 +294,12 @@  discard block
 block discarded – undo
294 294
             $parent = 0; // TODO: Deal with the parent.
295 295
             $previous = 0;
296 296
             $prereq = $oAu->prereq_string;
297
-            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) " .
298
-                    "VALUES " .
299
-                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."'," .
300
-                    "'$path',0,100, $value_add" .
301
-                    "$parent, $previous, 0, " .
302
-                    "'$prereq', 0,'".(!empty($oAu->parameters)?Database::escape_string($oAu->parameters):'')."'" .
297
+            $sql_item = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,parameters) ".
298
+                    "VALUES ".
299
+                    "($course_id, $lp_id, 'au','".$oAu->identifier."','".$title."',".
300
+                    "'$path',0,100, $value_add".
301
+                    "$parent, $previous, 0, ".
302
+                    "'$prereq', 0,'".(!empty($oAu->parameters) ? Database::escape_string($oAu->parameters) : '')."'".
303 303
                     ")";
304 304
             Database::query($sql_item);
305 305
             if ($this->debug > 1) { error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : ', 0); }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         $zip_file_name = $zip_file_info['name'];
351 351
 
352 352
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); }
353
-        $course_rel_dir  = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
353
+        $course_rel_dir = api_get_course_path().'/scorm'; // Scorm dir web path starting from /courses
354 354
         $course_sys_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path of this course.
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Base file name is : '.$file_base_name, 0); }
368 368
         $new_dir = api_replace_dangerous_char(trim($file_base_name));
369 369
         $this->subdir = $new_dir;
370
-        if($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
370
+        if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Subdir is first set to : '.$this->subdir, 0); }
371 371
 
372 372
         /*
373 373
         if (check_name_exist($course_sys_dir.$current_dir.'/'.$new_dir)) {
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
                         $subdir_isset = true;
414 414
                     } else {
415 415
                         if (!$subdir_isset) {
416
-                            if (preg_match('?^.*/aicc$?i',dirname($thisContent['filename']))) {
416
+                            if (preg_match('?^.*/aicc$?i', dirname($thisContent['filename']))) {
417 417
                                 //echo "Cutting subdir<br/>";
418 418
                                 $this->subdir .= '/'.substr(dirname($thisContent['filename']), 0, -5);
419 419
                             } else {
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
517 517
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
518 518
                         $find_str = array('\\', '.php', '.phtml');
519
-                        $repl_str = array('/',  '.txt', '.txt');
519
+                        $repl_str = array('/', '.txt', '.txt');
520 520
                         $safe_file = str_replace($find_str, $repl_str, $file);
521 521
 
522 522
                         if ($safe_file != $file) {
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
         if ($this->debug > 0) { error_log('In aicc::get_res_path('.$id.') method', 0); }
718 718
         $path = '';
719 719
         if (isset($this->resources[$id])) {
720
-            $oRes =& $this->resources[$id];
720
+            $oRes = & $this->resources[$id];
721 721
             $path = @$oRes->get_path();
722 722
         }
723 723
         return $path;
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
         if ($this->debug > 0) { error_log('In aicc::get_res_type('.$id.') method', 0); }
734 734
         $type = '';
735 735
         if (isset($this->resources[$id])) {
736
-            $oRes =& $this->resources[$id];
736
+            $oRes = & $this->resources[$id];
737 737
             $temptype = $oRes->get_scorm_type();
738 738
             if (!empty($temptype)) {
739 739
                 $type = $temptype;
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
      * Gets the default organisation's title
747 747
      * @return	string	The organization's title
748 748
      */
749
-    function get_title(){
749
+    function get_title() {
750 750
         if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); }
751 751
         $title = '';
752 752
         if (isset($this->config['organizations']['default'])) {
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
             $chr = $data{$i};
908 908
             switch ($chr) {
909 909
                 case $enclosure:
910
-                    if ($enclosed && $data{$i+1} == $enclosure) {
910
+                    if ($enclosed && $data{$i + 1} == $enclosure) {
911 911
                         $fldval .= $chr;
912 912
                         ++$i; // Skip the next character.
913 913
                     } else
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
                         $fldval .= $chr;
922 922
                     break;
923 923
                 case "\r":
924
-                    if (!$enclosed&&$data{$i+1} == "\n")
924
+                    if (!$enclosed && $data{$i + 1} == "\n")
925 925
                         continue;
926 926
                 case "\n":
927 927
                     if (!$enclosed) {
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
                         $fldval .= $chr;
933 933
                     break;
934 934
                 case "\\r":
935
-                    if (!$enclosed&&$data{$i+1} == "\\n")
935
+                    if (!$enclosed && $data{$i + 1} == "\\n")
936 936
                         continue;
937 937
                 case "\\n":
938 938
                     if (!$enclosed) {
Please login to merge, or discard this patch.
main/lp/aicc_api.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -78,33 +78,33 @@  discard block
 block discarded – undo
78 78
 var commit = false ;
79 79
 
80 80
 // Strictly SCORM variables.
81
-var score=<?php echo $oItem->get_score();?>;
82
-var max=<?php echo $oItem->get_max();?>;
83
-var min=<?php echo $oItem->get_min();?>;
84
-var lesson_status='<?php echo $oItem->get_status();?>';
85
-var session_time='<?php echo $oItem->get_scorm_time('js');?>';
86
-var suspend_data = '<?php echo $oItem->get_suspend_data();?>';
87
-var lesson_location = '<?php echo $oItem->get_lesson_location();?>';
88
-var total_time = '<?php echo $oItem->get_scorm_time('js');?>';
81
+var score=<?php echo $oItem->get_score(); ?>;
82
+var max=<?php echo $oItem->get_max(); ?>;
83
+var min=<?php echo $oItem->get_min(); ?>;
84
+var lesson_status='<?php echo $oItem->get_status(); ?>';
85
+var session_time='<?php echo $oItem->get_scorm_time('js'); ?>';
86
+var suspend_data = '<?php echo $oItem->get_suspend_data(); ?>';
87
+var lesson_location = '<?php echo $oItem->get_lesson_location(); ?>';
88
+var total_time = '<?php echo $oItem->get_scorm_time('js'); ?>';
89 89
 
90 90
 // Chamilo internal variables.
91 91
 var saved_lesson_status = 'not attempted';
92
-var lms_lp_id = <?php echo $oLP->get_id();?>;
93
-var lms_item_id = <?php echo $oItem->get_id();?>;
92
+var lms_lp_id = <?php echo $oLP->get_id(); ?>;
93
+var lms_item_id = <?php echo $oItem->get_id(); ?>;
94 94
 //var lms_new_item_id = 0; //temporary value (only there between a load_item() and a LMSInitialize())
95 95
 var lms_been_synchronized = 0;
96 96
 var lms_initialized = 0;
97 97
 var lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
98
-var lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>;
99
-var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>';
98
+var lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>;
99
+var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>';
100 100
 if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
101
-var lms_view_id = '<?php echo $oLP->get_view();?>';
101
+var lms_view_id = '<?php echo $oLP->get_view(); ?>';
102 102
 if(lms_view_id == ''){ lms_view_id = 1;}
103
-var lms_user_id = '<?php echo $_user['user_id'];?>';
104
-var lms_next_item = '<?php echo $oLP->get_next_item_id();?>';
105
-var lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>';
106
-var lms_lp_type = '<?php echo $oLP->get_type();?>';
107
-var lms_item_type = '<?php echo $oItem->get_type();?>';
103
+var lms_user_id = '<?php echo $_user['user_id']; ?>';
104
+var lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
105
+var lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
106
+var lms_lp_type = '<?php echo $oLP->get_type(); ?>';
107
+var lms_item_type = '<?php echo $oItem->get_type(); ?>';
108 108
 
109 109
 // Backup for old values.
110 110
 var old_score = 0;
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
     }else if(param == 'cmi.core.lesson_mode'){
163 163
         result='normal';
164 164
     }else if(param == 'cmi.suspend_data'){
165
-        result='<?php echo $oItem->get_suspend_data();?>';
165
+        result='<?php echo $oItem->get_suspend_data(); ?>';
166 166
     }else if(param == 'cmi.launch_data'){
167 167
         result='';
168 168
     }else if(param == 'cmi.objectives._count'){
169
-        result='<?php echo $oItem->get_view_count();?>';
169
+        result='<?php echo $oItem->get_view_count(); ?>';
170 170
     }
171 171
     /*
172 172
     // Switch not working??? WTF???
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
             result='normal';
228 228
             break;
229 229
         case 'cmi.suspend_data'		:
230
-            result='<?php echo $oItem->get_suspend_data();?>';
230
+            result='<?php echo $oItem->get_suspend_data(); ?>';
231 231
             break;
232 232
         case 'cmi.launch_data'		:
233 233
             result='';
234 234
             break;
235 235
         case 'cmi.objectives._count':
236
-            result='<?php echo $oItem->get_view_count();?>';
236
+            result='<?php echo $oItem->get_view_count(); ?>';
237 237
             break;
238 238
         default 					:
239 239
             result='';
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     $url = $_SERVER['HTTP_HOST'].$self;
286 286
     $url = substr($url, 0, -14); // 14 is the length of this file's name (/scorm_api.php).
287 287
     echo $url;
288
-    ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id();?>&" + param + "";
288
+    ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id(); ?>&" + param + "";
289 289
     logit_lms('saving data (status='+lesson_status+')',1);
290 290
     xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location);
291 291
     //xajax_update_pgs();
Please login to merge, or discard this patch.