xref: /webtrees/resources/views/modules/random_media/slide-show.phtml (revision 39ca88ba08cefcfcaf891abfcf748f9c808eb326)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsPrint; ?>
2dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
3dd6b2bfcSGreg Roach
4dd6b2bfcSGreg Roach<div class="text-center slide-show-container">
5dd6b2bfcSGreg Roach    <?php if ($show_controls) : ?>
6dd6b2bfcSGreg Roach        <div class="slide-show-controls">
739b853a7SGreg Roach            <a href="#" title="<?= I18N::translate('Play') ?>" <?= $start_automatically ? 'hidden' : '' ?>>
839b853a7SGreg Roach                <?= view('icons/media-play') ?>
939b853a7SGreg Roach                <span class="sr-only"><?= I18N::translate('Play') ?></span>
1039b853a7SGreg Roach            </a>
1139b853a7SGreg Roach            <a href="#" title="<?= I18N::translate('Stop') ?>" <?= $start_automatically ? '' : 'hidden' ?>>
1239b853a7SGreg Roach                <?= view('icons/media-stop') ?>
1339b853a7SGreg Roach                <span class="sr-only"><?= I18N::translate('Stop') ?></span>
1439b853a7SGreg Roach            </a>
1539b853a7SGreg Roach            <a href="#" title="<?= I18N::translate('Next image') ?>">
1639b853a7SGreg Roach                <?= view('icons/media-next') ?>
1739b853a7SGreg Roach                <span class="sr-only"><?= I18N::translate('Next image') ?></span>
1839b853a7SGreg Roach            </a>
19dd6b2bfcSGreg Roach        </div>
20dd6b2bfcSGreg Roach    <?php endif ?>
21dd6b2bfcSGreg Roach
22dd6b2bfcSGreg Roach    <figure class="text-center slide-show-figure">
23dd6b2bfcSGreg Roach        <?= $media_file->displayImage(200, 200, '', ['class' => 'slide-show-image']) ?>
24dd6b2bfcSGreg Roach        <figcaption class="slide-show-figcaption">
25dd6b2bfcSGreg Roach            <a href="<?= e($media->url()) ?>">
26*39ca88baSGreg Roach                <b><?= $media->fullName() ?></b>
27dd6b2bfcSGreg Roach            </a>
28dd6b2bfcSGreg Roach        </figcaption>
29dd6b2bfcSGreg Roach    </figure>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach    <p class="slide-show-notes">
327d0db648SGreg Roach        <?= FunctionsPrint::printFactNotes($tree, $media->gedcom(), 1) ?>
33dd6b2bfcSGreg Roach    </p>
34dd6b2bfcSGreg Roach
35dd6b2bfcSGreg Roach    <ul class="slide-show-links">
36dd6b2bfcSGreg Roach        <?php foreach ($media->linkedIndividuals('OBJE') as $individual) : ?>
37dd6b2bfcSGreg Roach            <?= I18N::translate('Individual') ?>38dd6b2bfcSGreg Roach            <a href="<?= e($individual->url()) ?>" class="slide-show-link">
39*39ca88baSGreg Roach                <?= $individual->fullName() ?>
40dd6b2bfcSGreg Roach            </a>
41dd6b2bfcSGreg Roach            <br>
42dd6b2bfcSGreg Roach        <?php endforeach ?>
43dd6b2bfcSGreg Roach
44dd6b2bfcSGreg Roach        <?php foreach ($media->linkedFamilies('OBJE') as $family) : ?>
45dd6b2bfcSGreg Roach            <?= I18N::translate('View this family') ?>46dd6b2bfcSGreg Roach            <a href="<?= e($family->url()) ?>" class="slide-show-link">
47*39ca88baSGreg Roach                <?= $family->fullName() ?>
48dd6b2bfcSGreg Roach            </a>
49dd6b2bfcSGreg Roach            <br>
50dd6b2bfcSGreg Roach        <?php endforeach ?>
51dd6b2bfcSGreg Roach
52dd6b2bfcSGreg Roach        <?php foreach ($media->linkedSources('OBJE') as $source) : ?>
53dd6b2bfcSGreg Roach            <?= I18N::translate('View this source') ?>54dd6b2bfcSGreg Roach            <a href="<?= e($source->url()) ?>" class="slide-show-link">
55*39ca88baSGreg Roach                <?= $source->fullName() ?>
56dd6b2bfcSGreg Roach            </a>
57dd6b2bfcSGreg Roach            <br>
58dd6b2bfcSGreg Roach        <?php endforeach ?>
59dd6b2bfcSGreg Roach    </ul>
60dd6b2bfcSGreg Roach</div>
61dd6b2bfcSGreg Roach
62dd6b2bfcSGreg Roach<script>
63dd6b2bfcSGreg Roach    // Reload automatically?
64dd6b2bfcSGreg Roach    var play = <?= json_encode($start_automatically); ?>;
65dd6b2bfcSGreg Roach
66dd6b2bfcSGreg Roach    function slideShowReload() {
67dd6b2bfcSGreg Roach        if (play) {
68dd6b2bfcSGreg Roach            var block = $("#block-<?= $block_id ?>").parent();
69dd6b2bfcSGreg Roach            clearTimeout(timeout);
70dd6b2bfcSGreg Roach            block.load(block.data('ajaxUrl') + '&start=' + (play ? '1' : '0'));
71dd6b2bfcSGreg Roach        }
72dd6b2bfcSGreg Roach
73dd6b2bfcSGreg Roach        return false;
74dd6b2bfcSGreg Roach    }
75dd6b2bfcSGreg Roach
76dd6b2bfcSGreg Roach    $(".wt-icon-media-play").on('click', function () {
77dd6b2bfcSGreg Roach        $(".wt-icon-media-play").parent().attr('hidden', true);
78dd6b2bfcSGreg Roach        $(".wt-icon-media-stop").parent().attr('hidden', false);
79dd6b2bfcSGreg Roach        play = true;
80dd6b2bfcSGreg Roach        return slideShowReload();
81dd6b2bfcSGreg Roach    });
82dd6b2bfcSGreg Roach
83dd6b2bfcSGreg Roach    $(".wt-icon-media-stop").on('click', function () {
84dd6b2bfcSGreg Roach        $(".wt-icon-media-stop").parent().attr('hidden', true);
85dd6b2bfcSGreg Roach        $(".wt-icon-media-play").parent().attr('hidden', false);
86dd6b2bfcSGreg Roach        play = false;
87dd6b2bfcSGreg Roach        return false;
88dd6b2bfcSGreg Roach    });
89dd6b2bfcSGreg Roach
90dd6b2bfcSGreg Roach    $(".wt-icon-media-next").on('click', function () {
91dd6b2bfcSGreg Roach        play = true;
92dd6b2bfcSGreg Roach        return slideShowReload();
93dd6b2bfcSGreg Roach    });
94dd6b2bfcSGreg Roach
95dd6b2bfcSGreg Roach    var timeout = setTimeout(slideShowReload, 6000);
96dd6b2bfcSGreg Roach</script>
97