xref: /webtrees/resources/views/family-page.phtml (revision c344974e96e2ea1576815a443b99a00ffc322086)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Family;
5use Fisharebest\Webtrees\Functions\FunctionsPrint;
6use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
7use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
8use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
9use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
10use Fisharebest\Webtrees\I18N;
11use Fisharebest\Webtrees\View;
12
13?>
14
15<?php if ($record->isPendingDeletion()) : ?>
16    <?php if (Auth::isModerator($record->tree())) : ?>
17        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This family has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
18    <?php elseif (Auth::isEditor($record->tree())) : ?>
19        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
20    <?php endif ?>
21<?php elseif ($record->isPendingAddition()) : ?>
22    <?php if (Auth::isModerator($record->tree())) : ?>
23        <?= view('components/alert-warning-dismissible', ['alert' => /* I18N: %1$s is “accept”, %2$s is “reject”. These are links. */ I18N::translate('This family has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesAcceptRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" data-post-url="' . e(route(PendingChangesRejectRecord::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) . '">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
24    <?php elseif (Auth::isEditor($record->tree())) : ?>
25        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been edited. The changes need to be reviewed by a moderator.') . ' ' . view('help/link', ['topic' => 'pending_changes'])]) ?>
26    <?php endif ?>
27<?php endif ?>
28
29<div class="d-flex mb-4">
30    <h2 class="wt-page-title mx-auto">
31        <?= $record->fullName() ?>
32    </h2>
33    <?php if ($record->canEdit()) : ?>
34        <?= view('family-page-menu', ['record' => $record]) ?>
35    <?php endif ?>
36</div>
37
38<div class="wt-page-content">
39    <div class="wt-family-members d-flex">
40        <?= view('family-page-children', ['family' => $record]) ?>
41        <?= view('family-page-parents', ['family' => $record]) ?>
42    </div>
43
44    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
45    <table class="table wt-facts-table">
46        <?php if ($facts->isEmpty()) : ?>
47            <tr>
48                <td colspan="2">
49                    <?= I18N::translate('No facts exist for this family.') ?>
50                </td>
51            </tr>
52        <?php else : ?>
53            <?php foreach ($facts as $fact) : ?>
54                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
55            <?php endforeach ?>
56        <?php endif ?>
57
58        <?php if (Auth::isEditor($record->tree())) : ?>
59            <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?>
60
61            <?php FunctionsPrint::printAddNewFact($record, $facts, Family::RECORD_TYPE) ?>
62            <tr>
63                <th scope="row">
64                    <?= I18N::translate('Note') ?>
65                </th>
66                <td>
67                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
68                        <?= I18N::translate('Add a note') ?>
69                    </a>
70                </td>
71            </tr>
72
73            <tr>
74                <th scope="row">
75                    <?= I18N::translate('Shared note') ?>
76                </th>
77                <td>
78                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
79                        <?= I18N::translate('Add a shared note') ?>
80                    </a>
81                </td>
82            </tr>
83
84            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
85                <tr>
86                    <th scope="row">
87                        <?= I18N::translate('Media object') ?>
88                    </th>
89                    <td>
90                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
91                            <?= I18N::translate('Add a media object') ?>
92                        </a>
93                    </td>
94                </tr>
95            <?php endif ?>
96
97            <tr>
98                <th scope="row">
99                    <?= I18N::translate('Source') ?>
100                </th>
101                <td>
102                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
103                        <?= I18N::translate('Add a source citation') ?>
104                    </a>
105                </td>
106            </tr>
107        <?php endif ?>
108    </table>
109</div>
110
111<?= view('modals/ajax') ?>
112