xref: /webtrees/resources/views/modules/descendancy_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 $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        <?php if ($family->children()->isNotEmpty()) : ?>
26            <div class="d-flex">
27                <button class="btn btn-link px-0 py-1 wt-chart-expansion-control" data-toggle="collapse" data-target="#fam-<?= e($family->xref()) ?>" aria-controls="fam-<?= e($family->xref()) ?>" aria-expanded="true">
28                    <span class="chart-expand">
29                        <?= view('icons/expand') ?>
30                    </span>
31                    <span class="chart-collapse">
32                        <?= view('icons/collapse') ?>
33                    </span>
34                    <?php foreach ($family->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
35                        <?= $fact->label() ?>
36                        <?php if ($fact->date()->isOK()) : ?>
37                            <?= strip_tags($fact->date()->display()) ?>
38                        <?php endif ?>
3940                    <?php endforeach ?>
41                    <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
42                </button>
43            </div>
44            <div id="fam-<?= e($family->xref()) ?>" class="collapse show mb-4">
45                <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
46                <?php foreach ($family->children()->sort(Individual::birthDateComparator()) as $n => $child) : ?>
47                    <div class="d-flex">
48                        <div class="wt-chart-vertical-indent position-relative">
49                            <?php if ($n + 1 === $family->children()->count()) : ?>
50                                <div class="wt-chart-vertical-last-child-line position-absolute"></div>
51                            <?php else : ?>
52                                <div class="wt-chart-vertical-line position-absolute"></div>
53                                <div class="wt-chart-vertical-child-line position-absolute"></div>
54                            <?php endif ?>
55                        </div>
56                        <div>
57                            <?= view('modules/descendancy_chart/tree', ['individual' => $child, 'generations' => $generations - 1, 'daboville' => $daboville . '.' . ++$child_number]) ?>
58                        </div>
59                    </div>
60                <?php endforeach ?>
61            </div>
62        <?php endif ?>
63    <?php endforeach ?>
64<?php endif ?>
65