diff options
author | Minteck <contact@minteck.org> | 2022-01-12 18:58:54 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-01-12 18:58:54 +0100 |
commit | d0982c5250d2e33c824ddccb8bd245ca39faa724 (patch) | |
tree | 0b1fac648c4214c29f22629555ada2f3a2dcdb5d /search/marriage/results/index.php | |
parent | 6dc0f517f78af1ff3f7d9fd763873194517ff4fd (diff) | |
download | genealogy-d0982c5250d2e33c824ddccb8bd245ca39faa724.tar.gz genealogy-d0982c5250d2e33c824ddccb8bd245ca39faa724.tar.bz2 genealogy-d0982c5250d2e33c824ddccb8bd245ca39faa724.zip |
Upadte
Diffstat (limited to 'search/marriage/results/index.php')
-rw-r--r-- | search/marriage/results/index.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/search/marriage/results/index.php b/search/marriage/results/index.php new file mode 100644 index 0000000..172a124 --- /dev/null +++ b/search/marriage/results/index.php @@ -0,0 +1,38 @@ +<?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["family"]) && isset($person["family"]["marriage"]["date"]) && isset($person["family"]["marriage"]["date"]["year"])) { + if ((string)$person["family"]["marriage"]["date"]["year"] === $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 |