Passed
Push — main ( 00c5b4...fe37d7 )
by Jonathan
03:49
created
app/Module/GeoDispersion/Views/GeoAnalysisTable.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,51 +22,51 @@
 block discarded – undo
22 22
 
23 23
 class GeoAnalysisTable extends AbstractGeoAnalysisView
24 24
 {
25
-    /**
26
-     * {@inheritDoc}
27
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::type()
28
-     */
29
-    public function type(): string
30
-    {
31
-        return I18N::translateContext('GEODISPERSION', 'Table');
32
-    }
25
+	/**
26
+	 * {@inheritDoc}
27
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::type()
28
+	 */
29
+	public function type(): string
30
+	{
31
+		return I18N::translateContext('GEODISPERSION', 'Table');
32
+	}
33 33
 
34
-    /**
35
-     * {@inheritDoc}
36
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon()
37
-     */
38
-    public function icon(ModuleInterface $module): string
39
-    {
40
-        return view($module->name() . '::icons/view-table', ['type' => $this->type()]);
41
-    }
34
+	/**
35
+	 * {@inheritDoc}
36
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon()
37
+	 */
38
+	public function icon(ModuleInterface $module): string
39
+	{
40
+		return view($module->name() . '::icons/view-table', ['type' => $this->type()]);
41
+	}
42 42
 
43
-    /**
44
-     * {@inheritDoc}
45
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent()
46
-     */
47
-    public function globalSettingsContent(ModuleInterface $module): string
48
-    {
49
-        return '';
50
-    }
43
+	/**
44
+	 * {@inheritDoc}
45
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent()
46
+	 */
47
+	public function globalSettingsContent(ModuleInterface $module): string
48
+	{
49
+		return '';
50
+	}
51 51
 
52
-    /**
53
-     * {@inheritDoc}
54
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate()
55
-     * @return $this
56
-     */
57
-    public function withGlobalSettingsUpdate(ServerRequestInterface $request): self
58
-    {
59
-        return $this;
60
-    }
52
+	/**
53
+	 * {@inheritDoc}
54
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate()
55
+	 * @return $this
56
+	 */
57
+	public function withGlobalSettingsUpdate(ServerRequestInterface $request): self
58
+	{
59
+		return $this;
60
+	}
61 61
 
62
-    /**
63
-     * {@inheritDoc}
64
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent()
65
-     */
66
-    public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string
67
-    {
68
-        return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [
69
-            'result'    =>  $result
70
-        ]);
71
-    }
62
+	/**
63
+	 * {@inheritDoc}
64
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent()
65
+	 */
66
+	public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string
67
+	{
68
+		return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [
69
+			'result'    =>  $result
70
+		]);
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function icon(ModuleInterface $module): string
39 39
     {
40
-        return view($module->name() . '::icons/view-table', ['type' => $this->type()]);
40
+        return view($module->name().'::icons/view-table', ['type' => $this->type()]);
41 41
     }
42 42
 
43 43
     /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string
