Passed
Pull Request — 1.10.x (#1110)
by
unknown
72:20 queued 22:26
created
main/newscorm/learnpath.class.php 3 patches
Doc Comments   +29 added lines, -25 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()
@@ -5842,7 +5846,7 @@  discard block
 block discarded – undo
5842 5846
     /**
5843 5847
      * This function builds the action menu
5844 5848
      * @param bool $returnContent
5845
-     * @return void
5849
+     * @return string|null
5846 5850
      */
5847 5851
     public function build_action_menu($returnContent = false)
5848 5852
     {
@@ -6348,7 +6352,7 @@  discard block
 block discarded – undo
6348 6352
     /**
6349 6353
      * Function that displays a list with al the resources that
6350 6354
      * could be added to the learning path
6351
-     * @return string
6355
+     * @return boolean
6352 6356
      */
6353 6357
     public function display_resources()
6354 6358
     {
@@ -8795,7 +8799,7 @@  discard block
 block discarded – undo
8795 8799
 
8796 8800
     /**
8797 8801
      * Creates a list with all the student publications in it
8798
-     * @return unknown
8802
+     * @return string
8799 8803
      */
8800 8804
     public function get_student_publications()
8801 8805
     {
@@ -9747,7 +9751,7 @@  discard block
 block discarded – undo
9747 9751
 
9748 9752
     /**
9749 9753
      * @param int $lp_id
9750
-     * @return bool
9754
+     * @return false|null
9751 9755
      */
9752 9756
     public function scorm_export_to_pdf($lp_id)
9753 9757
     {
@@ -10264,6 +10268,7 @@  discard block
 block discarded – undo
10264 10268
     }
10265 10269
 
10266 10270
     /**
10271
+     * @param string $courseCode
10267 10272
      * @return \learnpath
10268 10273
      */
10269 10274
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
@@ -10283,7 +10288,7 @@  discard block
 block discarded – undo
10283 10288
 
10284 10289
     /**
10285 10290
      * @param int $itemId
10286
-     * @return learnpathItem|false
10291
+     * @return string
10287 10292
      */
10288 10293
     public function getItem($itemId)
10289 10294
     {
@@ -10333,7 +10338,6 @@  discard block
 block discarded – undo
10333 10338
     /**
10334 10339
      * Set whether this is a learning path with the possibility to subscribe
10335 10340
      * users or not
10336
-     * @param int $subscribeUsers (0 = false, 1 = true)
10337 10341
      */
10338 10342
     public function setSubscribeUsers($value)
10339 10343
     {
@@ -10458,7 +10462,7 @@  discard block
 block discarded – undo
10458 10462
 
10459 10463
     /**
10460 10464
      * Get the item of exercise type (evaluation type)
10461
-     * @return array The final evaluation. Otherwise return false
10465
+     * @return integer The final evaluation. Otherwise return false
10462 10466
      */
10463 10467
     public function getFinalEvaluationItem()
10464 10468
     {
@@ -10682,7 +10686,7 @@  discard block
 block discarded – undo
10682 10686
     /**
10683 10687
      * Create a forum for this learning path
10684 10688
      * @param type $forumCategoryId
10685
-     * @return int The forum ID if was created. Otherwise return false
10689
+     * @return false|string The forum ID if was created. Otherwise return false
10686 10690
      */
10687 10691
     public function createForum($forumCategoryId)
10688 10692
     {
@@ -10737,7 +10741,7 @@  discard block
 block discarded – undo
10737 10741
 
10738 10742
     /**
10739 10743
      * 
10740
-     * @return html
10744
+     * @return string
10741 10745
      */
10742 10746
     public function getFinalItemForm()
10743 10747
     {
Please login to merge, or discard this patch.
Spacing   +689 added lines, -689 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_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,8 +6481,8 @@  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
         $legend = '<legend>';
6488 6488
         if ($id != 0 && is_array($extra_info))
@@ -6490,13 +6490,13 @@  discard block
 block discarded – undo
6490 6490
         else
6491 6491
             $parent = 0;
6492 6492
 
6493
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6494
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6493
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6494
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6495 6495
 
6496 6496
         $result = Database::query($sql);
6497
-        $arrLP = array ();
6497
+        $arrLP = array();
6498 6498
         while ($row = Database :: fetch_array($result)) {
6499
-            $arrLP[] = array (
6499
+            $arrLP[] = array(
6500 6500
                 'id' => $row['id'],
6501 6501
                 'item_type' => $row['item_type'],
6502 6502
                 'title' => $row['title'],
@@ -6519,15 +6519,15 @@  discard block
 block discarded – undo
6519 6519
         unset ($this->arrMenu);
6520 6520
 
6521 6521
         if ($action == 'add') {
6522
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6522
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6523 6523
         } elseif ($action == 'move') {
6524
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6524
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6525 6525
         } else {
6526
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6526
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6527 6527
         }
6528 6528
 
6529 6529
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6530
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6530
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6531 6531
         }
6532 6532
 
6533 6533
         $legend .= '</legend>';
@@ -6540,34 +6540,34 @@  discard block
 block discarded – undo
6540 6540
 
6541 6541
         if ($action != 'move') {
6542 6542
             $return .= '<tr>';
6543
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6544
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6543
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6544
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6545 6545
             $return .= '</tr>';
6546 6546
         }
6547 6547
 
6548 6548
         $return .= '<tr>';
6549 6549
 
6550
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6550
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6551 6551
         $return .= '<td class="input">';
6552 6552
 
6553 6553
         // Select for Parent item, root or chapter
6554 6554
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6555 6555
 
6556
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6556
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6557 6557
 
6558
-        $arrHide = array (
6558
+        $arrHide = array(
6559 6559
             $id
6560 6560
         );
6561 6561
         for ($i = 0; $i < count($arrLP); $i++) {
6562 6562
             if ($action != 'add') {
6563 6563
                 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)) {
6564
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6564
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6565 6565
                 } else {
6566 6566
                     $arrHide[] = $arrLP[$i]['id'];
6567 6567
                 }
6568 6568
             } else {
6569 6569
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6570
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6570
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6571 6571
             }
6572 6572
         }
6573 6573
         if (is_array($arrLP)) {
@@ -6579,11 +6579,11 @@  discard block
 block discarded – undo
6579 6579
         $return .= '</tr>';
6580 6580
         $return .= '<tr>';
6581 6581
 
6582
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6582
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6583 6583
         $return .= '<td class="input">';
6584 6584
 
6585 6585
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6586
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6586
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6587 6587
         for ($i = 0; $i < count($arrLP); $i++) {
6588 6588
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6589 6589
                 if (is_array($extra_info)) {
@@ -6595,7 +6595,7 @@  discard block
 block discarded – undo
6595 6595
                 } else {
6596 6596
                     $selected = '';
6597 6597
                 }
6598
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6598
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6599 6599
             }
6600 6600
         }
6601 6601
         $return .= '</select>';
@@ -6612,7 +6612,7 @@  discard block
 block discarded – undo
6612 6612
                     }
6613 6613
                 }
6614 6614
             }
6615
-            $arrHide = array ();
6615
+            $arrHide = array();
6616 6616
             for ($i = 0; $i < count($arrLP); $i++) {
6617 6617
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6618 6618
                     if (is_array($extra_info)) {
@@ -6658,27 +6658,27 @@  discard block
 block discarded – undo
6658 6658
 
6659 6659
         $return .= '<tr>';
6660 6660
         if ($action == 'add') {
6661
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6661
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6662 6662
         } else {
6663
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6663
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6664 6664
         }
6665 6665
 
6666 6666
         $return .= '</tr>';
6667 6667
         $return .= '</table>';
6668 6668
 
6669 6669
         if ($action == 'move') {
6670
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6671
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6670
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6671
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6672 6672
         }
6673 6673
 
6674 6674
         if (is_numeric($extra_info)) {
6675
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6675
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6676 6676
         } elseif (is_array($extra_info)) {
6677
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6677
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6678 6678
         }
6679 6679
 
6680
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6681
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6680
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6681
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6682 6682
 
6683 6683
         $return .= '</form>';
6684 6684
         $return .= '</div>';
@@ -6705,11 +6705,11 @@  discard block
 block discarded – undo
6705 6705
         } elseif (is_numeric($extra_info)) {
6706 6706
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6707 6707
 
6708
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6708
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6709 6709
                     WHERE
6710 6710
                         c_id = ".$course_id." AND
6711
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6712
-                        id = " . (int) $extra_info . "
6711
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6712
+                        id = " . (int) $extra_info."
6713 6713
                     ORDER BY id ASC";
6714 6714
 
6715 6715
             $res_hot = Database::query($sql);
@@ -6733,11 +6733,11 @@  discard block
 block discarded – undo
6733 6733
         }
6734 6734
 
6735 6735
         $sql = "SELECT * FROM $tbl_lp_item
6736
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6736
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6737 6737
         $result = Database::query($sql);
6738
-        $arrLP = array ();
6738
+        $arrLP = array();
6739 6739
         while ($row = Database :: fetch_array($result)) {
6740
-            $arrLP[] = array (
6740
+            $arrLP[] = array(
6741 6741
                 'id' => $row['id'],
6742 6742
                 'item_type' => $row['item_type'],
6743 6743
                 'title' => $row['title'],
@@ -6762,7 +6762,7 @@  discard block
 block discarded – undo
6762 6762
         else
6763 6763
             $legend .= get_lang('EditCurrentExecice');
6764 6764
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6765
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6765
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6766 6766
         }
6767 6767
         $legend .= '</legend>';
6768 6768
 
@@ -6770,11 +6770,11 @@  discard block
 block discarded – undo
6770 6770
         $return .= $legend;
6771 6771
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6772 6772
         $return .= '<tr>';
6773
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6773
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6774 6774
         $return .= '<td class="input">';
6775 6775
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6776
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6777
-        $arrHide = array (
6776
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6777
+        $arrHide = array(
6778 6778
             $id
6779 6779
         );
6780 6780
 
@@ -6782,13 +6782,13 @@  discard block
 block discarded – undo
6782 6782
             for ($i = 0; $i < count($arrLP); $i++) {
6783 6783
                 if ($action != 'add') {
6784 6784
                     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)) {
6785
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6785
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6786 6786
                     } else {
6787 6787
                         $arrHide[] = $arrLP[$i]['id'];
6788 6788
                     }
6789 6789
                 } else {
6790 6790
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6791
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6791
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6792 6792
                 }
6793 6793
             }
6794 6794
 
@@ -6799,10 +6799,10 @@  discard block
 block discarded – undo
6799 6799
         $return .= '</td>';
6800 6800
         $return .= '</tr>';
6801 6801
         $return .= '<tr>';
6802
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6802
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6803 6803
         $return .= '<td class="input">';
6804 6804
         $return .= '<select id="previous" name="previous" size="1">';
6805
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6805
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6806 6806
 
6807 6807
         for ($i = 0; $i < count($arrLP); $i++) {
6808 6808
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6812,7 +6812,7 @@  discard block
 block discarded – undo
6812 6812
                 else
6813 6813
                     $selected = '';
6814 6814
 
6815
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6815
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6816 6816
             }
6817 6817
         }
6818 6818
 
@@ -6822,8 +6822,8 @@  discard block
 block discarded – undo
6822 6822
 
6823 6823
         if ($action != 'move') {
6824 6824
             $return .= '<tr>';
6825
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6826
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6825
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6826
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6827 6827
             $return .= '</tr>';
6828 6828
             $id_prerequisite = 0;
6829 6829
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6834,7 +6834,7 @@  discard block
 block discarded – undo
6834 6834
                     }
6835 6835
                 }
6836 6836
 
6837
-                $arrHide = array ();
6837
+                $arrHide = array();
6838 6838
                 for ($i = 0; $i < count($arrLP); $i++) {
6839 6839
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6840 6840
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6848,22 +6848,22 @@  discard block
 block discarded – undo
6848 6848
         }
6849 6849
 
6850 6850
         $return .= '<tr>';
6851
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6851
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6852 6852
         $return .= '</tr>';
6853 6853
         $return .= '</table>';
6854 6854
 
6855 6855
         if ($action == 'move') {
6856
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6857
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6856
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6857
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6858 6858
         }
6859 6859
 
6860 6860
         if (is_numeric($extra_info)) {
6861
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6861
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6862 6862
         } elseif (is_array($extra_info)) {
6863
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6863
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6864 6864
         }
6865
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6866
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6865
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6866
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6867 6867
         $return .= '</form>';
6868 6868
 
6869 6869
         return $return;
@@ -6886,8 +6886,8 @@  discard block
 block discarded – undo
6886 6886
             $item_title = stripslashes($extra_info['title']);
6887 6887
         } elseif (is_numeric($extra_info)) {
6888 6888
             $sql = "SELECT forum_title as title, forum_comment as comment
6889
-                    FROM " . $tbl_forum . "
6890
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6889
+                    FROM " . $tbl_forum."
6890
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6891 6891
 
6892 6892
             $result = Database::query($sql);
6893 6893
             $row = Database :: fetch_array($result);
@@ -6907,7 +6907,7 @@  discard block
 block discarded – undo
6907 6907
             $parent = 0;
6908 6908
         }
6909 6909
 
6910
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6910
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6911 6911
                 WHERE
6912 6912
                     c_id = ".$course_id." AND
6913 6913
                     lp_id = " . $this->lp_id;
@@ -6915,7 +6915,7 @@  discard block
 block discarded – undo
6915 6915
         $arrLP = array();
6916 6916
 
6917 6917
         while ($row = Database :: fetch_array($result)) {
6918
-            $arrLP[] = array (
6918
+            $arrLP[] = array(
6919 6919
                 'id' => $row['id'],
6920 6920
                 'item_type' => $row['item_type'],
6921 6921
                 'title' => $row['title'],
@@ -6937,10 +6937,10 @@  discard block
 block discarded – undo
6937 6937
         unset($this->arrMenu);
6938 6938
 
6939 6939
         if ($action == 'add')
6940
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6941
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6940
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6941
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6942 6942
         else
6943
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6943
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6944 6944
 
6945 6945
         $legend .= '</legend>';
6946 6946
         $return = '<div class="sectioncomment">';
@@ -6950,16 +6950,16 @@  discard block
 block discarded – undo
6950 6950
 
6951 6951
         if ($action != 'move') {
6952 6952
             $return .= '<tr>';
6953
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6954
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6953
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6954
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6955 6955
             $return .= '</tr>';
6956 6956
         }
6957 6957
 
6958 6958
         $return .= '<tr>';
6959
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6959
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6960 6960
         $return .= '<td class="input">';
6961 6961
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6962
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6962
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6963 6963
         $arrHide = array(
6964 6964
             $id
6965 6965
         );
@@ -6968,13 +6968,13 @@  discard block
 block discarded – undo
6968 6968
         for ($i = 0; $i < count($arrLP); $i++) {
6969 6969
             if ($action != 'add') {
6970 6970
                 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)) {
6971
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6971
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6972 6972
                 } else {
6973 6973
                     $arrHide[] = $arrLP[$i]['id'];
6974 6974
                 }
6975 6975
             } else {
6976 6976
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6977
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6977
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6978 6978
             }
6979 6979
         }
6980 6980
         if (is_array($arrLP)) {
@@ -6985,10 +6985,10 @@  discard block
 block discarded – undo
6985 6985
         $return .= '</td>';
6986 6986
         $return .= '</tr>';
6987 6987
         $return .= '<tr>';
6988
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6988
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6989 6989
         $return .= '<td class="input">';
6990 6990
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6991
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6991
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6992 6992
 
6993 6993
         for ($i = 0; $i < count($arrLP); $i++) {
6994 6994
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6998,8 +6998,8 @@  discard block
 block discarded – undo
6998 6998
                 else
6999 6999
                     $selected = '';
7000 7000
 
7001
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
7002
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7001
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
7002
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7003 7003
             }
7004 7004
         }
7005 7005
 
@@ -7033,25 +7033,25 @@  discard block
 block discarded – undo
7033 7033
         $return .= '<tr>';
7034 7034
 
7035 7035
         if ($action == 'add') {
7036
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
7036
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
7037 7037
         } else {
7038
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
7038
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
7039 7039
         }
7040 7040
         $return .= '</tr>';
7041 7041
         $return .= '</table>';
7042 7042
 
7043 7043
         if ($action == 'move') {
7044
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7045
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7044
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7045
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7046 7046
         }
7047 7047
 
7048 7048
         if (is_numeric($extra_info)) {
7049
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7049
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7050 7050
         } elseif (is_array($extra_info)) {
7051
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7051
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7052 7052
         }
7053
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7054
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7053
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7054
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7055 7055
         $return .= '</form>';
7056 7056
         $return .= '</div>';
7057 7057
 
@@ -7078,7 +7078,7 @@  discard block
 block discarded – undo
7078 7078
             $item_title = stripslashes($extra_info['title']);
7079 7079
         } elseif (is_numeric($extra_info)) {
7080 7080
             $sql = "SELECT thread_title as title FROM $tbl_forum
7081
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7081
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7082 7082
 
7083 7083
             $result = Database::query($sql);
7084 7084
             $row = Database :: fetch_array($result);
@@ -7098,15 +7098,15 @@  discard block
 block discarded – undo
7098 7098
             $parent = 0;
7099 7099
         }
7100 7100
 
7101
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7102
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7101
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7102
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7103 7103
 
7104 7104
         $result = Database::query($sql);
7105 7105
 
7106
-        $arrLP = array ();
7106
+        $arrLP = array();
7107 7107
 
7108 7108
         while ($row = Database :: fetch_array($result)) {
7109
-            $arrLP[] = array (
7109
+            $arrLP[] = array(
7110 7110
                 'id' => $row['id'],
7111 7111
                 'item_type' => $row['item_type'],
7112 7112
                 'title' => $row['title'],
@@ -7129,31 +7129,31 @@  discard block
 block discarded – undo
7129 7129
 
7130 7130
         $return .= '<form method="POST">';
7131 7131
         if ($action == 'add')
7132
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7133
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7132
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7133
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7134 7134
         else
7135
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7135
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7136 7136
 
7137 7137
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7138 7138
         $return .= '<tr>';
7139
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7139
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7140 7140
         $return .= '<td class="input">';
7141 7141
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7142
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7143
-        $arrHide = array (
7142
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7143
+        $arrHide = array(
7144 7144
             $id
7145 7145
         );
7146 7146
 
7147 7147
         for ($i = 0; $i < count($arrLP); $i++) {
7148 7148
             if ($action != 'add') {
7149 7149
                 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)) {
7150
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7150
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7151 7151
                 } else {
7152 7152
                     $arrHide[] = $arrLP[$i]['id'];
7153 7153
                 }
7154 7154
             } else {
7155 7155
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7156
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7156
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7157 7157
             }
7158 7158
         }
7159 7159
 
@@ -7165,10 +7165,10 @@  discard block
 block discarded – undo
7165 7165
         $return .= '</td>';
7166 7166
         $return .= '</tr>';
7167 7167
         $return .= '<tr>';
7168
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7168
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7169 7169
         $return .= '<td class="input">';
7170 7170
         $return .= '<select id="previous" name="previous" size="1">';
7171
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7171
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7172 7172
         for ($i = 0; $i < count($arrLP); $i++) {
7173 7173
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7174 7174
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7177,7 +7177,7 @@  discard block
 block discarded – undo
7177 7177
                 else
7178 7178
                     $selected = '';
7179 7179
 
7180
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7180
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7181 7181
             }
7182 7182
         }
7183 7183
         $return .= '</select>';
@@ -7185,8 +7185,8 @@  discard block
 block discarded – undo
7185 7185
         $return .= '</tr>';
7186 7186
         if ($action != 'move') {
7187 7187
             $return .= '<tr>';
7188
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7189
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7188
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7189
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7190 7190
             $return .= '</tr>';
7191 7191
             $return .= '<tr>';
7192 7192
             $return .= '</tr>';
@@ -7213,17 +7213,17 @@  discard block
 block discarded – undo
7213 7213
             }
7214 7214
 
7215 7215
             $return .= '<tr>';
7216
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7217
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7216
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7217
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7218 7218
 
7219 7219
             foreach ($arrHide as $key => $value) {
7220 7220
                 if ($key == $s_selected_position && $action == 'add') {
7221
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7221
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7222 7222
                 }
7223 7223
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7224
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7224
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7225 7225
                 } else {
7226
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7226
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7227 7227
                 }
7228 7228
             }
7229 7229
             $return .= "</select></td>";
@@ -7237,19 +7237,19 @@  discard block
 block discarded – undo
7237 7237
         $return .= '</table>';
7238 7238
 
7239 7239
         if ($action == 'move') {
7240
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7241
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7240
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7241
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7242 7242
         }
7243 7243
 
7244 7244
         if (is_numeric($extra_info)) {
7245
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7245
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7246 7246
         }
7247 7247
         elseif (is_array($extra_info)) {
7248
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7248
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7249 7249
         }
7250 7250
 
7251
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7252
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7251
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7252
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7253 7253
         $return .= '</form>';
7254 7254
         $return .= '</div>';
7255 7255
 
@@ -7275,10 +7275,10 @@  discard block
 block discarded – undo
7275 7275
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7276 7276
 
7277 7277
         if ($id != 0 && is_array($extra_info)) {
7278
-            $item_title 		= $extra_info['title'];
7279
-            $item_description 	= $extra_info['description'];
7280
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7281
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7278
+            $item_title = $extra_info['title'];
7279
+            $item_description = $extra_info['description'];
7280
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7281
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7282 7282
         } else {
7283 7283
             $item_title = '';
7284 7284
             $item_description = '';
@@ -7292,17 +7292,17 @@  discard block
 block discarded – undo
7292 7292
         }
7293 7293
 
7294 7294
         $id  = intval($id);
7295
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7295
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7296 7296
                 WHERE
7297 7297
                     c_id = ".$course_id." AND
7298
-                    lp_id = " . $this->lp_id . " AND
7298
+                    lp_id = " . $this->lp_id." AND
7299 7299
                     id != $id";
7300 7300
 
7301 7301
         if ($item_type == 'module')
7302 7302
             $sql .= " AND parent_item_id = 0";
7303 7303
 
7304 7304
         $result = Database::query($sql);
7305
-        $arrLP = array ();
7305
+        $arrLP = array();
7306 7306
 
7307 7307
         while ($row = Database :: fetch_array($result)) {
7308 7308
             $arrLP[] = array(
@@ -7330,9 +7330,9 @@  discard block
 block discarded – undo
7330 7330
 
7331 7331
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7332 7332
 
7333
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7333
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7334 7334
 
7335
-        $form = new FormValidator('form', 'POST',  $url);
7335
+        $form = new FormValidator('form', 'POST', $url);
7336 7336
 
7337 7337
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7338 7338
         $defaults['description'] = $item_description;
@@ -7376,7 +7376,7 @@  discard block
 block discarded – undo
7376 7376
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7377 7377
 
7378 7378
             foreach ($arrHide as $key => $value) {
7379
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7379
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7380 7380
             }
7381 7381
             if (!empty($s_selected_parent)) {
7382 7382
                 $parent_select->setSelected($s_selected_parent);
@@ -7398,16 +7398,16 @@  discard block
 block discarded – undo
7398 7398
                     $s_selected_position = $arrLP[$i]['id'];
7399 7399
                 }
7400 7400
 
7401
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7401
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7402 7402
             }
7403 7403
         }
7404 7404
 
7405 7405
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7406 7406
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7407
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7407
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7408 7408
 
7409 7409
         foreach ($arrHide as $key => $value) {
7410
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7410
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7411 7411
         }
7412 7412
 
7413 7413
         if (!empty ($s_selected_position)) {
@@ -7436,23 +7436,23 @@  discard block
 block discarded – undo
7436 7436
         //assets can't be modified
7437 7437
 
7438 7438
         //$item_type == 'asset' ||
7439
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7439
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7440 7440
 
7441 7441
             if ($item_type == 'sco') {
7442
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7442
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7443 7443
             }
7444 7444
             $renderer = $form->defaultRenderer();
7445 7445
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7446 7446
 
7447 7447
             $relative_prefix = '';
7448 7448
 
7449
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7449
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7450 7450
                 'Width' 				=> '100%',
7451 7451
                 'Height' 				=> '500',
7452 7452
                 'FullPage' 				=> true,
7453 7453
                 'CreateDocumentDir' 	=> $relative_prefix,
7454
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7455
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7454
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7455
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7456 7456
             );
7457 7457
 
7458 7458
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7461,7 +7461,7 @@  discard block
 block discarded – undo
7461 7461
             $defaults['content_lp'] = file_get_contents($content_path);
7462 7462
         }
7463 7463
 
7464
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7464
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7465 7465
         $form->addElement('hidden', 'post_time', time());
7466 7466
         $form->setDefaults($defaults);
7467 7467
         return $form->return_form();
@@ -7499,8 +7499,8 @@  discard block
 block discarded – undo
7499 7499
         // We don't display the document form if it's not an editable document (html or txt file).
7500 7500
         if ($action == "add") {
7501 7501
             if (is_numeric($extra_info)) {
7502
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7503
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7502
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7503
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7504 7504
                 $result = Database::query($sql_doc);
7505 7505
                 $path_file = Database :: result($result, 0, 0);
7506 7506
                 $path_parts = pathinfo($path_file);
@@ -7518,13 +7518,13 @@  discard block
 block discarded – undo
7518 7518
                 $item_title = stripslashes($path_parts['filename']);
7519 7519
             }
7520 7520
         } elseif (is_numeric($extra_info)) {
7521
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7521
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7522 7522
                         WHERE
7523 7523
                             c_id = ".$course_id." AND
7524 7524
                             id = " . intval($extra_info);
7525 7525
 
7526 7526
             $result = Database::query($sql_doc);
7527
-            $row 	= Database::fetch_array($result);
7527
+            $row = Database::fetch_array($result);
7528 7528
             $item_title = $row['title'];
7529 7529
             $item_title = str_replace('_', ' ', $item_title);
7530 7530
             if (empty ($item_title)) {
@@ -7543,11 +7543,11 @@  discard block
 block discarded – undo
7543 7543
             $parent = 0;
7544 7544
         }
7545 7545
 
7546
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7547
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7546
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7547
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7548 7548
 
7549 7549
         $result = Database::query($sql);
7550
-        $arrLP = array ();
7550
+        $arrLP = array();
7551 7551
         while ($row = Database :: fetch_array($result)) {
7552 7552
             $arrLP[] = array(
7553 7553
                 'id' => $row['id'],
@@ -7581,9 +7581,9 @@  discard block
 block discarded – undo
7581 7581
         $return .= '</legend>';
7582 7582
 
7583 7583
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7584
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7584
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7585 7585
         }
7586
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7586
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7587 7587
         $defaults['title'] = Security :: remove_XSS($item_title);
7588 7588
         if (empty($item_title)) {
7589 7589
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7619,15 +7619,15 @@  discard block
 block discarded – undo
7619 7619
         }
7620 7620
 
7621 7621
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7622
-        $my_count=0;
7622
+        $my_count = 0;
7623 7623
         foreach ($arrHide as $key => $value) {
7624
-            if ($my_count!=0) {
7624
+            if ($my_count != 0) {
7625 7625
                 // The LP name is also the first section and is not in the same charset like the other sections.
7626 7626
                 $value['value'] = Security :: remove_XSS($value['value']);
7627
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7627
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7628 7628
             } else {
7629 7629
                 $value['value'] = Security :: remove_XSS($value['value']);
7630
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7630
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7631 7631
             }
7632 7632
             $my_count++;
7633 7633
         }
@@ -7635,7 +7635,7 @@  discard block
 block discarded – undo
7635 7635
         if (!empty($id)) {
7636 7636
             $parent_select->setSelected($parent);
7637 7637
         } else {
7638
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7638
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7639 7639
             $parent_select->setSelected($parent_item_id);
7640 7640
         }
7641 7641
 
@@ -7652,7 +7652,7 @@  discard block
 block discarded – undo
7652 7652
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'] || $action == 'add') {
7653 7653
                     $s_selected_position = $arrLP[$i]['id'];
7654 7654
                 }
7655
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7655
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7656 7656
             }
7657 7657
         }
7658 7658
 
@@ -7660,8 +7660,8 @@  discard block
 block discarded – undo
7660 7660
         $position->addOption(get_lang('FirstPosition'), 0);
7661 7661
 
7662 7662
         foreach ($arrHide as $key => $value) {
7663
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7664
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7663
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7664
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7665 7665
         }
7666 7666
 
7667 7667
         $position->setSelected($s_selected_position);
@@ -7732,7 +7732,7 @@  discard block
 block discarded – undo
7732 7732
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7733 7733
                             $relative_path 	 = implode('/', $relative_path);
7734 7734
                             if (strlen($relative_path) > 0) {
7735
-                                $relative_path = $relative_path . '/';
7735
+                                $relative_path = $relative_path.'/';
7736 7736
                             }
7737 7737
                         } else {
7738 7738
                             $result = $this->generate_lp_folder($_course);
@@ -7746,8 +7746,8 @@  discard block
 block discarded – undo
7746 7746
                             'Height' 				=> '500',
7747 7747
                             'FullPage' 				=> true,
7748 7748
                             'CreateDocumentDir' 	=> $relative_prefix,
7749
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7750
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7749
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7750
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7751 7751
                         );
7752 7752
 
7753 7753
                         if ($_GET['action'] == 'add_item') {
@@ -7814,8 +7814,8 @@  discard block
 block discarded – undo
7814 7814
             $item_url = stripslashes($extra_info['url']);
7815 7815
         } elseif (is_numeric($extra_info)) {
7816 7816
             $extra_info = intval($extra_info);
7817
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7818
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7817
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7818
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7819 7819
             $result = Database::query($sql);
7820 7820
             $row = Database :: fetch_array($result);
7821 7821
             $item_title       = $row['title'];
@@ -7835,8 +7835,8 @@  discard block
 block discarded – undo
7835 7835
             $parent = 0;
7836 7836
         }
7837 7837
 
7838
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7839
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7838
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7839
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7840 7840
         $result = Database::query($sql);
7841 7841
         $arrLP = array();
7842 7842
 
@@ -7863,10 +7863,10 @@  discard block
 block discarded – undo
7863 7863
         unset ($this->arrMenu);
7864 7864
 
7865 7865
         if ($action == 'add')
7866
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7867
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7866
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7867
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7868 7868
         else
7869
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7869
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7870 7870
 
7871 7871
         $legend .= '</legend>';
7872 7872
 
@@ -7877,16 +7877,16 @@  discard block
 block discarded – undo
7877 7877
 
7878 7878
         if ($action != 'move') {
7879 7879
             $return .= '<tr>';
7880
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7881
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7880
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7881
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7882 7882
             $return .= '</tr>';
7883 7883
         }
7884 7884
 
7885 7885
         $return .= '<tr>';
7886
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7886
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7887 7887
         $return .= '<td class="input">';
7888 7888
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7889
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7889
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7890 7890
         $arrHide = array(
7891 7891
             $id
7892 7892
         );
@@ -7896,13 +7896,13 @@  discard block
 block discarded – undo
7896 7896
         for ($i = 0; $i < count($arrLP); $i++) {
7897 7897
             if ($action != 'add') {
7898 7898
                 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)) {
7899
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7899
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7900 7900
                 } else {
7901 7901
                     $arrHide[] = $arrLP[$i]['id'];
7902 7902
                 }
7903 7903
             } else {
7904 7904
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7905
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7905
+                    $return .= '<option '.(($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7906 7906
             }
7907 7907
         }
7908 7908
 
@@ -7914,11 +7914,11 @@  discard block
 block discarded – undo
7914 7914
         $return .= '</td>';
7915 7915
         $return .= '</tr>';
7916 7916
         $return .= '<tr>';
7917
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7917
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7918 7918
         $return .= '<td class="input">';
7919 7919
 
7920 7920
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7921
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7921
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7922 7922
         for ($i = 0; $i < count($arrLP); $i++) {
7923 7923
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7924 7924
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7928,7 +7928,7 @@  discard block
 block discarded – undo
7928 7928
                 else
7929 7929
                     $selected = '';
7930 7930
 
7931
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7931
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7932 7932
             }
7933 7933
         }
7934 7934
         $return .= '</select>';
@@ -7937,8 +7937,8 @@  discard block
 block discarded – undo
7937 7937
 
7938 7938
         if ($action != 'move') {
7939 7939
             $return .= '<tr>';
7940
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7941
-            $return .= '<td class="input"><input' . (is_numeric($extra_info) ? ' disabled="disabled"' : '') . ' id="idURL" name="url" style="width:99%;" type="text" value="' . $item_url . '" class="learnpath_item_form" /></td>';
7940
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7941
+            $return .= '<td class="input"><input'.(is_numeric($extra_info) ? ' disabled="disabled"' : '').' id="idURL" name="url" style="width:99%;" type="text" value="'.$item_url.'" class="learnpath_item_form" /></td>';
7942 7942
             $return .= '</tr>';
7943 7943
             $id_prerequisite = 0;
7944 7944
             if (is_array($arrLP)) {
@@ -7965,25 +7965,25 @@  discard block
 block discarded – undo
7965 7965
 
7966 7966
         $return .= '<tr>';
7967 7967
         if ($action == 'add') {
7968
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7968
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7969 7969
         } else {
7970
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7970
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7971 7971
         }
7972 7972
         $return .= '</tr>';
7973 7973
         $return .= '</table>';
7974 7974
 
7975 7975
         if ($action == 'move') {
7976
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7977
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7976
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7977
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7978 7978
         }
7979 7979
 
7980 7980
         if (is_numeric($extra_info)) {
7981
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7981
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7982 7982
         } elseif (is_array($extra_info)) {
7983
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7983
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7984 7984
         }
7985
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7986
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7985
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7986
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7987 7987
         $return .= '</form>';
7988 7988
         $return .= '</div>';
7989 7989
 
@@ -8009,8 +8009,8 @@  discard block
 block discarded – undo
8009 8009
         } elseif (is_numeric($extra_info)) {
8010 8010
             $extra_info = intval($extra_info);
8011 8011
             $sql = "SELECT title, description
8012
-                    FROM " . $tbl_publication . "
8013
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
8012
+                    FROM " . $tbl_publication."
8013
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
8014 8014
 
8015 8015
             $result = Database::query($sql);
8016 8016
             $row = Database :: fetch_array($result);
@@ -8026,13 +8026,13 @@  discard block
 block discarded – undo
8026 8026
             $parent = 0;
8027 8027
         }
8028 8028
 
8029
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8030
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8029
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8030
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8031 8031
 
8032 8032
         $result = Database::query($sql);
8033 8033
         $arrLP = array();
8034 8034
         while ($row = Database :: fetch_array($result)) {
8035
-            $arrLP[] = array (
8035
+            $arrLP[] = array(
8036 8036
                 'id' => $row['id'],
8037 8037
                 'item_type' => $row['item_type'],
8038 8038
                 'title' => $row['title'],
@@ -8078,7 +8078,7 @@  discard block
 block discarded – undo
8078 8078
             ]
8079 8079
         );
8080 8080
 
8081
-        $arrHide = array (
8081
+        $arrHide = array(
8082 8082
             $id
8083 8083
         );
8084 8084
 
@@ -8096,7 +8096,7 @@  discard block
 block discarded – undo
8096 8096
                     $parentSelect->addOption(
8097 8097
                         $arrLP[$i]['title'],
8098 8098
                         $arrLP[$i]['id'],
8099
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8099
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8100 8100
                     );
8101 8101
 
8102 8102
                     if ($parent == $arrLP[$i]['id']) {
@@ -8113,7 +8113,7 @@  discard block
 block discarded – undo
8113 8113
                     $parentSelect->addOption(
8114 8114
                         $arrLP[$i]['title'],
8115 8115
                         $arrLP[$i]['id'],
8116
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8116
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8117 8117
                     );
8118 8118
 
8119 8119
                     if ($parent == $arrLP[$i]['id']) {
@@ -8137,7 +8137,7 @@  discard block
 block discarded – undo
8137 8137
         for ($i = 0; $i < count($arrLP); $i++) {
8138 8138
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8139 8139
                 $previousSelect->addOption(
8140
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8140
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8141 8141
                     $arrLP[$i]['id']
8142 8142
                 );
8143 8143
 
@@ -8159,7 +8159,7 @@  discard block
 block discarded – undo
8159 8159
                     }
8160 8160
                 }
8161 8161
             }
8162
-            $arrHide = array ();
8162
+            $arrHide = array();
8163 8163
             for ($i = 0; $i < count($arrLP); $i++) {
8164 8164
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8165 8165
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8251,8 +8251,8 @@  discard block
 block discarded – undo
8251 8251
 
8252 8252
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8253 8253
         $item_id = intval($item_id);
8254
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8255
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8254
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8255
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8256 8256
         $result = Database::query($sql);
8257 8257
         $row = Database::fetch_assoc($result);
8258 8258
 
@@ -8266,16 +8266,16 @@  discard block
 block discarded – undo
8266 8266
             $audio_player .= '<script>
8267 8267
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8268 8268
                                 s1.addParam("allowscriptaccess","always");
8269
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8269
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8270 8270
                                 s1.write("container");
8271 8271
                             </script>';
8272 8272
         }
8273 8273
 
8274
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8274
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8275 8275
 
8276 8276
         $return .= Display::url(
8277 8277
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8278
-            $url.'&action=edit_item&path_item=' . $row['path']
8278
+            $url.'&action=edit_item&path_item='.$row['path']
8279 8279
         );
8280 8280
 
8281 8281
         $return .= Display::url(
@@ -8295,7 +8295,7 @@  discard block
 block discarded – undo
8295 8295
             $url.'&action=delete_item'
8296 8296
         );
8297 8297
 
8298
-        if ($item_type == TOOL_HOTPOTATOES ) {
8298
+        if ($item_type == TOOL_HOTPOTATOES) {
8299 8299
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8300 8300
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8301 8301
         }
@@ -8321,13 +8321,13 @@  discard block
 block discarded – undo
8321 8321
     public function get_js_dropdown_array()
8322 8322
     {
8323 8323
         $course_id = api_get_course_int_id();
8324
-        $return = 'var child_name = new Array();' . "\n";
8325
-        $return .= 'var child_value = new Array();' . "\n\n";
8326
-        $return .= 'child_name[0] = new Array();' . "\n";
8327
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8324
+        $return = 'var child_name = new Array();'."\n";
8325
+        $return .= 'var child_value = new Array();'."\n\n";
8326
+        $return .= 'child_name[0] = new Array();'."\n";
8327
+        $return .= 'child_value[0] = new Array();'."\n\n";
8328 8328
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8329
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8330
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8329
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8330
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8331 8331
                     ORDER BY display_order ASC";
8332 8332
         $res_zero = Database::query($sql_zero);
8333 8333
         $i = 0;
@@ -8337,28 +8337,28 @@  discard block
 block discarded – undo
8337 8337
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8338 8338
             }
8339 8339
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8340
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8341
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8340
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8341
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8342 8342
         }
8343 8343
         $return .= "\n";
8344
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8345
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8344
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8345
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8346 8346
         $res = Database::query($sql);
8347 8347
         while ($row = Database :: fetch_array($res)) {
8348
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8348
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8349 8349
                            WHERE
8350 8350
                                 c_id = ".$course_id." AND
8351
-                                parent_item_id = " . $row['id'] . "
8351
+                                parent_item_id = " . $row['id']."
8352 8352
                            ORDER BY display_order ASC";
8353 8353
             $res_parent = Database::query($sql_parent);
8354 8354
             $i = 0;
8355
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8356
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8355
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8356
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8357 8357
 
8358 8358
             while ($row_parent = Database :: fetch_array($res_parent)) {
8359 8359
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8360
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8361
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8360
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8361
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8362 8362
             }
8363 8363
             $return .= "\n";
8364 8364
         }
@@ -8379,8 +8379,8 @@  discard block
 block discarded – undo
8379 8379
         if (is_numeric($item_id)) {
8380 8380
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8381 8381
 
8382
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8383
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8382
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8383
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8384 8384
 
8385 8385
             $res = Database::query($sql);
8386 8386
             $row = Database :: fetch_array($res);
@@ -8439,7 +8439,7 @@  discard block
 block discarded – undo
8439 8439
      */
8440 8440
     public function display_item_small_form($item_type, $title = '', $data = array())
8441 8441
     {
8442
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8442
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8443 8443
         $form = new FormValidator('small_form', 'post', $url);
8444 8444
         $form->addElement('header', $title);
8445 8445
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8465,7 +8465,7 @@  discard block
 block discarded – undo
8465 8465
         $item_id = intval($item_id);
8466 8466
         /* Current prerequisite */
8467 8467
         $sql = "SELECT * FROM $tbl_lp_item
8468
-                WHERE c_id = $course_id AND id = " . $item_id;
8468
+                WHERE c_id = $course_id AND id = ".$item_id;
8469 8469
         $result = Database::query($sql);
8470 8470
         $row    = Database::fetch_array($result);
8471 8471
         $prerequisiteId = $row['prerequisite'];
@@ -8475,20 +8475,20 @@  discard block
 block discarded – undo
8475 8475
         $return .= '<form method="POST">';
8476 8476
         $return .= '<table class="data_table">';
8477 8477
         $return .= '<tr>';
8478
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8479
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8480
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8478
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8479
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8480
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8481 8481
         $return .= '</tr>';
8482 8482
 
8483 8483
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8484 8484
         $return .= '<tr >';
8485 8485
         $return .= '<td colspan="3" class="radio">';
8486 8486
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8487
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8487
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8488 8488
         $return .= '</tr>';
8489 8489
 
8490 8490
         $sql = "SELECT * FROM $tbl_lp_item
8491
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8491
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8492 8492
         $result = Database::query($sql);
8493 8493
         $arrLP = array();
8494 8494
 
@@ -8531,25 +8531,25 @@  discard block
 block discarded – undo
8531 8531
             }
8532 8532
 
8533 8533
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8534
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8534
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8535 8535
 
8536 8536
             $return .= '<tr>';
8537
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8538
-            $return .= '<label for="id' . $item['id'] . '">';
8539
-            $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'] . '" />';
8537
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8538
+            $return .= '<label for="id'.$item['id'].'">';
8539
+            $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'].'" />';
8540 8540
             $icon_name = str_replace(' ', '', $item['item_type']);
8541 8541
 
8542
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8543
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8542
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8543
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8544 8544
             } else {
8545
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8546
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8545
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8546
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8547 8547
                 } else {
8548 8548
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8549 8549
                 }
8550 8550
             }
8551 8551
 
8552
-            $return .=  $item['title'] . '</label>';
8552
+            $return .= $item['title'].'</label>';
8553 8553
             $return .= '</td>';
8554 8554
 
8555 8555
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8563,19 +8563,19 @@  discard block
 block discarded – undo
8563 8563
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8564 8564
 
8565 8565
                 $return .= '<td class="exercise">';
8566
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8566
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8567 8567
                 $return .= '</td>';
8568 8568
                 $return .= '<td class="exercise">';
8569
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8569
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8570 8570
                 $return .= '</td>';
8571 8571
             }
8572 8572
 
8573 8573
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8574 8574
                 $return .= '<td class="exercise">';
8575
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8575
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8576 8576
                 $return .= '</td>';
8577 8577
                 $return .= '<td class="exercise"">';
8578
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8578
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8579 8579
                 $return .= '</td>';
8580 8580
             }
8581 8581
             $return .= '</tr>';
@@ -8584,7 +8584,7 @@  discard block
 block discarded – undo
8584 8584
         $return .= '</tr>';
8585 8585
         $return .= '</table>';
8586 8586
         $return .= '<div style="padding-top:3px;">';
8587
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8587
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8588 8588
         $return .= '</form>';
8589 8589
 
8590 8590
         return $return;
@@ -8620,7 +8620,7 @@  discard block
 block discarded – undo
8620 8620
                 if ($row['id'] == $lp_id) {
8621 8621
                     continue;
8622 8622
                 }
8623
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8623
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8624 8624
             }
8625 8625
         }
8626 8626
         $return .= '</select>';
@@ -8680,8 +8680,8 @@  discard block
 block discarded – undo
8680 8680
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8681 8681
                      ORDER BY title ASC";
8682 8682
 
8683
-        $sql_hot  = "SELECT * FROM $tbl_doc
8684
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8683
+        $sql_hot = "SELECT * FROM $tbl_doc
8684
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8685 8685
                      ORDER BY id ASC";
8686 8686
 
8687 8687
         $res_quiz = Database::query($sql_quiz);
@@ -8690,8 +8690,8 @@  discard block
 block discarded – undo
8690 8690
         $return = '<ul class="lp_resource">';
8691 8691
         $return .= '<li class="lp_resource_element">';
8692 8692
         $return .= Display::return_icon('new_test_small.gif');
8693
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8694
-            get_lang('NewExercise') . '</a>';
8693
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8694
+            get_lang('NewExercise').'</a>';
8695 8695
         $return .= '</li>';
8696 8696
 
8697 8697
         // Display hotpotatoes
@@ -8703,8 +8703,8 @@  discard block
 block discarded – undo
8703 8703
             $return .= '</a> ';
8704 8704
 
8705 8705
             $return .= Display::return_icon('hotpotatoes_s.png');
8706
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8707
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8706
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8707
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8708 8708
             $return .= '</li>';
8709 8709
         }
