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