config(); break; case 'flags': $this->flags(); break; case 'pedigree_map': $this->pedigree_map(); break; case 'admin_placecheck': $this->admin_placecheck(); break; case 'admin_places': case 'places_edit': // TODO: these files should be methods in this class require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php'; require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; require WT_ROOT.WT_MODULES_DIR.$this->getName().'/'.$mod_action.'.php'; break; default: header('HTTP/1.0 404 Not Found'); break; } } // Implement WT_Module_Config public function getConfigLink() { return 'module.php?mod='.$this->getName().'&mod_action=admin_config'; } // Implement WT_Module_Tab public function defaultTabOrder() { return 80; } // Implement WT_Module_Tab public function getPreLoadContent() { ob_start(); require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php'; require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; setup_map(); return ob_get_clean(); } // Implement WT_Module_Tab public function canLoadAjax() { return true; } // Implement WT_Module_Tab public function getTabContent() { global $WT_IMAGES, $controller, $GOOGLEMAP_XSIZE, $GOOGLEMAP_YSIZE; if ($this->checkMapData()) { ob_start(); require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php'; require_once WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; echo ''; echo '
'; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo '
'; if (WT_USER_IS_ADMIN) { echo ''; echo ''; echo ''; echo ''; echo '
'; echo '', WT_I18N::translate('Google Maps™ preferences'), ''; echo ''; echo '', WT_I18N::translate('Geographic data'), ''; echo ''; echo '', WT_I18N::translate('Place Check'),''; echo '
'; } echo '
'; echo '
'; echo '
'; $famids = array(); $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { $famids[] = $family->getXref(); } $indifacts = array(); foreach ($controller->record->getFacts() as $fact) { if ($fact->canShow()) { $indifacts[] = $fact; } } foreach ($controller->record->getSpouseFamilies() as $family) { foreach ($family->getFacts() as $fact) { if ($fact->canShow()) { $indifacts[] = $fact; } } } sort_facts($indifacts); build_indiv_map($controller->record, $indifacts, $famids); echo '
'; echo '
'; // start echo ''; // end echo '
'; echo ''; return '
'.ob_get_clean().'
'; } else { $html=''; $html.=''; if (WT_USER_IS_ADMIN) { $html.=''; } return $html; } } // Implement WT_Module_Tab public function hasTabContent() { global $SEARCH_SPIDER; return !$SEARCH_SPIDER && (array_key_exists('googlemap', WT_Module::getActiveModules()) || WT_USER_IS_ADMIN); } // Implement WT_Module_Tab public function isGrayedOut() { return false; } private function config() { require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; require WT_ROOT.'includes/functions/functions_edit.php'; $action=safe_REQUEST($_REQUEST, 'action'); $controller=new WT_Controller_Page(); $controller ->requireAdminLogin() ->setPageTitle(WT_I18N::translate('Google Maps™')) ->pageHeader() ->addInlineJavascript('jQuery("#tabs").tabs();'); if ($action=='update') { set_module_setting('googlemap', 'GM_MAP_TYPE', $_POST['NEW_GM_MAP_TYPE']); set_module_setting('googlemap', 'GM_USE_STREETVIEW', $_POST['NEW_GM_USE_STREETVIEW']); set_module_setting('googlemap', 'GM_MIN_ZOOM', $_POST['NEW_GM_MIN_ZOOM']); set_module_setting('googlemap', 'GM_MAX_ZOOM', $_POST['NEW_GM_MAX_ZOOM']); set_module_setting('googlemap', 'GM_XSIZE', $_POST['NEW_GM_XSIZE']); set_module_setting('googlemap', 'GM_YSIZE', $_POST['NEW_GM_YSIZE']); set_module_setting('googlemap', 'GM_PRECISION_0', $_POST['NEW_GM_PRECISION_0']); set_module_setting('googlemap', 'GM_PRECISION_1', $_POST['NEW_GM_PRECISION_1']); set_module_setting('googlemap', 'GM_PRECISION_2', $_POST['NEW_GM_PRECISION_2']); set_module_setting('googlemap', 'GM_PRECISION_3', $_POST['NEW_GM_PRECISION_3']); set_module_setting('googlemap', 'GM_PRECISION_4', $_POST['NEW_GM_PRECISION_4']); set_module_setting('googlemap', 'GM_PRECISION_5', $_POST['NEW_GM_PRECISION_5']); set_module_setting('googlemap', 'GM_DEFAULT_TOP_VALUE', $_POST['NEW_GM_DEFAULT_TOP_LEVEL']); set_module_setting('googlemap', 'GM_COORD', $_POST['NEW_GM_COORD']); set_module_setting('googlemap', 'GM_PLACE_HIERARCHY', $_POST['NEW_GM_PLACE_HIERARCHY']); set_module_setting('googlemap', 'GM_PH_XSIZE', $_POST['NEW_GM_PH_XSIZE']); set_module_setting('googlemap', 'GM_PH_YSIZE', $_POST['NEW_GM_PH_YSIZE']); set_module_setting('googlemap', 'GM_PH_MARKER', $_POST['NEW_GM_PH_MARKER']); set_module_setting('googlemap', 'GM_DISP_SHORT_PLACE', $_POST['NEW_GM_DISP_SHORT_PLACE']); for ($i=1; $i<=9; $i++) { set_module_setting('googlemap', 'GM_PREFIX_'.$i, $_POST['NEW_GM_PREFIX_'.$i]); set_module_setting('googlemap', 'GM_POSTFIX_'.$i, $_POST['NEW_GM_POSTFIX_'.$i]); } AddToLog('Googlemap config updated', 'config'); // read the config file again, to set the vars require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; } ?>
'.WT_I18N::translate('No map data for this person'); $html.='
'; $html.=''.WT_I18N::translate('Google Maps™ preferences'). ''; $html.='
WT_I18N::translate('hide'),true=>WT_I18N::translate('show')), get_module_setting('googlemap', 'GM_USE_STREETVIEW', '0')); ?>
: :
     
     
     
     
     
     
 
 
 

