summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-03-08 09:27:31 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-03-08 13:55:26 +0000
commit3d61243a4fdc86b69bf167d00ad585d3e25bcbc9 (patch)
tree4e5882e666999ffd4c6d9323a420eeb271f50f69
parent1afd8fb8ec6b95d0719e0a266a25e8ef0190c467 (diff)
downloadwebtrees-3d61243a4fdc86b69bf167d00ad585d3e25bcbc9.tar.gz
webtrees-3d61243a4fdc86b69bf167d00ad585d3e25bcbc9.tar.bz2
webtrees-3d61243a4fdc86b69bf167d00ad585d3e25bcbc9.zip
Simplify logic
-rw-r--r--app/Functions/FunctionsCharts.php56
1 files changed, 26 insertions, 30 deletions
diff --git a/app/Functions/FunctionsCharts.php b/app/Functions/FunctionsCharts.php
index 3fe6988f5e..273bd4b010 100644
--- a/app/Functions/FunctionsCharts.php
+++ b/app/Functions/FunctionsCharts.php
@@ -80,7 +80,7 @@ class FunctionsCharts
echo (string) $sosa;
if ($sosa !== 1 && $pid !== '' && $icon !== '') {
echo '<br>';
- echo '<a href="#' . e($pid) . '">' . e($pid);
+ echo '<a href="#' . e($pid) . '">';
echo view($icon);
echo '</a>';
}
@@ -146,12 +146,11 @@ class FunctionsCharts
echo '</td>';
// husband’s parents
$hfam = $husb->primaryChildFamily();
- if ($hfam) {
- // remove the|| test for $sosa
+ if ($hfam instanceof Family) {
echo '<td rowspan="2"><img src="' . e(asset('css/images/hline.png')) . '"></td><td rowspan="2"><img src="' . e(asset('css/images/vline.png')) . '" width="3" height="' . ($pbheight - 14) . '"></td>';
echo '<td><img class="linea1 lined1" src="' . e(asset('css/images/hline.png')) . '"></td><td>';
// husband’s father
- if ($hfam && $hfam->husband()) {
+ if ($hfam->husband() instanceof Individual) {
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
if ($sosa > 0) {
self::printSosaNumber($sosa * 4, $hfam->husband()->xref(), 'icons/arrow-down');
@@ -162,24 +161,23 @@ class FunctionsCharts
echo '<td>';
echo FunctionsPrint::printPedigreePerson($hfam->husband());
echo '</td></tr></table>';
- } elseif ($hfam && !$hfam->husband()) {
+ } else {
// Empty box for grandfather
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
echo '<td>';
- echo FunctionsPrint::printPedigreePerson($hfam->husband());
+ echo FunctionsPrint::printPedigreePerson(null);
echo '</td></tr></table>';
}
echo '</td>';
- }
- if ($hfam && ($sosa !== -1)) {
- echo '<td rowspan="2">';
- echo '<a href="' . ($sosa === 0 ? $hfam->url() : '#' . $hfam->xref()) . '">' . view('icons/arrow-right') . '</a>';
- echo '</td>';
- }
- if ($hfam) {
+ if ($sosa !== -1) {
+ echo '<td rowspan="2">';
+ echo '<a href="' . ($sosa === 0 ? $hfam->url() : '#' . $hfam->xref()) . '">' . view('icons/arrow-right') . '</a>';
+ echo '</td>';
+ }
+
// husband’s mother
echo '</tr><tr><td><img class="linea2 lined2" src="' . e(asset('css/images/hline.png')) . '"></td><td>';
- if ($hfam && $hfam->wife()) {
+ if ($hfam->wife() instanceof Individual) {
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
if ($sosa > 0) {
self::printSosaNumber($sosa * 4 + 1, $hfam->wife()->xref(), 'icons/arrow-down');
@@ -190,11 +188,11 @@ class FunctionsCharts
echo '<td>';
echo FunctionsPrint::printPedigreePerson($hfam->wife());
echo '</td></tr></table>';
- } elseif ($hfam && !$hfam->wife()) {
+ } else {
// Empty box for grandmother
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
echo '<td>';
- echo FunctionsPrint::printPedigreePerson($hfam->wife());
+ echo FunctionsPrint::printPedigreePerson(null);
echo '</td></tr></table>';
}
echo '</td>';
@@ -234,11 +232,11 @@ class FunctionsCharts
echo '</td>';
// wife’s parents
$wfam = $wife->primaryChildFamily();
- if ($wfam) {
+ if ($wfam instanceof Family) {
echo '<td rowspan="2"><img src="' . e(asset('css/images/hline.png')) . '"></td><td rowspan="2"><img src="' . e(asset('css/images/vline.png')) . '" width="3" height="' . ($pbheight - 14) . '"></td>';
echo '<td><img class="linea3 lined3" src="' . e(asset('css/images/hline.png')) . '"></td><td>';
// wife’s father
- if ($wfam && $wfam->husband()) {
+ if ($wfam->husband() instanceof Individual) {
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
if ($sosa > 0) {
self::printSosaNumber($sosa * 4 + 2, $wfam->husband()->xref(), 'icons/arrow-down');
@@ -249,24 +247,22 @@ class FunctionsCharts
echo '<td>';
echo FunctionsPrint::printPedigreePerson($wfam->husband());
echo '</td></tr></table>';
- } elseif ($wfam && !$wfam->husband()) {
+ } else {
// Empty box for grandfather
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
echo '<td>';
- echo FunctionsPrint::printPedigreePerson($wfam->husband());
+ echo FunctionsPrint::printPedigreePerson(null);
echo '</td></tr></table>';
}
echo '</td>';
- }
- if ($wfam && ($sosa !== -1)) {
- echo '<td rowspan="2">';
- echo '<a href="' . ($sosa === 0 ? $wfam->url() : '#' . $wfam->xref()) . '">' . view('icons/arrow-right') . '</a>';
- echo '</td>';
- }
- if ($wfam) {
+ if ($sosa !== -1) {
+ echo '<td rowspan="2">';
+ echo '<a href="' . ($sosa === 0 ? $wfam->url() : '#' . $wfam->xref()) . '">' . view('icons/arrow-right') . '</a>';
+ echo '</td>';
+ }
// wife’s mother
echo '</tr><tr><td><img class="linea4 lined4" src="' . e(asset('css/images/hline.png')) . '"></td><td>';
- if ($wfam && $wfam->wife()) {
+ if ($wfam->wife() instanceof Individual) {
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
if ($sosa > 0) {
self::printSosaNumber($sosa * 4 + 3, $wfam->wife()->xref(), 'icons/arrow-down');
@@ -277,11 +273,11 @@ class FunctionsCharts
echo '<td>';
echo FunctionsPrint::printPedigreePerson($wfam->wife());
echo '</td></tr></table>';
- } elseif ($wfam && !$wfam->wife()) {
+ } else {
// Empty box for grandmother
echo '<table cellspacing="0" cellpadding="0" border="0"><tr>';
echo '<td>';
- echo FunctionsPrint::printPedigreePerson($wfam->wife());
+ echo FunctionsPrint::printPedigreePerson(null);
echo '</td></tr></table>';
}
echo '</td>';