Completed
Pull Request — master (#1904)
by Rico
09:54
created
resources/views/lists/media-table.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 block discarded – undo
6 6
 // It is not good to bypass privacy, but many servers do not have the resources
7 7
 // to process privacy for every record in the tree
8 8
 $count_individuals = Database::prepare(
9
-	"SELECT l_to, COUNT(*) FROM `##individuals` JOIN `##link` ON l_from = i_id AND l_file = i_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
9
+    "SELECT l_to, COUNT(*) FROM `##individuals` JOIN `##link` ON l_from = i_id AND l_file = i_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
10 10
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
11 11
 $count_families    = Database::prepare(
12
-	"SELECT l_to, COUNT(*) FROM `##families` JOIN `##link` ON l_from = f_id AND l_file = f_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
12
+    "SELECT l_to, COUNT(*) FROM `##families` JOIN `##link` ON l_from = f_id AND l_file = f_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
13 13
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
14 14
 $count_sources     = Database::prepare(
15
-	"SELECT l_to, COUNT(*) FROM `##sources` JOIN `##link` ON l_from = s_id AND l_file = s_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
15
+    "SELECT l_to, COUNT(*) FROM `##sources` JOIN `##link` ON l_from = s_id AND l_file = s_file AND l_type = 'NOTE' AND l_file = :tree_id GROUP BY l_to"
16 16
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
17 17
 ?>
18 18
 
19 19
 <table
20 20
 	class="table table-bordered table-sm wt-table-media datatables"
21 21
 	data-columns="<?= e(json_encode([
22
-		null,
23
-		null,
24
-		['visible' => array_sum($count_individuals) > 0],
25
-		['visible' => array_sum($count_families) > 0],
26
-		['visible' => array_sum($count_sources) > 0],
27
-		['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
28
-	])) ?>"
22
+        null,
23
+        null,
24
+        ['visible' => array_sum($count_individuals) > 0],
25
+        ['visible' => array_sum($count_families) > 0],
26
+        ['visible' => array_sum($count_sources) > 0],
27
+        ['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
28
+    ])) ?>"
29 29
 	data-state-save="true"
30 30
 >
31 31
 	<caption class="sr-only">
Please login to merge, or discard this patch.
resources/views/lists/sources-table.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 // It is not good to bypass privacy, but many servers do not have the resources
7 7
 // to process privacy for every record in the tree
8 8
 $count_individuals = Database::prepare(
9
-	"SELECT l_to, COUNT(*) FROM `##individuals` JOIN `##link` ON l_from = i_id AND l_file = i_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
9
+    "SELECT l_to, COUNT(*) FROM `##individuals` JOIN `##link` ON l_from = i_id AND l_file = i_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
10 10
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
11 11
 $count_families    = Database::prepare(
12
-	"SELECT l_to, COUNT(*) FROM `##families` JOIN `##link` ON l_from = f_id AND l_file = f_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
12
+    "SELECT l_to, COUNT(*) FROM `##families` JOIN `##link` ON l_from = f_id AND l_file = f_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
13 13
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
14 14
 $count_media       = Database::prepare(
15
-	"SELECT l_to, COUNT(*) FROM `##media` JOIN `##link` ON l_from = m_id AND l_file = m_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
15
+    "SELECT l_to, COUNT(*) FROM `##media` JOIN `##link` ON l_from = m_id AND l_file = m_file AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
16 16
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
17 17
 $count_notes       = Database::prepare(
18
-	"SELECT l_to, COUNT(*) FROM `##other` JOIN `##link` ON l_from = o_id AND l_file = o_file AND o_type = 'NOTE' AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
18
+    "SELECT l_to, COUNT(*) FROM `##other` JOIN `##link` ON l_from = o_id AND l_file = o_file AND o_type = 'NOTE' AND l_type = 'SOUR' AND l_file = :tree_id GROUP BY l_to"
19 19
 )->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc();
20 20
 ?>
21 21
 
22 22
 <table
23 23
 	class="table table-bordered table-sm wt-table-source datatables d-none"
24 24
 	data-columns="<?= e(json_encode([
25
-		null,
26
-		null,
27
-		['visible' => array_sum($count_individuals) > 0],
28
-		['visible' => array_sum($count_families) > 0],
29
-		['visible' => array_sum($count_media) > 0],
30
-		['visible' => array_sum($count_notes) > 0],
31
-		['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
32
-	])) ?>"
25
+        null,
26
+        null,
27
+        ['visible' => array_sum($count_individuals) > 0],
28
+        ['visible' => array_sum($count_families) > 0],
29
+        ['visible' => array_sum($count_media) > 0],
30
+        ['visible' => array_sum($count_notes) > 0],
31
+        ['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
32
+    ])) ?>"
33 33
 	data-state-save="true"
