xref: /webtrees/resources/views/family-page.phtml (revision 36de22acf6348b1059dac63e3cd19589574906ac)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Fact;
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\Functions\FunctionsPrint;
7use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
8use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
9use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
10use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
11use Fisharebest\Webtrees\I18N;
12use Illuminate\Support\Collection;
13
14/**
15 * @var Collection<Fact> $clipboard_facts
16 * @var Collection<Fact> $facts
17 * @var Family           $record
18 */
19
20?>
21
22<?php if ($record->isPendingDeletion()) : ?>
23    <?php if (Auth::isModerator($record->tree())) : ?>
24        <?= 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'])]) ?>
25    <?php elseif (Auth::isEditor($record->tree())) : ?>
26        <?= 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'])]) ?>
27    <?php endif ?>
28<?php elseif ($record->isPendingAddition()) : ?>
29    <?php if (Auth::isModerator($record->tree())) : ?>
30        <?= 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'])]) ?>
31    <?php elseif (Auth::isEditor($record->tree())) : ?>
32        <?= 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'])]) ?>
33    <?php endif ?>
34<?php endif ?>
35
36<div class="d-flex mb-4">
37    <h2 class="wt-page-title mx-auto">
38        <?= $record->fullName() ?>
39    </h2>
40    <?php if ($record->canEdit()) : ?>
41        <?= view('family-page-menu', ['record' => $record]) ?>
42    <?php endif ?>
43</div>
44
45<div class="wt-page-content">
46    <div class="wt-family-members d-flex">
47        <?= view('family-page-children', ['family' => $record]) ?>
48        <?= view('family-page-parents', ['family' => $record]) ?>
49    </div>
50
51    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
52    <table class="table wt-facts-table">
53        <?php if ($facts->isEmpty()) : ?>
54            <tr>
55                <td colspan="2">
56                    <?= I18N::translate('No facts exist for this family.') ?>
57                </td>
58            </tr>
59        <?php else : ?>
60            <?php foreach ($facts as $fact) : ?>
61                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
62            <?php endforeach ?>
63        <?php endif ?>
64
65        <?php if (Auth::isEditor($record->tree())) : ?>
66            <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?>
67
68            <?php FunctionsPrint::printAddNewFact($record, $facts, Family::RECORD_TYPE) ?>
69            <tr>
70                <th scope="row">
71                    <?= I18N::translate('Note') ?>
72                </th>
73                <td>
74                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
75                        <?= I18N::translate('Add a note') ?>
76                    </a>
77                </td>
78            </tr>
79
80            <tr>
81                <th scope="row">
82                    <?= I18N::translate('Shared note') ?>
83                </th>
84                <td>
85                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
86                        <?= I18N::translate('Add a shared note') ?>
87                    </a>
88                </td>
89            </tr>
90
91            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
92                <tr>
93                    <th scope="row">
94                        <?= I18N::translate('Media object') ?>
95                    </th>
96                    <td>
97                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
98                            <?= I18N::translate('Add a media object') ?>
99                        </a>
100                    </td>
101                </tr>
102            <?php endif ?>
103
104            <tr>
105                <th scope="row">
106                    <?= I18N::translate('Source') ?>
107                </th>
108                <td>
109                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
110                        <?= I18N::translate('Add a source citation') ?>
111                    </a>
112                </td>
113            </tr>
114        <?php endif ?>
115    </table>
116</div>
117
118<?= view('modals/ajax') ?>
119