tree_name;
break;
}
}
break;
default:
$GEDCOM = $gedcom;
break;
}
/*
* Retrieve text, process embedded variables
*/
$title_tmp = get_block_setting($block_id, 'title');
$html = get_block_setting($block_id, 'html');
if ( (strpos($title_tmp, '#')!==false) || (strpos($html, '#')!==false) ) {
$stats = new WT_Stats($GEDCOM);
$title_tmp = $stats->embedTags($title_tmp);
$html = $stats->embedTags($html);
}
/*
* Restore Current GEDCOM
*/
$GEDCOM = WT_GEDCOM;
/*
* Start Of Output
*/
$id=$this->getName().$block_id;
$class=$this->getName().'_block';
if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
$title=' ';
} else {
$title='';
}
$title.=$title_tmp;
$content = $html;
if (get_block_setting($block_id, 'show_timestamp', false)) {
$content.=' '.format_timestamp(get_block_setting($block_id, 'timestamp', WT_TIMESTAMP));
}
if ($template) {
if (get_block_setting($block_id, 'block', false)) {
require WT_THEME_DIR.'templates/block_small_temp.php';
} else {
require WT_THEME_DIR.'templates/block_main_temp.php';
}
} else {
return $content;
}
}
// Implement class WT_Module_Block
public function loadAjax() {
return false;
}
// Implement class WT_Module_Block
public function isUserBlock() {
return true;
}
// Implement class WT_Module_Block
public function isGedcomBlock() {
return true;
}
// Implement class WT_Module_Block
public function configureBlock($block_id) {
if (safe_POST_bool('save')) {
set_block_setting($block_id, 'gedcom', safe_POST('gedcom'));
set_block_setting($block_id, 'title', $_POST['title']);
set_block_setting($block_id, 'html', $_POST['html']);
set_block_setting($block_id, 'show_timestamp', safe_POST_bool('show_timestamp'));
set_block_setting($block_id, 'timestamp', safe_POST('timestamp'));
$languages=array();
foreach (WT_I18N::installed_languages() as $code=>$name) {
if (safe_POST_bool('lang_'.$code)) {
$languages[]=$code;
}
}
set_block_setting($block_id, 'languages', implode(',', $languages));
exit;
}
require_once WT_ROOT.'includes/functions/functions_edit.php';
$templates=array(
WT_I18N::translate('Keyword examples')=>
'#getAllTagsTable#',
WT_I18N::translate('Narrative description')=>
/* I18N: do not translate the #keywords# */ WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#. If you have any comments or feedback please contact #contactWebmaster#.'),
WT_I18N::translate('Statistics')=>
'
#gedcomTitle#
' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
'.WT_I18N::translate('Individuals').'
#totalIndividuals#
'.WT_I18N::translate('Males').'
#totalSexMales# #totalSexMalesPercentage#
'.WT_I18N::translate('Females').'
#totalSexFemales# #totalSexFemalesPercentage#
'.WT_I18N::translate('Total surnames').'
#totalSurnames#
'. WT_I18N::translate('Families').'
#totalFamilies#
'.WT_I18N::translate('Sources').'
#totalSources#
'.WT_I18N::translate('Media objects').'
#totalMedia#
'.WT_I18N::translate('Repositories').'
#totalRepositories#
'.WT_I18N::translate('Total events').'
#totalEvents#
'.WT_I18N::translate('Total users').'
#totalUsers#
'.WT_I18N::translate('Earliest birth year').'
#firstBirthYear#
#firstBirth#
'.WT_I18N::translate('Latest birth year').'
#lastBirthYear#
#lastBirth#
'.WT_I18N::translate('Earliest death year').'
#firstDeathYear#
#firstDeath#
'.WT_I18N::translate('Latest death year').'
#lastDeathYear#
#lastDeath#
'.WT_I18N::translate('Person who lived the longest').'
#longestLifeAge#
#longestLife#
'.WT_I18N::translate('Average age at death').'
#averageLifespan#
'.WT_I18N::translate('Family with the most children').'
#largestFamilySize#
#largestFamily#
'.WT_I18N::translate('Average number of children per family').'
#averageChildren#
'.WT_I18N::translate('Most Common Surnames').'
#commonSurnames#
'
);
$title=get_block_setting($block_id, 'title');
$html=get_block_setting($block_id, 'html');
// title
echo '',
WT_Gedcom_Tag::getLabel('TITL'),
' ';
// templates
echo '',
WT_I18N::translate('Templates'),
help_link('block_html_template', $this->getName()),
' ';
// The CK editor needs lots of help to load/save data :-(
if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
$ckeditor_onchange='CKEDITOR.instances.html.setData(document.block.html.value);';
} else {
$ckeditor_onchange='';
}
echo '';
echo '', WT_I18N::translate('Custom'), ' ';
foreach ($templates as $title=>$template) {
echo '', $title, ' ';
}
echo ' ';
// gedcom
$gedcom=get_block_setting($block_id, 'gedcom');
if (count(WT_Tree::getAll()) > 1) {
if ($gedcom == '__current__') {$sel_current = ' selected="selected"';} else {$sel_current = '';}
if ($gedcom == '__default__') {$sel_default = ' selected="selected"';} else {$sel_default = '';}
echo '',
WT_I18N::translate('Family tree'),
' ',
'',
'', WT_I18N::translate('Current'), ' ',
'', WT_I18N::translate('Default'), ' ';
foreach (WT_Tree::getAll() as $tree) {
if ($tree->tree_name == $gedcom) {$sel = ' selected="selected"';} else {$sel = '';}
echo '', $tree->tree_title_html, ' ';
}
echo ' ';
}
// html
echo '',
WT_I18N::translate('Content'),
help_link('block_html_content', $this->getName()),
' ',
'';
echo '';
echo ' ';
$show_timestamp=get_block_setting($block_id, 'show_timestamp', false);
echo '';
echo WT_I18N::translate('Show the date and time of update');
echo ' ';
echo edit_field_yes_no('show_timestamp', $show_timestamp);
echo ' ';
echo ' ';
$languages=get_block_setting($block_id, 'languages');
echo '';
echo WT_I18N::translate('Show this block for which languages?');
echo ' ';
echo edit_language_checkboxes('lang_', $languages);
echo ' ';
}
}