|
23 | 23 | * Code |
24 | 24 | */ |
25 | 25 | // name of the language file that needs to be included |
26 | | -$language_file = array('registration', 'admin', 'userInfo'); |
| 26 | +$language_file = array('registration', 'admin', 'userInfo', 'registration'); |
27 | 27 | $use_anonymous = true; |
28 | 28 | require_once '../inc/global.inc.php'; |
29 | 29 | $current_course_tool = TOOL_USER; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 |
|
| 80 | +$user_image_pdf_size = 80; |
| 81 | + |
80 | 82 | if (api_is_allowed_to_edit(null, true)) { |
81 | 83 | if (isset($_GET['action'])) { |
82 | 84 | switch ($_GET['action']) { |
|
120 | 122 |
|
121 | 123 | if ($_GET['type'] == 'pdf') { |
122 | 124 | if ($is_western_name_order) { |
123 | | - $a_users[0] = array('#', get_lang('OfficialCode'), get_lang('FirstName').', '.get_lang('LastName')); |
| 125 | + $a_users[0] = array('#', get_lang('UserPicture'), get_lang('OfficialCode'), get_lang('FirstName').', '.get_lang('LastName')); |
124 | 126 | } else { |
125 | | - $a_users[0] = array('#', get_lang('OfficialCode'), get_lang('LastName').', '.get_lang('FirstName')); |
| 127 | + $a_users[0] = array('#', get_lang('UserPicture'), get_lang('OfficialCode'), get_lang('LastName').', '.get_lang('FirstName')); |
126 | 128 | } |
127 | 129 | } |
128 | 130 |
|
|
168 | 170 | } |
169 | 171 | $data[] = $user; |
170 | 172 | if ($_GET['type'] == 'pdf') { |
| 173 | + $user_info = api_get_user_info($user['user_id']); |
| 174 | + $user_image = Display::img($user_info['avatar'], null, array('width' => $user_image_pdf_size.'px')); |
171 | 175 | if ($is_western_name_order) { |
172 | | - $user_pdf = array($counter, $user['official_code'], $user['firstname'].', '.$user['lastname'] ); |
| 176 | + $user_pdf = array($counter, $user_image, $user['official_code'], $user['firstname'].', '.$user['lastname'] ); |
173 | 177 | } else { |
174 | | - $user_pdf = array($counter, $user['official_code'], $user['lastname'].', '.$user['firstname'] ); |
| 178 | + $user_pdf = array($counter, $user_image, $user['official_code'], $user['lastname'].', '.$user['firstname'] ); |
175 | 179 | } |
176 | 180 | $a_users[] = $user_pdf; |
177 | 181 | } else { |
178 | 182 | $a_users[] = $user; |
179 | 183 | } |
180 | 184 | $counter++; |
181 | 185 | } |
182 | | - } |
183 | | - |
184 | | - |
| 186 | + } |
| 187 | + |
185 | 188 | if ($session_id == 0) { |
186 | 189 |
|
187 | 190 | // users directly subscribed to the course |
|
220 | 223 | } |
221 | 224 | } |
222 | 225 | if ($_GET['type'] == 'pdf') { |
| 226 | + $user_info = api_get_user_info($user['user_id']); |
| 227 | + $user_image = Display::img($user_info['avatar'], null, array('width' => $user_image_pdf_size.'px')); |
| 228 | + |
223 | 229 | if ($is_western_name_order) { |
224 | | - $user_pdf = array($counter, $user['official_code'], $user['firstname'].', '.$user['lastname'] ); |
| 230 | + $user_pdf = array($counter, $user_image, $user['official_code'], $user['firstname'].', '.$user['lastname'] ); |
225 | 231 | } else { |
226 | | - $user_pdf = array($counter, $user['official_code'], $user['lastname'].', '.$user['firstname'] ); |
227 | | - } |
| 232 | + $user_pdf = array($counter, $user_image, $user['official_code'], $user['lastname'].', '.$user['firstname'] ); |
| 233 | + } |
228 | 234 | $a_users[] = $user_pdf; |
229 | 235 | } else { |
230 | 236 | $a_users[] = $user; |
|
268 | 274 | if (!empty($session_id)) { |
269 | 275 | //If I'm a coach |
270 | 276 | $coaches = CourseManager::get_coach_list_from_course_code($course_info['code'], $session_id); |
271 | | - |
| 277 | + |
272 | 278 | if (isset($coaches) && isset($coaches[$user_id])) { |
273 | 279 | $user_info = api_get_user_info($user_id); |
274 | 280 | $description .= '<tr><td>'.get_lang('Coach').': </td><td class="highlight">'.$user_info['complete_name'].'</td>'; |
|
284 | 290 | $description .= '<tr><td>'.get_lang('Date').': </td><td class="highlight">'.api_convert_and_format_date(time(), DATE_TIME_FORMAT_LONG).'</td>'; |
285 | 291 | $description .= '</table>'; |
286 | 292 | $params = array(); |
287 | | - Export::export_table_pdf($a_users, get_lang('UserList'), $header, $description, $params); |
| 293 | + $header_attributes = array( |
| 294 | + array('style' => 'width:10px'), |
| 295 | + array('style' => 'width:30px'), |
| 296 | + array('style' => 'width:50px'), |
| 297 | + array('style' => 'width:500px'), |
| 298 | + ); |
| 299 | + Export::export_table_pdf($a_users, get_lang('UserList'), $header, $description, $params, $header_attributes); |
288 | 300 | exit; |
289 | 301 | } |
290 | 302 | } |
|
0 commit comments