FamilyTreeStatisticsModule::configureBlock()   F
last analyzed

Complexity

Conditions 21
Paths 2

Size

Total Lines 204
Code Lines 192

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 21
eloc 192
nc 2
nop 1
dl 0
loc 204
rs 3.3333
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * webtrees: online genealogy
4
 * Copyright (C) 2019 webtrees development team
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
 * GNU General Public License for more details.
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
 */
16
namespace Fisharebest\Webtrees\Module;
17
18
use Fisharebest\Webtrees\Auth;
19
use Fisharebest\Webtrees\Filter;
20
use Fisharebest\Webtrees\Functions\FunctionsDb;
21
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
22
use Fisharebest\Webtrees\I18N;
23
use Fisharebest\Webtrees\Module;
24
use Fisharebest\Webtrees\Query\QueryName;
25
use Fisharebest\Webtrees\Stats;
26
use Fisharebest\Webtrees\Theme;
27
28
/**
29
 * Class FamilyTreeStatisticsModule
30
 */
31
class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockInterface
32
{
33
    /** Show this number of surnames by default */
34
    const DEFAULT_NUMBER_OF_SURNAMES = 10;
35
36
    /** {@inheritdoc} */
37
    public function getTitle()
38
    {
39
        return /* I18N: Name of a module */ I18N::translate('Statistics');
40
    }
41
42
    /** {@inheritdoc} */
43
    public function getDescription()
44
    {
45
        return /* I18N: Description of “Statistics” module */ I18N::translate('The size of the family tree, earliest and latest events, common names, etc.');
46
    }
47
48
    /**
49
     * Generate the HTML content of this block.
50
     *
51
     * @param int      $block_id
52
     * @param bool     $template
53
     * @param string[] $cfg
54
     *
55
     * @return string
56
     */
57
    public function getBlock($block_id, $template = true, $cfg = array())
58
    {
59
        global $WT_TREE, $ctype;
60
61
        $show_last_update     = $this->getBlockSetting($block_id, 'show_last_update', '1');
62
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
63
        $number_of_surnames   = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
64
        $stat_indi            = $this->getBlockSetting($block_id, 'stat_indi', '1');
65
        $stat_fam             = $this->getBlockSetting($block_id, 'stat_fam', '1');
66
        $stat_sour            = $this->getBlockSetting($block_id, 'stat_sour', '1');
67
        $stat_media           = $this->getBlockSetting($block_id, 'stat_media', '1');
68
        $stat_repo            = $this->getBlockSetting($block_id, 'stat_repo', '1');
69
        $stat_surname         = $this->getBlockSetting($block_id, 'stat_surname', '1');
70
        $stat_events          = $this->getBlockSetting($block_id, 'stat_events', '1');
71
        $stat_users           = $this->getBlockSetting($block_id, 'stat_users', '1');
72
        $stat_first_birth     = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
73
        $stat_last_birth      = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
74
        $stat_first_death     = $this->getBlockSetting($block_id, 'stat_first_death', '1');
75
        $stat_last_death      = $this->getBlockSetting($block_id, 'stat_last_death', '1');
76
        $stat_long_life       = $this->getBlockSetting($block_id, 'stat_long_life', '1');
77
        $stat_avg_life        = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
78
        $stat_most_chil       = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
79
        $stat_avg_chil        = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
80
81
        // This can be overriden when embedding in an HTML block
82
        $block = '0';
83
84
        foreach (array('show_common_surnames', 'number_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'block') as $name) {
85
            if (array_key_exists($name, $cfg)) {
86
                $$name = $cfg[$name];
87
            }
88
        }
89
90
        $id    = $this->getName() . $block_id;
91
        $class = $this->getName() . '_block';
92
        if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
0 ignored issues
show
introduced by
Consider adding parentheses for clarity. Current Interpretation: ($ctype === 'gedcom' && ...\Webtrees\Auth::check(), Probably Intended Meaning: $ctype === 'gedcom' && (...Webtrees\Auth::check())
Loading history...
93
            $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
94
        } else {
95
            $title = '';
96
        }
97
        $title .= $this->getTitle() . ' — ' . $WT_TREE->getTitleHtml();
98
99
        $stats = new Stats($WT_TREE);
100
101
        $content = '';
102
103
        if ($show_last_update) {
104
            $content .= '<p>' . /* I18N: %s is a date */
105
                I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</p>';
106
        }
107
108
        /** Responsive Design */
109
        $content .= '<div class="stat-table1">';
110
        if ($stat_indi) {
111
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individuals') . '</div><div class="facts_value stats_value stat-cell"><a href="' . "indilist.php?surname_sublist=no&amp;ged=" . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>';
112
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Males') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</div></div>';
113
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Females') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</div></div>';
114
        }
115
        if ($stat_surname) {
116
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total surnames') . '</div><div class="facts_value stats_value stat-cell"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>';
117
        }
118
        if ($stat_fam) {
119
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Families') . '</div><div class="facts_value stats_value stat-cell"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalFamilies() . '</a></div></div>';
120
        }
121
        if ($stat_sour) {
122
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Sources') . '</div><div class="facts_value stats_value stat-cell"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSources() . '</a></div></div>';
123
        }
124
        if ($stat_media) {
125
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Media objects') . '</div><div class="facts_value stats_value stat-cell"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalMedia() . '</a></div></div>';
126
        }
127
        if ($stat_repo) {
128
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Repositories') . '</div><div class="facts_value stats_value stat-cell"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalRepositories() . '</a></div></div>';
129
        }
130
        if ($stat_events) {
131
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total events') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalEvents() . '</div></div>';
132
        }
133
        if ($stat_users) {
134
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total users') . '</div><div class="facts_value stats_value stat-cell">';
135
            if (Auth::isManager($WT_TREE)) {
136
                $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>';
137
            } else {
138
                $content .= $stats->totalUsers();
139
            }
140
            $content .= '</div></div>';
141
        }
142
        if (!$block) {
143
            $content .= '</div><div class="facts_table stat-table2">';
144
        }
145
        if ($stat_first_birth) {
146
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstBirthYear() . '</div>';
147
            if (!$block) {
148
                $content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>';
149
            }
150
            $content .= '</div>';
151
        }
152
        if ($stat_last_birth) {
153
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastBirthYear() . '</div>';
154
            if (!$block) {
155
                $content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>';
156
            }
157
            $content .= '</div>';
158
        }
159
        if ($stat_first_death) {
160
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstDeathYear() . '</div>';
161
            if (!$block) {
162
                $content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>';
163
            }
164
            $content .= '</div>';
165
        }
166
        if ($stat_last_death) {
167
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest death year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastDeathYear() . '</div>';
168
            if (!$block) {
169
                $content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>';
170
            }
171
            $content .= '</div>';
172
        }
173
        if ($stat_long_life) {
174
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individual who lived the longest') . '</div><div class="facts_value stats_value stat-cell">' . $stats->longestLifeAge() . '</div>';
175
            if (!$block) {
176
                $content .= '<div class="facts_value stat-cell left">' . $stats->longestLife() . '</div>';
177
            }
178
            $content .= '</div>';
179
        }
180
        if ($stat_avg_life) {
181
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average age at death') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageLifespan() . '</div>';
182
            if (!$block) {
183
                $content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ':&nbsp;' . $stats->averageLifespanMale();
184
                $content .= '&nbsp;&nbsp;&nbsp;' . I18N::translate('Females') . ':&nbsp;' . $stats->averageLifespanFemale() . '</div>';
185
            }
186
            $content .= '</div>';
187
        }
188
189
        if ($stat_most_chil && !$block) {
190
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Family with the most children') . '</div><div class="facts_value stats_value stat-cell">' . $stats->largestFamilySize() . '</div>';
191
            if (!$block) {
192
                $content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>';
193
            }
194
            $content .= '</div>';
195
        }
196
        if ($stat_avg_chil) {
197
            $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Average number of children per family') . '</div><div class="facts_value stats_value stat-cell">' . $stats->averageChildren() . '</div>';
198
            if (!$block) {
199
                $content .= '<div class="facts_value stat-cell left"></div>';
200
            }
201
            $content .= '</div>';
202
        }
203
        $content .= '</div>';
204
205
        if ($show_common_surnames) {
206
            $surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), 0, (int) $number_of_surnames);
207
208
            $all_surnames = array();
209
            foreach (array_keys($surnames) as $surname) {
210
                $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $surname, '', false, false));
211
            }
