Completed
Pull Request — 1.11.x (#1700)
by José
28:48
created
main/lp/aicc.class.php 4 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     /**
217 217
      * Import the aicc object (as a result from the parse_config_files function) into the database structure
218 218
      * @param	string	$course_code
219
-     * @return	bool	Returns -1 on error
219
+     * @return	false|null	Returns -1 on error
220 220
      */
221 221
     public function import_aicc($course_code)
222 222
     {
@@ -780,7 +780,8 @@  discard block
 block discarded – undo
780 780
      * Static function to parse AICC ini files.
781 781
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
782 782
      * @param	string	File path
783
-     * @return	array	Structured array
783
+     * @param string $f
784
+     * @return	string	Structured array
784 785
      */
785 786
     function parse_ini_file_quotes_safe($f) {
786 787
         $null = '';
@@ -831,7 +832,7 @@  discard block
 block discarded – undo
831 832
      * Based on work by sinedeo at gmail dot com published on php.net (parse_ini_file()).
832 833
      * @param		string	INI File string
833 834
      * @param		array	List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case
834
-     * @return	array	Structured array
835
+     * @return	string	Structured array
835 836
      */
836 837
     function parse_ini_string_quotes_safe($s, $pure_strings = array()) {
837 838
         $null = '';
@@ -894,6 +895,7 @@  discard block
 block discarded – undo
894 895
      * @param	string	CSV delimiter
895 896
      * @param	string	CSV enclosure
896 897
      * @param	boolean	Might one field name happen more than once on the same line? (then split by comma in the values)
898
+     * @param string $f
897 899
      * @return array	Simple structured array
898 900
      */
899 901
     function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false) {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
         }
321 321
     }
322 322
 
323
-     /**
324
-     * Intermediate to import_package only to allow import from local zip files
325
-     * @param	string	Path to the zip file, from the dokeos sys root
326
-     * @param	string	Current path (optional)
327
-     * @return string	Absolute path to the AICC description files or empty string on error
328
-     */
323
+        /**
324
+         * Intermediate to import_package only to allow import from local zip files
325
+         * @param	string	Path to the zip file, from the dokeos sys root
326
+         * @param	string	Current path (optional)
327
+         * @return string	Absolute path to the AICC description files or empty string on error
328
+         */
329 329
     function import_local_package($file_path, $current_dir = '')
330 330
     {
331 331
         // TODO: Prepare info as given by the $_FILES[''] vector.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
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); }
357 357
 
358
-         //$uploaded_filename = $_FILES['userFile']['name'];
358
+            //$uploaded_filename = $_FILES['userFile']['name'];
359 359
         // Get the name of the zip file without the extension.
360 360
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); }
361 361
         $file_info = pathinfo($zip_file_name);
Please login to merge, or discard this 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.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -509,7 +509,9 @@  discard block
 block discarded – undo
509 509
                     if ($file != '.' && $file != '..') {
510 510
                         $filetype = 'file';
511 511
 
512
-                        if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder';
512
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
513
+                            $filetype = 'folder';
514
+                        }
513 515
 
514 516
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
515 517
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
@@ -908,37 +910,43 @@  discard block
 block discarded – undo
908 910
                     if ($enclosed && $data{$i+1} == $enclosure) {
909 911
                         $fldval .= $chr;
910 912
                         ++$i; // Skip the next character.
911
-                    } else
912
-                        $enclosed = !$enclosed;
913
+                    } else {
914
+                                            $enclosed = !$enclosed;
915
+                    }
913 916
                     break;
914 917
                 case $delim:
915 918
                     if (!$enclosed) {
916 919
                         $ret_array[$linecount][$fldcount++] = $fldval;
917 920
                         $fldval = '';
918
-                    } else
919
-                        $fldval .= $chr;
921
+                    } else {
922
+                                            $fldval .= $chr;
923
+                    }
920 924
                     break;
921 925
                 case "\r":
