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