@@ -346,7 +346,7 @@ |
||
346 | 346 | '_MBON', |
347 | 347 | '_NMR', |
348 | 348 | '_SEPR', |
349 | - '_SP_DEAT', // only used internally, not exported to a gedcom file |
|
349 | + '_SP_DEAT', // only used internally, not exported to a gedcom file |
|
350 | 350 | ]; |
351 | 351 | |
352 | 352 | public const CUSTOM_INDIVIDUAL_TAGS = [ |
@@ -346,7 +346,7 @@ |
||
346 | 346 | '_MBON', |
347 | 347 | '_NMR', |
348 | 348 | '_SEPR', |
349 | - '_SP_DEAT', // only used internally, not exported to a gedcom file |
|
349 | + '_SP_DEAT', // only used internally, not exported to a gedcom file |
|
350 | 350 | ]; |
351 | 351 | |
352 | 352 | public const CUSTOM_INDIVIDUAL_TAGS = [ |
@@ -98,8 +98,9 @@ |
||
98 | 98 | public function getHeight($renderer): float |
99 | 99 | { |
100 | 100 | $txt2 = $this->text; |
101 | - if (substr($txt2, -1) == "\n") |
|
102 | - $txt2 = substr($txt2, 0, -1); |
|
101 | + if (substr($txt2, -1) == "\n") { |
|
102 | + $txt2 = substr($txt2, 0, -1); |
|
103 | + } |
|
103 | 104 | $ct = substr_count($txt2, "\n"); |
104 | 105 | if ($ct > 0) { |
105 | 106 | $ct += 1; |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | if (!empty($attrs['truncate'])) { |
1155 | 1155 | $value = strip_tags($value); |
1156 | 1156 | if ( (int) $attrs['truncate'] > 0 ) |
1157 | - $value = Str::limit($value, (int) $attrs['truncate'], I18N::translate('…')); |
|
1157 | + $value = Str::limit($value, (int) $attrs['truncate'], I18N::translate('…')); |
|
1158 | 1158 | } |
1159 | 1159 | $this->current_element->addText($value); |
1160 | 1160 | } |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | $value = "0"; |
1704 | 1704 | } |
1705 | 1705 | if ( isset($attrs['trim']) ) { |
1706 | - $value = str_replace($attrs['trim'], '', $value); |
|
1706 | + $value = str_replace($attrs['trim'], '', $value); |
|
1707 | 1707 | } |
1708 | 1708 | if (preg_match("/\\$(\w+)/", $name, $match)) { |
1709 | 1709 | $name = $this->vars["'" . $match[1] . "'"]['id']; |
@@ -3030,7 +3030,7 @@ discard block |
||
3030 | 3030 | $child->generation = $list[$id]->generation ?? 1; |
3031 | 3031 | if ( $child->xref() != $person->xref() ) |
3032 | 3032 | $this->mfrelation[$child->xref()] = $this->mfrelation[$id] . "x"; |
3033 | - } |
|
3033 | + } |
|
3034 | 3034 | } |
3035 | 3035 | } |
3036 | 3036 | } |
@@ -828,21 +828,21 @@ discard block |
||
828 | 828 | // position of box absolute or relative, and possibly top and height |
829 | 829 | if (isset($attrs['pos'])) { |
830 | 830 | $pos = $attrs['pos']; |
831 | - if (substr($pos,0,3) == 'abs') { |
|
831 | + if (substr($pos, 0, 3) == 'abs') { |
|
832 | 832 | //-- check absolute or relative position |
833 | 833 | $top += -222000; |
834 | 834 | } |
835 | - if (substr($pos,0,3) == 'rel') { |
|
835 | + if (substr($pos, 0, 3) == 'rel') { |
|
836 | 836 | //-- check absolute or relative position |
837 | 837 | $top = -100000; |
838 | 838 | } |
839 | - if (substr($pos,3,3) == '_fh') { |
|
839 | + if (substr($pos, 3, 3) == '_fh') { |
|
840 | 840 | $top = -100012; |
841 | 841 | } |
842 | - if (substr($pos,3,3) == '_f2') { |
|
842 | + if (substr($pos, 3, 3) == '_f2') { |
|
843 | 843 | $top = -100018; |
844 | 844 | } |
845 | - if (substr($pos,6,5) == '_html') { |
|
845 | + if (substr($pos, 6, 5) == '_html') { |
|
846 | 846 | $top = -90012; |
847 | 847 | } |
848 | 848 | } |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | $nameselect = ""; |
1019 | - if ( isset($attrs['select']) ) { |
|
1019 | + if (isset($attrs['select'])) { |
|
1020 | 1020 | $nameselect = $attrs['select']; |
1021 | 1021 | } |
1022 | 1022 | $famrel = false; |
1023 | - if ( isset($attrs['fam_relation']) ) { |
|
1023 | + if (isset($attrs['fam_relation'])) { |
|
1024 | 1024 | $famrel = true; |
1025 | 1025 | } |
1026 | 1026 | if (!empty($id)) { |
@@ -1030,28 +1030,28 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | if (!$record->canShowName()) { |
1032 | 1032 | $this->current_element->addText(I18N::translate('Private')); |
1033 | - } else if ( $nameselect == 'latest' ) { |
|
1033 | + } else if ($nameselect == 'latest') { |
|
1034 | 1034 | $tmp = $record->getAllNames(); |
1035 | - $name = strip_tags($tmp[count($tmp)-1]['full']); |
|
1035 | + $name = strip_tags($tmp[count($tmp) - 1]['full']); |
|
1036 | 1036 | $this->current_element->addText(trim($name)); |
1037 | - } else if ( $nameselect == 'combined' ) { |
|
1037 | + } else if ($nameselect == 'combined') { |
|
1038 | 1038 | $tmp = $record->getAllNames(); |
1039 | - $name = $tmp[count($tmp)-1]['full']; |
|
1040 | - if ($ix1 = strpos($name,'<span class="starredname">')) { // '«' and '»' mark text for underlining |
|
1039 | + $name = $tmp[count($tmp) - 1]['full']; |
|
1040 | + if ($ix1 = strpos($name, '<span class="starredname">')) { // '«' and '»' mark text for underlining |
|
1041 | 1041 | $name = substr_replace($name, '«', $ix1, 26); |
1042 | - $ix1 = strpos($name,'</span>',$ix1); |
|
1042 | + $ix1 = strpos($name, '</span>', $ix1); |
|
1043 | 1043 | $name = substr_replace($name, '»', $ix1, 7); |
1044 | 1044 | } |
1045 | 1045 | $addname = strip_tags((string) $tmp[0]['surn']); |
1046 | - if ( !empty($addname) && !($addname==='@N.N.') && !str_contains($name,$addname) ) { |
|
1047 | - $name .= " ".I18N::translate('b.')." ".$addname; |
|
1046 | + if (!empty($addname) && !($addname === '@N.N.') && !str_contains($name, $addname)) { |
|
1047 | + $name .= " " . I18N::translate('b.') . " " . $addname; |
|
1048 | 1048 | } |
1049 | 1049 | $this->current_element->addText(trim($name)); |
1050 | 1050 | } else { |
1051 | 1051 | $name = $record->fullName(); |
1052 | 1052 | $name = strip_tags($name); |
1053 | 1053 | if (!empty($attrs['truncate'])) { |
1054 | - if ( (int) $attrs['truncate'] > 0 ) |
|
1054 | + if ((int) $attrs['truncate'] > 0) |
|
1055 | 1055 | $name = Str::limit($name, (int) $attrs['truncate'], I18N::translate('…')); |
1056 | 1056 | } else { |
1057 | 1057 | $addname = (string) $record->alternateName(); |
@@ -1063,8 +1063,8 @@ discard block |
||
1063 | 1063 | $this->current_element->addText(trim($name)); |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | - if ( $famrel && ($this->mfrelation[$record->xref()] != "") ) { |
|
1067 | - $this->current_element->addText(" (".(string) $this->mfrelation[$record->xref()].")"); |
|
1066 | + if ($famrel && ($this->mfrelation[$record->xref()] != "")) { |
|
1067 | + $this->current_element->addText(" (" . (string) $this->mfrelation[$record->xref()] . ")"); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
@@ -1112,11 +1112,11 @@ discard block |
||
1112 | 1112 | $value = $this->getGedcomValue($tag, $level, $this->gedrec); |
1113 | 1113 | switch (end($tags)) { |
1114 | 1114 | case 'DATE': |
1115 | - $tmp = new Date($value); |
|
1115 | + $tmp = new Date($value); |
|
1116 | 1116 | $dfmt = "%j %F %Y"; |
1117 | 1117 | if (!empty($attrs['truncate'])) { |
1118 | - if ( $attrs['truncate'] === "d" ) $dfmt = "%j %M %Y"; |
|
1119 | - if ( $attrs['truncate'] === "Y" ) $dfmt = "%Y"; |
|
1118 | + if ($attrs['truncate'] === "d") $dfmt = "%j %M %Y"; |
|
1119 | + if ($attrs['truncate'] === "Y") $dfmt = "%Y"; |
|
1120 | 1120 | } |
1121 | 1121 | $value = strip_tags($tmp->display(null, $dfmt)); |
1122 | 1122 | break; |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | |
1149 | 1149 | if (isset($attrs['lcfirst'])) { |
1150 | 1150 | $value = lcfirst($value); |
1151 | - $value = str_replace(["Å","Ä","Ö"], ["å","ä","ö"], $value); |
|
1151 | + $value = str_replace(["Å", "Ä", "Ö"], ["å", "ä", "ö"], $value); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | if (!empty($attrs['truncate'])) { |
1155 | 1155 | $value = strip_tags($value); |
1156 | - if ( (int) $attrs['truncate'] > 0 ) |
|
1156 | + if ((int) $attrs['truncate'] > 0) |
|
1157 | 1157 | $value = Str::limit($value, (int) $attrs['truncate'], I18N::translate('…')); |
1158 | 1158 | } |
1159 | 1159 | $this->current_element->addText($value); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | } |
1386 | 1386 | if (isset($attrs['cut'])) { |
1387 | 1387 | $cut = (int) $attrs['cut']; |
1388 | - $var = $cut >0 ? substr($var, 0, $cut) : substr($var, $cut); |
|
1388 | + $var = $cut > 0 ? substr($var, 0, $cut) : substr($var, $cut); |
|
1389 | 1389 | if ($cut == 0) $var = ""; |
1390 | 1390 | } |
1391 | 1391 | if (isset($attrs['lcfirst'])) { |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | // Resort facts in chronological order, if possible |
1498 | 1498 | $m = count($this->repeats) - 1; |
1499 | 1499 | $prevd = 0; |
1500 | - for ($i = 0; $i <= $m; $i ++) { // keep undated events after previous dated event |
|
1500 | + for ($i = 0; $i <= $m; $i++) { // keep undated events after previous dated event |
|
1501 | 1501 | if ($jdarr[$i] === 0) |
1502 | 1502 | $jdarr[$i] = $prevd; |
1503 | 1503 | else |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | |
1523 | 1523 | // Remove spouse deaths that are too late: after new marriage or own death |
1524 | 1524 | $currfam = ""; |
1525 | - for ($i = 0; $i <= count($this->repeats) - 1; $i ++) { |
|
1525 | + for ($i = 0; $i <= count($this->repeats) - 1; $i++) { |
|
1526 | 1526 | if (preg_match('/[1234] FAMS @(.+)@/', $this->repeats[$i], $match)) |
1527 | 1527 | $currfam = $match[1]; |
1528 | 1528 | if (preg_match('/_SP_DEAT.*\n2 DATE (.*)\n.*_O_FAM (.+)\n/', $this->repeats[$i], $match)) { |
@@ -1574,8 +1574,8 @@ discard block |
||
1574 | 1574 | $count = count($this->repeats); |
1575 | 1575 | $i = 0; |
1576 | 1576 | while ($i < $count) { |
1577 | - if (! isset($this->repeats[$i])) { |
|
1578 | - $i ++; |
|
1577 | + if (!isset($this->repeats[$i])) { |
|
1578 | + $i++; |
|
1579 | 1579 | continue; // this fact has been removed above, occured too late |
1580 | 1580 | } |
1581 | 1581 | $this->gedrec = $this->repeats[$i]; |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | $nnn = 0; |
1692 | 1692 | error_log("\n---- setvar start " . date("Y-m-d H:i:s") . " RPG " . __LINE__ . " " . $name . " -----\n", 3, "my-errors.log"); |
1693 | 1693 | foreach ($this->vars as $key => $val) { |
1694 | - if ($nnn -- < 0) |
|
1694 | + if ($nnn-- < 0) |
|
1695 | 1695 | error_log($key . "='" . $val['id'] . "'\n", 3, "my-errors.log"); |
1696 | 1696 | } |
1697 | 1697 | } |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | else |
1703 | 1703 | $value = "0"; |
1704 | 1704 | } |
1705 | - if ( isset($attrs['trim']) ) { |
|
1705 | + if (isset($attrs['trim'])) { |
|
1706 | 1706 | $value = str_replace($attrs['trim'], '', $value); |
1707 | 1707 | } |
1708 | 1708 | if (preg_match("/\\$(\w+)/", $name, $match)) { |
@@ -2889,7 +2889,7 @@ discard block |
||
2889 | 2889 | static $focusperson = true; |
2890 | 2890 | static $dupl = 1; |
2891 | 2891 | $sx = $person->sex(); |
2892 | - $rl="x"; // unknown |
|
2892 | + $rl = "x"; // unknown |
|
2893 | 2893 | if ($sx == "M") |
2894 | 2894 | $rl = "s"; // son |
2895 | 2895 | if ($sx == "F") |
@@ -2903,7 +2903,7 @@ discard block |
||
2903 | 2903 | $list[$pid] = $person; |
2904 | 2904 | } |
2905 | 2905 | else if (!$focusperson) { |
2906 | - $newpid = "D_".$dupl."_".$pid; |
|
2906 | + $newpid = "D_" . $dupl . "_" . $pid; |
|
2907 | 2907 | $list[$newpid] = $person; |
2908 | 2908 | } |
2909 | 2909 | if (!isset($list[$newpid]->generation)) { |
@@ -2939,14 +2939,14 @@ discard block |
||
2939 | 2939 | $this->mfrelation[$wife->xref()] = $this->mfrelation[$person->xref()] . "x"; |
2940 | 2940 | if ($wife->canShow()) |
2941 | 2941 | $list[$wife->xref()] = $wife; |
2942 | - if (! isset($wife->generation)) |
|
2942 | + if (!isset($wife->generation)) |
|
2943 | 2943 | $wife->generation = $person->generation; |
2944 | 2944 | $nam = $wife->getAllNames()[0]['fullNN']; |
2945 | 2945 | } else { |
2946 | 2946 | $this->mfrelation[$husband->xref()] = $this->mfrelation[$person->xref()] . "x"; |
2947 | 2947 | if ($husband->canShow()) |
2948 | 2948 | $list[$husband->xref()] = $husband; |
2949 | - if (! isset($husband->generation)) |
|
2949 | + if (!isset($husband->generation)) |
|
2950 | 2950 | $husband->generation = $person->generation; |
2951 | 2951 | $nam = $husband->getAllNames()[0]['fullNN']; |
2952 | 2952 | } |
@@ -2957,7 +2957,7 @@ discard block |
||
2957 | 2957 | if ($child) { |
2958 | 2958 | |
2959 | 2959 | $sx = $child->sex(); |
2960 | - $rl="x"; // unknown |
|
2960 | + $rl = "x"; // unknown |
|
2961 | 2961 | if ($sx == "M") |
2962 | 2962 | $rl = "s"; // son |
2963 | 2963 | if ($sx == "F") |
@@ -3000,7 +3000,7 @@ discard block |
||
3000 | 3000 | if (str_starts_with($id, 'empty')) { |
3001 | 3001 | continue; // id can be something like “empty7” |
3002 | 3002 | } |
3003 | - if (! isset($this->mfrelation[$id])) |
|
3003 | + if (!isset($this->mfrelation[$id])) |
|
3004 | 3004 | $this->mfrelation[$id] = ""; |
3005 | 3005 | $person = Registry::individualFactory()->make($id, $this->tree); |
3006 | 3006 | foreach ($person->childFamilies() as $family) { |
@@ -3028,7 +3028,7 @@ discard block |
||
3028 | 3028 | foreach ($family->children() as $child) { |
3029 | 3029 | $list[$child->xref()] = $child; |
3030 | 3030 | $child->generation = $list[$id]->generation ?? 1; |
3031 | - if ( $child->xref() != $person->xref() ) |
|
3031 | + if ($child->xref() != $person->xref()) |
|
3032 | 3032 | $this->mfrelation[$child->xref()] = $this->mfrelation[$id] . "x"; |
3033 | 3033 | } |
3034 | 3034 | } |
@@ -1037,7 +1037,8 @@ discard block |
||
1037 | 1037 | } else if ( $nameselect == 'combined' ) { |
1038 | 1038 | $tmp = $record->getAllNames(); |
1039 | 1039 | $name = $tmp[count($tmp)-1]['full']; |
1040 | - if ($ix1 = strpos($name,'<span class="starredname">')) { // '«' and '»' mark text for underlining |
|
1040 | + if ($ix1 = strpos($name,'<span class="starredname">')) { |
|
1041 | +// '«' and '»' mark text for underlining |
|
1041 | 1042 | $name = substr_replace($name, '«', $ix1, 26); |
1042 | 1043 | $ix1 = strpos($name,'</span>',$ix1); |
1043 | 1044 | $name = substr_replace($name, '»', $ix1, 7); |
@@ -1051,8 +1052,9 @@ discard block |
||
1051 | 1052 | $name = $record->fullName(); |
1052 | 1053 | $name = strip_tags($name); |
1053 | 1054 | if (!empty($attrs['truncate'])) { |
1054 | - if ( (int) $attrs['truncate'] > 0 ) |
|
1055 | - $name = Str::limit($name, (int) $attrs['truncate'], I18N::translate('…')); |
|
1055 | + if ( (int) $attrs['truncate'] > 0 ) { |
|
1056 | + $name = Str::limit($name, (int) $attrs['truncate'], I18N::translate('…')); |
|
1057 | + } |
|
1056 | 1058 | } else { |
1057 | 1059 | $addname = (string) $record->alternateName(); |
1058 | 1060 | $addname = strip_tags($addname); |
@@ -1115,8 +1117,12 @@ discard block |
||
1115 | 1117 | $tmp = new Date($value); |
1116 | 1118 | $dfmt = "%j %F %Y"; |
1117 | 1119 | if (!empty($attrs['truncate'])) { |
1118 | - if ( $attrs['truncate'] === "d" ) $dfmt = "%j %M %Y"; |
|
1119 | - if ( $attrs['truncate'] === "Y" ) $dfmt = "%Y"; |
|
1120 | + if ( $attrs['truncate'] === "d" ) { |
|
1121 | + $dfmt = "%j %M %Y"; |
|
1122 | + } |
|
1123 | + if ( $attrs['truncate'] === "Y" ) { |
|
1124 | + $dfmt = "%Y"; |
|
1125 | + } |
|
1120 | 1126 | } |
1121 | 1127 | $value = strip_tags($tmp->display(null, $dfmt)); |
1122 | 1128 | break; |
@@ -1153,8 +1159,9 @@ discard block |
||
1153 | 1159 | |
1154 | 1160 | if (!empty($attrs['truncate'])) { |
1155 | 1161 | $value = strip_tags($value); |
1156 | - if ( (int) $attrs['truncate'] > 0 ) |
|
1157 | - $value = Str::limit($value, (int) $attrs['truncate'], I18N::translate('…')); |
|
1162 | + if ( (int) $attrs['truncate'] > 0 ) { |
|
1163 | + $value = Str::limit($value, (int) $attrs['truncate'], I18N::translate('…')); |
|
1164 | + } |
|
1158 | 1165 | } |
1159 | 1166 | $this->current_element->addText($value); |
1160 | 1167 | } |
@@ -1386,7 +1393,9 @@ discard block |
||
1386 | 1393 | if (isset($attrs['cut'])) { |
1387 | 1394 | $cut = (int) $attrs['cut']; |
1388 | 1395 | $var = $cut >0 ? substr($var, 0, $cut) : substr($var, $cut); |
1389 | - if ($cut == 0) $var = ""; |
|
1396 | + if ($cut == 0) { |
|
1397 | + $var = ""; |
|
1398 | + } |
|
1390 | 1399 | } |
1391 | 1400 | if (isset($attrs['lcfirst'])) { |
1392 | 1401 | $var = lcfirst($var); |
@@ -1453,36 +1462,43 @@ discard block |
||
1453 | 1462 | $famid = $match[1]; |
1454 | 1463 | $fam = Registry::familyFactory()->make($match[1], $this->tree); |
1455 | 1464 | $dt = $this->getGedcomValue("MARR:DATE", 0, $fam->gedcom()); |
1456 | - if ($dt == "") |
|
1457 | - $dt = $this->getGedcomValue("ENGA:DATE", 0, $fam->gedcom()); |
|
1458 | - if ($dt == "" && $this->getGedcomValue("EVEN:TYPE", 0, $fam->gedcom()) == "Sambo") |
|
1459 | - $dt = $this->getGedcomValue("EVEN:DATE", 0, $fam->gedcom()); |
|
1465 | + if ($dt == "") { |
|
1466 | + $dt = $this->getGedcomValue("ENGA:DATE", 0, $fam->gedcom()); |
|
1467 | + } |
|
1468 | + if ($dt == "" && $this->getGedcomValue("EVEN:TYPE", 0, $fam->gedcom()) == "Sambo") { |
|
1469 | + $dt = $this->getGedcomValue("EVEN:DATE", 0, $fam->gedcom()); |
|
1470 | + } |
|
1460 | 1471 | $date = new Date($dt); |
1461 | 1472 | $jd = $date->julianDay(); |
1462 | 1473 | $jdarr[$key] = $jd; |
1463 | 1474 | // Divorce |
1464 | 1475 | $dt = $this->getGedcomValue("DIV:DATE", 0, $fam->gedcom()); |
1465 | - if ($dt != "") |
|
1466 | - $this->repeats[] = "1 DIV\n2 DATE " . $dt . "\n"; |
|
1476 | + if ($dt != "") { |
|
1477 | + $this->repeats[] = "1 DIV\n2 DATE " . $dt . "\n"; |
|
1478 | + } |
|
1467 | 1479 | // Separation // Doesn't work!! getGedComValue only reports the first event!! I.e. no match here |
1468 | 1480 | if ($this->getGedcomValue("EVEN:TYPE", 0, $fam->gedcom()) == "Separation") { |
1469 | 1481 | $dt = $this->getGedcomValue("EVEN:DATE", 0, $fam->gedcom()); |
1470 | - if ($dt != "") |
|
1471 | - $this->repeats[] = "1 EVEN\n2 TYPE Separation\n2 DATE " . $dt . "\n"; |
|
1482 | + if ($dt != "") { |
|
1483 | + $this->repeats[] = "1 EVEN\n2 TYPE Separation\n2 DATE " . $dt . "\n"; |
|
1484 | + } |
|
1472 | 1485 | } |
1473 | 1486 | // death of husband / wife |
1474 | 1487 | $husb = $fam->husband(); |
1475 | 1488 | $wife = $fam->wife(); |
1476 | - if ($this->getGedcomValue("SEX", 0, $this->gedrec) == "M") |
|
1477 | - $spouse = $wife; |
|
1478 | - else |
|
1479 | - $spouse = $husb; |
|
1480 | - if ($spouse) |
|
1481 | - $dt = $this->getGedcomValue("DEAT:DATE", 0, $spouse->gedcom()); |
|
1482 | - else |
|
1483 | - $dt = ""; |
|
1484 | - if ($dt != "") |
|
1485 | - $this->repeats[] = "1 _SP_DEAT\n2 DATE " . $dt . "\n2 _O_FAM " . $famid . "\n"; |
|
1489 | + if ($this->getGedcomValue("SEX", 0, $this->gedrec) == "M") { |
|
1490 | + $spouse = $wife; |
|
1491 | + } else { |
|
1492 | + $spouse = $husb; |
|
1493 | + } |
|
1494 | + if ($spouse) { |
|
1495 | + $dt = $this->getGedcomValue("DEAT:DATE", 0, $spouse->gedcom()); |
|
1496 | + } else { |
|
1497 | + $dt = ""; |
|
1498 | + } |
|
1499 | + if ($dt != "") { |
|
1500 | + $this->repeats[] = "1 _SP_DEAT\n2 DATE " . $dt . "\n2 _O_FAM " . $famid . "\n"; |
|
1501 | + } |
|
1486 | 1502 | } |
1487 | 1503 | } |
1488 | 1504 | // Find the dates for the facts that are found |
@@ -1497,11 +1513,13 @@ discard block |
||
1497 | 1513 | // Resort facts in chronological order, if possible |
1498 | 1514 | $m = count($this->repeats) - 1; |
1499 | 1515 | $prevd = 0; |
1500 | - for ($i = 0; $i <= $m; $i ++) { // keep undated events after previous dated event |
|
1501 | - if ($jdarr[$i] === 0) |
|
1502 | - $jdarr[$i] = $prevd; |
|
1503 | - else |
|
1504 | - $prevd = $jdarr[$i]; |
|
1516 | + for ($i = 0; $i <= $m; $i ++) { |
|
1517 | +// keep undated events after previous dated event |
|
1518 | + if ($jdarr[$i] === 0) { |
|
1519 | + $jdarr[$i] = $prevd; |
|
1520 | + } else { |
|
1521 | + $prevd = $jdarr[$i]; |
|
1522 | + } |
|
1505 | 1523 | } |
1506 | 1524 | |
1507 | 1525 | while ($m > 1) { |
@@ -1523,11 +1541,14 @@ discard block |
||
1523 | 1541 | // Remove spouse deaths that are too late: after new marriage or own death |
1524 | 1542 | $currfam = ""; |
1525 | 1543 | for ($i = 0; $i <= count($this->repeats) - 1; $i ++) { |
1526 | - if (preg_match('/[1234] FAMS @(.+)@/', $this->repeats[$i], $match)) |
|
1527 | - $currfam = $match[1]; |
|
1544 | + if (preg_match('/[1234] FAMS @(.+)@/', $this->repeats[$i], $match)) { |
|
1545 | + $currfam = $match[1]; |
|
1546 | + } |
|
1528 | 1547 | if (preg_match('/_SP_DEAT.*\n2 DATE (.*)\n.*_O_FAM (.+)\n/', $this->repeats[$i], $match)) { |
1529 | - if ($currfam != $match[2] || $i == count($this->repeats) - 1) |
|
1530 | - $this->repeats[$i] = "1 _XXX\n"; // ignore fact |
|
1548 | + if ($currfam != $match[2] || $i == count($this->repeats) - 1) { |
|
1549 | + $this->repeats[$i] = "1 _XXX\n"; |
|
1550 | + } |
|
1551 | + // ignore fact |
|
1531 | 1552 | } |
1532 | 1553 | } |
1533 | 1554 | } |
@@ -1648,8 +1669,11 @@ discard block |
||
1648 | 1669 | |
1649 | 1670 | $name = $attrs['name']; |
1650 | 1671 | $value = $attrs['value']; |
1651 | - if (isset($attrs['dumpvar'])) $dumpvar = $attrs['dumpvar']; |
|
1652 | - else $dumpvar = ""; |
|
1672 | + if (isset($attrs['dumpvar'])) { |
|
1673 | + $dumpvar = $attrs['dumpvar']; |
|
1674 | + } else { |
|
1675 | + $dumpvar = ""; |
|
1676 | + } |
|
1653 | 1677 | $match = []; |
1654 | 1678 | // Current GEDCOM record strings |
1655 | 1679 | if ($value === '@ID') { |
@@ -1661,17 +1685,19 @@ discard block |
||
1661 | 1685 | } elseif ($value === '@desc') { |
1662 | 1686 | $value = $this->desc; |
1663 | 1687 | } elseif ($value === '@format') { |
1664 | - if (isset($_GET["format"])) |
|
1665 | - $value = $_GET["format"]; |
|
1666 | - else |
|
1667 | - $value = ""; |
|
1688 | + if (isset($_GET["format"])) { |
|
1689 | + $value = $_GET["format"]; |
|
1690 | + } else { |
|
1691 | + $value = ""; |
|
1692 | + } |
|
1668 | 1693 | } elseif ($value === '@generation') { |
1669 | 1694 | $value = (string) $this->generation; |
1670 | 1695 | } elseif ($value === '@relation') { |
1671 | - if (isset($this->mfrelation[$this->xref()])) |
|
1672 | - $value = (string) $this->mfrelation[$this->xref()]; |
|
1673 | - else |
|
1674 | - $value = ""; |
|
1696 | + if (isset($this->mfrelation[$this->xref()])) { |
|
1697 | + $value = (string) $this->mfrelation[$this->xref()]; |
|
1698 | + } else { |
|
1699 | + $value = ""; |
|
1700 | + } |
|
1675 | 1701 | } elseif (preg_match("/@(\w+)/", $value, $match)) { |
1676 | 1702 | $gmatch = []; |
1677 | 1703 | if (preg_match("/\d $match[1] (.+)/", $this->gedrec, $gmatch)) { |
@@ -1680,27 +1706,30 @@ discard block |
||
1680 | 1706 | } elseif (preg_match("/@\\$(\w+)/", $value, $match)) { |
1681 | 1707 | if ($match[1] == "dump" && $this->vars['dval']['id'] > 0) { |
1682 | 1708 | // if ($this->vars[ 'dval' ]['id'] == 1001) |
1683 | - if ($dumpvar == "gedrec") |
|
1684 | - error_log("\n---- setvar start " . date("Y-m-d H:i:s") . " RPG " . __LINE__ . " " . $name . " gedcom=\n" . $this->gedrec . "\n", 3, "my-errors.log"); |
|
1685 | - else if ($dumpvar != "") |
|
1686 | - error_log("var: " . $dumpvar . " = " . $this->vars[$dumpvar]['id'] . "\n", 3, "my-errors.log"); |
|
1687 | - else { |
|
1688 | - if (isset($this->vars['dval']['id'])) |
|
1689 | - $nnn = $this->vars['dval']['id']; |
|
1690 | - else |
|
1691 | - $nnn = 0; |
|
1709 | + if ($dumpvar == "gedrec") { |
|
1710 | + error_log("\n---- setvar start " . date("Y-m-d H:i:s") . " RPG " . __LINE__ . " " . $name . " gedcom=\n" . $this->gedrec . "\n", 3, "my-errors.log"); |
|
1711 | + } else if ($dumpvar != "") { |
|
1712 | + error_log("var: " . $dumpvar . " = " . $this->vars[$dumpvar]['id'] . "\n", 3, "my-errors.log"); |
|
1713 | + } else { |
|
1714 | + if (isset($this->vars['dval']['id'])) { |
|
1715 | + $nnn = $this->vars['dval']['id']; |
|
1716 | + } else { |
|
1717 | + $nnn = 0; |
|
1718 | + } |
|
1692 | 1719 | error_log("\n---- setvar start " . date("Y-m-d H:i:s") . " RPG " . __LINE__ . " " . $name . " -----\n", 3, "my-errors.log"); |
1693 | 1720 | foreach ($this->vars as $key => $val) { |
1694 | - if ($nnn -- < 0) |
|
1695 | - error_log($key . "='" . $val['id'] . "'\n", 3, "my-errors.log"); |
|
1721 | + if ($nnn -- < 0) { |
|
1722 | + error_log($key . "='" . $val['id'] . "'\n", 3, "my-errors.log"); |
|
1723 | + } |
|
1696 | 1724 | } |
1697 | 1725 | } |
1698 | 1726 | } |
1699 | 1727 | $value = $this->vars[$match[1]]['id']; |
1700 | - if (isset($this->vars[$value]['id'])) |
|
1701 | - $value = '$' . $this->vars[$match[1]]['id']; |
|
1702 | - else |
|
1703 | - $value = "0"; |
|
1728 | + if (isset($this->vars[$value]['id'])) { |
|
1729 | + $value = '$' . $this->vars[$match[1]]['id']; |
|
1730 | + } else { |
|
1731 | + $value = "0"; |
|
1732 | + } |
|
1704 | 1733 | } |
1705 | 1734 | if ( isset($attrs['trim']) ) { |
1706 | 1735 | $value = str_replace($attrs['trim'], '', $value); |
@@ -1722,7 +1751,8 @@ discard block |
||
1722 | 1751 | } elseif (preg_match('/^I18N::translateContext\(\'(.+)\', *\'(.+)\'\)$/', $value, $match)) { |
1723 | 1752 | $value = I18N::translateContext($match[1], $match[2]); |
1724 | 1753 | } |
1725 | - if (isset($attrs['lcfirst'])) { // set 1st char to lower case |
|
1754 | + if (isset($attrs['lcfirst'])) { |
|
1755 | +// set 1st char to lower case |
|
1726 | 1756 | $value = lcfirst($value); |
1727 | 1757 | } |
1728 | 1758 | |
@@ -2711,10 +2741,13 @@ discard block |
||
2711 | 2741 | $genCounter = 1; |
2712 | 2742 | while (count($newarray) < count($this->list)) { |
2713 | 2743 | foreach ($this->list as $key => $value) { |
2714 | - if ($value->generation < 0) |
|
2715 | - $this->generation = -$value->generation; // indication of husband or wife |
|
2716 | - else |
|
2717 | - $this->generation = $value->generation; |
|
2744 | + if ($value->generation < 0) { |
|
2745 | + $this->generation = -$value->generation; |
|
2746 | + } |
|
2747 | + // indication of husband or wife |
|
2748 | + else { |
|
2749 | + $this->generation = $value->generation; |
|
2750 | + } |
|
2718 | 2751 | if ($this->generation == $genCounter) { |
2719 | 2752 | $newarray[$key] = (object) ['generation' => $this->generation]; |
2720 | 2753 | } |
@@ -2890,19 +2923,23 @@ discard block |
||
2890 | 2923 | static $dupl = 1; |
2891 | 2924 | $sx = $person->sex(); |
2892 | 2925 | $rl="x"; // unknown |
2893 | - if ($sx == "M") |
|
2894 | - $rl = "s"; // son |
|
2895 | - if ($sx == "F") |
|
2896 | - $rl = "d"; // daughter |
|
2897 | - if ($focusperson) |
|
2898 | - $this->mfrelation[$pid] = ""; |
|
2926 | + if ($sx == "M") { |
|
2927 | + $rl = "s"; |
|
2928 | + } |
|
2929 | + // son |
|
2930 | + if ($sx == "F") { |
|
2931 | + $rl = "d"; |
|
2932 | + } |
|
2933 | + // daughter |
|
2934 | + if ($focusperson) { |
|
2935 | + $this->mfrelation[$pid] = ""; |
|
2936 | + } |
|
2899 | 2937 | $nam = $person->getAllNames()[0]['fullNN']; |
2900 | 2938 | |
2901 | 2939 | $newpid = $pid; |
2902 | 2940 | if (!isset($list[$pid])) { |
2903 | 2941 | $list[$pid] = $person; |
2904 | - } |
|
2905 | - else if (!$focusperson) { |
|
2942 | + } else if (!$focusperson) { |
|
2906 | 2943 | $newpid = "D_".$dupl."_".$pid; |
2907 | 2944 | $list[$newpid] = $person; |
2908 | 2945 | } |
@@ -2937,17 +2974,21 @@ discard block |
||
2937 | 2974 | if ($husband && $wife) { |
2938 | 2975 | if ($husband->xref() == $person->xref()) { |
2939 | 2976 | $this->mfrelation[$wife->xref()] = $this->mfrelation[$person->xref()] . "x"; |
2940 | - if ($wife->canShow()) |
|
2941 | - $list[$wife->xref()] = $wife; |
|
2942 | - if (! isset($wife->generation)) |
|
2943 | - $wife->generation = $person->generation; |
|
2977 | + if ($wife->canShow()) { |
|
2978 | + $list[$wife->xref()] = $wife; |
|
2979 | + } |
|
2980 | + if (! isset($wife->generation)) { |
|
2981 | + $wife->generation = $person->generation; |
|
2982 | + } |
|
2944 | 2983 | $nam = $wife->getAllNames()[0]['fullNN']; |
2945 | 2984 | } else { |
2946 | 2985 | $this->mfrelation[$husband->xref()] = $this->mfrelation[$person->xref()] . "x"; |
2947 | - if ($husband->canShow()) |
|
2948 | - $list[$husband->xref()] = $husband; |
|
2949 | - if (! isset($husband->generation)) |
|
2950 | - $husband->generation = $person->generation; |
|
2986 | + if ($husband->canShow()) { |
|
2987 | + $list[$husband->xref()] = $husband; |
|
2988 | + } |
|
2989 | + if (! isset($husband->generation)) { |
|
2990 | + $husband->generation = $person->generation; |
|
2991 | + } |
|
2951 | 2992 | $nam = $husband->getAllNames()[0]['fullNN']; |
2952 | 2993 | } |
2953 | 2994 | } |
@@ -2958,10 +2999,14 @@ discard block |
||
2958 | 2999 | |
2959 | 3000 | $sx = $child->sex(); |
2960 | 3001 | $rl="x"; // unknown |
2961 | - if ($sx == "M") |
|
2962 | - $rl = "s"; // son |
|
2963 | - if ($sx == "F") |
|
2964 | - $rl = "d"; // daughter |
|
3002 | + if ($sx == "M") { |
|
3003 | + $rl = "s"; |
|
3004 | + } |
|
3005 | + // son |
|
3006 | + if ($sx == "F") { |
|
3007 | + $rl = "d"; |
|
3008 | + } |
|
3009 | + // daughter |
|
2965 | 3010 | $rl = $this->mfrelation[$person->xref()] . $rl; |
2966 | 3011 | $this->mfrelation[$child->xref()] = $rl; |
2967 | 3012 | if (isset($list[$pid]->generation)) { |
@@ -2973,8 +3018,10 @@ discard block |
||
2973 | 3018 | } |
2974 | 3019 | if ($generations == -1 || $list[$pid]->generation < $generations) { |
2975 | 3020 | foreach ($children as $child) { |
2976 | - if ($child->canShow()) |
|
2977 | - $this->addDescendancy($list, $child->xref(), $parents, $generations); // recurse on the childs family |
|
3021 | + if ($child->canShow()) { |
|
3022 | + $this->addDescendancy($list, $child->xref(), $parents, $generations); |
|
3023 | + } |
|
3024 | + // recurse on the childs family |
|
2978 | 3025 | } |
2979 | 3026 | } |
2980 | 3027 | } |
@@ -3000,8 +3047,9 @@ discard block |
||
3000 | 3047 | if (str_starts_with($id, 'empty')) { |
3001 | 3048 | continue; // id can be something like “empty7” |
3002 | 3049 | } |
3003 | - if (! isset($this->mfrelation[$id])) |
|
3004 | - $this->mfrelation[$id] = ""; |
|
3050 | + if (! isset($this->mfrelation[$id])) { |
|
3051 | + $this->mfrelation[$id] = ""; |
|
3052 | + } |
|
3005 | 3053 | $person = Registry::individualFactory()->make($id, $this->tree); |
3006 | 3054 | foreach ($person->childFamilies() as $family) { |
3007 | 3055 | $husband = $family->husband(); |
@@ -3028,8 +3076,9 @@ discard block |
||
3028 | 3076 | foreach ($family->children() as $child) { |
3029 | 3077 | $list[$child->xref()] = $child; |
3030 | 3078 | $child->generation = $list[$id]->generation ?? 1; |
3031 | - if ( $child->xref() != $person->xref() ) |
|
3032 | - $this->mfrelation[$child->xref()] = $this->mfrelation[$id] . "x"; |
|
3079 | + if ( $child->xref() != $person->xref() ) { |
|
3080 | + $this->mfrelation[$child->xref()] = $this->mfrelation[$id] . "x"; |
|
3081 | + } |
|
3033 | 3082 | } |
3034 | 3083 | } |
3035 | 3084 | } |
@@ -1143,7 +1143,7 @@ |
||
1143 | 1143 | $value = str_replace("\n", "<br>", $value); |
1144 | 1144 | //$value = strip_tags(Registry::markdownFactory()->autolink($value, $this->tree), ['br']); |
1145 | 1145 | } |
1146 | - $value = strtr($value, [MarkdownFactory::BREAK => ' ']); |
|
1146 | + $value = strtr($value, [MarkdownFactory::break => ' ']); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | if (isset($attrs['lcfirst'])) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $lastelement = $element; |
70 | 70 | } |
71 | 71 | } elseif ($element instanceof ReportHtmlImage) { |
72 | - $lastelement = $element; |
|
72 | + $lastelement = $element; |
|
73 | 73 | } elseif ($element instanceof ReportHtmlFootnote) { |
74 | 74 | // Check if the Footnote has been set with it’s link number |
75 | 75 | $renderer->checkFootnote($element); |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | if ($this->top < -110000) // pos='abs' |
141 | 141 | $this->top += 222000; |
142 | 142 | if ($this->top < -10000) { // <= -100000: both pdf and html; -100000 -- -90000: only html |
143 | - $this->top += 90000; //= ReportBaseElement::CURRENT_POSITION; |
|
143 | + $this->top += 90000; //= ReportBaseElement::CURRENT_POSITION; |
|
144 | 144 | if ($this->top < -9000) $this->top += 10000; |
145 | - $topstr = "top:".$this->top."pt;"; |
|
145 | + $topstr = "top:" . $this->top . "pt;"; |
|
146 | 146 | $align_Y = true; |
147 | 147 | } |
148 | 148 | if ($this->top === ReportBaseElement::CURRENT_POSITION) { |
@@ -137,11 +137,16 @@ discard block |
||
137 | 137 | // If current position (top) |
138 | 138 | $align_Y = false; |
139 | 139 | $topstr = ""; |
140 | - if ($this->top < -110000) // pos='abs' |
|
141 | - $this->top += 222000; |
|
142 | - if ($this->top < -10000) { // <= -100000: both pdf and html; -100000 -- -90000: only html |
|
140 | + if ($this->top < -110000) { |
|
141 | + // pos='abs' |
|
142 | + $this->top += 222000; |
|
143 | + } |
|
144 | + if ($this->top < -10000) { |
|
145 | +// <= -100000: both pdf and html; -100000 -- -90000: only html |
|
143 | 146 | $this->top += 90000; //= ReportBaseElement::CURRENT_POSITION; |
144 | - if ($this->top < -9000) $this->top += 10000; |
|
147 | + if ($this->top < -9000) { |
|
148 | + $this->top += 10000; |
|
149 | + } |
|
145 | 150 | $topstr = "top:".$this->top."pt;"; |
146 | 151 | $align_Y = true; |
147 | 152 | } |
@@ -239,10 +244,11 @@ discard block |
||
239 | 244 | $renderer->addMaxY($this->top + $cH); |
240 | 245 | |
241 | 246 | // Start to print HTML |
242 | - if (!$align_Y) |
|
243 | - echo '<div style="position:absolute;top:', $this->top, 'pt;'; |
|
244 | - else |
|
245 | - echo '<div style="position:relative;top:', $this->top, 'pt;'; |
|
247 | + if (!$align_Y) { |
|
248 | + echo '<div style="position:absolute;top:', $this->top, 'pt;'; |
|
249 | + } else { |
|
250 | + echo '<div style="position:relative;top:', $this->top, 'pt;'; |
|
251 | + } |
|
246 | 252 | //echo '<div style="position:relative;'; |
247 | 253 | // LTR (left) or RTL (right) |
248 | 254 | echo $renderer->alignRTL, ':', $cX, 'pt;'; |
@@ -258,15 +264,19 @@ discard block |
||
258 | 264 | // Border setup |
259 | 265 | if ($this->border) { |
260 | 266 | echo ' border:solid black 1pt;'; |
261 | - if (!$align_Y) |
|
262 | - echo 'width:', $this->width - 1 - $cP * 2, 'pt;height:', $cH - 1, 'pt;'; |
|
263 | - else |
|
264 | - echo 'width:', $this->width - 1 - $cP * 2, 'pt;height:auto;'; // height:',$this->height,'pt;'; //,$topstr; |
|
267 | + if (!$align_Y) { |
|
268 | + echo 'width:', $this->width - 1 - $cP * 2, 'pt;height:', $cH - 1, 'pt;'; |
|
269 | + } else { |
|
270 | + echo 'width:', $this->width - 1 - $cP * 2, 'pt;height:auto;'; |
|
271 | + } |
|
272 | + // height:',$this->height,'pt;'; //,$topstr; |
|
265 | 273 | } else { |
266 | - if (!$align_Y) |
|
267 | - echo 'width:', $this->width - $cP * 2, 'pt;height:', $cH, 'pt;'; |
|
268 | - else |
|
269 | - echo 'width:', $this->width - $cP * 2, 'pt;height:auto;'; //height:',$this->height,'pt;'; //,$topstr; |
|
274 | + if (!$align_Y) { |
|
275 | + echo 'width:', $this->width - $cP * 2, 'pt;height:', $cH, 'pt;'; |
|
276 | + } else { |
|
277 | + echo 'width:', $this->width - $cP * 2, 'pt;height:auto;'; |
|
278 | + } |
|
279 | + //height:',$this->height,'pt;'; //,$topstr; |
|
270 | 280 | } |
271 | 281 | echo '">'; |
272 | 282 |
@@ -327,7 +327,7 @@ |
||
327 | 327 | $element->render($renderer); |
328 | 328 | // If tcpdf has added a new page the left margin must be restored |
329 | 329 | if ($cPT != $renderer->tcpdf->getPage()) |
330 | - $renderer->tcpdf->setLeftMargin($cMT['left']); |
|
330 | + $renderer->tcpdf->setLeftMargin($cMT['left']); |
|
331 | 331 | } elseif ($element === 'footnotetexts') { |
332 | 332 | $renderer->footnotes(); |
333 | 333 | } elseif ($element === 'addpage') { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if ($this->top === ReportBaseElement::CURRENT_POSITION) { |
148 | 148 | $cY = $renderer->tcpdf->GetY(); |
149 | 149 | //-- check for space after the last picture |
150 | - if ($align_Y && ($cY < $lastBoxYfinal) ) |
|
150 | + if ($align_Y && ($cY < $lastBoxYfinal)) |
|
151 | 151 | $cY = $lastBoxYfinal; |
152 | 152 | } else { |
153 | 153 | $cY = $this->top; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $curr_P = $renderer->tcpdf->getPage(); |
352 | 352 | // New line and some clean up |
353 | 353 | if (!$this->newline) { |
354 | - $renderer->tcpdf->setXY($cX + $cW, $cY); // $curr_Y); |
|
354 | + $renderer->tcpdf->setXY($cX + $cW, $cY); // $curr_Y); |
|
355 | 355 | $renderer->lastCellHeight = $cH; |
356 | 356 | } else { |
357 | 357 | // addMarginX() also updates X |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $renderer->tcpdf->setY($min_Y); |
362 | 362 | } else { |
363 | 363 | // 15 is good enough, should be a more general value ($cH is too large!) |
364 | - $renderer->tcpdf->setY($curr_Y + ($cH>15?15:$cH)); |
|
364 | + $renderer->tcpdf->setY($curr_Y + ($cH > 15 ? 15 : $cH)); |
|
365 | 365 | } |
366 | 366 | $renderer->lastCellHeight = 0; |
367 | 367 | } |
@@ -96,7 +96,9 @@ discard block |
||
96 | 96 | if (!empty($lastelement)) { |
97 | 97 | if ($element instanceof ReportBaseImage) { |
98 | 98 | $imgH = $element->getHeight(); |
99 | - } else $imgH = 0; |
|
99 | + } else { |
|
100 | + $imgH = 0; |
|
101 | + } |
|
100 | 102 | $cX = $renderer->tcpdf->GetX(); |
101 | 103 | $newelements[] = $lastelement; |
102 | 104 | $lastelement = []; |
@@ -137,18 +139,22 @@ discard block |
||
137 | 139 | // If current position (top) |
138 | 140 | $align_Y = false; |
139 | 141 | $curr_P = $renderer->tcpdf->getPage(); |
140 | - if ($this->top < -95000) { // 90000: only html; 100000: both pdf and html |
|
142 | + if ($this->top < -95000) { |
|
143 | +// 90000: only html; 100000: both pdf and html |
|
141 | 144 | $align_Y = true; |
142 | 145 | } |
143 | - if ($this->top < -200000) // pos="abs" |
|
146 | + if ($this->top < -200000) { |
|
147 | + // pos="abs" |
|
144 | 148 | $this->top += 222000; |
145 | - else |
|
146 | - $this->top = ReportBaseElement::CURRENT_POSITION; |
|
149 | + } else { |
|
150 | + $this->top = ReportBaseElement::CURRENT_POSITION; |
|
151 | + } |
|
147 | 152 | if ($this->top === ReportBaseElement::CURRENT_POSITION) { |
148 | 153 | $cY = $renderer->tcpdf->GetY(); |
149 | 154 | //-- check for space after the last picture |
150 | - if ($align_Y && ($cY < $lastBoxYfinal) ) |
|
151 | - $cY = $lastBoxYfinal; |
|
155 | + if ($align_Y && ($cY < $lastBoxYfinal) ) { |
|
156 | + $cY = $lastBoxYfinal; |
|
157 | + } |
|
152 | 158 | } else { |
153 | 159 | $cY = $this->top; |
154 | 160 | $renderer->tcpdf->setY($cY); |
@@ -326,8 +332,9 @@ discard block |
||
326 | 332 | $cMT = $renderer->tcpdf->getMargins(); |
327 | 333 | $element->render($renderer); |
328 | 334 | // If tcpdf has added a new page the left margin must be restored |
329 | - if ($cPT != $renderer->tcpdf->getPage()) |
|
330 | - $renderer->tcpdf->setLeftMargin($cMT['left']); |
|
335 | + if ($cPT != $renderer->tcpdf->getPage()) { |
|
336 | + $renderer->tcpdf->setLeftMargin($cMT['left']); |
|
337 | + } |
|
331 | 338 | } elseif ($element === 'footnotetexts') { |
332 | 339 | $renderer->footnotes(); |
333 | 340 | } elseif ($element === 'addpage') { |
@@ -202,8 +202,8 @@ |
||
202 | 202 | echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottom_margin - $this->footer_margin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; |
203 | 203 | echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">'; |
204 | 204 | } else { |
205 | - echo '<div id="bottommargin" style="position: relative; top: '.$this->Y.'pt; height: ', $this->bottom_margin - $this->footer_margin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; |
|
206 | - echo '<div id="footerdiv" style="position: relative; top: '.$this->Y.'pt; width: ', $this->noMarginWidth, 'pt;height:auto;">'; |
|
205 | + echo '<div id="bottommargin" style="position: relative; top: ' . $this->Y . 'pt; height: ', $this->bottom_margin - $this->footer_margin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; |
|
206 | + echo '<div id="footerdiv" style="position: relative; top: ' . $this->Y . 'pt; width: ', $this->noMarginWidth, 'pt;height:auto;">'; |
|
207 | 207 | } |
208 | 208 | $this->Y = 0; |
209 | 209 | $this->X = 0; |
@@ -198,7 +198,8 @@ |
||
198 | 198 | //-- footer |
199 | 199 | echo '</div>'; |
200 | 200 | //echo '<script>document.getElementById("bodydiv").style.height="', $this->maxY, 'pt";</script>'; |
201 | - if ($this->Y < 200) { //heuristic guess! |
|
201 | + if ($this->Y < 200) { |
|
202 | +//heuristic guess! |
|
202 | 203 | echo '<div id="bottommargin" style="position: relative; top: auto; height: ', $this->bottom_margin - $this->footer_margin, 'pt;width:', $this->noMarginWidth, 'pt;"></div>'; |
203 | 204 | echo '<div id="footerdiv" style="position: relative; top: auto; width: ', $this->noMarginWidth, 'pt;height:auto;">'; |
204 | 205 | } else { |