212
213
            if (!empty($surnames)) {
214
                ksort($all_surnames);
215
                $content .= '<div class="clearfloat">';
216
                $content .= '<p>';
217
                $content .= '<strong>' . I18N::translate('Most common surnames') . '</strong>';
218
                $content .= '<br>';
219
                $content .= '<span class="common_surnames">' . FunctionsPrintLists::surnameList($all_surnames, 2, false, 'indilist.php', $WT_TREE) . '</span>';
220
                $content .= '</p>';
221
                $content .= '</div>';
222
            }
223
        }
224
225
        if ($template) {
226
            return Theme::theme()->formatBlock($id, $title, $class, $content);
227
        } else {
228
            return $content;
229
        }
230
    }
231
232
    /** {@inheritdoc} */
233
    public function loadAjax()
234
    {
235
        return true;
236
    }
237
238
    /** {@inheritdoc} */
239
    public function isUserBlock()
240
    {
241
        return true;
242
    }
243
244
    /** {@inheritdoc} */
245
    public function isGedcomBlock()
246
    {
247
        return true;
248
    }
249
250
    /**
251
     * An HTML form to edit block settings
252
     *
253
     * @param int $block_id
254
     */
255
    public function configureBlock($block_id)
256
    {
257
        if (Filter::postBool('save') && Filter::checkCsrf()) {
258
            $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
259
            $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
260
            $this->setBlockSetting($block_id, 'number_of_surnames', Filter::postInteger('number_of_surnames'));
261
            $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
262
            $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
263
            $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
264
            $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other'));
265
            $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media'));
266
            $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
267
            $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
268
            $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events'));
269
            $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users'));
270
            $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
271
            $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
272
            $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
273
            $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
274
            $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
275
            $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
276
            $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
277
            $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
278
        }
279
280
        $show_last_update     = $this->getBlockSetting($block_id, 'show_last_update', '1');
281
        $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
282
        $number_of_surnames   = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES);
