18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 46bdf7674SGreg Roach * Copyright (C) 2017 webtrees development team 58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88c2e8227SGreg Roach * (at your option) any later version. 98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2e8227SGreg Roach * GNU General Public License for more details. 138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158c2e8227SGreg Roach */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1776692c8bSGreg Roach 180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 1915d603e7SGreg Roachuse Fisharebest\Webtrees\Bootstrap4; 200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Filter; 2115d603e7SGreg Roachuse Fisharebest\Webtrees\FontAwesome; 223d7a8a4cSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsDb; 23f36626dbSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrintLists; 24047f239bSGreg Roachuse Fisharebest\Webtrees\Html; 250e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 264eb71cfaSGreg Roachuse Fisharebest\Webtrees\Module; 27f36626dbSGreg Roachuse Fisharebest\Webtrees\Query\QueryName; 280e62c4b8SGreg Roachuse Fisharebest\Webtrees\Stats; 290e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 30*9c6524dcSGreg Roachuse Fisharebest\Webtrees\View; 318c2e8227SGreg Roach 328c2e8227SGreg Roach/** 338c2e8227SGreg Roach * Class FamilyTreeStatisticsModule 348c2e8227SGreg Roach */ 35e2a378d3SGreg Roachclass FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockInterface { 36f36626dbSGreg Roach /** Show this number of surnames by default */ 37f36626dbSGreg Roach const DEFAULT_NUMBER_OF_SURNAMES = 10; 38f36626dbSGreg Roach 398c2e8227SGreg Roach /** {@inheritdoc} */ 408c2e8227SGreg Roach public function getTitle() { 418c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('Statistics'); 428c2e8227SGreg Roach } 438c2e8227SGreg Roach 448c2e8227SGreg Roach /** {@inheritdoc} */ 458c2e8227SGreg Roach public function getDescription() { 468c2e8227SGreg Roach return /* I18N: Description of “Statistics” module */ I18N::translate('The size of the family tree, earliest and latest events, common names, etc.'); 478c2e8227SGreg Roach } 488c2e8227SGreg Roach 4976692c8bSGreg Roach /** 5076692c8bSGreg Roach * Generate the HTML content of this block. 5176692c8bSGreg Roach * 5276692c8bSGreg Roach * @param int $block_id 5376692c8bSGreg Roach * @param bool $template 54727f238cSGreg Roach * @param string[] $cfg 5576692c8bSGreg Roach * 5676692c8bSGreg Roach * @return string 5776692c8bSGreg Roach */ 5813abd6f3SGreg Roach public function getBlock($block_id, $template = true, $cfg = []) { 598c2e8227SGreg Roach global $WT_TREE, $ctype; 608c2e8227SGreg Roach 61e2a378d3SGreg Roach $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); 62e2a378d3SGreg Roach $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); 63f36626dbSGreg Roach $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES); 64e2a378d3SGreg Roach $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); 65e2a378d3SGreg Roach $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); 66e2a378d3SGreg Roach $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); 67e2a378d3SGreg Roach $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); 68e2a378d3SGreg Roach $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); 69e2a378d3SGreg Roach $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); 70e2a378d3SGreg Roach $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); 71e2a378d3SGreg Roach $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); 72e2a378d3SGreg Roach $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); 73e2a378d3SGreg Roach $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); 74e2a378d3SGreg Roach $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); 75e2a378d3SGreg Roach $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); 76e2a378d3SGreg Roach $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); 77e2a378d3SGreg Roach $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); 78e2a378d3SGreg Roach $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); 79e2a378d3SGreg Roach $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); 808c2e8227SGreg Roach 8115d603e7SGreg Roach foreach (['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'] as $name) { 828c2e8227SGreg Roach if (array_key_exists($name, $cfg)) { 838c2e8227SGreg Roach $$name = $cfg[$name]; 848c2e8227SGreg Roach } 858c2e8227SGreg Roach } 868c2e8227SGreg Roach 878c2e8227SGreg Roach $stats = new Stats($WT_TREE); 888c2e8227SGreg Roach 89d93f11b5SGreg Roach $content = ''; 908c2e8227SGreg Roach 918c2e8227SGreg Roach if ($show_last_update) { 92d93f11b5SGreg Roach $content .= '<p>' . /* I18N: %s is a date */ 93d93f11b5SGreg Roach I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</p>'; 948c2e8227SGreg Roach } 958c2e8227SGreg Roach 96d93f11b5SGreg Roach /** Responsive Design */ 978c2e8227SGreg Roach $content .= '<div class="stat-table1">'; 988c2e8227SGreg Roach if ($stat_indi) { 997a6ee1acSGreg Roach $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&ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>'; 1004a0f15aaSGreg Roach $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>'; 1014a0f15aaSGreg Roach $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>'; 1028c2e8227SGreg Roach } 1038c2e8227SGreg Roach if ($stat_surname) { 1044b9ff166SGreg Roach $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&surname_sublist=yes&ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>'; 1058c2e8227SGreg Roach } 1068c2e8227SGreg Roach if ($stat_fam) { 1074b9ff166SGreg Roach $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>'; 1088c2e8227SGreg Roach } 1098c2e8227SGreg Roach if ($stat_sour) { 1104b9ff166SGreg Roach $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>'; 1118c2e8227SGreg Roach } 1128c2e8227SGreg Roach if ($stat_media) { 1134b9ff166SGreg Roach $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>'; 1148c2e8227SGreg Roach } 1158c2e8227SGreg Roach if ($stat_repo) { 1164b9ff166SGreg Roach $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>'; 1178c2e8227SGreg Roach } 1188c2e8227SGreg Roach if ($stat_events) { 1198c2e8227SGreg Roach $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>'; 1208c2e8227SGreg Roach } 1218c2e8227SGreg Roach if ($stat_users) { 1228c2e8227SGreg Roach $content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total users') . '</div><div class="facts_value stats_value stat-cell">'; 1234b9ff166SGreg Roach if (Auth::isManager($WT_TREE)) { 1248c2e8227SGreg Roach $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>'; 1258c2e8227SGreg Roach } else { 1268c2e8227SGreg Roach $content .= $stats->totalUsers(); 1278c2e8227SGreg Roach } 1288c2e8227SGreg Roach $content .= '</div></div>'; 1298c2e8227SGreg Roach } 1308c2e8227SGreg Roach $content .= '</div><div class="facts_table stat-table2">'; 1318c2e8227SGreg Roach if ($stat_first_birth) { 1328c2e8227SGreg Roach $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>'; 1338c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>'; 1348c2e8227SGreg Roach $content .= '</div>'; 1358c2e8227SGreg Roach } 1368c2e8227SGreg Roach if ($stat_last_birth) { 1378c2e8227SGreg Roach $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>'; 1388c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>'; 1398c2e8227SGreg Roach $content .= '</div>'; 1408c2e8227SGreg Roach } 1418c2e8227SGreg Roach if ($stat_first_death) { 1428c2e8227SGreg Roach $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>'; 1438c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>'; 1448c2e8227SGreg Roach $content .= '</div>'; 1458c2e8227SGreg Roach } 1468c2e8227SGreg Roach if ($stat_last_death) { 1478c2e8227SGreg Roach $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>'; 1488c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>'; 1498c2e8227SGreg Roach $content .= '</div>'; 1508c2e8227SGreg Roach } 1518c2e8227SGreg Roach if ($stat_long_life) { 1527820e4d7SGreg Roach $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>'; 1537820e4d7SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->longestLife() . '</div>'; 1548c2e8227SGreg Roach $content .= '</div>'; 1558c2e8227SGreg Roach } 1568c2e8227SGreg Roach if ($stat_avg_life) { 1578c2e8227SGreg Roach $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>'; 1588c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ': ' . $stats->averageLifespanMale(); 1598c2e8227SGreg Roach $content .= ' ' . I18N::translate('Females') . ': ' . $stats->averageLifespanFemale() . '</div>'; 1608c2e8227SGreg Roach $content .= '</div>'; 1618c2e8227SGreg Roach } 1628c2e8227SGreg Roach 16315d603e7SGreg Roach if ($stat_most_chil) { 1648c2e8227SGreg Roach $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>'; 1658c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>'; 1668c2e8227SGreg Roach $content .= '</div>'; 1678c2e8227SGreg Roach } 1688c2e8227SGreg Roach if ($stat_avg_chil) { 1698c2e8227SGreg Roach $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>'; 1708c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left"></div>'; 1710fd21fdaSmakitso $content .= '</div>'; 1728c2e8227SGreg Roach } 17328941e3cSGreg Roach $content .= '</div>'; 174e85991caSGreg Roach 1758c2e8227SGreg Roach if ($show_common_surnames) { 176f36626dbSGreg Roach $surnames = FunctionsDb::getTopSurnames($WT_TREE->getTreeId(), 0, (int) $number_of_surnames); 177e0275e5bSGreg Roach 17813abd6f3SGreg Roach $all_surnames = []; 179f36626dbSGreg Roach foreach (array_keys($surnames) as $surname) { 180f36626dbSGreg Roach $all_surnames = array_merge($all_surnames, QueryName::surnames($WT_TREE, $surname, '', false, false)); 181f36626dbSGreg Roach } 182f36626dbSGreg Roach 183f36626dbSGreg Roach if (!empty($surnames)) { 184f36626dbSGreg Roach ksort($all_surnames); 185e0275e5bSGreg Roach $content .= '<div class="clearfloat">'; 186d93f11b5SGreg Roach $content .= '<p>'; 187d93f11b5SGreg Roach $content .= '<strong>' . I18N::translate('Most common surnames') . '</strong>'; 188d93f11b5SGreg Roach $content .= '<br>'; 189f36626dbSGreg Roach $content .= '<span class="common_surnames">' . FunctionsPrintLists::surnameList($all_surnames, 2, false, 'indilist.php', $WT_TREE) . '</span>'; 190d93f11b5SGreg Roach $content .= '</p>'; 191e0275e5bSGreg Roach $content .= '</div>'; 1928c2e8227SGreg Roach } 1938c2e8227SGreg Roach } 19428941e3cSGreg Roach 1958c2e8227SGreg Roach if ($template) { 196*9c6524dcSGreg Roach if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { 197*9c6524dcSGreg Roach $config_url = Html::url('block_edit.php', ['block_id' => $block_id, 'ged' => $WT_TREE->getName()]); 198*9c6524dcSGreg Roach } else { 199*9c6524dcSGreg Roach $config_url = ''; 200*9c6524dcSGreg Roach } 201*9c6524dcSGreg Roach 202*9c6524dcSGreg Roach return View::make('blocks/template', [ 203*9c6524dcSGreg Roach 'block' => str_replace('_', '-', $this->getName()), 204*9c6524dcSGreg Roach 'id' => $block_id, 205*9c6524dcSGreg Roach 'config_url' => $config_url, 206*9c6524dcSGreg Roach 'title' => $this->getTitle(), 207*9c6524dcSGreg Roach 'content' => $content, 208*9c6524dcSGreg Roach ]); 2098c2e8227SGreg Roach } else { 2108c2e8227SGreg Roach return $content; 2118c2e8227SGreg Roach } 2128c2e8227SGreg Roach } 2138c2e8227SGreg Roach 2148c2e8227SGreg Roach /** {@inheritdoc} */ 2158c2e8227SGreg Roach public function loadAjax() { 2168c2e8227SGreg Roach return true; 2178c2e8227SGreg Roach } 2188c2e8227SGreg Roach 2198c2e8227SGreg Roach /** {@inheritdoc} */ 2208c2e8227SGreg Roach public function isUserBlock() { 2218c2e8227SGreg Roach return true; 2228c2e8227SGreg Roach } 2238c2e8227SGreg Roach 2248c2e8227SGreg Roach /** {@inheritdoc} */ 2258c2e8227SGreg Roach public function isGedcomBlock() { 2268c2e8227SGreg Roach return true; 2278c2e8227SGreg Roach } 2288c2e8227SGreg Roach 22976692c8bSGreg Roach /** 23076692c8bSGreg Roach * An HTML form to edit block settings 23176692c8bSGreg Roach * 23276692c8bSGreg Roach * @param int $block_id 23376692c8bSGreg Roach */ 2348c2e8227SGreg Roach public function configureBlock($block_id) { 2358c2e8227SGreg Roach if (Filter::postBool('save') && Filter::checkCsrf()) { 236e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'show_last_update', Filter::postBool('show_last_update')); 237e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames')); 238f36626dbSGreg Roach $this->setBlockSetting($block_id, 'number_of_surnames', Filter::postInteger('number_of_surnames')); 239e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_indi', Filter::postBool('stat_indi')); 240e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_fam', Filter::postBool('stat_fam')); 241e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_sour', Filter::postBool('stat_sour')); 242e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_other', Filter::postBool('stat_other')); 243e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_media', Filter::postBool('stat_media')); 244e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_repo', Filter::postBool('stat_repo')); 245e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_surname', Filter::postBool('stat_surname')); 246e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_events', Filter::postBool('stat_events')); 247e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_users', Filter::postBool('stat_users')); 248e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth')); 249e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth')); 250e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_first_death', Filter::postBool('stat_first_death')); 251e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_last_death', Filter::postBool('stat_last_death')); 252e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_long_life', Filter::postBool('stat_long_life')); 253e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life')); 254e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil')); 255e2a378d3SGreg Roach $this->setBlockSetting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil')); 2568c2e8227SGreg Roach } 2578c2e8227SGreg Roach 258e2a378d3SGreg Roach $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); 259e2a378d3SGreg Roach $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); 260f36626dbSGreg Roach $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES); 261e2a378d3SGreg Roach $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); 262e2a378d3SGreg Roach $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); 263e2a378d3SGreg Roach $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); 264e2a378d3SGreg Roach $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); 265e2a378d3SGreg Roach $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); 266e2a378d3SGreg Roach $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); 267e2a378d3SGreg Roach $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); 268e2a378d3SGreg Roach $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); 269e2a378d3SGreg Roach $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); 270e2a378d3SGreg Roach $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); 271e2a378d3SGreg Roach $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); 272e2a378d3SGreg Roach $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); 273e2a378d3SGreg Roach $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); 274e2a378d3SGreg Roach $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); 275e2a378d3SGreg Roach $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); 276e2a378d3SGreg Roach $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); 2778c2e8227SGreg Roach 2788c2e8227SGreg Roach ?> 27915d603e7SGreg Roach <fieldset class="form-group"> 28015d603e7SGreg Roach <div class="row"> 28115d603e7SGreg Roach <legend class="col-form-legend col-sm-3"> 28215d603e7SGreg Roach <?= I18N::translate('Last change') ?> 28315d603e7SGreg Roach </legend> 28415d603e7SGreg Roach <div class="col-sm-9"> 28515d603e7SGreg Roach <?= Bootstrap4::checkbox(/* I18N: label for yes/no option */ I18N::translate('Show date of last update'), false, ['name' => 'show_last_update', 'checked' => (bool) $show_last_update]) ?> 28615d603e7SGreg Roach </div> 28715d603e7SGreg Roach </div> 28815d603e7SGreg Roach </fieldset> 28915d603e7SGreg Roach 29015d603e7SGreg Roach <fieldset class="form-group"> 29115d603e7SGreg Roach <div class="row"> 29215d603e7SGreg Roach <legend class="col-form-legend col-sm-3"> 293564ae2d7SGreg Roach <?= I18N::translate('Statistics') ?> 29415d603e7SGreg Roach </legend> 29515d603e7SGreg Roach <div class="col-sm-9"> 29615d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Individuals'), false, ['name' => 'stat_indi', 'checked' => (bool) $stat_indi]) ?> 29715d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Total surnames'), false, ['name' => 'stat_surname', 'checked' => (bool) $stat_surname]) ?> 29815d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Families'), false, ['name' => 'stat_fam', 'checked' => (bool) $stat_fam]) ?> 29915d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Sources'), false, ['name' => 'stat_sour', 'checked' => (bool) $stat_sour]) ?> 30015d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Media objects'), false, ['name' => 'stat_media', 'checked' => (bool) $stat_media]) ?> 30115d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Repositories'), false, ['name' => 'stat_repo', 'checked' => (bool) $stat_repo]) ?> 30215d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Total events'), false, ['name' => 'stat_events', 'checked' => (bool) $stat_events]) ?> 30315d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Total users'), false, ['name' => 'stat_users', 'checked' => (bool) $stat_users]) ?> 30415d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Earliest birth year'), false, ['name' => 'stat_first_birth', 'checked' => (bool) $stat_first_birth]) ?> 30515d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Latest birth year'), false, ['name' => 'stat_last_birth', 'checked' => (bool) $stat_last_birth]) ?> 30615d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Earliest death year'), false, ['name' => 'stat_first_death', 'checked' => (bool) $stat_first_death]) ?> 30715d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Latest death year'), false, ['name' => 'stat_last_death', 'checked' => (bool) $stat_last_death]) ?> 30815d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Individual who lived the longest'), false, ['name' => 'stat_long_life', 'checked' => (bool) $stat_long_life]) ?> 30915d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Average age at death'), false, ['name' => 'stat_avg_life', 'checked' => (bool) $stat_avg_life]) ?> 31015d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Family with the most children'), false, ['name' => 'stat_most_chil', 'checked' => (bool) $stat_most_chil]) ?> 31115d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Average number of children per family'), false, ['name' => 'stat_avg_chil', 'checked' => (bool) $stat_avg_chil]) ?> 31215d603e7SGreg Roach </div> 31315d603e7SGreg Roach </div> 31415d603e7SGreg Roach </fieldset> 31515d603e7SGreg Roach 31615d603e7SGreg Roach <fieldset class="form-group"> 31715d603e7SGreg Roach <div class="row"> 31815d603e7SGreg Roach <legend class="col-form-legend col-sm-3"> 31915d603e7SGreg Roach <label for="show_common_surnames"> 32015d603e7SGreg Roach <?= I18N::translate('Surnames') ?> 3218c2e8227SGreg Roach </label> 32215d603e7SGreg Roach </legend> 32315d603e7SGreg Roach <div class="col-sm-9"> 32415d603e7SGreg Roach <?= Bootstrap4::checkbox(I18N::translate('Most common surnames'), false, ['name' => 'show_common_surnames', 'checked' => (bool) $show_common_surnames]) ?> 32515d603e7SGreg Roach <label for="number_of_surnames"> 326564ae2d7SGreg Roach <?= /* I18N: ... to show in a list */ I18N::translate('Number of surnames') ?> 327f36626dbSGreg Roach <input 32815d603e7SGreg Roach class="form-control" 32915d603e7SGreg Roach id="number_of_surnames" 330f36626dbSGreg Roach maxlength="5" 331f36626dbSGreg Roach name="number_of_surnames" 332f36626dbSGreg Roach pattern="[1-9][0-9]*" 333f36626dbSGreg Roach required 334f36626dbSGreg Roach type="text" 335cc5ab399SGreg Roach value="<?= Html::escape($number_of_surnames) ?>" 336f36626dbSGreg Roach > 33715d603e7SGreg Roach </label> 33815d603e7SGreg Roach </div> 33915d603e7SGreg Roach </div> 34015d603e7SGreg Roach </fieldset> 3418c2e8227SGreg Roach <?php 3428c2e8227SGreg Roach } 3438c2e8227SGreg Roach} 344