Passed
Push — 1.10.x ( 0c4a68...0d2152 )
by
unknown
269:02 queued 220:28
created
main/tracking/courseLog.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                             get_lang('HideColumn'),
113 113
                             array('align' => 'absmiddle', 'hspace' => '3px'),
114 114
                             ICON_SIZE_SMALL
115
-                         ) . "</div>'
115
+                         )."</div>'
116 116
                     );
117 117
                 }
118 118
             );
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 $TABLETRACK_LINKS       = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
148 148
 $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
149 149
 $TABLETRACK_ACCESS_2    = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
150
-$TABLETRACK_EXERCISES 	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
150
+$TABLETRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
151 151
 $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
152 152
 $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
153 153
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 
158 158
 // Breadcrumbs.
159 159
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
160
-    $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
161
-    $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
160
+    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
161
+    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
162 162
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'));
163 163
 }
164 164
 
@@ -229,21 +229,21 @@  discard block
 block discarded – undo
229 229
 if (!empty($sessionId)) {
230 230
     $actionsLeft .= Display::url(
231 231
         Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
232
-        api_get_path(WEB_CODE_PATH) . 'attendance/index.php?' . api_get_cidreq() . '&action=calendar_logins'
232
+        api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins'
233 233
     );
234 234
 }
235 235
 
236 236
 $actionsRight = '<div class="pull-right">';
237 237
 $actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
238
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
238
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
239 239
 
240 240
 $addional_param = '';
241 241
 if (isset($_GET['additional_profile_field'])) {
242
-    $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']);
242
+    $addional_param = 'additional_profile_field='.intval($_GET['additional_profile_field']);
243 243
 }
244 244
 $users_tracking_per_page = '';
245 245
 if (isset($_GET['users_tracking_per_page'])) {
246
-    $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
246
+    $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
247 247
 }
248 248
 $actionsRight .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
249 249
      '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
 $form_search->addButtonSearch(get_lang('SearchUsers'));
265 265
 
266 266
 
267
-echo Display::toolbarAction('toolbar-courselog', array( 0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight ), 3);
267
+echo Display::toolbarAction('toolbar-courselog', array(0 => $actionsLeft, 1 => $form_search->returnForm(), 2 => $actionsRight), 3);
268 268
 
269 269
 $course_name = get_lang('Course').' '.$courseInfo['name'];
270 270
 
271 271
 if ($session_id) {
272 272
     $titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id);
273
-    $titleCourse =  Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
273
+    $titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
274 274
 
275 275
 } else {
276 276
     $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     $html .= '<ul class="session-list">';
313 313
     foreach ($sessionList as $session) {
314 314
         $url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code'];
315
-        $html .= Display::tag('li', $iconCourse . ' ' . Display::url($session['name'], $url));
315
+        $html .= Display::tag('li', $iconCourse.' '.Display::url($session['name'], $url));
316 316
     }
317 317
     $html .= '</ul>';
318 318
 }
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
     $form = new FormValidator(
328 328
         'reminder_form',
329 329
         'get',
330
-        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?' . api_get_cidreq(),
330
+        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
331 331
         null,
332 332
         ['style' => 'margin-bottom: 10px'],
333 333
         FormValidator::LAYOUT_INLINE
334 334
     );
335
-    $options = array (
335
+    $options = array(
336 336
         2 => sprintf($getLangXDays, 2),
337 337
         3 => sprintf($getLangXDays, 3),
338 338
         4 => sprintf($getLangXDays, 4),
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     );
346 346
     $el = $form->addSelect(
347 347
         'since',
348
-        Display::returnFontAwesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'),
348
+        Display::returnFontAwesomeIcon('warning').get_lang('RemindInactivesLearnersSince'),
349 349
         $options,
350 350
         ['class' => 'col-sm-3']
351 351
     );
Please login to merge, or discard this patch.
main/inc/lib/exercise.lib.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 if ($show_title) {
66 66
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
67 67
                     echo Display::div(
68
-                        $current_item . '. ' . $objQuestionTmp->selectTitle(),
68
+                        $current_item.'. '.$objQuestionTmp->selectTitle(),
69 69
                         array('class' => 'question_title')
70 70
                     );
71 71
                 }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $config = array(
162 162
                     'ToolbarSet' => 'TestFreeAnswer'
163 163
                 );
164
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
165
-                $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
164
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
165
+                $form->setDefaults(array("choice[".$questionId."]" => $fck_content));
166 166
                 $s .= $form->returnForm();
167 167
             } elseif ($answerType == ORAL_EXPRESSION) {
168 168
                 // Add nanog
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 $config = array(
192 192
                     'ToolbarSet' => 'TestFreeAnswer'
193 193
                 );
194
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
194
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
195 195
                 //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
196 196
                 $s .= $form->returnForm();
197 197
             }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
                 // Unique answer
274 274
                 if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
275
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
275
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
276 276
                     if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
277 277
                         $attributes = array(
278 278
                             'id' => $input_id,
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
298 298
                         if ($show_comment) {
299 299
                             if (empty($comment)) {
300
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
300
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
301 301
                                     . 'class="exercise-unique-answer-image" style="text-align: center">';
302 302
                             } else {
303
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
303
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
304 304
                                     . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
305 305
                             }
306 306
                         } else {
307
-                            $s .= '<div id="answer' . $questionId . $numAnswer . '" '
307
+                            $s .= '<div id="answer'.$questionId.$numAnswer.'" '
308 308
                                 . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
309 309
                         }
310 310
                     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     $answer = Security::remove_XSS($answer, STUDENT);
313 313
                     $s .= Display::input(
314 314
                         'hidden',
315
-                        'choice2[' . $questionId . ']',
315
+                        'choice2['.$questionId.']',
316 316
                         '0'
317 317
                     );
318 318
 
@@ -320,13 +320,13 @@  discard block
 block discarded – undo
320 320
 
321 321
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
322 322
                         $attributes['style'] = 'display: none;';
323
-                        $answer = '<div class="thumbnail">' . $answer . '</div>';
323
+                        $answer = '<div class="thumbnail">'.$answer.'</div>';
324 324
                     }
325 325
 
326 326
                     $answer_input .= '<label class="radio">';
327 327
                     $answer_input .= Display::input(
328 328
                         'radio',
329
-                        'choice[' . $questionId . ']',
329
+                        'choice['.$questionId.']',
330 330
                         $numAnswer,
331 331
                         $attributes
332 332
                     );
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                     $answerType == MULTIPLE_ANSWER_TRUE_FALSE ||
354 354
                     $answerType == GLOBAL_MULTIPLE_ANSWER
355 355
                 ) {
356
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
356
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
357 357
                     $answer = Security::remove_XSS($answer, STUDENT);
358 358
 
359 359
                     if (in_array($numAnswer, $user_choice_array)) {
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
                     }
375 375
 
376 376
                     if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
377
-                        $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
377
+                        $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
378 378
 
379 379
                         $answer_input = '<label class="checkbox">';
380 380
                         $answer_input .= Display::input(
381 381
                             'checkbox',
382
-                            'choice[' . $questionId . '][' . $numAnswer . ']',
382
+                            'choice['.$questionId.']['.$numAnswer.']',
383 383
                             $numAnswer,
384 384
                             $attributes
385 385
                         );
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                                     'td',
433 433
                                     Display::input(
434 434
                                         'radio',
435
-                                        'choice[' . $questionId . '][' . $numAnswer . ']',
435
+                                        'choice['.$questionId.']['.$numAnswer.']',
436 436
                                         $id,
437 437
                                         $attributes
438 438
                                     ),
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                     }
451 451
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
452 452
                     // multiple answers
453
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
453
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
454 454
 
455 455
                     if (in_array($numAnswer, $user_choice_array)) {
456 456
                         $attributes = array(
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
                     }
471 471
 
472 472
                     $answer = Security::remove_XSS($answer, STUDENT);
473
-                    $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
473
+                    $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
474 474
                     $answer_input .= '<label class="checkbox">';
475 475
                     $answer_input .= Display::input(
476 476
                         'checkbox',
477
-                        'choice[' . $questionId . '][' . $numAnswer . ']',
477
+                        'choice['.$questionId.']['.$numAnswer.']',
478 478
                         1,
479 479
                         $attributes
480 480
                     );
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                     }
496 496
 
497 497
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
498
-                    $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
498
+                    $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
499 499
 
500 500
                     $my_choice = array();
501 501
                     if (!empty($user_choice_array)) {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                             'td',
531 531
                             Display::input(
532 532
                                 'radio',
533
-                                'choice[' . $questionId . '][' . $numAnswer . ']',
533
+                                'choice['.$questionId.']['.$numAnswer.']',
534 534
                                 $key,
535 535
                                 $attributes
536 536
                             )
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
                         $trackAttempts = Database::get_main_table(
627 627
                             TABLE_STATISTIC_TRACK_E_ATTEMPT
628 628
                         );
629
-                        $sql = 'SELECT answer FROM ' . $trackAttempts . '
630
-                                WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
629
+                        $sql = 'SELECT answer FROM '.$trackAttempts.'
630
+                                WHERE exe_id=' . $exe_id.' AND question_id='.$questionId;
631 631
                         $rsLastAttempt = Database::query($sql);
632 632
                         $rowLastAttempt = Database::fetch_array($rsLastAttempt);
633 633
                         $answer = $rowLastAttempt['answer'];
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                                 '',
683 683
                                 $answerCorrected
684 684
                             );
685
-                            $answerCorrected = '[' . $answerCorrected . ']';
685
+                            $answerCorrected = '['.$answerCorrected.']';
686 686
                             $studentAnswerList[] = $answerCorrected;
687 687
                         }
688 688
                     }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                     */
702 702
                     $tabComments = api_preg_split(
703 703
                         '/\[[^]]+\]/',
704
-                        ' ' . $answer . ' '
704
+                        ' '.$answer.' '
705 705
                     );
706 706
                     if (!empty($correctAnswerList) && !empty($studentAnswerList)) {
707 707
                         $answer = "";
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
                                 $size
719 719
                             );
720 720
 
721
-                            $answer .= $tabComments[$i] .
721
+                            $answer .= $tabComments[$i].
722 722
                                 Display::input(
723 723
                                     'text',
724 724
                                     "choice[$questionId][]",
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
                         $s .= '<tr><td width="45%" valign="top">';
765 765
                         $parsed_answer = $answer;
766 766
                         //left part questions
767
-                        $s .= '<p class="indent">' . $lines_count . '.&nbsp;' . $parsed_answer . '</p></td>';
767
+                        $s .= '<p class="indent">'.$lines_count.'.&nbsp;'.$parsed_answer.'</p></td>';
768 768
                         //middle part (matches selects)
769 769
 
770 770
                         $s .= '<td width="10%" valign="top" align="center" >
771 771
                                 <div class="select-matching">
772
-                                <select name="choice[' . $questionId . '][' . $numAnswer . ']">';
772
+                                <select name="choice[' . $questionId.']['.$numAnswer.']">';
773 773
 
774 774
                         // fills the list-box
775 775
                         foreach ($select_items as $key => $val) {
@@ -785,14 +785,14 @@  discard block
 block discarded – undo
785 785
                             if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) {
786 786
                                 $selected = 'selected="selected"';
787 787
                             }
788
-                            $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>';
788
+                            $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
789 789
 
790 790
                         }  // end foreach()
791 791
 
792 792
                         $s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
793 793
                         $s .= '<td width="40%" valign="top" >';
794 794
                         if (isset($select_items[$lines_count])) {
795
-                            $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'.&nbsp; '. $select_items[$lines_count]['answer'].'</p></div>';
795
+                            $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'.&nbsp; '.$select_items[$lines_count]['answer'].'</p></div>';
796 796
                         } else {
797 797
                             $s .= '&nbsp;';
798 798
                         }
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
                                 $s .= '<tr>
808 808
                                       <td colspan="2"></td>
809 809
                                       <td valign="top">';
810
-                                $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer'];
810
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'];
811 811
                                 $s .= "</td>
812 812
                                 </tr>";
813 813
                                 $lines_count++;
@@ -823,9 +823,9 @@  discard block
 block discarded – undo
823 823
                         $data = $objAnswerTmp->getAnswerByAutoId($data['correct']);
824 824
                         $lines_count = $data['answer'];*/
825 825
 
826
-                        $windowId = $questionId . '_' . $lines_count;
826
+                        $windowId = $questionId.'_'.$lines_count;
827 827
 
828
-                        $s .= '<li class="touch-items" id="' . $windowId . '">';
828
+                        $s .= '<li class="touch-items" id="'.$windowId.'">';
829 829
                         $s .= Display::div(
830 830
                             $parsed_answer,
831 831
                             [
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                                 Display::tag(
884 884
                                     'b',
885 885
                                     $select_items[$lines_count]['letter']
886
-                                ) . $select_items[$lines_count]['answer'],
886
+                                ).$select_items[$lines_count]['answer'],
887 887
                                 [
888 888
                                     'id' => "window_{$windowId}_answer",
889 889
                                     'style' => 'display: none;'
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
             if ($show_comment) {
1029 1029
                 $s .= '</table>';
1030
-            } elseif(
1030
+            } elseif (
1031 1031
                 in_array(
1032 1032
                     $answerType,
1033 1033
                     [
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
                 for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
1054 1054
                     $answerCorrect = $objAnswerTmp->isCorrect($answerId);
1055
-                    $windowId = $questionId . '_' . $counterAnswer;
1055
+                    $windowId = $questionId.'_'.$counterAnswer;
1056 1056
 
1057 1057
                     if ($answerCorrect) {
1058 1058
                         $s .= Display::div(
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
                 $course = api_get_course_info();
1098 1098
                 $doc_id = DocumentManager::get_document_id(
1099 1099
                     $course,
1100
-                    '/images/' . $pictureName
1100
+                    '/images/'.$pictureName
1101 1101
                 );
1102 1102
                 if (is_numeric($doc_id)) {
1103 1103
                     $images_folder_visibility = api_get_item_visibility(
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
                 echo "
1123 1123
                     <script>
1124 1124
                         $(document).on('ready', function () {
1125
-                            new " . ($answerType == HOT_SPOT ?  "HotspotQuestion" : "DelineationQuestion" ) . "({
1125
+                            new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({
1126 1126
                                 questionId: $questionId,
1127 1127
                                 exerciseId: $exerciseId,
1128 1128
                                 selector: '#hotspot-preview-$questionId',
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
             if ($answerType != HOT_SPOT_DELINEATION) {
1157 1157
                 $answerList = '
1158 1158
                     <div class="well well-sm">
1159
-                        <h5 class="page-header">' . get_lang('HotspotZones') . '</h5>
1159
+                        <h5 class="page-header">' . get_lang('HotspotZones').'</h5>
1160 1160
                         <ol>
1161 1161
                 ';
1162 1162
 
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
             if (!$only_questions) {
1182 1182
                 if ($show_title) {
1183 1183
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
1184
-                    echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>';
1184
+                    echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
1185 1185
                 }
1186 1186
                 //@todo I need to the get the feedback type
1187 1187
                 echo <<<HOTSPOT
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                                 <div class=\"hotspot-image\"></div>
1200 1200
                                 <script>
1201 1201
                                     $(document).on('ready', function () {
1202
-                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({
1202
+                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({
1203 1203
                                             questionId: $questionId,
1204 1204
                                             exerciseId: $exe_id,
1205 1205
                                             selector: '#question_div_' + $questionId + ' .hotspot-image',
@@ -1318,11 +1318,11 @@  discard block
 block discarded – undo
1318 1318
         $lp_id = intval($lp_id);
1319 1319
         $lp_item_id = intval($lp_item_id);
1320 1320
         return
1321
-            api_get_course_int_id() . '_' .
1322
-            api_get_session_id() . '_' .
1323
-            $exercise_id . '_' .
1324
-            api_get_user_id() . '_' .
1325
-            $lp_id . '_' .
1321
+            api_get_course_int_id().'_'.
1322
+            api_get_session_id().'_'.
1323
+            $exercise_id.'_'.
1324
+            api_get_user_id().'_'.
1325
+            $lp_id.'_'.
1326 1326
             $lp_item_id;
1327 1327
     }
1328 1328
 
@@ -1434,14 +1434,14 @@  discard block
 block discarded – undo
1434 1434
         $res = Database::query($sql);
1435 1435
         $result = array();
1436 1436
         $apiIsAllowedToEdit = api_is_allowed_to_edit();
1437
-        $urlBase = api_get_path(WEB_CODE_PATH) .
1438
-            'exercice/hotpotatoes_exercise_report.php?action=delete&' .
1439
-            api_get_cidreq() . '&id=';
1437
+        $urlBase = api_get_path(WEB_CODE_PATH).
1438
+            'exercice/hotpotatoes_exercise_report.php?action=delete&'.
1439
+            api_get_cidreq().'&id=';
1440 1440
         while ($data = Database::fetch_array($res)) {
1441 1441
             $actions = null;
1442 1442
 
1443 1443
             if ($apiIsAllowedToEdit) {
1444
-                $url = $urlBase . $data['id'] . '&path=' . $data['exe_name'];
1444
+                $url = $urlBase.$data['id'].'&path='.$data['exe_name'];
1445 1445
                 $actions = Display::url(
1446 1446
                     Display::return_icon('delete.png', get_lang('Delete')),
1447 1447
                     $url
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
                     GroupManager::get_user_group_name($data['user_id'])
1458 1458
                 ),
1459 1459
                 'exe_date' => $data['exe_date'],
1460
-                'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'],
1460
+                'score' => $data['exe_result'].' / '.$data['exe_weighting'],
1461 1461
                 'actions' => $actions,
1462 1462
             );
1463 1463
         }
@@ -1540,18 +1540,18 @@  discard block
 block discarded – undo
1540 1540
         $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
1541 1541
         $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
1542 1542
 
1543
-        $session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
1543
+        $session_id_and = ' AND te.session_id = '.$sessionId.' ';
1544 1544
         $exercise_id = intval($exercise_id);
1545 1545
 
1546 1546
         $exercise_where = '';
1547 1547
         if (!empty($exercise_id)) {
1548
-            $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . '  ';
1548
+            $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.'  ';
1549 1549
         }
1550 1550
 
1551 1551
         $hotpotatoe_where = '';
1552 1552
         if (!empty($_GET['path'])) {
1553 1553
             $hotpotatoe_path = Database::escape_string($_GET['path']);
1554
-            $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '"  ';
1554
+            $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'"  ';
1555 1555
         }
1556 1556
 
1557 1557
         // sql for chamilo-type tests for teacher / tutor view
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
             WHERE
1564 1564
                 c_id = $course_id AND
1565 1565
                 exe_exo_id = $exercise_id AND
1566
-                ttte.session_id = " . $sessionId . "
1566
+                ttte.session_id = ".$sessionId."
1567 1567
         )";
1568 1568
 
1569 1569
         if ($is_allowedToEdit) {
@@ -1586,9 +1586,9 @@  discard block
 block discarded – undo
1586 1586
                         g.id as group_id
1587 1587
                     FROM $TBL_USER u
1588 1588
                     INNER JOIN $TBL_GROUP_REL_USER gru
1589
-                    ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ")
1589
+                    ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.")
1590 1590
                     INNER JOIN $TBL_GROUP g
1591
-                    ON (gru.group_id = g.id AND g.c_id=" . $course_id . ")
1591
+                    ON (gru.group_id = g.id AND g.c_id=".$course_id.")
1592 1592
                 )";
1593 1593
             }
1594 1594
 
@@ -1650,9 +1650,9 @@  discard block
 block discarded – undo
1650 1650
                     g.id as group_id
1651 1651
                 FROM $TBL_USER u
1652 1652
                 LEFT OUTER JOIN $TBL_GROUP_REL_USER gru
1653
-                ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " )
1653
+                ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." )
1654 1654
                 LEFT OUTER JOIN $TBL_GROUP g
1655
-                ON (gru.group_id = g.id AND g.c_id = " . $course_id . ")
1655
+                ON (gru.group_id = g.id AND g.c_id = ".$course_id.")
1656 1656
             )";
1657 1657
             }
1658 1658
 
@@ -1665,12 +1665,12 @@  discard block
 block discarded – undo
1665 1665
             (
1666 1666
                 SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code
1667 1667
                 FROM $TBL_USER u
1668
-                WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ")
1668
+                WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
1669 1669
             )";
1670 1670
             }
1671 1671
 
1672 1672
             $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru ";
1673
-            $sqlWhereOption = "  AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id ";
1673
+            $sqlWhereOption = "  AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id ";
1674 1674
             $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname";
1675 1675
 
1676 1676
             if ($get_count) {
@@ -1707,8 +1707,8 @@  discard block
 block discarded – undo
1707 1707
                 ON (user.user_id = exe_user_id)
1708 1708
                 WHERE
1709 1709
                     te.status != 'incomplete' AND
1710
-                    te.c_id = " . $course_id . " $session_id_and AND
1711
-                    ce.active <>-1 AND ce.c_id = " . $course_id . "
1710
+                    te.c_id = ".$course_id." $session_id_and AND
1711
+                    ce.active <>-1 AND ce.c_id = ".$course_id."
1712 1712
                     $exercise_where
1713 1713
                     $extra_where_conditions
1714 1714
                 ";
@@ -1735,12 +1735,12 @@  discard block
 block discarded – undo
1735 1735
                     $sqlFromOption
1736 1736
                 WHERE
1737 1737
                     user.user_id=tth.exe_user_id
1738
-                    AND tth.c_id = " . $course_id . "
1738
+                    AND tth.c_id = ".$course_id."
1739 1739
                     $hotpotatoe_where
1740 1740
                     $sqlWhereOption
1741
-                    AND user.status NOT IN(" . api_get_users_status_ignored_in_reports(
1741
+                    AND user.status NOT IN(".api_get_users_status_ignored_in_reports(
1742 1742
                     'string'
1743
-                ) . ")
1743
+                ).")
1744 1744
                 ORDER BY
1745 1745
                     tth.c_id ASC,
1746 1746
                     tth.exe_date DESC";
@@ -1813,12 +1813,12 @@  discard block
 block discarded – undo
1813 1813
 
1814 1814
                     if ($from_gradebook && ($is_allowedToEdit)) {
1815 1815
                         if (in_array(
1816
-                            $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'],
1816
+                            $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'],
1817 1817
                             $users_array_id
1818 1818
                         )) {
1819 1819
                             continue;
1820 1820
                         }
1821
-                        $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'];
1821
+                        $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'];
1822 1822
                     }
1823 1823
 
1824 1824
                     $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null;
@@ -1827,8 +1827,8 @@  discard block
 block discarded – undo
1827 1827
                     if ($lp_obj) {
1828 1828
                         $url = api_get_path(
1829 1829
                                 WEB_CODE_PATH
1830
-                            ) . 'newscorm/lp_controller.php?' . api_get_cidreq(
1831
-                            ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
1830
+                            ).'newscorm/lp_controller.php?'.api_get_cidreq(
1831
+                            ).'&action=view&lp_id='.$results[$i]['orig_lp_id'];
1832 1832
                         $lp_name = Display::url(
1833 1833
                             $lp_obj['lp_name'],
1834 1834
                             $url,
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
                         );
1847 1847
 
1848 1848
                         foreach ($group_list as $id) {
1849
-                            $group_name_list .= $clean_group_list[$id] . '<br/>';
1849
+                            $group_name_list .= $clean_group_list[$id].'<br/>';
1850 1850
                         }
1851 1851
                         $results[$i]['group_name'] = $group_name_list;
1852 1852
                     }
@@ -1902,8 +1902,8 @@  discard block
 block discarded – undo
1902 1902
                                 }
1903 1903
                             }
1904 1904
                             if ($revised) {
1905
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1906
-                                    ) . "&action=edit&id=$id'>" .
1905
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1906
+                                    )."&action=edit&id=$id'>".
1907 1907
                                     Display:: return_icon(
1908 1908
                                         'edit.png',
1909 1909
                                         get_lang('Edit'),
@@ -1912,8 +1912,8 @@  discard block
 block discarded – undo
1912 1912
                                     );
1913 1913
                                 $actions .= '&nbsp;';
1914 1914
                             } else {
1915
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1916
-                                    ) . "&action=qualify&id=$id'>" .
1915
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1916
+                                    )."&action=qualify&id=$id'>".
1917 1917
                                     Display:: return_icon(
1918 1918
                                         'quiz.gif',
1919 1919
                                         get_lang('Qualify')
@@ -1923,12 +1923,12 @@  discard block
 block discarded – undo
1923 1923
                             $actions .= "</a>";
1924 1924
 
1925 1925
                             if ($filter == 2) {
1926
-                                $actions .= ' <a href="exercise_history.php?' . api_get_cidreq(
1927
-                                    ) . '&exe_id=' . $id . '">' .
1926
+                                $actions .= ' <a href="exercise_history.php?'.api_get_cidreq(
1927
+                                    ).'&exe_id='.$id.'">'.
1928 1928
                                     Display:: return_icon(
1929 1929
                                         'history.gif',
1930 1930
                                         get_lang('ViewHistoryChange')
1931
-                                    ) . '</a>';
1931
+                                    ).'</a>';
1932 1932
                             }
1933 1933
 
1934 1934
                             //Admin can always delete the attempt
@@ -1940,32 +1940,32 @@  discard block
 block discarded – undo
1940 1940
                                     date('Y-m-d h:i:s'),
1941 1941
                                     false
1942 1942
                                 );
1943
-                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">
1943
+                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank">
1944 1944
                                 '.Display::return_icon('info.png', $ip).'
1945 1945
                                 </a>';
1946 1946
 
1947
-                                $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
1947
+                                $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'"
1948 1948
                                 onclick="javascript:if(!confirm(\'' . sprintf(
1949 1949
                                         get_lang('DeleteAttempt'),
1950 1950
                                         $results[$i]['username'],
1951 1951
                                         $dt
1952
-                                    ) . '\')) return false;">' . Display:: return_icon(
1952
+                                    ).'\')) return false;">'.Display:: return_icon(
1953 1953
                                         'delete.png',
1954 1954
                                         get_lang('Delete')
1955
-                                    ) . '</a>';
1955
+                                    ).'</a>';
1956 1956
                                 $delete_link = utf8_encode($delete_link);
1957 1957
 
1958 1958
                                 if (api_is_drh() && !api_is_platform_admin()) {
1959 1959
                                     $delete_link = null;
1960 1960
                                 }
1961
-                                $actions .= $delete_link . '&nbsp;';
1961
+                                $actions .= $delete_link.'&nbsp;';
1962 1962
                             }
1963 1963
 
1964 1964
                         } else {
1965 1965
                             $attempt_url = api_get_path(
1966 1966
                                     WEB_CODE_PATH
1967
-                                ) . 'exercice/result.php?' . api_get_cidreq(
1968
-                                ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
1967
+                                ).'exercice/result.php?'.api_get_cidreq(
1968
+                                ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId;
1969 1969
                             $attempt_link = Display::url(
1970 1970
                                 get_lang('Show'),
1971 1971
                                 $attempt_url,
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
                     $hp_result = round(
2023 2023
                             ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100,
2024 2024
                             2
2025
-                        ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
2025
+                        ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')';
2026 2026
                     if ($is_allowedToEdit) {
2027 2027
                         $list_info[] = array(
2028 2028
                             $hpresults[$i][0],
@@ -2095,13 +2095,13 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
         $html = null;
2097 2097
         if ($show_percentage) {
2098
-            $parent = '(' . $score . ' / ' . $weight . ')';
2099
-            $html = $percentage . "%  $parent";
2098
+            $parent = '('.$score.' / '.$weight.')';
2099
+            $html = $percentage."%  $parent";
2100 2100
             if ($show_only_percentage) {
2101
-                $html = $percentage . "% ";
2101
+                $html = $percentage."% ";
2102 2102
             }
2103 2103
         } else {
2104
-            $html = $score . ' / ' . $weight;
2104
+            $html = $score.' / '.$weight;
2105 2105
         }
2106 2106
         $html = Display::span($html, array('class' => 'score_exercise'));
2107 2107
 
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
     {
2196 2196
         $return = '-';
2197 2197
         if ($value != '') {
2198
-            $return = float_format($value * 100, 1) . ' %';
2198
+            $return = float_format($value * 100, 1).' %';
2199 2199
         }
2200 2200
         return $return;
2201 2201
     }
@@ -2273,7 +2273,7 @@  discard block
 block discarded – undo
2273 2273
         }
2274 2274
 
2275 2275
         $needle_where = !empty($search) ? " AND title LIKE '?' " : '';
2276
-        $needle = !empty($search) ? "%" . $search . "%" : '';
2276
+        $needle = !empty($search) ? "%".$search."%" : '';
2277 2277
 
2278 2278
         // Show courses by active status
2279 2279
         $active_sql = '';
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
         if ($search_all_sessions == true) {
2289 2289
             $conditions = array(
2290 2290
                 'where' => array(
2291
-                    $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array(
2291
+                    $active_sql.' c_id = ? '.$needle_where.$time_conditions => array(
2292 2292
                         $course_id,
2293 2293
                         $needle
2294 2294
                     )
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
             if ($session_id == 0) {
2300 2300
                 $conditions = array(
2301 2301
                     'where' => array(
2302
-                        $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array(
2302
+                        $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array(
2303 2303
                             $session_id,
2304 2304
                             $course_id,
2305 2305
                             $needle
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
             } else {
2311 2311
                 $conditions = array(
2312 2312
                     'where' => array(
2313
-                        $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array(
2313
+                        $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array(
2314 2314
                             $session_id,
2315 2315
                             $course_id,
2316 2316
                             $needle
@@ -2489,7 +2489,7 @@  discard block
 block discarded – undo
2489 2489
 
2490 2490
             if ($return_string) {
2491 2491
                 if (!empty($position) && !empty($my_ranking)) {
2492
-                    $return_value = $position . '/' . count($my_ranking);
2492
+                    $return_value = $position.'/'.count($my_ranking);
2493 2493
                 } else {
2494 2494
                     $return_value = '-';
2495 2495
                 }
@@ -2569,7 +2569,7 @@  discard block
 block discarded – undo
2569 2569
 
2570 2570
             if ($return_string) {
2571 2571
                 if (!empty($position) && !empty($my_ranking)) {
2572
-                    return $position . '/' . count($my_ranking);
2572
+                    return $position.'/'.count($my_ranking);
2573 2573
                 }
2574 2574
             }
2575 2575
             return $return_value;
@@ -2969,7 +2969,7 @@  discard block
 block discarded – undo
2969 2969
             $courseCondition = "
2970 2970
             INNER JOIN $courseUser cu
2971 2971
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
2972
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
2972
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
2973 2973
         } else {
2974 2974
             $courseCondition = "
2975 2975
             INNER JOIN $courseUserSession cu
@@ -3044,7 +3044,7 @@  discard block
 block discarded – undo
3044 3044
             $courseCondition = "
3045 3045
             INNER JOIN $courseUser cu
3046 3046
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3047
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3047
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3048 3048
         } else {
3049 3049
             $courseCondition = "
3050 3050
             INNER JOIN $courseUserSession cu
@@ -3136,7 +3136,7 @@  discard block
 block discarded – undo
3136 3136
             $courseCondition = "
3137 3137
             INNER JOIN $courseUser cu
3138 3138
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3139
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3139
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3140 3140
         } else {
3141 3141
             $courseCondition = "
3142 3142
             INNER JOIN $courseUserSession cu
@@ -3318,7 +3318,7 @@  discard block
 block discarded – undo
3318 3318
                 }
3319 3319
             }
3320 3320
             // adds the correct word, followed by ] to close the blank
3321
-            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3321
+            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3322 3322
             if (isset ($real_text[$i + 1])) {
3323 3323
                 $answer .= $real_text[$i + 1];
3324 3324
             }
@@ -3377,13 +3377,13 @@  discard block
 block discarded – undo
3377 3377
         // check the default value of option
3378 3378
         $tabSelected = array($in_default => " selected='selected' ");
3379 3379
         $res = "";
3380
-        $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >";
3381
-        $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang(
3380
+        $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
3381
+        $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang(
3382 3382
                 'AllGroups'
3383
-            ) . " --</option>";
3384
-        $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang(
3383
+            )." --</option>";
3384
+        $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang(
3385 3385
                 'NotInAGroup'
3386
-            ) . " -</option>";
3386
+            )." -</option>";
3387 3387
         $tabGroups = GroupManager::get_group_list();
3388 3388
         $currentCatId = 0;
3389 3389
         for ($i = 0; $i < count($tabGroups); $i++) {
@@ -3391,10 +3391,10 @@  discard block
 block discarded – undo
3391 3391
                 $tabGroups[$i]["id"]
3392 3392
             );
3393 3393
             if ($tabCategory["id"] != $currentCatId) {
3394
-                $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>";
3394
+                $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
3395 3395
                 $currentCatId = $tabCategory["id"];
3396 3396
             }
3397
-            $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>";
3397
+            $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
3398 3398
         }
3399 3399
         $res .= "</select>";
3400 3400
         return $res;
@@ -3599,14 +3599,14 @@  discard block
 block discarded – undo
3599 3599
                 if ($show_results) {
3600 3600
                     $comnt = Event::get_comments($exe_id, $questionId);
3601 3601
                     if (!empty($comnt)) {
3602
-                        echo '<b>' . get_lang('Feedback') . '</b>';
3603
-                        echo '<div id="question_feedback">' . $comnt . '</div>';
3602
+                        echo '<b>'.get_lang('Feedback').'</b>';
3603
+                        echo '<div id="question_feedback">'.$comnt.'</div>';
3604 3604
                     }
3605 3605
                 }
3606 3606
 
3607 3607
                 if ($show_results) {
3608 3608
                     $score = array(
3609
-                        'result' => get_lang('Score') . " : " . self::show_score(
3609
+                        'result' => get_lang('Score')." : ".self::show_score(
3610 3610
                                 $my_total_score,
3611 3611
                                 $my_total_weight,
3612 3612
                                 false,
@@ -3680,13 +3680,13 @@  discard block
 block discarded – undo
3680 3680
         }
3681 3681
 
3682 3682
         if ($show_all_but_expected_answer) {
3683
-            $exercise_content .= "<div class='normal-message'>" . get_lang(
3683
+            $exercise_content .= "<div class='normal-message'>".get_lang(
3684 3684
                     "ExerciseWithFeedbackWithoutCorrectionComment"
3685
-                ) . "</div>";
3685
+                )."</div>";
3686 3686
         }
3687 3687
         // Remove audio auto play from questions on results page - refs BT#7939
3688 3688
         $exercise_content = preg_replace(
3689
-            ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'],
3689
+            ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'],
3690 3690
             '',
3691 3691
             $exercise_content
3692 3692
         );
@@ -3780,11 +3780,11 @@  discard block
 block discarded – undo
3780 3780
                     $ribbon_total_success_or_error = ' ribbon-total-error';
3781 3781
                 }
3782 3782
             }
3783
-            $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">';
3783
+            $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">';
3784 3784
         } else {
3785 3785
             $ribbon .= '<div class="total">';
3786 3786
         }
3787
-        $ribbon .= '<h3>' . get_lang('YourTotalScore') . ":&nbsp;";
3787
+        $ribbon .= '<h3>'.get_lang('YourTotalScore').":&nbsp;";
3788 3788
         $ribbon .= self::show_score($score, $weight, false, true);
3789 3789
         $ribbon .= '</h3>';
3790 3790
         $ribbon .= '</div>';
Please login to merge, or discard this patch.
main/inc/lib/grade_model.lib.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function __construct()
17 17
     {
18
-        $this->table =  Database::get_main_table(TABLE_GRADE_MODEL);
18
+        $this->table = Database::get_main_table(TABLE_GRADE_MODEL);
19 19
     }
20 20
 
21 21
     /**
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     {
55 55
 		// action links
56 56
 		echo '<div class="actions" style="margin-bottom:20px">';
57
-        echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
58
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>';
57
+        echo '<a href="grade_models.php">'.Display::return_icon('back.png', get_lang('Back'), '', '32').'</a>';
58
+		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>';
59 59
 		echo '</div>';
60 60
         echo Display::grid_html('grade_model');
61 61
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
         if ($action == 'edit') {
112 112
             if (!empty($components)) {
113
-                $nr_items = count($components) -1;
113
+                $nr_items = count($components) - 1;
114 114
             }
115 115
         }
116 116
 
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
         for ($i = 0; $i <= $max; $i++) {
124 124
             $counter = $i;
125 125
             $form->addElement('text', 'components['.$i.'][percentage]', null);
126
-            $form->addElement('text', 'components['.$i.'][acronym]',    null);
127
-            $form->addElement('text', 'components['.$i.'][title]',      null);
128
-            $form->addElement('hidden', 'components['.$i.'][id]',       null);
126
+            $form->addElement('text', 'components['.$i.'][acronym]', null);
127
+            $form->addElement('text', 'components['.$i.'][title]', null);
128
+            $form->addElement('hidden', 'components['.$i.'][id]', null);
129 129
 
130 130
              $template_percentage =
131
-            '<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="control-group">
131
+            '<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="control-group">
132 132
                 <p>
133 133
                 <label class="control-label">{label}</label>
134 134
                 <div class="controls">
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 
142 142
             $template_title =
143 143
             '&nbsp{element} <!-- BEGIN error --> <span class="form_error">{error}</span><!-- END error -->
144
-             <a href="javascript:plusItem(' . ($counter+1) . ')">
145
-                <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::return_icon('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'">
144
+             <a href="javascript:plusItem(' . ($counter + 1).')">
145
+                <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::return_icon('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'">
146 146
             </a>
147
-            <a href="javascript:minItem(' . ($counter) . ')">
148
-                <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::return_icon('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'">
147
+            <a href="javascript:minItem(' . ($counter).')">
148
+                <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::return_icon('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'">
149 149
             </a>
150 150
             </div></p></div>';
151 151
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
 	public function __construct()
294 294
     {
295
-        $this->table =  Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
295
+        $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
296 296
 	}
297 297
 
298 298
     public function save($params, $show_query = false)
Please login to merge, or discard this patch.
main/mySpace/myStudents.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -63,53 +63,53 @@  discard block
 block discarded – undo
63 63
     if ($origin == 'user_course') {
64 64
         $course_info = CourseManager :: get_course_information($get_course_code);
65 65
         if (empty ($cidReq)) {
66
-            $interbreadcrumb[] = array (
67
-                "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'],
66
+            $interbreadcrumb[] = array(
67
+                "url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'],
68 68
                 'name' => $course_info['title']
69 69
             );
70 70
         }
71
-        $interbreadcrumb[] = array (
72
-            "url" => "../user/user.php?cidReq=" . $get_course_code,
71
+        $interbreadcrumb[] = array(
72
+            "url" => "../user/user.php?cidReq=".$get_course_code,
73 73
             "name" => get_lang("Users")
74 74
         );
75 75
     } else
76 76
         if ($origin == 'tracking_course') {
77 77
             $course_info = CourseManager :: get_course_information($get_course_code);
78
-            $interbreadcrumb[] = array (
79
-                "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session=' . api_get_session_id(),
78
+            $interbreadcrumb[] = array(
79
+                "url" => "../tracking/courseLog.php?cidReq=".$get_course_code.'&id_session='.api_get_session_id(),
80 80
                 "name" => get_lang("Tracking")
81 81
             );
82 82
         } else
83 83
             if ($origin == 'resume_session') {
84
-                $interbreadcrumb[] = array (
84
+                $interbreadcrumb[] = array(
85 85
                     'url' => "../session/session_list.php",
86 86
                     "name" => get_lang('SessionList')
87 87
                 );
88
-                $interbreadcrumb[] = array (
89
-                    'url' => "../session/resume_session.php?id_session=" . $sessionId,
88
+                $interbreadcrumb[] = array(
89
+                    'url' => "../session/resume_session.php?id_session=".$sessionId,
90 90
                     "name" => get_lang('SessionOverview')
91 91
                 );
92 92
             } else {
93
-                $interbreadcrumb[] = array (
93
+                $interbreadcrumb[] = array(
94 94
                     "url" => "index.php",
95 95
                     "name" => get_lang('MySpace')
96 96
                 );
97 97
                 if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
98
-                    $interbreadcrumb[] = array (
99
-                        "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
98
+                    $interbreadcrumb[] = array(
99
+                        "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
100 100
                         "name" => get_lang("CoachStudents")
101 101
                     );
102
-                    $interbreadcrumb[] = array (
103
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
102
+                    $interbreadcrumb[] = array(
103
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']).'&id_coach='.Security :: remove_XSS($_GET['id_coach']),
104 104
                         "name" => get_lang("StudentDetails")
105 105
                     );
106 106
                 } else {
107
-                    $interbreadcrumb[] = array (
107
+                    $interbreadcrumb[] = array(
108 108
                         "url" => "student.php",
109 109
                         "name" => get_lang("MyStudents")
110 110
                     );
111
-                    $interbreadcrumb[] = array (
112
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
111
+                    $interbreadcrumb[] = array(
112
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']),
113 113
                         "name" => get_lang("StudentDetails")
114 114
                     );
115 115
                 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     $nameTools = get_lang("DetailsStudentInCourse");
118 118
 } else {
119 119
     if ($origin == 'resume_session') {
120
-        $interbreadcrumb[] = array (
120
+        $interbreadcrumb[] = array(
121 121
             'url' => "../session/session_list.php",
122 122
             "name" => get_lang('SessionList')
123 123
         );
@@ -128,24 +128,24 @@  discard block
 block discarded – undo
128 128
             );
129 129
         }
130 130
     } else {
131
-        $interbreadcrumb[] = array (
131
+        $interbreadcrumb[] = array(
132 132
             "url" => "index.php",
133 133
             "name" => get_lang('MySpace')
134 134
         );
135 135
         if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
136 136
             if ($sessionId) {
137
-                $interbreadcrumb[] = array (
138
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId,
137
+                $interbreadcrumb[] = array(
138
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach'])."&id_session=".$sessionId,
139 139
                     "name" => get_lang("CoachStudents")
140 140
                 );
141 141
             } else {
142
-                $interbreadcrumb[] = array (
143
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
142
+                $interbreadcrumb[] = array(
143
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
144 144
                     "name" => get_lang("CoachStudents")
145 145
                 );
146 146
             }
147 147
         } else {
148
-            $interbreadcrumb[] = array (
148
+            $interbreadcrumb[] = array(
149 149
                 "url" => "student.php",
150 150
                 "name" => get_lang("MyStudents")
151 151
             );
@@ -316,28 +316,28 @@  discard block
 block discarded – undo
316 316
     // Actions bar
317 317
     echo '<div class="actions">';
318 318
     echo '<a href="javascript: window.history.go(-1);">'.
319
-            Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
319
+            Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
320 320
 
321 321
     echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
322
-            Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
322
+            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
323 323
 
324
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv">'.
325
-            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
324
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'.
325
+            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
326 326
 
327
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=xls">'.
328
-    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
327
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'.
328
+    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
329 329
 
330 330
     if (!empty ($user_info['email'])) {
331 331
         $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
332
-            Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
332
+            Display :: return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).'</a>';
333 333
     } else {
334
-        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
334
+        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM);
335 335
     }
336 336
     echo $send_mail;
337 337
     if (!empty($student_id) && !empty($_GET['course'])) {
338 338
         // Only show link to connection details if course and student were defined in the URL
339
-        echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&origin=' . $origin. '&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
340
-            Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
339
+        echo '<a href="access_details.php?student='.$student_id.'&course='.Security :: remove_XSS($_GET['course']).'&origin='.$origin.'&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
340
+            Display :: return_icon('statistics.png', get_lang('AccessDetails'), '', ICON_SIZE_MEDIUM).'</a>';
341 341
     }
342 342
     if (api_can_login_as($student_id)) {
343 343
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$student_id.'&sec_token='.$token.'">'.
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     $csv_content[] = array(
407 407
         get_lang('Information', '')
408 408
     );
409
-    $csv_content[] = array (
409
+    $csv_content[] = array(
410 410
         get_lang('Name', ''),
411 411
         get_lang('Email', ''),
412 412
         get_lang('Tel', '')
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
         strip_tags($first_connection_date),
435 435
         strip_tags($last_connection_date),
436 436
         $time_spent_on_the_course,
437
-        $avg_student_progress . '%',
437
+        $avg_student_progress.'%',
438 438
         $avg_student_score
439 439
     );
440 440
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
             foreach ($course_coachs as $course_coach) {
455 455
                 $info_tutor_name[] = api_get_person_name($course_coach['firstname'], $course_coach['lastname']);
456 456
             }
457
-            $info_course['tutor_name'] = implode(",",$info_tutor_name);
457
+            $info_course['tutor_name'] = implode(",", $info_tutor_name);
458 458
         } elseif ($session_coach_id != 0) {
459 459
             $session_coach_id = intval($session_info['id_coach']);
460 460
             $coach_info = api_get_user_info($session_coach_id);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
         $session_name = $session_info['name'];
465 465
     } // end
466 466
 
467
-    $info_course  = CourseManager :: get_course_information($get_course_code);
467
+    $info_course = CourseManager :: get_course_information($get_course_code);
468 468
     $table_title = Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).$user_info['complete_name'];
469 469
 
470 470
     echo Display::page_subheader($table_title);
@@ -485,19 +485,19 @@  discard block
 block discarded – undo
485 485
             </thead>
486 486
             <tbody>
487 487
             <tr>
488
-                <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
488
+                <td><?php echo get_lang('Name').' : '.$user_info['complete_name']; ?></td>
489 489
             </tr>
490 490
             <tr>
491
-                <td><?php echo get_lang('Email') . ' : ';
491
+                <td><?php echo get_lang('Email').' : ';
492 492
                     if (!empty ($user_info['email'])) {
493
-                        echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
493
+                        echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>';
494 494
                     } else {
495 495
                         echo get_lang('NoEmail');
496 496
                     } ?>
497 497
                 </td>
498 498
             </tr>
499 499
             <tr>
500
-                <td> <?php echo get_lang('Tel') . ' : ';
500
+                <td> <?php echo get_lang('Tel').' : ';
501 501
                     if (!empty ($user_info['phone'])) {
502 502
                         echo $user_info['phone'];
503 503
                     } else {
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
                 </td>
508 508
             </tr>
509 509
             <tr>
510
-                <td> <?php echo get_lang('OfficialCode') . ' : ';
510
+                <td> <?php echo get_lang('OfficialCode').' : ';
511 511
                     if (!empty ($user_info['official_code'])) {
512 512
                         echo $user_info['official_code'];
513 513
                     } else {
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
                 </td>
518 518
             </tr>
519 519
             <tr>
520
-                <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td>
520
+                <td><?php echo get_lang('OnLine').' : '.$online; ?> </td>
521 521
             </tr>
522 522
             <?php
523 523
 
524 524
             // Display timezone if the user selected one and if the admin allows the use of user's timezone
525 525
             $timezone = null;
526
-            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'],'timezone');
526
+            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'], 'timezone');
527 527
             $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
528 528
             if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
529 529
                 $timezone = $timezone_user['timezone'];
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
             if ($timezone !== null) {
532 532
                 ?>
533 533
                 <tr>
534
-                    <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td>
534
+                    <td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td>
535 535
                 </tr>
536 536
             <?php
537 537
             }
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
                     <td align="right">
564 564
                         <?php
565 565
                         echo get_lang('Progress').' ';
566
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?>
566
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
567 567
                     </td>
568 568
                     <td align="left"><?php echo $avg_student_progress.'%' ?></td>
569 569
                 </tr>
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
                     <td align="right">
572 572
                         <?php
573 573
                         echo get_lang('Score').' ';
574
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
574
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
575 575
                     </td>
576
-                    <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%';} else { echo $avg_student_score ;}  ?></td>
576
+                    <td align="left"><?php if (is_numeric($avg_student_score)) { echo $avg_student_score.'%'; } else { echo $avg_student_score; }  ?></td>
577 577
                 </tr>
578 578
                 <?php
579 579
                 if (!empty($nb_login)) {
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
     $table_title = '';
608 608
     if (!empty($sessionId)) {
609 609
         $session_name = api_get_session_name($sessionId);
610
-        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'';
610
+        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : '';
611 611
     }
612 612
     if (!empty($info_course['title'])) {
613
-        $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].'  ':'';
613
+        $table_title .= $info_course ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$info_course['title'].'  ' : '';
614 614
     }
615 615
 
616 616
     echo Display::page_subheader($table_title);
@@ -648,13 +648,13 @@  discard block
 block discarded – undo
648 648
             }
649 649
             $date_session = '';
650 650
             if (!empty($access_start_date) && !empty($access_end_date)) {
651
-                $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
651
+                $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date;
652 652
             }
653 653
             $title = '';
654 654
             if (empty($sessionId)) {
655 655
                 $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
656 656
             } else {
657
-                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
657
+                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
658 658
             }
659 659
 
660 660
             // Courses
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
                         $scoretotal = array();
706 706
                         if (isset($cats) && isset($cats[0])) {
707 707
                             if (!empty($sessionId)) {
708
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
708
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
709 709
                             } else {
710
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
710
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $course_code);
711 711
                             }
712 712
                         }
713 713
 
@@ -740,8 +740,8 @@  discard block
 block discarded – undo
740 740
                         );
741 741
 
742 742
                         echo '<tr>
743
-                        <td ><a href="' . api_get_path(WEB_COURSE_PATH) . $course_info['directory'] .'/?id_session=' . $sessionId . '">'.$course_info['title'].'</a></td>
744
-                        <td >'.$time_spent_on_course .'</td>
743
+                        <td ><a href="' . api_get_path(WEB_COURSE_PATH).$course_info['directory'].'/?id_session='.$sessionId.'">'.$course_info['title'].'</a></td>
744
+                        <td >'.$time_spent_on_course.'</td>
745 745
                         <td >'.$progress.'</td>
746 746
                         <td >'.$score.'</td>
747 747
                         <td >'.$attendances_faults_avg.'</td>
@@ -807,22 +807,22 @@  discard block
 block discarded – undo
807 807
                 <table class="table table-striped table-hover">
808 808
                 <thead>
809 809
                 <tr>
810
-                    <th><?php echo get_lang('Learnpaths');?></th>
810
+                    <th><?php echo get_lang('Learnpaths'); ?></th>
811 811
                     <th><?php
812 812
                         echo get_lang('Time').' ';
813
-                        Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
813
+                        Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
814 814
                     <th><?php
815 815
                         echo get_lang('AverageScore').' ';
816
-                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
816
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
817 817
                     <th><?php
818 818
                         echo get_lang('LatestAttemptAverageScore').' ';
819
-                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
819
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
820 820
                     <th><?php
821 821
                         echo get_lang('Progress').' ';
822
-                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
822
+                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
823 823
                     <th><?php
824 824
                         echo get_lang('LastConnexion').' ';
825
-                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
825
+                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
826 826
                     <?php
827 827
                     echo '<th>'.get_lang('Details').'</th>';
828 828
                     if (api_is_allowed_to_edit()) {
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 
851 851
                     if ($progress === null) {
852 852
                         $progress = '0%';
853
-                    }  else {
853
+                    } else {
854 854
                         $any_result = true;
855 855
                     }
856 856
 
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
                     if (!empty($start_time)) {
878 878
                         $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
879 879
                     } else {
880
-                        $start_time =  '-';
880
+                        $start_time = '-';
881 881
                     }
882 882
 
883 883
                     if (!empty($total_time)) $any_result = true;
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
                     $i++;
907 907
 
908 908
                     // csv export content
909
-                    $csv_content[] = array (
909
+                    $csv_content[] = array(
910 910
                         api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
911 911
                         api_time_to_hms($total_time),
912
-                        $score . '%',
913
-                        $score_latest . '%',
912
+                        $score.'%',
913
+                        $score_latest.'%',
914 914
                         $progress.'%',
915 915
                         $start_time
916 916
                     );
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
                     if ($any_result === true) {
949 949
                         $from = '';
950 950
                         if ($from_myspace) {
951
-                            $from ='&from=myspace';
951
+                            $from = '&from=myspace';
952 952
                         }
953 953
                         $link = Display::url(
954 954
                             Display::return_icon('2rightarrow.png'),
@@ -961,14 +961,14 @@  discard block
 block discarded – undo
961 961
                         echo '<td>';
962 962
                         if ($any_result === true) {
963 963
                             echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.$origin.'&lp_id='.$learnpath->getId().'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">';
964
-                            echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
964
+                            echo Display::return_icon('clean.png', get_lang('Clean'), '', ICON_SIZE_SMALL).'</a>';
965 965
                             echo '</a>';
966 966
                         }
967 967
                         echo '</td>';
968 968
                         echo '</tr>';
969 969
                     }
970 970
                     $data_learnpath[$i][] = $lp_name;
971
-                    $data_learnpath[$i][] = $progress . '%';
971
+                    $data_learnpath[$i][] = $progress.'%';
972 972
                 }
973 973
             } else {
974 974
                 //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         <thead>
986 986
         <tr>
987 987
             <th><?php echo get_lang('Exercises'); ?></th>
988
-            <th><?php echo get_lang('LearningPath');?></th>
988
+            <th><?php echo get_lang('LearningPath'); ?></th>
989 989
             <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
990 990
             <th><?php echo get_lang('Attempts'); ?></th>
991 991
             <th><?php echo get_lang('LatestAttempt'); ?></th>
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
         );
1005 1005
 
1006 1006
         $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
1007
-        $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
1007
+        $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
1008 1008
                 WHERE
1009 1009
                     quiz.c_id =  ".$info_course['real_id']." AND
1010 1010
                     (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
                 echo '<td>';
1048 1048
 
1049 1049
                 if ($count_attempts > 0) {
1050
-                    echo $score_percentage . '%';
1050
+                    echo $score_percentage.'%';
1051 1051
                 } else {
1052 1052
                     echo '-';
1053 1053
                     $score_percentage = 0;
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
                 echo '<td>'.$count_attempts.'</td>';
1058 1058
                 echo '<td>';
1059 1059
 
1060
-                $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
1060
+                $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
1061 1061
                          WHERE
1062 1062
                             exe_exo_id      ="'.$exercise_id.'" AND
1063 1063
                             exe_user_id     ="'.$student_id.'" AND
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
                 if (Database :: num_rows($result_last_attempt) > 0) {
1071 1071
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1072 1072
                     if ($count_attempts > 0)
1073
-                        echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1073
+                        echo '<a href="../exercice/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'">
1074 1074
                         '.Display::return_icon('quiz.gif').'
1075 1075
                      </a>';
1076 1076
                 }
@@ -1078,11 +1078,11 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
                 echo '<td>';
1080 1080
                 $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
1081
-                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
1081
+                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url);
1082 1082
 
1083 1083
                 echo '</td></tr>';
1084 1084
                 $data_exercices[$i][] = $exercices['title'];
1085
-                $data_exercices[$i][] = $score_percentage . '%';
1085
+                $data_exercices[$i][] = $score_percentage.'%';
1086 1086
                 $data_exercices[$i][] = $count_attempts;
1087 1087
 
1088 1088
                 $csv_content[] = array(
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
             $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
1111 1111
 
1112 1112
             $survey_data = array();
1113
-            foreach($survey_list as $survey) {
1113
+            foreach ($survey_list as $survey) {
1114 1114
                 $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $info_course['real_id']);
1115 1115
                 $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
1116 1116
                 if (in_array($student_id, $user_list)) {
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
                         $column = 0;
1136 1136
                         $table->setCellContents($row, $column, $data);
1137 1137
                         $class = 'class="row_odd"';
1138
-                        if($row % 2) {
1138
+                        if ($row % 2) {
1139 1139
                             $class = 'class="row_even"';
1140 1140
                         }
1141 1141
                         $table->setRowAttributes($row, $class, true);
@@ -1158,13 +1158,13 @@  discard block
 block discarded – undo
1158 1158
             </thead>
1159 1159
             <tbody>
1160 1160
         <?php
1161
-        $csv_content[] = array ();
1162
-        $nb_assignments 		= Tracking::count_student_assignments($student_id, $course_code, $sessionId);
1161
+        $csv_content[] = array();
1162
+        $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
1163 1163
         $messages 				= Tracking::count_student_messages($student_id, $course_code, $sessionId);
1164
-        $links 					= Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
1165
-        $chat_last_connection 	= Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
1164
+        $links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
1165
+        $chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
1166 1166
         $documents				= Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
1167
-        $uploaded_documents		= Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
1167
+        $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
1168 1168
 
1169 1169
         $csv_content[] = array(
1170 1170
             get_lang('OtherTools')
Please login to merge, or discard this patch.
main/gradebook/lib/fe/scoredisplayform.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -14,28 +14,28 @@  discard block
 block discarded – undo
14 14
 	 * @param $form_name
15 15
 	 * @param null $action
16 16
 	 */
17
-	public function ScoreDisplayForm($form_name, $action= null)
17
+	public function ScoreDisplayForm($form_name, $action = null)
18 18
 	{
19 19
 		parent :: __construct($form_name, 'post', $action);
20 20
 		$displayscore = ScoreDisplay :: instance();
21 21
 		$customdisplays = $displayscore->get_custom_score_display_settings();
22 22
 
23
-		$nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1';
24
-		$this->setDefaults(array (
23
+		$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
24
+		$this->setDefaults(array(
25 25
             'scorecolpercent' => $displayscore->get_color_split_value()
26 26
 		));
27 27
 
28 28
 		$this->addElement('hidden', 'maxvalue', '100');
29 29
 		$this->addElement('hidden', 'minvalue', '0');
30
-		$counter= 1;
30
+		$counter = 1;
31 31
 
32 32
 		//setting the default values
33 33
 
34
-		if(is_array($customdisplays)) {
34
+		if (is_array($customdisplays)) {
35 35
 			foreach ($customdisplays as $customdisplay) {
36
-				$this->setDefaults(array (
37
-					'endscore[' . $counter . ']' => $customdisplay['score'],
38
-					'displaytext[' . $counter . ']' => $customdisplay['display']
36
+				$this->setDefaults(array(
37
+					'endscore['.$counter.']' => $customdisplay['score'],
38
+					'displaytext['.$counter.']' => $customdisplay['display']
39 39
 				));
40 40
 				$counter++;
41 41
 			}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$this->addElement('header', get_lang('ScoreEdit'));
47 47
 
48 48
         if ($displayscore->is_coloring_enabled()) {
49
-            $this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
49
+            $this->addElement('html', '<b>'.get_lang('ScoreColor').'</b>');
50 50
             $this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array(
51 51
                 'size' => 5,
52 52
                 'maxlength' => 5,
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
             }
59 59
 
60 60
             $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
61
-            $this->addRule(array('scorecolpercent','maxvalue'), get_lang('Over100'), 'compare', '<=');
62
-            $this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>');
61
+            $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
62
+            $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
63 63
         }
64 64
 
65 65
 		//Settings for the scoring system
66 66
 
67 67
 		if ($displayscore->is_custom()) {
68
-            $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
68
+            $this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>');
69 69
 			$this->addElement('static', null, null, get_lang('ScoreInfo'));
70 70
 			$this->setDefaults(array(
71 71
 				'beginscore' => '0'
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 				'input-size' => 2
78 78
 			));
79 79
 
80
-			for ($counter= 1; $counter <= 20; $counter++) {
81
-				$renderer =& $this->defaultRenderer();
80
+			for ($counter = 1; $counter <= 20; $counter++) {
81
+				$renderer = & $this->defaultRenderer();
82 82
 				$elementTemplateTwoLabel =
83
-				'<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';">
83
+				'<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
84 84
 
85 85
 				<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
86 86
 
@@ -105,39 +105,39 @@  discard block
 block discarded – undo
105 105
 
106 106
 				';
107 107
 
108
-				$elementTemplateTwoLabel2 ='
108
+				$elementTemplateTwoLabel2 = '
109 109
 				<div class="col-sm-2">
110 110
 					<!-- BEGIN error --><span class="form_error">{error}</span>
111 111
 					<!-- END error -->
112 112
 					{element}
113 113
 				</div>
114 114
 				<div class="col-sm-1">
115
-                    <a href="javascript:plusItem(' . ($counter+1) . ')">
116
-                    <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
117
-        			<a href="javascript:minItem(' . ($counter) . ')">
118
-        			<img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
115
+                    <a href="javascript:plusItem(' . ($counter + 1).')">
116
+                    <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
117
+        			<a href="javascript:minItem(' . ($counter).')">
118
+        			<img style="display: '.(($counter >= $nr_items && $counter != 1) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
119 119
 				</div>
120 120
 				</div>
121 121
 				</div>';
122 122
 
123 123
 				$scorebetw = array();
124
-				$this->addElement('text', 'endscore[' . $counter . ']', null, array (
124
+				$this->addElement('text', 'endscore['.$counter.']', null, array(
125 125
 					'size' => 5,
126 126
 					'maxlength' => 5,
127 127
 					'id' => 'txta-'.$counter,
128 128
 					'input-size' => 2
129 129
 				));
130 130
 
131
-				$this->addElement('text', 'displaytext[' . $counter . ']', null,array (
131
+				$this->addElement('text', 'displaytext['.$counter.']', null, array(
132 132
 					'size' => 40,
133 133
 					'maxlength' => 40,
134 134
 					'id' => 'txtb-'.$counter
135 135
 				));
136
-				$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
137
-				$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
138
-				$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
139
-				$this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
140
-				$this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
136
+				$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore['.$counter.']');
137
+				$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext['.$counter.']');
138
+				$this->addRule('endscore['.$counter.']', get_lang('OnlyNumbers'), 'numeric');
139
+				$this->addRule(array('endscore['.$counter.']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
140
+				$this->addRule(array('endscore['.$counter.']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
141 141
 			}
142 142
 		}
143 143
 
Please login to merge, or discard this patch.
main/gradebook/lib/fe/displaygradebook.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -20,37 +20,37 @@  discard block
 block discarded – undo
20 20
         if (api_is_allowed_to_edit(null, true)) {
21 21
             $header = '<div class="actions">';
22 22
             if ($page != 'statistics') {
23
-                $header .= '<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '">' .
24
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
23
+                $header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'">'.
24
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
25 25
                 if ($evalobj->get_course_code() == null) {
26 26
 
27 27
                 } elseif (!$evalobj->has_results()) {
28
-                    $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat=' . $selectcat . '&selecteval=' . $evalobj->get_id() . '">
29
-    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM) . '</a>';
28
+                    $header .= '<a href="gradebook_add_result.php?'.api_get_cidreq().'&selectcat='.$selectcat.'&selecteval='.$evalobj->get_id().'">
29
+    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM).'</a>';
30 30
                 }
31 31
 
32 32
                 if (api_is_platform_admin() || $evalobj->is_locked() == false) {
33
-                    $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&import=">' .
34
-                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
33
+                    $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&import=">'.
34
+                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM).'</a>';
35 35
                 }
36 36
 
37 37
                 if ($evalobj->has_results()) {
38
-                    $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&export=">' .
39
-                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
38
+                    $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&export=">'.
39
+                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM).'</a>';
40 40
 
41 41
                     if (api_is_platform_admin() || $evalobj->is_locked() == false) {
42
-                        $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '">' .
43
-                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM) . '</a>';
44
-                        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">' .
45
-                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM) . '</a>';
42
+                        $header .= '<a href="gradebook_edit_result.php?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'">'.
43
+                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM).'</a>';
44
+                        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&selecteval='.$evalobj->get_id().'&deleteall=" onclick="return confirmationall();">'.
45
+                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
                     }
47 47
                 }
48 48
 
49
-                $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selecteval=' . $evalobj->get_id() . '" target="_blank">' .
50
-                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
49
+                $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selecteval='.$evalobj->get_id().'" target="_blank">'.
50
+                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
             } else {
52
-                $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' .
53
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
52
+                $header .= '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.
53
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
54 54
             }
55 55
             $header .= '</div>';
56 56
         }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
             $score = $evalobj->calc_score();
70 70
 
71 71
             if ($score != null) {
72
-                $average = get_lang('Average') . ' :<b> ' . $scoredisplay->display_score($score, SCORE_AVERAGE) . '</b>';
72
+                $average = get_lang('Average').' :<b> '.$scoredisplay->display_score($score, SCORE_AVERAGE).'</b>';
73 73
                 $student_score = $evalobj->calc_score(api_get_user_id());
74 74
                 $student_score = Display::tag(
75 75
                     'h3',
76
-                    get_lang('Score') . ': ' . $scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
76
+                    get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
77 77
                 );
78 78
             }
79 79
         }
80 80
         $description = "";
81 81
         if (!$evalobj->get_description() == '') {
82
-            $description = get_lang('Description') . ' :<b> ' . $evalobj->get_description() . '</b><br>';
82
+            $description = get_lang('Description').' :<b> '.$evalobj->get_description().'</b><br>';
83 83
         }
84 84
 
85 85
         if ($evalobj->get_course_code() == null) {
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         $evalinfo = '<table width="100%" border="0"><tr><td>';
92
-        $evalinfo .= '<h2>' . $evalobj->get_name() . '</h2><hr>';
92
+        $evalinfo .= '<h2>'.$evalobj->get_name().'</h2><hr>';
93 93
         $evalinfo .= $description;
94
-        $evalinfo .= get_lang('Course') . ' :<b> ' . $course . '</b><br />';
94
+        $evalinfo .= get_lang('Course').' :<b> '.$course.'</b><br />';
95 95
         //'<br>' . get_lang('Weight') . ' :<b> ' . $evalobj->get_weight() . '</b><br>' . get_lang('Visible') . ' :<b> ' . $visible . '</b>
96
-        $evalinfo .= get_lang('QualificationNumeric') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $average;
96
+        $evalinfo .= get_lang('QualificationNumeric').' :<b> '.$evalobj->get_max().'</b><br>'.$average;
97 97
 
98 98
         if (!api_is_allowed_to_edit()) {
99 99
             $evalinfo .= $student_score;
100 100
         }
101 101
 
102 102
         if (!$evalobj->has_results()) {
103
-            $evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>';
103
+            $evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>';
104 104
         } elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') {
105 105
             if (api_is_allowed_to_edit(null, true)) {
106 106
                 if ($page != 'statistics') {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         }
111 111
         if ($page != 'statistics') {
112 112
             if (api_is_allowed_to_edit(null, true)) {
113
-                $evalinfo .= '<br /><a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' . Display::return_icon(('statistics.png'), get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM) . '</a>';
113
+                $evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('statistics.png'), get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).'</a>';
114 114
             }
115 115
         }
116 116
         $evalinfo .= '</td><td><img style="float:right; position:relative;" src="../img/tutorial.gif"></td></table>';
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
     public function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form)
128 128
     {
129 129
         $header = '<table border="0" cellpadding="5">';
130
-        $header .= '<td style="vertical-align: top;"><a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '">' . Display::return_icon('gradebook.gif') . get_lang('Gradebook') . '</a></td>';
131
-        $header .= '<td style="vertical-align: top;">' . get_lang('FilterCategory') . '</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
130
+        $header .= '<td style="vertical-align: top;"><a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('gradebook.gif').get_lang('Gradebook').'</a></td>';
131
+        $header .= '<td style="vertical-align: top;">'.get_lang('FilterCategory').'</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
132 132
         $cats = Category :: load();
133 133
         $tree = $cats[0]->get_tree();
134 134
         unset($cats);
@@ -137,33 +137,33 @@  discard block
 block discarded – undo
137 137
                 $line .= '&mdash;';
138 138
             }
139 139
             if ($_GET['selectcat'] == $cat[0]) {
140
-                $header .= '<option selected="selected" value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
140
+                $header .= '<option selected="selected" value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
141 141
             } else {
142
-                $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
142
+                $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
143 143
             }
144 144
             $line = '';
145 145
         }
146 146
         $header .= '</td></select></form>';
147 147
         if (!$catobj->get_id() == '0') {
148
-            $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '"><img src="../img/gradebook.gif" border="0" alt="' . get_lang('Up') . '" /></a></td>';
148
+            $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'"><img src="../img/gradebook.gif" border="0" alt="'.get_lang('Up').'" /></a></td>';
149 149
         }
150
-        $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
150
+        $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
151 151
         $header .= '<td style="vertical-align: top;">
152
-                    <a href="' . api_get_self() . '?exportpdf=&offset=' . Security::remove_XSS($_GET['offset']) . '&search=' . Security::remove_XSS($_GET['search']) . '&selectcat=' . $catobj->get_id() . '">
152
+                    <a href="' . api_get_self().'?exportpdf=&offset='.Security::remove_XSS($_GET['offset']).'&search='.Security::remove_XSS($_GET['search']).'&selectcat='.$catobj->get_id().'">
153 153
                      '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
154
-                    ' . get_lang('ExportPDF') . '</a>';
154
+                    ' . get_lang('ExportPDF').'</a>';
155 155
         $header .= '<td style="vertical-align: top;">
156
-                    <a href="' . api_get_self() . '?print=&selectcat=' . $catobj->get_id() . '" target="_blank">
156
+                    <a href="' . api_get_self().'?print=&selectcat='.$catobj->get_id().'" target="_blank">
157 157
                      '.Display::return_icon('printer.png', get_lang('Print'), [], ICON_SIZE_MEDIUM).'
158
-                    ' . get_lang('Print') . '</a>';
158
+                    ' . get_lang('Print').'</a>';
159 159
         $header .= '</td></tr></table>';
160 160
         if (!$catobj->get_id() == '0') {
161
-            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="' . api_get_self() . '?selectcat=' . $catobj->get_id() . '">
162
-            <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '') . '>Show Evaluations &nbsp;';
163
-            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" ' . (($showlink == '1') ? 'checked' : '') . '>' . get_lang('ShowLinks') . '</form></td></tr></table>';
161
+            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="'.api_get_self().'?selectcat='.$catobj->get_id().'">
162
+            <input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '').'>Show Evaluations &nbsp;';
163
+            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" '.(($showlink == '1') ? 'checked' : '').'>'.get_lang('ShowLinks').'</form></td></tr></table>';
164 164
         }
165 165
         if (isset($_GET['search'])) {
166
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
166
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
167 167
         }
168 168
         echo $header;
169 169
     }
@@ -184,23 +184,23 @@  discard block
 block discarded – undo
184 184
             $select_cat = $catobj->get_parent_id();
185 185
             $url = 'gradebook_flatview.php';
186 186
         }
187
-        $header .= '<a href="' . $url . '?' . api_get_cidreq() . '&selectcat=' . $select_cat . '">' .
188
-            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
187
+        $header .= '<a href="'.$url.'?'.api_get_cidreq().'&selectcat='.$select_cat.'">'.
188
+            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
189 189
 
190 190
         $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : '';
191 191
         $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : '';
192 192
         $offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
193 193
 
194
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
195
-            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
196
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
197
-            Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '</a>';
198
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
199
-            Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM) . '</a>';
200
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selectcat=' . $catobj->get_id() . '" target="_blank">' .
201
-            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
202
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&exportpdf=&selectcat=' . $catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >' .
203
-            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
194
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat='.$catobj->get_id().'">'.
195
+            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
196
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat='.$catobj->get_id().'">'.
197
+            Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
198
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat='.$catobj->get_id().'">'.
199
+            Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM).'</a>';
200
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selectcat='.$catobj->get_id().'" target="_blank">'.
201
+            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
202
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&exportpdf=&selectcat='.$catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >'.
203
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
204 204
         $header .= '</div>';
205 205
         echo $header;
206 206
     }
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
                 $item = $evals_links[$count];
242 242
                 $score = $item->calc_score($user_id);
243 243
                 $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
244
-                $item_value+=$score[0] / $my_score_denom * $item->get_weight();
245
-                $item_total+=$item->get_weight();
244
+                $item_value += $score[0] / $my_score_denom * $item->get_weight();
245
+                $item_total += $item->get_weight();
246 246
             }
247 247
             $item_value = number_format($item_value, 2, '.', ' ');
248 248
             $total_score = array($item_value, $item_total);
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
             $cattotal = Category :: load(0);
252 252
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
253 253
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
254
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . api_get_person_name($user['firstname'], $user['lastname']) . '</b><br />';
254
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.api_get_person_name($user['firstname'], $user['lastname']).'</b><br />';
255 255
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
256
-                $scoreinfo.= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>';
256
+                $scoreinfo .= '<h2>'.get_lang('Total').' : '.$scorecourse_display.'</h2>';
257 257
             }
258 258
             Display :: display_normal_message($scoreinfo, false);
259 259
         }
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
         if (($showtree == '1') || (isset($_GET['studentoverview']))) {
264 264
             $header .= '<tr>';
265 265
             if (!$selectcat == '0') {
266
-                $header .= '<td style=" "><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
266
+                $header .= '<td style=" "><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
267 267
             }
268
-            $header .= '<td style=" ">' . get_lang('CurrentCategory') . '</td>' .
268
+            $header .= '<td style=" ">'.get_lang('CurrentCategory').'</td>'.
269 269
                     '<td style=" "><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
270 270
             $cats = Category :: load();
271 271
 
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
                 }
279 279
                 $line = isset($line) ? $line : '';
280 280
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
281
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
281
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
282 282
                 } else {
283
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
283
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
284 284
                 }
285 285
                 $line = '';
286 286
             }
287 287
             $header .= '</select></form></td>';
288 288
             if (!empty($simple_search_form) && $message_resource === false) {
289
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
289
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
290 290
             } else {
291 291
                 $header .= '<td></td>';
292 292
             }
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
                     //$header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
301 301
                 }
302 302
             } else {
303
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
303
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">
304 304
                 '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
305
-                ' . get_lang('ExportPDF') . '</a>';
305
+                ' . get_lang('ExportPDF').'</a>';
306 306
             }
307 307
             $header .= '</td></tr>';
308 308
         }
309
-        $header.='</table></div>';
309
+        $header .= '</table></div>';
310 310
 
311 311
         // for course admin & platform admin add item buttons are added to the header
312 312
         $header .= '<div class="actions">';
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
337 337
                 $my_api_cidreq = api_get_cidreq();
338 338
                 if ($my_api_cidreq == '') {
339
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
339
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
340 340
                 }
341 341
                 if ($show_add_link && !$message_resource) {
342 342
                     //$header .= '<td><a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '" >'.Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'),'',ICON_SIZE_MEDIUM).'</a>';
@@ -355,28 +355,28 @@  discard block
 block discarded – undo
355 355
                     $my_course_id = api_get_course_id();
356 356
                     $my_file = substr($_SESSION['gradebook_dest'], 0, 5);
357 357
 
358
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
359
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
360
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&amp;cat_id=' . (int) $_GET['selectcat'] . '">' .
361
-                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';
358
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
359
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
360
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int) $_GET['selectcat'].'">'.
361
+                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM).'</a>';
362 362
 
363 363
                     $visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
364 364
                     $visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
365 365
 
366 366
                     //Right icons
367
-                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
367
+                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
368 368
                     //$modify_icons .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat=' . $catobj->get_id() . '">'.
369 369
                     //Display::return_icon('certificate.png', get_lang('AttachCertificate'),'',ICON_SIZE_MEDIUM).'</a>';
370 370
                     //hide or delete are not options available
371 371
                     //$modify_icons .= '&nbsp;<a  href="' . api_get_self() . '?visiblecat=' . $catobj->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=0 ">'.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'',ICON_SIZE_MEDIUM).'</a>';
372 372
                     if ($catobj->get_name() != api_get_course_id()) {
373
-                        $modify_icons .= '&nbsp;<a  href="' . api_get_self() . '?deletecat=' . $catobj->get_id() . '&amp;selectcat=0&amp;cidReq=' . $catobj->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '</a>';
373
+                        $modify_icons .= '&nbsp;<a  href="'.api_get_self().'?deletecat='.$catobj->get_id().'&amp;selectcat=0&amp;cidReq='.$catobj->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM).'</a>';
374 374
                     }
375 375
                     $header .= Display::div($modify_icons, array('class' => 'right'));
376 376
                 }
377 377
             }
378 378
         } elseif (isset($_GET['search'])) {
379
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
379
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
380 380
         }
381 381
         $header .= '</div>';
382 382
         echo $header;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
                     $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
489 489
                     $aditionalButtons .= '</div>';
490 490
                 }
491
-                $scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons). '</strong>';
491
+                $scoreinfo .= '<strong>'.sprintf(get_lang('TotalX'), $scorecourse_display.$aditionalButtons).'</strong>';
492 492
 
493 493
             }
494 494
             Display :: display_normal_message($scoreinfo, false);
@@ -499,10 +499,10 @@  discard block
 block discarded – undo
499 499
             $header = '<div class="actions"><table>';
500 500
             $header .= '<tr>';
501 501
             if (!$selectcat == '0') {
502
-                $header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' .
503
-                    Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
502
+                $header .= '<td><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.
503
+                    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
504 504
             }
505
-            $header .= '<td>' . get_lang('CurrentCategory') . '</td>' .
505
+            $header .= '<td>'.get_lang('CurrentCategory').'</td>'.
506 506
                     '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
507 507
             $cats = Category :: load();
508 508
 
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
                 }
516 516
                 $line = isset($line) ? $line : '';
517 517
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
518
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
518
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
519 519
                 } else {
520
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
520
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
521 521
                 }
522 522
                 $line = '';
523 523
             }
524 524
             $header .= '</select></form></td>';
525 525
             if (!empty($simple_search_form) && $message_resource === false) {
526
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
526
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
527 527
             } else {
528 528
                 $header .= '<td></td>';
529 529
             }
@@ -540,9 +540,9 @@  discard block
 block discarded – undo
540 540
                     //$header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
541 541
                 }
542 542
             } else {
543
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
543
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">
544 544
 							 '.Display::return_icon('pdf.png', get_lang('ExportPDF'), [], ICON_SIZE_MEDIUM).'
545
-							' . get_lang('ExportPDF') . '</a>';
545
+							' . get_lang('ExportPDF').'</a>';
546 546
             }
547 547
             $header .= '</td></tr>';
548 548
             $header .= '</table></div>';
@@ -557,33 +557,33 @@  discard block
 block discarded – undo
557 557
 
558 558
         if (api_is_allowed_to_edit(null, true)) {
559 559
             if (empty($grade_model_id) || $grade_model_id == -1) {
560
-                $actionsLeft .= '<a href="gradebook_add_cat.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' .
561
-                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '</a></td>';
560
+                $actionsLeft .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.
561
+                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).'</a></td>';
562 562
             }
563 563
             if ($selectcat == '0') {
564 564
 
565 565
             } else {
566 566
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
567 567
                 if ($my_api_cidreq == '') {
568
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
568
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
569 569
                 }
570 570
                 if ($show_add_link && !$message_resource) {
571
-                   $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
572
-                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
571
+                   $actionsLeft .= '<a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'" >'.
572
+                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
573 573
                     $cats = Category :: load($selectcat);
574 574
 
575 575
                     if ($cats[0]->get_course_code() != null && !$message_resource) {
576
-                        $actionsLeft .= '<a href="gradebook_add_link.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
577
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
576
+                        $actionsLeft .= '<a href="gradebook_add_link.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
577
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
578 578
                     } else {
579
-                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
580
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
579
+                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
580
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
581 581
                     }
582 582
                 }
583 583
 
584 584
                 if (!$message_resource) {
585
-                    $actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
586
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
585
+                    $actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
586
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
587 587
 
588 588
                     if ($my_category['generate_certificates'] == 1) {
589 589
                         $actionsLeft .= Display::url(
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                                         '',
594 594
                                         ICON_SIZE_MEDIUM
595 595
                                         ),
596
-                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . intval($_GET['selectcat'])
596
+                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".intval($_GET['selectcat'])
597 597
                             );
598 598
                     }
599 599
 
@@ -604,30 +604,30 @@  discard block
 block discarded – undo
604 604
                                     '',
605 605
                                     ICON_SIZE_MEDIUM
606 606
                                     ),
607
-                            "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . intval($_GET['selectcat'])
607
+                            "gradebook_display_summary.php?$my_api_cidreq&selectcat=".intval($_GET['selectcat'])
608 608
                         );
609 609
 
610 610
 
611 611
                     // Right icons
612
-                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
613
-                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
614
-                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&' . $my_api_cidreq . '&origin=gradebook&selectcat=' . $catobj->get_id() . '">' .
615
-                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . '</a>';
612
+                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
613
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
614
+                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'.
615
+                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).'</a>';
616 616
 
617 617
                     if (empty($categories)) {
618
-                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session=' . api_get_session_id() . '&amp;' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
619
-                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . '</a>';
618
+                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
619
+                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).'</a>';
620 620
                     }
621 621
                     $score_display_custom = api_get_setting('gradebook_score_display_custom');
622 622
                     if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') {
623
-                        $actionsRight .= '<a href="gradebook_scoring_system.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
624
-                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
623
+                        $actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
624
+                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
625 625
                     }
626 626
 
627 627
                 }
628 628
             }
629 629
         } elseif (isset($_GET['search'])) {
630
-            echo $header = '<b>' . get_lang('SearchResults') . ' :</b>';
630
+            echo $header = '<b>'.get_lang('SearchResults').' :</b>';
631 631
         }
632 632
 
633 633
         $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
@@ -636,26 +636,26 @@  discard block
 block discarded – undo
636 636
         );
637 637
 
638 638
         if ($isDrhOfCourse) {
639
-            $$actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
640
-                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
639
+            $$actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
640
+                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
641 641
         }
642 642
 
643
-        if (api_is_allowed_to_edit(null, true)){
644
-            echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight ));
643
+        if (api_is_allowed_to_edit(null, true)) {
644
+            echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight));
645 645
         }
646 646
 
647 647
         if (api_is_allowed_to_edit(null, true)) {
648 648
             $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0;
649
-            $weight = '<strong>' . get_lang('TotalWeight') . ' : </strong>' . $weight;
649
+            $weight = '<strong>'.get_lang('TotalWeight').' : </strong>'.$weight;
650 650
 
651 651
             $min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0);
652
-            $min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification;
653
-            $edit_icon = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
654
-                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
652
+            $min_certification = get_lang('CertificateMinScore').' : '.$min_certification;
653
+            $edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
654
+                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
655 655
             //$msg = Display::tag('h3', $weight.' - '.$min_certification);
656
-            $msg = $weight . ' - ' . $min_certification . $edit_icon;
656
+            $msg = $weight.' - '.$min_certification.$edit_icon;
657 657
             //@todo show description
658
-            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>' . get_lang('GradebookDescriptionLog') . '</strong>' . ': ' . $catobj->get_description());
658
+            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.$catobj->get_description());
659 659
             Display::display_normal_message($msg, false);
660 660
             if (!empty($description)) {
661 661
                 echo Display::div($description, array());
@@ -683,24 +683,24 @@  discard block
 block discarded – undo
683 683
             $cattotal = Category :: load(0);
684 684
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
685 685
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
686
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />';
686
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.$user['complete_name'].'</b><br />';
687 687
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
688
-                $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
689
-            $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
688
+                $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>';
689
+            $scoreinfo .= '<br />'.get_lang('Total').' : <b>'.$scoretotal_display.'</b>';
690 690
             Display :: display_normal_message($scoreinfo, false);
691 691
         }
692 692
         // show navigation tree and buttons?
693 693
         $header = '<div class="actions">';
694 694
 
695 695
         if ($is_course_admin) {
696
-            $header .= '<a href="gradebook_flatview.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
697
-            $header .= '<a href="gradebook_scoring_system.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
696
+            $header .= '<a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
697
+            $header .= '<a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
698 698
         } elseif (!(isset($_GET['studentoverview']))) {
699
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('view_list.gif', get_lang('FlatView')) . ' ' . get_lang('FlatView') . '</a>';
699
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat='.$catobj->get_id().'">'.Display::return_icon('view_list.gif', get_lang('FlatView')).' '.get_lang('FlatView').'</a>';
700 700
         } else {
701
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
701
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">'.Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>';
702 702
         }
703
-        $header.='</div>';
703
+        $header .= '</div>';
704 704
         echo $header;
705 705
     }
706 706
 
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
             $item = $evals_links[$count];
728 728
             $score = $item->calc_score($user_id);
729 729
             $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
730
-            $item_value+=$score[0] / $my_score_denom * $item->get_weight();
731
-            $item_total+=$item->get_weight();
730
+            $item_value += $score[0] / $my_score_denom * $item->get_weight();
731
+            $item_total += $item->get_weight();
732 732
             //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
733 733
         }
734 734
         $item_value = number_format($item_value, 2, '.', ' ');
@@ -743,17 +743,17 @@  discard block
 block discarded – undo
743 743
         $imageUrl = UserManager::getUserPicture($userid);
744 744
 
745 745
         $info = '<div class="row"><div class="col-md-3">';
746
-        $info .= '<div class="thumbnail"><img src="' . $imageUrl . '" /></div>';
746
+        $info .= '<div class="thumbnail"><img src="'.$imageUrl.'" /></div>';
747 747
         $info .= '</div>';
748 748
         $info .= '<div class="col-md-6">';
749
-        $info .= get_lang('Name') . ' :  <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userid . '"> ' .
750
-            $user['complete_name'] . '</a><br />';
749
+        $info .= get_lang('Name').' :  <a target="_blank" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userid.'"> '.
750
+            $user['complete_name'].'</a><br />';
751 751
 
752 752
         if (api_get_setting('show_email_addresses') == 'true') {
753
-            $info .= get_lang('Email') . ' : <a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a><br />';
753
+            $info .= get_lang('Email').' : <a href="mailto:'.$user['email'].'">'.$user['email'].'</a><br />';
754 754
         }
755 755
 
756
-        $info .= get_lang('TotalUser') . ' : <b>' . $scorecourse_display . '</b>';
756
+        $info .= get_lang('TotalUser').' : <b>'.$scorecourse_display.'</b>';
757 757
         $info .= '</div>';
758 758
         $info .= '</div>';
759 759
 
Please login to merge, or discard this patch.
main/newscorm/learnpath.class.php 1 patch
Spacing   +685 added lines, -685 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;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $res = Database::query($sql);
245 245
 
246 246
         if ($this->debug > 2) {
247
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0);
247
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0);
248 248
             error_log('-- Start while--', 0);
249 249
         }
250 250
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
                         $this->refs_list[$oItem->ref] = $my_item_id;
265 265
                         if ($this->debug > 2) {
266 266
                             error_log(
267
-                                'New LP - learnpath::__construct() - ' .
268
-                                'aicc object with id ' . $my_item_id .
267
+                                'New LP - learnpath::__construct() - '.
268
+                                'aicc object with id '.$my_item_id.
269 269
                                 ' set in items[]',
270 270
                                 0
271 271
                             );
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 
285 285
                         $this->refs_list[$oItem->ref] = $my_item_id;
286 286
                         if ($this->debug > 2) {
287
-                            error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0);
287
+                            error_log('New LP - object with id '.$my_item_id.' set in items[]', 0);
288 288
                         }
289 289
                     }
290 290
                     break;
291 291
                 case 1:
292 292
                 default:
293 293
                     if ($this->debug > 2) {
294
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0);
294
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0);
295 295
                     }
296 296
                     $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row);
297 297
 
298 298
                     if ($this->debug > 2) {
299
-                        error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0);
299
+                        error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0);
300 300
                     }
301 301
                     if (is_object($oItem)) {
302 302
                         $my_item_id = $oItem->get_id();
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
                         $this->refs_list[$my_item_id] = $my_item_id;
308 308
                         if ($this->debug > 2) {
309 309
                             error_log(
310
-                                'New LP - learnpath::__construct() ' . __LINE__ .
311
-                                ' - object with id ' . $my_item_id . ' set in items[]',
310
+                                'New LP - learnpath::__construct() '.__LINE__.
311
+                                ' - object with id '.$my_item_id.' set in items[]',
312 312
                                 0);
313 313
                         }
314 314
                     }
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
                 $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id);
327 327
                 if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) {
328 328
                     $this->items[$row['id']]->current_start_time = 0;
329
-                    $this->items[$row['id']]->current_stop_time	= 0;
329
+                    $this->items[$row['id']]->current_stop_time = 0;
330 330
                 }
331 331
             }
332 332
         }
333 333
 
334 334
         if ($this->debug > 2) {
335
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0);
335
+            error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0);
336 336
         }
337 337
 
338 338
         if (!empty($lp_item_id_list)) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
         // TODO: Define the current item better.
425 425
         $this->first();
426 426
         if ($this->debug > 2) {
427
-            error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0);
427
+            error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0);
428 428
         }
429 429
         return true;
430 430
     }
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     ) {
499 499
         $course_id = $this->course_info['real_id'];
500 500
         if ($this->debug > 0) {
501
-            error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0);
501
+            error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0);
502 502
         }
