xref: /webtrees/resources/views/admin/site-preferences.phtml (revision e57829396e448d173bb4be808a8b9fd89548228b)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\Http\RequestHandlers\SitePreferencesAction;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Site;
7
8/**
9 * @var array<string> $all_themes
10 * @var string        $title
11 */
12
13?>
14
15<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
16
17<h1><?= $title ?></h1>
18
19<form method="post" action="<?= e(route(SitePreferencesAction::class)) ?>" class="form-horizontal">
20    <?= csrf_field() ?>
21
22    <!-- INDEX_DIRECTORY -->
23    <div class="row form-group">
24        <label for="INDEX_DIRECTORY" class="col-sm-3 col-form-label">
25            <?= /* I18N: A configuration setting */
26            I18N::translate('Data folder') ?>
27        </label>
28        <div class="col-sm-9">
29            <input type="text" class="form-control" dir="ltr" id="INDEX_DIRECTORY" name="INDEX_DIRECTORY" value="<?= e(Site::getPreference('INDEX_DIRECTORY')) ?>" maxlength="255" placeholder="data/" required="required">
30            <div class="form-text">
31                <?= /* I18N: Help text for the "Data folder" site configuration setting */
32                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.') ?>
33            </div>
34            <div class="form-text">
35                <?= /* I18N: “Apache” is a software program. */
36                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.') ?>
37            </div>
38            <div class="form-text">
39                <?= 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.') ?>
40            </div>
41            <div class="form-text">
42                <?= 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/).') ?>
43            </div>
44        </div>
45    </div>
46
47    <!-- TIMEZONE -->
48    <div class="row form-group">
49        <label for="TIMEZONE" class="col-sm-3 col-form-label">
50            <?= I18N::translate('Time zone') ?>
51        </label>
52        <div class="col-sm-9">
53            <?= view('components/select', ['name' => 'TIMEZONE', 'selected' => Site::getPreference('TIMEZONE'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
54            <div class="form-text">
55                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
56            </div>
57        </div>
58    </div>
59
60    <!-- THEME_DIR -->
61    <div class="row form-group">
62        <label for="THEME_DIR" class="col-sm-3 col-form-label">
63            <?= /* I18N: A configuration setting */
64            I18N::translate('Default theme') ?>
65        </label>
66        <div class="col-sm-9">
67            <?= view('components/select', ['name' => 'THEME_DIR', 'selected' => Site::getPreference('THEME_DIR'), 'options' => $all_themes]) ?>
68            <div class="form-text">
69                <?= /* I18N: Help text for the "Default theme" site configuration setting */
70                I18N::translate('You can change the appearance of webtrees using “themes”. Each theme has a different style, layout, color scheme, etc.') ?>
71            </div>
72        </div>
73    </div>
74
75    <!-- LANGUAGE -->
76    <div class="row form-group">
77        <label class="col-sm-3 col-form-label" for="LANGUAGE">
78            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
79        </label>
80        <div class="col-sm-9">
81            <select id="LANGUAGE" name="LANGUAGE" class="form-control">
82                <?php foreach (I18N::activeLocales() as $active_locale) : ?>
83                    <option value="<?= $active_locale->languageTag() ?>" <?= Site::getPreference('LANGUAGE') === $active_locale->languageTag() ? 'selected' : '' ?>>
84                        <?= $active_locale->endonym() ?>
85                    </option>
86                <?php endforeach ?>
87            </select>
88            <div class="form-text">
89                <?= /* 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.') ?>
90            </div>
91        </div>
92    </div>
93
94    <!-- ALLOW_CHANGE_GEDCOM -->
95    <fieldset class="row form-group">
96        <legend class="col-form-label col-sm-3">
97            <?= /* I18N: A configuration setting */
98            I18N::translate('Show list of family trees') ?>
99        </legend>
100        <div class="col-sm-9">
101            <?= view('components/radios-inline', ['name' => 'ALLOW_CHANGE_GEDCOM', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int) Site::getPreference('ALLOW_CHANGE_GEDCOM')]) ?>
102            <div class="form-text">
103                <?= /* I18N: Help text for the “Show list of family trees” site configuration setting */
104                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.') ?>
105            </div>
106        </div>
107    </fieldset>
108
109    <div class="row form-group">
110        <div class="offset-sm-3 col-sm-9">
111            <button type="submit" class="btn btn-primary">
112                <?= view('icons/save') ?>
113                <?= I18N::translate('save') ?>
114            </button>
115
116            <a href="<?= e(route(ControlPanel::class)) ?>" class="btn btn-secondary">
117                <?= view('icons/cancel') ?>
118                <?= I18N::translate('cancel') ?>
119            </a>
120        </div>
121    </div>
122</form>
123