1*0f5fd22fSGreg Roach<?php 2*0f5fd22fSGreg Roach 3*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Auth; 4*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrintFacts; 5*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\DeleteFact; 6*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\EditMediaFileModal; 7*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; 8*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; 9*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\I18N; 10*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Media; 11*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Registry; 12*0f5fd22fSGreg Roachuse Fisharebest\Webtrees\Tree; 13*0f5fd22fSGreg Roachuse Illuminate\Support\Collection; 14*0f5fd22fSGreg Roachuse League\Flysystem\FilesystemOperator; 15*0f5fd22fSGreg Roach 16*0f5fd22fSGreg Roach/** 17*0f5fd22fSGreg Roach * @var Collection $clipboard_facts 18*0f5fd22fSGreg Roach * @var FilesystemOperator $data_filesystem 19*0f5fd22fSGreg Roach * @var Media $record 20*0f5fd22fSGreg Roach * @var Tree $tree 21*0f5fd22fSGreg Roach */ 22*0f5fd22fSGreg Roach 23*0f5fd22fSGreg Roach?> 24*0f5fd22fSGreg Roach 25*0f5fd22fSGreg Roach<table class="table wt-facts-table"> 26*0f5fd22fSGreg Roach <?php foreach ($record->mediaFiles() as $media_file) : ?> 27*0f5fd22fSGreg Roach <tr class="<?= $media_file->isPendingAddition() ? 'wt-new' : '' ?><?= $media_file->isPendingDeletion() ? 'wt-old' : '' ?>"> 28*0f5fd22fSGreg Roach <th scope="row"> 29*0f5fd22fSGreg Roach <?= I18N::translate('Media file') ?> 30*0f5fd22fSGreg Roach <?php if ($record->canEdit()) : ?> 31*0f5fd22fSGreg Roach <div class="editfacts nowrap"> 32*0f5fd22fSGreg Roach <a class="btn btn-link" href="#" data-toggle="modal" data-backdrop="static" data-target="#wt-ajax-modal" data-href="<?= route(EditMediaFileModal::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact_id' => $media_file->factId()]) ?>" title="<?= I18N::translate('Edit') ?>"> 33*0f5fd22fSGreg Roach <?= view('icons/edit') ?> 34*0f5fd22fSGreg Roach <span class="sr-only"> 35*0f5fd22fSGreg Roach <?= I18N::translate('Edit') ?> 36*0f5fd22fSGreg Roach </span> 37*0f5fd22fSGreg Roach </a> 38*0f5fd22fSGreg Roach 39*0f5fd22fSGreg Roach <?php if (count($record->mediaFiles()) > 1) : ?> 40*0f5fd22fSGreg Roach <a class="btn btn-link" href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete this fact?') ?>" data-post-url="<?= e(route(DeleteFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref(), 'fact_id' => $media_file->factId()])) ?>" title="<?= I18N::translate('Delete') ?>"> 41*0f5fd22fSGreg Roach <?= view('icons/delete') ?> 42*0f5fd22fSGreg Roach <span class="sr-only"> 43*0f5fd22fSGreg Roach <?= I18N::translate('Delete') ?> 44*0f5fd22fSGreg Roach </span> 45*0f5fd22fSGreg Roach </a> 46*0f5fd22fSGreg Roach 47*0f5fd22fSGreg Roach <?php endif ?> 48*0f5fd22fSGreg Roach </div> 49*0f5fd22fSGreg Roach <?php endif ?> 50*0f5fd22fSGreg Roach </th> 51*0f5fd22fSGreg Roach <td class="d-flex justify-content-between"> 52*0f5fd22fSGreg Roach <div> 53*0f5fd22fSGreg Roach <?php if ($media_file->isExternal()) : ?> 54*0f5fd22fSGreg Roach <?= Registry::elementFactory()->make('OBJE:FILE')->labelValue($media_file->filename(), $record->tree()) ?> 55*0f5fd22fSGreg Roach <?php elseif (Auth::isEditor($record->tree())) :?> 56*0f5fd22fSGreg Roach <?php if (!$media_file->fileExists($data_filesystem)) : ?> 57*0f5fd22fSGreg Roach <p class="alert alert-danger"> 58*0f5fd22fSGreg Roach <?= I18N::translate('The file “%s” does not exist.', e($media_file->filename())) ?> 59*0f5fd22fSGreg Roach </p> 60*0f5fd22fSGreg Roach <?php endif ?> 61*0f5fd22fSGreg Roach <?= Registry::elementFactory()->make('OBJE:FILE')->labelValue($media_file->filename(), $record->tree()) ?> 62*0f5fd22fSGreg Roach <?php endif ?> 63*0f5fd22fSGreg Roach 64*0f5fd22fSGreg Roach <?= Registry::elementFactory()->make('OBJE:FILE:TITL')->labelValue($media_file->title(), $record->tree()) ?> 65*0f5fd22fSGreg Roach <?= Registry::elementFactory()->make('OBJE:FILE:FORM:TYPE')->labelValue($media_file->type(), $record->tree()) ?> 66*0f5fd22fSGreg Roach <?= Registry::elementFactory()->make('OBJE:FILE:FORM')->labelValue($media_file->format(), $record->tree()) ?> 67*0f5fd22fSGreg Roach </div> 68*0f5fd22fSGreg Roach 69*0f5fd22fSGreg Roach <div> 70*0f5fd22fSGreg Roach <?php if (!$media_file->isExternal()) : ?> 71*0f5fd22fSGreg Roach <?php if (explode('/', $media_file->mimeType())[0] === 'audio') : ?> 72*0f5fd22fSGreg Roach <audio controls> 73*0f5fd22fSGreg Roach <source src="<?= e($media_file->downloadUrl('inline')) ?>" type="<?= $media_file->mimeType() ?>"> 74*0f5fd22fSGreg Roach </audio> 75*0f5fd22fSGreg Roach <?php elseif (explode('/', $media_file->mimeType())[0] === 'video') : ?> 76*0f5fd22fSGreg Roach <video controls width="300"> 77*0f5fd22fSGreg Roach <source src="<?= e($media_file->downloadUrl('inline')) ?>" type="<?= $media_file->mimeType() ?>"> 78*0f5fd22fSGreg Roach </video> 79*0f5fd22fSGreg Roach <?php else : ?> 80*0f5fd22fSGreg Roach <?= $media_file->displayImage(200, 150, 'contain', []) ?> 81*0f5fd22fSGreg Roach <?php endif ?> 82*0f5fd22fSGreg Roach <?php if ($record->tree()->getPreference('SHOW_MEDIA_DOWNLOAD') >= Auth::accessLevel($record->tree()) && $media_file->fileExists($data_filesystem)) : ?> 83*0f5fd22fSGreg Roach <br> 84*0f5fd22fSGreg Roach <a href="<?= e($media_file->downloadUrl('attachment')) ?>"> 85*0f5fd22fSGreg Roach <?= I18N::translate('Download file') ?> 86*0f5fd22fSGreg Roach </a> 87*0f5fd22fSGreg Roach <?php endif ?> 88*0f5fd22fSGreg Roach <?php endif ?> 89*0f5fd22fSGreg Roach </div> 90*0f5fd22fSGreg Roach </td> 91*0f5fd22fSGreg Roach </tr> 92*0f5fd22fSGreg Roach <?php endforeach ?> 93*0f5fd22fSGreg Roach 94*0f5fd22fSGreg Roach <?php foreach ($record->facts() as $fact) : ?> 95*0f5fd22fSGreg Roach <?php FunctionsPrintFacts::printFact($fact, $record) ?> 96*0f5fd22fSGreg Roach <?php endforeach ?> 97*0f5fd22fSGreg Roach</table> 98