xref: /webtrees/resources/views/fact-parents-age.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1b315f3e1SGreg Roach<?php
2b315f3e1SGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5b315f3e1SGreg Roachuse Fisharebest\Webtrees\Age;
6b315f3e1SGreg Roachuse Fisharebest\Webtrees\Date;
7b315f3e1SGreg Roachuse Fisharebest\Webtrees\Family;
8b315f3e1SGreg Roachuse Fisharebest\Webtrees\Individual;
9b315f3e1SGreg Roach
10b315f3e1SGreg Roach/**
11b315f3e1SGreg Roach * @var Individual $individual
12b315f3e1SGreg Roach * @var Date       $birth_date
13b315f3e1SGreg Roach */
14b315f3e1SGreg Roach
15b315f3e1SGreg Roach$family = $individual->childFamilies()->first();
16b315f3e1SGreg Roach
17b315f3e1SGreg Roach?>
18b315f3e1SGreg Roach
19b315f3e1SGreg Roach<?php  if ($family instanceof Family && $birth_date->isOK()) : ?>
20b315f3e1SGreg Roach    <span class="age">
21b315f3e1SGreg Roach    <?php foreach ($family->spouses() as $parent) : ?>
22b315f3e1SGreg Roach        <?php if ($parent->getBirthDate()->isOK()) : ?>
23b315f3e1SGreg Roach            <?php if ($parent->sex() === 'F') : ?>
24b315f3e1SGreg Roach                <?= view('fact-parent-age', ['age' => new Age($parent->getBirthDate(), $birth_date), 'died' => $parent->getDeathDate()->isOK() && $parent->getDeathDate()->maximumJulianDay() < $birth_date->minimumJulianDay() + 90, 'sex' => $parent->sex()]) ?>
25b315f3e1SGreg Roach            <?php else : ?>
26b315f3e1SGreg Roach                <?= view('fact-parent-age', ['age' => new Age($parent->getBirthDate(), $birth_date), 'died' => $parent->getDeathDate()->isOK() && $parent->getDeathDate()->maximumJulianDay() < $birth_date->minimumJulianDay(), 'sex' => $parent->sex()]) ?>
27b315f3e1SGreg Roach            <?php endif ?>
28b315f3e1SGreg Roach        <?php endif ?>
29b315f3e1SGreg Roach    <?php endforeach ?>
30b315f3e1SGreg Roach    </span>
31b315f3e1SGreg Roach<?php endif ?>
32