67 67
     {
68
-        return view($module->name() . '::geoanalysisview-tab-glb-table', $params + [
68
+        return view($module->name().'::geoanalysisview-tab-glb-table', $params + [
69 69
             'result'    =>  $result
70 70
         ]);
71 71
     }
Please login to merge, or discard this patch.
app/Module/Sosa/SosaModule.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     // How to update the database schema for this module
74 74
     private const SCHEMA_TARGET_VERSION   = 3;
75 75
     private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
76
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
76
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
77 77
 /**
78 78
      * {@inheritDoc}
79 79
      * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function loadRoutes(Map $router): void
115 115
     {
116
-        $router->attach('', '', static function (Map $router): void {
116
+        $router->attach('', '', static function(Map $router): void {
117 117
 
118
-            $router->attach('', '/module-maj/sosa', static function (Map $router): void {
118
+            $router->attach('', '/module-maj/sosa', static function(Map $router): void {
119 119
 
120
-                $router->attach('', '/list', static function (Map $router): void {
120
+                $router->attach('', '/list', static function(Map $router): void {
121 121
                     $router->tokens(['gen' => '\d+']);
122 122
                     $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
123
-                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
124
-                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
123
+                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong
124
+                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong
125 125
                     $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
126 126
                 });
127 127
 
128
-                $router->attach('', '/statistics/{tree}', static function (Map $router): void {
128
+                $router->attach('', '/statistics/{tree}', static function(Map $router): void {
129 129
 
130 130
                     $router->get(SosaStatistics::class, '', SosaStatistics::class);
131 131
                     $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
132 132
                 });
133 133
 
134
-                $router->attach('', '/config/{tree}', static function (Map $router): void {
134
+                $router->attach('', '/config/{tree}', static function(Map $router): void {
135 135
 
136 136
                     $router->get(SosaConfig::class, '', SosaConfig::class);
137 137
                     $router->post(SosaConfigAction::class, '', SosaConfigAction::class);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function headContent(): string
232 232
     {
233
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
233
+        return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">';
234 234
     }
235 235
 
236 236
     /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public function bodyContent(): string
241 241
     {
242
-        return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
242
+        return '<script src="'.$this->assetUrl('js/sosa.min.js').'"></script>';
243 243
     }
244 244
 
245 245
     /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     {
251 251
         $user = Auth::check() ? Auth::user() : new DefaultUser();
252 252
 
253
-        return view($this->name() . '::sidebar/title', [
253
+        return view($this->name().'::sidebar/title', [
254 254
             'module_name'   =>  $this->name(),
255 255
             'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
256 256
         ]);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
267 267
         $user = Auth::check() ? Auth::user() : new DefaultUser();
268 268
 
269
-        return view($this->name() . '::sidebar/content', [
269
+        return view($this->name().'::sidebar/content', [
270 270
             'sosa_ancestor' =>  $individual,
271 271
             'sosa_root'     =>  $sosa_root,
272 272
             'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     public function listSubscribedHooks(): array
313 313
     {
314 314
         return [
315
-            app()->makeWith(SosaIconHook::class, [ 'module' => $this ])
315
+            app()->makeWith(SosaIconHook::class, ['module' => $this])
316 316
         ];
317 317
     }
318 318
 }
Please login to merge, or discard this patch.
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -57,261 +57,261 @@
 block discarded – undo
57 57
  * Identify and produce statistics about Sosa ancestors
58 58
  */
59 59
 class SosaModule extends AbstractModule implements
60
-    ModuleMyArtJaubInterface,
61
-    ModuleGlobalInterface,
62
-    ModuleMenuInterface,
63
-    ModuleSidebarInterface,
64
-    ModuleGeoAnalysisProviderInterface,
65
-    ModuleHookSubscriberInterface
60
+	ModuleMyArtJaubInterface,
61
+	ModuleGlobalInterface,
62
+	ModuleMenuInterface,
63
+	ModuleSidebarInterface,
64
+	ModuleGeoAnalysisProviderInterface,
65
+	ModuleHookSubscriberInterface
66 66
 {
67
-    use ModuleMyArtJaubTrait {
68
-        boot as traitBoot;
69
-    }
70
-    use ModuleGlobalTrait;
71
-    use ModuleMenuTrait;
72
-    use ModuleSidebarTrait;
73
-
74
-    // How to update the database schema for this module
75
-    private const SCHEMA_TARGET_VERSION   = 3;
76
-    private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
77
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
67
+	use ModuleMyArtJaubTrait {
68
+		boot as traitBoot;
69
+	}
70
+	use ModuleGlobalTrait;
71
+	use ModuleMenuTrait;
72
+	use ModuleSidebarTrait;
73
+
74
+	// How to update the database schema for this module
75
+	private const SCHEMA_TARGET_VERSION   = 3;
76
+	private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
77
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
78 78
 /**
79
-     * {@inheritDoc}
80
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
81
-     */
82
-    public function title(): string
83
-    {
84
-        return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa');
85
-    }
86
-
87
-    /**
88
-     * {@inheritDoc}
89
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
90
-     */
91
-    public function description(): string
92
-    {
93
-        //phpcs:ignore Generic.Files.LineLength.TooLong
94
-        return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
95
-    }
96
-
97
-    /**
98
-     * {@inheritDoc}
99
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
100
-     */
101
-    public function boot(): void
102
-    {
103
-        $this->traitBoot();
104
-        app(MigrationService::class)->updateSchema(
105
-            self::SCHEMA_MIGRATION_PREFIX,
106
-            self::SCHEMA_SETTING_NAME,
107
-            self::SCHEMA_TARGET_VERSION
108
-        );
109
-    }
110
-
111
-    /**
112
-     * {@inheritDoc}
113
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
114
-     */
115
-    public function loadRoutes(Map $router): void
116
-    {
117
-        $router->attach('', '', static function (Map $router): void {
118
-
119
-            $router->attach('', '/module-maj/sosa', static function (Map $router): void {
120
-
121
-                $router->attach('', '/list', static function (Map $router): void {
122
-                    $router->tokens(['gen' => '\d+']);
123
-                    $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
124
-                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
125
-                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
126
-                    $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
127
-                });
128
-
129
-                $router->attach('', '/statistics/{tree}', static function (Map $router): void {
130
-
131
-                    $router->get(SosaStatistics::class, '', SosaStatistics::class);
132
-                    $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
133
-                });
134
-
135
-                $router->attach('', '/config/{tree}', static function (Map $router): void {
136
-
137
-                    $router->get(SosaConfig::class, '', SosaConfig::class);
138
-                    $router->post(SosaConfigAction::class, '', SosaConfigAction::class);
139
-                    $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class);
140
-                    $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class);
141
-                });
142
-            });
143
-        });
144
-    }
145
-
146
-    /**
147
-     * {@inheritDoc}
148
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
149
-     */
150
-    public function customModuleVersion(): string
151
-    {
152
-        return '2.1.3-v.1';
153
-    }
154
-
155
-    /**
156
-     * {@inheritDoc}
157
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
158
-     */
159
-    public function defaultMenuOrder(): int
160
-    {
161
-        return 7;
162
-    }
163
-
164
-    /**
165
-     * {@inhericDoc}
166
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
167
-     */
168
-    public function getMenu(Tree $tree): ?Menu
169
-    {
170
-        $menu = new Menu(I18N::translate('Sosa Statistics'));
171
-        $menu->setClass('menu-maj-sosa');
172
-        $menu->setSubmenus([
173
-            new Menu(
174
-                I18N::translate('Sosa Ancestors'),
175
-                route(AncestorsList::class, ['tree' => $tree->name()]),
176
-                'menu-maj-sosa-list',
177
-                ['rel' => 'nofollow']
178
-            ),
179
-            new Menu(
180
-                I18N::translate('Missing Ancestors'),
181
-                route(MissingAncestorsList::class, ['tree' => $tree->name()]),
182
-                'menu-maj-sosa-missing',
183
-                ['rel' => 'nofollow']
184
-            ),
185
-            new Menu(
186
-                I18N::translate('Sosa Statistics'),
187
-                route(SosaStatistics::class, ['tree' => $tree->name()]),
188
-                'menu-maj-sosa-stats'
189
-            )
190
-        ]);
191
-
192
-        if (Auth::check()) {
193
-            $menu->addSubmenu(new Menu(
194
-                I18N::translate('Sosa Configuration'),
195
-                route(SosaConfig::class, ['tree' => $tree->name()]),
196
-                'menu-maj-sosa-config'
197
-            ));
198
-
199
-            /** @var ServerRequestInterface $request */
200
-            $request = app(ServerRequestInterface::class);
201
-            $route = Validator::attributes($request)->route();
202
-
203
-            $root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
204
-
205
-            if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) {
206
-                $xref = Validator::attributes($request)->isXref()->string('xref', '');
207
-
208
-                $menu->addSubmenu(new Menu(
209
-                    I18N::translate('Complete Sosas'),
210
-                    '#',
211
-                    'menu-maj-sosa-compute',
212
-                    [
213
-                        'rel'           => 'nofollow',
214
-                        'data-wt-href'  => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]),
215
-                        'data-bs-target'    => '#wt-ajax-modal',
216
-                        'data-bs-toggle'    => 'modal',
217
-                        'data-bs-backdrop'  => 'static'
218
-                    ]
219
-                ));
220
-            }
221
-        }
222
-
223
-        return $menu;
224
-    }
225
-
226
-    /**
227
-     * {@inheritDoc}
228
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
229
-     */
230
-    public function headContent(): string
231
-    {
232
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
233
-    }
234
-
235
-    /**
236
-     * {@inheritDoc}
237
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
238
-     */
239
-    public function bodyContent(): string
240
-    {
241
-        return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
242
-    }
243
-
244
-    /**
245
-     * {@inheritDoc}
246
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle()
247
-     */
248
-    public function sidebarTitle(Individual $individual): string
249
-    {
250
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
251
-
252
-        return view($this->name() . '::sidebar/title', [
253
-            'module_name'   =>  $this->name(),
254
-            'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
255
-        ]);
256
-    }
257
-
258
-    /**
259
-     * {@inheritDoc}
260
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
261
-     */
262
-    public function getSidebarContent(Individual $individual): string
263
-    {
264
-        $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
265
-        $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
266
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
267
-
268
-        return view($this->name() . '::sidebar/content', [
269
-            'sosa_ancestor' =>  $individual,
270
-            'sosa_root'     =>  $sosa_root,
271
-            'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
272
-        ]);
273
-    }
274
-
275
-    /**
276
-     * {@inheritDoc}
277
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
278
-     */
279
-    public function hasSidebarContent(Individual $individual): bool
280
-    {
281
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
282
-
283
-        return app(SosaRecordsService::class)
284
-            ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0;
285
-    }
286
-
287
-    /**
288
-     * {@inheritDoc}
289
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
290
-     */
291
-    public function defaultSidebarOrder(): int
292
-    {
293
-        return 1;
294
-    }
295
-
296
-    /**
297
-     * {@inheritDoc}
298
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
299
-     */
300
-    public function listGeoAnalyses(): array
301
-    {
302
-        return [
303
-            SosaByGenerationGeoAnalysis::class
304
-        ];
305
-    }
306
-
307
-    /**
308
-     * {@inheritDoc}
309
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
310
-     */
311
-    public function listSubscribedHooks(): array
312
-    {
313
-        return [
314
-            app()->makeWith(SosaIconHook::class, [ 'module' => $this ])
315
-        ];
316
-    }
79
+	 * {@inheritDoc}
80
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
81
+	 */
82
+	public function title(): string
83
+	{
84
+		return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa');
85
+	}
86
+
87
+	/**
88
+	 * {@inheritDoc}
89
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
90
+	 */
91
+	public function description(): string
92
+	{
93
+		//phpcs:ignore Generic.Files.LineLength.TooLong
94
+		return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
95
+	}
96
+
97
+	/**
98
+	 * {@inheritDoc}
99
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
100
+	 */
101
+	public function boot(): void
102
+	{
103
+		$this->traitBoot();
104
+		app(MigrationService::class)->updateSchema(
105
+			self::SCHEMA_MIGRATION_PREFIX,
106
+			self::SCHEMA_SETTING_NAME,
107
+			self::SCHEMA_TARGET_VERSION
108
+		);
109
+	}
110
+
111
+	/**
112
+	 * {@inheritDoc}
113
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
114
+	 */
115
+	public function loadRoutes(Map $router): void
116
+	{
117
+		$router->attach('', '', static function (Map $router): void {
118
+
119
+			$router->attach('', '/module-maj/sosa', static function (Map $router): void {
120
+
121
+				$router->attach('', '/list', static function (Map $router): void {
122
+					$router->tokens(['gen' => '\d+']);
123
+					$router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
124
+					$router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
125
+					$router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
126
+					$router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
127
+				});
128
+
129
+				$router->attach('', '/statistics/{tree}', static function (Map $router): void {
130
+
131
+					$router->get(SosaStatistics::class, '', SosaStatistics::class);
132
+					$router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
133
+				});
134
+
135
+				$router->attach('', '/config/{tree}', static function (Map $router): void {
136
+
137
+					$router->get(SosaConfig::class, '', SosaConfig::class);
138
+					$router->post(SosaConfigAction::class, '', SosaConfigAction::class);
139
+					$router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class);
140
+					$router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class);
141
+				});
142
+			});
143
+		});
144
+	}
145
+
146
+	/**
147
+	 * {@inheritDoc}
148
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
149
+	 */
150
+	public function customModuleVersion(): string
151
+	{
152
+		return '2.1.3-v.1';
153
+	}
154
+
155
+	/**
156
+	 * {@inheritDoc}
157
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
158
+	 */
159
+	public function defaultMenuOrder(): int
160
+	{
161
+		return 7;
162
+	}
163
+
164
+	/**
165
+	 * {@inhericDoc}
166
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
167
+	 */
168
+	public function getMenu(Tree $tree): ?Menu
169
+	{
170
+		$menu = new Menu(I18N::translate('Sosa Statistics'));
171
+		$menu->setClass('menu-maj-sosa');
172
+		$menu->setSubmenus([
173
+			new Menu(
174
+				I18N::translate('Sosa Ancestors'),
175
+				route(AncestorsList::class, ['tree' => $tree->name()]),
176
+				'menu-maj-sosa-list',
177
+				['rel' => 'nofollow']
178
+			),
179
+			new Menu(
180
+				I18N::translate('Missing Ancestors'),
181
+				route(MissingAncestorsList::class, ['tree' => $tree->name()]),
182
+				'menu-maj-sosa-missing',
183
+				['rel' => 'nofollow']
184
+			),
185
+			new Menu(
186
+				I18N::translate('Sosa Statistics'),
187
+				route(SosaStatistics::class, ['tree' => $tree->name()]),
188
+				'menu-maj-sosa-stats'
189
+			)
190
+		]);
191
+
192
+		if (Auth::check()) {
193
+			$menu->addSubmenu(new Menu(
194
+				I18N::translate('Sosa Configuration'),
195
+				route(SosaConfig::class, ['tree' => $tree->name()]),
196
+				'menu-maj-sosa-config'
197
+			));
198
+
199
+			/** @var ServerRequestInterface $request */
200
+			$request = app(ServerRequestInterface::class);
201
+			$route = Validator::attributes($request)->route();
202
+
203
+			$root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
204
+
205
+			if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) {
206
+				$xref = Validator::attributes($request)->isXref()->string('xref', '');
207
+
208
+				$menu->addSubmenu(new Menu(
209
+					I18N::translate('Complete Sosas'),
210
+					'#',
211
+					'menu-maj-sosa-compute',
212
+					[
213
+						'rel'           => 'nofollow',
214
+						'data-wt-href'  => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]),
215
+						'data-bs-target'    => '#wt-ajax-modal',
216
+						'data-bs-toggle'    => 'modal',
217
+						'data-bs-backdrop'  => 'static'
218
+					]
219
+				));
220
+			}
221
+		}
222
+
223
+		return $menu;
224
+	}
225
+
226
+	/**
227
+	 * {@inheritDoc}
228
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
229
+	 */
230
+	public function headContent(): string
231
+	{
232
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
233
+	}
234
+
235
+	/**
236
+	 * {@inheritDoc}
237
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
238
+	 */
239
+	public function bodyContent(): string
240
+	{
241
+		return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
242
+	}
243
+
244
+	/**
245
+	 * {@inheritDoc}
246
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle()
247
+	 */
248
+	public function sidebarTitle(Individual $individual): string
249
+	{
250
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
251
+
252
+		return view($this->name() . '::sidebar/title', [
253
+			'module_name'   =>  $this->name(),
254
+			'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
255
+		]);
256
+	}
257
+
258
+	/**
259
+	 * {@inheritDoc}
260
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
261
+	 */
262
+	public function getSidebarContent(Individual $individual): string
263
+	{
264
+		$sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
265
+		$sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
266
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
267
+
268
+		return view($this->name() . '::sidebar/content', [
269
+			'sosa_ancestor' =>  $individual,
270
+			'sosa_root'     =>  $sosa_root,
271
+			'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
272
+		]);
273
+	}
274
+
275
+	/**
276
+	 * {@inheritDoc}
277
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
278
+	 */
279
+	public function hasSidebarContent(Individual $individual): bool
280
+	{
281
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
282
+
283
+		return app(SosaRecordsService::class)
284
+			->sosaNumbers($individual->tree(), $user, $individual)->count() > 0;
285
+	}
286
+
287
+	/**
288
+	 * {@inheritDoc}
289
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
290
+	 */
291
+	public function defaultSidebarOrder(): int
292
+	{
293
+		return 1;
294
+	}
295
+
296
+	/**
297
+	 * {@inheritDoc}
298
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
299
+	 */
300
+	public function listGeoAnalyses(): array
301
+	{
302
+		return [
303
+			SosaByGenerationGeoAnalysis::class
304
+		];
305
+	}
306
+
307
+	/**
308
+	 * {@inheritDoc}
309
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
310
+	 */
311
+	public function listSubscribedHooks(): array
312
+	{
313
+		return [
314
+			app()->makeWith(SosaIconHook::class, [ 'module' => $this ])
315
+		];
316
+	}
317 317
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/NameAccordionExtenderInterface.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
  */
22 22
 interface NameAccordionExtenderInterface extends HookInterface
23 23
 {
24
-    /**
25
-     * Add a new card to the names accordion.
26
-     *
27
-     * @param Individual $individual
28
-     * @return string
29
-     */
30
-    public function accordionCard(Individual $individual): string;
24
+	/**
25
+	 * Add a new card to the names accordion.
26
+	 *
27
+	 * @param Individual $individual
28
+	 * @return string
29
+	 */
30
+	public function accordionCard(Individual $individual): string;
31 31
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/ModuleHookSubscriberInterface.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  */
20 20
 interface ModuleHookSubscriberInterface
21 21
 {
22
-    /**
23
-     * List hooks to be subscribed by the module as an array.
24
-     *
25
-     * @return HookInterface[]
26
-     */
27
-    public function listSubscribedHooks(): array;
22
+	/**
23
+	 * List hooks to be subscribed by the module as an array.
24
+	 *
25
+	 * @return HookInterface[]
26
+	 */
27
+	public function listSubscribedHooks(): array;
28 28
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/FamilyDatatablesExtenderInterface.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
  */
20 20
 interface FamilyDatatablesExtenderInterface extends HookInterface
21 21
 {
22
-    /**
23
-     * Get the columns to be added to families datatables
24
-     *
25
-     * @param iterable<\Fisharebest\Webtrees\Family> $records
26
-     * @return array<string, array<string, array<string, mixed>>>
27
-     */
28
-    public function familyColumns(iterable $records): array;
22
+	/**
23
+	 * Get the columns to be added to families datatables
24
+	 *
25
+	 * @param iterable<\Fisharebest\Webtrees\Family> $records
26
+	 * @return array<string, array<string, array<string, mixed>>>
27
+	 */
28
+	public function familyColumns(iterable $records): array;
29 29
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/HookCollectorInterface.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -21,46 +21,46 @@  discard block
 block discarded – undo
21 21
  */
22 22
 interface HookCollectorInterface
23 23
 {
24
-    /**
25
-     * Get the unique internal name for the hook collector
26
-     *
27
-     * @return string
28
-     */
29
-    public function name(): string;
24
+	/**
25
+	 * Get the unique internal name for the hook collector
26
+	 *
27
+	 * @return string
28
+	 */
29
+	public function name(): string;
30 30
 
31
-    /**
32
-     * Get the title to be displayed to idenfity the hook collector
33
-     *
34
-     * @return string
35
-     */
36
-    public function title(): string;
31
+	/**
32
+	 * Get the title to be displayed to idenfity the hook collector
33
+	 *
34
+	 * @return string
35
+	 */
36
+	public function title(): string;
37 37
 
38
-    /**
39
-     * Get a short description for the hook collector
40
-     *
41
-     * @return string
42
-     */
43
-    public function description(): string;
38
+	/**
39
+	 * Get a short description for the hook collector
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public function description(): string;
44 44
 
45
-    /**
46
-     * Get the interface collated by the hook collector
47
-     *
48
-     * @return class-string
49
-     */
50
-    public function hookInterface(): string;
45
+	/**
46
+	 * Get the interface collated by the hook collector
47
+	 *
48
+	 * @return class-string
49
+	 */
50
+	public function hookInterface(): string;
51 51
 
52
-    /**
53
-     * Register a hook instance in the hook collector
54
-     *
55
-     * @param HookInterface $hook_instance
56
-     * @param int $order
57
-     */
58
-    public function register(HookInterface $hook_instance, int $order): void;
52
+	/**
53
+	 * Register a hook instance in the hook collector
54
+	 *
55
+	 * @param HookInterface $hook_instance
56
+	 * @param int $order
57
+	 */
58
+	public function register(HookInterface $hook_instance, int $order): void;
59 59
 
60
-    /**
61
-     * Get the list of hooks registered against the hook collector
62
-     *
63
-     * @return Collection<HookInterface>
64
-     */
65
-    public function hooks(): Collection;
60
+	/**
61
+	 * Get the list of hooks registered against the hook collector
62
+	 *
63
+	 * @return Collection<HookInterface>
64
+	 */
65
+	public function hooks(): Collection;
66 66
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/SosaMissingDatatablesExtenderInterface.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
  */
20 20
 interface SosaMissingDatatablesExtenderInterface extends HookInterface
21 21
 {
22
-    /**
23
-     * Get the columns to be added to missing ancestors datatables
24
-     *
25
-     * @param iterable<\Fisharebest\Webtrees\Individual> $records
26
-     * @return array<string, array<string, array<string, mixed>>>
27
-     */
28
-    public function sosaMissingColumns(iterable $records): array;
22
+	/**
23
+	 * Get the columns to be added to missing ancestors datatables
24
+	 *
25
+	 * @param iterable<\Fisharebest\Webtrees\Individual> $records
26
+	 * @return array<string, array<string, array<string, mixed>>>
27
+	 */
28
+	public function sosaMissingColumns(iterable $records): array;
29 29
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/HookInterface.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  */
22 22
 interface HookInterface
23 23
 {
24
-    /**
25
-     * Get the module attached to the hook
26
-     *
27
-     * @return ModuleInterface
28
-     */
29
-    public function module(): ModuleInterface;
24
+	/**
25
+	 * Get the module attached to the hook
26
+	 *
27
+	 * @return ModuleInterface
28
+	 */
29
+	public function module(): ModuleInterface;
30 30
 }
Please login to merge, or discard this patch.
app/Contracts/Hooks/FactSourceTextExtenderInterface.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- * webtrees-lib: MyArtJaub library for webtrees
5
- *
6
- * @package MyArtJaub\Webtrees
7
- * @subpackage Hooks
8
- * @author Jonathan Jaubart <[email protected]>
9
- * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
- */
4
+  * webtrees-lib: MyArtJaub library for webtrees
5
+  *
6
+  * @package MyArtJaub\Webtrees
7
+  * @subpackage Hooks
8
+  * @author Jonathan Jaubart <[email protected]>
9
+  * @copyright Copyright (c) 2011-2022, Jonathan Jaubart
10
+  * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
+  */
12 12
 
13 13
 declare(strict_types=1);
14 14
 
@@ -21,21 +21,21 @@  discard block
 block discarded – undo
21 21
  */
22 22
 interface FactSourceTextExtenderInterface extends HookInterface
23 23
 {
24
-    /**
25
-     * Insert some content before the source citation title.
26
-     *
27
-     * @param Tree $tree
28
-     * @param \Fisharebest\Webtrees\Fact|array<array<\Fisharebest\Webtrees\Contracts\ElementInterface|string>> $fact
29
-     * @return string
30
-     */
31
-    public function factSourcePrepend(Tree $tree, $fact): string;
24
+	/**
25
+	 * Insert some content before the source citation title.
26
+	 *
27
+	 * @param Tree $tree
28
+	 * @param \Fisharebest\Webtrees\Fact|array<array<\Fisharebest\Webtrees\Contracts\ElementInterface|string>> $fact
29
+	 * @return string
30
+	 */
31
+	public function factSourcePrepend(Tree $tree, $fact): string;
32 32
 
33
-    /**
34
-     * Insert some content after the source citation title.
35
-     *
36
-     * @param Tree $tree
37
-     * @param \Fisharebest\Webtrees\Fact|array<array<\Fisharebest\Webtrees\Contracts\ElementInterface|string>> $fact
38
-     * @return string
39
-     */
40
-    public function factSourceAppend(Tree $tree, $fact): string;
33
+	/**
34
+	 * Insert some content after the source citation title.
35
+	 *
36
+	 * @param Tree $tree
37
+	 * @param \Fisharebest\Webtrees\Fact|array<array<\Fisharebest\Webtrees\Contracts\ElementInterface|string>> $fact
38
+	 * @return string
39
+	 */
40
+	public function factSourceAppend(Tree $tree, $fact): string;
41 41
 }
Please login to merge, or discard this patch.