xref: /webtrees/resources/views/fact-place.phtml (revision d35568b467207589ea9059739da0bf1f7e785a0d)
1b315f3e1SGreg Roach<?php
2b315f3e1SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
5b315f3e1SGreg Roachuse Fisharebest\Webtrees\Date;
6b315f3e1SGreg Roachuse Fisharebest\Webtrees\Fact;
7b315f3e1SGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
8b315f3e1SGreg Roachuse Fisharebest\Webtrees\I18N;
9b315f3e1SGreg Roachuse Fisharebest\Webtrees\Module\ModuleMapLinkInterface;
10b315f3e1SGreg Roachuse Fisharebest\Webtrees\Place;
11b315f3e1SGreg Roachuse Fisharebest\Webtrees\Registry;
12b315f3e1SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
13b315f3e1SGreg Roach
14b315f3e1SGreg Roach/**
15b315f3e1SGreg Roach * @var bool         $cal_link
16b315f3e1SGreg Roach * @var Fact         $fact
17b315f3e1SGreg Roach * @var GedcomRecord $record
18b315f3e1SGreg Roach * @var bool         $time
19b315f3e1SGreg Roach */
20b315f3e1SGreg Roach
21b315f3e1SGreg Roach?>
22b315f3e1SGreg Roach<div class="wt-fact-place">
23b315f3e1SGreg Roach    <?php if (preg_match('/\n(2 PLAC.*(?:\n[3-9].*)*)/', $fact->gedcom(), $match) === 1) : ?>
24b315f3e1SGreg Roach        <?php $placerec = $match[1]; ?>
25b315f3e1SGreg Roach        <?= $fact->place()->fullName($fact->id() !== 'histo') ?>
26b315f3e1SGreg Roach
27bd29d468SGreg Roach        <?php if (preg_match_all('/\n3 (?:_HEB|ROMN|FONE) (.+)/', $placerec, $matches) === 1) : ?>
28b315f3e1SGreg Roach            <?php foreach ($matches[1] as $match) : ?>
29b315f3e1SGreg Roach<?= (new Place($match, $record->tree()))->fullName() ?>
30b315f3e1SGreg Roach            <?php endforeach ?>
31b315f3e1SGreg Roach        <?php endif ?>
32b315f3e1SGreg Roach
33b315f3e1SGreg Roach        <?php if ($fact->latitude() !== null && $fact->longitude() !== null) : ?>
34b315f3e1SGreg Roach            <div class="wt-fact-coordinates">
35b315f3e1SGreg Roach                <span class="label"><?= I18N::translate('Latitude') ?>: </span><?= $fact->latitude() ?>
36b315f3e1SGreg Roach                <span class="label"><?= I18N::translate('Longitude') ?>: </span><?= $fact->longitude()?>
37*d35568b4SGreg Roach                <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleMapLinkInterface::class)->map(fn (ModuleMapLinkInterface $module): string => ' ' . $module->mapLink($fact))->implode('') ?>
38b315f3e1SGreg Roach            </div>
39b315f3e1SGreg Roach        <?php endif ?>
40b315f3e1SGreg Roach
41b315f3e1SGreg Roach        <?php if (preg_match_all('/\n(3 NOTE\b.*(?:\n[^3].*)*)/', $placerec, $matches, PREG_SET_ORDER) > 0) : ?>
42b315f3e1SGreg Roach            <?php foreach ($matches as $match) : ?>
43b315f3e1SGreg Roach                <?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag() . ':PLAC:NOTE', 'tree' => $record->tree()]) ?>
44b315f3e1SGreg Roach            <?php endforeach ?>
45b315f3e1SGreg Roach        <?php endif ?>
46b315f3e1SGreg Roach    <?php endif ?>
47b315f3e1SGreg Roach
48b315f3e1SGreg Roach    <?php if (preg_match('/2 TEMP (.+)/', $fact->gedcom(), $match)) : ?>
49b315f3e1SGreg Roach        <?= Registry::elementFactory()->make($fact->tag() . ':TEMP')->labelValue($match[1], $record->tree()) ?>
50b315f3e1SGreg Roach    <?php endif ?>
51b315f3e1SGreg Roach
52b315f3e1SGreg Roach    <?php if (preg_match('/2 STAT (.+)/', $fact->gedcom(), $match)) : ?>
53b315f3e1SGreg Roach        <?= Registry::elementFactory()->make($fact->tag() . ':STAT')->labelValue($match[1], $record->tree()) ?>
54b315f3e1SGreg Roach
55b315f3e1SGreg Roach        <?php if (preg_match('/3 DATE (.+)/', $fact->gedcom(), $match)) : ?>
56b315f3e1SGreg Roach            <?= Registry::elementFactory()->make($fact->tag() . ':STAT:DATE')->labelValue((new Date($match[1]))->display(), $record->tree()) ?>
57b315f3e1SGreg Roach        <?php endif ?>
58b315f3e1SGreg Roach    <?php endif ?>
59b315f3e1SGreg Roach</div>
60