->getMapData($individual)->features !== []; } /** * @param Individual $indi * * @return object */ private function getMapData(Individual $indi): object { $facts = $this->getPersonalFacts($indi); $geojson = [ 'type' => 'FeatureCollection', 'features' => [], ]; foreach ($facts as $id => $fact) { $location = new PlaceLocation($fact->place()->gedcomName()); // Use the co-ordinates from the fact (if they exist). $latitude = $fact->latitude(); $longitude = $fact->longitude(); // Use the co-ordinates from the location otherwise. if ($latitude === null || $longitude === null) { $latitude = $location->latitude(); $longitude = $location->longitude(); } if ($latitude !== null && $longitude !== null) { $geojson['features'][] = [ 'type' => 'Feature', 'id' => $id, 'geometry' => [ 'type' => 'Point', 'coordinates' => [$longitude, $latitude], ], 'properties' => [ 'icon' => static::ICONS[$fact->tag()] ?? static::DEFAULT_ICON, 'tooltip' => $fact->place()->gedcomName(), 'summary' => view('modules/places/event-sidebar', $this->summaryData($indi, $fact)), ], ]; } } return (object) $geojson; } /** * @param Individual $individual * * @return Collection * @throws Exception */ private function getPersonalFacts(Individual $individual): Collection { $facts = $individual->facts(); foreach ($individual->spouseFamilies() as $family) { $facts = $facts->merge($family->facts()); // Add birth of children from this family to the facts array foreach ($family->children() as $child) { $childsBirth = $child->facts(['BIRT'])->first(); if ($childsBirth instanceof Fact && $childsBirth->place()->gedcomName() !== '') { $facts->push($childsBirth); } } } $facts = Fact::sortFacts($facts); return $facts->filter(static function (Fact $item): bool { return $item->place()->gedcomName() !== ''; }); } /** * @param Individual $individual * @param Fact $fact * * @return array */ private function summaryData(Individual $individual, Fact $fact): array { $record = $fact->record(); $name = ''; $url = ''; $tag = $fact->label(); if ($record instanceof Family) { // Marriage $spouse = $record->spouse($individual); if ($spouse instanceof Individual) { $url = $spouse->url(); $name = $spouse->fullName(); } } elseif ($record !== $individual) { // Birth of a child $url = $record->url(); $name = $record->fullName(); $tag = I18N::translate('Birth of a child'); } return [ 'tag' => $tag, 'url' => $url, 'name' => $name, 'value' => $fact->value(), 'date' => $fact->date()->display($individual->tree(), null, true), 'place' => $fact->place(), ]; } /** * A greyed out tab has no actual content, but may perhaps have * options to create content. * * @param Individual $individual * * @return bool */ public function isGrayedOut(Individual $individual): bool { return false; } /** * Can this tab load asynchronously? * * @return bool */ public function canLoadAjax(): bool { return true; } /** * Generate the HTML content of this tab. * * @param Individual $individual * * @return string */ public function getTabContent(Individual $individual): string { return view('modules/places/tab', [ 'data' => $this->getMapData($individual), 'leaflet_config' => $this->leaflet_js_service->config(), ]); } } Uncaught RuntimeException: Headers already sent at /hp/ct/ab/dd/www/genealogie/app/Module/PlacesModule.php:1 in /hp/ct/ab/dd/www/genealogie/app/Http/Middleware/EmitResponse.php:98 Stack trace: #0 /hp/ct/ab/dd/www/genealogie/app/Http/Middleware/EmitResponse.php(59): Fisharebest\Webtrees\Http\Middleware\EmitResponse->assertHeadersNotEmitted() #1 /hp/ct/ab/dd/www/genealogie/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher)) #2 /hp/ct/ab/dd/www/genealogie/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest)) #3 /hp/ct/ab/dd/www/genealogie/app/Webtrees.php(275): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest)) #4 /hp/ct/ab/dd/www/genealogie/app/Webtrees.php(262): Fisharebest\Webtrees\Webtrees::dispatch(Object(Nyholm\Psr7\ServerRequest), Array) #5 /hp/ct/ab/dd/www/genealogie/index.php(51): Fisharebest\Webtrees\Webtrees->httpRequest() #6 {main} thrown

/hp/ct/ab/dd/www/genealogie/app/Http/Middleware/EmitResponse.php: 98