xref: /webtrees/resources/views/edit/edit-record.phtml (revision e6747449f8e9bc991dc3b20abe694161c7f5d9e6)
1<?php
2
3use Fisharebest\Webtrees\GedcomRecord;
4use Fisharebest\Webtrees\Http\RequestHandlers\EditRawRecordPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\EditRecordAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Tree;
8
9/**
10 * @var bool         $can_edit_raw
11 * @var string       $gedcom
12 * @var bool         $has_chan
13 * @var string       $hidden_url
14 * @var GedcomRecord $record
15 * @var string       $title
16 * @var Tree         $tree
17 */
18
19?>
20
21<h2 class="wt-page-title"><?= $title ?></h2>
22
23<form method="post" action="<?= e(route(EditRecordAction::class, ['tree' => $tree->name(), 'xref' => $record->xref()])) ?>" class="wt-page-content">
24    <?= csrf_field() ?>
25
26    <?= view('edit/edit-gedcom-fields', ['gedcom' => $gedcom, 'hierarchy' => [$record->tag()], 'tree' => $tree, 'prefix' => '']) ?>
27
28    <div class="row form-group 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="form-group">
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</form>
64
65<?= view('modals/on-screen-keyboard') ?>
66<?= view('modals/ajax') ?>
67<?= view('edit/initialize-calendar-popup') ?>
68