execute(array($id))->fetchOneRow(); $arr=array($id=>$row->pl_place)+$arr; $id=$row->pl_parent_id; } return $arr; } function get_placeid($place) { $par = explode (",", $place); $par = array_reverse($par); $place_id = 0; for ($i=0; $i $placename) { $pl_id= WT_DB::prepare("SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place") ->execute(array($i, $place_id, $placename)) ->fetchOne(); if (!empty($pl_id)) break; } if (empty($pl_id)) break; $place_id = $pl_id; } return $place_id; } function get_p_id($place) { $par = explode (",", $place); $par = array_reverse($par); $place_id = 0; for ($i=0; $i $placename) { $pl_id= WT_DB::prepare("SELECT p_id FROM `##places` WHERE p_level=? AND p_parent_id=? AND p_file=? AND p_place LIKE ? ORDER BY p_place") ->execute(array($i, $place_id, WT_GED_ID, $placename)) ->fetchOne(); if (!empty($pl_id)) break; } if (empty($pl_id)) break; $place_id = $pl_id; } return $place_id; } function set_placeid_map($level, $parent) { if (!isset($levelm)) { $levelm=0; } $fullplace = ""; if ($level==0) $levelm=0; else { for ($i=1; $i<=$level; $i++) { $fullplace .= $parent[$level-$i].", "; } $fullplace = substr($fullplace, 0, -2); $levelm = get_p_id($fullplace); } return $levelm; } function set_levelm($level, $parent) { if (!isset($levelm)) { $levelm=0; } $fullplace = ""; if ($level==0) $levelm=0; else { for ($i=1; $i<=$level; $i++) { if ($parent[$level-$i]!="") $fullplace .= $parent[$level-$i].", "; else $fullplace .= "Unknown, "; } $fullplace = substr($fullplace, 0, -2); $levelm = get_placeid($fullplace); } return $levelm; } function create_map($placelevels) { $level = safe_GET('level'); global $GOOGLEMAP_PH_XSIZE, $GOOGLEMAP_PH_YSIZE, $GOOGLEMAP_MAP_TYPE, $TEXT_DIRECTION, $levelm, $plzoom; // *** ENABLE STREETVIEW *** (boolean) ========================================================= $STREETVIEW = get_module_setting('googlemap', 'GM_USE_STREETVIEW'); // ============================================================================================= $parent = safe_GET('parent'); // create the map echo ''; echo ''; } // End Streetview window =================================================================== } function check_were_am_i($numls, $levelm) { $where_am_i=place_id_to_hierarchy($levelm); $i=$numls+1; if (!isset($levelo)) { $levelo[0]=0; } foreach (array_reverse($where_am_i, true) as $id=>$place2) { $levelo[$i]=$id; $i--; } return $levelo; } function check_place($place_names, $place) { if ($place == "Unknown") $place=""; if (in_array($place, $place_names)) { return true; } } function print_how_many_people($level, $parent) { $stats = new WT_Stats(WT_GEDCOM); $place_count_indi = 0; $place_count_fam = 0; if (!isset($parent[$level-1])) $parent[$level-1]=""; $p_id = set_placeid_map($level, $parent); $indi = $stats->_statsPlaces('INDI', false, $p_id); $fam = $stats->_statsPlaces('FAM', false, $p_id); if (!empty($indi)) { foreach ($indi as $place) { $place_count_indi=$place['tot']; } } if (!empty($fam)) { foreach ($fam as $place) { $place_count_fam=$place['tot']; } } echo "

", WT_I18N::translate('Individuals'), ": ", $place_count_indi, ", ", WT_I18N::translate('Families'), ": ", $place_count_fam; } function print_gm_markers($place2, $level, $parent, $levelm, $linklevels, $placelevels, $lastlevel=false) { global $GOOGLEMAP_COORD, $GOOGLEMAP_PH_MARKER, $GM_DISP_SHORT_PLACE, $GM_DISP_COUNT; if (($place2['lati'] == NULL) || ($place2['long'] == NULL) || (($place2['lati'] == "0") && ($place2['long'] == "0"))) { echo 'var icon_type = new google.maps.MarkerImage();\n'; echo 'icon_type.image = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png";'; echo 'icon_type.shadow = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png";'; echo 'icon_type.iconSize = google.maps.Size(20, 34);\n'; echo 'icon_type.shadowSize = google.maps.Size(37, 34);\n'; echo 'var point = new google.maps.LatLng(0, 0);\n'; if ($lastlevel) echo "var marker = createMarker(point, \"

"; else { echo "var marker = createMarker(point, \"
\", icon_type, \"", str_replace(array('‎', '‏'), array(WT_UTF8_LRM, WT_UTF8_RLM), addslashes($place2['place'])), "\");\n"; } else { $lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place2['lati']); $long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place2['long']); //delete leading zero if ($lati >= 0) { $lati = abs($lati); } elseif ($lati < 0) { $lati = "-".abs($lati); } if ($long >= 0) { $long = abs($long); } elseif ($long < 0) { $long = "-".abs($long); } // flags by kiwi3685 --- if (($place2["icon"] == NULL) || ($place2['icon'] == "") || ($GOOGLEMAP_PH_MARKER != "G_FLAG")) { echo "var icon_type = new google.maps.MarkerImage();\n"; } else { echo "var icon_type = new google.maps.MarkerImage();\n"; echo ' icon_type.image = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place2['icon'], '";'; echo ' icon_type.shadow = "', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png";'; echo " icon_type.iconSize = new google.maps.Size(25, 15);\n"; echo " icon_type.shadowSize = new google.maps.Size(35, 45);\n"; } echo "var point = new google.maps.LatLng({$lati}, {$long});\n"; if ($lastlevel) { echo "var marker = createMarker(point, \"\", icon_type, \"", $temp, "\");\n"; } } } function map_scripts($numfound, $level, $parent, $linklevels, $placelevels, $place_names) { global $GOOGLEMAP_MAP_TYPE, $GM_MAX_NOF_LEVELS, $GOOGLEMAP_PH_WHEEL, $GOOGLEMAP_PH_CONTROLS, $GOOGLEMAP_PH_MARKER, $plzoom; echo ""; echo ""; echo ""; echo ''; ?>
'; // echo ''; echo ''; $plzoom = $latlng['pl_zoom']; // Map zoom level if (WT_USER_IS_ADMIN) { $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; if ($parent && isset($parent[0]) ) { $placecheck_url .= '&country='.$parent[0]; if (isset($parent[1])) { $placecheck_url .= '&state='.$parent[1]; } } $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; if ($latlng && isset($latlng['pl_id'])) { $adminplaces_url .= '&parent='.$latlng['pl_id']; } echo '
'; $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=?") ->execute(array($levelm)) ->fetch(PDO::FETCH_ASSOC); if ($STREETVIEW && $level!=0 ) { echo '
"; echo ''; echo '
'; echo '', WT_I18N::translate('Google Maps configuration'), ''; echo ' | '; echo '', WT_I18N::translate('Edit geographic place locations'), ''; echo ' | '; echo '', WT_I18N::translate('Place Check'), ''; if (array_key_exists('batch_update', WT_Module::getActiveModules())) { $placelevels=preg_replace('/, '.WT_I18N::translate('unknown').'/', ', ', $placelevels); // replace ", unknown" with ", " $placelevels=substr($placelevels, 2); // remove the leading ", " if ($placelevels) { $batchupdate_url='module.php?mod=batch_update&mod_action=admin_batch_update&plugin=search_replace_bu_plugin&method=exact&ged='.WT_GEDCOM.'&search='.urlencode($placelevels); // exact match echo ' | '; echo '', WT_I18N::translate('Batch update'), ''; } } } echo '
'; echo '
'; if ($STREETVIEW) { ?> =1) { $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long // Check if Streetview location parameters are stored in database $placeid = $latlng['pl_id']; // Placelocation place id $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) // Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------ if (($latlng['sv_lati']==null && $latlng['sv_long']==null) || ($latlng['sv_lati']==0 && $latlng['sv_long']==0)) { $sv_lat = $pl_lati; $sv_lng = $pl_long; } // Set Street View parameters to numeric value if NULL (avoids problem with Google Street View Pane not rendering) if ($sv_dir==null) { $sv_dir=0; } if ($sv_pitch==null) { $sv_pitch=0; } if ($sv_zoom==null) { $sv_zoom=1; } $_map = WT_I18N::translate('Google Maps'); $_reset = WT_I18N::translate('Reset'); $_streetview = /* I18N: http://en.wikipedia.org/wiki/Google_street_view */ WT_I18N::translate('Google Street View'); ?>
". WT_Gedcom_Tag::getLabel('LONG')."". /* I18N: Compass bearing (in degrees), for street-view mapping */ WT_I18N::translate('Bearing')."". /* I18N: Angle of elevation (in degrees), for street-view mapping */ WT_I18N::translate('Elevation')."". WT_I18N::translate('Zoom')." "); if (WT_USER_IS_ADMIN) { echo ""; } else { echo "
"; } echo "\n"; echo "
\n"; echo "
"; echo $list_latlon; echo ""; echo "
"; echo "
\n"; } // Next line puts Place hierarchy on new row ----- echo '