@@ -21,19 +21,19 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | interface ModuleMyArtJaubInterface extends ModuleCustomInterface |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Add module routes to webtrees route loader |
|
| 26 | - * |
|
| 27 | - * @param Map<\Aura\Router\Route> $router |
|
| 28 | - */ |
|
| 29 | - public function loadRoutes(Map $router): void; |
|
| 24 | + /** |
|
| 25 | + * Add module routes to webtrees route loader |
|
| 26 | + * |
|
| 27 | + * @param Map<\Aura\Router\Route> $router |
|
| 28 | + */ |
|
| 29 | + public function loadRoutes(Map $router): void; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Returns the URL of the module specific stylesheets. |
|
| 33 | - * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
| 34 | - * and fallback to default.min.css if none are found |
|
| 35 | - * |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - public function moduleCssUrl(): string; |
|
| 31 | + /** |
|
| 32 | + * Returns the URL of the module specific stylesheets. |
|
| 33 | + * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
| 34 | + * and fallback to default.min.css if none are found |
|
| 35 | + * |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + public function moduleCssUrl(): string; |
|
| 39 | 39 | } |
@@ -25,41 +25,41 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class GeoAnalysisService |
| 27 | 27 | { |
| 28 | - private ModuleService $module_service; |
|
| 28 | + private ModuleService $module_service; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Constructor for MapDefinitionsService |
|
| 32 | - * |
|
| 33 | - * @param ModuleService $module_service |
|
| 34 | - */ |
|
| 35 | - public function __construct(ModuleService $module_service) |
|
| 36 | - { |
|
| 37 | - $this->module_service = $module_service; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Constructor for MapDefinitionsService |
|
| 32 | + * |
|
| 33 | + * @param ModuleService $module_service |
|
| 34 | + */ |
|
| 35 | + public function __construct(ModuleService $module_service) |
|
| 36 | + { |
|
| 37 | + $this->module_service = $module_service; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Get all available geographical dispersion analyses. |
|
| 42 | - * |
|
| 43 | - * {@internal The list is generated based on the modules exposing ModuleGeoAnalysisProviderInterface |
|
| 44 | - * |
|
| 45 | - * @param bool $include_disabled |
|
| 46 | - * @return Collection<GeoAnalysisInterface> |
|
| 47 | - */ |
|
| 48 | - public function all(bool $include_disabled = false): Collection |
|
| 49 | - { |
|
| 50 | - /** @var Collection<GeoAnalysisInterface> $geoanalyses */ |
|
| 51 | - $geoanalyses = $this->module_service |
|
| 52 | - ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
|
| 53 | - ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
|
| 54 | - ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
| 55 | - try { |
|
| 56 | - $analysis = app($analysis_class); |
|
| 57 | - return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
|
| 58 | - } catch (BindingResolutionException $ex) { |
|
| 59 | - return null; |
|
| 60 | - } |
|
| 61 | - })->filter(); |
|
| 40 | + /** |
|
| 41 | + * Get all available geographical dispersion analyses. |
|
| 42 | + * |
|
| 43 | + * {@internal The list is generated based on the modules exposing ModuleGeoAnalysisProviderInterface |
|
| 44 | + * |
|
| 45 | + * @param bool $include_disabled |
|
| 46 | + * @return Collection<GeoAnalysisInterface> |
|
| 47 | + */ |
|
| 48 | + public function all(bool $include_disabled = false): Collection |
|
| 49 | + { |
|
| 50 | + /** @var Collection<GeoAnalysisInterface> $geoanalyses */ |
|
| 51 | + $geoanalyses = $this->module_service |
|
| 52 | + ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
|
| 53 | + ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
|
| 54 | + ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
| 55 | + try { |
|
| 56 | + $analysis = app($analysis_class); |
|
| 57 | + return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
|
| 58 | + } catch (BindingResolutionException $ex) { |
|
| 59 | + return null; |
|
| 60 | + } |
|
| 61 | + })->filter(); |
|
| 62 | 62 | |
| 63 | - return $geoanalyses; |
|
| 64 | - } |
|
| 63 | + return $geoanalyses; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $geoanalyses = $this->module_service |
| 52 | 52 | ->findByInterface(ModuleGeoAnalysisProviderInterface::class, $include_disabled) |
| 53 | 53 | ->flatMap(fn(ModuleGeoAnalysisProviderInterface $module) => $module->listGeoAnalyses()) |
| 54 | - ->map(static function (string $analysis_class): ?GeoAnalysisInterface { |
|
| 54 | + ->map(static function(string $analysis_class): ?GeoAnalysisInterface { |
|
| 55 | 55 | try { |
| 56 | 56 | $analysis = app($analysis_class); |
| 57 | 57 | return $analysis instanceof GeoAnalysisInterface ? $analysis : null; |
@@ -25,41 +25,41 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class PlaceMapperService |
| 27 | 27 | { |
| 28 | - private ModuleService $module_service; |
|
| 28 | + private ModuleService $module_service; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Constructor for PlaceMapperService |
|
| 32 | - * |
|
| 33 | - * @param ModuleService $module_service |
|
| 34 | - */ |
|
| 35 | - public function __construct(ModuleService $module_service) |
|
| 36 | - { |
|
| 37 | - $this->module_service = $module_service; |
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Constructor for PlaceMapperService |
|
| 32 | + * |
|
| 33 | + * @param ModuleService $module_service |
|
| 34 | + */ |
|
| 35 | + public function __construct(ModuleService $module_service) |
|
| 36 | + { |
|
| 37 | + $this->module_service = $module_service; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Get all place mappers available. |
|
| 42 | - * |
|
| 43 | - * {@internal The list is generated based on the modules exposing ModulePlaceMapperProviderInterface} |
|
| 44 | - * |
|
| 45 | - * @param bool $include_disabled |
|
| 46 | - * @return Collection<PlaceMapperInterface> |
|
| 47 | - */ |
|
| 48 | - public function all(bool $include_disabled = false): Collection |
|
| 49 | - { |
|
| 50 | - /** @var Collection<PlaceMapperInterface> $place_mappers */ |
|
| 51 | - $place_mappers = $this->module_service |
|
| 52 | - ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
|
| 53 | - ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
|
| 54 | - ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
| 55 | - try { |
|
| 56 | - $mapper = app($mapper_class); |
|
| 57 | - return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
|
| 58 | - } catch (BindingResolutionException $ex) { |
|
| 59 | - return null; |
|
| 60 | - } |
|
| 61 | - })->filter(); |
|
| 40 | + /** |
|
| 41 | + * Get all place mappers available. |
|
| 42 | + * |
|
| 43 | + * {@internal The list is generated based on the modules exposing ModulePlaceMapperProviderInterface} |
|
| 44 | + * |
|
| 45 | + * @param bool $include_disabled |
|
| 46 | + * @return Collection<PlaceMapperInterface> |
|
| 47 | + */ |
|
| 48 | + public function all(bool $include_disabled = false): Collection |
|
| 49 | + { |
|
| 50 | + /** @var Collection<PlaceMapperInterface> $place_mappers */ |
|
| 51 | + $place_mappers = $this->module_service |
|
| 52 | + ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
|
| 53 | + ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
|
| 54 | + ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
| 55 | + try { |
|
| 56 | + $mapper = app($mapper_class); |
|
| 57 | + return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
|
| 58 | + } catch (BindingResolutionException $ex) { |
|
| 59 | + return null; |
|
| 60 | + } |
|
| 61 | + })->filter(); |
|
| 62 | 62 | |
| 63 | - return $place_mappers; |
|
| 64 | - } |
|
| 63 | + return $place_mappers; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -48,10 +48,10 @@ |
||
| 48 | 48 | public function all(bool $include_disabled = false): Collection |
| 49 | 49 | { |
| 50 | 50 | /** @var Collection<PlaceMapperInterface> $place_mappers */ |
| 51 | - $place_mappers = $this->module_service |
|
| 51 | + $place_mappers = $this->module_service |
|
| 52 | 52 | ->findByInterface(ModulePlaceMapperProviderInterface::class, $include_disabled) |
| 53 | 53 | ->flatMap(fn(ModulePlaceMapperProviderInterface $module) => $module->listPlaceMappers()) |
| 54 | - ->map(static function (string $mapper_class): ?PlaceMapperInterface { |
|
| 54 | + ->map(static function(string $mapper_class): ?PlaceMapperInterface { |
|
| 55 | 55 | try { |
| 56 | 56 | $mapper = app($mapper_class); |
| 57 | 57 | return $mapper instanceof PlaceMapperInterface ? $mapper : null; |
@@ -24,67 +24,67 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | trait PlaceMapperTrait |
| 26 | 26 | { |
| 27 | - private ?PlaceMapperConfigInterface $config = null; |
|
| 27 | + private ?PlaceMapperConfigInterface $config = null; |
|
| 28 | 28 | |
| 29 | - /** @var array<string, mixed> $data */ |
|
| 30 | - private array $data = []; |
|
| 29 | + /** @var array<string, mixed> $data */ |
|
| 30 | + private array $data = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Implementation of PlaceMapperInterface::boot |
|
| 34 | - * |
|
| 35 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
| 36 | - */ |
|
| 37 | - public function boot(): void |
|
| 38 | - { |
|
| 39 | - } |
|
| 32 | + /** |
|
| 33 | + * Implementation of PlaceMapperInterface::boot |
|
| 34 | + * |
|
| 35 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot() |
|
| 36 | + */ |
|
| 37 | + public function boot(): void |
|
| 38 | + { |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Implementation of PlaceMapperInterface::config |
|
| 43 | - * |
|
| 44 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
| 45 | - * |
|
| 46 | - * @return PlaceMapperConfigInterface |
|
| 47 | - */ |
|
| 48 | - public function config(): PlaceMapperConfigInterface |
|
| 49 | - { |
|
| 50 | - return $this->config ?? new NullPlaceMapperConfig(); |
|
| 51 | - } |
|
| 41 | + /** |
|
| 42 | + * Implementation of PlaceMapperInterface::config |
|
| 43 | + * |
|
| 44 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config() |
|
| 45 | + * |
|
| 46 | + * @return PlaceMapperConfigInterface |
|
| 47 | + */ |
|
| 48 | + public function config(): PlaceMapperConfigInterface |
|
| 49 | + { |
|
| 50 | + return $this->config ?? new NullPlaceMapperConfig(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Implementation of PlaceMapperInterface::setConfig |
|
| 55 | - * |
|
| 56 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig() |
|
| 57 | - * |
|
| 58 | - * @param PlaceMapperConfigInterface $config |
|
| 59 | - */ |
|
| 60 | - public function setConfig(PlaceMapperConfigInterface $config): void |
|
| 61 | - { |
|
| 62 | - $this->config = $config; |
|
| 63 | - } |
|
| 53 | + /** |
|
| 54 | + * Implementation of PlaceMapperInterface::setConfig |
|
| 55 | + * |
|
| 56 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig() |
|
| 57 | + * |
|
| 58 | + * @param PlaceMapperConfigInterface $config |
|
| 59 | + */ |
|
| 60 | + public function setConfig(PlaceMapperConfigInterface $config): void |
|
| 61 | + { |
|
| 62 | + $this->config = $config; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Implementation of PlaceMapperInterface::data |
|
| 67 | - * |
|
| 68 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data() |
|
| 69 | - * |
|
| 70 | - * @param string $key |
|
| 71 | - * @return NULL|mixed |
|
| 72 | - */ |
|
| 73 | - public function data(string $key) |
|
| 74 | - { |
|
| 75 | - return $this->data[$key] ?? null; |
|
| 76 | - } |
|
| 65 | + /** |
|
| 66 | + * Implementation of PlaceMapperInterface::data |
|
| 67 | + * |
|
| 68 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data() |
|
| 69 | + * |
|
| 70 | + * @param string $key |
|
| 71 | + * @return NULL|mixed |
|
| 72 | + */ |
|
| 73 | + public function data(string $key) |
|
| 74 | + { |
|
| 75 | + return $this->data[$key] ?? null; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Implementation of PlaceMapperInterface::setData |
|
| 80 | - * |
|
| 81 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData() |
|
| 82 | - * |
|
| 83 | - * @param string $key |
|
| 84 | - * @param mixed|null $data |
|
| 85 | - */ |
|
| 86 | - public function setData(string $key, $data): void |
|
| 87 | - { |
|
| 88 | - $this->data[$key] = $data; |
|
| 89 | - } |
|
| 78 | + /** |
|
| 79 | + * Implementation of PlaceMapperInterface::setData |
|
| 80 | + * |
|
| 81 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData() |
|
| 82 | + * |
|
| 83 | + * @param string $key |
|
| 84 | + * @param mixed|null $data |
|
| 85 | + */ |
|
| 86 | + public function setData(string $key, $data): void |
|
| 87 | + { |
|
| 88 | + $this->data[$key] = $data; |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -23,104 +23,104 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class GeoAnalysisResults |
| 25 | 25 | { |
| 26 | - private GeoAnalysisResult $global; |
|
| 26 | + private GeoAnalysisResult $global; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var Collection<string, GeoAnalysisResult> $detailed |
|
| 30 | - */ |
|
| 31 | - private Collection $detailed; |
|
| 28 | + /** |
|
| 29 | + * @var Collection<string, GeoAnalysisResult> $detailed |
|
| 30 | + */ |
|
| 31 | + private Collection $detailed; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Constructor for GeoAnalysisResults |
|
| 35 | - */ |
|
| 36 | - public function __construct() |
|
| 37 | - { |
|
| 38 | - $this->global = new GeoAnalysisResult('Global', 0); |
|
| 39 | - $this->detailed = new Collection(); |
|
| 40 | - } |
|
| 33 | + /** |
|
| 34 | + * Constructor for GeoAnalysisResults |
|
| 35 | + */ |
|
| 36 | + public function __construct() |
|
| 37 | + { |
|
| 38 | + $this->global = new GeoAnalysisResult('Global', 0); |
|
| 39 | + $this->detailed = new Collection(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Global result of the geographical analysis |
|
| 44 | - * |
|
| 45 | - * @return GeoAnalysisResult |
|
| 46 | - */ |
|
| 47 | - public function global(): GeoAnalysisResult |
|
| 48 | - { |
|
| 49 | - return $this->global; |
|
| 50 | - } |
|
| 42 | + /** |
|
| 43 | + * Global result of the geographical analysis |
|
| 44 | + * |
|
| 45 | + * @return GeoAnalysisResult |
|
| 46 | + */ |
|
| 47 | + public function global(): GeoAnalysisResult |
|
| 48 | + { |
|
| 49 | + return $this->global; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * List of results by category of the geographical analysis |
|
| 54 | - * |
|
| 55 | - * @return Collection<string, GeoAnalysisResult> |
|
| 56 | - */ |
|
| 57 | - public function detailed(): Collection |
|
| 58 | - { |
|
| 59 | - return $this->detailed; |
|
| 60 | - } |
|
| 52 | + /** |
|
| 53 | + * List of results by category of the geographical analysis |
|
| 54 | + * |
|
| 55 | + * @return Collection<string, GeoAnalysisResult> |
|
| 56 | + */ |
|
| 57 | + public function detailed(): Collection |
|
| 58 | + { |
|
| 59 | + return $this->detailed; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * List of results by category of the geographical analysis. |
|
| 64 | - * The list is sorted first by the category order, then by the category description |
|
| 65 | - * |
|
| 66 | - * @return Collection<string, GeoAnalysisResult> |
|
| 67 | - */ |
|
| 68 | - public function sortedDetailed(): Collection |
|
| 69 | - { |
|
| 70 | - return $this->detailed->sortBy([ |
|
| 71 | - fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => $a->order() <=> $b->order(), |
|
| 72 | - fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => |
|
| 73 | - I18N::comparator()($a->description(), $b->description()) |
|
| 74 | - ]); |
|
| 75 | - } |
|
| 62 | + /** |
|
| 63 | + * List of results by category of the geographical analysis. |
|
| 64 | + * The list is sorted first by the category order, then by the category description |
|
| 65 | + * |
|
| 66 | + * @return Collection<string, GeoAnalysisResult> |
|
| 67 | + */ |
|
| 68 | + public function sortedDetailed(): Collection |
|
| 69 | + { |
|
| 70 | + return $this->detailed->sortBy([ |
|
| 71 | + fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => $a->order() <=> $b->order(), |
|
| 72 | + fn(GeoAnalysisResult $a, GeoAnalysisResult $b): int => |
|
| 73 | + I18N::comparator()($a->description(), $b->description()) |
|
| 74 | + ]); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Add a GeoAnalysis Place to the global result |
|
| 79 | - * |
|
| 80 | - * @param GeoAnalysisPlace $place |
|
| 81 | - */ |
|
| 82 | - public function addPlace(GeoAnalysisPlace $place): void |
|
| 83 | - { |
|
| 84 | - $this->global()->addPlace($place); |
|
| 85 | - } |
|
| 77 | + /** |
|
| 78 | + * Add a GeoAnalysis Place to the global result |
|
| 79 | + * |
|
| 80 | + * @param GeoAnalysisPlace $place |
|
| 81 | + */ |
|
| 82 | + public function addPlace(GeoAnalysisPlace $place): void |
|
| 83 | + { |
|
| 84 | + $this->global()->addPlace($place); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Add a new category to the list of results, if it does not exist yet |
|
| 89 | - * |
|
| 90 | - * @param string $description |
|
| 91 | - * @param int $order |
|
| 92 | - */ |
|
| 93 | - public function addCategory(string $description, int $order): void |
|
| 94 | - { |
|
| 95 | - if (!$this->detailed->has($description)) { |
|
| 96 | - $this->detailed->put($description, new GeoAnalysisResult($description, $order)); |
|
| 97 | - } |
|
| 98 | - } |
|
| 87 | + /** |
|
| 88 | + * Add a new category to the list of results, if it does not exist yet |
|
| 89 | + * |
|
| 90 | + * @param string $description |
|
| 91 | + * @param int $order |
|
| 92 | + */ |
|
| 93 | + public function addCategory(string $description, int $order): void |
|
| 94 | + { |
|
| 95 | + if (!$this->detailed->has($description)) { |
|
| 96 | + $this->detailed->put($description, new GeoAnalysisResult($description, $order)); |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Add a GeoAnalysis Place to a category result, if the category exist. |
|
| 102 | - * |
|
| 103 | - * @param string $category_name |
|
| 104 | - * @param GeoAnalysisPlace $place |
|
| 105 | - */ |
|
| 106 | - public function addPlaceInCreatedCategory(string $category_name, GeoAnalysisPlace $place): void |
|
| 107 | - { |
|
| 108 | - if ($this->detailed->has($category_name)) { |
|
| 109 | - $this->detailed->get($category_name)->addPlace($place); |
|
| 110 | - } |
|
| 111 | - } |
|
| 100 | + /** |
|
| 101 | + * Add a GeoAnalysis Place to a category result, if the category exist. |
|
| 102 | + * |
|
| 103 | + * @param string $category_name |
|
| 104 | + * @param GeoAnalysisPlace $place |
|
| 105 | + */ |
|
| 106 | + public function addPlaceInCreatedCategory(string $category_name, GeoAnalysisPlace $place): void |
|
| 107 | + { |
|
| 108 | + if ($this->detailed->has($category_name)) { |
|
| 109 | + $this->detailed->get($category_name)->addPlace($place); |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Add a GeoAnalysis Place to a category result, after creating the category if it does not exist. |
|
| 115 | - * |
|
| 116 | - * @param string $category_name |
|
| 117 | - * @param GeoAnalysisPlace $place |
|
| 118 | - */ |
|
| 119 | - public function addPlaceInCategory(string $category_name, int $category_order, GeoAnalysisPlace $place): void |
|
| 120 | - { |
|
| 121 | - if (!$this->detailed->has($category_name)) { |
|
| 122 | - $this->addCategory($category_name, $category_order); |
|
| 123 | - } |
|
| 124 | - $this->addPlaceInCreatedCategory($category_name, $place); |
|
| 125 | - } |
|
| 113 | + /** |
|
| 114 | + * Add a GeoAnalysis Place to a category result, after creating the category if it does not exist. |
|
| 115 | + * |
|
| 116 | + * @param string $category_name |
|
| 117 | + * @param GeoAnalysisPlace $place |
|
| 118 | + */ |
|
| 119 | + public function addPlaceInCategory(string $category_name, int $category_order, GeoAnalysisPlace $place): void |
|
| 120 | + { |
|
| 121 | + if (!$this->detailed->has($category_name)) { |
|
| 122 | + $this->addCategory($category_name, $category_order); |
|
| 123 | + } |
|
| 124 | + $this->addPlaceInCreatedCategory($category_name, $place); |
|
| 125 | + } |
|
| 126 | 126 | } |
@@ -22,51 +22,51 @@ |
||
| 22 | 22 | |
| 23 | 23 | class GeoAnalysisTable extends AbstractGeoAnalysisView |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * {@inheritDoc} |
|
| 27 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::type() |
|
| 28 | - */ |
|
| 29 | - public function type(): string |
|
| 30 | - { |
|
| 31 | - return I18N::translateContext('GEODISPERSION', 'Table'); |
|
| 32 | - } |
|
| 25 | + /** |
|
| 26 | + * {@inheritDoc} |
|
| 27 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::type() |
|
| 28 | + */ |
|
| 29 | + public function type(): string |
|
| 30 | + { |
|
| 31 | + return I18N::translateContext('GEODISPERSION', 'Table'); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * {@inheritDoc} |
|
| 36 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon() |
|
| 37 | - */ |
|
| 38 | - public function icon(ModuleInterface $module): string |
|
| 39 | - { |
|
| 40 | - return view($module->name() . '::icons/view-table', ['type' => $this->type()]); |
|
| 41 | - } |
|
| 34 | + /** |
|
| 35 | + * {@inheritDoc} |
|
| 36 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon() |
|
| 37 | + */ |
|
| 38 | + public function icon(ModuleInterface $module): string |
|
| 39 | + { |
|
| 40 | + return view($module->name() . '::icons/view-table', ['type' => $this->type()]); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * {@inheritDoc} |
|
| 45 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent() |
|
| 46 | - */ |
|
| 47 | - public function globalSettingsContent(ModuleInterface $module): string |
|
| 48 | - { |
|
| 49 | - return ''; |
|
| 50 | - } |
|
| 43 | + /** |
|
| 44 | + * {@inheritDoc} |
|
| 45 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent() |
|
| 46 | + */ |
|
| 47 | + public function globalSettingsContent(ModuleInterface $module): string |
|
| 48 | + { |
|
| 49 | + return ''; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * {@inheritDoc} |
|
| 54 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate() |
|
| 55 | - * @return $this |
|
| 56 | - */ |
|
| 57 | - public function withGlobalSettingsUpdate(ServerRequestInterface $request): self |
|
| 58 | - { |
|
| 59 | - return $this; |
|
| 60 | - } |
|
| 52 | + /** |
|
| 53 | + * {@inheritDoc} |
|
| 54 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate() |
|
| 55 | + * @return $this |
|
| 56 | + */ |
|
| 57 | + public function withGlobalSettingsUpdate(ServerRequestInterface $request): self |
|
| 58 | + { |
|
| 59 | + return $this; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * {@inheritDoc} |
|
| 64 | - * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent() |
|
| 65 | - */ |
|
| 66 | - public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string |
|
| 67 | - { |
|
| 68 | - return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [ |
|
| 69 | - 'result' => $result |
|
| 70 | - ]); |
|
| 71 | - } |
|
| 62 | + /** |
|
| 63 | + * {@inheritDoc} |
|
| 64 | + * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent() |
|
| 65 | + */ |
|
| 66 | + public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string |
|
| 67 | + { |
|
| 68 | + return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [ |
|
| 69 | + 'result' => $result |
|
| 70 | + ]); |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function icon(ModuleInterface $module): string |
| 39 | 39 | { |
| 40 | - return view($module->name() . '::icons/view-table', ['type' => $this->type()]); |
|
| 40 | + return view($module->name().'::icons/view-table', ['type' => $this->type()]); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string |
| 67 | 67 | { |
| 68 | - return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [ |
|
| 68 | + return view($module->name().'::geoanalysisview-tab-glb-table', $params + [ |
|
| 69 | 69 | 'result' => $result |
| 70 | 70 | ]); |
| 71 | 71 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // How to update the database schema for this module |
| 74 | 74 | private const SCHEMA_TARGET_VERSION = 3; |
| 75 | 75 | private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
| 76 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 76 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
| 77 | 77 | /** |
| 78 | 78 | * {@inheritDoc} |
| 79 | 79 | * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
@@ -113,25 +113,25 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function loadRoutes(Map $router): void |
| 115 | 115 | { |
| 116 | - $router->attach('', '', static function (Map $router): void { |
|
| 116 | + $router->attach('', '', static function(Map $router): void { |
|
| 117 | 117 | |
| 118 | - $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
| 118 | + $router->attach('', '/module-maj/sosa', static function(Map $router): void { |
|
| 119 | 119 | |
| 120 | - $router->attach('', '/list', static function (Map $router): void { |
|
| 120 | + $router->attach('', '/list', static function(Map $router): void { |
|
| 121 | 121 | $router->tokens(['gen' => '\d+']); |
| 122 | 122 | $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class); |
| 123 | - $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 124 | - $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 123 | + $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 124 | + $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 125 | 125 | $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
| 126 | 126 | }); |
| 127 | 127 | |
| 128 | - $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
| 128 | + $router->attach('', '/statistics/{tree}', static function(Map $router): void { |
|
| 129 | 129 | |
| 130 | 130 | $router->get(SosaStatistics::class, '', SosaStatistics::class); |
| 131 | 131 | $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
| 132 | 132 | }); |
| 133 | 133 | |
| 134 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 134 | + $router->attach('', '/config/{tree}', static function(Map $router): void { |
|
| 135 | 135 | |
| 136 | 136 | $router->get(SosaConfig::class, '', SosaConfig::class); |
| 137 | 137 | $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function headContent(): string |
| 232 | 232 | { |
| 233 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 233 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function bodyContent(): string |
| 241 | 241 | { |
| 242 | - return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
| 242 | + return '<script src="'.$this->assetUrl('js/sosa.min.js').'"></script>'; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | { |
| 251 | 251 | $user = Auth::check() ? Auth::user() : new DefaultUser(); |
| 252 | 252 | |
| 253 | - return view($this->name() . '::sidebar/title', [ |
|
| 253 | + return view($this->name().'::sidebar/title', [ |
|
| 254 | 254 | 'module_name' => $this->name(), |
| 255 | 255 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
| 256 | 256 | ]); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
| 267 | 267 | $user = Auth::check() ? Auth::user() : new DefaultUser(); |
| 268 | 268 | |
| 269 | - return view($this->name() . '::sidebar/content', [ |
|
| 269 | + return view($this->name().'::sidebar/content', [ |
|
| 270 | 270 | 'sosa_ancestor' => $individual, |
| 271 | 271 | 'sosa_root' => $sosa_root, |
| 272 | 272 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | public function listSubscribedHooks(): array |
| 313 | 313 | { |
| 314 | 314 | return [ |
| 315 | - app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
| 315 | + app()->makeWith(SosaIconHook::class, ['module' => $this]) |
|
| 316 | 316 | ]; |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -57,261 +57,261 @@ |
||
| 57 | 57 | * Identify and produce statistics about Sosa ancestors |
| 58 | 58 | */ |
| 59 | 59 | class SosaModule extends AbstractModule implements |
| 60 | - ModuleMyArtJaubInterface, |
|
| 61 | - ModuleGlobalInterface, |
|
| 62 | - ModuleMenuInterface, |
|
| 63 | - ModuleSidebarInterface, |
|
| 64 | - ModuleGeoAnalysisProviderInterface, |
|
| 65 | - ModuleHookSubscriberInterface |
|
| 60 | + ModuleMyArtJaubInterface, |
|
| 61 | + ModuleGlobalInterface, |
|
| 62 | + ModuleMenuInterface, |
|
| 63 | + ModuleSidebarInterface, |
|
| 64 | + ModuleGeoAnalysisProviderInterface, |
|
| 65 | + ModuleHookSubscriberInterface |
|
| 66 | 66 | { |
| 67 | - use ModuleMyArtJaubTrait { |
|
| 68 | - boot as traitBoot; |
|
| 69 | - } |
|
| 70 | - use ModuleGlobalTrait; |
|
| 71 | - use ModuleMenuTrait; |
|
| 72 | - use ModuleSidebarTrait; |
|
| 73 | - |
|
| 74 | - // How to update the database schema for this module |
|
| 75 | - private const SCHEMA_TARGET_VERSION = 3; |
|
| 76 | - private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 77 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 67 | + use ModuleMyArtJaubTrait { |
|
| 68 | + boot as traitBoot; |
|
| 69 | + } |
|
| 70 | + use ModuleGlobalTrait; |
|
| 71 | + use ModuleMenuTrait; |
|
| 72 | + use ModuleSidebarTrait; |
|
| 73 | + |
|
| 74 | + // How to update the database schema for this module |
|
| 75 | + private const SCHEMA_TARGET_VERSION = 3; |
|
| 76 | + private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
| 77 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 78 | 78 | /** |
| 79 | - * {@inheritDoc} |
|
| 80 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
| 81 | - */ |
|
| 82 | - public function title(): string |
|
| 83 | - { |
|
| 84 | - return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * {@inheritDoc} |
|
| 89 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
| 90 | - */ |
|
| 91 | - public function description(): string |
|
| 92 | - { |
|
| 93 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 94 | - return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * {@inheritDoc} |
|
| 99 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
| 100 | - */ |
|
| 101 | - public function boot(): void |
|
| 102 | - { |
|
| 103 | - $this->traitBoot(); |
|
| 104 | - app(MigrationService::class)->updateSchema( |
|
| 105 | - self::SCHEMA_MIGRATION_PREFIX, |
|
| 106 | - self::SCHEMA_SETTING_NAME, |
|
| 107 | - self::SCHEMA_TARGET_VERSION |
|
| 108 | - ); |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * {@inheritDoc} |
|
| 113 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
| 114 | - */ |
|
| 115 | - public function loadRoutes(Map $router): void |
|
| 116 | - { |
|
| 117 | - $router->attach('', '', static function (Map $router): void { |
|
| 118 | - |
|
| 119 | - $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
| 120 | - |
|
| 121 | - $router->attach('', '/list', static function (Map $router): void { |
|
| 122 | - $router->tokens(['gen' => '\d+']); |
|
| 123 | - $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class); |
|
| 124 | - $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 125 | - $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 126 | - $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
|
| 127 | - }); |
|
| 128 | - |
|
| 129 | - $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
| 130 | - |
|
| 131 | - $router->get(SosaStatistics::class, '', SosaStatistics::class); |
|
| 132 | - $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
|
| 133 | - }); |
|
| 134 | - |
|
| 135 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 136 | - |
|
| 137 | - $router->get(SosaConfig::class, '', SosaConfig::class); |
|
| 138 | - $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
|
| 139 | - $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class); |
|
| 140 | - $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class); |
|
| 141 | - }); |
|
| 142 | - }); |
|
| 143 | - }); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * {@inheritDoc} |
|
| 148 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
| 149 | - */ |
|
| 150 | - public function customModuleVersion(): string |
|
| 151 | - { |
|
| 152 | - return '2.1.3-v.1'; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * {@inheritDoc} |
|
| 157 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 158 | - */ |
|
| 159 | - public function defaultMenuOrder(): int |
|
| 160 | - { |
|
| 161 | - return 7; |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * {@inhericDoc} |
|
| 166 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 167 | - */ |
|
| 168 | - public function getMenu(Tree $tree): ?Menu |
|
| 169 | - { |
|
| 170 | - $menu = new Menu(I18N::translate('Sosa Statistics')); |
|
| 171 | - $menu->setClass('menu-maj-sosa'); |
|
| 172 | - $menu->setSubmenus([ |
|
| 173 | - new Menu( |
|
| 174 | - I18N::translate('Sosa Ancestors'), |
|
| 175 | - route(AncestorsList::class, ['tree' => $tree->name()]), |
|
| 176 | - 'menu-maj-sosa-list', |
|
| 177 | - ['rel' => 'nofollow'] |
|
| 178 | - ), |
|
| 179 | - new Menu( |
|
| 180 | - I18N::translate('Missing Ancestors'), |
|
| 181 | - route(MissingAncestorsList::class, ['tree' => $tree->name()]), |
|
| 182 | - 'menu-maj-sosa-missing', |
|
| 183 | - ['rel' => 'nofollow'] |
|
| 184 | - ), |
|
| 185 | - new Menu( |
|
| 186 | - I18N::translate('Sosa Statistics'), |
|
| 187 | - route(SosaStatistics::class, ['tree' => $tree->name()]), |
|
| 188 | - 'menu-maj-sosa-stats' |
|
| 189 | - ) |
|
| 190 | - ]); |
|
| 191 | - |
|
| 192 | - if (Auth::check()) { |
|
| 193 | - $menu->addSubmenu(new Menu( |
|
| 194 | - I18N::translate('Sosa Configuration'), |
|
| 195 | - route(SosaConfig::class, ['tree' => $tree->name()]), |
|
| 196 | - 'menu-maj-sosa-config' |
|
| 197 | - )); |
|
| 198 | - |
|
| 199 | - /** @var ServerRequestInterface $request */ |
|
| 200 | - $request = app(ServerRequestInterface::class); |
|
| 201 | - $route = Validator::attributes($request)->route(); |
|
| 202 | - |
|
| 203 | - $root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
| 204 | - |
|
| 205 | - if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) { |
|
| 206 | - $xref = Validator::attributes($request)->isXref()->string('xref', ''); |
|
| 207 | - |
|
| 208 | - $menu->addSubmenu(new Menu( |
|
| 209 | - I18N::translate('Complete Sosas'), |
|
| 210 | - '#', |
|
| 211 | - 'menu-maj-sosa-compute', |
|
| 212 | - [ |
|
| 213 | - 'rel' => 'nofollow', |
|
| 214 | - 'data-wt-href' => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]), |
|
| 215 | - 'data-bs-target' => '#wt-ajax-modal', |
|
| 216 | - 'data-bs-toggle' => 'modal', |
|
| 217 | - 'data-bs-backdrop' => 'static' |
|
| 218 | - ] |
|
| 219 | - )); |
|
| 220 | - } |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - return $menu; |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * {@inheritDoc} |
|
| 228 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
| 229 | - */ |
|
| 230 | - public function headContent(): string |
|
| 231 | - { |
|
| 232 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * {@inheritDoc} |
|
| 237 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
| 238 | - */ |
|
| 239 | - public function bodyContent(): string |
|
| 240 | - { |
|
| 241 | - return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * {@inheritDoc} |
|
| 246 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle() |
|
| 247 | - */ |
|
| 248 | - public function sidebarTitle(Individual $individual): string |
|
| 249 | - { |
|
| 250 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 251 | - |
|
| 252 | - return view($this->name() . '::sidebar/title', [ |
|
| 253 | - 'module_name' => $this->name(), |
|
| 254 | - 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
| 255 | - ]); |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - /** |
|
| 259 | - * {@inheritDoc} |
|
| 260 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
| 261 | - */ |
|
| 262 | - public function getSidebarContent(Individual $individual): string |
|
| 263 | - { |
|
| 264 | - $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
| 265 | - $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
|
| 266 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 267 | - |
|
| 268 | - return view($this->name() . '::sidebar/content', [ |
|
| 269 | - 'sosa_ancestor' => $individual, |
|
| 270 | - 'sosa_root' => $sosa_root, |
|
| 271 | - 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
| 272 | - ]); |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * {@inheritDoc} |
|
| 277 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
| 278 | - */ |
|
| 279 | - public function hasSidebarContent(Individual $individual): bool |
|
| 280 | - { |
|
| 281 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 282 | - |
|
| 283 | - return app(SosaRecordsService::class) |
|
| 284 | - ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * {@inheritDoc} |
|
| 289 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
|
| 290 | - */ |
|
| 291 | - public function defaultSidebarOrder(): int |
|
| 292 | - { |
|
| 293 | - return 1; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * {@inheritDoc} |
|
| 298 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses() |
|
| 299 | - */ |
|
| 300 | - public function listGeoAnalyses(): array |
|
| 301 | - { |
|
| 302 | - return [ |
|
| 303 | - SosaByGenerationGeoAnalysis::class |
|
| 304 | - ]; |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * {@inheritDoc} |
|
| 309 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
| 310 | - */ |
|
| 311 | - public function listSubscribedHooks(): array |
|
| 312 | - { |
|
| 313 | - return [ |
|
| 314 | - app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
| 315 | - ]; |
|
| 316 | - } |
|
| 79 | + * {@inheritDoc} |
|
| 80 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
| 81 | + */ |
|
| 82 | + public function title(): string |
|
| 83 | + { |
|
| 84 | + return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * {@inheritDoc} |
|
| 89 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
| 90 | + */ |
|
| 91 | + public function description(): string |
|
| 92 | + { |
|
| 93 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 94 | + return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * {@inheritDoc} |
|
| 99 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
| 100 | + */ |
|
| 101 | + public function boot(): void |
|
| 102 | + { |
|
| 103 | + $this->traitBoot(); |
|
| 104 | + app(MigrationService::class)->updateSchema( |
|
| 105 | + self::SCHEMA_MIGRATION_PREFIX, |
|
| 106 | + self::SCHEMA_SETTING_NAME, |
|
| 107 | + self::SCHEMA_TARGET_VERSION |
|
| 108 | + ); |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * {@inheritDoc} |
|
| 113 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
| 114 | + */ |
|
| 115 | + public function loadRoutes(Map $router): void |
|
| 116 | + { |
|
| 117 | + $router->attach('', '', static function (Map $router): void { |
|
| 118 | + |
|
| 119 | + $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
| 120 | + |
|
| 121 | + $router->attach('', '/list', static function (Map $router): void { |
|
| 122 | + $router->tokens(['gen' => '\d+']); |
|
| 123 | + $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class); |
|
| 124 | + $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 125 | + $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 126 | + $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
|
| 127 | + }); |
|
| 128 | + |
|
| 129 | + $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
| 130 | + |
|
| 131 | + $router->get(SosaStatistics::class, '', SosaStatistics::class); |
|
| 132 | + $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
|
| 133 | + }); |
|
| 134 | + |
|
| 135 | + $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 136 | + |
|
| 137 | + $router->get(SosaConfig::class, '', SosaConfig::class); |
|
| 138 | + $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
|
| 139 | + $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class); |
|
| 140 | + $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class); |
|
| 141 | + }); |
|
| 142 | + }); |
|
| 143 | + }); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * {@inheritDoc} |
|
| 148 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
| 149 | + */ |
|
| 150 | + public function customModuleVersion(): string |
|
| 151 | + { |
|
| 152 | + return '2.1.3-v.1'; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * {@inheritDoc} |
|
| 157 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
| 158 | + */ |
|
| 159 | + public function defaultMenuOrder(): int |
|
| 160 | + { |
|
| 161 | + return 7; |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * {@inhericDoc} |
|
| 166 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
| 167 | + */ |
|
| 168 | + public function getMenu(Tree $tree): ?Menu |
|
| 169 | + { |
|
| 170 | + $menu = new Menu(I18N::translate('Sosa Statistics')); |
|
| 171 | + $menu->setClass('menu-maj-sosa'); |
|
| 172 | + $menu->setSubmenus([ |
|
| 173 | + new Menu( |
|
| 174 | + I18N::translate('Sosa Ancestors'), |
|
| 175 | + route(AncestorsList::class, ['tree' => $tree->name()]), |
|
| 176 | + 'menu-maj-sosa-list', |
|
| 177 | + ['rel' => 'nofollow'] |
|
| 178 | + ), |
|
| 179 | + new Menu( |
|
| 180 | + I18N::translate('Missing Ancestors'), |
|
| 181 | + route(MissingAncestorsList::class, ['tree' => $tree->name()]), |
|
| 182 | + 'menu-maj-sosa-missing', |
|
| 183 | + ['rel' => 'nofollow'] |
|
| 184 | + ), |
|
| 185 | + new Menu( |
|
| 186 | + I18N::translate('Sosa Statistics'), |
|
| 187 | + route(SosaStatistics::class, ['tree' => $tree->name()]), |
|
| 188 | + 'menu-maj-sosa-stats' |
|
| 189 | + ) |
|
| 190 | + ]); |
|
| 191 | + |
|
| 192 | + if (Auth::check()) { |
|
| 193 | + $menu->addSubmenu(new Menu( |
|
| 194 | + I18N::translate('Sosa Configuration'), |
|
| 195 | + route(SosaConfig::class, ['tree' => $tree->name()]), |
|
| 196 | + 'menu-maj-sosa-config' |
|
| 197 | + )); |
|
| 198 | + |
|
| 199 | + /** @var ServerRequestInterface $request */ |
|
| 200 | + $request = app(ServerRequestInterface::class); |
|
| 201 | + $route = Validator::attributes($request)->route(); |
|
| 202 | + |
|
| 203 | + $root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
| 204 | + |
|
| 205 | + if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) { |
|
| 206 | + $xref = Validator::attributes($request)->isXref()->string('xref', ''); |
|
| 207 | + |
|
| 208 | + $menu->addSubmenu(new Menu( |
|
| 209 | + I18N::translate('Complete Sosas'), |
|
| 210 | + '#', |
|
| 211 | + 'menu-maj-sosa-compute', |
|
| 212 | + [ |
|
| 213 | + 'rel' => 'nofollow', |
|
| 214 | + 'data-wt-href' => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]), |
|
| 215 | + 'data-bs-target' => '#wt-ajax-modal', |
|
| 216 | + 'data-bs-toggle' => 'modal', |
|
| 217 | + 'data-bs-backdrop' => 'static' |
|
| 218 | + ] |
|
| 219 | + )); |
|
| 220 | + } |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + return $menu; |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * {@inheritDoc} |
|
| 228 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
| 229 | + */ |
|
| 230 | + public function headContent(): string |
|
| 231 | + { |
|
| 232 | + return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * {@inheritDoc} |
|
| 237 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
| 238 | + */ |
|
| 239 | + public function bodyContent(): string |
|
| 240 | + { |
|
| 241 | + return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * {@inheritDoc} |
|
| 246 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle() |
|
| 247 | + */ |
|
| 248 | + public function sidebarTitle(Individual $individual): string |
|
| 249 | + { |
|
| 250 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 251 | + |
|
| 252 | + return view($this->name() . '::sidebar/title', [ |
|
| 253 | + 'module_name' => $this->name(), |
|
| 254 | + 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
| 255 | + ]); |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + /** |
|
| 259 | + * {@inheritDoc} |
|
| 260 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
| 261 | + */ |
|
| 262 | + public function getSidebarContent(Individual $individual): string |
|
| 263 | + { |
|
| 264 | + $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
| 265 | + $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
|
| 266 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 267 | + |
|
| 268 | + return view($this->name() . '::sidebar/content', [ |
|
| 269 | + 'sosa_ancestor' => $individual, |
|
| 270 | + 'sosa_root' => $sosa_root, |
|
| 271 | + 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
| 272 | + ]); |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * {@inheritDoc} |
|
| 277 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
| 278 | + */ |
|
| 279 | + public function hasSidebarContent(Individual $individual): bool |
|
| 280 | + { |
|
| 281 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
| 282 | + |
|
| 283 | + return app(SosaRecordsService::class) |
|
| 284 | + ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * {@inheritDoc} |
|
| 289 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
|
| 290 | + */ |
|
| 291 | + public function defaultSidebarOrder(): int |
|
| 292 | + { |
|
| 293 | + return 1; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * {@inheritDoc} |
|
| 298 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses() |
|
| 299 | + */ |
|
| 300 | + public function listGeoAnalyses(): array |
|
| 301 | + { |
|
| 302 | + return [ |
|
| 303 | + SosaByGenerationGeoAnalysis::class |
|
| 304 | + ]; |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * {@inheritDoc} |
|
| 309 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
| 310 | + */ |
|
| 311 | + public function listSubscribedHooks(): array |
|
| 312 | + { |
|
| 313 | + return [ |
|
| 314 | + app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
| 315 | + ]; |
|
| 316 | + } |
|
| 317 | 317 | } |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 5 | - * |
|
| 6 | - * @package MyArtJaub\Webtrees |
|
| 7 | - * @subpackage Hooks |
|
| 8 | - * @author Jonathan Jaubart <[email protected]> |
|
| 9 | - * @copyright Copyright (c) 2011-2022, Jonathan Jaubart |
|
| 10 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 11 | - */ |
|
| 4 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 5 | + * |
|
| 6 | + * @package MyArtJaub\Webtrees |
|
| 7 | + * @subpackage Hooks |
|
| 8 | + * @author Jonathan Jaubart <[email protected]> |
|
| 9 | + * @copyright Copyright (c) 2011-2022, Jonathan Jaubart |
|
| 10 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | declare(strict_types=1); |
| 14 | 14 | |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | interface NameAccordionExtenderInterface extends HookInterface |
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Add a new card to the names accordion. |
|
| 26 | - * |
|
| 27 | - * @param Individual $individual |
|
| 28 | - * @return string |
|
| 29 | - */ |
|
| 30 | - public function accordionCard(Individual $individual): string; |
|
| 24 | + /** |
|
| 25 | + * Add a new card to the names accordion. |
|
| 26 | + * |
|
| 27 | + * @param Individual $individual |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 30 | + public function accordionCard(Individual $individual): string; |
|
| 31 | 31 | } |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 5 | - * |
|
| 6 | - * @package MyArtJaub\Webtrees |
|
| 7 | - * @subpackage Hooks |
|
| 8 | - * @author Jonathan Jaubart <[email protected]> |
|
| 9 | - * @copyright Copyright (c) 2011-2022, Jonathan Jaubart |
|
| 10 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 11 | - */ |
|
| 4 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 5 | + * |
|
| 6 | + * @package MyArtJaub\Webtrees |
|
| 7 | + * @subpackage Hooks |
|
| 8 | + * @author Jonathan Jaubart <[email protected]> |
|
| 9 | + * @copyright Copyright (c) 2011-2022, Jonathan Jaubart |
|
| 10 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 11 | + */ |
|
| 12 | 12 | |
| 13 | 13 | declare(strict_types=1); |
| 14 | 14 | |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | interface ModuleHookSubscriberInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * List hooks to be subscribed by the module as an array. |
|
| 24 | - * |
|
| 25 | - * @return HookInterface[] |
|
| 26 | - */ |
|
| 27 | - public function listSubscribedHooks(): array; |
|
| 22 | + /** |
|
| 23 | + * List hooks to be subscribed by the module as an array. |
|
| 24 | + * |
|
| 25 | + * @return HookInterface[] |
|
| 26 | + */ |
|
| 27 | + public function listSubscribedHooks(): array; |
|
| 28 | 28 | } |