8710 8710
 
@@ -8714,7 +8714,7 @@  discard block
 block discarded – undo
8714 8714
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8715 8715
             $return .= '</a> ';
8716 8716
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8717
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8717
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8718 8718
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8719 8719
                 '</a>';
8720 8720
             $return .= '</li>';
@@ -8788,7 +8788,7 @@  discard block
 block discarded – undo
8788 8788
         foreach ($categorizedLinks as $categoryId => $links) {
8789 8789
             $linkNodes = null;
8790 8790
             foreach ($links as $key => $title) {
8791
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8791
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8792 8792
                     $linkNodes .=
8793 8793
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8794 8794
                         <a class="moved" href="#">'.
@@ -8826,7 +8826,7 @@  discard block
 block discarded – undo
8826 8826
         $return = '<div class="lp_resource" >';
8827 8827
         $return .= '<div class="lp_resource_element">';
8828 8828
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8829
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8829
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8830 8830
         $return .= '</div>';
8831 8831
         $return .= '</div>';
8832 8832
         return $return;
@@ -8849,7 +8849,7 @@  discard block
 block discarded – undo
8849 8849
         $return .= Display::return_icon('forum_new_small.gif');
8850 8850
         $return .= Display::url(
8851 8851
             get_lang('CreateANewForum'),
8852
-            api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query([
8852
+            api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&'.http_build_query([
8853 8853
                 'action' => 'add',
8854 8854
                 'content' => 'forum',
8855 8855
                 'lp_id' => $this->lp_id
@@ -8877,15 +8877,15 @@  discard block
 block discarded – undo
8877 8877
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8878 8878
                 $return .= ' </a>';
8879 8879
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8880
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8881
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8880
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8881
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8882 8882
                             </a>
8883
-                            <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">' .
8884
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8883
+                            <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">'.
8884
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8885 8885
 
8886 8886
                 $return .= '</li>';
8887 8887
 
8888
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8888
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8889 8889
                 $a_threads = get_threads($forum['forum_id']);
8890 8890
                 if (is_array($a_threads)) {
8891 8891
                     foreach ($a_threads as $thread) {
@@ -8894,8 +8894,8 @@  discard block
 block discarded – undo
8894 8894
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8895 8895
                         $return .= ' </a>';
8896 8896
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8897
-                        $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 . '">' .
8898
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8897
+                        $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.'">'.
8898
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8899 8899
                         $return .= '</li>';
8900 8900
                     }
8901 8901
                 }
@@ -8966,7 +8966,7 @@  discard block
 block discarded – undo
8966 8966
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8967 8967
             // Remove the possible . at the end of the path.
8968 8968
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8969
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8969
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8970 8970
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8971 8971
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8972 8972
         }
@@ -9034,7 +9034,7 @@  discard block
 block discarded – undo
9034 9034
                 if ($item->type == 'sco') {
9035 9035
                     $inc_docs = $item->get_resources_from_source(
9036 9036
                         null,
9037
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
9037
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
9038 9038
                     );
9039 9039
                 } else {
9040 9040
                     $inc_docs = $item->get_resources_from_source();
@@ -9250,7 +9250,7 @@  discard block
 block discarded – undo
9250 9250
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9251 9251
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9252 9252
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9253
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9253
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9254 9254
                                         $my_dep->setAttribute('xml:base', '');
9255 9255
                                     }
9256 9256
                                 }
@@ -9381,7 +9381,7 @@  discard block
 block discarded – undo
9381 9381
                         //$my_item->appendChild($my_max_score);
9382 9382
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9383 9383
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9384
-                        $my_prereqs->setAttribute('type','aicc_script');
9384
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9385 9385
                         $my_item->appendChild($my_prereqs);
9386 9386
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9387 9387
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9434,7 +9434,7 @@  discard block
 block discarded – undo
9434 9434
                         $my_resource->appendChild($my_file);
9435 9435
 
9436 9436
                         // Get included docs.
9437
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9437
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9438 9438
                         // Dependency to other files - not yet supported.
9439 9439
                         $i = 1;
9440 9440
                         foreach ($inc_docs as $doc_info) {
@@ -9495,7 +9495,7 @@  discard block
 block discarded – undo
9495 9495
                                         $my_dep_file->setAttribute('href', $file_path);
9496 9496
                                         $my_dep->setAttribute('xml:base', '');
9497 9497
 
9498
-                                        if (strstr($file_path,$main_path) !== false) {
9498
+                                        if (strstr($file_path, $main_path) !== false) {
9499 9499
                                             // The calculated real path is really inside the chamilo root path.
9500 9500
                                             // Reduce file path to what's under the DocumentRoot.
9501 9501
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9513,7 +9513,7 @@  discard block
 block discarded – undo
9513 9513
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9514 9514
                                             $file_path = str_replace('//', '/', $file_path);
9515 9515
                                             if (file_exists($file_path)) {
9516
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9516
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9517 9517
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9518 9518
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9519 9519
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9742,7 +9742,7 @@  discard block
 block discarded – undo
9742 9742
             if (strpos($extra_file, '.') === 0)
9743 9743
                 continue;
9744 9744
             else {
9745
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9745
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9746 9746
                 $this->create_path($dest_file);
9747 9747
                 copy($main_code_path.$extra_file, $dest_file);
9748 9748
             }
@@ -9795,7 +9795,7 @@  discard block
 block discarded – undo
9795 9795
                             }
9796 9796
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9797 9797
                             if (file_exists($file_path)) {
9798
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9798
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9799 9799
                             }
9800 9800
                             break;
9801 9801
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9835,12 +9835,12 @@  discard block
 block discarded – undo
9835 9835
 
9836 9836
         foreach ($path_bits as $bit) {
9837 9837
             if (!empty ($bit)) {
9838
-                $new_path = $path_built . $bit;
9838
+                $new_path = $path_built.$bit;
9839 9839
                 if (is_dir($new_path)) {
9840
-                    $path_built = $new_path . '/';
9840
+                    $path_built = $new_path.'/';
9841 9841
                 } else {
9842 9842
                     mkdir($new_path, api_get_permissions_for_new_directories());
9843
-                    $path_built = $new_path . '/';
9843
+                    $path_built = $new_path.'/';
9844 9844
                 }
9845 9845
             }
9846 9846
         }
@@ -9884,9 +9884,9 @@  discard block
 block discarded – undo
9884 9884
 
9885 9885
         if ($upload_ok) {
9886 9886
             if ($has_attachment) {
9887
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9887
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9888 9888
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9889
-                $updir = $sys_course_path . $courseDir;
9889
+                $updir = $sys_course_path.$courseDir;
9890 9890
                 // Try to add an extension to the file if it hasn't one.
9891 9891
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9892 9892
 
@@ -9941,7 +9941,7 @@  discard block
 block discarded – undo
9941 9941
             //Setting my lp_id to autolaunch = 1
9942 9942
             $attributes['autolaunch'] = 1;
9943 9943
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9944
-            Database::update($lp_table, $attributes, $where );
9944
+            Database::update($lp_table, $attributes, $where);
9945 9945
         }
9946 9946
     }
9947 9947
 
@@ -9960,13 +9960,13 @@  discard block
 block discarded – undo
9960 9960
 
9961 9961
         // Get the max order of the items
9962 9962
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9963
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9963
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9964 9964
         $rs_max_order = Database::query($sql_max_order);
9965 9965
         $row_max_order = Database::fetch_object($rs_max_order);
9966 9966
         $max_order = $row_max_order->display_order;
9967 9967
         // Get the previous item ID
9968 9968
         $sql = "SELECT id as previous FROM $table_lp_item
9969
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9969
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9970 9970
         $rs_max = Database::query($sql);
9971 9971
         $row_max = Database::fetch_object($rs_max);
9972 9972
 
@@ -10022,9 +10022,9 @@  discard block
 block discarded – undo
10022 10022
         $documents_total_space = DocumentManager::documents_total_space();
10023 10023
         $course_max_space = DocumentManager::get_course_quota();
10024 10024
         $total_size = filesize($s) + $documents_total_space;
10025
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
10025
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
10026 10026
             return true;
10027
-        } else{
10027
+        } else {
10028 10028
             return false;
10029 10029
         }
10030 10030
     }
@@ -10364,7 +10364,7 @@  discard block
 block discarded – undo
10364 10364
         if ($this->debug > 0) {
10365 10365
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10366 10366
         }
10367
-        $this->subscribeUsers = intval($value);;
10367
+        $this->subscribeUsers = intval($value); ;
10368 10368
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10369 10369
         $lp_id = $this->get_id();
10370 10370
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10710,7 +10710,7 @@  discard block
 block discarded – undo
10710 10710
      */
10711 10711
     public function createForum($forumCategoryId)
10712 10712
     {
10713
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10713
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10714 10714
 
10715 10715
         $forumId = store_forum(
10716 10716
             [
@@ -10749,7 +10749,7 @@  discard block
 block discarded – undo
10749 10749
 
10750 10750
     private function getFinalItemTemplate()
10751 10751
     {
10752
-        return file_get_contents(api_get_path(SYS_CODE_PATH) . 'newscorm/final_item_template/template.html');
10752
+        return file_get_contents(api_get_path(SYS_CODE_PATH).'newscorm/final_item_template/template.html');
10753 10753
     }
10754 10754
 
10755 10755
     private function getSavedFinalItem()
@@ -10790,11 +10790,11 @@  discard block
 block discarded – undo
10790 10790
             'Height' => '500',
10791 10791
             'FullPage' => true,
10792 10792
             'CreateDocumentDir' => $relative_prefix,
10793
-            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
10794
-            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
10793
+            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
10794
+            'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
10795 10795
         ];
10796 10796
 
10797
-        $url = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
10797
+        $url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
10798 10798
             'type' => 'document',
10799 10799
             'lp_id' => $this->lp_id
10800 10800
         ]);
Please login to merge, or discard this patch.
Braces   +163 added lines, -115 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']) {
@@ -6485,10 +6500,11 @@  discard block
 block discarded – undo
6485 6500
         $item_description 	= Security::remove_XSS($item_description);
6486 6501
 
6487 6502
         $legend = '<legend>';
6488
-        if ($id != 0 && is_array($extra_info))
6489
-            $parent = $extra_info['parent_item_id'];
6490
-        else
6491
-            $parent = 0;
6503
+        if ($id != 0 && is_array($extra_info)) {
6504
+                    $parent = $extra_info['parent_item_id'];
6505
+        } else {
6506
+                    $parent = 0;
6507
+        }
6492 6508
 
6493 6509
         $sql = "SELECT * FROM " . $tbl_lp_item . "
6494 6510
                 WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ -6566,8 +6582,9 @@  discard block
 block discarded – undo
6566 6582
                     $arrHide[] = $arrLP[$i]['id'];
6567 6583
                 }
6568 6584
             } else {
6569
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6570
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6585
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6586
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6587
+                }
6571 6588
             }
6572 6589
         }
