-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpeople.php
More file actions
426 lines (341 loc) · 15.9 KB
/
people.php
File metadata and controls
426 lines (341 loc) · 15.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<?php
$subpath = $_SERVER['REQUEST_URI'];
$incpath = "assets/inc";
include($incpath . "/config.php");
include("header_common_he.php.inc");
include($headerInc);
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>People</title>
<!-- Include style file -->
<link rel="stylesheet" type="text/css" href="<?php echo $designCss;?>">
<link rel="stylesheet" type="text/css" href="<?php echo $peopleCss;?>">
</head>
<body>
<div class="sub-body">
<!-- ++++++++++++++++++++ Start Main Content of the page here! +++++++++++++++++++++ -->
<div class="people-container">
<h1 class="page-title">Group Members</h1>
</div>
<!-- Use function from PI to get the list from the database -TODO: find out how to make it resizable-->
<?php
function getNames($content) {
$names = [];
$doc = new DOMDocument();
libxml_use_internal_errors(true); // Suppress HTML parsing warnings
$doc->loadHTML($content);
libxml_clear_errors();
// Find all <a> tags in <td> elements
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
foreach ($rows as $row) {
$names[] = trim($row->nodeValue);
}
return $names;
}
function getPostDocs($content) {
$names = [];
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($content);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
foreach ($rows as $row) {
$name = trim($row->nodeValue);
if (stripos($name, 'Dr.') !== false && stripos($name, 'Prof.') === false) {
$names[] = $name;
}
}
return $names;
}
function getPhdStudents($content) {
$names = [];
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($content);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
foreach ($rows as $row) {
$name = trim($row->nodeValue);
if (stripos($name, 'Dr.') === false && stripos($name, 'Prof.') === false && stripos($name, 'M.Sc.') !== false) {
$names[] = $name;
}
}
return $names;
}
function getMasterStudents($content) {
$names = [];
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($content);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
foreach ($rows as $row) {
$name = trim($row->nodeValue);
if (stripos($name, 'Dr.') === false && stripos($name, 'Prof.') === false && stripos($name, 'M.Sc.') === false && stripos($name, 'B.Sc.') !== false) {
$names[] = $name;
}
}
return $names;
}
function getBachelorStudents($content) {
$names = [];
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($content);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
foreach ($rows as $row) {
$name = trim($row->nodeValue);
if (stripos($name, 'Dr.') === false && stripos($name, 'Prof.') === false && stripos($name, 'M.Sc.') === false && stripos($name, 'B.Sc.') === false) {
$names[] = $name;
}
}
return $names;
}
function inActiveMembers($names) {
// List of last names to exclude
$excludedLastNames = [
'Bees',
'Meneses González',
'Hammerich',
'Holtherm',
'Hematty',
'Höfer',
'Huidobro Rodriguez',
'Manoussos',
'Menzel',
'Schlötzer',
'Schmidt',
'Stoll',
'Suresh Babu'
];
return array_filter($names, function($name) use ($excludedLastNames) {
// Get the last name (assumed to be before the first comma)
$lastName = explode(',', $name)[0] ?? '';
$lastName = trim($lastName);
return !in_array($lastName, $excludedLastNames);
});
}
function getPersonDetails($content, $name) {
$details = '';
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($content);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
$rows = $xpath->query('//tr[td]/td[1]/a');
// Normalize input name (trim, collapse spaces)
$normalizedInputName = preg_replace('/\s+/', ' ', trim($name));
foreach ($rows as $aTag) {
$rowName = preg_replace('/\s+/', ' ', trim($aTag->nodeValue));
if ($rowName === $normalizedInputName) {
$tr = $aTag->parentNode->parentNode;
$tds = $tr->getElementsByTagName('td');
$group = $tds->length > 1 ? trim($tds->item(1)->nodeValue) : 'N/A';
$room = $tds->length > 2 ? trim($tds->item(2)->nodeValue) : 'N/A';
$phone = $tds->length > 3 ? trim($tds->item(3)->nodeValue) : 'N/A';
$link = $aTag->getAttribute('href');
// Extract last name and normalize it (for image file lookup)
$lastNameParts = explode(',', $normalizedInputName);
$lastName = isset($lastNameParts[0]) ? preg_replace('/\s+/', '', $lastNameParts[0]) : 'member';
// Find image file by any extension
$imageDir = 'assets/figs/group_members/';
$imagePattern = $imageDir . $lastName . '.*';
$imageFiles = glob($imagePattern);
$imgPath = count($imageFiles) > 0 ? $imageFiles[0] : $imageDir . '../member.jpg';
// Format display name: "FirstName LastName"
$nameParts = explode(',', $rowName);
$displayName = isset($nameParts[1]) && isset($nameParts[0])
? trim($nameParts[1]) . ' ' . trim($nameParts[0])
: $rowName;
// Build HTML output
$details = '
<ul class="people">
<li style="display: flex; align-items: flex-start; gap: 1em;">
<img src="' . htmlspecialchars($imgPath) . '" alt="' . htmlspecialchars($lastName) . '" style="width: 120px; height: 160px; object-fit: cover; border-radius: 8px;">
<div>
<p class="title">' . htmlspecialchars($displayName) . '</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Group: ' . htmlspecialchars($group) . '</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Room: ' . htmlspecialchars($room) . '</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Tel.: ' . htmlspecialchars($phone) . '</p>
<div class="people-links">
<span class="link-wrapper"><a href="' . htmlspecialchars($link) . '">Contact >>></a></span>
</div>
</div>
</li>
</ul>';
break;
}
}
return $details;
}
$title = "HE group";
$sel = ("gruppe2='ATLAS' OR gruppe2='ATLAS,H1' OR gruppe3='ATLAS'
OR gruppe3='ATLAS,H1' OR gruppe2='H1' OR gruppe2='mu3e'
OR gruppe2='mu3e,H1'");
// Start output buffering
ob_start();
// Call the function (this will output content into the buffer)
physi_maliste_we($sel);
// Get the content from the buffer and clean it
$content = ob_get_clean();
$encoding = mb_detect_encoding($content, ['UTF-8', 'ISO-8859-1', 'Windows-1252'], true);
//echo "<!-- Detected encoding: $encoding -->";
// Ensure content is treated as UTF-8 during DOM parsing
$content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
// Inject <meta charset="UTF-8"> if missing, so DOMDocument parses correctly
if (stripos($content, '<head>') !== false) {
$content = preg_replace('/<head>/', '<head><meta charset="UTF-8">', $content, 1);
} else {
// fallback: prepend if <head> is missing
$content = '<meta charset="UTF-8">' . $content;
}
// Clean up table cell attributes
$content = preg_replace('/<td\s+bgcolor="#EFEFEF"\s+nowrap="">/', '<td>', $content);
$content = preg_replace('/<td\s+bgcolor="#F8F8F8"\s+nowrap="">/', '<td>', $content);
// Apply regex cleanup
$group_leader = '<!-- Year divider -->
<div class="people-year">
<h3>Group Leader</h3>
</div>
<ul class="people">
<li style="display: flex; align-items: flex-start; gap: 1em;">
<img src="assets/figs/group_members/main_schoening.jpg" alt="schoening" style="width: 120px; height: 160px; object-fit: cover; border-radius: 8px;">
<div>
<p class="title">Prof. Dr. André Schöning</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Group: HE mu3e ATLAS HVMAPS</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Room: INF 226 - 03.105</p>
<p style="display: flex; align-items: flex-start; gap: 1em; margin-bottom: 0.5em;">Tel.: 19401</p>
<div class="people-links">
<span class="link-wrapper"><a href="http://www.physi.uni-heidelberg.de/~schoning">Contact >>></a></span>
</div>
</div>
</li>
</ul>';
echo $group_leader;
echo '<!-- Year divider -->
<div class="people-year">
<h3>Postdocs</h3>
</div>';
$postDocs = getPostDocs($content);
// Filter out inactives
$ActivePostDocs = inActiveMembers($postDocs);
// Display only active postdocs
foreach ($ActivePostDocs as $postDoc) {
$details = getPersonDetails($content, $postDoc);
echo $details;
}
echo '<!-- Year divider -->
<div class="people-year">
<h3>PhD Students</h3>
</div>';
$PhdStudents = getPhdStudents($content);
// Filter out inactives
$ActivePhdStudents = inActiveMembers($PhdStudents);
// Display only active PhD students
foreach ($ActivePhdStudents as $Student) {
$details = getPersonDetails($content, $Student);
echo $details;
}
echo '<!-- Year divider -->
<div class="people-year">
<h3>Master Students</h3>
</div>';
$MasterStudents = getMasterStudents($content);
// Filter out inactives
$ActiveMasterStudents = inActiveMembers($MasterStudents);
// Display only active master students
foreach ($ActiveMasterStudents as $Student) {
$details = getPersonDetails($content, $Student);
echo $details;
}
echo '<!-- Year divider -->
<div class="people-year">
<h3>Bachelor Students</h3>
</div>';
$BachelorStudents = getBachelorStudents($content);
// Filter out inactives
$ActiveBachelorStudents = inActiveMembers($BachelorStudents);
// Display only active bachelor students
foreach ($ActiveBachelorStudents as $Student) {
$details = getPersonDetails($content, $Student);
echo $details;
}
?>
<br/>
<h2 class="western">Former Group Members</h2>
<h3>PhD Students</h3>
Dr. Annie Meneses González <br>
Dr. Christof Sauer <br>
Dr. Marta Czurylo <br>
Dr. Jens Kroeger <br>
Dr. Alena Weber <br>
Dr. Adrian Herkert <br>
Dr. Arthur Bolz <br>
Dr. Mathis Kolb <br>
Dr. Lennart Huth <br>
Dr. Ann-Kathrin Perrevoort <br>
Dr. Dorothea vom Bruch <br>
Dr. Maddalena Guilini <br>
Dr. Moritz Kiehn <br>
Dr. David Sosa <br>
Dr. Rohin Narayan <br>
Dr. Sebastian Schmitt <br>
Dr. Gregor Kasieczka <br>
Dr. Hayk Pirumov<br>
Dr. Florian Huber <br>
<h3>Master</h3>
Tobias Linker <br>
Poppy Hicks <br>
Sachin Gupta <br>
Dohun Kim <br>
Damini Suresh Babu <br>
Jan Hammerich <br>
Lars Noehte <br>
Lukas Gerritzen <br>
Caren Kresse <br>
Jonathan Phillip <br>
Jan Patrick Hammerich <br>
<h3>Bachelor</h3>
Jan-Willem Holtherm <br>
Jan Höfer <br>
David Karres <br>
Laura Bees <br>
Alexander Schmidt <br>
Florian Schlötzer <br>
Aleem Sheikh <br>
Jakob Stricker <br>
Stephan Lachnit <br>
Florian Frauen <br>
Marius Menzel <br>
Sebastian Preuss <br>
Konstantin Neureither <br>
Christoph Blattgerste <br>
Michele Blago <br>
Jens Petersen <br>
Thomas Hugle <br>
Sven Pirner <br>
Daniel Glodeck <br>
<h3>Diploma</h3>
Robert Weidel <br>
Patricia Sauer <br>
Sascha Lischer <br>
Arno John <br>
</div>
<!-- ++++++++++++++++++++ End Main Content of the page here! +++++++++++++++++++++ -->
</div>
</body>
</html>
<?php
include($footerInc);
?>