503 503
         if (empty($course_id)) {
504 504
             // Sometimes Oogie doesn't catch the course info but sets $this->cc
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                 FROM $tbl_lp_item
519 519
                 WHERE
520 520
                     c_id = $course_id AND
521
-                    lp_id = " . $this->get_id() . " AND
521
+                    lp_id = ".$this->get_id()." AND
522 522
                     parent_item_id = " . $parent;
523 523
 
524 524
         $res_count = Database::query($sql);
@@ -528,11 +528,11 @@  discard block
 block discarded – undo
528 528
         if ($num > 0) {
529 529
             if ($previous == 0) {
530 530
                 $sql = "SELECT id, next_item_id, display_order
531
-                        FROM " . $tbl_lp_item . "
531
+                        FROM " . $tbl_lp_item."
532 532
                         WHERE
533 533
                             c_id = $course_id AND
534
-                            lp_id = " . $this->get_id() . " AND
535
-                            parent_item_id = " . $parent . " AND
534
+                            lp_id = ".$this->get_id()." AND
535
+                            parent_item_id = " . $parent." AND
536 536
                             previous_item_id = 0 OR
537 537
                             previous_item_id=" . $parent;
538 538
                 $result = Database::query($sql);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 						FROM $tbl_lp_item
548 548
                         WHERE
549 549
                             c_id = $course_id AND
550
-                            lp_id = " . $this->get_id() . " AND
550
+                            lp_id = ".$this->get_id()." AND
551 551
                             id = " . $previous;
552 552
 
553 553
                 $result = Database::query($sql);
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
         $typeCleaned = Database::escape_string($type);
568 568
         if ($type == 'quiz') {
569 569
             $sql = 'SELECT SUM(ponderation)
570
-                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
571
-                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
570
+                    FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question
571
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question
572 572
                     ON
573 573
                         quiz_question.id = quiz_rel_question.question_id AND
574 574
                         quiz_question.c_id = quiz_rel_question.c_id
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         $new_item_id = Database::insert($tbl_lp_item, $params);
615 615
 
616 616
         if ($this->debug > 2) {
617
-            error_log('New LP - Inserting chapter: ' . $new_item_id, 0);
617
+            error_log('New LP - Inserting chapter: '.$new_item_id, 0);
618 618
         }
619 619
 
620 620
         if ($new_item_id) {
@@ -631,28 +631,28 @@  discard block
 block discarded – undo
631 631
             Database::query($sql);
632 632
 
633 633
             // Update all the items after the new item.
634
-            $sql = "UPDATE " . $tbl_lp_item . "
634
+            $sql = "UPDATE ".$tbl_lp_item."
635 635
                         SET display_order = display_order + 1
636 636
                     WHERE
637 637
                         c_id = $course_id AND
638
-                        lp_id = " . $this->get_id() . " AND
639
-                        id <> " . $new_item_id . " AND
640
-                        parent_item_id = " . $parent . " AND
638
+                        lp_id = ".$this->get_id()." AND
639
+                        id <> " . $new_item_id." AND
640
+                        parent_item_id = " . $parent." AND
641 641
                         display_order > " . $display_order;
642 642
             Database::query($sql);
643 643
 
644 644
             // Update the item that should come after the new item.
645
-            $sql = "UPDATE " . $tbl_lp_item . "
646
-                    SET ref = " . $new_item_id . "
647
-                    WHERE c_id = $course_id AND id = " . $new_item_id;
645
+            $sql = "UPDATE ".$tbl_lp_item."
646
+                    SET ref = " . $new_item_id."
647
+                    WHERE c_id = $course_id AND id = ".$new_item_id;
648 648
             Database::query($sql);
649 649
 
650 650
             // Upload audio.
651 651
             if (!empty($_FILES['mp3']['name'])) {
652 652
                 // Create the audio folder if it does not exist yet.
653
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
654
-                if (!is_dir($filepath . 'audio')) {
655
-                    mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
653
+                $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
654
+                if (!is_dir($filepath.'audio')) {
655
+                    mkdir($filepath.'audio', api_get_permissions_for_new_directories());
656 656
                     $audio_id = add_document(
657 657
                         $_course,
658 658
                         '/audio',
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                 $file_path = handle_uploaded_document(
690 690
                     $_course,
691 691
                     $_FILES['mp3'],
692
-                    api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document',
692
+                    api_get_path(SYS_COURSE_PATH).$_course['path'].'/document',
693 693
                     '/audio',
694 694
                     api_get_user_id(),
695 695
                     '',
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 
706 706
                 // Store the mp3 file in the lp_item table.
707 707
                 $sql = "UPDATE $tbl_lp_item SET
708
-                            audio = '" . Database::escape_string($file) . "'
709
-                        WHERE id = '" . intval($new_item_id) . "'";
708
+                            audio = '".Database::escape_string($file)."'
709
+                        WHERE id = '" . intval($new_item_id)."'";
710 710
                 Database::query($sql);
711 711
             }
712 712
         }
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         while (Database :: num_rows($res_name)) {
783 783
             // There is already one such name, update the current one a bit.
784 784
             $i++;
785
-            $name = $name . ' - ' . $i;
785
+            $name = $name.' - '.$i;
786 786
             $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'";
787 787
             $res_name = Database::query($check_name);
788 788
         }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                 // if $item points to an object and there is a parent.
895 895
                 if ($debug) {
896 896
                     error_log(
897
-                        'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ',
897
+                        'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ',
898 898
                         0
899 899
                     );
900 900
                 }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
                         if ($childItemId != $item) {
923 923
                             if ($debug) {
924 924
                                 error_log(
925
-                                    'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(),
925
+                                    'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(),
926 926
                                     0
927 927
                                 );
928 928
                             }
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
                             } else {
943 943
                                 if ($debug > 2) {
944 944
                                     error_log(
945
-                                        '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,
945
+                                        '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,
946 946
                                         0
947 947
                                     );
948 948
                                 }
@@ -1047,15 +1047,15 @@  discard block
 block discarded – undo
1047 1047
         // Delete lp item id.
1048 1048
         foreach ($this->items as $id => $dummy) {
1049 1049
             $sql = "DELETE FROM $lp_item_view
1050
-                    WHERE c_id = $course_id AND lp_item_id = '" . $id . "'";
1050
+                    WHERE c_id = $course_id AND lp_item_id = '".$id."'";
1051 1051
             Database::query($sql);
1052 1052
         }
1053 1053
 
1054 1054
         // Proposed by Christophe (nickname: clefevre)
1055
-        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1055
+        $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1056 1056
         Database::query($sql);
1057 1057
 
1058
-        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
1058
+        $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
1059 1059
         Database::query($sql);
1060 1060
 
1061 1061
         self::toggle_publish($this->lp_id, 'i');
@@ -1063,32 +1063,32 @@  discard block
 block discarded – undo
1063 1063
         if ($this->type == 2 || $this->type == 3) {
1064 1064
             // This is a scorm learning path, delete the files as well.
1065 1065
             $sql = "SELECT path FROM $lp
1066
-                    WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1066
+                    WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1067 1067
             $res = Database::query($sql);
1068 1068
             if (Database :: num_rows($res) > 0) {
1069 1069
                 $row = Database :: fetch_array($res);
1070 1070
                 $path = $row['path'];
1071 1071
                 $sql = "SELECT id FROM $lp
1072
-                        WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id;
1072
+                        WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id;
1073 1073
                 $res = Database::query($sql);
1074 1074
                 if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it.
1075 1075
                     if ($this->debug > 2) {
1076
-                        error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
1076
+                        error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0);
1077 1077
                     }
1078 1078
                 } else {
1079 1079
                     // No other LP uses that directory, delete it.
1080
-                    $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses
1081
-                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course.
1082
-                    if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) {
1080
+                    $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses
1081
+                    $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course.
1082
+                    if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) {
1083 1083
                         if ($this->debug > 2) {
1084
-                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
1084
+                            error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0);
1085 1085
                         }
1086 1086
                         // Proposed by Christophe (clefevre).
1087 1087
                         if (strcmp(substr($path, -2), "/.") == 0) {
1088 1088
                             $path = substr($path, 0, -1); // Remove "." at the end.
1089 1089
                         }
1090 1090
                         //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
1091
-                        rmdirr($course_scorm_dir . $path);
1091
+                        rmdirr($course_scorm_dir.$path);
1092 1092
                     }
1093 1093
                 }
1094 1094
             }
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
                 WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')";
1102 1102
         Database::query($sql);
1103 1103
 
1104
-        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id;
1104
+        $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id;
1105 1105
         Database::query($sql);
1106 1106
         // Updates the display order of all lps.
1107 1107
         $this->update_display_order();
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
             api_get_user_id()
1115 1115
         );
1116 1116
 
1117
-        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id());
1117
+        $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
1118 1118
         if ($link_info !== false) {
1119 1119
             GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
1120 1120
         }
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
     {
1135 1135
         $course_id = $this->course_info['real_id'];
1136 1136
         if ($this->debug > 0) {
1137
-            error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0);
1137
+            error_log('New LP - In learnpath::delete_children_items('.$id.')', 0);
1138 1138
         }
1139 1139
         $num = 0;
1140 1140
         if (empty ($id) || $id != strval(intval($id))) {
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
         $res = Database::query($sql);
1146 1146
         while ($row = Database :: fetch_array($res)) {
1147 1147
             $num += $this->delete_children_items($row['id']);
1148
-            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id'];
1148
+            $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id'];
1149 1149
             Database::query($sql_del);
1150 1150
             $num++;
1151 1151
         }
@@ -1186,12 +1186,12 @@  discard block
 block discarded – undo
1186 1186
         // Delete children items.
1187 1187
         $num = $this->delete_children_items($id);
1188 1188
         if ($this->debug > 2) {
1189
-            error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0);
1189
+            error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0);
1190 1190
         }
1191 1191
         // Now delete the item.
1192 1192
         $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id";
1193 1193
         if ($this->debug > 2) {
1194
-            error_log('New LP - Deleting item: ' . $sql_del, 0);
1194
+            error_log('New LP - Deleting item: '.$sql_del, 0);
1195 1195
         }
1196 1196
         Database::query($sql_del);
1197 1197
         // Now update surrounding items.
@@ -1266,15 +1266,15 @@  discard block
 block discarded – undo
1266 1266
         }
1267 1267
 
1268 1268
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
1269
-        $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id;
1269
+        $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id;
1270 1270
         $res_select = Database::query($sql_select);
1271 1271
         $row_select = Database :: fetch_array($res_select);
1272 1272
         $audio_update_sql = '';
1273 1273
         if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
1274 1274
             // Create the audio folder if it does not exist yet.
1275
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
1276
-            if (!is_dir($filepath . 'audio')) {
1277
-                mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
1275
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
1276
+            if (!is_dir($filepath.'audio')) {
1277
+                mkdir($filepath.'audio', api_get_permissions_for_new_directories());
1278 1278
                 $audio_id = add_document(
1279 1279
                     $_course,
1280 1280
                     '/audio',
@@ -1312,11 +1312,11 @@  discard block
 block discarded – undo
1312 1312
             $pi = pathinfo($audio['name']);
1313 1313
             if ($pi['extension'] == 'mp3') {
1314 1314
                 $c_det = api_get_course_info($this->cc);
1315
-                $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document';
1315
+                $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document';
1316 1316
                 $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0);
1317 1317
                 $path = substr($path, 7);
1318 1318
                 // Update reference in lp_item - audio path is the path from inside de document/audio/ dir.
1319
-                $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' ";
1319
+                $audio_update_sql = ", audio = '".Database::escape_string($path)."' ";
1320 1320
             }
1321 1321
         }
1322 1322
 
@@ -1326,13 +1326,13 @@  discard block
 block discarded – undo
1326 1326
         // TODO: htmlspecialchars to be checked for encoding related problems.
1327 1327
         if ($same_parent && $same_previous) {
1328 1328
             // Only update title and description.
1329
-            $sql = "UPDATE " . $tbl_lp_item . "
1330
-                    SET title = '" . Database::escape_string($title) . "',
1331
-                        prerequisite = '" . $prerequisites . "',
1332
-                        description = '" . Database::escape_string($description) . "'
1333
-                        " . $audio_update_sql . ",
1334
-                        max_time_allowed = '" . Database::escape_string($max_time_allowed) . "'
1335
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1329
+            $sql = "UPDATE ".$tbl_lp_item."
1330
+                    SET title = '" . Database::escape_string($title)."',
1331
+                        prerequisite = '" . $prerequisites."',
1332
+                        description = '" . Database::escape_string($description)."'
1333
+                        " . $audio_update_sql.",
1334
+                        max_time_allowed = '" . Database::escape_string($max_time_allowed)."'
1335
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1336 1336
             Database::query($sql);
1337 1337
         } else {
1338 1338
             $old_parent = $row_select['parent_item_id'];
@@ -1347,27 +1347,27 @@  discard block
 block discarded – undo
1347 1347
 
1348 1348
             if ($old_previous != 0) {
1349 1349
                 // Next
1350
-                $sql = "UPDATE " . $tbl_lp_item . "
1351
-                        SET next_item_id = " . $old_next . "
1352
-                        WHERE c_id = ".$course_id." AND id = " . $old_previous;
1350
+                $sql = "UPDATE ".$tbl_lp_item."
1351
+                        SET next_item_id = " . $old_next."
1352
+                        WHERE c_id = ".$course_id." AND id = ".$old_previous;
1353 1353
                 Database::query($sql);
1354 1354
             }
1355 1355
 
1356 1356
             if ($old_next != 0) {
1357 1357
                 // Previous
1358
-                $sql = "UPDATE " . $tbl_lp_item . "
1359
-                        SET previous_item_id = " . $old_previous . "
1360
-                        WHERE c_id = ".$course_id." AND id = " . $old_next;
1358
+                $sql = "UPDATE ".$tbl_lp_item."
1359
+                        SET previous_item_id = " . $old_previous."
1360
+                        WHERE c_id = ".$course_id." AND id = ".$old_next;
1361 1361
                 Database::query($sql);
1362 1362
             }
1363 1363
 
1364 1364
             // display_order - 1 for every item with a display_order bigger then the display_order of the current item.
1365
-            $sql = "UPDATE " . $tbl_lp_item . "
1365
+            $sql = "UPDATE ".$tbl_lp_item."
1366 1366
                     SET display_order = display_order - 1
1367 1367
                     WHERE
1368 1368
                         c_id = ".$course_id." AND
1369
-                        display_order > " . $old_order . " AND
1370
-                        lp_id = " . $this->lp_id . " AND
1369
+                        display_order > " . $old_order." AND
1370
+                        lp_id = " . $this->lp_id." AND
1371 1371
                         parent_item_id = " . $old_parent;
1372 1372
             Database::query($sql);
1373 1373
             /* END -- virtually remove the current item id */
@@ -1377,11 +1377,11 @@  discard block
 block discarded – undo
1377 1377
             if ($previous == 0) {
1378 1378
                 // Select the data of the item that should come after the current item.
1379 1379
                 $sql = "SELECT id, display_order
1380
-                        FROM " . $tbl_lp_item . "
1380
+                        FROM " . $tbl_lp_item."
1381 1381
                         WHERE
1382 1382
                             c_id = ".$course_id." AND
1383
-                            lp_id = " . $this->lp_id . " AND
1384
-                            parent_item_id = " . $parent . " AND
1383
+                            lp_id = " . $this->lp_id." AND
1384
+                            parent_item_id = " . $parent." AND
1385 1385
                             previous_item_id = " . $previous;
1386 1386
                 $res_select_old = Database::query($sql);
1387 1387
                 $row_select_old = Database::fetch_array($res_select_old);
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
             } else {
1398 1398
                 // Select the data of the item that should come before the current item.
1399 1399
                 $sql = "SELECT next_item_id, display_order
1400
-                        FROM " . $tbl_lp_item . "
1401
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1400
+                        FROM " . $tbl_lp_item."
1401
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1402 1402
                 $res_select_old = Database::query($sql);
1403 1403
                 $row_select_old = Database :: fetch_array($res_select_old);
1404 1404
                 $new_next = $row_select_old['next_item_id'];
@@ -1407,57 +1407,57 @@  discard block
 block discarded – undo
1407 1407
 
1408 1408
             // TODO: htmlspecialchars to be checked for encoding related problems.
1409 1409
             // Update the current item with the new data.
1410
-            $sql = "UPDATE " . $tbl_lp_item . "
1410
+            $sql = "UPDATE ".$tbl_lp_item."
1411 1411
                     SET
1412
-                        title = '" . Database::escape_string($title) . "',
1413
-                        description = '" . Database::escape_string($description) . "',
1414
-                        parent_item_id = " . $parent . ",
1415
-                        previous_item_id = " . $previous . ",
1416
-                        next_item_id = " . $new_next . ",
1417
-                        display_order = " . $new_order . "
1418
-                        " . $audio_update_sql . "
1419
-                    WHERE c_id = ".$course_id." AND id = " . $id;
1412
+                        title = '" . Database::escape_string($title)."',
1413
+                        description = '" . Database::escape_string($description)."',
1414
+                        parent_item_id = " . $parent.",
1415
+                        previous_item_id = " . $previous.",
1416
+                        next_item_id = " . $new_next.",
1417
+                        display_order = " . $new_order."
1418
+                        " . $audio_update_sql."
1419
+                    WHERE c_id = ".$course_id." AND id = ".$id;
1420 1420
             Database::query($sql);
1421 1421
 
1422 1422
             if ($previous != 0) {
1423 1423
                 // Update the previous item's next_item_id.
1424
-                $sql = "UPDATE " . $tbl_lp_item . "
1425
-                        SET next_item_id = " . $id . "
1426
-                        WHERE c_id = ".$course_id." AND id = " . $previous;
1424
+                $sql = "UPDATE ".$tbl_lp_item."
1425
+                        SET next_item_id = " . $id."
1426
+                        WHERE c_id = ".$course_id." AND id = ".$previous;
1427 1427
                 Database::query($sql);
1428 1428
             }
1429 1429
 
1430 1430
             if ($new_next != 0) {
1431 1431
                 // Update the next item's previous_item_id.
1432
-                $sql = "UPDATE " . $tbl_lp_item . "
1433
-                        SET previous_item_id = " . $id . "
1434
-                        WHERE c_id = ".$course_id." AND id = " . $new_next;
1432
+                $sql = "UPDATE ".$tbl_lp_item."
1433
+                        SET previous_item_id = " . $id."
1434
+                        WHERE c_id = ".$course_id." AND id = ".$new_next;
1435 1435
                 Database::query($sql);
1436 1436
             }
1437 1437
 
1438 1438
             if ($old_prerequisite != $prerequisites) {
1439
-                $sql = "UPDATE " . $tbl_lp_item . "
1440
-                        SET prerequisite = '" . $prerequisites . "'
1441
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1439
+                $sql = "UPDATE ".$tbl_lp_item."
1440
+                        SET prerequisite = '" . $prerequisites."'
1441
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1442 1442
                 Database::query($sql);
1443 1443
             }
1444 1444
 
1445 1445
             if ($old_max_time_allowed != $max_time_allowed) {
1446 1446
                 // update max time allowed
1447
-                $sql = "UPDATE " . $tbl_lp_item . "
1448
-                        SET max_time_allowed = " . $max_time_allowed . "
1449
-                        WHERE c_id = ".$course_id." AND id = " . $id;
1447
+                $sql = "UPDATE ".$tbl_lp_item."
1448
+                        SET max_time_allowed = " . $max_time_allowed."
1449
+                        WHERE c_id = ".$course_id." AND id = ".$id;
1450 1450
                 Database::query($sql);
1451 1451
             }
1452 1452
 
1453 1453
             // Update all the items with the same or a bigger display_order than the current item.
1454
-            $sql = "UPDATE " . $tbl_lp_item . "
1454
+            $sql = "UPDATE ".$tbl_lp_item."
1455 1455
                     SET display_order = display_order + 1
1456 1456
                     WHERE
1457 1457
                        c_id = ".$course_id." AND
1458
-                       lp_id = " . $this->get_id() . " AND
1459
-                       id <> " . $id . " AND
1460
-                       parent_item_id = " . $parent . " AND
1458
+                       lp_id = " . $this->get_id()." AND
1459
+                       id <> " . $id." AND
1460
+                       parent_item_id = " . $parent." AND
1461 1461
                        display_order >= " . $new_order;
1462 1462
 
1463 1463
             Database::query($sql);
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
     {
1484 1484
         $course_id = api_get_course_int_id();
1485 1485
         if ($this->debug > 0) {
1486
-            error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0);
1486
+            error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0);
1487 1487
         }
1488 1488
 
1489 1489
         if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) {
@@ -1581,8 +1581,8 @@  discard block
 block discarded – undo
1581 1581
             error_log('New LP - In learnpath::get_brother_chapters()', 0);
1582 1582
         }
1583 1583
 
1584
-        if (empty($id)|| $id != strval(intval($id))) {
1585
-            return array ();
1584
+        if (empty($id) || $id != strval(intval($id))) {
1585
+            return array();
1586 1586
         }
1587 1587
 
1588 1588
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1600,13 +1600,13 @@  discard block
 block discarded – undo
1600 1600
                             item_type='dokeos_chapter'
1601 1601
                         ORDER BY display_order";
1602 1602
             $res_bros = Database::query($sql_bros);
1603
-            $list = array ();
1603
+            $list = array();
1604 1604
             while ($row_bro = Database :: fetch_array($res_bros)) {
1605 1605
                 $list[] = $row_bro;
1606 1606
             }
1607 1607
             return $list;
1608 1608
         }
1609
-        return array ();
1609
+        return array();
1610 1610
     }
1611 1611
 
1612 1612
     /**
@@ -1619,11 +1619,11 @@  discard block
 block discarded – undo
1619 1619
     {
1620 1620
         $course_id = api_get_course_int_id();
1621 1621
         if ($this->debug > 0) {
1622
-            error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0);
1622
+            error_log('New LP - In learnpath::get_brother_items('.$id.')', 0);
1623 1623
         }
1624 1624
 
1625 1625
         if (empty ($id) || $id != strval(intval($id))) {
1626
-            return array ();
1626
+            return array();
1627 1627
         }
1628 1628
 
1629 1629
         $lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -1635,13 +1635,13 @@  discard block
 block discarded – undo
1635 1635
             $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent
1636 1636
                          ORDER BY display_order";
1637 1637
             $res_bros = Database::query($sql_bros);
1638
-            $list = array ();
1638
+            $list = array();
1639 1639
             while ($row_bro = Database :: fetch_array($res_bros)) {
1640 1640
                 $list[] = $row_bro;
1641 1641
             }
1642 1642
             return $list;
1643 1643
         }
1644
-        return array ();
1644
+        return array();
1645 1645
     }
1646 1646
 
1647 1647
     /**
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
             $current = $this->current;
1712 1712
         }
1713 1713
         if ($this->debug > 2) {
1714
-            error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0);
1714
+            error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0);
1715 1715
         }
1716 1716
         return $current;
1717 1717
     }
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
         ) {
1793 1793
 
1794 1794
             if ($this->debug > 2) {
1795
-                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);
1795
+                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);
1796 1796
             }
1797 1797
             $index = -1;
1798 1798
             foreach ($this->ordered_items as $myindex => $item_id) {
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
             if ($index == -1) {
1805 1805
                 // Index hasn't changed, so item not found - panic (this shouldn't happen).
1806 1806
                 if ($this->debug > 2) {
1807
-                    error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0);
1807
+                    error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0);
1808 1808
                 }
1809 1809
                 return false;
1810 1810
             } else {
@@ -1819,7 +1819,7 @@  discard block
 block discarded – undo
1819 1819
             $index = 0;
1820 1820
             // Loop through all ordered items and stop at the first item that is
1821 1821
             // not a directory *and* that has not been completed yet.
1822
-            while ( !empty($this->ordered_items[$index]) AND
1822
+            while (!empty($this->ordered_items[$index]) AND
1823 1823
                 is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND
1824 1824
                 (
1825 1825
                     $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR
@@ -1833,14 +1833,14 @@  discard block
 block discarded – undo
1833 1833
             $this->current  = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null;
1834 1834
             $this->index    = $index;
1835 1835
             if ($this->debug > 2) {
1836
-                error_log('$index ' . $index);
1836
+                error_log('$index '.$index);
1837 1837
             }
1838 1838
             if ($this->debug > 2) {
1839
-                error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0);
1839
+                error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0);
1840 1840
             }
1841 1841
         }
1842 1842
         if ($this->debug > 2) {
1843
-            error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id());
1843
+            error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id());
1844 1844
         }
1845 1845
     }
1846 1846
 
@@ -1853,7 +1853,7 @@  discard block
 block discarded – undo
1853 1853
     public function get_js_info($item_id = '')
1854 1854
     {
1855 1855
         if ($this->debug > 0) {
1856
-            error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0);
1856
+            error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0);
1857 1857
         }
1858 1858
 
1859 1859
         $info = '';
@@ -1863,17 +1863,17 @@  discard block
 block discarded – undo
1863 1863
             //if item is defined, return values from DB
1864 1864
             $oItem = $this->items[$item_id];
1865 1865
             $info .= '<script language="javascript">';
1866
-            $info .= "top.set_score(" . $oItem->get_score() . ");\n";
1867
-            $info .= "top.set_max(" . $oItem->get_max() . ");\n";
1868
-            $info .= "top.set_min(" . $oItem->get_min() . ");\n";
1869
-            $info .= "top.set_lesson_status('" . $oItem->get_status() . "');";
1870
-            $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');";
1871
-            $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');";
1872
-            $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');";
1866
+            $info .= "top.set_score(".$oItem->get_score().");\n";
1867
+            $info .= "top.set_max(".$oItem->get_max().");\n";
1868
+            $info .= "top.set_min(".$oItem->get_min().");\n";
1869
+            $info .= "top.set_lesson_status('".$oItem->get_status()."');";
1870
+            $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');";
1871
+            $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');";
1872
+            $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');";
1873 1873
             $info .= "top.set_flag_synchronized();";
1874 1874
             $info .= '</script>';
1875 1875
             if ($this->debug > 2) {
1876
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1876
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1877 1877
             }
1878 1878
             return $info;
1879 1879
 
@@ -1881,17 +1881,17 @@  discard block
 block discarded – undo
1881 1881
 
1882 1882
             // If item_id is empty, just update to default SCORM data.
1883 1883
             $info .= '<script language="javascript">';
1884
-            $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n";
1885
-            $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n";
1886
-            $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n";
1887
-            $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');";
1888
-            $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');";
1889
-            $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');";
1890
-            $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');";
1884
+            $info .= "top.set_score(".learnpathItem :: get_score().");\n";
1885
+            $info .= "top.set_max(".learnpathItem :: get_max().");\n";
1886
+            $info .= "top.set_min(".learnpathItem :: get_min().");\n";
1887
+            $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');";
1888
+            $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');";
1889
+            $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');";
1890
+            $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');";
1891 1891
             $info .= "top.set_flag_synchronized();";
1892 1892
             $info .= '</script>';
1893 1893
             if ($this->debug > 2) {
1894
-                error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0);
1894
+                error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0);
1895 1895
             }
1896 1896
             return $info;
1897 1897
         }
@@ -1945,12 +1945,12 @@  discard block
 block discarded – undo
1945 1945
      * Gets the navigation bar for the learnpath display screen
1946 1946
      * @return	string	The HTML string to use as a navigation bar
1947 1947
      */
1948
-    public function get_navigation_bar($idBar = null, $display=null) {
1948
+    public function get_navigation_bar($idBar = null, $display = null) {
1949 1949
         if ($this->debug > 0) {
1950 1950
             error_log('New LP - In learnpath::get_navigation_bar()', 0);
1951 1951
         }
1952
-        if(empty($idBar)){
1953
-            $idBar='control-top';
1952
+        if (empty($idBar)) {
1953
+            $idBar = 'control-top';
1954 1954
         }
1955 1955
         /* if(empty($display)){
1956 1956
             $display='display:block';
@@ -1963,16 +1963,16 @@  discard block
 block discarded – undo
1963 1963
             $navbar = '
1964 1964
                   <span id="'.$idBar.'" class="buttons">
1965 1965
                     <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">
1966
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1966
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1967 1967
                     </a>
1968
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1969
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1968
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1969
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1970 1970
                     </a>
1971
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1972
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1971
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1972
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1973 1973
                     </a>
1974 1974
                     <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode">
1975
-                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span>
1975
+                        <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span>
1976 1976
                     </a>
1977 1977
                   </span>';
1978 1978
 
@@ -1980,13 +1980,13 @@  discard block
 block discarded – undo
1980 1980
             $navbar = '
1981 1981
                 <span id="'.$idBar.'" class="buttons text-right">
1982 1982
                     <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">
1983
-                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span>
1983
+                        <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span>
1984 1984
                     </a>
1985
-                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous">
1986
-                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span>
1985
+                    <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous">
1986
+                        <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span>
1987 1987
                     </a>
1988
-                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next">
1989
-                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span>
1988
+                    <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next">
1989
+                        <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span>
1990 1990
                     </a>
1991 1991
                 </span>';
1992 1992
         }
@@ -2007,11 +2007,11 @@  discard block
 block discarded – undo
2007 2007
         $index = $this->index;
2008 2008
         $index++;
2009 2009
         if ($this->debug > 2) {
2010
-            error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0);
2010
+            error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0);
2011 2011
         }
2012 2012
         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) {
2013 2013
             $index++;
2014
-            if ($index == $this->max_ordered_items){
2014
+            if ($index == $this->max_ordered_items) {
2015 2015
                 if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') {
2016 2016
                     return $this->index;
2017 2017
                 } else {
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
             return $this->index;
2024 2024
         }
2025 2025
         if ($this->debug > 2) {
2026
-            error_log('New LP - index is now ' . $index, 0);
2026
+            error_log('New LP - index is now '.$index, 0);
2027 2027
         }
2028 2028
         return $index;
2029 2029
     }
@@ -2041,7 +2041,7 @@  discard block
 block discarded – undo
2041 2041
         if (!empty ($new_index)) {
2042 2042
             if (isset ($this->ordered_items[$new_index])) {
2043 2043
                 if ($this->debug > 2) {
2044
-                    error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0);
2044
+                    error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0);
2045 2045
                 }
2046 2046
                 return $this->ordered_items[$new_index];
2047 2047
             }
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
         }
2084 2084
 
2085 2085
         // Filename without its extension.
2086
-        $file_base_name = str_replace('.' . $extension, '', $filename);
2086
+        $file_base_name = str_replace('.'.$extension, '', $filename);
2087 2087
 
2088 2088
         $zipFile = new PclZip($file_path);
2089 2089
         // Check the zip content (real size and file extension).
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
                     break; // Exit the foreach loop.
2108 2108
                 } elseif (
2109 2109
                     preg_match('/aicc\//i', $thisContent['filename']) ||
2110
-                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst'))
2110
+                    in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst'))
2111 2111
                 ) {
2112 2112
                     $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION));
2113 2113
                     switch ($ext) {
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
             error_log('New LP - In learnpath::get_previous_index()', 0);
2150 2150
         }
2151 2151
         $index = $this->index;
2152
-        if (isset ($this->ordered_items[$index -1])) {
2152
+        if (isset ($this->ordered_items[$index - 1])) {
2153 2153
             $index--;
2154 2154
             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')) {
2155 2155
                 $index--;
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
             }
2160 2160
         } else {
2161 2161
             if ($this->debug > 2) {
2162
-                error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0);
2162
+                error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0);
2163 2163
             }
2164 2164
             // There is no previous item.
2165 2165
         }
@@ -2202,8 +2202,8 @@  discard block
 block discarded – undo
2202 2202
     {
2203 2203
         $course_id = api_get_course_int_id();
2204 2204
         $_course = api_get_course_info();
2205
-        $tbl_lp_item 		= Database :: get_course_table(TABLE_LP_ITEM);
2206
-        $tbl_lp_item_view 	= Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2205
+        $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
2206
+        $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
2207 2207
 
2208 2208
         // Getting all the information about the item.
2209 2209
         $sql = "SELECT * FROM ".$tbl_lp_item." as lp
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
                     lp.c_id = $course_id AND
2215 2215
                     lp_view.c_id = $course_id";
2216 2216
         $result = Database::query($sql);
2217
-        $row 	= Database::fetch_assoc($result);
2217
+        $row = Database::fetch_assoc($result);
2218 2218
         $output = '';
2219 2219
 
2220 2220
         if (!empty ($row['audio'])) {
@@ -2222,8 +2222,8 @@  discard block
 block discarded – undo
2222 2222
             $list = $_SESSION['oLP']->get_toc();
2223 2223
             $type_quiz = false;
2224 2224
 
2225
-            foreach($list as $toc) {
2226
-                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) {
2225
+            foreach ($list as $toc) {
2226
+                if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) {
2227 2227
                     $type_quiz = true;
2228 2228
                 }
2229 2229
             }
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
         $courseCode = null,
2287 2287
         $sessionId = null
2288 2288
     ) {
2289
-        $lp_id = (int)$lp_id;
2289
+        $lp_id = (int) $lp_id;
2290 2290
         $courseInfo = api_get_course_info($courseCode);
2291 2291
         $sessionId = intval($sessionId);
2292 2292
 
@@ -2452,10 +2452,10 @@  discard block
 block discarded – undo
2452 2452
      */
2453 2453
     public static function get_progress_bar($percentage = -1, $text_add = '')
2454 2454
     {
2455
-        $text = $percentage . $text_add;
2455
+        $text = $percentage.$text_add;
2456 2456
         $output = '<div class="progress">
2457
-                        <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.';">
2458
-                        '. $text .'
2457
+                        <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.';">
2458
+                        '. $text.'
2459 2459
                         </div>
2460 2460
                     </div>';
2461 2461
 
@@ -2491,16 +2491,16 @@  discard block
 block discarded – undo
2491 2491
         }
2492 2492
         $total_items = $this->get_total_items_count_without_chapters();
2493 2493
         if ($this->debug > 2) {
2494
-            error_log('New LP - Total items available in this learnpath: ' . $total_items, 0);
2494
+            error_log('New LP - Total items available in this learnpath: '.$total_items, 0);
2495 2495
         }
2496 2496
         $completeItems = $this->get_complete_items_count();
2497 2497
         if ($this->debug > 2) {
2498
-            error_log('New LP - Items completed so far: ' . $completeItems, 0);
2498
+            error_log('New LP - Items completed so far: '.$completeItems, 0);
2499 2499
         }
2500 2500
         if ($add != 0) {
2501 2501
             $completeItems += $add;
2502 2502
             if ($this->debug > 2) {
2503
-                error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0);
2503
+                error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0);
2504 2504
             }
2505 2505
         }
2506 2506
         $text = '';
@@ -2518,7 +2518,7 @@  discard block
 block discarded – undo
2518 2518
             $text = '%';
2519 2519
         } elseif ($mode == 'abs') {
2520 2520
             $percentage = $completeItems;
2521
-            $text = '/' . $total_items;
2521
+            $text = '/'.$total_items;
2522 2522
         }
2523 2523
 
2524 2524
         return array(
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
                 // and replace them, one by one, by the internal IDs (chamilo db)
2715 2715
                 // TODO: Modify the '*' replacement to replace the multiplier in front of it
2716 2716
                 // by a space as well.
2717
-                $find = array (
2717
+                $find = array(
2718 2718
                     '&',
2719 2719
                     '|',
2720 2720
                     '~',
@@ -2726,7 +2726,7 @@  discard block
 block discarded – undo
2726 2726
                     '(',
2727 2727
                     ')'
2728 2728
                 );
2729
-                $replace = array (
2729
+                $replace = array(
2730 2730
                     ' ',
2731 2731
                     ' ',
2732 2732
                     ' ',
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
                 foreach ($ids as $id) {
2744 2744
                     $id = trim($id);
2745 2745
                     if (isset ($this->refs_list[$id])) {
2746
-                        $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq);
2746
+                        $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq);
2747 2747
                     }
2748 2748
                 }
2749 2749
 
@@ -2851,9 +2851,9 @@  discard block
 block discarded – undo
2851 2851
         if ($this->debug > 0) {
2852 2852
             error_log('New LP - In learnpath::get_items_status_list()', 0);
2853 2853
         }
2854
-        $list = array ();
2854
+        $list = array();
2855 2855
         foreach ($this->ordered_items as $item_id) {
2856
-            $list[] = array (
2856
+            $list[] = array(
2857 2857
                 $item_id => $this->items[$item_id]->get_status()
2858 2858
             );
2859 2859
         }
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
         $res = Database::query($sql);
2908 2908
         $num = Database :: num_rows($res);
2909 2909
         if ($num > 0) {
2910
-            $list[] = array (
2910
+            $list[] = array(
2911 2911
                 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES),
2912 2912
                 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES),
2913 2913
                 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES),
@@ -2918,7 +2918,7 @@  discard block
 block discarded – undo
2918 2918
                 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES)
2919 2919
             );
2920 2920
             while ($row = Database :: fetch_array($res)) {
2921
-                $list[] = array (
2921
+                $list[] = array(
2922 2922
                     'order_id' => ($row['order_id'] + 1),
2923 2923
                     'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that
2924 2924
                     'type' => $row['interaction_type'],
@@ -2986,7 +2986,7 @@  discard block
 block discarded – undo
2986 2986
                 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES)
2987 2987
             );
2988 2988
             while ($row = Database :: fetch_array($res)) {
2989
-                $list[] = array (
2989
+                $list[] = array(
2990 2990
                     'order_id' => ($row['order_id'] + 1),
2991 2991
                     'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that.
2992 2992
                     'score_raw' => $row['score_raw'],
@@ -3013,10 +3013,10 @@  discard block
 block discarded – undo
3013 3013
         $toc = array();
3014 3014
         foreach ($this->ordered_items as $item_id) {
3015 3015
             if ($this->debug > 2) {
3016
-                error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0);
3016
+                error_log('learnpath::get_toc(): getting info for item '.$item_id, 0);
3017 3017
             }
3018 3018
             // TODO: Change this link generation and use new function instead.
3019
-            $toc[] = array (
3019
+            $toc[] = array(
3020 3020
                 'id'            => $item_id,
3021 3021
                 'title'         => $this->items[$item_id]->get_title(),
3022 3022
                 'status'        => $this->items[$item_id]->get_status(),
@@ -3027,7 +3027,7 @@  discard block
 block discarded – undo
3027 3027
             );
3028 3028
         }
3029 3029
         if ($this->debug > 2) {
3030
-            error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0);
3030
+            error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0);
3031 3031
         }
3032 3032
         return $toc;
3033 3033
     }
@@ -3044,10 +3044,10 @@  discard block
 block discarded – undo
3044 3044
         }
3045 3045
         $toc = $varname.' = new Array();';
3046 3046
         foreach ($this->ordered_items as $item_id) {
3047
-            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3047
+            $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
3048 3048
         }
3049 3049
         if ($this->debug > 2) {
3050
-            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
3050
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0);
3051 3051
         }
3052 3052
         return $toc;
3053 3053
     }
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
             }
3072 3072
         }
3073 3073
         if ($this->debug > 2) {
3074
-            error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0);
3074
+            error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0);
3075 3075
         }
3076 3076
         return $res;
3077 3077
     }
@@ -3087,7 +3087,7 @@  discard block
 block discarded – undo
3087 3087
         $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
3088 3088
         $lp_id = intval($lp_id);
3089 3089
         $sql = "SELECT lp_type FROM $tbl_lp
3090
-                WHERE c_id = $course_id AND id = '" . $lp_id . "'";
3090
+                WHERE c_id = $course_id AND id = '".$lp_id."'";
3091 3091
         $res = Database::query($sql);
3092 3092
         if ($res === false) {
3093 3093
             return null;
@@ -3179,7 +3179,7 @@  discard block
 block discarded – undo
3179 3179
 
3180 3180
         foreach ($toc_list as $item) {
3181 3181
             // TODO: Complete this
3182
-            $icon_name = array (
3182
+            $icon_name = array(
3183 3183
                 'not attempted' => '../img/notattempted.gif',
3184 3184
                 'incomplete'    => '../img/incomplete.png',
3185 3185
                 'failed'        => '../img/delete.png',
@@ -3191,7 +3191,7 @@  discard block
 block discarded – undo
3191 3191
 
3192 3192
             // Style Status
3193 3193
 
3194
-            $class_name = array (
3194
+            $class_name = array(
3195 3195
                 'not attempted' => 'scorm_not_attempted',
3196 3196
                 'incomplete'    => 'scorm_not_attempted',
3197 3197
                 'failed'        => 'scorm_failed',
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
             $dirTypes = self::getChapterTypes();
3212 3212
 
3213 3213
             if (in_array($item['type'], $dirTypes)) {
3214
-                $scorm_color_background ='scorm_item_section ';
3214
+                $scorm_color_background = 'scorm_item_section ';
3215 3215
                 $style_item = '';
3216 3216
             }
3217 3217
             if ($item['id'] == $this->current) {
@@ -3220,7 +3220,7 @@  discard block
 block discarded – undo
3220 3220
                 $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' ';
3221 3221
             }
3222 3222
 
3223
-            $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">';
3223
+            $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">';
3224 3224
 
3225 3225
             // Learning path title
3226 3226
             $title = $item['title'];
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
                 $html .= stripslashes($title);
3251 3251
             } else {
3252 3252
                 $this->get_link('http', $item['id'], $toc_list);
3253
-                $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>';
3253
+                $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>';
3254 3254
             }
3255 3255
             $html .= "</div>";
3256 3256
 
@@ -3284,12 +3284,12 @@  discard block
 block discarded – undo
3284 3284
             if ($this->get_lp_session_id() == api_get_session_id()) {
3285 3285
                 $html .= '<div id="actions_lp" class="actions_lp"><hr>';
3286 3286
                 $html .= '<div class="btn-group">';
3287
-                $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'>" .
3288
-                    Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>";
3289
-                $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'>" .
3290
-                    Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>";
3291
-                $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">' .
3292
-                    Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>';
3287
+                $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'>".
3288
+                    Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>";
3289
+                $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'>".
3290
+                    Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>";
3291
+                $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">'.
3292
+                    Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>';
3293 3293
                 $html .= '</div>';
3294 3294
                 $html .= '</div>';
3295 3295
             }
@@ -3340,11 +3340,11 @@  discard block
 block discarded – undo
3340 3340
         $course_id = $this->get_course_int_id();
3341 3341
 
3342 3342
         if ($this->debug > 0) {
3343
-            error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0);
3343
+            error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0);
3344 3344
         }
3345 3345
         if (empty($item_id)) {
3346 3346
             if ($this->debug > 2) {
3347
-                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0);
3347
+                error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0);
3348 3348
             }
3349 3349
             $item_id = $this->get_current_item_id();
3350 3350
         }
@@ -3376,7 +3376,7 @@  discard block
 block discarded – undo
3376 3376
                     ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id )
3377 3377
         		WHERE li.id = $item_id ";
3378 3378
         if ($this->debug > 2) {
3379
-            error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0);
3379
+            error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0);
3380 3380
         }
3381 3381
         $res = Database::query($sql);
3382 3382
         if (Database :: num_rows($res) > 0) {
@@ -3390,9 +3390,9 @@  discard block
 block discarded – undo
3390 3390
             if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) {
3391 3391
                 list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path);
3392 3392
             }
3393
-            $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path();
3393
+            $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path();
3394 3394
             if ($type == 'http') {
3395
-                $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path
3395
+                $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path
3396 3396
             } else {
3397 3397
                 $course_path = $sys_course_path; //system path
3398 3398
             }
@@ -3403,8 +3403,8 @@  discard block
 block discarded – undo
3403 3403
             }
3404 3404
 
3405 3405
             if ($this->debug > 2) {
3406
-                error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0);
3407
-                error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0);
3406
+                error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0);
3407
+                error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0);
3408 3408
             }
3409 3409
 
3410 3410
             // Now go through the specific cases to get the end of the path
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
                         );
3424 3424
 
3425 3425
                         if ($this->debug > 0) {
3426
-                            error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0);
3426
+                            error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0);
3427 3427
                         }
3428 3428
 
3429 3429
                         if ($lp_item_type == 'link') {
@@ -3443,7 +3443,7 @@  discard block
 block discarded – undo
3443 3443
                                     $linkProtocol = substr($file, 0, 5);
3444 3444
                                     if ($linkProtocol === 'http:') {
3445 3445
                                         //this is the special intervention case
3446
-                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' .  urlencode($file);
3446
+                                        $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file);
3447 3447
                                     }
3448 3448
                                 }
3449 3449
                             }
@@ -3483,8 +3483,8 @@  discard block
 block discarded – undo
3483 3483
                                 $sql = "SELECT count(*) FROM $lp_item_view_table
3484 3484
                                         WHERE
3485 3485
                                             c_id = $course_id AND
3486
-                                            lp_item_id='" . $lp_item_id . "' AND
3487
-                                            lp_view_id ='" . $lp_view_id . "' AND
3486
+                                            lp_item_id='".$lp_item_id."' AND
3487
+                                            lp_view_id ='" . $lp_view_id."' AND
3488 3488
                                             status='completed'";
3489 3489
                                 $result = Database::query($sql);
3490 3490
                                 $row_count = Database :: fetch_row($result);
@@ -3493,7 +3493,7 @@  discard block
 block discarded – undo
3493 3493
                                 if ($prevent_reinit === 1 && $count_item_view > 0) {
3494 3494
                                     $not_multiple_attempt = 1;
3495 3495
                                 }
3496
-                                $file .= '&not_multiple_attempt=' . $not_multiple_attempt;
3496
+                                $file .= '&not_multiple_attempt='.$not_multiple_attempt;
3497 3497
                             }
3498 3498
 
3499 3499
                             $tmp_array = explode('/', $file);
@@ -3506,7 +3506,7 @@  discard block
 block discarded – undo
3506 3506
                     break;
3507 3507
                 case 2 :
3508 3508
                     if ($this->debug > 2) {
3509
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3509
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3510 3510
                     }
3511 3511
 
3512 3512
                     if ($lp_item_type != 'dir') {
@@ -3520,19 +3520,19 @@  discard block
 block discarded – undo
3520 3520
                         //if ($this->prerequisites_match($item_id)) {
3521 3521
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3522 3522
                             if ($this->debug > 2) {
3523
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3523
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3524 3524
                             }
3525 3525
                             // Distant url, return as is.
3526 3526
                             $file = $lp_item_path;
3527 3527
                         } else {
3528 3528
                             if ($this->debug > 2) {
3529
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3529
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3530 3530
                             }
3531 3531
                             // Prevent getting untranslatable urls.
3532 3532
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3533 3533
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3534 3534
                             // Prepare the path.
3535
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3535
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3536 3536
                             // TODO: Fix this for urls with protocol header.
3537 3537
                             $file = str_replace('//', '/', $file);
3538 3538
                             $file = str_replace(':/', '://', $file);
@@ -3540,11 +3540,11 @@  discard block
 block discarded – undo
3540 3540
                                 $lp_path = substr($lp_path, 0, -1);
3541 3541
                             }
3542 3542
 
3543
-                            if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) {
3543
+                            if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) {
3544 3544
                                 // if file not found.
3545 3545
                                 $decoded = html_entity_decode($lp_item_path);
3546 3546
                                 list ($decoded) = explode('?', $decoded);
3547
-                                if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) {
3547
+                                if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) {
3548 3548
                                     require_once 'resourcelinker.inc.php';
3549 3549
                                     $file = rl_get_resource_link_for_learnpath(
3550 3550
                                         $course_id,
@@ -3564,14 +3564,14 @@  discard block
 block discarded – undo
3564 3564
                                         }
3565 3565
                                     }
3566 3566
                                 } else {
3567
-                                    $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded;
3567
+                                    $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded;
3568 3568
                                 }
3569 3569
                             }
3570 3570
                         }
3571 3571
 
3572 3572
                         // We want to use parameters if they were defined in the imsmanifest
3573 3573
                         if (strpos($file, 'blank.php') === false) {
3574
-                            $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params;
3574
+                            $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params;
3575 3575
                         }
3576 3576
                     } else {
3577 3577
                         $file = 'lp_content.php?type=dir';
@@ -3579,12 +3579,12 @@  discard block
 block discarded – undo
3579 3579
                     break;
3580 3580
                 case 3 :
3581 3581
                     if ($this->debug > 2) {
3582
-                        error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0);
3582
+                        error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0);
3583 3583
                     }
3584 3584
                     // Formatting AICC HACP append URL.
3585
-                    $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&';
3585
+                    $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&';
3586 3586
                     if (!empty($lp_item_params)) {
3587
-                        $aicc_append .= $lp_item_params . '&';
3587
+                        $aicc_append .= $lp_item_params.'&';
3588 3588
                     }
3589 3589
                     if ($lp_item_type != 'dir') {
3590 3590
                         // Quite complex here:
@@ -3596,7 +3596,7 @@  discard block
 block discarded – undo
3596 3596
 
3597 3597
                         if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) {
3598 3598
                             if ($this->debug > 2) {
3599
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0);
3599
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0);
3600 3600
                             }
3601 3601
                             // Distant url, return as is.
3602 3602
                             $file = $lp_item_path;
@@ -3609,19 +3609,19 @@  discard block
 block discarded – undo
3609 3609
                             if (stripos($file, '<servername>') !== false) {
3610 3610
                                 //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path);
3611 3611
                                 $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path));
3612
-                                $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path);
3612
+                                $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path);
3613 3613
                             }
3614 3614
                             //
3615 3615
                             $file .= $aicc_append;
3616 3616
                         } else {
3617 3617
                             if ($this->debug > 2) {
3618
-                                error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0);
3618
+                                error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0);
3619 3619
                             }
3620 3620
                             // Prevent getting untranslatable urls.
3621 3621
                             $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path);
3622 3622
                             $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path);
3623 3623
                             // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name.
3624
-                            $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path;
3624
+                            $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path;
3625 3625
                             // TODO: Fix this for urls with protocol header.
3626 3626
                             $file = str_replace('//', '/', $file);
3627 3627
                             $file = str_replace(':/', '://', $file);
@@ -3640,7 +3640,7 @@  discard block
 block discarded – undo
3640 3640
             $file = !empty($file) ? str_replace('&amp;', '&', $file) : '';
3641 3641
         }
3642 3642
         if ($this->debug > 2) {
3643
-            error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0);
3643
+            error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0);
3644 3644
         }
3645 3645
         return $file;
3646 3646
     }
@@ -3658,7 +3658,7 @@  discard block
 block discarded – undo
3658 3658
         $search = '';
3659 3659
         // Use $attempt_num to enable multi-views management (disabled so far).
3660 3660
         if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) {
3661
-            $search = 'AND view_count = ' . $attempt_num;
3661
+            $search = 'AND view_count = '.$attempt_num;
3662 3662
         }
3663 3663
         // When missing $attempt_num, search for a unique lp_view record for this lp and user.
3664 3664
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
@@ -3668,9 +3668,9 @@  discard block
 block discarded – undo
3668 3668
 
3669 3669
         $sql = "SELECT id, view_count FROM $lp_view_table
3670 3670
         		WHERE
3671
-        		    c_id = " . $course_id . " AND
3672
-        		    lp_id = " . $this->get_id() . " AND
3673
-        		    user_id = " . $this->get_user_id() . " AND
3671
+        		    c_id = ".$course_id." AND
3672
+        		    lp_id = " . $this->get_id()." AND
3673
+        		    user_id = " . $this->get_user_id()." AND
3674 3674
         		    session_id = $sessionId
3675 3675
         		    $search
3676 3676
                 ORDER BY view_count DESC";
@@ -3681,7 +3681,7 @@  discard block
 block discarded – undo
3681 3681
         } else if (!api_is_invitee()) {
3682 3682
             // There is no database record, create one.
3683 3683
             $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES
3684
-            		($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)";
3684
+            		($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)";
3685 3685
             Database::query($sql);
3686 3686
             $id = Database :: insert_id();
3687 3687
             $this->lp_view_id = $id;
@@ -3781,15 +3781,15 @@  discard block
 block discarded – undo
3781 3781
     {
3782 3782
         $course_id = api_get_course_int_id();
3783 3783
         if ($this->debug > 0) {
3784
-            error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0);
3784
+            error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0);
3785 3785
         }
3786 3786
         if (empty($id) || empty($direction)) {
3787 3787
             return false;
3788 3788
         }
3789 3789
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
3790 3790
         $sql_sel = "SELECT *
3791
-                    FROM " . $tbl_lp_item . "
3792
-                    WHERE c_id = ".$course_id." AND id = " . $id;
3791
+                    FROM " . $tbl_lp_item."
3792
+                    WHERE c_id = ".$course_id." AND id = ".$id;
3793 3793
         $res_sel = Database::query($sql_sel);
3794 3794
         // Check if elem exists.
3795 3795
         if (Database :: num_rows($res_sel) < 1) {
@@ -3814,7 +3814,7 @@  discard block
 block discarded – undo
3814 3814
                                  WHERE c_id = ".$course_id." AND id = $previous";
3815 3815
 
3816 3816
                     if ($this->debug > 2) {
3817
-                        error_log('Selecting previous: ' . $sql_sel2, 0);
3817
+                        error_log('Selecting previous: '.$sql_sel2, 0);
3818 3818
                     }
3819 3819
                     $res_sel2 = Database::query($sql_sel2);
3820 3820
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3867,7 +3867,7 @@  discard block
 block discarded – undo
3867 3867
                         }
