xref: /webtrees/resources/views/family-page.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Functions\FunctionsPrint;
5use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
6use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
7use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord;
8use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord;
9use Fisharebest\Webtrees\I18N;
10use Fisharebest\Webtrees\View;
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<?php View::push('styles') ?>
38<style>
39    .wt-family-members .wt-chart-box {
40        width: 22.5vw;
41    }
42</style>
43<?php View::endpush() ?>
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 class="messagebox" 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, 'FAM') ?>
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 class="optionbox">
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 class="optionbox">
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