Completed
Push — 1.10.x ( 0db498...531f7d )
by Julito
55:48 queued 23:11
created
main/inc/lib/tracking.lib.php 1 patch
Spacing   +429 added lines, -429 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
                 }
78 78
 
79 79
                 $countUsers = count($users);
80
-                $averageProgress = empty($countUsers) ? 0 : $avg_student_progress/$countUsers;
81
-                $averageScore = empty($countUsers) ? 0 : $avg_student_score/$countUsers;
80
+                $averageProgress = empty($countUsers) ? 0 : $avg_student_progress / $countUsers;
81
+                $averageScore = empty($countUsers) ? 0 : $avg_student_score / $countUsers;
82 82
 
83 83
                 $group_item = array(
84 84
                     'id' => $group['id'],
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $extendedAttempt = null,
125 125
         $extendedAll = null,
126 126
         $type = 'classic',
127
-        $allowExtend =  true
127
+        $allowExtend = true
128 128
     ) {
129 129
         if (empty($courseInfo) || empty($lp_id)) {
130 130
             return null;
@@ -148,22 +148,22 @@  discard block
 block discarded – undo
148 148
         $extend_all = 0;
149 149
 
150 150
         if ($origin == 'tracking') {
151
-            $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
151
+            $url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin;
152 152
         } else {
153
-            $url_suffix = '&lp_id=' . $lp_id;
153
+            $url_suffix = '&lp_id='.$lp_id;
154 154
         }
155 155
 
156 156
         if (!empty($extendedAll)) {
157 157
             $extend_all_link = Display::url(
158 158
                 Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
159
-                api_get_self() . '?action=stats' . $url_suffix
159
+                api_get_self().'?action=stats'.$url_suffix
160 160
             );
161 161
 
162 162
             $extend_all = 1;
163 163
         } else {
164 164
             $extend_all_link = Display::url(
165 165
                 Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')),
166
-                api_get_self() . '?action=stats&extend_all=1' . $url_suffix
166
+                api_get_self().'?action=stats&extend_all=1'.$url_suffix
167 167
             );
168 168
         }
169 169
 
@@ -175,24 +175,24 @@  discard block
 block discarded – undo
175 175
 
176 176
         $actionColumn = null;
177 177
         if ($type == 'classic') {
178
-            $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
178
+            $actionColumn = ' <th>'.get_lang('Actions').'</th>';
179 179
         }
180 180
         $output .= '<div class="table-responsive">';
181 181
         $output .= '<table class="table tracking">
182 182
             <thead>
183 183
             <tr class="table-header">
184
-                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;') . '</th>
184
+                <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;').'</th>
185 185
                 <th colspan="4">
186
-                    ' . get_lang('ScormLessonTitle') .'
186
+                    ' . get_lang('ScormLessonTitle').'
187 187
                 </th>
188 188
                 <th colspan="2">
189
-                    ' . get_lang('ScormStatus') . '
189
+                    ' . get_lang('ScormStatus').'
190 190
                 </th>
191 191
                 <th colspan="2">
192
-                    ' . get_lang('ScormScore') . '
192
+                    ' . get_lang('ScormScore').'
193 193
                 </th>
194 194
                 <th colspan="2">
195
-                    ' . get_lang('ScormTime') . '
195
+                    ' . get_lang('ScormTime').'
196 196
                 </th>
197 197
                 '.$actionColumn.'
198 198
                 </tr>
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                 // Prepare statement to go through each attempt.
256 256
                 $viewCondition = null;
257 257
                 if (!empty($view)) {
258
-                    $viewCondition =  " AND v.view_count = $view  ";
258
+                    $viewCondition = " AND v.view_count = $view  ";
259 259
                 }
260 260
 
261 261
                 $sql = "SELECT
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
                                 FROM $TBL_QUIZ
304 304
                                 WHERE
305 305
                                     c_id = $course_id AND
306
-                                    id ='" . $my_path . "'";
306
+                                    id ='".$my_path."'";
307 307
                         $res_result_disabled = Database::query($sql);
308 308
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
309 309
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                     if (!empty($inter_num)) {
326 326
                         $extend_link = Display::url(
327 327
                               Display::return_icon('visible.gif', get_lang('HideAttemptView')),
328
-                              api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix
328
+                              api_get_self().'?action=stats&fold_id='.$my_item_id.$url_suffix
329 329
                         );
330 330
                     }
331 331
                     $title = $row['mytitle'];
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
                     $action = null;
345 345
                     if ($type == 'classic') {
346
-                        $action =  '<td></td>';
346
+                        $action = '<td></td>';
347 347
                     }
348 348
 
349 349
                     if (in_array($row['item_type'], $chapterTypes)) {
@@ -387,13 +387,13 @@  discard block
 block discarded – undo
387 387
                                 $extend_this_attempt = 1;
388 388
                                 $extend_attempt_link = Display::url(
389 389
                                     Display::return_icon('visible.gif', get_lang('HideAttemptView')),
390
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
390
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
391 391
                                 );
392 392
                             } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
393 393
                                 // The extend button for this attempt has not been clicked.
394 394
                                 $extend_attempt_link = Display::url(
395 395
                                     Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
396
-                                    api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
396
+                                    api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
397 397
                                 );
398 398
                             }
399 399
                         }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                         }
427 427
 
428 428
                         // Remove "NaN" if any (@todo: locate the source of these NaN)
429
-                        $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
429
+                        $time = str_replace('NaN', '00'.$h.'00\'00"', $time);
430 430
 
431 431
                         if ($row['item_type'] != 'dokeos_chapter') {
432 432
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
                                 $action = '<td></td>';
455 455
                             }
456 456
 
457
-                            $output .= '<tr class="' . $oddclass . '">
457
+                            $output .= '<tr class="'.$oddclass.'">
458 458
                                     <td></td>
459
-                                    <td>' . $extend_attempt_link . '</td>
460
-                                    <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td>
461
-                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
462
-                                    <td colspan="2">' . $view_score . '</td>
463
-                                    <td colspan="2">' . $time . '</td>
459
+                                    <td>' . $extend_attempt_link.'</td>
460
+                                    <td colspan="3">' . get_lang('Attempt').' '.$attemptCount.'</td>
461
+                                    <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type).'</td>
462
+                                    <td colspan="2">' . $view_score.'</td>
463
+                                    <td colspan="2">' . $time.'</td>
464 464
                                     '.$action.'
465 465
                                 </tr>';
466 466
                             $attemptCount++;
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
                                     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
474 474
                                         $temp[] = '/';
475 475
                                     } else {
476
-                                        $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
476
+                                        $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
477 477
                                     }
478 478
                                 } else {
479
-                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
479
+                                    $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
480 480
                                 }
481 481
                                 $temp[] = $time;
482 482
                                 $csv_content[] = $temp;
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
                                         <td></td>
514 514
                                         <td></td>
515 515
                                         <td></td>
516
-                                        <td>'.$interaction['order_id'] . '</td>
517
-                                        <td>'.$interaction['id'] . '</td>
516
+                                        <td>'.$interaction['order_id'].'</td>
517
+                                        <td>'.$interaction['id'].'</td>
518 518
                                         <td colspan="2">' . $interaction['type'].'</td>
519
-                                        <td>'.$student_response . '</td>
520
-                                        <td>'.$interaction['result'] . '</td>
521
-                                        <td>'.$interaction['latency'] . '</td>
522
-                                        <td>'.$interaction['time'] . '</td>
519
+                                        <td>'.$student_response.'</td>
520
+                                        <td>'.$interaction['result'].'</td>
521
+                                        <td>'.$interaction['latency'].'</td>
522
+                                        <td>'.$interaction['time'].'</td>
523 523
                                         '.$action.'
524 524
                                     </tr>';
525 525
                                 $counter++;
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
                                         <td></td>
537 537
                                         <td></td>
538 538
                                         <td></td>
539
-                                        <td>' . $interaction['order_id'] . '</td>
540
-                                        <td colspan="2">' . $interaction['objective_id'] . '</td>
541
-                                        <td colspan="2">' . $interaction['status'] .'</td>
542
-                                        <td>' . $interaction['score_raw'] . '</td>
543
-                                        <td>' . $interaction['score_max'] . '</td>
544
-                                        <td>' . $interaction['score_min'] . '</td>
539
+                                        <td>' . $interaction['order_id'].'</td>
540
+                                        <td colspan="2">' . $interaction['objective_id'].'</td>
541
+                                        <td colspan="2">' . $interaction['status'].'</td>
542
+                                        <td>' . $interaction['score_raw'].'</td>
543
+                                        <td>' . $interaction['score_max'].'</td>
544
+                                        <td>' . $interaction['score_min'].'</td>
545 545
                                         '.$action.'
546 546
                                      </tr>';
547 547
                                 $counter++;
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                         $my_path = Database::escape_string($my_path);
565 565
                         $sql = "SELECT results_disabled
566 566
                                 FROM $TBL_QUIZ
567
-                                WHERE c_id = $course_id AND id ='" . $my_path . "'";
567
+                                WHERE c_id = $course_id AND id ='".$my_path."'";
568 568
                         $res_result_disabled = Database::query($sql);
569 569
                         $row_result_disabled = Database::fetch_row($res_result_disabled);
570 570
 
@@ -588,14 +588,14 @@  discard block
 block discarded – undo
588 588
                             $extend_this_attempt = 1;
589 589
                             $extend_attempt_link = Display::url(
590 590
                                 Display::return_icon('visible.gif', get_lang('HideAttemptView')),
591
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix
591
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
592 592
                             );
593 593
                         } else {
594 594
                             // Same case if fold_attempt_id is set, so not implemented explicitly.
595 595
                             // The extend button for this attempt has not been clicked.
596 596
                             $extend_attempt_link = Display::url(
597 597
                                 Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
598
-                                api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
598
+                                api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
599 599
                             );
600 600
                         }
601 601
                     }
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
                     if ($inter_num > 1) {
611 611
                         $extend_link = Display::url(
612 612
                             Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
613
-                            api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix
613
+                            api_get_self().'?action=stats&extend_id='.$my_item_id.'&extend_attempt_id='.$row['iv_id'].$url_suffix
614 614
                         );
615 615
                     }
616 616
 
@@ -626,15 +626,15 @@  discard block
 block discarded – undo
626 626
 
627 627
                     // Selecting the exe_id from stats attempts tables in order to look the max score value.
628 628
 
629
-                    $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
629
+                    $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
630 630
                              WHERE
631
-                                exe_exo_id="' . $row['path'] . '" AND
632
-                                exe_user_id="' . $user_id . '" AND
633
-                                orig_lp_id = "' . $lp_id . '" AND
634
-                                orig_lp_item_id = "' . $row['myid'] . '" AND
635
-                                c_id = ' . $course_id . ' AND
631
+                                exe_exo_id="' . $row['path'].'" AND
632
+                                exe_user_id="' . $user_id.'" AND
633
+                                orig_lp_id = "' . $lp_id.'" AND
634
+                                orig_lp_item_id = "' . $row['myid'].'" AND
635
+                                c_id = ' . $course_id.' AND
636 636
                                 status <> "incomplete" AND
637
-                                session_id = ' . $session_id . '
637
+                                session_id = ' . $session_id.'
638 638
                              ORDER BY exe_date DESC
639 639
                              LIMIT 1';
640 640
 
@@ -665,8 +665,8 @@  discard block
 block discarded – undo
665 665
                                         FROM $TBL_LP_ITEM_VIEW
666 666
                                         WHERE
667 667
                                             c_id = $course_id AND
668
-                                            lp_item_id = '" . (int) $my_id . "' AND
669
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'
668
+                                            lp_item_id = '".(int) $my_id."' AND
669
+                                            lp_view_id = '" . (int) $my_lp_view_id."'
670 670
                                         ORDER BY view_count DESC limit 1";
671 671
                                 $res_score = Database::query($sql);
672 672
                                 $row_score = Database::fetch_array($res_score);
@@ -675,8 +675,8 @@  discard block
 block discarded – undo
675 675
                                         FROM $TBL_LP_ITEM_VIEW
676 676
                                         WHERE
677 677
                                             c_id = $course_id AND
678
-                                            lp_item_id = '" . (int) $my_id . "' AND
679
-                                            lp_view_id = '" . (int) $my_lp_view_id . "'";
678
+                                            lp_item_id = '".(int) $my_id."' AND
679
+                                            lp_view_id = '" . (int) $my_lp_view_id."'";
680 680
                                 $res_time = Database::query($sql);
681 681
                                 $row_time = Database::fetch_array($res_time);
682 682
 
@@ -735,16 +735,16 @@  discard block
 block discarded – undo
735 735
                     } else {
736 736
                         $correct_test_link = '-';
737 737
                         if ($row['item_type'] == 'quiz') {
738
-                            $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin;
739
-                            $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
738
+                            $my_url_suffix = '&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.intval($row['mylpid']).'&origin='.$origin;
739
+                            $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
740 740
                                      WHERE
741
-                                        exe_exo_id="' . $row['path'] . '" AND
742
-                                        exe_user_id="' . $user_id . '" AND
743
-                                        orig_lp_id = "' . $lp_id . '" AND
744
-                                        orig_lp_item_id = "' . $row['myid'] . '" AND
745
-                                        c_id = ' . $course_id . ' AND
741
+                                        exe_exo_id="' . $row['path'].'" AND
742
+                                        exe_user_id="' . $user_id.'" AND
743
+                                        orig_lp_id = "' . $lp_id.'" AND
744
+                                        orig_lp_item_id = "' . $row['myid'].'" AND
745
+                                        c_id = ' . $course_id.' AND
746 746
                                         status <> "incomplete" AND
747
-                                        session_id = ' . $session_id . '
747
+                                        session_id = ' . $session_id.'
748 748
                                      ORDER BY exe_date DESC ';
749 749
 
750 750
                             $resultLastAttempt = Database::query($sql);
@@ -756,12 +756,12 @@  discard block
 block discarded – undo
756 756
                                 ) {
757 757
                                     $correct_test_link = Display::url(
758 758
                                         Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')),
759
-                                        api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
759
+                                        api_get_self().'?action=stats'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
760 760
                                     );
761 761
                                 } else {
762 762
                                     $correct_test_link = Display::url(
763 763
                                         Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')),
764
-                                        api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id
764
+                                        api_get_self().'?action=stats&extend_attempt=1'.$my_url_suffix.'&session_id='.$session_id.'&lp_item_id='.$my_id
765 765
                                     );
766 766
                                 }
767 767
                             }
@@ -771,14 +771,14 @@  discard block
 block discarded – undo
771 771
 
772 772
                         $action = null;
773 773
                         if ($type == 'classic') {
774
-                            $action =  '<td>' . $correct_test_link . '</td>';
774
+                            $action = '<td>'.$correct_test_link.'</td>';
775 775
                         }
776 776
 
777 777
                         if ($lp_id == $my_lp_id && false) {
778 778
 
779
-                            $output .= '<tr class =' . $oddclass . '>
780
-                                    <td>' . $extend_link . '</td>
781
-                                    <td colspan="4">' . $title . '</td>
779
+                            $output .= '<tr class ='.$oddclass.'>
780
+                                    <td>' . $extend_link.'</td>
781
+                                    <td colspan="4">' . $title.'</td>
782 782
                                     <td colspan="2">&nbsp;</td>
783 783
                                     <td colspan="2">&nbsp;</td>
784 784
                                     <td colspan="2">&nbsp;</td>
@@ -803,13 +803,13 @@  discard block
 block discarded – undo
803 803
                                     $scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
804 804
                                 }
