@@ -1,14 +1,14 @@ discard block |
||
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-2025, 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-2025, 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 |
||
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 | } |
@@ -1,14 +1,14 @@ discard block |
||
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-2025, 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-2025, 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 |
||
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 | } |
@@ -1,14 +1,14 @@ discard block |
||
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-2025, 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-2025, 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 |
||
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 | } |
@@ -1,14 +1,14 @@ discard block |
||
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-2025, 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-2025, 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,23 +21,23 @@ discard block |
||
21 | 21 | */ |
22 | 22 | interface RecordNameTextExtenderInterface extends HookInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * Insert some content before the record name text. |
|
26 | - * |
|
27 | - * @param GedcomRecord $record Gedcom record |
|
28 | - * @param bool $use_long Use the long text extender format |
|
29 | - * @param string $size Prepend size |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string; |
|
24 | + /** |
|
25 | + * Insert some content before the record name text. |
|
26 | + * |
|
27 | + * @param GedcomRecord $record Gedcom record |
|
28 | + * @param bool $use_long Use the long text extender format |
|
29 | + * @param string $size Prepend size |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Insert some content after the record name text. |
|
36 | - * |
|
37 | - * @param GedcomRecord $record Gedcom record |
|
38 | - * @param bool $use_long Use the long text extender format |
|
39 | - * @param string $size Append size |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string; |
|
34 | + /** |
|
35 | + * Insert some content after the record name text. |
|
36 | + * |
|
37 | + * @param GedcomRecord $record Gedcom record |
|
38 | + * @param bool $use_long Use the long text extender format |
|
39 | + * @param string $size Append size |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string; |
|
43 | 43 | } |
@@ -21,11 +21,11 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModuleTasksProviderInterface extends ModuleInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * List tasks provided by the module as an associative array. |
|
26 | - * They keys are used as task IDs for storage and reference. |
|
27 | - * |
|
28 | - * @return array<string, string> List of tasks |
|
29 | - */ |
|
30 | - public function listTasks(): array; |
|
24 | + /** |
|
25 | + * List tasks provided by the module as an associative array. |
|
26 | + * They keys are used as task IDs for storage and reference. |
|
27 | + * |
|
28 | + * @return array<string, string> List of tasks |
|
29 | + */ |
|
30 | + public function listTasks(): array; |
|
31 | 31 | } |
@@ -21,10 +21,10 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModuleMapDefinitionProviderInterface extends ModuleInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * List map definitions provided by the module as an array. |
|
26 | - * |
|
27 | - * @return array<int, MapDefinitionInterface> List of map definitions |
|
28 | - */ |
|
29 | - public function listMapDefinition(): array; |
|
24 | + /** |
|
25 | + * List map definitions provided by the module as an array. |
|
26 | + * |
|
27 | + * @return array<int, MapDefinitionInterface> List of map definitions |
|
28 | + */ |
|
29 | + public function listMapDefinition(): array; |
|
30 | 30 | } |
@@ -21,10 +21,10 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModuleGeoAnalysisProviderInterface extends ModuleInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * List geographical analyses provided by the module as an array. |
|
26 | - * |
|
27 | - * @return string[] List of geographical analyses |
|
28 | - */ |
|
29 | - public function listGeoAnalyses(): array; |
|
24 | + /** |
|
25 | + * List geographical analyses provided by the module as an array. |
|
26 | + * |
|
27 | + * @return string[] List of geographical analyses |
|
28 | + */ |
|
29 | + public function listGeoAnalyses(): array; |
|
30 | 30 | } |
@@ -21,10 +21,10 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModulePlaceMapperProviderInterface extends ModuleInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * List place mappers provided by the module as an array. |
|
26 | - * |
|
27 | - * @return string[] List of place mappers |
|
28 | - */ |
|
29 | - public function listPlaceMappers(): array; |
|
24 | + /** |
|
25 | + * List place mappers provided by the module as an array. |
|
26 | + * |
|
27 | + * @return string[] List of place mappers |
|
28 | + */ |
|
29 | + public function listPlaceMappers(): array; |
|
30 | 30 | } |
@@ -44,180 +44,180 @@ |
||
44 | 44 | * Certificates Module. |
45 | 45 | */ |
46 | 46 | class CertificatesModule extends AbstractModule implements |
47 | - ModuleMyArtJaubInterface, |
|
48 | - ModuleConfigInterface, |
|
49 | - ModuleGlobalInterface, |
|
50 | - ModuleListInterface, |
|
51 | - ModuleHookSubscriberInterface |
|
47 | + ModuleMyArtJaubInterface, |
|
48 | + ModuleConfigInterface, |
|
49 | + ModuleGlobalInterface, |
|
50 | + ModuleListInterface, |
|
51 | + ModuleHookSubscriberInterface |
|
52 | 52 | { |
53 | - use ModuleMyArtJaubTrait { |
|
54 | - ModuleMyArtJaubTrait::boot as traitMajBoot; |
|
55 | - } |
|
56 | - use ModuleConfigTrait; |
|
57 | - use ModuleGlobalTrait; |
|
58 | - use ModuleListTrait; |
|
59 | - |
|
60 | - /** |
|
61 | - * {@inheritDoc} |
|
62 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
63 | - */ |
|
64 | - public function title(): string |
|
65 | - { |
|
66 | - return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * {@inheritDoc} |
|
71 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
72 | - */ |
|
73 | - public function description(): string |
|
74 | - { |
|
75 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
76 | - return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * {@inheritDoc} |
|
81 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
82 | - */ |
|
83 | - public function boot(): void |
|
84 | - { |
|
85 | - $this->traitMajBoot(); |
|
86 | - |
|
87 | - Registry::elementFactory()->registerTags([ |
|
88 | - 'FAM:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
89 | - 'FAM:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
90 | - 'INDI:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
91 | - 'INDI:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
92 | - 'OBJE:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
93 | - 'OBJE:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
94 | - 'NOTE:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
95 | - 'NOTE:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this) |
|
96 | - ]); |
|
97 | - |
|
98 | - Registry::elementFactory()->registerSubTags([ |
|
99 | - 'FAM:SOUR' => [['_ACT', '0:1']], |
|
100 | - 'FAM:*:SOUR' => [['_ACT', '0:1']], |
|
101 | - 'INDI:SOUR' => [['_ACT', '0:1']], |
|
102 | - 'INDI:*:SOUR' => [['_ACT', '0:1']], |
|
103 | - 'OBJE:SOUR' => [['_ACT', '0:1']], |
|
104 | - 'OBJE:*:SOUR' => [['_ACT', '0:1']], |
|
105 | - 'NOTE:SOUR' => [['_ACT', '0:1']], |
|
106 | - 'NOTE:*:SOUR' => [['_ACT', '0:1']] |
|
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/certificates', static function (Map $router): void { |
|
119 | - |
|
120 | - $router->attach('', '/admin', static function (Map $router): void { |
|
121 | - |
|
122 | - $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class); |
|
123 | - $router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class) |
|
124 | - ->extras([ |
|
125 | - 'middleware' => [ |
|
126 | - AuthManager::class, |
|
127 | - ], |
|
128 | - ]); |
|
129 | - }); |
|
130 | - |
|
131 | - $router->get(AutoCompleteFile::class, '/autocomplete/file/{tree}/{query}', AutoCompleteFile::class) |
|
132 | - ->extras([ |
|
133 | - 'middleware' => [AuthTreePreference::class], |
|
134 | - 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
135 | - ]); |
|
136 | - |
|
137 | - $router->get(CertificatesList::class, '/list/{tree}{/cityobf}', CertificatesList::class) |
|
138 | - ->extras([ |
|
139 | - 'middleware' => [AuthTreePreference::class], |
|
140 | - 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
141 | - ]); |
|
142 | - |
|
143 | - $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void { |
|
144 | - |
|
145 | - $router->extras([ |
|
146 | - 'middleware' => [AuthTreePreference::class], |
|
147 | - 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
148 | - ]); |
|
149 | - |
|
150 | - $router->get(CertificatePage::class, '', CertificatePage::class); |
|
151 | - $router->get(CertificateImage::class, '/image', CertificateImage::class); |
|
152 | - }); |
|
153 | - }); |
|
154 | - }); |
|
155 | - } |
|
156 | - |
|
157 | - /** |
|
158 | - * {@inheritDoc} |
|
159 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
160 | - */ |
|
161 | - public function customModuleVersion(): string |
|
162 | - { |
|
163 | - return '2.1.3-v.1'; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * {@inheritDoc} |
|
168 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
169 | - */ |
|
170 | - public function getConfigLink(): string |
|
171 | - { |
|
172 | - return route(AdminConfigPage::class); |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * {@inheritDoc} |
|
177 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
178 | - */ |
|
179 | - public function headContent(): string |
|
180 | - { |
|
181 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
182 | - } |
|
183 | - |
|
184 | - /** |
|
185 | - * {@inheritDoc} |
|
186 | - * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl() |
|
187 | - * |
|
188 | - * @param array<bool|int|string|array<mixed>|null> $parameters |
|
189 | - */ |
|
190 | - public function listUrl(Tree $tree, array $parameters = []): string |
|
191 | - { |
|
192 | - return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters); |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * {@inheritDoc} |
|
197 | - * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass() |
|
198 | - */ |
|
199 | - public function listMenuClass(): string |
|
200 | - { |
|
201 | - return 'menu-maj-certificates'; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * {@inheritDoc} |
|
206 | - * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listIsEmpty() |
|
207 | - */ |
|
208 | - public function listIsEmpty(Tree $tree): bool |
|
209 | - { |
|
210 | - return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE); |
|
211 | - } |
|
212 | - |
|
213 | - /** |
|
214 | - * {@inheritDoc} |
|
215 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
216 | - */ |
|
217 | - public function listSubscribedHooks(): array |
|
218 | - { |
|
219 | - return [ |
|
220 | - app()->makeWith(SourceCertificateIconHook::class, ['module' => $this]) |
|
221 | - ]; |
|
222 | - } |
|
53 | + use ModuleMyArtJaubTrait { |
|
54 | + ModuleMyArtJaubTrait::boot as traitMajBoot; |
|
55 | + } |
|
56 | + use ModuleConfigTrait; |
|
57 | + use ModuleGlobalTrait; |
|
58 | + use ModuleListTrait; |
|
59 | + |
|
60 | + /** |
|
61 | + * {@inheritDoc} |
|
62 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
63 | + */ |
|
64 | + public function title(): string |
|
65 | + { |
|
66 | + return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * {@inheritDoc} |
|
71 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
72 | + */ |
|
73 | + public function description(): string |
|
74 | + { |
|
75 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
76 | + return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * {@inheritDoc} |
|
81 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
82 | + */ |
|
83 | + public function boot(): void |
|
84 | + { |
|
85 | + $this->traitMajBoot(); |
|
86 | + |
|
87 | + Registry::elementFactory()->registerTags([ |
|
88 | + 'FAM:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
89 | + 'FAM:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
90 | + 'INDI:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
91 | + 'INDI:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
92 | + 'OBJE:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
93 | + 'OBJE:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
94 | + 'NOTE:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this), |
|
95 | + 'NOTE:*:SOUR:_ACT' => new SourceCertificate(I18N::translate('Certificate'), $this) |
|
96 | + ]); |
|
97 | + |
|
98 | + Registry::elementFactory()->registerSubTags([ |
|
99 | + 'FAM:SOUR' => [['_ACT', '0:1']], |
|
100 | + 'FAM:*:SOUR' => [['_ACT', '0:1']], |
|
101 | + 'INDI:SOUR' => [['_ACT', '0:1']], |
|
102 | + 'INDI:*:SOUR' => [['_ACT', '0:1']], |
|
103 | + 'OBJE:SOUR' => [['_ACT', '0:1']], |
|
104 | + 'OBJE:*:SOUR' => [['_ACT', '0:1']], |
|
105 | + 'NOTE:SOUR' => [['_ACT', '0:1']], |
|
106 | + 'NOTE:*:SOUR' => [['_ACT', '0:1']] |
|
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/certificates', static function (Map $router): void { |
|
119 | + |
|
120 | + $router->attach('', '/admin', static function (Map $router): void { |
|
121 | + |
|
122 | + $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class); |
|
123 | + $router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class) |
|
124 | + ->extras([ |
|
125 | + 'middleware' => [ |
|
126 | + AuthManager::class, |
|
127 | + ], |
|
128 | + ]); |
|
129 | + }); |
|
130 | + |
|
131 | + $router->get(AutoCompleteFile::class, '/autocomplete/file/{tree}/{query}', AutoCompleteFile::class) |
|
132 | + ->extras([ |
|
133 | + 'middleware' => [AuthTreePreference::class], |
|
134 | + 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
135 | + ]); |
|
136 | + |
|
137 | + $router->get(CertificatesList::class, '/list/{tree}{/cityobf}', CertificatesList::class) |
|
138 | + ->extras([ |
|
139 | + 'middleware' => [AuthTreePreference::class], |
|
140 | + 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
141 | + ]); |
|
142 | + |
|
143 | + $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void { |
|
144 | + |
|
145 | + $router->extras([ |
|
146 | + 'middleware' => [AuthTreePreference::class], |
|
147 | + 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
|
148 | + ]); |
|
149 | + |
|
150 | + $router->get(CertificatePage::class, '', CertificatePage::class); |
|
151 | + $router->get(CertificateImage::class, '/image', CertificateImage::class); |
|
152 | + }); |
|
153 | + }); |
|
154 | + }); |
|
155 | + } |
|
156 | + |
|
157 | + /** |
|
158 | + * {@inheritDoc} |
|
159 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
160 | + */ |
|
161 | + public function customModuleVersion(): string |
|
162 | + { |
|
163 | + return '2.1.3-v.1'; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * {@inheritDoc} |
|
168 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
169 | + */ |
|
170 | + public function getConfigLink(): string |
|
171 | + { |
|
172 | + return route(AdminConfigPage::class); |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * {@inheritDoc} |
|
177 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
178 | + */ |
|
179 | + public function headContent(): string |
|
180 | + { |
|
181 | + return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
182 | + } |
|
183 | + |
|
184 | + /** |
|
185 | + * {@inheritDoc} |
|
186 | + * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl() |
|
187 | + * |
|
188 | + * @param array<bool|int|string|array<mixed>|null> $parameters |
|
189 | + */ |
|
190 | + public function listUrl(Tree $tree, array $parameters = []): string |
|
191 | + { |
|
192 | + return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters); |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * {@inheritDoc} |
|
197 | + * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass() |
|
198 | + */ |
|
199 | + public function listMenuClass(): string |
|
200 | + { |
|
201 | + return 'menu-maj-certificates'; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * {@inheritDoc} |
|
206 | + * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listIsEmpty() |
|
207 | + */ |
|
208 | + public function listIsEmpty(Tree $tree): bool |
|
209 | + { |
|
210 | + return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE); |
|
211 | + } |
|
212 | + |
|
213 | + /** |
|
214 | + * {@inheritDoc} |
|
215 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
216 | + */ |
|
217 | + public function listSubscribedHooks(): array |
|
218 | + { |
|
219 | + return [ |
|
220 | + app()->makeWith(SourceCertificateIconHook::class, ['module' => $this]) |
|
221 | + ]; |
|
222 | + } |
|
223 | 223 | } |
@@ -113,11 +113,11 @@ 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/certificates', static function (Map $router): void { |
|
118 | + $router->attach('', '/module-maj/certificates', static function(Map $router): void { |
|
119 | 119 | |
120 | - $router->attach('', '/admin', static function (Map $router): void { |
|
120 | + $router->attach('', '/admin', static function(Map $router): void { |
|
121 | 121 | |
122 | 122 | $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class); |
123 | 123 | $router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
141 | 141 | ]); |
142 | 142 | |
143 | - $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void { |
|
143 | + $router->attach('', '/certificate/{tree}/{cid}', static function(Map $router): void { |
|
144 | 144 | |
145 | 145 | $router->extras([ |
146 | 146 | 'middleware' => [AuthTreePreference::class], |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function headContent(): string |
180 | 180 | { |
181 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
181 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function listUrl(Tree $tree, array $parameters = []): string |
191 | 191 | { |
192 | - return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters); |
|
192 | + return route(CertificatesList::class, ['tree' => $tree->name()] + $parameters); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function listIsEmpty(Tree $tree): bool |
209 | 209 | { |
210 | - return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE); |
|
210 | + return Auth::accessLevel($tree) > (int)$tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string)Auth::PRIV_HIDE); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |