xref: /webtrees/resources/views/edit/edit-record.phtml (revision 1ff45046fabc22237b5d0d8e489c96f031fc598d)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\GedcomRecord;
6use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordAction;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\Tree;
10
11/**
12 * @var bool         $can_edit_raw
13 * @var string       $gedcom
14 * @var bool         $has_chan
15 * @var string       $hidden_url
16 * @var GedcomRecord $record
17 * @var string       $title
18 * @var Tree         $tree
19 */
20
21?>
22
23<h2 class="wt-page-title"><?= $title ?></h2>
24
25<form method="post" action="<?= e(route(EditRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
26    <?= view('edit/edit-gedcom-fields', ['gedcom' => $gedcom, 'hierarchy' => [$record->tag()], 'tree' => $tree, 'prefix' => '']) ?>
27
28    <div class="row mb-3">
29        <div class="col-sm-3 wt-page-options-label">
30        </div>
31        <div class="col-sm-9 wt-page-options-value">
32            <?php if ($has_chan) : ?>
33                <div class="mb-3">
34                    <?= view('components/checkbox', ['label' => I18N::translate('Keep the existing “last change” information'), 'name' => 'keep_chan', 'checked' => (bool) $tree->getPreference('NO_UPDATE_CHAN')]) ?>
35                </div>
36            <?php endif ?>
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($record->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(EditRawRecordPage::class, ['xref' => $record->xref(), 'tree' => $tree->name()])) ?>">
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