xref: /webtrees/resources/views/family-page.phtml (revision 77a2010793e07b8d01d1a336fa5967181694729d)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\Functions\FunctionsCharts; ?>
3<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
4<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?>
5<?php use Fisharebest\Webtrees\I18N; ?>
6<?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?>
7
8<?php if ($record->isPendingDeletion()) : ?>
9    <?php if (Auth::isModerator($record->tree())) : ?>
10        <?= 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')]) ?>
11    <?php elseif (Auth::isEditor($record->tree())) : ?>
12        <?= 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')]) ?>
13    <?php endif ?>
14<?php elseif ($record->isPendingAddition()) : ?>
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 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')]) ?>
17    <?php elseif (Auth::isEditor($record->tree())) : ?>
18        <?= 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')]) ?>
19    <?php endif ?>
20<?php endif ?>
21
22<div class="d-flex mb-4">
23    <h2 class="wt-page-title mx-auto">
24        <?= $record->getFullName() ?>
25    </h2>
26    <?php if ($record->canEdit() && !$record->isPendingDeletion()) : ?>
27        <?= view('family-page-menu', ['record' => $record]) ?>
28    <?php endif ?>
29</div>
30
31<div class="wt-page-content">
32    <table id="family-table" class="w-100" role="presentation">
33        <tr style="vertical-align:top;">
34            <td style="width: <?= app()->make(ModuleThemeInterface::class)->parameter('chart-box-x') + 30 ?>px;">
35                <?php FunctionsCharts::printFamilyChildren($record) ?>
36            </td>
37            <td>
38                <table class="w-100" role="presentation">
39                    <tr>
40                        <td class="subheaders"><?= I18N::translate('Parents') ?></td>
41                        <td class="subheaders"><?= I18N::translate('Grandparents') ?></td>
42                    </tr>
43                    <tr>
44                        <td colspan="2">
45                            <?php FunctionsCharts::printFamilyParents($record) ?>
46                            <?php if (Auth::isEditor($record->tree())) : ?>
47                                <?php if ($record->getHusband() === null) : ?>
48                                    <a href="<?= e(route('add-spouse-to-family', ['ged=' => $record->tree()->name(), 'xref' => $record->xref(), 'famtag' => 'HUSB'])) ?>">
49                                        <?= I18N::translate('Add a father') ?>
50                                    </a>
51                                    <br>
52                                <?php endif ?>
53                                <?php if ($record->getWife() === null) : ?>
54                                    <a href="<?= e(route('add-spouse-to-family', ['ged=' => $record->tree()->name(), 'xref' => $record->xref(), 'famtag' => 'WIFE'])) ?>">
55                                        <?= I18N::translate('Add a mother') ?>
56                                    </a>
57                                    <br>
58                                <?php endif ?>
59                            <?php endif ?>
60                        </td>
61                    </tr>
62                </table>
63            </td>
64        </tr>
65    </table>
66    <span class="subheaders"><?= I18N::translate('Family group information') ?></span>
67    <table class="table wt-facts-table">
68        <?php if (empty($facts)) : ?>
69            <tr>
70                <td class="messagebox" colspan="2">
71                    <?= I18N::translate('No facts exist for this family.') ?>
72                </td>
73            </tr>
74        <?php else : ?>
75            <?php foreach ($facts as $fact) : ?>
76                <?php FunctionsPrintFacts::printFact($fact, $record) ?>
77            <?php endforeach ?>
78        <?php endif ?>
79
80        <?php if (Auth::isEditor($record->tree())) : ?>
81            <?php FunctionsPrint::printAddNewFact($record, $facts, 'FAM') ?>
82            <tr>
83                <th scope="row">
84                    <?= I18N::translate('Note') ?>
85                </th>
86                <td>
87                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'NOTE'])) ?>">
88                        <?= I18N::translate('Add a note') ?>
89                    </a>
90                </td>
91            </tr>
92
93            <tr>
94                <th scope="row">
95                    <?= I18N::translate('Shared note') ?>
96                </th>
97                <td class="optionbox">
98                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SHARED_NOTE'])) ?>">
99                        <?= I18N::translate('Add a shared note') ?>
100                    </a>
101                </td>
102            </tr>
103
104            <?php if ($record->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($record->tree())) : ?>
105                <tr>
106                    <th scope="row">
107                        <?= I18N::translate('Media object') ?>
108                    </th>
109                    <td class="optionbox">
110                        <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE']))  ?>">
111                            <?= I18N::translate('Add a media object') ?>
112                        </a>
113                    </td>
114                </tr>
115            <?php endif ?>
116
117            <tr>
118                <th scope="row">
119                    <?= I18N::translate('Source') ?>
120                </th>
121                <td>
122                    <a href="<?= e(route('add-fact', ['ged' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'SOUR'])) ?>">
123                        <?= I18N::translate('Add a source citation') ?>
124                    </a>
125                </td>
126            </tr>
127        <?php endif ?>
128    </table>
129</div>
130
131<?= view('modals/ajax') ?>
132