xref: /webtrees/resources/views/family-page.phtml (revision 1f1ffa65b3b51df2b95b5c68894525436855964a)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Functions\FunctionsCharts;
5use Fisharebest\Webtrees\Functions\FunctionsPrint;
6use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Module\ModuleThemeInterface;
9use Fisharebest\Webtrees\View;
10
11?>
12
13<?php if ($record->isPendingDeletion()) : ?>
14    <?php if (Auth::isModerator($record->tree())) : ?>
15        <?= 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" onclick="accept_changes(\'' . e($record->xref()) . '\', \'' . e($record->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($record->xref()) . '\', \'' . e($record->tree()->name()) . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
16    <?php elseif (Auth::isEditor($record->tree())) : ?>
17        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been deleted. The deletion will need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
18    <?php endif ?>
19<?php elseif ($record->isPendingAddition()) : ?>
20    <?php if (Auth::isModerator($record->tree())) : ?>
21        <?= 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" onclick="accept_changes(\'' . e($record->xref()) . '\', \'' . e($record->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" class="alert-link" onclick="reject_changes(\'' . e($record->xref()) . '\', \'' . e($record->tree()->name()) . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
22    <?php elseif (Auth::isEditor($record->tree())) : ?>
23        <?= view('components/alert-warning-dismissible', ['alert' => I18N::translate('This family has been edited. The changes need to be reviewed by a moderator.') . ' ' . FunctionsPrint::helpLink('pending_changes')]) ?>
24    <?php endif ?>
25<?php endif ?>
26
27<div class="d-flex mb-4">
28    <h2 class="wt-page-title mx-auto">
29        <?= $record->fullName() ?>
30    </h2>
31    <?php if ($record->canEdit()) : ?>
32        <?= view('family-page-menu', ['record' => $record]) ?>
33    <?php endif ?>
34</div>
35
36<?php View::push('styles') ?>
37<style>
38    .wt-family-members .wt-chart-box {
39        width: 22.5vw;
40    }
41</style>
42<?php View::endpush() ?>
43
44<div class="wt-page-content">
45    <div class="wt-family-members d-flex">
46        <?= view('family-page-children', ['family' => $record]) ?>
47        <?= view('family-page-parents', ['family' => $record]) ?>
48    </div>
49
50    <h3 class="mt-4"><?= I18N::translate('Facts and events') ?></h3>
51    <table class="table wt-facts-table">
52        <?php if ($facts->isEmpty()) : ?>
53            <tr>
54                <td class="messagebox" colspan="2">
55                    <?= I18N::translate('No facts exist for this family.') ?>
56                </td>
57            </tr>
58        <?php else : ?>
59            <?php foreach ($facts as $fact) : ?>
60                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
61            <?php endforeach ?>
62        <?php endif ?>
63
64        <?php if (Auth::isEditor($record->tree())) : ?>
65            <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?>
66
67            <?php FunctionsPrint::printAddNewFact($record, $facts, 'FAM') ?>
68            <tr>
69                <th scope="row">
70                    <?= I18N::translate('Note') ?>
71                </th>
72                <td>
73                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
74                        <?= I18N::translate('Add a note') ?>
75                    </a>
76                </td>
77            </tr>
78
79            <tr>
80                <th scope="row">
81                    <?= I18N::translate('Shared note') ?>
82                </th>
83                <td class="optionbox">
84                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
85                        <?= I18N::translate('Add a shared note') ?>
86                    </a>
87                </td>
88            </tr>
89
90            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
91                <tr>
92                    <th scope="row">
93                        <?= I18N::translate('Media object') ?>
94                    </th>
95                    <td class="optionbox">
96                        <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
97                            <?= I18N::translate('Add a media object') ?>
98                        </a>
99                    </td>
100                </tr>
101            <?php endif ?>
102
103            <tr>
104                <th scope="row">
105                    <?= I18N::translate('Source') ?>
106                </th>
107                <td>
108                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
109                        <?= I18N::translate('Add a source citation') ?>
110                    </a>
111                </td>
112            </tr>
113        <?php endif ?>
114    </table>
115</div>
116
117<?= view('modals/ajax') ?>
118