$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") print_header(WT_I18N::translate('Place hierarchy')); else print_header(WT_I18N::translate('Place List')); echo "\n\t
"; if ($display=="hierarchy" && $level == 0) { echo "

", WT_I18N::translate('Place hierarchy'), " ", $parent[$level-1],"

\n\t"; } else if ($display=="hierarchy" && $level > 0) { echo "

", WT_I18N::translate('Place hierarchy'), " - ", $parent[$level-1],"

\n\t"; } else { echo "

", WT_I18N::translate('Place List'), "

\n\t"; } // 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); $levelm = set_levelm($level, $parent); $latlng = WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM ##placelocation WHERE pl_id='{$levelm}'")->fetch(PDO::FETCH_ASSOC); for ($j=0; $j<=$highKey; $j++) { if (!isset($parent[$j])) { $parent[$j] = ""; } else { $parent[$level-1] = $latlng['pl_place']; } } 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 $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 "$ppart) { if ($j==$numls) { $ppart = rawurlencode($base_parent); } else { $ppart = rawurlencode($ppart); } $ppart = preg_replace("/amp\%3B/", "", trim($ppart)); echo "&parent[$j]=", $ppart; } } 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 '', help_link('ppp_levels'); if ($use_googlemap) { create_map(); } else { echo "

"; if (array_key_exists('places_assistant', WT_Module::getActiveModules())) { // show clickable map if found places_assistant_WT_Module::display_map($level, $parent); } } //-- 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; } } } $i=0; $ct1=count($placelist); // -- echo the array foreach ($placelist as $key => $value) { if ($i==0) { echo "\n\t\n\t\t\n\t\t"; echo"
\n\t\t\n\t\t\n\t\t"; if (($action!="show")&&($level>0)) { echo "\n\t\t"; } echo "
20) { echo "colspan=\"3\""; } elseif ($ct1 > 4) { echo "colspan=\"2\""; } echo "> "; echo "\"",  "; if ($level>0) { echo " ", WT_I18N::translate('Place Hierarchy after'), ": "; echo PrintReady($num_place); } else { echo WT_I18N::translate('Place hierarchy'); } echo help_link('ppp_placelist'); echo "
    "; } if ($i == floor(($ct1 / 3) * 2)) { echo "\n\t\t
    "; } } elseif ($ct1 > 4 && $i == floor($ct1 / 2)) { echo "\n\t\t
    "; } $i++; } if ($i>0) { echo "\n\t\t
20) { echo "colspan=\"3\""; } elseif ($ct1 > 4) { echo "colspan=\"2\""; } echo ">\n\t"; 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 "$value) { echo "&parent[", $key, "]=", urlencode(trim($value)); } 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))." "; // Sort each of the tables by Name usort($myindilist, array('WT_GedcomRecord', 'Compare')); usort($myfamlist, array('WT_GedcomRecord', 'Compare')); usort($mysourcelist, array('WT_GedcomRecord', 'Compare')); // echo each of the tables print_indi_table($myindilist, WT_I18N::translate('Individuals').' @ '.$title); print_fam_table ($myfamlist, WT_I18N::translate('Families' ).' @ '.$title); print_sour_table($mysourcelist, WT_I18N::translate('Sources' ).' @ '.$title); } } //-- 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 "\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t"; if ($i>1) { echo "\n"; } echo "\n\t\t
20 ? "3" : "2", "\"> "; echo "\"",  "; 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[$level]=".urlencode($place); $level++; if ($level>1) $revplace .= ", "; if ($place=="") $revplace .= WT_I18N::translate('unknown'); else $revplace .= $place; } echo "
  • "; echo PrintReady($revplace), "
  • \n"; $i++; if ($ct > 20) { if ($i == floor($ct / 3)) echo "\n\t\t
    "; if ($i == floor(($ct / 3) * 2)) echo "\n\t\t
    "; } else if ($i == floor($ct/2)) echo "
    \n\t\t\t"; } echo "\n\t\t
"; 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 "

\n"; if ($hasplaceform) { $placeheader = substr($header, $hasplaceform); $ct = preg_match("/2 FORM (.*)/", $placeheader, $match); if ($ct>0) { echo WT_I18N::translate('Places are encoded in the form: ').$match[1]; echo help_link('ppp_match_one'); } } else { echo WT_I18N::translate('Places are encoded in the form: '), WT_I18N::translate('City, County, State/Province, Country'), " ", WT_I18N::translate('(Default)'), help_link('ppp_default_form'); } echo "

"; if ($use_googlemap && $display=="hierarchy") map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names); print_footer();