xref: /webtrees/resources/views/modules/family_nav/sidebar-family.phtml (revision 455ea186c69f201c925b6cf60187a65446830fc5)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
58b27c8beSGreg Roachuse Fisharebest\Webtrees\Family;
68b27c8beSGreg Roachuse Fisharebest\Webtrees\I18N;
78b27c8beSGreg Roachuse Fisharebest\Webtrees\Individual;
8d35568b4SGreg Roachuse Fisharebest\Webtrees\Registry;
96fcafd02SGreg Roachuse Fisharebest\Webtrees\Services\RelationshipService;
108b27c8beSGreg Roach
118b27c8beSGreg Roach/**
128b27c8beSGreg Roach * @var Individual $individual
138b27c8beSGreg Roach * @var Family     $family
148b27c8beSGreg Roach * @var string     $title
158b27c8beSGreg Roach */
16d70512abSGreg Roach
17d70512abSGreg Roach?>
18dd6b2bfcSGreg Roach
19dd6b2bfcSGreg Roach<table class="table table-sm wt-facts-table wt-family-navigator-family">
20dd6b2bfcSGreg Roach    <caption class="text-center wt-family-navigator-family-heading">
21*455ea186SGreg Roach        <?php if ($family->canShow()) : ?>
22dd6b2bfcSGreg Roach            <a href="<?= e($family->url()) ?>">
23dd6b2bfcSGreg Roach                <?= $title ?>
24dd6b2bfcSGreg Roach            </a>
25*455ea186SGreg Roach        <?php else : ?>
26*455ea186SGreg Roach            <?= $title ?>
27*455ea186SGreg Roach        <?php endif ?>
28dd6b2bfcSGreg Roach    </caption>
29dd6b2bfcSGreg Roach    <tbody>
3039ca88baSGreg Roach        <?php foreach ($family->spouses() as $spouse) : ?>
311baf69deSGreg Roach            <tr class="text-center wt-family-navigator-parent wt-sex-<?= strtolower($spouse->sex()) ?>">
32eb414fd9SGreg Roach                <th class="align-middle wt-family-navigator-label" scope="row">
33dd6b2bfcSGreg Roach                    <?php if ($spouse === $individual) : ?>
34d35568b4SGreg Roach                        <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $spouse) ?>
35dd6b2bfcSGreg Roach                        <i class="icon-selected"></i>
368b27c8beSGreg Roach                    <?php elseif ($spouse->childFamilies()->isNotEmpty()) : ?>
37dd6b2bfcSGreg Roach                    <div class="dropdown">
38315eb316SGreg Roach                        <a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($spouse->xref()) ?>" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
39d35568b4SGreg Roach                            <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $spouse) ?>
40dd6b2bfcSGreg Roach                        </a>
41dd6b2bfcSGreg Roach
42dd6b2bfcSGreg Roach                        <div class="dropdown-menu wt-family-navigator-dropdown">
438b27c8beSGreg Roach                            <?php foreach ($spouse->childFamilies() as $n => $spouse_child_family) : ?>
448b27c8beSGreg Roach                                <?php if ($n > 0) : ?>
458b27c8beSGreg Roach                                    <div class="dropdown-divider"></div>
468b27c8beSGreg Roach                                <?php endif ?>
47f11f4a44SGreg Roach                                <a class="dropdown-header wt-family-navigator-dropdown-heading" href="<?= e($spouse_child_family->url()) ?>">
48dd6b2bfcSGreg Roach                                    <?= I18N::translate('Parents') ?>
498b27c8beSGreg Roach                                </a>
508b27c8beSGreg Roach                                <?php foreach ($spouse_child_family->spouses() as $parent) : ?>
51dd6b2bfcSGreg Roach                                    <a class="dropdown-item" href="<?= e($parent->url()) ?>">
5239ca88baSGreg Roach                                        <?= $parent->fullName() ?>
53dd6b2bfcSGreg Roach                                    </a>
54dd6b2bfcSGreg Roach                                <?php endforeach ?>
558b27c8beSGreg Roach                            <?php endforeach ?>
56dd6b2bfcSGreg Roach                        </div>
57dd6b2bfcSGreg Roach                    </div>
58dd6b2bfcSGreg Roach                    <?php else : ?>
59d35568b4SGreg Roach                        <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $spouse) ?>
60dd6b2bfcSGreg Roach                    <?php endif ?>
61dd6b2bfcSGreg Roach                </th>
62dd6b2bfcSGreg Roach
63dd6b2bfcSGreg Roach                <td class="wt-family-navigator-name">
64dd6b2bfcSGreg Roach                    <?php if ($spouse->canShow()) : ?>
65dd6b2bfcSGreg Roach                        <a href="<?= e($spouse->url()) ?>">
6639ca88baSGreg Roach                            <?= $spouse->fullName() ?>
67dd6b2bfcSGreg Roach                        </a>
68dd6b2bfcSGreg Roach                        <div class="small">
695e6816beSGreg Roach                            <?= $spouse->lifespan() ?>
70dd6b2bfcSGreg Roach                        </div>
71dd6b2bfcSGreg Roach                    <?php else : ?>
7239ca88baSGreg Roach                        <?= $spouse->fullName() ?>
73dd6b2bfcSGreg Roach                    <?php endif ?>
74dd6b2bfcSGreg Roach                </td>
75dd6b2bfcSGreg Roach            </tr>
76dd6b2bfcSGreg Roach        <?php endforeach ?>
77dd6b2bfcSGreg Roach
7839ca88baSGreg Roach        <?php foreach ($family->children() as $child) : ?>
791baf69deSGreg Roach            <tr class="text-center wt-family-navigator-child wt-sex-<?= strtolower($child->sex()) ?>">
80627d7dbeSGreg Roach                <th class="align-middle wt-family-navigator-label" scope="row">
81dd6b2bfcSGreg Roach                    <?php if ($child === $individual) : ?>
82d35568b4SGreg Roach                        <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $child) ?>
83dd6b2bfcSGreg Roach                        <i class="icon-selected"></i>
84da7f6dd7SGreg Roach                    <?php elseif ($child->spouseFamilies()->isNotEmpty()) : ?>
85dd6b2bfcSGreg Roach                        <div class="dropdown">
86315eb316SGreg Roach                            <a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($child->xref()) ?>" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
87d35568b4SGreg Roach                                <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $child) ?>
88dd6b2bfcSGreg Roach                            </a>
89dd6b2bfcSGreg Roach
90dd6b2bfcSGreg Roach                            <div class="dropdown-menu">
9139ca88baSGreg Roach                                <?php foreach ($child->spouseFamilies() as $n => $in_laws) : ?>
92dd6b2bfcSGreg Roach                                    <?php if ($n > 0) : ?>
93dd6b2bfcSGreg Roach                                        <div class="dropdown-divider"></div>
94dd6b2bfcSGreg Roach                                    <?php endif ?>
958b27c8beSGreg Roach                                    <a class="dropdown-header wt-family-navigator-dropdown-heading" href="<?= e($in_laws->url()) ?>">
96dd6b2bfcSGreg Roach                                        <?= I18N::translate('Family') ?>
978b27c8beSGreg Roach                                    </a>
98dd6b2bfcSGreg Roach
9939ca88baSGreg Roach                                    <?php foreach ($in_laws->spouses() as $sibling_in_law) : ?>
100dd6b2bfcSGreg Roach                                        <?php if ($sibling_in_law !== $child) : ?>
101dd6b2bfcSGreg Roach                                            <a class="dropdown-item" href="<?= e($sibling_in_law->url()) ?>">
10239ca88baSGreg Roach                                                <?= $sibling_in_law->fullName() ?>
103dd6b2bfcSGreg Roach                                            </a>
104dd6b2bfcSGreg Roach                                        <?php endif ?>
105dd6b2bfcSGreg Roach                                    <?php endforeach ?>
106dd6b2bfcSGreg Roach
107dd6b2bfcSGreg Roach                                <ul>
10839ca88baSGreg Roach                                    <?php foreach ($in_laws->children() as $child_in_law) : ?>
109dd6b2bfcSGreg Roach                                    <li>
110dd6b2bfcSGreg Roach                                        <a class="dropdown-item" href="<?= e($child_in_law->url()) ?>">
11139ca88baSGreg Roach                                            <?= $child_in_law->fullName() ?>
112dd6b2bfcSGreg Roach                                        </a>
113dd6b2bfcSGreg Roach                                    </li>
114dd6b2bfcSGreg Roach                                    <?php endforeach ?>
115dd6b2bfcSGreg Roach                                </ul>
116dd6b2bfcSGreg Roach                                <?php endforeach ?>
117dd6b2bfcSGreg Roach                            </div>
118dd6b2bfcSGreg Roach                        </div>
119dd6b2bfcSGreg Roach                    <?php else : ?>
120d35568b4SGreg Roach                        <?= Registry::container()->get(RelationshipService::class)->getCloseRelationshipName($individual, $child) ?>
121dd6b2bfcSGreg Roach                    <?php endif ?>
122dd6b2bfcSGreg Roach                </th>
123dd6b2bfcSGreg Roach
124dd6b2bfcSGreg Roach                <td>
125dd6b2bfcSGreg Roach                    <?php if ($child->canShow()) : ?>
126dd6b2bfcSGreg Roach                        <a  href="<?= e($child->url()) ?>">
12739ca88baSGreg Roach                            <?= $child->fullName() ?>
128dd6b2bfcSGreg Roach                        </a>
129dd6b2bfcSGreg Roach                        <div class="small">
1305e6816beSGreg Roach                            <?= $child->lifespan() ?>
131dd6b2bfcSGreg Roach                        </div>
132dd6b2bfcSGreg Roach                    <?php else : ?>
13339ca88baSGreg Roach                        <?= $child->fullName() ?>
134dd6b2bfcSGreg Roach                    <?php endif ?>
135dd6b2bfcSGreg Roach                </td>
136dd6b2bfcSGreg Roach            </tr>
137dd6b2bfcSGreg Roach        <?php endforeach ?>
138dd6b2bfcSGreg Roach    </tbody>
139dd6b2bfcSGreg Roach</table>
140