. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\AjaxController; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'statistics.php'); require './includes/session.php'; // check for on demand content loading $tab = Filter::getInteger('tab', 0, 3); $ajax = Filter::getBool('ajax'); if (!$ajax) { $controller = new PageController; $controller ->restrictAccess(Module::isActiveChart($WT_TREE, 'statistics_chart')) ->setPageTitle(I18N::translate('Statistics')) ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript(' jQuery("#statistics_chart").css("visibility", "visible"); jQuery("#statistics_chart").tabs({ load: function() { jQuery("#loading-indicator").removeClass("loading-image"); }, beforeLoad: function(event, ui) { // Only load each tab once if (ui.tab.data("loaded")) { event.preventDefault(); return; } else { jQuery("#loading-indicator").addClass("loading-image"); } ui.jqXHR.success(function() { ui.tab.data("loaded", true); }); } }); ') ->pageHeader(); echo '

', I18N::translate('Statistics'), '

', '
', '', '
', '
', // statistics_chart '
', // statistics-page '

'; } else { $controller = new AjaxController; $controller ->pageHeader() ->addInlineJavascript('autocomplete();') ->addInlineJavascript('jQuery("#loading-indicator").removeClass("loading-image");'); $stats = new Stats($WT_TREE); if ($tab == 0) { echo '
', I18N::translate('Total individuals: %s', $stats->totalIndividuals()), '
', I18N::translate('Total males'), ' ', I18N::translate('Total females'), ' ', I18N::translate('Total living'), ' ', I18N::translate('Total dead'), '
', $stats->totalSexMales(), ' ', $stats->totalSexFemales(), ' ', $stats->totalLiving(), ' ', $stats->totalDeceased(), '
', $stats->chartSex(), ' ', $stats->chartMortality(), '

', I18N::translate('Events'), '
', I18N::translate('Total births'), ' ', I18N::translate('Total deaths'), '
', $stats->totalBirths(), ' ', $stats->totalDeaths(), '
', I18N::translate('Births by century'), ' ', I18N::translate('Deaths by century'), '
', $stats->statsBirth(), ' ', $stats->statsDeath(), '
', I18N::translate('Earliest birth'), ' ', I18N::translate('Earliest death'), '
', $stats->firstBirth(), ' ', $stats->firstDeath(), '
', I18N::translate('Latest birth'), ' ', I18N::translate('Latest death'), '
', $stats->lastBirth(), ' ', $stats->lastDeath(), '

', I18N::translate('Lifespan'), '
', I18N::translate('Average age at death'), ' ', I18N::translate('Males'), ' ', I18N::translate('Females'), '
', $stats->averageLifespan(true), ' ', $stats->averageLifespanMale(true), ' ', $stats->averageLifespanFemale(true), '
', $stats->statsAge(), '

', I18N::translate('Greatest age at death'), '
', I18N::translate('Males'), ' ', I18N::translate('Females'), '
', $stats->topTenOldestMaleList(), ' ', $stats->topTenOldestFemaleList(), '

'; if (Auth::check()) { echo '', I18N::translate('Oldest living individuals'), '
', I18N::translate('Males'), ' ', I18N::translate('Females'), '
', $stats->topTenOldestMaleListAlive(), ' ', $stats->topTenOldestFemaleListAlive(), '

'; } echo '', I18N::translate('Names'), '
', I18N::translate('Total surnames'), ' ', I18N::translate('Total given names'), '
', $stats->totalSurnames(), ' ', $stats->totalGivennames(), '
', I18N::translate('Top surnames'), ' ', I18N::translate('Top given names'), '
', $stats->chartCommonSurnames(), ' ', $stats->chartCommonGiven(), '
'; } elseif ($tab == 1) { echo '
', I18N::translate('Total families: %s', $stats->totalFamilies()), ' ', I18N::translate('Events'), '
', I18N::translate('Total marriages'), ' ', I18N::translate('Total divorces'), '
', $stats->totalMarriages(), ' ', $stats->totalDivorces(), '
', I18N::translate('Marriages by century'), ' ', I18N::translate('Divorces by century'), '
', $stats->statsMarr(), ' ', $stats->statsDiv(), '
', I18N::translate('Earliest marriage'), ' ', I18N::translate('Earliest divorce'), '
', $stats->firstMarriage(), ' ', $stats->firstDivorce(), '
', I18N::translate('Latest marriage'), ' ', I18N::translate('Latest divorce'), '
', $stats->lastMarriage(), ' ', $stats->lastDivorce(), '

