0) { $retStr = " "; $levels = explode(",", $match[1]); $place = trim($match[1]); // reverse the array so that we get the top level first $levels = array_reverse($levels); $retStr .= "$ppart) { // routine for replacing ampersands $ppart = preg_replace("/amp\%3B/", "", trim($ppart)); $retStr .= "parent[$pindex]=".PrintReady($ppart)."&"; } $retStr .= "level=".count($levels); $retStr .= "\"> ".PrintReady($place).""; return $retStr; } return ""; } function print_address_structure_map($factrec, $level) { global $WORD_WRAPPED_NOTES; global $POSTAL_CODE; // $POSTAL_CODE = 'false' - before city, 'true' - after city and/or state //-- define per gedcom till can do per address countries in address languages //-- then this will be the default when country not recognized or does not exist //-- both Finland and Suomi are valid for Finland etc. //-- see http://www.bitboost.com/ref/international-address-formats.html $nlevel = $level+1; $ct = preg_match_all("/$level ADDR(.*)/", $factrec, $omatch, PREG_SET_ORDER); for($i=0; $i<$ct; $i++) { $arec = get_sub_record($level, "$level ADDR", $factrec, $i+1); $resultText = ""; $cn = preg_match("/$nlevel _NAME (.*)/", $arec, $cmatch); if ($cn>0) $resultText .= str_replace("/", "", $cmatch[1])."
"; $resultText .= PrintReady(trim($omatch[$i][1])); $cont = get_cont($nlevel, $arec); if (!empty($cont)) $resultText .= str_replace(array(" ", " 0) echo "
"; $cs = preg_match("/$nlevel ADR1 (.*)/", $arec, $cmatch); if ($cs>0) { if ($cn==0) { $resultText .= "
"; $cn=0; } $resultText .= PrintReady($cmatch[1]); } $cs = preg_match("/$nlevel ADR2 (.*)/", $arec, $cmatch); if ($cs>0) { if ($cn==0) { $resultText .= "
"; $cn=0; } $resultText .= PrintReady($cmatch[1]); } if ($POSTAL_CODE) { if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch)) $resultText.=" ".PrintReady($cmatch[1]); if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch)) $resultText.=", ".PrintReady($cmatch[1]); if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch)) $resultText.="
".PrintReady($cmatch[1]); } else { if (preg_match("/$nlevel POST (.*)/", $arec, $cmatch)) $resultText.="
".PrintReady($cmatch[1]); if (preg_match("/$nlevel CITY (.*)/", $arec, $cmatch)) $resultText.=" ".PrintReady($cmatch[1]); if (preg_match("/$nlevel STAE (.*)/", $arec, $cmatch)) $resultText.=", ".PrintReady($cmatch[1]); } } if (preg_match("/$nlevel CTRY (.*)/", $arec, $cmatch)) $resultText.="
".PrintReady($cmatch[1]); $resultText.= "
"; // Here we can examine the resultant text and remove empty tags echo str_replace(chr(10), ' ' , $resultText); } $resultText = ""; $ct = preg_match_all("/$level PHON (.*)/", $factrec, $omatch, PREG_SET_ORDER); for($i=0; $i<$ct; $i++) { $resultText .= ""; } $ct = preg_match_all("/$level FAX (.*)/", $factrec, $omatch, PREG_SET_ORDER); for($i=0; $i<$ct; $i++) { $resultText .= ""; } $ct = preg_match_all("/$level EMAIL (.*)/", $factrec, $omatch, PREG_SET_ORDER); for($i=0; $i<$ct; $i++) { $resultText .= ""; } $ct = preg_match_all("/$level (WWW|URL) (.*)/", $factrec, $omatch, PREG_SET_ORDER); for($i=0; $i<$ct; $i++) { $resultText .= ""; } $resultText .= "
".translate_fact('PHON').": "; $resultText .= getLRM() . $omatch[$i][1]. getLRM(); $resultText .= "
".translate_fact('FAX').": "; $resultText .= getLRM() . $omatch[$i][1] . getLRM(); $resultText .= "
".translate_fact('EMAIL').": "; $resultText .= "".$omatch[$i][1].""; $resultText .= "
".translate_fact('URL').": "; $resultText .= "".$omatch[$i][2].""; $resultText .= "
"; if ($resultText!="
") echo str_replace(chr(10), ' ' , $resultText); } function rem_prefix_from_placename($prefix_list, $place, $placelist) { $prefix_split = explode(";", $prefix_list); foreach ($prefix_split as $prefix) { if (!empty($prefix)) { if (preg_match('/^'.$prefix.' (.*)/', $place, $matches) != 0) { $placelist[] = $matches[1]; } } } return $placelist; } function rem_postfix_from_placename($postfix_list, $place, $placelist) { $postfix_split = explode (";", $postfix_list); foreach ($postfix_split as $postfix) { if (!empty($postfix)) { if (preg_match('/^(.*) '.$postfix.'$/', $place, $matches) != 0) { $placelist[] = $matches[1]; } } } return $placelist; } function rem_prefix_postfix_from_placename($prefix_list, $postfix_list, $place, $placelist) { $prefix_split = explode (";", $prefix_list); $postfix_split = explode (";", $postfix_list); foreach ($prefix_split as $prefix) { if (!empty($prefix)) { foreach ($postfix_split as $postfix) { if (!empty($postfix)) { if (preg_match('/^'.$prefix.' (.*) '.$postfix.'$/', $place, $matches) != 0) { $placelist[] = $matches[1]; } } } } } return $placelist; } function create_possible_place_names ($placename, $level) { global $GM_PREFIX, $GM_POSTFIX, $GM_PRE_POST_MODE; $retlist = array(); switch (@$GM_PRE_POST_MODE[$level]) { case 0: // 0: no pre/postfix $retlist[] = $placename; break; case 1: // 1 = Normal name, Prefix, Postfix, Both $retlist[] = $placename; $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); break; case 2: // 2 = Normal name, Postfix, Prefxi, Both $retlist[] = $placename; $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); break; case 3: // 3 = Prefix, Postfix, Both, Normal name $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); $retlist[] = $placename; break; case 4: // 4 = Postfix, Prefix, Both, Normal name $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); $retlist[] = $placename; break; case 5: // 5 = Prefix, Postfix, Normal name, Both $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist[] = $placename; $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); break; case 6: // 6 = Postfix, Prefix, Normal name, Both $retlist = rem_postfix_from_placename($GM_POSTFIX[$level], $placename, $retlist); $retlist = rem_prefix_from_placename($GM_PREFIX[$level], $placename, $retlist); $retlist[] = $placename; $retlist = rem_prefix_postfix_from_placename($GM_PREFIX[$level], $GM_POSTFIX[$level], $placename, $retlist); break; } return $retlist; } function abbreviate($text) { if (utf8_strlen($text)>13) { if (trim(utf8_substr($text, 10, 1))!="") $desc = utf8_substr($text, 0, 11)."."; else $desc = trim(utf8_substr($text, 0, 11)); } else $desc = $text; return $desc; } function get_lati_long_placelocation ($place) { $parent = explode (",", $place); $parent = array_reverse($parent); $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; } $row= WT_DB::prepare("SELECT pl_lati, pl_long, pl_zoom, pl_icon, pl_level FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place") ->execute(array($place_id)) ->fetchOneRow(); if ($row) { return array('lati'=>$row->pl_lati, 'long'=>$row->pl_long, 'zoom'=>$row->pl_zoom, 'icon'=>$row->pl_icon, 'level'=>$row->pl_level); } else { return array(); } } function setup_map() { global $GOOGLEMAP_ENABLED, $GOOGLEMAP_API_KEY, $GOOGLEMAP_MAP_TYPE, $GOOGLEMAP_MIN_ZOOM, $GOOGLEMAP_MAX_ZOOM; if (!$GOOGLEMAP_ENABLED) { return; } ?> canDisplayName()) { $tool_tip.=": ".PrintReady($person->getFullName()); } } if (!empty($marker['date'])) { $date=new GedcomDate($marker['date']); $tool_tip.=" - ".$date->Display(false); } return $tool_tip; // dates & RTL is not OK - adding PrintReady does not solve it } function create_indiv_buttons() { ?> $value) { $fact = $value->getTag(); $fact_data=$value->getDetail(); $factrec = $value->getGedComRecord(); $placerec = null; if ($value->getPlace()!=null) { $placerec = get_sub_record(2, "2 PLAC", $factrec); $addrFound = false; } else { if (preg_match("/\d ADDR (.*)/", $factrec, $match)) { $placerec = get_sub_record(1, "\d ADDR", $factrec); $addrFound = true; } } if (!empty($placerec)) { $ctla = preg_match("/\d LATI (.*)/", $placerec, $match1); $ctlo = preg_match("/\d LONG (.*)/", $placerec, $match2); $spouserec = get_sub_record(2, "2 _WTS", $factrec); $ctlp = preg_match("/\d _WTS @(.*)@/", $spouserec, $spouseid); if ($ctlp>0) { $useThisItem = canDisplayRecord(WT_GED_ID, find_family_record($spouseid[1], WT_GED_ID)); } else { $useThisItem = true; } if (($ctla>0) && ($ctlo>0) && ($useThisItem==true)) { $i = $i + 1; $markers[$i]=array('class'=>'optionbox', 'index'=>'', 'tabindex'=>'', 'placed'=>'no'); if ($fact == "EVEN" || $fact=="FACT") { $eventrec = get_sub_record(1, "2 TYPE", $factrec); if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) { $markers[$i]["fact"]=$match3[1]; } else { $markers[$i]["fact"]=translate_fact($fact); } } else { $markers[$i]["fact"]=translate_fact($fact); } if (!empty($fact_data) && $fact_data!='Y') $markers[$i]["info"] = $fact_data; $markers[$i]["placerec"] = $placerec; $match1[1] = trim($match1[1]); $match2[1] = trim($match2[1]); $markers[$i]["lati"] = str_replace(array('N', 'S', ','), array('', '-', '.') , $match1[1]); $markers[$i]["lng"] = str_replace(array('E', 'W', ','), array('', '-', '.') , $match2[1]); $ctd = preg_match("/2 DATE (.+)/", $factrec, $match); if ($ctd>0) $markers[$i]["date"] = $match[1]; if ($ctlp>0) $markers[$i]["name"]=$spouseid[1]; } else { if (($placelocation == true) && ($useThisItem==true) && ($addrFound==false)) { $ctpl = preg_match("/\d PLAC (.*)/", $placerec, $match1); $latlongval = get_lati_long_placelocation($match1[1]); if ((count($latlongval) == 0) && (!empty($GM_DEFAULT_TOP_VALUE))) { $latlongval = get_lati_long_placelocation($match1[1].", ".$GM_DEFAULT_TOP_VALUE); if ((count($latlongval) != 0) && ($latlongval["level"] == 0)) { $latlongval["lati"] = NULL; $latlongval["long"] = NULL; } } if ((count($latlongval) != 0) && ($latlongval["lati"] != NULL) && ($latlongval["long"] != NULL)) { $i = $i + 1; $markers[$i]=array('class'=>'optionbox', 'index'=>'', 'tabindex'=>'', 'placed'=>'no'); if ($fact == "EVEN" || $fact=="FACT") { $eventrec = get_sub_record(1, "2 TYPE", $factrec); if (preg_match("/\d TYPE (.*)/", $eventrec, $match3)) { $markers[$i]["fact"]=$match3[1]; } else { $markers[$i]["fact"]=translate_fact($fact); } } else { $markers[$i]["fact"]=translate_fact($fact); } if (!empty($fact_data) && $fact_data!='Y') $markers[$i]["info"] = $fact_data; $markers[$i]["icon"] = $latlongval["icon"]; $markers[$i]["placerec"] = $placerec; if ($zoomLevel > $latlongval["zoom"]) $zoomLevel = $latlongval["zoom"]; $markers[$i]["lati"] = str_replace(array('N', 'S', ','), array('', '-', '.') , $latlongval["lati"]); $markers[$i]["lng"] = str_replace(array('E', 'W', ','), array('', '-', '.') , $latlongval["long"]); $ctd = preg_match("/2 DATE (.+)/", $factrec, $match); if ($ctd>0) $markers[$i]["date"] = $match[1]; if ($ctlp>0) $markers[$i]["name"]=$spouseid[1]; } } } } } // Add children to the list if (count($famids)>0) { $hparents=false; for($f=0; $fcanDisplayDetails()) { $srec = find_person_record($smatch[$j][1], WT_GED_ID); $birthrec = ''; $placerec = ''; foreach ($person->getAllFactsByType('BIRT') as $sEvent) { $birthrec = $sEvent->getGedcomRecord(); $placerec = get_sub_record(2, "2 PLAC", $birthrec); if (!empty($placerec)) { $ctd = preg_match("/\d DATE (.*)/", $birthrec, $matchd); $ctla = preg_match("/\d LATI (.*)/", $placerec, $match1); $ctlo = preg_match("/\d LONG (.*)/", $placerec, $match2); if (($ctla>0) && ($ctlo>0)) { $i = $i + 1; $markers[$i]=array('index'=>'', 'tabindex'=>'', 'placed'=>'no'); if (strpos($srec, "\n1 SEX F")!==false) { $markers[$i]["fact"] = i18n::translate('Daughter'); $markers[$i]["class"] = "person_boxF"; } else if (strpos($srec, "\n1 SEX M")!==false) { $markers[$i]["fact"] = i18n::translate('Son'); $markers[$i]["class"] = "person_box"; } else { $markers[$i]["fact"] = translate_fact('CHIL'); $markers[$i]["class"] = "person_boxNN"; } $markers[$i]["placerec"] = $placerec; $match1[1] = trim($match1[1]); $match2[1] = trim($match2[1]); $markers[$i]["lati"] = str_replace(array('N', 'S', ','), array('', '-', '.'), $match1[1]); $markers[$i]["lng"] = str_replace(array('E', 'W', ','), array('', '-', '.'), $match2[1]); if ($ctd > 0) $markers[$i]["date"] = $matchd[1]; $markers[$i]["name"] = $smatch[$j][1]; } else { if ($placelocation == true) { $ctpl = preg_match("/\d PLAC (.*)/", $placerec, $match1); $latlongval = get_lati_long_placelocation($match1[1]); if ((count($latlongval) == 0) && (!empty($GM_DEFAULT_TOP_VALUE))) { $latlongval = get_lati_long_placelocation($match1[1].", ".$GM_DEFAULT_TOP_VALUE); if ((count($latlongval) != 0) && ($latlongval["level"] == 0)) { $latlongval["lati"] = NULL; $latlongval["long"] = NULL; } } if ((count($latlongval) != 0) && ($latlongval["lati"] != NULL) && ($latlongval["long"] != NULL)) { $i = $i + 1; $markers[$i]=array('index'=>'', 'tabindex'=>'', 'placed'=>'no'); $markers[$i]["fact"] = translate_fact('CHIL'); $markers[$i]["class"] = "option_boxNN"; if (strpos($srec, "\n1 SEX F")!==false) { $markers[$i]["fact"] = i18n::translate('Daughter'); $markers[$i]["class"] = "person_boxF"; } if (strpos($srec, "\n1 SEX M")!==false) { $markers[$i]["fact"] = i18n::translate('Son'); $markers[$i]["class"] = "person_box"; } $markers[$i]["icon"] = $latlongval["icon"]; $markers[$i]["placerec"] = $placerec; if ($zoomLevel > $latlongval["zoom"]) $zoomLevel = $latlongval["zoom"]; $markers[$i]["lati"] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval["lati"]); $markers[$i]["lng"] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval["long"]); if ($ctd > 0) $markers[$i]["date"] = $matchd[1]; $markers[$i]["name"] = $smatch[$j][1]; } } } } } } } } } } } if ($i == 0) { echo "\n"; echo "\n"; echo "\n"; if (WT_USER_IS_ADMIN) { echo "\n"; } } else { ?>
".i18n::translate('No map data for this person'); //echo ""; echo "
\n"; echo "", i18n::translate('Manage GoogleMap configuration'), ""; echo "
"; foreach($markers as $marker) { echo ""; echo ""; } echo "
"; echo "{$marker["fact"]}"; if (!empty($marker["info"])) echo "{$marker["info"]}
"; if (!empty($marker["name"])) { $person=Person::getInstance($marker['name']); if ($person) { echo '', $person->canDisplayName() ? PrintReady($person->getFullName()) : i18n::translate('Private'), ''; } echo '
'; } if (preg_match("/2 PLAC (.*)/", $marker["placerec"]) == 0) { print_address_structure_map($marker["placerec"], 1); } else { echo print_fact_place_map($marker["placerec"]), "
"; } if (!empty($marker['date'])) { $date=new GedcomDate($marker['date']); echo $date->Display(true), "
"; } echo "

"; } echo "\n
"; return $i; }