&%{};]*');
$soundex_std = safe_GET_bool('soundex_std');
$soundex_dm = safe_GET_bool('soundex_dm');
$ged = safe_GET('ged');
if (empty($ged)) {
$ged = $GEDCOM;
}
$user_ancestors=array();
if (WT_USER_GEDCOM_ID) {
load_ancestors_array(WT_Person::getInstance(WT_USER_GEDCOM_ID), 1);
}
$controller=new WT_Controller_Base();
if ($surn) {
$controller->setPageTitle(/* I18N: %s is a surname */ WT_I18N::translate('Branches of the %s family', htmlspecialchars($surn)));
} else {
$controller->setPageTitle(WT_I18N::translate('Branches'));
}
$controller
->pageHeader()
->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js');
?>
';
$indis = indis_array($surn, $soundex_std, $soundex_dm);
usort($indis, array('WT_Person', 'CompareBirtDate'));
echo '
';
foreach ($indis as $person) {
$famc = $person->getPrimaryChildFamily();
// Don't show INDIs with parents in the list, as they will be shown twice.
if ($famc) {
foreach ($famc->getSpouses() as $parent) {
if (in_array($parent, $indis, true)) {
continue 2;
}
}
}
print_fams($person);
}
echo '
';
echo '';
}
echo '
'; // close branches-page
if (false) {
// These messages were added (briefly) and translated.
// Keep them in the translation template, as we will want them in the future
WT_I18N::translate('Collapse all');
WT_I18N::translate('Expand all');
}
function print_fams($person, $famid=null) {
global $surn, $soundex_std, $soundex_dm, $user_ancestors;
// select person name according to searched surname
$person_name = "";
foreach ($person->getAllNames() as $n=>$name) {
list($surn1) = explode(",", $name['sort']);
if (
// one name is a substring of the other
stripos($surn1, $surn)!==false ||
stripos($surn, $surn1)!==false ||
// one name sounds like the other
$soundex_std && WT_Soundex::compare(WT_Soundex::soundex_std($surn1), WT_Soundex::soundex_std($surn)) ||
$soundex_dm && WT_Soundex::compare(WT_Soundex::soundex_dm ($surn1), WT_Soundex::soundex_dm ($surn))
) {
$person_name = $name['full'];
break;
}
}
if (empty($person_name)) {
echo '