setPageTitle(WT_I18N::translate('Select flag')) ->pageHeader(); $countries=WT_Stats::get_all_countries(); $action=safe_REQUEST($_REQUEST, 'action'); if (isset($_REQUEST['countrySelected'])) $countrySelected = $_REQUEST['countrySelected']; if (!isset($countrySelected)) $countrySelected='Countries'; if (isset($_REQUEST['stateSelected'])) $stateSelected = $_REQUEST['stateSelected']; if (!isset($stateSelected)) $stateSelected='States'; $country = array(); $rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/flags/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $country[] = substr($file, 0, strlen($file)-4); } } closedir($rep); sort($country); if ($countrySelected == 'Countries') { $flags = $country; } else { $flags = array(); $rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $flags[] = substr($file, 0, strlen($file)-4); } } closedir($rep); sort($flags); } $flags_s = array(); if ($stateSelected != 'States' && is_dir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$stateSelected.'/')) { $rep = opendir(WT_ROOT.WT_MODULES_DIR.'googlemap/places/'.$countrySelected.'/flags/'.$stateSelected.'/'); while ($file = readdir($rep)) { if (stristr($file, '.png')) { $flags_s[] = substr($file, 0, strlen($file)-4); } } closedir($rep); sort($flags_s); } if ($action == 'ChangeFlag' && isset($_POST['FLAGS'])) { ?>

'.$flags[$i].'  ', $flags[$i], ''; } else { echo ''; } if ($j == 4) { echo ''; $j = 0; } $j++; } echo ''; ?>   ', $flags_s[$i], ''; } if ($j == 4) { echo ''; $j = 0; } $j++; } ?>
  ', $flags[$i], '

setPageTitle(/* I18N: %s is an individual’s name */ WT_I18N::translate('Pedigree map of %s', $controller->getPersonName())) ->pageHeader() ->addExternalJavascript(WT_STATIC_URL.'js/autocomplete.js') ->addInLineJavascript('var pastefield; function paste_id(value) {pastefield.value=value;}'); echo ''; echo '