34 34
 >
35 35
 	<caption class="sr-only">
Please login to merge, or discard this patch.
resources/views/lists/individuals-table.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 // Inititialise chart data
79 79
 $deat_by_age = [];
80 80
 for ($age = 0; $age <= $max_age; $age++) {
81
-	$deat_by_age[$age] = '';
81
+    $deat_by_age[$age] = '';
82 82
 }
83 83
 $birt_by_decade = [];
84 84
 $deat_by_decade = [];
85 85
 for ($year = 1550; $year < 2030; $year += 10) {
86
-	$birt_by_decade[$year] = '';
87
-	$deat_by_decade[$year] = '';
86
+    $birt_by_decade[$year] = '';
87
+    $deat_by_decade[$year] = '';
88 88
 }
89 89
 ?>
90 90
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				<th><?= I18N::translate('Given names') ?></th>
198 198
 				<th><?= I18N::translate('Surname') ?></th>
199 199
 				<th><?= /* I18N: Abbreviation for “Sosa-Stradonitz number”. This is an individual’s surname, so may need transliterating into non-latin alphabets. */
200
-					I18N::translate('Sosa') ?></th>
200
+                    I18N::translate('Sosa') ?></th>
201 201
 				<th><?= I18N::translate('Birth') ?></th>
202 202
 				<th>
203 203
 					<i class="icon-reminder" title="<?= I18N::translate('Anniversary') ?>"></i>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -319,8 +319,11 @@
 block discarded – undo
319 319
 					<?php if (!isset($unique_indis[$individual->getXref()]) && $age_at_death >= 0 && $age_at_death <= $max_age): ?>
320 320
 						<?php $deat_by_age[$age_at_death] .= $individual->getSex(); ?>
321 321
 					<?php endif ?>
322
-				<?php else: ?>
323
-					<?php $age_at_death = ''; ?>
322
+				<?php else {
323
+    : ?>
324
+					<?php $age_at_death = '';
325
+}
326
+?>
324 327
 					<?php $age_at_death_sort = PHP_INT_MAX; ?>
325 328
 				<?php endif ?>
326 329
 				<td class="center" data-sort="<?= e($age_at_death_sort) ?>">
Please login to merge, or discard this patch.
resources/views/lists/repositories-table.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 <table
14 14
 	class="table table-bordered table-sm wt-table-source datatables d-none"
15 15
 	data-columns="<?= e(json_encode([
16
-		null,
17
-		['visible' => array_sum($count_sources) > 0],
18
-		['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
19
-	])) ?>"
16
+        null,
17
+        ['visible' => array_sum($count_sources) > 0],
18
+        ['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
19
+    ])) ?>"
20 20
 	data-state-save="true"
21 21
 >
22 22
 	<caption class="sr-only">
Please login to merge, or discard this patch.
resources/views/lists/chart-by-age.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 $vmax   = 0;
7 7
 $avg    = 0;
8 8
 foreach ($data as $age => $v) {
9
-	$n      = strlen($v);
10
-	$vmax   = max($vmax, $n);
11
-	$agemax = max($agemax, $age);
12
-	$count += $n;
13
-	$avg += $age * $n;
9
+    $n      = strlen($v);
10
+    $vmax   = max($vmax, $n);
11
+    $agemax = max($agemax, $age);
12
+    $count += $n;
13
+    $avg += $age * $n;
14 14
 }
15 15
 if ($count < 1) {
16
-	return '';
16
+    return '';
17 17
 }
18 18
 $avg       = round($avg / $count);
19 19
 $chart_url = 'https://chart.googleapis.com/chart?cht=bvs'; // chart type
@@ -27,36 +27,36 @@  discard block
 block discarded – undo
27 27
 $chart_url .= '&amp;chm=V,FF0000,0,' . ($avg - 0.3) . ',1'; // average age line marker
28 28
 $chart_url .= '&amp;chxl=0:|'; // label
29 29
 for ($age = 0; $age <= $agemax; $age += 5) {
30
-	$chart_url .= $age . '|||||'; // x axis
30
+    $chart_url .= $age . '|||||'; // x axis
31 31
 }
32 32
 $chart_url .= '|1:||' . rawurlencode(I18N::percentage($vmax / $count)); // y axis
33 33
 $chart_url .= '|2:||';
34 34
 $step = $vmax;
35 35
 for ($d = $vmax; $d > 0; $d--) {
36
-	if ($vmax < ($d * 10 + 1) && ($vmax % $d) == 0) {
37
-		$step = $d;
38
-	}
36
+    if ($vmax < ($d * 10 + 1) && ($vmax % $d) == 0) {
37
+        $step = $d;
38
+    }
39 39
 }