3868 3868
                         Database::query($sql_upd2);
3869 3869
                     }
3870
-                    $display = $display -1;
3870
+                    $display = $display - 1;
3871 3871
                 }
3872 3872
                 break;
3873 3873
             case 'down':
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
                 } else {
3879 3879
                     $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next";
3880 3880
                     if ($this->debug > 2) {
3881
-                        error_log('Selecting next: ' . $sql_sel2, 0);
3881
+                        error_log('Selecting next: '.$sql_sel2, 0);
3882 3882
                     }
3883 3883
                     $res_sel2 = Database::query($sql_sel2);
3884 3884
                     if (Database :: num_rows($res_sel2) < 1) {
@@ -3916,7 +3916,7 @@  discard block
 block discarded – undo
3916 3916
                                      WHERE c_id = ".$course_id." AND id = $next_next";
3917 3917
                         Database::query($sql_upd2);
3918 3918
                     }
3919
-                    $display = $display +1;
3919
+                    $display = $display + 1;
3920 3920
                 }
3921 3921
                 break;
3922 3922
             default :
@@ -3939,8 +3939,8 @@  discard block
 block discarded – undo
3939 3939
         $res = Database::query($sql);
3940 3940
         if ($res === false)
3941 3941
             return false;
3942
-        $lps = array ();
3943
-        $lp_order = array ();
3942
+        $lps = array();
3943
+        $lp_order = array();
3944 3944
         $num = Database :: num_rows($res);
3945 3945
         // First check the order is correct, globally (might be wrong because
3946 3946
         // of versions < 1.8.4)
@@ -3950,7 +3950,7 @@  discard block
 block discarded – undo
3950 3950
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
3951 3951
                     $need_fix = true;
3952 3952
                     $sql_u = "UPDATE $lp_table SET display_order = $i
3953
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
3953
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
3954 3954
                     Database::query($sql_u);
3955 3955
                 }
3956 3956
                 $row['display_order'] = $i;
@@ -3963,10 +3963,10 @@  discard block
 block discarded – undo
3963 3963
             $order = $lps[$lp_id]['display_order'];
3964 3964
             if ($order > 1) { // If it's the first element, no need to move up.
3965 3965
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
3966
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1];
3966
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1];
3967 3967
                 Database::query($sql_u1);
3968
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . "
3969
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
3968
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)."
3969
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
3970 3970
                 Database::query($sql_u2);
3971 3971
             }
3972 3972
         }
@@ -3987,8 +3987,8 @@  discard block
 block discarded – undo
3987 3987
         if ($res === false) {
3988 3988
             return false;
3989 3989
         }
3990
-        $lps = array ();
3991
-        $lp_order = array ();
3990
+        $lps = array();
3991
+        $lp_order = array();
3992 3992
         $num = Database :: num_rows($res);
3993 3993
         $max = 0;
3994 3994
         // First check the order is correct, globally (might be wrong because
@@ -4000,7 +4000,7 @@  discard block
 block discarded – undo
4000 4000
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
4001 4001
                     $need_fix = true;
4002 4002
                     $sql_u = "UPDATE $lp_table SET display_order = $i
4003
-                              WHERE c_id = ".$course_id." AND id = " . $row['id'];
4003
+                              WHERE c_id = ".$course_id." AND id = ".$row['id'];
4004 4004
                     Database::query($sql_u);
4005 4005
                 }
4006 4006
                 $row['display_order'] = $i;
@@ -4013,10 +4013,10 @@  discard block
 block discarded – undo
4013 4013
             $order = $lps[$lp_id]['display_order'];
4014 4014
             if ($order < $max) { // If it's the first element, no need to move up.
4015 4015
                 $sql_u1 = "UPDATE $lp_table SET display_order = $order
4016
-                           WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1];
4016
+                           WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1];
4017 4017
                 Database::query($sql_u1);
4018
-                $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . "
4019
-                           WHERE c_id = ".$course_id." AND id = " . $lp_id;
4018
+                $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)."
4019
+                           WHERE c_id = ".$course_id." AND id = ".$lp_id;
4020 4020
                 Database::query($sql_u2);
4021 4021
             }
4022 4022
         }
@@ -4036,15 +4036,15 @@  discard block
 block discarded – undo
4036 4036
         $this->autocomplete_parents($this->last);
4037 4037
         $new_index = $this->get_next_index();
4038 4038
         if ($this->debug > 2) {
4039
-            error_log('New LP - New index: ' . $new_index, 0);
4039
+            error_log('New LP - New index: '.$new_index, 0);
4040 4040
         }
4041 4041
         $this->index = $new_index;
4042 4042
         if ($this->debug > 2) {
4043
-            error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0);
4043
+            error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0);
4044 4044
         }
4045 4045
         $this->current = $this->ordered_items[$new_index];
4046 4046
         if ($this->debug > 2) {
4047
-            error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0);
4047
+            error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0);
4048 4048
         }
4049 4049
     }
4050 4050
 
@@ -4108,7 +4108,7 @@  discard block
 block discarded – undo
4108 4108
             // Clean spaces.
4109 4109
             $prereq_string = str_replace(' ', '', $prereq_string);
4110 4110
             if ($debug > 0) {
4111
-                error_log('Found prereq_string: ' . $prereq_string, 0);
4111
+                error_log('Found prereq_string: '.$prereq_string, 0);
4112 4112
             }
4113 4113
             // Now send to the parse_prereq() function that will check this component's prerequisites.
4114 4114
             $result = $currentItem->parse_prereq(
@@ -4124,12 +4124,12 @@  discard block
 block discarded – undo
4124 4124
         } else {
4125 4125
             $result = true;
4126 4126
             if ($debug > 1) {
4127
-                error_log('$this->items[' . $itemId . '] was not an object', 0);
4127
+                error_log('$this->items['.$itemId.'] was not an object', 0);
4128 4128
             }
4129 4129
         }
4130 4130
 
4131 4131
         if ($debug > 1) {
4132
-            error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0);
4132
+            error_log('End of prerequisites_match(). Error message is now '.$this->error, 0);
4133 4133
         }
4134 4134
         return $result;
4135 4135
     }
@@ -4195,12 +4195,12 @@  discard block
 block discarded – undo
4195 4195
             $row = Database :: fetch_array($result);
4196 4196
             $name = domesticate($row['name']);
4197 4197
             if ($set_visibility == 'i') {
4198
-                $s = $name . " " . get_lang('LearnpathNotPublished');
4198
+                $s = $name." ".get_lang('LearnpathNotPublished');
4199 4199
                 $dialogBox = $s;
4200 4200
                 $v = 0;
4201 4201
             }
4202 4202
             if ($set_visibility == 'v') {
4203
-                $s = $name . " " . get_lang('LearnpathPublished');
4203
+                $s = $name." ".get_lang('LearnpathPublished');
4204 4204
                 $dialogBox = $s;
4205 4205
                 $v = 1;
4206 4206
             }
@@ -4283,9 +4283,9 @@  discard block
 block discarded – undo
4283 4283
         $course_id = api_get_course_int_id();
4284 4284
         $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW);
4285 4285
         $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id)
4286
-                VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)";
4286
+                VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)";
4287 4287
         if ($this->debug > 2) {
4288
-            error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0);
4288
+            error_log('New LP - Inserting new lp_view for restart: '.$sql, 0);
4289 4289
         }
4290 4290
         $res = Database::query($sql);
4291 4291
         $view_id = Database::insert_id();
@@ -4323,10 +4323,10 @@  discard block
 block discarded – undo
4323 4323
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4324 4324
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
4325 4325
         if ($this->debug > 2) {
4326
-            error_log('New LP - save_current() saving item ' . $this->current, 0);
4326
+            error_log('New LP - save_current() saving item '.$this->current, 0);
4327 4327
         }
4328 4328
         if ($this->debug > 2) {
4329
-            error_log('' . print_r($this->items, true), 0);
4329
+            error_log(''.print_r($this->items, true), 0);
4330 4330
         }
4331 4331
         if (isset($this->items[$this->current]) &&
4332 4332
             is_object($this->items[$this->current])
@@ -4350,7 +4350,7 @@  discard block
 block discarded – undo
4350 4350
     {
4351 4351
         $debug = $this->debug;
4352 4352
         if ($debug) {
4353
-            error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0);
4353
+            error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0);
4354 4354
         }
4355 4355
         // TODO: Do a better check on the index pointing to the right item (it is supposed to be working
4356 4356
         // on $ordered_items[] but not sure it's always safe to use with $items[]).
@@ -4373,7 +4373,7 @@  discard block
 block discarded – undo
4373 4373
 
4374 4374
             if ($debug) {
4375 4375
                 error_log('update_queue before:');
4376
-                error_log(print_r($this->update_queue,1));
4376
+                error_log(print_r($this->update_queue, 1));
4377 4377
             }
4378 4378
             $this->autocomplete_parents($item_id);
4379 4379
 
@@ -4381,9 +4381,9 @@  discard block
 block discarded – undo
4381 4381
             $this->update_queue[$item_id] = $status;
4382 4382
 
4383 4383
             if ($debug) {
4384
-                error_log('get_status(): ' . $status);
4384
+                error_log('get_status(): '.$status);
4385 4385
                 error_log('update_queue after:');
4386
-                error_log(print_r($this->update_queue,1));
4386
+                error_log(print_r($this->update_queue, 1));
4387 4387
             }
4388 4388
             return $res;
4389 4389
         }
@@ -4404,17 +4404,17 @@  discard block
 block discarded – undo
4404 4404
 
4405 4405
         if (isset($this->current) && !api_is_invitee()) {
4406 4406
             if ($this->debug > 2) {
4407
-                error_log('New LP - Saving current item (' . $this->current . ') for later review', 0);
4407
+                error_log('New LP - Saving current item ('.$this->current.') for later review', 0);
4408 4408
             }
4409 4409
             $sql = "UPDATE $table SET
4410
-                        last_item = " . intval($this->get_current_item_id()). "
4410
+                        last_item = ".intval($this->get_current_item_id())."
4411 4411
                     WHERE
4412 4412
                         c_id = $course_id AND
4413
-                        lp_id = " . $this->get_id() . " AND
4413
+                        lp_id = ".$this->get_id()." AND
4414 4414
                         user_id = " . $this->get_user_id()." ".$session_condition;
4415 4415
 
4416 4416
             if ($this->debug > 2) {
4417
-                error_log('New LP - Saving last item seen : ' . $sql, 0);
4417
+                error_log('New LP - Saving last item seen : '.$sql, 0);
4418 4418
             }
4419 4419
             Database::query($sql);
4420 4420
         }
@@ -4428,7 +4428,7 @@  discard block
 block discarded – undo
4428 4428
                             progress = $progress
4429 4429
                         WHERE
4430 4430
                             c_id = ".$course_id." AND
4431
-                            lp_id = " . $this->get_id() . " AND
4431
+                            lp_id = " . $this->get_id()." AND
4432 4432
                             user_id = " . $this->get_user_id()." ".$session_condition;
4433 4433
                 // Ignore errors as some tables might not have the progress field just yet.
4434 4434
                 Database::query($sql);
@@ -4444,7 +4444,7 @@  discard block
 block discarded – undo
4444 4444
     public function set_current_item($item_id = null)
4445 4445
     {
4446 4446
         if ($this->debug > 0) {
4447
-            error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0);
4447
+            error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0);
4448 4448
         }
4449 4449
         if (empty ($item_id)) {
4450 4450
             if ($this->debug > 2) {
@@ -4453,7 +4453,7 @@  discard block
 block discarded – undo
4453 4453
             // Do nothing.
4454 4454
         } else {
4455 4455
             if ($this->debug > 2) {
4456
-                error_log('New LP - New current item given is ' . $item_id . '...', 0);
4456
+                error_log('New LP - New current item given is '.$item_id.'...', 0);
4457 4457
             }
4458 4458
             if (is_numeric($item_id)) {
4459 4459
                 $item_id = intval($item_id);
@@ -4468,10 +4468,10 @@  discard block
 block discarded – undo
4468 4468
                     }
4469 4469
                 }
4470 4470
                 if ($this->debug > 2) {
4471
-                    error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0);
4471
+                    error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0);
4472 4472
                 }
4473 4473
             } else {
4474
-                error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0);
4474
+                error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0);
4475 4475
             }
4476 4476
         }
4477 4477
     }
@@ -4496,7 +4496,7 @@  discard block
 block discarded – undo
4496 4496
             $lp = $this->get_id();
4497 4497
             if ($lp != 0) {
4498 4498
                 $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4499
-                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp;
4499
+                $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp;
4500 4500
                 $res = Database::query($sql);
4501 4501
                 return $res;
4502 4502
             }
@@ -4520,7 +4520,7 @@  discard block
 block discarded – undo
4520 4520
 
4521 4521
         if ($lp != 0) {
4522 4522
             $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN);
4523
-            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp;
4523
+            $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp;
4524 4524
             $res = Database::query($sql);
4525 4525
             return $res;
4526 4526
         } else {
@@ -4545,10 +4545,10 @@  discard block
 block discarded – undo
4545 4545
         $course_id = api_get_course_int_id();
4546 4546
         $lp_id = $this->get_id();
4547 4547
         $sql = "UPDATE $lp_table SET
4548
-                content_maker = '" . Database::escape_string($this->maker) . "'
4548
+                content_maker = '".Database::escape_string($this->maker)."'
4549 4549
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4550 4550
         if ($this->debug > 2) {
4551
-            error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0);
4551
+            error_log('New LP - lp updated with new content_maker : '.$this->maker, 0);
4552 4552
         }
4553 4553
         Database::query($sql);
4554 4554
         return true;
@@ -4572,10 +4572,10 @@  discard block
 block discarded – undo
4572 4572
         $lp_id = $this->get_id();
4573 4573
         $course_id = $this->course_info['real_id'];
4574 4574
         $sql = "UPDATE $lp_table SET
4575
-                name = '" . Database::escape_string($this->name). "'
4575
+                name = '".Database::escape_string($this->name)."'
4576 4576
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4577 4577
         if ($this->debug > 2) {
4578
-            error_log('New LP - lp updated with new name : ' . $this->name, 0);
4578
+            error_log('New LP - lp updated with new name : '.$this->name, 0);
4579 4579
         }
4580 4580
         $result = Database::query($sql);
4581 4581
         // If the lp is visible on the homepage, change his name there.
@@ -4583,7 +4583,7 @@  discard block
 block discarded – undo
4583 4583
             $session_id = api_get_session_id();
4584 4584
             $session_condition = api_get_session_condition($session_id);
4585 4585
             $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
4586
-            $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
4586
+            $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id;
4587 4587
             $sql = "UPDATE $tbl_tool SET name = '$this->name'
4588 4588
             	    WHERE
4589 4589
             	        c_id = $course_id AND
@@ -4661,10 +4661,10 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
                 // Save it to search engine.
4663 4663
                 foreach ($missing_terms as $term) {
4664
-                    $doc->add_term($prefix . $term, 1);
4664
+                    $doc->add_term($prefix.$term, 1);
4665 4665
                 }
4666 4666
                 foreach ($deprecated_terms as $term) {
4667
-                    $doc->remove_term($prefix . $term);
4667
+                    $doc->remove_term($prefix.$term);
4668 4668
                 }
4669 4669
                 $di->getDb()->replace_document((int) $se_ref['search_did'], $doc);
4670 4670
                 $di->getDb()->flush();
@@ -4689,10 +4689,10 @@  discard block
 block discarded – undo
4689 4689
         $this->theme = $name;
4690 4690
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4691 4691
         $lp_id = $this->get_id();
4692
-        $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "'
4692
+        $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."'
4693 4693
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4694 4694
         if ($this->debug > 2) {
4695
-            error_log('New LP - lp updated with new theme : ' . $this->theme, 0);
4695
+            error_log('New LP - lp updated with new theme : '.$this->theme, 0);
4696 4696
         }
4697 4697
         Database::query($sql);
4698 4698
 
@@ -4715,10 +4715,10 @@  discard block
 block discarded – undo
4715 4715
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4716 4716
         $lp_id = $this->get_id();
4717 4717
         $sql = "UPDATE $lp_table SET
4718
-                preview_image = '" . Database::escape_string($this->preview_image). "'
4718
+                preview_image = '".Database::escape_string($this->preview_image)."'
4719 4719
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4720 4720
         if ($this->debug > 2) {
4721
-            error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0);
4721
+            error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0);
4722 4722
         }
4723 4723
         Database::query($sql);
4724 4724
         return true;
@@ -4738,10 +4738,10 @@  discard block
 block discarded – undo
4738 4738
         $this->author = $name;
4739 4739
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4740 4740
         $lp_id = $this->get_id();
4741
-        $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "'
4741
+        $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."'
4742 4742
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4743 4743
         if ($this->debug > 2) {
4744
-            error_log('New LP - lp updated with new preview author : ' . $this->author, 0);
4744
+            error_log('New LP - lp updated with new preview author : '.$this->author, 0);
4745 4745
         }
4746 4746
         Database::query($sql);
4747 4747
 
@@ -4759,15 +4759,15 @@  discard block
 block discarded – undo
4759 4759
         if ($this->debug > 0) {
4760 4760
             error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
4761 4761
         }
4762
-        if (intval($hide) == $hide){
4762
+        if (intval($hide) == $hide) {
4763 4763
             $this->hide_toc_frame = $hide;
4764 4764
             $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4765 4765
             $lp_id = $this->get_id();
4766 4766
             $sql = "UPDATE $lp_table SET
4767
-                    hide_toc_frame = '" . $this->hide_toc_frame . "'
4767
+                    hide_toc_frame = '".$this->hide_toc_frame."'
4768 4768
                     WHERE c_id = ".$course_id." AND id = '$lp_id'";
4769 4769
             if ($this->debug > 2) {
4770
-                error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
4770
+                error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0);
4771 4771
             }
4772 4772
             Database::query($sql);
4773 4773
 
@@ -4794,7 +4794,7 @@  discard block
 block discarded – undo
4794 4794
         $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."'
4795 4795
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4796 4796
         if ($this->debug > 2) {
4797
-            error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0);
4797
+            error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0);
4798 4798
         }
4799 4799
         Database::query($sql);
4800 4800
         return true;
@@ -4818,10 +4818,10 @@  discard block
 block discarded – undo
4818 4818
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4819 4819
         $lp_id = $this->get_id();
4820 4820
         $sql = "UPDATE $lp_table SET
4821
-                    content_local = '" . Database::escape_string($name) . "'
4821
+                    content_local = '".Database::escape_string($name)."'
4822 4822
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4823 4823
         if ($this->debug > 2) {
4824
-            error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0);
4824
+            error_log('New LP - lp updated with new proximity : '.$this->proximity, 0);
4825 4825
         }
4826 4826
         Database::query($sql);
4827 4827
         return true;
@@ -4855,11 +4855,11 @@  discard block
 block discarded – undo
4855 4855
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4856 4856
         $lp_id = $this->get_id();
4857 4857
         $sql = "UPDATE $lp_table SET
4858
-                    use_max_score = '" . $this->use_max_score . "'
4858
+                    use_max_score = '".$this->use_max_score."'
4859 4859
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4860 4860
 
4861 4861
         if ($this->debug > 2) {
4862
-            error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0);
4862
+            error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0);
4863 4863
         }
4864 4864
         Database::query($sql);
4865 4865
 
@@ -4886,10 +4886,10 @@  discard block
 block discarded – undo
4886 4886
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4887 4887
         $lp_id = $this->get_id();
4888 4888
         $sql = "UPDATE $lp_table SET
4889
-                expired_on = '" . Database::escape_string($this->expired_on) . "'
4889
+                expired_on = '".Database::escape_string($this->expired_on)."'
4890 4890
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4891 4891
         if ($this->debug > 2) {
4892
-            error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0);
4892
+            error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0);
4893 4893
         }
4894 4894
         Database::query($sql);
4895 4895
 
@@ -4915,10 +4915,10 @@  discard block
 block discarded – undo
4915 4915
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4916 4916
         $lp_id = $this->get_id();
4917 4917
         $sql = "UPDATE $lp_table SET
4918
-                publicated_on = '" . Database::escape_string($this->publicated_on) . "'
4918
+                publicated_on = '".Database::escape_string($this->publicated_on)."'
4919 4919
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4920 4920
         if ($this->debug > 2) {
4921
-            error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0);
4921
+            error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0);
4922 4922
         }
4923 4923
         Database::query($sql);
4924 4924
 
@@ -4938,10 +4938,10 @@  discard block
 block discarded – undo
4938 4938
         $this->modified_on = api_get_utc_datetime();
4939 4939
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
4940 4940
         $lp_id = $this->get_id();
4941
-        $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "'
4941
+        $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."'
4942 4942
                 WHERE c_id = ".$course_id." AND id = '$lp_id'";
4943 4943
         if ($this->debug > 2) {
4944
-            error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0);
4944
+            error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0);
4945 4945
         }
4946 4946
         Database::query($sql);
4947 4947
         return true;
@@ -5012,13 +5012,13 @@  discard block
 block discarded – undo
5012 5012
 
5013 5013
         if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) {
5014 5014
             if ($this->debug > 2) {
5015
-                error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0);
5015
+                error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0);
5016 5016
             }
5017 5017
             switch ($this->get_type()) {
5018 5018
                 case '3' :
5019 5019
                     if ($this->items[$this->last]->get_type() != 'au') {
5020 5020
                         if ($this->debug > 2) {
5021
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0);
5021
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0);
5022 5022
                         }
5023 5023
                         $this->items[$this->last]->close();
5024 5024
                         //$this->autocomplete_parents($this->last);
@@ -5031,7 +5031,7 @@  discard block
 block discarded – undo
5031 5031
                 case '2' :
5032 5032
                     if ($this->items[$this->last]->get_type() != 'sco') {
5033 5033
                         if ($this->debug > 2) {
5034
-                            error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0);
5034
+                            error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0);
5035 5035
                         }
5036 5036
                         $this->items[$this->last]->close();
5037 5037
                         //$this->autocomplete_parents($this->last);
@@ -5045,7 +5045,7 @@  discard block
 block discarded – undo
5045 5045
                 case '1' :
5046 5046
                 default :
5047 5047
                     if ($this->debug > 2) {
5048
-                        error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0);
5048
+                        error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0);
5049 5049
                     }
5050 5050
                     $this->items[$this->last]->close();
5051 5051
                     break;
@@ -5071,7 +5071,7 @@  discard block
 block discarded – undo
5071 5071
         }
5072 5072
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5073 5073
         $sql = "SELECT * FROM $lp_table
5074
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5074
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5075 5075
         $res = Database::query($sql);
5076 5076
         if (Database :: num_rows($res) > 0) {
5077 5077
             $row = Database :: fetch_array($res);
@@ -5092,14 +5092,14 @@  discard block
 block discarded – undo
5092 5092
                     break;
5093 5093
             }
5094 5094
             $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode'
5095
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5095
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5096 5096
             Database::query($sql);
5097 5097
             $this->mode = $view_mode;
5098 5098
 
5099 5099
             return $view_mode;
5100 5100
         } else {
5101 5101
             if ($this->debug > 2) {
5102
-                error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0);
5102
+                error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0);
5103 5103
             }
5104 5104
         }
5105 5105
         return -1;
@@ -5117,7 +5117,7 @@  discard block
 block discarded – undo
5117 5117
         }
5118 5118
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5119 5119
         $sql = "SELECT * FROM $lp_table
5120
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5120
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5121 5121
         $res = Database::query($sql);
5122 5122
         if (Database :: num_rows($res) > 0) {
5123 5123
             $row = Database :: fetch_array($res);
@@ -5130,14 +5130,14 @@  discard block
 block discarded – undo
5130 5130
                 $force_return = true;
5131 5131
             }
5132 5132
             $sql = "UPDATE $lp_table SET force_commit = $force
5133
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5133
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5134 5134
             Database::query($sql);
5135 5135
             $this->force_commit = $force_return;
5136 5136
 
5137 5137
             return $force_return;
5138 5138
         } else {
5139 5139
             if ($this->debug > 2) {
5140
-                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5140
+                error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0);
5141 5141
             }
5142 5142
         }
5143 5143
         return -1;
@@ -5166,7 +5166,7 @@  discard block
 block discarded – undo
5166 5166
                 if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it.
5167 5167
                     $need_fix = true;
5168 5168
                     $sql = "UPDATE $lp_table SET display_order = $i
5169
-                            WHERE c_id = ".$course_id." AND id = " . $row['id'];
5169
+                            WHERE c_id = ".$course_id." AND id = ".$row['id'];
5170 5170
                     Database::query($sql);
5171 5171
                 }
5172 5172
                 $i++;
@@ -5187,7 +5187,7 @@  discard block
 block discarded – undo
5187 5187
         }
5188 5188
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5189 5189
         $sql = "SELECT * FROM $lp_table
5190
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5190
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5191 5191
         $res = Database::query($sql);
5192 5192
         if (Database :: num_rows($res) > 0) {
5193 5193
             $row = Database :: fetch_array($res);
@@ -5198,13 +5198,13 @@  discard block
 block discarded – undo
5198 5198
                 $force = 1;
5199 5199
             }
5200 5200
             $sql = "UPDATE $lp_table SET prevent_reinit = $force
5201
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5201
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5202 5202
             Database::query($sql);
5203 5203
             $this->prevent_reinit = $force;
5204 5204
             return $force;
5205 5205
         } else {
5206 5206
             if ($this->debug > 2) {
5207
-                error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0);
5207
+                error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0);
5208 5208
             }
5209 5209
         }
5210 5210
         return -1;
@@ -5220,11 +5220,11 @@  discard block
 block discarded – undo
5220 5220
     {
5221 5221
         //Set default value for seriousgame_mode
5222 5222
         if (!isset($this->seriousgame_mode)) {
5223
-            $this->seriousgame_mode=0;
5223
+            $this->seriousgame_mode = 0;
5224 5224
         }
5225 5225
         // Set default value for prevent_reinit
5226 5226
         if (!isset($this->prevent_reinit)) {
5227
-            $this->prevent_reinit =1;
5227
+            $this->prevent_reinit = 1;
5228 5228
         }
5229 5229
         if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) {
5230 5230
             return 'seriousgame';
@@ -5272,7 +5272,7 @@  discard block
 block discarded – undo
5272 5272
         $sql = "UPDATE $lp_table SET
5273 5273
                 prevent_reinit = $prevent_reinit ,
5274 5274
                 seriousgame_mode = $sg_mode
5275
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5275
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5276 5276
         $res = Database::query($sql);
5277 5277
         if ($res) {
5278 5278
             return true;
@@ -5324,7 +5324,7 @@  discard block
 block discarded – undo
5324 5324
             error_log('New LP - In learnpath::set_seriousgame_mode()', 0);
5325 5325
         }
5326 5326
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5327
-        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5327
+        $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5328 5328
         $res = Database::query($sql);
5329 5329
         if (Database :: num_rows($res) > 0) {
5330 5330
             $row = Database :: fetch_array($res);
@@ -5335,13 +5335,13 @@  discard block
 block discarded – undo
5335 5335
                 $force = 1;
5336 5336
             }
5337 5337
             $sql = "UPDATE $lp_table SET seriousgame_mode = $force
5338
-			        WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5338
+			        WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5339 5339
             Database::query($sql);
5340 5340
             $this->seriousgame_mode = $force;
5341 5341
             return $force;
5342 5342
         } else {
5343 5343
             if ($this->debug > 2) {
5344
-                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0);
5344
+                error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0);
5345 5345
             }
5346 5346
         }
5347 5347
         return -1;
@@ -5359,7 +5359,7 @@  discard block
 block discarded – undo
5359 5359
         }
5360 5360
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
5361 5361
         $sql = "SELECT * FROM $lp_table
5362
-                WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5362
+                WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5363 5363
         $res = Database::query($sql);
5364 5364
         if (Database :: num_rows($res) > 0) {
5365 5365
             $row = Database :: fetch_array($res);
@@ -5370,13 +5370,13 @@  discard block
 block discarded – undo
5370 5370
                 $force = 1;
5371 5371
             }
5372 5372
             $sql = "UPDATE $lp_table SET debug = $force
5373
-                    WHERE c_id = ".$course_id." AND id = " . $this->get_id();
5373
+                    WHERE c_id = ".$course_id." AND id = ".$this->get_id();
5374 5374
             $res = Database::query($sql);
5375 5375
             $this->scorm_debug = $force;
5376 5376
             return $force;
5377 5377
         } else {
5378 5378
             if ($this->debug > 2) {
5379
-                error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0);
5379
+                error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0);
5380 5380
             }
5381 5381
         }
5382 5382
         return -1;
@@ -5405,7 +5405,7 @@  discard block
 block discarded – undo
5405 5405
      * @param int $depth
5406 5406
      * @param array $tmp
5407 5407
      */
5408
-    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ())
5408
+    public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array())
5409 5409
     {
5410 5410
         if ($this->debug > 1) {
5411 5411
             error_log('New LP - In learnpath::create_tree_array())', 0);
@@ -5491,7 +5491,7 @@  discard block
 block discarded – undo
5491 5491
 
5492 5492
         // we need to start a form when we want to update all the mp3 files
5493 5493
         if ($update_audio == 'true') {
5494
-            $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">';
5494
+            $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">';
5495 5495
         }
5496 5496
         $return .= '<div id="message"></div>';
5497 5497
         if (count($this->items) == 0) {
@@ -5499,14 +5499,14 @@  discard block
 block discarded – undo
5499 5499
         } else {
5500 5500
             $return_audio = '<table class="data_table">';
5501 5501
             $return_audio .= '<tr>';
5502
-            $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>';
5503
-            $return_audio .= '<th>' . get_lang('Audio') . '</th>';
5502
+            $return_audio .= '<th width="40%">'.get_lang('Title').'</th>';
5503
+            $return_audio .= '<th>'.get_lang('Audio').'</th>';
5504 5504
             $return_audio .= '</tr>';
5505 5505
 
5506 5506
             if ($update_audio != 'true') {
5507 5507
                 $return .= '<div class="col-md-12">';
5508 5508
                 $return .= self::return_new_tree($update_audio);
5509
-                $return .='</div>';
5509
+                $return .= '</div>';
5510 5510
                 $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%'));
5511 5511
             } else {
5512 5512
                 $return_audio .= self::return_new_tree($update_audio);
@@ -5516,7 +5516,7 @@  discard block
 block discarded – undo
5516 5516
             // We need to close the form when we are updating the mp3 files.
5517 5517
             if ($update_audio == 'true') {
5518 5518
                 $return .= '<div class="footer-audio">';
5519
-                $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit'));
5519
+                $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit'));
5520 5520
                 $return .= '</div>';
5521 5521
                 //$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?
5522 5522
             }
@@ -5537,7 +5537,7 @@  discard block
 block discarded – undo
5537 5537
     public function return_new_tree($update_audio = 'false', $drop_element_here = false)
5538 5538
     {
5539 5539
         $return = '';
5540
-        $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
5540
+        $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
5541 5541
 
5542 5542
         $course_id = api_get_course_int_id();
5543 5543
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
@@ -5585,7 +5585,7 @@  discard block
 block discarded – undo
5585 5585
 
5586 5586
             // Link for the documents
5587 5587
             if ($arrLP[$i]['item_type'] == 'document') {
5588
-                $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id;
5588
+                $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5589 5589
                 $title_cut = Display::url(
5590 5590
                     $title_cut,
5591 5591
                     $url,
@@ -5601,14 +5601,14 @@  discard block
 block discarded – undo
5601 5601
             } else {
5602 5602
                 $oddClass = 'row_even';
5603 5603
             }
5604
-            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">';
5604
+            $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">';
5605 5605
 
5606 5606
             $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']);
5607 5607
 
5608
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
5608
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
5609 5609
                 $icon = Display::return_icon('lp_'.$icon_name.'.png');
5610 5610
             } else {
5611
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
5611
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
5612 5612
                     $icon = Display::return_icon('lp_'.$icon_name.'.gif');
5613 5613
                 } else {
5614 5614
                     $icon = Display::return_icon('folder_document.gif');
@@ -5616,7 +5616,7 @@  discard block
 block discarded – undo
5616 5616
             }
5617 5617
 
5618 5618
             // The audio column.
5619
-            $return_audio  .= '<td align="left" style="padding-left:10px;">';
5619
+            $return_audio .= '<td align="left" style="padding-left:10px;">';
5620 5620
 
5621 5621
             $audio = '';
5622 5622
 
@@ -5628,10 +5628,10 @@  discard block
 block discarded – undo
5628 5628
             } else {
5629 5629
                 $types = self::getChapterTypes();
5630 5630
                 if (!in_array($arrLP[$i]['item_type'], $types)) {
5631
-                    $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
5631
+                    $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />';
5632 5632
                     if (!empty ($arrLP[$i]['audio'])) {
5633 5633
                         $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br />
5634
-                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
5634
+                        <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio');
5635 5635
                     }
5636 5636
                 }
5637 5637
             }
@@ -5655,7 +5655,7 @@  discard block
 block discarded – undo
5655 5655
                 // No edit for this item types
5656 5656
                 if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) {
5657 5657
                     if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) {
5658
-                        $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">';
5658
+                        $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">';
5659 5659
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5660 5660
                         $edit_icon .= '</a>';
5661 5661
 
@@ -5668,7 +5668,7 @@  discard block
 block discarded – undo
5668 5668
                                 $this->lp_session_id
5669 5669
                             )
5670 5670
                             ) {
5671
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5671
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5672 5672
                                     'action' => 'dissociate_forum',
5673 5673
                                     'id' => $arrLP[$i]['id'],
5674 5674
                                     'lp_id' => $this->lp_id
@@ -5679,7 +5679,7 @@  discard block
 block discarded – undo
5679 5679
                                     ['class' => 'btn btn-default lp-btn-dissociate-forum']
5680 5680
                                 );
5681 5681
                             } else {
5682
-                                $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([
5682
+                                $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
5683 5683
                                     'action' => 'create_forum',
5684 5684
                                     'id' => $arrLP[$i]['id'],
5685 5685
                                     'lp_id' => $this->lp_id
@@ -5692,17 +5692,17 @@  discard block
 block discarded – undo
5692 5692
                             }
5693 5693
                         }
5694 5694
                     } else {
5695
-                        $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">';
5695
+                        $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">';
5696 5696
                         $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY);
5697 5697
                         $edit_icon .= '</a>';
5698 5698
                     }
5699 5699
                 }
5700 5700
 
5701
-                $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">';
5701
+                $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">';
5702 5702
                 $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY);
5703 5703
                 $delete_icon .= '</a>';
5704 5704
 
5705
-                $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id;
5705
+                $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id;
5706 5706
 
5707 5707
                 if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) {
5708 5708
                     $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']);
@@ -5711,8 +5711,8 @@  discard block
 block discarded – undo
5711 5711
                 }
5712 5712
             }
