xref: /webtrees/resources/views/modules/descendancy_chart/tree.phtml (revision 4a9a60957058ca2a34e30a0d6f783e1540606590)
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 $individual
11 * @var int        $generations
12 * @var string     $daboville
13 */
14
15?>
16
17<div class="d-flex">
18    <?= view('chart-box', ['individual' => $individual]) ?>
19    <div class="wt-daboville-number align-self-center p-1 mx-2 d-none d-md-block" title="<?= I18N::translate('d’Aboville number') ?>">
20        <?= e($daboville) ?>
21    </div>
22</div>
23
24<?php if ($generations > 1) : ?>
25    <?php $child_number = 0; ?>
26    <?php foreach ($individual->spouseFamilies()->sort(Family::marriageDateComparator()) as $family) : ?>
27        <div class="d-flex">
28            <button class="btn btn-link px-0 py-1 wt-chart-expansion-control" data-bs-toggle="collapse" data-bs-target="#fam-<?= e($family->xref()) ?>" aria-controls="fam-<?= e($family->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                <?php foreach ($family->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
36                    <?= $fact->label() ?>
37                    <?php if ($fact->date()->isOK()) : ?>
38                        <?= strip_tags($fact->date()->display()) ?>
39                    <?php endif ?>
4041                <?php endforeach ?>
42                <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
43            </button>
44        </div>
45        <div id="fam-<?= e($family->xref()) ?>" class="collapse show mb-4">
46            <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
47            <?php foreach ($family->children()->sort(Individual::birthDateComparator())->values() as $n => $child) : ?>
48                <div class="d-flex">
49                    <div class="wt-chart-horizontal-indent position-relative">
50                        <?php if ($n + 1 === $family->children()->count()) : ?>
51                            <div class="wt-chart-vertical-last-child-line position-absolute"></div>
52                        <?php else : ?>
53                            <div class="wt-chart-vertical-line position-absolute"></div>
54                            <div class="wt-chart-vertical-child-line position-absolute"></div>
55                        <?php endif ?>
56                    </div>
57                    <div>
58                        <?= view('modules/descendancy_chart/tree', ['individual' => $child, 'generations' => $generations - 1, 'daboville' => $daboville . '.' . ++$child_number]) ?>
59                    </div>
60                </div>
61            <?php endforeach ?>
62        </div>
63    <?php endforeach ?>
64<?php endif ?>
65