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