Exemplo n.º 1
0
 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', 7);
     $filter = get_block_setting($block_id, 'filter', true);
     $onlyBDM = get_block_setting($block_id, 'onlyBDM', false);
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     $sortStyle = get_block_setting($block_id, 'sortStyle', 'alpha');
     $block = get_block_setting($block_id, 'block', true);
     if ($cfg) {
         foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     $startjd = WT_CLIENT_JD + 1;
     $endjd = WT_CLIENT_JD + $days;
     // Output starts here
     $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();
     $content = '';
     switch ($infoStyle) {
         case "list":
             // 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 ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
             break;
         case "table":
             // 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 ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
             $content .= ob_get_clean();
             break;
     }
     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;
     }
 }
Exemplo n.º 2
0
function print_todays_events($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $PGV_BLOCKS;
    $block = true;
    // Always restrict this block's height
    $todayjd = client_jd();
    if (empty($config)) {
        $config = $PGV_BLOCKS["print_todays_events"]["config"];
    }
    if (isset($config["filter"])) {
        $filter = $config["filter"];
    } else {
        $filter = "all";
    }
    if (isset($config["onlyBDM"])) {
        $onlyBDM = $config["onlyBDM"];
    } else {
        $onlyBDM = "no";
    }
    if (isset($config["infoStyle"])) {
        $infoStyle = $config["infoStyle"];
    } else {
        $infoStyle = "style2";
    }
    if (isset($config["sortStyle"])) {
        $sortStyle = $config["sortStyle"];
    } else {
        $sortStyle = "alpha";
    }
    if (isset($config["allowDownload"])) {
        $allowDownload = $config["allowDownload"];
    } else {
        $allowDownload = "yes";
    }
    // Don't permit calendar download if not logged in
    if (!PGV_USER_ID) {
        $allowDownload = "no";
    }
    //-- Start output
    $id = "on_this_day_events";
    $title = print_help_link("index_onthisday_help", "qm", "", false, true);
    if ($PGV_BLOCKS["print_todays_events"]["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["on_this_day"];
    $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($todayjd, $todayjd, $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($todayjd, $todayjd, $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';
    }
}