xref: /webtrees/resources/views/modules/pedigree-chart/chart-down.phtml (revision 81b514b4672980e5db010e9d89b55eaf131e798f)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Individual;
6use Illuminate\Support\Collection;
7
8/**
9 * @var Collection<int,Individual> $ancestors   Indexed by sosa number
10 * @var int                        $generation  Draw this generation
11 * @var int                        $generations Final generation to draw
12 * @var Collection<int,string>     $links       Links to extend the tree
13 * @var int                        $sosa        Draw this individual
14 * @var string                     $spacer
15 */
16?>
17
18<div class="d-flex flex-column">
19    <div class="position-relative d-flex justify-content-center wt-pedigree-generation wt-generation-fwd-<?= $generation ?> wt-generation-rev-<?= 1 + $generations - $generation ?>">
20        <!-- lines to the next generation -->
21        <?php if ($generation < $generations) : ?>
22            <div class="wt-pedigree-lines position-absolute"></div>
23        <?php endif ?>
24
25        <div class="d-flex flex-column align-items-center position-relative">
26            <?php if ($sosa === 1) : ?>
27                <?= $links->get(1) ?>
28            <?php endif ?>
29
30            <?= view('chart-box', ['individual' => $ancestors->get($sosa)]) ?>
31
32            <?php if ($generation === $generations) : ?>
33                <?= $links->get($sosa, $spacer) ?>
34            <?php endif ?>
35        </div>
36    </div>
37
38    <?php if ($generation < $generations) : ?>
39        <div class="d-flex">
40            <?= view('modules/pedigree-chart/chart-down', ['ancestors' => $ancestors, 'sosa' => $sosa * 2, 'generation' => $generation + 1, 'generations' => $generations, 'links' => $links, 'spacer' => $spacer]) ?>
41
42            <?= view('modules/pedigree-chart/chart-down', ['ancestors' => $ancestors, 'sosa' => $sosa * 2 + 1, 'generation' => $generation + 1, 'generations' => $generations, 'links' => $links, 'spacer' => $spacer]) ?>
43        </div>
44    <?php endif ?>
45</div>
46
47