xref: /webtrees/resources/views/modules/descendancy_chart/tree.phtml (revision a8b39ba2d349525974d59077419f7a8ea8802aaa)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Fisharebest\Webtrees\I18N;
5use Fisharebest\Webtrees\Individual;
6
7/**
8 * @var Individual $individual
9 * @var int        $generations
10 * @var string     $daboville
11 */
12
13?>
14
15<div class="d-flex">
16    <?= view('chart-box', ['individual' => $individual]) ?>
17    <div class="wt-daboville-number align-self-center p-1 mx-2 d-none d-md-block" title="<?= I18N::translate('d’Aboville number') ?>">
18        <?= e($daboville) ?>
19    </div>
20</div>
21
22<?php if ($generations > 1) : ?>
23    <?php $child_number = 0; ?>
24    <?php foreach ($individual->spouseFamilies()->sort(Family::marriageDateComparator()) as $family) : ?>
25        <div class="d-flex">
26            <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">
27                <span class="chart-expand">
28                    <?= view('icons/expand') ?>
29                </span>
30                <span class="chart-collapse">
31                    <?= view('icons/collapse') ?>
32                </span>
33                <?php foreach ($family->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
34                    <?= $fact->label() ?>
35                    <?php if ($fact->date()->isOK()) : ?>
36                        <?= strip_tags($fact->date()->display()) ?>
37                    <?php endif ?>
3839                <?php endforeach ?>
40                <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
41            </button>
42        </div>
43        <div id="fam-<?= e($family->xref()) ?>" class="collapse show mb-4">
44            <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
45            <?php foreach ($family->children()->sort(Individual::birthDateComparator()) as $n => $child) : ?>
46                <div class="d-flex">
47                    <div class="wt-chart-horizontal-indent position-relative">
48                        <?php if ($n + 1 === $family->children()->count()) : ?>
49                            <div class="wt-chart-vertical-last-child-line position-absolute"></div>
50                        <?php else : ?>
51                            <div class="wt-chart-vertical-line position-absolute"></div>
52                            <div class="wt-chart-vertical-child-line position-absolute"></div>
53                        <?php endif ?>
54                    </div>
55                    <div>
56                        <?= view('modules/descendancy_chart/tree', ['individual' => $child, 'generations' => $generations - 1, 'daboville' => $daboville . '.' . ++$child_number]) ?>
57                    </div>
58                </div>
59            <?php endforeach ?>
60        </div>
61    <?php endforeach ?>
62<?php endif ?>
63