922
-                    if (!$enclosed&&$data{$i+1} == "\n")
923
-                        continue;
926
+                    if (!$enclosed&&$data{$i+1} == "\n") {
927
+                                            continue;
928
+                    }
924 929
                 case "\n":
925 930
                     if (!$enclosed) {
926 931
                         $ret_array[$linecount++][$fldcount] = $fldval;
927 932
                         $fldcount = 0;
928 933
                         $fldval = '';
929
-                    } else
930
-                        $fldval .= $chr;
934
+                    } else {
935
+                                            $fldval .= $chr;
936
+                    }
931 937
                     break;
932 938
                 case "\\r":
933
-                    if (!$enclosed&&$data{$i+1} == "\\n")
934
-                        continue;
939
+                    if (!$enclosed&&$data{$i+1} == "\\n") {
940
+                                            continue;
941
+                    }
935 942
                 case "\\n":
936 943
                     if (!$enclosed) {
937 944
                         $ret_array[$linecount++][$fldcount] = $fldval;
938 945
                         $fldcount = 0;
939 946
                         $fldval = '';
940
-                    } else
941
-                        $fldval .= $chr;
947
+                    } else {
948
+                                            $fldval .= $chr;
949
+                    }
942 950
                     break;
943 951
                 default:
944 952
                     $fldval .= $chr;
Please login to merge, or discard this patch.
main/lp/learnpathList.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      * @param   int     $categoryId
35 35
      * @param bool $ignoreCategoryFilter
36 36
      *
37
-     * @return	void
37
+     * @return	false|null
38 38
      */
39 39
     public function __construct(
40 40
         $user_id,
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
             // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
120 120
             // is done using domesticate()
121 121
             $name = domesticate($row->getName());
122
-            $link = 'lp/lp_controller.php?action=view&lp_id=' . $row->getId() . '&id_session='.$session_id;
123
-            $oldLink = 'newscorm/lp_controller.php?action=view&lp_id=' . $row->getId() . '&id_session='.$session_id;
122
+            $link = 'lp/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
123
+            $oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
124 124
 
125 125
             $sql2 = "SELECT * FROM $tbl_tool
126 126
                      WHERE
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
         $lessons = array();
227 227
         while ($row = Database::fetch_array($result)) {
228
-            if (api_get_item_visibility($course, 'learnpath', $row['id'],  $session_id)) {
228
+            if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
229 229
                 $lessons[$row['id']] = $row;
230 230
             }
231 231
         }
Please login to merge, or discard this patch.
main/lp/lp_ajax_save_item.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
  * @param   int $user_id User ID
21 21
  * @param   int $view_id View ID
22 22
  * @param   int $item_id Item ID
23
- * @param   float  $score Current score
24
- * @param   float  $max Maximum score
25
- * @param   float  $min Minimum score
23
+ * @param   integer  $score Current score
24
+ * @param   integer  $max Maximum score
25
+ * @param   integer  $min Minimum score
26 26
  * @param   string  $status Lesson status
27 27
  * @param   int  $time Session time
28 28
  * @param   string  $suspend Suspend data
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -458,7 +458,7 @@
 block discarded – undo
458 458
     }
459 459
 
460 460
     if ($myLP->get_type() == 2) {
461
-         $return .= "update_stats();";
461
+            $return .= "update_stats();";
462 462
     }
463 463
 
