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