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