283
        $stat_indi            = $this->getBlockSetting($block_id, 'stat_indi', '1');
284
        $stat_fam             = $this->getBlockSetting($block_id, 'stat_fam', '1');
285
        $stat_sour            = $this->getBlockSetting($block_id, 'stat_sour', '1');
286
        $stat_media           = $this->getBlockSetting($block_id, 'stat_media', '1');
287
        $stat_repo            = $this->getBlockSetting($block_id, 'stat_repo', '1');
288
        $stat_surname         = $this->getBlockSetting($block_id, 'stat_surname', '1');
289
        $stat_events          = $this->getBlockSetting($block_id, 'stat_events', '1');
290
        $stat_users           = $this->getBlockSetting($block_id, 'stat_users', '1');
291
        $stat_first_birth     = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
292
        $stat_last_birth      = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
293
        $stat_first_death     = $this->getBlockSetting($block_id, 'stat_first_death', '1');
294
        $stat_last_death      = $this->getBlockSetting($block_id, 'stat_last_death', '1');
295
        $stat_long_life       = $this->getBlockSetting($block_id, 'stat_long_life', '1');
296
        $stat_avg_life        = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
297
        $stat_most_chil       = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
298
        $stat_avg_chil        = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
299
300
        ?>
301
        <tr>
302
            <td class="descriptionbox wrap width33">
303
                <label for="show-last-update">
304
                    <?php echo /* I18N: label for yes/no option */ I18N::translate('Show date of last update') ?>
305
                </label>
306
            </td>
307
            <td class="optionbox">
308
                <input type="checkbox" value="yes" id="show-last-update" name="show_last_update" <?php echo $show_last_update ? 'checked' : ''; ?>>
309
            </td>
310
        </tr>
311
        <tr>
312
            <td class="descriptionbox wrap width33">
313
                <?php echo I18N::translate('Statistics'); ?>
314
            </td>
315
            <td class="optionbox">
316
                <table>
317
                    <tbody>
318
                        <tr>
319
                            <td>
320
                                <label>
321
                                    <input type="checkbox" value="yes" name="stat_indi" <?php echo $stat_indi ? 'checked' : ''; ?>>
322
                                    <?php echo I18N::translate('Individuals'); ?>
323
                                </label>
324
                            </td>
325
                            <td>
326
                                <label>
327
                                    <input type="checkbox" value="yes" name="stat_first_birth" <?php echo $stat_first_birth ? 'checked' : ''; ?>>
328
                                    <?php echo I18N::translate('Earliest birth year'); ?>
329
                                </label>
330
                            </td>
331
                        </tr>
332
                        <tr>
333
                            <td>
334
                                <label>
335
                                    <input type="checkbox" value="yes" name="stat_surname" <?php echo $stat_surname ? 'checked' : ''; ?>>
336
                                    <?php echo I18N::translate('Total surnames'); ?>
337
                                </label>
338
                            </td>
339
                            <td>
340
                                <label>
341
                                    <input type="checkbox" value="yes" name="stat_last_birth" <?php echo $stat_last_birth ? 'checked' : ''; ?>>
342
                                    <?php echo I18N::translate('Latest birth year'); ?>
343
                                </label>
344
                            </td>
345
                        </tr>
346
                        <tr>
347
                            <td>
348
                                <label>
349
                                    <input type="checkbox" value="yes" name="stat_fam" <?php echo $stat_fam ? 'checked' : ''; ?>>
350
                                    <?php echo I18N::translate('Families'); ?>
351
                                </label>
