xref: /webtrees/resources/views/modules/lifespans-chart/chart.phtml (revision f7cf8a155e2743f3d124eef3d30a558ab062fa4b)
1<?php
2
3use Fisharebest\Webtrees\Gedcom;
4
5/**
6 * @var string          $dir
7 * @var int             $end_year
8 * @var array<stdClass> $lifespans
9 * @var int             $max_rows
10 * @var int             $start_year
11 * @var string          $subtitle
12 */
13
14?>
15
16<p class="wt-lifespans-subtitle">
17    <?= $subtitle ?>
18</p>
19
20<div class="wt-lifespans-scale">
21    <?php for ($year = $start_year; $year < $end_year; $year += 10) :
22        ?><div class="wt-lifespans-decade"><?= $year ?></div><?php
23    endfor ?>
24</div>
25
26<div class="wt-lifespans-individuals position-relative" style="height: <?= (5 + $max_rows) * 1.5 ?>rem; width: <?= ($end_year - $start_year) * 7 ?>px;">
27    <?php foreach ($lifespans as $lifespan) : ?>
28    <a href="#" data-toggle="collapse" data-target="#<?= e($lifespan->id) ?>" aria-expanded="false" aria-controls="<?= e($lifespan->id) ?>">
29        <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;">
30            <?= $lifespan->individual->fullName() ?>
31            <?= strip_tags($lifespan->individual->lifespan()) ?>
32        </div>
33    </a>
34
35    <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;">
36        <a class="wt-lifespans-summary-link" href="<?= e($lifespan->individual->url()) ?>">
37            <?= $lifespan->individual->fullName() ?>
38        </a>
39
40        <?php foreach ($lifespan->individual->facts(array_merge(Gedcom::BIRTH_EVENTS, Gedcom::DEATH_EVENTS), true) as $fact) : ?>
41            <?= $fact->summary() ?>
42        <?php endforeach ?>
43    </div>
44    <?php endforeach ?>
45</div>
46
47