fisharebest/webtrees

View on GitHub
resources/views/modules/gedcom_stats/statistics.phtml

Summary

Maintainability
Test Coverage
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;

/**
 * @var string     $show_last_update
 * @var string     $stat_indi
 * @var string     $stat_surname
 * @var string     $stat_fam
 * @var string     $stat_sour
 * @var string     $stat_media
 * @var string     $stat_repo
 * @var string     $stat_events
 * @var string     $stat_users
 * @var string     $stat_first_birth
 * @var string     $stat_last_birth
 * @var string     $stat_first_death
 * @var string     $stat_last_death
 * @var string     $stat_long_life
 * @var string     $stat_avg_life
 * @var string     $stat_most_chil
 * @var string     $stat_avg_chil
 * @var string     $surnames
 */

?>

<?php if ($show_last_update) : ?>
    <p class="card-text">
        <?= I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') ?>
    </p>
<?php endif ?>

<div class="row">
    <div class="col col">
        <table class="table wt-facts-table">
            <caption class="visually-hidden">
                <?= I18N::translate('Statistics') ?>
            </caption>
            <tbody>
            <?php if ($stat_indi) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Individuals') ?>
                    </th>
                    <td>
                        #totalIndividuals#
                    </td>
                </tr>

                <tr>
                    <th scope="row">
                        <?= I18N::translate('Males') ?>
                    </th>
                    <td>
                        #totalSexMales#
                        <br>
                        #totalSexMalesPercentage#
                    </td>
                </tr>

                <tr>
                    <th scope="row">
                        <?= I18N::translate('Females') ?>
                    </th>
                    <td>
                        #totalSexFemales#
                        <br>
                        #totalSexFemalesPercentage#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_surname) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Surnames') ?>
                    </th>
                    <td>
                        #totalSurnames#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_fam) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Families') ?>
                    </th>
                    <td>
                        #totalFamilies#
                    </td>
                </tr>
            <?php endif ?>


            <?php if ($stat_sour) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Sources') ?>
                    </th>
                    <td>
                        #totalSources#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_media) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Media objects') ?>
                    </th>
                    <td>
                        #totalMedia#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_repo) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Repositories') ?>
                    </th>
                    <td>
                        #totalRepositories#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_events) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Events') ?>
                    </th>
                    <td>
                        #totalEvents#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_users) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Users') ?>
                    </th>
                    <td>
                        #totalUsers#
                    </td>
                </tr>
            <?php endif ?>
            </tbody>
        </table>
    </div>

    <div class="col col">
        <table class="table wt-facts-table">
            <caption class="visually-hidden">
                <?= I18N::translate('Statistics') ?>
            </caption>

            <tbody>
            <?php if ($stat_first_birth) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Earliest birth') ?>
                    </th>
                    <td>
                        #firstBirth#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_last_birth) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Latest birth') ?>
                    </th>
                    <td>
                        #lastBirth#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_first_death) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Earliest death') ?>
                    </th>
                    <td>
                        #firstDeath#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_last_death) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Latest death') ?>
                    </th>
                    <td>
                        #lastDeath#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_long_life) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Individual who lived the longest') ?>
                    </th>
                    <td>
                        #longestLife#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_avg_life) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Average age at death') ?>
                    </th>
                    <td>
                        #averageLifespan#
                        <br>
                        <?= I18N::translate('Males') ?>: #averageLifespanMale#
                        <br>
                        <?= I18N::translate('Females') ?>: #averageLifespanFemale#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_most_chil) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Family with the most children') ?>
                    </th>
                    <td>
                        #largestFamilySize#
                        <br>
                        #largestFamily#
                    </td>
                </tr>
            <?php endif ?>

            <?php if ($stat_avg_chil) : ?>
                <tr>
                    <th scope="row">
                        <?= I18N::translate('Average number of children per family') ?>
                    </th>
                    <td>
                        #averageChildren#
                    </td>
                </tr>
            <?php endif ?>
            </tbody>
        </table>
    </div>
</div>

<?php if ($surnames !== '') : ?>
    <div class="clearfix">
        <p>
            <strong>
                <?= I18N::translate('Most common surnames') ?>
            </strong>
            <br>
            <span class="common_surnames">
                <?= $surnames ?>
            </span>
        </p>
    </div>
<?php endif ?>