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
|
<?php
setlocale(LC_ALL, 'fr_FR.UTF-8');
$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/data/people.json"), true);
function getplace($place) {
$info = false;
if (isset($place["city"])) {
$info = true;
echo("<a href='/search/city/?q=" . $place["city"] . "'>" . $place["city"] . "</a><br>");
}
if (isset($place["dept"])) {
$info = true;
echo("<a href='/search/dept/?q=" . $place["dept"] . "'>" . $place["dept"] . "</a><br>");
}
if (isset($place["country"])) {
$info = true;
echo($place["country"] . "<br>");
}
if (!$info) {
echo("Non renseigné");
}
}
if (isset($_GET['_']) && trim($_GET['_']) !== "" && isset($data[$_GET['_']])) {
$id = $_GET['_'];
$person = $data[$_GET['_']];
} else {
header("Location: /");
die();
}
$_TITLE = $person["famname"] . " " . $person["surname"] . " (#" . $id . ")"; require_once $_SERVER['DOCUMENT_ROOT'] . "/private/header.php"; ?>
<div class="container">
<h1>
<?= $person["famname"] . " " . $person["surname"] . " <span class='text-muted'>#" . $id . "</span>" ?>
<a style="float:right;position: relative;top: 7px;" href="/tree/?_=<?= $id ?>" class="btn btn-outline-primary">Voir l'arbre</a>
</h1>
<br>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td colspan="2">
<b>Noms et prénoms</b>
</td>
</tr>
<tr>
<td class="text-muted">Nom de famille</td>
<td><a href="/search/lastname/?q=<?= ucfirst(strtolower($person["famname"])) ?>"><?= strtoupper($person["famname"]) ?></a></td>
</tr>
<tr>
<td class="text-muted">Premier prénom</td>
<td><a href="/search/name/?q=<?= ucfirst(strtolower($person["surname"])) ?>"><?= $person["surname"] ?></a></td>
</tr>
<tr>
<td class="text-muted">Prénoms alternatifs</td>
<td><?php
if (count($person["altnames"]) < 1) {
echo("Non applicable");
} else {
foreach ($person["altnames"] as $name) {
echo('<a href="/search/name/?q=' . ucfirst(strtolower($name)) . '">' . $name . '</a><br>');
}
}
?></td>
</tr>
<tr>
<td class="text-muted">Nom complet</td>
<td><?= strtoupper($person["famname"]) ?> <?= strtoupper($person["surname"]) ?> <?= strtoupper(implode(" ", $person["altnames"])) ?></td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td colspan="2">
<b>Informations générales</b>
</td>
</tr>
<tr>
<td class="text-muted">Identifiant généalogique</td>
<td>#<?= $id ?></td>
</tr>
<tr>
<td class="text-muted">Sexe</td>
<td><?php
if ($person["sex"] === "F") {
echo("Féminin");
} else {
echo("Masculin");
}
?></td>
</tr>
<?php if (isset($person["birth"]["date"]["day"])): ?>
<tr>
<td class="text-muted">Date de naissance</td>
<td><?= strftime("%A %e %B", strtotime($person["birth"]["date"]["day"] . "-" . $person["birth"]["date"]["month"] . "-" . $person["birth"]["date"]["year"])) ?> <a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["birth"]["date"]["month"])): ?>
<tr>
<td class="text-muted">Mois de naissance</td>
<td><?= strftime("%B", strtotime("1-" . $person["death"]["date"]["month"] . "-" . $person["death"]["date"]["year"])) ?> <a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["birth"]["date"]["year"])): ?>
<tr>
<td class="text-muted">Année de naissance</td>
<td><a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php else: ?>
<tr>
<td class="text-muted">Date de naissance</td>
<td>Non renseignée</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td colspan="2">
<b>Lieux et endroits</b>
</td>
</tr>
<tr>
<td class="text-muted">Lieu de naissance</td>
<td><?php
getplace($person["birth"]["place"]);
?></td>
</tr>
<tr>
<td class="text-muted">Lieu de décès</td>
<td><?php
getplace($person["death"]["place"]);
?></td>
</tr>
<?php if (isset($person["family"]) && isset($person["family"]["marriage"])): ?>
<tr>
<td class="text-muted">Lieu de mariage</td>
<td><?php
getplace($person["family"]["marriage"]["place"]);
?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td colspan="2">
<b>Dates</b>
</td>
</tr>
<?php if (isset($person["birth"]["date"]["day"])): ?>
<tr>
<td class="text-muted">Date de naissance</td>
<td><?= strftime("%A %e %B", strtotime($person["birth"]["date"]["day"] . "-" . $person["birth"]["date"]["month"] . "-" . $person["birth"]["date"]["year"])) ?> <a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["birth"]["date"]["month"])): ?>
<tr>
<td class="text-muted">Mois de naissance</td>
<td><?= strftime("%B", strtotime("1-" . $person["birth"]["date"]["month"] . "-" . $person["birth"]["date"]["year"])) ?> <a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["birth"]["date"]["year"])): ?>
<tr>
<td class="text-muted">Année de naissance</td>
<td><a href="/search/birth/?q=<?= $person["birth"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["birth"]["date"]["year"])) ?></a></td>
</tr>
<?php else: ?>
<tr>
<td class="text-muted">Date de naissance</td>
<td>Non renseigné</td>
</tr>
<?php endif; ?>
<?php if (isset($person["death"]["date"]["day"])): ?>
<tr>
<td class="text-muted">Date de décès</td>
<td><?= strftime("%A %e %B", strtotime($person["death"]["date"]["day"] . "-" . $person["death"]["date"]["month"] . "-" . $person["death"]["date"]["year"])) ?> <a href="/search/death/?q=<?= $person["death"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["death"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["death"]["date"]["month"])): ?>
<tr>
<td class="text-muted">Mois de décès</td>
<td><?= strftime("%B", strtotime("1-" . $person["death"]["date"]["month"] . "-" . $person["death"]["date"]["year"])) ?> <a href="/search/death/?q=<?= $person["death"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["death"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["death"]["date"]["year"])): ?>
<tr>
<td class="text-muted">Année de décès</td>
<td><a href="/search/death/?q=<?= $person["death"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["death"]["date"]["year"])) ?></a></td>
</tr>
<?php else: ?>
<tr>
<td class="text-muted">Date de décès</td>
<td>Non applicable</td>
</tr>
<?php endif; ?>
<?php if (isset($person["family"]) && isset($person["family"]["marriage"])): ?>
<?php if (isset($person["family"]["marriage"]["date"]["day"])): ?>
<tr>
<td class="text-muted">Date de mariage</td>
<td><?= strftime("%A %e %B", strtotime($person["family"]["marriage"]["date"]["day"] . "-" . $person["family"]["marriage"]["date"]["month"] . "-" . $person["family"]["marriage"]["date"]["year"])) ?> <a href="/search/marriage/?q=<?= $person["family"]["marriage"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["family"]["marriage"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["family"]["marriage"]["date"]["month"])): ?>
<tr>
<td class="text-muted">Mois de mariage</td>
<td><?= strftime("%B", strtotime("1-" . $person["family"]["marriage"]["date"]["month"] . "-" . $person["family"]["marriage"]["date"]["year"])) ?> <a href="/search/marriage/?q=<?= $person["family"]["marriage"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["family"]["marriage"]["date"]["year"])) ?></a></td>
</tr>
<?php elseif (isset($person["family"]["marriage"]["date"]["year"])): ?>
<tr>
<td class="text-muted">Année de mariage</td>
<td><a href="/search/marriage/?q=<?= $person["family"]["marriage"]["date"]["year"] ?>"><?= strftime("%Y", strtotime("1-1-" . $person["family"]["marriage"]["date"]["year"])) ?></a></td>
</tr>
<?php else: ?>
<tr>
<td class="text-muted">Date de mariage</td>
<td>Non applicable</td>
</tr>
<?php endif; ?>
<?php else: ?>
<tr>
<td class="text-muted">Date de mariage</td>
<td>Non applicable</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="table table-bordered table-dark">
<tbody>
<tr>
<td colspan="2">
<b>Liens de parenté</b>
</td>
</tr>
<tr>
<td class="text-muted"><?= $person["sex"] === "F" ? "Époux" : "Épouse" ?></td>
<td><?php
$soid = $person["sex"] === "F" ? "husband" : "wife";
if (isset($person["family"]) && isset($person["family"][$soid])) {
echo("<a href='/person/?_=" . $person["family"][$soid] . "'>" . $data[$person["family"][$soid]]["famname"] . " " . $data[$person["family"][$soid]]["surname"] . " (#" . $person["family"][$soid] . ")</a>");
} else {
echo("Non applicable");
}
if (isset($person["family"]["marriage"]) && isset($person["family"]["marriage"]["date"]["year"]) && isset($person["birth"]["date"]["year"])) {
echo(" (marié" . ($person["sex"] === "F" ? "e" : "") . " à " . ($person["family"]["marriage"]["date"]["year"] - $person["birth"]["date"]["year"]) . " ans)");
} else if (!isset($person["family"]["marriage"])) {
echo(" (pas de mariage)");
}
?></td>
</tr>
<tr>
<td class="text-muted">Enfant<?php
if (isset($person["family"]) && isset($person["family"]["children"])) {
if (count($person["family"]["children"]) > 1) {
echo("s");
}
}
?></td>
<td><?php
$found = false;
if (isset($person["family"]) && isset($person["family"]["children"])) {
foreach ($person["family"]["children"] as $child) {
$found = true;
echo("<a href='/person/?_=" . $child . "'>" . $data[$child]["famname"] . " " . $data[$child]["surname"] . " (#" . $child . ")</a>");
if (isset($person["birth"]["date"]["year"]) && isset($data[$child]["birth"]["date"]["year"])) {
echo(" (né" . ($data[$child]["sex"] === "F" ? "e" : "") . " à " . ($data[$child]["birth"]["date"]["year"] - $person["birth"]["date"]["year"]) . " ans)");
}
echo("<br>");
}
}
if (!$found) {
echo("Non applicable");
}
?></td>
</tr>
<tr>
<td class="text-muted">Père</td>
<td><?php
$found = false;
foreach ($data as $potid => $potential) {
if (isset($potential["family"]) && count($potential["family"]["children"]) > 0 && in_array($id, $potential["family"]["children"]) && $potential["sex"] !== "F") {
$found = true;
echo("<a href='/person/?_=" . $potid . "'>" . $potential["famname"] . " " . $potential["surname"] . " (#" . $potid . ")</a><br>");
}
}
if (!$found) {
echo("Non renseigné");
}
?></td>
</tr>
<tr>
<td class="text-muted">Mère</td>
<td><?php
$found = false;
foreach ($data as $potid => $potential) {
if (isset($potential["family"]) && count($potential["family"]["children"]) > 0 && in_array($id, $potential["family"]["children"]) && $potential["sex"] === "F") {
$found = true;
echo("<a href='/person/?_=" . $potid . "'>" . $potential["famname"] . " " . $potential["surname"] . " (#" . $potid . ")</a><br>");
}
}
if (!$found) {
echo("Non renseigné");
}
?></td>
</tr>
</tbody>
</table>
<style>
.table {
border-radius: 5px;
}
.table td {
width: 50%;
}
.table td:nth-child(1) {
text-align: right;
}
.table td[colspan="2"] {
text-align: center;
}
</style>
</div>
<br>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/private/footer.php"; ?>
|