$val) { if (strcasecmp($value, $val)==0) { return true; } } return false; } $action = safe_GET('action'); $display = safe_GET('display'); $parent = safe_GET('parent', WT_REGEX_UNSAFE); $level = safe_GET('level'); if (empty($action)) $action = 'find'; if (empty($display)) $display = 'hierarchy'; if ($display=='hierarchy') { $controller->setPageTitle(WT_I18N::translate('Place hierarchy')); } else { $controller->setPageTitle(WT_I18N::translate('Place List')); } $controller->pageHeader(); echo '

'; if ($display=='hierarchy' && $level == 0) { echo WT_I18N::translate('Place hierarchy'); } else if ($display=='hierarchy' && $level > 0) { echo WT_I18N::translate('Place hierarchy'), ' - ', $parent[$level-1]; } else { echo WT_I18N::translate('Place List'); } echo '

'; // Set original place name found (used later) $base_parent = $parent[$level-1]; // Make sure the "parent" array has no holes if (isset($parent) && is_array($parent)) { $parentKeys = array_keys($parent); $highKey = max($parentKeys); for ($j=0; $j<=$highKey; $j++) { if (!isset($parent[$j])) { $parent[$j] = ''; } } ksort($parent, SORT_NUMERIC); } if (!isset($parent)) $parent=array(); else { if (!is_array($parent)) $parent = array(); else $parent = array_values($parent); } // Remove slashes foreach ($parent as $p => $child) { $parent[$p] = stripLRMRLM($child); } if (!isset($level)) { $level=0; } if ($level>count($parent)) $level = count($parent); if ($level0) $squery = '&query='.urlencode($tempparent[0]); else $squery=''; for ($i=1; $i<$level; $i++) { $squery.=', '.urlencode($tempparent[$i]); } //-- if the number of places found is 0 then automatically redirect to search page if ($numfound==0) { $action='show'; } echo ''; // -- echo the breadcrumb hierarchy echo '

'; $numls=0; if ($level>0) { //-- link to search results if ((($level>1)||($parent[0]!=''))&&($numfound>0)) { echo $numfound, ' ', WT_I18N::translate('Place connections found'), ': '; } //-- breadcrumb $numls = count($parent)-1; $num_place=''; //-- place and page text orientation is opposite -> top level added at the beginning of the place text echo ''; if ($numls>=0 && (($TEXT_DIRECTION=='ltr' && hasRtLText($parent[$numls])) || ($TEXT_DIRECTION=='rtl' && !hasRtLText($parent[$numls])))) { echo WT_I18N::translate('Top Level'), ', '; } echo ''; for ($i=$numls; $i>=0; $i--) { echo ''; if (trim($parent[$i])=='') { echo WT_I18N::translate('unknown'); } else if ($i == $numls) { echo $base_parent; } else { echo PrintReady($parent[$i]); } echo ''; if ($i>0) { echo ', '; } elseif (($TEXT_DIRECTION=='rtl' && hasRtLText($parent[$i])) || ($TEXT_DIRECTION=='ltr' && !hasRtLText($parent[$i]))) { echo ', '; } if (empty($num_place)) { $num_place=$parent[$i]; } } } echo ''; //-- place and page text orientation is the same -> top level added at the end of the place text if ($level==0 || ($numls>=0 && (($TEXT_DIRECTION=='rtl' && hasRtLText($parent[$numls])) || ($TEXT_DIRECTION=='ltr' && !hasRtLText($parent[$numls]))))) { echo WT_I18N::translate('Top Level'); } echo '', '

'; //-- create a string to hold the variable links and place names $linklevels=''; if ($use_googlemap) { $placelevels=''; $place_names=array(); } for ($j=0; $j<$level; $j++) { $linklevels .= '&parent['.$j.']='.urlencode($parent[$j]); if ($use_googlemap) { if (trim($parent[$j])=='') { $placelevels = ', '.WT_I18N::translate('unknown').$placelevels; } else { $placelevels = ', '.$parent[$j].$placelevels; } } } if ($use_googlemap) { create_map($placelevels); } else { echo '