6573 6590
         if (is_array($arrLP)) {
@@ -6756,11 +6773,13 @@  discard block
 block discarded – undo
6756 6773
         }
6757 6774
 
6758 6775
         $legend = '<legend>';
6759
-        if ($action == 'add')
6760
-            $legend .= get_lang('CreateTheExercise');
6761
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentExercise');
6762
-        else
6763
-            $legend .= get_lang('EditCurrentExecice');
6776
+        if ($action == 'add') {
6777
+                    $legend .= get_lang('CreateTheExercise');
6778
+        } elseif ($action == 'move') {
6779
+            $legend .= get_lang('MoveTheCurrentExercise');
6780
+        } else {
6781
+                    $legend .= get_lang('EditCurrentExecice');
6782
+        }
6764 6783
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6765 6784
             $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6766 6785
         }
@@ -6787,8 +6806,9 @@  discard block
 block discarded – undo
6787 6806
                         $arrHide[] = $arrLP[$i]['id'];
6788 6807
                     }
6789 6808
                 } else {
6790
-                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6791
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6809
+                    if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
6810
+                                            $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6811
+                    }
6792 6812
                 }
6793 6813
             }
6794 6814
 
@@ -6806,11 +6826,13 @@  discard block
 block discarded – undo
6806 6826
 
