xref: /webtrees/app/Module/FamilyTreeStatisticsModule.php (revision 4b9ff166b3342695f2a94855b7a33368e6d55c35)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roachnamespace Fisharebest\Webtrees;
38c2e8227SGreg Roach
48c2e8227SGreg Roach/**
58c2e8227SGreg Roach * webtrees: online genealogy
68c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team
78c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify
88c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by
98c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or
108c2e8227SGreg Roach * (at your option) any later version.
118c2e8227SGreg Roach * This program is distributed in the hope that it will be useful,
128c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
138c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148c2e8227SGreg Roach * GNU General Public License for more details.
158c2e8227SGreg Roach * You should have received a copy of the GNU General Public License
168c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
178c2e8227SGreg Roach */
188c2e8227SGreg Roach
198c2e8227SGreg Roach/**
208c2e8227SGreg Roach * Class FamilyTreeStatisticsModule
218c2e8227SGreg Roach */
228c2e8227SGreg Roachclass FamilyTreeStatisticsModule extends Module implements ModuleBlockInterface {
238c2e8227SGreg Roach	/** {@inheritdoc} */
248c2e8227SGreg Roach	public function getTitle() {
258c2e8227SGreg Roach		return /* I18N: Name of a module */ I18N::translate('Statistics');
268c2e8227SGreg Roach	}
278c2e8227SGreg Roach
288c2e8227SGreg Roach	/** {@inheritdoc} */
298c2e8227SGreg Roach	public function getDescription() {
308c2e8227SGreg Roach		return /* I18N: Description of “Statistics” module */ I18N::translate('The size of the family tree, earliest and latest events, common names, etc.');
318c2e8227SGreg Roach	}
328c2e8227SGreg Roach
338c2e8227SGreg Roach	/** {@inheritdoc} */
348c2e8227SGreg Roach	public function getBlock($block_id, $template = true, $cfg = null) {
358c2e8227SGreg Roach		global $WT_TREE, $ctype;
368c2e8227SGreg Roach
378c2e8227SGreg Roach		$show_last_update     = get_block_setting($block_id, 'show_last_update', '1');
388c2e8227SGreg Roach		$show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
398c2e8227SGreg Roach		$stat_indi            = get_block_setting($block_id, 'stat_indi', '1');
408c2e8227SGreg Roach		$stat_fam             = get_block_setting($block_id, 'stat_fam', '1');
418c2e8227SGreg Roach		$stat_sour            = get_block_setting($block_id, 'stat_sour', '1');
428c2e8227SGreg Roach		$stat_media           = get_block_setting($block_id, 'stat_media', '1');
438c2e8227SGreg Roach		$stat_repo            = get_block_setting($block_id, 'stat_repo', '1');
448c2e8227SGreg Roach		$stat_surname         = get_block_setting($block_id, 'stat_surname', '1');
458c2e8227SGreg Roach		$stat_events          = get_block_setting($block_id, 'stat_events', '1');
468c2e8227SGreg Roach		$stat_users           = get_block_setting($block_id, 'stat_users', '1');
478c2e8227SGreg Roach		$stat_first_birth     = get_block_setting($block_id, 'stat_first_birth', '1');
488c2e8227SGreg Roach		$stat_last_birth      = get_block_setting($block_id, 'stat_last_birth', '1');
498c2e8227SGreg Roach		$stat_first_death     = get_block_setting($block_id, 'stat_first_death', '1');
508c2e8227SGreg Roach		$stat_last_death      = get_block_setting($block_id, 'stat_last_death', '1');
518c2e8227SGreg Roach		$stat_long_life       = get_block_setting($block_id, 'stat_long_life', '1');
528c2e8227SGreg Roach		$stat_avg_life        = get_block_setting($block_id, 'stat_avg_life', '1');
538c2e8227SGreg Roach		$stat_most_chil       = get_block_setting($block_id, 'stat_most_chil', '1');
548c2e8227SGreg Roach		$stat_avg_chil        = get_block_setting($block_id, 'stat_avg_chil', '1');
558c2e8227SGreg Roach
568c2e8227SGreg Roach		// This can be overriden when embedding in an HTML block
578c2e8227SGreg Roach		$block     = '0';
588c2e8227SGreg Roach		$stat_link = '1';
598c2e8227SGreg Roach
608c2e8227SGreg Roach		if ($cfg) {
618c2e8227SGreg Roach			foreach (array('show_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', 'stat_link', 'block') as $name) {
628c2e8227SGreg Roach				if (array_key_exists($name, $cfg)) {
638c2e8227SGreg Roach					$$name = $cfg[$name];
648c2e8227SGreg Roach				}
658c2e8227SGreg Roach			}
668c2e8227SGreg Roach		}
678c2e8227SGreg Roach
688c2e8227SGreg Roach		$id = $this->getName() . $block_id;
698c2e8227SGreg Roach		$class = $this->getName() . '_block';
70*4b9ff166SGreg Roach		if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
718c2e8227SGreg Roach			$title = '<i class="icon-admin" title="' . I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
728c2e8227SGreg Roach		} else {
738c2e8227SGreg Roach			$title = '';
748c2e8227SGreg Roach		}
758c2e8227SGreg Roach		$title .= $this->getTitle();
768c2e8227SGreg Roach
778c2e8227SGreg Roach		$stats = new Stats($WT_TREE);
788c2e8227SGreg Roach
79*4b9ff166SGreg Roach		$content = '<b>' . $WT_TREE->getTitleHtml() . '</b><br>';
808c2e8227SGreg Roach
818c2e8227SGreg Roach		if ($show_last_update) {
828c2e8227SGreg Roach			$content .= '<div>' . /* I18N: %s is a date */ I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>';
838c2e8227SGreg Roach		}
848c2e8227SGreg Roach/** Responsive Design */
858c2e8227SGreg Roach
868c2e8227SGreg Roach	$content .= '<div class="stat-table1">';
878c2e8227SGreg Roach		if ($stat_indi) {
88*4b9ff166SGreg 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&amp;ged=" . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>';
898c2e8227SGreg 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() . '</a></div></div>';
908c2e8227SGreg 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() . '</a></div></div>';
918c2e8227SGreg Roach		}
928c2e8227SGreg Roach		if ($stat_surname) {
93*4b9ff166SGreg 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&amp;surname_sublist=yes&amp;ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>';
948c2e8227SGreg Roach		}
958c2e8227SGreg Roach		if ($stat_fam) {
96*4b9ff166SGreg 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>';
978c2e8227SGreg Roach		}
988c2e8227SGreg Roach		if ($stat_sour) {
99*4b9ff166SGreg 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>';
1008c2e8227SGreg Roach		}
1018c2e8227SGreg Roach		if ($stat_media) {
102*4b9ff166SGreg 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>';
1038c2e8227SGreg Roach		}
1048c2e8227SGreg Roach		if ($stat_repo) {
105*4b9ff166SGreg 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>';
1068c2e8227SGreg Roach		}
1078c2e8227SGreg Roach		if ($stat_events) {
1088c2e8227SGreg 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>';
1098c2e8227SGreg Roach		}
1108c2e8227SGreg Roach		if ($stat_users) {
1118c2e8227SGreg 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">';
112*4b9ff166SGreg Roach			if (Auth::isManager($WT_TREE)) {
1138c2e8227SGreg Roach				$content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>';
1148c2e8227SGreg Roach			} else {
1158c2e8227SGreg Roach				$content .= $stats->totalUsers();
1168c2e8227SGreg Roach			}
1178c2e8227SGreg Roach			$content .= '</div></div>';
1188c2e8227SGreg Roach		}
1198c2e8227SGreg Roach		if (!$block) {
1208c2e8227SGreg Roach			$content .= '</div><div class="facts_table stat-table2">';
1218c2e8227SGreg Roach		}
1228c2e8227SGreg Roach		if ($stat_first_birth) {
1238c2e8227SGreg 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>';
1248c2e8227SGreg Roach			if (!$block) {
1258c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>';
1268c2e8227SGreg Roach			}
1278c2e8227SGreg Roach			$content .= '</div>';
1288c2e8227SGreg Roach		}
1298c2e8227SGreg Roach		if ($stat_last_birth) {
1308c2e8227SGreg 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>';
1318c2e8227SGreg Roach			if (!$block) {
1328c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>';
1338c2e8227SGreg Roach			}
1348c2e8227SGreg Roach			$content .= '</div>';
1358c2e8227SGreg Roach		}
1368c2e8227SGreg Roach		if ($stat_first_death) {
1378c2e8227SGreg 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>';
1388c2e8227SGreg Roach			if (!$block) {
1398c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>';
1408c2e8227SGreg Roach			}
1418c2e8227SGreg Roach			$content .= '</div>';
1428c2e8227SGreg Roach		}
1438c2e8227SGreg Roach		if ($stat_last_death) {
1448c2e8227SGreg 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>';
1458c2e8227SGreg Roach			if (!$block) {
1468c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>';
1478c2e8227SGreg Roach			}
1488c2e8227SGreg Roach			$content .= '</div>';
1498c2e8227SGreg Roach		}
1508c2e8227SGreg Roach		if ($stat_long_life) {
1518c2e8227SGreg 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>';
1528c2e8227SGreg Roach			if (!$block) {
1538c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->LongestLife() . '</div>';
1548c2e8227SGreg Roach			}
1558c2e8227SGreg Roach			$content .= '</div>';
1568c2e8227SGreg Roach		}
1578c2e8227SGreg Roach		if ($stat_avg_life) {
1588c2e8227SGreg 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>';
1598c2e8227SGreg Roach			if (!$block) {
1608c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ':&nbsp;' . $stats->averageLifespanMale();
1618c2e8227SGreg Roach				$content .= '&nbsp;&nbsp;&nbsp;' . I18N::translate('Females') . ':&nbsp;' . $stats->averageLifespanFemale() . '</div>';
1628c2e8227SGreg Roach			}
1638c2e8227SGreg Roach			$content .= '</div>';
1648c2e8227SGreg Roach		}
1658c2e8227SGreg Roach
1668c2e8227SGreg Roach		if ($stat_most_chil && !$block) {
1678c2e8227SGreg 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>';
1688c2e8227SGreg Roach			if (!$block) {
1698c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>';
1708c2e8227SGreg Roach			}
1718c2e8227SGreg Roach			$content .= '</div>';
1728c2e8227SGreg Roach		}
1738c2e8227SGreg Roach		if ($stat_avg_chil) {
1748c2e8227SGreg 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>';
1758c2e8227SGreg Roach			if (!$block) {
1768c2e8227SGreg Roach				$content .= '<div class="facts_value stat-cell left"></div>';
1778c2e8227SGreg Roach			}
1780fd21fdaSmakitso			$content .= '</div>';
1798c2e8227SGreg Roach		}
1808c2e8227SGreg Roach		if ($stat_link) {
181*4b9ff166SGreg Roach			$content .= '</div><div class="clearfloat"><a href="statistics.php?ged=' . $WT_TREE->getNameUrl() . '"><b>' . I18N::translate('View statistics as graphs') . '</b></a></div>';
1828c2e8227SGreg Roach		}
1838c2e8227SGreg Roach		// NOTE: Print the most common surnames
1848c2e8227SGreg Roach		if ($show_common_surnames) {
1858c2e8227SGreg Roach			$surnames = get_common_surnames($WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'), $WT_TREE);
1868c2e8227SGreg Roach			if (count($surnames) > 0) {
1878c2e8227SGreg Roach				$content .= '<p><b>' . I18N::translate('Most common surnames') . '</b></p>';
1888c2e8227SGreg Roach				$content .= '<div class="common_surnames">';
1898c2e8227SGreg Roach				$i = 0;
1908c2e8227SGreg Roach				foreach ($surnames as $indexval => $surname) {
1918c2e8227SGreg Roach					if (stristr($surname['name'], '@N.N') === false) {
1928c2e8227SGreg Roach						if ($i > 0) {
1938c2e8227SGreg Roach							$content .= ', ';
1948c2e8227SGreg Roach						}
195*4b9ff166SGreg Roach						$content .= '<a href="' . "indilist.php?ged=" . $WT_TREE->getNameUrl() . "&amp;surname=" . rawurlencode($surname['name']) . '">' . $surname['name'] . '</a>';
1968c2e8227SGreg Roach						$i++;
1978c2e8227SGreg Roach					}
1988c2e8227SGreg Roach				}
1998c2e8227SGreg Roach			}
2008c2e8227SGreg Roach		}
2018c2e8227SGreg Roach
2028c2e8227SGreg Roach		if ($template) {
2038c2e8227SGreg Roach			return Theme::theme()->formatBlock($id, $title, $class, $content);
2048c2e8227SGreg Roach		} else {
2058c2e8227SGreg Roach			return $content;
2068c2e8227SGreg Roach		}
2078c2e8227SGreg Roach	}
2088c2e8227SGreg Roach
2098c2e8227SGreg Roach	/** {@inheritdoc} */
2108c2e8227SGreg Roach	public function loadAjax() {
2118c2e8227SGreg Roach		return true;
2128c2e8227SGreg Roach	}
2138c2e8227SGreg Roach
2148c2e8227SGreg Roach	/** {@inheritdoc} */
2158c2e8227SGreg Roach	public function isUserBlock() {
2168c2e8227SGreg Roach		return true;
2178c2e8227SGreg Roach	}
2188c2e8227SGreg Roach
2198c2e8227SGreg Roach	/** {@inheritdoc} */
2208c2e8227SGreg Roach	public function isGedcomBlock() {
2218c2e8227SGreg Roach		return true;
2228c2e8227SGreg Roach	}
2238c2e8227SGreg Roach
2248c2e8227SGreg Roach	/** {@inheritdoc} */
2258c2e8227SGreg Roach	public function configureBlock($block_id) {
2268c2e8227SGreg Roach		if (Filter::postBool('save') && Filter::checkCsrf()) {
2278c2e8227SGreg Roach			set_block_setting($block_id, 'show_last_update', Filter::postBool('show_last_update'));
2288c2e8227SGreg Roach			set_block_setting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames'));
2298c2e8227SGreg Roach			set_block_setting($block_id, 'stat_indi', Filter::postBool('stat_indi'));
2308c2e8227SGreg Roach			set_block_setting($block_id, 'stat_fam', Filter::postBool('stat_fam'));
2318c2e8227SGreg Roach			set_block_setting($block_id, 'stat_sour', Filter::postBool('stat_sour'));
2328c2e8227SGreg Roach			set_block_setting($block_id, 'stat_other', Filter::postBool('stat_other'));
2338c2e8227SGreg Roach			set_block_setting($block_id, 'stat_media', Filter::postBool('stat_media'));
2348c2e8227SGreg Roach			set_block_setting($block_id, 'stat_repo', Filter::postBool('stat_repo'));
2358c2e8227SGreg Roach			set_block_setting($block_id, 'stat_surname', Filter::postBool('stat_surname'));
2368c2e8227SGreg Roach			set_block_setting($block_id, 'stat_events', Filter::postBool('stat_events'));
2378c2e8227SGreg Roach			set_block_setting($block_id, 'stat_users', Filter::postBool('stat_users'));
2388c2e8227SGreg Roach			set_block_setting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth'));
2398c2e8227SGreg Roach			set_block_setting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth'));
2408c2e8227SGreg Roach			set_block_setting($block_id, 'stat_first_death', Filter::postBool('stat_first_death'));
2418c2e8227SGreg Roach			set_block_setting($block_id, 'stat_last_death', Filter::postBool('stat_last_death'));
2428c2e8227SGreg Roach			set_block_setting($block_id, 'stat_long_life', Filter::postBool('stat_long_life'));
2438c2e8227SGreg Roach			set_block_setting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life'));
2448c2e8227SGreg Roach			set_block_setting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil'));
2458c2e8227SGreg Roach			set_block_setting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil'));
2468c2e8227SGreg Roach		}
2478c2e8227SGreg Roach
2488c2e8227SGreg Roach		$show_last_update     = get_block_setting($block_id, 'show_last_update', '1');
2498c2e8227SGreg Roach		$show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1');
2508c2e8227SGreg Roach		$stat_indi            = get_block_setting($block_id, 'stat_indi', '1');
2518c2e8227SGreg Roach		$stat_fam             = get_block_setting($block_id, 'stat_fam', '1');
2528c2e8227SGreg Roach		$stat_sour            = get_block_setting($block_id, 'stat_sour', '1');
2538c2e8227SGreg Roach		$stat_media           = get_block_setting($block_id, 'stat_media', '1');
2548c2e8227SGreg Roach		$stat_repo            = get_block_setting($block_id, 'stat_repo', '1');
2558c2e8227SGreg Roach		$stat_surname         = get_block_setting($block_id, 'stat_surname', '1');
2568c2e8227SGreg Roach		$stat_events          = get_block_setting($block_id, 'stat_events', '1');
2578c2e8227SGreg Roach		$stat_users           = get_block_setting($block_id, 'stat_users', '1');
2588c2e8227SGreg Roach		$stat_first_birth     = get_block_setting($block_id, 'stat_first_birth', '1');
2598c2e8227SGreg Roach		$stat_last_birth      = get_block_setting($block_id, 'stat_last_birth', '1');
2608c2e8227SGreg Roach		$stat_first_death     = get_block_setting($block_id, 'stat_first_death', '1');
2618c2e8227SGreg Roach		$stat_last_death      = get_block_setting($block_id, 'stat_last_death', '1');
2628c2e8227SGreg Roach		$stat_long_life       = get_block_setting($block_id, 'stat_long_life', '1');
2638c2e8227SGreg Roach		$stat_avg_life        = get_block_setting($block_id, 'stat_avg_life', '1');
2648c2e8227SGreg Roach		$stat_most_chil       = get_block_setting($block_id, 'stat_most_chil', '1');
2658c2e8227SGreg Roach		$stat_avg_chil        = get_block_setting($block_id, 'stat_avg_chil', '1');
2668c2e8227SGreg Roach
2678c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2688c2e8227SGreg Roach		echo /* I18N: label for yes/no option */ I18N::translate('Show date of last update?');
2698c2e8227SGreg Roach		echo '</td><td class="optionbox">';
2708c2e8227SGreg Roach		echo edit_field_yes_no('show_last_update', $show_last_update);
2718c2e8227SGreg Roach		echo '</td></tr>';
2728c2e8227SGreg Roach
2738c2e8227SGreg Roach		echo '<tr><td class="descriptionbox wrap width33">';
2748c2e8227SGreg Roach		echo I18N::translate('Show common surnames?');
2758c2e8227SGreg Roach		echo '</td><td class="optionbox">';
2768c2e8227SGreg Roach		echo edit_field_yes_no('show_common_surnames', $show_common_surnames);
2778c2e8227SGreg Roach		echo '</td></tr>';
2788c2e8227SGreg Roach
2798c2e8227SGreg Roach?>
2808c2e8227SGreg Roach	<tr>
2818c2e8227SGreg Roach	<td class="descriptionbox wrap width33"><?php echo I18N::translate('Select the stats to show in this block'); ?></td>
2828c2e8227SGreg Roach	<td class="optionbox">
2838c2e8227SGreg Roach	<table>
2848c2e8227SGreg Roach		<tbody>
2858c2e8227SGreg Roach			<tr>
2868c2e8227SGreg Roach				<td>
2878c2e8227SGreg Roach					<label>
2888c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_indi" <?php echo $stat_indi ? 'checked' : ''; ?>>
2898c2e8227SGreg Roach						<?php echo I18N::translate('Individuals'); ?>
2908c2e8227SGreg Roach					</label>
2918c2e8227SGreg Roach				</td>
2928c2e8227SGreg Roach				<td>
2938c2e8227SGreg Roach					<label>
2948c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_first_birth" <?php echo $stat_first_birth ? 'checked' : ''; ?>>
2958c2e8227SGreg Roach						<?php echo I18N::translate('Earliest birth year'); ?>
2968c2e8227SGreg Roach					</label>
2978c2e8227SGreg Roach				</td>
2988c2e8227SGreg Roach			</tr>
2998c2e8227SGreg Roach			<tr>
3008c2e8227SGreg Roach				<td>
3018c2e8227SGreg Roach					<label>
3028c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_surname" <?php echo $stat_surname ? 'checked' : ''; ?>>
3038c2e8227SGreg Roach						<?php echo I18N::translate('Total surnames'); ?>
3048c2e8227SGreg Roach					</label>
3058c2e8227SGreg Roach				</td>
3068c2e8227SGreg Roach				<td>
3078c2e8227SGreg Roach					<label>
3088c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_last_birth" <?php echo $stat_last_birth ? 'checked' : ''; ?>>
3098c2e8227SGreg Roach						<?php echo I18N::translate('Latest birth year'); ?>
3108c2e8227SGreg Roach					</label>
3118c2e8227SGreg Roach				</td>
3128c2e8227SGreg Roach			</tr>
3138c2e8227SGreg Roach			<tr>
3148c2e8227SGreg Roach				<td>
3158c2e8227SGreg Roach					<label>
3168c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_fam" <?php echo $stat_fam ? 'checked' : ''; ?>>
3178c2e8227SGreg Roach						<?php echo I18N::translate('Families'); ?>
3188c2e8227SGreg Roach					</label>
3198c2e8227SGreg Roach				</td>
3208c2e8227SGreg Roach				<td>
3218c2e8227SGreg Roach					<label>
3228c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_first_death" <?php echo $stat_first_death ? 'checked' : ''; ?>>
3238c2e8227SGreg Roach						<?php echo I18N::translate('Earliest death year'); ?>
3248c2e8227SGreg Roach					</label>
3258c2e8227SGreg Roach				</td>
3268c2e8227SGreg Roach			</tr>
3278c2e8227SGreg Roach			<tr>
3288c2e8227SGreg Roach				<td>
3298c2e8227SGreg Roach					<label>
3308c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_sour" <?php echo $stat_sour ? 'checked' : ''; ?>>
3318c2e8227SGreg Roach						<?php echo I18N::translate('Sources'); ?>
3328c2e8227SGreg Roach					</label>
3338c2e8227SGreg Roach				</td>
3348c2e8227SGreg Roach				<td>
3358c2e8227SGreg Roach					<label>
3368c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_last_death" <?php echo $stat_last_death ? 'checked' : ''; ?>>
3378c2e8227SGreg Roach						<?php echo I18N::translate('Latest death year'); ?>
3388c2e8227SGreg Roach					</label>
3398c2e8227SGreg Roach				</td>
3408c2e8227SGreg Roach			</tr>
3418c2e8227SGreg Roach			<tr>
3428c2e8227SGreg Roach				<td>
3438c2e8227SGreg Roach					<label>
3448c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_media" <?php echo $stat_media ? 'checked' : ''; ?>>
3458c2e8227SGreg Roach						<?php echo I18N::translate('Media objects'); ?>
3468c2e8227SGreg Roach					</label>
3478c2e8227SGreg Roach				</td>
3488c2e8227SGreg Roach				<td>
3498c2e8227SGreg Roach					<label>
3508c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_long_life" <?php echo $stat_long_life ? 'checked' : ''; ?>>
3518c2e8227SGreg Roach						<?php echo I18N::translate('Individual who lived the longest'); ?>
3528c2e8227SGreg Roach					</label>
3538c2e8227SGreg Roach				</td>
3548c2e8227SGreg Roach			</tr>
3558c2e8227SGreg Roach			<tr>
3568c2e8227SGreg Roach				<td>
3578c2e8227SGreg Roach					<label>
3588c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_repo" <?php echo $stat_repo ? 'checked' : ''; ?>>
3598c2e8227SGreg Roach						<?php echo I18N::translate('Repositories'); ?>
3608c2e8227SGreg Roach					</label>
3618c2e8227SGreg Roach				</td>
3628c2e8227SGreg Roach				<td>
3638c2e8227SGreg Roach					<label>
3648c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_avg_life" <?php echo $stat_avg_life ? 'checked' : ''; ?>>
3658c2e8227SGreg Roach						<?php echo I18N::translate('Average age at death'); ?>
3668c2e8227SGreg Roach					</label>
3678c2e8227SGreg Roach				</td>
3688c2e8227SGreg Roach			</tr>
3698c2e8227SGreg Roach			<tr>
3708c2e8227SGreg Roach				<td>
3718c2e8227SGreg Roach					<label>
3728c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_events" <?php echo $stat_events ? 'checked' : ''; ?>>
3738c2e8227SGreg Roach						<?php echo I18N::translate('Total events'); ?>
3748c2e8227SGreg Roach					</label>
3758c2e8227SGreg Roach				</td>
3768c2e8227SGreg Roach				<td>
3778c2e8227SGreg Roach					<label>
3788c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_most_chil" <?php echo $stat_most_chil ? 'checked' : ''; ?>>
3798c2e8227SGreg Roach						<?php echo I18N::translate('Family with the most children'); ?>
3808c2e8227SGreg Roach					</label>
3818c2e8227SGreg Roach				</td>
3828c2e8227SGreg Roach			</tr>
3838c2e8227SGreg Roach			<tr>
3848c2e8227SGreg Roach				<td>
3858c2e8227SGreg Roach					<label>
3868c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_users" <?php echo $stat_users ? 'checked' : ''; ?>>
3878c2e8227SGreg Roach						<?php echo I18N::translate('Total users'); ?>
3888c2e8227SGreg Roach					</label>
3898c2e8227SGreg Roach				</td>
3908c2e8227SGreg Roach				<td>
3918c2e8227SGreg Roach					<label>
3928c2e8227SGreg Roach						<input type="checkbox" value="yes" name="stat_avg_chil" <?php echo $stat_avg_chil ? 'checked' : ''; ?>>
3938c2e8227SGreg Roach						<?php echo I18N::translate('Average number of children per family'); ?>
3948c2e8227SGreg Roach					</label>
3958c2e8227SGreg Roach				</td>
3968c2e8227SGreg Roach			</tr>
3978c2e8227SGreg Roach		</tbody>
3988c2e8227SGreg Roach	</table>
3998c2e8227SGreg Roach	</td>
4008c2e8227SGreg Roach	</tr>
4018c2e8227SGreg Roach	<?php
4028c2e8227SGreg Roach	}
4038c2e8227SGreg Roach}
404