xref: /webtrees/resources/views/edit/edit-fact.phtml (revision 1821c9e596679be8717c51394b448df204b1f577)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Fact;
6use Fisharebest\Webtrees\Http\RequestHandlers\EditFactAction;
7use Fisharebest\Webtrees\Http\RequestHandlers\EditRawFactPage;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\Tree;
10
11/**
12 * @var bool   $can_edit_raw
13 * @var Fact   $fact
14 * @var string $gedcom
15 * @var string $hidden_url
16 * @var string $title
17 * @var Tree   $tree
18 * @var string $url
19 */
20
21?>
22
23<h2 class="wt-page-title"><?= $title ?></h2>
24
25<form method="post" action="<?= e(route(EditFactAction::class, ['tree' => $tree->name(), 'xref' => $fact->record()->xref(), 'fact_id' => $fact->id()])) ?>" class="wt-page-content">
26    <input type="hidden" name="url" value="<?= e($url) ?>">
27
28    <?= view('edit/edit-gedcom-fields', ['gedcom' => $gedcom, 'hierarchy' => explode(':', $fact->tag()), 'tree' => $fact->record()->tree(), 'prefix' => '']) ?>
29
30    <div class="row mb-3">
31        <div class="col-sm-3 wt-page-options-label">
32        </div>
33        <div class="col-sm-9 wt-page-options-value">
34            <div class="mb-3">
35                <?= view('components/checkbox', ['label' => I18N::translate('Keep the existing “last change” information'), 'name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?>
36            </div>
37
38            <button class="btn btn-primary" type="submit">
39                <?= view('icons/save') ?>
40                <?= /* I18N: A button label. */
41                I18N::translate('save') ?>
42            </button>
43
44            <a class="btn btn-secondary" href="<?= e($url) ?>">
45                <?= view('icons/cancel') ?>
46                <?= /* I18N: A button label. */
47                I18N::translate('cancel') ?>
48            </a>
49
50            <?php if ($hidden_url !== '') : ?>
51                <a class="btn btn-link" href="<?= e($hidden_url) ?>">
52                    <?= I18N::translate('Edit with all GEDCOM tags') ?>
53                </a>
54            <?php endif; ?>
55
56            <?php if ($can_edit_raw) : ?>
57                <a class="btn btn-link" href="<?= e(route(EditRawFactPage::class, ['xref' => $fact->record()->xref(), 'fact_id' => $fact->id(), 'tree' => $tree->name(), 'url' => $url])) ?>">
58                    <?= I18N::translate('Edit the raw GEDCOM') ?>
59                </a>
60            <?php endif; ?>
61        </div>
62    </div>
63
64    <?= csrf_field() ?>
65</form>
66
67<?= view('modals/on-screen-keyboard') ?>
68<?= view('modals/ajax') ?>
69<?= view('edit/initialize-calendar-popup') ?>
70