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