xref: /webtrees/resources/views/family-page.phtml (revision 8fb9b7894ed4c3ae1e97765be9b3bf91e81d7092)
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            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
81                <tr>
82                    <th scope="row">
83                        <?= I18N::translate('Media object') ?>
84                    </th>
85                    <td>
86                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
87                            <?= I18N::translate('Add a media object') ?>
88                        </a>
89                    </td>
90                </tr>
91            <?php endif ?>
92
93            <tr>
94                <th scope="row">
95                    <?= I18N::translate('Source') ?>
96                </th>
97                <td>
98                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
99                        <?= I18N::translate('Add a source citation') ?>
100                    </a>
101                </td>
102            </tr>
103        <?php endif ?>
104    </table>
105</div>
106
107<?= view('modals/ajax') ?>
108