xref: /webtrees/resources/views/modules/lifespans-chart/chart.phtml (revision 1792ff1cf1956b41f3e3c853cfb279a803a71ed2)
1<?php
2
3use Fisharebest\Webtrees\Gedcom;
4
5?>
6
7<p class="wt-lifespans-subtitle">
8    <?= $subtitle ?>
9</p>
10
11<div class="wt-lifespans-scale">
12    <?php for ($year = $start_year; $year < $end_year; $year += 10) :
13        ?><div class="wt-lifespans-decade"><?= $year ?></div><?php
14    endfor ?>
15</div>
16
17<div class="wt-lifespans-individuals position-relative" style="height: <?= (5 + $max_rows) * 1.5 ?>rem; width: <?= ($end_year - $start_year) * 7 ?>px;">
18    <?php foreach ($lifespans as $lifespan) : ?>
19    <a href="#" data-toggle="collapse" data-target="#<?= e($lifespan->id) ?>" aria-expanded="false" aria-controls="<?= e($lifespan->id) ?>">
20        <div class="wt-lifespans-individual position-absolute text-nowrap text-truncate" dir="auto" style="background: <?= $lifespan->background ?>; <?= $dir === 'ltr' ? 'left' : 'right' ?>:<?= ($lifespan->birth_year - $start_year) * 7 ?>px; top:<?= $lifespan->row * 1.5 ?>rem; width:<?= ($lifespan->death_year - $lifespan->birth_year) * 7 + 5 ?>px;">
21            <?= $lifespan->individual->fullName() ?>
22            <?= strip_tags($lifespan->individual->lifespan()) ?>
23        </div>
24    </a>
25
26    <div class="wt-lifespans-summary collapse position-absolute" id="<?= e($lifespan->id) ?>" style="<?= $dir === 'ltr' ? 'left' : 'right' ?>:<?= (min($lifespan->birth_year, $end_year - 50) - $start_year) * 7 ?>px; top:<?= ($lifespan->row + 1) * 1.5 ?>rem; width:350px;">
27        <a class="wt-lifespans-summary-link" href="<?= e($lifespan->individual->url()) ?>">
28            <?= $lifespan->individual->fullName() ?>
29        </a>
30
31        <?php foreach ($lifespan->individual->facts(array_merge(Gedcom::BIRTH_EVENTS, Gedcom::DEATH_EVENTS), true) as $fact) : ?>
32            <?= $fact->summary() ?>
33        <?php endforeach ?>
34    </div>
35    <?php endforeach ?>
36</div>
37
38