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