1d70512abSGreg Roach<?php 2d70512abSGreg Roach 3054771e9SGreg Roachuse Fisharebest\Webtrees\Age; 4054771e9SGreg Roachuse Fisharebest\Webtrees\Fact; 554c1ab5eSGreg Roachuse Fisharebest\Webtrees\Family; 654c1ab5eSGreg Roachuse Fisharebest\Webtrees\I18N; 7d70512abSGreg Roachuse Fisharebest\Webtrees\Individual; 8d70512abSGreg Roach 92cebb4b4SGreg Roach/** 102cebb4b4SGreg Roach * @var int $baseyear 112cebb4b4SGreg Roach * @var int $bheight 12*36779af1SGreg Roach * @var array<int> $birthdays 13*36779af1SGreg Roach * @var array<int> $birthmonths 14*36779af1SGreg Roach * @var array<int> $birthyears 152cebb4b4SGreg Roach * @var int $scale 162cebb4b4SGreg Roach * @var int $topyear 172cebb4b4SGreg Roach * @var array<Fact> $indifacts 182cebb4b4SGreg Roach * @var array<Individual> $individuals 192cebb4b4SGreg Roach */ 202cebb4b4SGreg Roach 21d70512abSGreg Roach?> 22eca4a663SGreg Roach 23eca4a663SGreg Roach<script> 24728c8c27SGreg Roach let bottomy = <?= json_encode(($topyear - $baseyear) * $scale - 5, JSON_THROW_ON_ERROR) ?>; 252cebb4b4SGreg Roach let topy = 0; 262cebb4b4SGreg Roach let baseyear = <?= $baseyear - 25 / $scale ?>; 272cebb4b4SGreg Roach let birthyears = []; 282cebb4b4SGreg Roach let birthmonths = []; 292cebb4b4SGreg Roach let birthdays = []; 3054c1ab5eSGreg Roach <?php foreach ($individuals as $c => $indi) : ?> 31728c8c27SGreg Roach birthyears [<?= json_encode($c, JSON_THROW_ON_ERROR) ?>] = <?= json_encode($birthyears[$indi->xref()] ?? null, JSON_THROW_ON_ERROR) ?>; 32728c8c27SGreg Roach birthmonths[<?= json_encode($c, JSON_THROW_ON_ERROR) ?>] = <?= json_encode($birthmonths[$indi->xref()] ?? null, JSON_THROW_ON_ERROR) ?>; 33728c8c27SGreg Roach birthdays [<?= json_encode($c, JSON_THROW_ON_ERROR) ?>] = <?= json_encode($birthdays[$indi->xref()] ?? null, JSON_THROW_ON_ERROR) ?>; 3454c1ab5eSGreg Roach <?php endforeach ?> 35eca4a663SGreg Roach 36728c8c27SGreg Roach let bheight = <?= json_encode($bheight, JSON_THROW_ON_ERROR) ?>; 37728c8c27SGreg Roach let scale = <?= json_encode($scale, JSON_THROW_ON_ERROR) ?>; 38eca4a663SGreg Roach 39eca4a663SGreg Roach timeline_chart_div = document.getElementById("timeline_chart"); 40728c8c27SGreg Roach timeline_chart_div.style.height = '<?= json_encode(0 + ($topyear - $baseyear) * $scale * 1.1, JSON_THROW_ON_ERROR) ?>px'; 41eca4a663SGreg Roach 42eca4a663SGreg Roach /** 43eca4a663SGreg Roach * Find the position of an event, relative to an element. 44eca4a663SGreg Roach * 45eca4a663SGreg Roach * @param event 46eca4a663SGreg Roach * @param element 47eca4a663SGreg Roach */ 48eca4a663SGreg Roach function clickPosition(event, element) { 492cebb4b4SGreg Roach let xpos = event.pageX; 502cebb4b4SGreg Roach let ypos = event.pageY; 51eca4a663SGreg Roach 52eca4a663SGreg Roach if (element.offsetParent) { 53eca4a663SGreg Roach do { 54eca4a663SGreg Roach xpos -= element.offsetLeft; 55eca4a663SGreg Roach ypos -= element.offsetTop; 56eca4a663SGreg Roach } while (element = element.offsetParent); 57eca4a663SGreg Roach } 58eca4a663SGreg Roach 59eca4a663SGreg Roach return {x: xpos, y: ypos} 60eca4a663SGreg Roach } 61eca4a663SGreg Roach 622cebb4b4SGreg Roach let ob = null; 632cebb4b4SGreg Roach let Y = 0; 642cebb4b4SGreg Roach let X = 0; 652cebb4b4SGreg Roach let oldx = 0; 662cebb4b4SGreg Roach let oldlinew = 0; 672cebb4b4SGreg Roach let personnum = 0; 682cebb4b4SGreg Roach let type = 0; 692cebb4b4SGreg Roach let boxmean = 0; 70eca4a663SGreg Roach 71eca4a663SGreg Roach function ageCursorMouseDown(divbox, num) { 72eca4a663SGreg Roach ob = divbox; 73eca4a663SGreg Roach personnum = num; 74eca4a663SGreg Roach type = 0; 75eca4a663SGreg Roach X = ob.offsetLeft; 76eca4a663SGreg Roach Y = ob.offsetTop; 77eca4a663SGreg Roach } 78eca4a663SGreg Roach 79eca4a663SGreg Roach function factMouseDown(divbox, num, mean) { 80eca4a663SGreg Roach ob = divbox; 81eca4a663SGreg Roach personnum = num; 82eca4a663SGreg Roach boxmean = mean; 83eca4a663SGreg Roach type = 1; 84eca4a663SGreg Roach oldx = ob.offsetLeft; 85eca4a663SGreg Roach oldlinew = 0; 86eca4a663SGreg Roach } 87eca4a663SGreg Roach 88eca4a663SGreg Roach document.onmousemove = function (e) { 892cebb4b4SGreg Roach let textDirection = document.documentElement.dir; 90eca4a663SGreg Roach 91eca4a663SGreg Roach if (ob === null) { 92eca4a663SGreg Roach return true; 93eca4a663SGreg Roach } 942cebb4b4SGreg Roach let newx = 0; 952cebb4b4SGreg Roach let newy = 0; 96eca4a663SGreg Roach if (type === 0) { 97eca4a663SGreg Roach // age boxes 98eca4a663SGreg Roach newPosition = clickPosition(e, document.getElementById("timeline_chart")); 99eca4a663SGreg Roach newx = newPosition.x; 100eca4a663SGreg Roach newy = newPosition.y; 101eca4a663SGreg Roach 102eca4a663SGreg Roach if (oldx === 0) { 103eca4a663SGreg Roach oldx = newx; 104eca4a663SGreg Roach } 105eca4a663SGreg Roach if (newy < topy - bheight / 2) { 106eca4a663SGreg Roach newy = topy - bheight / 2; 107eca4a663SGreg Roach } 108eca4a663SGreg Roach if (newy > bottomy) { 109eca4a663SGreg Roach newy = bottomy - 1; 110eca4a663SGreg Roach } 111eca4a663SGreg Roach ob.style.top = newy + "px"; 1122cebb4b4SGreg Roach let tyear = (newy + bheight - 4 - topy + scale) / scale + baseyear; 1132cebb4b4SGreg Roach let year = Math.floor(tyear); 1142cebb4b4SGreg Roach let month = Math.floor(tyear * 12 - year * 12); 1152cebb4b4SGreg Roach let day = Math.floor(tyear * 365 - year * 365 - month * 30); 1162cebb4b4SGreg Roach let mstamp = year * 365 + month * 30 + day; 1172cebb4b4SGreg Roach let bdstamp = birthyears[personnum] * 365 + birthmonths[personnum] * 30 + birthdays[personnum]; 1182cebb4b4SGreg Roach let daydiff = mstamp - bdstamp; 1192cebb4b4SGreg Roach let ba = 1; 120eca4a663SGreg Roach if (daydiff < 0) { 121eca4a663SGreg Roach ba = -1; 122eca4a663SGreg Roach daydiff = (bdstamp - mstamp); 123eca4a663SGreg Roach } 1242cebb4b4SGreg Roach let yage = Math.floor(daydiff / 365); 1252cebb4b4SGreg Roach let mage = Math.floor((daydiff - yage * 365) / 30); 1262cebb4b4SGreg Roach let dage = Math.floor(daydiff - yage * 365 - mage * 30); 127eca4a663SGreg Roach if (dage < 0) { 128eca4a663SGreg Roach mage = mage - 1; 129eca4a663SGreg Roach } 130eca4a663SGreg Roach if (dage < -30) { 131eca4a663SGreg Roach dage = 30 + dage; 132eca4a663SGreg Roach } 133eca4a663SGreg Roach if (mage < 0) { 134eca4a663SGreg Roach yage = yage - 1; 135eca4a663SGreg Roach } 136eca4a663SGreg Roach if (mage < -11) { 137eca4a663SGreg Roach mage = 12 + mage; 138eca4a663SGreg Roach } 1392cebb4b4SGreg Roach let yearform = document.getElementById('yearform' + personnum); 1402cebb4b4SGreg Roach let ageform = document.getElementById('ageform' + personnum); 141eca4a663SGreg Roach yearform.innerHTML = year + " " + month + " <?= mb_substr(I18N::translate('Month:'), 0, 1) ?> " + day + " <?= mb_substr(I18N::translate('Day:'), 0, 1) ?>"; 142eca4a663SGreg Roach if (ba * yage > 1 || ba * yage < -1 || ba * yage === 0) { 143eca4a663SGreg Roach ageform.innerHTML = (ba * yage) + " <?= mb_substr(I18N::translate('years'), 0, 1) ?> " + (ba * mage) + " <?= mb_substr(I18N::translate('Month:'), 0, 1) ?> " + (ba * dage) + " <?= mb_substr(I18N::translate('Day:'), 0, 1) ?>"; 144eca4a663SGreg Roach } else { 145eca4a663SGreg Roach ageform.innerHTML = (ba * yage) + " <?= mb_substr(I18N::translate('Year:'), 0, 1) ?> " + (ba * mage) + " <?= mb_substr(I18N::translate('Month:'), 0, 1) ?> " + (ba * dage) + " <?= mb_substr(I18N::translate('Day:'), 0, 1) ?>"; 146eca4a663SGreg Roach } 1472cebb4b4SGreg Roach let line = document.getElementById('ageline' + personnum); 1482cebb4b4SGreg Roach let temp = newx - oldx; 149eca4a663SGreg Roach 150eca4a663SGreg Roach if (textDirection === 'rtl') { 151eca4a663SGreg Roach temp = temp * -1; 152eca4a663SGreg Roach } 153eca4a663SGreg Roach line.style.width = (line.width + temp) + "px"; 154eca4a663SGreg Roach oldx = newx; 155eca4a663SGreg Roach return false; 156eca4a663SGreg Roach } else { 157eca4a663SGreg Roach // fact boxes 1582cebb4b4SGreg Roach let linewidth; 159eca4a663SGreg Roach newPosition = clickPosition(e, document.getElementById("timeline_chart")); 160eca4a663SGreg Roach newx = newPosition.x; 161eca4a663SGreg Roach newy = newPosition.y; 162eca4a663SGreg Roach if (oldx === 0) { 163eca4a663SGreg Roach oldx = newx; 164eca4a663SGreg Roach } 165eca4a663SGreg Roach linewidth = e.pageX; 166eca4a663SGreg Roach 167eca4a663SGreg Roach // get diagnal line box 1682cebb4b4SGreg Roach let dbox = document.getElementById('dbox' + personnum); 1692cebb4b4SGreg Roach let etopy; 1702cebb4b4SGreg Roach let ebottomy; 171eca4a663SGreg Roach // set up limits 172eca4a663SGreg Roach if (boxmean - 175 < topy) { 173eca4a663SGreg Roach etopy = topy; 174eca4a663SGreg Roach } else { 175eca4a663SGreg Roach etopy = boxmean - 175; 176eca4a663SGreg Roach } 177eca4a663SGreg Roach if (boxmean + 175 > bottomy) { 178eca4a663SGreg Roach ebottomy = bottomy; 179eca4a663SGreg Roach } else { 180eca4a663SGreg Roach ebottomy = boxmean + 175; 181eca4a663SGreg Roach } 182eca4a663SGreg Roach // check if in the bounds of the limits 183eca4a663SGreg Roach if (newy < etopy) { 184eca4a663SGreg Roach newy = etopy; 185eca4a663SGreg Roach } 186eca4a663SGreg Roach if (newy > ebottomy) { 187eca4a663SGreg Roach newy = ebottomy; 188eca4a663SGreg Roach } 189eca4a663SGreg Roach // calculate the change in Y position 1902cebb4b4SGreg Roach let dy = newy - ob.offsetTop; 191eca4a663SGreg Roach // check if we are above the starting point and switch the background image 192eca4a663SGreg Roach 193eca4a663SGreg Roach if (newy < boxmean) { 194eca4a663SGreg Roach if (textDirection === 'rtl') { 195e837ff07SGreg Roach dbox.style.backgroundImage = "url('<?= asset('css/images/dline2.png') ?>')"; 196eca4a663SGreg Roach dbox.style.backgroundPosition = "0% 0%"; 197eca4a663SGreg Roach } else { 198e837ff07SGreg Roach dbox.style.backgroundImage = "url('<?= asset('css/images/dline.png') ?>')"; 199eca4a663SGreg Roach dbox.style.backgroundPosition = "0% 100%"; 200eca4a663SGreg Roach } 201eca4a663SGreg Roach dy = -dy; 202eca4a663SGreg Roach dbox.style.top = (newy + bheight / 3) + "px"; 203eca4a663SGreg Roach } else { 204eca4a663SGreg Roach if (textDirection === 'rtl') { 205e837ff07SGreg Roach dbox.style.backgroundImage = "url('<?= asset('css/images/dline.png') ?>')"; 206eca4a663SGreg Roach dbox.style.backgroundPosition = "0% 100%"; 207eca4a663SGreg Roach } else { 208e837ff07SGreg Roach dbox.style.backgroundImage = "url('<?= asset('css/images/dline2.png') ?>')"; 209eca4a663SGreg Roach dbox.style.backgroundPosition = "0% 0%"; 210eca4a663SGreg Roach } 211eca4a663SGreg Roach 212eca4a663SGreg Roach dbox.style.top = (boxmean + bheight / 3) + "px"; 213eca4a663SGreg Roach } 214eca4a663SGreg Roach // the new X posistion moves the same as the y position 215eca4a663SGreg Roach if (textDirection === 'rtl') { 216eca4a663SGreg Roach newx = dbox.offsetRight + Math.abs(newy - boxmean); 217eca4a663SGreg Roach } else { 218eca4a663SGreg Roach newx = dbox.offsetLeft + Math.abs(newy - boxmean); 219eca4a663SGreg Roach } 220eca4a663SGreg Roach // set the X position of the box 221eca4a663SGreg Roach if (textDirection === 'rtl') { 222eca4a663SGreg Roach ob.style.right = newx + "px"; 223eca4a663SGreg Roach } else { 224eca4a663SGreg Roach ob.style.left = newx + "px"; 225eca4a663SGreg Roach } 226eca4a663SGreg Roach // set new top positions 227eca4a663SGreg Roach ob.style.top = newy + "px"; 228eca4a663SGreg Roach // get the width for the diagnal box 2292cebb4b4SGreg Roach let newwidth = (ob.offsetLeft - dbox.offsetLeft); 230eca4a663SGreg Roach // set the width 231eca4a663SGreg Roach dbox.style.width = newwidth + "px"; 232eca4a663SGreg Roach if (textDirection === 'rtl') { 233eca4a663SGreg Roach dbox.style.right = (dbox.offsetRight - newwidth) + 'px'; 234eca4a663SGreg Roach } 235eca4a663SGreg Roach dbox.style.height = newwidth + "px"; 236eca4a663SGreg Roach // change the line width to the change in the mouse X position 237eca4a663SGreg Roach line = document.getElementById('boxline' + personnum); 238eca4a663SGreg Roach if (oldlinew !== 0) { 239eca4a663SGreg Roach line.width = line.width + (linewidth - oldlinew); 240eca4a663SGreg Roach } 241eca4a663SGreg Roach oldlinew = linewidth; 242eca4a663SGreg Roach oldx = newx; 243eca4a663SGreg Roach return false; 244eca4a663SGreg Roach } 245eca4a663SGreg Roach }; 246eca4a663SGreg Roach 247eca4a663SGreg Roach document.onmouseup = function () { 248eca4a663SGreg Roach ob = null; 249eca4a663SGreg Roach oldx = 0; 250eca4a663SGreg Roach } 251eca4a663SGreg Roach</script> 252eca4a663SGreg Roach 253eca4a663SGreg Roach<div id="timeline_chart"> 254eca4a663SGreg Roach <!-- print the timeline line image --> 255eca4a663SGreg Roach <div id="line" style="position:absolute; <?= I18N::direction() === 'ltr' ? 'left:22px;' : 'right:22px;' ?> top:0;"> 2562cebb4b4SGreg Roach <img src="<?= e(asset('css/images/vline.png')) ?>" width="3" 2572cebb4b4SGreg Roach height="<?= 0 + ($topyear - $baseyear) * $scale ?>"> 258eca4a663SGreg Roach </div> 259eca4a663SGreg Roach 260eca4a663SGreg Roach <!-- print divs for the grid --> 2612cebb4b4SGreg Roach <div id="scale<?= e($baseyear) ?>" 2622cebb4b4SGreg Roach style="position:absolute; <?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>:0; top:-5px; font-size: 7pt; text-align: <?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>;"> 263eca4a663SGreg Roach <?= $baseyear ?> 264eca4a663SGreg Roach </div> 265eca4a663SGreg Roach <?php 266eca4a663SGreg Roach // at a scale of 25 or higher, show every year 267eca4a663SGreg Roach $mod = 25 / $scale; 268eca4a663SGreg Roach if ($mod < 1) { 269eca4a663SGreg Roach $mod = 1; 270eca4a663SGreg Roach } 271eca4a663SGreg Roach for ($i = $baseyear + 1; $i < $topyear; $i++) { 272eca4a663SGreg Roach if ($i % $mod === 0) { 273dd71ff6bSGreg Roach echo '<div id="scale' . $i . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left:0;' : 'right:0;') . ' top:' . (($i - $baseyear) * $scale - $scale / 2) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">'; 274eca4a663SGreg Roach echo $i; 275eca4a663SGreg Roach echo '</div>'; 276eca4a663SGreg Roach } 277eca4a663SGreg Roach } 278eca4a663SGreg Roach echo ''; 279eca4a663SGreg Roach ?> 2802cebb4b4SGreg Roach <div id="scale<?= e($topyear) ?>" 2812cebb4b4SGreg Roach style="position:absolute; <?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>:0; top:<?= ($topyear - $baseyear) * $scale ?>px; font-size: 7pt; text-align:<?= I18N::direction() === 'ltr' ? 'left' : 'right' ?>;"> 282eca4a663SGreg Roach <?= e($topyear) ?> 283eca4a663SGreg Roach </div> 284eca4a663SGreg Roach 285eca4a663SGreg Roach <?php foreach ($indifacts as $factcount => $event) : ?> 286eca4a663SGreg Roach <?php 287eca4a663SGreg Roach $desc = $event->value(); 288eca4a663SGreg Roach $gdate = $event->date(); 289eca4a663SGreg Roach $date = $gdate->minimumDate(); 290eca4a663SGreg Roach $date = $date->convertToCalendar('gregorian'); 291eca4a663SGreg Roach $year = $date->year(); 292eca4a663SGreg Roach $month = max(1, $date->month()); 293eca4a663SGreg Roach $day = max(1, $date->day()); 294eca4a663SGreg Roach $xoffset = 0 + 22; 2952cebb4b4SGreg Roach $yoffset = 0 + ($year - $baseyear) * $scale - $scale; 2962cebb4b4SGreg Roach $yoffset = $yoffset + $month / 12 * $scale; 2972cebb4b4SGreg Roach $yoffset = $yoffset + $day / 30 * ($scale / 12); 298261d6e48SGreg Roach $yoffset = (int) $yoffset; 299eca4a663SGreg Roach $place = (int) ($yoffset / $bheight); 300eca4a663SGreg Roach $i = 1; 301eca4a663SGreg Roach $j = 0; 302eca4a663SGreg Roach $tyoffset = 0; 303eca4a663SGreg Roach while (isset($placements[$place])) { 304eca4a663SGreg Roach if ($i === $j) { 305eca4a663SGreg Roach $tyoffset = $bheight * $i; 306eca4a663SGreg Roach $i++; 307eca4a663SGreg Roach } else { 308eca4a663SGreg Roach $tyoffset = -1 * $bheight * $j; 309eca4a663SGreg Roach $j++; 310eca4a663SGreg Roach } 311eca4a663SGreg Roach $place = (int) (($yoffset + $tyoffset) / $bheight); 312eca4a663SGreg Roach } 313eca4a663SGreg Roach $yoffset += $tyoffset; 314eca4a663SGreg Roach $xoffset += abs($tyoffset); 315eca4a663SGreg Roach $placements[$place] = $yoffset; 316eca4a663SGreg Roach 317261d6e48SGreg Roach echo "<div id=\"fact$factcount\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . $xoffset : 'right: ' . $xoffset) . 'px; top:' . $yoffset . 'px; font-size: 8pt; height: ' . $bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ');">'; 318ca8f62c9SGreg Roach echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: grab;"><tr><td>'; 319f220ef57SGreg Roach echo '<img src="' . e(asset('css/images/hline.png')) . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-'; 320eca4a663SGreg Roach if (I18N::direction() === 'ltr') { 321eca4a663SGreg Roach echo 'left: 3px;">'; 322eca4a663SGreg Roach } else { 323eca4a663SGreg Roach echo 'right: 3px;">'; 324eca4a663SGreg Roach } 325eca4a663SGreg Roach 32622d65e5aSGreg Roach $col = array_search($event->record(), $individuals, true); 327eca4a663SGreg Roach if ($col === false) { 328eca4a663SGreg Roach // Marriage event - use the color of the husband 32922d65e5aSGreg Roach $col = array_search($event->record()->husband(), $individuals, true); 330eca4a663SGreg Roach } 331eca4a663SGreg Roach if ($col === false) { 332eca4a663SGreg Roach // Marriage event - use the color of the wife 33322d65e5aSGreg Roach $col = array_search($event->record()->wife(), $individuals, true); 334eca4a663SGreg Roach } 3352cebb4b4SGreg Roach $col %= 6; 336eca4a663SGreg Roach echo '</td><td class="person' . $col . '">'; 337eca4a663SGreg Roach if (count($individuals) > 6) { 338eca4a663SGreg Roach // We only have six colours, so show naes if more than this number 33939ca88baSGreg Roach echo $event->record()->fullName() . ' — '; 340eca4a663SGreg Roach } 341eca4a663SGreg Roach $record = $event->record(); 342eca4a663SGreg Roach echo $event->label(); 343eca4a663SGreg Roach echo ' — '; 344eca4a663SGreg Roach if ($record instanceof Individual) { 345b315f3e1SGreg Roach echo view('fact-date', ['cal_link' => 'false', 'fact' => $event, 'record' => $record, 'time' => false]); 346eca4a663SGreg Roach } elseif ($record instanceof Family) { 347eca4a663SGreg Roach echo $gdate->display(); 348054771e9SGreg Roach 349054771e9SGreg Roach foreach ($record->spouses() as $spouse) { 350054771e9SGreg Roach if ($spouse->getBirthDate()->isOK()) { 351a5fd6d7cSGreg Roach $age = (string) new Age($spouse->getBirthDate(), $gdate); 352054771e9SGreg Roach if ($spouse->sex() === 'F') { 353a5fd6d7cSGreg Roach echo '<span class="age"> ', I18N::translate('Wife’s age'), ' ', $age, '</span>'; 354eca4a663SGreg Roach } else { 355a5fd6d7cSGreg Roach echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $age, '</span>'; 356eca4a663SGreg Roach } 357eca4a663SGreg Roach } 358eca4a663SGreg Roach } 359eca4a663SGreg Roach } 360eca4a663SGreg Roach echo ' ' . e($desc); 36129e68993SGreg Roach if ($event->place()->gedcomName() !== '') { 362392561bbSGreg Roach echo ' — ' . $event->place()->shortName(); 363eca4a663SGreg Roach } 364eca4a663SGreg Roach // Print spouses names for family events 365eca4a663SGreg Roach if ($event->record() instanceof Family) { 36639ca88baSGreg Roach echo ' — <a href="', e($event->record()->url()), '">', $event->record()->fullName(), '</a>'; 367eca4a663SGreg Roach } 368eca4a663SGreg Roach echo '</td></tr></table>'; 369eca4a663SGreg Roach echo '</div>'; 370eca4a663SGreg Roach if (I18N::direction() === 'ltr') { 371e837ff07SGreg Roach $img = asset('css/images/dline2.png'); 372eca4a663SGreg Roach $ypos = '0%'; 373eca4a663SGreg Roach } else { 374e837ff07SGreg Roach $img = asset('css/images/dline.png'); 375eca4a663SGreg Roach $ypos = '100%'; 376eca4a663SGreg Roach } 377dd71ff6bSGreg Roach $dyoffset = $yoffset - $tyoffset + $bheight / 3; 378eca4a663SGreg Roach if ($tyoffset < 0) { 379eca4a663SGreg Roach $dyoffset = $yoffset + $bheight / 3; 380eca4a663SGreg Roach if (I18N::direction() === 'ltr') { 381e837ff07SGreg Roach $img = asset('css/images/dline.png'); 382eca4a663SGreg Roach $ypos = '100%'; 383eca4a663SGreg Roach } else { 384e837ff07SGreg Roach $img = asset('css/images/dline2.png'); 385eca4a663SGreg Roach $ypos = '0%'; 386eca4a663SGreg Roach } 387eca4a663SGreg Roach } 388eca4a663SGreg Roach ?> 389eca4a663SGreg Roach 390eca4a663SGreg Roach <!-- diagonal line --> 391dd71ff6bSGreg Roach <div id="dbox<?= $factcount ?>" style="position:absolute; <?= I18N::direction() === 'ltr' ? 'left: ' . (0 + 25) : 'right: ' . (0 + 25) ?>px; top:<?= $dyoffset ?>px; font-size: 8pt; height: <?= abs($tyoffset) ?>px; width: <?= abs($tyoffset) ?>px; background-image: url('<?= e($img) ?>'); background-position: 0 <?= $ypos ?>;"> 392eca4a663SGreg Roach </div> 393eca4a663SGreg Roach <?php endforeach ?> 394eca4a663SGreg Roach 395eca4a663SGreg Roach <!-- age cursors --> 396eca4a663SGreg Roach <?php foreach ($individuals as $p => $indi) : ?> 397dd71ff6bSGreg Roach <?php $ageyoffset = 0 + $bheight * $p; ?> 398eca4a663SGreg Roach <div id="agebox<?= $p ?>" style="cursor:move; position:absolute; <?= I18N::direction() === 'ltr' ? 'left:20px;' : 'right:20px;' ?> top:<?= $ageyoffset ?>px; height:<?= $bheight ?>px; display:none;" onmousedown="ageCursorMouseDown(this, <?= $p ?>);"> 399eca4a663SGreg Roach <table cellspacing="0" cellpadding="0"> 400eca4a663SGreg Roach <tr> 401eca4a663SGreg Roach <td> 402f220ef57SGreg Roach <img src="<?= e(asset('css/images/hline.png')) ?>" id="ageline<?= $p ?>" width="25" height="3"> 403eca4a663SGreg Roach </td> 404eca4a663SGreg Roach <td> 405eca4a663SGreg Roach <?php if (!empty($birthyears[$indi->xref()])) : ?> 406dd71ff6bSGreg Roach <?php $tyear = round(($ageyoffset + $bheight / 2) / $scale) + $baseyear; ?> 407ca8f62c9SGreg Roach <table class="person<?= $p % 6 ?>" style="cursor: grab;"> 408eca4a663SGreg Roach <tr> 409eca4a663SGreg Roach <td> 410eca4a663SGreg Roach <?= I18N::translate('Year:') ?> 411eca4a663SGreg Roach <span id="yearform<?= $p ?>" class="field"> 412eca4a663SGreg Roach <?= $tyear ?> 413eca4a663SGreg Roach </span> 414eca4a663SGreg Roach </td> 415eca4a663SGreg Roach <td> 4162cebb4b4SGreg Roach (<?= I18N::translate('Age') ?> 4172cebb4b4SGreg Roach <span id="ageform<?= $p ?>" class="field"><?= $tyear - $birthyears[$indi->xref()] ?></span>) 418eca4a663SGreg Roach </td> 419eca4a663SGreg Roach </tr> 420eca4a663SGreg Roach </table> 421eca4a663SGreg Roach <?php endif ?> 422eca4a663SGreg Roach </td> 423eca4a663SGreg Roach </tr> 424eca4a663SGreg Roach </table> 425eca4a663SGreg Roach <br> 426eca4a663SGreg Roach <br> 427eca4a663SGreg Roach <br> 428eca4a663SGreg Roach </div> 429eca4a663SGreg Roach <br> 430eca4a663SGreg Roach <br> 431eca4a663SGreg Roach <br> 432eca4a663SGreg Roach <br> 433eca4a663SGreg Roach <?php endforeach ?> 434eca4a663SGreg Roach</div> 435