public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $top10_block_present; $show_last_update = get_block_setting($block_id, 'show_last_update', true); $show_common_surnames = get_block_setting($block_id, 'show_common_surnames', true); $stat_indi = get_block_setting($block_id, 'stat_indi', true); $stat_fam = get_block_setting($block_id, 'stat_fam', true); $stat_sour = get_block_setting($block_id, 'stat_sour', true); $stat_media = get_block_setting($block_id, 'stat_media', true); $stat_repo = get_block_setting($block_id, 'stat_repo', true); $stat_surname = get_block_setting($block_id, 'stat_surname', true); $stat_events = get_block_setting($block_id, 'stat_events', true); $stat_users = get_block_setting($block_id, 'stat_users', true); $stat_first_birth = get_block_setting($block_id, 'stat_first_birth', true); $stat_last_birth = get_block_setting($block_id, 'stat_last_birth', true); $stat_first_death = get_block_setting($block_id, 'stat_first_death', true); $stat_last_death = get_block_setting($block_id, 'stat_last_death', true); $stat_long_life = get_block_setting($block_id, 'stat_long_life', true); $stat_avg_life = get_block_setting($block_id, 'stat_avg_life', true); $stat_most_chil = get_block_setting($block_id, 'stat_most_chil', true); $stat_avg_chil = get_block_setting($block_id, 'stat_avg_chil', true); $stat_link = get_block_setting($block_id, 'stat_link', true); $block = get_block_setting($block_id, 'block', false); if ($cfg) { 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) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) { $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } $title .= $this->getTitle(); $stats = new WT_Stats(WT_GEDCOM); $content = '<b>' . WT_TREE_TITLE . '</b><br>'; if ($show_last_update) { $content .= '<div>' . WT_I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>'; } $content .= '<table><tr><td class="width20"><table class="facts_table">'; if ($stat_indi) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Individuals') . '</td><td class="facts_value stats_value"><a href="' . "indilist.php?surname_sublist=no&ged=" . WT_GEDURL . '">' . $stats->totalIndividuals() . '</a></td></tr>'; $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Males') . '</td><td class="facts_value stats_value">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</td></tr>'; $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Females') . '</td><td class="facts_value stats_value">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</td></tr>'; } if ($stat_surname) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td><td class="facts_value stats_value"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . WT_GEDURL . '">' . $stats->totalSurnames() . '</a></td></tr>'; } if ($stat_fam) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Families') . '</td><td class="facts_value stats_value"><a href="famlist.php?ged=' . WT_GEDURL . '">' . $stats->totalFamilies() . '</a></td></tr>'; } if ($stat_sour) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Sources') . '</td><td class="facts_value stats_value"><a href="sourcelist.php?ged=' . WT_GEDURL . '">' . $stats->totalSources() . '</a></td></tr>'; } if ($stat_media) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Media objects') . '</td><td class="facts_value stats_value"><a href="medialist.php?ged=' . WT_GEDURL . '">' . $stats->totalMedia() . '</a></td></tr>'; } if ($stat_repo) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Repositories') . '</td><td class="facts_value stats_value"><a href="repolist.php?ged=' . WT_GEDURL . '">' . $stats->totalRepositories() . '</a></td></tr>'; } if ($stat_events) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total events') . '</td><td class="facts_value stats_value">' . $stats->totalEvents() . '</td></tr>'; } if ($stat_users) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Total users') . '</td><td class="facts_value stats_value">'; if (WT_USER_GEDCOM_ADMIN) { $content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>'; } else { $content .= $stats->totalUsers(); } $content .= '</td></tr>'; } if (!$block) { $content .= '</table></td><td><table class="facts_table">'; } if ($stat_first_birth) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td><td class="facts_value stats_value">' . $stats->firstBirthYear() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->firstBirth() . '</td>'; } $content .= '</tr>'; } if ($stat_last_birth) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td><td class="facts_value stats_value">' . $stats->lastBirthYear() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->lastBirth() . '</td>'; } $content .= '</tr>'; } if ($stat_first_death) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td><td class="facts_value stats_value">' . $stats->firstDeathYear() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->firstDeath() . '</td>'; } $content .= '</tr>'; } if ($stat_last_death) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td><td class="facts_value stats_value">' . $stats->lastDeathYear() . ' </td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->lastDeath() . '</td>'; } $content .= '</tr>'; } if ($stat_long_life) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td><td class="facts_value stats_value">' . $stats->LongestLifeAge() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->LongestLife() . '</td>'; } $content .= '</tr>'; } if ($stat_avg_life) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td><td class="facts_value stats_value">' . $stats->averageLifespan() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . WT_I18N::translate('Males') . ': ' . $stats->averageLifespanMale(); $content .= ' ' . WT_I18N::translate('Females') . ': ' . $stats->averageLifespanFemale() . '</td>'; } $content .= '</tr>'; } if ($stat_most_chil && !$block) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td><td class="facts_value stats_value">' . $stats->largestFamilySize() . '</td>'; if (!$block) { $content .= '<td class="facts_value">' . $stats->largestFamily() . '</td>'; } $content .= '</tr>'; } if ($stat_avg_chil) { $content .= '<tr><td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td><td class="facts_value stats_value">' . $stats->averageChildren() . '</td>'; if (!$block) { $content .= '<td class="facts_value"> </td>'; } $content .= '</tr>'; } $content .= '</table></td></tr></table>'; if ($stat_link) { $content .= '<a href="statistics.php?ged=' . WT_GEDURL . '"><b>' . WT_I18N::translate('View statistics as graphs') . '</b></a><br>'; } // NOTE: Print the most common surnames if ($show_common_surnames) { $surnames = get_common_surnames(get_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_THRESHOLD')); if (count($surnames) > 0) { $content .= '<p><b>' . WT_I18N::translate('Most common surnames') . '</b></p>'; $content .= '<div class="common_surnames">'; $i = 0; foreach ($surnames as $indexval => $surname) { if (stristr($surname['name'], '@N.N') === false) { if ($i > 0) { $content .= ', '; } $content .= '<a href="' . "indilist.php?ged=" . WT_GEDURL . "&surname=" . rawurlencode($surname['name']) . '">' . $surname['name'] . '</a>'; $i++; } } $content .= '</div>'; } } if ($template) { require WT_THEME_DIR . 'templates/block_main_temp.php'; } else { return $content; } }
<tr> <td class="facts_label">', WT_I18N::translate('Media objects'), '</td> <td class="facts_label">', WT_I18N::translate('Sources'), '</td> <td class="facts_label">', WT_I18N::translate('Notes'), '</td> <td class="facts_label">', WT_I18N::translate('Repositories'), '</td> </tr> <tr> <td class="facts_value" align="center">', $stats->totalMedia(), '</td> <td class="facts_value" align="center">', $stats->totalSources(), '</td> <td class="facts_value" align="center">', $stats->totalNotes(), '</td> <td class="facts_value" align="center">', $stats->totalRepositories(), '</td> </tr> </table> </fieldset> <fieldset> <legend>', WT_I18N::translate('Total events'), ': ', $stats->totalEvents(), '</legend> <table class="facts_table"> <tr> <td class="facts_label">', WT_I18N::translate('First event'), ' - ', $stats->firstEventType(), '</td> <td class="facts_label">', WT_I18N::translate('Last event'), ' - ', $stats->lastEventType(), '</td> </tr> <tr> <td class="facts_value">', $stats->firstEvent(), '</td> <td class="facts_value">', $stats->lastEvent(), '</td> </tr> </table> </fieldset> <fieldset> <legend>', WT_I18N::translate('Media objects'), ': ', $stats->totalMedia(), '</legend> <table class="facts_table"> <tr>