@@ -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 | } |
@@ -21,51 +21,51 @@ |
||
21 | 21 | */ |
22 | 22 | trait TopFilteredPlaceMapperTrait |
23 | 23 | { |
24 | - /** |
|
25 | - * @var Place[] $top_places |
|
26 | - */ |
|
27 | - private array $top_places = []; |
|
24 | + /** |
|
25 | + * @var Place[] $top_places |
|
26 | + */ |
|
27 | + private array $top_places = []; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get the list of top level places. |
|
31 | - * |
|
32 | - * @return Place[] |
|
33 | - */ |
|
34 | - public function topPlaces(): array |
|
35 | - { |
|
36 | - return $this->top_places; |
|
37 | - } |
|
29 | + /** |
|
30 | + * Get the list of top level places. |
|
31 | + * |
|
32 | + * @return Place[] |
|
33 | + */ |
|
34 | + public function topPlaces(): array |
|
35 | + { |
|
36 | + return $this->top_places; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Set the list of defined top level places. |
|
41 | - * |
|
42 | - * @param Place[] $top_places |
|
43 | - */ |
|
44 | - public function setTopPlaces(array $top_places): void |
|
45 | - { |
|
46 | - $this->top_places = collect($top_places) |
|
47 | - ->filter( |
|
48 | - /** @psalm-suppress MissingClosureParamType */ |
|
49 | - fn($top_places): bool => $top_places instanceof Place |
|
50 | - )->toArray(); |
|
51 | - } |
|
39 | + /** |
|
40 | + * Set the list of defined top level places. |
|
41 | + * |
|
42 | + * @param Place[] $top_places |
|
43 | + */ |
|
44 | + public function setTopPlaces(array $top_places): void |
|
45 | + { |
|
46 | + $this->top_places = collect($top_places) |
|
47 | + ->filter( |
|
48 | + /** @psalm-suppress MissingClosureParamType */ |
|
49 | + fn($top_places): bool => $top_places instanceof Place |
|
50 | + )->toArray(); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Check whether a Place belongs to one of the defined top places. |
|
55 | - * |
|
56 | - * @param Place $place |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - protected function belongsToTopLevels(Place $place): bool |
|
60 | - { |
|
61 | - foreach ($this->top_places as $top_place) { |
|
62 | - if ( |
|
63 | - $top_place->tree()->id() === $place->tree()->id() && |
|
64 | - str_ends_with($place->gedcomName(), $top_place->gedcomName()) |
|
65 | - ) { |
|
66 | - return true; |
|
67 | - } |
|
68 | - } |
|
69 | - return false; |
|
70 | - } |
|
53 | + /** |
|
54 | + * Check whether a Place belongs to one of the defined top places. |
|
55 | + * |
|
56 | + * @param Place $place |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + protected function belongsToTopLevels(Place $place): bool |
|
60 | + { |
|
61 | + foreach ($this->top_places as $top_place) { |
|
62 | + if ( |
|
63 | + $top_place->tree()->id() === $place->tree()->id() && |
|
64 | + str_ends_with($place->gedcomName(), $top_place->gedcomName()) |
|
65 | + ) { |
|
66 | + return true; |
|
67 | + } |
|
68 | + } |
|
69 | + return false; |
|
70 | + } |
|
71 | 71 | } |