/** * {@inheritdoc } * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() */ public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { if (!$place->isEmpty()) { $parent = array_reverse(explode(',', $place->getGedcomName())); $place_id = 0; $nb_levels = count($parent); for ($i = 0; $i < $nb_levels; $i++) { $parent[$i] = trim($parent[$i]); if (empty($parent[$i])) { $parent[$i] = 'unknown'; } // GoogleMap module uses "unknown" while GEDCOM uses , , $pl_id = Database::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, $parent[$i]))->fetchOne(); if (empty($pl_id)) { break; } $place_id = $pl_id; } return $place_id; } return null; }
/** * Print places * * @param Place $place * @param type $tree * @return string */ private function printPlace($place, $tree) { if ($this->options('show_places') == true) { $place = new Place($place, $tree); $html = ' ' . I18N::translateContext('before placesnames', 'in '); if ($this->options('use_gedcom_places') == true) { $html .= $place->getShortName(); } else { $country = $this->options('country'); $new_place = array_reverse(explode(", ", $place->getGedcomName())); if (!empty($country) && $new_place[0] == $country) { unset($new_place[0]); $html .= '<span dir="auto">' . Filter::escapeHtml(implode(', ', array_reverse($new_place))) . '</span>'; } else { $html .= $place->getFullName(); } } return $html; } }
/** * Return HTML code to include a flag icon * * @param \Fisharebest\Webtrees\Place $place * @param string $icon_path * @param number $size * @return string HTML code of the inserted flag */ public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { return '<img class="flag_gm_h' . $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; }