464 464
     // To be sure progress is updated.
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // Set status to completed for hotpotatoes if score > 80%.
164 164
         if ($my_type == 'hotpotatoes') {
165 165
             if ((empty($status) || $status == 'undefined' || $status == 'not attempted') && $max > 0) {
166
-                if (($score/$max) > 0.8) {
166
+                if (($score / $max) > 0.8) {
167 167
                     $myStatus = 'completed';
168 168
                     if ($debug > 1) {
169 169
                         error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                         error_log('Done calling set_status for hotpotatoes - now '.$myLPI->get_status(false), 0);
175 175
                     }
176 176
                 }
177
-            } elseif ($status == 'completed' && $max > 0 && ($score/$max) < 0.8) {
177
+            } elseif ($status == 'completed' && $max > 0 && ($score / $max) < 0.8) {
178 178
                 $myStatus = 'failed';
179 179
                 if ($debug > 1) {
180 180
                     error_log('Calling set_status('.$myStatus.') for hotpotatoes', 0);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $myLPI->current_data = $suspend;
368 368
         }
369 369
 
370
-        if (isset($location) && $location != '' && $location!='undefined') {
370
+        if (isset($location) && $location != '' && $location != 'undefined') {
371 371
             $myLPI->set_lesson_location($location);
372 372
         }
373 373
 
Please login to merge, or discard this patch.
main/lp/scorm.class.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * @param int $userMaxScore
272 272
      * @param int $sessionId
273 273
      *
274
-     * @return bool	Returns -1 on error
274
+     * @return boolean|null	Returns -1 on error
275 275
      */
276 276
     public function import_manifest($courseCode, $userMaxScore = 1, $sessionId = 0, $userId = 0)
277 277
     {
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
      * @param	string	course Code
926 926
      * @param string	LP ID (in database)
927 927
      * @param string	Manifest file path (optional if lp_id defined)
928
-     * @return	integer	New LP ID or false on failure
928
+     * @return	boolean	New LP ID or false on failure
929 929
      * TODO @TODO Implement imsmanifest_path parameter
930 930
      */
931 931
     public function reimport_manifest($courseCode, $lp_id = null, $imsmanifest_path = '')
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                 $path = '';
394 394
                 $type = 'dir';
395 395
                 if (isset($this->resources[$item['identifierref']])) {
396
-                    $oRes =& $this->resources[$item['identifierref']];
396
+                    $oRes = & $this->resources[$item['identifierref']];
397 397
                     $path = @$oRes->get_path();
398 398
                     if (!empty($path)) {
399 399
                         $temptype = $oRes->get_scorm_type();
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
                 $item['parameters'] = Database::escape_string($item['parameters']);
445 445
 
446 446
                 $sql = "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,launch_data, parameters)
447
-                        VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'] .", '".$item['datafromlms']."', '".$item['parameters']."' )";
447
+                        VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'].", '".$item['datafromlms']."', '".$item['parameters']."' )";
448 448
 
449 449
                 Database::query($sql);
450 450
                 if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting item : '.$sql, 0); }
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                     foreach ($specific_fields as $specific_field) {
479 479
                         if (isset($_REQUEST[$specific_field['code']])) {
480 480
                             $sterms = trim($_REQUEST[$specific_field['code']]);
481
-                            $all_specific_terms .= ' '. $sterms;
481
+                            $all_specific_terms .= ' '.$sterms;
482 482
                             if (!empty($sterms)) {
483 483
                                 $sterms = explode(',', $sterms);
484 484
                                 foreach ($sterms as $sterm) {
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                             }
488 488
                         }
489 489
                     }
490
-                    $body_to_index = $all_specific_terms .' '. $title;
490
+                    $body_to_index = $all_specific_terms.' '.$title;
491 491
                     $ic_slide->addValue("content", $body_to_index);
492 492
                     // TODO: Add a comment to say terms separated by commas.
493 493
                     $courseid = api_get_course_id();
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
                         SE_COURSE_ID => $courseid,
498 498
                         SE_TOOL_ID => TOOL_LEARNPATH,
499 499
                         SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => ''), // TODO: Unify with other lp types.
500
-                        SE_USER => (int)api_get_user_id(),
500
+                        SE_USER => (int) api_get_user_id(),
501 501
                     );
502 502
                     $ic_slide->xapian_data = serialize($xapian_data);
503 503
                     $di->addChunk($ic_slide);
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
     public function import_package($zip_file_info, $current_dir = '', $courseInfo = array())
544 544
     {
545 545
         if ($this->debug > 0) {
546
-            error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method', 0);
546
+            error_log('In scorm::import_package('.print_r($zip_file_info, true).',"'.$current_dir.'") method', 0);
547 547
         }
548 548
 
549 549
         $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
         $zip_file_name = $zip_file_info['name'];
555 555
 
556 556
         if ($this->debug > 1) {
557
-            error_log('New LP - import_package() - zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0);
557
+            error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0);
558 558
         }
559 559
 
560 560
         $course_rel_dir = api_get_course_path($courseInfo['code']).'/scorm'; // scorm dir web path starting from /courses
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
563 563
 
564 564
         if ($this->debug > 1) {
565
-            error_log( 'New LP - import_package() - current_dir = ' . $current_dir, 0);
565
+            error_log('New LP - import_package() - current_dir = '.$current_dir, 0);
566 566
         }
567 567
 
568 568
         // Get name of the zip file without the extension.
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
         $file_info = pathinfo($zip_file_name);
571 571
         $filename = $file_info['basename'];
572 572
         $extension = $file_info['extension'];
573
-        $file_base_name = str_replace('.'.$extension,'',$filename); // Filename without its extension.
573
+        $file_base_name = str_replace('.'.$extension, '', $filename); // Filename without its extension.
574 574
         $this->zipname = $file_base_name; // Save for later in case we don't have a title.
575 575
 
576 576
         if ($this->debug > 1) { error_log("New LP - base file name is : ".$file_base_name, 0); }
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $slash_count = substr_count($shortest_path, '/');
617 617
         foreach ($manifest_list as $manifest_path) {
618 618
             $tmp_slash_count = substr_count($manifest_path, '/');
619
-            if ($tmp_slash_count<$slash_count) {
619
+            if ($tmp_slash_count < $slash_count) {
620 620
                 $shortest_path = $manifest_path;
621 621
                 $slash_count = $tmp_slash_count;
622 622
             }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
         $this->subdir .= '/'.dirname($shortest_path); // Do not concatenate because already done above.
626 626
         $manifest = $shortest_path;
627 627
         if ($this->debug > 1) { error_log('New LP - Package type is now '.$package_type, 0); }
628
-        if ($package_type== '') {
628
+        if ($package_type == '') {
629 629
             // && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM)
630 630
             if ($this->debug > 1) { error_log('New LP - Package type is empty', 0); }
631 631
 
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
             $new_dir = '/'.$new_dir;
651 651
         }
652 652
 
653
-        if ($new_dir[strlen($new_dir)-1] == '/') {
654
-            $new_dir = substr($new_dir,0,-1);
653
+        if ($new_dir[strlen($new_dir) - 1] == '/') {
654
+            $new_dir = substr($new_dir, 0, -1);
655 655
         }
656 656
 
657 657
         /* Uncompressing phase */
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
                     if ($file != '.' && $file != '..') {
693 693
                         $filetype = 'file';
694 694
 
695
-                        if (is_dir($course_sys_dir . $new_dir . $file)) {
695
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
696 696
                             $filetype = 'folder';
697 697
                         }
698 698
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                                     }
722 722
                                 }
723 723
                             }
724
-                            @rename($course_sys_dir.$new_dir.$file,$course_sys_dir.$new_dir.$safe_file);
724
+                            @rename($course_sys_dir.$new_dir.$file, $course_sys_dir.$new_dir.$safe_file);
725 725
                             if ($this->debug >= 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); }
726 726
                         }
727 727
                     }
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
         if ($this->debug > 0) { error_log('In scorm::get_res_path('.$id.') method', 0); }
909 909
         $path = '';
910 910
         if (isset($this->resources[$id])) {
911
-            $oRes =& $this->resources[$id];
911
+            $oRes = & $this->resources[$id];
912 912
             $path = @$oRes->get_path();
913 913
         }
914 914
         return $path;
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         if ($this->debug > 0) { error_log('In scorm::get_res_type('.$id.') method', 0); }
925 925
         $type = '';
926 926
         if (isset($this->resources[$id])) {
927
-            $oRes =& $this->resources[$id];
927
+            $oRes = & $this->resources[$id];
928 928
             $temptype = $oRes->get_scorm_type();
929 929
             if (!empty($temptype)) {
930 930
                 $type = $temptype;
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
         $title = '';
944 944
         if (isset($this->manifest['organizations']['default'])) {
945 945
             $title = $this->organizations[$this->manifest['organizations']['default']]->get_name();
946
-        } elseif (count($this->organizations)==1) {
946
+        } elseif (count($this->organizations) == 1) {
947 947
             // This will only get one title but so we don't need to know the index.
948
-            foreach($this->organizations as $id => $value) {
948
+            foreach ($this->organizations as $id => $value) {
949 949
                 $title = $this->organizations[$id]->get_name();
950 950
                 break;
951 951
             }
Please login to merge, or discard this patch.
main/lp/lp_move_item.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,10 +47,10 @@
 block discarded – undo
47 47
 " .
48 48
 "\n" .
49 49
 '$().ready(function() {'."\n" .
50
-  'if ($(\'#previous\')) {'."\n" .
50
+    'if ($(\'#previous\')) {'."\n" .
51 51
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
52
-      'load_cbo($(\'#idParent\').val());'."\n" .
53
-  '}}'."\n" .
52
+        'load_cbo($(\'#idParent\').val());'."\n" .
53
+    '}}'."\n" .
54 54
 '});</script>'."\n" ;
55 55
 
56 56
 /* Constants and variables */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 /* Header and action code */
19 19
 $htmlHeadXtra[] = '<script>'.
20
-$_SESSION['oLP']->get_js_dropdown_array() .
20
+$_SESSION['oLP']->get_js_dropdown_array().
21 21
 "
22 22
     function load_cbo(id) {
23 23
         if (!id) {
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
         $('#previous').selectpicker('refresh');
42 42
     }
43 43
 " .
44
-"\n" .
45
-'$().ready(function() {'."\n" .
46
-  'if ($(\'#previous\')) {'."\n" .
44
+"\n".
45
+'$().ready(function() {'."\n".
46
+  'if ($(\'#previous\')) {'."\n".
47 47
     'if(\'parent is\'+$(\'#idParent\').val()) {'.
48
-      'load_cbo($(\'#idParent\').val());'."\n" .
49
-  '}}'."\n" .
50
-'});</script>'."\n" ;
48
+      'load_cbo($(\'#idParent\').val());'."\n".
49
+  '}}'."\n".
50
+'});</script>'."\n";
51 51
 
52 52
 /* Constants and variables */
53 53
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 /* SHOWING THE ADMIN TOOLS */
82 82
 
83 83
 if (isset($_SESSION['gradebook'])) {
84
-    $gradebook=	$_SESSION['gradebook'];
84
+    $gradebook = $_SESSION['gradebook'];
85 85
 }
86 86
 
87 87
 if (!empty($gradebook) && $gradebook == 'view') {
88
-    $interbreadcrumb[] = array (
88
+    $interbreadcrumb[] = array(
89 89
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
90 90
         'name' => get_lang('ToolGradebook')
91 91
     );
Please login to merge, or discard this patch.
main/lp/scormResource.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
                         }
70 70
                     }
71 71
                     //$keep_href = '';
72
-                    if ($element->hasAttributes()){ //in some cases we get here with an empty attributes array
72
+                    if ($element->hasAttributes()) { //in some cases we get here with an empty attributes array
73 73
                         // TODO: Find when and why we get such a case (empty array).
74 74
                         $attributes = $element->attributes;
75 75
                         foreach ($attributes as $attrib) {
Please login to merge, or discard this patch.
main/lp/blank.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 Display::display_reduced_header();
17 17
 
18 18
 if (isset($_GET['error'])) {
19
-    switch ($_GET['error']){
19
+    switch ($_GET['error']) {
20 20
         case 'document_deleted':
21 21
             echo '<br /><br />';
22 22
             Display::display_error_message(get_lang('DocumentHasBeenDeleted'));
Please login to merge, or discard this patch.
main/lp/scorm_api.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -458,8 +458,8 @@
 block discarded – undo
458 458
     } else if(param == 'cmi.core.student_name'){
459 459
         // ---- cmi.core.student_name
460 460
         <?php
461
-          $who = addslashes($user['complete_name']);
462
-          echo "result='$who';";
461
+            $who = addslashes($user['complete_name']);
462
+            echo "result='$who';";
463 463
         ?>
464 464
     } else if(param == 'cmi.core.lesson_location'){
465 465
         // ---- cmi.core.lesson_location
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 require_once __DIR__.'/../inc/global.inc.php';
27 27
 
28
-$file   = (empty($_SESSION['file'])?'':$_SESSION['file']);
28
+$file = (empty($_SESSION['file']) ? '' : $_SESSION['file']);
29 29
 /** @var learnpath $oLP */
30 30
 $oLP = unserialize($_SESSION['lpobject']);
31 31
 /** @var learnpathItem $oItem */
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 header('Content-type: text/javascript');
43 43
 
44
-?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin()) )?'0':'3');?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
44
+?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin())) ? '0' : '3'); ?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
45 45
 var lms_logs = 0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
46 46
 
47 47
 // API Object initialization (eases access later on)
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 olms.statusSignalReceived = 0;
145 145
 
146 146
 // Strictly scorm variables
147
-olms.score=<?php echo $oItem->get_score();?>;
148
-olms.max='<?php echo $oItem->get_max();?>';
149
-olms.min='<?php echo $oItem->get_min();?>';
150
-olms.lesson_status='<?php echo $oItem->get_status();?>';
151
-olms.session_time='<?php echo $oItem->get_scorm_time('js');?>';
152
-olms.suspend_data = '<?php echo $oItem->get_suspend_data();?>';
153
-olms.lesson_location = '<?php echo $oItem->get_lesson_location();?>';
154
-olms.total_time = '<?php echo $oItem->get_scorm_time('js');?>';
155
-olms.mastery_score = '<?php echo $oItem->get_mastery_score();?>';
147
+olms.score=<?php echo $oItem->get_score(); ?>;
148
+olms.max='<?php echo $oItem->get_max(); ?>';
149
+olms.min='<?php echo $oItem->get_min(); ?>';
150
+olms.lesson_status='<?php echo $oItem->get_status(); ?>';
151
+olms.session_time='<?php echo $oItem->get_scorm_time('js'); ?>';
152
+olms.suspend_data = '<?php echo $oItem->get_suspend_data(); ?>';
153
+olms.lesson_location = '<?php echo $oItem->get_lesson_location(); ?>';
154
+olms.total_time = '<?php echo $oItem->get_scorm_time('js'); ?>';
155
+olms.mastery_score = '<?php echo $oItem->get_mastery_score(); ?>';
156 156
 olms.launch_data = '<?php echo $oItem->get_launch_data(); ?>';
157
-olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed();?>';
158
-olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array();?>);
157
+olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed(); ?>';
158
+olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array(); ?>);
159 159
 olms.item_objectives = new Array();
160 160
 olms.info_lms_item = new Array();
161 161
 
162 162
 // Chamilo internal variables (not SCORM)
163 163
 // olms.saved_lesson_status = 'not attempted';
164
-olms.lms_lp_id = <?php echo $oLP->get_id();?>;
165
-olms.lms_item_id = <?php echo $oItem->get_id();?>;
164
+olms.lms_lp_id = <?php echo $oLP->get_id(); ?>;
165
+olms.lms_item_id = <?php echo $oItem->get_id(); ?>;
166 166
 olms.lms_initialized = 0;
167 167
 // switch_finished indicates if the switch process is finished (if it has gone
168 168
 // through LMSInitialize() for the new item. Until then, all LMSSetValue()
@@ -171,26 +171,26 @@  discard block
 block discarded – undo
171 171
 olms.switch_finished = 0;
172 172
 
173 173
 //olms.lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
174
-//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>;
175
-//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>';
174
+//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>;
175
+//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>';
176 176
 //if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
177 177
 
178
-olms.lms_view_id = '<?php echo $oLP->get_view();?>';
178
+olms.lms_view_id = '<?php echo $oLP->get_view(); ?>';
179 179
 if(olms.lms_view_id == ''){ olms.lms_view_id = 1;}
180
-olms.lms_user_id = '<?php echo $userId;?>';
181
-olms.lms_next_item = '<?php echo $oLP->get_next_item_id();?>';
182
-olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>';
183
-olms.lms_lp_type = '<?php echo $oLP->get_type();?>';
184
-olms.lms_item_type = '<?php echo $oItem->get_type();?>';
185
-olms.lms_item_credit = '<?php echo $oItem->get_credit();?>';
186
-olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode();?>';
187
-olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data());?>';
188
-olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit();?>';
180
+olms.lms_user_id = '<?php echo $userId; ?>';
181
+olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
182
+olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
183
+olms.lms_lp_type = '<?php echo $oLP->get_type(); ?>';
184
+olms.lms_item_type = '<?php echo $oItem->get_type(); ?>';
185
+olms.lms_item_credit = '<?php echo $oItem->get_credit(); ?>';
186
+olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode(); ?>';
187
+olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data()); ?>';
188
+olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit(); ?>';
189 189
 olms.lms_course_id = '<?php echo $oLP->get_course_int_id(); ?>';
190 190
 olms.lms_session_id = '<?php echo api_get_session_id(); ?>';
191 191
 olms.lms_course_code = '<?php echo $oLP->getCourseCode(); ?>';
192 192
 olms.lms_course_id =  '<?php echo $oLP->get_course_int_id(); ?>';
193
-<?php echo $oLP->get_items_details_as_js('olms.lms_item_types');?>
193
+<?php echo $oLP->get_items_details_as_js('olms.lms_item_types'); ?>
194 194
 
195 195
 // Following definition of cmi.core.score.raw in SCORM 1.2, "LMS should
196 196
 // initialize this to an empty string ("") upon initial launch of a SCO. The
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
     logit_scorm('Other SCORM calls are shown in orange.', 1);
228 228
     logit_lms('To add new messages to these logs, use logit_lms() or logit_scorm().');
229 229
 
230
-    olms.info_lms_item[0] = '<?php echo $oItem->get_id();?>';
231
-    olms.info_lms_item[1] = '<?php echo $oItem->get_id();?>';
230
+    olms.info_lms_item[0] = '<?php echo $oItem->get_id(); ?>';
231
+    olms.info_lms_item[1] = '<?php echo $oItem->get_id(); ?>';
232 232
 
233 233
     $("#content_id").load(function() {
234 234
         logit_lms('#content_id load event starts');
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         result = 'id,score,status';
500 500
     } else if(param == 'cmi.objectives._count'){
501 501
     // ---- cmi.objectives._count
502
-        //result='<?php echo $oItem->get_view_count();?>';
502
+        //result='<?php echo $oItem->get_view_count(); ?>';
503 503
         result = olms.item_objectives.length;
504 504
     } else if(param.substring(0,15)== 'cmi.objectives.'){
505 505
         var myres = '';
Please login to merge, or discard this patch.
main/lp/content_makers.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
     'Accent',
14 14
     'Accenture',
15 15
     'ADLNet',
16
-      'Articulate',
17
-      'ATutor',
18
-      'Blackboard',
19
-      'Calfat',
20
-      'Captivate',
16
+        'Articulate',
17
+        'ATutor',
18
+        'Blackboard',
19
+        'Calfat',
20
+        'Captivate',
21 21
     'Chamilo',
22 22
     'Chamilo 2',
23 23
     'Claroline',
Please login to merge, or discard this patch.