1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\Contracts\TimestampInterface; 6use Fisharebest\Webtrees\Contracts\UserInterface; 7use Fisharebest\Webtrees\GedcomRecord; 8use Fisharebest\Webtrees\I18N; 9use Fisharebest\Webtrees\Timestamp; 10use Fisharebest\Webtrees\View; 11use Illuminate\Support\Collection; 12 13/** 14 * @var int $id 15 * @var int $limit_low 16 * @var int $limit_high 17 * @var Collection<int,object{record:GedcomRecord,time:TimestampInterface,user:UserInterface}> $rows 18 * @var bool $show_date 19 * @var bool $show_user 20 */ 21 22?> 23 24<?php foreach ($rows as $n => $row) : ?> 25 <?php if ($n === $limit_low && $rows->count() > $limit_high) : ?> 26 <div> 27 <button class="btn btn-sm btn-secondary" id="show-more-<?= e($id) ?>"> 28 <?= view('icons/add') ?> 29 <?= /* I18N: button label */ I18N::translate('show more') ?> 30 </button> 31 </div> 32 33 <?php View::push('javascript') ?> 34 <script> 35 document.getElementById("show-more-<?= e($id) ?>").addEventListener("click", function (ev) { 36 document.querySelectorAll("#block-<?= e($id) ?> .d-none").forEach(function (el) { 37 el.classList.remove("d-none"); 38 }); 39 ev.target.parentNode.removeChild(ev.target); 40 }); 41 </script> 42 <?php View::endpush() ?> 43 <?php endif ?> 44 45 <div class="<?= $n >= $limit_low && $rows->count() > $limit_high ? 'd-none' : '' ?>"> 46 <a href="<?= e($row->record->url()) ?>"> 47 <?= $row->record->fullName() ?> 48 </a> 49 50 <div class="indent mb-1"> 51 <?php if ($show_user && $show_date) : ?> 52 <?= /* I18N: [a record was] Changed on <date/time> by <user> */I18N::translate('Changed on %1$s by %2$s', view('components/datetime', ['timestamp' => $row->time]), e($row->record->lastChangeUser())) ?> 53 <?php elseif ($show_date) : ?> 54 <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed on %1$s', view('components/datetime', ['timestamp' => $row->time])) ?> 55 <?php elseif ($show_user) : ?> 56 <?= /* I18N: [a record was] Changed on <date/time> */ I18N::translate('Changed by %1$s', e($row->user->userName())) ?> 57 <?php endif ?> 58 </div> 59 </div> 60<?php endforeach ?> 61