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