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