diff options
author | Minteck <contact@minteck.org> | 2021-12-05 16:38:49 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-05 16:38:49 +0100 |
commit | 879a6237b186768356f99caf992f0d25d5ec8612 (patch) | |
tree | 733aacd4845e918b484d8f46951d925f05f91b4c /app/genealogy/search/lastname/results/index.php | |
parent | 4bad8bcfb984cf017495b8fd31f174c32cebe805 (diff) | |
download | core-879a6237b186768356f99caf992f0d25d5ec8612.tar.gz core-879a6237b186768356f99caf992f0d25d5ec8612.tar.bz2 core-879a6237b186768356f99caf992f0d25d5ec8612.zip |
Commit
Diffstat (limited to 'app/genealogy/search/lastname/results/index.php')
-rw-r--r-- | app/genealogy/search/lastname/results/index.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/genealogy/search/lastname/results/index.php b/app/genealogy/search/lastname/results/index.php new file mode 100644 index 0000000..bfb80f7 --- /dev/null +++ b/app/genealogy/search/lastname/results/index.php @@ -0,0 +1,36 @@ +<?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 (ucfirst(strtolower($person["famname"])) === ucfirst(strtolower($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 |