@@ -38,64 +38,64 @@ |
||
38 | 38 | */ |
39 | 39 | class GeoAnalysisViewEditPage implements RequestHandlerInterface |
40 | 40 | { |
41 | - use ViewResponseTrait; |
|
41 | + use ViewResponseTrait; |
|
42 | 42 | |
43 | - private ?GeoDispersionModule $module; |
|
44 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
45 | - private GeoAnalysisService $geoanalysis_service; |
|
46 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
43 | + private ?GeoDispersionModule $module; |
|
44 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
45 | + private GeoAnalysisService $geoanalysis_service; |
|
46 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Constructor for GeoAnalysisViewEditPage Request Handler |
|
50 | - * |
|
51 | - * @param ModuleService $module_service |
|
52 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
53 | - * @param GeoAnalysisService $geoanalysis_service |
|
54 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
55 | - */ |
|
56 | - public function __construct( |
|
57 | - ModuleService $module_service, |
|
58 | - GeoAnalysisViewDataService $geoview_data_service, |
|
59 | - GeoAnalysisService $geoanalysis_service, |
|
60 | - GeoAnalysisDataService $geoanalysis_data_service |
|
61 | - ) { |
|
62 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
63 | - $this->geoview_data_service = $geoview_data_service; |
|
64 | - $this->geoanalysis_service = $geoanalysis_service; |
|
65 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
66 | - } |
|
48 | + /** |
|
49 | + * Constructor for GeoAnalysisViewEditPage Request Handler |
|
50 | + * |
|
51 | + * @param ModuleService $module_service |
|
52 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
53 | + * @param GeoAnalysisService $geoanalysis_service |
|
54 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
55 | + */ |
|
56 | + public function __construct( |
|
57 | + ModuleService $module_service, |
|
58 | + GeoAnalysisViewDataService $geoview_data_service, |
|
59 | + GeoAnalysisService $geoanalysis_service, |
|
60 | + GeoAnalysisDataService $geoanalysis_data_service |
|
61 | + ) { |
|
62 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
63 | + $this->geoview_data_service = $geoview_data_service; |
|
64 | + $this->geoanalysis_service = $geoanalysis_service; |
|
65 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * {@inheritDoc} |
|
70 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
71 | - */ |
|
72 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
73 | - { |
|
74 | - $this->layout = 'layouts/administration'; |
|
68 | + /** |
|
69 | + * {@inheritDoc} |
|
70 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
71 | + */ |
|
72 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
73 | + { |
|
74 | + $this->layout = 'layouts/administration'; |
|
75 | 75 | |
76 | - if ($this->module === null) { |
|
77 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
78 | - } |
|
79 | - $tree = $request->getAttribute('tree'); |
|
80 | - assert($tree instanceof Tree); |
|
76 | + if ($this->module === null) { |
|
77 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
78 | + } |
|
79 | + $tree = $request->getAttribute('tree'); |
|
80 | + assert($tree instanceof Tree); |
|
81 | 81 | |
82 | - $view_id = (int) $request->getAttribute('view_id'); |
|
83 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
82 | + $view_id = (int) $request->getAttribute('view_id'); |
|
83 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
84 | 84 | |
85 | - if ($view === null) { |
|
86 | - throw new HttpNotFoundException( |
|
87 | - I18N::translate('The geographical dispersion analysis view could not be found.') |
|
88 | - ); |
|
89 | - } |
|
85 | + if ($view === null) { |
|
86 | + throw new HttpNotFoundException( |
|
87 | + I18N::translate('The geographical dispersion analysis view could not be found.') |
|
88 | + ); |
|
89 | + } |
|
90 | 90 | |
91 | - return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
92 | - 'module' => $this->module, |
|
93 | - 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
|
94 | - 'tree' => $tree, |
|
95 | - 'view' => $view, |
|
96 | - 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
97 | - 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
98 | - 'global_settings' => $view->globalSettingsContent($this->module) |
|
99 | - ]); |
|
100 | - } |
|
91 | + return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
92 | + 'module' => $this->module, |
|
93 | + 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
|
94 | + 'tree' => $tree, |
|
95 | + 'view' => $view, |
|
96 | + 'geoanalysis_list' => $this->geoanalysis_service->all(), |
|
97 | + 'place_example' => $this->geoanalysis_data_service->placeHierarchyExample($tree), |
|
98 | + 'global_settings' => $view->globalSettingsContent($this->module) |
|
99 | + ]); |
|
100 | + } |
|
101 | 101 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $tree = $request->getAttribute('tree'); |
80 | 80 | assert($tree instanceof Tree); |
81 | 81 | |
82 | - $view_id = (int) $request->getAttribute('view_id'); |
|
82 | + $view_id = (int)$request->getAttribute('view_id'); |
|
83 | 83 | $view = $this->geoview_data_service->find($tree, $view_id, true); |
84 | 84 | |
85 | 85 | if ($view === null) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | } |
90 | 90 | |
91 | - return $this->viewResponse($this->module->name() . '::admin/view-edit', [ |
|
91 | + return $this->viewResponse($this->module->name().'::admin/view-edit', [ |
|
92 | 92 | 'module' => $this->module, |
93 | 93 | 'title' => I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()), |
94 | 94 | 'tree' => $tree, |
@@ -34,89 +34,89 @@ |
||
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 = $request->getAttribute('tree'); |
|
59 | - assert($tree instanceof Tree); |
|
60 | - |
|
61 | - $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
62 | - |
|
63 | - if ($this->module === null) { |
|
64 | - FlashMessages::addMessage( |
|
65 | - I18N::translate('The attached module could not be found.'), |
|
66 | - 'danger' |
|
67 | - ); |
|
68 | - return redirect($admin_config_route); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - $view_id = (int) $request->getAttribute('view_id'); |
|
73 | - $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
74 | - |
|
75 | - $params = (array) $request->getParsedBody(); |
|
76 | - |
|
77 | - $description = $params['view_description'] ?? ''; |
|
78 | - $place_depth = (int) ($params['view_depth'] ?? 1); |
|
79 | - $top_places = (int) ($params['view_top_places'] ?? 0); |
|
80 | - |
|
81 | - $analysis = null; |
|
82 | - try { |
|
83 | - $analysis = app($params['view_analysis'] ?? ''); |
|
84 | - } catch (BindingResolutionException $ex) { |
|
85 | - } |
|
86 | - |
|
87 | - if ( |
|
88 | - $view === null |
|
89 | - || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
90 | - || $place_depth <= 0 && $top_places < 0 |
|
91 | - ) { |
|
92 | - FlashMessages::addMessage( |
|
93 | - I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)), |
|
94 | - 'danger' |
|
95 | - ); |
|
96 | - return redirect($admin_config_route); |
|
97 | - } |
|
98 | - |
|
99 | - $new_view = $view |
|
100 | - ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places) |
|
101 | - ->withGlobalSettingsUpdate($request); |
|
102 | - |
|
103 | - try { |
|
104 | - $this->geoview_data_service->update($new_view); |
|
105 | - FlashMessages::addMessage( |
|
106 | - I18N::translate('The geographical dispersion analysis view has been successfully updated.'), |
|
107 | - 'success' |
|
108 | - ); |
|
109 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
110 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
111 | - } catch (Throwable $ex) { |
|
112 | - FlashMessages::addMessage( |
|
113 | - I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
|
114 | - 'danger' |
|
115 | - ); |
|
116 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
117 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
118 | - } |
|
119 | - |
|
120 | - return redirect($admin_config_route); |
|
121 | - } |
|
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 = $request->getAttribute('tree'); |
|
59 | + assert($tree instanceof Tree); |
|
60 | + |
|
61 | + $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
62 | + |
|
63 | + if ($this->module === null) { |
|
64 | + FlashMessages::addMessage( |
|
65 | + I18N::translate('The attached module could not be found.'), |
|
66 | + 'danger' |
|
67 | + ); |
|
68 | + return redirect($admin_config_route); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + $view_id = (int) $request->getAttribute('view_id'); |
|
73 | + $view = $this->geoview_data_service->find($tree, $view_id, true); |
|
74 | + |
|
75 | + $params = (array) $request->getParsedBody(); |
|
76 | + |
|
77 | + $description = $params['view_description'] ?? ''; |
|
78 | + $place_depth = (int) ($params['view_depth'] ?? 1); |
|
79 | + $top_places = (int) ($params['view_top_places'] ?? 0); |
|
80 | + |
|
81 | + $analysis = null; |
|
82 | + try { |
|
83 | + $analysis = app($params['view_analysis'] ?? ''); |
|
84 | + } catch (BindingResolutionException $ex) { |
|
85 | + } |
|
86 | + |
|
87 | + if ( |
|
88 | + $view === null |
|
89 | + || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
90 | + || $place_depth <= 0 && $top_places < 0 |
|
91 | + ) { |
|
92 | + FlashMessages::addMessage( |
|
93 | + I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)), |
|
94 | + 'danger' |
|
95 | + ); |
|
96 | + return redirect($admin_config_route); |
|
97 | + } |
|
98 | + |
|
99 | + $new_view = $view |
|
100 | + ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places) |
|
101 | + ->withGlobalSettingsUpdate($request); |
|
102 | + |
|
103 | + try { |
|
104 | + $this->geoview_data_service->update($new_view); |
|
105 | + FlashMessages::addMessage( |
|
106 | + I18N::translate('The geographical dispersion analysis view has been successfully updated.'), |
|
107 | + 'success' |
|
108 | + ); |
|
109 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
110 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
111 | + } catch (Throwable $ex) { |
|
112 | + FlashMessages::addMessage( |
|
113 | + I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
|
114 | + 'danger' |
|
115 | + ); |
|
116 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
117 | + Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
118 | + } |
|
119 | + |
|
120 | + return redirect($admin_config_route); |
|
121 | + } |
|
122 | 122 | } |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | - $view_id = (int) $request->getAttribute('view_id'); |
|
72 | + $view_id = (int)$request->getAttribute('view_id'); |
|
73 | 73 | $view = $this->geoview_data_service->find($tree, $view_id, true); |
74 | 74 | |
75 | - $params = (array) $request->getParsedBody(); |
|
75 | + $params = (array)$request->getParsedBody(); |
|
76 | 76 | |
77 | 77 | $description = $params['view_description'] ?? ''; |
78 | - $place_depth = (int) ($params['view_depth'] ?? 1); |
|
79 | - $top_places = (int) ($params['view_top_places'] ?? 0); |
|
78 | + $place_depth = (int)($params['view_depth'] ?? 1); |
|
79 | + $top_places = (int)($params['view_top_places'] ?? 0); |
|
80 | 80 | |
81 | 81 | $analysis = null; |
82 | 82 | try { |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | 'success' |
108 | 108 | ); |
109 | 109 | //phpcs:ignore Generic.Files.LineLength.TooLong |
110 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
110 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.'); |
|
111 | 111 | } catch (Throwable $ex) { |
112 | 112 | FlashMessages::addMessage( |
113 | 113 | I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
114 | 114 | 'danger' |
115 | 115 | ); |
116 | 116 | //phpcs:ignore Generic.Files.LineLength.TooLong |
117 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
117 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage()); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return redirect($admin_config_route); |
@@ -32,47 +32,47 @@ |
||
32 | 32 | */ |
33 | 33 | class GeoAnalysisViewsList 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 GeoAnalysisViewsList 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 GeoAnalysisViewsList 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 = $request->getAttribute('tree'); |
|
64 | - assert($tree instanceof Tree); |
|
63 | + $tree = $request->getAttribute('tree'); |
|
64 | + assert($tree instanceof 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 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | ->all($tree) |
68 | 68 | ->sortBy(fn(AbstractGeoAnalysisView $view) => $view->description()); |
69 | 69 | |
70 | - return $this->viewResponse($this->module->name() . '::geoanalysisviews-list', [ |
|
70 | + return $this->viewResponse($this->module->name().'::geoanalysisviews-list', [ |
|
71 | 71 | 'module' => $this->module, |
72 | 72 | 'title' => I18N::translate('Geographical dispersion'), |
73 | 73 | 'tree' => $tree, |
@@ -30,61 +30,61 @@ |
||
30 | 30 | */ |
31 | 31 | class GeoAnalysisViewTabs implements RequestHandlerInterface |
32 | 32 | { |
33 | - private ?GeoDispersionModule $module; |
|
34 | - private GeoAnalysisViewDataService $geoviewdata_service; |
|
33 | + private ?GeoDispersionModule $module; |
|
34 | + private GeoAnalysisViewDataService $geoviewdata_service; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor for GeoAnalysisMapsList Request Handler |
|
38 | - * |
|
39 | - * @param ModuleService $module_service |
|
40 | - */ |
|
41 | - public function __construct( |
|
42 | - ModuleService $module_service, |
|
43 | - GeoAnalysisViewDataService $geoviewdata_service |
|
44 | - ) { |
|
45 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
46 | - $this->geoviewdata_service = $geoviewdata_service; |
|
47 | - } |
|
36 | + /** |
|
37 | + * Constructor for GeoAnalysisMapsList Request Handler |
|
38 | + * |
|
39 | + * @param ModuleService $module_service |
|
40 | + */ |
|
41 | + public function __construct( |
|
42 | + ModuleService $module_service, |
|
43 | + GeoAnalysisViewDataService $geoviewdata_service |
|
44 | + ) { |
|
45 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
46 | + $this->geoviewdata_service = $geoviewdata_service; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | - */ |
|
53 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | - { |
|
55 | - if ($this->module === null) { |
|
56 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
57 | - } |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | + */ |
|
53 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | + { |
|
55 | + if ($this->module === null) { |
|
56 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
57 | + } |
|
58 | 58 | |
59 | - $tree = $request->getAttribute('tree'); |
|
60 | - assert($tree instanceof Tree); |
|
59 | + $tree = $request->getAttribute('tree'); |
|
60 | + assert($tree instanceof Tree); |
|
61 | 61 | |
62 | - $view_id = $request->getAttribute('view_id'); |
|
63 | - $view_id = is_numeric($view_id) ? (int) $view_id : 0; |
|
62 | + $view_id = $request->getAttribute('view_id'); |
|
63 | + $view_id = is_numeric($view_id) ? (int) $view_id : 0; |
|
64 | 64 | |
65 | - $view = $this->geoviewdata_service->find($tree, $view_id); |
|
65 | + $view = $this->geoviewdata_service->find($tree, $view_id); |
|
66 | 66 | |
67 | - if ($view === null) { |
|
68 | - throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.')); |
|
69 | - } |
|
67 | + if ($view === null) { |
|
68 | + throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.')); |
|
69 | + } |
|
70 | 70 | |
71 | - $results = $view->analysis()->results($tree, $view->placesDepth()); |
|
71 | + $results = $view->analysis()->results($tree, $view->placesDepth()); |
|
72 | 72 | |
73 | - $params = [ |
|
74 | - 'module_name' => $this->module->name(), |
|
75 | - 'tree' => $tree, |
|
76 | - 'view' => $view, |
|
77 | - 'items_descr' => $view->analysis()->itemsDescription() |
|
78 | - ]; |
|
79 | - $response = [ |
|
80 | - 'global' => view('layouts/ajax', [ |
|
81 | - 'content' => $view->globalTabContent($this->module, $results->global(), $params) |
|
82 | - ]), |
|
83 | - 'detailed' => view('layouts/ajax', [ |
|
84 | - 'content' => $view->detailedTabContent($this->module, $results->sortedDetailed(), $params) |
|
85 | - ]) |
|
86 | - ]; |
|
73 | + $params = [ |
|
74 | + 'module_name' => $this->module->name(), |
|
75 | + 'tree' => $tree, |
|
76 | + 'view' => $view, |
|
77 | + 'items_descr' => $view->analysis()->itemsDescription() |
|
78 | + ]; |
|
79 | + $response = [ |
|
80 | + 'global' => view('layouts/ajax', [ |
|
81 | + 'content' => $view->globalTabContent($this->module, $results->global(), $params) |
|
82 | + ]), |
|
83 | + 'detailed' => view('layouts/ajax', [ |
|
84 | + 'content' => $view->detailedTabContent($this->module, $results->sortedDetailed(), $params) |
|
85 | + ]) |
|
86 | + ]; |
|
87 | 87 | |
88 | - return response($response); |
|
89 | - } |
|
88 | + return response($response); |
|
89 | + } |
|
90 | 90 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | assert($tree instanceof Tree); |
61 | 61 | |
62 | 62 | $view_id = $request->getAttribute('view_id'); |
63 | - $view_id = is_numeric($view_id) ? (int) $view_id : 0; |
|
63 | + $view_id = is_numeric($view_id) ? (int)$view_id : 0; |
|
64 | 64 | |
65 | 65 | $view = $this->geoviewdata_service->find($tree, $view_id); |
66 | 66 |
@@ -32,68 +32,68 @@ |
||
32 | 32 | */ |
33 | 33 | class MapAdapterMapperConfig implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private MapAdapterDataService $mapadapter_data_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private MapAdapterDataService $mapadapter_data_service; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructor for MapAdapterMapperConfig Request Handler |
|
42 | - * |
|
43 | - * @param ModuleService $module_service |
|
44 | - * @param MapAdapterDataService $mapadapter_data_service |
|
45 | - */ |
|
46 | - public function __construct( |
|
47 | - ModuleService $module_service, |
|
48 | - MapAdapterDataService $mapadapter_data_service |
|
49 | - ) { |
|
50 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
51 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
52 | - } |
|
40 | + /** |
|
41 | + * Constructor for MapAdapterMapperConfig Request Handler |
|
42 | + * |
|
43 | + * @param ModuleService $module_service |
|
44 | + * @param MapAdapterDataService $mapadapter_data_service |
|
45 | + */ |
|
46 | + public function __construct( |
|
47 | + ModuleService $module_service, |
|
48 | + MapAdapterDataService $mapadapter_data_service |
|
49 | + ) { |
|
50 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
51 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inheritDoc} |
|
56 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
57 | - */ |
|
58 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
59 | - { |
|
60 | - $this->layout = 'layouts/ajax'; |
|
54 | + /** |
|
55 | + * {@inheritDoc} |
|
56 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
57 | + */ |
|
58 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
59 | + { |
|
60 | + $this->layout = 'layouts/ajax'; |
|
61 | 61 | |
62 | - if ($this->module === null) { |
|
63 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
64 | - } |
|
65 | - $tree = $request->getAttribute('tree'); |
|
66 | - assert($tree instanceof Tree); |
|
62 | + if ($this->module === null) { |
|
63 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
64 | + } |
|
65 | + $tree = $request->getAttribute('tree'); |
|
66 | + assert($tree instanceof Tree); |
|
67 | 67 | |
68 | - $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
69 | - $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
68 | + $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
69 | + $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
70 | 70 | |
71 | - $mapper_class = $request->getQueryParams()['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 = $request->getQueryParams()['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 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $tree = $request->getAttribute('tree'); |
66 | 66 | assert($tree instanceof Tree); |
67 | 67 | |
68 | - $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
68 | + $adapter_id = (int)$request->getAttribute('adapter_id'); |
|
69 | 69 | $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
70 | 70 | |
71 | 71 | $mapper_class = $request->getQueryParams()['mapper'] ?? ''; |
@@ -31,49 +31,49 @@ |
||
31 | 31 | */ |
32 | 32 | class GeoAnalysisViewAddPage implements RequestHandlerInterface |
33 | 33 | { |
34 | - use ViewResponseTrait; |
|
34 | + use ViewResponseTrait; |
|
35 | 35 | |
36 | - private ?GeoDispersionModule $module; |
|
37 | - private GeoAnalysisService $geoanalysis_service; |
|
38 | - private GeoAnalysisDataService $geoanalysis_data_service; |
|
36 | + private ?GeoDispersionModule $module; |
|
37 | + private GeoAnalysisService $geoanalysis_service; |
|
38 | + private GeoAnalysisDataService $geoanalysis_data_service; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Constructor for GeoAnalysisViewAddPage Request Handler |
|
42 | - * |
|
43 | - * @param ModuleService $module_service |
|
44 | - * @param GeoAnalysisService $geoanalysis_service |
|
45 | - * @param GeoAnalysisDataService $geoanalysis_data_service |
|
46 | - */ |
|
47 | - public function __construct( |
|
48 | - ModuleService $module_service, |
|
49 | - GeoAnalysisService $geoanalysis_service, |
|
50 | - GeoAnalysisDataService $geoanalysis_data_service |
|
51 | - ) { |
|
52 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
53 | - $this->geoanalysis_service = $geoanalysis_service; |
|
54 | - $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
55 | - } |
|
40 | + /** |
|
41 | + * Constructor for GeoAnalysisViewAddPage Request Handler |
|
42 | + * |
|
43 | + * @param ModuleService $module_service |
|
44 | + * @param GeoAnalysisService $geoanalysis_service |
|
45 | + * @param GeoAnalysisDataService $geoanalysis_data_service |
|
46 | + */ |
|
47 | + public function __construct( |
|
48 | + ModuleService $module_service, |
|
49 | + GeoAnalysisService $geoanalysis_service, |
|
50 | + GeoAnalysisDataService $geoanalysis_data_service |
|
51 | + ) { |
|
52 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
53 | + $this->geoanalysis_service = $geoanalysis_service; |
|
54 | + $this->geoanalysis_data_service = $geoanalysis_data_service; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
60 | - */ |
|
61 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
62 | - { |
|
63 | - $this->layout = 'layouts/administration'; |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
60 | + */ |
|
61 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
62 | + { |
|
63 | + $this->layout = 'layouts/administration'; |
|
64 | 64 | |
65 | - if ($this->module === null) { |
|
66 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
67 | - } |
|
68 | - $tree = $request->getAttribute('tree'); |
|
69 | - assert($tree instanceof Tree); |
|
65 | + if ($this->module === null) { |
|
66 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
67 | + } |
|
68 | + $tree = $request->getAttribute('tree'); |
|
69 | + assert($tree instanceof 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 | $tree = $request->getAttribute('tree'); |
69 | 69 | assert($tree instanceof 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, |
@@ -34,89 +34,89 @@ |
||
34 | 34 | */ |
35 | 35 | class GeoAnalysisViewAddAction implements RequestHandlerInterface |
36 | 36 | { |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | - |
|
40 | - /** |
|
41 | - * Constructor for GeoAnalysisViewAddAction 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 = $request->getAttribute('tree'); |
|
59 | - assert($tree instanceof Tree); |
|
60 | - |
|
61 | - $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
62 | - |
|
63 | - if ($this->module === null) { |
|
64 | - FlashMessages::addMessage( |
|
65 | - I18N::translate('The attached module could not be found.'), |
|
66 | - 'danger' |
|
67 | - ); |
|
68 | - return redirect($admin_config_route); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - $params = (array) $request->getParsedBody(); |
|
73 | - |
|
74 | - $type = $params['view_type'] ?? ''; |
|
75 | - $description = $params['view_description'] ?? ''; |
|
76 | - $place_depth = (int) ($params['view_depth'] ?? 1); |
|
77 | - |
|
78 | - $analysis = null; |
|
79 | - try { |
|
80 | - $analysis = app($params['view_analysis'] ?? ''); |
|
81 | - } catch (BindingResolutionException $ex) { |
|
82 | - } |
|
83 | - |
|
84 | - if ( |
|
85 | - !in_array($type, ['table', 'map'], true) || $place_depth <= 0 |
|
86 | - || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
87 | - ) { |
|
88 | - FlashMessages::addMessage( |
|
89 | - I18N::translate('The parameters for the new view are not valid.'), |
|
90 | - 'danger' |
|
91 | - ); |
|
92 | - return redirect($admin_config_route); |
|
93 | - } |
|
94 | - |
|
95 | - if ($type === 'map') { |
|
96 | - $new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth); |
|
97 | - } else { |
|
98 | - $new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth); |
|
99 | - } |
|
100 | - |
|
101 | - $new_view_id = $this->geoview_data_service->insertGetId($new_view); |
|
102 | - if ($new_view_id > 0) { |
|
103 | - FlashMessages::addMessage( |
|
104 | - I18N::translate('The geographical dispersion analysis view has been successfully added.'), |
|
105 | - 'success' |
|
106 | - ); |
|
107 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
108 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.'); |
|
109 | - return redirect( |
|
110 | - route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ]) |
|
111 | - ); |
|
112 | - } else { |
|
113 | - FlashMessages::addMessage( |
|
114 | - I18N::translate('An error occured while adding the geographical dispersion analysis view.'), |
|
115 | - 'danger' |
|
116 | - ); |
|
117 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
118 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.'); |
|
119 | - return redirect($admin_config_route); |
|
120 | - } |
|
121 | - } |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | + |
|
40 | + /** |
|
41 | + * Constructor for GeoAnalysisViewAddAction 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 = $request->getAttribute('tree'); |
|
59 | + assert($tree instanceof Tree); |
|
60 | + |
|
61 | + $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]); |
|
62 | + |
|
63 | + if ($this->module === null) { |
|
64 | + FlashMessages::addMessage( |
|
65 | + I18N::translate('The attached module could not be found.'), |
|
66 | + 'danger' |
|
67 | + ); |
|
68 | + return redirect($admin_config_route); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + $params = (array) $request->getParsedBody(); |
|
73 | + |
|
74 | + $type = $params['view_type'] ?? ''; |
|
75 | + $description = $params['view_description'] ?? ''; |
|
76 | + $place_depth = (int) ($params['view_depth'] ?? 1); |
|
77 | + |
|
78 | + $analysis = null; |
|
79 | + try { |
|
80 | + $analysis = app($params['view_analysis'] ?? ''); |
|
81 | + } catch (BindingResolutionException $ex) { |
|
82 | + } |
|
83 | + |
|
84 | + if ( |
|
85 | + !in_array($type, ['table', 'map'], true) || $place_depth <= 0 |
|
86 | + || $analysis === null || !($analysis instanceof GeoAnalysisInterface) |
|
87 | + ) { |
|
88 | + FlashMessages::addMessage( |
|
89 | + I18N::translate('The parameters for the new view are not valid.'), |
|
90 | + 'danger' |
|
91 | + ); |
|
92 | + return redirect($admin_config_route); |
|
93 | + } |
|
94 | + |
|
95 | + if ($type === 'map') { |
|
96 | + $new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth); |
|
97 | + } else { |
|
98 | + $new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth); |
|
99 | + } |
|
100 | + |
|
101 | + $new_view_id = $this->geoview_data_service->insertGetId($new_view); |
|
102 | + if ($new_view_id > 0) { |
|
103 | + FlashMessages::addMessage( |
|
104 | + I18N::translate('The geographical dispersion analysis view has been successfully added.'), |
|
105 | + 'success' |
|
106 | + ); |
|
107 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
108 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.'); |
|
109 | + return redirect( |
|
110 | + route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ]) |
|
111 | + ); |
|
112 | + } else { |
|
113 | + FlashMessages::addMessage( |
|
114 | + I18N::translate('An error occured while adding the geographical dispersion analysis view.'), |
|
115 | + 'danger' |
|
116 | + ); |
|
117 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
118 | + Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.'); |
|
119 | + return redirect($admin_config_route); |
|
120 | + } |
|
121 | + } |
|
122 | 122 | } |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | - $params = (array) $request->getParsedBody(); |
|
72 | + $params = (array)$request->getParsedBody(); |
|
73 | 73 | |
74 | 74 | $type = $params['view_type'] ?? ''; |
75 | 75 | $description = $params['view_description'] ?? ''; |
76 | - $place_depth = (int) ($params['view_depth'] ?? 1); |
|
76 | + $place_depth = (int)($params['view_depth'] ?? 1); |
|
77 | 77 | |
78 | 78 | $analysis = null; |
79 | 79 | try { |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | 'success' |
106 | 106 | ); |
107 | 107 | //phpcs:ignore Generic.Files.LineLength.TooLong |
108 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.'); |
|
108 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$new_view_id.'” has been added.'); |
|
109 | 109 | return redirect( |
110 | - route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ]) |
|
110 | + route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id]) |
|
111 | 111 | ); |
112 | 112 | } else { |
113 | 113 | FlashMessages::addMessage( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'danger' |
116 | 116 | ); |
117 | 117 | //phpcs:ignore Generic.Files.LineLength.TooLong |
118 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.'); |
|
118 | + Log::addConfigurationLog('Module '.$this->module->title().' : A new View could not be added. See error log.'); |
|
119 | 119 | return redirect($admin_config_route); |
120 | 120 | } |
121 | 121 | } |
@@ -32,68 +32,68 @@ |
||
32 | 32 | */ |
33 | 33 | class MapAdapterEditPage implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private MapAdapterDataService $mapadapter_data_service; |
|
39 | - private MapDefinitionsService $map_definition_service; |
|
40 | - private PlaceMapperService $place_mapper_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private MapAdapterDataService $mapadapter_data_service; |
|
39 | + private MapDefinitionsService $map_definition_service; |
|
40 | + private PlaceMapperService $place_mapper_service; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Constructor for MapAdapterEditPage Request Handler |
|
44 | - * |
|
45 | - * @param ModuleService $module_service |
|
46 | - * @param MapAdapterDataService $mapadapter_data_service |
|
47 | - * @param MapDefinitionsService $map_definition_service |
|
48 | - * @param PlaceMapperService $place_mapper_service |
|
49 | - */ |
|
50 | - public function __construct( |
|
51 | - ModuleService $module_service, |
|
52 | - MapAdapterDataService $mapadapter_data_service, |
|
53 | - MapDefinitionsService $map_definition_service, |
|
54 | - PlaceMapperService $place_mapper_service |
|
55 | - ) { |
|
56 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
57 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
58 | - $this->map_definition_service = $map_definition_service; |
|
59 | - $this->place_mapper_service = $place_mapper_service; |
|
60 | - } |
|
42 | + /** |
|
43 | + * Constructor for MapAdapterEditPage Request Handler |
|
44 | + * |
|
45 | + * @param ModuleService $module_service |
|
46 | + * @param MapAdapterDataService $mapadapter_data_service |
|
47 | + * @param MapDefinitionsService $map_definition_service |
|
48 | + * @param PlaceMapperService $place_mapper_service |
|
49 | + */ |
|
50 | + public function __construct( |
|
51 | + ModuleService $module_service, |
|
52 | + MapAdapterDataService $mapadapter_data_service, |
|
53 | + MapDefinitionsService $map_definition_service, |
|
54 | + PlaceMapperService $place_mapper_service |
|
55 | + ) { |
|
56 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
57 | + $this->mapadapter_data_service = $mapadapter_data_service; |
|
58 | + $this->map_definition_service = $map_definition_service; |
|
59 | + $this->place_mapper_service = $place_mapper_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 | - } |
|
73 | - $tree = $request->getAttribute('tree'); |
|
74 | - assert($tree instanceof Tree); |
|
70 | + if ($this->module === null) { |
|
71 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
72 | + } |
|
73 | + $tree = $request->getAttribute('tree'); |
|
74 | + assert($tree instanceof Tree); |
|
75 | 75 | |
76 | - $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
77 | - $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
76 | + $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
77 | + $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
|
78 | 78 | |
79 | - if ($map_adapter === null) { |
|
80 | - throw new HttpNotFoundException( |
|
81 | - I18N::translate('The map configuration could not be found.') |
|
82 | - ); |
|
83 | - } |
|
79 | + if ($map_adapter === null) { |
|
80 | + throw new HttpNotFoundException( |
|
81 | + I18N::translate('The map configuration could not be found.') |
|
82 | + ); |
|
83 | + } |
|
84 | 84 | |
85 | - return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
86 | - 'module' => $this->module, |
|
87 | - 'title' => I18N::translate('Edit the map configuration'), |
|
88 | - 'tree' => $tree, |
|
89 | - 'view_id' => $map_adapter->geoAnalysisViewId(), |
|
90 | - 'map_adapter' => $map_adapter, |
|
91 | - 'maps_list' => $this->map_definition_service->all(), |
|
92 | - 'mappers_list' => $this->place_mapper_service->all(), |
|
93 | - 'route_edit' => route(MapAdapterEditAction::class, [ |
|
94 | - 'tree' => $tree->name(), |
|
95 | - 'adapter_id' => $map_adapter->id() |
|
96 | - ]) |
|
97 | - ]); |
|
98 | - } |
|
85 | + return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
86 | + 'module' => $this->module, |
|
87 | + 'title' => I18N::translate('Edit the map configuration'), |
|
88 | + 'tree' => $tree, |
|
89 | + 'view_id' => $map_adapter->geoAnalysisViewId(), |
|
90 | + 'map_adapter' => $map_adapter, |
|
91 | + 'maps_list' => $this->map_definition_service->all(), |
|
92 | + 'mappers_list' => $this->place_mapper_service->all(), |
|
93 | + 'route_edit' => route(MapAdapterEditAction::class, [ |
|
94 | + 'tree' => $tree->name(), |
|
95 | + 'adapter_id' => $map_adapter->id() |
|
96 | + ]) |
|
97 | + ]); |
|
98 | + } |
|
99 | 99 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $tree = $request->getAttribute('tree'); |
74 | 74 | assert($tree instanceof Tree); |
75 | 75 | |
76 | - $adapter_id = (int) $request->getAttribute('adapter_id'); |
|
76 | + $adapter_id = (int)$request->getAttribute('adapter_id'); |
|
77 | 77 | $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
78 | 78 | |
79 | 79 | if ($map_adapter === null) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ); |
83 | 83 | } |
84 | 84 | |
85 | - return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [ |
|
85 | + return $this->viewResponse($this->module->name().'::admin/map-adapter-edit', [ |
|
86 | 86 | 'module' => $this->module, |
87 | 87 | 'title' => I18N::translate('Edit the map configuration'), |
88 | 88 | 'tree' => $tree, |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | return redirect(route(AdminConfigPage::class, ['tree' => $tree])); |
73 | 73 | } |
74 | 74 | |
75 | - $view_id = (int) $request->getAttribute('view_id'); |
|
75 | + $view_id = (int)$request->getAttribute('view_id'); |
|
76 | 76 | $view = $this->geoview_data_service->find($tree, $view_id); |
77 | 77 | |
78 | 78 | if ($view === null || !($view instanceof GeoAnalysisMap)) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'danger' |
100 | 100 | ); |
101 | 101 | //phpcs:ignore Generic.Files.LineLength.TooLong |
102 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage()); |
|
102 | + Log::addConfigurationLog('Module '.$this->module->title().' : Error when deleting invalid map configurations: '.$ex->getMessage()); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return redirect(route(GeoAnalysisViewEditPage::class, [ |
@@ -34,78 +34,78 @@ |
||
34 | 34 | */ |
35 | 35 | class MapAdapterDeleteInvalidAction implements RequestHandlerInterface |
36 | 36 | { |
37 | - private ?GeoDispersionModule $module; |
|
38 | - private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | - private MapAdapterDataService $mapadapter_data_service; |
|
37 | + private ?GeoDispersionModule $module; |
|
38 | + private GeoAnalysisViewDataService $geoview_data_service; |
|
39 | + private MapAdapterDataService $mapadapter_data_service; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for MapAdapterDeleteInvalidAction Request Handler |
|
43 | - * |
|
44 | - * @param ModuleService $module_service |
|
45 | - * @param GeoAnalysisViewDataService $geoview_data_service |
|
46 | - * @param MapAdapterDataService $mapadapter_data_service |
|
47 | - */ |
|
48 | - public function __construct( |
|
49 | - ModuleService $module_service, |
|
50 | - GeoAnalysisViewDataService $geoview_data_service, |
|
51 | - MapAdapterDataService $mapadapter_data_service |
|
52 | - ) { |
|
53 | - $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
54 | - $this->geoview_data_service = $geoview_data_service; |
|
55 | - $this->mapadapter_data_service = $mapadapter_data_service; |
|
56 | - } |
|
41 | + /** |
|
42 | + * Constructor for MapAdapterDeleteInvalidAction Request Handler |
|
43 | + * |
|
44 | + * @param ModuleService $module_service |
|
45 | + * @param GeoAnalysisViewDataService $geoview_data_service |
|
46 | + * @param MapAdapterDataService $mapadapter_data_service |
|
47 | + */ |
|
48 | + public function __construct( |
|
49 | + ModuleService $module_service, |
|
50 | + GeoAnalysisViewDataService $geoview_data_service, |
|
51 | + MapAdapterDataService $mapadapter_data_service |
|
52 | + ) { |
|
53 | + $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first(); |
|
54 | + $this->geoview_data_service = $geoview_data_service; |
|
55 | + $this->mapadapter_data_service = $mapadapter_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 | - $tree = $request->getAttribute('tree'); |
|
65 | - assert($tree instanceof Tree); |
|
58 | + /** |
|
59 | + * {@inheritDoc} |
|
60 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | + */ |
|
62 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | + { |
|
64 | + $tree = $request->getAttribute('tree'); |
|
65 | + assert($tree instanceof 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])); |
|
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])); |
|
73 | + } |
|
74 | 74 | |
75 | - $view_id = (int) $request->getAttribute('view_id'); |
|
76 | - $view = $this->geoview_data_service->find($tree, $view_id); |
|
75 | + $view_id = (int) $request->getAttribute('view_id'); |
|
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])); |
|
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])); |
|
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 | } |