|
18 | 18 | $sessionId = api_get_session_id(); |
19 | 19 | $courseId = api_get_course_int_id(); |
20 | 20 |
|
| 21 | +if (empty($sessionId)) { |
| 22 | + api_not_allowed(true); |
| 23 | +} |
| 24 | + |
21 | 25 | $allow = api_is_platform_admin(true) || |
22 | 26 | api_is_coach($sessionId, $courseId, false) || |
23 | 27 | SessionManager::get_user_status_in_course_session(api_get_user_id(), $courseId, $sessionId) == 2; |
|
26 | 30 | api_not_allowed(true); |
27 | 31 | } |
28 | 32 |
|
29 | | -/** |
30 | | - * Header |
31 | | - * include the HTTP, HTML headers plus the top banner. |
32 | | - */ |
33 | | -Display::display_header(get_lang('UserOnlineListSession')); |
| 33 | +$sessionInfo = api_get_session_info($sessionId); |
| 34 | + |
| 35 | +Display::display_header(get_lang('UsersOnLineList')); |
| 36 | +echo Display::page_header($sessionInfo['name']); |
34 | 37 | ?> |
35 | 38 | <br /> |
36 | 39 | <table class="data_table"> |
37 | | - <tr class="tableName"> |
38 | | - <td colspan="4"> |
39 | | - <strong><?php echo get_lang('UserOnlineListSession'); ?></strong> |
40 | | - </td> |
41 | | - </tr> |
42 | 40 | <tr> |
43 | 41 | <th> |
44 | 42 | <?php echo get_lang('Name'); ?> |
45 | 43 | </th> |
46 | 44 | <th> |
47 | 45 | <?php echo get_lang('InCourse'); ?> |
48 | 46 | </th> |
49 | | - <th> |
50 | | - <?php echo get_lang('Email'); ?> |
51 | | - </th> |
52 | 47 | <th> |
53 | 48 | <?php echo get_lang('Chat'); ?> |
54 | 49 | </th> |
|
72 | 67 |
|
73 | 68 | $online_time = time() - $time_limit * 60; |
74 | 69 | $current_date = api_get_utc_datetime($online_time); |
75 | | -$students_online = []; |
| 70 | +$studentsOnline = []; |
76 | 71 |
|
77 | 72 | $sql = "SELECT DISTINCT last_access.login_user_id, |
78 | 73 | last_access.login_date, |
79 | 74 | last_access.c_id, |
80 | | - last_access.session_id, |
81 | | - ".(api_is_western_name_order() ? "CONCAT(user.firstname,' ',user.lastname)" : "CONCAT(user.lastname,' ',user.firstname)")." as name, |
82 | | - user.email |
| 75 | + last_access.session_id |
83 | 76 | FROM ".Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE)." AS last_access |
84 | 77 | INNER JOIN ".Database::get_main_table(TABLE_MAIN_USER)." AS user |
85 | 78 | ON user.id = last_access.login_user_id |
|
92 | 85 |
|
93 | 86 | $result = Database::query($sql); |
94 | 87 | while ($user_list = Database::fetch_array($result)) { |
95 | | - $students_online[$user_list['login_user_id']] = $user_list; |
| 88 | + $studentsOnline[$user_list['login_user_id']] = $user_list; |
96 | 89 | } |
97 | 90 |
|
98 | | -if (count($students_online) > 0) { |
99 | | - foreach ($students_online as $student_online) { |
| 91 | +if (count($studentsOnline) > 0) { |
| 92 | + foreach ($studentsOnline as $student_online) { |
| 93 | + $userInfo = api_get_user_info($student_online['login_user_id']); |
| 94 | + if (empty($userInfo)) { |
| 95 | + continue; |
| 96 | + } |
| 97 | + |
100 | 98 | echo "<tr> |
101 | 99 | <td> |
102 | 100 | "; |
103 | | - echo $student_online['name']; |
| 101 | + echo $userInfo['complete_name_with_message_link']; |
104 | 102 | echo " </td> |
105 | 103 | <td> |
106 | 104 | "; |
107 | 105 | $courseInfo = api_get_course_info_by_id($student_online['c_id']); |
108 | | - echo $courseInfo['title']; |
109 | | - echo " </td> |
110 | | - <td> |
111 | | - "; |
112 | | - if (!empty($student_online['email'])) { |
113 | | - echo $student_online['email']; |
114 | | - } else { |
115 | | - echo get_lang('NoEmail'); |
116 | | - } |
117 | | - echo " </td> |
118 | | - <td> |
119 | | - "; |
| 106 | + echo Display::url( |
| 107 | + $courseInfo['title'], |
| 108 | + $courseInfo['course_public_url'].'?id_session='.$student_online['session_id'], |
| 109 | + ['target' => '_blank'] |
| 110 | + ); |
| 111 | + echo " </td>"; |
| 112 | + echo "<td>"; |
120 | 113 | echo '<a |
121 | 114 | target="_blank" |
122 | 115 | href="main/chat/chat.php?cidReq='.$courseInfo['code'].'&id_session='.$student_online['session_id'].'"> -> </a>'; |
|
0 commit comments