i18n::translate('Recent Changes'),
'type'=>'both',
'descr'=>i18n::translate('The Recent Changes block will list all of the changes that have been made to the database in the last month. This block can help you stay current with the changes that have been made. Changes are detected automatically, using the CHAN tag defined in the GEDCOM Standard.'),
'canconfig'=>true,
'config'=>array(
'cache'=>1,
'days'=>30,
'hide_empty'=>'no'
)
);
//-- Recent Changes block
//-- this block prints a list of changes that have occurred recently in your gedcom
function print_recent_changes($block=true, $config="", $side, $index) {
global $ctype;
global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
$block = true; // Always restrict this block's height
if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"];
if ($config["days"]<1) $config["days"] = 30;
if (isset($config["hide_empty"])) $HideEmpty = $config["hide_empty"];
else $HideEmpty = "no";
$found_facts=get_recent_changes(client_jd()-$config['days']);
// Start output
if (count($found_facts)==0 and $HideEmpty=="yes") return false;
// Print block header
$id="recent_changes";
$title='';
if ($WT_BLOCKS["print_recent_changes"]["canconfig"]) {
if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
if ($ctype=="gedcom") {
$name = WT_GEDCOM;
} else {
$name = WT_USER_NAME;
}
$title .= "";
$title .= "";
}
}
$title.=i18n::translate('Recent Changes').help_link('recent_changes');
$content = "";
// Print block content
if (count($found_facts)==0) {
$content .= i18n::translate('There have been no changes within the last %s days.', $config["days"]);
} else {
$content .= i18n::translate('Changes made within the last %s days', $config["days"]);
// sortable table
require_once WT_ROOT.'includes/functions/functions_print_lists.php';
ob_start();
print_changes_table($found_facts);
$content .= ob_get_clean();
}
global $THEME_DIR;
if ($block) {
require $THEME_DIR.'templates/block_small_temp.php';
} else {
require $THEME_DIR.'templates/block_main_temp.php';
}
}
function print_recent_changes_config($config) {
global $ctype, $WT_BLOCKS;
if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"];
if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_recent_changes"]["config"]["cache"];
print "