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