@@ -34,86 +34,86 @@ |
||
34 | 34 | */ |
35 | 35 | class GeoAnalysisViewEditAction implements RequestHandlerInterface |
36 | 36 | { |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | - |
|
40 | - /** |
|
41 | - * Constructor for GeoAnalysisViewEditAction Request Handler |
|
42 | - * |
|
43 | - * @param ModuleService $module_service |
|
44 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
45 | - */ |
|
46 | - public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service) |
|
47 | - { |
|
48 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
49 | - $this->geoview_data_service = $geoview_data_service; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * {@inheritDoc} |
|
54 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
55 | - */ |
|
56 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
57 | - { |
|
58 | - $tree = Validator::attributes($request)->tree(); |
|
59 | - |
|
60 | - $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
61 | - |
|
62 | - if ($this->module === null) { |
|
63 | - FlashMessages::addMessage( |
|
64 | - I18N::translate('The attached module could not be found.'), |
|
65 | - 'danger' |
|
66 | - ); |
|
67 | - return redirect($admin_config_route); |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
72 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
73 | - |
|
74 | - $description = Validator::parsedBody($request)->string('view_description', ''); |
|
75 | - $place_depth = Validator::parsedBody($request)->integer('view_depth', 1); |
|
76 | - $top_places = Validator::parsedBody($request)->integer('view_top_places', 0); |
|
77 | - |
|
78 | - $analysis = null; |
|
79 | - try { |
|
80 | - $analysis = app(Validator::parsedBody($request)->string('view_analysis', '')); |
|
81 | - } catch (BindingResolutionException $ex) { |
|
82 | - } |
|
83 | - |
|
84 | - if ( |
|
85 | - $view === null |
|
86 | - || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
87 | - || $place_depth <= 0 && $top_places < 0 |
|
88 | - ) { |
|
89 | - FlashMessages::addMessage( |
|
90 | - I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)), |
|
91 | - 'danger' |
|
92 | - ); |
|
93 | - return redirect($admin_config_route); |
|
94 | - } |
|
95 | - |
|
96 | - $new_view = $view |
|
97 | - ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places) |
|
98 | - ->withGlobalSettingsUpdate($request); |
|
99 | - |
|
100 | - try { |
|
101 | - $this->geoview_data_service->update($new_view); |
|
102 | - FlashMessages::addMessage( |
|
103 | - I18N::translate('The geographical dispersion analysis view has been successfully updated.'), |
|
104 | - 'success' |
|
105 | - ); |
|
106 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
107 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
108 | - } catch (Throwable $ex) { |
|
109 | - FlashMessages::addMessage( |
|
110 | - I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
|
111 | - 'danger' |
|
112 | - ); |
|
113 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
114 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
115 | - } |
|
116 | - |
|
117 | - return redirect($admin_config_route); |
|
118 | - } |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | + |
|
40 | + /** |
|
41 | + * Constructor for GeoAnalysisViewEditAction Request Handler |
|
42 | + * |
|
43 | + * @param ModuleService $module_service |
|
44 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
45 | + */ |
|
46 | + public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service) |
|
47 | + { |
|
48 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
49 | + $this->geoview_data_service = $geoview_data_service; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * {@inheritDoc} |
|
54 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
55 | + */ |
|
56 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
57 | + { |
|
58 | + $tree = Validator::attributes($request)->tree(); |
|
59 | + |
|
60 | + $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
61 | + |
|
62 | + if ($this->module === null) { |
|
63 | + FlashMessages::addMessage( |
|
64 | + I18N::translate('The attached module could not be found.'), |
|
65 | + 'danger' |
|
66 | + ); |
|
67 | + return redirect($admin_config_route); |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
72 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
73 | + |
|
74 | + $description = Validator::parsedBody($request)->string('view_description', ''); |
|
75 | + $place_depth = Validator::parsedBody($request)->integer('view_depth', 1); |
|
76 | + $top_places = Validator::parsedBody($request)->integer('view_top_places', 0); |
|
77 | + |
|
78 | + $analysis = null; |
|
79 | + try { |
|
80 | + $analysis = app(Validator::parsedBody($request)->string('view_analysis', '')); |
|
81 | + } catch (BindingResolutionException $ex) { |
|
82 | + } |
|
83 | + |
|
84 | + if ( |
|
85 | + $view === null |
|
86 | + || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
87 | + || $place_depth <= 0 && $top_places < 0 |
|
88 | + ) { |
|
89 | + FlashMessages::addMessage( |
|
90 | + I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)), |
|
91 | + 'danger' |
|
92 | + ); |
|
93 | + return redirect($admin_config_route); |
|
94 | + } |
|
95 | + |
|
96 | + $new_view = $view |
|
97 | + ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places) |
|
98 | + ->withGlobalSettingsUpdate($request); |
|
99 | + |
|
100 | + try { |
|
101 | + $this->geoview_data_service->update($new_view); |
|
102 | + FlashMessages::addMessage( |
|
103 | + I18N::translate('The geographical dispersion analysis view has been successfully updated.'), |
|
104 | + 'success' |
|
105 | + ); |
|
106 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
107 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
108 | + } catch (Throwable $ex) { |
|
109 | + FlashMessages::addMessage( |
|
110 | + I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
|
111 | + 'danger' |
|
112 | + ); |
|
113 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
114 | + Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
115 | + } |
|
116 | + |
|
117 | + return redirect($admin_config_route); |
|
118 | + } |
|
119 | 119 | } |
@@ -104,14 +104,14 @@ |
||
104 | 104 | 'success' |
105 | 105 | ); |
106 | 106 | //phpcs:ignore Generic.Files.LineLength.TooLong |
107 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
107 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.'); |
|
108 | 108 | } catch (Throwable $ex) { |
109 | 109 | FlashMessages::addMessage( |
110 | 110 | I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
111 | 111 | 'danger' |
112 | 112 | ); |
113 | 113 | //phpcs:ignore Generic.Files.LineLength.TooLong |
114 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
114 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage()); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | return redirect($admin_config_route); |
@@ -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 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | $tree = Validator::attributes($request)->tree(); |
70 | 70 | |
71 | - return $this->viewResponse($this->module->name() . '::admin/view-add', [ |
|
71 | + return $this->viewResponse($this->module->name().'::admin/view-add', [ |
|
72 | 72 | 'module' => $this->module, |
73 | 73 | 'title' => I18N::translate('Add a geographical dispersion analysis view'), |
74 | 74 | 'tree' => $tree, |
@@ -35,85 +35,85 @@ |
||
35 | 35 | */ |
36 | 36 | class MapAdapterEditAction implements RequestHandlerInterface |
37 | 37 | { |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private MapAdapterDataService $mapadapter_data_service; |
|
40 | - private MapDefinitionsService $map_definition_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private MapAdapterDataService $mapadapter_data_service; |
|
40 | + private MapDefinitionsService $map_definition_service; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Constructor for MapAdapterEditAction Request Handler |
|
44 | - * |
|
45 | - * @param ModuleService $module_service |
|
46 | - * @param MapAdapterDataService $mapadapter_data_service |
|
47 | - * @param MapDefinitionsService $map_definition_service |
|
48 | - */ |
|
49 | - public function __construct( |
|
50 | - ModuleService $module_service, |
|
51 | - MapAdapterDataService $mapadapter_data_service, |
|
52 | - MapDefinitionsService $map_definition_service |
|
53 | - ) { |
|
54 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
55 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
56 | - $this->map_definition_service = $map_definition_service; |
|
57 | - } |
|
42 | + /** |
|
43 | + * Constructor for MapAdapterEditAction Request Handler |
|
44 | + * |
|
45 | + * @param ModuleService $module_service |
|
46 | + * @param MapAdapterDataService $mapadapter_data_service |
|
47 | + * @param MapDefinitionsService $map_definition_service |
|
48 | + */ |
|
49 | + public function __construct( |
|
50 | + ModuleService $module_service, |
|
51 | + MapAdapterDataService $mapadapter_data_service, |
|
52 | + MapDefinitionsService $map_definition_service |
|
53 | + ) { |
|
54 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
55 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
56 | + $this->map_definition_service = $map_definition_service; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
62 | - */ |
|
63 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
64 | - { |
|
65 | - $tree = Validator::attributes($request)->tree(); |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
62 | + */ |
|
63 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
64 | + { |
|
65 | + $tree = Validator::attributes($request)->tree(); |
|
66 | 66 | |
67 | - if ($this->module === null) { |
|
68 | - FlashMessages::addMessage( |
|
69 | - I18N::translate('The attached module could not be found.'), |
|
70 | - 'danger' |
|
71 | - ); |
|
72 | - return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
73 | - } |
|
67 | + if ($this->module === null) { |
|
68 | + FlashMessages::addMessage( |
|
69 | + I18N::translate('The attached module could not be found.'), |
|
70 | + 'danger' |
|
71 | + ); |
|
72 | + return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
73 | + } |
|
74 | 74 | |
75 | - $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
76 | - $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
75 | + $adapter_id = Validator::attributes($request)->integer('adapter_id', -1); |
|
76 | + $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
77 | 77 | |
78 | - $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', '')); |
|
79 | - $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
78 | + $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', '')); |
|
79 | + $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
80 | 80 | |
81 | - $mapper = null; |
|
82 | - try { |
|
83 | - $mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', '')); |
|
84 | - } catch (BindingResolutionException $ex) { |
|
85 | - } |
|
81 | + $mapper = null; |
|
82 | + try { |
|
83 | + $mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', '')); |
|
84 | + } catch (BindingResolutionException $ex) { |
|
85 | + } |
|
86 | 86 | |
87 | - if ($map_adapter === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) { |
|
88 | - FlashMessages::addMessage( |
|
89 | - I18N::translate('The parameters for the map configuration are not valid.'), |
|
90 | - 'danger' |
|
91 | - ); |
|
92 | - return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
93 | - } |
|
87 | + if ($map_adapter === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) { |
|
88 | + FlashMessages::addMessage( |
|
89 | + I18N::translate('The parameters for the map configuration are not valid.'), |
|
90 | + 'danger' |
|
91 | + ); |
|
92 | + return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
93 | + } |
|
94 | 94 | |
95 | - $mapper->setConfig($mapper->config()->withConfigUpdate($request)); |
|
96 | - $new_map_adapter = $map_adapter->with($map, $mapper, $mapping_property); |
|
97 | - try { |
|
98 | - $this->mapadapter_data_service->update($new_map_adapter); |
|
99 | - FlashMessages::addMessage( |
|
100 | - I18N::translate('The map configuration has been successfully updated.'), |
|
101 | - 'success' |
|
102 | - ); |
|
103 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
104 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.'); |
|
105 | - } catch (Throwable $ex) { |
|
106 | - FlashMessages::addMessage( |
|
107 | - I18N::translate('An error occured while updating the map configuration.'), |
|
108 | - 'danger' |
|
109 | - ); |
|
110 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
111 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage()); |
|
112 | - } |
|
95 | + $mapper->setConfig($mapper->config()->withConfigUpdate($request)); |
|
96 | + $new_map_adapter = $map_adapter->with($map, $mapper, $mapping_property); |
|
97 | + try { |
|
98 | + $this->mapadapter_data_service->update($new_map_adapter); |
|
99 | + FlashMessages::addMessage( |
|
100 | + I18N::translate('The map configuration has been successfully updated.'), |
|
101 | + 'success' |
|
102 | + ); |
|
103 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
104 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.'); |
|
105 | + } catch (Throwable $ex) { |
|
106 | + FlashMessages::addMessage( |
|
107 | + I18N::translate('An error occured while updating the map configuration.'), |
|
108 | + 'danger' |
|
109 | + ); |
|
110 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
111 | + Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage()); |
|
112 | + } |
|
113 | 113 | |
114 | - return redirect(route(GeoAnalysisViewEditPage::class, [ |
|
115 | - 'tree' => $tree->name(), |
|
116 | - 'view_id' => $map_adapter->geoAnalysisViewId() |
|
117 | - ])); |
|
118 | - } |
|
114 | + return redirect(route(GeoAnalysisViewEditPage::class, [ |
|
115 | + 'tree' => $tree->name(), |
|
116 | + 'view_id' => $map_adapter->geoAnalysisViewId() |
|
117 | + ])); |
|
118 | + } |
|
119 | 119 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
77 | 77 | |
78 | 78 | $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', '')); |
79 | - $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
79 | + $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
80 | 80 | |
81 | 81 | $mapper = null; |
82 | 82 | try { |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | 'success' |
102 | 102 | ); |
103 | 103 | //phpcs:ignore Generic.Files.LineLength.TooLong |
104 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.'); |
|
104 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been updated.'); |
|
105 | 105 | } catch (Throwable $ex) { |
106 | 106 | FlashMessages::addMessage( |
107 | 107 | I18N::translate('An error occured while updating the map configuration.'), |
108 | 108 | 'danger' |
109 | 109 | ); |
110 | 110 | //phpcs:ignore Generic.Files.LineLength.TooLong |
111 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage()); |
|
111 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating Map Adapter “'.$map_adapter->id().'”: '.$ex->getMessage()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return redirect(route(GeoAnalysisViewEditPage::class, [ |
@@ -33,74 +33,74 @@ |
||
33 | 33 | */ |
34 | 34 | class GeoAnalysisViewListData implements RequestHandlerInterface |
35 | 35 | { |
36 | - private ?GeoDispersionModule $module; |
|
37 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
36 | + private ?GeoDispersionModule $module; |
|
37 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor for GeoAnalysisViewListData Request Handler |
|
41 | - * |
|
42 | - * @param ModuleService $module_service |
|
43 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
44 | - */ |
|
45 | - public function __construct( |
|
46 | - ModuleService $module_service, |
|
47 | - GeoAnalysisViewDataService $geoview_data_service |
|
48 | - ) { |
|
49 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
50 | - $this->geoview_data_service = $geoview_data_service; |
|
51 | - } |
|
39 | + /** |
|
40 | + * Constructor for GeoAnalysisViewListData Request Handler |
|
41 | + * |
|
42 | + * @param ModuleService $module_service |
|
43 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
44 | + */ |
|
45 | + public function __construct( |
|
46 | + ModuleService $module_service, |
|
47 | + GeoAnalysisViewDataService $geoview_data_service |
|
48 | + ) { |
|
49 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
50 | + $this->geoview_data_service = $geoview_data_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(); |
|
63 | + $tree = Validator::attributes($request)->tree(); |
|
64 | 64 | |
65 | - $module = $this->module; |
|
66 | - $module_name = $this->module->name(); |
|
67 | - return response(['data' => $this->geoview_data_service->all($tree, true) |
|
68 | - ->map(fn(AbstractGeoAnalysisView $view) => [ |
|
69 | - 'edit' => view($module_name . '::admin/view-table-options', [ |
|
70 | - 'view_id' => $view->id(), |
|
71 | - 'view_enabled' => $view->isEnabled(), |
|
72 | - 'view_edit_route' => route(GeoAnalysisViewEditPage::class, [ |
|
73 | - 'tree' => $tree->name(), |
|
74 | - 'view_id' => $view->id() |
|
75 | - ]), |
|
76 | - 'view_delete_route' => route(GeoAnalysisViewDeleteAction::class, [ |
|
77 | - 'tree' => $tree->name(), |
|
78 | - 'view_id' => $view->id() |
|
79 | - ]), |
|
80 | - 'view_status_route' => route(GeoAnalysisViewStatusAction::class, [ |
|
81 | - 'tree' => $tree->name(), |
|
82 | - 'view_id' => $view->id(), |
|
83 | - 'enable' => $view->isEnabled() ? 0 : 1 |
|
84 | - ]), |
|
85 | - ]), |
|
86 | - 'enabled' => [ |
|
87 | - 'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]), |
|
88 | - 'raw' => $view->isEnabled() ? 0 : 1 |
|
89 | - ], |
|
90 | - 'type' => $view->icon($module), |
|
91 | - 'description' => [ |
|
92 | - 'display' => '<bdi>' . e($view->description()) . '</bdi>', |
|
93 | - 'raw' => e($view->description()) |
|
94 | - ], |
|
95 | - 'analysis' => [ |
|
96 | - 'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>', |
|
97 | - 'raw' => e($view->analysis()->title()) |
|
98 | - ], |
|
99 | - 'place_depth' => [ |
|
100 | - 'display' => I18N::number($view->placesDepth()), |
|
101 | - 'raw' => $view->placesDepth() |
|
102 | - ] |
|
103 | - ]) |
|
104 | - ]); |
|
105 | - } |
|
65 | + $module = $this->module; |
|
66 | + $module_name = $this->module->name(); |
|
67 | + return response(['data' => $this->geoview_data_service->all($tree, true) |
|
68 | + ->map(fn(AbstractGeoAnalysisView $view) => [ |
|
69 | + 'edit' => view($module_name . '::admin/view-table-options', [ |
|
70 | + 'view_id' => $view->id(), |
|
71 | + 'view_enabled' => $view->isEnabled(), |
|
72 | + 'view_edit_route' => route(GeoAnalysisViewEditPage::class, [ |
|
73 | + 'tree' => $tree->name(), |
|
74 | + 'view_id' => $view->id() |
|
75 | + ]), |
|
76 | + 'view_delete_route' => route(GeoAnalysisViewDeleteAction::class, [ |
|
77 | + 'tree' => $tree->name(), |
|
78 | + 'view_id' => $view->id() |
|
79 | + ]), |
|
80 | + 'view_status_route' => route(GeoAnalysisViewStatusAction::class, [ |
|
81 | + 'tree' => $tree->name(), |
|
82 | + 'view_id' => $view->id(), |
|
83 | + 'enable' => $view->isEnabled() ? 0 : 1 |
|
84 | + ]), |
|
85 | + ]), |
|
86 | + 'enabled' => [ |
|
87 | + 'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]), |
|
88 | + 'raw' => $view->isEnabled() ? 0 : 1 |
|
89 | + ], |
|
90 | + 'type' => $view->icon($module), |
|
91 | + 'description' => [ |
|
92 | + 'display' => '<bdi>' . e($view->description()) . '</bdi>', |
|
93 | + 'raw' => e($view->description()) |
|
94 | + ], |
|
95 | + 'analysis' => [ |
|
96 | + 'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>', |
|
97 | + 'raw' => e($view->analysis()->title()) |
|
98 | + ], |
|
99 | + 'place_depth' => [ |
|
100 | + 'display' => I18N::number($view->placesDepth()), |
|
101 | + 'raw' => $view->placesDepth() |
|
102 | + ] |
|
103 | + ]) |
|
104 | + ]); |
|
105 | + } |
|
106 | 106 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $module_name = $this->module->name(); |
67 | 67 | return response(['data' => $this->geoview_data_service->all($tree, true) |
68 | 68 | ->map(fn(AbstractGeoAnalysisView $view) => [ |
69 | - 'edit' => view($module_name . '::admin/view-table-options', [ |
|
69 | + 'edit' => view($module_name.'::admin/view-table-options', [ |
|
70 | 70 | 'view_id' => $view->id(), |
71 | 71 | 'view_enabled' => $view->isEnabled(), |
72 | 72 | 'view_edit_route' => route(GeoAnalysisViewEditPage::class, [ |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | ]), |
85 | 85 | ]), |
86 | 86 | 'enabled' => [ |
87 | - 'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]), |
|
87 | + 'display' => view($module_name.'::components/yes-no-icons', ['yes' => $view->isEnabled()]), |
|
88 | 88 | 'raw' => $view->isEnabled() ? 0 : 1 |
89 | 89 | ], |
90 | 90 | 'type' => $view->icon($module), |
91 | 91 | 'description' => [ |
92 | - 'display' => '<bdi>' . e($view->description()) . '</bdi>', |
|
92 | + 'display' => '<bdi>'.e($view->description()).'</bdi>', |
|
93 | 93 | 'raw' => e($view->description()) |
94 | 94 | ], |
95 | 95 | 'analysis' => [ |
96 | - 'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>', |
|
96 | + 'display' => '<bdi>'.e($view->analysis()->title()).'</bdi>', |
|
97 | 97 | 'raw' => e($view->analysis()->title()) |
98 | 98 | ], |
99 | 99 | 'place_depth' => [ |
@@ -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 | } |
@@ -83,7 +83,7 @@ |
||
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | - return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
86 | + return $this->viewResponse($this->module->name().'::admin/map-adapter-edit', [ |
|
87 | 87 | 'module' => $this->module, |
88 | 88 | 'title' => I18N::translate('Edit the map configuration'), |
89 | 89 | 'tree' => $tree, |
@@ -31,66 +31,66 @@ |
||
31 | 31 | */ |
32 | 32 | class GeoAnalysisViewDeleteAction implements RequestHandlerInterface |
33 | 33 | { |
34 | - private ?GeoDispersionModule $module; |
|
35 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
34 | + private ?GeoDispersionModule $module; |
|
35 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor for GeoAnalysisViewDeleteAction Request Handler |
|
39 | - * |
|
40 | - * @param ModuleService $module_service |
|
41 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
42 | - */ |
|
43 | - public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service) |
|
44 | - { |
|
45 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
46 | - $this->geoview_data_service = $geoview_data_service; |
|
47 | - } |
|
37 | + /** |
|
38 | + * Constructor for GeoAnalysisViewDeleteAction Request Handler |
|
39 | + * |
|
40 | + * @param ModuleService $module_service |
|
41 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
42 | + */ |
|
43 | + public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service) |
|
44 | + { |
|
45 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
46 | + $this->geoview_data_service = $geoview_data_service; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | - */ |
|
53 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | - { |
|
55 | - $tree = Validator::attributes($request)->tree(); |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | + */ |
|
53 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | + { |
|
55 | + $tree = Validator::attributes($request)->tree(); |
|
56 | 56 | |
57 | - $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
57 | + $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
58 | 58 | |
59 | - if ($this->module === null) { |
|
60 | - FlashMessages::addMessage( |
|
61 | - I18N::translate('The attached module could not be found.'), |
|
62 | - 'danger' |
|
63 | - ); |
|
64 | - return redirect($admin_config_route); |
|
65 | - } |
|
59 | + if ($this->module === null) { |
|
60 | + FlashMessages::addMessage( |
|
61 | + I18N::translate('The attached module could not be found.'), |
|
62 | + 'danger' |
|
63 | + ); |
|
64 | + return redirect($admin_config_route); |
|
65 | + } |
|
66 | 66 | |
67 | - $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
68 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
67 | + $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
68 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
69 | 69 | |
70 | - if ($view === null) { |
|
71 | - FlashMessages::addMessage( |
|
72 | - I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)), |
|
73 | - 'danger' |
|
74 | - ); |
|
75 | - return redirect($admin_config_route); |
|
76 | - } |
|
70 | + if ($view === null) { |
|
71 | + FlashMessages::addMessage( |
|
72 | + I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)), |
|
73 | + 'danger' |
|
74 | + ); |
|
75 | + return redirect($admin_config_route); |
|
76 | + } |
|
77 | 77 | |
78 | - if ($this->geoview_data_service->delete($view) > 0) { |
|
79 | - FlashMessages::addMessage( |
|
80 | - I18N::translate('The geographical dispersion analysis view has been successfully deleted.'), |
|
81 | - 'success' |
|
82 | - ); |
|
83 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
84 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.'); |
|
85 | - } else { |
|
86 | - FlashMessages::addMessage( |
|
87 | - I18N::translate('An error occured while deleting the geographical dispersion analysis view.'), |
|
88 | - 'danger' |
|
89 | - ); |
|
90 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
91 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.'); |
|
92 | - } |
|
78 | + if ($this->geoview_data_service->delete($view) > 0) { |
|
79 | + FlashMessages::addMessage( |
|
80 | + I18N::translate('The geographical dispersion analysis view has been successfully deleted.'), |
|
81 | + 'success' |
|
82 | + ); |
|
83 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
84 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.'); |
|
85 | + } else { |
|
86 | + FlashMessages::addMessage( |
|
87 | + I18N::translate('An error occured while deleting the geographical dispersion analysis view.'), |
|
88 | + 'danger' |
|
89 | + ); |
|
90 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
91 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.'); |
|
92 | + } |
|
93 | 93 | |
94 | - return redirect($admin_config_route); |
|
95 | - } |
|
94 | + return redirect($admin_config_route); |
|
95 | + } |
|
96 | 96 | } |
@@ -81,14 +81,14 @@ |
||
81 | 81 | 'success' |
82 | 82 | ); |
83 | 83 | //phpcs:ignore Generic.Files.LineLength.TooLong |
84 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.'); |
|
84 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been deleted.'); |
|
85 | 85 | } else { |
86 | 86 | FlashMessages::addMessage( |
87 | 87 | I18N::translate('An error occured while deleting the geographical dispersion analysis view.'), |
88 | 88 | 'danger' |
89 | 89 | ); |
90 | 90 | //phpcs:ignore Generic.Files.LineLength.TooLong |
91 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.'); |
|
91 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” could not be deleted. See error log.'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return redirect($admin_config_route); |
@@ -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 | } |
@@ -35,77 +35,77 @@ |
||
35 | 35 | */ |
36 | 36 | class MapAdapterDeleteInvalidAction implements RequestHandlerInterface |
37 | 37 | { |
38 | - private ?GeoDispersionModule $module; |
|
39 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
40 | - private MapAdapterDataService $mapadapter_data_service; |
|
38 | + private ?GeoDispersionModule $module; |
|
39 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
40 | + private MapAdapterDataService $mapadapter_data_service; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Constructor for MapAdapterDeleteInvalidAction Request Handler |
|
44 | - * |
|
45 | - * @param ModuleService $module_service |
|
46 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
47 | - * @param MapAdapterDataService $mapadapter_data_service |
|
48 | - */ |
|
49 | - public function __construct( |
|
50 | - ModuleService $module_service, |
|
51 | - GeoAnalysisViewDataService $geoview_data_service, |
|
52 | - MapAdapterDataService $mapadapter_data_service |
|
53 | - ) { |
|
54 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
55 | - $this->geoview_data_service = $geoview_data_service; |
|
56 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
57 | - } |
|
42 | + /** |
|
43 | + * Constructor for MapAdapterDeleteInvalidAction Request Handler |
|
44 | + * |
|
45 | + * @param ModuleService $module_service |
|
46 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
47 | + * @param MapAdapterDataService $mapadapter_data_service |
|
48 | + */ |
|
49 | + public function __construct( |
|
50 | + ModuleService $module_service, |
|
51 | + GeoAnalysisViewDataService $geoview_data_service, |
|
52 | + MapAdapterDataService $mapadapter_data_service |
|
53 | + ) { |
|
54 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
55 | + $this->geoview_data_service = $geoview_data_service; |
|
56 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
62 | - */ |
|
63 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
64 | - { |
|
65 | - $tree = Validator::attributes($request)->tree(); |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
62 | + */ |
|
63 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
64 | + { |
|
65 | + $tree = Validator::attributes($request)->tree(); |
|
66 | 66 | |
67 | - if ($this->module === null) { |
|
68 | - FlashMessages::addMessage( |
|
69 | - I18N::translate('The attached module could not be found.'), |
|
70 | - 'danger' |
|
71 | - ); |
|
72 | - return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
73 | - } |
|
67 | + if ($this->module === null) { |
|
68 | + FlashMessages::addMessage( |
|
69 | + I18N::translate('The attached module could not be found.'), |
|
70 | + 'danger' |
|
71 | + ); |
|
72 | + return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
73 | + } |
|
74 | 74 | |
75 | - $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
76 | - $view = $this->geoview_data_service->find($tree, $view_id); |
|
75 | + $view_id = Validator::attributes($request)->integer('view_id', -1); |
|
76 | + $view = $this->geoview_data_service->find($tree, $view_id); |
|
77 | 77 | |
78 | - if ($view === null || !($view instanceof GeoAnalysisMap)) { |
|
79 | - FlashMessages::addMessage( |
|
80 | - I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)), |
|
81 | - 'danger' |
|
82 | - ); |
|
83 | - return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
84 | - } |
|
78 | + if ($view === null || !($view instanceof GeoAnalysisMap)) { |
|
79 | + FlashMessages::addMessage( |
|
80 | + I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)), |
|
81 | + 'danger' |
|
82 | + ); |
|
83 | + return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()])); |
|
84 | + } |
|
85 | 85 | |
86 | - /** @var \Illuminate\Support\Collection<int> $valid_map_adapters */ |
|
87 | - $valid_map_adapters = $this->mapadapter_data_service |
|
88 | - ->allForView($view) |
|
89 | - ->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id()); |
|
86 | + /** @var \Illuminate\Support\Collection<int> $valid_map_adapters */ |
|
87 | + $valid_map_adapters = $this->mapadapter_data_service |
|
88 | + ->allForView($view) |
|
89 | + ->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id()); |
|
90 | 90 | |
91 | - try { |
|
92 | - $this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters); |
|
93 | - FlashMessages::addMessage( |
|
94 | - I18N::translate('The invalid map configurations have been successfully deleted.'), |
|
95 | - 'success' |
|
96 | - ); |
|
97 | - } catch (Throwable $ex) { |
|
98 | - FlashMessages::addMessage( |
|
99 | - I18N::translate('An error occured while deleting the invalid map configurations.'), |
|
100 | - 'danger' |
|
101 | - ); |
|
102 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
103 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage()); |
|
104 | - } |
|
91 | + try { |
|
92 | + $this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters); |
|
93 | + FlashMessages::addMessage( |
|
94 | + I18N::translate('The invalid map configurations have been successfully deleted.'), |
|
95 | + 'success' |
|
96 | + ); |
|
97 | + } catch (Throwable $ex) { |
|
98 | + FlashMessages::addMessage( |
|
99 | + I18N::translate('An error occured while deleting the invalid map configurations.'), |
|
100 | + 'danger' |
|
101 | + ); |
|
102 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
103 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage()); |
|
104 | + } |
|
105 | 105 | |
106 | - return redirect(route(GeoAnalysisViewEditPage::class, [ |
|
107 | - 'tree' => $tree->name(), |
|
108 | - 'view_id' => $view_id |
|
109 | - ])); |
|
110 | - } |
|
106 | + return redirect(route(GeoAnalysisViewEditPage::class, [ |
|
107 | + 'tree' => $tree->name(), |
|
108 | + 'view_id' => $view_id |
|
109 | + ])); |
|
110 | + } |
|
111 | 111 | } |
@@ -100,7 +100,7 @@ |
||
100 | 100 | 'danger' |
101 | 101 | ); |
102 | 102 | //phpcs:ignore Generic.Files.LineLength.TooLong |
103 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage()); |
|
103 | + Log::addConfigurationLog('Module '.$this->module->title().' : Error when deleting invalid map configurations: '.$ex->getMessage()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return redirect(route(GeoAnalysisViewEditPage::class, [ |
@@ -30,51 +30,51 @@ |
||
30 | 30 | */ |
31 | 31 | class MapFeaturePropertyData implements RequestHandlerInterface |
32 | 32 | { |
33 | - private MapDefinitionsService $map_definition_service; |
|
33 | + private MapDefinitionsService $map_definition_service; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Constructor for MapFeaturePropertyData Request Handler |
|
37 | - * |
|
38 | - * @param MapDefinitionsService $map_definition_service |
|
39 | - */ |
|
40 | - public function __construct( |
|
41 | - MapDefinitionsService $map_definition_service |
|
42 | - ) { |
|
43 | - $this->map_definition_service = $map_definition_service; |
|
44 | - } |
|
35 | + /** |
|
36 | + * Constructor for MapFeaturePropertyData Request Handler |
|
37 | + * |
|
38 | + * @param MapDefinitionsService $map_definition_service |
|
39 | + */ |
|
40 | + public function __construct( |
|
41 | + MapDefinitionsService $map_definition_service |
|
42 | + ) { |
|
43 | + $this->map_definition_service = $map_definition_service; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * {@inheritDoc} |
|
48 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
49 | - */ |
|
50 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
51 | - { |
|
52 | - $map_id = Validator::queryParams($request)->string( |
|
53 | - 'map_id', |
|
54 | - Validator::attributes($request)->string('map_id', '') |
|
55 | - ); |
|
46 | + /** |
|
47 | + * {@inheritDoc} |
|
48 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
49 | + */ |
|
50 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
51 | + { |
|
52 | + $map_id = Validator::queryParams($request)->string( |
|
53 | + 'map_id', |
|
54 | + Validator::attributes($request)->string('map_id', '') |
|
55 | + ); |
|
56 | 56 | |
57 | - return response(Registry::cache()->file()->remember( |
|
58 | - 'map-properties-' . $map_id, |
|
59 | - function () use ($map_id): array { |
|
60 | - $map = $this->map_definition_service->find($map_id); |
|
61 | - if ($map === null) { |
|
62 | - throw new HttpNotFoundException(I18N::translate('The map could not be found.')); |
|
63 | - } |
|
57 | + return response(Registry::cache()->file()->remember( |
|
58 | + 'map-properties-' . $map_id, |
|
59 | + function () use ($map_id): array { |
|
60 | + $map = $this->map_definition_service->find($map_id); |
|
61 | + if ($map === null) { |
|
62 | + throw new HttpNotFoundException(I18N::translate('The map could not be found.')); |
|
63 | + } |
|
64 | 64 | |
65 | - $features = []; |
|
66 | - collect($map->features()) |
|
67 | - ->map(fn(Feature $feature): ?stdClass => $feature->getProperties()) |
|
68 | - ->filter() |
|
69 | - ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties))) |
|
70 | - ->each(function (array $properties) use (&$features): void { |
|
71 | - $features = count($features) === 0 ? $properties : array_intersect($features, $properties); |
|
72 | - }); |
|
65 | + $features = []; |
|
66 | + collect($map->features()) |
|
67 | + ->map(fn(Feature $feature): ?stdClass => $feature->getProperties()) |
|
68 | + ->filter() |
|
69 | + ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties))) |
|
70 | + ->each(function (array $properties) use (&$features): void { |
|
71 | + $features = count($features) === 0 ? $properties : array_intersect($features, $properties); |
|
72 | + }); |
|
73 | 73 | |
74 | - usort($features, I18N::comparator()); |
|
75 | - return $features; |
|
76 | - }, |
|
77 | - 86400000 |
|
78 | - )); |
|
79 | - } |
|
74 | + usort($features, I18N::comparator()); |
|
75 | + return $features; |
|
76 | + }, |
|
77 | + 86400000 |
|
78 | + )); |
|
79 | + } |
|
80 | 80 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | ); |
56 | 56 | |
57 | 57 | return response(Registry::cache()->file()->remember( |
58 | - 'map-properties-' . $map_id, |
|
59 | - function () use ($map_id): array { |
|
58 | + 'map-properties-'.$map_id, |
|
59 | + function() use ($map_id): array { |
|
60 | 60 | $map = $this->map_definition_service->find($map_id); |
61 | 61 | if ($map === null) { |
62 | 62 | throw new HttpNotFoundException(I18N::translate('The map could not be found.')); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | collect($map->features()) |
67 | 67 | ->map(fn(Feature $feature): ?stdClass => $feature->getProperties()) |
68 | 68 | ->filter() |
69 | - ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties))) |
|
70 | - ->each(function (array $properties) use (&$features): void { |
|
69 | + ->map(fn(stdClass $properties) : array => array_keys(get_object_vars($properties))) |
|
70 | + ->each(function(array $properties) use (&$features) : void { |
|
71 | 71 | $features = count($features) === 0 ? $properties : array_intersect($features, $properties); |
72 | 72 | }); |
73 | 73 |