jmontoyaa пре 7 година
родитељ
комит
54d31e63ad
1 измењених фајлова са 187 додато и 189 уклоњено
  1. 187 189
      main/mySpace/myStudents.php

+ 187 - 189
main/mySpace/myStudents.php

@@ -101,54 +101,54 @@ $em = Database::getManager();
 if (!empty($details)) {
     if ($origin === 'user_course') {
         if (empty($cidReq)) {
-            $interbreadcrumb[] = array(
+            $interbreadcrumb[] = [
                 "url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'],
                 'name' => $courseInfo['title']
-            );
+            ];
         }
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             "url" => "../user/user.php?cidReq=".$course_code,
             "name" => get_lang("Users")
-        );
+        ];
     } else {
         if ($origin === 'tracking_course') {
-            $interbreadcrumb[] = array(
+            $interbreadcrumb[] = [
                 "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(),
                 "name" => get_lang("Tracking")
-            );
+            ];
         } else {
             if ($origin === 'resume_session') {
-                $interbreadcrumb[] = array(
+                $interbreadcrumb[] = [
                     'url' => "../session/session_list.php",
                     "name" => get_lang('SessionList')
-                );
-                $interbreadcrumb[] = array(
+                ];
+                $interbreadcrumb[] = [
                     'url' => "../session/resume_session.php?id_session=".$sessionId,
                     "name" => get_lang('SessionOverview')
-                );
+                ];
             } else {
-                $interbreadcrumb[] = array(
+                $interbreadcrumb[] = [
                     "url" => api_is_student_boss() ? "#" : "index.php",
                     "name" => get_lang('MySpace')
-                );
+                ];
                 if (!empty($coachId)) {
-                    $interbreadcrumb[] = array(
+                    $interbreadcrumb[] = [
                         "url" => "student.php?id_coach=".$coachId,
                         "name" => get_lang("CoachStudents")
-                    );
-                    $interbreadcrumb[] = array(
+                    ];
+                    $interbreadcrumb[] = [
                         "url" => "myStudents.php?student=".$student_id.'&id_coach='.$coachId,
                         "name" => get_lang("StudentDetails")
-                    );
+                    ];
                 } else {
-                    $interbreadcrumb[] = array(
+                    $interbreadcrumb[] = [
                         "url" => "student.php",
                         "name" => get_lang("MyStudents")
-                    );
-                    $interbreadcrumb[] = array(
+                    ];
+                    $interbreadcrumb[] = [
                         "url" => "myStudents.php?student=".$student_id,
                         "name" => get_lang("StudentDetails")
-                    );
+                    ];
                 }
             }
         }
@@ -156,43 +156,43 @@ if (!empty($details)) {
     $nameTools = get_lang("DetailsStudentInCourse");
 } else {
     if ($origin == 'resume_session') {
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             'url' => "../session/session_list.php",
             "name" => get_lang('SessionList')
-        );
+        ];
         if (!empty($sessionId)) {
-            $interbreadcrumb[] = array(
+            $interbreadcrumb[] = [
                 'url' => "../session/resume_session.php?id_session=".$sessionId,
                 "name" => get_lang('SessionOverview')
-            );
+            ];
         }
     } elseif ($origin === 'teacher_details') {
         $this_section = SECTION_TRACKING;
-        $interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
-        $interbreadcrumb[] = array("url" => "teachers.php", "name" => get_lang('Teachers'));
+        $interbreadcrumb[] = ["url" => "index.php", "name" => get_lang('MySpace')];
+        $interbreadcrumb[] = ["url" => "teachers.php", "name" => get_lang('Teachers')];
         $nameTools = $user_info['complete_name'];
     } else {
-        $interbreadcrumb[] = array(
+        $interbreadcrumb[] = [
             "url" => api_is_student_boss() ? "#" : "index.php",
             "name" => get_lang('MySpace')
-        );
+        ];
         if (!empty($coachId)) {
             if ($sessionId) {
-                $interbreadcrumb[] = array(
+                $interbreadcrumb[] = [
                     "url" => "student.php?id_coach=".$coachId."&id_session=".$sessionId,
                     "name" => get_lang("CoachStudents")
-                );
+                ];
             } else {
-                $interbreadcrumb[] = array(
+                $interbreadcrumb[] = [
                     "url" => "student.php?id_coach=".$coachId,
                     "name" => get_lang("CoachStudents")
-                );
+                ];
             }
         } else {
-            $interbreadcrumb[] = array(
+            $interbreadcrumb[] = [
                 "url" => "student.php",
                 "name" => get_lang("MyStudents")
-            );
+            ];
         }
     }
 }
