@@ -35,74 +35,74 @@ |
||
35 | 35 | */ |
36 | 36 | class AncestorsListIndividual implements RequestHandlerInterface |
37 | 37 | { |
38 | - use ViewResponseTrait; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var SosaModule $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') ?? $request->getQueryParams()['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 $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') ?? $request->getQueryParams()['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 | } |
@@ -29,40 +29,40 @@ |
||
29 | 29 | */ |
30 | 30 | class SosaComputeModal implements RequestHandlerInterface |
31 | 31 | { |
32 | - /** |
|
33 | - * @var SosaModule $module |
|
34 | - */ |
|
35 | - private $module; |
|
32 | + /** |
|
33 | + * @var SosaModule $module |
|
34 | + */ |
|
35 | + private $module; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor for SosaComputeModal Request Handler |
|
39 | - * |
|
40 | - * @param ModuleService $module_service |
|
41 | - */ |
|
42 | - public function __construct(ModuleService $module_service) |
|
43 | - { |
|
44 | - $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
45 | - } |
|
37 | + /** |
|
38 | + * Constructor for SosaComputeModal Request Handler |
|
39 | + * |
|
40 | + * @param ModuleService $module_service |
|
41 | + */ |
|
42 | + public function __construct(ModuleService $module_service) |
|
43 | + { |
|
44 | + $this->module = $module_service->findByInterface(SosaModule::class)->first(); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * {@inheritDoc} |
|
49 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
50 | - */ |
|
51 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
52 | - { |
|
53 | - if ($this->module === null) { |
|
54 | - return response( |
|
55 | - I18N::translate('The attached module could not be found.'), |
|
56 | - StatusCodeInterface::STATUS_NOT_FOUND |
|
57 | - ); |
|
58 | - } |
|
47 | + /** |
|
48 | + * {@inheritDoc} |
|
49 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
50 | + */ |
|
51 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
52 | + { |
|
53 | + if ($this->module === null) { |
|
54 | + return response( |
|
55 | + I18N::translate('The attached module could not be found.'), |
|
56 | + StatusCodeInterface::STATUS_NOT_FOUND |
|
57 | + ); |
|
58 | + } |
|
59 | 59 | |
60 | - $tree = $request->getAttribute('tree'); |
|
61 | - assert($tree instanceof Tree); |
|
60 | + $tree = $request->getAttribute('tree'); |
|
61 | + assert($tree instanceof Tree); |
|
62 | 62 | |
63 | - return response(view($this->module->name() . '::modals/sosa-compute', [ |
|
64 | - 'tree' => $tree, |
|
65 | - 'xref' => $request->getAttribute('xref') |
|
66 | - ])); |
|
67 | - } |
|
63 | + return response(view($this->module->name() . '::modals/sosa-compute', [ |
|
64 | + 'tree' => $tree, |
|
65 | + 'xref' => $request->getAttribute('xref') |
|
66 | + ])); |
|
67 | + } |
|
68 | 68 | } |
@@ -31,61 +31,61 @@ |
||
31 | 31 | */ |
32 | 32 | class SosaComputeAction implements RequestHandlerInterface |
33 | 33 | { |
34 | - /** |
|
35 | - * @var UserService $user_service |
|
36 | - */ |
|
37 | - private $user_service; |
|
34 | + /** |
|
35 | + * @var UserService $user_service |
|
36 | + */ |
|
37 | + private $user_service; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Constructor for SosaConfigAction Request Handler |
|
41 | - * |
|
42 | - * @param UserService $user_service |
|
43 | - */ |
|
44 | - public function __construct(UserService $user_service) |
|
45 | - { |
|
46 | - $this->user_service = $user_service; |
|
47 | - } |
|
39 | + /** |
|
40 | + * Constructor for SosaConfigAction Request Handler |
|
41 | + * |
|
42 | + * @param UserService $user_service |
|
43 | + */ |
|
44 | + public function __construct(UserService $user_service) |
|
45 | + { |
|
46 | + $this->user_service = $user_service; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | - */ |
|
53 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | - { |
|
55 | - $tree = $request->getAttribute('tree'); |
|
56 | - assert($tree instanceof Tree); |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | + */ |
|
53 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | + { |
|
55 | + $tree = $request->getAttribute('tree'); |
|
56 | + assert($tree instanceof Tree); |
|
57 | 57 | |
58 | - $params = $request->getParsedBody(); |
|
59 | - assert(is_array($params)); |
|
58 | + $params = $request->getParsedBody(); |
|
59 | + assert(is_array($params)); |
|
60 | 60 | |
61 | - $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0); |
|
62 | - $partial_from = $params['partial_from'] ?? null; |
|
61 | + $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0); |
|
62 | + $partial_from = $params['partial_from'] ?? null; |
|
63 | 63 | |
64 | - if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) { |
|
65 | - $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id); |
|
64 | + if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) { |
|
65 | + $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id); |
|
66 | 66 | |
67 | - /** @var SosaCalculatorService $sosa_calc_service */ |
|
68 | - $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]); |
|
67 | + /** @var SosaCalculatorService $sosa_calc_service */ |
|
68 | + $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]); |
|
69 | 69 | |
70 | - if ( |
|
71 | - $partial_from !== null && |
|
72 | - ($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null |
|
73 | - ) { |
|
74 | - $res = $sosa_calc_service->computeFromIndividual($sosa_from); |
|
75 | - } else { |
|
76 | - $res = $sosa_calc_service->computeAll(); |
|
77 | - } |
|
70 | + if ( |
|
71 | + $partial_from !== null && |
|
72 | + ($sosa_from = Registry::individualFactory()->make($partial_from, $tree)) !== null |
|
73 | + ) { |
|
74 | + $res = $sosa_calc_service->computeFromIndividual($sosa_from); |
|
75 | + } else { |
|
76 | + $res = $sosa_calc_service->computeAll(); |
|
77 | + } |
|
78 | 78 | |
79 | - return $res ? |
|
80 | - response('', 200) : |
|
81 | - response( |
|
82 | - I18N::translate('An error occurred while computing Sosa ancestors.'), |
|
83 | - StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR |
|
84 | - ); |
|
85 | - } |
|
86 | - return response( |
|
87 | - I18N::translate('You do not have permission to modify the user.'), |
|
88 | - StatusCodeInterface::STATUS_FORBIDDEN |
|
89 | - ); |
|
90 | - } |
|
79 | + return $res ? |
|
80 | + response('', 200) : |
|
81 | + response( |
|
82 | + I18N::translate('An error occurred while computing Sosa ancestors.'), |
|
83 | + StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR |
|
84 | + ); |
|
85 | + } |
|
86 | + return response( |
|
87 | + I18N::translate('You do not have permission to modify the user.'), |
|
88 | + StatusCodeInterface::STATUS_FORBIDDEN |
|
89 | + ); |
|
90 | + } |
|
91 | 91 | } |
@@ -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 $module |
|
40 | - */ |
|
41 | - private $module; |
|
38 | + /** |
|
39 | + * @var SosaModule $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->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
80 | + $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['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 | } |
@@ -22,12 +22,12 @@ |
||
22 | 22 | class Migration0 implements MigrationInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritDoc} |
|
27 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
28 | - */ |
|
29 | - public function upgrade(): void |
|
30 | - { |
|
31 | - // These migrations have been merged into migration 2. |
|
32 | - } |
|
25 | + /** |
|
26 | + * {@inheritDoc} |
|
27 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
28 | + */ |
|
29 | + public function upgrade(): void |
|
30 | + { |
|
31 | + // These migrations have been merged into migration 2. |
|
32 | + } |
|
33 | 33 | } |
@@ -24,36 +24,36 @@ |
||
24 | 24 | class Migration2 implements MigrationInterface |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * {@inheritDoc} |
|
29 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
30 | - */ |
|
31 | - public function upgrade(): void |
|
32 | - { |
|
33 | - |
|
34 | - // Clean up previous sosa table if it exists |
|
35 | - DB::schema()->dropIfExists('maj_sosa'); |
|
36 | - |
|
37 | - DB::schema()->create('maj_sosa', static function (Blueprint $table): void { |
|
38 | - |
|
39 | - $table->integer('majs_gedcom_id'); |
|
40 | - $table->integer('majs_user_id')->default(-1); |
|
41 | - $table->bigInteger('majs_sosa')->unsigned(); // Allow to calculate sosa on 64 generations |
|
42 | - $table->string('majs_i_id', 20); |
|
43 | - $table->tinyInteger('majs_gen')->nullable(); |
|
44 | - $table->smallInteger('majs_birth_year')->nullable(); |
|
45 | - $table->smallInteger('majs_birth_year_est')->nullable(); |
|
46 | - $table->smallInteger('majs_death_year')->nullable(); |
|
47 | - $table->smallInteger('majs_death_year_est')->nullable(); |
|
48 | - |
|
49 | - $table->primary(['majs_gedcom_id', 'majs_user_id', 'majs_sosa']); |
|
50 | - |
|
51 | - $table->index(['majs_gedcom_id', 'majs_user_id']); |
|
52 | - $table->index(['majs_gedcom_id', 'majs_user_id', 'majs_i_id']); |
|
53 | - $table->index(['majs_gedcom_id', 'majs_user_id', 'majs_gen']); |
|
54 | - |
|
55 | - $table->foreign('majs_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade'); |
|
56 | - $table->foreign('majs_user_id')->references('user_id')->on('user')->onDelete('cascade'); |
|
57 | - }); |
|
58 | - } |
|
27 | + /** |
|
28 | + * {@inheritDoc} |
|
29 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
30 | + */ |
|
31 | + public function upgrade(): void |
|
32 | + { |
|
33 | + |
|
34 | + // Clean up previous sosa table if it exists |
|
35 | + DB::schema()->dropIfExists('maj_sosa'); |
|
36 | + |
|
37 | + DB::schema()->create('maj_sosa', static function (Blueprint $table): void { |
|
38 | + |
|
39 | + $table->integer('majs_gedcom_id'); |
|
40 | + $table->integer('majs_user_id')->default(-1); |
|
41 | + $table->bigInteger('majs_sosa')->unsigned(); // Allow to calculate sosa on 64 generations |
|
42 | + $table->string('majs_i_id', 20); |
|
43 | + $table->tinyInteger('majs_gen')->nullable(); |
|
44 | + $table->smallInteger('majs_birth_year')->nullable(); |
|
45 | + $table->smallInteger('majs_birth_year_est')->nullable(); |
|
46 | + $table->smallInteger('majs_death_year')->nullable(); |
|
47 | + $table->smallInteger('majs_death_year_est')->nullable(); |
|
48 | + |
|
49 | + $table->primary(['majs_gedcom_id', 'majs_user_id', 'majs_sosa']); |
|
50 | + |
|
51 | + $table->index(['majs_gedcom_id', 'majs_user_id']); |
|
52 | + $table->index(['majs_gedcom_id', 'majs_user_id', 'majs_i_id']); |
|
53 | + $table->index(['majs_gedcom_id', 'majs_user_id', 'majs_gen']); |
|
54 | + |
|
55 | + $table->foreign('majs_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade'); |
|
56 | + $table->foreign('majs_user_id')->references('user_id')->on('user')->onDelete('cascade'); |
|
57 | + }); |
|
58 | + } |
|
59 | 59 | } |
@@ -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 | } |
@@ -21,18 +21,18 @@ |
||
21 | 21 | */ |
22 | 22 | interface ModuleMyArtJaubInterface extends ModuleCustomInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * Add module routes to webtrees route loader |
|
26 | - * |
|
27 | - * @param Map $router |
|
28 | - */ |
|
29 | - public function loadRoutes(Map $router): void; |
|
24 | + /** |
|
25 | + * Add module routes to webtrees route loader |
|
26 | + * |
|
27 | + * @param Map $router |
|
28 | + */ |
|
29 | + public function loadRoutes(Map $router): void; |
|
30 | 30 | /** |
31 | - * Returns the URL of the module specific stylesheets. |
|
32 | - * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
33 | - * and fallback to default.min.css if none are found |
|
34 | - * |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function moduleCssUrl(): string; |
|
31 | + * Returns the URL of the module specific stylesheets. |
|
32 | + * It will look for a CSS file matching the theme name (e.g. xenea.min.css), |
|
33 | + * and fallback to default.min.css if none are found |
|
34 | + * |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function moduleCssUrl(): string; |
|
38 | 38 | } |
@@ -31,65 +31,65 @@ |
||
31 | 31 | */ |
32 | 32 | class TaskEditPage implements RequestHandlerInterface |
33 | 33 | { |
34 | - use ViewResponseTrait; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var AdminTasksModule $module |
|
38 | - */ |
|
39 | - private $module; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var TaskScheduleService $taskschedules_service |
|
43 | - */ |
|
44 | - private $taskschedules_service; |
|
45 | - |
|
46 | - /** |
|
47 | - * Constructor for TaskEditPage Request Handler |
|
48 | - * |
|
49 | - * @param ModuleService $module_service |
|
50 | - * @param TaskScheduleService $taskschedules_service |
|
51 | - */ |
|
52 | - public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service) |
|
53 | - { |
|
54 | - $this->module = $module_service->findByInterface(AdminTasksModule::class)->first(); |
|
55 | - $this->taskschedules_service = $taskschedules_service; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * {@inheritDoc} |
|
60 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | - */ |
|
62 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | - { |
|
64 | - $this->layout = 'layouts/administration'; |
|
65 | - |
|
66 | - if ($this->module === null) { |
|
67 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
68 | - } |
|
69 | - |
|
70 | - $task_sched_id = (int) $request->getAttribute('task'); |
|
71 | - $task_schedule = $this->taskschedules_service->find($task_sched_id); |
|
72 | - |
|
73 | - if ($task_schedule === null) { |
|
74 | - throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.')); |
|
75 | - } |
|
76 | - |
|
77 | - $task = $this->taskschedules_service->findTask($task_schedule->taskId()); |
|
78 | - |
|
79 | - if ($task === null) { |
|
80 | - throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.')); |
|
81 | - } |
|
82 | - |
|
83 | - $has_task_config = $task instanceof ConfigurableTaskInterface; |
|
84 | - /** @var TaskInterface&ConfigurableTaskInterface $task */ |
|
85 | - |
|
86 | - return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [ |
|
87 | - 'module' => $this->module, |
|
88 | - 'title' => I18N::translate('Edit the administrative task') . ' - ' . $task->name(), |
|
89 | - 'task_schedule' => $task_schedule, |
|
90 | - 'task' => $task, |
|
91 | - 'has_task_config' => $has_task_config, |
|
92 | - 'task_config_view' => $has_task_config ? $task->configView($request) : '' |
|
93 | - ]); |
|
94 | - } |
|
34 | + use ViewResponseTrait; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var AdminTasksModule $module |
|
38 | + */ |
|
39 | + private $module; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var TaskScheduleService $taskschedules_service |
|
43 | + */ |
|
44 | + private $taskschedules_service; |
|
45 | + |
|
46 | + /** |
|
47 | + * Constructor for TaskEditPage Request Handler |
|
48 | + * |
|
49 | + * @param ModuleService $module_service |
|
50 | + * @param TaskScheduleService $taskschedules_service |
|
51 | + */ |
|
52 | + public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service) |
|
53 | + { |
|
54 | + $this->module = $module_service->findByInterface(AdminTasksModule::class)->first(); |
|
55 | + $this->taskschedules_service = $taskschedules_service; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * {@inheritDoc} |
|
60 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | + */ |
|
62 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | + { |
|
64 | + $this->layout = 'layouts/administration'; |
|
65 | + |
|
66 | + if ($this->module === null) { |
|
67 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
68 | + } |
|
69 | + |
|
70 | + $task_sched_id = (int) $request->getAttribute('task'); |
|
71 | + $task_schedule = $this->taskschedules_service->find($task_sched_id); |
|
72 | + |
|
73 | + if ($task_schedule === null) { |
|
74 | + throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.')); |
|
75 | + } |
|
76 | + |
|
77 | + $task = $this->taskschedules_service->findTask($task_schedule->taskId()); |
|
78 | + |
|
79 | + if ($task === null) { |
|
80 | + throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.')); |
|
81 | + } |
|
82 | + |
|
83 | + $has_task_config = $task instanceof ConfigurableTaskInterface; |
|
84 | + /** @var TaskInterface&ConfigurableTaskInterface $task */ |
|
85 | + |
|
86 | + return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [ |
|
87 | + 'module' => $this->module, |
|
88 | + 'title' => I18N::translate('Edit the administrative task') . ' - ' . $task->name(), |
|
89 | + 'task_schedule' => $task_schedule, |
|
90 | + 'task' => $task, |
|
91 | + 'has_task_config' => $has_task_config, |
|
92 | + 'task_config_view' => $has_task_config ? $task->configView($request) : '' |
|
93 | + ]); |
|
94 | + } |
|
95 | 95 | } |