', I18N::translate('Length of marriage'), '
', I18N::translate('Longest marriage'), ' - ', $stats->topAgeOfMarriage(), ' ', I18N::translate('Shortest marriage'), ' - ', $stats->minAgeOfMarriage(), '
', $stats->topAgeOfMarriageFamily(), ' ', $stats->minAgeOfMarriageFamily(), '

', I18N::translate('Age in year of marriage'), '
', I18N::translate('Youngest male'), ' - ', $stats->youngestMarriageMaleAge(true), ' ', I18N::translate('Youngest female'), ' - ', $stats->youngestMarriageFemaleAge(true), '
', $stats->youngestMarriageMale(), ' ', $stats->youngestMarriageFemale(), '
', I18N::translate('Oldest male'), ' - ', $stats->oldestMarriageMaleAge(true), ' ', I18N::translate('Oldest female'), ' - ', $stats->oldestMarriageFemaleAge(true), '
', $stats->oldestMarriageMale(), ' ', $stats->oldestMarriageFemale(), '
', $stats->statsMarrAge(), '

', I18N::translate('Age at birth of child'), '
', I18N::translate('Youngest father'), ' - ', $stats->youngestFatherAge(true), ' ', I18N::translate('Youngest mother'), ' - ', $stats->youngestMotherAge(true), '
', $stats->youngestFather(), ' ', $stats->youngestMother(), '
', I18N::translate('Oldest father'), ' - ', $stats->oldestFatherAge(true), ' ', I18N::translate('Oldest mother'), ' - ', $stats->oldestMotherAge(true), '
', $stats->oldestFather(), ' ', $stats->oldestMother(), '

', I18N::translate('Children in family'), '
', I18N::translate('Average number of children per family'), ' ', I18N::translate('Number of families without children'), '
', $stats->averageChildren(), ' ', $stats->noChildrenFamilies(), '
', $stats->statsChildren(), ' ', $stats->chartNoChildrenFamilies(), '
', I18N::translate('Largest families'), ' ', I18N::translate('Largest number of grandchildren'), '
', $stats->topTenLargestFamilyList(), ' ', $stats->topTenLargestGrandFamilyList(), '

', I18N::translate('Age difference'), '
', I18N::translate('Age between siblings'), ' ', I18N::translate('Greatest age between siblings'), '
', $stats->topAgeBetweenSiblingsList(), ' ', $stats->topAgeBetweenSiblingsFullName(), '
', I18N::translate('Age between husband and wife'), ' ', I18N::translate('Age between wife and husband'), '
', $stats->ageBetweenSpousesMFList(), ' ', $stats->ageBetweenSpousesFMList(), '
'; } elseif ($tab == 2) { echo '
', I18N::translate('Records'), ': ', $stats->totalRecords(), '
', I18N::translate('Media objects'), ' ', I18N::translate('Sources'), ' ', I18N::translate('Notes'), ' ', I18N::translate('Repositories'), '
', $stats->totalMedia(), ' ', $stats->totalSources(), ' ', $stats->totalNotes(), ' ', $stats->totalRepositories(), '
', I18N::translate('Total events'), ': ', $stats->totalEvents(), '
', I18N::translate('First event'), ' - ', $stats->firstEventType(), ' ', I18N::translate('Last event'), ' - ', $stats->lastEventType(), '
', $stats->firstEvent(), ' ', $stats->lastEvent(), '
', I18N::translate('Media objects'), ': ', $stats->totalMedia(), '
', I18N::translate('Media objects'), '
', $stats->chartMedia(), '
', I18N::translate('Sources'), ': ', $stats->totalSources(), '
', I18N::translate('Individuals with sources'), ' ', I18N::translate('Families with sources'), '
', $stats->totalIndisWithSources(), ' ', $stats->totalFamsWithSources(), '
', $stats->chartIndisWithSources(), ' ', $stats->chartFamsWithSources(), '
', I18N::translate('Places'), ': ', $stats->totalPlaces(), '
', I18N::translate('Birth places'), ' ', I18N::translate('Death places'), '
', $stats->commonBirthPlacesList(), ' ', $stats->commonDeathPlacesList(), '
', I18N::translate('Marriage places'), ' ', I18N::translate('Events in countries'), '
', $stats->commonMarriagePlacesList(), ' ', $stats->commonCountriesList(), '
', $stats->chartDistribution(), '
'; } elseif ($tab == 3) { ?>