@@ -23,41 +23,41 @@ |
||
23 | 23 | */ |
24 | 24 | class Migration1 implements MigrationInterface |
25 | 25 | { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
29 | - */ |
|
30 | - public function upgrade(): void |
|
31 | - { |
|
32 | - $in_transaction = DB::connection()->getPdo()->inTransaction(); |
|
33 | - |
|
34 | - DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void { |
|
35 | - $table->integer('majgv_id')->autoIncrement(); |
|
36 | - $table->integer('majgv_gedcom_id')->index(); |
|
37 | - $table->string('majgv_view_class', 255); |
|
38 | - $table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled'); |
|
39 | - $table->string('majgv_descr', 248); |
|
40 | - $table->string('majgv_analysis', 255); |
|
41 | - $table->tinyInteger('majgv_place_depth')->default(1); |
|
42 | - $table->tinyInteger('majgv_top_places')->default(0); |
|
43 | - $table->json('majgv_colors')->nullable(); |
|
44 | - |
|
45 | - $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade'); |
|
46 | - }); |
|
47 | - |
|
48 | - DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void { |
|
49 | - $table->integer('majgm_id')->autoIncrement(); |
|
50 | - $table->integer('majgm_majgv_id')->index(); |
|
51 | - $table->string('majgm_map_id', 127); |
|
52 | - $table->string('majgm_mapper', 255); |
|
53 | - $table->string('majgm_feature_prop', 31); |
|
54 | - $table->json('majgm_config')->nullable(); |
|
55 | - |
|
56 | - $table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade'); |
|
57 | - }); |
|
58 | - |
|
59 | - if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
|
60 | - DB::connection()->beginTransaction(); |
|
61 | - } |
|
62 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
29 | + */ |
|
30 | + public function upgrade(): void |
|
31 | + { |
|
32 | + $in_transaction = DB::connection()->getPdo()->inTransaction(); |
|
33 | + |
|
34 | + DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void { |
|
35 | + $table->integer('majgv_id')->autoIncrement(); |
|
36 | + $table->integer('majgv_gedcom_id')->index(); |
|
37 | + $table->string('majgv_view_class', 255); |
|
38 | + $table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled'); |
|
39 | + $table->string('majgv_descr', 248); |
|
40 | + $table->string('majgv_analysis', 255); |
|
41 | + $table->tinyInteger('majgv_place_depth')->default(1); |
|
42 | + $table->tinyInteger('majgv_top_places')->default(0); |
|
43 | + $table->json('majgv_colors')->nullable(); |
|
44 | + |
|
45 | + $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade'); |
|
46 | + }); |
|
47 | + |
|
48 | + DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void { |
|
49 | + $table->integer('majgm_id')->autoIncrement(); |
|
50 | + $table->integer('majgm_majgv_id')->index(); |
|
51 | + $table->string('majgm_map_id', 127); |
|
52 | + $table->string('majgm_mapper', 255); |
|
53 | + $table->string('majgm_feature_prop', 31); |
|
54 | + $table->json('majgm_config')->nullable(); |
|
55 | + |
|
56 | + $table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade'); |
|
57 | + }); |
|
58 | + |
|
59 | + if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
|
60 | + DB::connection()->beginTransaction(); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | } |
@@ -32,48 +32,48 @@ |
||
32 | 32 | */ |
33 | 33 | class GeoAnalysisViewAddPage implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisService $geoanalysis_service; |
|
39 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisService $geoanalysis_service; |
|
39 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for GeoAnalysisViewAddPage Request Handler |
|
43 | - * |
|
44 | - * @param ModuleService $module_service |
|
45 | - * @param GeoAnalysisService $geoanalysis_service |
|
46 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
47 | - */ |
|
48 | - public function __construct( |
|
49 | - ModuleService $module_service, |
|
50 | - GeoAnalysisService $geoanalysis_service, |
|
51 | - GeoAnalysisDataService $geoanalysis_data_service |
|
52 | - ) { |
|
53 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
54 | - $this->geoanalysis_service = $geoanalysis_service; |
|
55 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
56 | - } |
|
41 | + /** |
|
42 | + * Constructor for GeoAnalysisViewAddPage Request Handler |
|
43 | + * |
|
44 | + * @param ModuleService $module_service |
|
45 | + * @param GeoAnalysisService $geoanalysis_service |
|
46 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
47 | + */ |
|
48 | + public function __construct( |
|
49 | + ModuleService $module_service, |
|
50 | + GeoAnalysisService $geoanalysis_service, |
|
51 | + GeoAnalysisDataService $geoanalysis_data_service |
|
52 | + ) { |
|
53 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
54 | + $this->geoanalysis_service = $geoanalysis_service; |
|
55 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * {@inheritDoc} |
|
60 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | - */ |
|
62 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | - { |
|
64 | - $this->layout = 'layouts/administration'; |
|
58 | + /** |
|
59 | + * {@inheritDoc} |
|
60 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | + */ |
|
62 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | + { |
|
64 | + $this->layout = 'layouts/administration'; |
|
65 | 65 | |
66 | - if ($this->module === null) { |
|
67 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
68 | - } |
|
69 | - $tree = Validator::attributes($request)->tree(); |
|
66 | + if ($this->module === null) { |
|
67 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
68 | + } |
|
69 | + $tree = Validator::attributes($request)->tree(); |
|
70 | 70 | |
71 | - return $this->viewResponse($this->module->name() . '::admin/view-add', [ |
|
72 | - 'module' => $this->module, |
|
73 | - 'title' => I18N::translate('Add a geographical dispersion analysis view'), |
|
74 | - 'tree' => $tree, |
|
75 | - 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
76 | - 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree) |
|
77 | - ]); |
|
78 | - } |
|
71 | + return $this->viewResponse($this->module->name() . '::admin/view-add', [ |
|
72 | + 'module' => $this->module, |
|
73 | + 'title' => I18N::translate('Add a geographical dispersion analysis view'), |
|
74 | + 'tree' => $tree, |
|
75 | + 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
76 | + 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree) |
|
77 | + ]); |
|
78 | + } |
|
79 | 79 | } |
@@ -33,68 +33,68 @@ |
||
33 | 33 | */ |
34 | 34 | class MapAdapterEditPage implements RequestHandlerInterface |
35 | 35 | { |
36 | - use ViewResponseTrait; |
|
36 | + use ViewResponseTrait; |
|
37 | 37 | |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private MapAdapterDataService $mapadapter_data_service; |
|
40 | - private MapDefinitionsService $map_definition_service; |
|
41 | - private PlaceMapperService $place_mapper_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private MapAdapterDataService $mapadapter_data_service; |
|
40 | + private MapDefinitionsService $map_definition_service; |
|
41 | + private PlaceMapperService $place_mapper_service; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Constructor for MapAdapterEditPage Request Handler |
|
45 | - * |
|
46 | - * @param ModuleService $module_service |
|
47 | - * @param MapAdapterDataService $mapadapter_data_service |
|
48 | - * @param MapDefinitionsService $map_definition_service |
|
49 | - * @param PlaceMapperService $place_mapper_service |
|
50 | - */ |
|
51 | - public function __construct( |
|
52 | - ModuleService $module_service, |
|
53 | - MapAdapterDataService $mapadapter_data_service, |
|
54 | - MapDefinitionsService $map_definition_service, |
|
55 | - PlaceMapperService $place_mapper_service |
|
56 | - ) { |
|
57 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
58 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
59 | - $this->map_definition_service = $map_definition_service; |
|
60 | - $this->place_mapper_service = $place_mapper_service; |
|
61 | - } |
|
43 | + /** |
|
44 | + * Constructor for MapAdapterEditPage Request Handler |
|
45 | + * |
|
46 | + * @param ModuleService $module_service |
|
47 | + * @param MapAdapterDataService $mapadapter_data_service |
|
48 | + * @param MapDefinitionsService $map_definition_service |
|
49 | + * @param PlaceMapperService $place_mapper_service |
|
50 | + */ |
|
51 | + public function __construct( |
|
52 | + ModuleService $module_service, |
|
53 | + MapAdapterDataService $mapadapter_data_service, |
|
54 | + MapDefinitionsService $map_definition_service, |
|
55 | + PlaceMapperService $place_mapper_service |
|
56 | + ) { |
|
57 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
58 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
59 | + $this->map_definition_service = $map_definition_service; |
|
60 | + $this->place_mapper_service = $place_mapper_service; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | - */ |
|
67 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | - { |
|
69 | - $this->layout = 'layouts/administration'; |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | + */ |
|
67 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | + { |
|
69 | + $this->layout = 'layouts/administration'; |
|
70 | 70 | |
71 | - if ($this->module === null) { |
|
72 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | - } |
|
71 | + if ($this->module === null) { |
|
72 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | + } |
|
74 | 74 | |
75 | - $tree = Validator::attributes($request)->tree(); |
|
75 | + $tree = Validator::attributes($request)->tree(); |
|
76 | 76 | |
77 | - $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
78 | - $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
77 | + $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
78 | + $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
79 | 79 | |
80 | - if ($map_adapter === null) { |
|
81 | - throw new HttpNotFoundException( |
|
82 | - I18N::translate('The map configuration could not be found.') |
|
83 | - ); |
|
84 | - } |
|
80 | + if ($map_adapter === null) { |
|
81 | + throw new HttpNotFoundException( |
|
82 | + I18N::translate('The map configuration could not be found.') |
|
83 | + ); |
|
84 | + } |
|
85 | 85 | |
86 | - return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
87 | - 'module' => $this->module, |
|
88 | - 'title' => I18N::translate('Edit the map configuration'), |
|
89 | - 'tree' => $tree, |
|
90 | - 'view_id' => $map_adapter->geoAnalysisViewId(), |
|
91 | - 'map_adapter' => $map_adapter, |
|
92 | - 'maps_list' => $this->map_definition_service->all(), |
|
93 | - 'mappers_list' => $this->place_mapper_service->all(), |
|
94 | - 'route_edit' => route(MapAdapterEditAction::class, [ |
|
95 | - 'tree' => $tree->name(), |
|
96 | - 'adapter_id' => $map_adapter->id() |
|
97 | - ]) |
|
98 | - ]); |
|
99 | - } |
|
86 | + return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
87 | + 'module' => $this->module, |
|
88 | + 'title' => I18N::translate('Edit the map configuration'), |
|
89 | + 'tree' => $tree, |
|
90 | + 'view_id' => $map_adapter->geoAnalysisViewId(), |
|
91 | + 'map_adapter' => $map_adapter, |
|
92 | + 'maps_list' => $this->map_definition_service->all(), |
|
93 | + 'mappers_list' => $this->place_mapper_service->all(), |
|
94 | + 'route_edit' => route(MapAdapterEditAction::class, [ |
|
95 | + 'tree' => $tree->name(), |
|
96 | + 'adapter_id' => $map_adapter->id() |
|
97 | + ]) |
|
98 | + ]); |
|
99 | + } |
|
100 | 100 | } |
@@ -35,64 +35,64 @@ |
||
35 | 35 | */ |
36 | 36 | class AdminConfigPage implements RequestHandlerInterface |
37 | 37 | { |
38 | - use ViewResponseTrait; |
|
39 | - |
|
40 | - private ?GeoDispersionModule $module; |
|
41 | - |
|
42 | - private TreeService $tree_service; |
|
43 | - |
|
44 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
45 | - |
|
46 | - /** |
|
47 | - * Constructor for the AdminConfigPage Request Handler |
|
48 | - * |
|
49 | - * @param ModuleService $module_service |
|
50 | - * @param TreeService $tree_service |
|
51 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
52 | - */ |
|
53 | - public function __construct( |
|
54 | - ModuleService $module_service, |
|
55 | - TreeService $tree_service, |
|
56 | - GeoAnalysisDataService $geoanalysis_data_service |
|
57 | - ) { |
|
58 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
59 | - $this->tree_service = $tree_service; |
|
60 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | - */ |
|
67 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | - { |
|
69 | - $this->layout = 'layouts/administration'; |
|
70 | - |
|
71 | - if ($this->module === null) { |
|
72 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | - } |
|
74 | - |
|
75 | - $user = Validator::attributes($request)->user(); |
|
76 | - |
|
77 | - $all_trees = $this->tree_service->all()->filter(fn(Tree $tree) => Auth::isManager($tree, $user)); |
|
78 | - if ($all_trees->count() === 0) { |
|
79 | - throw new HttpAccessDeniedException(); |
|
80 | - } |
|
81 | - |
|
82 | - $tree = Validator::attributes($request)->treeOptional() ?? $all_trees->first(); |
|
83 | - |
|
84 | - $same_tree = fn(Tree $tree_collection): bool => $tree->id() === $tree_collection->id(); |
|
85 | - if (!$all_trees->contains($same_tree)) { |
|
86 | - throw new HttpAccessDeniedException(); |
|
87 | - } |
|
88 | - |
|
89 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
90 | - 'module_name' => $this->module->name(), |
|
91 | - 'title' => $this->module->title(), |
|
92 | - 'tree' => $tree, |
|
93 | - 'other_trees' => $all_trees->reject($same_tree), |
|
94 | - 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
95 | - 'js_script_url' => $this->module->assetUrl('js/geodispersion.min.js') |
|
96 | - ]); |
|
97 | - } |
|
38 | + use ViewResponseTrait; |
|
39 | + |
|
40 | + private ?GeoDispersionModule $module; |
|
41 | + |
|
42 | + private TreeService $tree_service; |
|
43 | + |
|
44 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
45 | + |
|
46 | + /** |
|
47 | + * Constructor for the AdminConfigPage Request Handler |
|
48 | + * |
|
49 | + * @param ModuleService $module_service |
|
50 | + * @param TreeService $tree_service |
|
51 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
52 | + */ |
|
53 | + public function __construct( |
|
54 | + ModuleService $module_service, |
|
55 | + TreeService $tree_service, |
|
56 | + GeoAnalysisDataService $geoanalysis_data_service |
|
57 | + ) { |
|
58 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
59 | + $this->tree_service = $tree_service; |
|
60 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | + */ |
|
67 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | + { |
|
69 | + $this->layout = 'layouts/administration'; |
|
70 | + |
|
71 | + if ($this->module === null) { |
|
72 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | + } |
|
74 | + |
|
75 | + $user = Validator::attributes($request)->user(); |
|
76 | + |
|
77 | + $all_trees = $this->tree_service->all()->filter(fn(Tree $tree) => Auth::isManager($tree, $user)); |
|
78 | + if ($all_trees->count() === 0) { |
|
79 | + throw new HttpAccessDeniedException(); |
|
80 | + } |
|
81 | + |
|
82 | + $tree = Validator::attributes($request)->treeOptional() ?? $all_trees->first(); |
|
83 | + |
|
84 | + $same_tree = fn(Tree $tree_collection): bool => $tree->id() === $tree_collection->id(); |
|
85 | + if (!$all_trees->contains($same_tree)) { |
|
86 | + throw new HttpAccessDeniedException(); |
|
87 | + } |
|
88 | + |
|
89 | + return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
90 | + 'module_name' => $this->module->name(), |
|
91 | + 'title' => $this->module->title(), |
|
92 | + 'tree' => $tree, |
|
93 | + 'other_trees' => $all_trees->reject($same_tree), |
|
94 | + 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
95 | + 'js_script_url' => $this->module->assetUrl('js/geodispersion.min.js') |
|
96 | + ]); |
|
97 | + } |
|
98 | 98 | } |
@@ -33,67 +33,67 @@ |
||
33 | 33 | */ |
34 | 34 | class MapAdapterMapperConfig implements RequestHandlerInterface |
35 | 35 | { |
36 | - use ViewResponseTrait; |
|
36 | + use ViewResponseTrait; |
|
37 | 37 | |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private MapAdapterDataService $mapadapter_data_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private MapAdapterDataService $mapadapter_data_service; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for MapAdapterMapperConfig Request Handler |
|
43 | - * |
|
44 | - * @param ModuleService $module_service |
|
45 | - * @param MapAdapterDataService $mapadapter_data_service |
|
46 | - */ |
|
47 | - public function __construct( |
|
48 | - ModuleService $module_service, |
|
49 | - MapAdapterDataService $mapadapter_data_service |
|
50 | - ) { |
|
51 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
52 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
53 | - } |
|
41 | + /** |
|
42 | + * Constructor for MapAdapterMapperConfig Request Handler |
|
43 | + * |
|
44 | + * @param ModuleService $module_service |
|
45 | + * @param MapAdapterDataService $mapadapter_data_service |
|
46 | + */ |
|
47 | + public function __construct( |
|
48 | + ModuleService $module_service, |
|
49 | + MapAdapterDataService $mapadapter_data_service |
|
50 | + ) { |
|
51 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
52 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * {@inheritDoc} |
|
57 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
58 | - */ |
|
59 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
60 | - { |
|
61 | - $this->layout = 'layouts/ajax'; |
|
55 | + /** |
|
56 | + * {@inheritDoc} |
|
57 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
58 | + */ |
|
59 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
60 | + { |
|
61 | + $this->layout = 'layouts/ajax'; |
|
62 | 62 | |
63 | - if ($this->module === null) { |
|
64 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
65 | - } |
|
66 | - $tree = Validator::attributes($request)->tree(); |
|
63 | + if ($this->module === null) { |
|
64 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
65 | + } |
|
66 | + $tree = Validator::attributes($request)->tree(); |
|
67 | 67 | |
68 | - $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
69 | - $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
68 | + $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
69 | + $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
70 | 70 | |
71 | - $mapper_class = Validator::queryParams($request)->string('mapper', ''); |
|
72 | - $mapper = null; |
|
73 | - if ($mapper_class === '' && $map_adapter !== null) { |
|
74 | - $mapper = $map_adapter->placeMapper(); |
|
75 | - } else { |
|
76 | - try { |
|
77 | - $mapper = app($mapper_class); |
|
78 | - } catch (BindingResolutionException $ex) { |
|
79 | - } |
|
71 | + $mapper_class = Validator::queryParams($request)->string('mapper', ''); |
|
72 | + $mapper = null; |
|
73 | + if ($mapper_class === '' && $map_adapter !== null) { |
|
74 | + $mapper = $map_adapter->placeMapper(); |
|
75 | + } else { |
|
76 | + try { |
|
77 | + $mapper = app($mapper_class); |
|
78 | + } catch (BindingResolutionException $ex) { |
|
79 | + } |
|
80 | 80 | |
81 | - if ( |
|
82 | - $mapper !== null && $map_adapter !== null && |
|
83 | - get_class($map_adapter->placeMapper()) === get_class($mapper) |
|
84 | - ) { |
|
85 | - $mapper = $map_adapter->placeMapper(); |
|
86 | - } |
|
87 | - } |
|
81 | + if ( |
|
82 | + $mapper !== null && $map_adapter !== null && |
|
83 | + get_class($map_adapter->placeMapper()) === get_class($mapper) |
|
84 | + ) { |
|
85 | + $mapper = $map_adapter->placeMapper(); |
|
86 | + } |
|
87 | + } |
|
88 | 88 | |
89 | - if ($mapper === null || !($mapper instanceof PlaceMapperInterface)) { |
|
90 | - throw new HttpNotFoundException( |
|
91 | - I18N::translate('The configuration for the place mapper could not be found.') |
|
92 | - ); |
|
93 | - } |
|
89 | + if ($mapper === null || !($mapper instanceof PlaceMapperInterface)) { |
|
90 | + throw new HttpNotFoundException( |
|
91 | + I18N::translate('The configuration for the place mapper could not be found.') |
|
92 | + ); |
|
93 | + } |
|
94 | 94 | |
95 | - return $this->viewResponse('layouts/ajax', [ |
|
96 | - 'content' => $mapper->config()->configContent($this->module, $tree) |
|
97 | - ]); |
|
98 | - } |
|
95 | + return $this->viewResponse('layouts/ajax', [ |
|
96 | + 'content' => $mapper->config()->configContent($this->module, $tree) |
|
97 | + ]); |
|
98 | + } |
|
99 | 99 | } |
@@ -33,68 +33,68 @@ |
||
33 | 33 | */ |
34 | 34 | class MapAdapterAddPage implements RequestHandlerInterface |
35 | 35 | { |
36 | - use ViewResponseTrait; |
|
36 | + use ViewResponseTrait; |
|
37 | 37 | |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
40 | - private MapDefinitionsService $map_definition_service; |
|
41 | - private PlaceMapperService $place_mapper_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
40 | + private MapDefinitionsService $map_definition_service; |
|
41 | + private PlaceMapperService $place_mapper_service; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Constructor for MapAdapterAddPage Request Handler |
|
45 | - * |
|
46 | - * @param ModuleService $module_service |
|
47 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
48 | - * @param MapDefinitionsService $map_definition_service |
|
49 | - * @param PlaceMapperService $place_mapper_service |
|
50 | - */ |
|
51 | - public function __construct( |
|
52 | - ModuleService $module_service, |
|
53 | - GeoAnalysisViewDataService $geoview_data_service, |
|
54 | - MapDefinitionsService $map_definition_service, |
|
55 | - PlaceMapperService $place_mapper_service |
|
56 | - ) { |
|
57 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
58 | - $this->geoview_data_service = $geoview_data_service; |
|
59 | - $this->map_definition_service = $map_definition_service; |
|
60 | - $this->place_mapper_service = $place_mapper_service; |
|
61 | - } |
|
43 | + /** |
|
44 | + * Constructor for MapAdapterAddPage Request Handler |
|
45 | + * |
|
46 | + * @param ModuleService $module_service |
|
47 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
48 | + * @param MapDefinitionsService $map_definition_service |
|
49 | + * @param PlaceMapperService $place_mapper_service |
|
50 | + */ |
|
51 | + public function __construct( |
|
52 | + ModuleService $module_service, |
|
53 | + GeoAnalysisViewDataService $geoview_data_service, |
|
54 | + MapDefinitionsService $map_definition_service, |
|
55 | + PlaceMapperService $place_mapper_service |
|
56 | + ) { |
|
57 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
58 | + $this->geoview_data_service = $geoview_data_service; |
|
59 | + $this->map_definition_service = $map_definition_service; |
|
60 | + $this->place_mapper_service = $place_mapper_service; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | - */ |
|
67 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | - { |
|
69 | - $this->layout = 'layouts/administration'; |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
66 | + */ |
|
67 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
68 | + { |
|
69 | + $this->layout = 'layouts/administration'; |
|
70 | 70 | |
71 | - if ($this->module === null) { |
|
72 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | - } |
|
71 | + if ($this->module === null) { |
|
72 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | + } |
|
74 | 74 | |
75 | - $tree = Validator::attributes($request)->tree(); |
|
75 | + $tree = Validator::attributes($request)->tree(); |
|
76 | 76 | |
77 | - $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
78 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
77 | + $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
78 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
79 | 79 | |
80 | - if ($view === null) { |
|
81 | - throw new HttpNotFoundException( |
|
82 | - I18N::translate('The geographical dispersion analysis view could not be found.') |
|
83 | - ); |
|
84 | - } |
|
80 | + if ($view === null) { |
|
81 | + throw new HttpNotFoundException( |
|
82 | + I18N::translate('The geographical dispersion analysis view could not be found.') |
|
83 | + ); |
|
84 | + } |
|
85 | 85 | |
86 | - return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
87 | - 'module' => $this->module, |
|
88 | - 'title' => I18N::translate('Add a map configuration'), |
|
89 | - 'tree' => $tree, |
|
90 | - 'view_id' => $view_id, |
|
91 | - 'map_adapter' => null, |
|
92 | - 'maps_list' => $this->map_definition_service->all(), |
|
93 | - 'mappers_list' => $this->place_mapper_service->all(), |
|
94 | - 'route_edit' => route(MapAdapterAddAction::class, [ |
|
95 | - 'tree' => $tree->name(), |
|
96 | - 'view_id' => $view_id |
|
97 | - ]) |
|
98 | - ]); |
|
99 | - } |
|
86 | + return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
87 | + 'module' => $this->module, |
|
88 | + 'title' => I18N::translate('Add a map configuration'), |
|
89 | + 'tree' => $tree, |
|
90 | + 'view_id' => $view_id, |
|
91 | + 'map_adapter' => null, |
|
92 | + 'maps_list' => $this->map_definition_service->all(), |
|
93 | + 'mappers_list' => $this->place_mapper_service->all(), |
|
94 | + 'route_edit' => route(MapAdapterAddAction::class, [ |
|
95 | + 'tree' => $tree->name(), |
|
96 | + 'view_id' => $view_id |
|
97 | + ]) |
|
98 | + ]); |
|
99 | + } |
|
100 | 100 | } |
@@ -32,42 +32,42 @@ |
||
32 | 32 | */ |
33 | 33 | class GeoAnalysisViewPage implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisViewDataService $geoviewdata_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisViewDataService $geoviewdata_service; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructor for GeoAnalysisViewPage Request Handler |
|
42 | - * |
|
43 | - * @param ModuleService $module_service |
|
44 | - */ |
|
45 | - public function __construct( |
|
46 | - ModuleService $module_service, |
|
47 | - GeoAnalysisViewDataService $geoviewdata_service |
|
48 | - ) { |
|
49 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
50 | - $this->geoviewdata_service = $geoviewdata_service; |
|
51 | - } |
|
40 | + /** |
|
41 | + * Constructor for GeoAnalysisViewPage Request Handler |
|
42 | + * |
|
43 | + * @param ModuleService $module_service |
|
44 | + */ |
|
45 | + public function __construct( |
|
46 | + ModuleService $module_service, |
|
47 | + GeoAnalysisViewDataService $geoviewdata_service |
|
48 | + ) { |
|
49 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
50 | + $this->geoviewdata_service = $geoviewdata_service; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
56 | - */ |
|
57 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
58 | - { |
|
59 | - if ($this->module === null) { |
|
60 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
61 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
56 | + */ |
|
57 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
58 | + { |
|
59 | + if ($this->module === null) { |
|
60 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
61 | + } |
|
62 | 62 | |
63 | - $tree = Validator::attributes($request)->tree(); |
|
64 | - $view_id = Validator::attributes($request)->integer('view_id', 0); |
|
63 | + $tree = Validator::attributes($request)->tree(); |
|
64 | + $view_id = Validator::attributes($request)->integer('view_id', 0); |
|
65 | 65 | |
66 | - return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [ |
|
67 | - 'module_name' => $this->module->name(), |
|
68 | - 'title' => I18N::translate('Geographical dispersion'), |
|
69 | - 'tree' => $tree, |
|
70 | - 'view' => $this->geoviewdata_service->find($tree, $view_id) |
|
71 | - ]); |
|
72 | - } |
|
66 | + return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [ |
|
67 | + 'module_name' => $this->module->name(), |
|
68 | + 'title' => I18N::translate('Geographical dispersion'), |
|
69 | + 'tree' => $tree, |
|
70 | + 'view' => $this->geoviewdata_service->find($tree, $view_id) |
|
71 | + ]); |
|
72 | + } |
|
73 | 73 | } |
@@ -33,46 +33,46 @@ |
||
33 | 33 | */ |
34 | 34 | class GeoAnalysisViewsList implements RequestHandlerInterface |
35 | 35 | { |
36 | - use ViewResponseTrait; |
|
36 | + use ViewResponseTrait; |
|
37 | 37 | |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private GeoAnalysisViewDataService $geoviewdata_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private GeoAnalysisViewDataService $geoviewdata_service; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for GeoAnalysisViewsList Request Handler |
|
43 | - * |
|
44 | - * @param ModuleService $module_service |
|
45 | - */ |
|
46 | - public function __construct( |
|
47 | - ModuleService $module_service, |
|
48 | - GeoAnalysisViewDataService $geoviewdata_service |
|
49 | - ) { |
|
50 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
51 | - $this->geoviewdata_service = $geoviewdata_service; |
|
52 | - } |
|
41 | + /** |
|
42 | + * Constructor for GeoAnalysisViewsList Request Handler |
|
43 | + * |
|
44 | + * @param ModuleService $module_service |
|
45 | + */ |
|
46 | + public function __construct( |
|
47 | + ModuleService $module_service, |
|
48 | + GeoAnalysisViewDataService $geoviewdata_service |
|
49 | + ) { |
|
50 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
51 | + $this->geoviewdata_service = $geoviewdata_service; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inheritDoc} |
|
56 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
57 | - */ |
|
58 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
59 | - { |
|
60 | - if ($this->module === null) { |
|
61 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
62 | - } |
|
54 | + /** |
|
55 | + * {@inheritDoc} |
|
56 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
57 | + */ |
|
58 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
59 | + { |
|
60 | + if ($this->module === null) { |
|
61 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
62 | + } |
|
63 | 63 | |
64 | - $tree = Validator::attributes($request)->tree(); |
|
64 | + $tree = Validator::attributes($request)->tree(); |
|
65 | 65 | |
66 | - $views_list = $this->geoviewdata_service |
|
67 | - ->all($tree) |
|
68 | - ->sortBy(fn(AbstractGeoAnalysisView $view) => $view->description()); |
|
66 | + $views_list = $this->geoviewdata_service |
|
67 | + ->all($tree) |
|
68 | + ->sortBy(fn(AbstractGeoAnalysisView $view) => $view->description()); |
|
69 | 69 | |
70 | - return $this->viewResponse($this->module->name() . '::geoanalysisviews-list', [ |
|
71 | - 'module' => $this->module, |
|
72 | - 'title' => I18N::translate('Geographical dispersion'), |
|
73 | - 'tree' => $tree, |
|
74 | - 'views_list' => $views_list, |
|
75 | - 'js_script_url' => $this->module->assetUrl('js/geodispersion.min.js') |
|
76 | - ]); |
|
77 | - } |
|
70 | + return $this->viewResponse($this->module->name() . '::geoanalysisviews-list', [ |
|
71 | + 'module' => $this->module, |
|
72 | + 'title' => I18N::translate('Geographical dispersion'), |
|
73 | + 'tree' => $tree, |
|
74 | + 'views_list' => $views_list, |
|
75 | + 'js_script_url' => $this->module->assetUrl('js/geodispersion.min.js') |
|
76 | + ]); |
|
77 | + } |
|
78 | 78 | } |
@@ -32,64 +32,64 @@ |
||
32 | 32 | */ |
33 | 33 | class GeoAnalysisViewEditPage implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | - private GeoAnalysisService $geoanalysis_service; |
|
40 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | + private GeoAnalysisService $geoanalysis_service; |
|
40 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Constructor for GeoAnalysisViewEditPage Request Handler |
|
44 | - * |
|
45 | - * @param ModuleService $module_service |
|
46 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
47 | - * @param GeoAnalysisService $geoanalysis_service |
|
48 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
49 | - */ |
|
50 | - public function __construct( |
|
51 | - ModuleService $module_service, |
|
52 | - GeoAnalysisViewDataService $geoview_data_service, |
|
53 | - GeoAnalysisService $geoanalysis_service, |
|
54 | - GeoAnalysisDataService $geoanalysis_data_service |
|
55 | - ) { |
|
56 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
57 | - $this->geoview_data_service = $geoview_data_service; |
|
58 | - $this->geoanalysis_service = $geoanalysis_service; |
|
59 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
60 | - } |
|
42 | + /** |
|
43 | + * Constructor for GeoAnalysisViewEditPage Request Handler |
|
44 | + * |
|
45 | + * @param ModuleService $module_service |
|
46 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
47 | + * @param GeoAnalysisService $geoanalysis_service |
|
48 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
49 | + */ |
|
50 | + public function __construct( |
|
51 | + ModuleService $module_service, |
|
52 | + GeoAnalysisViewDataService $geoview_data_service, |
|
53 | + GeoAnalysisService $geoanalysis_service, |
|
54 | + GeoAnalysisDataService $geoanalysis_data_service |
|
55 | + ) { |
|
56 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
57 | + $this->geoview_data_service = $geoview_data_service; |
|
58 | + $this->geoanalysis_service = $geoanalysis_service; |
|
59 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * {@inheritDoc} |
|
64 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
65 | - */ |
|
66 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
67 | - { |
|
68 | - $this->layout = 'layouts/administration'; |
|
62 | + /** |
|
63 | + * {@inheritDoc} |
|
64 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
65 | + */ |
|
66 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
67 | + { |
|
68 | + $this->layout = 'layouts/administration'; |
|
69 | 69 | |
70 | - if ($this->module === null) { |
|
71 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
72 | - } |
|
70 | + if ($this->module === null) { |
|
71 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
72 | + } |
|
73 | 73 | |
74 | - $tree = Validator::attributes($request)->tree(); |
|
74 | + $tree = Validator::attributes($request)->tree(); |
|
75 | 75 | |
76 | - $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
77 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
76 | + $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
77 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
78 | 78 | |
79 | - if ($view === null) { |
|
80 | - throw new HttpNotFoundException( |
|
81 | - I18N::translate('The geographical dispersion analysis view could not be found.') |
|
82 | - ); |
|
83 | - } |
|
79 | + if ($view === null) { |
|
80 | + throw new HttpNotFoundException( |
|
81 | + I18N::translate('The geographical dispersion analysis view could not be found.') |
|
82 | + ); |
|
83 | + } |
|
84 | 84 | |
85 | - return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
86 | - 'module' => $this->module, |
|
87 | - 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
|
88 | - 'tree' => $tree, |
|
89 | - 'view' => $view, |
|
90 | - 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
91 | - 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
92 | - 'global_settings' => $view->globalSettingsContent($this->module) |
|
93 | - ]); |
|
94 | - } |
|
85 | + return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
86 | + 'module' => $this->module, |
|
87 | + 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
|
88 | + 'tree' => $tree, |
|
89 | + 'view' => $view, |
|
90 | + 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
91 | + 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
92 | + 'global_settings' => $view->globalSettingsContent($this->module) |
|
93 | + ]); |
|
94 | + } |
|
95 | 95 | } |