xref: /webtrees/resources/views/modules/ancestors-chart/tree.phtml (revision ac71572d8462e396ed5a307f05b29381e49f9e6e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Family;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8
9/**
10 * @var Individual|null $individual
11 * @var Family|null     $parents
12 * @var int             $generations
13 * @var int             $sosa
14 */
15
16?>
17
18<div class="d-flex">
19    <?= view('chart-box', ['individual' => $individual]) ?>
20    <div class="wt-sosa-number align-self-center p-1 mx-2 d-none d-md-block" title="<?= I18N::translate('Sosa-Stradonitz number') ?>">
21        <?= I18N::number($sosa) ?>
22    </div>
23</div>
24
25<?php if ($generations > 1 && $parents instanceof Family) : ?>
26    <div class="d-flex">
27        <span class="wt-chart-horizontal-spacer d-inline-block"></span>
28        <button class="btn btn-link px-0 py-1 wt-chart-expansion-control" data-bs-toggle="collapse" data-bs-target="#fam-<?= e($parents->xref()) ?>" aria-controls="fam-<?= e($parents->xref()) ?>" aria-expanded="true">
29            <span class="chart-expand">
30                <?= view('icons/expand') ?>
31            </span>
32            <span class="chart-collapse">
33                <?= view('icons/collapse') ?>
34            </span>
35            <?= I18N::translate('Parents') ?>
36            <?php foreach ($parents->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
3738                <?= $fact->label() ?>
39                <?php if ($fact->date()->isOK()) : ?>
40                    <?= strip_tags($fact->date()->display()) ?>
41                <?php endif ?>
42            <?php endforeach ?>
4344            <?= I18N::plural('%s child', '%s children', $parents->children()->count(), I18N::number($parents->children()->count())) ?>
45        </button>
46    </div>
47    <div id="fam-<?= e($parents->xref()) ?>" class="collapse show mb-4">
48        <?php foreach ($parents->spouses() as $n => $spouse) : ?>
49            <div class="d-flex">
50                <div class="wt-chart-horizontal-indent position-relative">
51                    <?php if ($n + 1 === $parents->spouses()->count()) : ?>
52                        <div class="wt-chart-vertical-last-child-line position-absolute"></div>
53                    <?php else : ?>
54                        <div class="wt-chart-vertical-line position-absolute"></div>
55                        <div class="wt-chart-vertical-child-line position-absolute"></div>
56                    <?php endif ?>
57                </div>
58                <div>
59                    <?= view('modules/ancestors-chart/tree', ['individual' => $spouse, 'parents' => $spouse->childFamilies()->first(), 'generations' => $generations - 1, 'sosa' => $sosa * 2 + ($spouse->sex() === 'F' ? 1 : 0)]) ?>
60                </div>
61            </div>
62        <?php endforeach ?>
63    </div>
64<?php endif ?>
65