1<?php 2 3use Fisharebest\Webtrees\Family; 4use Fisharebest\Webtrees\I18N; 5use Fisharebest\Webtrees\Individual; 6use Fisharebest\Webtrees\Media; 7use Fisharebest\Webtrees\MediaFile; 8use Fisharebest\Webtrees\Source; 9use Fisharebest\Webtrees\Tree; 10use Illuminate\Support\Collection; 11 12/** 13 * @var int $block_id 14 * @var int $delay 15 * @var Collection<Family> $linked_families 16 * @var Collection<Individual> $linked_individuals 17 * @var Collection<Source> $linked_sources 18 * @var Media $media 19 * @var MediaFile $media_file 20 * @var bool $show_controls 21 * @var bool $start_automatically 22 * @var Tree $tree 23 */ 24 25?> 26 27<div class="wt-slide-show-container"> 28 <?php if ($show_controls) : ?> 29 <div class="wt-slide-show-controls text-center"> 30 <a href="#" title="<?= I18N::translate('Play') ?>" <?= $start_automatically ? 'hidden' : '' ?>> 31 <?= view('icons/media-play') ?> 32 <span class="visually-hidden"><?= I18N::translate('Play') ?></span> 33 </a> 34 <a href="#" title="<?= I18N::translate('Stop') ?>" <?= $start_automatically ? '' : 'hidden' ?>> 35 <?= view('icons/media-stop') ?> 36 <span class="visually-hidden"><?= I18N::translate('Stop') ?></span> 37 </a> 38 <a href="#" title="<?= I18N::translate('Next image') ?>"> 39 <?= view('icons/media-next') ?> 40 <span class="visually-hidden"><?= I18N::translate('Next image') ?></span> 41 </a> 42 </div> 43 <?php endif ?> 44 45 <figure class="wt-slide-show-figure text-center"> 46 <?= $media_file->displayImage(200, 200, 'contain', ['class' => 'slide-show-image img-fluid']) ?> 47 <figcaption class="wt-slide-show-figcaption"> 48 <a href="<?= e($media->url()) ?>"> 49 <b><?= $media->fullName() ?></b> 50 </a> 51 </figcaption> 52 </figure> 53 54 <p class="wt-slide-show-notes text-center"> 55 <?php foreach ($media->facts(['NOTE']) as $fact) : ?> 56 <?= view('fact-gedcom-fields', ['gedcom' => $fact->gedcom(), 'parent' => $media->tag(), 'tree' => $tree]) ?> 57 <?php endforeach ?> 58 </p> 59 60 <ul class="fa-ul wt-slide-show-links"> 61 <?php foreach ($linked_individuals as $individual) : ?> 62 <li> 63 <span class="fa-li" title="<?= I18N::translate('Individual') ?>"><?= view('icons/individual') ?></span> 64 <a href="<?= e($individual->url()) ?>" class="wt-slide-show-link"> 65 <?= $individual->fullName() ?> 66 </a> 67 </li> 68 <?php endforeach ?> 69 70 <?php foreach ($linked_families as $family) : ?> 71 <li> 72 <span class="fa-li" title="<?= I18N::translate('Family') ?>"><?= view('icons/family') ?></span> 73 <a href="<?= e($family->url()) ?>" class="wt-slide-show-link"> 74 <?= $family->fullName() ?> 75 </a> 76 </li> 77 <?php endforeach ?> 78 79 <?php foreach ($linked_sources as $source) : ?> 80 <li> 81 <span class="fa-li" title="<?= I18N::translate('Source') ?>"><?= view('icons/source') ?></span> 82 <a href="<?= e($source->url()) ?>" class="wt-slide-show-link"> 83 <?= $source->fullName() ?> 84 </a> 85 </li> 86 <?php endforeach ?> 87 </ul> 88</div> 89 90<script> 91 var play = <?= json_encode($start_automatically, JSON_THROW_ON_ERROR) ?>; 92 93 if (play) { 94 var timeout = setTimeout(slideShowReload, <?= json_encode($delay * 1000, JSON_THROW_ON_ERROR) ?>); 95 } 96 97 function slideShowReload() { 98 var block = $("#block-<?= $block_id ?>").parent(); 99 clearTimeout(timeout); 100 block.load(block.data("wtAjaxUrl") + "&start=" + (play ? "1" : "0")); 101 102 return false; 103 } 104 105 $(".wt-icon-media-play").on("click", function () { 106 $(".wt-icon-media-play").parent().attr("hidden", true); 107 $(".wt-icon-media-stop").parent().attr("hidden", false); 108 play = true; 109 return slideShowReload(); 110 }); 111 112 $(".wt-icon-media-stop").on("click", function () { 113 $(".wt-icon-media-stop").parent().attr("hidden", true); 114 $(".wt-icon-media-play").parent().attr("hidden", false); 115 play = false; 116 clearTimeout(timeout); 117 return false; 118 }); 119 120 $(".wt-icon-media-next").on("click", function () { 121 return slideShowReload(); 122 }); 123</script> 124