1*8c2e8227SGreg Roach<?php 2*8c2e8227SGreg Roachnamespace Fisharebest\Webtrees; 3*8c2e8227SGreg Roach 4*8c2e8227SGreg Roach/** 5*8c2e8227SGreg Roach * webtrees: online genealogy 6*8c2e8227SGreg Roach * Copyright (C) 2015 webtrees development team 7*8c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 8*8c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 9*8c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 10*8c2e8227SGreg Roach * (at your option) any later version. 11*8c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 12*8c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 13*8c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*8c2e8227SGreg Roach * GNU General Public License for more details. 15*8c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 16*8c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 17*8c2e8227SGreg Roach */ 18*8c2e8227SGreg Roach 19*8c2e8227SGreg Roach/** 20*8c2e8227SGreg Roach * Class FamilyTreeStatisticsModule 21*8c2e8227SGreg Roach */ 22*8c2e8227SGreg Roachclass FamilyTreeStatisticsModule extends Module implements ModuleBlockInterface { 23*8c2e8227SGreg Roach /** {@inheritdoc} */ 24*8c2e8227SGreg Roach public function getTitle() { 25*8c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('Statistics'); 26*8c2e8227SGreg Roach } 27*8c2e8227SGreg Roach 28*8c2e8227SGreg Roach /** {@inheritdoc} */ 29*8c2e8227SGreg Roach public function getDescription() { 30*8c2e8227SGreg Roach return /* I18N: Description of “Statistics” module */ I18N::translate('The size of the family tree, earliest and latest events, common names, etc.'); 31*8c2e8227SGreg Roach } 32*8c2e8227SGreg Roach 33*8c2e8227SGreg Roach /** {@inheritdoc} */ 34*8c2e8227SGreg Roach public function getBlock($block_id, $template = true, $cfg = null) { 35*8c2e8227SGreg Roach global $WT_TREE, $ctype; 36*8c2e8227SGreg Roach 37*8c2e8227SGreg Roach $show_last_update = get_block_setting($block_id, 'show_last_update', '1'); 38*8c2e8227SGreg Roach $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1'); 39*8c2e8227SGreg Roach $stat_indi = get_block_setting($block_id, 'stat_indi', '1'); 40*8c2e8227SGreg Roach $stat_fam = get_block_setting($block_id, 'stat_fam', '1'); 41*8c2e8227SGreg Roach $stat_sour = get_block_setting($block_id, 'stat_sour', '1'); 42*8c2e8227SGreg Roach $stat_media = get_block_setting($block_id, 'stat_media', '1'); 43*8c2e8227SGreg Roach $stat_repo = get_block_setting($block_id, 'stat_repo', '1'); 44*8c2e8227SGreg Roach $stat_surname = get_block_setting($block_id, 'stat_surname', '1'); 45*8c2e8227SGreg Roach $stat_events = get_block_setting($block_id, 'stat_events', '1'); 46*8c2e8227SGreg Roach $stat_users = get_block_setting($block_id, 'stat_users', '1'); 47*8c2e8227SGreg Roach $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1'); 48*8c2e8227SGreg Roach $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1'); 49*8c2e8227SGreg Roach $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1'); 50*8c2e8227SGreg Roach $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1'); 51*8c2e8227SGreg Roach $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1'); 52*8c2e8227SGreg Roach $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1'); 53*8c2e8227SGreg Roach $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1'); 54*8c2e8227SGreg Roach $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1'); 55*8c2e8227SGreg Roach 56*8c2e8227SGreg Roach // This can be overriden when embedding in an HTML block 57*8c2e8227SGreg Roach $block = '0'; 58*8c2e8227SGreg Roach $stat_link = '1'; 59*8c2e8227SGreg Roach 60*8c2e8227SGreg Roach if ($cfg) { 61*8c2e8227SGreg 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) { 62*8c2e8227SGreg Roach if (array_key_exists($name, $cfg)) { 63*8c2e8227SGreg Roach $$name = $cfg[$name]; 64*8c2e8227SGreg Roach } 65*8c2e8227SGreg Roach } 66*8c2e8227SGreg Roach } 67*8c2e8227SGreg Roach 68*8c2e8227SGreg Roach $id = $this->getName() . $block_id; 69*8c2e8227SGreg Roach $class = $this->getName() . '_block'; 70*8c2e8227SGreg Roach if ($ctype === 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype === 'user' && Auth::check()) { 71*8c2e8227SGreg Roach $title = '<i class="icon-admin" title="' . I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; 72*8c2e8227SGreg Roach } else { 73*8c2e8227SGreg Roach $title = ''; 74*8c2e8227SGreg Roach } 75*8c2e8227SGreg Roach $title .= $this->getTitle(); 76*8c2e8227SGreg Roach 77*8c2e8227SGreg Roach $stats = new Stats($WT_TREE); 78*8c2e8227SGreg Roach 79*8c2e8227SGreg Roach $content = '<b>' . WT_TREE_TITLE . '</b><br>'; 80*8c2e8227SGreg Roach 81*8c2e8227SGreg Roach if ($show_last_update) { 82*8c2e8227SGreg Roach $content .= '<div>' . /* I18N: %s is a date */ I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>'; 83*8c2e8227SGreg Roach } 84*8c2e8227SGreg Roach/** Responsive Design */ 85*8c2e8227SGreg Roach 86*8c2e8227SGreg Roach $content .= '<div class="stat-table1">'; 87*8c2e8227SGreg Roach if ($stat_indi) { 88*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalIndividuals() . '</a></div></div>'; 89*8c2e8227SGreg 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>'; 90*8c2e8227SGreg 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>'; 91*8c2e8227SGreg Roach } 92*8c2e8227SGreg Roach if ($stat_surname) { 93*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalSurnames() . '</a></div></div>'; 94*8c2e8227SGreg Roach } 95*8c2e8227SGreg Roach if ($stat_fam) { 96*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalFamilies() . '</a></div></div>'; 97*8c2e8227SGreg Roach } 98*8c2e8227SGreg Roach if ($stat_sour) { 99*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalSources() . '</a></div></div>'; 100*8c2e8227SGreg Roach } 101*8c2e8227SGreg Roach if ($stat_media) { 102*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalMedia() . '</a></div></div>'; 103*8c2e8227SGreg Roach } 104*8c2e8227SGreg Roach if ($stat_repo) { 105*8c2e8227SGreg 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_GEDURL . '">' . $stats->totalRepositories() . '</a></div></div>'; 106*8c2e8227SGreg Roach } 107*8c2e8227SGreg Roach if ($stat_events) { 108*8c2e8227SGreg 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>'; 109*8c2e8227SGreg Roach } 110*8c2e8227SGreg Roach if ($stat_users) { 111*8c2e8227SGreg 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*8c2e8227SGreg Roach if (WT_USER_GEDCOM_ADMIN) { 113*8c2e8227SGreg Roach $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>'; 114*8c2e8227SGreg Roach } else { 115*8c2e8227SGreg Roach $content .= $stats->totalUsers(); 116*8c2e8227SGreg Roach } 117*8c2e8227SGreg Roach $content .= '</div></div>'; 118*8c2e8227SGreg Roach } 119*8c2e8227SGreg Roach if (!$block) { 120*8c2e8227SGreg Roach $content .= '</div><div class="facts_table stat-table2">'; 121*8c2e8227SGreg Roach } 122*8c2e8227SGreg Roach if ($stat_first_birth) { 123*8c2e8227SGreg 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>'; 124*8c2e8227SGreg Roach if (!$block) { 125*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>'; 126*8c2e8227SGreg Roach } 127*8c2e8227SGreg Roach $content .= '</div>'; 128*8c2e8227SGreg Roach } 129*8c2e8227SGreg Roach if ($stat_last_birth) { 130*8c2e8227SGreg 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>'; 131*8c2e8227SGreg Roach if (!$block) { 132*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>'; 133*8c2e8227SGreg Roach } 134*8c2e8227SGreg Roach $content .= '</div>'; 135*8c2e8227SGreg Roach } 136*8c2e8227SGreg Roach if ($stat_first_death) { 137*8c2e8227SGreg 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>'; 138*8c2e8227SGreg Roach if (!$block) { 139*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->firstDeath() . '</div>'; 140*8c2e8227SGreg Roach } 141*8c2e8227SGreg Roach $content .= '</div>'; 142*8c2e8227SGreg Roach } 143*8c2e8227SGreg Roach if ($stat_last_death) { 144*8c2e8227SGreg 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>'; 145*8c2e8227SGreg Roach if (!$block) { 146*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->lastDeath() . '</div>'; 147*8c2e8227SGreg Roach } 148*8c2e8227SGreg Roach $content .= '</div>'; 149*8c2e8227SGreg Roach } 150*8c2e8227SGreg Roach if ($stat_long_life) { 151*8c2e8227SGreg 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>'; 152*8c2e8227SGreg Roach if (!$block) { 153*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->LongestLife() . '</div>'; 154*8c2e8227SGreg Roach } 155*8c2e8227SGreg Roach $content .= '</div>'; 156*8c2e8227SGreg Roach } 157*8c2e8227SGreg Roach if ($stat_avg_life) { 158*8c2e8227SGreg 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>'; 159*8c2e8227SGreg Roach if (!$block) { 160*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . I18N::translate('Males') . ': ' . $stats->averageLifespanMale(); 161*8c2e8227SGreg Roach $content .= ' ' . I18N::translate('Females') . ': ' . $stats->averageLifespanFemale() . '</div>'; 162*8c2e8227SGreg Roach } 163*8c2e8227SGreg Roach $content .= '</div>'; 164*8c2e8227SGreg Roach } 165*8c2e8227SGreg Roach 166*8c2e8227SGreg Roach if ($stat_most_chil && !$block) { 167*8c2e8227SGreg 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>'; 168*8c2e8227SGreg Roach if (!$block) { 169*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left">' . $stats->largestFamily() . '</div>'; 170*8c2e8227SGreg Roach } 171*8c2e8227SGreg Roach $content .= '</div>'; 172*8c2e8227SGreg Roach } 173*8c2e8227SGreg Roach if ($stat_avg_chil) { 174*8c2e8227SGreg 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>'; 175*8c2e8227SGreg Roach if (!$block) { 176*8c2e8227SGreg Roach $content .= '<div class="facts_value stat-cell left"></div>'; 177*8c2e8227SGreg Roach } 178*8c2e8227SGreg Roach $content .= '</div></div>'; 179*8c2e8227SGreg Roach } 180*8c2e8227SGreg Roach if ($stat_link) { 181*8c2e8227SGreg Roach $content .= '<div class="clearfloat"><a href="statistics.php?ged=' . WT_GEDURL . '"><b>' . I18N::translate('View statistics as graphs') . '</b></a></div>'; 182*8c2e8227SGreg Roach } 183*8c2e8227SGreg Roach // NOTE: Print the most common surnames 184*8c2e8227SGreg Roach if ($show_common_surnames) { 185*8c2e8227SGreg Roach $surnames = get_common_surnames($WT_TREE->getPreference('COMMON_NAMES_THRESHOLD'), $WT_TREE); 186*8c2e8227SGreg Roach if (count($surnames) > 0) { 187*8c2e8227SGreg Roach $content .= '<p><b>' . I18N::translate('Most common surnames') . '</b></p>'; 188*8c2e8227SGreg Roach $content .= '<div class="common_surnames">'; 189*8c2e8227SGreg Roach $i = 0; 190*8c2e8227SGreg Roach foreach ($surnames as $indexval => $surname) { 191*8c2e8227SGreg Roach if (stristr($surname['name'], '@N.N') === false) { 192*8c2e8227SGreg Roach if ($i > 0) { 193*8c2e8227SGreg Roach $content .= ', '; 194*8c2e8227SGreg Roach } 195*8c2e8227SGreg Roach $content .= '<a href="' . "indilist.php?ged=" . WT_GEDURL . "&surname=" . rawurlencode($surname['name']) . '">' . $surname['name'] . '</a>'; 196*8c2e8227SGreg Roach $i++; 197*8c2e8227SGreg Roach } 198*8c2e8227SGreg Roach } 199*8c2e8227SGreg Roach $content .= '</div>'; 200*8c2e8227SGreg Roach } 201*8c2e8227SGreg Roach } 202*8c2e8227SGreg Roach 203*8c2e8227SGreg Roach if ($template) { 204*8c2e8227SGreg Roach return Theme::theme()->formatBlock($id, $title, $class, $content); 205*8c2e8227SGreg Roach } else { 206*8c2e8227SGreg Roach return $content; 207*8c2e8227SGreg Roach } 208*8c2e8227SGreg Roach } 209*8c2e8227SGreg Roach 210*8c2e8227SGreg Roach /** {@inheritdoc} */ 211*8c2e8227SGreg Roach public function loadAjax() { 212*8c2e8227SGreg Roach return true; 213*8c2e8227SGreg Roach } 214*8c2e8227SGreg Roach 215*8c2e8227SGreg Roach /** {@inheritdoc} */ 216*8c2e8227SGreg Roach public function isUserBlock() { 217*8c2e8227SGreg Roach return true; 218*8c2e8227SGreg Roach } 219*8c2e8227SGreg Roach 220*8c2e8227SGreg Roach /** {@inheritdoc} */ 221*8c2e8227SGreg Roach public function isGedcomBlock() { 222*8c2e8227SGreg Roach return true; 223*8c2e8227SGreg Roach } 224*8c2e8227SGreg Roach 225*8c2e8227SGreg Roach /** {@inheritdoc} */ 226*8c2e8227SGreg Roach public function configureBlock($block_id) { 227*8c2e8227SGreg Roach if (Filter::postBool('save') && Filter::checkCsrf()) { 228*8c2e8227SGreg Roach set_block_setting($block_id, 'show_last_update', Filter::postBool('show_last_update')); 229*8c2e8227SGreg Roach set_block_setting($block_id, 'show_common_surnames', Filter::postBool('show_common_surnames')); 230*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_indi', Filter::postBool('stat_indi')); 231*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_fam', Filter::postBool('stat_fam')); 232*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_sour', Filter::postBool('stat_sour')); 233*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_other', Filter::postBool('stat_other')); 234*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_media', Filter::postBool('stat_media')); 235*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_repo', Filter::postBool('stat_repo')); 236*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_surname', Filter::postBool('stat_surname')); 237*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_events', Filter::postBool('stat_events')); 238*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_users', Filter::postBool('stat_users')); 239*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_first_birth', Filter::postBool('stat_first_birth')); 240*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_last_birth', Filter::postBool('stat_last_birth')); 241*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_first_death', Filter::postBool('stat_first_death')); 242*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_last_death', Filter::postBool('stat_last_death')); 243*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_long_life', Filter::postBool('stat_long_life')); 244*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_avg_life', Filter::postBool('stat_avg_life')); 245*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_most_chil', Filter::postBool('stat_most_chil')); 246*8c2e8227SGreg Roach set_block_setting($block_id, 'stat_avg_chil', Filter::postBool('stat_avg_chil')); 247*8c2e8227SGreg Roach } 248*8c2e8227SGreg Roach 249*8c2e8227SGreg Roach $show_last_update = get_block_setting($block_id, 'show_last_update', '1'); 250*8c2e8227SGreg Roach $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', '1'); 251*8c2e8227SGreg Roach $stat_indi = get_block_setting($block_id, 'stat_indi', '1'); 252*8c2e8227SGreg Roach $stat_fam = get_block_setting($block_id, 'stat_fam', '1'); 253*8c2e8227SGreg Roach $stat_sour = get_block_setting($block_id, 'stat_sour', '1'); 254*8c2e8227SGreg Roach $stat_media = get_block_setting($block_id, 'stat_media', '1'); 255*8c2e8227SGreg Roach $stat_repo = get_block_setting($block_id, 'stat_repo', '1'); 256*8c2e8227SGreg Roach $stat_surname = get_block_setting($block_id, 'stat_surname', '1'); 257*8c2e8227SGreg Roach $stat_events = get_block_setting($block_id, 'stat_events', '1'); 258*8c2e8227SGreg Roach $stat_users = get_block_setting($block_id, 'stat_users', '1'); 259*8c2e8227SGreg Roach $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', '1'); 260*8c2e8227SGreg Roach $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', '1'); 261*8c2e8227SGreg Roach $stat_first_death = get_block_setting($block_id, 'stat_first_death', '1'); 262*8c2e8227SGreg Roach $stat_last_death = get_block_setting($block_id, 'stat_last_death', '1'); 263*8c2e8227SGreg Roach $stat_long_life = get_block_setting($block_id, 'stat_long_life', '1'); 264*8c2e8227SGreg Roach $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', '1'); 265*8c2e8227SGreg Roach $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', '1'); 266*8c2e8227SGreg Roach $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', '1'); 267*8c2e8227SGreg Roach 268*8c2e8227SGreg Roach echo '<tr><td class="descriptionbox wrap width33">'; 269*8c2e8227SGreg Roach echo /* I18N: label for yes/no option */ I18N::translate('Show date of last update?'); 270*8c2e8227SGreg Roach echo '</td><td class="optionbox">'; 271*8c2e8227SGreg Roach echo edit_field_yes_no('show_last_update', $show_last_update); 272*8c2e8227SGreg Roach echo '</td></tr>'; 273*8c2e8227SGreg Roach 274*8c2e8227SGreg Roach echo '<tr><td class="descriptionbox wrap width33">'; 275*8c2e8227SGreg Roach echo I18N::translate('Show common surnames?'); 276*8c2e8227SGreg Roach echo '</td><td class="optionbox">'; 277*8c2e8227SGreg Roach echo edit_field_yes_no('show_common_surnames', $show_common_surnames); 278*8c2e8227SGreg Roach echo '</td></tr>'; 279*8c2e8227SGreg Roach 280*8c2e8227SGreg Roach?> 281*8c2e8227SGreg Roach <tr> 282*8c2e8227SGreg Roach <td class="descriptionbox wrap width33"><?php echo I18N::translate('Select the stats to show in this block'); ?></td> 283*8c2e8227SGreg Roach <td class="optionbox"> 284*8c2e8227SGreg Roach <table> 285*8c2e8227SGreg Roach <tbody> 286*8c2e8227SGreg Roach <tr> 287*8c2e8227SGreg Roach <td> 288*8c2e8227SGreg Roach <label> 289*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_indi" <?php echo $stat_indi ? 'checked' : ''; ?>> 290*8c2e8227SGreg Roach <?php echo I18N::translate('Individuals'); ?> 291*8c2e8227SGreg Roach </label> 292*8c2e8227SGreg Roach </td> 293*8c2e8227SGreg Roach <td> 294*8c2e8227SGreg Roach <label> 295*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_first_birth" <?php echo $stat_first_birth ? 'checked' : ''; ?>> 296*8c2e8227SGreg Roach <?php echo I18N::translate('Earliest birth year'); ?> 297*8c2e8227SGreg Roach </label> 298*8c2e8227SGreg Roach </td> 299*8c2e8227SGreg Roach </tr> 300*8c2e8227SGreg Roach <tr> 301*8c2e8227SGreg Roach <td> 302*8c2e8227SGreg Roach <label> 303*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_surname" <?php echo $stat_surname ? 'checked' : ''; ?>> 304*8c2e8227SGreg Roach <?php echo I18N::translate('Total surnames'); ?> 305*8c2e8227SGreg Roach </label> 306*8c2e8227SGreg Roach </td> 307*8c2e8227SGreg Roach <td> 308*8c2e8227SGreg Roach <label> 309*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_last_birth" <?php echo $stat_last_birth ? 'checked' : ''; ?>> 310*8c2e8227SGreg Roach <?php echo I18N::translate('Latest birth year'); ?> 311*8c2e8227SGreg Roach </label> 312*8c2e8227SGreg Roach </td> 313*8c2e8227SGreg Roach </tr> 314*8c2e8227SGreg Roach <tr> 315*8c2e8227SGreg Roach <td> 316*8c2e8227SGreg Roach <label> 317*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_fam" <?php echo $stat_fam ? 'checked' : ''; ?>> 318*8c2e8227SGreg Roach <?php echo I18N::translate('Families'); ?> 319*8c2e8227SGreg Roach </label> 320*8c2e8227SGreg Roach </td> 321*8c2e8227SGreg Roach <td> 322*8c2e8227SGreg Roach <label> 323*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_first_death" <?php echo $stat_first_death ? 'checked' : ''; ?>> 324*8c2e8227SGreg Roach <?php echo I18N::translate('Earliest death year'); ?> 325*8c2e8227SGreg Roach </label> 326*8c2e8227SGreg Roach </td> 327*8c2e8227SGreg Roach </tr> 328*8c2e8227SGreg Roach <tr> 329*8c2e8227SGreg Roach <td> 330*8c2e8227SGreg Roach <label> 331*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_sour" <?php echo $stat_sour ? 'checked' : ''; ?>> 332*8c2e8227SGreg Roach <?php echo I18N::translate('Sources'); ?> 333*8c2e8227SGreg Roach </label> 334*8c2e8227SGreg Roach </td> 335*8c2e8227SGreg Roach <td> 336*8c2e8227SGreg Roach <label> 337*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_last_death" <?php echo $stat_last_death ? 'checked' : ''; ?>> 338*8c2e8227SGreg Roach <?php echo I18N::translate('Latest death year'); ?> 339*8c2e8227SGreg Roach </label> 340*8c2e8227SGreg Roach </td> 341*8c2e8227SGreg Roach </tr> 342*8c2e8227SGreg Roach <tr> 343*8c2e8227SGreg Roach <td> 344*8c2e8227SGreg Roach <label> 345*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_media" <?php echo $stat_media ? 'checked' : ''; ?>> 346*8c2e8227SGreg Roach <?php echo I18N::translate('Media objects'); ?> 347*8c2e8227SGreg Roach </label> 348*8c2e8227SGreg Roach </td> 349*8c2e8227SGreg Roach <td> 350*8c2e8227SGreg Roach <label> 351*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_long_life" <?php echo $stat_long_life ? 'checked' : ''; ?>> 352*8c2e8227SGreg Roach <?php echo I18N::translate('Individual who lived the longest'); ?> 353*8c2e8227SGreg Roach </label> 354*8c2e8227SGreg Roach </td> 355*8c2e8227SGreg Roach </tr> 356*8c2e8227SGreg Roach <tr> 357*8c2e8227SGreg Roach <td> 358*8c2e8227SGreg Roach <label> 359*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_repo" <?php echo $stat_repo ? 'checked' : ''; ?>> 360*8c2e8227SGreg Roach <?php echo I18N::translate('Repositories'); ?> 361*8c2e8227SGreg Roach </label> 362*8c2e8227SGreg Roach </td> 363*8c2e8227SGreg Roach <td> 364*8c2e8227SGreg Roach <label> 365*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_avg_life" <?php echo $stat_avg_life ? 'checked' : ''; ?>> 366*8c2e8227SGreg Roach <?php echo I18N::translate('Average age at death'); ?> 367*8c2e8227SGreg Roach </label> 368*8c2e8227SGreg Roach </td> 369*8c2e8227SGreg Roach </tr> 370*8c2e8227SGreg Roach <tr> 371*8c2e8227SGreg Roach <td> 372*8c2e8227SGreg Roach <label> 373*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_events" <?php echo $stat_events ? 'checked' : ''; ?>> 374*8c2e8227SGreg Roach <?php echo I18N::translate('Total events'); ?> 375*8c2e8227SGreg Roach </label> 376*8c2e8227SGreg Roach </td> 377*8c2e8227SGreg Roach <td> 378*8c2e8227SGreg Roach <label> 379*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_most_chil" <?php echo $stat_most_chil ? 'checked' : ''; ?>> 380*8c2e8227SGreg Roach <?php echo I18N::translate('Family with the most children'); ?> 381*8c2e8227SGreg Roach </label> 382*8c2e8227SGreg Roach </td> 383*8c2e8227SGreg Roach </tr> 384*8c2e8227SGreg Roach <tr> 385*8c2e8227SGreg Roach <td> 386*8c2e8227SGreg Roach <label> 387*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_users" <?php echo $stat_users ? 'checked' : ''; ?>> 388*8c2e8227SGreg Roach <?php echo I18N::translate('Total users'); ?> 389*8c2e8227SGreg Roach </label> 390*8c2e8227SGreg Roach </td> 391*8c2e8227SGreg Roach <td> 392*8c2e8227SGreg Roach <label> 393*8c2e8227SGreg Roach <input type="checkbox" value="yes" name="stat_avg_chil" <?php echo $stat_avg_chil ? 'checked' : ''; ?>> 394*8c2e8227SGreg Roach <?php echo I18N::translate('Average number of children per family'); ?> 395*8c2e8227SGreg Roach </label> 396*8c2e8227SGreg Roach </td> 397*8c2e8227SGreg Roach </tr> 398*8c2e8227SGreg Roach </tbody> 399*8c2e8227SGreg Roach </table> 400*8c2e8227SGreg Roach </td> 401*8c2e8227SGreg Roach </tr> 402*8c2e8227SGreg Roach <?php 403*8c2e8227SGreg Roach } 404*8c2e8227SGreg Roach} 405