xref: /webtrees/resources/views/modules/ancestors-chart/tree.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1fb7dd072SGreg Roach<?php
2fb7dd072SGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5fb7dd072SGreg Roachuse Fisharebest\Webtrees\Family;
6fb7dd072SGreg Roachuse Fisharebest\Webtrees\I18N;
7fb7dd072SGreg Roachuse Fisharebest\Webtrees\Individual;
8fb7dd072SGreg Roach
9fb7dd072SGreg Roach/**
10fb7dd072SGreg Roach * @var Individual|null $individual
11fb7dd072SGreg Roach * @var Family|null     $parents
12fb7dd072SGreg Roach * @var int             $generations
13fb7dd072SGreg Roach * @var int             $sosa
14fb7dd072SGreg Roach */
15fb7dd072SGreg Roach
16fb7dd072SGreg Roach?>
17fb7dd072SGreg Roach
18fb7dd072SGreg Roach<div class="d-flex">
19fb7dd072SGreg Roach    <?= view('chart-box', ['individual' => $individual]) ?>
20fb7dd072SGreg Roach    <div class="wt-sosa-number align-self-center p-1 mx-2 d-none d-md-block" title="<?= I18N::translate('Sosa-Stradonitz number') ?>">
21fb7dd072SGreg Roach        <?= I18N::number($sosa) ?>
22fb7dd072SGreg Roach    </div>
23fb7dd072SGreg Roach</div>
24fb7dd072SGreg Roach
25fb7dd072SGreg Roach<?php if ($generations > 1 && $parents instanceof Family) : ?>
26fb7dd072SGreg Roach    <div class="d-flex">
27076e4c54SGreg Roach        <span class="wt-chart-horizontal-spacer d-inline-block"></span>
28315eb316SGreg Roach        <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">
29fb7dd072SGreg Roach            <span class="chart-expand">
30fb7dd072SGreg Roach                <?= view('icons/expand') ?>
31fb7dd072SGreg Roach            </span>
32fb7dd072SGreg Roach            <span class="chart-collapse">
33fb7dd072SGreg Roach                <?= view('icons/collapse') ?>
34fb7dd072SGreg Roach            </span>
352cb444b0SGreg Roach            <?= I18N::translate('Parents') ?>
36fb7dd072SGreg Roach            <?php foreach ($parents->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
372cb444b0SGreg Roach38fb7dd072SGreg Roach                <?= $fact->label() ?>
39fb7dd072SGreg Roach                <?php if ($fact->date()->isOK()) : ?>
40fb7dd072SGreg Roach                    <?= strip_tags($fact->date()->display()) ?>
41fb7dd072SGreg Roach                <?php endif ?>
42fb7dd072SGreg Roach            <?php endforeach ?>
432cb444b0SGreg Roach44fb7dd072SGreg Roach            <?= I18N::plural('%s child', '%s children', $parents->children()->count(), I18N::number($parents->children()->count())) ?>
45fb7dd072SGreg Roach        </button>
46fb7dd072SGreg Roach    </div>
470f1e0f10SGreg Roach    <div id="fam-<?= e($parents->xref()) ?>" class="collapse show mb-4">
48fb7dd072SGreg Roach        <?php foreach ($parents->spouses() as $n => $spouse) : ?>
49fb7dd072SGreg Roach            <div class="d-flex">
50076e4c54SGreg Roach                <div class="wt-chart-horizontal-indent position-relative">
51fb7dd072SGreg Roach                    <?php if ($n + 1 === $parents->spouses()->count()) : ?>
52fb7dd072SGreg Roach                        <div class="wt-chart-vertical-last-child-line position-absolute"></div>
53fb7dd072SGreg Roach                    <?php else : ?>
54fb7dd072SGreg Roach                        <div class="wt-chart-vertical-line position-absolute"></div>
55fb7dd072SGreg Roach                        <div class="wt-chart-vertical-child-line position-absolute"></div>
56fb7dd072SGreg Roach                    <?php endif ?>
57fb7dd072SGreg Roach                </div>
58fb7dd072SGreg Roach                <div>
591afbbc50SGreg Roach                    <?= view('modules/ancestors-chart/tree', ['individual' => $spouse, 'parents' => $spouse->childFamilies()->first(), 'generations' => $generations - 1, 'sosa' => $sosa * 2 + ($spouse->sex() === 'F' ? 1 : 0)]) ?>
60fb7dd072SGreg Roach                </div>
61fb7dd072SGreg Roach            </div>
62fb7dd072SGreg Roach        <?php endforeach ?>
63fb7dd072SGreg Roach    </div>
64fb7dd072SGreg Roach<?php endif ?>
65