xref: /webtrees/resources/views/edit-account-page.phtml (revision 7b5ff3ba7ebe870983e109f10d8f08cc8ac9885b)
1<?php
2
3use Fisharebest\Webtrees\Contracts\UserInterface;
4use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Individual;
7use Fisharebest\Webtrees\Tree;
8use Fisharebest\Webtrees\View;
9
10/**
11 * @var array<string,string> $contact_methods
12 * @var Individual|null      $default_individual
13 * @var array<string,string> $languages
14 * @var Individual|null      $my_individual_record
15 * @var bool                 $show_delete_option
16 * @var array<string,string> $timezones
17 * @var string               $title
18 * @var Tree|null            $tree
19 * @var UserInterface        $user
20 */
21
22?>
23
24<h2 class="wt-page-title">
25    <?= $title ?>
26</h2>
27
28<form method="post" class="wt-page-options wt-page-options-my-account">
29    <?= csrf_field() ?>
30
31    <div class="row form-group">
32        <label class="col-sm-3 col-form-label wt-page-options-label" for="user-name">
33            <?= I18N::translate('Username') ?>
34        </label>
35        <div class="col-sm-9 wt-page-options-value">
36            <input type="text" class="form-control" id="user-name" name="user_name" value="<?= e($user->userName()) ?>" dir="auto" aria-describedby="username-description" required="required">
37            <div class="form-text" id="username-description">
38                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
39            </div>
40        </div>
41    </div>
42
43    <div class="row form-group">
44        <label class="col-sm-3 col-form-label wt-page-options-label" for="real-name">
45            <?= I18N::translate('Real name') ?>
46        </label>
47        <div class="col-sm-9 wt-page-options-value">
48            <input type="text" class="form-control" id="real-name" name="real_name" value="<?= e($user->realName()) ?>" dir="auto" aria-describedby="real-name-description" required="required">
49            <div class="form-text" id="real-name-description">
50                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
51            </div>
52        </div>
53    </div>
54
55    <?php if ($tree instanceof Tree) : ?>
56        <div class="row form-group">
57            <label class="col-sm-3 col-form-label wt-page-options-label" for="gedcom-id">
58                <?= I18N::translate('Individual record') ?>
59            </label>
60            <div class="col-sm-9 wt-page-options-value">
61                <select class="form-control" id="gedcom-id" aria-describedby="gedcom-id-description" disabled>
62                    <?php if ($my_individual_record !== null) : ?>
63                        <option value=""><?= $my_individual_record->fullName() ?></option>
64                    <?php else : ?>
65                        <option value=""><?= I18N::translateContext('unknown people', 'Unknown') ?></option>
66                    <?php endif ?>
67                </select>
68                <div class="form-text" id="gedcom-id-description">
69                    <?= I18N::translate('This is a link to your own record in the family tree. If this is the wrong individual, contact an administrator.') ?>
70                </div>
71            </div>
72        </div>
73
74        <div class="row form-group">
75            <label class="col-sm-3 col-form-label wt-page-options-label" for="default-xref">
76                <?= I18N::translate('Default individual') ?>
77            </label>
78            <div class="col-sm-9 wt-page-options-value">
79                <?= view('components/select-individual', ['name' => 'default-xref', 'id' => 'default-xref', 'individual' => $default_individual, 'tree' => $tree]) ?>
80                <div class="form-text" id="default-xref-description">
81                    <?= I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
82                </div>
83            </div>
84        </div>
85    <?php endif ?>
86
87    <div class="row form-group">
88        <label class="col-sm-3 col-form-label wt-page-options-label" for="password">
89            <?= I18N::translate('Password') ?>
90        </label>
91        <div class="col-sm-9 wt-page-options-value">
92            <input class="form-control" type="password" id="password" name="password" aria-describedby="password-description" autocomplete="new-password" data-wt-show-password-text="<?= e(I18N::translate('show')) ?>" data-wt-show-password-title="<?= e(I18N::translate('Show password')) ?>" data-wt-hide-password-text="<?= e(I18N::translate('hide')) ?>" data-wt-hide-password-title="<?= e(I18N::translate('Hide password')) ?>">
93            <div class="form-text" id="password-description">
94                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
95                <br>
96                <?= I18N::translate('Leave the password blank if you want to keep the current password.') ?>
97            </div>
98        </div>
99    </div>
100
101    <div class="row form-group">
102        <label class="col-sm-3 col-form-label wt-page-options-label" for="language">
103            <?= I18N::translate('Language') ?>
104        </label>
105        <div class="col-sm-9 wt-page-options-value">
106            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE), 'options' => $languages]) ?>
107        </div>
108    </div>
109
110    <div class="row form-group">
111        <label class="col-sm-3 col-form-label wt-page-options-label" for="timezone">
112            <?= I18N::translate('Time zone') ?>
113        </label>
114        <div class="col-sm-9 wt-page-options-value">
115            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => $timezones]) ?>
116            <div class="form-text" id="timezone-description">
117                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
118            </div>
119        </div>
120    </div>
121
122    <div class="row form-group">
123        <label class="col-sm-3 col-form-label wt-page-options-label" for="email">
124            <?= I18N::translate('Email address') ?>
125        </label>
126        <div class="col-sm-9 wt-page-options-value">
127            <input class="form-control" type="email" id="email" name="email" value="<?= e($user->email()) ?>" aria-describedby="email-description">
128            <div class="form-text" id="email-description">
129                <?= I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.') ?>
130            </div>
131        </div>
132    </div>
133
134    <div class="row form-group">
135        <label class="col-sm-3 col-form-label wt-page-options-label" for="contact-method">
136            <?= I18N::translate('Contact method') ?>
137        </label>
138        <div class="col-sm-9 wt-page-options-value">
139            <?= view('components/select', ['name' => 'contact-method', 'id' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
140            <div class="form-text" id="contact-method-description">
141            <?= I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.') ?>
142            </div>
143        </div>
144    </div>
145
146    <fieldset class="row form-group">
147        <legend class="col-sm-3 col-form-label wt-page-options-label">
148            <?= I18N::translate('Visible online') ?>
149        </legend>
150        <div class="col-sm-9 wt-page-options-value">
151            <?= view('components/checkbox', ['label' => I18N::translate('Visible to other users when online'), 'name' => 'visible-online', 'checked' => (bool) $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE)]) ?>
152            <div class="form-text" id="visible-online-description">
153                <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
154            </div>
155        </div>
156    </fieldset>
157
158    <div class="row form-group">
159        <div class="col-sm-3 wt-page-options-label"></div>
160        <div class="col-sm-9 wt-page-options-value">
161            <button type="submit" class="btn btn-primary">
162                <?= view('icons/save') ?>
163                <?= I18N::translate('save') ?>
164            </button>
165        </div>
166    </div>
167</form>
168
169<?php if ($show_delete_option) : ?>
170    <div class="row form-group">
171        <div class="col-sm-3 wt-page-options-label"></div>
172        <div class="col-sm-9 wt-page-options-value">
173            <a href="#" class="btn btn-danger" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($user->userName())) ?>" data-wt-post-url="<?= e(route(AccountDelete::class)) ?>">
174                <?= view('icons/delete') ?>
175                <?= I18N::translate('Delete your account') ?>
176            </a>
177        </div>
178    </div>
179<?php endif ?>
180