@@ -294,7 +294,7 @@ switch ($action) {
     default:
         break;
 }
-$courses_in_session = array();
+$courses_in_session = [];
 
 //See #4676
 $drh_can_access_all_courses = false;
@@ -303,7 +303,7 @@ if (api_is_drh() || api_is_platform_admin() || api_is_student_boss()) {
 }
 
 $courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
-$courses_in_session_by_coach = array();
+$courses_in_session_by_coach = [];
 $sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_id());
 
 // RRHH or session admin
@@ -354,7 +354,7 @@ $sql = 'SELECT session_id, c_id
         FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
         WHERE user_id=' . intval($user_info['user_id']);
 $rs = Database::query($sql);
-$tmp_sessions = array();
+$tmp_sessions = [];
 while ($row = Database::fetch_array($rs, 'ASSOC')) {
     $tmp_sessions[] = $row['session_id'];
     if ($drh_can_access_all_courses) {
@@ -490,7 +490,7 @@ if (CourseManager::is_user_subscribed_in_course($user_info['user_id'], $course_c
     $avg_student_progress = Tracking::get_avg_student_progress(
         $user_info['user_id'],
         $course_code,
-        array(),
+        [],
         $sessionId
     );
 
@@ -498,7 +498,7 @@ if (CourseManager::is_user_subscribed_in_course($user_info['user_id'], $course_c
     $avg_student_score = Tracking::get_avg_student_score(
         $user_info['user_id'],
         $course_code,
-        array(),
+        [],
         $sessionId
     );
 }
@@ -528,47 +528,47 @@ if ($last_connection_date == '') {
 }
 
 // cvs information
-$csv_content[] = array(
+$csv_content[] = [
     get_lang('Information')
-);
-$csv_content[] = array(
+];
+$csv_content[] = [
     get_lang('Name'),
     get_lang('Email'),
     get_lang('Tel')
-);
-$csv_content[] = array(
+];
+$csv_content[] = [
     $user_info['complete_name'],
     $user_info['email'],
     $user_info['phone']
-);
+];
 
-$csv_content[] = array();
+$csv_content[] = [];
 
 // csv tracking
-$csv_content[] = array(
+$csv_content[] = [
     get_lang('Tracking')
-);
-$csv_content[] = array(
+];
+$csv_content[] = [
     get_lang('FirstLoginInPlatform'),
     get_lang('LatestLoginInPlatform'),
     get_lang('TimeSpentInTheCourse'),
     get_lang('Progress'),
     get_lang('Score')
-);
-$csv_content[] = array(
+];
+$csv_content[] = [
     strip_tags($first_connection_date),
     strip_tags($last_connection_date),
     $time_spent_on_the_course,
     $avg_student_progress.'%',
     $avg_student_score
-);
+];
 
 $coachs_name  = '';
 $session_name = '';
 $table_title = Display::return_icon(
     'user.png',
     get_lang('User'),
-    array(),
+    [],
     ICON_SIZE_SMALL
 ).$user_info['complete_name'];
 
@@ -632,7 +632,7 @@ $userGroups = $userGroupManager->getNameListByUser(
         </tr>
         <?php
         if (!empty($course_code)) {
-        ?>
+            ?>
             <tr>
                 <td>
                     <a href="access_details.php?student=<?php echo $student_id; ?>&course=<?php echo $course_code; ?>&origin=<?php echo $origin; ?>&cidReq=<?php echo $course_code; ?>&id_session=<?php echo $sessionId; ?>"><?php echo get_lang('SeeAccesses'); ?></a>
@@ -714,7 +714,7 @@ $userGroups = $userGroupManager->getNameListByUser(
         $extraField = new ExtraField('session');
 
         if ($items) {
-             /** @var ExtraFieldSavedSearch $item */
+            /** @var ExtraFieldSavedSearch $item */
             foreach ($items as $item) {
                 $variable = $item->getField()->getVariable();
                 if (in_array($variable, $listVariables)) {
@@ -789,7 +789,8 @@ $userGroups = $userGroupManager->getNameListByUser(
             <td align="right"><?php echo get_lang('LatestLoginInPlatform') ?></td>
             <td align="left"><?php echo $last_connection_date ?></td>
         </tr>
-        <?php if (isset($_GET['details']) && $_GET['details'] == 'true') { ?>
+        <?php if (isset($_GET['details']) && $_GET['details'] == 'true') {
+            ?>
             <tr>
                 <td align="right"><?php echo get_lang('TimeSpentInTheCourse') ?></td>
                 <td align="left"><?php echo  $time_spent_on_the_course ?></td>
@@ -798,12 +799,11 @@ $userGroups = $userGroupManager->getNameListByUser(
                 <td align="right">
                     <?php
                     echo get_lang('Progress').' ';
-                    Display:: display_icon(
+            Display:: display_icon(
                         'info3.gif',
                         get_lang('ScormAndLPProgressTotalAverage'),
-                        array('align' => 'absmiddle', 'hspace' => '3px')
-                    );
-                    ?>
+                        ['align' => 'absmiddle', 'hspace' => '3px']
+                    ); ?>
                 </td>
                 <td align="left"><?php echo $avg_student_progress.'%' ?></td>
              </tr>
@@ -811,20 +811,18 @@ $userGroups = $userGroupManager->getNameListByUser(
                 <td align="right">
                     <?php
                     echo get_lang('Score').' ';
-                    Display:: display_icon(
+            Display:: display_icon(
                         'info3.gif',
                         get_lang('ScormAndLPTestTotalAverage'),
-                        array('align' => 'absmiddle', 'hspace' => '3px')
-                    );
-                    ?>
+                        ['align' => 'absmiddle', 'hspace' => '3px']
+                    ); ?>
                 </td>
                 <td align="left"><?php
                     if (is_numeric($avg_student_score)) {
                         echo $avg_student_score.'%';
                     } else {
                         echo $avg_student_score;
-                    }
-                    ?>
+                    } ?>
                 </td>
             </tr>
         <?php
@@ -872,7 +870,8 @@ $userGroups = $userGroupManager->getNameListByUser(
         ?>
         </tbody>
     </table>
-    <?php if (!empty($userGroups)) { ?>
+    <?php if (!empty($userGroups)) {
+            ?>
         <table class="table table-striped table-hover">
             <thead>
                 <tr>
@@ -880,21 +879,24 @@ $userGroups = $userGroupManager->getNameListByUser(
                 </tr>
             </thead>
             <tbody>
-                <?php foreach ($userGroups as $class) { ?>
+                <?php foreach ($userGroups as $class) {
+                ?>
                 <tr>
                     <td><?php echo $class ?></td>
                 </tr>
-                <?php } ?>
+                <?php
+            } ?>
             </tbody>
         </table>
-    <?php } ?>
+    <?php
+        } ?>
     </div>
 </div>
 <?php
 
 if (empty($_GET['details'])) {
-    $csv_content[] = array();
-    $csv_content[] = array(
+    $csv_content[] = [];
+    $csv_content[] = [
         get_lang('Session'),
         get_lang('Course'),
         get_lang('Time'),
@@ -902,7 +904,7 @@ if (empty($_GET['details'])) {
         get_lang('Score'),
         get_lang('AttendancesFaults'),
         get_lang('Evaluations')
-    );
+    ];
 
     $attendance = new Attendance();
     foreach ($courses_in_session as $sId => $courses) {
@@ -913,7 +915,7 @@ if (empty($_GET['details'])) {
         $title = Display::return_icon(
             'course.png',
             get_lang('Courses'),
-            array(),
+            [],
             ICON_SIZE_SMALL
         ).' '.get_lang('Courses');
 
@@ -931,7 +933,7 @@ if (empty($_GET['details'])) {
             if (!empty($access_start_date) && !empty($access_end_date)) {
                 $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date;
             }
-            $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
+            $title = Display::return_icon('session.png', get_lang('Session'), [], ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
         }
 
         // Courses
@@ -998,7 +1000,7 @@ if (empty($_GET['details'])) {
                         $sId
                     );
 
-                    $scoretotal = array();
+                    $scoretotal = [];
                     if (isset($cats) && isset($cats[0])) {
                         if (!empty($sId)) {
                             $scoretotal = $cats[0]->calc_score($student_id, null, $courseCodeItem, $sId);
@@ -1030,7 +1032,7 @@ if (empty($_GET['details'])) {
                     $progress = empty($progress) ? '0%' : $progress.'%';
                     $score = empty($score) ? '0%' : $score.'%';
 
-                    $csv_content[] = array(
+                    $csv_content[] = [
                         $session_name,
                         $courseInfoItem['title'],
                         $time_spent_on_course,
@@ -1038,7 +1040,7 @@ if (empty($_GET['details'])) {
                         $score,
                         $attendances_faults_avg,
                         $scoretotal_display
-                    );
+                    ];
 
                     echo '<tr>
                     <td ><a href="' .$courseInfoItem['course_public_url'].'?id_session='.$sId.'">'.
@@ -1074,31 +1076,31 @@ if (empty($_GET['details'])) {
             Display::return_icon(
                 'info3.gif',
                 get_lang('TotalTimeByCourse'),
-                array('align' => 'absmiddle', 'hspace' => '3px')
+                ['align' => 'absmiddle', 'hspace' => '3px']
             ),
         'best_score' => get_lang('BestScore'),
         'latest_attempt_avg_score' => get_lang('LatestAttemptAverageScore').
             Display::return_icon(
                 'info3.gif',
                 get_lang('AverageIsCalculatedBasedInTheLatestAttempts'),
-                array('align' => 'absmiddle', 'hspace' => '3px')
+                ['align' => 'absmiddle', 'hspace' => '3px']
             ),
         'progress'=> get_lang('Progress').
             Display::return_icon(
                 'info3.gif',
                 get_lang('LPProgressScore'),
-                array('align' => 'absmiddle', 'hspace' => '3px')
+                ['align' => 'absmiddle', 'hspace' => '3px']
             ),
         'last_connection' => get_lang('LastConnexion').
             Display::return_icon(
                 'info3.gif',
                 get_lang('LastTimeTheCourseWasUsed'),
-                array('align' => 'absmiddle', 'hspace' => '3px')
+                ['align' => 'absmiddle', 'hspace' => '3px']
             )
     ];
     if ($user_info['status'] != INVITEE) {
-        $csv_content[] = array();
-        $csv_content[] = array(str_replace('&nbsp;', '', $table_title));
+        $csv_content[] = [];
+        $csv_content[] = [str_replace('&nbsp;', '', $table_title)];
 
         $trackingColumns = api_get_configuration_value('tracking_columns');
         if (isset($trackingColumns['my_students_lp'])) {
@@ -1176,7 +1178,7 @@ if (empty($_GET['details'])) {
                 $progress = Tracking::get_avg_student_progress(
                     $student_id,
                     $course_code,
-                    array($lp_id),
+                    [$lp_id],
                     $sessionId
                 );
 
@@ -1190,7 +1192,7 @@ if (empty($_GET['details'])) {
                 $total_time = Tracking::get_time_spent_in_lp(
                     $student_id,
                     $course_code,
-                    array($lp_id),
+                    [$lp_id],
                     $sessionId
                 );
 
@@ -1220,7 +1222,7 @@ if (empty($_GET['details'])) {
                 $score = Tracking::get_avg_student_score(
                     $student_id,
                     $course_code,
-                    array($lp_id),
+                    [$lp_id],
                     $sessionId
                 );
 
@@ -1228,7 +1230,7 @@ if (empty($_GET['details'])) {
                 $score_latest = Tracking:: get_avg_student_score(
                     $student_id,
                     $course_code,
-                    array($lp_id),
+                    [$lp_id],
                     $sessionId,
                     false,
                     true
@@ -1237,7 +1239,7 @@ if (empty($_GET['details'])) {
                 $bestScore = Tracking::get_avg_student_score(
                     $student_id,
                     $course_code,
-                    array($lp_id),
+                    [$lp_id],
                     $sessionId,
                     false,
                     false,
@@ -1338,8 +1340,7 @@ if (empty($_GET['details'])) {
                     echo '</td>';
                     echo '</tr>';
                 }
-            }
-            ?>
+            } ?>
             </tbody>
             </table>
             </div>
@@ -1347,14 +1348,15 @@ if (empty($_GET['details'])) {
         }
     } ?>
     <!-- line about exercises -->
-    <?php if ($user_info['status'] != INVITEE) { ?>
+    <?php if ($user_info['status'] != INVITEE) {
+        ?>
     <div class="table-responsive">
     <table class="table table-striped table-hover">
     <thead>
     <tr>
         <th><?php echo get_lang('Exercises'); ?></th>
         <th><?php echo get_lang('LearningPath'); ?></th>
-        <th><?php echo get_lang('AvgCourseScore').' '.Display::return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
+        <th><?php echo get_lang('AvgCourseScore').' '.Display::return_icon('info3.gif', get_lang('AverageScore'), ['align' => 'absmiddle', 'hspace' => '3px']) ?></th>
         <th><?php echo get_lang('Attempts'); ?></th>
         <th><?php echo get_lang('LatestAttempt'); ?></th>
         <th><?php echo get_lang('AllAttempts'); ?></th>
@@ -1363,35 +1365,35 @@ if (empty($_GET['details'])) {
     <tbody>
     <?php
 
-    $csv_content[] = array();
-    $csv_content[] = array(
+    $csv_content[] = [];
+        $csv_content[] = [
         get_lang('Exercises'),
         get_lang('LearningPath'),
         get_lang('AvgCourseScore'),
         get_lang('Attempts')
-    );
+    ];
 
-    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
-    $sessionCondition = api_get_session_condition(
+        $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
+        $sessionCondition = api_get_session_condition(
         $sessionId,
         true,
         true,
         'quiz.session_id'
     );
 
-    $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
+        $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
             WHERE
                 quiz.c_id = ".$courseInfo['real_id']." AND
                 active IN (0, 1)
                 $sessionCondition                    
             ORDER BY quiz.title ASC ";
 
-    $result_exercices = Database::query($sql);
-    $i = 0;
-    if (Database :: num_rows($result_exercices) > 0) {
-        while ($exercices = Database :: fetch_array($result_exercices)) {
-            $exercise_id = intval($exercices['id']);
-            $count_attempts = Tracking::count_student_exercise_attempts(
+        $result_exercices = Database::query($sql);
+        $i = 0;
+        if (Database :: num_rows($result_exercices) > 0) {
+            while ($exercices = Database :: fetch_array($result_exercices)) {
+                $exercise_id = intval($exercices['id']);
+                $count_attempts = Tracking::count_student_exercise_attempts(
                 $student_id,
                 $courseInfo['real_id'],
                 $exercise_id,
@@ -1400,7 +1402,7 @@ if (empty($_GET['details'])) {
                 $sessionId,
                 2
             );
-            $score_percentage = Tracking::get_avg_student_exercise_score(
+                $score_percentage = Tracking::get_avg_student_exercise_score(
                 $student_id,
                 $course_code,
                 $exercise_id,
@@ -1409,8 +1411,8 @@ if (empty($_GET['details'])) {
                 0
             );
 
-            if (!isset($score_percentage) && $count_attempts > 0) {
-                $scores_lp = Tracking::get_avg_student_exercise_score(
+                if (!isset($score_percentage) && $count_attempts > 0) {
+                    $scores_lp = Tracking::get_avg_student_exercise_score(
                     $student_id,
                     $course_code,
                     $exercise_id,
@@ -1418,43 +1420,43 @@ if (empty($_GET['details'])) {
                     2,
                     1
                 );
-                $score_percentage = $scores_lp[0];
-                $lp_name = $scores_lp[1];
-            } else {
-                $lp_name = '-';
-            }
-            $lp_name = !empty($lp_name) ? $lp_name : get_lang('NoLearnpath');
+                    $score_percentage = $scores_lp[0];
+                    $lp_name = $scores_lp[1];
+                } else {
+                    $lp_name = '-';
+                }
+                $lp_name = !empty($lp_name) ? $lp_name : get_lang('NoLearnpath');
 
-            if ($i % 2) {
-                $css_class = 'row_odd';
-            } else {
-                $css_class = 'row_even';
-            }
+                if ($i % 2) {
+                    $css_class = 'row_odd';
+                } else {
+                    $css_class = 'row_even';
+                }
 
-            echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
-            echo '<td>';
+                echo '<tr class="'.$css_class.'"><td>'.$exercices['title'].'</td>';
+                echo '<td>';
 
-            if (!empty($lp_name)) {
-                echo $lp_name;
-            } else {
-                echo '-';
-            }
+                if (!empty($lp_name)) {
+                    echo $lp_name;
+                } else {
+                    echo '-';
+                }
 
-            echo '</td>';
-            echo '<td>';
+                echo '</td>';
+                echo '<td>';
 
-            if ($count_attempts > 0) {
-                echo $score_percentage.'%';
-            } else {
-                echo '-';
-                $score_percentage = 0;
-            }
+                if ($count_attempts > 0) {
+                    echo $score_percentage.'%';
+                } else {
+                    echo '-';
+                    $score_percentage = 0;
+                }
 
-            echo '</td>';
-            echo '<td>'.$count_attempts.'</td>';
-            echo '<td>';
+                echo '</td>';
+                echo '<td>'.$count_attempts.'</td>';
+                echo '<td>';
 
-            $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
+                $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
                      WHERE
                         exe_exo_id = "'.$exercise_id.'" AND
                         exe_user_id ="'.$student_id.'" AND
@@ -1463,51 +1465,49 @@ if (empty($_GET['details'])) {
                         status = ""
                     ORDER BY exe_date DESC
                     LIMIT 1';
-            $result_last_attempt = Database::query($sql);
-            if (Database :: num_rows($result_last_attempt) > 0) {
-                $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
-                if ($count_attempts > 0) {
-                    echo '<a href="../exercise/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'">
+                $result_last_attempt = Database::query($sql);
+                if (Database :: num_rows($result_last_attempt) > 0) {
+                    $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
+                    if ($count_attempts > 0) {
+                        echo '<a href="../exercise/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'">
                     '.Display::return_icon('quiz.png').'
                  </a>';
+                    }
                 }
-            }
-            echo '</td>';
+                echo '</td>';
 
-            echo '<td>';
-            if ($count_attempts > 0) {
-                $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
-                echo Display::url(
+                echo '<td>';
+                if ($count_attempts > 0) {
+                    $all_attempt_url = "../exercise/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
+                    echo Display::url(
                     Display::return_icon(
                         'test_results.png',
                         get_lang('AllAttempts'),
-                        array(),
+                        [],
                         ICON_SIZE_SMALL
                     ),
                     $all_attempt_url
                 );
-            }
-            echo '</td>';
+                }
+                echo '</td>';
 
-            echo '</tr>';
-            $data_exercices[$i][] = $exercices['title'];
-            $data_exercices[$i][] = $score_percentage.'%';
-            $data_exercices[$i][] = $count_attempts;
+                echo '</tr>';
+                $data_exercices[$i][] = $exercices['title'];
+                $data_exercices[$i][] = $score_percentage.'%';
+                $data_exercices[$i][] = $count_attempts;
 
-            $csv_content[] = array(
+                $csv_content[] = [
                 $exercices['title'],
                 $lp_name,
                 $score_percentage,
                 $count_attempts
-            );
+            ];
 
-            $i++;
-
-        }
-    } else {
-        echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
-    }
-    ?>
+                $i++;
+            }
+        } else {
+            echo '<tr><td colspan="6">'.get_lang('NoExercise').'</td></tr>';
+        } ?>
     </tbody>
     </table>
     </div>
@@ -1518,20 +1518,20 @@ if (empty($_GET['details'])) {
     if (empty($sessionId)) {
         $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
 
-        $survey_data = array();
+        $survey_data = [];
         foreach ($survey_list as $survey) {
             $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $courseInfo['real_id']);
-            $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
+            $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), [], ICON_SIZE_SMALL);
             if (in_array($student_id, $user_list)) {
-                $survey_done = Display::return_icon("accept.png", get_lang('Answered'), array(), ICON_SIZE_SMALL);
+                $survey_done = Display::return_icon("accept.png", get_lang('Answered'), [], ICON_SIZE_SMALL);
             }
-            $data = array('title' => $survey['title'], 'done' => $survey_done);
+            $data = ['title' => $survey['title'], 'done' => $survey_done];
             $survey_data[] = $data;
         }
 
         if (!empty($survey_list)) {
-            $table = new HTML_Table(array('class' => 'data_table'));
-            $header_names = array(get_lang('Survey'), get_lang('Answered'));
+            $table = new HTML_Table(['class' => 'data_table']);
+            $header_names = [get_lang('Survey'), get_lang('Answered')];
             $row = 0;
             $column = 0;
             foreach ($header_names as $item) {
@@ -1614,8 +1614,7 @@ if (empty($_GET['details'])) {
         </div>
     ';
 
-    // line about other tools
-    ?>
+    // line about other tools ?>
     <div class="table-responsive">
     <table class="table table-striped table-hover">
         <thead>
@@ -1625,7 +1624,7 @@ if (empty($_GET['details'])) {
         </thead>
         <tbody>
     <?php
-    $csv_content[] = array();
+    $csv_content[] = [];
     $nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
     $messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
     $links = Tracking::count_student_visited_links($student_id, $courseInfo['real_id'], $sessionId);
@@ -1633,35 +1632,34 @@ if (empty($_GET['details'])) {
     $documents = Tracking::count_student_downloaded_documents($student_id, $courseInfo['real_id'], $sessionId);
     $uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
 
-    $csv_content[] = array(
+    $csv_content[] = [
         get_lang('OtherTools')
-    );
+    ];
 
-    $csv_content[] = array(
+    $csv_content[] = [
         get_lang('Student_publication'),
         $nb_assignments
-    );
-    $csv_content[] = array(
+    ];
+    $csv_content[] = [
         get_lang('Messages'),
         $messages
-    );
-    $csv_content[] = array(
+    ];
+    $csv_content[] = [
         get_lang('LinksDetails'),
         $links
-    );
-    $csv_content[] = array(
+    ];
+    $csv_content[] = [
         get_lang('DocumentsDetails'),
         $documents
-    );
-    $csv_content[] = array(
+    ];
+    $csv_content[] = [
         get_lang('UploadedDocuments'),
         $uploaded_documents
-    );
-    $csv_content[] = array(
+    ];
+    $csv_content[] = [
         get_lang('ChatLastConnection'),
         $chat_last_connection
-    );
-    ?>
+    ]; ?>
     <tr><!-- assignments -->
         <td width="40%"><?php echo get_lang('Student_publication') ?></td>
         <td><?php echo $nb_assignments ?></td>