setPageTitle(WT_I18N::translate('Place hierarchy') . ' - ' . WT_Filter::escapeHtml(end($parent)) . ''); } else { $controller->setPageTitle(WT_I18N::translate('Place hierarchy')); } } else { $controller->setPageTitle(WT_I18N::translate('Place list')); } $controller->pageHeader(); echo '
'; switch ($display) { case 'list': echo '

', $controller->getPageTitle(), '

'; $list_places=WT_Place::allPlaces(WT_GED_ID); $num_places=count($list_places); if ($num_places==0) { echo '', WT_I18N::translate('No results found.'), '
'; } else { echo ''; echo ''; echo '
'; echo WT_I18N::translate('Place list'); echo '
    '; } if ($n == (int)(($num_places / 3) * 2)) { echo '
    '; } } elseif ($n == (int)($num_places/2)) { echo '
    '; } } echo '
'; } echo '

', WT_I18N::translate('Show places in hierarchy'), '

'; break; case 'hierarchy': $all_modules = WT_Module::getActiveModules(); if (array_key_exists('googlemap', $all_modules)) { $gm_module = $all_modules['googlemap']; } else { $gm_module = null; } // Find this place and its ID $place=new WT_Place(implode(', ', array_reverse($parent)), WT_GED_ID); $place_id=$place->getPlaceId(); $child_places=$place->getChildPlaces(); $numfound=count($child_places); //-- if the number of places found is 0 then automatically redirect to search page if ($numfound==0) { $action='show'; } echo '

', $controller->getPageTitle(); // Breadcrumbs if ($place_id) { $parent_place=$place->getParentPlace(); while ($parent_place->getPlaceId()) { echo ', ', $parent_place->getPlaceName(), ''; $parent_place=$parent_place->getParentPlace(); } echo ', ', WT_I18N::translate('Top level'), ''; } echo '

'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { $linklevels=''; $placelevels=''; $place_names=array(); for ($j=0; $j<$level; $j++) { $linklevels .= '&parent['.$j.']='.rawurlencode($parent[$j]); if ($parent[$j]=='') { $placelevels = ', ' . WT_I18N::translate('unknown') . $placelevels; } else { $placelevels = ', ' . $parent[$j] . $placelevels; } } $gm_module->createMap($placelevels); } elseif (array_key_exists('places_assistant', WT_Module::getActiveModules())) { // Places Assistant is a custom/add-on module that was once part of the core code. places_assistant_WT_Module::display_map($level, $parent); } // -- echo the array foreach ($child_places as $n => $child_place) { if ($n==0) { echo ''; if ($action=='find' && $place_id) { echo ''; } echo '
20) { echo 'colspan="3"'; } elseif ($numfound > 4) { echo 'colspan="2"'; } echo '> '; if ($place_id) { echo /* I18N: %s is a country or region */ WT_I18N::translate('Places in %s', $place->getPlaceName()); } else { echo WT_I18N::translate('Place hierarchy'); } echo '
    '; } echo '
  • ', $child_place->getPlaceName(), '
  • '; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { list($tmp) = explode(', ', $child_place->getGedcomName(), 2); $place_names[$n]=$tmp; } $n++; if ($numfound > 20) { if ($n == (int)($numfound / 3)) { echo '
    '; } if ($n == (int)(($numfound / 3) * 2)) { echo '
    '; } } elseif ($numfound > 4 && $n == (int)($numfound / 2)) { echo '
    '; } } if ($child_places) { echo '
20) { echo 'colspan="3"'; } elseif ($numfound > 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 ($numfound > 4) { echo 'colspan="2"'; } echo ' style="text-align: center;">'; echo '', $place->getPlaceName(), ''; echo '
'; } echo ''; if ($place_id && $action=='show') { // -- array of names $myindilist = array(); $myfamlist = array(); $positions= WT_DB::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") ->execute(array($place_id, WT_GED_ID)) ->fetchOneColumn(); foreach ($positions as $position) { $record=WT_GedcomRecord::getInstance($position); if ($record && $record->canShow()) { if ($record instanceof WT_Individual) { $myindilist[]=$record; } if ($record instanceof WT_Family) { $myfamlist[]=$record; } } } echo '
'; //-- display results $controller ->addInlineJavascript('jQuery("#places-tabs").tabs();') ->addInlineJavascript('jQuery("#places-tabs").css("visibility", "visible");') ->addInlineJavascript('jQuery(".loading-image").css("display", "none");'); echo '
 
'; echo '
'; if ($myindilist) { echo '
', format_indi_table($myindilist), '
'; } if ($myfamlist) { echo '
', format_fam_table($myfamlist), '
'; } if (!$myindilist && !$myfamlist) { echo '
', format_indi_table(array()), '
'; } echo '
'; //
} echo '

', WT_I18N::translate('Show all places in a list'), '

'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { echo ''; $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names); } break; } echo '
'; //