xref: /webtrees/resources/views/modules/lifespans-chart/chart.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1d70512abSGreg Roach<?php
2d70512abSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5d70512abSGreg Roachuse Fisharebest\Webtrees\Gedcom;
6d70512abSGreg Roach
77c2c99faSGreg Roach/**
87c2c99faSGreg Roach * @var string        $dir
97c2c99faSGreg Roach * @var int           $end_year
10f70bcff5SGreg Roach * @var array<object> $lifespans
117c2c99faSGreg Roach * @var int           $max_rows
127c2c99faSGreg Roach * @var int           $start_year
137c2c99faSGreg Roach * @var string        $subtitle
147c2c99faSGreg Roach */
157c2c99faSGreg Roach
16d70512abSGreg Roach?>
17e2b8114dSGreg Roach
18e2b8114dSGreg Roach<p class="wt-lifespans-subtitle">
19e2b8114dSGreg Roach    <?= $subtitle ?>
20e2b8114dSGreg Roach</p>
21e2b8114dSGreg Roach
22e2b8114dSGreg Roach<div class="wt-lifespans-scale">
23e2b8114dSGreg Roach    <?php for ($year = $start_year; $year < $end_year; $year += 10) :
24e2b8114dSGreg Roach        ?><div class="wt-lifespans-decade"><?= $year ?></div><?php
25e2b8114dSGreg Roach    endfor ?>
26e2b8114dSGreg Roach</div>
27e2b8114dSGreg Roach
28e2b8114dSGreg Roach<div class="wt-lifespans-individuals position-relative" style="height: <?= (5 + $max_rows) * 1.5 ?>rem; width: <?= ($end_year - $start_year) * 7 ?>px;">
29e2b8114dSGreg Roach    <?php foreach ($lifespans as $lifespan) : ?>
30315eb316SGreg Roach    <a href="#" data-bs-toggle="collapse" data-bs-target="#<?= e($lifespan->id) ?>" aria-expanded="false" aria-controls="<?= e($lifespan->id) ?>">
31e2b8114dSGreg Roach        <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;">
3239ca88baSGreg Roach            <?= $lifespan->individual->fullName() ?>
335e6816beSGreg Roach            <?= strip_tags($lifespan->individual->lifespan()) ?>
34e2b8114dSGreg Roach        </div>
35e2b8114dSGreg Roach    </a>
36e2b8114dSGreg Roach
37e2b8114dSGreg Roach    <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;">
38e2b8114dSGreg Roach        <a class="wt-lifespans-summary-link" href="<?= e($lifespan->individual->url()) ?>">
3939ca88baSGreg Roach            <?= $lifespan->individual->fullName() ?>
40e2b8114dSGreg Roach        </a>
41e2b8114dSGreg Roach
42e2b8114dSGreg Roach        <?php foreach ($lifespan->individual->facts(array_merge(Gedcom::BIRTH_EVENTS, Gedcom::DEATH_EVENTS), true) as $fact) : ?>
43e2b8114dSGreg Roach            <?= $fact->summary() ?>
44e2b8114dSGreg Roach        <?php endforeach ?>
45e2b8114dSGreg Roach    </div>
46e2b8114dSGreg Roach    <?php endforeach ?>
47e2b8114dSGreg Roach</div>
48e2b8114dSGreg Roach
49