xref: /webtrees/resources/views/individual-page-images.phtml (revision 5bfc689774bb9a6401271c4ed15a6d50652c991b)
1<?php
2
3use Fisharebest\Webtrees\Fact;
4use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\Media;
8use Fisharebest\Webtrees\Module\ModuleSidebarInterface;
9use Fisharebest\Webtrees\Module\ModuleTabInterface;
10use Fisharebest\Webtrees\Tree;
11use Illuminate\Support\Collection;
12
13/**
14 * @var string                                 $age
15 * @var bool                                   $can_upload_media
16 * @var Collection<int,Media>                  $individual_media
17 * @var Collection<int,Fact>                   $name_records
18 * @var Individual                             $record
19 * @var Collection<int,Fact>                   $sex_records
20 * @var Collection<int,string>                 $shares
21 * @var Collection<int,ModuleSidebarInterface> $sidebars
22 * @var Collection<int,ModuleTabInterface>     $tabs
23 * @var Tree                                   $tree
24 * @var string                                 $user_link
25 */
26?>
27
28<?php if ($individual_media->isNotEmpty() || $tree->getPreference('USE_SILHOUETTE') === '1') : ?>
29    <div class="col-sm-3">
30        <?php if ($individual_media->isEmpty()) : ?>
31            <div class="img-thumbnail">
32                <i class="wt-individual-silhouette wt-individual-silhouette-<?= strtolower($record->sex()) ?>"></i>
33            </div>
34        <?php elseif ($individual_media->count() === 1) : ?>
35            <?= $individual_media->first()->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?>
36        <?php else : ?>
37            <div id="individual-images" class="carousel slide" data-bs-ride="carousel" data-bs-interval="false">
38                <div class="carousel-inner">
39                    <?php foreach ($individual_media as $n => $media_file) : ?>
40                        <div class="carousel-item <?= $n === 0 ? 'active' : '' ?>">
41                            <?= $media_file->displayImage(200, 260, 'crop', ['class' => 'img-thumbnail img-fluid w-100']) ?>
42                        </div>
43                    <?php endforeach ?>
44                </div>
45                <button type="button" class="carousel-control-prev" data-bs-target="#individual-images" data-bs-slide="prev">
46                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
47                    <span class="visually-hidden"><?= I18N::translate('previous') ?></span>
48                </button>
49                <button type="button" class="carousel-control-next" data-bs-target="#individual-images" data-bs-slide="next">
50                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
51                    <span class="visually-hidden"><?= I18N::translate('next') ?></span>
52                </button>
53            </div>
54        <?php endif ?>
55
56        <?php if ($can_upload_media) : ?>
57            <div class="text-center">
58                <a href="<?= e(route(AddNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact' => 'OBJE'])) ?>">
59                    <?= I18N::translate('Add a media object') ?>
60                </a>
61            </div>
62        <?php endif ?>
63    </div>
64<?php endif ?>
65