", i18n::translate('Place Check'), "

"; //Start of User Defined options echo ""; echo ""; echo ""; echo ""; //Show Filter table if (!isset ($_POST["matching"])) {$matching=0;} else {$matching=1;} echo ""; //Show Key table echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; //Option box to select gedcom echo ""; echo ""; //Option box for 'Open in new window' echo ""; echo ""; //Option box to select top level place within Gedcom echo ""; echo ""; //Option box to select level one place within the selected top level if ($country!='XYZ') { echo ""; echo ""; } echo "
", i18n::translate('PlaceCheck List Options'), "
".i18n::translate('GEDCOM File:')."
".i18n::translate('Open links in')."
", i18n::translate('Top Level Place'), "
", i18n::translate('Level One Place'), "
"; echo "
"; echo ""; echo ""; echo "
"; echo "", i18n::translate('List filtering options'), "", help_link('PLACECHECK_FILTER','googlemap'); echo "
"; echo i18n::translate('Include fully matched places: '), help_link('PLACECHECK_MATCH','googlemap'); echo "
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
", i18n::translate('Key to colors used below'), "
", i18n::translate('PLAC'), "XX", i18n::translate('this place and its coordinates do not exist in the GoogleMap tables'), "
", i18n::translate('PLAC'), "XX", i18n::translate('this place exists in the GoogleMap tables, but has no coordinates'), "
".i18n::translate('Unknown')."XX", i18n::translate('this place level is blank in your GEDCOM file. It should be added to
GoogleMap places as "unknown" with coordinates from its parent
level before you add any place to the next level'), "
".i18n::translate('Unknown')."N55.0W75.0", i18n::translate('this place level is blank in your GEDCOM file, but exists as \'unknown\'
in the GoogleMap places table with coordinates. No action required
until the missing level can be entered'), "
"; echo "
"; echo ""; echo "
"; echo "
"; switch ($action) { case 'go': //Identify gedcom file echo "", i18n::translate('Place list for GEDCOM file'), ": ", htmlspecialchars(get_gedcom_setting($gedcom_id, 'title')), "

"; //Select all '2 PLAC ' tags in the file and create array $place_list=array(); $ged_data=WT_DB::prepare("SELECT i_gedcom FROM {$TBLPREFIX}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 {$TBLPREFIX}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 "", i18n::translate('GEDCOM File Place Data
(2 PLAC tag)'), "
"; echo "", i18n::translate('GoogleMap Places Table Data'), ""; echo ""; while ($cols<$max) { echo "", PrintReady(i18n::translate('Level')), " ", $cols, ""; $cols++; } echo ""; $cols=0; while ($cols<$max) { echo "", i18n::translate('PLAC'), "", i18n::translate('Latitude'), "", i18n::translate('Longitude'), ""; $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.="level=".count($levels); $placestr.="\">".$place_list[$x].""; $gedplace="".$placestr.""; $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 {$TBLPREFIX}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.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(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]="".$placestr2."\n"; if ($row['pl_lati']=='0'){ $lati[$z]="".$row['pl_lati'].""; } else if ($row['pl_lati']!='') { $lati[$z]="".$row['pl_lati'].""; } else { $lati[$z]="X";$matched[$x]++; } if ($row['pl_long']=='0'){ $long[$z]="".$row['pl_long'].""; } else if ($row['pl_long']!='') { $long[$z]="".$row['pl_long'].""; } else { $long[$z]="X";$matched[$x]++; } $level++; $mapstr3=$mapstr3."&parent[".$z."]=".addslashes(PrintReady($row['pl_placerequested'])); $mapstr4=$mapstr4."&parent[".$z."]=".addslashes(PrintReady(rtrim(ltrim($levels[$z])))); $z++; } if ($matching==1) { $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 "", i18n::translate('Total unique places'), ": ", $countrows, "

"; break; default: // Do not run until user selects a gedcom/place/etc. // Instead, show some useful help info. echo "

", 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; } //echo footers echo "
"; print_footer(); ?>