xref: /webtrees/resources/views/modules/family_nav/sidebar-family.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
1<?php
2
3use Fisharebest\Webtrees\Functions\Functions;
4
5?>
6<?php use Fisharebest\Webtrees\I18N; ?>
7
8<table class="table table-sm wt-facts-table wt-family-navigator-family">
9    <caption class="text-center wt-family-navigator-family-heading">
10        <a href="<?= e($family->url()) ?>">
11            <?= $title ?>
12        </a>
13    </caption>
14    <tbody>
15        <?php foreach ($family->spouses() as $spouse) : ?>
16            <tr class="text-center wt-family-navigator-parent wt-gender-<?= $spouse->sex() ?>">
17                <th class="align-middle wt-family-navigator-label" scope="row">
18                    <?php if ($spouse === $individual) : ?>
19                        <?= Functions::getCloseRelationshipName($individual, $spouse) ?>
20                        <i class="icon-selected"></i>
21                    <?php elseif ($spouse->childFamilies()->first() !== null) : ?>
22                    <div class="dropdown">
23                        <a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($spouse->xref()) ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
24                            <?= Functions::getCloseRelationshipName($individual, $spouse) ?>
25                        </a>
26
27                        <div class="dropdown-menu wt-family-navigator-dropdown">
28                            <div class="dropdown-header wt-family-navigator-dropdown-heading">
29                                <?= I18N::translate('Parents') ?>
30                            </div>
31                            <?php foreach ($spouse->childFamilies()->first()->spouses() as $parent) : ?>
32                                <a class="dropdown-item" href="<?= e($parent->url()) ?>">
33                                    <?= $parent->fullName() ?>
34                                </a>
35                            <?php endforeach ?>
36                        </div>
37                    </div>
38                    <?php else : ?>
39                        <?= Functions::getCloseRelationshipName($individual, $spouse) ?>
40                    <?php endif ?>
41                </th>
42
43                <td class="wt-family-navigator-name">
44                    <?php if ($spouse->canShow()) : ?>
45                        <a href="<?= e($spouse->url()) ?>">
46                            <?= $spouse->fullName() ?>
47                        </a>
48                        <div class="small">
49                            <?= $spouse->lifespan() ?>
50                        </div>
51                    <?php else : ?>
52                        <?= $spouse->fullName() ?>
53                    <?php endif ?>
54                </td>
55            </tr>
56        <?php endforeach ?>
57
58        <?php foreach ($family->children() as $child) : ?>
59            <tr class="text-center wt-family-navigator-child wt-gender-<?= $child->sex() ?>">
60                <th class="align-middle wt-family-navigator-label" scope="row">
61                    <?php if ($child === $individual) : ?>
62                        <?= Functions::getCloseRelationshipName($individual, $child) ?>
63                        <i class="icon-selected"></i>
64                    <?php elseif ($child->spouseFamilies()->isNotEmpty()) : ?>
65                        <div class="dropdown">
66                            <a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($child->xref()) ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
67                                <?= Functions::getCloseRelationshipName($individual, $child) ?>
68                            </a>
69
70                            <div class="dropdown-menu">
71                                <?php foreach ($child->spouseFamilies() as $n => $in_laws) : ?>
72                                    <?php if ($n > 0) : ?>
73                                        <div class="dropdown-divider"></div>
74                                    <?php endif ?>
75                                    <div class="dropdown-header wt-family-navigator-dropdown-heading">
76                                        <?= I18N::translate('Family') ?>
77                                    </div>
78
79                                    <?php foreach ($in_laws->spouses() as $sibling_in_law) : ?>
80                                        <?php if ($sibling_in_law !== $child) : ?>
81                                            <a class="dropdown-item" href="<?= e($sibling_in_law->url()) ?>">
82                                                <?= $sibling_in_law->fullName() ?>
83                                            </a>
84                                        <?php endif ?>
85                                    <?php endforeach ?>
86
87                                <ul>
88                                    <?php foreach ($in_laws->children() as $child_in_law) : ?>
89                                    <li>
90                                        <a class="dropdown-item" href="<?= e($child_in_law->url()) ?>">
91                                            <?= $child_in_law->fullName() ?>
92                                        </a>
93                                    </li>
94                                    <?php endforeach ?>
95                                </ul>
96                                <?php endforeach ?>
97                            </div>
98                        </div>
99                    <?php else : ?>
100                        <?= Functions::getCloseRelationshipName($individual, $child) ?>
101                    <?php endif ?>
102                </th>
103
104                <td>
105                    <?php if ($child->canShow()) : ?>
106                        <a  href="<?= e($child->url()) ?>">
107                            <?= $child->fullName() ?>
108                        </a>
109                        <div class="small">
110                            <?= $child->lifespan() ?>
111                        </div>
112                    <?php else : ?>
113                        <?= $child->fullName() ?>
114                    <?php endif ?>
115                </td>
116            </tr>
117        <?php endforeach ?>
118    </tbody>
119</table>
120