1ff995987SGreg Roach<?php 2ff995987SGreg Roach 3ff995987SGreg Roachuse Fisharebest\Webtrees\Auth; 4ff995987SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrint; 5ff995987SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsPrintFacts; 6ff995987SGreg Roachuse Fisharebest\Webtrees\GedcomTag; 7ff995987SGreg Roachuse Fisharebest\Webtrees\I18N; 806a438b4SGreg Roachuse Fisharebest\Webtrees\Media; 9455a30feSGreg Roachuse Fisharebest\Webtrees\MediaFile; 1006a438b4SGreg Roachuse Fisharebest\Webtrees\Module\ModuleListInterface; 11455a30feSGreg Roachuse Fisharebest\Webtrees\Registry; 12455a30feSGreg Roachuse Fisharebest\Webtrees\Tree; 1306a438b4SGreg Roachuse Illuminate\Support\Collection; 14*f7cf8a15SGreg Roachuse League\Flysystem\FilesystemOperator; 1506a438b4SGreg Roach 1606a438b4SGreg Roach/** 1706a438b4SGreg Roach * @var int $count 18*f7cf8a15SGreg Roach * @var FilesystemOperator $data_filesystem 1906a438b4SGreg Roach * @var string $filter 2006a438b4SGreg Roach * @var string $folder 2106a438b4SGreg Roach * @var array<string> $folders 2206a438b4SGreg Roach * @var string $format 2306a438b4SGreg Roach * @var array<string> $formats 24455a30feSGreg Roach * @var int $max 2506a438b4SGreg Roach * @var Collection<Media> $media_objects 2606a438b4SGreg Roach * @var ModuleListInterface $module 2706a438b4SGreg Roach * @var int $page 2806a438b4SGreg Roach * @var int $pages 2906a438b4SGreg Roach * @var string $subdirs 3006a438b4SGreg Roach * @var string $title 31455a30feSGreg Roach * @var Tree $tree 3206a438b4SGreg Roach */ 33ff995987SGreg Roach 34ff995987SGreg Roach?> 35ff995987SGreg Roach 36ff995987SGreg Roach<h2 class="wt-page-title"> 37ff995987SGreg Roach <?= $title ?> 38ff995987SGreg Roach</h2> 39ff995987SGreg Roach 40ff995987SGreg Roach<form method="post" class="wt-page-options wt-page-options-media-list d-print-none"> 41ff995987SGreg Roach <?= csrf_field() ?> 42ff995987SGreg Roach 43ff995987SGreg Roach <div class="row form-group"> 44ff995987SGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="folder"> 45ff995987SGreg Roach <?= I18N::translate('Folder') ?> 46ff995987SGreg Roach </label> 47ff995987SGreg Roach <div class="col-sm-3 wt-page-options-value"> 48ff995987SGreg Roach <?= view('components/select', ['name' => 'folder', 'selected' => $folder, 'options' => $folders]) ?> 49ff995987SGreg Roach <?= view('components/checkbox-inline', ['label' => /* I18N: Label for check-box */ I18N::translate('Include subfolders'), 'name' => 'subdirs', 'checked' => $subdirs === '1']) ?> 50ff995987SGreg Roach </div> 51ff995987SGreg Roach 52ff995987SGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="max"> 53ff995987SGreg Roach <?= I18N::translate('Media objects per page') ?> 54ff995987SGreg Roach </label> 55ff995987SGreg Roach <div class="col-sm-3 wt-page-options-value"> 56f91b18ebSGreg Roach <?= view('components/select-number', ['name' => 'max', 'selected' => $max, 'options' => [10, 20, 30, 40, 50, 75, 100, 150, 200]]) ?> 57ff995987SGreg Roach </div> 58ff995987SGreg Roach </div> 59ff995987SGreg Roach 60ff995987SGreg Roach <div class="row form-group"> 6106a438b4SGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="format"> 62ff995987SGreg Roach <?= I18N::translate('Type') ?> 63ff995987SGreg Roach </label> 6406a438b4SGreg Roach 65ff995987SGreg Roach <div class="col-sm-3 wt-page-options-value"> 6606a438b4SGreg Roach <?= view('components/select', ['name' => 'format', 'id' => 'format', 'selected' => $format, 'options' => ['' => ''] + $formats]) ?> 67ff995987SGreg Roach </div> 68ff995987SGreg Roach 6906a438b4SGreg Roach <div class="col-sm-3 col-form-label wt-page-options-label"></div> 7006a438b4SGreg Roach 7106a438b4SGreg Roach <div class="col-sm-3 wt-page-options-value"></div> 72ff995987SGreg Roach </div> 73ff995987SGreg Roach 74ff995987SGreg Roach <div class="row form-group"> 75ff995987SGreg Roach <label class="col-sm-3 col-form-label wt-page-options-label" for="filter"> 76ff995987SGreg Roach <?= I18N::translate('Search filters') ?> 77ff995987SGreg Roach </label> 78ff995987SGreg Roach <div class="col-sm-3 wt-page-options-value"> 79ff995987SGreg Roach <input type="text" class="form-control" name="filter" id="filter" value="<?= e($filter) ?>"> 80ff995987SGreg Roach </div> 81ff995987SGreg Roach 8206a438b4SGreg Roach <div class="col-sm-3 col-form-label wt-page-options-label"></div> 8306a438b4SGreg Roach 84ff995987SGreg Roach <div class="col-sm-3 wt-page-options-value"> 8506a438b4SGreg Roach <button type="submit" name="go" value="1" class="btn btn-primary"> 86ff995987SGreg Roach <?= /* I18N: A button label. */ I18N::translate('search') ?> 87ff995987SGreg Roach </button> 8806a438b4SGreg Roach <a class="btn btn-secondary" href="<?= e($module->listUrl($tree)) ?>"> 89ff995987SGreg Roach <?= /* I18N: A button label. */ I18N::translate('reset') ?> 90ff995987SGreg Roach </a> 91ff995987SGreg Roach </div> 92ff995987SGreg Roach </div> 93ff995987SGreg Roach</form> 94ff995987SGreg Roach 95ff995987SGreg Roach<div class="wt-page-content"> 96ff995987SGreg Roach <p class="text-center mt-4"><?= I18N::translate('Media objects found') ?> <?= I18N::number($count) ?></p> 976e9b2106SThomas Karcher <?php if ($media_objects->isNotEmpty()) : ?> 98ff995987SGreg Roach 9906a438b4SGreg Roach <?= view('modules/media-list/pagination', ['module' => $module, 'page' => $page, 'pages' => $pages, 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'format' => $format, 'max' => $max, 'tree' => $tree]) ?> 100ff995987SGreg Roach 101ff995987SGreg Roach <div class="card-deck row mb-4 mt-4"> 102ff995987SGreg Roach <?php foreach ($media_objects as $n => $media_object) : ?> 1035197b5a1SGreg Roach <div class="col-12 col-sm-6 col-lg-4 d-flex"> 104ff995987SGreg Roach <div class="card mb-4"> 105ff995987SGreg Roach <div class="card-header"> 106ff995987SGreg Roach <h4 class="card-title"> 107ff995987SGreg Roach <a href="<?= e($media_object->url()) ?>"><?= $media_object->fullName() ?></a> 108ff995987SGreg Roach </h4> 109ff995987SGreg Roach </div> 110ff995987SGreg Roach <div class="card-body"> 111ff995987SGreg Roach <?php foreach ($media_object->mediaFiles() as $media_file) : ?> 112ff995987SGreg Roach <?= $media_file->displayImage(300, 200, 'contain', ['class' => 'img-fluid']) ?> 113ff995987SGreg Roach <?php endforeach ?> 114ff995987SGreg Roach 115455a30feSGreg Roach <?php $media_file = $media_object->mediaFiles()->first() ?> 116455a30feSGreg Roach <?php if ($media_file instanceof MediaFile): ?> 117ff995987SGreg Roach <p class="card-text"> 118ff995987SGreg Roach <?php 119ff995987SGreg Roach // Show file details 120ff995987SGreg Roach $mediatype = $media_file->type(); 121455a30feSGreg Roach if ($media_file->type() !== '') { 122455a30feSGreg Roach $element = Registry::elementFactory()->make('OBJE:FILE:FORM:TYPE'); 123455a30feSGreg Roach echo $element->labelValue($media_file->type(), $media_object->tree()); 124ff995987SGreg Roach } 125ff995987SGreg Roach echo FunctionsPrintFacts::printFactSources($tree, $media_object->gedcom(), 1); 126ff995987SGreg Roach echo FunctionsPrint::printFactNotes($tree, $media_object->gedcom(), 1); 127ff995987SGreg Roach if ($media_file->isExternal()) { 128455a30feSGreg Roach echo Registry::elementFactory()->make('OBJE:FILE')->labelValue($media_file->filename(), $media_object->tree()); 129ff995987SGreg Roach } elseif ($media_file->fileExists($data_filesystem)) { 130455a30feSGreg Roach echo Registry::elementFactory()->make('OBJE:FILE:FORM')->labelValue($media_file->mimeType(), $media_object->tree()); 131ff995987SGreg Roach if (Auth::isEditor($tree)) { 132455a30feSGreg Roach echo Registry::elementFactory()->make('OBJE:FILE')->labelValue($media_file->filename(), $media_object->tree()); 133ff995987SGreg Roach } 134ff995987SGreg Roach if (Auth::isEditor($tree)) { 135ff995987SGreg Roach foreach ($media_file->attributes($data_filesystem) as $tag => $value) { 136ff995987SGreg Roach echo GedcomTag::getLabelValue($tag, $value); 137ff995987SGreg Roach } 138ff995987SGreg Roach } 139ff995987SGreg Roach } else { 1400cfb9b8cSGreg Roach echo '<p class="alert alert-danger">', /* I18N: %s is a filename */ I18N::translate('The file “%s” does not exist.', e($media_file->filename())), '</p>'; 141ff995987SGreg Roach } 142ff995987SGreg Roach ?> 143ff995987SGreg Roach </p> 144455a30feSGreg Roach <?php endif ?> 145ff995987SGreg Roach </div> 146ff995987SGreg Roach <div class="card-footer"> 147ff995987SGreg Roach <?php foreach ($media_object->linkedIndividuals('OBJE') as $record) : ?> 148ff995987SGreg Roach <?= view('icons/individual') ?> 149ff995987SGreg Roach <a href="<?= e($record->url()) ?>"><?= $record->fullName() ?></a> 150ff995987SGreg Roach <br> 151ff995987SGreg Roach <?php endforeach ?> 152ff995987SGreg Roach 153ff995987SGreg Roach <?php foreach ($media_object->linkedFamilies('OBJE') as $record) : ?> 154ff995987SGreg Roach <?= view('icons/family') ?> 155ff995987SGreg Roach <a href="<?= e($record->url()) ?>"><?= $record->fullName() ?></a> 156ff995987SGreg Roach <br> 157ff995987SGreg Roach <?php endforeach ?> 158ff995987SGreg Roach 159ff995987SGreg Roach <?php foreach ($media_object->linkedSources('OBJE') as $record) : ?> 160ff995987SGreg Roach <?= view('icons/source') ?> 161ff995987SGreg Roach <a href="<?= e($record->url()) ?>"><?= $record->fullName() ?></a> 162ff995987SGreg Roach <br> 163ff995987SGreg Roach <?php endforeach ?> 164ff995987SGreg Roach </div> 165ff995987SGreg Roach </div> 166ff995987SGreg Roach </div> 167ff995987SGreg Roach <?php endforeach ?> 168ff995987SGreg Roach </div> 169ff995987SGreg Roach 17006a438b4SGreg Roach <?= view('modules/media-list/pagination', ['module' => $module, 'page' => $page, 'pages' => $pages, 'folder' => $folder, 'subdirs' => $subdirs, 'filter' => $filter, 'format' => $format, 'max' => $max, 'tree' => $tree]) ?> 171ff995987SGreg Roach <?php endif ?> 172ff995987SGreg Roach</div> 173