xref: /webtrees/resources/views/modules/family-book-chart/chart.phtml (revision 6c2179e2012ee7bb08bc76647556f957e4eeaa05)
1b7765f6bSGreg Roach<?php
2b7765f6bSGreg Roach
3b7765f6bSGreg Roachuse Fisharebest\Webtrees\Family;
4b7765f6bSGreg Roachuse Fisharebest\Webtrees\I18N;
5b7765f6bSGreg Roachuse Fisharebest\Webtrees\Individual;
6b7765f6bSGreg Roachuse Illuminate\Support\Collection;
7b7765f6bSGreg Roach
8b7765f6bSGreg Roach/**
9b7765f6bSGreg Roach * @var int        $book_size
10b7765f6bSGreg Roach * @var int        $generations
11b7765f6bSGreg Roach * @var Individual $individual
12b7765f6bSGreg Roach * @var bool       $show_spouse
13b7765f6bSGreg Roach */
14b7765f6bSGreg Roach
15*6c2179e2SGreg Roach$children = $individual->spouseFamilies()->map(static function (Family $family): Collection {
16*6c2179e2SGreg Roach    return $family->children();
17*6c2179e2SGreg Roach})->flatten();
18b7765f6bSGreg Roach
19b7765f6bSGreg Roach?>
20b7765f6bSGreg Roach
21b7765f6bSGreg Roach<h3><?= I18N::translate('Family of %s', $individual->fullName()) ?></h3>
22b7765f6bSGreg Roach
23b7765f6bSGreg Roach<div class="d-flex wt-chart-family-book">
24b7765f6bSGreg Roach    <?= view('modules/family-book-chart/children', ['children' => $children, 'generations' => $book_size - 1]) ?>
25b7765f6bSGreg Roach    <div class="align-self-center">
26b7765f6bSGreg Roach        <?= view('chart-box', ['individual' => $individual]) ?>
27b7765f6bSGreg Roach        <?php if ($show_spouse): ?>
28b7765f6bSGreg Roach            <?php foreach ($individual->spouseFamilies() as $family): ?>
29b7765f6bSGreg Roach                <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
30b7765f6bSGreg Roach            <?php endforeach ?>
31b7765f6bSGreg Roach        <?php endif ?>
32b7765f6bSGreg Roach    </div>
33b7765f6bSGreg Roach    <div class="wt-chart-horizontal-spacer">
34b7765f6bSGreg Roach        <div class="wt-chart-horizontal-line"></div>
35b7765f6bSGreg Roach    </div>
36b7765f6bSGreg Roach    <?= view('modules/family-book-chart/parents', ['generations' => $book_size - 1, 'family' => $individual->primaryChildFamily()]) ?>
37b7765f6bSGreg Roach</div>
38b7765f6bSGreg Roach
39b7765f6bSGreg Roach<?php if ($generations > 1): ?>
40b7765f6bSGreg Roach    <?php foreach ($children as $child): ?>
41b7765f6bSGreg Roach        <hr class="wt-family-separator">
42b7765f6bSGreg Roach        <?= view('modules/family-book-chart/chart', ['individual' => $child, 'generations' => $generations - 1, 'book_size' => $book_size, 'show_spouse' => $show_spouse]) ?>
43b7765f6bSGreg Roach    <?php endforeach ?>
44b7765f6bSGreg Roach<?php endif ?>
45