i18n::translate('Upcoming Events'), 'type'=>'both', 'descr'=>i18n::translate('The Upcoming Events block shows anniversaries of events that will occur in the near future. You can configure the amount of detail shown, and the administrator can configure how far into the future this block will look.'), 'canconfig'=>true, 'config'=>array( 'cache'=>1, 'days'=>30, 'filter'=>'all', 'onlyBDM'=>'no', 'infoStyle'=>'style2', 'sortStyle'=>'alpha', 'allowDownload'=>'yes' ) ); //-- upcoming events block //-- this block prints a list of upcoming events of people in your gedcom function print_upcoming_events($block=true, $config="", $side, $index) { global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION; global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS; global $DAYS_TO_SHOW_LIMIT; $block = true; // Always restrict this block's height if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"]; if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30; if (isset($config["days"])) $daysprint = $config["days"]; else $daysprint = 30; if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all" else $filter = "all"; if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no" else $onlyBDM = "no"; if (isset($config["infoStyle"])) $infoStyle = $config["infoStyle"]; // "style1" or "style2" else $infoStyle = "style2"; if (isset($config["sortStyle"])) $sortStyle = $config["sortStyle"]; // "alpha" or "anniv" else $sortStyle = "alpha"; if (isset($config["allowDownload"])) $allowDownload = $config["allowDownload"]; // "yes" or "no" else $allowDownload = "yes"; // Don't permit calendar download if not logged in if (!WT_USER_ID) { $allowDownload = "no"; } if ($daysprint < 1) $daysprint = 1; if ($daysprint > $DAYS_TO_SHOW_LIMIT) $daysprint = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit $startjd=client_jd()+1; $endjd=client_jd()+$daysprint; // Output starts here $id="upcoming_events"; $title=''; if ($WT_BLOCKS["print_upcoming_events"]["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 .= "\"".i18n::translate('Configure')."\""; } } $title .= i18n::translate('Upcoming Events'); $title .= help_link('index_events'); $content = ""; switch ($infoStyle) { case "style1": // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page. $content .= print_events_list($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $sortStyle); break; case "style2": // Style 2: New format, tables, big text, etc. Not too good on right side of page ob_start(); $content .= print_events_table($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $allowDownload=='yes', $sortStyle); $content .= ob_get_clean(); break; } global $THEME_DIR; if ($block) { require $THEME_DIR.'templates/block_small_temp.php'; } else { require $THEME_DIR.'templates/block_main_temp.php'; } } function print_upcoming_events_config($config) { global $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT; if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"]; if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30; if (!isset($config["days"])) $config["days"] = 30; if (!isset($config["filter"])) $config["filter"] = "all"; if (!isset($config["onlyBDM"])) $config["onlyBDM"] = "no"; if (!isset($config["infoStyle"])) $config["infoStyle"] = "style2"; if (!isset($config["sortStyle"])) $config["sortStyle"] = "alpha"; if (!isset($config["allowDownload"])) $config["allowDownload"] = "yes"; if ($config["days"] < 1) $config["days"] = 1; if ($config["days"] > $DAYS_TO_SHOW_LIMIT) $config["days"] = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit ?> " />