805 805
                             } else {
806
-                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
806
+                                $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.$maxscore);
807 807
                             }
808 808
 
809 809
                             $output .= '
810 810
                                 <td>'.$extend_link.'</td>
811
-                                <td colspan="4">' . $title . '</td>
812
-                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status) .'</td>
811
+                                <td colspan="4">' . $title.'</td>
812
+                                <td colspan="2">' . learnpathitem::humanize_status($lesson_status).'</td>
813 813
                                 <td colspan="2">'.$scoreItem.'</td>
814 814
                                 <td colspan="2">'.$time.'</td>
815 815
                                 '.$action.'
@@ -826,10 +826,10 @@  discard block
 block discarded – undo
826 826
                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
827 827
                                     $temp[] = '/';
828 828
                                 } else {
829
-                                    $temp[] = ($score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
829
+                                    $temp[] = ($score == 0 ? '0/'.$maxscore : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
830 830
                                 }
831 831
                             } else {
832
-                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)));
832
+                                $temp[] = ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score.'/'.float_format($maxscore, 1)));
833 833
                             }
834 834
                             $temp[] = $time;
835 835
                             $csv_content[] = $temp;
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
                     $action = null;
842 842
                     if ($type == 'classic') {
843
-                        $action =  '<td></td>';
843
+                        $action = '<td></td>';
844 844
                     }
845 845
 
846 846
                     if ($extend_this_attempt || $extend_all) {
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
                                     <td></td>
878 878
                                     <td></td>
879 879
                                     <td></td>
880
-                                    <td>' . $interaction['order_id'] . '</td>
881
-                                    <td colspan="2">'.$interaction['objective_id'] . '</td>
882
-                                    <td colspan="2">' . $interaction['status'] . '</td>
880
+                                    <td>' . $interaction['order_id'].'</td>
881
+                                    <td colspan="2">'.$interaction['objective_id'].'</td>
882
+                                    <td colspan="2">' . $interaction['status'].'</td>
883 883
                                     <td>' . $interaction['score_raw'].'</td>
884
-                                    <td>' . $interaction['score_max'] .'</td>
884
+                                    <td>' . $interaction['score_max'].'</td>
885 885
                                     <td>' . $interaction['score_min'].'</td>
886 886
                                     '.$action.'
887 887
                                </tr>';
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
                     }
891 891
 
892 892
                     // Attempts listing by exercise.
893
-                    if ($lp_id == $my_lp_id && $lp_item_id== $my_id && $extendedAttempt) {
893
+                    if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) {
894 894
                         // Get attempts of a exercise.
895 895
                         if (!empty($lp_id) &&
896 896
                             !empty($lp_item_id) &&
@@ -905,15 +905,15 @@  discard block
 block discarded – undo
905 905
                             $row_path = Database::fetch_array($res_path);
906 906
 
907 907
                             if (Database::num_rows($res_path) > 0) {
908
-                                $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
908
+                                $sql = 'SELECT * FROM '.$tbl_stats_exercices.'
909 909
                                         WHERE
910
-                                            exe_exo_id="' . (int) $row_path['path'] . '" AND
910
+                                            exe_exo_id="' . (int) $row_path['path'].'" AND
911 911
                                             status <> "incomplete" AND
912
-                                            exe_user_id="' . $user_id . '" AND
913
-                                            orig_lp_id = "' . (int) $lp_id . '" AND
914
-                                            orig_lp_item_id = "' . (int) $lp_item_id . '" AND
915
-                                            c_id = ' . $course_id . '  AND
916
-                                            session_id = ' . $session_id . '
912
+                                            exe_user_id="' . $user_id.'" AND
913
+                                            orig_lp_id = "' . (int) $lp_id.'" AND
914
+                                            orig_lp_item_id = "' . (int) $lp_item_id.'" AND
915
+                                            c_id = ' . $course_id.'  AND
916
+                                            session_id = ' . $session_id.'
917 917
                                         ORDER BY exe_date';
918 918
                                 $res_attempts = Database::query($sql);
919 919
                                 $num_attempts = Database::num_rows($res_attempts);
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
                                         if ($mktime_start_date && $mktime_exe_date) {
932 932
                                             $mytime = ((int) $mktime_exe_date - (int) $mktime_start_date);
933 933
                                             $time_attemp = learnpathItem :: getScormTimeFromParameter('js', $mytime);
934
-                                            $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
934
+                                            $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
935 935
                                         } else {
936 936
                                             $time_attemp = ' - ';
937 937
                                         }
@@ -957,33 +957,33 @@  discard block
 block discarded – undo
957 957
                                             $my_lesson_status = learnpathitem::humanize_status('incomplete');
958 958
                                         }
959 959
 
960
-                                        $output .= '<tr class="' . $oddclass . '" >
960
+                                        $output .= '<tr class="'.$oddclass.'" >
961 961
                                         <td></td>
962
-                                        <td>' . $extend_attempt_link . '</td>
963
-                                        <td colspan="3">' . get_lang('Attempt').' '. $n.'</td>
964
-                                        <td colspan="2">' . $my_lesson_status . '</td>
965
-                                        <td colspan="2">'.$view_score . '</td>
966
-                                        <td colspan="2">'.$time_attemp . '</td>';
962
+                                        <td>' . $extend_attempt_link.'</td>
963
+                                        <td colspan="3">' . get_lang('Attempt').' '.$n.'</td>
964
+                                        <td colspan="2">' . $my_lesson_status.'</td>
965
+                                        <td colspan="2">'.$view_score.'</td>
966
+                                        <td colspan="2">'.$time_attemp.'</td>';
967 967
                                         if ($action == 'classic') {
968 968
                                             if ($origin != 'tracking') {
969 969
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
970 970
                                                     $output .= '<td>
971
-                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
971
+                                                            <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
972 972
                                                             </td>';
973 973
                                                 } else {
974 974
                                                     $output .= '<td>
975
-                                                            <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
976
-                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
975
+                                                            <a href="../exercice/exercise_show.php?origin=' . $origin.'&id='.$my_exe_id.'&cidReq='.$courseCode.'" target="_parent">
976
+                                                            <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAttempt').'" title="'.get_lang('ShowAttempt').'">
977 977
                                                             </a></td>';
978 978
                                                 }
979 979
                                             } else {
980 980
                                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
981 981
                                                     $output .= '<td>
982
-                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
982
+                                                                <img src="' . Display::returnIconPath('quiz_na.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></td>';
983 983
                                                 } else {
984 984
                                                     $output .= '<td>
985
-                                                                    <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
986
-                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
985
+                                                                    <a href="../exercice/exercise_show.php?cidReq=' . $courseCode.'&origin=correct_exercise_in_lp&id='.$my_exe_id.'" target="_parent">
986
+                                                                    <img src="' . Display::returnIconPath('quiz.gif').'" alt="'.get_lang('ShowAndQualifyAttempt').'" title="'.get_lang('ShowAndQualifyAttempt').'"></a></td>';
987 987
                                                 }
988 988
                                             }
989 989
                                         }
@@ -1042,13 +1042,13 @@  discard block
 block discarded – undo
1042 1042
         }
1043 1043
 
1044 1044
         $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
1045
-        $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
1045
+        $total_time = str_replace('NaN', '00'.$h.'00\'00"', $total_time);
1046 1046
 
1047 1047
         if (!$is_allowed_to_edit && $result_disabled_ext_all) {
1048 1048
             $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
1049 1049
         } else {
1050 1050
             if (is_numeric($total_score)) {
1051
-                $final_score = $total_score . '%';
1051
+                $final_score = $total_score.'%';
1052 1052
             } else {
1053 1053
                 $final_score = $total_score;
1054 1054
             }
@@ -1064,19 +1064,19 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
         $action = null;
1066 1066
         if ($type == 'classic') {
1067
-            $action =  '<td></td>';
1067
+            $action = '<td></td>';
1068 1068
         }
1069 1069
 
1070 1070
         $output .= '<tr class="'.$oddclass.'">
1071 1071
                 <td></td>
1072 1072
                 <td colspan="4">
1073
-                    <i>' . get_lang('AccomplishedStepsTotal') .'</i>
1073
+                    <i>' . get_lang('AccomplishedStepsTotal').'</i>
1074 1074
                 </td>
1075 1075
                 <td colspan="2">'.$progress.'%</td>
1076 1076
                 <td colspan="2">
1077 1077
                     ' . $final_score.'
1078 1078
                 </td>
1079
-                <td colspan="2">' . $total_time . '</div>
1079
+                <td colspan="2">' . $total_time.'</div>
1080 1080
                 '.$action.'
1081 1081
            </tr>';
1082 1082
 
@@ -1416,7 +1416,7 @@  discard block
 block discarded – undo
1416 1416
     	$tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1417 1417
     	if (is_array($user_id)) {
1418 1418
     	    $user_id = array_map('intval', $user_id);
1419
-    		$condition_user = " AND user_id IN (".implode(',',$user_id).") ";
1419
+    		$condition_user = " AND user_id IN (".implode(',', $user_id).") ";
1420 1420
     	} else {
1421 1421
     		$user_id = intval($user_id);
1422 1422
     		$condition_user = " AND user_id = $user_id ";
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
     {
1453 1453
     	$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1454 1454
     	$sql = 'SELECT login_date
1455
-    	        FROM ' . $tbl_track_login . '
1456
-                WHERE login_user_id = ' . intval($student_id) . '
1455
+    	        FROM ' . $tbl_track_login.'
1456
+                WHERE login_user_id = ' . intval($student_id).'
1457 1457
                 ORDER BY login_date ASC
1458 1458
                 LIMIT 0,1';
1459 1459
 
1460 1460
     	$rs = Database::query($sql);
1461
-    	if (Database::num_rows($rs)>0) {
1461
+    	if (Database::num_rows($rs) > 0) {
1462 1462
     		if ($first_login_date = Database::result($rs, 0, 0)) {
1463 1463
                 return api_convert_and_format_date(
1464 1464
                     $first_login_date,
@@ -1483,8 +1483,8 @@  discard block
 block discarded – undo
1483 1483
     {
1484 1484
     	$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
1485 1485
     	$sql = 'SELECT login_date
1486
-    	        FROM ' . $table . '
1487
-                WHERE login_user_id = ' . intval($student_id) . '
1486
+    	        FROM ' . $table.'
1487
+                WHERE login_user_id = ' . intval($student_id).'
1488 1488
                 ORDER BY login_date
1489 1489
                 DESC LIMIT 0,1';
1490 1490
 
@@ -1493,18 +1493,18 @@  discard block
 block discarded – undo
1493 1493
     		if ($last_login_date = Database::result($rs, 0, 0)) {
1494 1494
     			$last_login_date = api_get_local_time($last_login_date);
1495 1495
     			if ($return_timestamp) {
1496
-    				return api_strtotime($last_login_date,'UTC');
1496
+    				return api_strtotime($last_login_date, 'UTC');
1497 1497
     			} else {
1498 1498
     				if (!$warning_message) {
1499 1499
     					return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1500 1500
     				} else {
1501
-    					$timestamp = api_strtotime($last_login_date,'UTC');
1501
+    					$timestamp = api_strtotime($last_login_date, 'UTC');
1502 1502
     					$currentTimestamp = time();
1503 1503
 
1504 1504
     					//If the last connection is > than 7 days, the text is red
1505 1505
     					//345600 = 7 days in seconds
1506 1506
     					if ($currentTimestamp - $timestamp > 604800) {
1507
-    						return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
1507
+    						return '<span style="color: #F00;">'.api_format_date($last_login_date, DATE_FORMAT_SHORT).'</span>';
1508 1508
     					} else {
1509 1509
     						return api_format_date($last_login_date, DATE_FORMAT_SHORT);
1510 1510
     					}
@@ -1539,7 +1539,7 @@  discard block
 block discarded – undo
1539 1539
         $sql = "$select
1540 1540
                 FROM $tbl_track_login
1541 1541
                 WHERE
1542
-                    login_user_id IN (' ". implode("','", $studentList) . "' ) AND
1542
+                    login_user_id IN (' ".implode("','", $studentList)."' ) AND
1543 1543
                     login_date < '$date'
1544 1544
                 ";
1545 1545
         $rs = Database::query($sql);
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
                               '.Display::return_icon('messagebox_warning.gif').'
1639 1639
                              </a>'
1640 1640
                             : null;
1641
-    					return $icon. Display::label($last_login_date, 'warning');
1641
+    					return $icon.Display::label($last_login_date, 'warning');
1642 1642
     				} else {
1643 1643
     					return $last_login_date;
1644 1644
     				}
@@ -1673,8 +1673,8 @@  discard block
 block discarded – undo
1673 1673
 
1674 1674
         // Given we're storing in cache, round the start and end times
1675 1675
         // to the lower minute
1676
-        $roundedStart = substr($start, 0, -2) . '00';
1677
-        $roundedStop = substr($stop, 0, -2) . '00';
1676
+        $roundedStart = substr($start, 0, -2).'00';
1677
+        $roundedStop = substr($stop, 0, -2).'00';
1678 1678
         $roundedStart = Database::escape_string($roundedStart);
1679 1679
         $roundedStop = Database::escape_string($roundedStop);
1680 1680
 
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
     	$session_id  = intval($session_id);
1685 1685
     	$count = 0;
1686 1686
         $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
1687
-        $sql =  "SELECT count(*) as count_connections
1687
+        $sql = "SELECT count(*) as count_connections
1688 1688
                 FROM $tbl_track_e_course_access
1689 1689
                 WHERE
1690 1690
                     c_id = $courseId AND
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
                 $count = apcu_fetch($apc_var);
1707 1707
             } else {
1708 1708
                 $rs = Database::query($sql);
1709
-                if (Database::num_rows($rs)>0) {
1709
+                if (Database::num_rows($rs) > 0) {
1710 1710
                     $row = Database::fetch_object($rs);
1711 1711
                     $count = $row->count_connections;
1712 1712
                 }
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             }
1716 1716
         } else {
1717 1717
             $rs = Database::query($sql);
1718
-            if (Database::num_rows($rs)>0) {
1718
+            if (Database::num_rows($rs) > 0) {
1719 1719
                 $row = Database::fetch_object($rs);
1720 1720
                 $count = $row->count_connections;
1721 1721
             }
@@ -1737,14 +1737,14 @@  discard block
 block discarded – undo
1737 1737
     	$tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1738 1738
 
1739 1739
     	$sql = 'SELECT DISTINCT c_id
1740
-                FROM ' . $tbl_course_rel_user . '
1740
+                FROM ' . $tbl_course_rel_user.'
1741 1741
                 WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH;
1742 1742
     	$rs = Database::query($sql);
1743 1743
     	$nb_courses = Database::num_rows($rs);
1744 1744
 
1745 1745
     	if ($include_sessions) {
1746 1746
     		$sql = 'SELECT DISTINCT c_id
1747
-                    FROM ' . $tbl_session_course_rel_user . '
1747
+                    FROM ' . $tbl_session_course_rel_user.'
1748 1748
                     WHERE user_id = ' . $user_id;
1749 1749
     		$rs = Database::query($sql);
1750 1750
     		$nb_courses += Database::num_rows($rs);
@@ -1791,7 +1791,7 @@  discard block
 block discarded – undo
1791 1791
     		$condition_quiz = "";
1792 1792
     		if (!empty($exercise_id)) {
1793 1793
     			$exercise_id = intval($exercise_id);
1794
-    			$condition_quiz =" AND id = $exercise_id ";
1794
+    			$condition_quiz = " AND id = $exercise_id ";
1795 1795
     		}
1796 1796
 
1797 1797
     		// Compose a filter based on optional session id given
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
                         }
1841 1841
                     }
1842 1842
                     if (!empty($exercise_list)) {
1843
-                        $exercise_id = implode("','",$exercise_list);
1843
+                        $exercise_id = implode("','", $exercise_list);
1844 1844
                     }
1845 1845
     			}
1846 1846
 
@@ -1865,10 +1865,10 @@  discard block
 block discarded – undo
1865 1865
     			$quiz_avg_score = null;
1866 1866
 
1867 1867
     			if (!empty($row['avg_score'])) {
1868
-    				$quiz_avg_score = round($row['avg_score'],2);
1868
+    				$quiz_avg_score = round($row['avg_score'], 2);
1869 1869
     			}
1870 1870
 
1871
-    			if(!empty($row['num_attempts'])) {
1871
+    			if (!empty($row['num_attempts'])) {
1872 1872
     				$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
1873 1873
     			}
1874 1874
     			if (is_array($student_id)) {
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
             $row = Database::fetch_row($rs);
1999 1999
             $count = $row[0];
2000 2000
         }
2001
-        $count = ($count != 0 ) ? 100*round(intval($count)/count($exercise_list), 2) .'%' : '0%';
2001
+        $count = ($count != 0) ? 100 * round(intval($count) / count($exercise_list), 2).'%' : '0%';
2002 2002
         return $count;
2003 2003
     }
2004 2004
 
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
                 );
2024 2024
 
2025 2025
                 if (!empty($best_attempt) && !empty($best_attempt['exe_weighting'])) {
2026
-                    $result += $best_attempt['exe_result']/$best_attempt['exe_weighting'];
2026
+                    $result += $best_attempt['exe_result'] / $best_attempt['exe_weighting'];
2027 2027
                 }
2028 2028
             }
2029 2029
             $result = $result / count($exercise_list);
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
         $query = sprintf($sql, intval($courseId), $sessionId);
2061 2061
         $rs = Database::query($query);
2062 2062
         $teachers = array();
2063
-        while ($teacher = Database::fetch_array($rs,'ASSOC')) {
2063
+        while ($teacher = Database::fetch_array($rs, 'ASSOC')) {
2064 2064
             $teachers[] = $teacher;
2065 2065
         }
2066 2066
         $data = array();
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
             $data[] = array(
2185 2185
                 'course' => $course['title'],
2186 2186
                 'session' => $teacher['name'],
2187
-                'tutor' => $tutor['username'] . ' - ' . $tutor['lastname'] . ' ' . $tutor['firstname'],
2187
+                'tutor' => $tutor['username'].' - '.$tutor['lastname'].' '.$tutor['firstname'],
2188 2188
                 'documents' => $totalDocuments,
2189 2189
                 'links' => $totalLinks,
2190 2190
                 'forums' => $totalForums,
@@ -2247,7 +2247,7 @@  discard block
 block discarded – undo
2247 2247
             for ($i = 0; $i < count($lpIdList); $i++) {
2248 2248
                 $placeHolders[] = '?';
2249 2249
             }
2250
-            $lpConditions['AND id IN(' . implode(', ', $placeHolders) . ') '] = $lpIdList;
2250
+            $lpConditions['AND id IN('.implode(', ', $placeHolders).') '] = $lpIdList;
2251 2251
         }
2252 2252
 
2253 2253
         if ($onlySeriousGame) {
@@ -2267,14 +2267,14 @@  discard block
 block discarded – undo
2267 2267
 
2268 2268
         $conditions = [
2269 2269
             " c_id = {$courseInfo['real_id']} ",
2270
-            " lp_view.lp_id IN(" . implode(', ', $filteredLP) . ") "
2270
+            " lp_view.lp_id IN(".implode(', ', $filteredLP).") "
2271 2271
         ];
2272 2272
 
2273 2273
         $groupBy = 'GROUP BY lp_id';
2274 2274
 
2275 2275
         if (is_array($studentId)) {
2276 2276
             $studentId = array_map('intval', $studentId);
2277
-            $conditions[] = " lp_view.user_id IN (" . implode(',', $studentId) . ")  ";
2277
+            $conditions[] = " lp_view.user_id IN (".implode(',', $studentId).")  ";
2278 2278
 
2279 2279
 
2280 2280
         } else {
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
             // Compose a filter based on optional learning paths list given
2410 2410
             $condition_lp = "";
2411 2411
             if (count($lp_ids) > 0) {
2412
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2412
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2413 2413
             }
2414 2414
 
2415 2415
             // Compose a filter based on optional session id
@@ -2449,9 +2449,9 @@  discard block
 block discarded – undo
2449 2449
             // prepare filter on users
2450 2450
             if (is_array($student_id)) {
2451 2451
                 array_walk($student_id, 'intval');
2452
-                $condition_user1 =" AND user_id IN (".implode(',', $student_id).") ";
2452
+                $condition_user1 = " AND user_id IN (".implode(',', $student_id).") ";
2453 2453
             } else {
2454
-                $condition_user1 =" AND user_id = $student_id ";
2454
+                $condition_user1 = " AND user_id = $student_id ";
2455 2455
             }
2456 2456
 
2457 2457
             if ($count_row_lp > 0 && !empty($student_id)) {
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
                                     ORDER BY lp_item_id";
2495 2495
                             $res_lp_item = Database::query($sql);
2496 2496
 
2497
-                            while ($row_lp_item = Database::fetch_array($res_lp_item,'ASSOC')) {
2497
+                            while ($row_lp_item = Database::fetch_array($res_lp_item, 'ASSOC')) {
2498 2498
                                 $my_lp_item_id = $row_lp_item['lp_item_id'];
2499 2499
 
2500 2500
                                 // Getting the most recent attempt
@@ -2517,8 +2517,8 @@  discard block
 block discarded – undo
2517 2517
                                         ORDER BY view_count DESC
2518 2518
                                         LIMIT 1";
2519 2519
                                 $res_lp_item_result = Database::query($sql);
2520
-                                while ($row_max_score = Database::fetch_array($res_lp_item_result,'ASSOC')) {
2521
-                                    $list[]= $row_max_score;
2520
+                                while ($row_max_score = Database::fetch_array($res_lp_item_result, 'ASSOC')) {
2521
+                                    $list[] = $row_max_score;
2522 2522
                                 }
2523 2523
                             }
2524 2524
                         } else {
@@ -2542,8 +2542,8 @@  discard block
 block discarded – undo
2542 2542
                             if ($debug) echo $sql.'<br />';
2543 2543
                             $res_max_score = Database::query($sql);
2544 2544
 
2545
-                            while ($row_max_score = Database::fetch_array($res_max_score,'ASSOC')) {
2546
-                                $list[]= $row_max_score;
2545
+                            while ($row_max_score = Database::fetch_array($res_max_score, 'ASSOC')) {
2546
+                                $list[] = $row_max_score;
2547 2547
                             }
2548 2548
                         }
2549 2549
 
@@ -2558,7 +2558,7 @@  discard block
 block discarded – undo
2558 2558
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2559 2559
                             $score = $row_max_score['score'];
2560 2560
 
2561
-                            if ($debug) echo '<h3>Item Type: ' .$row_max_score['item_type'].'</h3>';
2561
+                            if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2562 2562
 
2563 2563
                             if ($row_max_score['item_type'] == 'sco') {
2564 2564
                                 /* Check if it is sco (easier to get max_score)
@@ -2576,7 +2576,7 @@  discard block
 block discarded – undo
2576 2576
                                 }
2577 2577
                                 // Avoid division by zero errors
2578 2578
                                 if (!empty($max_score)) {
2579
-                                    $lp_partial_total += $score/$max_score;
2579
+                                    $lp_partial_total += $score / $max_score;
2580 2580
                                 }
2581 2581
                                 if ($debug) echo '<b>$lp_partial_total, $score, $max_score '.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2582 2582
                             } else {
@@ -2600,10 +2600,10 @@  discard block
 block discarded – undo
2600 2600
                                         ORDER BY exe_date DESC
2601 2601
                                         LIMIT 1";
2602 2602
 
2603
-                                if ($debug) echo $sql .'<br />';
2603
+                                if ($debug) echo $sql.'<br />';
2604 2604
                                 $result_last_attempt = Database::query($sql);
2605 2605
                                 $num = Database :: num_rows($result_last_attempt);
2606
-                                if ($num > 0 ) {
2606
+                                if ($num > 0) {
2607 2607
                                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
2608 2608
                                     if ($debug) echo $id_last_attempt.'<br />';
2609 2609
 
@@ -2632,13 +2632,13 @@  discard block
 block discarded – undo
2632 2632
                                         $max_score = $row_max_score_bis['maxscore'];
2633 2633
                                     }
2634 2634
                                     if (!empty($max_score) && floatval($max_score) > 0) {
2635
-                                        $lp_partial_total += $score/$max_score;
2635
+                                        $lp_partial_total += $score / $max_score;
2636 2636
                                     }
2637 2637
                                     if ($debug) echo '$lp_partial_total, $score, $max_score <b>'.$lp_partial_total.' '.$score.' '.$max_score.'</b><br />';
2638 2638
                                 }
2639 2639
                             }
2640 2640
 
2641
-                            if (in_array($row_max_score['item_type'], array('quiz','sco'))) {
2641
+                            if (in_array($row_max_score['item_type'], array('quiz', 'sco'))) {
2642 2642
                                 // Normal way
2643 2643
                                 if ($use_max_score[$lp_id]) {
2644 2644
                                     $count_items++;
@@ -2673,8 +2673,8 @@  discard block
 block discarded – undo
2673 2673
                     if ($debug) echo $sql;
2674 2674
                     $result_have_quiz = Database::query($sql);
2675 2675
 
2676
-                    if (Database::num_rows($result_have_quiz) > 0 ) {
2677
-                        $row = Database::fetch_array($result_have_quiz,'ASSOC');
2676
+                    if (Database::num_rows($result_have_quiz) > 0) {
2677
+                        $row = Database::fetch_array($result_have_quiz, 'ASSOC');
2678 2678
                         if (is_numeric($row['count']) && $row['count'] != 0) {
2679 2679
                             $lp_with_quiz++;
2680 2680
                         }
@@ -2686,7 +2686,7 @@  discard block
 block discarded – undo
2686 2686
 
2687 2687
                 if ($lp_with_quiz != 0) {
2688 2688
                     if (!$return_array) {
2689
-                        $score_of_scorm_calculate = round(($global_result/$lp_with_quiz),2);
2689
+                        $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2);
2690 2690
                         if ($debug) var_dump($score_of_scorm_calculate);
2691 2691
                         if (empty($lp_ids)) {
2692 2692
                             if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
@@ -2760,9 +2760,9 @@  discard block
 block discarded – undo
2760 2760
 
2761 2761
         if (is_array($student_id)) {
2762 2762
             array_walk($student_id, 'intval');
2763
-            $conditions[] =" lp_view.user_id IN (".implode(',', $student_id).") ";
2763
+            $conditions[] = " lp_view.user_id IN (".implode(',', $student_id).") ";
2764 2764
         } else {
2765
-            $conditions[] =" lp_view.user_id = $student_id ";
2765
+            $conditions[] = " lp_view.user_id = $student_id ";
2766 2766
         }
2767 2767
 
2768 2768
         $conditionsToString = implode('AND ', $conditions);
@@ -2786,7 +2786,7 @@  discard block
 block discarded – undo
2786 2786
             return 0;
2787 2787
         }
2788 2788
 
2789
-        return ($row['sum_score'] / $row['sum_max_score'])*100;
2789
+        return ($row['sum_score'] / $row['sum_max_score']) * 100;
2790 2790
 
2791 2791
     }
2792 2792
 
@@ -2816,7 +2816,7 @@  discard block
 block discarded – undo
2816 2816
             // Compose a filter based on optional learning paths list given
2817 2817
             $condition_lp = "";
2818 2818
             if (count($lp_ids) > 0) {
2819
-                $condition_lp =" AND id IN(".implode(',',$lp_ids).") ";
2819
+                $condition_lp = " AND id IN(".implode(',', $lp_ids).") ";
2820 2820
             }
2821 2821
 
2822 2822
             // Compose a filter based on optional session id
@@ -2878,7 +2878,7 @@  discard block
 block discarded – undo
2878 2878
 
2879 2879
         if (!empty($course)) {
2880 2880
 
2881
-            $course_id	 = $course['real_id'];
2881
+            $course_id = $course['real_id'];
2882 2882
 
2883 2883
             $lp_table    = Database :: get_course_table(TABLE_LP_MAIN);
2884 2884
             $t_lpv       = Database :: get_course_table(TABLE_LP_VIEW);
@@ -2892,8 +2892,8 @@  discard block
 block discarded – undo
2892 2892
             // calculates last connection time
2893 2893
             if ($count_row_lp > 0) {
2894 2894
                 $sql = 'SELECT MAX(start_time)
2895
-                        FROM ' . $t_lpiv . ' AS item_view
2896
-                        INNER JOIN ' . $t_lpv . ' AS view
2895
+                        FROM ' . $t_lpiv.' AS item_view
2896
+                        INNER JOIN ' . $t_lpv.' AS view
2897 2897
                             ON item_view.lp_view_id = view.id
2898 2898
                         WHERE
2899 2899
                             item_view.c_id 		= '.$course_id.' AND
@@ -2929,15 +2929,15 @@  discard block
 block discarded – undo
2929 2929
 
2930 2930
         // At first, courses where $coach_id is coach of the course //
2931 2931
         $sql = 'SELECT session_id, c_id
2932
-                FROM ' . $tbl_session_course_user . '
2932
+                FROM ' . $tbl_session_course_user.'
2933 2933
                 WHERE user_id=' . $coach_id.' AND status=2';
2934 2934
 
2935 2935
         if (api_is_multiple_url_enabled()) {
2936
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2936
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2937 2937
             $access_url_id = api_get_current_access_url_id();
2938 2938
             if ($access_url_id != -1) {
2939 2939
                 $sql = 'SELECT scu.session_id, scu.c_id
2940
-                    FROM ' . $tbl_session_course_user . ' scu
2940
+                    FROM ' . $tbl_session_course_user.' scu
2941 2941
                     INNER JOIN '.$tbl_session_rel_access_url.'  sru
2942 2942
                     ON (scu.session_id=sru.session_id)
2943 2943
                     WHERE
@@ -2971,28 +2971,28 @@  discard block
 block discarded – undo
2971 2971
 
2972 2972
         // Then, courses where $coach_id is coach of the session    //
2973 2973
         $sql = 'SELECT session_course_user.user_id
2974
-                FROM ' . $tbl_session_course_user . ' as session_course_user
2974
+                FROM ' . $tbl_session_course_user.' as session_course_user
2975 2975
                 INNER JOIN     '.$tbl_session_user.' sru
2976 2976
                 ON session_course_user.user_id = sru.user_id AND session_course_user.session_id = sru.session_id
2977
-                INNER JOIN ' . $tbl_session_course . ' as session_course
2977
+                INNER JOIN ' . $tbl_session_course.' as session_course
2978 2978
                 ON session_course.c_id = session_course_user.c_id
2979 2979
                 AND session_course_user.session_id = session_course.session_id
2980
-                INNER JOIN ' . $tbl_session . ' as session
2980
+                INNER JOIN ' . $tbl_session.' as session
2981 2981
                 ON session.id = session_course.session_id
2982 2982
                 AND session.id_coach = ' . $coach_id;
2983 2983
         if (api_is_multiple_url_enabled()) {
2984
-            $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2984
+            $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
2985 2985
             $access_url_id = api_get_current_access_url_id();
2986
-            if ($access_url_id != -1){
2986
+            if ($access_url_id != -1) {
2987 2987
                 $sql = 'SELECT session_course_user.user_id
2988
-                        FROM ' . $tbl_session_course_user . ' as session_course_user
2988
+                        FROM ' . $tbl_session_course_user.' as session_course_user
2989 2989
                         INNER JOIN     '.$tbl_session_user.' sru
2990 2990
                             ON session_course_user.user_id = sru.user_id AND
2991 2991
                                session_course_user.session_id = sru.session_id
2992
-                        INNER JOIN ' . $tbl_session_course . ' as session_course
2992
+                        INNER JOIN ' . $tbl_session_course.' as session_course
2993 2993
                             ON session_course.c_id = session_course_user.c_id AND
2994 2994
                             session_course_user.session_id = session_course.session_id
2995
-                        INNER JOIN ' . $tbl_session . ' as session
2995
+                        INNER JOIN ' . $tbl_session.' as session
2996 2996
                             ON session.id = session_course.session_id AND
2997 2997
                             session.id_coach = ' . $coach_id.'
2998 2998
                         INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
@@ -3022,8 +3022,8 @@  discard block
 block discarded – undo
3022 3022
 
3023 3023
         $students = [];
3024 3024
         // At first, courses where $coach_id is coach of the course //
3025
-        $sql = 'SELECT c_id FROM ' . $tbl_session_course_user . '
3026
-                WHERE session_id="' . $id_session . '" AND user_id=' . $coach_id.' AND status=2';
3025
+        $sql = 'SELECT c_id FROM '.$tbl_session_course_user.'
3026
+                WHERE session_id="' . $id_session.'" AND user_id='.$coach_id.' AND status=2';
3027 3027
         $result = Database::query($sql);
3028 3028
 
3029 3029
         while ($a_courses = Database::fetch_array($result)) {
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
                     FROM $tbl_session_course_user AS srcru
3034 3034
                     WHERE
3035 3035
                         c_id = '$courseId' AND
3036
-                        session_id = '" . $id_session . "'";
3036
+                        session_id = '".$id_session."'";
3037 3037
             $rs = Database::query($sql);
3038 3038
             while ($row = Database::fetch_array($rs)) {
3039 3039
                 $students[$row['user_id']] = $row['user_id'];
@@ -3041,15 +3041,15 @@  discard block
 block discarded – undo
3041 3041
         }
3042 3042
 
3043 3043
         // Then, courses where $coach_id is coach of the session
3044
-        $sql = 'SELECT id_coach FROM ' . $tbl_session . '
3045
-                WHERE id="' . $id_session.'" AND id_coach="' . $coach_id . '"';
3044
+        $sql = 'SELECT id_coach FROM '.$tbl_session.'
3045
+                WHERE id="' . $id_session.'" AND id_coach="'.$coach_id.'"';
3046 3046
         $result = Database::query($sql);
3047 3047
 
3048 3048
         //He is the session_coach so we select all the users in the session
3049 3049
         if (Database::num_rows($result) > 0) {
3050 3050
             $sql = 'SELECT DISTINCT srcru.user_id
3051
-                    FROM ' . $tbl_session_course_user . ' AS srcru
3052
-                    WHERE session_id="' . $id_session . '"';
3051
+                    FROM ' . $tbl_session_course_user.' AS srcru
3052
+                    WHERE session_id="' . $id_session.'"';
3053 3053
             $result = Database::query($sql);
3054 3054
             while ($row = Database::fetch_array($result)) {
3055 3055
                 $students[$row['user_id']] = $row['user_id'];
@@ -3076,8 +3076,8 @@  discard block
 block discarded – undo
3076 3076
 
3077 3077
         // At first, courses where $coach_id is coach of the course //
3078 3078
 
3079
-        $sql = 'SELECT 1 FROM ' . $tbl_session_course_user . '
3080
-                WHERE user_id=' . $coach_id .' AND status=2';
3079
+        $sql = 'SELECT 1 FROM '.$tbl_session_course_user.'
3080
+                WHERE user_id=' . $coach_id.' AND status=2';
3081 3081
         $result = Database::query($sql);
3082 3082
         if (Database::num_rows($result) > 0) {
3083 3083
             return true;
@@ -3085,12 +3085,12 @@  discard block
 block discarded – undo
3085 3085
 
3086 3086
         // Then, courses where $coach_id is coach of the session
3087 3087
         $sql = 'SELECT session_course_user.user_id
3088
-                FROM ' . $tbl_session_course_user . ' as session_course_user
3089
-                INNER JOIN ' . $tbl_session_course . ' as session_course
3088
+                FROM ' . $tbl_session_course_user.' as session_course_user
3089
+                INNER JOIN ' . $tbl_session_course.' as session_course
3090 3090
                     ON session_course.c_id = session_course_user.c_id
3091
-                INNER JOIN ' . $tbl_session . ' as session
3091
+                INNER JOIN ' . $tbl_session.' as session
3092 3092
                     ON session.id = session_course.session_id
3093
-                    AND session.id_coach = ' . $coach_id . '
3093
+                    AND session.id_coach = ' . $coach_id.'
3094 3094
                 WHERE user_id = ' . $student_id;
3095 3095
         $result = Database::query($sql);
3096 3096
         if (Database::num_rows($result) > 0) {
@@ -3122,16 +3122,16 @@  discard block
 block discarded – undo
3122 3122
         // At first, courses where $coach_id is coach of the course.
3123 3123
 
3124 3124
         $sql = 'SELECT DISTINCT c.code
3125
-                FROM ' . $tbl_session_course_user . ' sc
3125
+                FROM ' . $tbl_session_course_user.' sc
3126 3126
                 INNER JOIN '.$tbl_course.' c
3127 3127
                 ON (c.id = sc.c_id)
3128 3128
                 WHERE user_id = ' . $coach_id.' AND status = 2';
3129 3129
 
3130 3130
         if (api_is_multiple_url_enabled()) {
3131 3131
             $access_url_id = api_get_current_access_url_id();
3132
-            if ($access_url_id != -1){
3132
+            if ($access_url_id != -1) {
3133 3133
                 $sql = 'SELECT DISTINCT c.code
3134
-                        FROM ' . $tbl_session_course_user . ' scu
3134
+                        FROM ' . $tbl_session_course_user.' scu
3135 3135
                         INNER JOIN '.$tbl_course.' c
3136 3136
                         ON (c.code = scu.c_id)
3137 3137
                         INNER JOIN '.$tbl_course_rel_access_url.' cru
@@ -3144,7 +3144,7 @@  discard block
 block discarded – undo
3144 3144
         }
3145 3145
 
3146 3146
         if (!empty($id_session)) {
3147
-            $sql .= ' AND session_id=' . $id_session;
3147
+            $sql .= ' AND session_id='.$id_session;
3148 3148
         }
3149 3149
 
3150 3150
         $courseList = array();
@@ -3156,25 +3156,25 @@  discard block
 block discarded – undo
3156 3156
         // Then, courses where $coach_id is coach of the session
3157 3157
 
3158 3158
         $sql = 'SELECT DISTINCT course.code
3159
-                FROM ' . $tbl_session_course . ' as session_course
3160
-                INNER JOIN ' . $tbl_session . ' as session
3159
+                FROM ' . $tbl_session_course.' as session_course
3160
+                INNER JOIN ' . $tbl_session.' as session
3161 3161
                     ON session.id = session_course.session_id
3162
-                    AND session.id_coach = ' . $coach_id . '
3163
-                INNER JOIN ' . $tbl_course . ' as course
3162
+                    AND session.id_coach = ' . $coach_id.'
3163
+                INNER JOIN ' . $tbl_course.' as course
3164 3164
                     ON course.id = session_course.c_id';
3165 3165
 
3166 3166
         if (api_is_multiple_url_enabled()) {
3167 3167
             $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
3168 3168
             $access_url_id = api_get_current_access_url_id();
3169
-            if ($access_url_id != -1){
3169
+            if ($access_url_id != -1) {
3170 3170
                 $sql = 'SELECT DISTINCT c.code
3171
-                    FROM ' . $tbl_session_course . ' as session_course
3171
+                    FROM ' . $tbl_session_course.' as session_course
3172 3172
                     INNER JOIN '.$tbl_course.' c
3173 3173
                     ON (c.id = session_course.c_id)
3174
-                    INNER JOIN ' . $tbl_session . ' as session
3174
+                    INNER JOIN ' . $tbl_session.' as session
3175 3175
                     ON session.id = session_course.session_id
3176
-                        AND session.id_coach = ' . $coach_id . '
3177
-                    INNER JOIN ' . $tbl_course . ' as course
3176
+                        AND session.id_coach = ' . $coach_id.'
3177
+                    INNER JOIN ' . $tbl_course.' as course
3178 3178
                         ON course.id = session_course.c_id
3179 3179
                      INNER JOIN '.$tbl_course_rel_access_url.' course_rel_url
3180 3180
                     ON (course_rel_url.c_id = c.id)';
@@ -3182,12 +3182,12 @@  discard block
 block discarded – undo
3182 3182
         }
3183 3183
 
3184 3184
         if (!empty ($id_session)) {
3185
-            $sql .= ' WHERE session_course.session_id=' . $id_session;
3185
+            $sql .= ' WHERE session_course.session_id='.$id_session;
3186 3186
             if (api_is_multiple_url_enabled())
3187
-            $sql .=  ' AND access_url_id = '.$access_url_id;
3188
-        }  else {
3187
+            $sql .= ' AND access_url_id = '.$access_url_id;
3188
+        } else {
3189 3189
             if (api_is_multiple_url_enabled())
3190
-            $sql .=  ' WHERE access_url_id = '.$access_url_id;
3190
+            $sql .= ' WHERE access_url_id = '.$access_url_id;
3191 3191
         }
3192 3192
 
3193 3193
         $result = Database::query($sql);
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
             }
3244 3244
         }
3245 3245
 
3246
-        $tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3246
+        $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3247 3247
         $access_url_id = api_get_current_access_url_id();
3248 3248
 
3249 3249
         $sql = "
@@ -3363,7 +3363,7 @@  discard block
 block discarded – undo
3363 3363
             // table definition
3364 3364
             $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY);
3365 3365
             $tbl_document = Database :: get_course_table(TABLE_DOCUMENT);
3366
-            $course_id	 = $a_course['real_id'];
3366
+            $course_id = $a_course['real_id'];
3367 3367
             if (is_array($student_id)) {
3368 3368
                 $studentList = array_map('intval', $student_id);
3369 3369
                 $condition_user = " AND ip.insert_user_id IN ('".implode(',', $studentList)."') ";
@@ -3414,7 +3414,7 @@  discard block
 block discarded – undo
3414 3414
         $a_course = CourseManager::get_course_information($course_code);
3415 3415
         if (!empty($a_course)) {
3416 3416
             $course_id = $a_course['real_id'];
3417
-            $conditions[]= " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3417
+            $conditions[] = " ip.c_id  = $course_id AND pub.c_id  = $course_id ";
3418 3418
         }
3419 3419
 
3420 3420
         // table definition
@@ -3423,14 +3423,14 @@  discard block
 block discarded – undo
3423 3423
 
3424 3424
         if (is_array($student_id)) {
3425 3425
             $studentList = array_map('intval', $student_id);
3426
-            $conditions[]= " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3426
+            $conditions[] = " ip.insert_user_id IN ('".implode("','", $studentList)."') ";
3427 3427
         } else {
3428 3428
             $student_id = intval($student_id);
3429
-            $conditions[]= " ip.insert_user_id = '$student_id' ";
3429
+            $conditions[] = " ip.insert_user_id = '$student_id' ";
3430 3430
         }
3431 3431
         if (isset($session_id)) {
3432 3432
             $session_id = intval($session_id);
3433
-            $conditions[]= " pub.session_id = $session_id ";
3433
+            $conditions[] = " pub.session_id = $session_id ";
3434 3434
         }
3435 3435
         $conditionToString = implode('AND', $conditions);
3436 3436
 
@@ -3463,8 +3463,8 @@  discard block
 block discarded – undo
3463 3463
         $courseCondition = null;
3464 3464
         $conditions = array();
3465 3465
         if (!empty($courseInfo)) {
3466
-            $course_id	    = $courseInfo['real_id'];
3467
-            $conditions[]= " post.c_id  = $course_id AND forum.c_id = $course_id ";
3466
+            $course_id = $courseInfo['real_id'];
3467
+            $conditions[] = " post.c_id  = $course_id AND forum.c_id = $course_id ";
3468 3468
         }
3469 3469
 
3470 3470
         // Table definition.
@@ -3473,15 +3473,15 @@  discard block
 block discarded – undo
3473 3473
 
3474 3474
         if (is_array($student_id)) {
3475 3475
             $studentList = array_map('intval', $student_id);
3476
-            $conditions[]= " post.poster_id IN ('".implode("','", $studentList)."') ";
3476
+            $conditions[] = " post.poster_id IN ('".implode("','", $studentList)."') ";
3477 3477
         } else {
3478 3478
             $student_id = intval($student_id);
3479
-            $conditions[]= " post.poster_id = '$student_id' ";
3479
+            $conditions[] = " post.poster_id = '$student_id' ";
3480 3480
         }
3481 3481
 
3482 3482
         if (isset($session_id)) {
3483 3483
             $session_id = intval($session_id);
3484
-            $conditions[]= " forum.session_id = $session_id";
3484
+            $conditions[] = " forum.session_id = $session_id";
3485 3485
         }
3486 3486
 
3487 3487
         $conditionsToString = implode('AND ', $conditions);
@@ -3516,7 +3516,7 @@  discard block
 block discarded – undo
3516 3516
             $condition_session = '';
3517 3517
             if (isset($session_id)) {
3518 3518
                 $session_id = intval($session_id);
3519
-                $condition_session = api_get_session_condition($session_id, true,  false, 'f.session_id');
3519
+                $condition_session = api_get_session_condition($session_id, true, false, 'f.session_id');
3520 3520
             }
3521 3521
 
3522 3522
             $course_id = $courseInfo['real_id'];
@@ -3572,7 +3572,7 @@  discard block
 block discarded – undo
3572 3572
         $condition_session = '';
3573 3573
         if (isset($session_id)) {
3574 3574
             $session_id = intval($session_id);
3575
-            $condition_session = ' AND f.session_id = '. $session_id;
3575
+            $condition_session = ' AND f.session_id = '.$session_id;
3576 3576
         }
3577 3577
 
3578 3578
         $groupId = intval($groupId);
@@ -3633,7 +3633,7 @@  discard block
 block discarded – undo
3633 3633
         $condition_session = '';
3634 3634
         if (isset($session_id)) {
3635 3635
              $session_id = intval($session_id);
3636
-             $condition_session = ' AND f.session_id = '. $session_id;
3636
+             $condition_session = ' AND f.session_id = '.$session_id;
3637 3637
         }
3638 3638
 
3639 3639
         $groupId = intval($groupId);
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
     {
3713 3713
         $student_id = intval($student_id);
3714 3714
         $courseId = intval($courseId);
3715
-        $session_id    = intval($session_id);
3715
+        $session_id = intval($session_id);
3716 3716
         $date_time  = '';
3717 3717
 
3718 3718
         // table definition
@@ -3781,7 +3781,7 @@  discard block
 block discarded – undo
3781 3781
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
3782 3782
 
3783 3783
         $sql = 'SELECT 1
3784
-                FROM ' . $table . '
3784
+                FROM ' . $table.'
3785 3785
                 WHERE down_user_id = '.$student_id.'
3786 3786
                 AND c_id  = "'.$courseId.'"
3787 3787
                 AND down_session_id = '.$session_id.' ';
@@ -3859,30 +3859,30 @@  discard block
 block discarded – undo
3859 3859
                 '.$inner.'
3860 3860
                 WHERE c.id = '.$courseId.'
3861 3861
                 GROUP BY stats_login.user_id
3862
-                HAVING DATE_SUB( "' . $now . '", INTERVAL '.$since.' DAY) > max_date ';
3862
+                HAVING DATE_SUB( "' . $now.'", INTERVAL '.$since.' DAY) > max_date ';
3863 3863
 
3864 3864
         if ($since == 'never') {
3865 3865
             if (empty($session_id)) {
3866 3866
                 $sql = 'SELECT course_user.user_id
3867
-                        FROM ' . $table_course_rel_user . ' course_user
3868
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3867
+                        FROM ' . $table_course_rel_user.' course_user
3868
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3869 3869
                         ON course_user.user_id = stats_login.user_id AND
3870
-                        relation_type<>' . COURSE_RELATION_TYPE_RRHH . '
3871
-                        INNER JOIN ' . $tableCourse . ' c
3870
+                        relation_type<>' . COURSE_RELATION_TYPE_RRHH.'
3871
+                        INNER JOIN ' . $tableCourse.' c
3872 3872
                         ON (c.id = course_user.c_id)
3873 3873
                         WHERE
3874
-                            course_user.c_id = ' . $courseId . ' AND
3874
+                            course_user.c_id = ' . $courseId.' AND
3875 3875
                             stats_login.login_course_date IS NULL
3876 3876
                         GROUP BY course_user.user_id';
3877 3877
             } else {
3878 3878
                 $sql = 'SELECT session_course_user.user_id
3879 3879
                         FROM '.$tbl_session_course_user.' session_course_user
3880
-                        LEFT JOIN ' . $tbl_track_login . ' stats_login
3880
+                        LEFT JOIN ' . $tbl_track_login.' stats_login
3881 3881
                         ON session_course_user.user_id = stats_login.user_id
3882
-                        INNER JOIN ' . $tableCourse . ' c
3882
+                        INNER JOIN ' . $tableCourse.' c
3883 3883
                         ON (c.id = session_course_user.c_id)
3884 3884
                         WHERE
3885
-                            session_course_user.c_id = ' . $courseId . ' AND
3885
+                            session_course_user.c_id = ' . $courseId.' AND
3886 3886
                             stats_login.login_course_date IS NULL
3887 3887
                         GROUP BY session_course_user.user_id';
3888 3888
 
@@ -3891,7 +3891,7 @@  discard block
 block discarded – undo
3891 3891
 
3892 3892
         $rs = Database::query($sql);
3893 3893
         $inactive_users = array();
3894
-        while($user = Database::fetch_array($rs)) {
3894
+        while ($user = Database::fetch_array($rs)) {
3895 3895
             $inactive_users[] = $user['user_id'];
3896 3896
         }
3897 3897
 
@@ -3913,10 +3913,10 @@  discard block
 block discarded – undo
3913 3913
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
3914 3914
 
3915 3915
         $sql = 'SELECT '.$student_id.'
3916
-                FROM ' . $table . '
3916
+                FROM ' . $table.'
3917 3917
                 WHERE
3918
-                    access_user_id=' . $student_id . ' AND
3919
-                    c_id="' . $courseId . '" AND
3918
+                    access_user_id=' . $student_id.' AND
3919
+                    c_id="' . $courseId.'" AND
3920 3920
                     access_session_id = "'.$session_id.'" ';
3921 3921
 
3922 3922
         $rs = Database::query($sql);
@@ -3934,13 +3934,13 @@  discard block
 block discarded – undo
3934 3934
     {
3935 3935
         $hr_dept_id = intval($hr_dept_id);
3936 3936
         $a_students = array();
3937
-        $tbl_user     = Database :: get_main_table(TABLE_MAIN_USER);
3937
+        $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
3938 3938
 
3939 3939
         $sql = 'SELECT DISTINCT user_id FROM '.$tbl_user.' as user
3940 3940
                 WHERE hr_dept_id='.$hr_dept_id;
3941 3941
         $rs = Database::query($sql);
3942 3942
 
3943
-        while($user = Database :: fetch_array($rs)) {
3943
+        while ($user = Database :: fetch_array($rs)) {
3944 3944
             $a_students[$user['user_id']] = $user['user_id'];
3945 3945
         }
3946 3946
 
@@ -3965,7 +3965,7 @@  discard block
 block discarded – undo
3965 3965
         $condition_session     = '';
3966 3966
         if (isset($session_id)) {
3967 3967
             $session_id = intval($session_id);
3968
-            $condition_session = ' AND access_session_id = '. $session_id;
3968
+            $condition_session = ' AND access_session_id = '.$session_id;
3969 3969
         }
3970 3970
         $sql = "SELECT
3971 3971
                     access_tool,
@@ -4077,7 +4077,7 @@  discard block
 block discarded – undo
4077 4077
             if (!empty($date_from) && !empty($date_to)) {
4078 4078
                 $fieldStartDate = $fields['start_date'];
4079 4079
                 if (!isset($fields['end_date'])) {
4080
-                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to) ;
4080
+                    $where .= sprintf(" AND ($fieldStartDate BETWEEN '%s' AND '%s' )", $date_from, $date_to);
4081 4081
                 } else {
4082 4082
                     $fieldEndDate = $fields['end_date'];
4083 4083
                     $where .= sprintf(" AND fieldStartDate >= '%s'
@@ -4093,12 +4093,12 @@  discard block
 block discarded – undo
4093 4093
                 $where
4094 4094
                 GROUP BY %s";
4095 4095
             $sql = sprintf($sql,
4096
-                $fields['user'],    //user field
4097
-                $tableName,         //FROM
4098
-                $fields['course'],  //course condition
4099
-                $course['real_id'],    //course condition
4100
-                $fields['user'],    //user condition
4101
-                $userId,            //user condition
4096
+                $fields['user'], //user field
4097
+                $tableName, //FROM
4098
+                $fields['course'], //course condition
4099
+                $course['real_id'], //course condition
4100
+                $fields['user'], //user condition
4101
+                $userId, //user condition
4102 4102
                 $fields['user']     //GROUP BY
4103 4103
                 );
4104 4104
             $rs = Database::query($sql);
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
             //iterate query
4107 4107
             if (Database::num_rows($rs) > 0) {
4108 4108
                 while ($row = Database::fetch_array($rs)) {
4109
-                    $data[$row['user']] = (isset($data[$row['user']])) ?  $data[$row['user']] + $row[total]: $row['total'];
4109
+                    $data[$row['user']] = (isset($data[$row['user']])) ? $data[$row['user']] + $row[total] : $row['total'];
4110 4110
                 }
4111 4111
             }
4112 4112
         }
@@ -4129,11 +4129,11 @@  discard block
 block discarded – undo
4129 4129
         $courseId = api_get_course_int_id($course_code);
4130 4130
         $data = array();
4131 4131
 
4132
-        $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4132
+        $TABLETRACK_DOWNLOADS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
4133 4133
         $condition_session = '';
4134 4134
         if (isset($session_id)) {
4135 4135
             $session_id = intval($session_id);
4136
-            $condition_session = ' AND down_session_id = '. $session_id;
4136
+            $condition_session = ' AND down_session_id = '.$session_id;
4137 4137
         }
4138 4138
         $sql = "SELECT down_doc_path, COUNT(DISTINCT down_user_id), COUNT(down_doc_path) as count_down
4139 4139
                 FROM $TABLETRACK_DOWNLOADS
@@ -4318,7 +4318,7 @@  discard block
 block discarded – undo
4318 4318
 
4319 4319
             $final_course_data = array();
4320 4320
 
4321
-            foreach($my_course_data as $course_id => $value) {
4321
+            foreach ($my_course_data as $course_id => $value) {
4322 4322
                 $final_course_data[$course_id] = $course_list[$course_id];
4323 4323
             }
4324 4324
             $course_in_session[$my_session_id]['course_list'] = $final_course_data;
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
                           '.Display::tag('th', get_lang('Course'), array('width'=>'300px')).'
4340 4340
                           '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4341 4341
                           '.Display::tag('th', get_lang('Progress'), array('class'=>'head')).'
4342
-                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')),array('class'=>'head')).'
4342
+                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4343 4343
                           '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4344 4344
                           '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4345 4345
                         </tr>';
@@ -4426,7 +4426,7 @@  discard block
 block discarded – undo
4426 4426
             $all_exercise_start_time = array();
4427 4427
 
4428 4428
             foreach ($course_in_session as $my_session_id => $session_data) {
4429
-                $course_list  = $session_data['course_list'];
4429
+                $course_list = $session_data['course_list'];
4430 4430
                 $user_count = count(SessionManager::get_users_by_session($my_session_id));
4431 4431
                 $exercise_graph_name_list = array();
4432 4432
                 //$user_results = array();
@@ -4471,20 +4471,20 @@  discard block
 block discarded – undo
4471 4471
 
4472 4472
                             $score = 0;
4473 4473
                             if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
4474
-                                $score = intval($user_result_data['exe_result']/$user_result_data['exe_weighting'] * 100);
4474
+                                $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
4475 4475
                             }
4476 4476
                             $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
4477 4477
                             $all_exercise_start_time[] = $time;
4478 4478
                             $my_results[] = $score;
4479
-                            if (count($exercise_list)<=10) {
4479
+                            if (count($exercise_list) <= 10) {
4480 4480
                                 $title = cut($course_data['title'], 30)." \n ".cut($exercise_data['title'], 30);
4481
-                                $exercise_graph_name_list[]= $title;
4481
+                                $exercise_graph_name_list[] = $title;
4482 4482
                                 $all_exercise_graph_name_list[] = $title;
4483 4483
                             } else {
4484 4484
                                 // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
4485 4485
                                 $title = cut($exercise_data['title'], 30);
4486
-                                $exercise_graph_name_list[]= $title;
4487
-                                $all_exercise_graph_name_list[]= $title;
4486
+                                $exercise_graph_name_list[] = $title;
4487
+                                $all_exercise_graph_name_list[] = $title;
4488 4488
                             }
4489 4489
                         }
4490 4490
                     }
@@ -4517,7 +4517,7 @@  discard block
 block discarded – undo
4517 4517
             }
4518 4518
 
4519 4519
             $html .= Display::page_subheader(
4520
-                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('Sessions')
4520
+                Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL).' '.get_lang('Sessions')
4521 4521
             );
4522 4522
 
4523 4523
             $html .= '<table class="data_table" width="100%">';
@@ -4567,7 +4567,7 @@  discard block
 block discarded – undo
4567 4567
                                 $courseInfo['real_id'],
4568 4568
                                 $my_session_id
4569 4569
                             );
4570
-                            if ($attempts > 1)  {
4570
+                            if ($attempts > 1) {
4571 4571
                                 $answered_exercises++;
4572 4572
                             }
4573 4573
                         }
@@ -4580,7 +4580,7 @@  discard block
 block discarded – undo
4580 4580
                     $all_average += $average;
4581 4581
                 }
4582 4582
 
4583
-                $all_average = $all_average /  count($course_list);
4583
+                $all_average = $all_average / count($course_list);
4584 4584
 
4585 4585
                 if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
4586 4586
                     $html .= '<tr style="background-color:#FBF09D">';
@@ -4605,31 +4605,31 @@  discard block
 block discarded – undo
4605 4605
                 $html .= '</tr>';
4606 4606
             }
4607 4607
             $html .= '</table><br />';
4608
-            $html .= Display::div($main_session_graph, array('id'=>'session_graph','class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
4608
+            $html .= Display::div($main_session_graph, array('id'=>'session_graph', 'class'=>'chart-session', 'style'=>'position:relative; text-align: center;'));
4609 4609
 
4610 4610
             // Checking selected session.
4611 4611
 
4612 4612
             if (isset($_GET['session_id'])) {
4613 4613
                 $session_id_from_get = intval($_GET['session_id']);
4614
-                $session_data 	= $course_in_session[$session_id_from_get];
4615
-                $course_list 	= $session_data['course_list'];
4614
+                $session_data = $course_in_session[$session_id_from_get];
4615
+                $course_list = $session_data['course_list'];
4616 4616
 
4617
-                $html .= Display::tag('h3',$session_data['name'].' - '.get_lang('CourseList'));
4617
+                $html .= Display::tag('h3', $session_data['name'].' - '.get_lang('CourseList'));
4618 4618
 
4619 4619
                 $html .= '<table class="data_table" width="100%">';
4620 4620
                 //'.Display::tag('th', get_lang('DoneExercises'),         array('class'=>'head')).'
4621 4621
                 $html .= '
4622 4622
                     <tr>
4623 4623
                       <th width="300px">'.get_lang('Course').'</th>
4624
-                      '.Display::tag('th', get_lang('PublishedExercises'),    	array('class'=>'head')).'
4625
-                      '.Display::tag('th', get_lang('NewExercises'),    		array('class'=>'head')).'
4626
-                      '.Display::tag('th', get_lang('MyAverage'), 				array('class'=>'head')).'
4627
-                      '.Display::tag('th', get_lang('AverageExerciseResult'), 	array('class'=>'head')).'
4628
-                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'),    array('class'=>'head')).'
4629
-                      '.Display::tag('th', get_lang('LPProgress')     ,      	array('class'=>'head')).'
4630
-                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4631
-                      '.Display::tag('th', get_lang('LastConnexion'),         	array('class'=>'head')).'
4632
-                      '.Display::tag('th', get_lang('Details'),               	array('class'=>'head')).'
4624
+                      '.Display::tag('th', get_lang('PublishedExercises'), array('class'=>'head')).'
4625
+                      '.Display::tag('th', get_lang('NewExercises'), array('class'=>'head')).'
4626
+                      '.Display::tag('th', get_lang('MyAverage'), array('class'=>'head')).'
4627
+                      '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
4628
+                      '.Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class'=>'head')).'
4629
+                      '.Display::tag('th', get_lang('LPProgress'), array('class'=>'head')).'
4630
+                      '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
4631
+                      '.Display::tag('th', get_lang('LastConnexion'), array('class'=>'head')).'
4632
+                      '.Display::tag('th', get_lang('Details'), array('class'=>'head')).'
4633 4633
                     </tr>';
4634 4634
 
4635 4635
                 foreach ($course_list as $course_data) {
@@ -4645,14 +4645,14 @@  discard block
 block discarded – undo
4645 4645
                         $count_exercises = count($exercises);
4646 4646
                     }
4647 4647
                     $answered_exercises = 0;
4648
-                    foreach($exercises as $exercise_item) {
4648
+                    foreach ($exercises as $exercise_item) {
4649 4649
                         $attempts = Event::count_exercise_attempts_by_user(
4650 4650
                             api_get_user_id(),
4651 4651
                             $exercise_item['id'],
4652 4652
                             $courseId,
4653 4653
                             $session_id_from_get
4654 4654
                         );
4655
-                        if ($attempts > 1)  {
4655
+                        if ($attempts > 1) {
4656 4656
                             $answered_exercises++;
4657 4657
                         }
4658 4658
                     }
@@ -4661,7 +4661,7 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
                     // Average
4663 4663
                     $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get);
4664
-                    $my_average	= ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4664
+                    $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
4665 4665
 
4666 4666
                     $stats_array[$course_code] = array(
4667 4667
                         'exercises' => $count_exercises,
@@ -4731,11 +4731,11 @@  discard block
 block discarded – undo
4731 4731
                     }
4732 4732
                     //Score
4733 4733
                     $html .= Display::tag('td', $percentage_score, array('align'=>'center'));
4734
-                    $html .= Display::tag('td', $last_connection,  array('align'=>'center'));
4734
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center'));
4735 4735
 
4736 4736
                     if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
4737 4737
                         $details = '<a href="#">';
4738
-                        $details .=Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4738
+                        $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
4739 4739
                     } else {
4740 4740
                         $details = '<a href="'.api_get_self().'?course='.$course_code.'&session_id='.$session_id_from_get.$extra_params.'">';
4741 4741
                         $details .= Display::return_icon('2rightarrow.png', get_lang('Details'));
@@ -4858,7 +4858,7 @@  discard block
 block discarded – undo
4858 4858
                         );
4859 4859
 
4860 4860
                         $latest_attempt_url = '';
4861
-                        $best_score = $position = $percentage_score_result  = '-';
4861
+                        $best_score = $position = $percentage_score_result = '-';
4862 4862
                         $graph = $normal_graph = null;
4863 4863
 
4864 4864
                         // Getting best results
@@ -4894,7 +4894,7 @@  discard block
 block discarded – undo
4894 4894
                                 $percentage_score_result = Display::url(ExerciseLib::show_score($score, $weighting), $latest_attempt_url);
4895 4895
                                 $my_score = 0;
4896 4896
                                 if (!empty($weighting) && intval($weighting) != 0) {
4897
-                                    $my_score = $score/$weighting;
4897
+                                    $my_score = $score / $weighting;
4898 4898
                                 }
4899 4899
                                 //@todo this function slows the page
4900 4900
                                 $position = ExerciseLib::get_exercise_result_ranking($my_score, $exe_id, $exercices['id'], $course_info['code'], $session_id, $user_list);
@@ -4905,14 +4905,14 @@  discard block
 block discarded – undo
4905 4905
                         }
4906 4906
                         $html .= Display::div(
4907 4907
                             $normal_graph,
4908
-                            array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none')
4908
+                            array('id'=>'main_graph_'.$exercices['id'], 'class'=>'dialog', 'style'=>'display:none')
4909 4909
                         );
4910 4910
 
4911 4911
                         if (empty($graph)) {
4912 4912
                             $graph = '-';
4913 4913
                         } else {
4914 4914
                             $graph = Display::url(
4915
-                                '<img src="' . $graph . '" >',
4915
+                                '<img src="'.$graph.'" >',
4916 4916
                                 $normal_graph,
4917 4917
                                 array(
4918 4918
                                     'id' => $exercices['id'],
@@ -4945,7 +4945,7 @@  discard block
 block discarded – undo
4945 4945
 
4946 4946
 
4947 4947
             // LP table results
4948
-            $html .='<table class="data_table">';
4948
+            $html .= '<table class="data_table">';
4949 4949
             $html .= Display::tag('th', get_lang('Learnpaths'), array('class'=>'head', 'style'=>'color:#000'));
4950 4950
             $html .= Display::tag('th', get_lang('LatencyTimeSpent'), array('class'=>'head', 'style'=>'color:#000'));
4951 4951
             $html .= Display::tag('th', get_lang('Progress'), array('class'=>'head', 'style'=>'color:#000'));
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
                     if (!empty($last_connection_in_lp)) {
5000 5000
                         $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG);
5001 5001
                     }
5002
-                    $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px'));
5002
+                    $html .= Display::tag('td', $last_connection, array('align'=>'center', 'width'=>'180px'));
5003 5003
                     $html .= "</tr>";
5004 5004
                 }
5005 5005
             } else {
@@ -5009,7 +5009,7 @@  discard block
 block discarded – undo
5009 5009
                         </td>
5010 5010
                       </tr>';
5011 5011
             }
5012
-            $html .='</table>';
5012
+            $html .= '</table>';
5013 5013
         }
5014 5014
 
5015 5015
         return $html;
@@ -5036,7 +5036,7 @@  discard block
 block discarded – undo
5036 5036
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
5037 5037
         $myData->setSerieDescription('Serie2', get_lang('AverageScore'));
5038 5038
         $myData->setAxisUnit(0, '%');
5039
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5039
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5040 5040
         // Cache definition
5041 5041
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5042 5042
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
@@ -5044,9 +5044,9 @@  discard block
 block discarded – undo
5044 5044
 
5045 5045
         if ($myCache->isInCache($chartHash)) {
5046 5046
             //if we already created the img
5047
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5047
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5048 5048
             $myCache->saveFromCache($chartHash, $imgPath);
5049
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5049
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5050 5050
         } else {
5051 5051
             /* Define width, height and angle */
5052 5052
             $mainWidth = 860;
@@ -5075,7 +5075,7 @@  discard block
 block discarded – undo
5075 5075
             /* Set the default font */
5076 5076
             $myPicture->setFontProperties(
5077 5077
                 array(
5078
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5078
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5079 5079
                     'FontSize' => 10)
5080 5080
             );
5081 5081
             /* Write the chart title */
@@ -5092,7 +5092,7 @@  discard block
 block discarded – undo
5092 5092
             /* Set the default font */
5093 5093
             $myPicture->setFontProperties(
5094 5094
                 array(
5095
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5095
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5096 5096
                     'FontSize' => 6
5097 5097
                 )
5098 5098
             );
@@ -5134,7 +5134,7 @@  discard block
 block discarded – undo
5134 5134
             /* Draw the line chart */
5135 5135
             $myPicture->setFontProperties(
5136 5136
                 array(
5137
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
5137
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
5138 5138
                     'FontSize' => 10
5139 5139
                 )
5140 5140
             );
@@ -5167,12 +5167,12 @@  discard block
 block discarded – undo
5167 5167
             );
5168 5168
 
5169 5169
             $myCache->writeToCache($chartHash, $myPicture);
5170
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5170
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5171 5171
             $myCache->saveFromCache($chartHash, $imgPath);
5172
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5172
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5173 5173
         }
5174 5174
 
5175
-        $html = '<img src="' . $imgPath . '">';
5175
+        $html = '<img src="'.$imgPath.'">';
5176 5176
 
5177 5177
         return $html;
5178 5178
     }
@@ -5193,12 +5193,12 @@  discard block
 block discarded – undo
5193 5193
 
5194 5194
         foreach ($attempts as $attempt) {
5195 5195
             if (api_get_user_id() == $attempt['exe_user_id']) {
5196
-                if ($attempt['exe_weighting'] != 0 ) {
5197
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5196
+                if ($attempt['exe_weighting'] != 0) {
5197
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5198 5198
                 }
5199 5199
             } else {
5200
-                if ($attempt['exe_weighting'] != 0 ) {
5201
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5200
+                if ($attempt['exe_weighting'] != 0) {
5201
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5202 5202
                 }
5203 5203
             }
5204 5204
         }
@@ -5207,27 +5207,27 @@  discard block
 block discarded – undo
5207 5207
         rsort($my_exercise_result_array);
5208 5208
         $my_exercise_result = 0;
5209 5209
         if (isset($my_exercise_result_array[0])) {
5210
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5210
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5211 5211
         }
5212 5212
 
5213 5213
         $max     = 100;
5214
-        $pieces  = 5 ;
5214
+        $pieces  = 5;
5215 5215
         $part    = round($max / $pieces);
5216 5216
         $x_axis = array();
5217 5217
         $final_array = array();
5218 5218
         $my_final_array = array();
5219 5219
 
5220
-        for ($i=1; $i <=$pieces; $i++) {
5220
+        for ($i = 1; $i <= $pieces; $i++) {
5221 5221
             $sum = 1;
5222 5222
             if ($i == 1) {
5223 5223
                 $sum = 0;
5224 5224
             }
5225
-            $min = ($i-1)*$part + $sum;
5226
-            $max = ($i)*$part;
5227
-            $x_axis[]= $min." - ".$max;
5225
+            $min = ($i - 1) * $part + $sum;
5226
+            $max = ($i) * $part;
5227
+            $x_axis[] = $min." - ".$max;
5228 5228
             $count = 0;
5229
-            foreach($exercise_result as $result) {
5230
-                $percentage = $result*100;
5229
+            foreach ($exercise_result as $result) {
5230
+                $percentage = $result * 100;
5231 5231
                 //echo $percentage.' - '.$min.' - '.$max."<br />";
5232 5232
                 if ($percentage >= $min && $percentage <= $max) {
5233 5233
                     //echo ' is > ';
@@ -5235,7 +5235,7 @@  discard block
 block discarded – undo
5235 5235
                 }
5236 5236
             }
5237 5237
             //echo '<br />';
5238
-            $final_array[]= $count;
5238
+            $final_array[] = $count;
5239 5239
 
5240 5240
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5241 5241
                 $my_final_array[] = 1;
@@ -5245,9 +5245,9 @@  discard block
 block discarded – undo
5245 5245
         }
5246 5246
 
5247 5247
         //Fix to remove the data of the user with my data
5248
-        for($i = 0; $i<=count($my_final_array); $i++) {
5248
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5249 5249
             if (!empty($my_final_array[$i])) {
5250
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5250
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5251 5251
                 $final_array[$i] = 0;
5252 5252
             }
5253 5253
         }
@@ -5257,16 +5257,16 @@  discard block
 block discarded – undo
5257 5257
         $dataSet->addPoints($final_array, 'Serie1');
5258 5258
         $dataSet->addPoints($my_final_array, 'Serie2');
5259 5259
         $dataSet->normalize(100, "%");
5260
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5260
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5261 5261
 
5262 5262
         // Cache definition
5263 5263
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
5264 5264
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
5265 5265
         $chartHash = $myCache->getHash($dataSet);
5266 5266
         if ($myCache->isInCache($chartHash)) {
5267
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5267
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5268 5268
             $myCache->saveFromCache($chartHash, $imgPath);
5269
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5269
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5270 5270
         } else {
5271 5271
             /* Create the pChart object */
5272 5272
             $widthSize = 80;
@@ -5282,7 +5282,7 @@  discard block
 block discarded – undo
5282 5282
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5283 5283
 
5284 5284
             /* Set the default font */
5285
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5285
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => $fontSize));
5286 5286
 
5287 5287
             /* Do not write the chart title */
5288 5288
 
@@ -5346,9 +5346,9 @@  discard block
 block discarded – undo
5346 5346
 
5347 5347
             /* Save and write in cache */
5348 5348
             $myCache->writeToCache($chartHash, $myPicture);
5349
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5349
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5350 5350
             $myCache->saveFromCache($chartHash, $imgPath);
5351
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5351
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5352 5352
         }
5353 5353
 
5354 5354
         return $imgPath;
@@ -5368,12 +5368,12 @@  discard block
 block discarded – undo
5368 5368
         }
5369 5369
         foreach ($attempts as $attempt) {
5370 5370
             if (api_get_user_id() == $attempt['exe_user_id']) {
5371
-                if ($attempt['exe_weighting'] != 0 ) {
5372
-                    $my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
5371
+                if ($attempt['exe_weighting'] != 0) {
5372
+                    $my_exercise_result_array[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5373 5373
                 }
5374 5374
             } else {
5375
-                if ($attempt['exe_weighting'] != 0 ) {
5376
-                    $exercise_result[]=  $attempt['exe_result']/$attempt['exe_weighting'];
5375
+                if ($attempt['exe_weighting'] != 0) {
5376
+                    $exercise_result[] = $attempt['exe_result'] / $attempt['exe_weighting'];
5377 5377
                 }
5378 5378
             }
5379 5379
         }
@@ -5382,32 +5382,32 @@  discard block
 block discarded – undo
5382 5382
         rsort($my_exercise_result_array);
5383 5383
         $my_exercise_result = 0;
5384 5384
         if (isset($my_exercise_result_array[0])) {
5385
-            $my_exercise_result = $my_exercise_result_array[0] *100;
5385
+            $my_exercise_result = $my_exercise_result_array[0] * 100;
5386 5386
         }
5387 5387
 
5388 5388
         $max = 100;
5389
-        $pieces = 5 ;
5389
+        $pieces = 5;
5390 5390
         $part = round($max / $pieces);
5391 5391
         $x_axis = array();
5392 5392
         $final_array = array();
5393 5393
         $my_final_array = array();
5394 5394
 
5395
-        for ($i=1; $i <=$pieces; $i++) {
5395
+        for ($i = 1; $i <= $pieces; $i++) {
5396 5396
             $sum = 1;
5397 5397
             if ($i == 1) {
5398 5398
                 $sum = 0;
5399 5399
             }
5400
-            $min = ($i-1)*$part + $sum;
5401
-            $max = ($i)*$part;
5402
-            $x_axis[]= $min." - ".$max;
5400
+            $min = ($i - 1) * $part + $sum;
5401
+            $max = ($i) * $part;
5402
+            $x_axis[] = $min." - ".$max;
5403 5403
             $count = 0;
5404
-            foreach($exercise_result as $result) {
5405
-                $percentage = $result*100;
5404
+            foreach ($exercise_result as $result) {
5405
+                $percentage = $result * 100;
5406 5406
                 if ($percentage >= $min && $percentage <= $max) {
5407 5407
                     $count++;
5408 5408
                 }
5409 5409
             }
5410
-            $final_array[]= $count;
5410
+            $final_array[] = $count;
5411 5411
 
5412 5412
             if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
5413 5413
                 $my_final_array[] = 1;
@@ -5418,9 +5418,9 @@  discard block
 block discarded – undo
5418 5418
 
5419 5419
         //Fix to remove the data of the user with my data
5420 5420
 
5421
-        for($i = 0; $i<=count($my_final_array); $i++) {
5421
+        for ($i = 0; $i <= count($my_final_array); $i++) {
5422 5422
             if (!empty($my_final_array[$i])) {
5423
-                $my_final_array[$i] =  $final_array[$i] + 1; //Add my result
5423
+                $my_final_array[$i] = $final_array[$i] + 1; //Add my result
5424 5424
                 $final_array[$i] = 0;
5425 5425
             }
5426 5426
         }
@@ -5438,7 +5438,7 @@  discard block
 block discarded – undo
5438 5438
         $dataSet->setXAxisName(get_lang('Score'));
5439 5439
         $dataSet->normalize(100, "%");
5440 5440
 
5441
-        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
5441
+        $dataSet->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
5442 5442
 
5443 5443
         // Cache definition
5444 5444
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -5446,9 +5446,9 @@  discard block
 block discarded – undo
5446 5446
         $chartHash = $myCache->getHash($dataSet);
5447 5447
 
5448 5448
         if ($myCache->isInCache($chartHash)) {
5449
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5449
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5450 5450
             $myCache->saveFromCache($chartHash, $imgPath);
5451
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5451
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5452 5452
         } else {
5453 5453
             /* Create the pChart object */
5454 5454
             $widthSize = 480;
@@ -5464,7 +5464,7 @@  discard block
 block discarded – undo
5464 5464
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
5465 5465
 
5466 5466
             /* Set the default font */
5467
-            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5467
+            $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
5468 5468
 
5469 5469
             /* Write the chart title */
5470 5470
             $myPicture->drawText(
@@ -5523,9 +5523,9 @@  discard block
 block discarded – undo
5523 5523
 
5524 5524
             /* Write and save into cache */
5525 5525
             $myCache->writeToCache($chartHash, $myPicture);
5526
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
5526
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
5527 5527
             $myCache->saveFromCache($chartHash, $imgPath);
5528
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
5528
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
5529 5529
         }
5530 5530
 
5531 5531
         return $imgPath;
@@ -5651,7 +5651,7 @@  discard block
 block discarded – undo
5651 5651
                         $whereSessionParams .= $sessionIdx.',';
5652 5652
                     }
5653 5653
                 }
5654
-                $whereSessionParams = substr($whereSessionParams,0,-1);
5654
+                $whereSessionParams = substr($whereSessionParams, 0, -1);
5655 5655
             }
5656 5656
 
5657 5657
             if (!empty($exerciseId)) {
@@ -5712,7 +5712,7 @@  discard block
 block discarded – undo
5712 5712
                     qq.position = rq.question_order AND
5713 5713
                     ta.question_id = rq.question_id
5714 5714
                 WHERE
5715
-                    te.c_id = $courseIdx ".(empty($whereSessionParams)?'':"AND te.session_id IN ($whereSessionParams)")."
5715
+                    te.c_id = $courseIdx ".(empty($whereSessionParams) ? '' : "AND te.session_id IN ($whereSessionParams)")."
5716 5716
                     AND q.c_id = $courseIdx
5717 5717
                     $where $order $limit";
5718 5718
             $sql_query = vsprintf($sql, $whereParams);
@@ -5760,7 +5760,7 @@  discard block
 block discarded – undo
5760 5760
             // Now fill users data
5761 5761
             $sqlUsers = "SELECT user_id, username, lastname, firstname
5762 5762
                          FROM $tuser
5763
-                         WHERE user_id IN (".implode(',',$userIds).")";
5763
+                         WHERE user_id IN (".implode(',', $userIds).")";
5764 5764
             $resUsers = Database::query($sqlUsers);
5765 5765
             while ($rowUser = Database::fetch_assoc($resUsers)) {
5766 5766
                 $users[$rowUser['user_id']] = $rowUser;
@@ -5856,7 +5856,7 @@  discard block
 block discarded – undo
5856 5856
     	        WHERE
5857 5857
                     track_resource.c_id = $course_id AND
5858 5858
                     track_resource.insert_user_id = user.user_id AND
5859
-                    session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5859
+                    session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5860 5860
 
5861 5861
     	if (isset($_GET['keyword'])) {
5862 5862
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -5914,7 +5914,7 @@  discard block
 block discarded – undo
5914 5914
                 WHERE
5915 5915
                   track_resource.c_id = $course_id AND
5916 5916
                   track_resource.insert_user_id = user.user_id AND
5917
-                  session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5917
+                  session_id ".(empty($session_id) ? ' IS NULL ' : " = $session_id ");
5918 5918
 
5919 5919
     	if (isset($_GET['keyword'])) {
5920 5920
     		$keyword = Database::escape_string(trim($_GET['keyword']));
@@ -6208,7 +6208,7 @@  discard block
 block discarded – undo
6208 6208
     public static function display_additional_profile_fields()
6209 6209
     {
6210 6210
     	// getting all the extra profile fields that are defined by the platform administrator
6211
-    	$extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC');
6211
+    	$extra_fields = UserManager :: get_extra_fields(0, 50, 5, 'ASC');
6212 6212
 
6213 6213
     	// creating the form
6214 6214
     	$return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">';
@@ -6220,8 +6220,8 @@  discard block
 block discarded – undo
6220 6220
     	$extra_fields_to_show = 0;
6221 6221
     	foreach ($extra_fields as $key=>$field) {
6222 6222
     		// show only extra fields that are visible + and can be filtered, added by J.Montoya
6223
-    		if ($field[6]==1 && $field[8] == 1) {
6224
-    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) {
6223
+    		if ($field[6] == 1 && $field[8] == 1) {
6224
+    			if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field']) {
6225 6225
     				$selected = 'selected="selected"';
6226 6226
     			} else {
6227 6227
     				$selected = '';
@@ -6233,8 +6233,8 @@  discard block
 block discarded – undo
6233 6233
     	$return .= '</select>';
6234 6234
 
6235 6235
     	// the form elements for the $_GET parameters (because the form is passed through GET
6236
-    	foreach ($_GET as $key=>$value){
6237
-    		if ($key <> 'additional_profile_field')    {
6236
+    	foreach ($_GET as $key=>$value) {
6237
+    		if ($key <> 'additional_profile_field') {
6238 6238
     			$return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />';
6239 6239
     		}
6240 6240
     	}
@@ -6271,21 +6271,21 @@  discard block
 block discarded – undo
6271 6271
     	$result_extra_field = UserManager::get_extra_field_information($field_id);
6272 6272
 
6273 6273
     	if (!empty($users)) {
6274
-    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) {
6275
-    			foreach($users as $user_id) {
6274
+    		if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG) {
6275
+    			foreach ($users as $user_id) {
6276 6276
     				$user_result = UserManager::get_user_tags($user_id, $field_id);
6277 6277
     				$tag_list = array();
6278
-    				foreach($user_result as $item) {
6278
+    				foreach ($user_result as $item) {
6279 6279
     					$tag_list[] = $item['tag'];
6280 6280
     				}
6281
-    				$return[$user_id][] = implode(', ',$tag_list);
6281
+    				$return[$user_id][] = implode(', ', $tag_list);
6282 6282
     			}
6283 6283
     		} else {
6284 6284
     			$new_user_array = array();
6285 6285
     			foreach ($users as $user_id) {
6286
-    				$new_user_array[]= "'".$user_id."'";
6286
+    				$new_user_array[] = "'".$user_id."'";
6287 6287
     			}
6288
-    			$users = implode(',',$new_user_array);
6288
+    			$users = implode(',', $new_user_array);
6289 6289
                 $extraFieldType = EntityExtraField::USER_FIELD_TYPE;
6290 6290
     			// Selecting only the necessary information NOT ALL the user list
6291 6291
     			$sql = "SELECT user.user_id, v.value
@@ -6300,7 +6300,7 @@  discard block
 block discarded – undo
6300 6300
                             user.user_id IN ($users)";
6301 6301
 
6302 6302
     			$result = Database::query($sql);
6303
-    			while($row = Database::fetch_array($result)) {
6303
+    			while ($row = Database::fetch_array($result)) {
6304 6304
     				// get option value for field type double select by id
6305 6305
     				if (!empty($row['value'])) {
6306 6306
     					if ($result_extra_field['field_type'] ==
@@ -6339,7 +6339,7 @@  discard block
 block discarded – undo
6339 6339
 
6340 6340
     public function sort_users_desc($a, $b)
6341 6341
     {
6342
-    	return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6342
+    	return strcmp(trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']])));
6343 6343
     }
6344 6344
 
6345 6345
     /**
@@ -6374,7 +6374,7 @@  discard block
 block discarded – undo
6374 6374
     	// get all users data from a course for sortable with limit
6375 6375
     	if (is_array($user_ids)) {
6376 6376
     		$user_ids = array_map('intval', $user_ids);
6377
-    		$condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") ";
6377
+    		$condition_user = " WHERE user.user_id IN (".implode(',', $user_ids).") ";
6378 6378
     	} else {
6379 6379
     		$user_ids = intval($user_ids);
6380 6380
     		$condition_user = " WHERE user.user_id = $user_ids ";
@@ -6382,7 +6382,7 @@  discard block
 block discarded – undo
6382 6382
 
6383 6383
     	if (!empty($_GET['user_keyword'])) {
6384 6384
     		$keyword = trim(Database::escape_string($_GET['user_keyword']));
6385
-    		$condition_user .=  " AND (
6385
+    		$condition_user .= " AND (
6386 6386
                 user.firstname LIKE '%".$keyword."%' OR
6387 6387
                 user.lastname LIKE '%".$keyword."%'  OR
6388 6388
                 user.username LIKE '%".$keyword."%'  OR
@@ -6400,7 +6400,7 @@  discard block
 block discarded – undo
6400 6400
         $invitedUsersCondition = '';
6401 6401
 
6402 6402
         if (!$includeInvitedUsers) {
6403
-            $invitedUsersCondition = " AND user.status != " . INVITEE;
6403
+            $invitedUsersCondition = " AND user.status != ".INVITEE;
6404 6404
         }
6405 6405
 
6406 6406
     	$sql = "SELECT  user.user_id as user_id,
@@ -6411,7 +6411,7 @@  discard block
 block discarded – undo
6411 6411
                 FROM $tbl_user as user $url_table
6412 6412
     	        $condition_user $url_condition $invitedUsersCondition";
6413 6413
 
6414
-    	if (!in_array($direction, array('ASC','DESC'))) {
6414
+    	if (!in_array($direction, array('ASC', 'DESC'))) {
6415 6415
     		$direction = 'ASC';
6416 6416
     	}
6417 6417
 
@@ -6548,7 +6548,7 @@  discard block
 block discarded – undo
6548 6548
     		}
6549 6549
 
6550 6550
             if (empty($session_id)) {
6551
-                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys;
6551
+                $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0).' / '.$total_surveys;
6552 6552
             }
6553 6553
 
6554 6554
     		$user['link'] = '<center>
@@ -6560,37 +6560,37 @@  discard block
 block discarded – undo
6560 6560
     		// store columns in array $users
6561 6561
     		$is_western_name_order = api_is_western_name_order();
6562 6562
             $user_row = array();
6563
-            $user_row[]= $user['official_code']; //0
6563
+            $user_row[] = $user['official_code']; //0
6564 6564
             if ($is_western_name_order) {
6565
-                $user_row[]= $user['firstname'];
6566
-                $user_row[]= $user['lastname'];
6565
+                $user_row[] = $user['firstname'];
6566
+                $user_row[] = $user['lastname'];
6567 6567
             } else {
6568
-                $user_row[]= $user['lastname'];
6569
-                $user_row[]= $user['firstname'];
6568
+                $user_row[] = $user['lastname'];
6569
+                $user_row[] = $user['firstname'];
6570 6570
             }
6571
-            $user_row[]= $user['username'];
6572
-            $user_row[]= $user['time'];
6573
-            $user_row[]= $user['average_progress'];
6574
-            $user_row[]= $user['exercise_progress'];
6575
-            $user_row[]= $user['exercise_average_best_attempt'];
6576
-            $user_row[]= $user['student_score'];
6577
-            $user_row[]= $user['count_assignments'];
6578
-            $user_row[]= $user['count_messages'];
6571
+            $user_row[] = $user['username'];
6572
+            $user_row[] = $user['time'];
6573
+            $user_row[] = $user['average_progress'];
6574
+            $user_row[] = $user['exercise_progress'];
6575
+            $user_row[] = $user['exercise_average_best_attempt'];
6576
+            $user_row[] = $user['student_score'];
6577
+            $user_row[] = $user['count_assignments'];
6578
+            $user_row[] = $user['count_messages'];
6579 6579
 
6580 6580
             $userGroupManager = new UserGroup();
6581 6581
             $user_row[] = $userGroupManager->getLabelsFromNameList($user['user_id'], UserGroup::NORMAL_CLASS);
6582 6582
 
6583 6583
             if (empty($session_id)) {
6584
-                $user_row[]= $user['survey'];
6584
+                $user_row[] = $user['survey'];
6585 6585
             }
6586 6586
 
6587
-            $user_row[]= $user['first_connection'];
6588
-            $user_row[]= $user['last_connection'];
6587
+            $user_row[] = $user['first_connection'];
6588
+            $user_row[] = $user['last_connection'];
6589 6589
             if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) {
6590
-                $user_row[]= $user['additional'];
6590
+                $user_row[] = $user['additional'];
6591 6591
             }
6592 6592
 
6593
-            $user_row[]= $user['link'];
6593
+            $user_row[] = $user['link'];
6594 6594
 
6595 6595
             $users[] = $user_row;
6596 6596
 
@@ -6635,8 +6635,8 @@  discard block
 block discarded – undo
6635 6635
 
6636 6636
     	$track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
6637 6637
     	$tempView = $view;
6638
-    	if(substr($view,0,1) == '1') {
6639
-    		$new_view = substr_replace($view,'0',0,1);
6638
+    	if (substr($view, 0, 1) == '1') {
6639
+    		$new_view = substr_replace($view, '0', 0, 1);
6640 6640
     		echo "
6641 6641
                 <tr>
6642 6642
                     <td valign='top'>
@@ -6669,9 +6669,9 @@  discard block
 block discarded – undo
6669 6669
                 </tr>";
6670 6670
     		$total = 0;
6671 6671
     		if (is_array($results)) {
6672
-    			for($j = 0 ; $j < count($results) ; $j++) {
6672
+    			for ($j = 0; $j < count($results); $j++) {
6673 6673
     				echo "<tr>";
6674
-    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>";
6674
+    				echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0]) - 1].' '.date('Y', $results[$j][0])."</a></td>";
6675 6675
     				echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>";
6676 6676
     				echo"</tr>";
6677 6677
     				$total = $total + $results[$j][1];
@@ -6688,7 +6688,7 @@  discard block
 block discarded – undo
6688 6688
     		echo "</table>";
6689 6689
     		echo "</td></tr>";
6690 6690
     	} else {
6691
-    		$new_view = substr_replace($view,'1',0,1);
6691
+    		$new_view = substr_replace($view, '1', 0, 1);
6692 6692
     		echo "
6693 6693
                 <tr>
6694 6694
                     <td valign='top'>
@@ -6711,8 +6711,8 @@  discard block
 block discarded – undo
6711 6711
     {
6712 6712
     	global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong;
6713 6713
         $courseId = api_get_course_int_id($courseCode);
6714
-    	if(substr($view,1,1) == '1') {
6715
-    		$new_view = substr_replace($view,'0',1,1);
6714
+    	if (substr($view, 1, 1) == '1') {
6715
+    		$new_view = substr_replace($view, '0', 1, 1);
6716 6716
     		echo "<tr>
6717 6717
                     <td valign='top'>
6718 6718
                         <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('ExercicesResults')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>]
@@ -6754,7 +6754,7 @@  discard block
 block discarded – undo
6754 6754
                 </tr>";
6755 6755
 
6756 6756
     		if (is_array($results)) {
6757
-    			for($i = 0; $i < sizeof($results); $i++) {
6757
+    			for ($i = 0; $i < sizeof($results); $i++) {
6758 6758
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
6759 6759
     				echo "<tr>\n";
6760 6760
     				echo "<td class='content'>".$results[$i][0]."</td>\n";
@@ -6769,8 +6769,8 @@  discard block
 block discarded – undo
6769 6769
 
6770 6770
     		// The Result of Tests
6771 6771
     		if (is_array($hpresults)) {
6772
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
6773
-    				$title = GetQuizName($hpresults[$i][0],'');
6772
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
6773
+    				$title = GetQuizName($hpresults[$i][0], '');
6774 6774
     				if ($title == '')
6775 6775
     				$title = basename($hpresults[$i][0]);
6776 6776
     				$display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get());
@@ -6796,7 +6796,7 @@  discard block
 block discarded – undo
6796 6796
     		echo "</table>";
6797 6797
     		echo "</td>\n</tr>\n";
6798 6798
     	} else {
6799
-    		$new_view = substr_replace($view,'1',1,1);
6799
+    		$new_view = substr_replace($view, '1', 1, 1);
6800 6800
     		echo "
6801 6801
                 <tr>
6802 6802
                     <td valign='top'>
@@ -6815,8 +6815,8 @@  discard block
 block discarded – undo
6815 6815
     	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK;
6816 6816
         $_course = api_get_course_info_by_id($course_id);
6817 6817
 
6818
-    	if (substr($view,2,1) == '1') {
6819
-    		$new_view = substr_replace($view,'0',2,1);
6818
+    	if (substr($view, 2, 1) == '1') {
6819
+    		$new_view = substr_replace($view, '0', 2, 1);
6820 6820
     		echo "<tr>
6821 6821
                     <td valign='top'>
6822 6822
                     <font color='#0000FF'>-&nbsp;&nbsp;&nbsp;</font><b>".get_lang('WorkUploads')."</b>&nbsp;&nbsp;&nbsp;[<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>]&nbsp;&nbsp;&nbsp;[<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>]
@@ -6830,7 +6830,7 @@  discard block
 block discarded – undo
6830 6830
                         AND u.c_id = '".intval($course_id)."'
6831 6831
                     ORDER BY u.upload_date DESC";
6832 6832
     		echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
6833
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
6833
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
6834 6834
     		echo "<table cellpadding='2' cellspacing='1' border='0' align=center>";
6835 6835
     		echo "<tr>
6836 6836
                     <td class='secLine' width='40%'>
@@ -6844,7 +6844,7 @@  discard block
 block discarded – undo
6844 6844
                     </td>
6845 6845
                 </tr>";
6846 6846
     		if (is_array($results)) {
6847
-    			for($j = 0 ; $j < count($results) ; $j++) {
6847
+    			for ($j = 0; $j < count($results); $j++) {
6848 6848
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
6849 6849
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
6850 6850
     				echo "<tr>";
@@ -6863,7 +6863,7 @@  discard block
 block discarded – undo
6863 6863
     		echo "</table>";
6864 6864
     		echo "</td></tr>";
6865 6865
     	} else {
6866
-    		$new_view = substr_replace($view,'1',2,1);
6866
+    		$new_view = substr_replace($view, '1', 2, 1);
6867 6867
     		echo "
6868 6868
                 <tr>
6869 6869
                     <td valign='top'>
@@ -6882,8 +6882,8 @@  discard block
 block discarded – undo
6882 6882
     {
6883 6883
     	global $TABLETRACK_LINKS, $TABLECOURSE_LINKS;
6884 6884
         $courseId = api_get_course_int_id($courseCode);
6885
-    	if (substr($view,3,1) == '1') {
6886
-    		$new_view = substr_replace($view,'0',3,1);
6885
+    	if (substr($view, 3, 1) == '1') {
6886
+    		$new_view = substr_replace($view, '0', 3, 1);
6887 6887
     		echo "
6888 6888
                 <tr>
6889 6889
                         <td valign='top'>
@@ -6907,7 +6907,7 @@  discard block
 block discarded – undo
6907 6907
                     </td>
6908 6908
                 </tr>";
6909 6909
     		if (is_array($results)) {
6910
-    			for($j = 0 ; $j < count($results) ; $j++) {
6910
+    			for ($j = 0; $j < count($results); $j++) {
6911 6911
     				echo "<tr>";
6912 6912
     				echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>";
6913 6913
     				echo"</tr>";
@@ -6920,7 +6920,7 @@  discard block
 block discarded – undo
6920 6920
     		echo "</table>";
6921 6921
     		echo "</td></tr>";
6922 6922
     	} else {
6923
-    		$new_view = substr_replace($view,'1',3,1);
6923
+    		$new_view = substr_replace($view, '1', 3, 1);
6924 6924
     		echo "
6925 6925
                 <tr>
6926 6926
                     <td valign='top'>
@@ -6947,8 +6947,8 @@  discard block
 block discarded – undo
6947 6947
     	$session_id = intval($session_id);
6948 6948
 
6949 6949
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
6950
-    	if(substr($view,4,1) == '1') {
6951
-    		$new_view = substr_replace($view,'0',4,1);
6950
+    	if (substr($view, 4, 1) == '1') {
6951
+    		$new_view = substr_replace($view, '0', 4, 1);
6952 6952
     		echo "
6953 6953
                 <tr>
6954 6954
                     <td valign='top'>
@@ -6974,7 +6974,7 @@  discard block
 block discarded – undo
6974 6974
                     </td>
6975 6975
                 </tr>";
6976 6976
     		if (is_array($results)) {
6977
-    			for($j = 0 ; $j < count($results) ; $j++) {
6977
+    			for ($j = 0; $j < count($results); $j++) {
6978 6978
     				echo "<tr>";
6979 6979
     				echo "<td class='content'>".$results[$j]."</td>";
6980 6980
     				echo"</tr>";
@@ -6987,7 +6987,7 @@  discard block
 block discarded – undo
6987 6987
     		echo "</table>";
6988 6988
     		echo "</td></tr>";
6989 6989
     	} else {
6990
-    		$new_view = substr_replace($view,'1',4,1);
6990
+    		$new_view = substr_replace($view, '1', 4, 1);
6991 6991
     		echo "
6992 6992
                 <tr>
6993 6993
                     <td valign='top'>
@@ -7021,11 +7021,11 @@  discard block
 block discarded – undo
7021 7021
                    ORDER BY login_date DESC LIMIT 1";
7022 7022
         $ip = '';
7023 7023
         $res_ip = Database::query($sql_ip);
7024
-        if ($res_ip !== false && Database::num_rows($res_ip)>0) {
7024
+        if ($res_ip !== false && Database::num_rows($res_ip) > 0) {
7025 7025
             $row_ip = Database::fetch_row($res_ip);
7026 7026
             if ($return_as_link) {
7027 7027
                 $ip = Display::url(
7028
-                    (empty($body_replace)?$row_ip[1]:$body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7028
+                    (empty($body_replace) ? $row_ip[1] : $body_replace), 'http://www.whatsmyip.org/ip-geo-location/?ip='.$row_ip[1],
7029 7029
                     array('title'=>get_lang('TraceIP'), 'target'=>'_blank')
7030 7030
                 );
7031 7031
             } else {
@@ -7061,9 +7061,9 @@  discard block
 block discarded – undo
7061 7061
     	$course_id  = intval($course_id);
7062 7062
 
7063 7063
     	$tempView = $view;
7064
-    	if (substr($view,0,1) == '1') {
7065
-    		$new_view = substr_replace($view,'0',0,1);
7066
-    		$title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7064
+    	if (substr($view, 0, 1) == '1') {
7065
+    		$new_view = substr_replace($view, '0', 0, 1);
7066
+    		$title[1] = get_lang('LoginsAndAccessTools').get_lang('LoginsDetails');
7067 7067
     		$sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date)
7068 7068
                     FROM $track_access_table
7069 7069
                     WHERE access_user_id = $user_id
@@ -7073,20 +7073,20 @@  discard block
 block discarded – undo
7073 7073
                     ORDER BY YEAR(access_date),MONTH(access_date) ASC";
7074 7074
     		//$results = getManyResults2Col($sql);
7075 7075
     		$results = getManyResults3Col($sql);
7076
-    		$title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7077
-    		$line='';
7076
+    		$title_line = get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n";
7077
+    		$line = '';
7078 7078
     		$total = 0;
7079 7079
     		if (is_array($results)) {
7080
-    			for($j = 0 ; $j < count($results) ; $j++) {
7080
+    			for ($j = 0; $j < count($results); $j++) {
7081 7081
     				$line .= $results[$j][0].';'.$results[$j][1]."\n";
7082 7082
     				$total = $total + $results[$j][1];
7083 7083
     			}
7084 7084
     			$line .= get_lang('Total').";".$total."\n";
7085 7085
     		} else {
7086
-    			$line= get_lang('NoResult')."</center></td>";
7086
+    			$line = get_lang('NoResult')."</center></td>";
7087 7087
     		}
7088 7088
     	} else {
7089
-    		$new_view = substr_replace($view,'1',0,1);
7089
+    		$new_view = substr_replace($view, '1', 0, 1);
7090 7090
     	}
7091 7091
     	return array($title_line, $line);
7092 7092
     }
@@ -7104,8 +7104,8 @@  discard block
 block discarded – undo
7104 7104
     	global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong;
7105 7105
         $courseId = api_get_course_int_id($courseCode);
7106 7106
         $userId = intval($userId);
7107
-    	if (substr($view,1,1) == '1') {
7108
-    		$new_view = substr_replace($view,'0',1,1);
7107
+    	if (substr($view, 1, 1) == '1') {
7108
+    		$new_view = substr_replace($view, '0', 1, 1);
7109 7109
     		$title[1] = get_lang('ExercicesDetails');
7110 7110
     		$line = '';
7111 7111
     		$sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date)
@@ -7129,7 +7129,7 @@  discard block
 block discarded – undo
7129 7129
     		$title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n";
7130 7130
 
7131 7131
     		if (is_array($results)) {
7132
-    			for($i = 0; $i < sizeof($results); $i++)
7132
+    			for ($i = 0; $i < sizeof($results); $i++)
7133 7133
     			{
7134 7134
     				$display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get());
7135 7135
     				$line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n";
@@ -7141,8 +7141,8 @@  discard block
 block discarded – undo
7141 7141
 
7142 7142
     		// The Result of Tests
7143 7143
     		if (is_array($hpresults)) {
7144
-    			for($i = 0; $i < sizeof($hpresults); $i++) {
7145
-    				$title = GetQuizName($hpresults[$i][0],'');
7144
+    			for ($i = 0; $i < sizeof($hpresults); $i++) {
7145
+    				$title = GetQuizName($hpresults[$i][0], '');
7146 7146
 
7147 7147
     				if ($title == '')
7148 7148
     				$title = basename($hpresults[$i][0]);
@@ -7156,10 +7156,10 @@  discard block
 block discarded – undo
7156 7156
     		}
7157 7157
 
7158 7158
     		if ($NoTestRes == 1 && $NoHPTestRes == 1) {
7159
-    			$line=get_lang('NoResult');
7159
+    			$line = get_lang('NoResult');
7160 7160
     		}
7161 7161
     	} else {
7162
-    		$new_view = substr_replace($view,'1',1,1);
7162
+    		$new_view = substr_replace($view, '1', 1, 1);
7163 7163
     	}
7164 7164
     	return array($title_line, $line);
7165 7165
     }
@@ -7175,7 +7175,7 @@  discard block
 block discarded – undo
7175 7175
         $user_id = intval($user_id);
7176 7176
         $course_id = intval($course_id);
7177 7177
 
7178
-    	if (substr($view,2,1) == '1') {
7178
+    	if (substr($view, 2, 1) == '1') {
7179 7179
     		$sql = "SELECT u.upload_date, w.title, w.author, w.url
7180 7180
                     FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w
7181 7181
                     WHERE
@@ -7183,21 +7183,21 @@  discard block
 block discarded – undo
7183 7183
                         u.upload_user_id = '$user_id' AND
7184 7184
                         u.c_id = '$course_id'
7185 7185
                     ORDER BY u.upload_date DESC";
7186
-    		$results = StatsUtils::getManyResultsXCol($sql,4);
7186
+    		$results = StatsUtils::getManyResultsXCol($sql, 4);
7187 7187
 
7188
-    		$title[1]=get_lang('WorksDetails');
7189
-    		$line='';
7190
-    		$title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7188
+    		$title[1] = get_lang('WorksDetails');
7189
+    		$line = '';
7190
+    		$title_line = get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n";
7191 7191
 
7192 7192
     		if (is_array($results)) {
7193
-    			for($j = 0 ; $j < count($results) ; $j++) {
7193
+    			for ($j = 0; $j < count($results); $j++) {
7194 7194
     				$pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3];
7195 7195
     				$beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get());
7196 7196
     				$line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n";
7197 7197
     			}
7198 7198
 
7199 7199
     		} else {
7200
-    			$line= get_lang('NoResult');
7200
+    			$line = get_lang('NoResult');
7201 7201
     		}
7202 7202
     	}
7203 7203
     	return array($title_line, $line);
@@ -7213,9 +7213,9 @@  discard block
 block discarded – undo
7213 7213
         $courseId = api_get_course_int_id($courseCode);
7214 7214
         $userId = intval($userId);
7215 7215
         $line = null;
7216
-    	if (substr($view,3,1) == '1') {
7217
-    		$new_view = substr_replace($view,'0',3,1);
7218
-    		$title[1]=get_lang('LinksDetails');
7216
+    	if (substr($view, 3, 1) == '1') {
7217
+    		$new_view = substr_replace($view, '0', 3, 1);
7218
+    		$title[1] = get_lang('LinksDetails');
7219 7219
     		$sql = "SELECT cl.title, cl.url
7220 7220
                         FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
7221 7221
                         WHERE sl.links_link_id = cl.id
@@ -7223,16 +7223,16 @@  discard block
 block discarded – undo
7223 7223
                             AND sl.links_user_id = $userId
7224 7224
                         GROUP BY cl.title, cl.url";
7225 7225
     		$results = StatsUtils::getManyResults2Col($sql);
7226
-    		$title_line= get_lang('LinksTitleLinkColumn')."\n";
7226
+    		$title_line = get_lang('LinksTitleLinkColumn')."\n";
7227 7227
     		if (is_array($results)) {
7228
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7228
+    			for ($j = 0; $j < count($results); $j++) {
7229 7229
     				$line .= $results[$j][0]."\n";
7230 7230
     			}
7231 7231
     		} else {
7232
-    			$line=get_lang('NoResult');
7232
+    			$line = get_lang('NoResult');
7233 7233
     		}
7234 7234
     	} else {
7235
-    		$new_view = substr_replace($view,'1',3,1);
7235
+    		$new_view = substr_replace($view, '1', 3, 1);
7236 7236
     	}
7237 7237
     	return array($title_line, $line);
7238 7238
     }
@@ -7254,9 +7254,9 @@  discard block
 block discarded – undo
7254 7254
 
7255 7255
     	$downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
7256 7256
 
7257
-    	if (substr($view,4,1) == '1') {
7258
-    		$new_view = substr_replace($view,'0',4,1);
7259
-    		$title[1]= get_lang('DocumentsDetails');
7257
+    	if (substr($view, 4, 1) == '1') {
7258
+    		$new_view = substr_replace($view, '0', 4, 1);
7259
+    		$title[1] = get_lang('DocumentsDetails');
7260 7260
 
7261 7261
     		$sql = "SELECT down_doc_path
7262 7262
                         FROM $downloads_table
@@ -7269,14 +7269,14 @@  discard block
 block discarded – undo
7269 7269
     		$title_line = get_lang('DocumentsTitleDocumentColumn')."\n";
7270 7270
             $line = null;
7271 7271
     		if (is_array($results)) {
7272
-    			for ($j = 0 ; $j < count($results) ; $j++) {
7272
+    			for ($j = 0; $j < count($results); $j++) {
7273 7273
     				$line .= $results[$j]."\n";
7274 7274
     			}
7275 7275
     		} else {
7276 7276
     			$line = get_lang('NoResult');
7277 7277
     		}
7278 7278
     	} else {
7279
-    		$new_view = substr_replace($view,'1',4,1);
7279
+    		$new_view = substr_replace($view, '1', 4, 1);
7280 7280
     	}
7281 7281
     	return array($title_line, $line);
7282 7282
     }
Please login to merge, or discard this patch.