function print_recent_changes($block = true, $config = "", $side, $index) { global $pgv_lang, $ctype; global $PGV_IMAGE_DIR, $PGV_IMAGES, $PGV_BLOCKS; $block = true; // Always restrict this block's height if (empty($config)) { $config = $PGV_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 = print_help_link("recent_changes_help", "qm", "", false, true); if ($PGV_BLOCKS["print_recent_changes"]["canconfig"]) { if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) { if ($ctype == "gedcom") { $name = PGV_GEDCOM; } else { $name = PGV_USER_NAME; } $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"; $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>"; } } $title .= $pgv_lang["recent_changes"]; $content = ""; // Print block content $pgv_lang["global_num1"] = $config["days"]; // Make this visible if (count($found_facts) == 0) { $content .= print_text("recent_changes_none", 0, 1); } else { $content .= print_text("recent_changes_some", 0, 1); // sortable table require_once PGV_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'; } }
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; $days = get_block_setting($block_id, 'days', self::DEFAULT_DAYS); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); $sortStyle = get_block_setting($block_id, 'sortStyle', 'date_desc'); $hide_empty = get_block_setting($block_id, 'hide_empty', false); $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('days', 'infoStyle', 'show_parents', 'sortStyle', 'hide_empty', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } $found_facts = get_recent_changes(WT_CLIENT_JD - $days); if (!$found_facts && $hide_empty) { return ''; } // Print block header $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 .= WT_I18N::plural('Changes in the last day', 'Changes in the last %s days', $days, WT_I18N::number($days)); $content = ''; // Print block content if (count($found_facts) == 0) { $content .= WT_I18N::translate('There have been no changes within the last %s days.', WT_I18N::number($days)); } else { ob_start(); switch ($infoStyle) { case 'list': $content .= print_changes_list($found_facts, $sortStyle); break; case 'table': // sortable table $content .= print_changes_table($found_facts, $sortStyle); break; } $content .= ob_get_clean(); } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } }
} } if (!empty($error)) { addDebugLog($action . " {$error}"); print $error . "\n"; } else { addDebugLog($action . " SUCCESS"); print "SUCCESS\n"; } exit; case 'getchanges': $lastdate = new GedcomDate(safe_REQUEST($_REQUEST, 'date', '\\d\\d \\w\\w\\w \\d\\d\\d\\d')); if ($lastdate->isOK()) { if ($lastdate->MinJD() < server_jd() - 180) { addDebugLog($action . " ERROR 24: You cannot retrieve updates for more than 180 days."); print "ERROR 24: You cannot retrieve updates for more than 180 days.\n"; } else { print "SUCCESS\n"; foreach (get_recent_changes($lastdate->MinJD()) as $xref) { echo "{$xref}\n"; } } } else { addDebugLog($action . " ERROR 23: Invalid date parameter. Please use a valid date in the GEDCOM format DD MMM YYYY."); print "ERROR 23: Invalid date parameter. Please use a valid date in the GEDCOM format DD MMM YYYY.\n"; } exit; default: addDebugLog($action . " ERROR 2: Unable to process request. Unknown action."); print "ERROR 2: Unable to process request. Unknown action.\n"; }