6807 6827
         for ($i = 0; $i < count($arrLP); $i++) {
6808 6828
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6809
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6829
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6830
+                                    $selected = 'selected="selected" ';
6831
+                } elseif ($action == 'add') {
6810 6832
                     $selected = 'selected="selected" ';
6811
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6812
-                else
6813
-                    $selected = '';
6833
+                } else {
6834
+                                    $selected = '';
6835
+                }
6814 6836
 
6815 6837
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6816 6838
             }
@@ -6837,9 +6859,11 @@  discard block
 block discarded – undo
6837 6859
                 $arrHide = array ();
6838 6860
                 for ($i = 0; $i < count($arrLP); $i++) {
6839 6861
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6840
-                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
6841
-                            $s_selected_position = $arrLP[$i]['id'];
6842
-                        elseif ($action == 'add') $s_selected_position = 0;
6862
+                        if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
6863
+                                                    $s_selected_position = $arrLP[$i]['id'];
6864
+                        } elseif ($action == 'add') {
6865
+                            $s_selected_position = 0;
6866
+                        }
6843 6867
                         $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
6844 6868
 
6845 6869
                     }
@@ -6936,11 +6960,13 @@  discard block
 block discarded – undo
6936 6960
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
6937 6961
         unset($this->arrMenu);