'; if (array_key_exists('places_assistant', WT_Module::getActiveModules())) { // show clickable map if found places_assistant_WT_Module::display_map($level, $parent); } } $i=0; $ct1=count($placelist); // -- echo the array foreach ($placelist as $key => $value) { if ($i==0) { echo ''; if (($action!='show')&&($level>0)) { echo ''; } echo '
20) { echo 'colspan="3"'; } elseif ($ct1 > 4) { echo 'colspan="2"'; } echo '> '; echo '', WT_I18N::translate('Place'), '  '; if ($level>0) { echo /* I18N: %s is a country or region */WT_I18N::translate('Places in %s', $num_place); } else { echo WT_I18N::translate('Place hierarchy'); } echo '
    '; } if ($i == floor(($ct1 / 3) * 2)) { echo '
    '; } } elseif ($ct1 > 4 && $i == floor($ct1 / 2)) { echo '
    '; } $i++; } if ($i>0) { echo '
20) { echo 'colspan="3"'; } elseif ($ct1 > 4) { echo 'colspan="2"'; } echo '>'; echo WT_I18N::translate('View all records found in this place'); echo help_link('ppp_view_records'); echo '
20) { echo 'colspan="3"'; } elseif ($ct1 > 4) { echo 'colspan="2"'; } echo ' style="text-align: center;">'; echo ''; if (trim($value)=='') { echo WT_I18N::translate('unknown'); } else { echo PrintReady($value); } echo ''; echo '
'; } echo ''; } $positions = get_place_positions($parent, $level); if ($level > 0) { if ($action=='show') { // -- array of names $myindilist = array(); $mysourcelist = array(); $myfamlist = array(); foreach ($positions as $position) { $record=WT_GedcomRecord::getInstance($position); switch ($record->getType()) { case 'INDI': $myindilist[]=$record; break; case 'SOUR': $mysourcelist[]=$record; break; case 'FAM': $myfamlist[]=$record; break; } } echo '
'; $title = ''; foreach ($parent as $k=>$v) { $title = $v.', '.$title; } $title = PrintReady(substr($title, 0, -2)).' '; //-- display results echo WT_JS_START; ?> jQuery(document).ready(function() { jQuery("#places-tabs").tabs(); jQuery("#places-tabs").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); });  
'; echo '
'; if ($myindilist) { echo '
', format_indi_table($myindilist), '
'; } if ($myfamlist) { echo '
', format_fam_table($myfamlist), '
'; } if ($mysourcelist) { echo '
', format_sour_table($mysourcelist), '
'; } echo '
';//close #places-tabs } } //-- list type display if ($display=='list') { $placelist = array(); $placelist=find_place_list(''); $placelist = array_unique($placelist); uasort($placelist, 'utf8_strcasecmp'); if (count($placelist)==0) { echo '', WT_I18N::translate('No results found.'), '
'; } else { echo ''; echo ''; if ($i>1) { echo ''; } echo '
 '; echo '', WT_I18N::translate('Place'), '  '; echo WT_I18N::translate('Place List'); echo help_link('ppp_placelist'); echo '
    '; $i=0; foreach ($placelist as $indexval => $revplace) { $linklevels = ''; $levels = explode(',', $revplace); // -- split the place into comma seperated values $level=0; $revplace = ''; foreach ($levels as $indexval => $place) { $place = trim($place); $linklevels .= '&parent%5B'.$level.'%5D='.urlencode($place); $level++; if ($level>1) $revplace .= ', '; if ($place=='') $revplace .= WT_I18N::translate('unknown'); else $revplace .= $place; } echo '
  • '; echo PrintReady($revplace), '
  • '; $i++; if ($ct > 20) { if ($i == floor($ct / 3)) { echo '
    '; } if ($i == floor(($ct / 3) * 2)) { echo '
    '; } } elseif ($i == floor($ct/2)) { echo '
    '; } } echo '
'; if ($i>0) { echo WT_I18N::translate('Total unique places'), ' ', $i; } echo '
'; } } echo '

', WT_I18N::translate('Show Places in Hierarchy'); } else { echo 'list">', WT_I18N::translate('Show All Places in a List'); } echo '

'; if ($use_googlemap && $display=='hierarchy') { map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names); }