@@ -57,7 +57,7 @@ |
||
57 | 57 | $params = $request->getParsedBody(); |
58 | 58 | assert(is_array($params)); |
59 | 59 | |
60 | - $user_id = (int) $params['sosa-userid']; |
|
60 | + $user_id = (int)$params['sosa-userid']; |
|
61 | 61 | $root_id = $params['sosa-rootid'] ?? ''; |
62 | 62 | $max_gen = $params['sosa-maxgen'] ?? ''; |
63 | 63 |
@@ -86,16 +86,15 @@ |
||
86 | 86 | $max_gen_system = app(SosaRecordsService::class)->maxSystemGenerations(); |
87 | 87 | foreach ($users_root as $key => $user_root) { |
88 | 88 | $users_root[$key]['max_gen'] = is_numeric($user_root['max_gen']) ? |
89 | - (int) $user_root['max_gen'] : |
|
90 | - $max_gen_system; |
|
89 | + (int)$user_root['max_gen'] : $max_gen_system; |
|
91 | 90 | }; |
92 | 91 | |
93 | - return $this->viewResponse($this->module->name() . '::config-page', [ |
|
92 | + return $this->viewResponse($this->module->name().'::config-page', [ |
|
94 | 93 | 'module_name' => $this->module->name(), |
95 | 94 | 'title' => I18N::translate('Sosa Configuration'), |
96 | 95 | 'tree' => $tree, |
97 | 96 | 'user_id' => $request->getAttribute('user'), |
98 | - 'selected_user_id' => (int) ($request->getQueryParams()['user_id'] ?? 0), |
|
97 | + 'selected_user_id' => (int)($request->getQueryParams()['user_id'] ?? 0), |
|
99 | 98 | 'immediate_compute' => ($request->getQueryParams()['compute'] ?? '') == 'yes', |
100 | 99 | 'users_root' => $users_root |
101 | 100 | ]); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $tree = $request->getAttribute('tree'); |
61 | 61 | assert($tree instanceof Tree); |
62 | 62 | |
63 | - return response(view($this->module->name() . '::modals/sosa-compute', [ |
|
63 | + return response(view($this->module->name().'::modals/sosa-compute', [ |
|
64 | 64 | 'tree' => $tree, |
65 | 65 | 'xref' => $request->getAttribute('xref') |
66 | 66 | ])); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | $params = $request->getParsedBody(); |
59 | 59 | assert(is_array($params)); |
60 | 60 | |
61 | - $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0); |
|
61 | + $user_id = (int)($params['user_id'] ?? Auth::id() ?? 0); |
|
62 | 62 | $partial_from = $params['partial_from'] ?? null; |
63 | 63 | |
64 | 64 | if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) { |
65 | 65 | $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id); |
66 | 66 | |
67 | 67 | /** @var SosaCalculatorService $sosa_calc_service */ |
68 | - $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]); |
|
68 | + $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, ['tree' => $tree, 'user' => $user]); |
|
69 | 69 | |
70 | 70 | if ( |
71 | 71 | $partial_from !== null && |
@@ -77,8 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | return $res ? |
80 | - response('', 200) : |
|
81 | - response( |
|
80 | + response('', 200) : response( |
|
82 | 81 | I18N::translate('An error occurred while computing Sosa ancestors.'), |
83 | 82 | StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR |
84 | 83 | ); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | // Clean up previous sosa table if it exists |
35 | 35 | DB::schema()->dropIfExists('maj_sosa'); |
36 | 36 | |
37 | - DB::schema()->create('maj_sosa', static function (Blueprint $table): void { |
|
37 | + DB::schema()->create('maj_sosa', static function(Blueprint $table): void { |
|
38 | 38 | |
39 | 39 | $table->integer('majs_gedcom_id'); |
40 | 40 | $table->integer('majs_user_id')->default(-1); |
@@ -74,8 +74,7 @@ |
||
74 | 74 | $this->tmp_sosa_table = array(); |
75 | 75 | $max_gen_setting = $tree->getUserPreference($user, 'MAJ_SOSA_MAX_GEN'); |
76 | 76 | $this->max_generations = is_numeric($max_gen_setting) ? |
77 | - (int) $max_gen_setting : |
|
78 | - $this->sosa_records_service->maxSystemGenerations(); |
|
77 | + (int)$max_gen_setting : $this->sosa_records_service->maxSystemGenerations(); |
|
79 | 78 | } |
80 | 79 | |
81 | 80 | /** |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | public function sosaNumbers(Tree $tree, UserInterface $user, Individual $indi): Collection |
89 | 89 | { |
90 | 90 | return Registry::cache()->array()->remember( |
91 | - 'sosanumbers-' . $indi->xref() . '@' . $tree->id() . '-' . $user->id(), |
|
92 | - function () use ($tree, $user, $indi): Collection { |
|
91 | + 'sosanumbers-'.$indi->xref().'@'.$tree->id().'-'.$user->id(), |
|
92 | + function() use ($tree, $user, $indi): Collection { |
|
93 | 93 | return DB::table('maj_sosa') |
94 | 94 | ->select(['majs_sosa', 'majs_gen']) |
95 | 95 | ->where('majs_gedcom_id', '=', $tree->id()) |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | { |
150 | 150 | $table_prefix = DB::connection()->getTablePrefix(); |
151 | 151 | return DB::table('families') |
152 | - ->join('maj_sosa AS sosa_husb', function (JoinClause $join) use ($tree, $user): void { |
|
152 | + ->join('maj_sosa AS sosa_husb', function(JoinClause $join) use ($tree, $user): void { |
|
153 | 153 | // Link to family husband |
154 | 154 | $join->on('families.f_file', '=', 'sosa_husb.majs_gedcom_id') |
155 | 155 | ->on('families.f_husb', '=', 'sosa_husb.majs_i_id') |
156 | 156 | ->where('sosa_husb.majs_gedcom_id', '=', $tree->id()) |
157 | 157 | ->where('sosa_husb.majs_user_id', '=', $user->id()); |
158 | 158 | }) |
159 | - ->join('maj_sosa AS sosa_wife', function (JoinClause $join) use ($tree, $user): void { |
|
159 | + ->join('maj_sosa AS sosa_wife', function(JoinClause $join) use ($tree, $user): void { |
|
160 | 160 | // Link to family husband |
161 | 161 | $join->on('families.f_file', '=', 'sosa_wife.majs_gedcom_id') |
162 | 162 | ->on('families.f_wife', '=', 'sosa_wife.majs_i_id') |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | }) |
166 | 166 | ->select(['sosa_husb.majs_sosa', 'families.f_id']) |
167 | 167 | ->where('sosa_husb.majs_gen', '=', $gen) |
168 | - ->whereRaw($table_prefix . 'sosa_husb.majs_sosa + 1 = ' . $table_prefix . 'sosa_wife.majs_sosa') |
|
168 | + ->whereRaw($table_prefix.'sosa_husb.majs_sosa + 1 = '.$table_prefix.'sosa_wife.majs_sosa') |
|
169 | 169 | ->orderBy('sosa_husb.majs_sosa') |
170 | 170 | ->get(); |
171 | 171 | } |
@@ -188,28 +188,28 @@ discard block |
||
188 | 188 | $table_prefix = DB::connection()->getTablePrefix(); |
189 | 189 | return DB::table('maj_sosa AS sosa') |
190 | 190 | ->select(['sosa.majs_i_id', 'sosa_fat.majs_i_id AS majs_fat_id', 'sosa_mot.majs_i_id AS majs_mot_id']) |
191 | - ->selectRaw('MIN(' . $table_prefix . 'sosa.majs_sosa) AS majs_sosa') |
|
192 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
191 | + ->selectRaw('MIN('.$table_prefix.'sosa.majs_sosa) AS majs_sosa') |
|
192 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
193 | 193 | // Link to sosa's father |
194 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
194 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
195 | 195 | ->where('sosa_fat.majs_gedcom_id', '=', $tree->id()) |
196 | 196 | ->where('sosa_fat.majs_user_id', '=', $user->id()); |
197 | 197 | }) |
198 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
198 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
199 | 199 | // Link to sosa's mother |
200 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
200 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
201 | 201 | ->where('sosa_mot.majs_gedcom_id', '=', $tree->id()) |
202 | 202 | ->where('sosa_mot.majs_user_id', '=', $user->id()); |
203 | 203 | }) |
204 | 204 | ->where('sosa.majs_gedcom_id', '=', $tree->id()) |
205 | 205 | ->where('sosa.majs_user_id', '=', $user->id()) |
206 | 206 | ->where('sosa.majs_gen', '=', $gen - 1) |
207 | - ->where(function (Builder $query): void { |
|
207 | + ->where(function(Builder $query): void { |
|
208 | 208 | $query->whereNull('sosa_fat.majs_i_id') |
209 | 209 | ->orWhereNull('sosa_mot.majs_i_id'); |
210 | 210 | }) |
211 | 211 | ->groupBy('sosa.majs_i_id', 'sosa_fat.majs_i_id', 'sosa_mot.majs_i_id') |
212 | - ->orderByRaw('MIN(' . $table_prefix . 'sosa.majs_sosa)') |
|
212 | + ->orderByRaw('MIN('.$table_prefix.'sosa.majs_sosa)') |
|
213 | 213 | ->get(); |
214 | 214 | } |
215 | 215 | |
@@ -261,29 +261,29 @@ discard block |
||
261 | 261 | $has_records = false; |
262 | 262 | foreach ($sosa_records as $i => $row) { |
263 | 263 | $gen = $this->generation($row['sosa']); |
264 | - if ($gen <= $this->maxSystemGenerations()) { |
|
264 | + if ($gen <= $this->maxSystemGenerations()) { |
|
265 | 265 | $has_records = true; |
266 | 266 | if ($mass_update) { |
267 | - $bindings_placeholders[] = '(:tree_id' . $i . ', :user_id' . $i . ', :sosa' . $i . ',' . |
|
268 | - ' :indi_id' . $i . ', :gen' . $i . ',' . |
|
269 | - ' :byear' . $i . ', :byearest' . $i . ', :dyear' . $i . ', :dyearest' . $i . ')'; |
|
267 | + $bindings_placeholders[] = '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.','. |
|
268 | + ' :indi_id'.$i.', :gen'.$i.','. |
|
269 | + ' :byear'.$i.', :byearest'.$i.', :dyear'.$i.', :dyearest'.$i.')'; |
|
270 | 270 | $bindings_values = array_merge( |
271 | 271 | $bindings_values, |
272 | 272 | [ |
273 | - 'tree_id' . $i => $tree->id(), |
|
274 | - 'user_id' . $i => $user->id(), |
|
275 | - 'sosa' . $i => $row['sosa'], |
|
276 | - 'indi_id' . $i => $row['indi'], |
|
277 | - 'gen' . $i => $gen, |
|
278 | - 'byear' . $i => $row['birth_year'], |
|
279 | - 'byearest' . $i => $row['birth_year_est'], |
|
280 | - 'dyear' . $i => $row['death_year'], |
|
281 | - 'dyearest' . $i => $row['death_year_est'] |
|
273 | + 'tree_id'.$i => $tree->id(), |
|
274 | + 'user_id'.$i => $user->id(), |
|
275 | + 'sosa'.$i => $row['sosa'], |
|
276 | + 'indi_id'.$i => $row['indi'], |
|
277 | + 'gen'.$i => $gen, |
|
278 | + 'byear'.$i => $row['birth_year'], |
|
279 | + 'byearest'.$i => $row['birth_year_est'], |
|
280 | + 'dyear'.$i => $row['death_year'], |
|
281 | + 'dyearest'.$i => $row['death_year_est'] |
|
282 | 282 | ] |
283 | 283 | ); |
284 | 284 | } else { |
285 | 285 | DB::table('maj_sosa')->updateOrInsert( |
286 | - [ 'majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
286 | + ['majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
287 | 287 | [ |
288 | 288 | 'majs_i_id' => $row['indi'], |
289 | 289 | 'majs_gen' => $gen, |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | |
300 | 300 | if ($has_records && $mass_update) { |
301 | 301 | DB::connection()->statement( |
302 | - 'INSERT INTO `' . DB::connection()->getTablePrefix() . 'maj_sosa`' . |
|
303 | - ' (majs_gedcom_id, majs_user_id, majs_sosa,' . |
|
304 | - ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)' . |
|
305 | - ' VALUES ' . implode(',', $bindings_placeholders) . |
|
306 | - ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),' . |
|
307 | - ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),' . |
|
302 | + 'INSERT INTO `'.DB::connection()->getTablePrefix().'maj_sosa`'. |
|
303 | + ' (majs_gedcom_id, majs_user_id, majs_sosa,'. |
|
304 | + ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)'. |
|
305 | + ' VALUES '.implode(',', $bindings_placeholders). |
|
306 | + ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),'. |
|
307 | + ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),'. |
|
308 | 308 | ' majs_death_year = VALUES(majs_death_year), majs_death_year_est = VALUES(majs_death_year_est)', |
309 | 309 | $bindings_values |
310 | 310 | ); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | if ($ancestor === null || !$ancestor->canShow()) { |
79 | 79 | continue; |
80 | 80 | } |
81 | - $generation = $this->records_service->generation((int) $item->majs_sosa); |
|
81 | + $generation = $this->records_service->generation((int)$item->majs_sosa); |
|
82 | 82 | $significantplace = new GeoAnalysisPlace($tree, null, $depth); |
83 | 83 | foreach ($this->significantPlaces($ancestor) as $place) { |
84 | 84 | $significantplace = new GeoAnalysisPlace($tree, $place, $depth, true); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | // How to update the database schema for this module |
77 | 77 | private const SCHEMA_TARGET_VERSION = 3; |
78 | 78 | private const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
79 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
79 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * {@inheritDoc} |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function loadRoutes(Map $router): void |
128 | 128 | { |
129 | - $router->attach('', '', static function (Map $router): void { |
|
129 | + $router->attach('', '', static function(Map $router): void { |
|
130 | 130 | |
131 | - $router->attach('', '/module-maj/geodispersion', static function (Map $router): void { |
|
132 | - $router->attach('', '/admin', static function (Map $router): void { |
|
131 | + $router->attach('', '/module-maj/geodispersion', static function(Map $router): void { |
|
132 | + $router->attach('', '/admin', static function(Map $router): void { |
|
133 | 133 | $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class); |
134 | 134 | |
135 | - $router->attach('', '/analysis-views/{tree}', static function (Map $router): void { |
|
135 | + $router->attach('', '/analysis-views/{tree}', static function(Map $router): void { |
|
136 | 136 | $router->tokens(['view_id' => '\d+', 'enable' => '[01]']); |
137 | 137 | $router->extras([ |
138 | 138 | 'middleware' => [ |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | //phpcs:enable |
152 | 152 | }); |
153 | 153 | |
154 | - $router->attach('', '/map-adapters/{tree}', static function (Map $router): void { |
|
154 | + $router->attach('', '/map-adapters/{tree}', static function(Map $router): void { |
|
155 | 155 | $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']); |
156 | 156 | $router->extras([ |
157 | 157 | 'middleware' => [ |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class); |
178 | 178 | |
179 | - $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void { |
|
179 | + $router->attach('', '/analysisview/{tree}/{view_id}', static function(Map $router): void { |
|
180 | 180 | $router->tokens(['view_id' => '\d+']); |
181 | 181 | $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class); |
182 | 182 | $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function headContent(): string |
216 | 216 | { |
217 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
217 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |