diff options
Diffstat (limited to 'app/genealogy/search/city')
-rw-r--r-- | app/genealogy/search/city/data.json/index.php | 39 | ||||
-rw-r--r-- | app/genealogy/search/city/index.php | 73 | ||||
-rw-r--r-- | app/genealogy/search/city/results/index.php | 38 |
3 files changed, 0 insertions, 150 deletions
diff --git a/app/genealogy/search/city/data.json/index.php b/app/genealogy/search/city/data.json/index.php deleted file mode 100644 index e61fd04..0000000 --- a/app/genealogy/search/city/data.json/index.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/../session.php";
-
-/** @var string $_FULLNAME
- * @var string $_USER
- * @var array $_PROFILE
- * @var array $_CONFIG
- */
-
-$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/data/people.json"), true);
-
-header("Content-Type: application/json");
-
-$arr = [];
-$names = [];
-$counts = [];
-
-foreach ($data as $id => $person) {
- if (isset($person["birth"]["place"]) && isset($person["birth"]["place"]["city"])) {
- if (isset($counts[$person["birth"]["place"]["city"]])) {
- $counts[$person["birth"]["place"]["city"]]++;
- } else {
- $counts[$person["birth"]["place"]["city"]] = 1;
- }
- if (!in_array($person["birth"]["place"]["city"], $names)) {
- $names[] = $person["birth"]["place"]["city"];
- }
- }
-}
-
-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/app/genealogy/search/city/index.php b/app/genealogy/search/city/index.php deleted file mode 100644 index 6559927..0000000 --- a/app/genealogy/search/city/index.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php $_TITLE = "Recherche par ville de naissance"; require_once $_SERVER['DOCUMENT_ROOT'] . "/private/header.php"; ?>
-<div class="container">
- <h2>Rechercher par ville de naissance</h2>
- <p id="preview">Patientez...</p>
- <script src="/dllib/jquery.flexdatalist.min.js"></script>
- <div class="input-group mt-3 mb-3">
- <div class="input-group-prepend">
- <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
- Par ville
- </button>
- <div class="dropdown-menu">
- <a class="dropdown-item" href="/search/name">Par prénom</a>
- <a class="dropdown-item" href="/search/lastname">Par nom</a>
- <a class="dropdown-item" href="/search/birth">Par date de naissance</a>
- <a class="dropdown-item" href="/search/death">Par date de décès</a>
- <a class="dropdown-item" href="/search/marriage">Par date de mariage</a>
- <a class="dropdown-item active" href="/search/city">Par ville</a>
- <a class="dropdown-item" href="/search/dept">Par département</a>
- <a class="dropdown-item" href="/search/state">Par région</a>
- </div>
- </div>
- <input onchange="reload();" class="form-control" type="text"
- placeholder="Commencer à taper une ville..."
- id="search">
- </div>
- <script>
- setInterval(() => {
- if (document.getElementById("search").value.trim() !== "") {
- document.getElementById("preview").innerText = "Affiche toutes les personnes nées à " + document.getElementById("search").value;
- } else {
- document.getElementById("preview").innerText = "Sélectionnez une ville";
- }
- }, 100)
-
- function reload() {
- window.fetch("./results/?q=" + encodeURI(document.getElementById("search").value.trim())).then((a) => {
- a.text().then((b) => {
- document.getElementById("results").innerHTML = b;
- })
- })
- }
-
- window.addEventListener("load", () => {
- i = Math.random().toString().substr(2);
- document.getElementById('search').classList.add(i);
- $('#search.' + i).flexdatalist({
- cache: false,
- minLength: 0,
- selectionRequired: true,
- visibleProperties: ["name","occurrences"],
- searchIn: 'name',
- data: "data.json"
- });
- })
- </script>
- <style>
- .flexdatalist-results li {
- cursor: pointer;
- }
- .flexdatalist-results li .item-occurrences {
- color: rgba(0, 0, 0, .25);
- }
- .flexdatalist-results li:hover {
- opacity: .75;
- }
- .flexdatalist-results li:active {
- opacity: .5;
- }
- </style>
- <div id="results"></div>
-</div>
-<br>
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/private/footer.php"; ?>
\ No newline at end of file diff --git a/app/genealogy/search/city/results/index.php b/app/genealogy/search/city/results/index.php deleted file mode 100644 index cbc0e66..0000000 --- a/app/genealogy/search/city/results/index.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/../session.php";
-
-/** @var string $_FULLNAME
- * @var string $_USER
- * @var array $_PROFILE
- * @var array $_CONFIG
- */
-
-$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/data/people.json"), true);
-
-if (isset($_GET['q']) && trim($_GET['q']) !== "") {
- $q = $_GET['q'];
-} else {
- die();
-}
-
-$results = [];
-
-foreach ($data as $id => $person) {
- if (isset($person["birth"]["place"]) && isset($person["birth"]["place"]["city"])) {
- if ($person["birth"]["place"]["city"] === $q) {
- $results[] = $id;
- }
- }
-}
-if (count($results) === 0): ?>
-<ul class="list-group">
- <li class="list-group-item">Aucun résultat correspondant</li>
-</ul>
-<?php else: ?>
-<div class="list-group">
- <?php foreach ($results as $result): $p = $data[$result]; ?>
- <a href="/person/?_=<?= $result ?>" class="list-group-item list-group-item-action"><?= $p["famname"] ?> <?= $p["surname"] ?> <span class="text-muted">#<?= $result ?></span></a>
- <?php endforeach; ?>
-</div>
-<?php endif; ?>
\ No newline at end of file |