summaryrefslogtreecommitdiff
path: root/resources/views/modules/family_nav/sidebar-family.php
blob: f5c60effb28a98ce24e7f76a1e738b9d1897be22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php use Fisharebest\Webtrees\Functions\Functions; ?>
<?php use Fisharebest\Webtrees\I18N; ?>

<table class="table table-sm wt-facts-table wt-family-navigator-family">
	<caption class="text-center wt-family-navigator-family-heading">
		<a href="<?= e($family->url()) ?>">
			<?= $title ?>
		</a>
	</caption>
	<tbody>
		<?php foreach ($family->getSpouses() as $spouse): ?>
			<tr class="text-center wt-family-navigator-parent wt-gender-<?= $spouse->getSex() ?>">
				<th class="text-nowrap align-middle wt-family-navigator-label" scope="row">
					<?php if ($spouse === $individual): ?>
						<?= Functions::getCloseRelationshipName($individual, $spouse) ?>
						<i class="icon-selected"></i>
					<?php elseif ($spouse->getPrimaryChildFamily() !== null): ?>
					<div class="dropdown">
						<a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($spouse->getXref()) ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							<?= Functions::getCloseRelationshipName($individual, $spouse) ?>
						</a>

						<div class="dropdown-menu wt-family-navigator-dropdown">
							<div class="dropdown-header wt-family-navigator-dropdown-heading">
								<?= I18N::translate('Parents') ?>
							</div>
							<?php foreach ($spouse->getPrimaryChildFamily()->getSpouses() as $parent): ?>
								<a class="dropdown-item" href="<?= e($parent->url()) ?>">
									<?= $parent->getFullName() ?>
								</a>
							<?php endforeach ?>
						</div>
					</div>
					<?php else: ?>
						<?= Functions::getCloseRelationshipName($individual, $spouse) ?>
					<?php endif ?>
				</th>

				<td class="wt-family-navigator-name">
					<?php if ($spouse->canShow()): ?>
						<a href="<?= e($spouse->url()) ?>">
							<?= $spouse->getFullName() ?>
						</a>
						<div class="small">
							<?= $spouse->getLifeSpan() ?>
						</div>
					<?php else: ?>
						<?= $spouse->getFullName() ?>
					<?php endif ?>
				</td>
			</tr>
		<?php endforeach ?>

		<?php foreach ($family->getChildren() as $child): ?>
			<tr class="text-center wt-family-navigator-child wt-gender-<?= $child->getSex() ?>">
				<th class="text-nowrap align-middle" scope="row">
					<?php if ($child === $individual): ?>
						<?= Functions::getCloseRelationshipName($individual, $child) ?>
						<i class="icon-selected"></i>
					<?php elseif ($child->getSpouseFamilies() !== []): ?>
						<div class="dropdown">
							<a class="dropdown-toggle" href="#" role="button" id="dropdown-<?= e($child->getXref()) ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
								<?= Functions::getCloseRelationshipName($individual, $child) ?>
							</a>

							<div class="dropdown-menu">
								<?php foreach ($child->getSpouseFamilies() as $n => $in_laws): ?>
									<?php if ($n > 0) : ?>
										<div class="dropdown-divider"></div>
									<?php endif ?>
									<div class="dropdown-header wt-family-navigator-dropdown-heading">
										<?= I18N::translate('Family') ?>
									</div>

									<?php foreach ($in_laws->getSpouses() as $sibling_in_law): ?>
										<?php if ($sibling_in_law !== $child): ?>
											<a class="dropdown-item" href="<?= e($sibling_in_law->url()) ?>">
												<?= $sibling_in_law->getFullName() ?>
											</a>
										<?php endif ?>
									<?php endforeach ?>

								<ul>
									<?php foreach ($in_laws->getChildren() as $child_in_law): ?>
									<li>
										<a class="dropdown-item" href="<?= e($child_in_law->url()) ?>">
											<?= $child_in_law->getFullName() ?>
										</a>
									</li>
									<?php endforeach ?>
								</ul>
								<?php endforeach ?>
							</div>
						</div>
					<?php else: ?>
						<?= Functions::getCloseRelationshipName($individual, $child) ?>
					<?php endif ?>
				</th>

				<td>
					<?php if ($child->canShow()): ?>
						<a  href="<?= e($child->url()) ?>">
							<?= $child->getFullName() ?>
						</a>
						<div class="small">
							<?= $child->getLifeSpan() ?>
						</div>
					<?php else: ?>
						<?= $child->getFullName() ?>
					<?php endif ?>
				</td>
			</tr>
			<?php endforeach ?>
	</tbody>
</table>