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