From d0982c5250d2e33c824ddccb8bd245ca39faa724 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 12 Jan 2022 18:58:54 +0100 Subject: Upadte --- search/birth/data.json/index.php | 39 +++++++++++++++++++++ search/birth/index.php | 73 ++++++++++++++++++++++++++++++++++++++++ search/birth/results/index.php | 38 +++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 search/birth/data.json/index.php create mode 100644 search/birth/index.php create mode 100644 search/birth/results/index.php (limited to 'search/birth') diff --git a/search/birth/data.json/index.php b/search/birth/data.json/index.php new file mode 100644 index 0000000..5baf427 --- /dev/null +++ b/search/birth/data.json/index.php @@ -0,0 +1,39 @@ + $person) { + if (isset($person["birth"]["date"]) && isset($person["birth"]["date"]["year"])) { + if (isset($counts[(string)$person["birth"]["date"]["year"]])) { + $counts[(string)$person["birth"]["date"]["year"]]++; + } else { + $counts[(string)$person["birth"]["date"]["year"]] = 1; + } + if (!in_array((string)$person["birth"]["date"]["year"], $names)) { + $names[] = (string)$person["birth"]["date"]["year"]; + } + } +} + +foreach ($names as $name) { + $arr[] = [ + 'name' => $name, + 'occurrences' => $counts[$name] . " personne" . ($counts[$name] > 1 ? "s" : "") + ]; +} + +echo(json_encode($arr)); \ No newline at end of file diff --git a/search/birth/index.php b/search/birth/index.php new file mode 100644 index 0000000..2e412a4 --- /dev/null +++ b/search/birth/index.php @@ -0,0 +1,73 @@ + +
+

Rechercher par date de naissance

+

Patientez...

+ + + + +
+
+
+ \ No newline at end of file diff --git a/search/birth/results/index.php b/search/birth/results/index.php new file mode 100644 index 0000000..6104373 --- /dev/null +++ b/search/birth/results/index.php @@ -0,0 +1,38 @@ + $person) { + if (isset($person["birth"]["date"]) && isset($person["birth"]["date"]["year"])) { + if ((string)$person["birth"]["date"]["year"] === $q) { + $results[] = $id; + } + } +} +if (count($results) === 0): ?> + + +
+ + # + +
+ \ No newline at end of file -- cgit