xref: /webtrees/resources/views/admin/media-upload.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\UploadMediaPage;
8use Fisharebest\Webtrees\I18N;
9use Illuminate\Support\Collection;
10
11/**
12 * @var string                       $filesize
13 * @var int                          $max_upload_files
14 * @var Collection<array-key,string> $media_folders
15 * @var string                       $title
16 */
17
18?>
19
20<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageMediaPage::class) => I18N::translate('Manage media'), $title]]) ?>
21
22<h1><?= $title ?></h1>
23
24<p>
25    <?= I18N::translate('Upload one or more media files from your local computer. Media files can be pictures, video, audio, or other formats.') ?>
26    <?= I18N::translate('Maximum upload size: ') ?><?= e($filesize) ?>
27</p>
28
29<form method="post" action="<?= e(route(UploadMediaPage::class)) ?>" name="uploadmedia" enctype="multipart/form-data">
30    <?php for ($i = 1; $i <= $max_upload_files; $i++) : ?>
31        <h2><?= I18N::translate('Media file') ?> <?= I18N::number($i) ?></h2>
32
33        <div class="row mb-3">
34            <label class="form-control-label col-sm-3" for="mediafile<?= e($i) ?>">
35                <?= I18N::translate('Media file to upload') ?>
36                <span class="visually-hidden"><?= e($i) ?></span>
37            </label>
38            <div class="col-sm-9">
39                <input class="form-control" id="mediafile<?= e($i) ?>" name="mediafile<?= e($i) ?>" type="file">
40            </div>
41        </div>
42
43        <div class="row mb-3">
44            <label class="form-control-label col-sm-3" for="filename<?= e($i) ?>">
45                <?= I18N::translate('Filename on server') ?>
46                <span class="visually-hidden"><?= e($i) ?></span>
47            </label>
48            <div class="col-sm-9">
49                <input class="form-control" id="filename<?= e($i) ?>" name="filename<?= e($i) ?>" type="text">
50                <div class="form-text">
51                    <?= I18N::translate('Leave this entry blank to keep the original filename') ?>
52                </div>
53            </div>
54        </div>
55
56        <div class="row mb-3">
57            <label class="form-control-label col-sm-3" for="folder_list<?= e($i) ?>">
58                <?= I18N::translate('Folder name on server') ?>
59                <span class="visually-hidden"><?= e($i) ?></span>
60            </label>
61            <div class="col-sm-9">
62                <select class="form-select" id="folder_list<?= e($i) ?>" name="folder<?= e($i) ?>">
63                    <?php foreach ($media_folders as $media_folder) : ?>
64                        <option value="<?= e($media_folder) ?>">
65                            <?= e($media_folder) ?>
66                        </option>
67                    <?php endforeach ?>
68                </select>
69            </div>
70        </div>
71    <?php endfor ?>
72
73    <button class="btn btn-primary" type="submit">
74        <?= /* I18N: A button label. */ I18N::translate('upload') ?>
75    </button>
76
77    <?= csrf_field() ?>
78</form>
79