Example #1
0
 /**
  * print fact PLACe TEMPle STATus
  *
  * @param Fact $event gedcom fact record
  * @param bool $anchor to print a link to placelist
  * @param bool $sub_records to print place subrecords
  * @param bool $lds to print LDS TEMPle and STATus
  *
  * @return string HTML
  */
 public static function formatFactPlace(Fact $event, $anchor = false, $sub_records = false, $lds = false)
 {
     if ($anchor) {
         // Show the full place name, for facts/events tab
         $html = '<a href="' . $event->getPlace()->getURL() . '">' . $event->getPlace()->getFullName() . '</a>';
     } else {
         // Abbreviate the place name, for chart boxes
         return ' - ' . $event->getPlace()->getShortName();
     }
     if ($sub_records) {
         $placerec = Functions::getSubRecord(2, '2 PLAC', $event->getGedcom());
         if (!empty($placerec)) {
             if (preg_match_all('/\\n3 (?:_HEB|ROMN) (.+)/', $placerec, $matches)) {
                 foreach ($matches[1] as $match) {
                     $wt_place = new Place($match, $event->getParent()->getTree());
                     $html .= ' - ' . $wt_place->getFullName();
                 }
             }
             $map_lati = "";
             $cts = preg_match('/\\d LATI (.*)/', $placerec, $match);
             if ($cts > 0) {
                 $map_lati = $match[1];
                 $html .= '<br><span class="label">' . GedcomTag::getLabel('LATI') . ': </span>' . $map_lati;
             }
             $map_long = '';
             $cts = preg_match('/\\d LONG (.*)/', $placerec, $match);
             if ($cts > 0) {
                 $map_long = $match[1];
                 $html .= ' <span class="label">' . GedcomTag::getLabel('LONG') . ': </span>' . $map_long;
             }
             if ($map_lati && $map_long) {
                 $map_lati = trim(strtr($map_lati, "NSEW,�", " - -. "));
                 // S5,6789 ==> -5.6789
                 $map_long = trim(strtr($map_long, "NSEW,�", " - -. "));
                 // E3.456� ==> 3.456
                 $html .= ' <a rel="nofollow" href="https://maps.google.com/maps?q=' . $map_lati . ',' . $map_long . '" class="icon-googlemaps" title="' . I18N::translate('Google Maps™') . '"></a>';
                 $html .= ' <a rel="nofollow" href="https://www.bing.com/maps/?lvl=15&cp=' . $map_lati . '~' . $map_long . '" class="icon-bing" title="' . I18N::translate('Bing Maps™') . '"></a>';
                 $html .= ' <a rel="nofollow" href="https://www.openstreetmap.org/#map=15/' . $map_lati . '/' . $map_long . '" class="icon-osm" title="' . I18N::translate('OpenStreetMap™') . '"></a>';
             }
             if (preg_match('/\\d NOTE (.*)/', $placerec, $match)) {
                 $html .= '<br>' . self::printFactNotes($placerec, 3);
             }
         }
     }
     if ($lds) {
         if (preg_match('/2 TEMP (.*)/', $event->getGedcom(), $match)) {
             $html .= '<br>' . I18N::translate('LDS temple') . ': ' . GedcomCodeTemp::templeName($match[1]);
         }
         if (preg_match('/2 STAT (.*)/', $event->getGedcom(), $match)) {
             $html .= '<br>' . I18N::translate('Status') . ': ' . GedcomCodeStat::statusName($match[1]);
             if (preg_match('/3 DATE (.*)/', $event->getGedcom(), $match)) {
                 $date = new Date($match[1]);
                 $html .= ', ' . GedcomTag::getLabel('STAT:DATE') . ': ' . $date->display();
             }
         }
     }
     return $html;
 }