6938 6962
 
6939
-        if ($action == 'add')
6940
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6941
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6942
-        else
6943
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6963
+        if ($action == 'add') {
6964
+                    $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6965
+        } elseif ($action == 'move') {
6966
+            $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6967
+        } else {
6968
+                    $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6969
+        }
6944 6970
 
6945 6971
         $legend .= '</legend>';
6946 6972
         $return = '<div class="sectioncomment">';
@@ -6973,8 +6999,9 @@  discard block
 block discarded – undo
6973 6999
                     $arrHide[] = $arrLP[$i]['id'];
6974 7000
                 }
6975 7001
             } else {
6976
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6977
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7002
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7003
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7004
+                }
6978 7005
             }
6979 7006
         }
6980 7007
         if (is_array($arrLP)) {
@@ -6992,11 +7019,13 @@  discard block
 block discarded – undo
6992 7019
 
6993 7020
         for ($i = 0; $i < count($arrLP); $i++) {
6994 7021
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6995
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7022
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7023
+                                    $selected = 'selected="selected" ';
7024
+                } elseif ($action == 'add') {
6996 7025
                     $selected = 'selected="selected" ';
6997
-                elseif ($action == 'add') $selected = 'selected="selected" ';
6998
-                else
6999
-                    $selected = '';
7026
+                } else {
7027
+                                    $selected = '';
7028
+                }
7000 7029
 
7001 7030
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
7002 7031
                     get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
@@ -7022,9 +7051,11 @@  discard block
 block discarded – undo
7022 7051
             $arrHide = array();
7023 7052
             for ($i = 0; $i < count($arrLP); $i++) {
7024 7053
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7025
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7026
-                        $s_selected_position = $arrLP[$i]['id'];
7027
-                    elseif ($action == 'add') $s_selected_position = 0;
7054
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7055
+                                            $s_selected_position = $arrLP[$i]['id'];
7056
+                    } elseif ($action == 'add') {
7057
+                        $s_selected_position = 0;
7058
+                    }
7028 7059
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7029 7060
                 }