40 40
 if ($step == $vmax) {
41
-	for ($d = $vmax - 1; $d > 0; $d--) {
42
-		if (($vmax - 1) < ($d * 10 + 1) && (($vmax - 1) % $d) == 0) {
43
-			$step = $d;
44
-		}
45
-	}
41
+    for ($d = $vmax - 1; $d > 0; $d--) {
42
+        if (($vmax - 1) < ($d * 10 + 1) && (($vmax - 1) % $d) == 0) {
43
+            $step = $d;
44
+        }
45
+    }
46 46
 }
47 47
 for ($n = $step; $n < $vmax; $n += $step) {
48
-	$chart_url .= $n . '|';
48
+    $chart_url .= $n . '|';
49 49
 }
50 50
 $chart_url .= rawurlencode($vmax . ' / ' . $count); // r axis
51 51
 $chart_url .= '&amp;chg=100,' . round(100 * $step / $vmax, 1) . ',1,5'; // grid
52 52
 $chart_url .= '&amp;chd=s:'; // data : simple encoding from A=0 to 9=61
53 53
 $CHART_ENCODING61 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
54 54
 for ($age = 0; $age <= $agemax; $age++) {
55
-	$chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'M') * 61 / $vmax)];
55
+    $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'M') * 61 / $vmax)];
56 56
 }
57 57
 $chart_url .= ',';
58 58
 for ($age = 0; $age <= $agemax; $age++) {
59
-	$chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'F') * 61 / $vmax)];
59
+    $chart_url .= $CHART_ENCODING61[(int) (substr_count($data[$age], 'F') * 61 / $vmax)];
60 60
 }
61 61
 $html = '<img src="' . $chart_url . '" alt="' . $title . '" title="' . $title . '" class="gchart">';
62 62
 
Please login to merge, or discard this patch.
resources/views/lists/families-table.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 // init chart data
71 71
 $marr_by_age = [];
72 72
 for ($age = 0; $age <= $max_age; $age++) {
73
-	$marr_by_age[$age] = '';
73
+    $marr_by_age[$age] = '';
74 74
 }
75 75
 $birt_by_decade = [];
76 76
 $marr_by_decade = [];
77 77
 for ($year = 1550; $year < 2030; $year += 10) {
78
-	$birt_by_decade[$year] = '';
79
-	$marr_by_decade[$year] = '';
78
+    $birt_by_decade[$year] = '';
79
+    $marr_by_decade[$year] = '';
80 80
 }
81 81
 ?>
82 82
 
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 
245 245
 				<!-- Husband age -->
246 246
 				<?php
247
-				$mdate = $family->getMarriageDate();
248
-				$hdate = $husb->getBirthDate();
249
-				if ($hdate->isOK() && $mdate->isOK()) {
250
-					if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) {
251
-						$birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
252
-					}
253
-					$hage = Date::getAge($hdate, $mdate, 0);
254
-					if ($hage >= 0 && $hage <= $max_age) {
255
-						$marr_by_age[$hage] .= $husb->getSex();
256
-					}
257
-				}
258
-				?>
247
+                $mdate = $family->getMarriageDate();
248
+                $hdate = $husb->getBirthDate();
249
+                if ($hdate->isOK() && $mdate->isOK()) {
250
+                    if ($hdate->gregorianYear() >= 1550 && $hdate->gregorianYear() < 2030) {
251
+                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
252
+                    }
253
+                    $hage = Date::getAge($hdate, $mdate, 0);
254
+                    if ($hage >= 0 && $hage <= $max_age) {
255
+                        $marr_by_age[$hage] .= $husb->getSex();
256
+                    }
257
+                }
258
+                ?>
259 259
 				<td class="center" data-sort="<?= Date::getAge($hdate, $mdate, 1) ?>">
260 260
 					<?= Date::getAge($hdate, $mdate, 2) ?>
261 261
 				</td>
@@ -280,17 +280,17 @@  discard block
 block discarded – undo
280 280
 
281 281
 				<!-- Wife age -->
282 282
 				<?php
