xref: /webtrees/resources/views/individual-page-menu.phtml (revision 5229eade2a8cdd1381e19f96f67fc1c8b92ca95d)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Http\RequestHandlers\ReorderMediaPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\ReorderNamesPage;
6use Fisharebest\Webtrees\Http\RequestHandlers\ReorderSpousesPage;
7use Fisharebest\Webtrees\I18N;
8
9?>
10
11<div class="dropdown wt-page-menu">
12    <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">
13        <?= view('icons/edit') ?>
14        <?= I18N::translate('edit') ?>
15    </button>
16
17    <div class="dropdown-menu dropdown-menu-right wt-page-menu-items" aria-labelledby="page-menu">
18        <a class="dropdown-item" href="<?= e(route('add-name', ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
19            <?= view('icons/add') ?>
20            <?= I18N::translate('Add a name') ?>
21        </a>
22
23        <?php if ($count_names > 1) : ?>
24            <a class="dropdown-item" href="<?= e(route(ReorderNamesPage::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>">
25                <?= view('icons/reorder') ?>
26                <?= I18N::translate('Re-order names') ?>
27            </a>
28        <?php else : ?>
29            <div class="dropdown-item disabled">
30                <?= view('icons/spacer') ?>
31                <?= I18N::translate('Re-order names') ?>
32            </div>
33        <?php endif ?>
34
35        <div class="dropdown-divider"></div>
36
37        <?php if ($count_sex === 0) : ?>
38            <a class="dropdown-item" href="<?= e(route('add-fact', ['fact' => 'SEX', 'tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
39                <?= view('icons/edit') ?>
40                <?= I18N::translate('Edit the gender') ?>
41            </a>
42        <?php endif ?>
43
44        <?php foreach ($individual->facts(['SEX']) as $fact) : ?>
45            <?php if ($fact->canEdit()) : ?>
46                <a class="dropdown-item" href="<?= e(route('edit-fact', ['xref' => $individual->xref(), 'fact_id' => $fact->id(), 'tree' => $individual->tree()->name()])) ?>">
47                    <?= view('icons/edit') ?>
48                    <?= I18N::translate('Edit the gender') ?>
49                </a>
50            <?php endif ?>
51        <?php endforeach ?>
52
53        <div class="dropdown-divider"></div>
54
55        <?php if ($individual->spouseFamilies()->count() > 1) : ?>
56            <a class="dropdown-item" href="<?= e(route(ReorderSpousesPage::class, ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
57                <?= view('icons/reorder') ?>
58                <?= I18N::translate('Re-order families') ?>
59            </a>
60        <?php else : ?>
61            <div class="dropdown-item disabled">
62                <?= view('icons/spacer') ?>
63                <?= I18N::translate('Re-order families') ?>
64            </div>
65        <?php endif ?>
66
67        <div class="dropdown-divider"></div>
68
69        <a class="dropdown-item" href="<?= e(route('add-fact', ['tree' => $individual->tree()->name(), 'xref' => $individual->xref(), 'fact' => 'OBJE'])) ?>">
70            <?= view('icons/add') ?>
71            <?= I18N::translate('Add a media object') ?>
72        </a>
73
74        <?php if ($individual->facts(['OBJE'])->count() > 1) : ?>
75            <a class="dropdown-item" href="<?= e(route(ReorderMediaPage::class, ['tree' => $tree->name(), 'xref' => $individual->xref()])) ?>">
76                <?= view('icons/reorder') ?>
77                <?= I18N::translate('Re-order media') ?>
78            </a>
79        <?php else : ?>
80            <div class="dropdown-item disabled">
81                <?= view('icons/spacer') ?>
82                <?= I18N::translate('Re-order media') ?>
83            </div>
84        <?php endif ?>
85
86        <div class="dropdown-divider"></div>
87
88        <a class="dropdown-item" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', strip_tags($individual->fullName())) ?>" data-post-url="<?= e(route('delete-record', ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
89            <?= view('icons/delete') ?>
90            <?= I18N::translate('Delete') ?>
91        </a>
92
93        <?php if (Auth::isAdmin() || $individual->tree()->getPreference('SHOW_GEDCOM_RECORD')) : ?>
94            <a class="dropdown-item" href="<?= e(route('edit-raw-record', ['tree' => $individual->tree()->name(), 'xref' => $individual->xref()])) ?>">
95                <?= view('icons/edit') ?>
96                <?= I18N::translate('Edit the raw GEDCOM') ?>
97            </a>
98        <?php endif ?>
99    </div>
100</div>
101