7030 7061
             }
@@ -7128,11 +7159,13 @@  discard block
 block discarded – undo
7128 7159
         unset ($this->arrMenu);
7129 7160
 
7130 7161
         $return .= '<form method="POST">';
7131
-        if ($action == 'add')
7132
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7133
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7134
-        else
7135
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7162
+        if ($action == 'add') {
7163
+                    $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7164
+        } elseif ($action == 'move') {
7165
+            $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7166
+        } else {
7167
+                    $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7168
+        }
7136 7169
 
7137 7170
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7138 7171
         $return .= '<tr>';
@@ -7152,8 +7185,9 @@  discard block
 block discarded – undo
7152 7185
                     $arrHide[] = $arrLP[$i]['id'];
7153 7186
                 }
7154 7187
             } else {
7155
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7156
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7188
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7189
+                                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7190
+                }
7157 7191
             }
7158 7192
         }
7159 7193
 
@@ -7171,11 +7205,13 @@  discard block
 block discarded – undo
7171 7205
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7172 7206
         for ($i = 0; $i < count($arrLP); $i++) {
7173 7207
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7174
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7208
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7209
+                                    $selected = 'selected="selected" ';
7210
+                } elseif ($action == 'add') {
7175 7211
                     $selected = 'selected="selected" ';
7176
-                elseif ($action == 'add') $selected = 'selected="selected" ';
7177
-                else
7178
-                    $selected = '';
7212
+                } else {
7213
+                                    $selected = '';
7214
+                }
7179 7215
 
