xref: /webtrees/resources/views/individual-page-menu.phtml (revision 0b4092ed8e31e3588eb143d0ade6c4a411367da8)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\I18N; ?>
3
4<div class="dropdown wt-page-menu">
5    <button class="btn btn-primary dropdown-toggle wt-page-menu-button" type="button" id="page-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
6        <?= view('icons/edit') ?>
7        <?= I18N::translate('edit') ?>
8    </button>
9
10    <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
11        <a class="dropdown-item" href="<?= e(route('add-name', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
12            <?= view('icons/add') ?>
13            <?= I18N::translate('Add a name') ?>
14        </a>
15
16        <?php if ($count_names > 1) : ?>
17            <a class="dropdown-item" href="<?= e(route('reorder-names', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
18                <?= view('icons/reorder') ?>
19                <?= I18N::translate('Re-order names') ?>
20            </a>
21        <?php else : ?>
22            <div class="dropdown-item disabled">
23                <?= view('icons/spacer') ?>
24                <?= I18N::translate('Re-order names') ?>
25            </div>
26        <?php endif ?>
27
28        <div class="dropdown-divider"></div>
29
30        <?php if ($count_sex === 0) : ?>
31            <a class="dropdown-item" href="<?= e(route('add-fact', ['fact' => 'SEX', 'ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
32                <?= view('icons/edit') ?>
33                <?= I18N::translate('Edit the gender') ?>
34            </a>
35        <?php endif ?>
36
37        <?php foreach ($individual->facts(['SEX']) as $fact) : ?>
38            <?php if ($fact->canEdit()) : ?>
39                <a class="dropdown-item" href="<?= e(route('edit-fact', ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'ged' => $individual->tree()->name()])) ?>">
40                    <?= view('icons/edit') ?>
41                    <?= I18N::translate('Edit the gender') ?>
42                </a>
43            <?php endif ?>
44        <?php endforeach ?>
45
46        <div class="dropdown-divider"></div>
47
48        <a class="dropdown-item" href="<?= e(route('add-fact', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>">
49            <?= view('icons/add') ?>
50            <?= I18N::translate('Add a media object') ?>
51        </a>
52
53        <?php if ($individual->facts(['OBJE'])->count() > 1) : ?>
54            <a class="dropdown-item" href="<?= e(route('reorder-media', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
55                <?= view('icons/edit') ?>
56                <?= I18N::translate('Re-order media') ?>
57            </a>
58        <?php else : ?>
59            <div class="dropdown-item disabled">
60                <?= view('icons/spacer') ?>
61                <?= I18N::translate('Re-order media') ?>
62            </div>
63        <?php endif ?>
64
65        <div class="dropdown-divider"></div>
66
67        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->fullName())) ?>" onclick="return confirm(this.dataset.confirm) && delete_record('<?= e($individual->xref()) ?>', '<?= e($individual->tree()->name()) ?>');">
68            <?= view('icons/delete') ?>
69            <?= I18N::translate('Delete') ?>
70        </a>
71
72        <?php if (Auth::isAdmin() || $individual->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
73            <a class="dropdown-item" href="<?= e(route('edit-raw-record', ['ged' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
74                <?= view('icons/edit') ?>
75                <?= I18N::translate('Edit the raw GEDCOM') ?>
76            </a>
77        <?php endif ?>
78    </div>
79</div>
80