示例#1
0
                            break;
                    }
                    if ($count) {
                        if ($show == 'indi' && $givn_initial == $falpha && $show_all_firstnames == 'no') {
                            $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                        } else {
                            $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                        }
                    } else {
                        $list[] = $html;
                    }
                }
                // Search spiders don't get the "show all" option as the other links give them everything.
                if (!$SEARCH_SPIDER) {
                    if ($show_all_firstnames == 'yes') {
                        $list[] = '<span class="warning">' . WT_I18N::translate('All') . '</span>';
                    } else {
                        $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . WT_I18N::translate('All') . '</a>';
                    }
                }
                if ($show_all == 'no') {
                    echo '<h2 class="center">', WT_I18N::translate('Individuals with surname %s', $legend), '</h2>';
                }
                echo '<p class="center alpha_index">', join(' | ', $list), '</p>';
            }
        }
        if ($show == 'indi') {
            echo format_fam_table(WT_Query_Name::families($surname, $alpha, $falpha, $show_marnm, WT_GED_ID));
        }
    }
}
示例#2
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;
     }
 }
示例#3
0
 function chartCommonSurnames($params = null)
 {
     global $WT_STATS_CHART_COLOR1, $WT_STATS_CHART_COLOR2, $WT_STATS_S_CHART_X, $WT_STATS_S_CHART_Y;
     if ($params === null) {
         $params = array();
     }
     if (isset($params[0]) && $params[0] != '') {
         $size = strtolower($params[0]);
     } else {
         $size = $WT_STATS_S_CHART_X . "x" . $WT_STATS_S_CHART_Y;
     }
     if (isset($params[1]) && $params[1] != '') {
         $color_from = strtolower($params[1]);
     } else {
         $color_from = $WT_STATS_CHART_COLOR1;
     }
     if (isset($params[2]) && $params[2] != '') {
         $color_to = strtolower($params[2]);
     } else {
         $color_to = $WT_STATS_CHART_COLOR2;
     }
     if (isset($params[3]) && $params[3] != '') {
         $threshold = strtolower($params[3]);
     } else {
         $threshold = get_gedcom_setting($this->_ged_id, 'COMMON_NAMES_THRESHOLD');
     }
     if (isset($params[4]) && $params[4] != '') {
         $maxtoshow = strtolower($params[4]);
     } else {
         $maxtoshow = 7;
     }
     $sizes = explode('x', $size);
     $tot_indi = $this->_totalIndividuals();
     $surnames = get_common_surnames($threshold);
     if (count($surnames) <= 0) {
         return '';
     }
     $SURNAME_TRADITION = get_gedcom_setting(WT_GED_ID, 'SURNAME_TRADITION');
     uasort($surnames, array('WT_Stats', '_name_total_rsort'));
     $surnames = array_slice($surnames, 0, $maxtoshow);
     $all_surnames = array();
     foreach (array_keys($surnames) as $n => $surname) {
         if ($n >= $maxtoshow) {
             break;
         }
         $all_surnames = array_merge($all_surnames, WT_Query_Name::surnames(WT_I18N::strtoupper($surname), '', false, false, WT_GED_ID));
     }
     $tot = 0;
     foreach ($surnames as $surname) {
         $tot += $surname['match'];
     }
     $chd = '';
     $chl = array();
     foreach ($all_surnames as $surns) {
         $count_per = 0;
         $max_name = 0;
         foreach ($surns as $spfxsurn => $indis) {
             $per = count($indis);
             $count_per += $per;
             // select most common surname from all variants
             if ($per > $max_name) {
                 $max_name = $per;
                 $top_name = $spfxsurn;
             }
         }
         switch ($SURNAME_TRADITION) {
             case 'polish':
                 // most common surname should be in male variant (Kowalski, not Kowalska)
                 $top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name);
         }
         $per = round(100 * $count_per / $tot_indi, 0);
         $chd .= self::_array_to_extended_encoding($per);
         //ToDo: RTL names are often printed LTR when also LTR names are present
         $chl[] = $top_name . ' - ' . WT_I18N::number($count_per);
     }
     $per = round(100 * ($tot_indi - $tot) / $tot_indi, 0);
     $chd .= self::_array_to_extended_encoding($per);
     $chl[] = WT_I18N::translate('Other') . ' - ' . WT_I18N::number($tot_indi - $tot);
     $chart_title = implode(WT_I18N::$list_separator, $chl);
     $chl = implode('|', $chl);
     return '<img src="https://chart.googleapis.com/chart?cht=p3&amp;chd=e:' . $chd . '&amp;chs=' . $size . '&amp;chco=' . $color_from . ',' . $color_to . '&amp;chf=bg,s,ffffff00&amp;chl=' . rawurlencode($chl) . '" width="' . $sizes[0] . '" height="' . $sizes[1] . '" alt="' . $chart_title . '" title="' . $chart_title . '" />';
 }
示例#4
0
 public function getSurnameIndis($alpha, $surname)
 {
     $indis = WT_Query_Name::individuals($surname, $alpha, '', true, false, WT_GED_ID);
     $out = '<ul>';
     foreach ($indis as $person) {
         if ($person->canShowName()) {
             $out .= '<li><a href="' . $person->getHtmlUrl() . '">' . $person->getSexImage() . ' ' . $person->getFullName() . ' ';
             if ($person->canShow()) {
                 $bd = $person->getLifeSpan();
                 if (!empty($bd)) {
                     $out .= ' (' . $bd . ')';
                 }
             }
             $out .= '</a></li>';
         }
     }
     $out .= '</ul>';
     return $out;
 }
示例#5
0
 public function getSurnameFams($alpha, $surname)
 {
     $families = WT_Query_Name::families($surname, $alpha, '', true, WT_GED_ID);
     $out = '<ul>';
     foreach ($families as $family) {
         if ($family->canShowName()) {
             $out .= '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . ' ';
             if ($family->canShow()) {
                 $marriage_year = $family->getMarriageYear();
                 if ($marriage_year) {
                     $out .= ' (' . $marriage_year . ')';
                 }
             }
             $out .= '</a></li>';
         }
     }
     $out .= '</ul>';
     return $out;
 }
示例#6
0
                            break;
                    }
                    if ($count) {
                        if ($show == 'indi' && $givn_initial == $falpha && $show_all_firstnames == 'no') {
                            $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                        } else {
                            $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                        }
                    } else {
                        $list[] = $html;
                    }
                }
                // Search spiders don't get the "show all" option as the other links give them everything.
                if (!$SEARCH_SPIDER) {
                    if ($show_all_firstnames == 'yes') {
                        $list[] = '<span class="warning">' . WT_I18N::translate('All') . '</span>';
                    } else {
                        $list[] = '<a href="' . $url . '&amp;show_all_firstnames=yes">' . WT_I18N::translate('All') . '</a>';
                    }
                }
                if ($show_all == 'no') {
                    echo '<h2 class="center">', WT_I18N::translate('Individuals with surname %s', $legend), '</h2>';
                }
                echo '<p class="center alpha_index">', join(' | ', $list), '</p>';
            }
        }
        if ($show == 'indi') {
            echo format_indi_table(WT_Query_Name::individuals($surname, $alpha, $falpha, $show_marnm, false, WT_GED_ID));
        }
    }
}