@@ -79,22 +79,22 @@ discard block |
||
| 79 | 79 | /** @var SosaStatisticsService $sosa_stats_service */ |
| 80 | 80 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
| 81 | 81 | |
| 82 | - $current_gen = Validator::queryParams($request)->integer( |
|
| 82 | + $current_gen = Validator::queryParams($request)->integer( |
|
| 83 | 83 | 'gen', |
| 84 | 84 | Validator::attributes($request)->integer('gen', 0) |
| 85 | 85 | ); |
| 86 | 86 | |
| 87 | 87 | $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
| 88 | - $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
| 88 | + $nb_missing_diff = $list_missing->sum(function(stdClass $value): int { |
|
| 89 | 89 | return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
| 92 | + $list_missing = $list_missing->map(function(stdClass $value) use ($tree): ?MissingAncestor { |
|
| 93 | 93 | $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
| 94 | 94 | if ($indi !== null && $indi->canShowName()) { |
| 95 | 95 | return new MissingAncestor( |
| 96 | 96 | $indi, |
| 97 | - (int) $value->majs_sosa, |
|
| 97 | + (int)$value->majs_sosa, |
|
| 98 | 98 | $value->majs_fat_id === null, |
| 99 | 99 | $value->majs_mot_id === null |
| 100 | 100 | ); |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | return null; |
| 103 | 103 | })->filter(); |
| 104 | 104 | |
| 105 | - $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
| 105 | + $nb_missing_shown = $list_missing->sum(function(MissingAncestor $value): int { |
|
| 106 | 106 | return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | - return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
| 109 | + return $this->viewResponse($this->module->name().'::list-missing-page', [ |
|
| 110 | 110 | 'module_name' => $this->module->name(), |
| 111 | 111 | 'title' => I18N::translate('Missing Ancestors'), |
| 112 | 112 | 'tree' => $tree, |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function maxGeneration(): int |
| 64 | 64 | { |
| 65 | - return (int) DB::table('maj_sosa') |
|
| 65 | + return (int)DB::table('maj_sosa') |
|
| 66 | 66 | ->where('majs_gedcom_id', '=', $this->tree->id()) |
| 67 | 67 | ->where('majs_user_id', '=', $this->user->id()) |
| 68 | 68 | ->max('majs_gen'); |
@@ -139,8 +139,7 @@ discard block |
||
| 139 | 139 | ->selectRaw('SUM(majs_gen * majs_gen) AS sum_x2') |
| 140 | 140 | ->get()->first(); |
| 141 | 141 | |
| 142 | - return $row->n == 0 ? 0 : |
|
| 143 | - -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / ($row->n * $row->sum_x2 - pow($row->sum_x, 2)); |
|
| 142 | + return $row->n == 0 ? 0 : -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / ($row->n * $row->sum_x2 - pow($row->sum_x, 2)); |
|
| 144 | 143 | } |
| 145 | 144 | |
| 146 | 145 | /** |
@@ -164,10 +163,10 @@ discard block |
||
| 164 | 163 | |
| 165 | 164 | $statistics_by_gen = []; |
| 166 | 165 | foreach ($stats_by_gen as $gen => $stats_gen) { |
| 167 | - $statistics_by_gen[(int) $stats_gen->gen] = array( |
|
| 168 | - 'sosaCount' => (int) $stats_gen->total_sosa, |
|
| 169 | - 'sosaTotalCount' => (int) $cumul_stats_by_gen[$gen]->total_cumul, |
|
| 170 | - 'diffSosaTotalCount' => (int) $cumul_stats_by_gen[$gen]->total_distinct_cumul, |
|
| 166 | + $statistics_by_gen[(int)$stats_gen->gen] = array( |
|
| 167 | + 'sosaCount' => (int)$stats_gen->total_sosa, |
|
| 168 | + 'sosaTotalCount' => (int)$cumul_stats_by_gen[$gen]->total_cumul, |
|
| 169 | + 'diffSosaTotalCount' => (int)$cumul_stats_by_gen[$gen]->total_distinct_cumul, |
|
| 171 | 170 | 'firstBirth' => $stats_gen->first_year, |
| 172 | 171 | 'firstEstimatedBirth' => $stats_gen->first_est_year, |
| 173 | 172 | 'lastBirth' => $stats_gen->last_year, |
@@ -211,7 +210,7 @@ discard block |
||
| 211 | 210 | ->where('majs_user_id', '=', $this->user->id()); |
| 212 | 211 | |
| 213 | 212 | return DB::table('maj_sosa') |
| 214 | - ->joinSub($list_gen, 'list_gen', function (JoinClause $join): void { |
|
| 213 | + ->joinSub($list_gen, 'list_gen', function(JoinClause $join): void { |
|
| 215 | 214 | $join->on('maj_sosa.majs_gen', '<=', 'list_gen.majs_gen') |
| 216 | 215 | ->where('majs_gedcom_id', '=', $this->tree->id()) |
| 217 | 216 | ->where('majs_user_id', '=', $this->user->id()); |
@@ -248,37 +247,37 @@ discard block |
||
| 248 | 247 | ->select(['list_gen.majs_gen AS gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id']) |
| 249 | 248 | ->addSelect(['sosa.majs_i_id', 'sosa.majs_gen']) |
| 250 | 249 | ->selectRaw( |
| 251 | - '(CASE ' . |
|
| 252 | - ' WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL' . |
|
| 253 | - ' THEN POWER(2, ' . $table_prefix . 'list_gen.majs_gen - ' . $table_prefix . 'sosa.majs_gen - 1)' . |
|
| 254 | - ' ELSE 0 ' . |
|
| 255 | - ' END)' . |
|
| 256 | - ' + (CASE ' . |
|
| 257 | - ' WHEN ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL' . |
|
| 258 | - ' THEN POWER(2, ' . $table_prefix . 'list_gen.majs_gen - ' . $table_prefix . 'sosa.majs_gen - 1)' . |
|
| 259 | - ' ELSE 0 ' . |
|
| 250 | + '(CASE '. |
|
| 251 | + ' WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL'. |
|
| 252 | + ' THEN POWER(2, '.$table_prefix.'list_gen.majs_gen - '.$table_prefix.'sosa.majs_gen - 1)'. |
|
| 253 | + ' ELSE 0 '. |
|
| 254 | + ' END)'. |
|
| 255 | + ' + (CASE '. |
|
| 256 | + ' WHEN '.$table_prefix.'sosa_mot.majs_i_id IS NULL'. |
|
| 257 | + ' THEN POWER(2, '.$table_prefix.'list_gen.majs_gen - '.$table_prefix.'sosa.majs_gen - 1)'. |
|
| 258 | + ' ELSE 0 '. |
|
| 260 | 259 | ' END) contrib' |
| 261 | 260 | ) |
| 262 | - ->joinSub($list_gen, 'list_gen', function (JoinClause $join): void { |
|
| 261 | + ->joinSub($list_gen, 'list_gen', function(JoinClause $join): void { |
|
| 263 | 262 | $join->on('sosa.majs_gen', '<', 'list_gen.majs_gen') |
| 264 | 263 | ->where('majs_gedcom_id', '=', $this->tree->id()) |
| 265 | 264 | ->where('majs_user_id', '=', $this->user->id()); |
| 266 | 265 | }) |
| 267 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void { |
|
| 266 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void { |
|
| 268 | 267 | // Link to sosa's father |
| 269 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 268 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 270 | 269 | ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id()) |
| 271 | 270 | ->where('sosa_fat.majs_user_id', '=', $this->user->id()); |
| 272 | 271 | }) |
| 273 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void { |
|
| 272 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void { |
|
| 274 | 273 | // Link to sosa's mother |
| 275 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 274 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 276 | 275 | ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id()) |
| 277 | 276 | ->where('sosa_mot.majs_user_id', '=', $this->user->id()); |
| 278 | 277 | }) |
| 279 | 278 | ->where('sosa.majs_gedcom_id', '=', $this->tree->id()) |
| 280 | 279 | ->where('sosa.majs_user_id', '=', $this->user->id()) |
| 281 | - ->where(function (Builder $query): void { |
|
| 280 | + ->where(function(Builder $query): void { |
|
| 282 | 281 | $query->whereNull('sosa_fat.majs_i_id') |
| 283 | 282 | ->orWhereNull('sosa_mot.majs_i_id'); |
| 284 | 283 | }); |
@@ -288,24 +287,24 @@ discard block |
||
| 288 | 287 | */ |
| 289 | 288 | $non_roots_ancestors = DB::table('maj_sosa AS sosa') |
| 290 | 289 | ->select(['sosa.majs_gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id', 'sosa.majs_sosa']) |
| 291 | - ->selectRaw('MAX(' . $table_prefix . 'sosa_anc.majs_sosa) - MIN(' . $table_prefix . 'sosa_anc.majs_sosa)' . |
|
| 290 | + ->selectRaw('MAX('.$table_prefix.'sosa_anc.majs_sosa) - MIN('.$table_prefix.'sosa_anc.majs_sosa)'. |
|
| 292 | 291 | ' AS full_ancestors') |
| 293 | - ->join('maj_sosa AS sosa_anc', function (JoinClause $join) use ($table_prefix): void { |
|
| 292 | + ->join('maj_sosa AS sosa_anc', function(JoinClause $join) use ($table_prefix): void { |
|
| 294 | 293 | $join->on('sosa.majs_gen', '<', 'sosa_anc.majs_gen') |
| 295 | - ->whereRaw('FLOOR(' . $table_prefix . 'sosa_anc.majs_sosa / POWER(2, ' . |
|
| 296 | - $table_prefix . 'sosa_anc.majs_gen - ' . $table_prefix . 'sosa.majs_gen)) = ' . |
|
| 297 | - $table_prefix . 'sosa.majs_sosa') |
|
| 294 | + ->whereRaw('FLOOR('.$table_prefix.'sosa_anc.majs_sosa / POWER(2, '. |
|
| 295 | + $table_prefix.'sosa_anc.majs_gen - '.$table_prefix.'sosa.majs_gen)) = '. |
|
| 296 | + $table_prefix.'sosa.majs_sosa') |
|
| 298 | 297 | ->where('sosa_anc.majs_gedcom_id', '=', $this->tree->id()) |
| 299 | 298 | ->where('sosa_anc.majs_user_id', '=', $this->user->id()); |
| 300 | 299 | }) |
| 301 | 300 | ->where('sosa.majs_gedcom_id', '=', $this->tree->id()) |
| 302 | 301 | ->where('sosa.majs_user_id', '=', $this->user->id()) |
| 303 | - ->whereIn('sosa_anc.majs_i_id', function (Builder $query) use ($table_prefix): void { |
|
| 302 | + ->whereIn('sosa_anc.majs_i_id', function(Builder $query) use ($table_prefix): void { |
|
| 304 | 303 | $query->from('maj_sosa AS sosa_gen') |
| 305 | 304 | ->select('sosa_gen.majs_i_id')->distinct() |
| 306 | 305 | ->where('sosa_gen.majs_gedcom_id', '=', $this->tree->id()) |
| 307 | 306 | ->where('sosa_gen.majs_user_id', '=', $this->user->id()) |
| 308 | - ->whereRaw($table_prefix . 'sosa_gen.majs_gen = ' . $table_prefix . 'sosa.majs_gen'); |
|
| 307 | + ->whereRaw($table_prefix.'sosa_gen.majs_gen = '.$table_prefix.'sosa.majs_gen'); |
|
| 309 | 308 | }) |
| 310 | 309 | ->groupBy(['sosa.majs_gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id', |
| 311 | 310 | 'sosa.majs_sosa', 'sosa.majs_i_id']); |
@@ -318,7 +317,7 @@ discard block |
||
| 318 | 317 | ->select(['sosa.majs_gen AS gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id']) |
| 319 | 318 | ->addSelect(['sosa.majs_i_id', 'sosa.majs_gen']) |
| 320 | 319 | ->selectRaw('1 AS contrib') |
| 321 | - ->leftJoinSub($non_roots_ancestors, 'nonroot', function (JoinClause $join): void { |
|
| 320 | + ->leftJoinSub($non_roots_ancestors, 'nonroot', function(JoinClause $join): void { |
|
| 322 | 321 | $join->on('sosa.majs_gen', '=', 'nonroot.majs_gen') |
| 323 | 322 | ->on('sosa.majs_sosa', '=', 'nonroot.majs_sosa') |
| 324 | 323 | ->where('nonroot.full_ancestors', '>', 0) |
@@ -336,9 +335,9 @@ discard block |
||
| 336 | 335 | ->fromSub($root_ancestors_contributions->unionAll($known_ancestors_contributions), 'sosa_contribs') |
| 337 | 336 | ->select(['sosa_contribs.gen', 'sosa_contribs.majs_gedcom_id', 'sosa_contribs.majs_user_id']) |
| 338 | 337 | ->addSelect(['sosa_contribs.majs_i_id', 'sosa_contribs.contrib']) |
| 339 | - ->selectRaw('COUNT(' . $table_prefix . 'sosa_contribs.majs_i_id) * ' . |
|
| 340 | - $table_prefix . 'sosa_contribs.contrib AS totalContrib') |
|
| 341 | - ->leftJoin('maj_sosa AS sosa_low', function (JoinClause $join): void { |
|
| 338 | + ->selectRaw('COUNT('.$table_prefix.'sosa_contribs.majs_i_id) * '. |
|
| 339 | + $table_prefix.'sosa_contribs.contrib AS totalContrib') |
|
| 340 | + ->leftJoin('maj_sosa AS sosa_low', function(JoinClause $join): void { |
|
| 342 | 341 | $join->on('sosa_low.majs_gen', '<', 'sosa_contribs.majs_gen') |
| 343 | 342 | ->on('sosa_low.majs_i_id', '=', 'sosa_contribs.majs_i_id') |
| 344 | 343 | ->where('sosa_low.majs_gedcom_id', '=', $this->tree->id()) |
@@ -359,9 +358,9 @@ discard block |
||
| 359 | 358 | |
| 360 | 359 | $pedi_collapse_by_gen = []; |
| 361 | 360 | foreach ($pedi_collapse_coll as $collapse_gen) { |
| 362 | - $pedi_collapse_by_gen[(int) $collapse_gen->gen] = array( |
|
| 363 | - 'pedi_collapse_roots' => (float) $collapse_gen->pedi_collapse_roots, |
|
| 364 | - 'pedi_collapse_xgen' => (float) $collapse_gen->pedi_collapse_xgen |
|
| 361 | + $pedi_collapse_by_gen[(int)$collapse_gen->gen] = array( |
|
| 362 | + 'pedi_collapse_roots' => (float)$collapse_gen->pedi_collapse_roots, |
|
| 363 | + 'pedi_collapse_xgen' => (float)$collapse_gen->pedi_collapse_xgen |
|
| 365 | 364 | ); |
| 366 | 365 | } |
| 367 | 366 | return $pedi_collapse_by_gen; |
@@ -389,26 +388,26 @@ discard block |
||
| 389 | 388 | { |
| 390 | 389 | $table_prefix = DB::connection()->getTablePrefix(); |
| 391 | 390 | $missing_ancestors_by_gen = DB::table('maj_sosa AS sosa') |
| 392 | - ->selectRaw($table_prefix . 'sosa.majs_gen - ? AS majs_gen_norm', [$gen]) |
|
| 393 | - ->selectRaw('FLOOR(((' . $table_prefix . 'sosa.majs_sosa / POW(2, ' . $table_prefix . 'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen]) //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 394 | - ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 395 | - ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 396 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void { |
|
| 391 | + ->selectRaw($table_prefix.'sosa.majs_gen - ? AS majs_gen_norm', [$gen]) |
|
| 392 | + ->selectRaw('FLOOR((('.$table_prefix.'sosa.majs_sosa / POW(2, '.$table_prefix.'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen]) //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 393 | + ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 394 | + ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 395 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void { |
|
| 397 | 396 | // Link to sosa's father |
| 398 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 397 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 399 | 398 | ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id()) |
| 400 | 399 | ->where('sosa_fat.majs_user_id', '=', $this->user->id()); |
| 401 | 400 | }) |
| 402 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void { |
|
| 401 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void { |
|
| 403 | 402 | // Link to sosa's mother |
| 404 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 403 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 405 | 404 | ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id()) |
| 406 | 405 | ->where('sosa_mot.majs_user_id', '=', $this->user->id()); |
| 407 | 406 | }) |
| 408 | 407 | ->where('sosa.majs_gedcom_id', '=', $this->tree->id()) |
| 409 | 408 | ->where('sosa.majs_user_id', '=', $this->user->id()) |
| 410 | 409 | ->where('sosa.majs_gen', '>=', $gen) |
| 411 | - ->where(function (Builder $query): void { |
|
| 410 | + ->where(function(Builder $query): void { |
|
| 412 | 411 | $query->whereNull('sosa_fat.majs_i_id') |
| 413 | 412 | ->orWhereNull('sosa_mot.majs_i_id'); |
| 414 | 413 | }) |
@@ -417,11 +416,11 @@ discard block |
||
| 417 | 416 | return DB::table('maj_sosa AS sosa_list') |
| 418 | 417 | ->select(['stats_by_gen.root_ancestor AS root_ancestor_sosa', 'sosa_list.majs_i_id as root_ancestor_id']) |
| 419 | 418 | ->selectRaw('1 + SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))) AS mean_gen_depth') //@phpcs:ignore Generic.Files.LineLength.TooLong |
| 420 | - ->selectRaw(' SQRT(' . |
|
| 421 | - ' SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm)))' . //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 422 | - ' - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))), 2)' . //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 419 | + ->selectRaw(' SQRT('. |
|
| 420 | + ' SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm)))'.//@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 421 | + ' - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) / (2 * POWER(2, majs_gen_norm))), 2)'.//@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 423 | 422 | ' ) AS stddev_gen_depth') |
| 424 | - ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function (JoinClause $join): void { |
|
| 423 | + ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function(JoinClause $join): void { |
|
| 425 | 424 | $join->on('sosa_list.majs_sosa', '=', 'stats_by_gen.root_ancestor') |
| 426 | 425 | ->where('sosa_list.majs_gedcom_id', '=', $this->tree->id()) |
| 427 | 426 | ->where('sosa_list.majs_user_id', '=', $this->user->id()); |
@@ -450,16 +449,16 @@ discard block |
||
| 450 | 449 | $table_prefix = DB::connection()->getTablePrefix(); |
| 451 | 450 | $multiple_ancestors = DB::table('maj_sosa AS sosa') |
| 452 | 451 | ->select('sosa.majs_i_id AS sosa_i_id') |
| 453 | - ->selectRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) AS sosa_count') |
|
| 454 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void { |
|
| 452 | + ->selectRaw('COUNT('.$table_prefix.'sosa.majs_sosa) AS sosa_count') |
|
| 453 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void { |
|
| 455 | 454 | // Link to sosa's father |
| 456 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 455 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 457 | 456 | ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id()) |
| 458 | 457 | ->where('sosa_fat.majs_user_id', '=', $this->user->id()); |
| 459 | 458 | }) |
| 460 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void { |
|
| 459 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void { |
|
| 461 | 460 | // Link to sosa's mother |
| 462 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 461 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 463 | 462 | ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id()) |
| 464 | 463 | ->where('sosa_mot.majs_user_id', '=', $this->user->id()); |
| 465 | 464 | }) |
@@ -468,15 +467,15 @@ discard block |
||
| 468 | 467 | ->whereNull('sosa_fat.majs_sosa') // We keep only root individuals, i.e. those with no father or mother |
| 469 | 468 | ->whereNull('sosa_mot.majs_sosa') |
| 470 | 469 | ->groupBy('sosa.majs_i_id') |
| 471 | - ->havingRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) > 1') // Limit to the duplicate sosas. |
|
| 472 | - ->orderByRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) DESC, MIN(' . $table_prefix . 'sosa.majs_sosa) ASC') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 470 | + ->havingRaw('COUNT('.$table_prefix.'sosa.majs_sosa) > 1') // Limit to the duplicate sosas. |
|
| 471 | + ->orderByRaw('COUNT('.$table_prefix.'sosa.majs_sosa) DESC, MIN('.$table_prefix.'sosa.majs_sosa) ASC') //@phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 473 | 472 | ->limit($limit + 1) // We want to select one more than required, for ties |
| 474 | 473 | ->get(); |
| 475 | 474 | |
| 476 | 475 | if ($multiple_ancestors->count() > $limit) { |
| 477 | 476 | $last_count = $multiple_ancestors->last()->sosa_count; |
| 478 | 477 | $multiple_ancestors = $multiple_ancestors->reject( |
| 479 | - fn (stdClass $element): bool => $element->sosa_count === $last_count |
|
| 478 | + fn (stdClass $element): bool => $element->sosa_count === $last_count |
|
| 480 | 479 | ); |
| 481 | 480 | } |
| 482 | 481 | return $multiple_ancestors; |
@@ -527,7 +526,7 @@ discard block |
||
| 527 | 526 | ->rightJoinSub( |
| 528 | 527 | $consolidated_ancestors_branches, |
| 529 | 528 | 'indi_branch_consolidated', |
| 530 | - function (JoinClause $join) use ($gen): void { |
|
| 529 | + function(JoinClause $join) use ($gen): void { |
|
| 531 | 530 | $join->where('maj_sosa.majs_gedcom_id', '=', $this->tree->id()) |
| 532 | 531 | ->where('maj_sosa.majs_user_id', '=', $this->user->id()) |
| 533 | 532 | ->where('branches', '>', 0) |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | public function sosaNumbers(Tree $tree, UserInterface $user, Individual $indi): Collection |
| 99 | 99 | { |
| 100 | 100 | return Registry::cache()->array()->remember( |
| 101 | - 'sosanumbers-' . $indi->xref() . '@' . $tree->id() . '-' . $user->id(), |
|
| 102 | - function () use ($tree, $user, $indi): Collection { |
|
| 101 | + 'sosanumbers-'.$indi->xref().'@'.$tree->id().'-'.$user->id(), |
|
| 102 | + function() use ($tree, $user, $indi): Collection { |
|
| 103 | 103 | return DB::table('maj_sosa') |
| 104 | 104 | ->select(['majs_sosa', 'majs_gen']) |
| 105 | 105 | ->where('majs_gedcom_id', '=', $tree->id()) |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $table_prefix = DB::connection()->getTablePrefix(); |
| 161 | 161 | return DB::table('families') |
| 162 | - ->join('maj_sosa AS sosa_husb', function (JoinClause $join) use ($tree, $user): void { |
|
| 162 | + ->join('maj_sosa AS sosa_husb', function(JoinClause $join) use ($tree, $user): void { |
|
| 163 | 163 | // Link to family husband |
| 164 | 164 | $join->on('families.f_file', '=', 'sosa_husb.majs_gedcom_id') |
| 165 | 165 | ->on('families.f_husb', '=', 'sosa_husb.majs_i_id') |
| 166 | 166 | ->where('sosa_husb.majs_gedcom_id', '=', $tree->id()) |
| 167 | 167 | ->where('sosa_husb.majs_user_id', '=', $user->id()); |
| 168 | 168 | }) |
| 169 | - ->join('maj_sosa AS sosa_wife', function (JoinClause $join) use ($tree, $user): void { |
|
| 169 | + ->join('maj_sosa AS sosa_wife', function(JoinClause $join) use ($tree, $user): void { |
|
| 170 | 170 | // Link to family husband |
| 171 | 171 | $join->on('families.f_file', '=', 'sosa_wife.majs_gedcom_id') |
| 172 | 172 | ->on('families.f_wife', '=', 'sosa_wife.majs_i_id') |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | }) |
| 176 | 176 | ->select(['sosa_husb.majs_sosa', 'families.f_id']) |
| 177 | 177 | ->where('sosa_husb.majs_gen', '=', $gen) |
| 178 | - ->whereRaw($table_prefix . 'sosa_husb.majs_sosa + 1 = ' . $table_prefix . 'sosa_wife.majs_sosa') |
|
| 178 | + ->whereRaw($table_prefix.'sosa_husb.majs_sosa + 1 = '.$table_prefix.'sosa_wife.majs_sosa') |
|
| 179 | 179 | ->orderBy('sosa_husb.majs_sosa') |
| 180 | 180 | ->get(); |
| 181 | 181 | } |
@@ -198,28 +198,28 @@ discard block |
||
| 198 | 198 | $table_prefix = DB::connection()->getTablePrefix(); |
| 199 | 199 | return DB::table('maj_sosa AS sosa') |
| 200 | 200 | ->select(['sosa.majs_i_id', 'sosa_fat.majs_i_id AS majs_fat_id', 'sosa_mot.majs_i_id AS majs_mot_id']) |
| 201 | - ->selectRaw('MIN(' . $table_prefix . 'sosa.majs_sosa) AS majs_sosa') |
|
| 202 | - ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 201 | + ->selectRaw('MIN('.$table_prefix.'sosa.majs_sosa) AS majs_sosa') |
|
| 202 | + ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 203 | 203 | // Link to sosa's father |
| 204 | - $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa') |
|
| 204 | + $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa') |
|
| 205 | 205 | ->where('sosa_fat.majs_gedcom_id', '=', $tree->id()) |
| 206 | 206 | ->where('sosa_fat.majs_user_id', '=', $user->id()); |
| 207 | 207 | }) |
| 208 | - ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 208 | + ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($tree, $user, $table_prefix): void { |
|
| 209 | 209 | // Link to sosa's mother |
| 210 | - $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1') |
|
| 210 | + $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1') |
|
| 211 | 211 | ->where('sosa_mot.majs_gedcom_id', '=', $tree->id()) |
| 212 | 212 | ->where('sosa_mot.majs_user_id', '=', $user->id()); |
| 213 | 213 | }) |
| 214 | 214 | ->where('sosa.majs_gedcom_id', '=', $tree->id()) |
| 215 | 215 | ->where('sosa.majs_user_id', '=', $user->id()) |
| 216 | 216 | ->where('sosa.majs_gen', '=', $gen - 1) |
| 217 | - ->where(function (Builder $query): void { |
|
| 217 | + ->where(function(Builder $query): void { |
|
| 218 | 218 | $query->whereNull('sosa_fat.majs_i_id') |
| 219 | 219 | ->orWhereNull('sosa_mot.majs_i_id'); |
| 220 | 220 | }) |
| 221 | 221 | ->groupBy('sosa.majs_i_id', 'sosa_fat.majs_i_id', 'sosa_mot.majs_i_id') |
| 222 | - ->orderByRaw('MIN(' . $table_prefix . 'sosa.majs_sosa)') |
|
| 222 | + ->orderByRaw('MIN('.$table_prefix.'sosa.majs_sosa)') |
|
| 223 | 223 | ->get(); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -271,26 +271,26 @@ discard block |
||
| 271 | 271 | $has_records = false; |
| 272 | 272 | foreach ($sosa_records as $i => $row) { |
| 273 | 273 | $gen = $this->generation($row['sosa']); |
| 274 | - if ($gen <= $this->maxSystemGenerations()) { |
|
| 274 | + if ($gen <= $this->maxSystemGenerations()) { |
|
| 275 | 275 | $has_records = true; |
| 276 | 276 | if ($mass_update) { |
| 277 | - $bindings_placeholders[] = '(:tree_id' . $i . ', :user_id' . $i . ', :sosa' . $i . ',' . |
|
| 278 | - ' :indi_id' . $i . ', :gen' . $i . ',' . |
|
| 279 | - ' :byear' . $i . ', :byearest' . $i . ', :dyear' . $i . ', :dyearest' . $i . ')'; |
|
| 277 | + $bindings_placeholders[] = '(:tree_id'.$i.', :user_id'.$i.', :sosa'.$i.','. |
|
| 278 | + ' :indi_id'.$i.', :gen'.$i.','. |
|
| 279 | + ' :byear'.$i.', :byearest'.$i.', :dyear'.$i.', :dyearest'.$i.')'; |
|
| 280 | 280 | $bindings_values += [ |
| 281 | - 'tree_id' . $i => $tree->id(), |
|
| 282 | - 'user_id' . $i => $user->id(), |
|
| 283 | - 'sosa' . $i => $row['sosa'], |
|
| 284 | - 'indi_id' . $i => $row['indi'], |
|
| 285 | - 'gen' . $i => $gen, |
|
| 286 | - 'byear' . $i => $row['birth_year'], |
|
| 287 | - 'byearest' . $i => $row['birth_year_est'], |
|
| 288 | - 'dyear' . $i => $row['death_year'], |
|
| 289 | - 'dyearest' . $i => $row['death_year_est'] |
|
| 281 | + 'tree_id'.$i => $tree->id(), |
|
| 282 | + 'user_id'.$i => $user->id(), |
|
| 283 | + 'sosa'.$i => $row['sosa'], |
|
| 284 | + 'indi_id'.$i => $row['indi'], |
|
| 285 | + 'gen'.$i => $gen, |
|
| 286 | + 'byear'.$i => $row['birth_year'], |
|
| 287 | + 'byearest'.$i => $row['birth_year_est'], |
|
| 288 | + 'dyear'.$i => $row['death_year'], |
|
| 289 | + 'dyearest'.$i => $row['death_year_est'] |
|
| 290 | 290 | ]; |
| 291 | 291 | } else { |
| 292 | 292 | DB::table('maj_sosa')->updateOrInsert( |
| 293 | - [ 'majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
| 293 | + ['majs_gedcom_id' => $tree->id(), 'majs_user_id' => $user->id(), 'majs_sosa' => $row['sosa']], |
|
| 294 | 294 | [ |
| 295 | 295 | 'majs_i_id' => $row['indi'], |
| 296 | 296 | 'majs_gen' => $gen, |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | if ($has_records && $mass_update) { |
| 308 | 308 | DB::connection()->statement( |
| 309 | - 'INSERT INTO `' . DB::connection()->getTablePrefix() . 'maj_sosa`' . |
|
| 310 | - ' (majs_gedcom_id, majs_user_id, majs_sosa,' . |
|
| 311 | - ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)' . |
|
| 312 | - ' VALUES ' . implode(',', $bindings_placeholders) . |
|
| 313 | - ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),' . |
|
| 314 | - ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),' . |
|
| 309 | + 'INSERT INTO `'.DB::connection()->getTablePrefix().'maj_sosa`'. |
|
| 310 | + ' (majs_gedcom_id, majs_user_id, majs_sosa,'. |
|
| 311 | + ' majs_i_id, majs_gen, majs_birth_year, majs_birth_year_est, majs_death_year, majs_death_year_est)'. |
|
| 312 | + ' VALUES '.implode(',', $bindings_placeholders). |
|
| 313 | + ' ON DUPLICATE KEY UPDATE majs_i_id = VALUES(majs_i_id), majs_gen = VALUES(majs_gen),'. |
|
| 314 | + ' majs_birth_year = VALUES(majs_birth_year), majs_birth_year_est = VALUES(majs_birth_year_est),'. |
|
| 315 | 315 | ' majs_death_year = VALUES(majs_death_year), majs_death_year_est = VALUES(majs_death_year_est)', |
| 316 | 316 | $bindings_values |
| 317 | 317 | ); |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function loadRoutes(Map $router): void |
| 64 | 64 | { |
| 65 | - $router->attach('', '', static function (Map $router): void { |
|
| 65 | + $router->attach('', '', static function(Map $router): void { |
|
| 66 | 66 | |
| 67 | - $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void { |
|
| 67 | + $router->attach('', '/module-maj/welcomeblock/{block_id}', static function(Map $router): void { |
|
| 68 | 68 | $router->tokens(['block_id' => '\d+']); |
| 69 | 69 | $router->get(MatomoStats::class, '/matomostats', MatomoStats::class); |
| 70 | 70 | }); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class) |
| 95 | 95 | ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED); |
| 96 | 96 | |
| 97 | - $content = view($this->name() . '::block-embed', [ |
|
| 97 | + $content = view($this->name().'::block-embed', [ |
|
| 98 | 98 | 'block_id' => $block_id, |
| 99 | 99 | 'fab_welcome_block_view' => $fab_welcome_block_view, |
| 100 | 100 | 'fab_login_block_view' => $fab_login_block_view, |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function editBlockConfiguration(Tree $tree, int $block_id): string |
| 132 | 132 | { |
| 133 | - return view($this->name() . '::config', $this->matomoSettings($block_id)); |
|
| 133 | + return view($this->name().'::config', $this->matomoSettings($block_id)); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | $this |
| 163 | 163 | ->setBlockSetting($block_id, 'matomo_url', $matomo_url) |
| 164 | 164 | ->setBlockSetting($block_id, 'matomo_token', $matomo_token) |
| 165 | - ->setBlockSetting($block_id, 'matomo_siteid', (string) $matomo_siteid); |
|
| 165 | + ->setBlockSetting($block_id, 'matomo_siteid', (string)$matomo_siteid); |
|
| 166 | 166 | |
| 167 | - Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id); |
|
| 167 | + Registry::cache()->file()->forget($this->name().'-matomovisits-yearly-'.$block_id); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'matomo_enabled' => $this->isMatomoEnabled($block_id), |
| 191 | 191 | 'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'), |
| 192 | 192 | 'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'), |
| 193 | - 'matomo_siteid' => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0') |
|
| 193 | + 'matomo_siteid' => (int)$this->getBlockSetting($block_id, 'matomo_siteid', '0') |
|
| 194 | 194 | ]; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -59,24 +59,24 @@ |
||
| 59 | 59 | $initial = Validator::attributes($request)->string('alpha', ''); |
| 60 | 60 | |
| 61 | 61 | $initials_list = collect($this->module->surnameAlpha($tree, false, false, I18N::locale())) |
| 62 | - ->reject(function (int $count, string $initial): bool { |
|
| 62 | + ->reject(function(int $count, string $initial): bool { |
|
| 63 | 63 | return $initial === '@' || $initial === ','; |
| 64 | 64 | }); |
| 65 | 65 | |
| 66 | 66 | $show_all = Validator::queryParams($request)->string('show_all', 'no'); |
| 67 | 67 | |
| 68 | 68 | if ($show_all === 'yes') { |
| 69 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All'); |
|
| 69 | + $title = I18N::translate('Patronymic Lineages').' — '.I18N::translate('All'); |
|
| 70 | 70 | $surnames = $this->module->surnames($tree, '', '', false, false, I18N::locale()); |
| 71 | 71 | } elseif (mb_strlen($initial) == 1) { |
| 72 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial; |
|
| 72 | + $title = I18N::translate('Patronymic Lineages').' — '.$initial; |
|
| 73 | 73 | $surnames = $this->module->surnames($tree, '', $initial, false, false, I18N::locale()); |
| 74 | 74 | } else { |
| 75 | - $title = I18N::translate('Patronymic Lineages'); |
|
| 75 | + $title = I18N::translate('Patronymic Lineages'); |
|
| 76 | 76 | $surnames = []; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return $this->viewResponse($this->module->name() . '::surnames-page', [ |
|
| 79 | + return $this->viewResponse($this->module->name().'::surnames-page', [ |
|
| 80 | 80 | 'title' => $title, |
| 81 | 81 | 'module' => $this->module, |
| 82 | 82 | 'tree' => $tree, |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function loadRoutes(Map $router): void |
| 71 | 71 | { |
| 72 | - $router->attach('', '', static function (Map $router): void { |
|
| 72 | + $router->attach('', '', static function(Map $router): void { |
|
| 73 | 73 | |
| 74 | - $router->attach('', '/module-maj/lineages', static function (Map $router): void { |
|
| 74 | + $router->attach('', '/module-maj/lineages', static function(Map $router): void { |
|
| 75 | 75 | |
| 76 | - $router->attach('', '/Page', static function (Map $router): void { |
|
| 76 | + $router->attach('', '/Page', static function(Map $router): void { |
|
| 77 | 77 | |
| 78 | 78 | $router->get(SurnamesList::class, '/{tree}/list{/alpha}', SurnamesList::class); |
| 79 | 79 | $router->get(LineagesPage::class, '/{tree}/lineage/{surname}', LineagesPage::class); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function headContent(): string |
| 134 | 134 | { |
| 135 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 135 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | $module = $this->module; |
| 62 | 62 | $module_name = $this->module->name(); |
| 63 | 63 | return response(['data' => $this->taskschedules_service->all(true, true) |
| 64 | - ->map(function (TaskSchedule $schedule) use ($module, $module_name): array { |
|
| 64 | + ->map(function(TaskSchedule $schedule) use ($module, $module_name): array { |
|
| 65 | 65 | $task = $this->taskschedules_service->findTask($schedule->taskId()); |
| 66 | 66 | $task_name = $task !== null ? $task->name() : I18N::translate('Task not found'); |
| 67 | 67 | |
| 68 | 68 | return [ |
| 69 | - 'edit' => view($module_name . '::admin/tasks-table-options', [ |
|
| 69 | + 'edit' => view($module_name.'::admin/tasks-table-options', [ |
|
| 70 | 70 | 'task_sched_id' => $schedule->id(), |
| 71 | 71 | 'task_sched_enabled' => $schedule->isEnabled(), |
| 72 | 72 | 'task_edit_route' => route(TaskEditPage::class, ['task' => $schedule->id()]), |
@@ -76,38 +76,36 @@ discard block |
||
| 76 | 76 | ]) |
| 77 | 77 | ]), |
| 78 | 78 | 'status' => [ |
| 79 | - 'display' => view($module_name . '::components/yes-no-icons', [ |
|
| 79 | + 'display' => view($module_name.'::components/yes-no-icons', [ |
|
| 80 | 80 | 'yes' => $schedule->isEnabled() |
| 81 | 81 | ]), |
| 82 | 82 | 'raw' => $schedule->isEnabled() ? 1 : 0 |
| 83 | 83 | ], |
| 84 | 84 | 'task_name' => [ |
| 85 | - 'display' => '<bdi>' . e($task_name) . '</bdi>', |
|
| 85 | + 'display' => '<bdi>'.e($task_name).'</bdi>', |
|
| 86 | 86 | 'raw' => $task_name |
| 87 | 87 | ], |
| 88 | 88 | 'last_run' => [ |
| 89 | 89 | 'display' => $schedule->lastRunTime()->timestamp() === 0 ? |
| 90 | - view('components/datetime', ['timestamp' => $schedule->lastRunTime()]) : |
|
| 91 | - view('components/datetime-diff', ['timestamp' => $schedule->lastRunTime()]), |
|
| 90 | + view('components/datetime', ['timestamp' => $schedule->lastRunTime()]) : view('components/datetime-diff', ['timestamp' => $schedule->lastRunTime()]), |
|
| 92 | 91 | 'raw' => $schedule->lastRunTime()->timestamp() |
| 93 | 92 | ], |
| 94 | 93 | 'last_result' => [ |
| 95 | - 'display' => view($module_name . '::components/yes-no-icons', [ |
|
| 94 | + 'display' => view($module_name.'::components/yes-no-icons', [ |
|
| 96 | 95 | 'yes' => $schedule->wasLastRunSuccess() |
| 97 | 96 | ]), |
| 98 | 97 | 'raw' => $schedule->wasLastRunSuccess() ? 1 : 0 |
| 99 | 98 | ], |
| 100 | 99 | 'frequency' => |
| 101 | - '<bdi>' . e(CarbonInterval::minutes($schedule->frequency())->cascade()->forHumans()) . '</bdi>', |
|
| 100 | + '<bdi>'.e(CarbonInterval::minutes($schedule->frequency())->cascade()->forHumans()).'</bdi>', |
|
| 102 | 101 | 'nb_occurrences' => $schedule->remainingOccurrences() > 0 ? |
| 103 | - I18N::number($schedule->remainingOccurrences()) : |
|
| 104 | - I18N::translate('Unlimited'), |
|
| 105 | - 'running' => view($module_name . '::components/yes-no-icons', [ |
|
| 102 | + I18N::number($schedule->remainingOccurrences()) : I18N::translate('Unlimited'), |
|
| 103 | + 'running' => view($module_name.'::components/yes-no-icons', [ |
|
| 106 | 104 | 'yes' => $schedule->isRunning(), |
| 107 | 105 | 'text_yes' => I18N::translate('Running'), |
| 108 | 106 | 'text_no' => I18N::translate('Not running') |
| 109 | 107 | ]), |
| 110 | - 'run' => view($module_name . '::admin/tasks-table-run', [ |
|
| 108 | + 'run' => view($module_name.'::admin/tasks-table-run', [ |
|
| 111 | 109 | 'task_sched_id' => $schedule->id(), |
| 112 | 110 | 'run_route' => route(TaskTrigger::class, [ |
| 113 | 111 | 'task' => $schedule->taskId(), |
@@ -75,8 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | Validator::attributes($request)->boolean('enable', false) ? |
| 78 | - $task_schedule->enable() : |
|
| 79 | - $task_schedule->disable(); |
|
| 78 | + $task_schedule->enable() : $task_schedule->disable(); |
|
| 80 | 79 | |
| 81 | 80 | if ($this->taskschedules_service->update($task_schedule) > 0) { |
| 82 | 81 | FlashMessages::addMessage( |
@@ -84,14 +83,14 @@ discard block |
||
| 84 | 83 | 'success' |
| 85 | 84 | ); |
| 86 | 85 | //phpcs:ignore Generic.Files.LineLength.TooLong |
| 87 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.'); |
|
| 86 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.'); |
|
| 88 | 87 | } else { |
| 89 | 88 | FlashMessages::addMessage( |
| 90 | 89 | I18N::translate('An error occured while updating the scheduled task.'), |
| 91 | 90 | 'danger' |
| 92 | 91 | ); |
| 93 | 92 | //phpcs:ignore Generic.Files.LineLength.TooLong |
| 94 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.'); |
|
| 93 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.'); |
|
| 95 | 94 | } |
| 96 | 95 | |
| 97 | 96 | return redirect($admin_config_route); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | 'success' |
| 86 | 86 | ); |
| 87 | 87 | //phpcs:ignore Generic.Files.LineLength.TooLong |
| 88 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.'); |
|
| 88 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” has been updated.'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | return redirect($admin_config_route); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task.'), 'danger'); |
| 143 | 143 | //@phpcs:ignore Generic.Files.LineLength.TooLong |
| 144 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.'); |
|
| 144 | + Log::addConfigurationLog('Module '.$this->module->title().' : Task Schedule “'.$task_schedule->id().'” could not be updated. See error log.'); |
|
| 145 | 145 | return false; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | 'danger' |
| 174 | 174 | ); |
| 175 | 175 | //phpcs:ignore Generic.Files.LineLength.TooLong |
| 176 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.'); |
|
| 176 | + Log::addConfigurationLog('Module '.$this->module->title().' : AdminTask “'.$task->name().'” specific settings could not be updated. See error log.'); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return true; |