5713 5713
             if ($update_audio != 'true') {
5714
-                $row = $move_icon . ' ' . $icon .
5715
-                    Display::span($title_cut) .
5714
+                $row = $move_icon.' '.$icon.
5715
+                    Display::span($title_cut).
5716 5716
                     Display::tag(
5717 5717
                         'div',
5718 5718
                         "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>",
@@ -5733,8 +5733,8 @@  discard block
 block discarded – undo
5733 5733
                 $parent_arrays = array();
5734 5734
                 if ($arrLP[$i]['depth'] > 1) {
5735 5735
                     //Getting list of parents
5736
-                    for($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5737
-                        foreach($arrLP as $item) {
5736
+                    for ($j = 0; $j < $arrLP[$i]['depth']; $j++) {
5737
+                        foreach ($arrLP as $item) {
5738 5738
                             if ($item['id'] == $parent_id) {
5739 5739
                                 if ($item['parent_item_id'] == 0) {
5740 5740
                                     $parent_id = $item['id'];
@@ -5756,8 +5756,8 @@  discard block
 block discarded – undo
5756 5756
                     $parent_arrays = array_reverse($parent_arrays);
5757 5757
                     $val = '$elements';
5758 5758
                     $x = 0;
5759
-                    foreach($parent_arrays as $item) {
5760
-                        if ($x != count($parent_arrays) -1) {
5759
+                    foreach ($parent_arrays as $item) {
5760
+                        if ($x != count($parent_arrays) - 1) {
5761 5761
                             $val .= '["'.$item.'"]["children"]';
5762 5762
                         } else {
5763 5763
                             $val .= '["'.$item.'"]["children"]';
@@ -5820,7 +5820,7 @@  discard block
 block discarded – undo
5820 5820
                 if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) {
5821 5821
                     $active = 'active';
5822 5822
                 }
5823
-                $return  .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5823
+                $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container'));
5824 5824
             } else {
5825 5825
                 //sections
5826 5826
                 if (isset($item['children'])) {
@@ -5843,17 +5843,17 @@  discard block
 block discarded – undo
5843 5843
     {
5844 5844
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
5845 5845
         $return = '<div class="actions">';
5846
-        $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> ';
5847
-        $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>';
5848
-        $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>';
5846
+        $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> ';
5847
+        $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>';
5848
+        $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>';
5849 5849
         $buttons = array(
5850 5850
             array(
5851 5851
                 'title' => get_lang('SetPrerequisiteForEachItem'),
5852
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id,
5852
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id,
5853 5853
             ),
5854 5854
             array(
5855 5855
                 'title' => get_lang('ClearAllPrerequisites'),
5856
-                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id,
5856
+                'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id,
5857 5857
             ),
5858 5858
         );
5859 5859
         $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
@@ -5874,7 +5874,7 @@  discard block
 block discarded – undo
5874 5874
     {
5875 5875
         // Creating learning_path folder
5876 5876
         $dir = '/learning_path';
5877
-        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document';
5877
+        $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5878 5878
         $folder = false;
5879 5879
         if (!is_dir($filepath.'/'.$dir)) {
5880 5880
             $folderData = create_unexisting_directory(
@@ -5915,9 +5915,9 @@  discard block
 block discarded – undo
5915 5915
         // Creating LP folder
5916 5916
         if ($folder) {
5917 5917
             //Limits title size
5918
-            $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80);
5918
+            $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80);
5919 5919
             $dir   = $dir.$title;
5920
-            $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
5920
+            $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document';
5921 5921
             if (!is_dir($filepath.'/'.$dir)) {
5922 5922
                 $folderData = create_unexisting_directory(
5923 5923
                     $course,
@@ -5937,7 +5937,7 @@  discard block
 block discarded – undo
5937 5937
             }
5938 5938
             $dir = $dir.'/';
5939 5939
             if ($folder) {
5940
-                $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
5940
+                $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir;
5941 5941
             }
5942 5942
         }
5943 5943
         $array = array(
@@ -5976,12 +5976,12 @@  discard block
 block discarded – undo
5976 5976
             $dir = substr($dir, 1);
5977 5977
         }
5978 5978
         if (!empty($dir[0]) && $dir[0] != '/') {
5979
-            $dir = '/' . $dir;
5979
+            $dir = '/'.$dir;
5980 5980
         }
5981 5981
         if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') {
5982 5982
             $dir .= '/';
5983 5983
         }
5984
-        $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir;
5984
+        $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir;
5985 5985
 
5986 5986
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
5987 5987
             //Generates folder
@@ -5991,7 +5991,7 @@  discard block
 block discarded – undo
5991 5991
         }
5992 5992
 
5993 5993
         if (!is_dir($filepath)) {
5994
-            $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/';
5994
+            $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/';
5995 5995
             $dir = '/';
5996 5996
         }
5997 5997
 
@@ -6014,10 +6014,10 @@  discard block
 block discarded – undo
6014 6014
         $tmp_filename = $filename;
6015 6015
 
6016 6016
         $i = 0;
6017
-        while (file_exists($filepath . $tmp_filename . '.'.$extension))
6018
-            $tmp_filename = $filename . '_' . ++ $i;
6017
+        while (file_exists($filepath.$tmp_filename.'.'.$extension))
6018
+            $tmp_filename = $filename.'_'.++ $i;
6019 6019
 
6020
-        $filename = $tmp_filename . '.'.$extension;
6020
+        $filename = $tmp_filename.'.'.$extension;
6021 6021
         if ($extension == 'html') {
6022 6022
             $content = stripslashes($content);
6023 6023
             $content = str_replace(
@@ -6052,12 +6052,12 @@  discard block
 block discarded – undo
6052 6052
             );
6053 6053
         }
6054 6054
 
6055
-        if (!file_exists($filepath . $filename)) {
6056
-            if ($fp = @ fopen($filepath . $filename, 'w')) {
6055
+        if (!file_exists($filepath.$filename)) {
6056
+            if ($fp = @ fopen($filepath.$filename, 'w')) {
6057 6057
                 fputs($fp, $content);
6058 6058
                 fclose($fp);
6059 6059
 
6060
-                $file_size = filesize($filepath . $filename);
6060
+                $file_size = filesize($filepath.$filename);
6061 6061
                 $save_file_path = $dir.$filename;
6062 6062
 
6063 6063
                 $document_id = add_document(
@@ -6089,12 +6089,12 @@  discard block
 block discarded – undo
6089 6089
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6090 6090
                         $ct = '';
6091 6091
                         if ($new_comment)
6092
-                            $ct .= ", comment='" . Database::escape_string($new_comment). "'";
6092
+                            $ct .= ", comment='".Database::escape_string($new_comment)."'";
6093 6093
                         if ($new_title)
6094
-                            $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6094
+                            $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
6095 6095
 
6096
-                        $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)."
6097
-                               WHERE c_id = ".$course_id." AND id = " . $document_id;
6096
+                        $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)."
6097
+                               WHERE c_id = ".$course_id." AND id = ".$document_id;
6098 6098
                         Database::query($sql);
6099 6099
                     }
6100 6100
                 }
@@ -6122,42 +6122,42 @@  discard block
 block discarded – undo
6122 6122
             $dir = substr($dir, 1);
6123 6123
 
6124 6124
         if ($dir[0] != '/')
6125
-            $dir = '/' . $dir;
6125
+            $dir = '/'.$dir;
6126 6126
 
6127 6127
         if ($dir[strlen($dir) - 1] != '/')
6128 6128
             $dir .= '/';
6129 6129
 
6130
-        $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
6130
+        $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
6131 6131
 
6132 6132
         if (!is_dir($filepath)) {
6133
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
6133
+            $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
6134 6134
             $dir = '/';
6135 6135
         }
6136 6136
 
6137 6137
         $table_doc = Database :: get_course_table(TABLE_DOCUMENT);
6138 6138
         if (isset($_POST['path']) && !empty($_POST['path'])) {
6139 6139
             $document_id = intval($_POST['path']);
6140
-            $sql = "SELECT path FROM " . $table_doc . "
6141
-                    WHERE c_id = $course_id AND id = " . $document_id;
6140
+            $sql = "SELECT path FROM ".$table_doc."
6141
+                    WHERE c_id = $course_id AND id = ".$document_id;
6142 6142
             $res = Database::query($sql);
6143 6143
             $row = Database :: fetch_array($res);
6144 6144
             $content = stripslashes($_POST['content_lp']);
6145
-            $file = $filepath . $row['path'];
6145
+            $file = $filepath.$row['path'];
6146 6146
 
6147 6147
             if ($fp = @ fopen($file, 'w')) {
6148
-                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content);
6148
+                $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
6149 6149
 
6150 6150
                 // Change the path of mp3 to absolute.
6151 6151
                 // The first regexp deals with :// urls.
6152
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
6152
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content);
6153 6153
                 // The second regexp deals with audio/ urls.
6154
-                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
6154
+                $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content);
6155 6155
                 fputs($fp, $content);
6156 6156
                 fclose($fp);
6157 6157
 
6158
-                $sql = "UPDATE " . $table_doc ." SET
6158
+                $sql = "UPDATE ".$table_doc." SET
6159 6159
                             title='".Database::escape_string($_POST['title'])."'
6160
-                        WHERE c_id = ".$course_id." AND id = " . $document_id;
6160
+                        WHERE c_id = ".$course_id." AND id = ".$document_id;
6161 6161
                 Database::query($sql);
6162 6162
             }
6163 6163
         }
@@ -6175,10 +6175,10 @@  discard block
 block discarded – undo
6175 6175
         $return = '';
6176 6176
         if (is_numeric($item_id)) {
6177 6177
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6178
-            $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp
6179
-                    WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id);
6178
+            $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp
6179
+                    WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id);
6180 6180
             $result = Database::query($sql);
6181
-            while ($row = Database :: fetch_array($result,'ASSOC')) {
6181
+            while ($row = Database :: fetch_array($result, 'ASSOC')) {
6182 6182
                 $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0;
6183 6183
 
6184 6184
                 // Prevents wrong parent selection for document, see Bug#1251.
@@ -6205,8 +6205,8 @@  discard block
 block discarded – undo
6205 6205
                         break;
6206 6206
                     case TOOL_DOCUMENT:
6207 6207
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6208
-                        $sql_doc = "SELECT path FROM " . $tbl_doc . "
6209
-                                    WHERE c_id = ".$course_id." AND id = " . intval($row['path']);
6208
+                        $sql_doc = "SELECT path FROM ".$tbl_doc."
6209
+                                    WHERE c_id = ".$course_id." AND id = ".intval($row['path']);
6210 6210
                         $result = Database::query($sql_doc);
6211 6211
                         $path_file = Database::result($result, 0, 0);
6212 6212
                         $path_parts = pathinfo($path_file);
@@ -6245,7 +6245,7 @@  discard block
 block discarded – undo
6245 6245
         if (is_numeric($item_id)) {
6246 6246
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
6247 6247
             $sql = "SELECT * FROM $tbl_lp_item
6248
-                    WHERE c_id = ".$course_id." AND id = " . intval($item_id);
6248
+                    WHERE c_id = ".$course_id." AND id = ".intval($item_id);
6249 6249
             $res = Database::query($sql);
6250 6250
             $row = Database::fetch_array($res);
6251 6251
 
@@ -6256,21 +6256,21 @@  discard block
 block discarded – undo
6256 6256
                 case 'sco' :
6257 6257
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6258 6258
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6259
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row);
6259
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row);
6260 6260
                     } else {
6261
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6261
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row);
6262 6262
                     }
6263 6263
                     break;
6264 6264
                 case TOOL_DOCUMENT :
6265 6265
                     $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6266 6266
                     $sql = "SELECT lp.*, doc.path as dir
6267
-                            FROM " . $tbl_lp_item . " as lp
6268
-                            LEFT JOIN " . $tbl_doc . " as doc
6267
+                            FROM " . $tbl_lp_item." as lp
6268
+                            LEFT JOIN " . $tbl_doc." as doc
6269 6269
                             ON doc.id = lp.path
6270 6270
                             WHERE
6271 6271
                                 lp.c_id = $course_id AND
6272 6272
                                 doc.c_id = $course_id AND
6273
-                                lp.id = " . intval($item_id);
6273
+                                lp.id = ".intval($item_id);
6274 6274
                     $res_step = Database::query($sql);
6275 6275
                     $row_step = Database :: fetch_array($res_step);
6276 6276
                     $return .= $this->display_manipulate($item_id, $row['item_type']);
@@ -6280,8 +6280,8 @@  discard block
 block discarded – undo
6280 6280
                     $link_id = (string) $row['path'];
6281 6281
                     if (ctype_digit($link_id)) {
6282 6282
                         $tbl_link = Database :: get_course_table(TABLE_LINK);
6283
-                        $sql_select = 'SELECT url FROM ' . $tbl_link . '
6284
-                                       WHERE c_id = '.$course_id.' AND id = ' . intval($link_id);
6283
+                        $sql_select = 'SELECT url FROM '.$tbl_link.'
6284
+                                       WHERE c_id = '.$course_id.' AND id = '.intval($link_id);
6285 6285
                         $res_link = Database::query($sql_select);
6286 6286
                         $row_link = Database :: fetch_array($res_link);
6287 6287
                         if (is_array($row_link)) {
@@ -6294,9 +6294,9 @@  discard block
 block discarded – undo
6294 6294
                 case 'dokeos_module' :
6295 6295
                     if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6296 6296
                         $return .= $this->display_manipulate($item_id, $row['item_type']);
6297
-                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row);
6297
+                        $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row);
6298 6298
                     } else {
6299
-                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row);
6299
+                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row);
6300 6300
                     }
6301 6301
                     break;
6302 6302
                 case TOOL_QUIZ :
@@ -6351,7 +6351,7 @@  discard block
 block discarded – undo
6351 6351
 
6352 6352
         $headers = array(
6353 6353
             Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG),
6354
-            Display::return_icon('quiz.png',  get_lang('Quiz'), array(), ICON_SIZE_BIG),
6354
+            Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG),
6355 6355
             Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG),
6356 6356
             Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG),
6357 6357
             Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG),
@@ -6391,16 +6391,16 @@  discard block
 block discarded – undo
6391 6391
         $course_id = api_get_course_int_id();
6392 6392
         $return = '';
6393 6393
         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6394
-        $sql_doc = "SELECT * FROM " . $tbl_doc . "
6395
-                    WHERE c_id = ".$course_id." AND id = " . $id;
6394
+        $sql_doc = "SELECT * FROM ".$tbl_doc."
6395
+                    WHERE c_id = ".$course_id." AND id = ".$id;
6396 6396
         $res_doc = Database::query($sql_doc);
6397 6397
         $row_doc = Database :: fetch_array($res_doc);
6398 6398
 
6399 6399
         // TODO: Add a path filter.
6400 6400
         if ($iframe) {
6401
-            $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>';
6401
+            $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>';
6402 6402
         } else {
6403
-            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']);
6403
+            $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']);
6404 6404
         }
6405 6405
 
6406 6406
         return $return;
@@ -6424,8 +6424,8 @@  discard block
 block discarded – undo
6424 6424
             $item_description = $extra_info['description'];
6425 6425
         } elseif (is_numeric($extra_info)) {
6426 6426
             $sql = "SELECT title, description
6427
-                    FROM " . $tbl_quiz . "
6428
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
6427
+                    FROM " . $tbl_quiz."
6428
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
6429 6429
 
6430 6430
             $result = Database::query($sql);
6431 6431
             $row = Database::fetch_array($result);
@@ -6435,8 +6435,8 @@  discard block
 block discarded – undo
6435 6435
             $item_title = '';
6436 6436
             $item_description = '';
6437 6437
         }
6438
-        $item_title			= Security::remove_XSS($item_title);
6439
-        $item_description 	= Security::remove_XSS($item_description);
6438
+        $item_title = Security::remove_XSS($item_title);
6439
+        $item_description = Security::remove_XSS($item_description);
6440 6440
 
6441 6441
         $legend = '<legend>';
6442 6442
         if ($id != 0 && is_array($extra_info))
@@ -6444,13 +6444,13 @@  discard block
 block discarded – undo
6444 6444
         else
6445 6445
             $parent = 0;
6446 6446
 
6447
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6448
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6447
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6448
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6449 6449
 
6450 6450
         $result = Database::query($sql);
6451
-        $arrLP = array ();
6451
+        $arrLP = array();
6452 6452
         while ($row = Database :: fetch_array($result)) {
6453
-            $arrLP[] = array (
6453
+            $arrLP[] = array(
6454 6454
                 'id' => $row['id'],
6455 6455
                 'item_type' => $row['item_type'],
6456 6456
                 'title' => $row['title'],
@@ -6473,15 +6473,15 @@  discard block
 block discarded – undo
6473 6473
         unset ($this->arrMenu);
6474 6474
 
6475 6475
         if ($action == 'add') {
6476
-            $legend .= get_lang('CreateTheExercise') . '&nbsp;:';
6476
+            $legend .= get_lang('CreateTheExercise').'&nbsp;:';
6477 6477
         } elseif ($action == 'move') {
6478
-            $legend .= get_lang('MoveTheCurrentExercise') . '&nbsp;:';
6478
+            $legend .= get_lang('MoveTheCurrentExercise').'&nbsp;:';
6479 6479
         } else {
6480
-            $legend .= get_lang('EditCurrentExecice') . '&nbsp;:';
6480
+            $legend .= get_lang('EditCurrentExecice').'&nbsp;:';
6481 6481
         }
6482 6482
 
6483 6483
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6484
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6484
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6485 6485
         }
6486 6486
 
6487 6487
         $legend .= '</legend>';
@@ -6494,34 +6494,34 @@  discard block
 block discarded – undo
6494 6494
 
6495 6495
         if ($action != 'move') {
6496 6496
             $return .= '<tr>';
6497
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6498
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>';
6497
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6498
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>';
6499 6499
             $return .= '</tr>';
6500 6500
         }
6501 6501
 
6502 6502
         $return .= '<tr>';
6503 6503
 
6504
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6504
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6505 6505
         $return .= '<td class="input">';
6506 6506
 
6507 6507
         // Select for Parent item, root or chapter
6508 6508
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6509 6509
 
6510
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6510
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6511 6511
 
6512
-        $arrHide = array (
6512
+        $arrHide = array(
6513 6513
             $id
6514 6514
         );
6515 6515
         for ($i = 0; $i < count($arrLP); $i++) {
6516 6516
             if ($action != 'add') {
6517 6517
                 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)) {
6518
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6518
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6519 6519
                 } else {
6520 6520
                     $arrHide[] = $arrLP[$i]['id'];
6521 6521
                 }
6522 6522
             } else {
6523 6523
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6524
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6524
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6525 6525
             }
6526 6526
         }
6527 6527
         if (is_array($arrLP)) {
@@ -6533,11 +6533,11 @@  discard block
 block discarded – undo
6533 6533
         $return .= '</tr>';
6534 6534
         $return .= '<tr>';
6535 6535
 
6536
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6536
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6537 6537
         $return .= '<td class="input">';
6538 6538
 
6539 6539
         $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">';
6540
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6540
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6541 6541
         for ($i = 0; $i < count($arrLP); $i++) {
6542 6542
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
6543 6543
                 if (is_array($extra_info)) {
@@ -6549,7 +6549,7 @@  discard block
 block discarded – undo
6549 6549
                 } else {
6550 6550
                     $selected = '';
6551 6551
                 }
6552
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6552
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6553 6553
             }
6554 6554
         }
6555 6555
         $return .= '</select>';
@@ -6566,7 +6566,7 @@  discard block
 block discarded – undo
6566 6566
                     }
6567 6567
                 }
6568 6568
             }
6569
-            $arrHide = array ();
6569
+            $arrHide = array();
6570 6570
             for ($i = 0; $i < count($arrLP); $i++) {
6571 6571
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6572 6572
                     if (is_array($extra_info)) {
@@ -6612,27 +6612,27 @@  discard block
 block discarded – undo
6612 6612
 
6613 6613
         $return .= '<tr>';
6614 6614
         if ($action == 'add') {
6615
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>';
6615
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>';
6616 6616
         } else {
6617
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>';
6617
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>';
6618 6618
         }
6619 6619
 
6620 6620
         $return .= '</tr>';
6621 6621
         $return .= '</table>';
6622 6622
 
6623 6623
         if ($action == 'move') {
6624
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6625
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6624
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6625
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6626 6626
         }
6627 6627
 
6628 6628
         if (is_numeric($extra_info)) {
6629
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6629
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6630 6630
         } elseif (is_array($extra_info)) {
6631
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6631
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6632 6632
         }
6633 6633
 
6634
-        $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />';
6635
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6634
+        $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />';
6635
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6636 6636
 
6637 6637
         $return .= '</form>';
6638 6638
         $return .= '</div>';
@@ -6659,11 +6659,11 @@  discard block
 block discarded – undo
6659 6659
         } elseif (is_numeric($extra_info)) {
6660 6660
             $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
6661 6661
 
6662
-            $sql = "SELECT * FROM " . $TBL_DOCUMENT . "
6662
+            $sql = "SELECT * FROM ".$TBL_DOCUMENT."
6663 6663
                     WHERE
6664 6664
                         c_id = ".$course_id." AND
6665
-                        path LIKE '" . $uploadPath . "/%/%htm%' AND
6666
-                        id = " . (int) $extra_info . "
6665
+                        path LIKE '" . $uploadPath."/%/%htm%' AND
6666
+                        id = " . (int) $extra_info."
6667 6667
                     ORDER BY id ASC";
6668 6668
 
6669 6669
             $res_hot = Database::query($sql);
@@ -6687,11 +6687,11 @@  discard block
 block discarded – undo
6687 6687
         }
6688 6688
 
6689 6689
         $sql = "SELECT * FROM $tbl_lp_item
6690
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
6690
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
6691 6691
         $result = Database::query($sql);
6692
-        $arrLP = array ();
6692
+        $arrLP = array();
6693 6693
         while ($row = Database :: fetch_array($result)) {
6694
-            $arrLP[] = array (
6694
+            $arrLP[] = array(
6695 6695
                 'id' => $row['id'],
6696 6696
                 'item_type' => $row['item_type'],
6697 6697
                 'title' => $row['title'],
@@ -6716,7 +6716,7 @@  discard block
 block discarded – undo
6716 6716
         else
6717 6717
             $legend .= get_lang('EditCurrentExecice');
6718 6718
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
6719
-            $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument'));
6719
+            $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument'));
6720 6720
         }
6721 6721
         $legend .= '</legend>';
6722 6722
 
@@ -6724,11 +6724,11 @@  discard block
 block discarded – undo
6724 6724
         $return .= $legend;
6725 6725
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
6726 6726
         $return .= '<tr>';
6727
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>';
6727
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>';
6728 6728
         $return .= '<td class="input">';
6729 6729
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
6730
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6731
-        $arrHide = array (
6730
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6731
+        $arrHide = array(
6732 6732
             $id
6733 6733
         );
6734 6734
 
@@ -6736,13 +6736,13 @@  discard block
 block discarded – undo
6736 6736
             for ($i = 0; $i < count($arrLP); $i++) {
6737 6737
                 if ($action != 'add') {
6738 6738
                     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)) {
6739
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6739
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6740 6740
                     } else {
6741 6741
                         $arrHide[] = $arrLP[$i]['id'];
6742 6742
                     }
6743 6743
                 } else {
6744 6744
                     if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6745
-                        $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6745
+                        $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6746 6746
                 }
6747 6747
             }
6748 6748
 
@@ -6753,10 +6753,10 @@  discard block
 block discarded – undo
6753 6753
         $return .= '</td>';
6754 6754
         $return .= '</tr>';
6755 6755
         $return .= '<tr>';
6756
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>';
6756
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>';
6757 6757
         $return .= '<td class="input">';
6758 6758
         $return .= '<select id="previous" name="previous" size="1">';
6759
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6759
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6760 6760
 
6761 6761
         for ($i = 0; $i < count($arrLP); $i++) {
6762 6762
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6766,7 +6766,7 @@  discard block
 block discarded – undo
6766 6766
                 else
6767 6767
                     $selected = '';
6768 6768
 
6769
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6769
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6770 6770
             }
6771 6771
         }
6772 6772
 
@@ -6776,8 +6776,8 @@  discard block
 block discarded – undo
6776 6776
 
6777 6777
         if ($action != 'move') {
6778 6778
             $return .= '<tr>';
6779
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>';
6780
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
6779
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>';
6780
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
6781 6781
             $return .= '</tr>';
6782 6782
             $id_prerequisite = 0;
6783 6783
             if (is_array($arrLP) && count($arrLP) > 0) {
@@ -6788,7 +6788,7 @@  discard block
 block discarded – undo
6788 6788
                     }
6789 6789
                 }
6790 6790
 
6791
-                $arrHide = array ();
6791
+                $arrHide = array();
6792 6792
                 for ($i = 0; $i < count($arrLP); $i++) {
6793 6793
                     if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
6794 6794
                         if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -6802,22 +6802,22 @@  discard block
 block discarded – undo
6802 6802
         }
6803 6803
 
6804 6804
         $return .= '<tr>';
6805
-        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>';
6805
+        $return .= '<td>&nbsp; </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>';
6806 6806
         $return .= '</tr>';
6807 6807
         $return .= '</table>';
6808 6808
 
6809 6809
         if ($action == 'move') {
6810
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6811
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6810
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6811
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
6812 6812
         }
6813 6813
 
6814 6814
         if (is_numeric($extra_info)) {
6815
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
6815
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
6816 6816
         } elseif (is_array($extra_info)) {
6817
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
6817
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
6818 6818
         }
6819
-        $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />';
6820
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
6819
+        $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />';
6820
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
6821 6821
         $return .= '</form>';
6822 6822
 
6823 6823
         return $return;
@@ -6840,8 +6840,8 @@  discard block
 block discarded – undo
6840 6840
             $item_title = stripslashes($extra_info['title']);
6841 6841
         } elseif (is_numeric($extra_info)) {
6842 6842
             $sql = "SELECT forum_title as title, forum_comment as comment
6843
-                    FROM " . $tbl_forum . "
6844
-                    WHERE c_id = ".$course_id." AND forum_id = " . $extra_info;
6843
+                    FROM " . $tbl_forum."
6844
+                    WHERE c_id = ".$course_id." AND forum_id = ".$extra_info;
6845 6845
 
6846 6846
             $result = Database::query($sql);
6847 6847
             $row = Database :: fetch_array($result);
@@ -6861,7 +6861,7 @@  discard block
 block discarded – undo
6861 6861
             $parent = 0;
6862 6862
         }
6863 6863
 
6864
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
6864
+        $sql = "SELECT * FROM ".$tbl_lp_item."
6865 6865
                 WHERE
6866 6866
                     c_id = ".$course_id." AND
6867 6867
                     lp_id = " . $this->lp_id;
@@ -6869,7 +6869,7 @@  discard block
 block discarded – undo
6869 6869
         $arrLP = array();
6870 6870
 
6871 6871
         while ($row = Database :: fetch_array($result)) {
6872
-            $arrLP[] = array (
6872
+            $arrLP[] = array(
6873 6873
                 'id' => $row['id'],
6874 6874
                 'item_type' => $row['item_type'],
6875 6875
                 'title' => $row['title'],
@@ -6891,10 +6891,10 @@  discard block
 block discarded – undo
6891 6891
         unset($this->arrMenu);
6892 6892
 
6893 6893
         if ($action == 'add')
6894
-            $legend .= get_lang('CreateTheForum') . '&nbsp;:';
6895
-        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . '&nbsp;:';
6894
+            $legend .= get_lang('CreateTheForum').'&nbsp;:';
6895
+        elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').'&nbsp;:';
6896 6896
         else
6897
-            $legend .= get_lang('EditCurrentForum') . '&nbsp;:';
6897
+            $legend .= get_lang('EditCurrentForum').'&nbsp;:';
6898 6898
 
6899 6899
         $legend .= '</legend>';
6900 6900
         $return = '<div class="sectioncomment">';
@@ -6904,16 +6904,16 @@  discard block
 block discarded – undo
6904 6904
 
6905 6905
         if ($action != 'move') {
6906 6906
             $return .= '<tr>';
6907
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
6908
-            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>';
6907
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
6908
+            $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>';
6909 6909
             $return .= '</tr>';
6910 6910
         }
6911 6911
 
6912 6912
         $return .= '<tr>';
6913
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
6913
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
6914 6914
         $return .= '<td class="input">';
6915 6915
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
6916
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
6916
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
6917 6917
         $arrHide = array(
6918 6918
             $id
6919 6919
         );
@@ -6922,13 +6922,13 @@  discard block
 block discarded – undo
6922 6922
         for ($i = 0; $i < count($arrLP); $i++) {
6923 6923
             if ($action != 'add') {
6924 6924
                 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)) {
6925
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6925
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6926 6926
                 } else {
6927 6927
                     $arrHide[] = $arrLP[$i]['id'];
6928 6928
                 }
6929 6929
             } else {
6930 6930
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
6931
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
6931
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
6932 6932
             }
6933 6933
         }
6934 6934
         if (is_array($arrLP)) {
@@ -6939,10 +6939,10 @@  discard block
 block discarded – undo
6939 6939
         $return .= '</td>';
6940 6940
         $return .= '</tr>';
6941 6941
         $return .= '<tr>';
6942
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
6942
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
6943 6943
         $return .= '<td class="input">';
6944 6944
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
6945
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
6945
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
6946 6946
 
6947 6947
         for ($i = 0; $i < count($arrLP); $i++) {
6948 6948
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
@@ -6952,8 +6952,8 @@  discard block
 block discarded – undo
6952 6952
                 else
6953 6953
                     $selected = '';
6954 6954
 
6955
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' .
6956
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
6955
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.
6956
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
6957 6957
             }
6958 6958
         }
6959 6959
 
@@ -6987,25 +6987,25 @@  discard block
 block discarded – undo
6987 6987
         $return .= '<tr>';
6988 6988
 
6989 6989
         if ($action == 'add') {
6990
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>';
6990
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>';
6991 6991
         } else {
6992
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>';
6992
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>';
6993 6993
         }
6994 6994
         $return .= '</tr>';
6995 6995
         $return .= '</table>';
6996 6996
 
6997 6997
         if ($action == 'move') {
6998
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
6999
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
6998
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
6999
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7000 7000
         }
7001 7001
 
7002 7002
         if (is_numeric($extra_info)) {
7003
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7003
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7004 7004
         } elseif (is_array($extra_info)) {
7005
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7005
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7006 7006
         }
7007
-        $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />';
7008
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7007
+        $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />';
7008
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7009 7009
         $return .= '</form>';
7010 7010
         $return .= '</div>';
7011 7011
 
@@ -7032,7 +7032,7 @@  discard block
 block discarded – undo
7032 7032
             $item_title = stripslashes($extra_info['title']);
7033 7033
         } elseif (is_numeric($extra_info)) {
7034 7034
             $sql = "SELECT thread_title as title FROM $tbl_forum
7035
-                    WHERE c_id = $course_id AND thread_id = " . $extra_info;
7035
+                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7036 7036
 
7037 7037
             $result = Database::query($sql);
7038 7038
             $row = Database :: fetch_array($result);
@@ -7052,15 +7052,15 @@  discard block
 block discarded – undo
7052 7052
             $parent = 0;
7053 7053
         }
7054 7054
 
7055
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7056
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7055
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7056
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7057 7057
 
7058 7058
         $result = Database::query($sql);
7059 7059
 
7060
-        $arrLP = array ();
7060
+        $arrLP = array();
7061 7061
 
7062 7062
         while ($row = Database :: fetch_array($result)) {
7063
-            $arrLP[] = array (
7063
+            $arrLP[] = array(
7064 7064
                 'id' => $row['id'],
7065 7065
                 'item_type' => $row['item_type'],
7066 7066
                 'title' => $row['title'],
@@ -7083,31 +7083,31 @@  discard block
 block discarded – undo
7083 7083
 
7084 7084
         $return .= '<form method="POST">';
7085 7085
         if ($action == 'add')
7086
-            $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>';
7087
-        elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . '&nbsp;:</p>';
7086
+            $return .= '<legend>'.get_lang('CreateTheForum').'</legend>';
7087
+        elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').'&nbsp;:</p>';
7088 7088
         else
7089
-            $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>';
7089
+            $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>';
7090 7090
 
7091 7091
         $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">';
7092 7092
         $return .= '<tr>';
7093
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7093
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7094 7094
         $return .= '<td class="input">';
7095 7095
         $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">';
7096
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7097
-        $arrHide = array (
7096
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7097
+        $arrHide = array(
7098 7098
             $id
7099 7099
         );
7100 7100
 
7101 7101
         for ($i = 0; $i < count($arrLP); $i++) {
7102 7102
             if ($action != 'add') {
7103 7103
                 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)) {
7104
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7104
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7105 7105
                 } else {
7106 7106
                     $arrHide[] = $arrLP[$i]['id'];
7107 7107
                 }
7108 7108
             } else {
7109 7109
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7110
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7110
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7111 7111
             }
7112 7112
         }
7113 7113
 
@@ -7119,10 +7119,10 @@  discard block
 block discarded – undo
7119 7119
         $return .= '</td>';
7120 7120
         $return .= '</tr>';
7121 7121
         $return .= '<tr>';
7122
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7122
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7123 7123
         $return .= '<td class="input">';
7124 7124
         $return .= '<select id="previous" name="previous" size="1">';
7125
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7125
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7126 7126
         for ($i = 0; $i < count($arrLP); $i++) {
7127 7127
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7128 7128
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7131,7 +7131,7 @@  discard block
 block discarded – undo
7131 7131
                 else
7132 7132
                     $selected = '';
7133 7133
 
7134
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7134
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7135 7135
             }
7136 7136
         }
7137 7137
         $return .= '</select>';
@@ -7139,8 +7139,8 @@  discard block
 block discarded – undo
7139 7139
         $return .= '</tr>';
7140 7140
         if ($action != 'move') {
7141 7141
             $return .= '<tr>';
7142
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7143
-            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>';
7142
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7143
+            $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>';
7144 7144
             $return .= '</tr>';
7145 7145
             $return .= '<tr>';
7146 7146
             $return .= '</tr>';
@@ -7167,17 +7167,17 @@  discard block
 block discarded – undo
7167 7167
             }
7168 7168
 
7169 7169
             $return .= '<tr>';
7170
-            $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>';
7171
-            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>';
7170
+            $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>';
7171
+            $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>';
7172 7172
 
7173 7173
             foreach ($arrHide as $key => $value) {
7174 7174
                 if ($key == $s_selected_position && $action == 'add') {
7175
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7175
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7176 7176
                 }
7177 7177
                 elseif ($key == $id_prerequisite && $action == 'edit') {
7178
-                    $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>';
7178
+                    $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>';
7179 7179
                 } else {
7180
-                    $return .= '<option value="' . $key . '">' . $value['value'] . '</option>';
7180
+                    $return .= '<option value="'.$key.'">'.$value['value'].'</option>';
7181 7181
                 }
7182 7182
             }
7183 7183
             $return .= "</select></td>";
@@ -7191,19 +7191,19 @@  discard block
 block discarded – undo
7191 7191
         $return .= '</table>';
7192 7192
 
7193 7193
         if ($action == 'move') {
7194
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7195
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7194
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7195
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7196 7196
         }
7197 7197
 
7198 7198
         if (is_numeric($extra_info)) {
7199
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7199
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7200 7200
         }
7201 7201
         elseif (is_array($extra_info)) {
7202
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7202
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7203 7203
         }
7204 7204
 
7205
-        $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />';
7206
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7205
+        $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />';
7206
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7207 7207
         $return .= '</form>';
7208 7208
         $return .= '</div>';
7209 7209
 
@@ -7229,10 +7229,10 @@  discard block
 block discarded – undo
7229 7229
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
7230 7230
 
7231 7231
         if ($id != 0 && is_array($extra_info)) {
7232
-            $item_title 		= $extra_info['title'];
7233
-            $item_description 	= $extra_info['description'];
7234
-            $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7235
-            $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']);
7232
+            $item_title = $extra_info['title'];
7233
+            $item_description = $extra_info['description'];
7234
+            $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7235
+            $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']);
7236 7236
         } else {
7237 7237
             $item_title = '';
7238 7238
             $item_description = '';
@@ -7246,17 +7246,17 @@  discard block
 block discarded – undo
7246 7246
         }
7247 7247
 
7248 7248
         $id  = intval($id);
7249
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7249
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7250 7250
                 WHERE
7251 7251
                     c_id = ".$course_id." AND
7252
-                    lp_id = " . $this->lp_id . " AND
7252
+                    lp_id = " . $this->lp_id." AND
7253 7253
                     id != $id";
7254 7254
 
7255 7255
         if ($item_type == 'module')
7256 7256
             $sql .= " AND parent_item_id = 0";
7257 7257
 
7258 7258
         $result = Database::query($sql);
7259
-        $arrLP = array ();
7259
+        $arrLP = array();
7260 7260
 
7261 7261
         while ($row = Database :: fetch_array($result)) {
7262 7262
             $arrLP[] = array(
@@ -7284,9 +7284,9 @@  discard block
 block discarded – undo
7284 7284
 
7285 7285
         $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
7286 7286
 
7287
-        $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7287
+        $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id;
7288 7288
 
7289
-        $form = new FormValidator('form', 'POST',  $url);
7289
+        $form = new FormValidator('form', 'POST', $url);
7290 7290
 
7291 7291
         $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset);
7292 7292
         $defaults['description'] = $item_description;
@@ -7330,7 +7330,7 @@  discard block
 block discarded – undo
7330 7330
             $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);"));
7331 7331
 
7332 7332
             foreach ($arrHide as $key => $value) {
7333
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7333
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7334 7334
             }
7335 7335
             if (!empty($s_selected_parent)) {
7336 7336
                 $parent_select->setSelected($s_selected_parent);
@@ -7352,16 +7352,16 @@  discard block
 block discarded – undo
7352 7352
                     $s_selected_position = $arrLP[$i]['id'];
7353 7353
                 }
7354 7354
 
7355
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7355
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7356 7356
             }
7357 7357
         }
7358 7358
 
7359 7359
         $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous'));
7360 7360
         $padding = isset($value['padding']) ? $value['padding'] : 0;
7361
-        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"');
7361
+        $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"');
7362 7362
 
7363 7363
         foreach ($arrHide as $key => $value) {
7364
-            $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"');
7364
+            $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"');
7365 7365
         }
7366 7366
 
7367 7367
         if (!empty ($s_selected_position)) {
@@ -7390,23 +7390,23 @@  discard block
 block discarded – undo
7390 7390
         //assets can't be modified
7391 7391
 
7392 7392
         //$item_type == 'asset' ||
7393
-        if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7393
+        if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) {
7394 7394
 
7395 7395
             if ($item_type == 'sco') {
7396
-                $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>');
7396
+                $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>');
7397 7397
             }
7398 7398
             $renderer = $form->defaultRenderer();
7399 7399
             $renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
7400 7400
 
7401 7401
             $relative_prefix = '';
7402 7402
 
7403
-            $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments',
7403
+            $editor_config = array('ToolbarSet' 			=> 'LearningPathDocuments',
7404 7404
                 'Width' 				=> '100%',
7405 7405
                 'Height' 				=> '500',
7406 7406
                 'FullPage' 				=> true,
7407 7407
                 'CreateDocumentDir' 	=> $relative_prefix,
7408
-                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/',
7409
-                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck
7408
+                'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/',
7409
+                'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck
7410 7410
             );
7411 7411
 
7412 7412
             $form->addElement('html_editor', 'content_lp', '', null, $editor_config);
@@ -7415,7 +7415,7 @@  discard block
 block discarded – undo
7415 7415
             $defaults['content_lp'] = file_get_contents($content_path);
7416 7416
         }
7417 7417
 
7418
-        $form->addElement('hidden', 'type', 'dokeos_' . $item_type);
7418
+        $form->addElement('hidden', 'type', 'dokeos_'.$item_type);
7419 7419
         $form->addElement('hidden', 'post_time', time());
7420 7420
         $form->setDefaults($defaults);
7421 7421
         return $form->return_form();
@@ -7453,8 +7453,8 @@  discard block
 block discarded – undo
7453 7453
         // We don't display the document form if it's not an editable document (html or txt file).
7454 7454
         if ($action == "add") {
7455 7455
             if (is_numeric($extra_info)) {
7456
-                $sql_doc = "SELECT path FROM " . $tbl_doc . "
7457
-                            WHERE c_id = ".$course_id." AND id = " . intval($extra_info);
7456
+                $sql_doc = "SELECT path FROM ".$tbl_doc."
7457
+                            WHERE c_id = ".$course_id." AND id = ".intval($extra_info);
7458 7458
                 $result = Database::query($sql_doc);
7459 7459
                 $path_file = Database :: result($result, 0, 0);
7460 7460
                 $path_parts = pathinfo($path_file);
@@ -7472,13 +7472,13 @@  discard block
 block discarded – undo
7472 7472
                 $item_title = stripslashes($path_parts['filename']);
7473 7473
             }
7474 7474
         } elseif (is_numeric($extra_info)) {
7475
-            $sql_doc = "SELECT path, title FROM " . $tbl_doc . "
7475
+            $sql_doc = "SELECT path, title FROM ".$tbl_doc."
7476 7476
                         WHERE
7477 7477
                             c_id = ".$course_id." AND
7478 7478
                             id = " . intval($extra_info);
7479 7479
 
7480 7480
             $result = Database::query($sql_doc);
7481
-            $row 	= Database::fetch_array($result);
7481
+            $row = Database::fetch_array($result);
7482 7482
             $item_title = $row['title'];
7483 7483
             $item_title = str_replace('_', ' ', $item_title);
7484 7484
             if (empty ($item_title)) {
@@ -7497,11 +7497,11 @@  discard block
 block discarded – undo
7497 7497
             $parent = 0;
7498 7498
         }
7499 7499
 
7500
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7501
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7500
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7501
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7502 7502
 
7503 7503
         $result = Database::query($sql);
7504
-        $arrLP = array ();
7504
+        $arrLP = array();
7505 7505
         while ($row = Database :: fetch_array($result)) {
7506 7506
             $arrLP[] = array(
7507 7507
                 'id' => $row['id'],
@@ -7535,9 +7535,9 @@  discard block
 block discarded – undo
7535 7535
         $return .= '</legend>';
7536 7536
 
7537 7537
         if (isset ($_GET['edit']) && $_GET['edit'] == 'true') {
7538
-            $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false);
7538
+            $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false);
7539 7539
         }
7540
-        $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7540
+        $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data"));
7541 7541
         $defaults['title'] = Security :: remove_XSS($item_title);
7542 7542
         if (empty($item_title)) {
7543 7543
             $defaults['title'] = Security::remove_XSS($item_title);
@@ -7573,15 +7573,15 @@  discard block
 block discarded – undo
7573 7573
         }
7574 7574
 
7575 7575
         $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"');
7576
-        $my_count=0;
7576
+        $my_count = 0;
7577 7577
         foreach ($arrHide as $key => $value) {
7578
-            if ($my_count!=0) {
7578
+            if ($my_count != 0) {
7579 7579
                 // The LP name is also the first section and is not in the same charset like the other sections.
7580 7580
                 $value['value'] = Security :: remove_XSS($value['value']);
7581
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7581
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7582 7582
             } else {
7583 7583
                 $value['value'] = Security :: remove_XSS($value['value']);
7584
-                $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"');
7584
+                $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
7585 7585
             }
7586 7586
             $my_count++;
7587 7587
         }
@@ -7589,7 +7589,7 @@  discard block
 block discarded – undo
7589 7589
         if (!empty($id)) {
7590 7590
             $parent_select->setSelected($parent);
7591 7591
         } else {
7592
-            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ;
7592
+            $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0;
7593 7593
             $parent_select->setSelected($parent_item_id);
7594 7594
         }
7595 7595
 
@@ -7606,7 +7606,7 @@  discard block
 block discarded – undo
7606 7606
                 if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id'])
7607 7607
                     $s_selected_position = $arrLP[$i]['id'];
7608 7608
                 elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id'];
7609
-                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"';
7609
+                $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"';
7610 7610
             }
7611 7611
         }
7612 7612
 
@@ -7614,8 +7614,8 @@  discard block
 block discarded – undo
7614 7614
         $position->addOption(get_lang('FirstPosition'), 0);
7615 7615
 
7616 7616
         foreach ($arrHide as $key => $value) {
7617
-            $padding = isset($value['padding']) ? $value['padding']: 0;
7618
-            $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"');
7617
+            $padding = isset($value['padding']) ? $value['padding'] : 0;
7618
+            $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"');
7619 7619
         }
7620 7620
         $position->setSelected($s_selected_position);
7621 7621
 
@@ -7685,7 +7685,7 @@  discard block
 block discarded – undo
7685 7685
                             $relative_path 	 = array_slice($relative_path, 1, $cnt);
7686 7686
                             $relative_path 	 = implode('/', $relative_path);
7687 7687
                             if (strlen($relative_path) > 0) {
7688
-                                $relative_path = $relative_path . '/';
7688
+                                $relative_path = $relative_path.'/';
7689 7689
                             }
7690 7690
                         } else {
7691 7691
                             $result = $this->generate_lp_folder($_course);
@@ -7699,8 +7699,8 @@  discard block
 block discarded – undo
7699 7699
                             'Height' 				=> '500',
7700 7700
                             'FullPage' 				=> true,
7701 7701
                             'CreateDocumentDir' 	=> $relative_prefix,
7702
-                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
7703
-                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
7702
+                            'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
7703
+                            'BaseHref' 				=> api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path
7704 7704
                         );
7705 7705
 
7706 7706
                         if ($_GET['action'] == 'add_item') {
@@ -7767,8 +7767,8 @@  discard block
 block discarded – undo
7767 7767
             $item_url = stripslashes($extra_info['url']);
7768 7768
         } elseif (is_numeric($extra_info)) {
7769 7769
             $extra_info = intval($extra_info);
7770
-            $sql = "SELECT title, description, url FROM " . $tbl_link . "
7771
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7770
+            $sql = "SELECT title, description, url FROM ".$tbl_link."
7771
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7772 7772
             $result = Database::query($sql);
7773 7773
             $row = Database :: fetch_array($result);
7774 7774
             $item_title       = $row['title'];
@@ -7788,8 +7788,8 @@  discard block
 block discarded – undo
7788 7788
             $parent = 0;
7789 7789
         }
7790 7790
 
7791
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7792
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7791
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7792
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7793 7793
         $result = Database::query($sql);
7794 7794
         $arrLP = array();
7795 7795
 
@@ -7816,10 +7816,10 @@  discard block
 block discarded – undo
7816 7816
         unset ($this->arrMenu);
7817 7817
 
7818 7818
         if ($action == 'add')
7819
-            $legend .= get_lang('CreateTheLink') . '&nbsp;:';
7820
-        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . '&nbsp;:';
7819
+            $legend .= get_lang('CreateTheLink').'&nbsp;:';
7820
+        elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').'&nbsp;:';
7821 7821
         else
7822
-            $legend .= get_lang('EditCurrentLink') . '&nbsp;:';
7822
+            $legend .= get_lang('EditCurrentLink').'&nbsp;:';
7823 7823
 
7824 7824
         $legend .= '</legend>';
7825 7825
 
@@ -7830,16 +7830,16 @@  discard block
 block discarded – undo
7830 7830
 
7831 7831
         if ($action != 'move') {
7832 7832
             $return .= '<tr>';
7833
-            $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>';
7834
-            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>';
7833
+            $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>';
7834
+            $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>';
7835 7835
             $return .= '</tr>';
7836 7836
         }
7837 7837
 
7838 7838
         $return .= '<tr>';
7839
-        $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>';
7839
+        $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>';
7840 7840
         $return .= '<td class="input">';
7841 7841
         $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">';
7842
-        $return .= '<option class="top" value="0">' . $this->name . '</option>';
7842
+        $return .= '<option class="top" value="0">'.$this->name.'</option>';
7843 7843
         $arrHide = array(
7844 7844
             $id
7845 7845
         );
@@ -7849,13 +7849,13 @@  discard block
 block discarded – undo
7849 7849
         for ($i = 0; $i < count($arrLP); $i++) {
7850 7850
             if ($action != 'add') {
7851 7851
                 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)) {
7852
-                    $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>';
7852
+                    $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>';
7853 7853
                 } else {
7854 7854
                     $arrHide[] = $arrLP[$i]['id'];
7855 7855
                 }
7856 7856
             } else {
7857 7857
                 if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir')
7858
-                    $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>';
7858
+                    $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>';
7859 7859
             }
7860 7860
         }
7861 7861
 
@@ -7867,11 +7867,11 @@  discard block
 block discarded – undo
7867 7867
         $return .= '</td>';
7868 7868
         $return .= '</tr>';
7869 7869
         $return .= '<tr>';
7870
-        $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>';
7870
+        $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>';
7871 7871
         $return .= '<td class="input">';
7872 7872
 
7873 7873
         $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">';
7874
-        $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>';
7874
+        $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>';
7875 7875
         for ($i = 0; $i < count($arrLP); $i++) {
7876 7876
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
7877 7877
                 if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -7881,7 +7881,7 @@  discard block
 block discarded – undo
7881 7881
                 else
7882 7882
                     $selected = '';
7883 7883
 
7884
-                $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>';
7884
+                $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>';
7885 7885
             }
7886 7886
         }
7887 7887
         $return .= '</select>';
@@ -7890,8 +7890,8 @@  discard block
 block discarded – undo
7890 7890
 
7891 7891
         if ($action != 'move') {
7892 7892
             $return .= '<tr>';
7893
-            $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>';
7894
-            $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>';
7893
+            $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>';
7894
+            $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>';
7895 7895
             $return .= '</tr>';
7896 7896
             $id_prerequisite = 0;
7897 7897
             if (is_array($arrLP)) {
@@ -7918,25 +7918,25 @@  discard block
 block discarded – undo
7918 7918
 
7919 7919
         $return .= '<tr>';
7920 7920
         if ($action == 'add') {
7921
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>';
7921
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>';
7922 7922
         } else {
7923
-            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>';
7923
+            $return .= '<td>&nbsp;</td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>';
7924 7924
         }
7925 7925
         $return .= '</tr>';
7926 7926
         $return .= '</table>';
7927 7927
 
7928 7928
         if ($action == 'move') {
7929
-            $return .= '<input name="title" type="hidden" value="' . $item_title . '" />';
7930
-            $return .= '<input name="description" type="hidden" value="' . $item_description . '" />';
7929
+            $return .= '<input name="title" type="hidden" value="'.$item_title.'" />';
7930
+            $return .= '<input name="description" type="hidden" value="'.$item_description.'" />';
7931 7931
         }
7932 7932
 
7933 7933
         if (is_numeric($extra_info)) {
7934
-            $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />';
7934
+            $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />';
7935 7935
         } elseif (is_array($extra_info)) {
7936
-            $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />';
7936
+            $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />';
7937 7937
         }
7938
-        $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />';
7939
-        $return .= '<input name="post_time" type="hidden" value="' . time() . '" />';
7938
+        $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />';
7939
+        $return .= '<input name="post_time" type="hidden" value="'.time().'" />';
7940 7940
         $return .= '</form>';
7941 7941
         $return .= '</div>';
7942 7942
 
@@ -7962,8 +7962,8 @@  discard block
 block discarded – undo
7962 7962
         } elseif (is_numeric($extra_info)) {
7963 7963
             $extra_info = intval($extra_info);
7964 7964
             $sql = "SELECT title, description
7965
-                    FROM " . $tbl_publication . "
7966
-                    WHERE c_id = ".$course_id." AND id = " . $extra_info;
7965
+                    FROM " . $tbl_publication."
7966
+                    WHERE c_id = ".$course_id." AND id = ".$extra_info;
7967 7967
 
7968 7968
             $result = Database::query($sql);
7969 7969
             $row = Database :: fetch_array($result);
@@ -7979,13 +7979,13 @@  discard block
 block discarded – undo
7979 7979
             $parent = 0;
7980 7980
         }
7981 7981
 
7982
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
7983
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
7982
+        $sql = "SELECT * FROM ".$tbl_lp_item."
7983
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7984 7984
 
7985 7985
         $result = Database::query($sql);
7986 7986
         $arrLP = array();
7987 7987
         while ($row = Database :: fetch_array($result)) {
7988
-            $arrLP[] = array (
7988
+            $arrLP[] = array(
7989 7989
                 'id' => $row['id'],
7990 7990
                 'item_type' => $row['item_type'],
7991 7991
                 'title' => $row['title'],
@@ -8031,7 +8031,7 @@  discard block
 block discarded – undo
8031 8031
             ]
8032 8032
         );
8033 8033
 
8034
-        $arrHide = array (
8034
+        $arrHide = array(
8035 8035
             $id
8036 8036
         );
8037 8037
 
@@ -8049,7 +8049,7 @@  discard block
 block discarded – undo
8049 8049
                     $parentSelect->addOption(
8050 8050
                         $arrLP[$i]['title'],
8051 8051
                         $arrLP[$i]['id'],
8052
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8052
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8053 8053
                     );
8054 8054
 
8055 8055
                     if ($parent == $arrLP[$i]['id']) {
@@ -8066,7 +8066,7 @@  discard block
 block discarded – undo
8066 8066
                     $parentSelect->addOption(
8067 8067
                         $arrLP[$i]['title'],
8068 8068
                         $arrLP[$i]['id'],
8069
-                        ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;']
8069
+                        ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;']
8070 8070
                     );
8071 8071
 
8072 8072
                     if ($parent == $arrLP[$i]['id']) {
@@ -8090,7 +8090,7 @@  discard block
 block discarded – undo
8090 8090
         for ($i = 0; $i < count($arrLP); $i++) {
8091 8091
             if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) {
8092 8092
                 $previousSelect->addOption(
8093
-                    get_lang('After') . ' "' . $arrLP[$i]['title'] . '"',
8093
+                    get_lang('After').' "'.$arrLP[$i]['title'].'"',
8094 8094
                     $arrLP[$i]['id']
8095 8095
                 );
8096 8096
 
@@ -8112,7 +8112,7 @@  discard block
 block discarded – undo
8112 8112
                     }
8113 8113
                 }
8114 8114
             }
8115
-            $arrHide = array ();
8115
+            $arrHide = array();
8116 8116
             for ($i = 0; $i < count($arrLP); $i++) {
8117 8117
                 if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') {
8118 8118
                     if ($extra_info['previous_item_id'] == $arrLP[$i]['id'])
@@ -8204,8 +8204,8 @@  discard block
 block discarded – undo
8204 8204
 
8205 8205
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8206 8206
         $item_id = intval($item_id);
8207
-        $sql = "SELECT * FROM " . $tbl_lp_item . " as lp
8208
-                WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id;
8207
+        $sql = "SELECT * FROM ".$tbl_lp_item." as lp
8208
+                WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id;
8209 8209
         $result = Database::query($sql);
8210 8210
         $row = Database::fetch_assoc($result);
8211 8211
 
@@ -8219,16 +8219,16 @@  discard block
 block discarded – undo
8219 8219
             $audio_player .= '<script>
8220 8220
                                 var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
8221 8221
                                 s1.addParam("allowscriptaccess","always");
8222
-                                s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true");
8222
+                                s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true");
8223 8223
                                 s1.write("container");
8224 8224
                             </script>';
8225 8225
         }
8226 8226
 
8227
-        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id;
8227
+        $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id;
8228 8228
 
8229 8229
         $return .= Display::url(
8230 8230
             Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL),
8231
-            $url.'&action=edit_item&path_item=' . $row['path']
8231
+            $url.'&action=edit_item&path_item='.$row['path']
8232 8232
         );
8233 8233
 
8234 8234
         $return .= Display::url(
@@ -8248,12 +8248,12 @@  discard block
 block discarded – undo
8248 8248
             $url.'&action=delete_item'
8249 8249
         );
8250 8250
 
8251
-        if ($item_type == TOOL_HOTPOTATOES ) {
8251
+        if ($item_type == TOOL_HOTPOTATOES) {
8252 8252
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8253 8253
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8254 8254
         }
8255 8255
 
8256
-        if ($item_type == TOOL_DOCUMENT ) {
8256
+        if ($item_type == TOOL_DOCUMENT) {
8257 8257
             $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code);
8258 8258
             $return .= get_lang('File').': '.$document_data['absolute_path_from_document'];
8259 8259
         }
@@ -8274,13 +8274,13 @@  discard block
 block discarded – undo
8274 8274
     public function get_js_dropdown_array()
8275 8275
     {
8276 8276
         $course_id = api_get_course_int_id();
8277
-        $return = 'var child_name = new Array();' . "\n";
8278
-        $return .= 'var child_value = new Array();' . "\n\n";
8279
-        $return .= 'child_name[0] = new Array();' . "\n";
8280
-        $return .= 'child_value[0] = new Array();' . "\n\n";
8277
+        $return = 'var child_name = new Array();'."\n";
8278
+        $return .= 'var child_value = new Array();'."\n\n";
8279
+        $return .= 'child_name[0] = new Array();'."\n";
8280
+        $return .= 'child_value[0] = new Array();'."\n\n";
8281 8281
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8282
-        $sql_zero = "SELECT * FROM " . $tbl_lp_item . "
8283
-                    WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0
8282
+        $sql_zero = "SELECT * FROM ".$tbl_lp_item."
8283
+                    WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0
8284 8284
                     ORDER BY display_order ASC";
8285 8285
         $res_zero = Database::query($sql_zero);
8286 8286
         $i = 0;
@@ -8290,28 +8290,28 @@  discard block
 block discarded – undo
8290 8290
                 $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']);
8291 8291
             }
8292 8292
             $js_var = json_encode(get_lang('After').' '.$row_zero['title']);
8293
-            $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n";
8294
-            $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n";
8293
+            $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n";
8294
+            $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n";
8295 8295
         }
8296 8296
         $return .= "\n";
8297
-        $sql = "SELECT * FROM " . $tbl_lp_item . "
8298
-                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
8297
+        $sql = "SELECT * FROM ".$tbl_lp_item."
8298
+                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
8299 8299
         $res = Database::query($sql);
8300 8300
         while ($row = Database :: fetch_array($res)) {
8301
-            $sql_parent = "SELECT * FROM " . $tbl_lp_item . "
8301
+            $sql_parent = "SELECT * FROM ".$tbl_lp_item."
8302 8302
                            WHERE
8303 8303
                                 c_id = ".$course_id." AND
8304
-                                parent_item_id = " . $row['id'] . "
8304
+                                parent_item_id = " . $row['id']."
8305 8305
                            ORDER BY display_order ASC";
8306 8306
             $res_parent = Database::query($sql_parent);
8307 8307
             $i = 0;
8308
-            $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n";
8309
-            $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n";
8308
+            $return .= 'child_name['.$row['id'].'] = new Array();'."\n";
8309
+            $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n";
8310 8310
 
8311 8311
             while ($row_parent = Database :: fetch_array($res_parent)) {
8312 8312
                 $js_var = json_encode(get_lang('After').' '.$row_parent['title']);
8313
-                $return .= 'child_name[' . $row['id'] . '][' . $i . '] =   '.$js_var.' ;' . "\n";
8314
-                $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n";
8313
+                $return .= 'child_name['.$row['id'].']['.$i.'] =   '.$js_var.' ;'."\n";
8314
+                $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n";
8315 8315
             }
8316 8316
             $return .= "\n";
8317 8317
         }
@@ -8332,8 +8332,8 @@  discard block
 block discarded – undo
8332 8332
         if (is_numeric($item_id)) {
8333 8333
             $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
8334 8334
 
8335
-            $sql = "SELECT * FROM " . $tbl_lp_item . "
8336
-                    WHERE c_id = ".$course_id." AND id = " . $item_id;
8335
+            $sql = "SELECT * FROM ".$tbl_lp_item."
8336
+                    WHERE c_id = ".$course_id." AND id = ".$item_id;
8337 8337
 
8338 8338
             $res = Database::query($sql);
8339 8339
             $row = Database :: fetch_array($res);
@@ -8392,7 +8392,7 @@  discard block
 block discarded – undo
8392 8392
      */
8393 8393
     public function display_item_small_form($item_type, $title = '', $data = array())
8394 8394
     {
8395
-        $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8395
+        $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id;
8396 8396
         $form = new FormValidator('small_form', 'post', $url);
8397 8397
         $form->addElement('header', $title);
8398 8398
         $form->addElement('text', 'title', get_lang('Title'));
@@ -8418,7 +8418,7 @@  discard block
 block discarded – undo
8418 8418
         $item_id = intval($item_id);
8419 8419
         /* Current prerequisite */
8420 8420
         $sql = "SELECT * FROM $tbl_lp_item
8421
-                WHERE c_id = $course_id AND id = " . $item_id;
8421
+                WHERE c_id = $course_id AND id = ".$item_id;
8422 8422
         $result = Database::query($sql);
8423 8423
         $row    = Database::fetch_array($result);
8424 8424
         $prerequisiteId = $row['prerequisite'];
@@ -8428,20 +8428,20 @@  discard block
 block discarded – undo
8428 8428
         $return .= '<form method="POST">';
8429 8429
         $return .= '<table class="data_table">';
8430 8430
         $return .= '<tr>';
8431
-        $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>';
8432
-        $return .= '<th width="70" >' . get_lang('Minimum') . '</th>';
8433
-        $return .= '<th width="70">' . get_lang('Maximum') . '</th>';
8431
+        $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>';
8432
+        $return .= '<th width="70" >'.get_lang('Minimum').'</th>';
8433
+        $return .= '<th width="70">'.get_lang('Maximum').'</th>';
8434 8434
         $return .= '</tr>';
8435 8435
 
8436 8436
         // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
8437 8437
         $return .= '<tr >';
8438 8438
         $return .= '<td colspan="3" class="radio">';
8439 8439
         $return .= '<input checked="checked" id="idNone" name="prerequisites"  style="margin-left:0px; margin-right:10px;" type="radio" />';
8440
-        $return .= '<label for="idNone">' . get_lang('None') . '</label>';
8440
+        $return .= '<label for="idNone">'.get_lang('None').'</label>';
8441 8441
         $return .= '</tr>';
8442 8442
 
8443 8443
         $sql = "SELECT * FROM $tbl_lp_item
8444
-                WHERE c_id = $course_id AND lp_id = " . $this->lp_id;
8444
+                WHERE c_id = $course_id AND lp_id = ".$this->lp_id;
8445 8445
         $result = Database::query($sql);
8446 8446
         $arrLP = array();
8447 8447
 
@@ -8484,25 +8484,25 @@  discard block
 block discarded – undo
8484 8484
             }
8485 8485
 
8486 8486
             $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score'];
8487
-            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0;
8487
+            $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0;
8488 8488
 
8489 8489
             $return .= '<tr>';
8490
-            $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>';
8491
-            $return .= '<label for="id' . $item['id'] . '">';
8492
-            $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'] . '" />';
8490
+            $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>';
8491
+            $return .= '<label for="id'.$item['id'].'">';
8492
+            $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'].'" />';
8493 8493
             $icon_name = str_replace(' ', '', $item['item_type']);
8494 8494
 
8495
-            if (file_exists('../img/lp_' . $icon_name . '.png')) {
8496
-                $return .= Display::return_icon('lp_' . $icon_name . '.png');
8495
+            if (file_exists('../img/lp_'.$icon_name.'.png')) {
8496
+                $return .= Display::return_icon('lp_'.$icon_name.'.png');
8497 8497
             } else {
8498
-                if (file_exists('../img/lp_' . $icon_name . '.gif')) {
8499
-                    $return .= Display::return_icon('lp_' . $icon_name . '.gif');
8498
+                if (file_exists('../img/lp_'.$icon_name.'.gif')) {
8499
+                    $return .= Display::return_icon('lp_'.$icon_name.'.gif');
8500 8500
                 } else {
8501 8501
                     $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;'));
8502 8502
                 }
8503 8503
             }
8504 8504
 
8505
-            $return .=  $item['title'] . '</label>';
8505
+            $return .= $item['title'].'</label>';
8506 8506
             $return .= '</td>';
8507 8507
 
8508 8508
             if ($item['item_type'] == TOOL_QUIZ) {
@@ -8516,19 +8516,19 @@  discard block
 block discarded – undo
8516 8516
                 $item['max_score'] = $tmp_obj_lp_item->max_score;
8517 8517
 
8518 8518
                 $return .= '<td class="exercise">';
8519
-                $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />';
8519
+                $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />';
8520 8520
                 $return .= '</td>';
8521 8521
                 $return .= '<td class="exercise">';
8522
-                $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />';
8522
+                $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />';
8523 8523
                 $return .= '</td>';
8524 8524
             }
8525 8525
 
8526 8526
             if ($item['item_type'] == TOOL_HOTPOTATOES) {
8527 8527
                 $return .= '<td class="exercise">';
8528
-                $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>';
8528
+                $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>';
8529 8529
                 $return .= '</td>';
8530 8530
                 $return .= '<td class="exercise"">';
8531
-                $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue . '" /></center>';
8531
+                $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'"  value="'.$selectedMaxScoreValue.'" /></center>';
8532 8532
                 $return .= '</td>';
8533 8533
             }
8534 8534
             $return .= '</tr>';
@@ -8537,7 +8537,7 @@  discard block
 block discarded – undo
8537 8537
         $return .= '</tr>';
8538 8538
         $return .= '</table>';
8539 8539
         $return .= '<div style="padding-top:3px;">';
8540
-        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>';
8540
+        $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>';
8541 8541
         $return .= '</form>';
8542 8542
 
8543 8543
         return $return;
@@ -8573,7 +8573,7 @@  discard block
 block discarded – undo
8573 8573
                 if ($row['id'] == $lp_id) {
8574 8574
                     continue;
8575 8575
                 }
8576
-                $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>';
8576
+                $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>';
8577 8577
             }
8578 8578
         }
8579 8579
         $return .= '</select>';
@@ -8633,8 +8633,8 @@  discard block
 block discarded – undo
8633 8633
                      WHERE c_id = $course_id AND $activeCondition $condition_session
8634 8634
                      ORDER BY title ASC";
8635 8635
 
8636
-        $sql_hot  = "SELECT * FROM $tbl_doc
8637
-                     WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%'  $condition_session
8636
+        $sql_hot = "SELECT * FROM $tbl_doc
8637
+                     WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%'  $condition_session
8638 8638
                      ORDER BY id ASC";
8639 8639
 
8640 8640
         $res_quiz = Database::query($sql_quiz);
@@ -8643,8 +8643,8 @@  discard block
 block discarded – undo
8643 8643
         $return = '<ul class="lp_resource">';
8644 8644
         $return .= '<li class="lp_resource_element">';
8645 8645
         $return .= Display::return_icon('new_test_small.gif');
8646
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' .
8647
-            get_lang('NewExercise') . '</a>';
8646
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'.
8647
+            get_lang('NewExercise').'</a>';
8648 8648
         $return .= '</li>';
8649 8649
 
8650 8650
         // Display hotpotatoes
@@ -8656,8 +8656,8 @@  discard block
 block discarded – undo
8656 8656
             $return .= '</a> ';
8657 8657
 
8658 8658
             $return .= Display::return_icon('hotpotatoes_s.png');
8659
-            $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'.
8660
-                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>';
8659
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'.
8660
+                ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>';
8661 8661
             $return .= '</li>';
8662 8662
         }
8663 8663
 
@@ -8667,7 +8667,7 @@  discard block
 block discarded – undo
8667 8667
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8668 8668
             $return .= '</a> ';
8669 8669
             $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY);
8670
-            $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' .
8670
+            $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'.
8671 8671
                 Security :: remove_XSS(cut($row_quiz['title'], 80)).
8672 8672
                 '</a>';
8673 8673
             $return .= '</li>';
@@ -8741,7 +8741,7 @@  discard block
 block discarded – undo
8741 8741
         foreach ($categorizedLinks as $categoryId => $links) {
8742 8742
             $linkNodes = null;
8743 8743
             foreach ($links as $key => $title) {
8744
-                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2)  {
8744
+                if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) {
8745 8745
                     $linkNodes .=
8746 8746
                         '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" >
8747 8747
                         <a class="moved" href="#">'.
@@ -8779,7 +8779,7 @@  discard block
 block discarded – undo
8779 8779
         $return = '<div class="lp_resource" >';
8780 8780
         $return .= '<div class="lp_resource_element">';
8781 8781
         $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY);
8782
-        $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>';
8782
+        $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>';
8783 8783
         $return .= '</div>';
8784 8784
         $return .= '</div>';
8785 8785
         return $return;
@@ -8800,7 +8800,7 @@  discard block
 block discarded – undo
8800 8800
         //First add link
8801 8801
         $return .= '<li class="lp_resource_element">';
8802 8802
         $return .= Display::return_icon('forum_new_small.gif');
8803
-        $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&content=forum&origin=learnpath&lp_id=' . $this->lp_id . '" title="' . get_lang('CreateANewForum') . '">' . get_lang('CreateANewForum') . '</a>';
8803
+        $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&action=add&content=forum&origin=learnpath&lp_id='.$this->lp_id.'" title="'.get_lang('CreateANewForum').'">'.get_lang('CreateANewForum').'</a>';
8804 8804
         $return .= '</li>';
8805 8805
 
8806 8806
         $return .= '<script>
@@ -8822,15 +8822,15 @@  discard block
 block discarded – undo
8822 8822
                 $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8823 8823
                 $return .= ' </a>';
8824 8824
                 $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
8825
-                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
8826
-                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
8825
+                $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle">
8826
+                                <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" />
8827 8827
                             </a>
8828
-                            <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">' .
8829
-                    Security :: remove_XSS($forum['forum_title']) . '</a>';
8828
+                            <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">'.
8829
+                    Security :: remove_XSS($forum['forum_title']).'</a>';
8830 8830
 
8831 8831
                 $return .= '</li>';
8832 8832
 
8833
-                $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
8833
+                $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">';
8834 8834
                 $a_threads = get_threads($forum['forum_id']);
8835 8835
                 if (is_array($a_threads)) {
8836 8836
                     foreach ($a_threads as $thread) {
@@ -8839,8 +8839,8 @@  discard block
 block discarded – undo
8839 8839
                         $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
8840 8840
                         $return .= ' </a>';
8841 8841
                         $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
8842
-                        $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 . '">' .
8843
-                            Security :: remove_XSS($thread['thread_title']) . '</a>';
8842
+                        $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.'">'.
8843
+                            Security :: remove_XSS($thread['thread_title']).'</a>';
8844 8844
                         $return .= '</li>';
8845 8845
                     }
8846 8846
                 }
@@ -8911,7 +8911,7 @@  discard block
 block discarded – undo
8911 8911
         if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) {
8912 8912
             // Remove the possible . at the end of the path.
8913 8913
             $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path;
8914
-            $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8914
+            $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp);
8915 8915
             mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true);
8916 8916
             $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files);
8917 8917
         }
@@ -8979,7 +8979,7 @@  discard block
 block discarded – undo
8979 8979
                 if ($item->type == 'sco') {
8980 8980
                     $inc_docs = $item->get_resources_from_source(
8981 8981
                         null,
8982
-                        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path()
8982
+                        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path()
8983 8983
                     );
8984 8984
                 } else {
8985 8985
                     $inc_docs = $item->get_resources_from_source();
@@ -9195,7 +9195,7 @@  discard block
 block discarded – undo
9195 9195
                                         $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9196 9196
                                         $zip_files[] = $my_sub_dir.'/'.$file_path;
9197 9197
                                         $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9198
-                                        $my_dep_file->setAttribute('href','document/'.$file_path);
9198
+                                        $my_dep_file->setAttribute('href', 'document/'.$file_path);
9199 9199
                                         $my_dep->setAttribute('xml:base', '');
9200 9200
                                     }
9201 9201
                                 }
@@ -9326,7 +9326,7 @@  discard block
 block discarded – undo
9326 9326
                         //$my_item->appendChild($my_max_score);
9327 9327
                         // Give a child element <adlcp:prerequisites> to the <item> element.
9328 9328
                         $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string());
9329
-                        $my_prereqs->setAttribute('type','aicc_script');
9329
+                        $my_prereqs->setAttribute('type', 'aicc_script');
9330 9330
                         $my_item->appendChild($my_prereqs);
9331 9331
                         // Give a child element <adlcp:masteryscore> to the <item> element.
9332 9332
                         $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score());
@@ -9379,7 +9379,7 @@  discard block
 block discarded – undo
9379 9379
                         $my_resource->appendChild($my_file);
9380 9380
 
9381 9381
                         // Get included docs.
9382
-                        $inc_docs = $item->get_resources_from_source(null,$tmp_file_path);
9382
+                        $inc_docs = $item->get_resources_from_source(null, $tmp_file_path);
9383 9383
                         // Dependency to other files - not yet supported.
9384 9384
                         $i = 1;
9385 9385
                         foreach ($inc_docs as $doc_info) {
@@ -9440,7 +9440,7 @@  discard block
 block discarded – undo
9440 9440
                                         $my_dep_file->setAttribute('href', $file_path);
9441 9441
                                         $my_dep->setAttribute('xml:base', '');
9442 9442
 
9443
-                                        if (strstr($file_path,$main_path) !== false) {
9443
+                                        if (strstr($file_path, $main_path) !== false) {
9444 9444
                                             // The calculated real path is really inside the chamilo root path.
9445 9445
                                             // Reduce file path to what's under the DocumentRoot.
9446 9446
                                             $file_path = substr($file_path, strlen($root_path));
@@ -9458,7 +9458,7 @@  discard block
 block discarded – undo
9458 9458
                                             $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0];
9459 9459
                                             $file_path = str_replace('//', '/', $file_path);
9460 9460
                                             if (file_exists($file_path)) {
9461
-                                                $file_path = substr($file_path,strlen($current_dir)); // We get the relative path.
9461
+                                                $file_path = substr($file_path, strlen($current_dir)); // We get the relative path.
9462 9462
                                                 $zip_files[] = $my_sub_dir.'/'.$file_path;
9463 9463
                                                 $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path);
9464 9464
                                                 $my_dep_file->setAttribute('href', 'document/'.$file_path);
@@ -9687,7 +9687,7 @@  discard block
 block discarded – undo
9687 9687
             if (strpos($extra_file, '.') === 0)
9688 9688
                 continue;
9689 9689
             else {
9690
-                $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file;
9690
+                $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file;
9691 9691
                 $this->create_path($dest_file);
9692 9692
                 copy($main_code_path.$extra_file, $dest_file);
9693 9693
             }
@@ -9740,7 +9740,7 @@  discard block
 block discarded – undo
9740 9740
                             }
9741 9741
                             $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path'];
9742 9742
                             if (file_exists($file_path)) {
9743
-                                $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path);
9743
+                                $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path);
9744 9744
                             }
9745 9745
                             break;
9746 9746
                         case 'asset': //commes from a scorm package generated by chamilo
@@ -9780,12 +9780,12 @@  discard block
 block discarded – undo
9780 9780
 
9781 9781
         foreach ($path_bits as $bit) {
9782 9782
             if (!empty ($bit)) {
9783
-                $new_path = $path_built . $bit;
9783
+                $new_path = $path_built.$bit;
9784 9784
                 if (is_dir($new_path)) {
9785
-                    $path_built = $new_path . '/';
9785
+                    $path_built = $new_path.'/';
9786 9786
                 } else {
9787 9787
                     mkdir($new_path, api_get_permissions_for_new_directories());
9788
-                    $path_built = $new_path . '/';
9788
+                    $path_built = $new_path.'/';
9789 9789
                 }
9790 9790
             }
9791 9791
         }
@@ -9829,9 +9829,9 @@  discard block
 block discarded – undo
9829 9829
 
9830 9830
         if ($upload_ok) {
9831 9831
             if ($has_attachment) {
9832
-                $courseDir = api_get_course_path() . '/upload/learning_path/images';
9832
+                $courseDir = api_get_course_path().'/upload/learning_path/images';
9833 9833
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
9834
-                $updir = $sys_course_path . $courseDir;
9834
+                $updir = $sys_course_path.$courseDir;
9835 9835
                 // Try to add an extension to the file if it hasn't one.
9836 9836
                 $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']);
9837 9837
 
@@ -9886,7 +9886,7 @@  discard block
 block discarded – undo
9886 9886
             //Setting my lp_id to autolaunch = 1
9887 9887
             $attributes['autolaunch'] = 1;
9888 9888
             $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id));
9889
-            Database::update($lp_table, $attributes, $where );
9889
+            Database::update($lp_table, $attributes, $where);
9890 9890
         }
9891 9891
     }
9892 9892
 
@@ -9905,13 +9905,13 @@  discard block
 block discarded – undo
9905 9905
 
9906 9906
         // Get the max order of the items
9907 9907
         $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item
9908
-    	                  WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'";
9908
+    	                  WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'";
9909 9909
         $rs_max_order = Database::query($sql_max_order);
9910 9910
         $row_max_order = Database::fetch_object($rs_max_order);
9911 9911
         $max_order = $row_max_order->display_order;
9912 9912
         // Get the previous item ID
9913 9913
         $sql = "SELECT id as previous FROM $table_lp_item
9914
-                WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' ";
9914
+                WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' ";
9915 9915
         $rs_max = Database::query($sql);
9916 9916
         $row_max = Database::fetch_object($rs_max);
9917 9917
 
@@ -9967,9 +9967,9 @@  discard block
 block discarded – undo
9967 9967
         $documents_total_space = DocumentManager::documents_total_space();
9968 9968
         $course_max_space = DocumentManager::get_course_quota();
9969 9969
         $total_size = filesize($s) + $documents_total_space;
9970
-        if (filesize($s)>$post_max || filesize($s)>$upl_max  || $total_size>$course_max_space ){
9970
+        if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) {
9971 9971
             return true;
9972
-        } else{
9972
+        } else {
9973 9973
             return false;
9974 9974
         }
9975 9975
     }
@@ -10309,7 +10309,7 @@  discard block
 block discarded – undo
10309 10309
         if ($this->debug > 0) {
10310 10310
             error_log('New LP - In learnpath::set_subscribe_users()', 0);
10311 10311
         }
10312
-        $this->subscribeUsers = intval($value);;
10312
+        $this->subscribeUsers = intval($value); ;
10313 10313
         $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
10314 10314
         $lp_id = $this->get_id();
10315 10315
         $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers."
@@ -10655,7 +10655,7 @@  discard block
 block discarded – undo
10655 10655
      */
10656 10656
     public function createForum($forumCategoryId)
10657 10657
     {
10658
-        require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php';
10658
+        require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php';
10659 10659
 
10660 10660
         $forumId = store_forum(
10661 10661
             [
Please login to merge, or discard this patch.
main/document/create_audio.php 1 patch
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 $groupId = api_get_group_id();
24 24
 
25 25
 if (api_get_setting('enabled_text2audio') == 'false') {
26
-	api_not_allowed(true);
26
+    api_not_allowed(true);
27 27
 }
28 28
 
29 29
 $document_data = DocumentManager::get_document_data_by_id(
30
-	$_REQUEST['id'],
31
-	api_get_course_id()
30
+    $_REQUEST['id'],
31
+    api_get_course_id()
32 32
 );
33 33
 if (empty($document_data)) {
34 34
     if (api_is_in_group()) {
35
-		$group_properties = GroupManager::get_group_properties(
36
-			$groupId
37
-		);
38
-		$document_id = DocumentManager::get_document_id(
39
-			api_get_course_info(),
40
-			$group_properties['directory']
41
-		);
42
-		$document_data = DocumentManager::get_document_data_by_id(
43
-			$document_id,
44
-			api_get_course_id()
45
-		);
35
+        $group_properties = GroupManager::get_group_properties(
36
+            $groupId
37
+        );
38
+        $document_id = DocumentManager::get_document_id(
39
+            api_get_course_info(),
40
+            $group_properties['directory']
41
+        );
42
+        $document_data = DocumentManager::get_document_data_by_id(
43
+            $document_id,
44
+            api_get_course_id()
45
+        );
46 46
     }
47 47
 }
48 48
 $document_id = $document_data['id'];
@@ -55,53 +55,53 @@  discard block
 block discarded – undo
55 55
 // Please, do not modify this dirname formatting
56 56
 
57 57
 if (strstr($dir, '..')) {
58
-	$dir = '/';
58
+    $dir = '/';
59 59
 }
60 60
 
61 61
 if ($dir[0] == '.') {
62
-	$dir = substr($dir, 1);
62
+    $dir = substr($dir, 1);
63 63
 }
64 64
 
65 65
 if ($dir[0] != '/') {
66
-	$dir = '/'.$dir;
66
+    $dir = '/'.$dir;
67 67
 }
68 68
 
69 69
 if ($dir[strlen($dir) - 1] != '/') {
70
-	$dir .= '/';
70
+    $dir .= '/';
71 71
 }
72 72
 
73 73
 $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
74 74
 
75 75
 if (!is_dir($filepath)) {
76
-	$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
77
-	$dir = '/';
76
+    $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
77
+    $dir = '/';
78 78
 }
79 79
 
80 80
 //groups //TODO: clean
81 81
 if (!empty($groupId)) {
82
-	$interbreadcrumb[] = array("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
83
-	$group = GroupManager :: get_group_properties($groupId);
84
-	$path = explode('/', $dir);
85
-	if ('/'.$path[1] != $group['directory']) {
86
-		api_not_allowed(true);
87
-	}
82
+    $interbreadcrumb[] = array("url" => "../group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'));
83
+    $group = GroupManager :: get_group_properties($groupId);
84
+    $path = explode('/', $dir);
85
+    if ('/'.$path[1] != $group['directory']) {
86
+        api_not_allowed(true);
87
+    }
88 88
 }
89 89
 
90 90
 $interbreadcrumb[] = array ("url" => "./document.php?curdirpath=".urlencode($dir)."&".api_get_cidreq(), "name" => get_lang('Documents'));
91 91
 
92 92
 if (!$is_allowed_in_course) {
93
-	api_not_allowed(true);
93
+    api_not_allowed(true);
94 94
 }
95 95
 
96 96
 
97 97
 if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] ||
98
-	DocumentManager::is_my_shared_folder(
99
-		api_get_user_id(),
100
-		Security::remove_XSS($dir),
101
-		api_get_session_id()
102
-	))
98
+    DocumentManager::is_my_shared_folder(
99
+        api_get_user_id(),
100
+        Security::remove_XSS($dir),
101
+        api_get_session_id()
102
+    ))
103 103
 ) {
104
-	api_not_allowed(true);
104
+    api_not_allowed(true);
105 105
 }
106 106
 
107 107
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
 $display_dir = $dir;
112 112
 if (isset ($group)) {
113
-	$display_dir = explode('/', $dir);
114
-	unset ($display_dir[0]);
115
-	unset ($display_dir[1]);
116
-	$display_dir = implode('/', $display_dir);
113
+    $display_dir = explode('/', $dir);
114
+    unset ($display_dir[0]);
115
+    unset ($display_dir[1]);
116
+    $display_dir = implode('/', $display_dir);
117 117
 }
118 118
 
119 119
 // Interbreadcrumb for the current directory root path
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 
124 124
 $dir_acum = '';
125 125
 for ($i = 0; $i < $array_len; $i++) {
126
-	$url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];
127
-	//Max char 80
128
-	$url_to_who = cut($dir_array[$i],80);
129
-	$interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who);
130
-	$dir_acum .= $dir_array[$i].'/';
126
+    $url_dir = 'document.php?&curdirpath='.$dir_acum.$dir_array[$i];
127
+    //Max char 80
128
+    $url_to_who = cut($dir_array[$i],80);
129
+    $interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who);
130
+    $dir_acum .= $dir_array[$i].'/';
131 131
 }
132 132
 
133 133
 Display :: display_header($nameTools, 'Doc');
134 134
 
135 135
 echo '<div class="actions">';
136 136
 echo '<a href="document.php?id='.$document_id.'">'.
137
-		Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
137
+        Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
138 138
 echo '<a href="create_audio.php?'.api_get_cidreq().'&amp;id='.$document_id.'&amp;dt2a=google">'.
139
-		Display::return_icon('google.png',get_lang('GoogleAudio'),'',ICON_SIZE_MEDIUM).'</a>';
139
+        Display::return_icon('google.png',get_lang('GoogleAudio'),'',ICON_SIZE_MEDIUM).'</a>';
140 140
 echo '<a href="create_audio.php?'.api_get_cidreq().'&amp;id='.$document_id.'&amp;dt2a=pediaphon">'.
141
-	Display::return_icon('pediaphon.png', get_lang('Pediaphon'),'',ICON_SIZE_MEDIUM).'</a>';
141
+    Display::return_icon('pediaphon.png', get_lang('Pediaphon'),'',ICON_SIZE_MEDIUM).'</a>';
142 142
 echo '</div>';
143 143
 
144 144
 ?>
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 <?php
192 192
 
193 193
 if (isset($_POST['text2voice_mode']) && $_POST['text2voice_mode'] == 'google') {
194
-	downloadMP3_google($filepath, $dir);
194
+    downloadMP3_google($filepath, $dir);
195 195
 } elseif (isset($_POST['text2voice_mode']) && $_POST['text2voice_mode'] == 'pediaphon') {
196
-	downloadMP3_pediaphon($filepath, $dir);
196
+    downloadMP3_pediaphon($filepath, $dir);
197 197
 }
198 198
 
199 199
 $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
@@ -204,65 +204,65 @@  discard block
 block discarded – undo
204 204
 $selected_language = null;
205 205
 
206 206
 while ($row = Database::fetch_array($result_select)) {
207
-	$options[$row['isocode']] =$row['original_name'].' ('.$row['english_name'].')';
208
-	if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))){
209
-		$options_pedia[$row['isocode']] =$row['original_name'].' ('.$row['english_name'].')';
210
-	}
207
+    $options[$row['isocode']] =$row['original_name'].' ('.$row['english_name'].')';
208
+    if (in_array($row['isocode'], array('de', 'en', 'es', 'fr'))){
209
+        $options_pedia[$row['isocode']] =$row['original_name'].' ('.$row['english_name'].')';
210
+    }
211 211
 }
212 212
 
213 213
 $icon = Display::return_icon('text2audio.png', get_lang('HelpText2Audio'),'',ICON_SIZE_MEDIUM);
214 214
 echo '<div class="page-header"><h2>'.$icon.get_lang('HelpText2Audio').'</h2></div>';
215 215
 
216 216
 if (Security::remove_XSS($_GET['dt2a']) == 'google') {
217
-	$selected_language = api_get_language_isocode();//lang default is the course language
218
-	echo '<div>';
219
-	$form = new FormValidator('form1', 'post', null, '', array('id' => 'form1'));
220
-	$form->addElement('hidden', 'text2voice_mode', 'google');
221
-	$form->addElement('hidden', 'id', $document_id);
222
-	$form->addElement('text', 'title', get_lang('Title'));
223
-	$form->addElement('select', 'lang', get_lang('Language'), $options);
224
-	$form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google'));
225
-	//echo Display :: return_icon('info3.gif', get_lang('HelpGoogleAudio'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
226
-	$form->addButtonSave(get_lang('SaveMP3'));
227
-	$defaults = array();
228
-	$defaults['lang'] = $selected_language;
229
-	$form->setDefaults($defaults);
230
-	$form->display();
231
-
232
-	echo '</div>';
217
+    $selected_language = api_get_language_isocode();//lang default is the course language
218
+    echo '<div>';
219
+    $form = new FormValidator('form1', 'post', null, '', array('id' => 'form1'));
220
+    $form->addElement('hidden', 'text2voice_mode', 'google');
221
+    $form->addElement('hidden', 'id', $document_id);
222
+    $form->addElement('text', 'title', get_lang('Title'));
223
+    $form->addElement('select', 'lang', get_lang('Language'), $options);
224
+    $form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_google'));
225
+    //echo Display :: return_icon('info3.gif', get_lang('HelpGoogleAudio'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
226
+    $form->addButtonSave(get_lang('SaveMP3'));
227
+    $defaults = array();
228
+    $defaults['lang'] = $selected_language;
229
+    $form->setDefaults($defaults);
230
+    $form->display();
231
+
232
+    echo '</div>';
233 233
 }
234 234
 
235 235
 if (Security::remove_XSS($_GET['dt2a']) == 'pediaphon') {
236
-	//lang default is a default message
237
-	$selected_language = "defaultmessage";
238
-	$options_pedia['defaultmessage'] =get_lang('FirstSelectALanguage');
239
-	$options['defaultmessage'] =get_lang('FirstSelectALanguage');
240
-	echo '<div>';
241
-
242
-	$form = new FormValidator('form2', 'post', null, '', array('id' => 'form2'));
243
-	$form->addElement('hidden', 'text2voice_mode','pediaphon');
244
-	$form->addElement('hidden', 'id', $document_id);
245
-	$form->addElement('text', 'title', get_lang('Title'));
246
-	$form->addElement('select', 'lang', get_lang('Language'), $options_pedia, array('onclick' => 'update_voices(this.selectedIndex);'));
247
-	$form->addElement('select', 'voices', get_lang('Voice'), array(get_lang('FirstSelectALanguage')), array());
248
-	$speed_options = array();
249
-	$speed_options['1']     = get_lang('Normal');
250
-	$speed_options['0.75']  = get_lang('GoFaster');
251
-	$speed_options['0.8']   = get_lang('Fast');
252
-	$speed_options['1.2']   = get_lang('Slow');
253
-	$speed_options['1.6']   = get_lang('SlowDown');
254
-
255
-	$form->addElement('select', 'speed', get_lang('Speed'), $speed_options, array());
256
-	$form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_pediaphon'));
257
-	//echo Display :: return_icon('info3.gif', get_lang('HelpPediaphon'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
258
-	$form->addButtonSave(get_lang('SaveMP3'));
259
-	$defaults = array();
260
-	$defaults['lang'] = $selected_language;
261
-	$form->setDefaults($defaults);
262
-	$form->display();
263
-	echo '</div>';
264
-
265
-	?>
236
+    //lang default is a default message
237
+    $selected_language = "defaultmessage";
238
+    $options_pedia['defaultmessage'] =get_lang('FirstSelectALanguage');
239
+    $options['defaultmessage'] =get_lang('FirstSelectALanguage');
240
+    echo '<div>';
241
+
242
+    $form = new FormValidator('form2', 'post', null, '', array('id' => 'form2'));
243
+    $form->addElement('hidden', 'text2voice_mode','pediaphon');
244
+    $form->addElement('hidden', 'id', $document_id);
245
+    $form->addElement('text', 'title', get_lang('Title'));
246
+    $form->addElement('select', 'lang', get_lang('Language'), $options_pedia, array('onclick' => 'update_voices(this.selectedIndex);'));
247
+    $form->addElement('select', 'voices', get_lang('Voice'), array(get_lang('FirstSelectALanguage')), array());
248
+    $speed_options = array();
249
+    $speed_options['1']     = get_lang('Normal');
250
+    $speed_options['0.75']  = get_lang('GoFaster');
251
+    $speed_options['0.8']   = get_lang('Fast');
252
+    $speed_options['1.2']   = get_lang('Slow');
253
+    $speed_options['1.6']   = get_lang('SlowDown');
254
+
255
+    $form->addElement('select', 'speed', get_lang('Speed'), $speed_options, array());
256
+    $form->addElement('textarea', 'text', get_lang('InsertText2Audio'), array('id' => 'textarea_pediaphon'));
257
+    //echo Display :: return_icon('info3.gif', get_lang('HelpPediaphon'), array('align' => 'absmiddle', 'hspace' => '3px'), false);
258
+    $form->addButtonSave(get_lang('SaveMP3'));
259
+    $defaults = array();
260
+    $defaults['lang'] = $selected_language;
261
+    $form->setDefaults($defaults);
262
+    $form->display();
263
+    echo '</div>';
264
+
265
+    ?>
266 266
 
267 267
 	<!-- javascript form name form2 update voices -->
268 268
 	<script type="text/javascript">
@@ -307,43 +307,43 @@  discard block
 block discarded – undo
307 307
 {
308 308
     $location='create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&dt2a=google';
309 309
 
310
-	//security
311
-	if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
312
-		echo '<script>window.location.href="'.$location.'"</script>';
313
-		return;
314
-	}
310
+    //security
311
+    if (!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
312
+        echo '<script>window.location.href="'.$location.'"</script>';
313
+        return;
314
+    }
315 315
 
316
-	$_course = api_get_course_info();
317
-	$_user = api_get_user_info();
316
+    $_course = api_get_course_info();
317
+    $_user = api_get_user_info();
318 318
 
319
-	$clean_title=trim($_POST['title']);
320
-	$clean_text=trim($_POST['text']);
321
-	if(empty($clean_title) || empty($clean_text)){
322
-		echo '<script>window.location.href="'.$location.'"</script>';
323
-		return;
324
-	}
325
-	$clean_title = Security::remove_XSS($clean_title);
326
-	$clean_title = Database::escape_string($clean_title);
327
-	$clean_title = str_replace(' ', '_', $clean_title);//compound file names
328
-
329
-	$clean_text = Security::remove_XSS($clean_text);
330
-	$clean_lang = Security::remove_XSS($_POST['lang']);
331
-
332
-	$extension='mp3';
333
-	$audio_filename=$clean_title.'.'.$extension;
334
-	$audio_title = str_replace('_',' ',$clean_title);
335
-
336
-	//prevent duplicates
337
-	if (file_exists($filepath.'/'.$clean_title.'.'.$extension)){
338
-		$i = 1;
339
-		while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) $i++;
340
-		$audio_filename = $clean_title . '_' . $i . '.'.$extension;
341
-		$audio_title = $clean_title . '_' . $i . '.'.$extension;
342
-		$audio_title = str_replace('_',' ',$audio_title);
343
-	}
319
+    $clean_title=trim($_POST['title']);
320
+    $clean_text=trim($_POST['text']);
321
+    if(empty($clean_title) || empty($clean_text)){
322
+        echo '<script>window.location.href="'.$location.'"</script>';
323
+        return;
324
+    }
325
+    $clean_title = Security::remove_XSS($clean_title);
326
+    $clean_title = Database::escape_string($clean_title);
327
+    $clean_title = str_replace(' ', '_', $clean_title);//compound file names
328
+
329
+    $clean_text = Security::remove_XSS($clean_text);
330
+    $clean_lang = Security::remove_XSS($_POST['lang']);
331
+
332
+    $extension='mp3';
333
+    $audio_filename=$clean_title.'.'.$extension;
334
+    $audio_title = str_replace('_',' ',$clean_title);
335
+
336
+    //prevent duplicates
337
+    if (file_exists($filepath.'/'.$clean_title.'.'.$extension)){
338
+        $i = 1;
339
+        while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) $i++;
340
+        $audio_filename = $clean_title . '_' . $i . '.'.$extension;
341
+        $audio_title = $clean_title . '_' . $i . '.'.$extension;
342
+        $audio_title = str_replace('_',' ',$audio_title);
343
+    }
344 344
 
345
-	$documentPath = $filepath.'/'.$audio_filename;
346
-	/*
345
+    $documentPath = $filepath.'/'.$audio_filename;
346
+    /*
347 347
 
348 348
 	//prev for a fine unicode, borrowed from main api TODO:clean
349 349
 	// Safe replacements for some non-letter characters (whitout blank spaces)
@@ -358,52 +358,52 @@  discard block
 block discarded – undo
358 358
 	$filename = api_transliterate($filename, 'x', $encoding);
359 359
     // Replacing remaining dangerous non-letter characters.
360 360
     $clean_text = str_replace($search, $replace, $filename);*/
361
-	$clean_text = api_replace_dangerous_char($clean_text);
361
+    $clean_text = api_replace_dangerous_char($clean_text);
362 362
 
363
-	// adding the file
364
-	// add new file to disk
363
+    // adding the file
364
+    // add new file to disk
365 365
 
366
-	$proxySettings = api_get_configuration_value('proxy_settings');
367
-	$url = "http://translate.google.com/translate_tts?tl=".$clean_lang."&q=".urlencode($clean_text)."";
366
+    $proxySettings = api_get_configuration_value('proxy_settings');
367
+    $url = "http://translate.google.com/translate_tts?tl=".$clean_lang."&q=".urlencode($clean_text)."";
368 368
 
369
-	if (empty($proxySettings)) {
370
-		$content = file_get_contents($url);
371
-	} else {
372
-		$context = stream_context_create($proxySettings);
373
-		$content = file_get_contents($url, false, $context);
374
-	}
369
+    if (empty($proxySettings)) {
370
+        $content = file_get_contents($url);
371
+    } else {
372
+        $context = stream_context_create($proxySettings);
373
+        $content = file_get_contents($url, false, $context);
374
+    }
375 375
 
376 376
     file_put_contents(
377 377
         $documentPath,
378 378
         $content
379 379
     );
380 380
 
381
-	// add document to database
382
-	$current_session_id = api_get_session_id();
383
-	$groupId = api_get_group_id();
384
-	$relativeUrlPath=$dir;
385
-	$doc_id = add_document(
386
-		$_course,
387
-		$relativeUrlPath.$audio_filename,
388
-		'file',
389
-		filesize($documentPath),
390
-		$audio_title
391
-	);
392
-	api_item_property_update(
393
-		$_course,
394
-		TOOL_DOCUMENT,
395
-		$doc_id,
396
-		'DocumentAdded',
397
-		$_user['user_id'],
398
-		$groupId,
399
-		null,
400
-		null,
401
-		null,
402
-		$current_session_id
403
-	);
404
-	Display::display_confirmation_message(get_lang('DocumentCreated'));
405
-	//return to location
406
-	echo '<script>window.location.href="'.$location.'"</script>';
381
+    // add document to database
382
+    $current_session_id = api_get_session_id();
383
+    $groupId = api_get_group_id();
384
+    $relativeUrlPath=$dir;
385
+    $doc_id = add_document(
386
+        $_course,
387
+        $relativeUrlPath.$audio_filename,
388
+        'file',
389
+        filesize($documentPath),
390
+        $audio_title
391
+    );
392
+    api_item_property_update(
393
+        $_course,
394
+        TOOL_DOCUMENT,
395
+        $doc_id,
396
+        'DocumentAdded',
397
+        $_user['user_id'],
398
+        $groupId,
399
+        null,
400
+        null,
401
+        null,
402
+        $current_session_id
403
+    );
404
+    Display::display_confirmation_message(get_lang('DocumentCreated'));
405
+    //return to location
406
+    echo '<script>window.location.href="'.$location.'"</script>';
407 407
 }
408 408
 
409 409
 /**
@@ -416,45 +416,45 @@  discard block
 block discarded – undo
416 416
  */
417 417
 function downloadMP3_pediaphon($filepath, $dir)
418 418
 {
419
-	$location='create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&dt2a=pediaphon';
420
-	//security
421
-	if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
422
-		echo '<script>window.location.href="'.$location.'"</script>';
423
-		return;
424
-	}
425
-	$_course = api_get_course_info();
426
-	$_user = api_get_user_info();
427
-	$clean_title=trim($_POST['title']);
428
-	$clean_title= Database::escape_string($clean_title);
429
-	$clean_text=trim($_POST['text']);
430
-	$clean_voices=Security::remove_XSS($_POST['voices']);
431
-	if(empty($clean_title) || empty($clean_text) || empty($clean_voices)){
432
-		echo '<script>window.location.href="'.$location.'"</script>';
433
-		return;
434
-	}
435
-	$clean_title = Security::remove_XSS($clean_title);
436
-	$clean_title = Database::escape_string($clean_title);
437
-	$clean_title = str_replace(' ', '_', $clean_title);//compound file names
438
-	$clean_text = Security::remove_XSS($clean_text);
439
-	$clean_lang = Security::remove_XSS($_POST['lang']);
440
-	$clean_speed = Security::remove_XSS($_POST['speed']);
441
-
442
-	$extension='mp3';
443
-	$audio_filename=$clean_title.'.'.$extension;
444
-	$audio_title = str_replace('_',' ',$clean_title);
445
-
446
-	//prevent duplicates
447
-	if (file_exists($filepath.'/'.$clean_title.'.'.$extension)){
448
-		$i = 1;
449
-		while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) $i++;
450
-		$audio_filename = $clean_title . '_' . $i . '.'.$extension;
451
-		$audio_title = $clean_title . '_' . $i . '.'.$extension;
452
-		$audio_title = str_replace('_',' ',$audio_title);
453
-	}
419
+    $location='create_audio.php?'.api_get_cidreq().'&id='.intval($_POST['id']).'&dt2a=pediaphon';
420
+    //security
421
+    if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) {
422
+        echo '<script>window.location.href="'.$location.'"</script>';
423
+        return;
424
+    }
425
+    $_course = api_get_course_info();
426
+    $_user = api_get_user_info();
427
+    $clean_title=trim($_POST['title']);
428
+    $clean_title= Database::escape_string($clean_title);
429
+    $clean_text=trim($_POST['text']);
430
+    $clean_voices=Security::remove_XSS($_POST['voices']);
431
+    if(empty($clean_title) || empty($clean_text) || empty($clean_voices)){
432
+        echo '<script>window.location.href="'.$location.'"</script>';
433
+        return;
434
+    }
435
+    $clean_title = Security::remove_XSS($clean_title);
436
+    $clean_title = Database::escape_string($clean_title);
437
+    $clean_title = str_replace(' ', '_', $clean_title);//compound file names
438
+    $clean_text = Security::remove_XSS($clean_text);
439
+    $clean_lang = Security::remove_XSS($_POST['lang']);
440
+    $clean_speed = Security::remove_XSS($_POST['speed']);
441
+
442
+    $extension='mp3';
443
+    $audio_filename=$clean_title.'.'.$extension;
444
+    $audio_title = str_replace('_',' ',$clean_title);
445
+
446
+    //prevent duplicates
447
+    if (file_exists($filepath.'/'.$clean_title.'.'.$extension)){
448
+        $i = 1;
449
+        while (file_exists($filepath.'/'.$clean_title.'_'.$i.'.'.$extension)) $i++;
450
+        $audio_filename = $clean_title . '_' . $i . '.'.$extension;
451
+        $audio_title = $clean_title . '_' . $i . '.'.$extension;
452
+        $audio_title = str_replace('_',' ',$audio_title);
453
+    }
454 454
 
455
-	$documentPath = $filepath.'/'.$audio_filename;
455
+    $documentPath = $filepath.'/'.$audio_filename;
456 456
 
457
-	/*//prev for a fine unicode, borrowed from main api TODO:clean
457
+    /*//prev for a fine unicode, borrowed from main api TODO:clean
458 458
 	// Safe replacements for some non-letter characters (whitout blank spaces)
459 459
 	$search  = array("\0", "\t", "\n", "\r", "\x0B", '/', "\\", '"', "'", '?', '*', '>', '<', '|', ':', '$', '(', ')', '^', '[', ']', '#', '+', '&', '%');
460 460
 	$replace = array('',  '_',  '_',  '_',  '_',    '-', '-',  '-', '_', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-');
@@ -467,48 +467,48 @@  discard block
 block discarded – undo
467 467
 	$filename = api_transliterate($filename, 'x', $encoding);
468 468
     // Replacing remaining dangerous non-letter characters.
469 469
     $clean_text = str_replace($search, $replace, $filename);*/
470
-	$clean_text = api_replace_dangerous_char($clean_text);
470
+    $clean_text = api_replace_dangerous_char($clean_text);
471 471
 
472
-	//adding the file
472
+    //adding the file
473 473
 
474
-	if ($clean_lang=='de') {
475
-		$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi';
476
-		$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/';
477
-	} else {
478
-		$url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi';//en, es, fr
479
-		$find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/';
480
-	}
474
+    if ($clean_lang=='de') {
475
+        $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi';
476
+        $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/(.*)\.mp3\"/';
477
+    } else {
478
+        $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_'.$clean_lang.'.cgi';//en, es, fr
479
+        $find_t2v = '/http\:\/\/www\.pediaphon\.org\/\~bischoff\/radiopedia\/mp3\/'.$clean_lang.'\/(.*)\.mp3\"/';
480
+    }
481 481
 
482
-	$data="stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak";
483
-	$opts = array('http' =>
484
-		array(
485
-		 'method'  => 'POST',
486
-		 'header'  =>"Content-Type: application/x-www-form-urlencoded\r\n",
487
-		 "Content-Length: " . strlen($data) . "\r\n",
488
-		 'content' => $data
489
-		)
490
-	);
491
-	$context  = stream_context_create($opts);
492
-	// Download the whole HTML page
493
-	$previous_returntext2voice = file_get_contents($url_pediaphon,false,$context);
494
-
495
-	//extract the audio file path
496
-	$search_source = preg_match($find_t2v, $previous_returntext2voice, $hits);
497
-	$souce_end = substr($hits[0], 0, -1);
498
-	//download file
499
-	$returntext2voice = file_get_contents($souce_end);
500
-	//save file
501
-	$f = @file_put_contents($documentPath, $returntext2voice);
502
-	if ($f === false && !empty($php_errormsg)) {
482
+    $data="stimme=".$clean_voices."&inputtext=".$clean_text."&speed=".$clean_speed."&go=speak";
483
+    $opts = array('http' =>
484
+        array(
485
+            'method'  => 'POST',
486
+            'header'  =>"Content-Type: application/x-www-form-urlencoded\r\n",
487
+            "Content-Length: " . strlen($data) . "\r\n",
488
+            'content' => $data
489
+        )
490
+    );
491
+    $context  = stream_context_create($opts);
492
+    // Download the whole HTML page
493
+    $previous_returntext2voice = file_get_contents($url_pediaphon,false,$context);
494
+
495
+    //extract the audio file path
496
+    $search_source = preg_match($find_t2v, $previous_returntext2voice, $hits);
497
+    $souce_end = substr($hits[0], 0, -1);
498
+    //download file
499
+    $returntext2voice = file_get_contents($souce_end);
500
+    //save file
501
+    $f = @file_put_contents($documentPath, $returntext2voice);
502
+    if ($f === false && !empty($php_errormsg)) {
503 503
                 error_log($php_errormsg);
504 504
             }
505
-	//add document to database
506
-	$current_session_id = api_get_session_id();
507
-	$groupId = api_get_group_id();
508
-	$relativeUrlPath=$dir;
509
-	$doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title);
510
-	api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
505
+    //add document to database
506
+    $current_session_id = api_get_session_id();
507
+    $groupId = api_get_group_id();
508
+    $relativeUrlPath=$dir;
509
+    $doc_id = add_document($_course, $relativeUrlPath.$audio_filename, 'file', filesize($documentPath), $audio_title);
510
+    api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
511 511
     Display::display_confirmation_message(get_lang('DocumentCreated'));
512
-	//return to location
513
-	echo '<script>window.location.href="'.$location.'"</script>';
512
+    //return to location
513
+    echo '<script>window.location.href="'.$location.'"</script>';
514 514
 }
Please login to merge, or discard this patch.