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