@@ -37,89 +37,89 @@ |
||
37 | 37 | */ |
38 | 38 | class MissingAncestorsList implements RequestHandlerInterface |
39 | 39 | { |
40 | - use ViewResponseTrait; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var SosaModule|null $module |
|
44 | - */ |
|
45 | - private $module; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var SosaRecordsService $sosa_record_service |
|
49 | - */ |
|
50 | - private $sosa_record_service; |
|
51 | - |
|
52 | - /** |
|
53 | - * Constructor for MissingAncestorsList Request Handler |
|
54 | - * |
|
55 | - * @param ModuleService $module_service |
|
56 | - * @param SosaRecordsService $sosa_record_service |
|
57 | - */ |
|
58 | - public function __construct( |
|
59 | - ModuleService $module_service, |
|
60 | - SosaRecordsService $sosa_record_service |
|
61 | - ) { |
|
62 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
63 | - $this->sosa_record_service = $sosa_record_service; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * {@inheritDoc} |
|
68 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
69 | - */ |
|
70 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
71 | - { |
|
72 | - if ($this->module === null) { |
|
73 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | - } |
|
75 | - |
|
76 | - $tree = Validator::attributes($request)->tree(); |
|
77 | - $user = Auth::check() ? Validator::attributes($request)->user() : new DefaultUser(); |
|
78 | - |
|
79 | - /** @var SosaStatisticsService $sosa_stats_service */ |
|
80 | - $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
81 | - |
|
82 | - $current_gen = Validator::queryParams($request)->integer( |
|
83 | - 'gen', |
|
84 | - Validator::attributes($request)->integer('gen', 0) |
|
85 | - ); |
|
86 | - |
|
87 | - $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
|
88 | - $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
89 | - return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
|
90 | - }); |
|
91 | - |
|
92 | - $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
93 | - $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
94 | - if ($indi !== null && $indi->canShowName()) { |
|
95 | - return new MissingAncestor( |
|
96 | - $indi, |
|
97 | - (int) $value->majs_sosa, |
|
98 | - $value->majs_fat_id === null, |
|
99 | - $value->majs_mot_id === null |
|
100 | - ); |
|
101 | - } |
|
102 | - return null; |
|
103 | - })->filter(); |
|
104 | - |
|
105 | - $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
106 | - return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
|
107 | - }); |
|
108 | - |
|
109 | - return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
110 | - 'module_name' => $this->module->name(), |
|
111 | - 'title' => I18N::translate('Missing Ancestors'), |
|
112 | - 'tree' => $tree, |
|
113 | - 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
114 | - 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
115 | - 'current_gen' => $current_gen, |
|
116 | - 'list_missing' => $list_missing, |
|
117 | - 'nb_missing_diff' => $nb_missing_diff, |
|
118 | - 'nb_missing_shown' => $nb_missing_shown, |
|
119 | - 'gen_completeness' => |
|
120 | - $sosa_stats_service->totalAncestorsAtGeneration($current_gen) / pow(2, $current_gen - 1), |
|
121 | - 'gen_potential' => |
|
122 | - $sosa_stats_service->totalAncestorsAtGeneration($current_gen - 1) / pow(2, $current_gen - 2) |
|
123 | - ]); |
|
124 | - } |
|
40 | + use ViewResponseTrait; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var SosaModule|null $module |
|
44 | + */ |
|
45 | + private $module; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var SosaRecordsService $sosa_record_service |
|
49 | + */ |
|
50 | + private $sosa_record_service; |
|
51 | + |
|
52 | + /** |
|
53 | + * Constructor for MissingAncestorsList Request Handler |
|
54 | + * |
|
55 | + * @param ModuleService $module_service |
|
56 | + * @param SosaRecordsService $sosa_record_service |
|
57 | + */ |
|
58 | + public function __construct( |
|
59 | + ModuleService $module_service, |
|
60 | + SosaRecordsService $sosa_record_service |
|
61 | + ) { |
|
62 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
63 | + $this->sosa_record_service = $sosa_record_service; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * {@inheritDoc} |
|
68 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
69 | + */ |
|
70 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
71 | + { |
|
72 | + if ($this->module === null) { |
|
73 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
74 | + } |
|
75 | + |
|
76 | + $tree = Validator::attributes($request)->tree(); |
|
77 | + $user = Auth::check() ? Validator::attributes($request)->user() : new DefaultUser(); |
|
78 | + |
|
79 | + /** @var SosaStatisticsService $sosa_stats_service */ |
|
80 | + $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
|
81 | + |
|
82 | + $current_gen = Validator::queryParams($request)->integer( |
|
83 | + 'gen', |
|
84 | + Validator::attributes($request)->integer('gen', 0) |
|
85 | + ); |
|
86 | + |
|
87 | + $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
|
88 | + $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
89 | + return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
|
90 | + }); |
|
91 | + |
|
92 | + $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
93 | + $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
|
94 | + if ($indi !== null && $indi->canShowName()) { |
|
95 | + return new MissingAncestor( |
|
96 | + $indi, |
|
97 | + (int) $value->majs_sosa, |
|
98 | + $value->majs_fat_id === null, |
|
99 | + $value->majs_mot_id === null |
|
100 | + ); |
|
101 | + } |
|
102 | + return null; |
|
103 | + })->filter(); |
|
104 | + |
|
105 | + $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
106 | + return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
|
107 | + }); |
|
108 | + |
|
109 | + return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
110 | + 'module_name' => $this->module->name(), |
|
111 | + 'title' => I18N::translate('Missing Ancestors'), |
|
112 | + 'tree' => $tree, |
|
113 | + 'root_indi' => $sosa_stats_service->rootIndividual(), |
|
114 | + 'max_gen' => $sosa_stats_service->maxGeneration(), |
|
115 | + 'current_gen' => $current_gen, |
|
116 | + 'list_missing' => $list_missing, |
|
117 | + 'nb_missing_diff' => $nb_missing_diff, |
|
118 | + 'nb_missing_shown' => $nb_missing_shown, |
|
119 | + 'gen_completeness' => |
|
120 | + $sosa_stats_service->totalAncestorsAtGeneration($current_gen) / pow(2, $current_gen - 1), |
|
121 | + 'gen_potential' => |
|
122 | + $sosa_stats_service->totalAncestorsAtGeneration($current_gen - 1) / pow(2, $current_gen - 2) |
|
123 | + ]); |
|
124 | + } |
|
125 | 125 | } |
@@ -25,45 +25,45 @@ |
||
25 | 25 | * @extends AbstractHookCollector<SosaMissingDatatablesExtenderInterface> |
26 | 26 | */ |
27 | 27 | class SosaMissingDatatablesExtenderCollector extends AbstractHookCollector implements |
28 | - SosaMissingDatatablesExtenderInterface |
|
28 | + SosaMissingDatatablesExtenderInterface |
|
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Columns extender for tables of missing ancestors'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Columns extender for tables of missing ancestors'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Add additional columns to tables of missing ancestors'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Add additional columns to tables of missing ancestors'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return SosaMissingDatatablesExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return SosaMissingDatatablesExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns() |
|
60 | - */ |
|
61 | - public function sosaMissingColumns(iterable $records): array |
|
62 | - { |
|
63 | - $result = []; |
|
64 | - foreach ($this->hooks() as $hook) { |
|
65 | - $result += $hook->sosaMissingColumns($records); |
|
66 | - } |
|
67 | - return $result; |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns() |
|
60 | + */ |
|
61 | + public function sosaMissingColumns(iterable $records): array |
|
62 | + { |
|
63 | + $result = []; |
|
64 | + foreach ($this->hooks() as $hook) { |
|
65 | + $result += $hook->sosaMissingColumns($records); |
|
66 | + } |
|
67 | + return $result; |
|
68 | + } |
|
69 | 69 | } |
@@ -25,45 +25,45 @@ |
||
25 | 25 | * @extends AbstractHookCollector<SosaFamilyDatatablesExtenderInterface> |
26 | 26 | */ |
27 | 27 | class SosaFamilyDatatablesExtenderCollector extends AbstractHookCollector implements |
28 | - SosaFamilyDatatablesExtenderInterface |
|
28 | + SosaFamilyDatatablesExtenderInterface |
|
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Columns extender for tables of ancestors’ families'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Columns extender for tables of ancestors’ families'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Add additional columns to tables of ancestors’ families'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Add additional columns to tables of ancestors’ families'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return SosaFamilyDatatablesExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return SosaFamilyDatatablesExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns() |
|
60 | - */ |
|
61 | - public function sosaFamilyColumns(iterable $records): array |
|
62 | - { |
|
63 | - $result = []; |
|
64 | - foreach ($this->hooks() as $hook) { |
|
65 | - $result += $hook->sosaFamilyColumns($records); |
|
66 | - } |
|
67 | - return $result; |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns() |
|
60 | + */ |
|
61 | + public function sosaFamilyColumns(iterable $records): array |
|
62 | + { |
|
63 | + $result = []; |
|
64 | + foreach ($this->hooks() as $hook) { |
|
65 | + $result += $hook->sosaFamilyColumns($records); |
|
66 | + } |
|
67 | + return $result; |
|
68 | + } |
|
69 | 69 | } |
@@ -25,45 +25,45 @@ |
||
25 | 25 | * @extends AbstractHookCollector<SosaIndividualDatatablesExtenderInterface> |
26 | 26 | */ |
27 | 27 | class SosaIndividualDatatablesExtenderCollector extends AbstractHookCollector implements |
28 | - SosaIndividualDatatablesExtenderInterface |
|
28 | + SosaIndividualDatatablesExtenderInterface |
|
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Columns extender for tables of ancestors'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Columns extender for tables of ancestors'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Add additional columns to tables of ancestors'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Add additional columns to tables of ancestors'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return SosaIndividualDatatablesExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return SosaIndividualDatatablesExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns() |
|
60 | - */ |
|
61 | - public function sosaIndividualColumns(iterable $records): array |
|
62 | - { |
|
63 | - $result = []; |
|
64 | - foreach ($this->hooks() as $hook) { |
|
65 | - $result += $hook->sosaIndividualColumns($records); |
|
66 | - } |
|
67 | - return $result; |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns() |
|
60 | + */ |
|
61 | + public function sosaIndividualColumns(iterable $records): array |
|
62 | + { |
|
63 | + $result = []; |
|
64 | + foreach ($this->hooks() as $hook) { |
|
65 | + $result += $hook->sosaIndividualColumns($records); |
|
66 | + } |
|
67 | + return $result; |
|
68 | + } |
|
69 | 69 | } |
@@ -27,56 +27,56 @@ |
||
27 | 27 | */ |
28 | 28 | class FactSourceTextExtenderCollector extends AbstractHookCollector implements FactSourceTextExtenderInterface |
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Text extender for source citations’ title'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Text extender for source citations’ title'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Extends the title of source citations with additional text or icons.'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Extends the title of source citations with additional text or icons.'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return FactSourceTextExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return FactSourceTextExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourcePrepend() |
|
60 | - */ |
|
61 | - public function factSourcePrepend(Tree $tree, $fact): string |
|
62 | - { |
|
63 | - return $this->hooks() |
|
64 | - ->map( |
|
65 | - fn(FactSourceTextExtenderInterface $hook) => |
|
66 | - $hook->factSourcePrepend($tree, $fact) |
|
67 | - )->implode(''); |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourcePrepend() |
|
60 | + */ |
|
61 | + public function factSourcePrepend(Tree $tree, $fact): string |
|
62 | + { |
|
63 | + return $this->hooks() |
|
64 | + ->map( |
|
65 | + fn(FactSourceTextExtenderInterface $hook) => |
|
66 | + $hook->factSourcePrepend($tree, $fact) |
|
67 | + )->implode(''); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * {@inheritDoc} |
|
72 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourceAppend() |
|
73 | - */ |
|
74 | - public function factSourceAppend(Tree $tree, $fact): string |
|
75 | - { |
|
76 | - return $this->hooks() |
|
77 | - ->map( |
|
78 | - fn(FactSourceTextExtenderInterface $hook) => |
|
79 | - $hook->factSourcePrepend($tree, $fact) |
|
80 | - )->implode(''); |
|
81 | - } |
|
70 | + /** |
|
71 | + * {@inheritDoc} |
|
72 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourceAppend() |
|
73 | + */ |
|
74 | + public function factSourceAppend(Tree $tree, $fact): string |
|
75 | + { |
|
76 | + return $this->hooks() |
|
77 | + ->map( |
|
78 | + fn(FactSourceTextExtenderInterface $hook) => |
|
79 | + $hook->factSourcePrepend($tree, $fact) |
|
80 | + )->implode(''); |
|
81 | + } |
|
82 | 82 | } |
@@ -25,45 +25,45 @@ |
||
25 | 25 | * @extends AbstractHookCollector<FamilyDatatablesExtenderInterface> |
26 | 26 | */ |
27 | 27 | class FamilyDatatablesExtenderCollector extends AbstractHookCollector implements |
28 | - FamilyDatatablesExtenderInterface |
|
28 | + FamilyDatatablesExtenderInterface |
|
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Columns extender for tables of families'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Columns extender for tables of families'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Add additional columns to tables of families'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Add additional columns to tables of families'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return FamilyDatatablesExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return FamilyDatatablesExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns() |
|
60 | - */ |
|
61 | - public function familyColumns(iterable $records): array |
|
62 | - { |
|
63 | - $result = []; |
|
64 | - foreach ($this->hooks() as $hook) { |
|
65 | - $result += $hook->familyColumns($records); |
|
66 | - } |
|
67 | - return $result; |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns() |
|
60 | + */ |
|
61 | + public function familyColumns(iterable $records): array |
|
62 | + { |
|
63 | + $result = []; |
|
64 | + foreach ($this->hooks() as $hook) { |
|
65 | + $result += $hook->familyColumns($records); |
|
66 | + } |
|
67 | + return $result; |
|
68 | + } |
|
69 | 69 | } |
@@ -25,45 +25,45 @@ |
||
25 | 25 | * @extends AbstractHookCollector<IndividualDatatablesExtenderInterface> |
26 | 26 | */ |
27 | 27 | class IndividualDatatablesExtenderCollector extends AbstractHookCollector implements |
28 | - IndividualDatatablesExtenderInterface |
|
28 | + IndividualDatatablesExtenderInterface |
|
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Columns extender for tables of individuals'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Columns extender for tables of individuals'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Add additional columns to tables of individuals'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Add additional columns to tables of individuals'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return IndividualDatatablesExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return IndividualDatatablesExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns() |
|
60 | - */ |
|
61 | - public function individualColumns(iterable $records): array |
|
62 | - { |
|
63 | - $result = []; |
|
64 | - foreach ($this->hooks() as $hook) { |
|
65 | - $result += $hook->individualColumns($records); |
|
66 | - } |
|
67 | - return $result; |
|
68 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns() |
|
60 | + */ |
|
61 | + public function individualColumns(iterable $records): array |
|
62 | + { |
|
63 | + $result = []; |
|
64 | + foreach ($this->hooks() as $hook) { |
|
65 | + $result += $hook->individualColumns($records); |
|
66 | + } |
|
67 | + return $result; |
|
68 | + } |
|
69 | 69 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | */ |
22 | 22 | class Migration0 implements MigrationInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * {@inheritDoc} |
|
26 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
27 | - */ |
|
28 | - public function upgrade(): void |
|
29 | - { |
|
24 | + /** |
|
25 | + * {@inheritDoc} |
|
26 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
27 | + */ |
|
28 | + public function upgrade(): void |
|
29 | + { |
|
30 | 30 | |
31 | - // This migration has been superseded by migration 1. |
|
32 | - } |
|
31 | + // This migration has been superseded by migration 1. |
|
32 | + } |
|
33 | 33 | } |
@@ -23,28 +23,28 @@ |
||
23 | 23 | */ |
24 | 24 | class Migration1 implements MigrationInterface |
25 | 25 | { |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
29 | - */ |
|
30 | - public function upgrade(): void |
|
31 | - { |
|
32 | - $in_transaction = DB::connection()->getPdo()->inTransaction(); |
|
33 | - |
|
34 | - if (DB::schema()->hasTable('maj_hooks')) { |
|
35 | - DB::schema()->drop('maj_hooks'); |
|
36 | - } |
|
37 | - |
|
38 | - DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
39 | - $table->string('majho_module_name', 32); |
|
40 | - $table->string('majho_hook_name', 64); |
|
41 | - $table->integer('majho_hook_order')->nullable(); |
|
42 | - |
|
43 | - $table->primary(['majho_module_name', 'majho_hook_name']); |
|
44 | - }); |
|
45 | - |
|
46 | - if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
|
47 | - DB::connection()->beginTransaction(); |
|
48 | - } |
|
49 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
29 | + */ |
|
30 | + public function upgrade(): void |
|
31 | + { |
|
32 | + $in_transaction = DB::connection()->getPdo()->inTransaction(); |
|
33 | + |
|
34 | + if (DB::schema()->hasTable('maj_hooks')) { |
|
35 | + DB::schema()->drop('maj_hooks'); |
|
36 | + } |
|
37 | + |
|
38 | + DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
39 | + $table->string('majho_module_name', 32); |
|
40 | + $table->string('majho_hook_name', 64); |
|
41 | + $table->integer('majho_hook_order')->nullable(); |
|
42 | + |
|
43 | + $table->primary(['majho_module_name', 'majho_hook_name']); |
|
44 | + }); |
|
45 | + |
|
46 | + if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
|
47 | + DB::connection()->beginTransaction(); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |