Пример #1
0
    echo '</p>';
}
if ($show == 'indi' || $show == 'surn') {
    $surns = WT_Query_Name::surnames($surname, $alpha, $show_marnm, true, WT_GED_ID);
    if ($show == 'surn') {
        // Show the surname list
        switch ($SURNAME_LIST_STYLE) {
            case 'style1':
                echo format_surname_list($surns, 3, true, WT_SCRIPT_NAME);
                break;
            case 'style3':
                echo format_surname_tagcloud($surns, WT_SCRIPT_NAME, true);
                break;
            case 'style2':
            default:
                echo format_surname_table($surns, WT_SCRIPT_NAME);
                break;
        }
    } else {
        // Show the list
        $count = 0;
        foreach ($surns as $surnames) {
            foreach ($surnames as $list) {
                $count += count($list);
            }
        }
        // Don't sublists short lists.
        if ($count < get_gedcom_setting(WT_GED_ID, 'SUBLIST_TRIGGER_I')) {
            $falpha = '';
            $show_all_firstnames = 'no';
        } else {
Пример #2
0
function print_block_name_top10($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $COMMON_NAMES_ADD, $COMMON_NAMES_REMOVE, $COMMON_NAMES_THRESHOLD, $PGV_BLOCKS, $ctype, $PGV_IMAGES, $PGV_IMAGE_DIR, $SURNAME_LIST_STYLE;
    if (empty($config)) {
        $config = $PGV_BLOCKS["print_block_name_top10"]["config"];
    }
    // This next function is a bit out of date, and doesn't cope well with surname variants
    $top_surnames = get_top_surnames(PGV_GED_ID, 1, $config["num"]);
    $all_surnames = array();
    foreach (array_keys($top_surnames) as $top_surname) {
        $all_surnames = array_merge($all_surnames, get_indilist_surns($top_surname, '', false, false, PGV_GED_ID));
    }
    // Insert from the "Add Names" list if not already in there
    if ($COMMON_NAMES_ADD) {
        foreach (preg_split('/[,; ]+/', $COMMON_NAMES_ADD) as $addname) {
            $ADDNAME = UTF8_strtoupper($addname);
            if (isset($all_surnames[$ADDNAME])) {
                $SURNAME = $ADDNAME;
                foreach (array_keys($all_surnames[$ADDNAME]) as $surname) {
                    if ($SURNAME != $surname && $SURNAME == UTF8_strtoupper($surname)) {
                        $all_surnames[$ADDNAME][$SURNAME] = $all_surnames[$ADDNAME][$surname];
                        unset($all_surnames[$ADDNAME][$surname]);
                    }
                }
                if (isset($all_surnames[$ADDNAME][$SURNAME])) {
                    $n = count($all_surnames[$ADDNAME][$SURNAME]);
                    $all_surnames[$ADDNAME][$SURNAME] = array_fill(0, max($n, $COMMON_NAMES_THRESHOLD), true);
                } else {
                    $all_surnames[$ADDNAME][$SURNAME] = array_fill(0, $COMMON_NAMES_THRESHOLD, true);
                }
            } else {
                $all_surnames[$ADDNAME][$ADDNAME] = array_fill(0, $COMMON_NAMES_THRESHOLD, true);
            }
        }
    }
    // Remove names found in the "Remove Names" list
    if ($COMMON_NAMES_REMOVE) {
        foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
            unset($all_surnames[UTF8_strtoupper($delname)]);
        }
    }
    $id = "top10surnames";
    $title = print_help_link("index_common_names_help", "qm", "", false, true);
    if ($PGV_BLOCKS["print_block_name_top10"]["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 .= str_replace("10", $config["num"], $pgv_lang["block_top10_title"]);
    switch ($SURNAME_LIST_STYLE) {
        case 'style3':
            uksort($all_surnames, 'stringsort');
            $content = format_surname_tagcloud($all_surnames, 'indilist', true);
            break;
        case 'style2':
        default:
            uasort($all_surnames, "top_surname_sort");
            $content = format_surname_table($all_surnames, 'indilist');
            break;
    }
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
}
Пример #3
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $SURNAME_LIST_STYLE;
     require_once WT_ROOT . 'includes/functions/functions_print_lists.php';
     $COMMON_NAMES_REMOVE = get_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_REMOVE');
     $COMMON_NAMES_THRESHOLD = get_gedcom_setting(WT_GED_ID, 'COMMON_NAMES_THRESHOLD');
     $num = get_block_setting($block_id, 'num', 10);
     $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
     $block = get_block_setting($block_id, 'block', false);
     if ($cfg) {
         foreach (array('num', 'infoStyle', 'block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     // This next function is a bit out of date, and doesn't cope well with surname variants
     $top_surnames = get_top_surnames(WT_GED_ID, $COMMON_NAMES_THRESHOLD, $num);
     // Remove names found in the "Remove Names" list
     if ($COMMON_NAMES_REMOVE) {
         foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
             unset($top_surnames[$delname]);
             unset($top_surnames[WT_I18N::strtoupper($delname)]);
         }
     }
     $all_surnames = array();
     $i = 0;
     foreach (array_keys($top_surnames) as $top_surname) {
         $all_surnames = array_merge($all_surnames, WT_Query_Name::surnames($top_surname, '', false, false, WT_GED_ID));
         if (++$i == $num) {
             break;
         }
     }
     if ($i < $num) {
         $num = $i;
     }
     $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 = '';
     }
     if ($num == 1) {
         // I18N: i.e. most popular surname.
         $title .= WT_I18N::translate('Top surname');
     } else {
         // I18N: Title for a list of the most common surnames, %s is a number.  Note that a separate translation exists when %s is 1
         $title .= WT_I18N::plural('Top %s surname', 'Top %s surnames', $num, WT_I18N::number($num));
     }
     switch ($infoStyle) {
         case 'tagcloud':
             uksort($all_surnames, array('WT_I18N', 'strcasecmp'));
             $content = format_surname_tagcloud($all_surnames, 'indilist.php', true);
             break;
         case 'list':
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_list($all_surnames, '1', true, 'indilist.php');
             break;
         case 'array':
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_list($all_surnames, '2', true, 'indilist.php');
             break;
         case 'table':
         default:
             uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
             $content = format_surname_table($all_surnames, 'indilist.php');
             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;
     }
 }
Пример #4
0
    }
    print_help_link('name_list_help', 'qm');
    echo '</p>';
}
echo '</div>';
if ($showList) {
    $surns = get_famlist_surns($surname, $alpha, $SHOW_MARRIED_NAMES, PGV_GED_ID);
    if ($surname_sublist == 'yes') {
        // Show the surname list
        switch ($SURNAME_LIST_STYLE) {
            case 'style3':
                echo format_surname_tagcloud($surns, 'famlist', true);
                break;
            case 'style2':
            default:
                echo format_surname_table($surns, 'famlist');
                break;
        }
    } else {
        // Show the family list
        $count = 0;
        foreach ($surns as $surnames) {
            foreach ($surnames as $list) {
                $count += count($list);
            }
        }
        // Don't sublists short lists.
        if ($count < $SUBLIST_TRIGGER_F) {
            $falpha = '';
            $show_all_firstnames = 'no';
        } else {