7180 7216
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7181 7217
             }
@@ -7204,9 +7240,11 @@  discard block
 block discarded – undo
7204 7240
             $arrHide = array();
7205 7241
             for ($i = 0; $i < count($arrLP); $i++) {
7206 7242
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7207
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7208
-                        $s_selected_position = $arrLP[$i]['id'];
7209
-                    elseif ($action == 'add') $s_selected_position = 0;
7243
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7244
+                                            $s_selected_position = $arrLP[$i]['id'];
7245
+                    } elseif ($action == 'add') {
7246
+                        $s_selected_position = 0;
7247
+                    }
7210 7248
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7211 7249
 
7212 7250
                 }
@@ -7219,8 +7257,7 @@  discard block
 block discarded – undo
7219 7257
             foreach ($arrHide as $key => $value) {
7220 7258
                 if ($key == $s_selected_position && $action == 'add') {
7221 7259
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7222
-                }
7223
-                elseif ($key == $id_prerequisite && $action == 'edit') {
7260
+                } elseif ($key == $id_prerequisite && $action == 'edit') {
7224 7261
                     $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7225 7262
                 } else {
7226 7263
                     $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
@@ -7243,8 +7280,7 @@  discard block
 block discarded – undo
7243 7280
 
7244 7281
         if (is_numeric($extra_info)) {
7245 7282
             $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7246
-        }
7247
-        elseif (is_array($extra_info)) {
7283
+        } elseif (is_array($extra_info)) {
7248 7284
             $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7249 7285
         }
7250 7286
 
@@ -7298,8 +7334,9 @@  discard block
 block discarded – undo
7298 7334
                     lp_id = " . $this->lp_id . " AND
7299 7335
                     id != $id";
7300 7336
 
7301
-        if ($item_type == 'module')
7302
-            $sql .= " AND parent_item_id = 0";
7337
+        if ($item_type == 'module') {
7338
+                    $sql .= " AND parent_item_id = 0";
7339
+        }
7303 7340
 
7304 7341
         $result = Database::query($sql);
7305 7342
         $arrLP = array ();
@@ -7685,9 +7722,11 @@  discard block
 block discarded – undo
7685 7722
 
7686 7723
             for ($i = 0; $i < count($arrLP); $i++) {
7687 7724
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] !== TOOL_FINAL_ITEM) {
7688
-                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7725
+                    if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7726
+                                            $s_selected_position = $arrLP[$i]['id'];
7727
+                    } elseif ($action == 'add') {
7689 7728
                         $s_selected_position = $arrLP[$i]['id'];
7690
-                    elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7729
+                    }
7691 7730
 
7692 7731
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7693 7732
 
@@ -7698,17 +7737,18 @@  discard block
 block discarded – undo
7698 7737
                 $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null;
7699 7738
                 $edit = isset($_GET['edit']) ? $_GET['edit'] : null;
7700 7739
                 if (($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_FINAL_ITEM || $edit == 'true')) {
7701
-                    if (isset ($_POST['content']))
7702
-                        $content = stripslashes($_POST['content']);
7703
-                    elseif (is_array($extra_info)) {
7740
+                    if (isset ($_POST['content'])) {
7741
+                                            $content = stripslashes($_POST['content']);
7742
+                    } elseif (is_array($extra_info)) {
7704 7743
                         //If it's an html document or a text file
7705 7744
                         if (!$no_display_edit_textarea) {
7706 7745
                             $content = $this->display_document($extra_info['path'], false, false);
7707 7746
                         }
7708
-                    } elseif (is_numeric($extra_info))
7709
-                        $content = $this->display_document($extra_info, false, false);
7710
-                    else
7711
-                        $content = '';
7747
+                    } elseif (is_numeric($extra_info)) {
7748
+                                            $content = $this->display_document($extra_info, false, false);
7749
+                    } else {
7750
+                                            $content = '';
7751
+                    }
7712 7752
 
7713 7753
                     if (!$no_display_edit_textarea) {
7714 7754
                         // We need to calculate here some specific settings for the online editor.
@@ -7862,11 +7902,13 @@  discard block
 block discarded – undo
7862 7902
         $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
7863 7903
         unset ($this->arrMenu);
7864 7904
 
7865
-        if ($action == 'add')
7866
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7867
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7868
-        else
7869
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7905
+        if ($action == 'add') {
7906
+                    $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7907
+        } elseif ($action == 'move') {
7908
+            $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7909
+        } else {
7910
+                    $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7911
+        }
7870 7912
 
7871 7913
         $legend .= '</legend>';
7872 7914
 
@@ -7901,8 +7943,9 @@  discard block
 block discarded – undo
7901 7943
                     $arrHide[] = $arrLP[$i]['id'];
7902 7944
                 }
7903 7945
             } else {
7904
-                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7905
-                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7946
+                if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') {
7947
+                                    $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7948
+                }
7906 7949
             }