352
                            </td>
353
                            <td>
354
                                <label>
355
                                    <input type="checkbox" value="yes" name="stat_first_death" <?php echo $stat_first_death ? 'checked' : ''; ?>>
356
                                    <?php echo I18N::translate('Earliest death year'); ?>
357
                                </label>
358
                            </td>
359
                        </tr>
360
                        <tr>
361
                            <td>
362
                                <label>
363
                                    <input type="checkbox" value="yes" name="stat_sour" <?php echo $stat_sour ? 'checked' : ''; ?>>
364
                                    <?php echo I18N::translate('Sources'); ?>
365
                                </label>
366
                            </td>
367
                            <td>
368
                                <label>
369
                                    <input type="checkbox" value="yes" name="stat_last_death" <?php echo $stat_last_death ? 'checked' : ''; ?>>
370
                                    <?php echo I18N::translate('Latest death year'); ?>
371
                                </label>
372
                            </td>
373
                        </tr>
374
                        <tr>
375
                            <td>
376
                                <label>
377
                                    <input type="checkbox" value="yes" name="stat_media" <?php echo $stat_media ? 'checked' : ''; ?>>
378
                                    <?php echo I18N::translate('Media objects'); ?>
379
                                </label>
380
                            </td>
381
                            <td>
382
                                <label>
383
                                    <input type="checkbox" value="yes" name="stat_long_life" <?php echo $stat_long_life ? 'checked' : ''; ?>>
384
                                    <?php echo I18N::translate('Individual who lived the longest'); ?>
385
                                </label>
386
                            </td>
387
                        </tr>
388
                        <tr>
389
                            <td>
390
                                <label>
391
                                    <input type="checkbox" value="yes" name="stat_repo" <?php echo $stat_repo ? 'checked' : ''; ?>>
392
                                    <?php echo I18N::translate('Repositories'); ?>
393
                                </label>
394
                            </td>
395
                            <td>
396
                                <label>
397
                                    <input type="checkbox" value="yes" name="stat_avg_life" <?php echo $stat_avg_life ? 'checked' : ''; ?>>
398
                                    <?php echo I18N::translate('Average age at death'); ?>
399
                                </label>
400
                            </td>
401
                        </tr>
402
                        <tr>
403
                            <td>
404
                                <label>
405
                                    <input type="checkbox" value="yes" name="stat_events" <?php echo $stat_events ? 'checked' : ''; ?>>
406
                                    <?php echo I18N::translate('Total events'); ?>
407
                                </label>
408
                            </td>
409
                            <td>
410
                                <label>
411
                                    <input type="checkbox" value="yes" name="stat_most_chil" <?php echo $stat_most_chil ? 'checked' : ''; ?>>
412
                                    <?php echo I18N::translate('Family with the most children'); ?>
413
                                </label>
414
                            </td>
415
                        </tr>
416
                        <tr>
417
                            <td>
418
                                <label>
419
                                    <input type="checkbox" value="yes" name="stat_users" <?php echo $stat_users ? 'checked' : ''; ?>>
420
                                    <?php echo I18N::translate('Total users'); ?>
421
                                </label>
422
                            </td>
423
                            <td>
424
                                <label>
425
                                    <input type="checkbox" value="yes" name="stat_avg_chil" <?php echo $stat_avg_chil ? 'checked' : ''; ?>>
426
                                    <?php echo I18N::translate('Average number of children per family'); ?>
427
                                </label>
428
                            </td>
429
                        </tr>
430
                    </tbody>
431
                </table>
432
            </td>
433
        </tr>
434
        <tr>
435
            <td class="descriptionbox wrap width33">
436
                <label for="show-common-surnames">
437
                    <?php echo I18N::translate('Most common surnames') ?>
438
                </label>
439
            </td>
440
            <td class="optionbox">
441
                <input type="checkbox" value="yes" id="show-common-surnames" name="show_common_surnames" <?php echo $show_common_surnames ? 'checked' : ''; ?>>
442
            </td>
443
        </tr>
444
        <tr>
445
            <td class="descriptionbox wrap width33">
446
                <label for="number-of-surnames">
447
                    <?php echo /* I18N: ... to show in a list */ I18N::translate('Number of surnames') ?>
448
                </label>
449
            </td>
450
            <td class="optionbox">
451
                <input
452
                    id="number-of-surnames"
453
                    maxlength="5"
454
                    name="number_of_surnames"
455
                    pattern="[1-9][0-9]*"
456
                    required
457
                    type="text"
458
                    value="<?php echo Filter::escapeHtml($number_of_surnames); ?>"
459
                >
460
            </td>
461
        </tr>
462
        <?php
463
    }
464
}
465