xref: /webtrees/resources/views/admin/site-preferences.phtml (revision 3f17da1ad8d9a8ffdf20212b66fa8455d49562ac)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesAction;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Site;
9
10/**
11 * @var array<string> $all_themes
12 * @var string        $data_folder
13 * @var string        $title
14 */
15
16?>
17
18<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
19
20<h1><?= $title ?></h1>
21
22<form method="post" action="<?= e(route(SitePreferencesAction::class)) ?>" class="form-horizontal">
23    <!-- INDEX_DIRECTORY -->
24    <div class="row mb-3">
25        <label for="INDEX_DIRECTORY" class="col-sm-3 col-form-label">
26            <?= /* I18N: A configuration setting */
27            I18N::translate('Data folder') ?>
28        </label>
29        <div class="col-sm-9">
30            <input type="text" class="form-control" dir="ltr" id="INDEX_DIRECTORY" name="INDEX_DIRECTORY" value="<?= e($data_folder) ?>" maxlength="255" placeholder="data/" required="required">
31            <div class="form-text">
32                <?= /* I18N: Help text for the "Data folder" site configuration setting */
33                I18N::translate('This folder will be used by webtrees to store media files, GEDCOM files, temporary files, etc. These files may contain private data, and should not be made available over the internet.') ?>
34            </div>
35            <div class="form-text">
36                <?= /* I18N: “Apache” is a software program. */
37                I18N::translate('To protect this private data, webtrees uses an Apache configuration file (.htaccess) which blocks all access to this folder. If your web-server does not support .htaccess files, and you cannot restrict access to this folder, then you can select another folder, away from your web documents.') ?>
38            </div>
39            <div class="form-text">
40                <?= I18N::translate('If you select a different folder, you must also move all files (except config.ini.php, index.php, and .htaccess) from the existing folder to the new folder.') ?>
41            </div>
42            <div class="form-text">
43                <?= I18N::translate('The folder can be specified in full (e.g. /home/user_name/webtrees_data/) or relative to the installation folder (e.g. ../../webtrees_data/).') ?>
44            </div>
45        </div>
46    </div>
47
48    <!-- TIMEZONE -->
49    <div class="row mb-3">
50        <label for="TIMEZONE" class="col-sm-3 col-form-label">
51            <?= I18N::translate('Time zone') ?>
52        </label>
53        <div class="col-sm-9">
54            <?= view('components/select', ['name' => 'TIMEZONE', 'selected' => Site::getPreference('TIMEZONE'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
55            <div class="form-text">
56                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
57            </div>
58        </div>
59    </div>
60
61    <!-- THEME_DIR -->
62    <div class="row mb-3">
63        <label for="THEME_DIR" class="col-sm-3 col-form-label">
64            <?= /* I18N: A configuration setting */
65            I18N::translate('Default theme') ?>
66        </label>
67        <div class="col-sm-9">
68            <?= view('components/select', ['name' => 'THEME_DIR', 'selected' => Site::getPreference('THEME_DIR'), 'options' => $all_themes]) ?>
69            <div class="form-text">
70                <?= /* I18N: Help text for the "Default theme" site configuration setting */
71                I18N::translate('You can change the appearance of webtrees using “themes”. Each theme has a different style, layout, color scheme, etc.') ?>
72            </div>
73        </div>
74    </div>
75
76    <!-- LANGUAGE -->
77    <div class="row mb-3">
78        <label class="col-sm-3 col-form-label" for="LANGUAGE">
79            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
80        </label>
81        <div class="col-sm-9">
82            <select id="LANGUAGE" name="LANGUAGE" class="form-select">
83                <?php foreach (I18N::activeLocales() as $active_locale) : ?>
84                    <option value="<?= $active_locale->languageTag() ?>" <?= Site::getPreference('LANGUAGE') === $active_locale->languageTag() ? 'selected' : '' ?>>
85                        <?= $active_locale->endonym() ?>
86                    </option>
87                <?php endforeach ?>
88            </select>
89            <div class="form-text">
90                <?= /* I18N: Help text for the “Language” configuration setting */ I18N::translate('If a visitor to the website has not selected a preferred language in their browser preferences, or they have selected an unsupported language, then this language will be used. Typically this applies to search engines.') ?>
91            </div>
92        </div>
93    </div>
94
95    <!-- ALLOW_CHANGE_GEDCOM -->
96    <fieldset class="row mb-3">
97        <legend class="col-form-label col-sm-3">
98            <?= /* I18N: A configuration setting */
99            I18N::translate('Show list of family trees') ?>
100        </legend>
101        <div class="col-sm-9">
102            <?= view('components/radios-inline', ['name' => 'ALLOW_CHANGE_GEDCOM', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) Site::getPreference('ALLOW_CHANGE_GEDCOM')]) ?>
103            <div class="form-text">
104                <?= /* I18N: Help text for the “Show list of family trees” site configuration setting */
105                I18N::translate('For websites with more than one family tree, this option will show the list of family trees in the main menu, the search pages, etc.') ?>
106            </div>
107        </div>
108    </fieldset>
109
110    <div class="row mb-3">
111        <div class="offset-sm-3 col-sm-9">
112            <button type="submit" class="btn btn-primary">
113                <?= view('icons/save') ?>
114                <?= I18N::translate('save') ?>
115            </button>
116
117            <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-secondary">
118                <?= view('icons/cancel') ?>
119                <?= I18N::translate('cancel') ?>
120            </a>
121        </div>
122    </div>
123
124    <?= csrf_field() ?>
125</form>
126