xref: /webtrees/resources/views/modules/descendancy_chart/tree.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
10f1e0f10SGreg Roach<?php
20f1e0f10SGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
50f1e0f10SGreg Roachuse Fisharebest\Webtrees\Family;
60f1e0f10SGreg Roachuse Fisharebest\Webtrees\I18N;
70f1e0f10SGreg Roachuse Fisharebest\Webtrees\Individual;
80f1e0f10SGreg Roach
90f1e0f10SGreg Roach/**
100f1e0f10SGreg Roach * @var Individual $individual
110f1e0f10SGreg Roach * @var int        $generations
120f1e0f10SGreg Roach * @var string     $daboville
130f1e0f10SGreg Roach */
140f1e0f10SGreg Roach
150f1e0f10SGreg Roach?>
160f1e0f10SGreg Roach
170f1e0f10SGreg Roach<div class="d-flex">
180f1e0f10SGreg Roach    <?= view('chart-box', ['individual' => $individual]) ?>
190f1e0f10SGreg Roach    <div class="wt-daboville-number align-self-center p-1 mx-2 d-none d-md-block" title="<?= I18N::translate('d’Aboville number') ?>">
200f1e0f10SGreg Roach        <?= e($daboville) ?>
210f1e0f10SGreg Roach    </div>
220f1e0f10SGreg Roach</div>
230f1e0f10SGreg Roach
240f1e0f10SGreg Roach<?php if ($generations > 1) : ?>
250f1e0f10SGreg Roach    <?php $child_number = 0; ?>
260f1e0f10SGreg Roach    <?php foreach ($individual->spouseFamilies()->sort(Family::marriageDateComparator()) as $family) : ?>
270f1e0f10SGreg Roach        <div class="d-flex">
28315eb316SGreg Roach            <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">
290f1e0f10SGreg Roach                <span class="chart-expand">
300f1e0f10SGreg Roach                    <?= view('icons/expand') ?>
310f1e0f10SGreg Roach                </span>
320f1e0f10SGreg Roach                <span class="chart-collapse">
330f1e0f10SGreg Roach                    <?= view('icons/collapse') ?>
340f1e0f10SGreg Roach                </span>
350f1e0f10SGreg Roach                <?php foreach ($family->facts(['MARR', 'DIV', '_NMR'], true) as $fact) : ?>
360f1e0f10SGreg Roach                    <?= $fact->label() ?>
370f1e0f10SGreg Roach                    <?php if ($fact->date()->isOK()) : ?>
380f1e0f10SGreg Roach                        <?= strip_tags($fact->date()->display()) ?>
390f1e0f10SGreg Roach                    <?php endif ?>
400f1e0f10SGreg Roach410f1e0f10SGreg Roach                <?php endforeach ?>
420f1e0f10SGreg Roach                <?= I18N::plural('%s child', '%s children', $family->children()->count(), I18N::number($family->children()->count())) ?>
430f1e0f10SGreg Roach            </button>
440f1e0f10SGreg Roach        </div>
450f1e0f10SGreg Roach        <div id="fam-<?= e($family->xref()) ?>" class="collapse show mb-4">
460f1e0f10SGreg Roach            <?= view('chart-box', ['individual' => $family->spouse($individual)]) ?>
47fcad4470SGreg Roach            <?php foreach ($family->children()->sort(Individual::birthDateComparator())->values() as $n => $child) : ?>
480f1e0f10SGreg Roach                <div class="d-flex">
49076e4c54SGreg Roach                    <div class="wt-chart-horizontal-indent position-relative">
500f1e0f10SGreg Roach                        <?php if ($n + 1 === $family->children()->count()) : ?>
510f1e0f10SGreg Roach                            <div class="wt-chart-vertical-last-child-line position-absolute"></div>
520f1e0f10SGreg Roach                        <?php else : ?>
530f1e0f10SGreg Roach                            <div class="wt-chart-vertical-line position-absolute"></div>
540f1e0f10SGreg Roach                            <div class="wt-chart-vertical-child-line position-absolute"></div>
550f1e0f10SGreg Roach                        <?php endif ?>
560f1e0f10SGreg Roach                    </div>
570f1e0f10SGreg Roach                    <div>
580f1e0f10SGreg Roach                        <?= view('modules/descendancy_chart/tree', ['individual' => $child, 'generations' => $generations - 1, 'daboville' => $daboville . '.' . ++$child_number]) ?>
590f1e0f10SGreg Roach                    </div>
600f1e0f10SGreg Roach                </div>
610f1e0f10SGreg Roach            <?php endforeach ?>
620f1e0f10SGreg Roach        </div>
630f1e0f10SGreg Roach    <?php endforeach ?>
640f1e0f10SGreg Roach<?php endif ?>
65