@@ -32,89 +32,89 @@ |
||
32 | 32 | * Provide miscellaneous improvements to webtrees. |
33 | 33 | */ |
34 | 34 | class MiscExtensionsModule extends AbstractModule implements |
35 | - ModuleMyArtJaubInterface, |
|
36 | - ModuleConfigInterface, |
|
37 | - ModuleHookSubscriberInterface |
|
35 | + ModuleMyArtJaubInterface, |
|
36 | + ModuleConfigInterface, |
|
37 | + ModuleHookSubscriberInterface |
|
38 | 38 | { |
39 | - use ModuleMyArtJaubTrait { |
|
40 | - boot as traitBoot; |
|
41 | - } |
|
42 | - use ModuleConfigTrait; |
|
39 | + use ModuleMyArtJaubTrait { |
|
40 | + boot as traitBoot; |
|
41 | + } |
|
42 | + use ModuleConfigTrait; |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inheritDoc} |
|
46 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
47 | - */ |
|
48 | - public function title(): string |
|
49 | - { |
|
50 | - return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions'); |
|
51 | - } |
|
44 | + /** |
|
45 | + * {@inheritDoc} |
|
46 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
47 | + */ |
|
48 | + public function title(): string |
|
49 | + { |
|
50 | + return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions'); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
56 | - */ |
|
57 | - public function description(): string |
|
58 | - { |
|
59 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
60 | - return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.'); |
|
61 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
56 | + */ |
|
57 | + public function description(): string |
|
58 | + { |
|
59 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
60 | + return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.'); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
66 | - */ |
|
67 | - public function boot(): void |
|
68 | - { |
|
69 | - $this->traitBoot(); |
|
70 | - View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
71 | - } |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
66 | + */ |
|
67 | + public function boot(): void |
|
68 | + { |
|
69 | + $this->traitBoot(); |
|
70 | + View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
76 | - */ |
|
77 | - public function loadRoutes(Map $router): void |
|
78 | - { |
|
79 | - $router->attach('', '', static function (Map $router): void { |
|
73 | + /** |
|
74 | + * {@inheritDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
76 | + */ |
|
77 | + public function loadRoutes(Map $router): void |
|
78 | + { |
|
79 | + $router->attach('', '', static function (Map $router): void { |
|
80 | 80 | |
81 | - $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
81 | + $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
82 | 82 | |
83 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
83 | + $router->attach('', '/config/admin', static function (Map $router): void { |
|
84 | 84 | |
85 | - $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
86 | - $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
|
87 | - }); |
|
88 | - }); |
|
89 | - }); |
|
90 | - } |
|
85 | + $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
86 | + $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
|
87 | + }); |
|
88 | + }); |
|
89 | + }); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * {@inheritDoc} |
|
94 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
95 | - */ |
|
96 | - public function customModuleVersion(): string |
|
97 | - { |
|
98 | - return '2.1.0-v.1'; |
|
99 | - } |
|
92 | + /** |
|
93 | + * {@inheritDoc} |
|
94 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
95 | + */ |
|
96 | + public function customModuleVersion(): string |
|
97 | + { |
|
98 | + return '2.1.0-v.1'; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * {@inheritDoc} |
|
103 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
104 | - */ |
|
105 | - public function getConfigLink(): string |
|
106 | - { |
|
107 | - return route(AdminConfigPage::class); |
|
108 | - } |
|
101 | + /** |
|
102 | + * {@inheritDoc} |
|
103 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
104 | + */ |
|
105 | + public function getConfigLink(): string |
|
106 | + { |
|
107 | + return route(AdminConfigPage::class); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * {@inheritDoc} |
|
112 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
113 | - */ |
|
114 | - public function listSubscribedHooks(): array |
|
115 | - { |
|
116 | - return [ |
|
117 | - app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
118 | - ]; |
|
119 | - } |
|
110 | + /** |
|
111 | + * {@inheritDoc} |
|
112 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
113 | + */ |
|
114 | + public function listSubscribedHooks(): array |
|
115 | + { |
|
116 | + return [ |
|
117 | + app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
118 | + ]; |
|
119 | + } |
|
120 | 120 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function boot(): void |
68 | 68 | { |
69 | 69 | $this->traitBoot(); |
70 | - View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
70 | + View::registerCustomView('::modules/privacy-policy/page', $this->name().'::privacy-policy'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function loadRoutes(Map $router): void |
78 | 78 | { |
79 | - $router->attach('', '', static function (Map $router): void { |
|
79 | + $router->attach('', '', static function(Map $router): void { |
|
80 | 80 | |
81 | - $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
81 | + $router->attach('', '/module-maj/misc', static function(Map $router): void { |
|
82 | 82 | |
83 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
83 | + $router->attach('', '/config/admin', static function(Map $router): void { |
|
84 | 84 | |
85 | 85 | $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
86 | 86 | $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function listSubscribedHooks(): array |
115 | 115 | { |
116 | 116 | return [ |
117 | - app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
117 | + app()->makeWith(TitlesCardHook::class, ['module' => $this]) |
|
118 | 118 | ]; |
119 | 119 | } |
120 | 120 | } |
@@ -26,80 +26,80 @@ |
||
26 | 26 | */ |
27 | 27 | trait ModuleMyArtJaubTrait |
28 | 28 | { |
29 | - use ModuleCustomTrait; |
|
30 | - |
|
31 | - /** |
|
32 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
33 | - */ |
|
34 | - public function boot(): void |
|
35 | - { |
|
36 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
37 | - |
|
38 | - $this->loadRoutes(app(RouterContainer::class)->getMap()); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::resourcesFolder() |
|
43 | - */ |
|
44 | - public function resourcesFolder(): string |
|
45 | - { |
|
46 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleAuthorName() |
|
51 | - */ |
|
52 | - public function customModuleAuthorName(): string |
|
53 | - { |
|
54 | - return 'Jonathan Jaubart'; |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl() |
|
59 | - */ |
|
60 | - public function customModuleSupportUrl(): string |
|
61 | - { |
|
62 | - return 'https://github.com/jon48/webtrees-lib'; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customTranslations() |
|
67 | - * |
|
68 | - * @return array<string, string> |
|
69 | - */ |
|
70 | - public function customTranslations(string $language): array |
|
71 | - { |
|
72 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
73 | - |
|
74 | - try { |
|
75 | - $translation = new Translation($translation_file); |
|
76 | - return $translation->asArray(); |
|
77 | - } catch (\Exception $e) { |
|
78 | - } |
|
79 | - |
|
80 | - return []; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes |
|
85 | - */ |
|
86 | - public function loadRoutes(Map $router): void |
|
87 | - { |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::moduleCssUrl |
|
92 | - */ |
|
93 | - public function moduleCssUrl(): string |
|
94 | - { |
|
95 | - /** @var ModuleThemeInterface $theme */ |
|
96 | - $theme = app(ModuleThemeInterface::class); |
|
97 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
98 | - |
|
99 | - if (file_exists($css_file)) { |
|
100 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
101 | - } else { |
|
102 | - return $this->assetUrl('css/default.min.css'); |
|
103 | - } |
|
104 | - } |
|
29 | + use ModuleCustomTrait; |
|
30 | + |
|
31 | + /** |
|
32 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
33 | + */ |
|
34 | + public function boot(): void |
|
35 | + { |
|
36 | + View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
37 | + |
|
38 | + $this->loadRoutes(app(RouterContainer::class)->getMap()); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::resourcesFolder() |
|
43 | + */ |
|
44 | + public function resourcesFolder(): string |
|
45 | + { |
|
46 | + return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleAuthorName() |
|
51 | + */ |
|
52 | + public function customModuleAuthorName(): string |
|
53 | + { |
|
54 | + return 'Jonathan Jaubart'; |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl() |
|
59 | + */ |
|
60 | + public function customModuleSupportUrl(): string |
|
61 | + { |
|
62 | + return 'https://github.com/jon48/webtrees-lib'; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customTranslations() |
|
67 | + * |
|
68 | + * @return array<string, string> |
|
69 | + */ |
|
70 | + public function customTranslations(string $language): array |
|
71 | + { |
|
72 | + $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
73 | + |
|
74 | + try { |
|
75 | + $translation = new Translation($translation_file); |
|
76 | + return $translation->asArray(); |
|
77 | + } catch (\Exception $e) { |
|
78 | + } |
|
79 | + |
|
80 | + return []; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes |
|
85 | + */ |
|
86 | + public function loadRoutes(Map $router): void |
|
87 | + { |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::moduleCssUrl |
|
92 | + */ |
|
93 | + public function moduleCssUrl(): string |
|
94 | + { |
|
95 | + /** @var ModuleThemeInterface $theme */ |
|
96 | + $theme = app(ModuleThemeInterface::class); |
|
97 | + $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
98 | + |
|
99 | + if (file_exists($css_file)) { |
|
100 | + return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
101 | + } else { |
|
102 | + return $this->assetUrl('css/default.min.css'); |
|
103 | + } |
|
104 | + } |
|
105 | 105 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function boot(): void |
35 | 35 | { |
36 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
36 | + View::registerNamespace($this->name(), $this->resourcesFolder().'views/'); |
|
37 | 37 | |
38 | 38 | $this->loadRoutes(app(RouterContainer::class)->getMap()); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function resourcesFolder(): string |
45 | 45 | { |
46 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
46 | + return Webtrees::MODULES_DIR.trim($this->name(), '_').'/resources/'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function customTranslations(string $language): array |
71 | 71 | { |
72 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
72 | + $translation_file = $this->resourcesFolder().'lang/'.$language.'/messages.php'; |
|
73 | 73 | |
74 | 74 | try { |
75 | 75 | $translation = new Translation($translation_file); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | { |
95 | 95 | /** @var ModuleThemeInterface $theme */ |
96 | 96 | $theme = app(ModuleThemeInterface::class); |
97 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
97 | + $css_file = $this->resourcesFolder().'css/'.$theme->name().'.min.css'; |
|
98 | 98 | |
99 | 99 | if (file_exists($css_file)) { |
100 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
100 | + return $this->assetUrl('css/'.$theme->name().'.min.css'); |
|
101 | 101 | } else { |
102 | 102 | return $this->assetUrl('css/default.min.css'); |
103 | 103 | } |
@@ -56,268 +56,268 @@ |
||
56 | 56 | * Identify and produce statistics about Sosa ancestors |
57 | 57 | */ |
58 | 58 | class SosaModule extends AbstractModule implements |
59 | - ModuleMyArtJaubInterface, |
|
60 | - ModuleGlobalInterface, |
|
61 | - ModuleMenuInterface, |
|
62 | - ModuleSidebarInterface, |
|
63 | - ModuleGeoAnalysisProviderInterface, |
|
64 | - ModuleHookSubscriberInterface |
|
59 | + ModuleMyArtJaubInterface, |
|
60 | + ModuleGlobalInterface, |
|
61 | + ModuleMenuInterface, |
|
62 | + ModuleSidebarInterface, |
|
63 | + ModuleGeoAnalysisProviderInterface, |
|
64 | + ModuleHookSubscriberInterface |
|
65 | 65 | { |
66 | - use ModuleMyArtJaubTrait { |
|
67 | - boot as traitBoot; |
|
68 | - } |
|
69 | - use ModuleGlobalTrait; |
|
70 | - use ModuleMenuTrait; |
|
71 | - use ModuleSidebarTrait; |
|
72 | - |
|
73 | - // How to update the database schema for this module |
|
74 | - private const SCHEMA_TARGET_VERSION = 3; |
|
75 | - private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
76 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
66 | + use ModuleMyArtJaubTrait { |
|
67 | + boot as traitBoot; |
|
68 | + } |
|
69 | + use ModuleGlobalTrait; |
|
70 | + use ModuleMenuTrait; |
|
71 | + use ModuleSidebarTrait; |
|
72 | + |
|
73 | + // How to update the database schema for this module |
|
74 | + private const SCHEMA_TARGET_VERSION = 3; |
|
75 | + private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
76 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
77 | 77 | /** |
78 | - * {@inheritDoc} |
|
79 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
80 | - */ |
|
81 | - public function title(): string |
|
82 | - { |
|
83 | - return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * {@inheritDoc} |
|
88 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
89 | - */ |
|
90 | - public function description(): string |
|
91 | - { |
|
92 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
93 | - return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * {@inheritDoc} |
|
98 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
99 | - */ |
|
100 | - public function boot(): void |
|
101 | - { |
|
102 | - $this->traitBoot(); |
|
103 | - app(MigrationService::class)->updateSchema( |
|
104 | - self::SCHEMA_MIGRATION_PREFIX, |
|
105 | - self::SCHEMA_SETTING_NAME, |
|
106 | - self::SCHEMA_TARGET_VERSION |
|
107 | - ); |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * {@inheritDoc} |
|
112 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
113 | - */ |
|
114 | - public function loadRoutes(Map $router): void |
|
115 | - { |
|
116 | - $router->attach('', '', static function (Map $router): void { |
|
117 | - |
|
118 | - $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
119 | - |
|
120 | - $router->attach('', '/list', static function (Map $router): void { |
|
121 | - $router->tokens(['gen' => '\d+']); |
|
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 |
|
125 | - $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
|
126 | - }); |
|
127 | - |
|
128 | - $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
129 | - |
|
130 | - $router->get(SosaStatistics::class, '', SosaStatistics::class); |
|
131 | - $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
|
132 | - }); |
|
133 | - |
|
134 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
135 | - |
|
136 | - $router->get(SosaConfig::class, '', SosaConfig::class); |
|
137 | - $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
|
138 | - $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class); |
|
139 | - $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class); |
|
140 | - }); |
|
141 | - }); |
|
142 | - }); |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * {@inheritDoc} |
|
147 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
148 | - */ |
|
149 | - public function customModuleVersion(): string |
|
150 | - { |
|
151 | - return '2.1.0-v.1'; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * {@inheritDoc} |
|
156 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
157 | - */ |
|
158 | - public function defaultMenuOrder(): int |
|
159 | - { |
|
160 | - return 7; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * {@inhericDoc} |
|
165 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
166 | - */ |
|
167 | - public function getMenu(Tree $tree): ?Menu |
|
168 | - { |
|
169 | - $menu = new Menu(I18N::translate('Sosa Statistics')); |
|
170 | - $menu->setClass('menu-maj-sosa'); |
|
171 | - $menu->setSubmenus([ |
|
172 | - new Menu( |
|
173 | - I18N::translate('Sosa Ancestors'), |
|
174 | - route(AncestorsList::class, ['tree' => $tree->name()]), |
|
175 | - 'menu-maj-sosa-list', |
|
176 | - ['rel' => 'nofollow'] |
|
177 | - ), |
|
178 | - new Menu( |
|
179 | - I18N::translate('Missing Ancestors'), |
|
180 | - route(MissingAncestorsList::class, ['tree' => $tree->name()]), |
|
181 | - 'menu-maj-sosa-missing', |
|
182 | - ['rel' => 'nofollow'] |
|
183 | - ), |
|
184 | - new Menu( |
|
185 | - I18N::translate('Sosa Statistics'), |
|
186 | - route(SosaStatistics::class, ['tree' => $tree->name()]), |
|
187 | - 'menu-maj-sosa-stats' |
|
188 | - ) |
|
189 | - ]); |
|
190 | - |
|
191 | - if (Auth::check()) { |
|
192 | - $menu->addSubmenu(new Menu( |
|
193 | - I18N::translate('Sosa Configuration'), |
|
194 | - route(SosaConfig::class, ['tree' => $tree->name()]), |
|
195 | - 'menu-maj-sosa-config' |
|
196 | - )); |
|
197 | - |
|
198 | - /** @var ServerRequestInterface $request */ |
|
199 | - $request = app(ServerRequestInterface::class); |
|
200 | - $route = $request->getAttribute('route'); |
|
201 | - assert($route instanceof 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 = $request->getAttribute('xref'); |
|
207 | - assert(is_string($xref)); |
|
208 | - |
|
209 | - $menu->addSubmenu(new Menu( |
|
210 | - I18N::translate('Complete Sosas'), |
|
211 | - '#', |
|
212 | - 'menu-maj-sosa-compute', |
|
213 | - [ |
|
214 | - 'rel' => 'nofollow', |
|
215 | - 'data-href' => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]), |
|
216 | - 'data-target' => '#wt-ajax-modal', |
|
217 | - 'data-toggle' => 'modal', |
|
218 | - 'data-backdrop' => 'static' |
|
219 | - ] |
|
220 | - )); |
|
221 | - } |
|
222 | - } |
|
223 | - |
|
224 | - return $menu; |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * {@inheritDoc} |
|
229 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
230 | - */ |
|
231 | - public function headContent(): string |
|
232 | - { |
|
233 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
234 | - } |
|
235 | - |
|
236 | - /** |
|
237 | - * {@inheritDoc} |
|
238 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
239 | - */ |
|
240 | - public function bodyContent(): string |
|
241 | - { |
|
242 | - return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * {@inheritDoc} |
|
247 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle() |
|
248 | - */ |
|
249 | - public function sidebarTitle(): string |
|
250 | - { |
|
251 | - $request = app(ServerRequestInterface::class); |
|
252 | - $xref = $request->getAttribute('xref'); |
|
253 | - $tree = $request->getAttribute('tree'); |
|
254 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
255 | - |
|
256 | - $individual = Registry::individualFactory()->make($xref, $tree); |
|
257 | - |
|
258 | - return view($this->name() . '::sidebar/title', [ |
|
259 | - 'module_name' => $this->name(), |
|
260 | - 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual) |
|
261 | - ]); |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * {@inheritDoc} |
|
266 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
267 | - */ |
|
268 | - public function getSidebarContent(Individual $individual): string |
|
269 | - { |
|
270 | - $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
271 | - $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
|
272 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
273 | - |
|
274 | - return view($this->name() . '::sidebar/content', [ |
|
275 | - 'sosa_ancestor' => $individual, |
|
276 | - 'sosa_root' => $sosa_root, |
|
277 | - 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
278 | - ]); |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * {@inheritDoc} |
|
283 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
284 | - */ |
|
285 | - public function hasSidebarContent(Individual $individual): bool |
|
286 | - { |
|
287 | - $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
288 | - |
|
289 | - return app(SosaRecordsService::class) |
|
290 | - ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0; |
|
291 | - } |
|
292 | - |
|
293 | - /** |
|
294 | - * {@inheritDoc} |
|
295 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
|
296 | - */ |
|
297 | - public function defaultSidebarOrder(): int |
|
298 | - { |
|
299 | - return 1; |
|
300 | - } |
|
301 | - |
|
302 | - /** |
|
303 | - * {@inheritDoc} |
|
304 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses() |
|
305 | - */ |
|
306 | - public function listGeoAnalyses(): array |
|
307 | - { |
|
308 | - return [ |
|
309 | - SosaByGenerationGeoAnalysis::class |
|
310 | - ]; |
|
311 | - } |
|
312 | - |
|
313 | - /** |
|
314 | - * {@inheritDoc} |
|
315 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
316 | - */ |
|
317 | - public function listSubscribedHooks(): array |
|
318 | - { |
|
319 | - return [ |
|
320 | - app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
321 | - ]; |
|
322 | - } |
|
78 | + * {@inheritDoc} |
|
79 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
80 | + */ |
|
81 | + public function title(): string |
|
82 | + { |
|
83 | + return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * {@inheritDoc} |
|
88 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
89 | + */ |
|
90 | + public function description(): string |
|
91 | + { |
|
92 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
93 | + return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * {@inheritDoc} |
|
98 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
99 | + */ |
|
100 | + public function boot(): void |
|
101 | + { |
|
102 | + $this->traitBoot(); |
|
103 | + app(MigrationService::class)->updateSchema( |
|
104 | + self::SCHEMA_MIGRATION_PREFIX, |
|
105 | + self::SCHEMA_SETTING_NAME, |
|
106 | + self::SCHEMA_TARGET_VERSION |
|
107 | + ); |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * {@inheritDoc} |
|
112 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
113 | + */ |
|
114 | + public function loadRoutes(Map $router): void |
|
115 | + { |
|
116 | + $router->attach('', '', static function (Map $router): void { |
|
117 | + |
|
118 | + $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
119 | + |
|
120 | + $router->attach('', '/list', static function (Map $router): void { |
|
121 | + $router->tokens(['gen' => '\d+']); |
|
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 |
|
125 | + $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
|
126 | + }); |
|
127 | + |
|
128 | + $router->attach('', '/statistics/{tree}', static function (Map $router): void { |
|
129 | + |
|
130 | + $router->get(SosaStatistics::class, '', SosaStatistics::class); |
|
131 | + $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class); |
|
132 | + }); |
|
133 | + |
|
134 | + $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
135 | + |
|
136 | + $router->get(SosaConfig::class, '', SosaConfig::class); |
|
137 | + $router->post(SosaConfigAction::class, '', SosaConfigAction::class); |
|
138 | + $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class); |
|
139 | + $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class); |
|
140 | + }); |
|
141 | + }); |
|
142 | + }); |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * {@inheritDoc} |
|
147 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
148 | + */ |
|
149 | + public function customModuleVersion(): string |
|
150 | + { |
|
151 | + return '2.1.0-v.1'; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * {@inheritDoc} |
|
156 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
157 | + */ |
|
158 | + public function defaultMenuOrder(): int |
|
159 | + { |
|
160 | + return 7; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * {@inhericDoc} |
|
165 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
166 | + */ |
|
167 | + public function getMenu(Tree $tree): ?Menu |
|
168 | + { |
|
169 | + $menu = new Menu(I18N::translate('Sosa Statistics')); |
|
170 | + $menu->setClass('menu-maj-sosa'); |
|
171 | + $menu->setSubmenus([ |
|
172 | + new Menu( |
|
173 | + I18N::translate('Sosa Ancestors'), |
|
174 | + route(AncestorsList::class, ['tree' => $tree->name()]), |
|
175 | + 'menu-maj-sosa-list', |
|
176 | + ['rel' => 'nofollow'] |
|
177 | + ), |
|
178 | + new Menu( |
|
179 | + I18N::translate('Missing Ancestors'), |
|
180 | + route(MissingAncestorsList::class, ['tree' => $tree->name()]), |
|
181 | + 'menu-maj-sosa-missing', |
|
182 | + ['rel' => 'nofollow'] |
|
183 | + ), |
|
184 | + new Menu( |
|
185 | + I18N::translate('Sosa Statistics'), |
|
186 | + route(SosaStatistics::class, ['tree' => $tree->name()]), |
|
187 | + 'menu-maj-sosa-stats' |
|
188 | + ) |
|
189 | + ]); |
|
190 | + |
|
191 | + if (Auth::check()) { |
|
192 | + $menu->addSubmenu(new Menu( |
|
193 | + I18N::translate('Sosa Configuration'), |
|
194 | + route(SosaConfig::class, ['tree' => $tree->name()]), |
|
195 | + 'menu-maj-sosa-config' |
|
196 | + )); |
|
197 | + |
|
198 | + /** @var ServerRequestInterface $request */ |
|
199 | + $request = app(ServerRequestInterface::class); |
|
200 | + $route = $request->getAttribute('route'); |
|
201 | + assert($route instanceof 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 = $request->getAttribute('xref'); |
|
207 | + assert(is_string($xref)); |
|
208 | + |
|
209 | + $menu->addSubmenu(new Menu( |
|
210 | + I18N::translate('Complete Sosas'), |
|
211 | + '#', |
|
212 | + 'menu-maj-sosa-compute', |
|
213 | + [ |
|
214 | + 'rel' => 'nofollow', |
|
215 | + 'data-href' => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]), |
|
216 | + 'data-target' => '#wt-ajax-modal', |
|
217 | + 'data-toggle' => 'modal', |
|
218 | + 'data-backdrop' => 'static' |
|
219 | + ] |
|
220 | + )); |
|
221 | + } |
|
222 | + } |
|
223 | + |
|
224 | + return $menu; |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * {@inheritDoc} |
|
229 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
230 | + */ |
|
231 | + public function headContent(): string |
|
232 | + { |
|
233 | + return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
234 | + } |
|
235 | + |
|
236 | + /** |
|
237 | + * {@inheritDoc} |
|
238 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
239 | + */ |
|
240 | + public function bodyContent(): string |
|
241 | + { |
|
242 | + return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>'; |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * {@inheritDoc} |
|
247 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle() |
|
248 | + */ |
|
249 | + public function sidebarTitle(): string |
|
250 | + { |
|
251 | + $request = app(ServerRequestInterface::class); |
|
252 | + $xref = $request->getAttribute('xref'); |
|
253 | + $tree = $request->getAttribute('tree'); |
|
254 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
255 | + |
|
256 | + $individual = Registry::individualFactory()->make($xref, $tree); |
|
257 | + |
|
258 | + return view($this->name() . '::sidebar/title', [ |
|
259 | + 'module_name' => $this->name(), |
|
260 | + 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual) |
|
261 | + ]); |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * {@inheritDoc} |
|
266 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
267 | + */ |
|
268 | + public function getSidebarContent(Individual $individual): string |
|
269 | + { |
|
270 | + $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
|
271 | + $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
|
272 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
273 | + |
|
274 | + return view($this->name() . '::sidebar/content', [ |
|
275 | + 'sosa_ancestor' => $individual, |
|
276 | + 'sosa_root' => $sosa_root, |
|
277 | + 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
|
278 | + ]); |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * {@inheritDoc} |
|
283 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
284 | + */ |
|
285 | + public function hasSidebarContent(Individual $individual): bool |
|
286 | + { |
|
287 | + $user = Auth::check() ? Auth::user() : new DefaultUser(); |
|
288 | + |
|
289 | + return app(SosaRecordsService::class) |
|
290 | + ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0; |
|
291 | + } |
|
292 | + |
|
293 | + /** |
|
294 | + * {@inheritDoc} |
|
295 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
|
296 | + */ |
|
297 | + public function defaultSidebarOrder(): int |
|
298 | + { |
|
299 | + return 1; |
|
300 | + } |
|
301 | + |
|
302 | + /** |
|
303 | + * {@inheritDoc} |
|
304 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses() |
|
305 | + */ |
|
306 | + public function listGeoAnalyses(): array |
|
307 | + { |
|
308 | + return [ |
|
309 | + SosaByGenerationGeoAnalysis::class |
|
310 | + ]; |
|
311 | + } |
|
312 | + |
|
313 | + /** |
|
314 | + * {@inheritDoc} |
|
315 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
316 | + */ |
|
317 | + public function listSubscribedHooks(): array |
|
318 | + { |
|
319 | + return [ |
|
320 | + app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
321 | + ]; |
|
322 | + } |
|
323 | 323 | } |
@@ -73,7 +73,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | /** |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $individual = Registry::individualFactory()->make($xref, $tree); |
257 | 257 | |
258 | - return view($this->name() . '::sidebar/title', [ |
|
258 | + return view($this->name().'::sidebar/title', [ |
|
259 | 259 | 'module_name' => $this->name(), |
260 | 260 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual) |
261 | 261 | ]); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree()); |
272 | 272 | $user = Auth::check() ? Auth::user() : new DefaultUser(); |
273 | 273 | |
274 | - return view($this->name() . '::sidebar/content', [ |
|
274 | + return view($this->name().'::sidebar/content', [ |
|
275 | 275 | 'sosa_ancestor' => $individual, |
276 | 276 | 'sosa_root' => $sosa_root, |
277 | 277 | 'sosa_numbers' => app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual) |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | public function listSubscribedHooks(): array |
318 | 318 | { |
319 | 319 | return [ |
320 | - app()->makeWith(SosaIconHook::class, [ 'module' => $this ]) |
|
320 | + app()->makeWith(SosaIconHook::class, ['module' => $this]) |
|
321 | 321 | ]; |
322 | 322 | } |
323 | 323 | } |
@@ -26,51 +26,51 @@ |
||
26 | 26 | */ |
27 | 27 | class SosaIconHook implements RecordNameTextExtenderInterface |
28 | 28 | { |
29 | - private ModuleInterface $module; |
|
30 | - private SosaRecordsService $sosa_records_service; |
|
29 | + private ModuleInterface $module; |
|
30 | + private SosaRecordsService $sosa_records_service; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Constructor for SosaIconHook |
|
34 | - * |
|
35 | - * @param ModuleInterface $module |
|
36 | - * @param SosaRecordsService $sosa_records_service |
|
37 | - */ |
|
38 | - public function __construct(ModuleInterface $module, SosaRecordsService $sosa_records_service) |
|
39 | - { |
|
40 | - $this->module = $module; |
|
41 | - $this->sosa_records_service = $sosa_records_service; |
|
42 | - } |
|
32 | + /** |
|
33 | + * Constructor for SosaIconHook |
|
34 | + * |
|
35 | + * @param ModuleInterface $module |
|
36 | + * @param SosaRecordsService $sosa_records_service |
|
37 | + */ |
|
38 | + public function __construct(ModuleInterface $module, SosaRecordsService $sosa_records_service) |
|
39 | + { |
|
40 | + $this->module = $module; |
|
41 | + $this->sosa_records_service = $sosa_records_service; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inheritDoc} |
|
46 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
47 | - */ |
|
48 | - public function module(): ModuleInterface |
|
49 | - { |
|
50 | - return $this->module; |
|
51 | - } |
|
44 | + /** |
|
45 | + * {@inheritDoc} |
|
46 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
47 | + */ |
|
48 | + public function module(): ModuleInterface |
|
49 | + { |
|
50 | + return $this->module; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
56 | - */ |
|
57 | - public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
58 | - { |
|
59 | - return ''; |
|
60 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
56 | + */ |
|
57 | + public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
58 | + { |
|
59 | + return ''; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * {@inheritDoc} |
|
64 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
65 | - */ |
|
66 | - public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
67 | - { |
|
68 | - if ( |
|
69 | - $record instanceof Individual && |
|
70 | - $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
|
71 | - ) { |
|
72 | - return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
73 | - } |
|
74 | - return ''; |
|
75 | - } |
|
62 | + /** |
|
63 | + * {@inheritDoc} |
|
64 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
65 | + */ |
|
66 | + public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
67 | + { |
|
68 | + if ( |
|
69 | + $record instanceof Individual && |
|
70 | + $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
|
71 | + ) { |
|
72 | + return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
73 | + } |
|
74 | + return ''; |
|
75 | + } |
|
76 | 76 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $record instanceof Individual && |
70 | 70 | $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
71 | 71 | ) { |
72 | - return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
72 | + return view($this->module->name().'::icons/sosa', ['size_style' => $size]); |
|
73 | 73 | } |
74 | 74 | return ''; |
75 | 75 | } |
@@ -21,79 +21,79 @@ |
||
21 | 21 | */ |
22 | 22 | class MissingAncestor |
23 | 23 | { |
24 | - /** |
|
25 | - * @var Individual $individual |
|
26 | - */ |
|
27 | - private $individual; |
|
24 | + /** |
|
25 | + * @var Individual $individual |
|
26 | + */ |
|
27 | + private $individual; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var int $sosa |
|
31 | - */ |
|
32 | - private $sosa; |
|
29 | + /** |
|
30 | + * @var int $sosa |
|
31 | + */ |
|
32 | + private $sosa; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var bool $missing_father |
|
36 | - */ |
|
37 | - private $missing_father; |
|
34 | + /** |
|
35 | + * @var bool $missing_father |
|
36 | + */ |
|
37 | + private $missing_father; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var bool $missing_mother |
|
41 | - */ |
|
42 | - private $missing_mother; |
|
39 | + /** |
|
40 | + * @var bool $missing_mother |
|
41 | + */ |
|
42 | + private $missing_mother; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor for MissingAncestor data class |
|
46 | - * |
|
47 | - * @param Individual $ancestor |
|
48 | - * @param int $sosa |
|
49 | - * @param bool $missing_father |
|
50 | - * @param bool $missing_mother |
|
51 | - */ |
|
52 | - public function __construct(Individual $ancestor, int $sosa, bool $missing_father, bool $missing_mother) |
|
53 | - { |
|
54 | - $this->individual = $ancestor; |
|
55 | - $this->sosa = $sosa; |
|
56 | - $this->missing_father = $missing_father; |
|
57 | - $this->missing_mother = $missing_mother; |
|
58 | - } |
|
44 | + /** |
|
45 | + * Constructor for MissingAncestor data class |
|
46 | + * |
|
47 | + * @param Individual $ancestor |
|
48 | + * @param int $sosa |
|
49 | + * @param bool $missing_father |
|
50 | + * @param bool $missing_mother |
|
51 | + */ |
|
52 | + public function __construct(Individual $ancestor, int $sosa, bool $missing_father, bool $missing_mother) |
|
53 | + { |
|
54 | + $this->individual = $ancestor; |
|
55 | + $this->sosa = $sosa; |
|
56 | + $this->missing_father = $missing_father; |
|
57 | + $this->missing_mother = $missing_mother; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Reference individual of the row |
|
62 | - * |
|
63 | - * @return Individual |
|
64 | - */ |
|
65 | - public function individual(): Individual |
|
66 | - { |
|
67 | - return $this->individual; |
|
68 | - } |
|
60 | + /** |
|
61 | + * Reference individual of the row |
|
62 | + * |
|
63 | + * @return Individual |
|
64 | + */ |
|
65 | + public function individual(): Individual |
|
66 | + { |
|
67 | + return $this->individual; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Minimum sosa of the reference individual |
|
72 | - * |
|
73 | - * @return int |
|
74 | - */ |
|
75 | - public function sosa(): int |
|
76 | - { |
|
77 | - return $this->sosa; |
|
78 | - } |
|
70 | + /** |
|
71 | + * Minimum sosa of the reference individual |
|
72 | + * |
|
73 | + * @return int |
|
74 | + */ |
|
75 | + public function sosa(): int |
|
76 | + { |
|
77 | + return $this->sosa; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Indicate whether the reference individual does not have a father |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function isFatherMissing(): bool |
|
86 | - { |
|
87 | - return $this->missing_father; |
|
88 | - } |
|
80 | + /** |
|
81 | + * Indicate whether the reference individual does not have a father |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function isFatherMissing(): bool |
|
86 | + { |
|
87 | + return $this->missing_father; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Indicate whether the reference individual does not have a mother |
|
92 | - * |
|
93 | - * @return bool |
|
94 | - */ |
|
95 | - public function isMotherMissing(): bool |
|
96 | - { |
|
97 | - return $this->missing_mother; |
|
98 | - } |
|
90 | + /** |
|
91 | + * Indicate whether the reference individual does not have a mother |
|
92 | + * |
|
93 | + * @return bool |
|
94 | + */ |
|
95 | + public function isMotherMissing(): bool |
|
96 | + { |
|
97 | + return $this->missing_mother; |
|
98 | + } |
|
99 | 99 | } |
@@ -35,74 +35,74 @@ |
||
35 | 35 | */ |
36 | 36 | class AncestorsListIndividual implements RequestHandlerInterface |
37 | 37 | { |
38 | - use ViewResponseTrait; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var SosaModule|null $module |
|
42 | - */ |
|
43 | - private $module; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var SosaRecordsService $sosa_record_service |
|
47 | - */ |
|
48 | - private $sosa_record_service; |
|
49 | - |
|
50 | - /** |
|
51 | - * Constructor for AncestorsListIndividual Request Handler |
|
52 | - * |
|
53 | - * @param ModuleService $module_service |
|
54 | - * @param SosaRecordsService $sosa_record_service |
|
55 | - */ |
|
56 | - public function __construct( |
|
57 | - ModuleService $module_service, |
|
58 | - SosaRecordsService $sosa_record_service |
|
59 | - ) { |
|
60 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
61 | - $this->sosa_record_service = $sosa_record_service; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritDoc} |
|
66 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
67 | - */ |
|
68 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
69 | - { |
|
70 | - $this->layout = 'layouts/ajax'; |
|
71 | - |
|
72 | - if ($this->module === null) { |
|
73 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | - } |
|
75 | - |
|
76 | - $tree = $request->getAttribute('tree'); |
|
77 | - assert($tree instanceof Tree); |
|
78 | - |
|
79 | - $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
80 | - |
|
81 | - $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
82 | - |
|
83 | - if ($current_gen <= 0) { |
|
84 | - return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
|
85 | - } |
|
86 | - |
|
87 | - $list_ancestors = $this->sosa_record_service->listAncestorsAtGeneration($tree, $user, $current_gen); |
|
88 | - $nb_ancestors_all = $list_ancestors->count(); |
|
89 | - |
|
90 | - /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Individual> $list_ancestors */ |
|
91 | - $list_ancestors = $list_ancestors->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
92 | - $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
93 | - return ($indi !== null && $indi->canShowName()) ? [(int) $value->majs_sosa => $indi] : null; |
|
94 | - })->filter(); |
|
95 | - |
|
96 | - $nb_ancestors_shown = $list_ancestors->count(); |
|
97 | - |
|
98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-indi-tab', [ |
|
99 | - 'module_name' => $this->module->name(), |
|
100 | - 'title' => I18N::translate('Sosa Ancestors'), |
|
101 | - 'tree' => $tree, |
|
102 | - 'list_ancestors' => $list_ancestors, |
|
103 | - 'nb_ancestors_all' => $nb_ancestors_all, |
|
104 | - 'nb_ancestors_theor' => pow(2, $current_gen - 1), |
|
105 | - 'nb_ancestors_shown' => $nb_ancestors_shown |
|
106 | - ]); |
|
107 | - } |
|
38 | + use ViewResponseTrait; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var SosaModule|null $module |
|
42 | + */ |
|
43 | + private $module; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var SosaRecordsService $sosa_record_service |
|
47 | + */ |
|
48 | + private $sosa_record_service; |
|
49 | + |
|
50 | + /** |
|
51 | + * Constructor for AncestorsListIndividual Request Handler |
|
52 | + * |
|
53 | + * @param ModuleService $module_service |
|
54 | + * @param SosaRecordsService $sosa_record_service |
|
55 | + */ |
|
56 | + public function __construct( |
|
57 | + ModuleService $module_service, |
|
58 | + SosaRecordsService $sosa_record_service |
|
59 | + ) { |
|
60 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
61 | + $this->sosa_record_service = $sosa_record_service; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritDoc} |
|
66 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
67 | + */ |
|
68 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
69 | + { |
|
70 | + $this->layout = 'layouts/ajax'; |
|
71 | + |
|
72 | + if ($this->module === null) { |
|
73 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | + } |
|
75 | + |
|
76 | + $tree = $request->getAttribute('tree'); |
|
77 | + assert($tree instanceof Tree); |
|
78 | + |
|
79 | + $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
80 | + |
|
81 | + $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
82 | + |
|
83 | + if ($current_gen <= 0) { |
|
84 | + return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
|
85 | + } |
|
86 | + |
|
87 | + $list_ancestors = $this->sosa_record_service->listAncestorsAtGeneration($tree, $user, $current_gen); |
|
88 | + $nb_ancestors_all = $list_ancestors->count(); |
|
89 | + |
|
90 | + /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Individual> $list_ancestors */ |
|
91 | + $list_ancestors = $list_ancestors->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
92 | + $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
93 | + return ($indi !== null && $indi->canShowName()) ? [(int) $value->majs_sosa => $indi] : null; |
|
94 | + })->filter(); |
|
95 | + |
|
96 | + $nb_ancestors_shown = $list_ancestors->count(); |
|
97 | + |
|
98 | + return $this->viewResponse($this->module->name() . '::list-ancestors-indi-tab', [ |
|
99 | + 'module_name' => $this->module->name(), |
|
100 | + 'title' => I18N::translate('Sosa Ancestors'), |
|
101 | + 'tree' => $tree, |
|
102 | + 'list_ancestors' => $list_ancestors, |
|
103 | + 'nb_ancestors_all' => $nb_ancestors_all, |
|
104 | + 'nb_ancestors_theor' => pow(2, $current_gen - 1), |
|
105 | + 'nb_ancestors_shown' => $nb_ancestors_shown |
|
106 | + ]); |
|
107 | + } |
|
108 | 108 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
80 | 80 | |
81 | - $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
81 | + $current_gen = (int)($request->getAttribute('gen') ?? 0); |
|
82 | 82 | |
83 | 83 | if ($current_gen <= 0) { |
84 | 84 | return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | $nb_ancestors_all = $list_ancestors->count(); |
89 | 89 | |
90 | 90 | /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Individual> $list_ancestors */ |
91 | - $list_ancestors = $list_ancestors->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
91 | + $list_ancestors = $list_ancestors->mapWithKeys(function(stdClass $value) use ($tree): ?array { |
|
92 | 92 | $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
93 | - return ($indi !== null && $indi->canShowName()) ? [(int) $value->majs_sosa => $indi] : null; |
|
93 | + return ($indi !== null && $indi->canShowName()) ? [(int)$value->majs_sosa => $indi] : null; |
|
94 | 94 | })->filter(); |
95 | 95 | |
96 | 96 | $nb_ancestors_shown = $list_ancestors->count(); |
97 | 97 | |
98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-indi-tab', [ |
|
98 | + return $this->viewResponse($this->module->name().'::list-ancestors-indi-tab', [ |
|
99 | 99 | 'module_name' => $this->module->name(), |
100 | 100 | 'title' => I18N::translate('Sosa Ancestors'), |
101 | 101 | 'tree' => $tree, |
@@ -36,88 +36,88 @@ |
||
36 | 36 | */ |
37 | 37 | class MissingAncestorsList implements RequestHandlerInterface |
38 | 38 | { |
39 | - use ViewResponseTrait; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var SosaModule|null $module |
|
43 | - */ |
|
44 | - private $module; |
|
45 | - |
|
46 | - /** |
|
47 | - * @var SosaRecordsService $sosa_record_service |
|
48 | - */ |
|
49 | - private $sosa_record_service; |
|
50 | - |
|
51 | - /** |
|
52 | - * Constructor for MissingAncestorsList Request Handler |
|
53 | - * |
|
54 | - * @param ModuleService $module_service |
|
55 | - * @param SosaRecordsService $sosa_record_service |
|
56 | - */ |
|
57 | - public function __construct( |
|
58 | - ModuleService $module_service, |
|
59 | - SosaRecordsService $sosa_record_service |
|
60 | - ) { |
|
61 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
62 | - $this->sosa_record_service = $sosa_record_service; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * {@inheritDoc} |
|
67 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
68 | - */ |
|
69 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
70 | - { |
|
71 | - if ($this->module === null) { |
|
72 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | - } |
|
74 | - |
|
75 | - $tree = $request->getAttribute('tree'); |
|
76 | - assert($tree instanceof Tree); |
|
77 | - |
|
78 | - $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
79 | - |
|
80 | - /** @var SosaStatisticsService $sosa_stats_service */ |
|
81 | - $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
82 | - |
|
83 | - $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
84 | - |
|
85 | - $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
|
86 | - $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
87 | - return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
|
88 | - }); |
|
89 | - |
|
90 | - $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
91 | - $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
92 | - if ($indi !== null && $indi->canShowName()) { |
|
93 | - return new MissingAncestor( |
|
94 | - $indi, |
|
95 | - (int) $value->majs_sosa, |
|
96 | - $value->majs_fat_id === null, |
|
97 | - $value->majs_mot_id === null |
|
98 | - ); |
|
99 | - } |
|
100 | - return null; |
|
101 | - })->filter(); |
|
102 | - |
|
103 | - $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
104 | - return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
|
105 | - }); |
|
106 | - |
|
107 | - return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
108 | - 'module_name' => $this->module->name(), |
|
109 | - 'title' => I18N::translate('Missing Ancestors'), |
|
110 | - 'tree' => $tree, |
|
111 | - 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
112 | - 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
113 | - 'current_gen' => $current_gen, |
|
114 | - 'list_missing' => $list_missing, |
|
115 | - 'nb_missing_diff' => $nb_missing_diff, |
|
116 | - 'nb_missing_shown' => $nb_missing_shown, |
|
117 | - 'gen_completeness' => |
|
118 | - $sosa_stats_service->totalAncestorsAtGeneration($current_gen) / pow(2, $current_gen - 1), |
|
119 | - 'gen_potential' => |
|
120 | - $sosa_stats_service->totalAncestorsAtGeneration($current_gen - 1) / pow(2, $current_gen - 2) |
|
121 | - ]); |
|
122 | - } |
|
39 | + use ViewResponseTrait; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var SosaModule|null $module |
|
43 | + */ |
|
44 | + private $module; |
|
45 | + |
|
46 | + /** |
|
47 | + * @var SosaRecordsService $sosa_record_service |
|
48 | + */ |
|
49 | + private $sosa_record_service; |
|
50 | + |
|
51 | + /** |
|
52 | + * Constructor for MissingAncestorsList Request Handler |
|
53 | + * |
|
54 | + * @param ModuleService $module_service |
|
55 | + * @param SosaRecordsService $sosa_record_service |
|
56 | + */ |
|
57 | + public function __construct( |
|
58 | + ModuleService $module_service, |
|
59 | + SosaRecordsService $sosa_record_service |
|
60 | + ) { |
|
61 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
62 | + $this->sosa_record_service = $sosa_record_service; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * {@inheritDoc} |
|
67 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
68 | + */ |
|
69 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
70 | + { |
|
71 | + if ($this->module === null) { |
|
72 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
73 | + } |
|
74 | + |
|
75 | + $tree = $request->getAttribute('tree'); |
|
76 | + assert($tree instanceof Tree); |
|
77 | + |
|
78 | + $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
79 | + |
|
80 | + /** @var SosaStatisticsService $sosa_stats_service */ |
|
81 | + $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
82 | + |
|
83 | + $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
84 | + |
|
85 | + $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
|
86 | + $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
87 | + return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
|
88 | + }); |
|
89 | + |
|
90 | + $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
91 | + $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
92 | + if ($indi !== null && $indi->canShowName()) { |
|
93 | + return new MissingAncestor( |
|
94 | + $indi, |
|
95 | + (int) $value->majs_sosa, |
|
96 | + $value->majs_fat_id === null, |
|
97 | + $value->majs_mot_id === null |
|
98 | + ); |
|
99 | + } |
|
100 | + return null; |
|
101 | + })->filter(); |
|
102 | + |
|
103 | + $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
104 | + return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
|
105 | + }); |
|
106 | + |
|
107 | + return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
108 | + 'module_name' => $this->module->name(), |
|
109 | + 'title' => I18N::translate('Missing Ancestors'), |
|
110 | + 'tree' => $tree, |
|
111 | + 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
112 | + 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
113 | + 'current_gen' => $current_gen, |
|
114 | + 'list_missing' => $list_missing, |
|
115 | + 'nb_missing_diff' => $nb_missing_diff, |
|
116 | + 'nb_missing_shown' => $nb_missing_shown, |
|
117 | + 'gen_completeness' => |
|
118 | + $sosa_stats_service->totalAncestorsAtGeneration($current_gen) / pow(2, $current_gen - 1), |
|
119 | + 'gen_potential' => |
|
120 | + $sosa_stats_service->totalAncestorsAtGeneration($current_gen - 1) / pow(2, $current_gen - 2) |
|
121 | + ]); |
|
122 | + } |
|
123 | 123 | } |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | /** @var SosaStatisticsService $sosa_stats_service */ |
81 | 81 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
82 | 82 | |
83 | - $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
83 | + $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
84 | 84 | |
85 | 85 | $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
86 | - $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
86 | + $nb_missing_diff = $list_missing->sum(function(stdClass $value): int { |
|
87 | 87 | return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
88 | 88 | }); |
89 | 89 | |
90 | - $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
90 | + $list_missing = $list_missing->map(function(stdClass $value) use ($tree): ?MissingAncestor { |
|
91 | 91 | $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
92 | 92 | if ($indi !== null && $indi->canShowName()) { |
93 | 93 | return new MissingAncestor( |
94 | 94 | $indi, |
95 | - (int) $value->majs_sosa, |
|
95 | + (int)$value->majs_sosa, |
|
96 | 96 | $value->majs_fat_id === null, |
97 | 97 | $value->majs_mot_id === null |
98 | 98 | ); |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | return null; |
101 | 101 | })->filter(); |
102 | 102 | |
103 | - $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
103 | + $nb_missing_shown = $list_missing->sum(function(MissingAncestor $value): int { |
|
104 | 104 | return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
105 | 105 | }); |
106 | 106 | |
107 | - return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
107 | + return $this->viewResponse($this->module->name().'::list-missing-page', [ |
|
108 | 108 | 'module_name' => $this->module->name(), |
109 | 109 | 'title' => I18N::translate('Missing Ancestors'), |
110 | 110 | 'tree' => $tree, |
@@ -35,73 +35,73 @@ |
||
35 | 35 | */ |
36 | 36 | class AncestorsListFamily implements RequestHandlerInterface |
37 | 37 | { |
38 | - use ViewResponseTrait; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var SosaModule|null $module |
|
42 | - */ |
|
43 | - private $module; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var SosaRecordsService $sosa_record_service |
|
47 | - */ |
|
48 | - private $sosa_record_service; |
|
49 | - |
|
50 | - /** |
|
51 | - * Constructor for AncestorsListFamily Request Handler |
|
52 | - * |
|
53 | - * @param ModuleService $module_service |
|
54 | - * @param SosaRecordsService $sosa_record_service |
|
55 | - */ |
|
56 | - public function __construct( |
|
57 | - ModuleService $module_service, |
|
58 | - SosaRecordsService $sosa_record_service |
|
59 | - ) { |
|
60 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
61 | - $this->sosa_record_service = $sosa_record_service; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritDoc} |
|
66 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
67 | - */ |
|
68 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
69 | - { |
|
70 | - $this->layout = 'layouts/ajax'; |
|
71 | - |
|
72 | - if ($this->module === null) { |
|
73 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | - } |
|
75 | - |
|
76 | - $tree = $request->getAttribute('tree'); |
|
77 | - assert($tree instanceof Tree); |
|
78 | - |
|
79 | - $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
80 | - |
|
81 | - $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
82 | - |
|
83 | - if ($current_gen <= 0) { |
|
84 | - return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
|
85 | - } |
|
86 | - |
|
87 | - $list_families = $this->sosa_record_service->listAncestorFamiliesAtGeneration($tree, $user, $current_gen); |
|
88 | - $nb_families_all = $list_families->count(); |
|
89 | - |
|
90 | - /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */ |
|
91 | - $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
92 | - $fam = Registry::familyFactory()->make($value->f_id, $tree); |
|
93 | - return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null; |
|
94 | - })->filter(); |
|
95 | - |
|
96 | - $nb_families_shown = $list_families->count(); |
|
97 | - |
|
98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [ |
|
99 | - 'module_name' => $this->module->name(), |
|
100 | - 'title' => I18N::translate('Sosa Ancestors'), |
|
101 | - 'tree' => $tree, |
|
102 | - 'list_families' => $list_families, |
|
103 | - 'nb_families_all' => $nb_families_all, |
|
104 | - 'nb_families_shown' => $nb_families_shown |
|
105 | - ]); |
|
106 | - } |
|
38 | + use ViewResponseTrait; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var SosaModule|null $module |
|
42 | + */ |
|
43 | + private $module; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var SosaRecordsService $sosa_record_service |
|
47 | + */ |
|
48 | + private $sosa_record_service; |
|
49 | + |
|
50 | + /** |
|
51 | + * Constructor for AncestorsListFamily Request Handler |
|
52 | + * |
|
53 | + * @param ModuleService $module_service |
|
54 | + * @param SosaRecordsService $sosa_record_service |
|
55 | + */ |
|
56 | + public function __construct( |
|
57 | + ModuleService $module_service, |
|
58 | + SosaRecordsService $sosa_record_service |
|
59 | + ) { |
|
60 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
61 | + $this->sosa_record_service = $sosa_record_service; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritDoc} |
|
66 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
67 | + */ |
|
68 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
69 | + { |
|
70 | + $this->layout = 'layouts/ajax'; |
|
71 | + |
|
72 | + if ($this->module === null) { |
|
73 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | + } |
|
75 | + |
|
76 | + $tree = $request->getAttribute('tree'); |
|
77 | + assert($tree instanceof Tree); |
|
78 | + |
|
79 | + $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
80 | + |
|
81 | + $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
82 | + |
|
83 | + if ($current_gen <= 0) { |
|
84 | + return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
|
85 | + } |
|
86 | + |
|
87 | + $list_families = $this->sosa_record_service->listAncestorFamiliesAtGeneration($tree, $user, $current_gen); |
|
88 | + $nb_families_all = $list_families->count(); |
|
89 | + |
|
90 | + /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */ |
|
91 | + $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
92 | + $fam = Registry::familyFactory()->make($value->f_id, $tree); |
|
93 | + return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null; |
|
94 | + })->filter(); |
|
95 | + |
|
96 | + $nb_families_shown = $list_families->count(); |
|
97 | + |
|
98 | + return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [ |
|
99 | + 'module_name' => $this->module->name(), |
|
100 | + 'title' => I18N::translate('Sosa Ancestors'), |
|
101 | + 'tree' => $tree, |
|
102 | + 'list_families' => $list_families, |
|
103 | + 'nb_families_all' => $nb_families_all, |
|
104 | + 'nb_families_shown' => $nb_families_shown |
|
105 | + ]); |
|
106 | + } |
|
107 | 107 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
80 | 80 | |
81 | - $current_gen = (int) ($request->getAttribute('gen') ?? 0); |
|
81 | + $current_gen = (int)($request->getAttribute('gen') ?? 0); |
|
82 | 82 | |
83 | 83 | if ($current_gen <= 0) { |
84 | 84 | return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | $nb_families_all = $list_families->count(); |
89 | 89 | |
90 | 90 | /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */ |
91 | - $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
91 | + $list_families = $list_families->mapWithKeys(function(stdClass $value) use ($tree): ?array { |
|
92 | 92 | $fam = Registry::familyFactory()->make($value->f_id, $tree); |
93 | - return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null; |
|
93 | + return ($fam !== null && $fam->canShow()) ? [(int)$value->majs_sosa => $fam] : null; |
|
94 | 94 | })->filter(); |
95 | 95 | |
96 | 96 | $nb_families_shown = $list_families->count(); |
97 | 97 | |
98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [ |
|
98 | + return $this->viewResponse($this->module->name().'::list-ancestors-fam-tab', [ |
|
99 | 99 | 'module_name' => $this->module->name(), |
100 | 100 | 'title' => I18N::translate('Sosa Ancestors'), |
101 | 101 | 'tree' => $tree, |
@@ -33,59 +33,59 @@ |
||
33 | 33 | */ |
34 | 34 | class AncestorsList implements RequestHandlerInterface |
35 | 35 | { |
36 | - use ViewResponseTrait; |
|
36 | + use ViewResponseTrait; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var SosaModule|null $module |
|
40 | - */ |
|
41 | - private $module; |
|
38 | + /** |
|
39 | + * @var SosaModule|null $module |
|
40 | + */ |
|
41 | + private $module; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var SosaRecordsService $sosa_record_service |
|
45 | - */ |
|
46 | - private $sosa_record_service; |
|
43 | + /** |
|
44 | + * @var SosaRecordsService $sosa_record_service |
|
45 | + */ |
|
46 | + private $sosa_record_service; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Constructor for AncestorsList Request Handler |
|
50 | - * |
|
51 | - * @param ModuleService $module_service |
|
52 | - * @param SosaRecordsService $sosa_record_service |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - ModuleService $module_service, |
|
56 | - SosaRecordsService $sosa_record_service |
|
57 | - ) { |
|
58 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
59 | - $this->sosa_record_service = $sosa_record_service; |
|
60 | - } |
|
48 | + /** |
|
49 | + * Constructor for AncestorsList Request Handler |
|
50 | + * |
|
51 | + * @param ModuleService $module_service |
|
52 | + * @param SosaRecordsService $sosa_record_service |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + ModuleService $module_service, |
|
56 | + SosaRecordsService $sosa_record_service |
|
57 | + ) { |
|
58 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
59 | + $this->sosa_record_service = $sosa_record_service; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * {@inheritDoc} |
|
64 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
65 | - */ |
|
66 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
67 | - { |
|
68 | - if ($this->module === null) { |
|
69 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
70 | - } |
|
62 | + /** |
|
63 | + * {@inheritDoc} |
|
64 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
65 | + */ |
|
66 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
67 | + { |
|
68 | + if ($this->module === null) { |
|
69 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
70 | + } |
|
71 | 71 | |
72 | - $tree = $request->getAttribute('tree'); |
|
73 | - assert($tree instanceof Tree); |
|
72 | + $tree = $request->getAttribute('tree'); |
|
73 | + assert($tree instanceof Tree); |
|
74 | 74 | |
75 | - $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
75 | + $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
|
76 | 76 | |
77 | - /** @var SosaStatisticsService $sosa_stats_service */ |
|
78 | - $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
77 | + /** @var SosaStatisticsService $sosa_stats_service */ |
|
78 | + $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
79 | 79 | |
80 | - $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
80 | + $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
81 | 81 | |
82 | - return $this->viewResponse($this->module->name() . '::list-ancestors-page', [ |
|
83 | - 'module_name' => $this->module->name(), |
|
84 | - 'title' => I18N::translate('Sosa Ancestors'), |
|
85 | - 'tree' => $tree, |
|
86 | - 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
87 | - 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
88 | - 'current_gen' => $current_gen |
|
89 | - ]); |
|
90 | - } |
|
82 | + return $this->viewResponse($this->module->name() . '::list-ancestors-page', [ |
|
83 | + 'module_name' => $this->module->name(), |
|
84 | + 'title' => I18N::translate('Sosa Ancestors'), |
|
85 | + 'tree' => $tree, |
|
86 | + 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
87 | + 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
88 | + 'current_gen' => $current_gen |
|
89 | + ]); |
|
90 | + } |
|
91 | 91 | } |
@@ -77,9 +77,9 @@ |
||
77 | 77 | /** @var SosaStatisticsService $sosa_stats_service */ |
78 | 78 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
79 | 79 | |
80 | - $current_gen = (int) ($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
80 | + $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
81 | 81 | |
82 | - return $this->viewResponse($this->module->name() . '::list-ancestors-page', [ |
|
82 | + return $this->viewResponse($this->module->name().'::list-ancestors-page', [ |
|
83 | 83 | 'module_name' => $this->module->name(), |
84 | 84 | 'title' => I18N::translate('Sosa Ancestors'), |
85 | 85 | 'tree' => $tree, |