xref: /webtrees/resources/views/modules/gedcom_stats/statistics.phtml (revision 090a06287954f43677f06ea778b3f67c029de8fe)
1<?php
2
3use Fisharebest\Webtrees\I18N;
4use Fisharebest\Webtrees\Statistics;
5
6/**
7 * @var string     $show_last_update
8 * @var Statistics $stats
9 * @var string     $stat_indi
10 * @var string     $stat_surname
11 * @var string     $stat_fam
12 * @var string     $stat_sour
13 * @var string     $stat_media
14 * @var string     $stat_repo
15 * @var string     $stat_events
16 * @var string     $stat_users
17 * @var string     $stat_first_birth
18 * @var string     $stat_last_birth
19 * @var string     $stat_first_death
20 * @var string     $stat_last_death
21 * @var string     $stat_long_life
22 * @var string     $stat_avg_life
23 * @var string     $stat_most_chil
24 * @var string     $stat_avg_chil
25 * @var string     $surnames
26 */
27
28?>
29
30<?php if ($show_last_update) : ?>
31    <p class="card-text">
32        <?= I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) ?>
33    </p>
34<?php endif ?>
35
36<div class="row">
37    <div class="col col">
38        <table class="table wt-facts-table">
39            <caption class="sr-only">
40                <?= I18N::translate('Statistics') ?>
41            </caption>
42            <tbody>
43            <?php if ($stat_indi) : ?>
44                <tr>
45                    <th scope="row">
46                        <?= I18N::translate('Individuals') ?>
47                    </th>
48                    <td>
49                        <?= $stats->totalIndividuals() ?>
50                    </td>
51                </tr>
52
53                <tr>
54                    <th scope="row">
55                        <?= I18N::translate('Males') ?>
56                    </th>
57                    <td>
58                        <?= $stats->totalSexMales() ?>
59                        <br>
60                        <?= $stats->totalSexMalesPercentage() ?>
61                    </td>
62                </tr>
63
64                <tr>
65                    <th scope="row">
66                        <?= I18N::translate('Females') ?>
67                    </th>
68                    <td>
69                        <?= $stats->totalSexFemales() ?>
70                        <br>
71                        <?= $stats->totalSexFemalesPercentage() ?>
72                    </td>
73                </tr>
74            <?php endif ?>
75
76            <?php if ($stat_surname) : ?>
77                <tr>
78                    <th scope="row">
79                        <?= I18N::translate('Surnames') ?>
80                    </th>
81                    <td>
82                        <?= $stats->totalSurnames() ?>
83                    </td>
84                </tr>
85            <?php endif ?>
86
87            <?php if ($stat_fam) : ?>
88                <tr>
89                    <th scope="row">
90                        <?= I18N::translate('Families') ?>
91                    </th>
92                    <td>
93                        <?= $stats->totalFamilies() ?>
94                    </td>
95                </tr>
96            <?php endif ?>
97
98
99            <?php if ($stat_sour) : ?>
100                <tr>
101                    <th scope="row">
102                        <?= I18N::translate('Sources') ?>
103                    </th>
104                    <td>
105                        <?= $stats->totalSources() ?>
106                    </td>
107                </tr>
108            <?php endif ?>
109
110            <?php if ($stat_media) : ?>
111                <tr>
112                    <th scope="row">
113                        <?= I18N::translate('Media objects') ?>
114                    </th>
115                    <td>
116                        <?= $stats->totalMedia() ?>
117                    </td>
118                </tr>
119            <?php endif ?>
120
121            <?php if ($stat_repo) : ?>
122                <tr>
123                    <th scope="row">
124                        <?= I18N::translate('Repositories') ?>
125                    </th>
126                    <td>
127                        <?= $stats->totalRepositories() ?>
128                    </td>
129                </tr>
130            <?php endif ?>
131
132            <?php if ($stat_events) : ?>
133                <tr>
134                    <th scope="row">
135                        <?= I18N::translate('Events') ?>
136                    </th>
137                    <td>
138                        <?= $stats->totalEvents() ?>
139                    </td>
140                </tr>
141            <?php endif ?>
142
143            <?php if ($stat_users) : ?>
144                <tr>
145                    <th scope="row">
146                        <?= I18N::translate('Users') ?>
147                    </th>
148                    <td>
149                        <?= $stats->totalUsers() ?>
150                    </td>
151                </tr>
152            <?php endif ?>
153            </tbody>
154        </table>
155    </div>
156
157    <div class="col col">
158        <table class="table wt-facts-table">
159            <caption class="sr-only">
160                <?= I18N::translate('Statistics') ?>
161            </caption>
162
163            <tbody>
164            <?php if ($stat_first_birth) : ?>
165                <tr>
166                    <th scope="row">
167                        <?= I18N::translate('Earliest birth') ?>
168                    </th>
169                    <td>
170                        <?= $stats->firstBirth() ?>
171                    </td>
172                </tr>
173            <?php endif ?>
174
175            <?php if ($stat_last_birth) : ?>
176                <tr>
177                    <th scope="row">
178                        <?= I18N::translate('Latest birth') ?>
179                    </th>
180                    <td>
181                        <?= $stats->lastBirth() ?>
182                    </td>
183                </tr>
184            <?php endif ?>
185
186            <?php if ($stat_first_death) : ?>
187                <tr>
188                    <th scope="row">
189                        <?= I18N::translate('Earliest death') ?>
190                    </th>
191                    <td>
192                        <?= $stats->firstDeath() ?>
193                    </td>
194                </tr>
195            <?php endif ?>
196
197            <?php if ($stat_last_death) : ?>
198                <tr>
199                    <th scope="row">
200                        <?= I18N::translate('Latest death') ?>
201                    </th>
202                    <td>
203                        <?= $stats->lastDeath() ?>
204                    </td>
205                </tr>
206            <?php endif ?>
207
208            <?php if ($stat_long_life) : ?>
209                <tr>
210                    <th scope="row">
211                        <?= I18N::translate('Individual who lived the longest') ?>
212                    </th>
213                    <td>
214                        <?= $stats->longestLife() ?>
215                    </td>
216                </tr>
217            <?php endif ?>
218
219            <?php if ($stat_avg_life) : ?>
220                <tr>
221                    <th scope="row">
222                        <?= I18N::translate('Average age at death') ?>
223                    </th>
224                    <td>
225                        <?= $stats->averageLifespan() ?>
226                        <br>
227                        <?= I18N::translate('Males') ?>:&nbsp;<?= $stats->averageLifespanMale() ?>
228                        <br>
229                        <?= I18N::translate('Females') ?>&nbsp;<?= $stats->averageLifespanFemale() ?>
230                    </td>
231                </tr>
232            <?php endif ?>
233
234            <?php if ($stat_most_chil) : ?>
235                <tr>
236                    <th scope="row">
237                        <?= I18N::translate('Family with the most children') ?>
238                    </th>
239                    <td>
240                        <?= e($stats->largestFamilySize()) ?>
241                        <br>
242                        <?= $stats->largestFamily() ?>
243                    </td>
244                </tr>
245            <?php endif ?>
246
247            <?php if ($stat_avg_chil) : ?>
248                <tr>
249                    <th scope="row">
250                        <?= I18N::translate('Average number of children per family') ?>
251                    </th>
252                    <td>
253                        <?= $stats->averageChildren() ?>
254                    </td>
255                </tr>
256            <?php endif ?>
257            </tbody>
258        </table>
259    </div>
260</div>
261
262<?php if ($surnames !== '') : ?>
263    <div class="clearfix">
264        <p>
265            <strong>
266                <?= I18N::translate('Most common surnames') ?>
267            </strong>
268            <br>
269            <span class="common_surnames">
270                <?= $surnames ?>
271            </span>
272        </p>
273    </div>
274<?php endif ?>
275