', $controller->getPageTitle(), '

'; // -- print the form to change the number of displayed generations ?>
'; ?> '; ?>
treesize); $i++) { // -- check to see if we have moved to the next generation if ($i+1 >= pow(2, $curgen)) {$curgen++;} $person = WT_Individual::getInstance($controller->treeid[$i]); if (!empty($person)) { $name = $person->getFullName(); if ($name == WT_I18N::translate('Private')) $priv++; $place = $person->getBirthPlace(); if (empty($place)) { $latlongval[$i] = NULL; } else { $latlongval[$i] = get_lati_long_placelocation($person->getBirthPlace()); if ($latlongval[$i] != NULL && $latlongval[$i]['lati']=='0' && $latlongval[$i]['long']=='0') { $latlongval[$i] = NULL; } } if ($latlongval[$i] != NULL) { $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]['lati']); $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]['long']); if (($lat[$i] != NULL) && ($lon[$i] != NULL)) { $count++; } else { // The place is in the table but has empty values if ($name) { if ($missing) { $missing .= ', '; } $missing .= '' . $name . ''; $miscount++; } } } else { // There was no place, or not listed in the map table if ($name) { if ($missing) { $missing .= ', '; } $missing .= '' . $name . ''; $miscount++; } } } } // // echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; if (WT_USER_IS_ADMIN) { echo ''; echo ''; echo ''; echo ''; echo '
'; echo '', WT_I18N::translate('Google Maps™ preferences'), ''; echo ''; echo '', WT_I18N::translate('Geographic data'), ''; echo ''; echo '', WT_I18N::translate('Place Check'), ''; echo '
'; } echo '
 '; echo '
'; // display info under map echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; // print summary statistics if (isset($curgen)) { $total=pow(2,$curgen)-1; $miss=$total-$count-$priv; echo WT_I18N::plural( '%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.', '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.', $count, $count, $total, $curgen ), '
'; echo '
'; if ($priv) { echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '
'; } if ($count+$priv != $total) { if ($miscount == 0) { echo WT_I18N::translate('No ancestors in the database.'), "
"; } else { echo /* I18N: %1$d is a count of individuals, %2$s is a list of their names */ WT_I18N::plural( '%1$d individual is missing birthplace map coordinates: %2$s.', '%1$d individuals are missing birthplace map coordinates: %2$s.', $miscount, $miscount, $missing), '
'; } } } echo '
'; echo '
';// close #pedigreemap_chart echo '
';// close #pedigreemap-page ?> '; $controller->addInlineJavascript($this->pedigree_map_js($hideflags, $hidelines)); } private function pedigree_map_js($hideflags, $hidelines) { global $controller, $SHOW_HIGHLIGHT_IMAGES, $PEDIGREE_GENERATIONS; // The HomeControl returns the map to the original position and style $js='function HomeControl(controlDiv, pm_map) {'. // Set CSS styles for the DIV containing the control // Setting padding to 5 px will offset the control from the edge of the map 'controlDiv.style.paddingTop = "5px"; controlDiv.style.paddingRight = "0px";'. // Set CSS for the control border 'var controlUI = document.createElement("DIV"); controlUI.style.backgroundColor = "white"; controlUI.style.color = "black"; controlUI.style.borderColor = "black"; controlUI.style.borderColor = "black"; controlUI.style.borderStyle = "solid"; controlUI.style.borderWidth = "2px"; controlUI.style.cursor = "pointer"; controlUI.style.textAlign = "center"; controlUI.title = ""; controlDiv.appendChild(controlUI);'. // Set CSS for the control interior 'var controlText = document.createElement("DIV"); controlText.style.fontFamily = "Arial,sans-serif"; controlText.style.fontSize = "12px"; controlText.style.paddingLeft = "15px"; controlText.style.paddingRight = "15px"; controlText.innerHTML = "'.WT_I18N::translate('Redraw map').'<\/b>"; controlUI.appendChild(controlText);'. // Setup the click event listeners: simply set the map to original LatLng 'google.maps.event.addDomListener(controlUI, "click", function() { pm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN), pm_map.fitBounds(bounds), pm_map.setCenter(bounds.getCenter()), infowindow.close() if (document.getElementById(lastlinkid) != null) { document.getElementById(lastlinkid).className = "person_box:target"; } }); }'. // This function picks up the click and opens the corresponding info window 'function myclick(i) { if (document.getElementById(lastlinkid) != null) { document.getElementById(lastlinkid).className = "person_box:target"; } google.maps.event.trigger(gmarkers[i], "click"); }'. // this variable will collect the html which will eventually be placed in the side_bar 'var side_bar_html = "";'. // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there 'var gmarkers = []; var i = 0; var lastlinkid; var infowindow = new google.maps.InfoWindow({});'. // === Create an associative array of GIcons() 'var gicons = []; gicons["1"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon1.png") gicons["1"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["2"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2.png") gicons["2"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["2L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["2L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["2R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["2R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["2Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["2Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon2Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["3"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3.png") gicons["3"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["3L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["3L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["3R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["3R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["3Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["3Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon3Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["4"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4.png") gicons["4"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["4L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["4L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["4R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["4R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["4Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["4Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon4Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["5"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5.png") gicons["5"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["5L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["5L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["5R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["5R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["5Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["5Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon5Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["6"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6.png") gicons["6"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["6L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["6L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["6R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["6R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["6Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["6Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon6Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["7"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7.png") gicons["7"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["7L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["7L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["7R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["7R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["7Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["7Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon7Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor ); gicons["8"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8.png") gicons["8"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow50.png", new google.maps.Size(37, 34), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(10, 34) // Shadow anchor is base of image ); gicons["8L"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8L.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(28, 28) // Image anchor ); gicons["8L"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-left-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(32, 27) // Shadow anchor is base of image ); gicons["8R"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8R.png", new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(4, 28) // Image anchor ); gicons["8R"].shadow = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/shadow-right-large.png", new google.maps.Size(49, 32), // Shadow size new google.maps.Point(0, 0), // Shadow origin new google.maps.Point(15, 27) // Shadow anchor is base of image ); gicons["8Ls"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8Ls.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(22, 22) // Image anchor ); gicons["8Rs"] = new google.maps.MarkerImage(WT_STATIC_URL+WT_MODULES_DIR+"googlemap/images/icon8Rs.png", new google.maps.Size(24, 24), // Image size new google.maps.Point(0, 0), // Image origin new google.maps.Point(2, 22) // Image anchor );'. // / A function to create the marker and set up the event window 'function createMarker(point, name, html, mhtml, icontype) { // alert(i+". "+name+", "+icontype); var contentString = "
"+mhtml+"<\/div>";'. //create a marker with the requested icon 'var marker = new google.maps.Marker({ icon: gicons[icontype], shadow: gicons[icontype].shadow, map: pm_map, position: point, zIndex: 0 }); var linkid = "link"+i; google.maps.event.addListener(marker, "click", function() { infowindow.close(); infowindow.setContent(contentString); infowindow.open(pm_map, marker); document.getElementById(linkid).className = "person_box"; if (document.getElementById(lastlinkid) != null) { document.getElementById(lastlinkid).className = "person_box:target"; } lastlinkid=linkid; });'. // save the info we need to use later for the side_bar 'gmarkers[i] = marker;'. // add a line to the side_bar html 'side_bar_html += "
" + html +"
"; i++; return marker; };'. // create the map 'var myOptions = { zoom: 6, center: new google.maps.LatLng(0, 0), mapTypeId: google.maps.MapTypeId.TERRAIN, // ROADMAP, SATELLITE, HYBRID, TERRAIN mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR }, navigationControlOptions: { position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN }, streetViewControl: false, // Show Pegman or not scrollwheel: true }; var pm_map = new google.maps.Map(document.getElementById("pm_map"), myOptions); google.maps.event.addListener(pm_map, "maptypechanged", function() { map_type.refresh(); }); google.maps.event.addListener(pm_map, "click", function() { if (document.getElementById(lastlinkid) != null) { document.getElementById(lastlinkid).className = "person_box:target"; } infowindow.close(); });'. // Create the DIV to hold the control and call HomeControl() passing in this DIV. -- 'var homeControlDiv = document.createElement("DIV"); var homeControl = new HomeControl(homeControlDiv, pm_map); homeControlDiv.index = 1; pm_map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);'. // create the map bounds 'var bounds = new google.maps.LatLngBounds();'; // add the points $curgen=1; $priv=0; $count=0; $event = ''. ' '.WT_I18N::translate('Root').': '; $colored_line = array('1'=>'#FF0000','2'=>'#0000FF','3'=>'#00FF00', '4'=>'#FFFF00','5'=>'#00FFFF','6'=>'#FF00FF', '7'=>'#C0C0FF','8'=>'#808000'); for ($i=0; $i<($controller->treesize); $i++) { // moved up to grab the sex of the individuals $person = WT_Individual::getInstance($controller->treeid[$i]); if ($person) { $name = $person->getFullName(); // -- check to see if we have moved to the next generation if ($i+1 >= pow(2, $curgen)) { $curgen++; } // TODO: Work out which escaping is needed, as "self" relationships are generated with HTML $relationship = strip_tags(get_close_relationship_name($controller->root, $person)); $event = ''. ''.$relationship.''; // add thumbnail image if ($SHOW_HIGHLIGHT_IMAGES) { $image = $person->displayImage(); } else { $image = ''; } // end of add image $dataleft = addslashes($image) . $event . addslashes($name); $datamid = " "; $datamid .= '('.WT_I18N::translate('View Person').')'; $datamid .= ''; $dataright = '
'. WT_I18N::translate('Birth:') . ' ' . addslashes($person->getBirthDate()->Display(false)).'
'.$person->getBirthPlace(); $latlongval[$i] = get_lati_long_placelocation($person->getBirthPlace()); if ($latlongval[$i] != NULL) { $lat[$i] = (double)str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]['lati']); $lon[$i] = (double)str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]['long']); if ($lat[$i] || $lon[$i]) { if ((!$hideflags) && ($latlongval[$i]['icon'] != NULL)) { $flags[$i] = $latlongval[$i]['icon']; $ffile = strrchr($latlongval[$i]['icon'], '/'); $ffile = substr($ffile,1, strpos($ffile, '.')-1); if (empty($flags[$ffile])) { $flags[$ffile] = $i; // Only generate the flag once $js.= 'var point = new google.maps.LatLng(' . $lat[$i] . ',' . $lon[$i]. ');'; $js.= 'var Marker1_0_flag = new google.maps.MarkerImage();'; $js.= 'Marker1_0_flag.image = "'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/'.$flags[$i].'";'; $js.= 'Marker1_0_flag.shadow = "'.WT_STATIC_URL.WT_MODULES_DIR.'googlemap/images/flag_shadow.png";'; $js.= 'Marker1_0_flag.iconSize = new google.maps.Size(25, 15);'; $js.= 'Marker1_0_flag.shadowSize = new google.maps.Size(35, 45);'; $js.= 'Marker1_0_flag.iconAnchor = new google.maps.Point(1, 45);'; $js.= 'var Marker1_0 = new google.maps.LatLng(point, {icon:Marker1_0_flag});'; } } $marker_number = $curgen; $dups=0; for ($k=0; $k<$i; $k++) { if ($latlongval[$i] == $latlongval[$k]) { $dups++; switch($dups) { case 1: $marker_number = $curgen . 'L'; break; case 2: $marker_number = $curgen . 'R'; break; case 3: $marker_number = $curgen . 'Ls'; break; case 4: $marker_number = $curgen . 'Rs'; break; case 5: //adjust position where markers have same coodinates default: $marker_number = $curgen; $lon[$i] = $lon[$i]+0.0025; $lat[$i] = $lat[$i]+0.0025; break; } } } $js.= 'var point = new google.maps.LatLng('.$lat[$i].','.$lon[$i].');'; $js.= "var marker = createMarker(point, \"".addslashes($name)."\",\n\t\"
".$dataleft.$datamid.$dataright."
\", \""; $js.= "
"; $js.= "".$dataleft."".$datamid.$dataright."
\", \"".$marker_number."\");"; // Construct the polygon lines if (!$hidelines) { $to_child = (intval(($i-1)/2)); // Draw a line from parent to child if (array_key_exists($to_child, $lat) && $lat[$to_child]!=0 && $lon[$to_child]!=0) { $js.=' var linecolor; var plines; var lines = [new google.maps.LatLng('.$lat[$i].','.$lon[$i].'), new google.maps.LatLng('.$lat[$to_child].','.$lon[$to_child].')]; linecolor = "'.$colored_line[$curgen].'"; plines = new google.maps.Polygon({ paths: lines, strokeColor: linecolor, strokeOpacity: 0.8, strokeWeight: 3, fillColor: "#FF0000", fillOpacity: 0.1 }); plines.setMap(pm_map);'; } } // Extend and fit marker bounds $js.='bounds.extend(point);'; $js.='pm_map.fitBounds(bounds);'; $count++; } } } else { $latlongval[$i] = NULL; } } $js.='pm_map.setCenter(bounds.getCenter());'. // Close the sidebar highlight when the infowindow is closed 'google.maps.event.addListener(infowindow, "closeclick", function() { document.getElementById(lastlinkid).className = "person_box:target"; });'. // put the assembled side_bar_html contents into the side_bar div 'document.getElementById("side_bar").innerHTML = side_bar_html;'. // create the context menu div 'var contextmenu = document.createElement("div"); contextmenu.style.visibility="hidden"; contextmenu.innerHTML = "
  '.WT_I18N::translate('Zoom in').'  
" + "
  '.WT_I18N::translate('Zoom out').'  
" + "
  '.WT_I18N::translate('Zoom in here').'
" + "
  '.WT_I18N::translate('Zoom out here').'  
" + "
  '.WT_I18N::translate('Center map here').'  
";'. // listen for singlerightclick 'google.maps.event.addListener(pm_map,"singlerightclick", function(pixel,tile) {'. // store the "pixel" info in case we need it later // adjust the context menu location if near an egde // create a GControlPosition // apply it to the context menu, and make the context menu visible 'clickedPixel = pixel; var x=pixel.x; var y=pixel.y; if (x > pm_map.getSize().width - 120) { x = pm_map.getSize().width - 120 } if (y > pm_map.getSize().height - 100) { y = pm_map.getSize().height - 100 } var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(x,y)); pos.apply(contextmenu); contextmenu.style.visibility = "visible"; }); '. // functions that perform the context menu options 'function zoomIn() {'. // perform the requested operation 'pm_map.zoomIn();'. // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } function zoomOut() {'. // perform the requested operation 'pm_map.zoomOut();'. // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } function zoomInHere() {'. // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) pm_map.zoomIn(point,true);'. // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } function zoomOutHere() {'. // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) pm_map.setCenter(point,pm_map.getZoom()-1);'. // There is no pm_map.zoomOut() equivalent // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; } function centreMapHere() {'. // perform the requested operation 'var point = pm_map.fromContainerPixelToLatLng(clickedPixel) pm_map.setCenter(point);'. // hide the context menu now that it has been used 'contextmenu.style.visibility="hidden"; }'. // If the user clicks on the map, close the context menu 'google.maps.event.addListener(pm_map, "click", function() { contextmenu.style.visibility="hidden"; });'; return $js; } private function admin_placecheck() { require WT_ROOT.WT_MODULES_DIR.'googlemap/defaultconfig.php'; require_once WT_ROOT.WT_MODULES_DIR.'googlemap/googlemap.php'; require_once WT_ROOT.'includes/functions/functions_edit.php'; $action = safe_GET('action', '','go'); $gedcom_id = safe_GET('gedcom_id', array_keys(WT_Tree::getAll()), WT_GED_ID); $country = safe_GET('country', WT_REGEX_UNSAFE, 'XYZ'); $state = safe_GET('state', WT_REGEX_UNSAFE, 'XYZ'); $matching = safe_GET_bool('matching'); if (!empty($WT_SESSION['placecheck_gedcom_id'])) { $gedcom_id = $WT_SESSION['placecheck_gedcom_id']; } else { $WT_SESSION['placecheck_gedcom_id'] = $gedcom_id; } if (!empty($WT_SESSION['placecheck_country'])) { $country = $WT_SESSION['placecheck_country']; } else { $WT_SESSION['placecheck_country'] = $country; } if (!empty($WT_SESSION['placecheck_state'])) { $state = $WT_SESSION['placecheck_state']; } else { $WT_SESSION['placecheck_state'] = $state; } $controller=new WT_Controller_Page(); $controller ->requireAdminLogin() ->setPageTitle(WT_I18N::translate('Google Maps™')) ->pageHeader(); echo '
', WT_I18N::translate('Google Maps™ preferences'),' ', WT_I18N::translate('Geographic data'),' ', WT_I18N::translate('Place Check'),'
'; //Start of User Defined options echo '
'; echo select_edit_control('gedcom_id', WT_Tree::getIdList(), null, $gedcom_id, ' onchange="this.form.submit();"'); echo ' '; if ($country!='XYZ') { echo ' '; } echo ''; echo ''; echo '
';// close div gm_check echo ''; echo '
';//close form placecheck echo '
'; switch ($action) { case 'go': //Identify gedcom file $trees=WT_Tree::getAll(); echo '
', $trees[$gedcom_id]->tree_title_html, '
'; //Select all '2 PLAC ' tags in the file and create array $place_list=array(); $ged_data=WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_gedcom LIKE ? AND i_file=?") ->execute(array("%\n2 PLAC %", $gedcom_id)) ->fetchOneColumn(); foreach ($ged_data as $ged_datum) { preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); foreach ($matches[1] as $match) { $place_list[$match]=true; } } $ged_data=WT_DB::prepare("SELECT f_gedcom FROM `##families` WHERE f_gedcom LIKE ? AND f_file=?") ->execute(array("%\n2 PLAC %", $gedcom_id)) ->fetchOneColumn(); foreach ($ged_data as $ged_datum) { preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); foreach ($matches[1] as $match) { $place_list[$match]=true; } } // Unique list of places $place_list=array_keys($place_list); // Apply_filter if ($country=='XYZ') { $filter='.*$'; } else { $filter=preg_quote($country).'$'; if ($state!='XYZ') { $filter=preg_quote($state).', '.$filter; } } $place_list=preg_grep('/'.$filter.'/', $place_list); //sort the array, limit to unique values, and count them $place_parts=array(); usort($place_list, "utf8_strcasecmp"); $i=count($place_list); //calculate maximum no. of levels to display $x=0; $max=0; while ($x<$i) { $levels=explode(",", $place_list[$x]); $parts=count($levels); if ($parts>$max) $max=$parts; $x++;} $x=0; //scripts for edit, add and refresh ?> '; echo ''; echo ''; echo ''; echo ''; while ($cols<$max) { if ($cols == 0) { echo ''; } else { echo ''; } $cols++; } echo ''; $cols=0; while ($cols<$max) { echo ''; $cols++; } echo ''; $countrows=0; while ($x<$i) { $placestr=""; $levels=explode(",", $place_list[$x]); $parts=count($levels); $levels=array_reverse($levels); $placestr.="$ppart) { $ppart=urlencode(trim($ppart)); $placestr.="&parent[$pindex]=".$ppart.""; } $placestr.="\">".$place_list[$x].""; $gedplace=""; $z=0; $y=0; $id=0; $level=0; $matched[$x]=0;// used to exclude places where the gedcom place is matched at all levels $mapstr_edit=""; $mapstr7="')\">"; $mapstr8=""; while ($z<$parts) { if ($levels[$z]==' ' || $levels[$z]=='') $levels[$z]="unknown";// GoogleMap module uses "unknown" while GEDCOM uses , , $levels[$z]=rtrim(ltrim($levels[$z])); $placelist=create_possible_place_names($levels[$z], $z+1); // add the necessary prefix/postfix values to the place name foreach ($placelist as $key=>$placename) { $row= WT_DB::prepare("SELECT pl_id, pl_place, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") ->execute(array($z, $id, $placename)) ->fetchOneRow(PDO::FETCH_ASSOC); if (!empty($row['pl_id'])) { $row['pl_placerequested']=$levels[$z]; // keep the actual place name that was requested so we can display that instead of what is in the db break; } } if ($row['pl_id']!='') { $id=$row['pl_id']; } if ($row['pl_place']!='') { $placestr2=$mapstr_edit.$id."&level=".$level.$mapstr3.$mapstr5.WT_I18N::translate('Zoom=').$row['pl_zoom'].$mapstr6.$row['pl_placerequested'].$mapstr8; if ($row['pl_place']=='unknown') $matched[$x]++; } else { if ($levels[$z]=="unknown") { $placestr2=$mapstr_add.$id."&level=".$level.$mapstr3.$mapstr7."".rtrim(ltrim(WT_I18N::translate('unknown')))."".$mapstr8;$matched[$x]++; } else { $placestr2=$mapstr_add.$id."&place_name=".urlencode($levels[$z])."&level=".$level.$mapstr3.$mapstr7.''.rtrim(ltrim($levels[$z])).''.$mapstr8;$matched[$x]++; } } $plac[$z]="\n"; if ($row['pl_lati']=='0') { $lati[$z]=""; } elseif ($row['pl_lati']!='') { $lati[$z]=""; } else { $lati[$z]="";$matched[$x]++; } if ($row['pl_long']=='0') { $long[$z]=""; } elseif ($row['pl_long']!='') { $long[$z]=""; } else { $long[$z]="";$matched[$x]++; } $level++; $mapstr3=$mapstr3."&parent[".$z."]=".addslashes($row['pl_placerequested']); $mapstr4=$mapstr4."&parent[".$z."]=".addslashes(rtrim(ltrim($levels[$z]))); $z++; } if ($matching) { $matched[$x]=1; } if ($matched[$x]!=0) { echo $gedplace; $z=0; while ($z<$max) { if ($z<$parts) { echo $plac[$z]; echo $lati[$z]; echo $long[$z]; } else { echo ''; } $z++; } echo ''; $countrows++; } $x++; } // echo final row of table echo '
', WT_I18N::translate('Place'), '', WT_I18N::translate('Geographic data'), '
', WT_I18N::translate('Country'), '', WT_I18N::translate('Level'), ' ', $cols+1, '
', WT_Gedcom_Tag::getLabel('PLAC'), '', WT_I18N::translate('Latitude'), '', WT_I18N::translate('Longitude'), '
".$placestr."".$placestr2."".$row['pl_lati']."".$row['pl_lati']."X".$row['pl_long']."".$row['pl_long']."X   
', /* I18N: A count of places */ WT_I18N::translate('Total places: %s', WT_I18N::number($countrows)), '
'; break; default: // Do not run until user selects a gedcom/place/etc. // Instead, show some useful help info. echo '
', WT_I18N::translate('This will list all the places from the selected GEDCOM file. By default this will NOT INCLUDE places that are fully matched between the GEDCOM file and the GoogleMap tables'), '
'; break; } } private function checkMapData() { global $controller; $xrefs="'".$controller->record->getXref()."'"; $families = $controller->record->getSpouseFamilies(); foreach ($families as $family) { $xrefs.=", '".$family->getXref()."'"; } return WT_DB::prepare("SELECT COUNT(*) AS tot FROM `##placelinks` WHERE pl_gid IN (".$xrefs.") AND pl_file=?") ->execute(array(WT_GED_ID)) ->fetchOne(); } }