Passed
Push — 1.10.x ( aeb152...c6d0a9 )
by Yannick
176:52 queued 127:28
created
main/newscorm/lp_controller.php 1 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.
main/newscorm/lp_final_item.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 $_in_course = true;
4 4
 require_once '../inc/global.inc.php';
5
-$current_course_tool  = TOOL_GRADEBOOK;
5
+$current_course_tool = TOOL_GRADEBOOK;
6 6
 
7 7
 api_protect_course_script(true);
8 8
 
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 
33 33
 if ($link) {
34 34
     $cat = new Category();
35
-    $catCourseCode     = CourseManager::get_course_by_category($categoryId);
36
-    $show_message  = $cat->show_message_resource_delete($catCourseCode);
35
+    $catCourseCode = CourseManager::get_course_by_category($categoryId);
36
+    $show_message = $cat->show_message_resource_delete($catCourseCode);
37 37
 
38 38
     if ($show_message == '') {
39 39
         if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 $userId
43 43
             );
44 44
             if (isset($certificate['pdf_url']) && isset($certificate['certificate_link'])) {
45
-                $downloadCertificateLink .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') .
45
+                $downloadCertificateLink .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o').
46 46
                     get_lang('DownloadCertificatePdf'),
47 47
                     $certificate['pdf_url'],
48 48
                     ['class' => 'btn btn-default']
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 3 patches
Doc Comments   +30 added lines, -26 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param	string	$course Course code
85 85
      * @param	integer	$lp_id
86 86
      * @param	integer	$user_id
87
-     * @return mixed True on success, false on error
87
+     * @return boolean True on success, false on error
88 88
      */
89 89
     public function __construct($course, $lp_id, $user_id)
90 90
     {
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
      * @param int $max_time_allowed
486 486
      * @param int $userId
487 487
      *
488
-     * @return int
488
+     * @return false|string
489 489
      */
490 490
     public function add_item(
491 491
         $parent,
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
      * @param	array $courseInfo
1037 1037
      * @param	integer	Learnpath ID
1038 1038
      * @param	string	Whether to delete data or keep it (default: 'keep', others: 'remove')
1039
-     * @return	boolean	True on success, false on failure (might change that to return number of elements deleted)
1039
+     * @return	false|null	True on success, false on failure (might change that to return number of elements deleted)
1040 1040
      */
1041 1041
     public function delete($courseInfo = null, $id = null, $delete = 'keep')
1042 1042
     {
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
      * @param	integer	$id Elem ID (0 if first)
1171 1171
      * @param	integer	$remove Whether to remove the resource/data from the
1172 1172
      * system or leave it (default: 'keep', others 'remove')
1173
-     * @return	integer	Number of elements moved
1173
+     * @return	false|null	Number of elements moved
1174 1174
      * @todo implement resource removal
1175 1175
      */
1176 1176
     public function delete_item($id, $remove = 'keep')
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
      * @param   array   $audio The array resulting of the $_FILES[mp3] element
1253 1253
      * @param   int     $max_time_allowed
1254 1254
      * @param   string  $url
1255
-     * @return  boolean True on success, false on error
1255
+     * @return  false|null True on success, false on error
1256 1256
      */
1257 1257
     public function edit_item(
1258 1258
         $id,
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
     /**
1777 1777
      * Gets the first element URL.
1778
-     * @return	string	URL to load into the viewer
1778
+     * @return	false|null	URL to load into the viewer
1779 1779
      */
1780 1780
     public function first()
1781 1781
     {
@@ -2291,6 +2291,7 @@  discard block
 block discarded – undo
2291 2291
      * @param int $student_id
2292 2292
      * @param string Course code (optional)
2293 2293
      * @param int $sessionId
2294
+     * @param string $courseCode
2294 2295
      * @return	bool
2295 2296
      */
2296 2297
     public static function is_lp_visible_for_student(
@@ -2590,7 +2591,7 @@  discard block
 block discarded – undo
2590 2591
 
2591 2592
     /**
2592 2593
      * Gets the learnpath session id
2593
-     * @return	string	Learnpath theme
2594
+     * @return	integer	Learnpath theme
2594 2595
      */
2595 2596
     public function get_lp_session_id()
2596 2597
     {
@@ -2623,7 +2624,7 @@  discard block
 block discarded – undo
2623 2624
     /**
2624 2625
      * @param string $size
2625 2626
      * @param string $path_type
2626
-     * @return bool|string
2627
+     * @return string|false
2627 2628
      */
2628 2629
     public function get_preview_image_path($size = null, $path_type = 'web')
2629 2630
     {
@@ -2769,6 +2770,8 @@  discard block
 block discarded – undo
2769 2770
      * Returns the XML DOM document's node
2770 2771
      * @param	resource	Reference to a list of objects to search for the given ITEM_*
2771 2772
      * @param	string		The identifier to look for
2773
+     * @param DOMNodeList $children
2774
+     * @param string $id
2772 2775
      * @return	mixed		The reference to the element found with that identifier. False if not found
2773 2776
      */
2774 2777
     public function get_scorm_xml_node(& $children, $id)
@@ -3016,7 +3019,7 @@  discard block
 block discarded – undo
3016 3019
     /**
3017 3020
      * Generate and return the table of contents for this learnpath. The (flat) table returned can be
3018 3021
      * used by get_html_toc() to be ready to display
3019
-     * @return	array	TOC as a table with 4 elements per row: title, link, status and level
3022
+     * @return	boolean	TOC as a table with 4 elements per row: title, link, status and level
3020 3023
      */
3021 3024
     public function get_toc()
3022 3025
     {
@@ -3152,7 +3155,7 @@  discard block
 block discarded – undo
3152 3155
     }
3153 3156
 
3154 3157
     /**
3155
-     * @return array
3158
+     * @return string[]
3156 3159
      */
3157 3160
     public static function getChapterTypes()
3158 3161
     {
@@ -4054,7 +4057,7 @@  discard block
 block discarded – undo
4054 4057
      * Open a resource = initialise all local variables relative to this resource. Depending on the child
4055 4058
      * class, this might be redefined to allow several behaviours depending on the document type.
4056 4059
      * @param integer Resource ID
4057
-     * @return boolean True on success, false otherwise
4060
+     * @return boolean|null True on success, false otherwise
4058 4061
      */
4059 4062
     public function open($id)
4060 4063
     {
@@ -4183,7 +4186,7 @@  discard block
 block discarded – undo
4183 4186
      * Can be used as abstract
4184 4187
      * @param	integer	$lp_id Learnpath id
4185 4188
      * @param	string	$set_visibility New visibility (v/i - visible/invisible)
4186
-     * @return bool
4189
+     * @return false|null
4187 4190
      */
4188 4191
     public static function toggle_publish($lp_id, $set_visibility = 'v')
4189 4192
     {
@@ -4268,7 +4271,7 @@  discard block
 block discarded – undo
4268 4271
      * Make sure the results are saved with anoter method. This method should probably be
4269 4272
      * redefined in children classes.
4270 4273
      * To use a similar method  statically, use the create_new_attempt() method
4271
-     * @return string URL to load in the viewer
4274
+     * @return boolean URL to load in the viewer
4272 4275
      */
4273 4276
     public function restart()
4274 4277
     {
@@ -4346,6 +4349,7 @@  discard block
 block discarded – undo
4346 4349
      * Saves the given item
4347 4350
      * @param	integer	$item_id. Optional (will take from $_REQUEST if null)
4348 4351
      * @param	boolean	$from_outside Save from url params (true) or from current attributes (false). Optional. Defaults to true
4352
+     * @param integer $item_id
4349 4353
      * @return	boolean
4350 4354
      */
4351 4355
     public function save_item($item_id = null, $from_outside = true)
@@ -4843,7 +4847,7 @@  discard block
 block discarded – undo
4843 4847
 
4844 4848
     /**
4845 4849
      * Sets use_max_score
4846
-     * @param   string  $use_max_score Optional string giving the new location of this learnpath
4850
+     * @param   integer  $use_max_score Optional string giving the new location of this learnpath
4847 4851
      * @return  boolean True on success / False on error
4848 4852
      */
4849 4853
     public function set_use_max_score($use_max_score = 1)
@@ -5244,6 +5248,7 @@  discard block
 block discarded – undo
5244 5248
      * Register the attempt mode into db thanks to flags prevent_reinit and seriousgame_mode flags
5245 5249
      *
5246 5250
      * @param string 'seriousgame', 'single' or 'multiple'
5251
+     * @param string $mode
5247 5252
      * @return boolean
5248 5253
      * @author ndiechburg <[email protected]>
5249 5254
      **/
@@ -5286,7 +5291,7 @@  discard block
 block discarded – undo
5286 5291
     /**
5287 5292
      * Switch between multiple attempt, single attempt or serious_game mode (only for scorm)
5288 5293
      *
5289
-     * @return boolean
5294
+     * @return boolean|null
5290 5295
      * @author ndiechburg <[email protected]>
5291 5296
      **/
5292 5297
     public function switch_attempt_mode()
@@ -5477,7 +5482,6 @@  discard block
 block discarded – undo
5477 5482
     /**
5478 5483
      * Function that creates a html list of learning path items so that we can add audio files to them
5479 5484
      * @author Kevin Van Den Haute
5480
-     * @param int $lp_id
5481 5485
      * @return string
5482 5486
      */
5483 5487
     public function overview()
@@ -5852,7 +5856,7 @@  discard block
 block discarded – undo
5852 5856
     /**
5853 5857
      * This function builds the action menu
5854 5858
      * @param bool $returnContent
5855
-     * @return void
5859
+     * @return string|null
5856 5860
      */
5857 5861
     public function build_action_menu($returnContent = false)
5858 5862
     {
@@ -6371,7 +6375,7 @@  discard block
 block discarded – undo
6371 6375
     /**
6372 6376
      * Function that displays a list with al the resources that
6373 6377
      * could be added to the learning path
6374
-     * @return string
6378
+     * @return boolean
6375 6379
      */
6376 6380
     public function display_resources()
6377 6381
     {
@@ -8875,7 +8879,7 @@  discard block
 block discarded – undo
8875 8879
 
8876 8880
     /**
8877 8881
      * Creates a list with all the student publications in it
8878
-     * @return unknown
8882
+     * @return string
8879 8883
      */
8880 8884
     public function get_student_publications()
8881 8885
     {
@@ -9827,7 +9831,7 @@  discard block
 block discarded – undo
9827 9831
 
9828 9832
     /**
9829 9833
      * @param int $lp_id
9830
-     * @return bool
9834
+     * @return false|null
9831 9835
      */
9832 9836
     public function scorm_export_to_pdf($lp_id)
9833 9837
     {
@@ -10344,6 +10348,7 @@  discard block
 block discarded – undo
10344 10348
     }
10345 10349
 
10346 10350
     /**
10351
+     * @param string $courseCode
10347 10352
      * @return \learnpath
10348 10353
      */
10349 10354
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
@@ -10363,7 +10368,7 @@  discard block
 block discarded – undo
10363 10368
 
10364 10369
     /**
10365 10370
      * @param int $itemId
10366
-     * @return learnpathItem|false
10371
+     * @return string
10367 10372
      */
10368 10373
     public function getItem($itemId)
10369 10374
     {
@@ -10413,7 +10418,6 @@  discard block
 block discarded – undo
10413 10418
     /**
10414 10419
      * Set whether this is a learning path with the possibility to subscribe
10415 10420
      * users or not
10416
-     * @param int $subscribeUsers (0 = false, 1 = true)
10417 10421
      */
10418 10422
     public function setSubscribeUsers($value)
10419 10423
     {
@@ -10538,7 +10542,7 @@  discard block
 block discarded – undo
10538 10542
 
10539 10543
     /**
10540 10544
      * Get the item of exercise type (evaluation type)
10541
-     * @return array The final evaluation. Otherwise return false
10545
+     * @return integer The final evaluation. Otherwise return false
10542 10546
      */
10543 10547
     public function getFinalEvaluationItem()
10544 10548
     {
@@ -10762,7 +10766,7 @@  discard block
 block discarded – undo
10762 10766
     /**
10763 10767
      * Create a forum for this learning path
10764 10768
      * @param type $forumCategoryId
10765
-     * @return int The forum ID if was created. Otherwise return false
10769
+     * @return false|string The forum ID if was created. Otherwise return false
10766 10770
      */
10767 10771
     public function createForum($forumCategoryId)
10768 10772
     {
@@ -10811,7 +10815,7 @@  discard block
 block discarded – undo
10811 10815
     /**
10812 10816
      * Get the LP Final Item Template
10813 10817
      *
10814
-     * @return html
10818
+     * @return string
10815 10819
      */
10816 10820
     private function getFinalItemTemplate()
10817 10821
     {
@@ -10834,7 +10838,7 @@  discard block
 block discarded – undo
10834 10838
     /**
10835 10839
      * Get the LP Final Item form
10836 10840
      *
10837
-     * @return html
10841
+     * @return string
10838 10842
      */
10839 10843
     public function getFinalItemForm()
10840 10844
     {
Please login to merge, or discard this patch.
Spacing   +621 added lines, -621 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     // Percentage progress as saved in the db.
54 54
     public $progress_db = '0';
55 55
     public $proximity; // Wether the content is distant or local or unknown.
56
-    public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match.
56
+    public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match.
57 57
     // !!!This array (refs_list) is built differently depending on the nature of the LP.
58 58
     // If SCORM, uses ref, if Chamilo, uses id to keep a unique value.
59 59
     public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ...
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                 }
155 155
 
156 156
                 if ($row['expired_on'] != '0000-00-00 00:00:00') {
157
-                    $this->expired_on  = $row['expired_on'];
157
+                    $this->expired_on = $row['expired_on'];
158 158
                 }
159 159
                 if ($this->type == 2) {
160 160
                     if ($row['force_commit'] == 1) {
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
                 ORDER BY view_count DESC";
199 199
         $res = Database::query($sql);
200 200
         if ($this->debug > 2) {
201
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0);
201
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0);
202 202
         }
203 203
 
204 204
         if (Database :: num_rows($res) > 0) {
205 205
             if ($this->debug > 2) {
206
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0);
206
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0);
207 207
             }
208 208
             $row = Database :: fetch_array($res);
209 209
             $this->attempt = $row['view_count'];
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             $this->lp_view_session_id = $row['session_id'];
214 214
         } else if (!api_is_invitee()) {
215 215
             if ($this->debug > 2) {
216
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0);
216
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0);
217 217
             }
218 218
             $this->attempt = 1;
219 219
             $params = [
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
             $this->lp_view_id = Database::insert_id();
229 229
 
230 230
             if ($this->debug > 2) {
231
-                error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0);
231
+                error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0);
232 232
             }
233 233
 
234 234
             $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $res = Database::query($sql);
244 244
 
245 245
         if ($this->debug > 2) {
246
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
246
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
247 247
             error_log('-- Start while--', 0);
248 248
         }
249 249
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
                         $this->refs_list[$oItem->ref] = $my_item_id;
264 264
                         if ($this->debug > 2) {
265 265
                             error_log(
266
-                                'New LP - learnpath::__construct() - ' .
267
-                                'aicc object with id ' . $my_item_id .
266
+                                'New LP - learnpath::__construct() - '.
267
+                                'aicc object with id '.$my_item_id.
268 268
                                 ' set in items[]',
269 269
                                 0
270 270
                             );
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 
284 284
                         $this->refs_list[$oItem->ref] = $my_item_id;
285 285
                         if ($this->debug > 2) {
286
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
286
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
287 287
                         }
288 288
                     }
289 289
                     break;
290 290
                 case 1:
291 291
                 default:
292 292
                     if ($this->debug > 2) {
293
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
293
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
294 294
                     }
295 295
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
296 296
 
297 297
                     if ($this->debug > 2) {
298
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
298
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
299 299
                     }
300 300
                     if (is_object($oItem)) {
301 301
                         $my_item_id = $oItem->get_id();
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
                         $this->refs_list[$my_item_id] = $my_item_id;
307 307
                         if ($this->debug > 2) {
308 308
                             error_log(
309
-                                'New LP - learnpath::__construct() ' . __LINE__ .
310
-                                ' - object with id ' . $my_item_id . ' set in items[]',
309
+                                'New LP - learnpath::__construct() '.__LINE__.
310
+                                ' - object with id '.$my_item_id.' set in items[]',
311 311
                                 0);
312 312
                         }
313 313
                     }
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
326 326
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
327 327
                     $this->items[$row['id']]->current_start_time = 0;
328
-                    $this->items[$row['id']]->current_stop_time	= 0;
328
+                    $this->items[$row['id']]->current_stop_time = 0;
329 329
                 }
330 330
             }
331 331
         }
332 332
 
333 333
         if ($this->debug > 2) {
334
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
334
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
335 335
         }
336 336
 
337 337
         if (!empty($lp_item_id_list)) {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
         // TODO: Define the current item better.
424 424
         $this->first();
425 425
         if ($this->debug > 2) {
426
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
426
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
427 427
         }
428 428
         return true;
429 429
     }
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     ) {
501 501
         $course_id = $this->course_info['real_id'];
502 502
         if ($this->debug > 0) {
503
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
503
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
504 504
         }
505 505
         if (empty($course_id)) {
506 506
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                 FROM $tbl_lp_item
523 523
                 WHERE
524 524
                     c_id = $course_id AND
525
-                    lp_id = " . $this->get_id() . " AND
525
+                    lp_id = ".$this->get_id()." AND
526 526
                     parent_item_id = " . $parent;
527 527
 
528 528
         $res_count = Database::query($sql);
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
         if ($num > 0) {
533 533
             if ($previous == 0) {
534 534
                 $sql = "SELECT id, next_item_id, display_order
535
-                        FROM " . $tbl_lp_item . "
535
+                        FROM " . $tbl_lp_item."
536 536
                         WHERE
537 537
                             c_id = $course_id AND
538
-                            lp_id = " . $this->get_id() . " AND
539
-                            parent_item_id = " . $parent . " AND
538
+                            lp_id = ".$this->get_id()." AND
539
+                            parent_item_id = " . $parent." AND
540 540
                             previous_item_id = 0 OR
541 541
                             previous_item_id=" . $parent;
542 542
                 $result = Database::query($sql);
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 						FROM $tbl_lp_item
552 552
                         WHERE
553 553
                             c_id = $course_id AND
554
-                            lp_id = " . $this->get_id() . " AND
554
+                            lp_id = ".$this->get_id()." AND
555 555
                             id = " . $previous;
556 556
 
557 557
                 $result = Database::query($sql);
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
         $typeCleaned = Database::escape_string($type);
572 572
         if ($type == 'quiz') {
573 573
             $sql = 'SELECT SUM(ponderation)
574
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
575
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
574
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
575
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
576 576
                     ON
577 577
                         quiz_question.id = quiz_rel_question.question_id AND
578 578
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         $new_item_id = Database::insert($tbl_lp_item, $params);
619 619
 
620 620
         if ($this->debug > 2) {
621
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
621
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
622 622
         }
623 623
 
624 624
         if ($new_item_id) {
@@ -635,28 +635,28 @@  discard block
 block discarded – undo
635 635
             Database::query($sql);
636 636
 
637 637
             // Update all the items after the new item.
638
-            $sql = "UPDATE " . $tbl_lp_item . "
638
+            $sql = "UPDATE ".$tbl_lp_item."
639 639
                         SET display_order = display_order + 1
640 640
                     WHERE
641 641
                         c_id = $course_id AND
642
-                        lp_id = " . $this->get_id() . " AND
643
-                        id <> " . $new_item_id . " AND
644
-                        parent_item_id = " . $parent . " AND
642
+                        lp_id = ".$this->get_id()." AND
643
+                        id <> " . $new_item_id." AND
644
+                        parent_item_id = " . $parent." AND
645 645
                         display_order > " . $display_order;
646 646
             Database::query($sql);
647 647
 
648 648
             // Update the item that should come after the new item.
649
-            $sql = "UPDATE " . $tbl_lp_item . "
650
-                    SET ref = " . $new_item_id . "
651
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
649
+            $sql = "UPDATE ".$tbl_lp_item."
650
+                    SET ref = " . $new_item_id."
651
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
652 652
             Database::query($sql);
653 653
 
654 654
             // Upload audio.
655 655
             if (!empty($_FILES['mp3']['name'])) {
656 656
                 // Create the audio folder if it does not exist yet.
657
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
658
-                if (!is_dir($filepath . 'audio')) {
659
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
657
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
658
+                if (!is_dir($filepath.'audio')) {
659
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
660 660
                     $audio_id = add_document(
661 661
                         $_course,
662 662
                         '/audio',
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
                 $file_path = handle_uploaded_document(
700 700
                     $_course,
701 701
                     $_FILES['mp3'],
702
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
702
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
703 703
                     '/audio',
704 704
                     $userId,
705 705
                     '',
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 
716 716
                 // Store the mp3 file in the lp_item table.
717 717
                 $sql = "UPDATE $tbl_lp_item SET
718
-                            audio = '" . Database::escape_string($file) . "'
719
-                        WHERE id = '" . intval($new_item_id) . "'";
718
+                            audio = '".Database::escape_string($file)."'
719
+                        WHERE id = '" . intval($new_item_id)."'";
720 720
                 Database::query($sql);
721 721
             }
722 722
         }
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
         while (Database :: num_rows($res_name)) {
796 796
             // There is already one such name, update the current one a bit.
797 797
             $i++;
798
-            $name = $name . ' - ' . $i;
798
+            $name = $name.' - '.$i;
799 799
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
800 800
             $res_name = Database::query($check_name);
801 801
         }
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
                 // if $item points to an object and there is a parent.
908 908
                 if ($debug) {
909 909
                     error_log(
910
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
910
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
911 911
                         0
912 912
                     );
913 913
                 }
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
                         if ($childItemId != $item) {
936 936
                             if ($debug) {
937 937
                                 error_log(
938
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
938
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
939 939
                                     0
940 940
                                 );
941 941
                             }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
                             } else {
956 956
                                 if ($debug > 2) {
957 957
                                     error_log(
958
-                                        'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
958
+                                        'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id,
959 959
                                         0
960 960
                                     );
961 961
                                 }
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
         // Delete lp item id.
1061 1061
         foreach ($this->items as $id => $dummy) {
1062 1062
             $sql = "DELETE FROM $lp_item_view
1063
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1063
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1064 1064
             Database::query($sql);
1065 1065
         }
1066 1066
 
1067 1067
         // Proposed by Christophe (nickname: clefevre)
1068
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1068
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1069 1069
         Database::query($sql);
1070 1070
 
1071
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1071
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1072 1072
         Database::query($sql);
1073 1073
 
1074 1074
         self::toggle_publish($this->lp_id, 'i');
@@ -1076,32 +1076,32 @@  discard block
 block discarded – undo
1076 1076
         if ($this->type == 2 || $this->type == 3) {
1077 1077
             // This is a scorm learning path, delete the files as well.
1078 1078
             $sql = "SELECT path FROM $lp
1079
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1079
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1080 1080
             $res = Database::query($sql);
1081 1081
             if (Database :: num_rows($res) > 0) {
1082 1082
                 $row = Database :: fetch_array($res);
1083 1083
                 $path = $row['path'];
1084 1084
                 $sql = "SELECT id FROM $lp
1085
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1085
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1086 1086
                 $res = Database::query($sql);
1087 1087
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1088 1088
                     if ($this->debug > 2) {
1089
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1089
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1090 1090
                     }
1091 1091
                 } else {
1092 1092
                     // No other LP uses that directory, delete it.
1093
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1094
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1095
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1093
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1094
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1095
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1096 1096
                         if ($this->debug > 2) {
1097
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1097
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1098 1098
                         }
1099 1099
                         // Proposed by Christophe (clefevre).
1100 1100
                         if (strcmp(substr($path, -2), "/.") == 0) {
1101 1101
                             $path = substr($path, 0, -1); // Remove "." at the end.
1102 1102
                         }
1103 1103
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1104
-                        rmdirr($course_scorm_dir . $path);
1104
+                        rmdirr($course_scorm_dir.$path);
1105 1105
                     }
1106 1106
                 }
1107 1107
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1115 1115
         Database::query($sql);
1116 1116
 
1117
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1117
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1118 1118
         Database::query($sql);
1119 1119
         // Updates the display order of all lps.
1120 1120
         $this->update_display_order();
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
             api_get_user_id()
1128 1128
         );
1129 1129
 
1130
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1130
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1131 1131
         if ($link_info !== false) {
1132 1132
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1133 1133
         }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
     {
1148 1148
         $course_id = $this->course_info['real_id'];
1149 1149
         if ($this->debug > 0) {
1150
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1150
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1151 1151
         }
1152 1152
         $num = 0;
1153 1153
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         $res = Database::query($sql);
1159 1159
         while ($row = Database :: fetch_array($res)) {
1160 1160
             $num += $this->delete_children_items($row['id']);
1161
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1161
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1162 1162
             Database::query($sql_del);
1163 1163
             $num++;
1164 1164
         }
@@ -1199,12 +1199,12 @@  discard block
 block discarded – undo
1199 1199
         // Delete children items.
1200 1200
         $num = $this->delete_children_items($id);
1201 1201
         if ($this->debug > 2) {
1202
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1202
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1203 1203
         }
1204 1204
         // Now delete the item.
1205 1205
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1206 1206
         if ($this->debug > 2) {
1207
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1207
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1208 1208
         }
1209 1209
         Database::query($sql_del);
1210 1210
         // Now update surrounding items.
@@ -1279,15 +1279,15 @@  discard block
 block discarded – undo
1279 1279
         }
1280 1280
 
1281 1281
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1282
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1282
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1283 1283
         $res_select = Database::query($sql_select);
1284 1284
         $row_select = Database :: fetch_array($res_select);
1285 1285
         $audio_update_sql = '';
1286 1286
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1287 1287
             // Create the audio folder if it does not exist yet.
1288
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1289
-            if (!is_dir($filepath . 'audio')) {
1290
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1288
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1289
+            if (!is_dir($filepath.'audio')) {
1290
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1291 1291
                 $audio_id = add_document(
1292 1292
                     $_course,
1293 1293
                     '/audio',
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
             $pi = pathinfo($audio['name']);
1326 1326
             if ($pi['extension'] == 'mp3') {
1327 1327
                 $c_det = api_get_course_info($this->cc);
1328
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1328
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1329 1329
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1330 1330
                 $path = substr($path, 7);
1331 1331
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1332
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1332
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1333 1333
             }
1334 1334
         }
1335 1335
 
@@ -1339,13 +1339,13 @@  discard block
 block discarded – undo
1339 1339
         // TODO: htmlspecialchars to be checked for encoding related problems.
1340 1340
         if ($same_parent && $same_previous) {
1341 1341
             // Only update title and description.
1342
-            $sql = "UPDATE " . $tbl_lp_item . "
1343
-                    SET title = '" . Database::escape_string($title) . "',
1344
-                        prerequisite = '" . $prerequisites . "',
1345
-                        description = '" . Database::escape_string($description) . "'
1346
-                        " . $audio_update_sql . ",
1347
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1348
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1342
+            $sql = "UPDATE ".$tbl_lp_item."
1343
+                    SET title = '" . Database::escape_string($title)."',
1344
+                        prerequisite = '" . $prerequisites."',
1345
+                        description = '" . Database::escape_string($description)."'
1346
+                        " . $audio_update_sql.",
1347
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1348
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1349 1349
             Database::query($sql);
1350 1350
         } else {
1351 1351
             $old_parent = $row_select['parent_item_id'];
@@ -1360,27 +1360,27 @@  discard block
 block discarded – undo
1360 1360
 
1361 1361
             if ($old_previous != 0) {
1362 1362
                 // Next
1363
-                $sql = "UPDATE " . $tbl_lp_item . "
1364
-                        SET next_item_id = " . $old_next . "
1365
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1363
+                $sql = "UPDATE ".$tbl_lp_item."
1364
+                        SET next_item_id = " . $old_next."
1365
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1366 1366
                 Database::query($sql);
1367 1367
             }
1368 1368
 
1369 1369
             if ($old_next != 0) {
1370 1370
                 // Previous
1371
-                $sql = "UPDATE " . $tbl_lp_item . "
1372
-                        SET previous_item_id = " . $old_previous . "
1373
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1371
+                $sql = "UPDATE ".$tbl_lp_item."
1372
+                        SET previous_item_id = " . $old_previous."
1373
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1374 1374
                 Database::query($sql);
1375 1375
             }
1376 1376
 
1377 1377
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1378
-            $sql = "UPDATE " . $tbl_lp_item . "
1378
+            $sql = "UPDATE ".$tbl_lp_item."
1379 1379
                     SET display_order = display_order - 1
1380 1380
                     WHERE
1381 1381
                         c_id = ".$course_id." AND
1382
-                        display_order > " . $old_order . " AND
1383
-                        lp_id = " . $this->lp_id . " AND
1382
+                        display_order > " . $old_order." AND
1383
+                        lp_id = " . $this->lp_id." AND
1384 1384
                         parent_item_id = " . $old_parent;
1385 1385
             Database::query($sql);
1386 1386
             /* END -- virtually remove the current item id */
@@ -1390,11 +1390,11 @@  discard block
 block discarded – undo
1390 1390
             if ($previous == 0) {
1391 1391
                 // Select the data of the item that should come after the current item.
1392 1392
                 $sql = "SELECT id, display_order
1393
-                        FROM " . $tbl_lp_item . "
1393
+                        FROM " . $tbl_lp_item."
1394 1394
                         WHERE
1395 1395
                             c_id = ".$course_id." AND
1396
-                            lp_id = " . $this->lp_id . " AND
1397
-                            parent_item_id = " . $parent . " AND
1396
+                            lp_id = " . $this->lp_id." AND
1397
+                            parent_item_id = " . $parent." AND
1398 1398
                             previous_item_id = " . $previous;
1399 1399
                 $res_select_old = Database::query($sql);
1400 1400
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1410,8 +1410,8 @@  discard block
 block discarded – undo
1410 1410
             } else {
1411 1411
                 // Select the data of the item that should come before the current item.
1412 1412
                 $sql = "SELECT next_item_id, display_order
1413
-                        FROM " . $tbl_lp_item . "
1414
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1413
+                        FROM " . $tbl_lp_item."
1414
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1415 1415
                 $res_select_old = Database::query($sql);
1416 1416
                 $row_select_old = Database :: fetch_array($res_select_old);
1417 1417
                 $new_next = $row_select_old['next_item_id'];
@@ -1420,57 +1420,57 @@  discard block
 block discarded – undo
1420 1420
 
1421 1421
             // TODO: htmlspecialchars to be checked for encoding related problems.
1422 1422
             // Update the current item with the new data.
1423
-            $sql = "UPDATE " . $tbl_lp_item . "
1423
+            $sql = "UPDATE ".$tbl_lp_item."
1424 1424
                     SET
1425
-                        title = '" . Database::escape_string($title) . "',
1426
-                        description = '" . Database::escape_string($description) . "',
1427
-                        parent_item_id = " . $parent . ",
1428
-                        previous_item_id = " . $previous . ",
1429
-                        next_item_id = " . $new_next . ",
1430
-                        display_order = " . $new_order . "
1431
-                        " . $audio_update_sql . "
1432
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1425
+                        title = '" . Database::escape_string($title)."',
1426
+                        description = '" . Database::escape_string($description)."',
1427
+                        parent_item_id = " . $parent.",
1428
+                        previous_item_id = " . $previous.",
1429
+                        next_item_id = " . $new_next.",
1430
+                        display_order = " . $new_order."
1431
+                        " . $audio_update_sql."
1432
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1433 1433
             Database::query($sql);
1434 1434
 
1435 1435
             if ($previous != 0) {
1436 1436
                 // Update the previous item's next_item_id.
1437
-                $sql = "UPDATE " . $tbl_lp_item . "
1438
-                        SET next_item_id = " . $id . "
1439
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1437
+                $sql = "UPDATE ".$tbl_lp_item."
1438
+                        SET next_item_id = " . $id."
1439
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1440 1440
                 Database::query($sql);
1441 1441
             }
1442 1442
 
1443 1443
             if ($new_next != 0) {
1444 1444
                 // Update the next item's previous_item_id.
1445
-                $sql = "UPDATE " . $tbl_lp_item . "
1446
-                        SET previous_item_id = " . $id . "
1447
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1445
+                $sql = "UPDATE ".$tbl_lp_item."
1446
+                        SET previous_item_id = " . $id."
1447
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1448 1448
                 Database::query($sql);
1449 1449
             }
1450 1450
 
1451 1451
             if ($old_prerequisite != $prerequisites) {
1452
-                $sql = "UPDATE " . $tbl_lp_item . "
1453
-                        SET prerequisite = '" . $prerequisites . "'
1454
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1452
+                $sql = "UPDATE ".$tbl_lp_item."
1453
+                        SET prerequisite = '" . $prerequisites."'
1454
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1455 1455
                 Database::query($sql);
1456 1456
             }
1457 1457
 
1458 1458
             if ($old_max_time_allowed != $max_time_allowed) {
1459 1459
                 // update max time allowed
1460
-                $sql = "UPDATE " . $tbl_lp_item . "
1461
-                        SET max_time_allowed = " . $max_time_allowed . "
1462
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1460
+                $sql = "UPDATE ".$tbl_lp_item."
1461
+                        SET max_time_allowed = " . $max_time_allowed."
1462
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1463 1463
                 Database::query($sql);
1464 1464
             }
1465 1465
 
1466 1466
             // Update all the items with the same or a bigger display_order than the current item.
1467
-            $sql = "UPDATE " . $tbl_lp_item . "
1467
+            $sql = "UPDATE ".$tbl_lp_item."
1468 1468
                     SET display_order = display_order + 1
1469 1469
                     WHERE
1470 1470
                        c_id = ".$course_id." AND
1471
-                       lp_id = " . $this->get_id() . " AND
1472
-                       id <> " . $id . " AND
1473
-                       parent_item_id = " . $parent . " AND
1471
+                       lp_id = " . $this->get_id()." AND
1472
+                       id <> " . $id." AND
1473
+                       parent_item_id = " . $parent." AND
1474 1474
                        display_order >= " . $new_order;
1475 1475
 
1476 1476
             Database::query($sql);
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
     {
1497 1497
         $course_id = api_get_course_int_id();
1498 1498
         if ($this->debug > 0) {
1499
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1499
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1500 1500
         }
1501 1501
 
1502 1502
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1594,8 +1594,8 @@  discard block
 block discarded – undo
1594 1594
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1595 1595
         }
1596 1596
 
1597
-        if (empty($id)|| $id != strval(intval($id))) {
1598
-            return array ();
1597
+        if (empty($id) || $id != strval(intval($id))) {
1598
+            return array();
1599 1599
         }
1600 1600
 
1601 1601
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1613,13 +1613,13 @@  discard block
 block discarded – undo
1613 1613
                             item_type='dokeos_chapter'
1614 1614
                         ORDER BY display_order";
1615 1615
             $res_bros = Database::query($sql_bros);
1616
-            $list = array ();
1616
+            $list = array();
1617 1617
             while ($row_bro = Database :: fetch_array($res_bros)) {
1618 1618
                 $list[] = $row_bro;
1619 1619
             }
1620 1620
             return $list;
1621 1621
         }
1622
-        return array ();
1622
+        return array();
1623 1623
     }
1624 1624
 
1625 1625
     /**
@@ -1632,11 +1632,11 @@  discard block
 block discarded – undo
1632 1632
     {
1633 1633
         $course_id = api_get_course_int_id();
1634 1634
         if ($this->debug > 0) {
1635
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1635
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1636 1636
         }
1637 1637
 
1638 1638
         if (empty ($id) || $id != strval(intval($id))) {
1639
-            return array ();
1639
+            return array();
1640 1640
         }
1641 1641
 
1642 1642
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1649 1649
                          ORDER BY display_order";
1650 1650
             $res_bros = Database::query($sql_bros);
1651
-            $list = array ();
1651
+            $list = array();
1652 1652
             while ($row_bro = Database :: fetch_array($res_bros)) {
1653 1653
                 $list[] = $row_bro;
1654 1654
             }
1655 1655
             return $list;
1656 1656
         }
1657
-        return array ();
1657
+        return array();
1658 1658
     }
1659 1659
 
1660 1660
     /**
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
             $current = $this->current;
1725 1725
         }
1726 1726
         if ($this->debug > 2) {
1727
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1727
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1728 1728
         }
1729 1729
         return $current;
1730 1730
     }
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
         ) {
1806 1806
 
1807 1807
             if ($this->debug > 2) {
1808
-                error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1808
+                error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0);
1809 1809
             }
1810 1810
             $index = -1;
1811 1811
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1817,7 +1817,7 @@  discard block
 block discarded – undo
1817 1817
             if ($index == -1) {
1818 1818
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1819 1819
                 if ($this->debug > 2) {
1820
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1820
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1821 1821
                 }
1822 1822
                 return false;
1823 1823
             } else {
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
             $index = 0;
1833 1833
             // Loop through all ordered items and stop at the first item that is
1834 1834
             // not a directory *and* that has not been completed yet.
1835
-            while ( !empty($this->ordered_items[$index]) AND
1835
+            while (!empty($this->ordered_items[$index]) AND
1836 1836
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1837 1837
                 (
1838 1838
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1846,14 +1846,14 @@  discard block
 block discarded – undo
1846 1846
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1847 1847
             $this->index    = $index;
1848 1848
             if ($this->debug > 2) {
1849
-                error_log('$index ' . $index);
1849
+                error_log('$index '.$index);
1850 1850
             }
1851 1851
             if ($this->debug > 2) {
1852
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1852
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1853 1853
             }
1854 1854
         }
1855 1855
         if ($this->debug > 2) {
1856
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1856
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1857 1857
         }
1858 1858
     }
1859 1859
 
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
     public function get_js_info($item_id = '')
1867 1867
     {
1868 1868
         if ($this->debug > 0) {
1869
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1869
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1870 1870
         }
1871 1871
 
1872 1872
         $info = '';
@@ -1876,17 +1876,17 @@  discard block
 block discarded – undo
1876 1876
             //if item is defined, return values from DB
1877 1877
             $oItem = $this->items[$item_id];
1878 1878
             $info .= '<script language="javascript">';
1879
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1880
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1881
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1882
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1883
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1884
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1885
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1879
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1880
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1881
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1882
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1883
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1884
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1885
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1886 1886
             $info .= "top.set_flag_synchronized();";
1887 1887
             $info .= '</script>';
1888 1888
             if ($this->debug > 2) {
1889
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1889
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1890 1890
             }
1891 1891
             return $info;
1892 1892
 
@@ -1894,17 +1894,17 @@  discard block
 block discarded – undo
1894 1894
 
1895 1895
             // If item_id is empty, just update to default SCORM data.
1896 1896
             $info .= '<script language="javascript">';
1897
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1898
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1899
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1900
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1901
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1902
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1903
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1897
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1898
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1899
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1900
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1901
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1902
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1903
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1904 1904
             $info .= "top.set_flag_synchronized();";
1905 1905
             $info .= '</script>';
1906 1906
             if ($this->debug > 2) {
1907
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1907
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1908 1908
             }
1909 1909
             return $info;
1910 1910
         }
@@ -1958,12 +1958,12 @@  discard block
 block discarded – undo
1958 1958
      * Gets the navigation bar for the learnpath display screen
1959 1959
      * @return	string	The HTML string to use as a navigation bar
1960 1960
      */
1961
-    public function get_navigation_bar($idBar = null, $display=null) {
1961
+    public function get_navigation_bar($idBar = null, $display = null) {
1962 1962
         if ($this->debug > 0) {
1963 1963
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1964 1964
         }
1965
-        if(empty($idBar)){
1966
-            $idBar='control-top';
1965
+        if (empty($idBar)) {
1966
+            $idBar = 'control-top';
1967 1967
         }
1968 1968
         /* if(empty($display)){
1969 1969
             $display='display:block';
@@ -1976,16 +1976,16 @@  discard block
 block discarded – undo
1976 1976
             $navbar = '
1977 1977
                   <span id="'.$idBar.'" class="buttons">
1978 1978
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1979
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1979
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1980 1980
                     </a>
1981
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1982
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1981
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1982
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1983 1983
                     </a>
1984
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1985
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1984
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1985
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1986 1986
                     </a>
1987 1987
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1988
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1988
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1989 1989
                     </a>
1990 1990
                   </span>';
1991 1991
 
@@ -1993,13 +1993,13 @@  discard block
 block discarded – undo
1993 1993
             $navbar = '
1994 1994
                 <span id="'.$idBar.'" class="buttons text-right">
1995 1995
                     <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link">
1996
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1996
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1997 1997
                     </a>
1998
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1999
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1998
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1999
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
2000 2000
                     </a>
2001
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
2002
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
2001
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
2002
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
2003 2003
                     </a>
2004 2004
                 </span>';
2005 2005
         }
@@ -2020,11 +2020,11 @@  discard block
 block discarded – undo
2020 2020
         $index = $this->index;
2021 2021
         $index++;
2022 2022
         if ($this->debug > 2) {
2023
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2023
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2024 2024
         }
2025 2025
         while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items) {
2026 2026
             $index++;
2027
-            if ($index == $this->max_ordered_items){
2027
+            if ($index == $this->max_ordered_items) {
2028 2028
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2029 2029
                     return $this->index;
2030 2030
                 } else {
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
             return $this->index;
2037 2037
         }
2038 2038
         if ($this->debug > 2) {
2039
-            error_log('New LP - index is now ' . $index, 0);
2039
+            error_log('New LP - index is now '.$index, 0);
2040 2040
         }
2041 2041
         return $index;
2042 2042
     }
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
         if (!empty ($new_index)) {
2055 2055
             if (isset ($this->ordered_items[$new_index])) {
2056 2056
                 if ($this->debug > 2) {
2057
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2057
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2058 2058
                 }
2059 2059
                 return $this->ordered_items[$new_index];
2060 2060
             }
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
         }
2097 2097
 
2098 2098
         // Filename without its extension.
2099
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2099
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2100 2100
 
2101 2101
         $zipFile = new PclZip($file_path);
2102 2102
         // Check the zip content (real size and file extension).
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
                     break; // Exit the foreach loop.
2121 2121
                 } elseif (
2122 2122
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2123
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2123
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2124 2124
                 ) {
2125 2125
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2126 2126
                     switch ($ext) {
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
             error_log('New LP - In learnpath::get_previous_index()', 0);
2163 2163
         }
2164 2164
         $index = $this->index;
2165
-        if (isset ($this->ordered_items[$index -1])) {
2165
+        if (isset ($this->ordered_items[$index - 1])) {
2166 2166
             $index--;
2167 2167
             while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) {
2168 2168
                 $index--;
@@ -2172,7 +2172,7 @@  discard block
 block discarded – undo
2172 2172
             }
2173 2173
         } else {
2174 2174
             if ($this->debug > 2) {
2175
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2175
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2176 2176
             }
2177 2177
             // There is no previous item.
2178 2178
         }
@@ -2215,8 +2215,8 @@  discard block
 block discarded – undo
2215 2215
     {
2216 2216
         $course_id = api_get_course_int_id();
2217 2217
         $_course = api_get_course_info();
2218
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2219
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2218
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2219
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2220 2220
 
2221 2221
         // Getting all the information about the item.
2222 2222
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
                     lp.c_id = $course_id AND
2228 2228
                     lp_view.c_id = $course_id";
2229 2229
         $result = Database::query($sql);
2230
-        $row 	= Database::fetch_assoc($result);
2230
+        $row = Database::fetch_assoc($result);
2231 2231
         $output = '';
2232 2232
 
2233 2233
         if (!empty ($row['audio'])) {
@@ -2235,8 +2235,8 @@  discard block
 block discarded – undo
2235 2235
             $list = $_SESSION['oLP']->get_toc();
2236 2236
             $type_quiz = false;
2237 2237
 
2238
-            foreach($list as $toc) {
2239
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2238
+            foreach ($list as $toc) {
2239
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2240 2240
                     $type_quiz = true;
2241 2241
                 }
2242 2242
             }
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
         $courseCode = null,
2300 2300
         $sessionId = null
2301 2301
     ) {
2302
-        $lp_id = (int)$lp_id;
2302
+        $lp_id = (int) $lp_id;
2303 2303
         $courseInfo = api_get_course_info($courseCode);
2304 2304
         $sessionId = intval($sessionId);
2305 2305
 
@@ -2465,10 +2465,10 @@  discard block
 block discarded – undo
2465 2465
      */
2466 2466
     public static function get_progress_bar($percentage = -1, $text_add = '')
2467 2467
     {
2468
-        $text = $percentage . $text_add;
2468
+        $text = $percentage.$text_add;
2469 2469
         $output = '<div class="progress">
2470
-                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
-                        '. $text .'
2470
+                        <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
2471
+                        '. $text.'
2472 2472
                         </div>
2473 2473
                     </div>';
2474 2474
 
@@ -2504,16 +2504,16 @@  discard block
 block discarded – undo
2504 2504
         }
2505 2505
         $total_items = $this->get_total_items_count_without_chapters();
2506 2506
         if ($this->debug > 2) {
2507
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2507
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2508 2508
         }
2509 2509
         $completeItems = $this->get_complete_items_count();
2510 2510
         if ($this->debug > 2) {
2511
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2511
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2512 2512
         }
2513 2513
         if ($add != 0) {
2514 2514
             $completeItems += $add;
2515 2515
             if ($this->debug > 2) {
2516
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2516
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2517 2517
             }
2518 2518
         }
2519 2519
         $text = '';
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
             $text = '%';
2532 2532
         } elseif ($mode == 'abs') {
2533 2533
             $percentage = $completeItems;
2534
-            $text = '/' . $total_items;
2534
+            $text = '/'.$total_items;
2535 2535
         }
2536 2536
 
2537 2537
         return array(
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                 // and replace them, one by one, by the internal IDs (chamilo db)
2728 2728
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2729 2729
                 // by a space as well.
2730
-                $find = array (
2730
+                $find = array(
2731 2731
                     '&',
2732 2732
                     '|',
2733 2733
                     '~',
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
                     '(',
2740 2740
                     ')'
2741 2741
                 );
2742
-                $replace = array (
2742
+                $replace = array(
2743 2743
                     ' ',
2744 2744
                     ' ',
2745 2745
                     ' ',
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
                 foreach ($ids as $id) {
2757 2757
                     $id = trim($id);
2758 2758
                     if (isset ($this->refs_list[$id])) {
2759
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2759
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2760 2760
                     }
2761 2761
                 }
2762 2762
 
@@ -2864,9 +2864,9 @@  discard block
 block discarded – undo
2864 2864
         if ($this->debug > 0) {
2865 2865
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2866 2866
         }
2867
-        $list = array ();
2867
+        $list = array();
2868 2868
         foreach ($this->ordered_items as $item_id) {
2869
-            $list[] = array (
2869
+            $list[] = array(
2870 2870
                 $item_id => $this->items[$item_id]->get_status()
2871 2871
             );
2872 2872
         }
@@ -2920,7 +2920,7 @@  discard block
 block discarded – undo
2920 2920
         $res = Database::query($sql);
2921 2921
         $num = Database :: num_rows($res);
2922 2922
         if ($num > 0) {
2923
-            $list[] = array (
2923
+            $list[] = array(
2924 2924
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2925 2925
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2926 2926
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2931,7 +2931,7 @@  discard block
 block discarded – undo
2931 2931
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2932 2932
             );
2933 2933
             while ($row = Database :: fetch_array($res)) {
2934
-                $list[] = array (
2934
+                $list[] = array(
2935 2935
                     'order_id' => ($row['order_id'] + 1),
2936 2936
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2937 2937
                     'type' => $row['interaction_type'],
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
3000 3000
             );
3001 3001
             while ($row = Database :: fetch_array($res)) {
3002
-                $list[] = array (
3002
+                $list[] = array(
3003 3003
                     'order_id' => ($row['order_id'] + 1),
3004 3004
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
3005 3005
                     'score_raw' => $row['score_raw'],
@@ -3026,10 +3026,10 @@  discard block
 block discarded – undo
3026 3026
         $toc = array();
3027 3027
         foreach ($this->ordered_items as $item_id) {
3028 3028
             if ($this->debug > 2) {
3029
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3029
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3030 3030
             }
3031 3031
             // TODO: Change this link generation and use new function instead.
3032
-            $toc[] = array (
3032
+            $toc[] = array(
3033 3033
                 'id'            => $item_id,
3034 3034
                 'title'         => $this->items[$item_id]->get_title(),
3035 3035
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
             );
3041 3041
         }
3042 3042
         if ($this->debug > 2) {
3043
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3043
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3044 3044
         }
3045 3045
         return $toc;
3046 3046
     }
@@ -3057,10 +3057,10 @@  discard block
 block discarded – undo
3057 3057
         }
3058 3058
         $toc = $varname.' = new Array();';
3059 3059
         foreach ($this->ordered_items as $item_id) {
3060
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3060
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3061 3061
         }
3062 3062
         if ($this->debug > 2) {
3063
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3063
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3064 3064
         }
3065 3065
         return $toc;
3066 3066
     }
@@ -3084,7 +3084,7 @@  discard block
 block discarded – undo
3084 3084
             }
3085 3085
         }
3086 3086
         if ($this->debug > 2) {
3087
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3087
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3088 3088
         }
3089 3089
         return $res;
3090 3090
     }
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3101 3101
         $lp_id = intval($lp_id);
3102 3102
         $sql = "SELECT lp_type FROM $tbl_lp
3103
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3103
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3104 3104
         $res = Database::query($sql);
3105 3105
         if ($res === false) {
3106 3106
             return null;
@@ -3213,7 +3213,7 @@  discard block
 block discarded – undo
3213 3213
             $dirTypes = self::getChapterTypes();
3214 3214
 
3215 3215
             if (in_array($item['type'], $dirTypes)) {
3216
-                $scorm_color_background ='scorm_item_section ';
3216
+                $scorm_color_background = 'scorm_item_section ';
3217 3217
                 $style_item = '';
3218 3218
             }
3219 3219
             if ($item['id'] == $this->current) {
@@ -3222,7 +3222,7 @@  discard block
 block discarded – undo
3222 3222
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3223 3223
             }
3224 3224
 
3225
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3225
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3226 3226
 
3227 3227
             // Learning path title
3228 3228
             $title = $item['title'];
@@ -3252,7 +3252,7 @@  discard block
 block discarded – undo
3252 3252
                 $html .= stripslashes($title);
3253 3253
             } else {
3254 3254
                 $this->get_link('http', $item['id'], $toc_list);
3255
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3255
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3256 3256
             }
3257 3257
             $html .= "</div>";
3258 3258
 
@@ -3286,12 +3286,12 @@  discard block
 block discarded – undo
3286 3286
             if ($this->get_lp_session_id() == api_get_session_id()) {
3287 3287
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3288 3288
                 $html .= '<div class="btn-group">';
3289
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3290
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3291
-                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" .
3292
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3293
-                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' .
3294
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3289
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3290
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3291
+                $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>".
3292
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3293
+                $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'.
3294
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3295 3295
                 $html .= '</div>';
3296 3296
                 $html .= '</div>';
3297 3297
             }
@@ -3342,11 +3342,11 @@  discard block
 block discarded – undo
3342 3342
         $course_id = $this->get_course_int_id();
3343 3343
 
3344 3344
         if ($this->debug > 0) {
3345
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3345
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3346 3346
         }
3347 3347
         if (empty($item_id)) {
3348 3348
             if ($this->debug > 2) {
3349
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3349
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3350 3350
             }
3351 3351
             $item_id = $this->get_current_item_id();
3352 3352
         }
@@ -3378,7 +3378,7 @@  discard block
 block discarded – undo
3378 3378
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3379 3379
         		WHERE li.id = $item_id ";
3380 3380
         if ($this->debug > 2) {
3381
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3381
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3382 3382
         }
3383 3383
         $res = Database::query($sql);
3384 3384
         if (Database :: num_rows($res) > 0) {
@@ -3392,9 +3392,9 @@  discard block
 block discarded – undo
3392 3392
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3393 3393
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3394 3394
             }
3395
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3395
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3396 3396
             if ($type == 'http') {
3397
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3397
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3398 3398
             } else {
3399 3399
                 $course_path = $sys_course_path; //system path
3400 3400
             }
@@ -3405,8 +3405,8 @@  discard block
 block discarded – undo
3405 3405
             }
3406 3406
 
3407 3407
             if ($this->debug > 2) {
3408
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3409
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3408
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3409
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3410 3410
             }
3411 3411
 
3412 3412
             // Now go through the specific cases to get the end of the path
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
                         );
3426 3426
 
3427 3427
                         if ($this->debug > 0) {
3428
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3428
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3429 3429
                         }
3430 3430
 
3431 3431
                         if ($lp_item_type == 'link') {
@@ -3445,7 +3445,7 @@  discard block
 block discarded – undo
3445 3445
                                     $linkProtocol = substr($file, 0, 5);
3446 3446
                                     if ($linkProtocol === 'http:') {
3447 3447
                                         //this is the special intervention case
3448
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3448
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3449 3449
                                     }
3450 3450
                                 }
3451 3451
                             }
@@ -3485,8 +3485,8 @@  discard block
 block discarded – undo
3485 3485
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3486 3486
                                         WHERE
3487 3487
                                             c_id = $course_id AND
3488
-                                            lp_item_id='" . $lp_item_id . "' AND
3489
-                                            lp_view_id ='" . $lp_view_id . "' AND
3488
+                                            lp_item_id='".$lp_item_id."' AND
3489
+                                            lp_view_id ='" . $lp_view_id."' AND
3490 3490
                                             status='completed'";
3491 3491
                                 $result = Database::query($sql);
3492 3492
                                 $row_count = Database :: fetch_row($result);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3496 3496
                                     $not_multiple_attempt = 1;
3497 3497
                                 }
3498
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3498
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3499 3499
                             }
3500 3500
 
3501 3501
                             $tmp_array = explode('/', $file);
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
                     break;
3509 3509
                 case 2 :
3510 3510
                     if ($this->debug > 2) {
3511
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3511
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3512 3512
                     }
3513 3513
 
3514 3514
                     if ($lp_item_type != 'dir') {
@@ -3522,19 +3522,19 @@  discard block
 block discarded – undo
3522 3522
                         //if ($this->prerequisites_match($item_id)) {
3523 3523
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3524 3524
                             if ($this->debug > 2) {
3525
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3525
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3526 3526
                             }
3527 3527
                             // Distant url, return as is.
3528 3528
                             $file = $lp_item_path;
3529 3529
                         } else {
3530 3530
                             if ($this->debug > 2) {
3531
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3531
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3532 3532
                             }
3533 3533
                             // Prevent getting untranslatable urls.
3534 3534
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3535 3535
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3536 3536
                             // Prepare the path.
3537
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3537
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3538 3538
                             // TODO: Fix this for urls with protocol header.
3539 3539
                             $file = str_replace('//', '/', $file);
3540 3540
                             $file = str_replace(':/', '://', $file);
@@ -3542,11 +3542,11 @@  discard block
 block discarded – undo
3542 3542
                                 $lp_path = substr($lp_path, 0, -1);
3543 3543
                             }
3544 3544
 
3545
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3545
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3546 3546
                                 // if file not found.
3547 3547
                                 $decoded = html_entity_decode($lp_item_path);
3548 3548
                                 list ($decoded) = explode('?', $decoded);
3549
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3549
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3550 3550
                                     require_once 'resourcelinker.inc.php';
3551 3551
                                     $file = rl_get_resource_link_for_learnpath(
3552 3552
                                         $course_id,
@@ -3566,14 +3566,14 @@  discard block
 block discarded – undo
3566 3566
                                         }
3567 3567
                                     }
3568 3568
                                 } else {
3569
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3569
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3570 3570
                                 }
3571 3571
                             }
3572 3572
                         }
3573 3573
 
3574 3574
                         // We want to use parameters if they were defined in the imsmanifest
3575 3575
                         if (strpos($file, 'blank.php') === false) {
3576
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3576
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3577 3577
                         }
3578 3578
                     } else {
3579 3579
                         $file = 'lp_content.php?type=dir';
@@ -3581,12 +3581,12 @@  discard block
 block discarded – undo
3581 3581
                     break;
3582 3582
                 case 3 :
3583 3583
                     if ($this->debug > 2) {
3584
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3584
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3585 3585
                     }
3586 3586
                     // Formatting AICC HACP append URL.
3587
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3587
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3588 3588
                     if (!empty($lp_item_params)) {
3589
-                        $aicc_append .= $lp_item_params . '&';
3589
+                        $aicc_append .= $lp_item_params.'&';
3590 3590
                     }
3591 3591
                     if ($lp_item_type != 'dir') {
3592 3592
                         // Quite complex here:
@@ -3598,7 +3598,7 @@  discard block
 block discarded – undo
3598 3598
 
3599 3599
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3600 3600
                             if ($this->debug > 2) {
3601
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3601
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3602 3602
                             }
3603 3603
                             // Distant url, return as is.
3604 3604
                             $file = $lp_item_path;
@@ -3611,19 +3611,19 @@  discard block
 block discarded – undo
3611 3611
                             if (stripos($file, '<servername>') !== false) {
3612 3612
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3613 3613
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3614
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3614
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3615 3615
                             }
3616 3616
                             //
3617 3617
                             $file .= $aicc_append;
3618 3618
                         } else {
3619 3619
                             if ($this->debug > 2) {
3620
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3620
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3621 3621
                             }
3622 3622
                             // Prevent getting untranslatable urls.
3623 3623
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3624 3624
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3625 3625
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3626
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3626
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3627 3627
                             // TODO: Fix this for urls with protocol header.
3628 3628
                             $file = str_replace('//', '/', $file);
3629 3629
                             $file = str_replace(':/', '://', $file);
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3643 3643
         }
3644 3644
         if ($this->debug > 2) {
3645
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3645
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3646 3646
         }
3647 3647
         return $file;
3648 3648
     }
@@ -3660,7 +3660,7 @@  discard block
 block discarded – undo
3660 3660
         $search = '';
3661 3661
         // Use $attempt_num to enable multi-views management (disabled so far).
3662 3662
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3663
-            $search = 'AND view_count = ' . $attempt_num;
3663
+            $search = 'AND view_count = '.$attempt_num;
3664 3664
         }
3665 3665
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3666 3666
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3670,9 +3670,9 @@  discard block
 block discarded – undo
3670 3670
 
3671 3671
         $sql = "SELECT id, view_count FROM $lp_view_table
3672 3672
         		WHERE
3673
-        		    c_id = " . $course_id . " AND
3674
-        		    lp_id = " . $this->get_id() . " AND
3675
-        		    user_id = " . $this->get_user_id() . " AND
3673
+        		    c_id = ".$course_id." AND
3674
+        		    lp_id = " . $this->get_id()." AND
3675
+        		    user_id = " . $this->get_user_id()." AND
3676 3676
         		    session_id = $sessionId
3677 3677
         		    $search
3678 3678
                 ORDER BY view_count DESC";
@@ -3683,7 +3683,7 @@  discard block
 block discarded – undo
3683 3683
         } else if (!api_is_invitee()) {
3684 3684
             // There is no database record, create one.
3685 3685
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3686
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3686
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3687 3687
             Database::query($sql);
3688 3688
             $id = Database :: insert_id();
3689 3689
             $this->lp_view_id = $id;
@@ -3783,15 +3783,15 @@  discard block
 block discarded – undo
3783 3783
     {
3784 3784
         $course_id = api_get_course_int_id();
3785 3785
         if ($this->debug > 0) {
3786
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3786
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3787 3787
         }
3788 3788
         if (empty($id) || empty($direction)) {
3789 3789
             return false;
3790 3790
         }
3791 3791
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3792 3792
         $sql_sel = "SELECT *
3793
-                    FROM " . $tbl_lp_item . "
3794
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3793
+                    FROM " . $tbl_lp_item."
3794
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3795 3795
         $res_sel = Database::query($sql_sel);
3796 3796
         // Check if elem exists.
3797 3797
         if (Database :: num_rows($res_sel) < 1) {
@@ -3816,7 +3816,7 @@  discard block
 block discarded – undo
3816 3816
                                  WHERE c_id = ".$course_id." AND id = $previous";
3817 3817
 
3818 3818
                     if ($this->debug > 2) {
3819
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3819
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3820 3820
                     }
3821 3821
                     $res_sel2 = Database::query($sql_sel2);
3822 3822
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
                         }
3870 3870
                         Database::query($sql_upd2);
3871 3871
                     }
3872
-                    $display = $display -1;
3872
+                    $display = $display - 1;
3873 3873
                 }
3874 3874
                 break;
3875 3875
             case 'down':
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
                 } else {
3881 3881
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3882 3882
                     if ($this->debug > 2) {
3883
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3883
+                        error_log('Selecting next: '.$sql_sel2, 0);
3884 3884
                     }
3885 3885
                     $res_sel2 = Database::query($sql_sel2);
3886 3886
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3918,7 +3918,7 @@  discard block
 block discarded – undo
3918 3918
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3919 3919
                         Database::query($sql_upd2);
3920 3920
                     }
3921
-                    $display = $display +1;
3921
+                    $display = $display + 1;
3922 3922
                 }
3923 3923
                 break;
3924 3924
             default :
@@ -3941,8 +3941,8 @@  discard block
 block discarded – undo
3941 3941
         $res = Database::query($sql);
3942 3942
         if ($res === false)
3943 3943
             return false;
3944
-        $lps = array ();
3945
-        $lp_order = array ();
3944
+        $lps = array();
3945
+        $lp_order = array();
3946 3946
         $num = Database :: num_rows($res);
3947 3947
         // First check the order is correct, globally (might be wrong because
3948 3948
         // of versions < 1.8.4)
@@ -3952,7 +3952,7 @@  discard block
 block discarded – undo
3952 3952
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3953 3953
                     $need_fix = true;
3954 3954
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3955
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3955
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3956 3956
                     Database::query($sql_u);
3957 3957
                 }
3958 3958
                 $row['display_order'] = $i;
@@ -3965,10 +3965,10 @@  discard block
 block discarded – undo
3965 3965
             $order = $lps[$lp_id]['display_order'];
3966 3966
             if ($order > 1) { // If it's the first element, no need to move up.
3967 3967
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3968
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3968
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3969 3969
                 Database::query($sql_u1);
3970
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3971
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3970
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3971
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3972 3972
                 Database::query($sql_u2);
3973 3973
             }
3974 3974
         }
@@ -3989,8 +3989,8 @@  discard block
 block discarded – undo
3989 3989
         if ($res === false) {
3990 3990
             return false;
3991 3991
         }
3992
-        $lps = array ();
3993
-        $lp_order = array ();
3992
+        $lps = array();
3993
+        $lp_order = array();
3994 3994
         $num = Database :: num_rows($res);
3995 3995
         $max = 0;
3996 3996
         // First check the order is correct, globally (might be wrong because
@@ -4002,7 +4002,7 @@  discard block
 block discarded – undo
4002 4002
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4003 4003
                     $need_fix = true;
4004 4004
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4005
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4005
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4006 4006
                     Database::query($sql_u);
4007 4007
                 }
4008 4008
                 $row['display_order'] = $i;
@@ -4015,10 +4015,10 @@  discard block
 block discarded – undo
4015 4015
             $order = $lps[$lp_id]['display_order'];
4016 4016
             if ($order < $max) { // If it's the first element, no need to move up.
4017 4017
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4018
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4018
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4019 4019
                 Database::query($sql_u1);
4020
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4021
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4020
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4021
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4022 4022
                 Database::query($sql_u2);
4023 4023
             }
4024 4024
         }
@@ -4038,15 +4038,15 @@  discard block
 block discarded – undo
4038 4038
         $this->autocomplete_parents($this->last);
4039 4039
         $new_index = $this->get_next_index();
4040 4040
         if ($this->debug > 2) {
4041
-            error_log('New LP - New index: ' . $new_index, 0);
4041
+            error_log('New LP - New index: '.$new_index, 0);
4042 4042
         }
4043 4043
         $this->index = $new_index;
4044 4044
         if ($this->debug > 2) {
4045
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4045
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4046 4046
         }
4047 4047
         $this->current = $this->ordered_items[$new_index];
4048 4048
         if ($this->debug > 2) {
4049
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4049
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4050 4050
         }
4051 4051
     }
4052 4052
 
@@ -4110,7 +4110,7 @@  discard block
 block discarded – undo
4110 4110
             // Clean spaces.
4111 4111
             $prereq_string = str_replace(' ', '', $prereq_string);
4112 4112
             if ($debug > 0) {
4113
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4113
+                error_log('Found prereq_string: '.$prereq_string, 0);
4114 4114
             }
4115 4115
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4116 4116
             $result = $currentItem->parse_prereq(
@@ -4126,12 +4126,12 @@  discard block
 block discarded – undo
4126 4126
         } else {
4127 4127
             $result = true;
4128 4128
             if ($debug > 1) {
4129
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4129
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4130 4130
             }
4131 4131
         }
4132 4132
 
4133 4133
         if ($debug > 1) {
4134
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4134
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4135 4135
         }
4136 4136
         return $result;
4137 4137
     }
@@ -4197,12 +4197,12 @@  discard block
 block discarded – undo
4197 4197
             $row = Database :: fetch_array($result);
4198 4198
             $name = domesticate($row['name']);
4199 4199
             if ($set_visibility == 'i') {
4200
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4200
+                $s = $name." ".get_lang('LearnpathNotPublished');
4201 4201
                 $dialogBox = $s;
4202 4202
                 $v = 0;
4203 4203
             }
4204 4204
             if ($set_visibility == 'v') {
4205
-                $s = $name . " " . get_lang('LearnpathPublished');
4205
+                $s = $name." ".get_lang('LearnpathPublished');
4206 4206
                 $dialogBox = $s;
4207 4207
                 $v = 1;
4208 4208
             }
@@ -4285,9 +4285,9 @@  discard block
 block discarded – undo
4285 4285
         $course_id = api_get_course_int_id();
4286 4286
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4287 4287
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4288
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4288
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4289 4289
         if ($this->debug > 2) {
4290
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4290
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4291 4291
         }
4292 4292
         $res = Database::query($sql);
4293 4293
         $view_id = Database::insert_id();
@@ -4325,10 +4325,10 @@  discard block
 block discarded – undo
4325 4325
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4326 4326
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4327 4327
         if ($this->debug > 2) {
4328
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4328
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4329 4329
         }
4330 4330
         if ($this->debug > 2) {
4331
-            error_log('' . print_r($this->items, true), 0);
4331
+            error_log(''.print_r($this->items, true), 0);
4332 4332
         }
4333 4333
         if (isset($this->items[$this->current]) &&
4334 4334
             is_object($this->items[$this->current])
@@ -4352,7 +4352,7 @@  discard block
 block discarded – undo
4352 4352
     {
4353 4353
         $debug = $this->debug;
4354 4354
         if ($debug) {
4355
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4355
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4356 4356
         }
4357 4357
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4358 4358
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4375,7 +4375,7 @@  discard block
 block discarded – undo
4375 4375
 
4376 4376
             if ($debug) {
4377 4377
                 error_log('update_queue before:');
4378
-                error_log(print_r($this->update_queue,1));
4378
+                error_log(print_r($this->update_queue, 1));
4379 4379
             }
4380 4380
             $this->autocomplete_parents($item_id);
4381 4381
 
@@ -4383,9 +4383,9 @@  discard block
 block discarded – undo
4383 4383
             $this->update_queue[$item_id] = $status;
4384 4384
 
4385 4385
             if ($debug) {
4386
-                error_log('get_status(): ' . $status);
4386
+                error_log('get_status(): '.$status);
4387 4387
                 error_log('update_queue after:');
4388
-                error_log(print_r($this->update_queue,1));
4388
+                error_log(print_r($this->update_queue, 1));
4389 4389
             }
4390 4390
             return $res;
4391 4391
         }
@@ -4406,17 +4406,17 @@  discard block
 block discarded – undo
4406 4406
 
4407 4407
         if (isset($this->current) && !api_is_invitee()) {
4408 4408
             if ($this->debug > 2) {
4409
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4409
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4410 4410
             }
4411 4411
             $sql = "UPDATE $table SET
4412
-                        last_item = " . intval($this->get_current_item_id()). "
4412
+                        last_item = ".intval($this->get_current_item_id())."
4413 4413
                     WHERE
4414 4414
                         c_id = $course_id AND
4415
-                        lp_id = " . $this->get_id() . " AND
4415
+                        lp_id = ".$this->get_id()." AND
4416 4416
                         user_id = " . $this->get_user_id()." ".$session_condition;
4417 4417
 
4418 4418
             if ($this->debug > 2) {
4419
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4419
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4420 4420
             }
4421 4421
             Database::query($sql);
4422 4422
         }
@@ -4430,7 +4430,7 @@  discard block
 block discarded – undo
4430 4430
                             progress = $progress
4431 4431
                         WHERE
4432 4432
                             c_id = ".$course_id." AND
4433
-                            lp_id = " . $this->get_id() . " AND
4433
+                            lp_id = " . $this->get_id()." AND
4434 4434
                             user_id = " . $this->get_user_id()." ".$session_condition;
4435 4435
                 // Ignore errors as some tables might not have the progress field just yet.
4436 4436
                 Database::query($sql);
@@ -4446,7 +4446,7 @@  discard block
 block discarded – undo
4446 4446
     public function set_current_item($item_id = null)
4447 4447
     {
4448 4448
         if ($this->debug > 0) {
4449
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4449
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4450 4450
         }
4451 4451
         if (empty ($item_id)) {
4452 4452
             if ($this->debug > 2) {
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
             // Do nothing.
4456 4456
         } else {
4457 4457
             if ($this->debug > 2) {
4458
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4458
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4459 4459
             }
4460 4460
             if (is_numeric($item_id)) {
4461 4461
                 $item_id = intval($item_id);
@@ -4470,10 +4470,10 @@  discard block
 block discarded – undo
4470 4470
                     }
4471 4471
                 }
4472 4472
                 if ($this->debug > 2) {
4473
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4473
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4474 4474
                 }
4475 4475
             } else {
4476
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4476
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4477 4477
             }
4478 4478
         }
4479 4479
     }
@@ -4498,7 +4498,7 @@  discard block
 block discarded – undo
4498 4498
             $lp = $this->get_id();
4499 4499
             if ($lp != 0) {
4500 4500
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4501
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4501
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4502 4502
                 $res = Database::query($sql);
4503 4503
                 return $res;
4504 4504
             }
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
 
4523 4523
         if ($lp != 0) {
4524 4524
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4525
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4525
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4526 4526
             $res = Database::query($sql);
4527 4527
             return $res;
4528 4528
         } else {
@@ -4547,10 +4547,10 @@  discard block
 block discarded – undo
4547 4547
         $course_id = api_get_course_int_id();
4548 4548
         $lp_id = $this->get_id();
4549 4549
         $sql = "UPDATE $lp_table SET
4550
-                content_maker = '" . Database::escape_string($this->maker) . "'
4550
+                content_maker = '".Database::escape_string($this->maker)."'
4551 4551
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4552 4552
         if ($this->debug > 2) {
4553
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4553
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4554 4554
         }
4555 4555
         Database::query($sql);
4556 4556
         return true;
@@ -4574,10 +4574,10 @@  discard block
 block discarded – undo
4574 4574
         $lp_id = $this->get_id();
4575 4575
         $course_id = $this->course_info['real_id'];
4576 4576
         $sql = "UPDATE $lp_table SET
4577
-                name = '" . Database::escape_string($this->name). "'
4577
+                name = '".Database::escape_string($this->name)."'
4578 4578
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4579 4579
         if ($this->debug > 2) {
4580
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4580
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4581 4581
         }
4582 4582
         $result = Database::query($sql);
4583 4583
         // If the lp is visible on the homepage, change his name there.
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
             $session_id = api_get_session_id();
4586 4586
             $session_condition = api_get_session_condition($session_id);
4587 4587
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4588
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4588
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4589 4589
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4590 4590
             	    WHERE
4591 4591
             	        c_id = $course_id AND
@@ -4663,10 +4663,10 @@  discard block
 block discarded – undo
4663 4663
 
4664 4664
                 // Save it to search engine.
4665 4665
                 foreach ($missing_terms as $term) {
4666
-                    $doc->add_term($prefix . $term, 1);
4666
+                    $doc->add_term($prefix.$term, 1);
4667 4667
                 }
4668 4668
                 foreach ($deprecated_terms as $term) {
4669
-                    $doc->remove_term($prefix . $term);
4669
+                    $doc->remove_term($prefix.$term);
4670 4670
                 }
4671 4671
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4672 4672
                 $di->getDb()->flush();
@@ -4691,10 +4691,10 @@  discard block
 block discarded – undo
4691 4691
         $this->theme = $name;
4692 4692
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4693 4693
         $lp_id = $this->get_id();
4694
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4694
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4695 4695
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4696 4696
         if ($this->debug > 2) {
4697
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4697
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4698 4698
         }
4699 4699
         Database::query($sql);
4700 4700
 
@@ -4717,10 +4717,10 @@  discard block
 block discarded – undo
4717 4717
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4718 4718
         $lp_id = $this->get_id();
4719 4719
         $sql = "UPDATE $lp_table SET
4720
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4720
+                preview_image = '".Database::escape_string($this->preview_image)."'
4721 4721
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4722 4722
         if ($this->debug > 2) {
4723
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4723
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4724 4724
         }
4725 4725
         Database::query($sql);
4726 4726
         return true;
@@ -4740,10 +4740,10 @@  discard block
 block discarded – undo
4740 4740
         $this->author = $name;
4741 4741
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4742 4742
         $lp_id = $this->get_id();
4743
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4743
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4744 4744
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4745 4745
         if ($this->debug > 2) {
4746
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4746
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4747 4747
         }
4748 4748
         Database::query($sql);
4749 4749
 
@@ -4761,15 +4761,15 @@  discard block
 block discarded – undo
4761 4761
         if ($this->debug > 0) {
4762 4762
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4763 4763
         }
4764
-        if (intval($hide) == $hide){
4764
+        if (intval($hide) == $hide) {
4765 4765
             $this->hide_toc_frame = $hide;
4766 4766
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4767 4767
             $lp_id = $this->get_id();
4768 4768
             $sql = "UPDATE $lp_table SET
4769
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4769
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4770 4770
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4771 4771
             if ($this->debug > 2) {
4772
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4772
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4773 4773
             }
4774 4774
             Database::query($sql);
4775 4775
 
@@ -4796,7 +4796,7 @@  discard block
 block discarded – undo
4796 4796
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4797 4797
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4798 4798
         if ($this->debug > 2) {
4799
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4799
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4800 4800
         }
4801 4801
         Database::query($sql);
4802 4802
         return true;
@@ -4820,10 +4820,10 @@  discard block
 block discarded – undo
4820 4820
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4821 4821
         $lp_id = $this->get_id();
4822 4822
         $sql = "UPDATE $lp_table SET
4823
-                    content_local = '" . Database::escape_string($name) . "'
4823
+                    content_local = '".Database::escape_string($name)."'
4824 4824
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4825 4825
         if ($this->debug > 2) {
4826
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4826
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4827 4827
         }
4828 4828
         Database::query($sql);
4829 4829
         return true;
@@ -4857,11 +4857,11 @@  discard block
 block discarded – undo
4857 4857
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4858 4858
         $lp_id = $this->get_id();
4859 4859
         $sql = "UPDATE $lp_table SET
4860
-                    use_max_score = '" . $this->use_max_score . "'
4860
+                    use_max_score = '".$this->use_max_score."'
4861 4861
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4862 4862
 
4863 4863
         if ($this->debug > 2) {
4864
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4864
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4865 4865
         }
4866 4866
         Database::query($sql);
4867 4867
 
@@ -4888,10 +4888,10 @@  discard block
 block discarded – undo
4888 4888
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4889 4889
         $lp_id = $this->get_id();
4890 4890
         $sql = "UPDATE $lp_table SET
4891
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4891
+                expired_on = '".Database::escape_string($this->expired_on)."'
4892 4892
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4893 4893
         if ($this->debug > 2) {
4894
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4894
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4895 4895
         }
4896 4896
         Database::query($sql);
4897 4897
 
@@ -4917,10 +4917,10 @@  discard block
 block discarded – undo
4917 4917
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4918 4918
         $lp_id = $this->get_id();
4919 4919
         $sql = "UPDATE $lp_table SET
4920
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4920
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4921 4921
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4922 4922
         if ($this->debug > 2) {
4923
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4923
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4924 4924
         }
4925 4925
         Database::query($sql);
4926 4926
 
@@ -4940,10 +4940,10 @@  discard block
 block discarded – undo
4940 4940
         $this->modified_on = api_get_utc_datetime();
4941 4941
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4942 4942
         $lp_id = $this->get_id();
4943
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4943
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4944 4944
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4945 4945
         if ($this->debug > 2) {
4946
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4946
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4947 4947
         }
4948 4948
         Database::query($sql);
4949 4949
         return true;
@@ -5014,13 +5014,13 @@  discard block
 block discarded – undo
5014 5014
 
5015 5015
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5016 5016
             if ($this->debug > 2) {
5017
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5017
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5018 5018
             }
5019 5019
             switch ($this->get_type()) {
5020 5020
                 case '3' :
5021 5021
                     if ($this->items[$this->last]->get_type() != 'au') {
5022 5022
                         if ($this->debug > 2) {
5023
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5023
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5024 5024
                         }
5025 5025
                         $this->items[$this->last]->close();
5026 5026
                         //$this->autocomplete_parents($this->last);
@@ -5033,7 +5033,7 @@  discard block
 block discarded – undo
5033 5033
                 case '2' :
5034 5034
                     if ($this->items[$this->last]->get_type() != 'sco') {
5035 5035
                         if ($this->debug > 2) {
5036
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5036
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5037 5037
                         }
5038 5038
                         $this->items[$this->last]->close();
5039 5039
                         //$this->autocomplete_parents($this->last);
@@ -5047,7 +5047,7 @@  discard block
 block discarded – undo
5047 5047
                 case '1' :
5048 5048
                 default :
5049 5049
                     if ($this->debug > 2) {
5050
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5050
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5051 5051
                     }
5052 5052
                     $this->items[$this->last]->close();
5053 5053
                     break;
@@ -5073,7 +5073,7 @@  discard block
 block discarded – undo
5073 5073
         }
5074 5074
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5075 5075
         $sql = "SELECT * FROM $lp_table
5076
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5076
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5077 5077
         $res = Database::query($sql);
5078 5078
         if (Database :: num_rows($res) > 0) {
5079 5079
             $row = Database :: fetch_array($res);
@@ -5094,14 +5094,14 @@  discard block
 block discarded – undo
5094 5094
                     break;
5095 5095
             }
5096 5096
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5097
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5097
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5098 5098
             Database::query($sql);
5099 5099
             $this->mode = $view_mode;
5100 5100
 
5101 5101
             return $view_mode;
5102 5102
         } else {
5103 5103
             if ($this->debug > 2) {
5104
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5104
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5105 5105
             }
5106 5106
         }
5107 5107
         return -1;
@@ -5119,7 +5119,7 @@  discard block
 block discarded – undo
5119 5119
         }
5120 5120
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5121 5121
         $sql = "SELECT * FROM $lp_table
5122
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5122
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5123 5123
         $res = Database::query($sql);
5124 5124
         if (Database :: num_rows($res) > 0) {
5125 5125
             $row = Database :: fetch_array($res);
@@ -5132,14 +5132,14 @@  discard block
 block discarded – undo
5132 5132
                 $force_return = true;
5133 5133
             }
5134 5134
             $sql = "UPDATE $lp_table SET force_commit = $force
5135
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5135
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5136 5136
             Database::query($sql);
5137 5137
             $this->force_commit = $force_return;
5138 5138
 
5139 5139
             return $force_return;
5140 5140
         } else {
5141 5141
             if ($this->debug > 2) {
5142
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5142
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5143 5143
             }
5144 5144
         }
5145 5145
         return -1;
@@ -5168,7 +5168,7 @@  discard block
 block discarded – undo
5168 5168
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5169 5169
                     $need_fix = true;
5170 5170
                     $sql = "UPDATE $lp_table SET display_order = $i
5171
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5171
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5172 5172
                     Database::query($sql);
5173 5173
                 }
5174 5174
                 $i++;
@@ -5189,7 +5189,7 @@  discard block
 block discarded – undo
5189 5189
         }
5190 5190
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5191 5191
         $sql = "SELECT * FROM $lp_table
5192
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5192
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5193 5193
         $res = Database::query($sql);
5194 5194
         if (Database :: num_rows($res) > 0) {
5195 5195
             $row = Database :: fetch_array($res);
@@ -5200,13 +5200,13 @@  discard block
 block discarded – undo
5200 5200
                 $force = 1;
5201 5201
             }
5202 5202
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5203
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5203
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5204 5204
             Database::query($sql);
5205 5205
             $this->prevent_reinit = $force;
5206 5206
             return $force;
5207 5207
         } else {
5208 5208
             if ($this->debug > 2) {
5209
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5209
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5210 5210
             }
5211 5211
         }
5212 5212
         return -1;
@@ -5222,11 +5222,11 @@  discard block
 block discarded – undo
5222 5222
     {
5223 5223
         //Set default value for seriousgame_mode
5224 5224
         if (!isset($this->seriousgame_mode)) {
5225
-            $this->seriousgame_mode=0;
5225
+            $this->seriousgame_mode = 0;
5226 5226
         }
5227 5227
         // Set default value for prevent_reinit
5228 5228
         if (!isset($this->prevent_reinit)) {
5229
-            $this->prevent_reinit =1;
5229
+            $this->prevent_reinit = 1;
5230 5230
         }
5231 5231
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5232 5232
             return 'seriousgame';
@@ -5274,7 +5274,7 @@  discard block
 block discarded – undo
5274 5274
         $sql = "UPDATE $lp_table SET
5275 5275
                 prevent_reinit = $prevent_reinit ,
5276 5276
                 seriousgame_mode = $sg_mode
5277
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5277
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5278 5278
         $res = Database::query($sql);
5279 5279
         if ($res) {
5280 5280
             return true;
@@ -5326,7 +5326,7 @@  discard block
 block discarded – undo
5326 5326
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5327 5327
         }
5328 5328
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5329
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5329
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5330 5330
         $res = Database::query($sql);
5331 5331
         if (Database :: num_rows($res) > 0) {
5332 5332
             $row = Database :: fetch_array($res);
@@ -5337,13 +5337,13 @@  discard block
 block discarded – undo
5337 5337
                 $force = 1;
5338 5338
             }
5339 5339
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5340
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5340
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5341 5341
             Database::query($sql);
5342 5342
             $this->seriousgame_mode = $force;
5343 5343
             return $force;
5344 5344
         } else {
5345 5345
             if ($this->debug > 2) {
5346
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5346
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5347 5347
             }
5348 5348
         }
5349 5349
         return -1;
@@ -5361,7 +5361,7 @@  discard block
 block discarded – undo
5361 5361
         }
5362 5362
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5363 5363
         $sql = "SELECT * FROM $lp_table
5364
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5364
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5365 5365
         $res = Database::query($sql);
5366 5366
         if (Database :: num_rows($res) > 0) {
5367 5367
             $row = Database :: fetch_array($res);
@@ -5372,13 +5372,13 @@  discard block
 block discarded – undo
5372 5372
                 $force = 1;
5373 5373
             }
5374 5374
             $sql = "UPDATE $lp_table SET debug = $force
5375
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5375
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5376 5376
             $res = Database::query($sql);
5377 5377
             $this->scorm_debug = $force;
5378 5378
             return $force;
5379 5379
         } else {
5380 5380
             if ($this->debug > 2) {
5381
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5381
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5382 5382
             }
5383 5383
         }
5384 5384
         return -1;
@@ -5407,7 +5407,7 @@  discard block
 block discarded – undo
5407 5407
      * @param int $depth
5408 5408
      * @param array $tmp
5409 5409
      */
5410
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5410
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5411 5411
     {
5412 5412
         if ($this->debug > 1) {
5413 5413
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5493,7 +5493,7 @@  discard block
 block discarded – undo
5493 5493
 
5494 5494
         // we need to start a form when we want to update all the mp3 files
5495 5495
         if ($update_audio == 'true') {
5496
-            $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5496
+            $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">';
5497 5497
         }
5498 5498
         $return .= '<div id="message"></div>';
5499 5499
         if (count($this->items) == 0) {
@@ -5501,14 +5501,14 @@  discard block
 block discarded – undo
5501 5501
         } else {
5502 5502
             $return_audio = '<table class="data_table">';
5503 5503
             $return_audio .= '<tr>';
5504
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5505
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5504
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5505
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5506 5506
             $return_audio .= '</tr>';
5507 5507
 
5508 5508
             if ($update_audio != 'true') {
5509 5509
                 $return .= '<div class="col-md-12">';
5510 5510
                 $return .= self::return_new_tree($update_audio);
5511
-                $return .='</div>';
5511
+                $return .= '</div>';
5512 5512
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5513 5513
             } else {
5514 5514
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5518,7 +5518,7 @@  discard block
 block discarded – undo
5518 5518
             // We need to close the form when we are updating the mp3 files.
5519 5519
             if ($update_audio == 'true') {
5520 5520
                 $return .= '<div class="footer-audio">';
5521
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5521
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5522 5522
                 $return .= '</div>';
5523 5523
                 //$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this?
5524 5524
             }
@@ -5539,7 +5539,7 @@  discard block
 block discarded – undo
5539 5539
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5540 5540
     {
5541 5541
         $return = '';
5542
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5542
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5543 5543
 
5544 5544
         $course_id = api_get_course_int_id();
5545 5545
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5587,7 +5587,7 @@  discard block
 block discarded – undo
5587 5587
 
5588 5588
             // Link for the documents
5589 5589
             if ($arrLP[$i]['item_type'] == 'document') {
5590
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5590
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5591 5591
                 $title_cut = Display::url(
5592 5592
                     $title_cut,
5593 5593
                     $url,
@@ -5611,14 +5611,14 @@  discard block
 block discarded – undo
5611 5611
             } else {
5612 5612
                 $oddClass = 'row_even';
5613 5613
             }
5614
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5614
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5615 5615
 
5616 5616
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5617 5617
 
5618
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5618
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5619 5619
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5620 5620
             } else {
5621
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5621
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5622 5622
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5623 5623
                 } else {
5624 5624
                     if ($arrLP[$i]['item_type'] === TOOL_LP_FINAL_ITEM) {
@@ -5630,7 +5630,7 @@  discard block
 block discarded – undo
5630 5630
             }
5631 5631
 
5632 5632
             // The audio column.
5633
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5633
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5634 5634
             $audio = '';
5635 5635
 
5636 5636
             if (!$update_audio || $update_audio <> 'true') {
@@ -5641,10 +5641,10 @@  discard block
 block discarded – undo
5641 5641
             } else {
5642 5642
                 $types = self::getChapterTypes();
5643 5643
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5644
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5644
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5645 5645
                     if (!empty ($arrLP[$i]['audio'])) {
5646 5646
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5647
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5647
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5648 5648
                     }
5649 5649
                 }
5650 5650
             }
@@ -5670,7 +5670,7 @@  discard block
 block discarded – undo
5670 5670
                 // No edit for this item types
5671 5671
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset', 'final_item'))) {
5672 5672
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5673
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5673
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5674 5674
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5675 5675
                         $edit_icon .= '</a>';
5676 5676
 
@@ -5683,7 +5683,7 @@  discard block
 block discarded – undo
5683 5683
                                 $this->lp_session_id
5684 5684
                             )
5685 5685
                             ) {
5686
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5686
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5687 5687
                                     'action' => 'dissociate_forum',
5688 5688
                                     'id' => $arrLP[$i]['id'],
5689 5689
                                     'lp_id' => $this->lp_id
@@ -5694,7 +5694,7 @@  discard block
 block discarded – undo
5694 5694
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5695 5695
                                 );
5696 5696
                             } else {
5697
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5697
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5698 5698
                                     'action' => 'create_forum',
5699 5699
                                     'id' => $arrLP[$i]['id'],
5700 5700
                                     'lp_id' => $this->lp_id
@@ -5707,17 +5707,17 @@  discard block
 block discarded – undo
5707 5707
                             }
5708 5708
                         }
5709 5709
                     } else {
5710
-                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">';
5710
+                        $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">';
5711 5711
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5712 5712
                         $edit_icon .= '</a>';
5713 5713
                     }
5714 5714
                 }
5715 5715
 
5716
-                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">';
5716
+                $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'" onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">';
5717 5717
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5718 5718
                 $delete_icon .= '</a>';
5719 5719
 
5720
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5720
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5721 5721
 
5722 5722
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5723 5723
                     $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq', ['class' => 'btn btn-default']);
@@ -5726,8 +5726,8 @@  discard block
 block discarded – undo
5726 5726
                 }
5727 5727
             }
5728 5728
             if ($update_audio != 'true') {
5729
-                $row = $move_icon . ' ' . $icon .
5730
-                    Display::span($title_cut) .
5729
+                $row = $move_icon.' '.$icon.
5730
+                    Display::span($title_cut).
5731 5731
                     Display::tag(
5732 5732
                         'div',
5733 5733
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5748,8 +5748,8 @@  discard block
 block discarded – undo
5748 5748
                 $parent_arrays = array();
5749 5749
                 if ($arrLP[$i]['depth'] > 1) {
5750 5750
                     //Getting list of parents
5751
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5752
-                        foreach($arrLP as $item) {
5751
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5752
+                        foreach ($arrLP as $item) {
5753 5753
                             if ($item['id'] == $parent_id) {
5754 5754
                                 if ($item['parent_item_id'] == 0) {
5755 5755
                                     $parent_id = $item['id'];
@@ -5771,8 +5771,8 @@  discard block
 block discarded – undo
5771 5771
                     $parent_arrays = array_reverse($parent_arrays);
5772 5772
                     $val = '$elements';
5773 5773
                     $x = 0;
5774
-                    foreach($parent_arrays as $item) {
5775
-                        if ($x != count($parent_arrays) -1) {
5774
+                    foreach ($parent_arrays as $item) {
5775
+                        if ($x != count($parent_arrays) - 1) {
5776 5776
                             $val .= '["'.$item.'"]["children"]';
5777 5777
                         } else {
5778 5778
                             $val .= '["'.$item.'"]["children"]';
@@ -5835,7 +5835,7 @@  discard block
 block discarded – undo
5835 5835
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5836 5836
                     $active = 'active';
5837 5837
                 }
5838
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5838
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5839 5839
             } else {
5840 5840
                 //sections
5841 5841
                 if (isset($item['children'])) {
@@ -5858,17 +5858,17 @@  discard block
 block discarded – undo
5858 5858
     {
5859 5859
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5860 5860
         $return = '<div class="actions">';
5861
-        $return .=  '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '&isStudentView=true">' . Display :: return_icon('preview_view.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'</a> ';
5862
-        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id=' . $_SESSION['oLP']->lp_id . '&updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM).'</a>';
5863
-        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM).'</a>';
5861
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'&isStudentView=true">'.Display :: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM).'</a> ';
5862
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id='.$_SESSION['oLP']->lp_id.'&updateaudio=true">'.Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM).'</a>';
5863
+        $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM).'</a>';
5864 5864
         $buttons = array(
5865 5865
             array(
5866 5866
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5867
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5867
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5868 5868
             ),
5869 5869
             array(
5870 5870
                 'title' => get_lang('ClearAllPrerequisites'),
5871
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5871
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5872 5872
             ),
5873 5873
         );
5874 5874
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5891,7 +5891,7 @@  discard block
 block discarded – undo
5891 5891
     {
5892 5892
         // Creating learning_path folder
5893 5893
         $dir = '/learning_path';
5894
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5894
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5895 5895
         $creatorId = empty($creatorId) ? api_get_user_id() : $creatorId;
5896 5896
 
5897 5897
         $folder = false;
@@ -5938,9 +5938,9 @@  discard block
 block discarded – undo
5938 5938
         // Creating LP folder
5939 5939
         if ($folder) {
5940 5940
             //Limits title size
5941
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5941
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5942 5942
             $dir   = $dir.$title;
5943
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5943
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5944 5944
             if (!is_dir($filepath.'/'.$dir)) {
5945 5945
                 $folderData = create_unexisting_directory(
5946 5946
                     $course,
@@ -5960,7 +5960,7 @@  discard block
 block discarded – undo
5960 5960
             }
5961 5961
             $dir = $dir.'/';
5962 5962
             if ($folder) {
5963
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5963
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5964 5964
             }
5965 5965
         }
5966 5966
         $array = array(
@@ -6002,12 +6002,12 @@  discard block
 block discarded – undo
6002 6002
             $dir = substr($dir, 1);
6003 6003
         }
6004 6004
         if (!empty($dir[0]) && $dir[0] != '/') {
6005
-            $dir = '/' . $dir;
6005
+            $dir = '/'.$dir;
6006 6006
         }
6007 6007
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
6008 6008
             $dir .= '/';
6009 6009
         }
6010
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
6010
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
6011 6011
 
6012 6012
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
6013 6013
             //Generates folder
@@ -6017,7 +6017,7 @@  discard block
 block discarded – undo
6017 6017
         }
6018 6018
 
6019 6019
         if (!is_dir($filepath)) {
6020
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
6020
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
6021 6021
             $dir = '/';
6022 6022
         }
6023 6023
 
@@ -6037,10 +6037,10 @@  discard block
 block discarded – undo
6037 6037
         $tmp_filename = $filename;
6038 6038
 
6039 6039
         $i = 0;
6040
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6041
-            $tmp_filename = $filename . '_' . ++ $i;
6040
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6041
+            $tmp_filename = $filename.'_'.++ $i;
6042 6042
 
6043
-        $filename = $tmp_filename . '.'.$extension;
6043
+        $filename = $tmp_filename.'.'.$extension;
6044 6044
         if ($extension == 'html') {
6045 6045
             $content = stripslashes($content);
6046 6046
             $content = str_replace(
@@ -6075,12 +6075,12 @@  discard block
 block discarded – undo
6075 6075
             );
6076 6076
         }
6077 6077
 
6078
-        if (!file_exists($filepath . $filename)) {
6079
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6078
+        if (!file_exists($filepath.$filename)) {
6079
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6080 6080
                 fputs($fp, $content);
6081 6081
                 fclose($fp);
6082 6082
 
6083
-                $file_size = filesize($filepath . $filename);
6083
+                $file_size = filesize($filepath.$filename);
6084 6084
                 $save_file_path = $dir.$filename;
6085 6085
 
6086 6086
                 $document_id = add_document(
@@ -6118,12 +6118,12 @@  discard block
 block discarded – undo
6118 6118
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6119 6119
                         $ct = '';
6120 6120
                         if ($new_comment)
6121
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6121
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6122 6122
                         if ($new_title)
6123
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6123
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6124 6124
 
6125
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6126
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6125
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6126
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6127 6127
                         Database::query($sql);
6128 6128
                     }
6129 6129
                 }
@@ -6151,41 +6151,41 @@  discard block
 block discarded – undo
6151 6151
             $dir = substr($dir, 1);
6152 6152
 
6153 6153
         if ($dir[0] != '/')
6154
-            $dir = '/' . $dir;
6154
+            $dir = '/'.$dir;
6155 6155
 
6156 6156
         if ($dir[strlen($dir) - 1] != '/')
6157 6157
             $dir .= '/';
6158 6158
 
6159
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6159
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6160 6160
 
6161 6161
         if (!is_dir($filepath)) {
6162
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6162
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6163 6163
         }
6164 6164
 
6165 6165
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6166 6166
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6167 6167
             $document_id = intval($_POST['path']);
6168
-            $sql = "SELECT path FROM " . $table_doc . "
6169
-                    WHERE c_id = $course_id AND id = " . $document_id;
6168
+            $sql = "SELECT path FROM ".$table_doc."
6169
+                    WHERE c_id = $course_id AND id = ".$document_id;
6170 6170
             $res = Database::query($sql);
6171 6171
             $row = Database :: fetch_array($res);
6172 6172
             $content = stripslashes($_POST['content_lp']);
6173
-            $file = $filepath . $row['path'];
6173
+            $file = $filepath.$row['path'];
6174 6174
 
6175 6175
             if ($fp = @ fopen($file, 'w')) {
6176
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6176
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6177 6177
 
6178 6178
                 // Change the path of mp3 to absolute.
6179 6179
                 // The first regexp deals with :// urls.
6180
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6180
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6181 6181
                 // The second regexp deals with audio/ urls.
6182
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6182
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6183 6183
                 fputs($fp, $content);
6184 6184
                 fclose($fp);
6185 6185
 
6186
-                $sql = "UPDATE " . $table_doc ." SET
6186
+                $sql = "UPDATE ".$table_doc." SET
6187 6187
                             title='".Database::escape_string($_POST['title'])."'
6188
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6188
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6189 6189
                 Database::query($sql);
6190 6190
             }
6191 6191
         }
@@ -6203,10 +6203,10 @@  discard block
 block discarded – undo
6203 6203
         $return = '';
6204 6204
         if (is_numeric($item_id)) {
6205 6205
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6206
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6207
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6206
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6207
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6208 6208
             $result = Database::query($sql);
6209
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6209
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6210 6210
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6211 6211
 
6212 6212
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6233,8 +6233,8 @@  discard block
 block discarded – undo
6233 6233
                         break;
6234 6234
                     case TOOL_DOCUMENT:
6235 6235
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6236
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6237
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6236
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6237
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6238 6238
                         $result = Database::query($sql_doc);
6239 6239
                         $path_file = Database::result($result, 0, 0);
6240 6240
                         $path_parts = pathinfo($path_file);
@@ -6273,7 +6273,7 @@  discard block
 block discarded – undo
6273 6273
         if (is_numeric($item_id)) {
6274 6274
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6275 6275
             $sql = "SELECT * FROM $tbl_lp_item
6276
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6276
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6277 6277
             $res = Database::query($sql);
6278 6278
             $row = Database::fetch_array($res);
6279 6279
             switch ($row['item_type']) {
@@ -6283,21 +6283,21 @@  discard block
 block discarded – undo
6283 6283
                 case 'sco' :
6284 6284
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6285 6285
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6286
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6286
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6287 6287
                     } else {
6288
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6288
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6289 6289
                     }
6290 6290
                     break;
6291 6291
                 case TOOL_DOCUMENT :
6292 6292
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6293 6293
                     $sql = "SELECT lp.*, doc.path as dir
6294
-                            FROM " . $tbl_lp_item . " as lp
6295
-                            LEFT JOIN " . $tbl_doc . " as doc
6294
+                            FROM " . $tbl_lp_item." as lp
6295
+                            LEFT JOIN " . $tbl_doc." as doc
6296 6296
                             ON doc.id = lp.path
6297 6297
                             WHERE
6298 6298
                                 lp.c_id = $course_id AND
6299 6299
                                 doc.c_id = $course_id AND
6300
-                                lp.id = " . intval($item_id);
6300
+                                lp.id = ".intval($item_id);
6301 6301
                     $res_step = Database::query($sql);
6302 6302
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6303 6303
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6307,8 +6307,8 @@  discard block
 block discarded – undo
6307 6307
                     $link_id = (string) $row['path'];
6308 6308
                     if (ctype_digit($link_id)) {
6309 6309
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6310
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6311
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6310
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6311
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6312 6312
                         $res_link = Database::query($sql_select);
6313 6313
                         $row_link = Database :: fetch_array($res_link);
6314 6314
                         if (is_array($row_link)) {
@@ -6322,13 +6322,13 @@  discard block
 block discarded – undo
6322 6322
                     $_SESSION['finalItem'] = true;
6323 6323
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6324 6324
                     $sql = "SELECT lp.*, doc.path as dir
6325
-                            FROM " . $tbl_lp_item . " as lp
6326
-                            LEFT JOIN " . $tbl_doc . " as doc
6325
+                            FROM " . $tbl_lp_item." as lp
6326
+                            LEFT JOIN " . $tbl_doc." as doc
6327 6327
                             ON doc.id = lp.path
6328 6328
                             WHERE
6329 6329
                                 lp.c_id = $course_id AND
6330 6330
                                 doc.c_id = $course_id AND
6331
-                                lp.id = " . intval($item_id);
6331
+                                lp.id = ".intval($item_id);
6332 6332
                     $res_step = Database::query($sql);
6333 6333
                     $row_step = Database :: fetch_array($res_step, 'ASSOC');
6334 6334
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6337,9 +6337,9 @@  discard block
 block discarded – undo
6337 6337
                 case 'dokeos_module' :
6338 6338
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6339 6339
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6340
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6340
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6341 6341
                     } else {
6342
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6342
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6343 6343
                     }
6344 6344
                     break;
6345 6345
                 case TOOL_QUIZ :
@@ -6396,7 +6396,7 @@  discard block
 block discarded – undo
6396 6396
 
6397 6397
         $headers = array(
6398 6398
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6399
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6399
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6400 6400
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6401 6401
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6402 6402
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6437,16 +6437,16 @@  discard block
 block discarded – undo
6437 6437
         $course_id = api_get_course_int_id();
6438 6438
         $return = '';
6439 6439
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6440
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6441
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6440
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6441
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6442 6442
         $res_doc = Database::query($sql_doc);
6443 6443
         $row_doc = Database :: fetch_array($res_doc);
6444 6444
 
6445 6445
         // TODO: Add a path filter.
6446 6446
         if ($iframe) {
6447
-            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . str_replace('%2F', '/', urlencode($row_doc['path'])) . '?' . api_get_cidreq() . '"></iframe>';
6447
+            $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.str_replace('%2F', '/', urlencode($row_doc['path'])).'?'.api_get_cidreq().'"></iframe>';
6448 6448
         } else {
6449
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6449
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6450 6450
         }
6451 6451
 
6452 6452
         return $return;
@@ -6470,8 +6470,8 @@  discard block
 block discarded – undo
6470 6470
             $item_description = $extra_info['description'];
6471 6471
         } elseif (is_numeric($extra_info)) {
6472 6472
             $sql = "SELECT title, description
6473
-                    FROM " . $tbl_quiz . "
6474
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6473
+                    FROM " . $tbl_quiz."
6474
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6475 6475
 
6476 6476
             $result = Database::query($sql);
6477 6477
             $row = Database::fetch_array($result);
@@ -6481,21 +6481,21 @@  discard block
 block discarded – undo
6481 6481
             $item_title = '';
6482 6482
             $item_description = '';
6483 6483
         }
6484
-        $item_title			= Security::remove_XSS($item_title);
6485
-        $item_description 	= Security::remove_XSS($item_description);
6484
+        $item_title = Security::remove_XSS($item_title);
6485
+        $item_description = Security::remove_XSS($item_description);
6486 6486
 
6487 6487
         if ($id != 0 && is_array($extra_info))
6488 6488
             $parent = $extra_info['parent_item_id'];
6489 6489
         else
6490 6490
             $parent = 0;
6491 6491
 
6492
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6493
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6492
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6493
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6494 6494
 
6495 6495
         $result = Database::query($sql);
6496
-        $arrLP = array ();
6496
+        $arrLP = array();
6497 6497
         while ($row = Database :: fetch_array($result)) {
6498
-            $arrLP[] = array (
6498
+            $arrLP[] = array(
6499 6499
                 'id' => $row['id'],
6500 6500
                 'item_type' => $row['item_type'],
6501 6501
                 'title' => $row['title'],
@@ -6517,7 +6517,7 @@  discard block
 block discarded – undo
6517 6517
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6518 6518
         unset ($this->arrMenu);
6519 6519
 
6520
-        $form = new FormValidator('quiz_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6520
+        $form = new FormValidator('quiz_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6521 6521
         $defaults = [];
6522 6522
 
6523 6523
         if ($action == 'add') {
@@ -6529,7 +6529,7 @@  discard block
 block discarded – undo
6529 6529
         }
6530 6530
 
6531 6531
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6532
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6532
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6533 6533
         }
6534 6534
 
6535 6535
         $form->addHeader($legend);
@@ -6548,7 +6548,7 @@  discard block
 block discarded – undo
6548 6548
         );
6549 6549
         $selectParent->addOption($this->name, 0);
6550 6550
 
6551
-        $arrHide = array (
6551
+        $arrHide = array(
6552 6552
             $id
6553 6553
         );
6554 6554
         for ($i = 0; $i < count($arrLP); $i++) {
@@ -6565,7 +6565,7 @@  discard block
 block discarded – undo
6565 6565
                     $selectParent->addOption(
6566 6566
                         $arrLP[$i]['title'],
6567 6567
                         $arrLP[$i]['id'],
6568
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6568
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6569 6569
                     );
6570 6570
 
6571 6571
                     if ($parent == $arrLP[$i]['id']) {
@@ -6582,7 +6582,7 @@  discard block
 block discarded – undo
6582 6582
                 ) {
6583 6583
                     $selectParent->addOption(
6584 6584
                         $arrLP[$i]['title'],
6585
-                        $arrLP[$i]['id'], ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6585
+                        $arrLP[$i]['id'], ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6586 6586
                     );
6587 6587
 
6588 6588
                     if ($parent == $arrLP[$i]['id']) {
@@ -6600,7 +6600,7 @@  discard block
 block discarded – undo
6600 6600
 
6601 6601
         for ($i = 0; $i < count($arrLP); $i++) {
6602 6602
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6603
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
6603
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
6604 6604
 
6605 6605
                 if (is_array($extra_info)) {
6606 6606
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
@@ -6622,7 +6622,7 @@  discard block
 block discarded – undo
6622 6622
                     }
6623 6623
                 }
6624 6624
             }
6625
-            $arrHide = array ();
6625
+            $arrHide = array();
6626 6626
             for ($i = 0; $i < count($arrLP); $i++) {
6627 6627
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6628 6628
                     if (is_array($extra_info)) {
@@ -6687,7 +6687,7 @@  discard block
 block discarded – undo
6687 6687
 
6688 6688
         $form->setDefaults($defaults);
6689 6689
 
6690
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
6690
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
6691 6691
     }
6692 6692
 
6693 6693
     /**
@@ -6709,11 +6709,11 @@  discard block
 block discarded – undo
6709 6709
         } elseif (is_numeric($extra_info)) {
6710 6710
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6711 6711
 
6712
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6712
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6713 6713
                     WHERE
6714 6714
                         c_id = ".$course_id." AND
6715
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6716
-                        id = " . (int) $extra_info . "
6715
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6716
+                        id = " . (int) $extra_info."
6717 6717
                     ORDER BY id ASC";
6718 6718
 
6719 6719
             $res_hot = Database::query($sql);
@@ -6737,11 +6737,11 @@  discard block
 block discarded – undo
6737 6737
         }
6738 6738
 
6739 6739
         $sql = "SELECT * FROM $tbl_lp_item
6740
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6740
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6741 6741
         $result = Database::query($sql);
6742
-        $arrLP = array ();
6742
+        $arrLP = array();
6743 6743
         while ($row = Database :: fetch_array($result)) {
6744
-            $arrLP[] = array (
6744
+            $arrLP[] = array(
6745 6745
                 'id' => $row['id'],
6746 6746
                 'item_type' => $row['item_type'],
6747 6747
                 'title' => $row['title'],
@@ -6766,7 +6766,7 @@  discard block
 block discarded – undo
6766 6766
         else
6767 6767
             $legend .= get_lang('EditCurrentExecice');
6768 6768
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6769
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6769
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6770 6770
         }
6771 6771
         $legend .= '</legend>';
6772 6772
 
@@ -6774,11 +6774,11 @@  discard block
 block discarded – undo
6774 6774
         $return .= $legend;
6775 6775
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6776 6776
         $return .= '<tr>';
6777
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6777
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6778 6778
         $return .= '<td class="input">';
6779 6779
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6780
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6781
-        $arrHide = array (
6780
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6781
+        $arrHide = array(
6782 6782
             $id
6783 6783
         );
6784 6784
 
@@ -6786,13 +6786,13 @@  discard block
 block discarded – undo
6786 6786
             for ($i = 0; $i < count($arrLP); $i++) {
6787 6787
                 if ($action != 'add') {
6788 6788
                     if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) {
6789
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6789
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6790 6790
                     } else {
6791 6791
                         $arrHide[] = $arrLP[$i]['id'];
6792 6792
                     }
6793 6793
                 } else {
6794 6794
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6795
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6795
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6796 6796
                 }
6797 6797
             }
6798 6798
 
@@ -6803,10 +6803,10 @@  discard block
 block discarded – undo
6803 6803
         $return .= '</td>';
6804 6804
         $return .= '</tr>';
6805 6805
         $return .= '<tr>';
6806
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6806
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6807 6807
         $return .= '<td class="input">';
6808 6808
         $return .= '<select id="previous" name="previous" size="1">';
6809
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6809
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6810 6810
 
6811 6811
         for ($i = 0; $i < count($arrLP); $i++) {
6812 6812
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6816,7 +6816,7 @@  discard block
 block discarded – undo
6816 6816
                 else
6817 6817
                     $selected = '';
6818 6818
 
6819
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6819
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6820 6820
             }
6821 6821
         }
6822 6822
 
@@ -6826,8 +6826,8 @@  discard block
 block discarded – undo
6826 6826
 
6827 6827
         if ($action != 'move') {
6828 6828
             $return .= '<tr>';
6829
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6830
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6829
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6830
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6831 6831
             $return .= '</tr>';
6832 6832
             $id_prerequisite = 0;
6833 6833
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6838,7 +6838,7 @@  discard block
 block discarded – undo
6838 6838
                     }
6839 6839
                 }
6840 6840
 
6841
-                $arrHide = array ();
6841
+                $arrHide = array();
6842 6842
                 for ($i = 0; $i < count($arrLP); $i++) {
6843 6843
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6844 6844
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6852,22 +6852,22 @@  discard block
 block discarded – undo
6852 6852
         }
6853 6853
 
6854 6854
         $return .= '<tr>';
6855
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6855
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6856 6856
         $return .= '</tr>';
6857 6857
         $return .= '</table>';
6858 6858
 
6859 6859
         if ($action == 'move') {
6860
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6861
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6860
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6861
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6862 6862
         }
6863 6863
 
6864 6864
         if (is_numeric($extra_info)) {
6865
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6865
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6866 6866
         } elseif (is_array($extra_info)) {
6867
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6867
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6868 6868
         }
6869
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6870
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6869
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6870
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6871 6871
         $return .= '</form>';
6872 6872
 
6873 6873
         return $return;
@@ -6890,8 +6890,8 @@  discard block
 block discarded – undo
6890 6890
             $item_title = stripslashes($extra_info['title']);
6891 6891
         } elseif (is_numeric($extra_info)) {
6892 6892
             $sql = "SELECT forum_title as title, forum_comment as comment
6893
-                    FROM " . $tbl_forum . "
6894
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6893
+                    FROM " . $tbl_forum."
6894
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6895 6895
 
6896 6896
             $result = Database::query($sql);
6897 6897
             $row = Database :: fetch_array($result);
@@ -6909,7 +6909,7 @@  discard block
 block discarded – undo
6909 6909
             $parent = 0;
6910 6910
         }
6911 6911
 
6912
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6912
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6913 6913
                 WHERE
6914 6914
                     c_id = ".$course_id." AND
6915 6915
                     lp_id = " . $this->lp_id;
@@ -6917,7 +6917,7 @@  discard block
 block discarded – undo
6917 6917
         $arrLP = array();
6918 6918
 
6919 6919
         while ($row = Database :: fetch_array($result)) {
6920
-            $arrLP[] = array (
6920
+            $arrLP[] = array(
6921 6921
                 'id' => $row['id'],
6922 6922
                 'item_type' => $row['item_type'],
6923 6923
                 'title' => $row['title'],
@@ -6946,7 +6946,7 @@  discard block
 block discarded – undo
6946 6946
             $legend = get_lang('EditCurrentForum');
6947 6947
         }
6948 6948
 
6949
-        $form = new FormValidator('forum_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
6949
+        $form = new FormValidator('forum_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
6950 6950
         $defaults = [];
6951 6951
 
6952 6952
         $form->addHeader($legend);
@@ -6975,7 +6975,7 @@  discard block
 block discarded – undo
6975 6975
                     $selectParent->addOption(
6976 6976
                         $arrLP[$i]['title'],
6977 6977
                         $arrLP[$i]['id'],
6978
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6978
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6979 6979
                     );
6980 6980
 
6981 6981
                     if ($parent == $arrLP[$i]['id']) {
@@ -6993,7 +6993,7 @@  discard block
 block discarded – undo
6993 6993
                     $selectParent->addOption(
6994 6994
                         $arrLP[$i]['title'],
6995 6995
                         $arrLP[$i]['id'],
6996
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
6996
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
6997 6997
                     );
6998 6998
 
6999 6999
                     if ($parent == $arrLP[$i]['id']) {
@@ -7016,7 +7016,7 @@  discard block
 block discarded – undo
7016 7016
 
7017 7017
         for ($i = 0; $i < count($arrLP); $i++) {
7018 7018
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7019
-                $selectPrevious->addOption(get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', $arrLP[$i]['id']);
7019
+                $selectPrevious->addOption(get_lang('After').' "'.$arrLP[$i]['title'].'"', $arrLP[$i]['id']);
7020 7020
 
7021 7021
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7022 7022
                     $selectPrevious->setSelected($arrLP[$i]['id']);
@@ -7068,7 +7068,7 @@  discard block
 block discarded – undo
7068 7068
         $form->addHidden('post_time', time());
7069 7069
         $form->setDefaults($defaults);
7070 7070
 
7071
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
7071
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
7072 7072
     }
7073 7073
 
7074 7074
     /**
@@ -7091,7 +7091,7 @@  discard block
 block discarded – undo
7091 7091
             $item_title = stripslashes($extra_info['title']);
7092 7092
         } elseif (is_numeric($extra_info)) {
7093 7093
             $sql = "SELECT thread_title as title FROM $tbl_forum
7094
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7094
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7095 7095
 
7096 7096
             $result = Database::query($sql);
7097 7097
             $row = Database :: fetch_array($result);
@@ -7109,15 +7109,15 @@  discard block
 block discarded – undo
7109 7109
             $parent = 0;
7110 7110
         }
7111 7111
 
7112
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7113
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7112
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7113
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7114 7114
 
7115 7115
         $result = Database::query($sql);
7116 7116
 
7117
-        $arrLP = array ();
7117
+        $arrLP = array();
7118 7118
 
7119 7119
         while ($row = Database :: fetch_array($result)) {
7120
-            $arrLP[] = array (
7120
+            $arrLP[] = array(
7121 7121
                 'id' => $row['id'],
7122 7122
                 'item_type' => $row['item_type'],
7123 7123
                 'title' => $row['title'],
@@ -7138,7 +7138,7 @@  discard block
 block discarded – undo
7138 7138
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7139 7139
         unset ($this->arrMenu);
7140 7140
 
7141
-        $form = new FormValidator('thread_form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7141
+        $form = new FormValidator('thread_form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7142 7142
         $defaults = [];
7143 7143
 
7144 7144
         if ($action == 'add') {
@@ -7158,7 +7158,7 @@  discard block
 block discarded – undo
7158 7158
         );
7159 7159
         $selectParent->addOption($this->name, 0);
7160 7160
 
7161
-        $arrHide = array (
7161
+        $arrHide = array(
7162 7162
             $id
7163 7163
         );
7164 7164
 
@@ -7176,7 +7176,7 @@  discard block
 block discarded – undo
7176 7176
                     $selectParent->addOption(
7177 7177
                         $arrLP[$i]['title'],
7178 7178
                         $arrLP[$i]['id'],
7179
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7179
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7180 7180
                     );
7181 7181
 
7182 7182
                     if ($parent == $arrLP[$i]['id']) {
@@ -7194,7 +7194,7 @@  discard block
 block discarded – undo
7194 7194
                     $selectParent->addOption(
7195 7195
                         $arrLP[$i]['title'],
7196 7196
                         $arrLP[$i]['id'],
7197
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7197
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7198 7198
                     );
7199 7199
 
7200 7200
                     if ($parent == $arrLP[$i]['id']) {
@@ -7214,7 +7214,7 @@  discard block
 block discarded – undo
7214 7214
         for ($i = 0; $i < count($arrLP); $i++) {
7215 7215
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7216 7216
                 $selectPrevious->addOption(
7217
-                    get_lang('After')  . ' "' . $arrLP[$i]['title'] . '"',
7217
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
7218 7218
                     $arrLP[$i]['id']
7219 7219
                 );
7220 7220
 
@@ -7312,10 +7312,10 @@  discard block
 block discarded – undo
7312 7312
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7313 7313
 
7314 7314
         if ($id != 0 && is_array($extra_info)) {
7315
-            $item_title 		= $extra_info['title'];
7316
-            $item_description 	= $extra_info['description'];
7317
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7318
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7315
+            $item_title = $extra_info['title'];
7316
+            $item_description = $extra_info['description'];
7317
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7318
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7319 7319
         } else {
7320 7320
             $item_title = '';
7321 7321
             $item_description = '';
@@ -7329,17 +7329,17 @@  discard block
 block discarded – undo
7329 7329
         }
7330 7330
 
7331 7331
         $id  = intval($id);
7332
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7332
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7333 7333
                 WHERE
7334 7334
                     c_id = ".$course_id." AND
7335
-                    lp_id = " . $this->lp_id . " AND
7335
+                    lp_id = " . $this->lp_id." AND
7336 7336
                     id != $id";
7337 7337
 
7338 7338
         if ($item_type == 'module')
7339 7339
             $sql .= " AND parent_item_id = 0";
7340 7340
 
7341 7341
         $result = Database::query($sql);
7342
-        $arrLP = array ();
7342
+        $arrLP = array();
7343 7343
 
7344 7344
         while ($row = Database :: fetch_array($result)) {
7345 7345
             $arrLP[] = array(
@@ -7367,9 +7367,9 @@  discard block
 block discarded – undo
7367 7367
 
7368 7368
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7369 7369
 
7370
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7370
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7371 7371
 
7372
-        $form = new FormValidator('form', 'POST',  $url);
7372
+        $form = new FormValidator('form', 'POST', $url);
7373 7373
 
7374 7374
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7375 7375
         $defaults['description'] = $item_description;
@@ -7413,7 +7413,7 @@  discard block
 block discarded – undo
7413 7413
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7414 7414
 
7415 7415
             foreach ($arrHide as $key => $value) {
7416
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7416
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7417 7417
             }
7418 7418
             if (!empty($s_selected_parent)) {
7419 7419
                 $parent_select->setSelected($s_selected_parent);
@@ -7435,16 +7435,16 @@  discard block
 block discarded – undo
7435 7435
                     $s_selected_position = $arrLP[$i]['id'];
7436 7436
                 }
7437 7437
 
7438
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7438
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7439 7439
             }
7440 7440
         }
7441 7441
 
7442 7442
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7443 7443
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7444
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7444
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7445 7445
 
7446 7446
         foreach ($arrHide as $key => $value) {
7447
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7447
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7448 7448
         }
7449 7449
 
7450 7450
         if (!empty ($s_selected_position)) {
@@ -7473,23 +7473,23 @@  discard block
 block discarded – undo
7473 7473
         //assets can't be modified
7474 7474
 
7475 7475
         //$item_type == 'asset' ||
7476
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7476
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7477 7477
 
7478 7478
             if ($item_type == 'sco') {
7479
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7479
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7480 7480
             }
7481 7481
             $renderer = $form->defaultRenderer();
7482 7482
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7483 7483
 
7484 7484
             $relative_prefix = '';
7485 7485
 
7486
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7486
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7487 7487
                 'Width' 				=> '100%',
7488 7488
                 'Height' 				=> '500',
7489 7489
                 'FullPage' 				=> true,
7490 7490
                 'CreateDocumentDir' 	=> $relative_prefix,
7491
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7492
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7491
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7492
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7493 7493
             );
7494 7494
 
7495 7495
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7498,7 +7498,7 @@  discard block
 block discarded – undo
7498 7498
             $defaults['content_lp'] = file_get_contents($content_path);
7499 7499
         }
7500 7500
 
7501
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7501
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7502 7502
         $form->addElement('hidden', 'post_time', time());
7503 7503
         $form->setDefaults($defaults);
7504 7504
         return $form->return_form();
@@ -7536,8 +7536,8 @@  discard block
 block discarded – undo
7536 7536
         // We don't display the document form if it's not an editable document (html or txt file).
7537 7537
         if ($action == "add") {
7538 7538
             if (is_numeric($extra_info)) {
7539
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7540
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7539
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7540
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7541 7541
                 $result = Database::query($sql_doc);
7542 7542
                 $path_file = Database :: result($result, 0, 0);
7543 7543
                 $path_parts = pathinfo($path_file);
@@ -7555,13 +7555,13 @@  discard block
 block discarded – undo
7555 7555
                 $item_title = stripslashes($path_parts['filename']);
7556 7556
             }
7557 7557
         } elseif (is_numeric($extra_info)) {
7558
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7558
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7559 7559
                         WHERE
7560 7560
                             c_id = ".$course_id." AND
7561 7561
                             id = " . intval($extra_info);
7562 7562
 
7563 7563
             $result = Database::query($sql_doc);
7564
-            $row 	= Database::fetch_array($result);
7564
+            $row = Database::fetch_array($result);
7565 7565
             $item_title = $row['title'];
7566 7566
             $item_title = str_replace('_', ' ', $item_title);
7567 7567
             if (empty ($item_title)) {
@@ -7580,11 +7580,11 @@  discard block
 block discarded – undo
7580 7580
             $parent = 0;
7581 7581
         }
7582 7582
 
7583
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7584
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7583
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7584
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7585 7585
 
7586 7586
         $result = Database::query($sql);
7587
-        $arrLP = array ();
7587
+        $arrLP = array();
7588 7588
         while ($row = Database :: fetch_array($result)) {
7589 7589
             $arrLP[] = array(
7590 7590
                 'id' => $row['id'],
@@ -7618,9 +7618,9 @@  discard block
 block discarded – undo
7618 7618
         $return .= '</legend>';
7619 7619
 
7620 7620
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7621
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7621
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7622 7622
         }
7623
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7623
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7624 7624
         $defaults['title'] = Security :: remove_XSS($item_title);
7625 7625
         if (empty($item_title)) {
7626 7626
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7656,15 +7656,15 @@  discard block
 block discarded – undo
7656 7656
         }
7657 7657
 
7658 7658
         $parent_select = $form->addSelect('parent', get_lang('Parent'), [], ['id' => 'idParent', 'onchange' => 'javascript: load_cbo(this.value);']);
7659
-        $my_count=0;
7659
+        $my_count = 0;
7660 7660
         foreach ($arrHide as $key => $value) {
7661
-            if ($my_count!=0) {
7661
+            if ($my_count != 0) {
7662 7662
                 // The LP name is also the first section and is not in the same charset like the other sections.
7663 7663
                 $value['value'] = Security :: remove_XSS($value['value']);
7664
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7664
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7665 7665
             } else {
7666 7666
                 $value['value'] = Security :: remove_XSS($value['value']);
7667
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7667
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7668 7668
             }
7669 7669
             $my_count++;
7670 7670
         }
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
         if (!empty($id)) {
7673 7673
             $parent_select->setSelected($parent);
7674 7674
         } else {
7675
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7675
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7676 7676
             $parent_select->setSelected($parent_item_id);
7677 7677
         }
7678 7678
 
@@ -7689,7 +7689,7 @@  discard block
 block discarded – undo
7689 7689
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') {
7690 7690
                     $s_selected_position = $arrLP[$i]['id'];
7691 7691
                 }
7692
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7692
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7693 7693
             }
7694 7694
         }
7695 7695
 
@@ -7697,8 +7697,8 @@  discard block
 block discarded – undo
7697 7697
         $position->addOption(get_lang('FirstPosition'), 0);
7698 7698
 
7699 7699
         foreach ($arrHide as $key => $value) {
7700
-            $padding = isset($value['padding']) ? $value['padding']: 20;
7701
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7700
+            $padding = isset($value['padding']) ? $value['padding'] : 20;
7701
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7702 7702
         }
7703 7703
 
7704 7704
         $position->setSelected($s_selected_position);
@@ -7769,7 +7769,7 @@  discard block
 block discarded – undo
7769 7769
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7770 7770
                             $relative_path 	 = implode('/', $relative_path);
7771 7771
                             if (strlen($relative_path) > 0) {
7772
-                                $relative_path = $relative_path . '/';
7772
+                                $relative_path = $relative_path.'/';
7773 7773
                             }
7774 7774
                         } else {
7775 7775
                             $result = $this->generate_lp_folder($_course);
@@ -7783,8 +7783,8 @@  discard block
 block discarded – undo
7783 7783
                             'Height' 				=> '500',
7784 7784
                             'FullPage' 				=> true,
7785 7785
                             'CreateDocumentDir' 	=> $relative_prefix,
7786
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7787
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7786
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7787
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7788 7788
                         );
7789 7789
 
7790 7790
                         if ($_GET['action'] == 'add_item') {
@@ -7851,8 +7851,8 @@  discard block
 block discarded – undo
7851 7851
             $item_url = stripslashes($extra_info['url']);
7852 7852
         } elseif (is_numeric($extra_info)) {
7853 7853
             $extra_info = intval($extra_info);
7854
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7855
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7854
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7855
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7856 7856
             $result = Database::query($sql);
7857 7857
             $row = Database :: fetch_array($result);
7858 7858
             $item_title       = $row['title'];
@@ -7864,7 +7864,7 @@  discard block
 block discarded – undo
7864 7864
             $item_url = '';
7865 7865
         }
7866 7866
 
7867
-        $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7867
+        $form = new FormValidator('edit_link', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING']);
7868 7868
         $defaults = [];
7869 7869
 
7870 7870
         if ($id != 0 && is_array($extra_info)) {
@@ -7873,8 +7873,8 @@  discard block
 block discarded – undo
7873 7873
             $parent = 0;
7874 7874
         }
7875 7875
 
7876
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7877
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7876
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7877
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7878 7878
         $result = Database::query($sql);
7879 7879
         $arrLP = array();
7880 7880
 
@@ -7942,7 +7942,7 @@  discard block
 block discarded – undo
7942 7942
                     $selectParent->addOption(
7943 7943
                         $arrLP[$i]['title'],
7944 7944
                         $arrLP[$i]['id'],
7945
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px;']
7945
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px;']
7946 7946
                     );
7947 7947
 
7948 7948
                     if ($parent == $arrLP[$i]['id']) {
@@ -7956,7 +7956,7 @@  discard block
 block discarded – undo
7956 7956
                     $selectParent->addOption(
7957 7957
                         $arrLP[$i]['title'],
7958 7958
                         $arrLP[$i]['id'],
7959
-                        ['style' => 'padding-left: ' . (20 + $arrLP[$i]['depth'] * 20) . 'px']
7959
+                        ['style' => 'padding-left: '.(20 + $arrLP[$i]['depth'] * 20).'px']
7960 7960
                     );
7961 7961
 
7962 7962
                     if ($parent_item_id == $arrLP[$i]['id']) {
@@ -8043,7 +8043,7 @@  discard block
 block discarded – undo
8043 8043
 
8044 8044
         $form->setDefaults($defaults);
8045 8045
 
8046
-        return '<div class="sectioncomment">' . $form->returnForm() . '</div>';
8046
+        return '<div class="sectioncomment">'.$form->returnForm().'</div>';
8047 8047
     }
8048 8048
 
8049 8049
     /**
@@ -8065,8 +8065,8 @@  discard block
 block discarded – undo
8065 8065
         } elseif (is_numeric($extra_info)) {
8066 8066
             $extra_info = intval($extra_info);
8067 8067
             $sql = "SELECT title, description
8068
-                    FROM " . $tbl_publication . "
8069
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
8068
+                    FROM " . $tbl_publication."
8069
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
8070 8070
 
8071 8071
             $result = Database::query($sql);
8072 8072
             $row = Database :: fetch_array($result);
@@ -8082,13 +8082,13 @@  discard block
 block discarded – undo
8082 8082
             $parent = 0;
8083 8083
         }
8084 8084
 
8085
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8086
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8085
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8086
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8087 8087
 
8088 8088
         $result = Database::query($sql);
8089 8089
         $arrLP = array();
8090 8090
         while ($row = Database :: fetch_array($result)) {
8091
-            $arrLP[] = array (
8091
+            $arrLP[] = array(
8092 8092
                 'id' => $row['id'],
8093 8093
                 'item_type' => $row['item_type'],
8094 8094
                 'title' => $row['title'],
@@ -8134,7 +8134,7 @@  discard block
 block discarded – undo
8134 8134
             ]
8135 8135
         );
8136 8136
 
8137
-        $arrHide = array (
8137
+        $arrHide = array(
8138 8138
             $id
8139 8139
         );
8140 8140
 
@@ -8152,7 +8152,7 @@  discard block
 block discarded – undo
8152 8152
                     $parentSelect->addOption(
8153 8153
                         $arrLP[$i]['title'],
8154 8154
                         $arrLP[$i]['id'],
8155
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8155
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8156 8156
                     );
8157 8157
 
8158 8158
                     if ($parent == $arrLP[$i]['id']) {
@@ -8169,7 +8169,7 @@  discard block
 block discarded – undo
8169 8169
                     $parentSelect->addOption(
8170 8170
                         $arrLP[$i]['title'],
8171 8171
                         $arrLP[$i]['id'],
8172
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8172
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8173 8173
                     );
8174 8174
 
8175 8175
                     if ($parent == $arrLP[$i]['id']) {
@@ -8193,7 +8193,7 @@  discard block
 block discarded – undo
8193 8193
         for ($i = 0; $i < count($arrLP); $i++) {
8194 8194
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8195 8195
                 $previousSelect->addOption(
8196
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8196
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8197 8197
                     $arrLP[$i]['id']
8198 8198
                 );
8199 8199
 
@@ -8215,7 +8215,7 @@  discard block
 block discarded – undo
8215 8215
                     }
8216 8216
                 }
8217 8217
             }
8218
-            $arrHide = array ();
8218
+            $arrHide = array();
8219 8219
             for ($i = 0; $i < count($arrLP); $i++) {
8220 8220
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8221 8221
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8307,8 +8307,8 @@  discard block
 block discarded – undo
8307 8307
 
8308 8308
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8309 8309
         $item_id = intval($item_id);
8310
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8311
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8310
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8311
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8312 8312
         $result = Database::query($sql);
8313 8313
         $row = Database::fetch_assoc($result);
8314 8314
 
@@ -8322,16 +8322,16 @@  discard block
 block discarded – undo
8322 8322
             $audio_player .= '<script>
8323 8323
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8324 8324
                                 s1.addParam("allowscriptaccess","always");
8325
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8325
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8326 8326
                                 s1.write("container");
8327 8327
                             </script>';
8328 8328
         }
8329 8329
 
8330
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8330
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8331 8331
 
8332 8332
         $return .= Display::url(
8333 8333
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8334
-            $url.'&action=edit_item&path_item=' . $row['path']
8334
+            $url.'&action=edit_item&path_item='.$row['path']
8335 8335
         );
8336 8336
 
8337 8337
         $return .= Display::url(
@@ -8351,7 +8351,7 @@  discard block
 block discarded – undo
8351 8351
             $url.'&action=delete_item'
8352 8352
         );
8353 8353
 
8354
-        if ($item_type == TOOL_HOTPOTATOES ) {
8354
+        if ($item_type == TOOL_HOTPOTATOES) {
8355 8355
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8356 8356
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8357 8357
         }
@@ -8377,13 +8377,13 @@  discard block
 block discarded – undo
8377 8377
     public function get_js_dropdown_array()
8378 8378
     {
8379 8379
         $course_id = api_get_course_int_id();
8380
-        $return = 'var child_name = new Array();' . "\n";
8381
-        $return .= 'var child_value = new Array();' . "\n\n";
8382
-        $return .= 'child_name[0] = new Array();' . "\n";
8383
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8380
+        $return = 'var child_name = new Array();'."\n";
8381
+        $return .= 'var child_value = new Array();'."\n\n";
8382
+        $return .= 'child_name[0] = new Array();'."\n";
8383
+        $return .= 'child_value[0] = new Array();'."\n\n";
8384 8384
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8385
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8386
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8385
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8386
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8387 8387
                     ORDER BY display_order ASC";
8388 8388
         $res_zero = Database::query($sql_zero);
8389 8389
         $i = 0;
@@ -8393,28 +8393,28 @@  discard block
 block discarded – undo
8393 8393
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8394 8394
             }
8395 8395
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8396
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8397
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8396
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8397
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8398 8398
         }
8399 8399
         $return .= "\n";
8400
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8401
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8400
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8401
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8402 8402
         $res = Database::query($sql);
8403 8403
         while ($row = Database :: fetch_array($res)) {
8404
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8404
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8405 8405
                            WHERE
8406 8406
                                 c_id = ".$course_id." AND
8407
-                                parent_item_id = " . $row['id'] . "
8407
+                                parent_item_id = " . $row['id']."
8408 8408
                            ORDER BY display_order ASC";
8409 8409
             $res_parent = Database::query($sql_parent);
8410 8410
             $i = 0;
8411
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8412
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8411
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8412
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8413 8413
 
8414 8414
             while ($row_parent = Database :: fetch_array($res_parent)) {
8415 8415
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8416
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8417
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8416
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8417
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8418 8418
             }
8419 8419
             $return .= "\n";
8420 8420
         }
@@ -8435,8 +8435,8 @@  discard block
 block discarded – undo
8435 8435
         if (is_numeric($item_id)) {
8436 8436
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8437 8437
 
8438
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8439
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8438
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8439
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8440 8440
 
8441 8441
             $res = Database::query($sql);
8442 8442
             $row = Database :: fetch_array($res);
@@ -8495,7 +8495,7 @@  discard block
 block discarded – undo
8495 8495
      */
8496 8496
     public function display_item_small_form($item_type, $title = '', $data = array())
8497 8497
     {
8498
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8498
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8499 8499
         $form = new FormValidator('small_form', 'post', $url);
8500 8500
         $form->addElement('header', $title);
8501 8501
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8521,7 +8521,7 @@  discard block
 block discarded – undo
8521 8521
         $item_id = intval($item_id);
8522 8522
         /* Current prerequisite */
8523 8523
         $sql = "SELECT * FROM $tbl_lp_item
8524
-                WHERE c_id = $course_id AND id = " . $item_id;
8524
+                WHERE c_id = $course_id AND id = ".$item_id;
8525 8525
         $result = Database::query($sql);
8526 8526
         $row    = Database::fetch_array($result);
8527 8527
         $prerequisiteId = $row['prerequisite'];
@@ -8531,20 +8531,20 @@  discard block
 block discarded – undo
8531 8531
         $return .= '<form method="POST">';
8532 8532
         $return .= '<table class="data_table">';
8533 8533
         $return .= '<tr>';
8534
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8535
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8536
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8534
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8535
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8536
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8537 8537
         $return .= '</tr>';
8538 8538
 
8539 8539
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8540 8540
         $return .= '<tr >';
8541 8541
         $return .= '<td colspan="3" class="radio">';
8542 8542
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8543
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8543
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8544 8544
         $return .= '</tr>';
8545 8545
 
8546 8546
         $sql = "SELECT * FROM $tbl_lp_item
8547
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8547
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8548 8548
         $result = Database::query($sql);
8549 8549
         $arrLP = array();
8550 8550
 
@@ -8587,25 +8587,25 @@  discard block
 block discarded – undo
8587 8587
             }
8588 8588
 
8589 8589
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8590
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8590
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8591 8591
 
8592 8592
             $return .= '<tr>';
8593
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8594
-            $return .= '<label for="id' . $item['id'] . '">';
8595
-            $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . (($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />';
8593
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8594
+            $return .= '<label for="id'.$item['id'].'">';
8595
+            $return .= '<input'.(in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '').(($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" style="margin-left:'.$item['depth'] * 10.'px; margin-right:10px;" type="radio" value="'.$item['id'].'" />';
8596 8596
             $icon_name = str_replace(' ', '', $item['item_type']);
8597 8597
 
8598
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8599
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8598
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8599
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8600 8600
             } else {
8601
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8602
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8601
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8602
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8603 8603
                 } else {
8604 8604
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8605 8605
                 }
8606 8606
             }
8607 8607
 
8608
-            $return .=  $item['title'] . '</label>';
8608
+            $return .= $item['title'].'</label>';
8609 8609
             $return .= '</td>';
8610 8610
 
8611 8611
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8619,19 +8619,19 @@  discard block
 block discarded – undo
8619 8619
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8620 8620
 
8621 8621
                 $return .= '<td class="exercise">';
8622
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8622
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8623 8623
                 $return .= '</td>';
8624 8624
                 $return .= '<td class="exercise">';
8625
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8625
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8626 8626
                 $return .= '</td>';
8627 8627
             }
8628 8628
 
8629 8629
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8630 8630
                 $return .= '<td class="exercise">';
8631
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8631
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8632 8632
                 $return .= '</td>';
8633 8633
                 $return .= '<td class="exercise"">';
8634
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8634
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8635 8635
                 $return .= '</td>';
8636 8636
             }
8637 8637
             $return .= '</tr>';
@@ -8640,7 +8640,7 @@  discard block
 block discarded – undo
8640 8640
         $return .= '</tr>';
8641 8641
         $return .= '</table>';
8642 8642
         $return .= '<div style="padding-top:3px;">';
8643
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8643
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8644 8644
         $return .= '</form>';
8645 8645
 
8646 8646
         return $return;
@@ -8676,7 +8676,7 @@  discard block
 block discarded – undo
8676 8676
                 if ($row['id'] == $lp_id) {
8677 8677
                     continue;
8678 8678
                 }
8679
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8679
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8680 8680
             }
8681 8681
         }
8682 8682
         $return .= '</select>';
@@ -8736,8 +8736,8 @@  discard block
 block discarded – undo
8736 8736
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8737 8737
                      ORDER BY title ASC";
8738 8738
 
8739
-        $sql_hot  = "SELECT * FROM $tbl_doc
8740
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8739
+        $sql_hot = "SELECT * FROM $tbl_doc
8740
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8741 8741
                      ORDER BY id ASC";
8742 8742
 
8743 8743
         $res_quiz = Database::query($sql_quiz);
@@ -8746,8 +8746,8 @@  discard block
 block discarded – undo
8746 8746
         $return = '<ul class="lp_resource">';
8747 8747
         $return .= '<li class="lp_resource_element">';
8748 8748
         $return .= Display::return_icon('new_test_small.gif');
8749
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8750
-            get_lang('NewExercise') . '</a>';
8749
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8750
+            get_lang('NewExercise').'</a>';
8751 8751
         $return .= '</li>';
8752 8752
 
8753 8753
         // Display hotpotatoes
@@ -8759,8 +8759,8 @@  discard block
 block discarded – undo
8759 8759
             $return .= '</a> ';
8760 8760
 
8761 8761
             $return .= Display::return_icon('hotpotatoes_s.png');
8762
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8763
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8762
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8763
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8764 8764
             $return .= '</li>';
8765 8765
         }
8766 8766
 
@@ -8770,7 +8770,7 @@  discard block
 block discarded – undo
8770 8770
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8771 8771
             $return .= '</a> ';
8772 8772
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8773
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8773
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8774 8774
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8775 8775
                 '</a>';
8776 8776
             $return .= '</li>';
@@ -8844,7 +8844,7 @@  discard block
 block discarded – undo
8844 8844
         foreach ($categorizedLinks as $categoryId => $links) {
8845 8845
             $linkNodes = null;
8846 8846
             foreach ($links as $key => $title) {
8847
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8847
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8848 8848
                     $linkNodes .=
8849 8849
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8850 8850
                         <a class="moved" href="#">'.
@@ -8882,7 +8882,7 @@  discard block
 block discarded – undo
8882 8882
         $return = '<div class="lp_resource" >';
8883 8883
         $return .= '<div class="lp_resource_element">';
8884 8884
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8885
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8885
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8886 8886
         $return .= '</div>';
8887 8887
         $return .= '</div>';
8888 8888
         return $return;
@@ -8905,7 +8905,7 @@  discard block
 block discarded – undo
8905 8905
         $return .= Display::return_icon('forum_new_small.gif');
8906 8906
         $return .= Display::url(
8907 8907
             get_lang('CreateANewForum'),
8908
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8908
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8909 8909
                 'action' => 'add',
8910 8910
                 'content' => 'forum',
8911 8911
                 'lp_id' => $this->lp_id
@@ -8933,15 +8933,15 @@  discard block
 block discarded – undo
8933 8933
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8934 8934
                 $return .= ' </a>';
8935 8935
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8936
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8937
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8936
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8937
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8938 8938
                             </a>
8939
-                            <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' .
8940
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8939
+                            <a href="' . api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_FORUM.'&forum_id='.$forum['forum_id'].'&lp_id='.$this->lp_id.'" style="vertical-align:middle">'.
8940
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8941 8941
 
8942 8942
                 $return .= '</li>';
8943 8943
 
8944
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8944
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8945 8945
                 $a_threads = get_threads($forum['forum_id']);
8946 8946
                 if (is_array($a_threads)) {
8947 8947
                     foreach ($a_threads as $thread) {
@@ -8950,8 +8950,8 @@  discard block
 block discarded – undo
8950 8950
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8951 8951
                         $return .= ' </a>';
8952 8952
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8953
-                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' .
8954
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8953
+                        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'.
8954
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8955 8955
                         $return .= '</li>';
8956 8956
                     }
8957 8957
                 }
@@ -9022,7 +9022,7 @@  discard block
 block discarded – undo
9022 9022
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
9023 9023
             // Remove the possible . at the end of the path.
9024 9024
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
9025
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9025
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
9026 9026
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
9027 9027
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
9028 9028
         }
@@ -9090,7 +9090,7 @@  discard block
 block discarded – undo
9090 9090
                 if ($item->type == 'sco') {
9091 9091
                     $inc_docs = $item->get_resources_from_source(
9092 9092
                         null,
9093
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9093
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9094 9094
                     );
9095 9095
                 } else {
9096 9096
                     $inc_docs = $item->get_resources_from_source();
@@ -9306,7 +9306,7 @@  discard block
 block discarded – undo
9306 9306
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9307 9307
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9308 9308
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9309
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9309
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9310 9310
                                         $my_dep->setAttribute('xml:base', '');
9311 9311
                                     }
9312 9312
                                 }
@@ -9437,7 +9437,7 @@  discard block
 block discarded – undo
9437 9437
                         //$my_item->appendChild($my_max_score);
9438 9438
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9439 9439
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9440
-                        $my_prereqs->setAttribute('type','aicc_script');
9440
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9441 9441
                         $my_item->appendChild($my_prereqs);
9442 9442
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9443 9443
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9490,7 +9490,7 @@  discard block
 block discarded – undo
9490 9490
                         $my_resource->appendChild($my_file);
9491 9491
 
9492 9492
                         // Get included docs.
9493
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9493
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9494 9494
                         // Dependency to other files - not yet supported.
9495 9495
                         $i = 1;
9496 9496
                         foreach ($inc_docs as $doc_info) {
@@ -9551,7 +9551,7 @@  discard block
 block discarded – undo
9551 9551
                                         $my_dep_file->setAttribute('href', $file_path);
9552 9552
                                         $my_dep->setAttribute('xml:base', '');
9553 9553
 
9554
-                                        if (strstr($file_path,$main_path) !== false) {
9554
+                                        if (strstr($file_path, $main_path) !== false) {
9555 9555
                                             // The calculated real path is really inside the chamilo root path.
9556 9556
                                             // Reduce file path to what's under the DocumentRoot.
9557 9557
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9569,7 +9569,7 @@  discard block
 block discarded – undo
9569 9569
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9570 9570
                                             $file_path = str_replace('//', '/', $file_path);
9571 9571
                                             if (file_exists($file_path)) {
9572
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9572
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9573 9573
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9574 9574
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9575 9575
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9798,7 +9798,7 @@  discard block
 block discarded – undo
9798 9798
             if (strpos($extra_file, '.') === 0)
9799 9799
                 continue;
9800 9800
             else {
9801
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9801
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9802 9802
                 $this->create_path($dest_file);
9803 9803
                 copy($main_code_path.$extra_file, $dest_file);
9804 9804
             }
@@ -9851,7 +9851,7 @@  discard block
 block discarded – undo
9851 9851
                             }
9852 9852
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9853 9853
                             if (file_exists($file_path)) {
9854
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9854
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9855 9855
                             }
9856 9856
                             break;
9857 9857
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9891,12 +9891,12 @@  discard block
 block discarded – undo
9891 9891
 
9892 9892
         foreach ($path_bits as $bit) {
9893 9893
             if (!empty ($bit)) {
9894
-                $new_path = $path_built . $bit;
9894
+                $new_path = $path_built.$bit;
9895 9895
                 if (is_dir($new_path)) {
9896
-                    $path_built = $new_path . '/';
9896
+                    $path_built = $new_path.'/';
9897 9897
                 } else {
9898 9898
                     mkdir($new_path, api_get_permissions_for_new_directories());
9899
-                    $path_built = $new_path . '/';
9899
+                    $path_built = $new_path.'/';
9900 9900
                 }
9901 9901
             }
9902 9902
         }
@@ -9940,9 +9940,9 @@  discard block
 block discarded – undo
9940 9940
 
9941 9941
         if ($upload_ok) {
9942 9942
             if ($has_attachment) {
9943
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9943
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9944 9944
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9945
-                $updir = $sys_course_path . $courseDir;
9945
+                $updir = $sys_course_path.$courseDir;
9946 9946
                 // Try to add an extension to the file if it hasn't one.
9947 9947
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9948 9948
 
@@ -9997,7 +9997,7 @@  discard block
 block discarded – undo
9997 9997
             //Setting my lp_id to autolaunch = 1
9998 9998
             $attributes['autolaunch'] = 1;
9999 9999
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
10000
-            Database::update($lp_table, $attributes, $where );
10000
+            Database::update($lp_table, $attributes, $where);
10001 10001
         }
10002 10002
     }
10003 10003
 
@@ -10016,13 +10016,13 @@  discard block
 block discarded – undo
10016 10016
 
10017 10017
         // Get the max order of the items
10018 10018
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
10019
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
10019
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
10020 10020
         $rs_max_order = Database::query($sql_max_order);
10021 10021
         $row_max_order = Database::fetch_object($rs_max_order);
10022 10022
         $max_order = $row_max_order->display_order;
10023 10023
         // Get the previous item ID
10024 10024
         $sql = "SELECT id as previous FROM $table_lp_item
10025
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
10025
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
10026 10026
         $rs_max = Database::query($sql);
10027 10027
         $row_max = Database::fetch_object($rs_max);
10028 10028
 
@@ -10078,9 +10078,9 @@  discard block
 block discarded – undo
10078 10078
         $documents_total_space = DocumentManager::documents_total_space();
10079 10079
         $course_max_space = DocumentManager::get_course_quota();
10080 10080
         $total_size = filesize($s) + $documents_total_space;
10081
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10081
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10082 10082
             return true;
10083
-        } else{
10083
+        } else {
10084 10084
             return false;
10085 10085
         }
10086 10086
     }
@@ -10420,7 +10420,7 @@  discard block
 block discarded – undo
10420 10420
         if ($this->debug > 0) {
10421 10421
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10422 10422
         }
10423
-        $this->subscribeUsers = intval($value);;
10423
+        $this->subscribeUsers = intval($value); ;
10424 10424
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10425 10425
         $lp_id = $this->get_id();
10426 10426
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10766,7 +10766,7 @@  discard block
 block discarded – undo
10766 10766
      */
10767 10767
     public function createForum($forumCategoryId)
10768 10768
     {
10769
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10769
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10770 10770
 
10771 10771
         $forumId = store_forum(
10772 10772
             [
@@ -10815,7 +10815,7 @@  discard block
 block discarded – undo
10815 10815
      */
10816 10816
     private function getFinalItemTemplate()
10817 10817
     {
10818
-        return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html');
10818
+        return file_get_contents(api_get_path(SYS_CODE_PATH).'newscorm/final_item_template/template.html');
10819 10819
     }
10820 10820
 
10821 10821
     /**
@@ -10862,11 +10862,11 @@  discard block
 block discarded – undo
10862 10862
             'Height' => '500',
10863 10863
             'FullPage' => true,
10864 10864
             'CreateDocumentDir' => $relative_prefix,
10865
-            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
10866
-            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
10865
+            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
10866
+            'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
10867 10867
         ];
10868 10868
 
10869
-        $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
10869
+        $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
10870 10870
             'type' => 'document',
10871 10871
             'lp_id' => $this->lp_id
10872 10872
         ]);
Please login to merge, or discard this patch.
Braces   +110 added lines, -76 removed lines patch added patch discarded remove patch
@@ -3939,8 +3939,9 @@  discard block
 block discarded – undo
3939 3939
                 WHERE c_id = ".$course_id."
3940 3940
                 ORDER BY display_order";
3941 3941
         $res = Database::query($sql);
3942
-        if ($res === false)
3943
-            return false;
3942
+        if ($res === false) {
3943
+                    return false;
3944
+        }
3944 3945
         $lps = array ();
3945 3946
         $lp_order = array ();
3946 3947
         $num = Database :: num_rows($res);
@@ -4540,8 +4541,9 @@  discard block
 block discarded – undo
4540 4541
         if ($this->debug > 0) {
4541 4542
             error_log('New LP - In learnpath::set_maker()', 0);
4542 4543
         }
4543
-        if (empty ($name))
4544
-            return false;
4544
+        if (empty ($name)) {
4545
+                    return false;
4546
+        }
4545 4547
         $this->maker = $name;
4546 4548
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4547 4549
         $course_id = api_get_course_int_id();
@@ -4606,8 +4608,9 @@  discard block
 block discarded – undo
4606 4608
     public function set_terms_by_prefix($terms_string, $prefix)
4607 4609
     {
4608 4610
         $course_id = api_get_course_int_id();
4609
-        if (api_get_setting('search_enabled') !== 'true')
4610
-            return false;
4611
+        if (api_get_setting('search_enabled') !== 'true') {
4612
+                    return false;
4613
+        }
4611 4614
 
4612 4615
         if (!extension_loaded('xapian')) {
4613 4616
             return false;
@@ -4620,8 +4623,9 @@  discard block
 block discarded – undo
4620 4623
         $stored_terms = $this->get_common_index_terms_by_prefix($prefix);
4621 4624
 
4622 4625
         // Don't do anything if no change, verify only at DB, not the search engine.
4623
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
4624
-            return false;
4626
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
4627
+                    return false;
4628
+        }
4625 4629
 
4626 4630
         require_once 'xapian.php'; // TODO: Try catch every xapian use or make wrappers on API.
4627 4631
         require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
@@ -4813,8 +4817,9 @@  discard block
 block discarded – undo
4813 4817
         if ($this->debug > 0) {
4814 4818
             error_log('New LP - In learnpath::set_proximity()', 0);
4815 4819
         }
4816
-        if (empty ($name))
4817
-            return false;
4820
+        if (empty ($name)) {
4821
+                    return false;
4822
+        }
4818 4823
 
4819 4824
         $this->proximity = $name;
4820 4825
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
@@ -5156,8 +5161,9 @@  discard block
 block discarded – undo
5156 5161
 
5157 5162
         $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." ORDER BY display_order";
5158 5163
         $res = Database::query($sql);
5159
-        if ($res === false)
5160
-            return false;
5164
+        if ($res === false) {
5165
+                    return false;
5166
+        }
5161 5167
 
5162 5168
         $num = Database :: num_rows($res);
5163 5169
         // First check the order is correct, globally (might be wrong because
@@ -5468,8 +5474,9 @@  discard block
 block discarded – undo
5468 5474
             $position[$key] = $row['display_order'];
5469 5475
         }
5470 5476
 
5471
-        if (count($array) > 0)
5472
-            array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5477
+        if (count($array) > 0) {
5478
+                    array_multisort($parent, SORT_ASC, $position, SORT_ASC, $array);
5479
+        }
5473 5480
 
5474 5481
         return $array;
5475 5482
     }
@@ -6037,8 +6044,9 @@  discard block
 block discarded – undo
6037 6044
         $tmp_filename = $filename;
6038 6045
 
6039 6046
         $i = 0;
6040
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6041
-            $tmp_filename = $filename . '_' . ++ $i;
6047
+        while (file_exists($filepath . $tmp_filename . '.'.$extension)) {
6048
+                    $tmp_filename = $filename . '_' . ++ $i;
6049
+        }
6042 6050
 
6043 6051
         $filename = $tmp_filename . '.'.$extension;
6044 6052
         if ($extension == 'html') {
@@ -6117,10 +6125,12 @@  discard block
 block discarded – undo
6117 6125
                     if ($new_comment || $new_title) {
6118 6126
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6119 6127
                         $ct = '';
6120
-                        if ($new_comment)
6121
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6122
-                        if ($new_title)
6123
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6128
+                        if ($new_comment) {
6129
+                                                    $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6130
+                        }
6131
+                        if ($new_title) {
6132
+                                                    $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6133
+                        }
6124 6134
 
6125 6135
                         $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6126 6136
                                WHERE c_id = ".$course_id." AND id = " . $document_id;
@@ -6144,17 +6154,21 @@  discard block
 block discarded – undo
6144 6154
         // Please, do not modify this dirname formatting.
6145 6155
         $dir = isset($_GET['dir']) ? $_GET['dir'] : $_POST['dir'];
6146 6156
 
6147
-        if (strstr($dir, '..'))
6148
-            $dir = '/';
6157
+        if (strstr($dir, '..')) {
6158
+                    $dir = '/';
6159
+        }
6149 6160
 
6150
-        if ($dir[0] == '.')
6151
-            $dir = substr($dir, 1);
6161
+        if ($dir[0] == '.') {
6162
+                    $dir = substr($dir, 1);
6163
+        }
6152 6164
 
6153
-        if ($dir[0] != '/')
6154
-            $dir = '/' . $dir;
6165
+        if ($dir[0] != '/') {
6166
+                    $dir = '/' . $dir;
6167
+        }
6155 6168
 
6156
-        if ($dir[strlen($dir) - 1] != '/')
6157
-            $dir .= '/';
6169
+        if ($dir[strlen($dir) - 1] != '/') {
6170
+                    $dir .= '/';
6171
+        }
6158 6172
 
6159 6173
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6160 6174
 
@@ -6219,8 +6233,9 @@  discard block
 block discarded – undo
6219 6233
                 }
6220 6234
                 $return .= '<div style="padding:10px;">';
6221 6235
 
6222
-                if ($msg != '')
6223
-                    $return .= $msg;
6236
+                if ($msg != '') {
6237
+                                    $return .= $msg;
6238
+                }
6224 6239
 
6225 6240
                 $return .= '<h3>'.$row['title'].'</h3>';
6226 6241
                 switch ($row['item_type']) {
@@ -6484,10 +6499,11 @@  discard block
 block discarded – undo
6484 6499
         $item_title			= Security::remove_XSS($item_title);
6485 6500
         $item_description 	= Security::remove_XSS($item_description);
6486 6501
 
6487
-        if ($id != 0 && is_array($extra_info))
6488
-            $parent = $extra_info['parent_item_id'];
6489
-        else
6490
-            $parent = 0;
6502
+        if ($id != 0 && is_array($extra_info)) {
6503
+                    $parent = $extra_info['parent_item_id'];
6504
+        } else {
6505
+                    $parent = 0;
6506
+        }
6491 6507
 
6492 6508
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6493 6509
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6760,11 +6776,13 @@  discard block
 block discarded – undo
6760 6776
         }
6761 6777
 
6762 6778
         $legend = '<legend>';
6763
-        if ($action == 'add')
6764
-            $legend .= get_lang('CreateTheExercise');
6765
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6766
-        else
6767
-            $legend .= get_lang('EditCurrentExecice');
6779
+        if ($action == 'add') {
6780
+                    $legend .= get_lang('CreateTheExercise');
6781
+        } elseif ($action == 'move') {
6782
+            $legend .= get_lang('MoveTheCurrentExercise');
6783
+        } else {
6784
+                    $legend .= get_lang('EditCurrentExecice');
6785
+        }
6768 6786
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6769 6787
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6770 6788
         }
@@ -6791,8 +6809,9 @@  discard block
 block discarded – undo
6791 6809
                         $arrHide[] = $arrLP[$i]['id'];
6792 6810
                     }
6793 6811
                 } else {
6794
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6795
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6812
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6813
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6814
+                    }
6796 6815
                 }
6797 6816
             }
6798 6817
 
@@ -6810,11 +6829,13 @@  discard block
 block discarded – undo
6810 6829
 
6811 6830
         for ($i = 0; $i < count($arrLP); $i++) {
6812 6831
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6813
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6832
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6833
+                                    $selected = 'selected="selected" ';
6834
+                } elseif ($action == 'add') {
6814 6835
                     $selected = 'selected="selected" ';
6815
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6816
-                else
6817
-                    $selected = '';
6836
+                } else {
6837
+                                    $selected = '';
6838
+                }
6818 6839
 
6819 6840
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6820 6841
             }
@@ -6841,9 +6862,11 @@  discard block
 block discarded – undo
6841 6862
                 $arrHide = array ();
6842 6863
                 for ($i = 0; $i < count($arrLP); $i++) {
6843 6864
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6844
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6845
-                            $s_selected_position = $arrLP[$i]['id'];
6846
-                        elseif ($action == 'add') $s_selected_position = 0;
6865
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6866
+                                                    $s_selected_position = $arrLP[$i]['id'];
6867
+                        } elseif ($action == 'add') {
6868
+                            $s_selected_position = 0;
6869
+                        }
6847 6870
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6848 6871
 
6849 6872
                     }
@@ -7040,9 +7063,11 @@  discard block
 block discarded – undo
7040 7063
             $arrHide = array();
7041 7064
             for ($i = 0; $i < count($arrLP); $i++) {
7042 7065
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7043
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7044
-                        $s_selected_position = $arrLP[$i]['id'];
7045
-                    elseif ($action == 'add') $s_selected_position = 0;
7066
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7067
+                                            $s_selected_position = $arrLP[$i]['id'];
7068
+                    } elseif ($action == 'add') {
7069
+                        $s_selected_position = 0;
7070
+                    }
7046 7071
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7047 7072
                 }
7048 7073
             }
@@ -7245,9 +7270,11 @@  discard block
 block discarded – undo
7245 7270
 
7246 7271
             for ($i = 0; $i < count($arrLP); $i++) {
7247 7272
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7248
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7249
-                        $s_selected_position = $arrLP[$i]['id'];
7250
-                    elseif ($action == 'add') $s_selected_position = 0;
7273
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7274
+                                            $s_selected_position = $arrLP[$i]['id'];
7275
+                    } elseif ($action == 'add') {
7276
+                        $s_selected_position = 0;
7277
+                    }
7251 7278
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7252 7279
 
7253 7280
                 }
@@ -7281,8 +7308,7 @@  discard block
 block discarded – undo
7281 7308
 
7282 7309
         if (is_numeric($extra_info)) {
7283 7310
             $form->addHidden('path', $extra_info);
7284
-        }
7285
-        elseif (is_array($extra_info)) {
7311
+        } elseif (is_array($extra_info)) {
7286 7312
             $form->addHidden('path', $extra_info['path']);
7287 7313
         }
7288 7314
 
@@ -7335,8 +7361,9 @@  discard block
 block discarded – undo
7335 7361
                     lp_id = " . $this->lp_id . " AND
7336 7362
                     id != $id";
7337 7363
 
7338
-        if ($item_type == 'module')
7339
-            $sql .= " AND parent_item_id = 0";
7364
+        if ($item_type == 'module') {
7365
+                    $sql .= " AND parent_item_id = 0";
7366
+        }
7340 7367
 
7341 7368
         $result = Database::query($sql);
7342 7369
         $arrLP = array ();
@@ -7722,9 +7749,11 @@  discard block
 block discarded – undo
7722 7749
 
7723 7750
             for ($i = 0; $i < count($arrLP); $i++) {
7724 7751
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM) {
7725
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7752
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7753
+                                            $s_selected_position = $arrLP[$i]['id'];
7754
+                    } elseif ($action == 'add') {
7726 7755
                         $s_selected_position = $arrLP[$i]['id'];
7727
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7756
+                    }
7728 7757
 
7729 7758
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7730 7759
 
@@ -7735,17 +7764,18 @@  discard block
 block discarded – undo
7735 7764
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7736 7765
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7737 7766
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true')) {
7738
-                    if (isset ($_POST['content']))
7739
-                        $content = stripslashes($_POST['content']);
7740
-                    elseif (is_array($extra_info)) {
7767
+                    if (isset ($_POST['content'])) {
7768
+                                            $content = stripslashes($_POST['content']);
7769
+                    } elseif (is_array($extra_info)) {
7741 7770
                         //If it's an html document or a text file
7742 7771
                         if (!$no_display_edit_textarea) {
7743 7772
                             $content = $this->display_document($extra_info['path'], false, false);
7744 7773
                         }
7745
-                    } elseif (is_numeric($extra_info))
7746
-                        $content = $this->display_document($extra_info, false, false);
7747
-                    else
7748
-                        $content = '';
7774
+                    } elseif (is_numeric($extra_info)) {
7775
+                                            $content = $this->display_document($extra_info, false, false);
7776
+                    } else {
7777
+                                            $content = '';
7778
+                    }
7749 7779
 
7750 7780
                     if (!$no_display_edit_textarea) {
7751 7781
                         // We need to calculate here some specific settings for the online editor.
@@ -8013,9 +8043,11 @@  discard block
 block discarded – undo
8013 8043
             $arrHide = array();
8014 8044
             for ($i = 0; $i < count($arrLP); $i++) {
8015 8045
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8016
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8017
-                        $s_selected_position = $arrLP[$i]['id'];
8018
-                    elseif ($action == 'add') $s_selected_position = 0;
8046
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8047
+                                            $s_selected_position = $arrLP[$i]['id'];
8048
+                    } elseif ($action == 'add') {
8049
+                        $s_selected_position = 0;
8050
+                    }
8019 8051
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8020 8052
 
8021 8053
                 }
@@ -8218,9 +8250,11 @@  discard block
 block discarded – undo
8218 8250
             $arrHide = array ();
8219 8251
             for ($i = 0; $i < count($arrLP); $i++) {
8220 8252
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8221
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8222
-                        $s_selected_position = $arrLP[$i]['id'];
8223
-                    elseif ($action == 'add') $s_selected_position = 0;
8253
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8254
+                                            $s_selected_position = $arrLP[$i]['id'];
8255
+                    } elseif ($action == 'add') {
8256
+                        $s_selected_position = 0;
8257
+                    }
8224 8258
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8225 8259
 
8226 8260
                 }
@@ -9795,9 +9829,9 @@  discard block
 block discarded – undo
9795 9829
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9796 9830
         $extra_files = scandir($main_code_path);
9797 9831
         foreach ($extra_files as $extra_file) {
9798
-            if (strpos($extra_file, '.') === 0)
9799
-                continue;
9800
-            else {
9832
+            if (strpos($extra_file, '.') === 0) {
9833
+                            continue;
9834
+            } else {
9801 9835
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9802 9836
                 $this->create_path($dest_file);
9803 9837
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.
main/inc/lib/template.lib.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 $content = '<li class="help">';
265 265
                 $content .= Display::url(
266 266
                     Display::return_icon('help.large.png', get_lang('Help')),
267
-                    api_get_path(WEB_CODE_PATH) . 'help/help.php?open=' . $help,
267
+                    api_get_path(WEB_CODE_PATH).'help/help.php?open='.$help,
268 268
                     [
269 269
                         'class' => 'ajax',
270 270
                         'data-title' => get_lang('Help')
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             'web_course' => api_get_path(WEB_COURSE_PATH),
479 479
             'web_main' => api_get_path(WEB_CODE_PATH),
480 480
             'web_css' => api_get_path(WEB_CSS_PATH),
481
-            'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/',
481
+            'web_css_theme' => api_get_path(WEB_CSS_PATH).'themes/'.$this->theme.'/',
482 482
             'web_ajax' => api_get_path(WEB_AJAX_PATH),
483 483
             'web_img' => api_get_path(WEB_IMG_PATH),
484 484
             'web_plugin' => api_get_path(WEB_PLUGIN_PATH),
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
         foreach ($bowerCSSFiles as $file) {
537 537
             $css[] = api_get_path(WEB_PATH).'web/assets/'.$file;
538 538
         }
539
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap-select/css/bootstrap-select.min.css';
540
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
541
-        $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css';
539
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap-select/css/bootstrap-select.min.css';
540
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';
541
+        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css';
542 542
 
543 543
         if (api_is_global_chat_enabled()) {
544
-            $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
544
+            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
545 545
         }
546 546
 
547 547
         //THEME CSS STYLE
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
             $style_print = '';
610 610
             if (is_readable(api_get_path(SYS_CSS_PATH).$this->theme.'/print.css')) {
611
-                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'),
611
+                $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'),
612 612
                     'print');
613 613
             }
614 614
             $this->assign('css_style_print', $style_print);
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 
632 632
         $isoCode = api_get_language_isocode();
633 633
 
634
-        $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_' . strtoupper($isoCode) . '.min.js';
634
+        $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_'.strtoupper($isoCode).'.min.js';
635 635
 
636 636
         if ($isoCode == 'en') {
637
-            $selectLink = 'bootstrap-select/js/i18n/defaults-' . $isoCode . '_US.min.js';
637
+            $selectLink = 'bootstrap-select/js/i18n/defaults-'.$isoCode.'_US.min.js';
638 638
         }
639 639
         // JS files
640 640
         $js_files = array(
@@ -684,8 +684,8 @@  discard block
 block discarded – undo
684 684
         }
685 685
 
686 686
         if ($isoCode != 'en') {
687
-            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-' . $isoCode . '.js';
688
-            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-' . $isoCode . '.min.js';
687
+            $bowerJsFiles[] = 'jqueryui-timepicker-addon/dist/i18n/jquery-ui-timepicker-'.$isoCode.'.js';
688
+            $bowerJsFiles[] = 'jquery-ui/ui/minified/i18n/datepicker-'.$isoCode.'.min.js';
689 689
         }
690 690
 
691 691
         foreach ($bowerJsFiles as $file) {
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         }
767 767
 
768 768
         $this->assign('online_button', Display::return_icon('statusonline.png', null, null, ICON_SIZE_ATOM));
769
-        $this->assign('offline_button',Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
769
+        $this->assign('offline_button', Display::return_icon('statusoffline.png', null, null, ICON_SIZE_ATOM));
770 770
 
771 771
         // Get language iso-code for this page - ignore errors
772 772
         $this->assign('document_language', api_get_language_isocode());
@@ -825,15 +825,15 @@  discard block
 block discarded – undo
825 825
         $this->assign('section_name', 'section-'.$this_section);
826 826
 
827 827
         //Defaul root chamilo favicon
828
-        $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_PATH) . 'favicon.ico" type="image/x-icon" />';
828
+        $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_PATH).'favicon.ico" type="image/x-icon" />';
829 829
 
830 830
         //Added to verify if in the current Chamilo Theme exist a favicon
831
-        $favicoThemeUrl = api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/images/';
831
+        $favicoThemeUrl = api_get_path(SYS_CSS_PATH).'themes/'.$this->theme.'/images/';
832 832
 
833 833
         //If exist pick the current chamilo theme favicon
834
-        if (is_file($favicoThemeUrl . 'favicon.ico')) {
835
-            $favico = '<link rel="shortcut icon" href="' . api_get_path(WEB_CSS_PATH)
836
-                . 'themes/' . $this->theme . '/images/favicon.ico" type="image/x-icon" />';
834
+        if (is_file($favicoThemeUrl.'favicon.ico')) {
835
+            $favico = '<link rel="shortcut icon" href="'.api_get_path(WEB_CSS_PATH)
836
+                . 'themes/'.$this->theme.'/images/favicon.ico" type="image/x-icon" />';
837 837
         }
838 838
 
839 839
         if (api_is_multiple_url_enabled()) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
         if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
864 864
             $bug_notification_link = '<li class="report">
865 865
 		<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
866
-                    '. $iconBug . '
866
+                    '. $iconBug.'
867 867
                 </a>
868 868
 		</li>';
869 869
         }
@@ -975,13 +975,13 @@  discard block
 block discarded – undo
975 975
         $socialMeta = '';
976 976
         $metaTitle = api_get_setting('meta_title');
977 977
         if (!empty($metaTitle)) {
978
-            $socialMeta .= '<meta name="twitter:card" content="summary" />' . "\n";
978
+            $socialMeta .= '<meta name="twitter:card" content="summary" />'."\n";
979 979
             $metaSite = api_get_setting('meta_twitter_site');
980 980
             if (!empty($metaSite)) {
981
-                $socialMeta .= '<meta name="twitter:site" content="' . $metaSite . '" />' . "\n";
981
+                $socialMeta .= '<meta name="twitter:site" content="'.$metaSite.'" />'."\n";
982 982
                 $metaCreator = api_get_setting('meta_twitter_creator');
983 983
                 if (!empty($metaCreator)) {
984
-                    $socialMeta .= '<meta name="twitter:creator" content="' . $metaCreator . '" />' . "\n";
984
+                    $socialMeta .= '<meta name="twitter:creator" content="'.$metaCreator.'" />'."\n";
985 985
                 }
986 986
             }
987 987
 
@@ -993,19 +993,19 @@  discard block
 block discarded – undo
993 993
             if (!$userId && !$skillId) {
994 994
                 // no combination of user and skill ID has been defined,
995 995
                 // so print the normal OpenGraph meta tags
996
-                $socialMeta .= '<meta property="og:title" content="' . $metaTitle . '" />' . "\n";
997
-                $socialMeta .= '<meta property="og:url" content="' . api_get_path(WEB_PATH) . '" />' . "\n";
996
+                $socialMeta .= '<meta property="og:title" content="'.$metaTitle.'" />'."\n";
997
+                $socialMeta .= '<meta property="og:url" content="'.api_get_path(WEB_PATH).'" />'."\n";
998 998
 
999 999
                 $metaDescription = api_get_setting('meta_description');
1000 1000
                 if (!empty($metaDescription)) {
1001
-                    $socialMeta .= '<meta property="og:description" content="' . $metaDescription . '" />' . "\n";
1001
+                    $socialMeta .= '<meta property="og:description" content="'.$metaDescription.'" />'."\n";
1002 1002
                 }
1003 1003
 
1004 1004
                 $metaImage = api_get_setting('meta_image_path');
1005 1005
                 if (!empty($metaImage)) {
1006
-                    if (is_file(api_get_path(SYS_PATH) . $metaImage)) {
1007
-                        $path = api_get_path(WEB_PATH) . $metaImage;
1008
-                        $socialMeta .= '<meta property="og:image" content="' . $path . '" />' . "\n";
1006
+                    if (is_file(api_get_path(SYS_PATH).$metaImage)) {
1007
+                        $path = api_get_path(WEB_PATH).$metaImage;
1008
+                        $socialMeta .= '<meta property="og:image" content="'.$path.'" />'."\n";
1009 1009
                     }
1010 1010
                 }
1011 1011
             }
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
         // Tutor name
1040 1040
         if (api_get_setting('show_tutor_data') == 'true') {
1041 1041
             // Course manager
1042
-            $courseId  = api_get_course_int_id();
1042
+            $courseId = api_get_course_int_id();
1043 1043
             $id_session = api_get_session_id();
1044 1044
             if (!empty($courseId)) {
1045 1045
                 $tutor_data = '';
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
             $courseId = api_get_course_int_id();
1072 1072
             if (!empty($courseId)) {
1073 1073
                 $teacher_data = '';
1074
-                $mail= CourseManager::get_emails_of_tutors_to_course($courseId);
1074
+                $mail = CourseManager::get_emails_of_tutors_to_course($courseId);
1075 1075
                 if (!empty($mail)) {
1076 1076
                     $teachers_parsed = array();
1077 1077
                     foreach ($mail as $value) {
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
                     'sessionVar'   => basename(__FILE__, '.php'),
1306 1306
                     'imageOptions' => array(
1307 1307
                         'font_size' => 20,
1308
-                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
1308
+                        'font_path' => api_get_path(SYS_FONTS_PATH).'opensans/',
1309 1309
                         'font_file' => 'OpenSans-Regular.ttf',
1310 1310
                         //'output' => 'gif'
1311 1311
                     )
Please login to merge, or discard this patch.