283
-				$wdate = $wife->getBirthDate();
284
-				if ($wdate->isOK() && $mdate->isOK()) {
285
-					if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) {
286
-						$birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
287
-					}
288
-					$wage = Date::getAge($wdate, $mdate, 0);
289
-					if ($wage >= 0 && $wage <= $max_age) {
290
-						$marr_by_age[$wage] .= $wife->getSex();
291
-					}
292
-				}
293
-				?>
283
+                $wdate = $wife->getBirthDate();
284
+                if ($wdate->isOK() && $mdate->isOK()) {
285
+                    if ($wdate->gregorianYear() >= 1550 && $wdate->gregorianYear() < 2030) {
286
+                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
287
+                    }
288
+                    $wage = Date::getAge($wdate, $mdate, 0);
289
+                    if ($wage >= 0 && $wage <= $max_age) {
290
+                        $marr_by_age[$wage] .= $wife->getSex();
291
+                    }
292
+                }
293
+                ?>
294 294
 
295 295
 				<td class="center" data-sort="<?= Date::getAge($wdate, $mdate, 1) ?>">
296 296
 					<?= Date::getAge($wdate, $mdate, 2) ?>
Please login to merge, or discard this patch.
resources/views/lifespans-page.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
 		</label>
21 21
 		<div class="col-sm-9 wt-page-options-value">
22 22
 			<?= FunctionsEdit::formControlIndividual($tree, null, [
23
-				'id'   => 'addxref',
24
-				'name' => 'addxref',
25
-			]) ?>
23
+                'id'   => 'addxref',
24
+                'name' => 'addxref',
25
+            ]) ?>
26 26
 
27 27
 			<?= Bootstrap4::checkbox(/* I18N: Label for a configuration option */ I18N::translate('Include the individual’s immediate family'), false, ['name' => 'addfam']) ?>
28 28
 		</div>
Please login to merge, or discard this patch.
resources/views/layouts/default.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 				<?php if ($page_hits ?? 0 > 0): ?>
123 123
 				<div class="wt-page-views">
124 124
 					<?= I18N::plural('This page has been viewed %s time.', 'This page has been viewed %s times.', $page_hits,
125
-					'<span class="odometer">' . I18N::digits($page_hits) . '</span>') ?>
125
+                    '<span class="odometer">' . I18N::digits($page_hits) . '</span>') ?>
126 126
 				</div>
127 127
 				<?php endif ?>
128 128
 
Please login to merge, or discard this patch.
resources/views/relationships-page.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 		</label>
18 18
 		<div class="col-sm-9 wt-page-options-value">
19 19
 			<?= FunctionsEdit::formControlIndividual($tree, $individual1, [
20
-				'id'   => 'xref1',
21
-				'name' => 'xref1',
22
-			]) ?>
20
+                'id'   => 'xref1',
21
+                'name' => 'xref1',
22
+            ]) ?>
23 23
 			<button class="btn btn-link small" id="btn-swap-individuals" type="button">
24 24
 				<?= /* I18N: Reverse the order of two individuals */
25
-				I18N::translate('Swap individuals') ?>
25
+                I18N::translate('Swap individuals') ?>
26 26
 			</button>
27 27
 		</div>
28 28
 	</div>
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 		</label>
34 34
 		<div class="col-sm-9 wt-page-options-value">
35 35
 			<?= FunctionsEdit::formControlIndividual($tree, $individual2, [
36
-				'id'   => 'xref2',
37
-				'name' => 'xref2',
38
-			]) ?>
36
+                'id'   => 'xref2',
37
+                'name' => 'xref2',
38
+            ]) ?>
39 39
 		</div>
40 40
 	</div>
41 41
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 		<div class="col-form-label col-sm-3 wt-page-options-label"></div>
74 74
 		<div class="col-sm-9 wt-page-options-value">
75 75
 			<input class="btn btn-primary" type="submit" value="<?= /* I18N: A button label. */
76
-			I18N::translate('view') ?>">
76
+            I18N::translate('view') ?>">
77 77
 		</div>
78 78
 	</div>
79 79
 </form>
80 80
 
81 81
 <?php if ($individual1 !== null && $individual2 !== null): ?>
82 82
 	<div class="wt-ajax-load wt-page-content wt-chart wt-relationships-chart" data-ajax-url="<?= e(route('relationships-chart', [
83
-		'xref1'     => $individual1->getXref(),
84
-		'xref2'     => $individual2->getXref(),
85
-		'ged'       => $individual2->getTree()->getName(),
86
-		'recursion' => $recursion,
87
-		'ancestors' => $ancestors,
88
-	])) ?>"></div>
83
+        'xref1'     => $individual1->getXref(),
84
+        'xref2'     => $individual2->getXref(),
85
+        'ged'       => $individual2->getTree()->getName(),
86
+        'recursion' => $recursion,
87
+        'ancestors' => $ancestors,
88
+    ])) ?>"></div>
89 89
 <?php endif ?>
90 90
 
91 91
 <?php View::push('javascript') ?>
Please login to merge, or discard this patch.