xref: /webtrees/resources/views/individual-page-images.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
10f5fd22fSGreg Roach<?php
20f5fd22fSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
50f5fd22fSGreg Roachuse Fisharebest\Webtrees\Fact;
60f5fd22fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
70f5fd22fSGreg Roachuse Fisharebest\Webtrees\I18N;
80f5fd22fSGreg Roachuse Fisharebest\Webtrees\Individual;
90f5fd22fSGreg Roachuse Fisharebest\Webtrees\Media;
100f5fd22fSGreg Roachuse Fisharebest\Webtrees\Module\ModuleSidebarInterface;
110f5fd22fSGreg Roachuse Fisharebest\Webtrees\Module\ModuleTabInterface;
120f5fd22fSGreg Roachuse Fisharebest\Webtrees\Tree;
130f5fd22fSGreg Roachuse Illuminate\Support\Collection;
140f5fd22fSGreg Roach
150f5fd22fSGreg Roach/**
160f5fd22fSGreg Roach * @var string                                 $age
170ea4a3f2SGreg Roach * @var bool                                   $can_upload_media
1836779af1SGreg Roach * @var Collection<int,Media>                  $individual_media
1936779af1SGreg Roach * @var Collection<int,Fact>                   $name_records
200f5fd22fSGreg Roach * @var Individual                             $record
2136779af1SGreg Roach * @var Collection<int,Fact>                   $sex_records
2236779af1SGreg Roach * @var Collection<int,string>                 $shares
2336779af1SGreg Roach * @var Collection<int,ModuleSidebarInterface> $sidebars
2436779af1SGreg Roach * @var Collection<int,ModuleTabInterface>     $tabs
250f5fd22fSGreg Roach * @var Tree                                   $tree
260f5fd22fSGreg Roach * @var string                                 $user_link
270f5fd22fSGreg Roach */
280f5fd22fSGreg Roach?>
290f5fd22fSGreg Roach
300f5fd22fSGreg Roach<?php if ($individual_media->isNotEmpty() || $tree->getPreference('USE_SILHOUETTE') === '1') : ?>
310f5fd22fSGreg Roach    <div class="col-sm-3">
320f5fd22fSGreg Roach        <?php if ($individual_media->isEmpty()) : ?>
330f5fd22fSGreg Roach            <div class="img-thumbnail">
34ce6842f3SGreg Roach                <i class="wt-individual-silhouette wt-individual-silhouette-<?= strtolower($record->sex()) ?> wt-icon-flip-rtl w-100"></i>
350f5fd22fSGreg Roach            </div>
360f5fd22fSGreg Roach        <?php elseif ($individual_media->count() === 1) : ?>
370f5fd22fSGreg Roach            <?= $individual_media->first()->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?>
380f5fd22fSGreg Roach        <?php else : ?>
3900475472SGreg Roach            <div id="individual-images" class="carousel slide" data-bs-interval="false">
400f5fd22fSGreg Roach                <div class="carousel-inner">
410f5fd22fSGreg Roach                    <?php foreach ($individual_media as $n => $media_file) : ?>
420f5fd22fSGreg Roach                        <div class="carousel-item <?= $n === 0 ? 'active' : '' ?>">
430f5fd22fSGreg Roach                            <?= $media_file->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?>
440f5fd22fSGreg Roach                        </div>
450f5fd22fSGreg Roach                    <?php endforeach ?>
460f5fd22fSGreg Roach                </div>
47ed09ab2bSGreg Roach                <button type="button" class="carousel-control-prev" data-bs-target="#individual-images" data-bs-slide="prev">
480f5fd22fSGreg Roach                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
49315eb316SGreg Roach                    <span class="visually-hidden"><?= I18N::translate('previous') ?></span>
50ed09ab2bSGreg Roach                </button>
51ed09ab2bSGreg Roach                <button type="button" class="carousel-control-next" data-bs-target="#individual-images" data-bs-slide="next">
520f5fd22fSGreg Roach                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
53315eb316SGreg Roach                    <span class="visually-hidden"><?= I18N::translate('next') ?></span>
54ed09ab2bSGreg Roach                </button>
550f5fd22fSGreg Roach            </div>
560f5fd22fSGreg Roach        <?php endif ?>
570f5fd22fSGreg Roach
580ea4a3f2SGreg Roach        <?php if ($can_upload_media) : ?>
590f5fd22fSGreg Roach            <div class="text-center">
600f5fd22fSGreg Roach                <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
610f5fd22fSGreg Roach                    <?= I18N::translate('Add a media object') ?>
620f5fd22fSGreg Roach                </a>
630f5fd22fSGreg Roach            </div>
640f5fd22fSGreg Roach        <?php endif ?>
650f5fd22fSGreg Roach    </div>
660f5fd22fSGreg Roach<?php endif ?>
67