7907 7950
         }
7908 7951
 
@@ -7921,12 +7964,13 @@  discard block
 block discarded – undo
7921 7964
         $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7922 7965
         for ($i = 0; $i < count($arrLP); $i++) {
7923 7966
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7924
-                if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7925
-                    $selected = 'selected="selected" ';
7926
-                elseif ($action == 'add')
7927
-                    $selected = 'selected="selected" ';
7928
-                else
7929
-                    $selected = '';
7967
+                if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
7968
+                                    $selected = 'selected="selected" ';
7969
+                } elseif ($action == 'add') {
7970
+                                    $selected = 'selected="selected" ';
7971
+                } else {
7972
+                                    $selected = '';
7973
+                }
7930 7974
 
7931 7975
                 $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7932 7976
             }
@@ -7953,9 +7997,11 @@  discard block
 block discarded – undo
7953 7997
             $arrHide = array();
7954 7998
             for ($i = 0; $i < count($arrLP); $i++) {
7955 7999
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
7956
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
7957
-                        $s_selected_position = $arrLP[$i]['id'];
7958
-                    elseif ($action == 'add') $s_selected_position = 0;
8000
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8001
+                                            $s_selected_position = $arrLP[$i]['id'];
8002
+                    } elseif ($action == 'add') {
8003
+                        $s_selected_position = 0;
8004
+                    }
7959 8005
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
7960 8006
 
7961 8007
                 }
@@ -8162,9 +8208,11 @@  discard block
 block discarded – undo
8162 8208
             $arrHide = array ();
8163 8209
             for ($i = 0; $i < count($arrLP); $i++) {
8164 8210
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8165
-                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
8166
-                        $s_selected_position = $arrLP[$i]['id'];
8167
-                    elseif ($action == 'add') $s_selected_position = 0;
8211
+                    if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) {
8212
+                                            $s_selected_position = $arrLP[$i]['id'];
8213
+                    } elseif ($action == 'add') {
8214
+                        $s_selected_position = 0;
8215
+                    }
8168 8216
                     $arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title'];
8169 8217
 
8170 8218
                 }
@@ -9739,9 +9787,9 @@  discard block
 block discarded – undo
9739 9787
         $main_code_path = api_get_path(SYS_CODE_PATH).'newscorm/packaging/';
9740 9788
         $extra_files = scandir($main_code_path);
9741 9789
         foreach ($extra_files as $extra_file) {
9742
-            if (strpos($extra_file, '.') === 0)
9743
-                continue;
9744
-            else {
9790
+            if (strpos($extra_file, '.') === 0) {
9791
+                            continue;
9792
+            } else {
9745 9793
                 $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9746 9794
                 $this->create_path($dest_file);
9747 9795
                 copy($main_code_path.$extra_file, $dest_file);
Please login to merge, or discard this patch.
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.