xref: /webtrees/resources/views/report-setup-page.phtml (revision f4c767fd89cdb62ee54edec032285924cd767af7)
1<?php
2
3use Fisharebest\Webtrees\I18N;
4
5/**
6 * @var string               $title
7 * @var string               $description
8 * @var string               $destination
9 * @var string               $format
10 * @var array<array<string>> $inputs
11 * @var string               $format
12 */
13
14?>
15
16<h2 class="wt-page-title">
17    <?= $title ?>
18</h2>
19
20<form method="post" class="wt-page-options wt-page-options-report-setup">
21    <?= csrf_field() ?>
22
23    <div class="row form-group">
24        <div class="col-sm-3 col-form-label wt-page-options-label">
25            <?= I18N::translate('Description') ?>
26        </div>
27        <div class="col-sm-9 wt-page-options-value">
28            <?= $description ?>
29        </div>
30    </div>
31
32    <?php foreach ($inputs as $n => $input) : ?>
33        <input type="hidden" name="varnames[]" value="<?= e($input['name']) ?>">
34        <div class="row form-group">
35            <label class="col-sm-3 col-form-label wt-page-options-label" for="input-<?= $n ?>">
36                <?= I18N::translate($input['value']) ?>
37            </label>
38            <div class="col-sm-9 wt-page-options-value">
39                <?= $input['control'] ?>
40                <?= $input['extra'] ?>
41            </div>
42        </div>
43    <?php endforeach ?>
44
45    <div class="row form-group">
46        <div class="col-sm-3 col-form-label wt-page-options-label">
47            <?= I18N::translate('Format') ?>
48        </div>
49
50        <div class="col-sm-9 wt-page-options-value d-flex justify-content-around">
51            <div class="text-center">
52                <label for="HTML" title="HTML">
53                    <?= view('icons/mime', ['type' => 'text/html']) ?>
54                    <span class="sr-only">HTML</span>
55                </label>
56                <br>
57                <input type="radio" name="format" id="HTML" value="HTML" <?= $format === 'HTML' ? 'checked' : '' ?>>
58            </div>
59            <div class="text-center">
60                <label for="PDF" title="PDF">
61                    <?= view('icons/mime', ['type' => 'application/pdf']) ?>
62                    <span class="sr-only">PDF</span>
63                </label>
64                <br>
65                <input type="radio" name="format" value="PDF" id="PDF" <?= $format === 'PDF' ? 'checked' : '' ?>>
66            </div>
67        </div>
68    </div>
69
70    <div class="row form-group">
71        <div class="col-sm-3 col-form-label wt-page-options-label"></div>
72        <div class="col-sm-9 wt-page-options-value">
73            <?php if ($destination === 'download') : ?>
74                <button type="submit" name="destination" value="download" class="btn btn-primary">
75                    <?= view('icons/download') ?>
76                    <?= I18N::translate('download') ?>
77                </button>
78                <button type="submit" name="destination" value="view" class="btn btn-secondary">
79                    <?= view('icons/report') ?>
80                    <?= I18N::translate('view') ?>
81                </button>
82            <?php else : ?>
83                <button type="submit" name="destination" value="view" class="btn btn-primary">
84                    <?= view('icons/report') ?>
85                    <?= I18N::translate('view') ?>
86                </button>
87                <button type="submit" name="destination" value="download" class="btn btn-secondary">
88                    <?= view('icons/download') ?>
89                    <?= I18N::translate('download') ?>
90                </button>
91            <?php endif ?>
92        </div>
93    </div>
94</form>
95