xref: /webtrees/resources/views/modules/family-book-chart/chart.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
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       $spouses
13 */
14
15$children = $individual->spouseFamilies()->map(static function (Family $family): Collection {
16    return $family->children();
17})->flatten();
18
19?>
20
21<h3><?= I18N::translate('Family of %s', $individual->fullName()) ?></h3>
22
23<div class="d-flex wt-chart-family-book">
24    <?= view('modules/family-book-chart/children', ['children' => $children, 'generations' => $book_size - 1]) ?>
25    <div class="align-self-center">
26        <?= view('chart-box', ['individual' => $individual]) ?>
27        <?php if ($spouses) : ?>
28            <?php foreach ($individual->spouseFamilies() as $family) : ?>
29                <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
30            <?php endforeach ?>
31        <?php endif ?>
32    </div>
33    <div class="wt-chart-horizontal-spacer">
34        <div class="wt-chart-horizontal-line"></div>
35    </div>
36    <?= view('modules/family-book-chart/parents', ['generations' => $book_size - 1, 'family' => $individual->childFamilies()->first()]) ?>
37</div>
38
39<?php if ($generations > 1) : ?>
40    <?php foreach ($children as $child) : ?>
41        <hr class="wt-family-separator">
42        <?= view('modules/family-book-chart/chart', ['individual' => $child, 'generations' => $generations - 1, 'book_size' => $book_size, 'spouses' => $spouses]) ?>
43    <?php endforeach ?>
44<?php endif ?>
45