xref: /webtrees/resources/views/admin/media-upload.phtml (revision 36de22acf6348b1059dac63e3cd19589574906ac)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\UploadMediaPage;
6use Fisharebest\Webtrees\I18N;
7use Illuminate\Support\Collection;
8
9/**
10 * @var string                    $filesize
11 * @var int                       $max_upload_files
12 * @var Collection<string,string> $media_folders
13 * @var string                    $title
14 */
15
16?>
17
18<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ManageMediaPage::class) => I18N::translate('Manage media'), $title]]) ?>
19
20<h1><?= $title ?></h1>
21
22<p>
23    <?= I18N::translate('Upload one or more media files from your local computer. Media files can be pictures, video, audio, or other formats.') ?>
24    <?= I18N::translate('Maximum upload size: ') ?><?= e($filesize) ?>
25</p>
26
27<form method="post" action="<?= e(route(UploadMediaPage::class)) ?>" name="uploadmedia" enctype="multipart/form-data">
28    <?= csrf_field() ?>
29
30    <?php for ($i = 1; $i <= $max_upload_files; $i++) : ?>
31        <h2><?= I18N::translate('Media file') ?> <?= I18N::number($i) ?></h2>
32
33        <div class="form-group row">
34            <label class="form-control-label col-sm-3" for="mediafile<?= e($i) ?>">
35                <?= I18N::translate('Media file to upload') ?>
36                <span class="sr-only"><?= e($i) ?></span>
37            </label>
38            <div class="col-sm-9">
39                <input class="form-control-file" id="mediafile<?= e($i) ?>" name="mediafile<?= e($i) ?>" type="file">
40            </div>
41        </div>
42
43        <div class="form-group row">
44            <label class="form-control-label col-sm-3" for="filename<?= e($i) ?>">
45                <?= I18N::translate('Filename on server') ?>
46                <span class="sr-only"><?= 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                <p class="small text-muted">
51                    <?= I18N::translate('Leave this entry blank to keep the original filename') ?>
52                </p>
53            </div>
54        </div>
55
56        <div class="form-group row">
57            <label class="form-control-label col-sm-3" for="folder_list<?= e($i) ?>">
58                <?= I18N::translate('Folder name on server') ?>
59                <span class="sr-only"><?= e($i) ?></span>
60            </label>
61            <div class="col-sm-9">
62                <select class="form-control" 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</form>
77