xref: /webtrees/resources/views/individual-page-images.phtml (revision 0f5fd22fb1857ad87285e5357592434d47b1f3bf)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Fact;
5use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Individual;
8use Fisharebest\Webtrees\Media;
9use Fisharebest\Webtrees\Module\ModuleSidebarInterface;
10use Fisharebest\Webtrees\Module\ModuleTabInterface;
11use Fisharebest\Webtrees\Tree;
12use Illuminate\Support\Collection;
13
14/**
15 * @var string                             $age
16 * @var Collection<Media>                  $individual_media
17 * @var Collection<Fact>                   $name_records
18 * @var Individual                         $record
19 * @var Collection<Fact>                   $sex_records
20 * @var Collection<string>                 $shares
21 * @var Collection<ModuleSidebarInterface> $sidebars
22 * @var Collection<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-ride="carousel" data-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                <a class="carousel-control-prev" href="#individual-images" role="button" data-slide="prev">
46                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
47                    <span class="sr-only"><?= I18N::translate('previous') ?></span>
48                </a>
49                <a class="carousel-control-next" href="#individual-images" role="button" data-slide="next">
50                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
51                    <span class="sr-only"><?= I18N::translate('next') ?></span>
52                </a>
53            </div>
54        <?php endif ?>
55
56        <?php if (Auth::isEditor($record->tree())) : ?>
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