xref: /webtrees/resources/views/family-page.phtml (revision 02467d3222d9362e48b39bb9221b32134076ae9c)
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<?php View::push('styles') ?>
39<style>
40    .wt-family-members .wt-chart-box {
41        width: 22.5vw;
42    }
43</style>
44<?php View::endpush() ?>
45
46<div class="wt-page-content">
47    <div class="wt-family-members d-flex">
48        <?= view('family-page-children', ['family' => $record]) ?>
49        <?= view('family-page-parents', ['family' => $record]) ?>
50    </div>
51
52    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
53    <table class="table wt-facts-table">
54        <?php if ($facts->isEmpty()) : ?>
55            <tr>
56                <td colspan="2">
57                    <?= I18N::translate('No facts exist for this family.') ?>
58                </td>
59            </tr>
60        <?php else : ?>
61            <?php foreach ($facts as $fact) : ?>
62                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
63            <?php endforeach ?>
64        <?php endif ?>
65
66        <?php if (Auth::isEditor($record->tree())) : ?>
67            <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?>
68
69            <?php FunctionsPrint::printAddNewFact($record, $facts, Family::RECORD_TYPE) ?>
70            <tr>
71                <th scope="row">
72                    <?= I18N::translate('Note') ?>
73                </th>
74                <td>
75                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
76                        <?= I18N::translate('Add a note') ?>
77                    </a>
78                </td>
79            </tr>
80
81            <tr>
82                <th scope="row">
83                    <?= I18N::translate('Shared note') ?>
84                </th>
85                <td>
86                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
87                        <?= I18N::translate('Add a shared note') ?>
88                    </a>
89                </td>
90            </tr>
91
92            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
93                <tr>
94                    <th scope="row">
95                        <?= I18N::translate('Media object') ?>
96                    </th>
97                    <td>
98                        <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
99                            <?= I18N::translate('Add a media object') ?>
100                        </a>
101                    </td>
102                </tr>
103            <?php endif ?>
104
105            <tr>
106                <th scope="row">
107                    <?= I18N::translate('Source') ?>
108                </th>
109                <td>
110                    <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
111                        <?= I18N::translate('Add a source citation') ?>
112                    </a>
113                </td>
114            </tr>
115        <?php endif ?>
116    </table>
117</div>
118
119<?= view('modals/ajax') ?>
120