xref: /webtrees/resources/views/edit-account-page.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1a49d0e3fSGreg Roach<?php
2a49d0e3fSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
51fe542e9SGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
6a49d0e3fSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
7a49d0e3fSGreg Roachuse Fisharebest\Webtrees\I18N;
87c2c99faSGreg Roachuse Fisharebest\Webtrees\Individual;
97c4add84SGreg Roachuse Fisharebest\Webtrees\Tree;
10a49d0e3fSGreg Roach
117c2c99faSGreg Roach/**
127c2c99faSGreg Roach * @var array<string,string> $contact_methods
137c2c99faSGreg Roach * @var Individual|null      $default_individual
147c2c99faSGreg Roach * @var array<string,string> $languages
157c2c99faSGreg Roach * @var Individual|null      $my_individual_record
167c2c99faSGreg Roach * @var bool                 $show_delete_option
177c2c99faSGreg Roach * @var array<string,string> $timezones
187c2c99faSGreg Roach * @var string               $title
197c2c99faSGreg Roach * @var Tree|null            $tree
207c2c99faSGreg Roach * @var UserInterface        $user
217c2c99faSGreg Roach */
227c2c99faSGreg Roach
23a49d0e3fSGreg Roach?>
24dd6b2bfcSGreg Roach
25dd6b2bfcSGreg Roach<h2 class="wt-page-title">
26dd6b2bfcSGreg Roach    <?= $title ?>
27dd6b2bfcSGreg Roach</h2>
28dd6b2bfcSGreg Roach
29a49d0e3fSGreg Roach<form method="post" class="wt-page-options wt-page-options-my-account">
309e3c2cf9SGreg Roach    <div class="row">
31dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="user-name">
32dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
33dd6b2bfcSGreg Roach        </label>
34dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
357dca5265SGreg Roach            <input type="text" class="form-control" id="user-name" name="user_name" value="<?= e($user->userName()) ?>" dir="auto" aria-describedby="username-description" required="required">
36315eb316SGreg Roach            <div class="form-text" id="username-description">
37dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
38315eb316SGreg Roach            </div>
39dd6b2bfcSGreg Roach        </div>
40dd6b2bfcSGreg Roach    </div>
41dd6b2bfcSGreg Roach
429e3c2cf9SGreg Roach    <div class="row">
43dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="real-name">
44dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
45dd6b2bfcSGreg Roach        </label>
46dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
477dca5265SGreg Roach            <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">
48315eb316SGreg Roach            <div class="form-text" id="real-name-description">
49dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
50315eb316SGreg Roach            </div>
51dd6b2bfcSGreg Roach        </div>
52dd6b2bfcSGreg Roach    </div>
53dd6b2bfcSGreg Roach
54a49d0e3fSGreg Roach    <?php if ($tree instanceof Tree) : ?>
559e3c2cf9SGreg Roach        <div class="row">
56dd6b2bfcSGreg Roach            <label class="col-sm-3 col-form-label wt-page-options-label" for="gedcom-id">
57dd6b2bfcSGreg Roach                <?= I18N::translate('Individual record') ?>
58dd6b2bfcSGreg Roach            </label>
59dd6b2bfcSGreg Roach            <div class="col-sm-9 wt-page-options-value">
604b9213b3SGreg Roach                <select class="form-select" id="gedcom-id" aria-describedby="gedcom-id-description" disabled>
61dd6b2bfcSGreg Roach                    <?php if ($my_individual_record !== null) : ?>
6239ca88baSGreg Roach                        <option value=""><?= $my_individual_record->fullName() ?></option>
63dd6b2bfcSGreg Roach                    <?php else : ?>
64dd6b2bfcSGreg Roach                        <option value=""><?= I18N::translateContext('unknown people', 'Unknown') ?></option>
65dd6b2bfcSGreg Roach                    <?php endif ?>
66dd6b2bfcSGreg Roach                </select>
67315eb316SGreg Roach                <div class="form-text" id="gedcom-id-description">
68dd6b2bfcSGreg Roach                    <?= I18N::translate('This is a link to your own record in the family tree. If this is the wrong individual, contact an administrator.') ?>
69315eb316SGreg Roach                </div>
70dd6b2bfcSGreg Roach            </div>
71dd6b2bfcSGreg Roach        </div>
72dd6b2bfcSGreg Roach
739e3c2cf9SGreg Roach        <div class="row">
747c4add84SGreg Roach            <label class="col-sm-3 col-form-label wt-page-options-label" for="default-xref">
75dd6b2bfcSGreg Roach                <?= I18N::translate('Default individual') ?>
76dd6b2bfcSGreg Roach            </label>
77dd6b2bfcSGreg Roach            <div class="col-sm-9 wt-page-options-value">
787c4add84SGreg Roach                <?= view('components/select-individual', ['name' => 'default-xref', 'id' => 'default-xref', 'individual' => $default_individual, 'tree' => $tree]) ?>
79315eb316SGreg Roach                <div class="form-text" id="default-xref-description">
80dd6b2bfcSGreg Roach                    <?= I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
81315eb316SGreg Roach                </div>
82dd6b2bfcSGreg Roach            </div>
83dd6b2bfcSGreg Roach        </div>
84a49d0e3fSGreg Roach    <?php endif ?>
85dd6b2bfcSGreg Roach
869e3c2cf9SGreg Roach    <div class="row">
87dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="password">
88dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
89dd6b2bfcSGreg Roach        </label>
90dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
91d4786c66SGreg Roach            <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')) ?>">
92315eb316SGreg Roach            <div class="form-text" id="password-description">
9354bcf2f0SRico Sonntag                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
94dd6b2bfcSGreg Roach                <br>
95dd6b2bfcSGreg Roach                <?= I18N::translate('Leave the password blank if you want to keep the current password.') ?>
96315eb316SGreg Roach            </div>
97dd6b2bfcSGreg Roach        </div>
98dd6b2bfcSGreg Roach    </div>
99dd6b2bfcSGreg Roach
1009e3c2cf9SGreg Roach    <div class="row">
101dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="language">
102dd6b2bfcSGreg Roach            <?= I18N::translate('Language') ?>
103dd6b2bfcSGreg Roach        </label>
104dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
1051fe542e9SGreg Roach            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE), 'options' => $languages]) ?>
106dd6b2bfcSGreg Roach        </div>
107dd6b2bfcSGreg Roach    </div>
108dd6b2bfcSGreg Roach
1099e3c2cf9SGreg Roach    <div class="row">
110dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="timezone">
111dd6b2bfcSGreg Roach            <?= I18N::translate('Time zone') ?>
112dd6b2bfcSGreg Roach        </label>
113dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
1141fe542e9SGreg Roach            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => $timezones]) ?>
115315eb316SGreg Roach            <div class="form-text" id="timezone-description">
116dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
117315eb316SGreg Roach            </div>
118dd6b2bfcSGreg Roach        </div>
119dd6b2bfcSGreg Roach    </div>
120dd6b2bfcSGreg Roach
1219e3c2cf9SGreg Roach    <div class="row">
122dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="email">
123dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
124dd6b2bfcSGreg Roach        </label>
125dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
126e5a6b4d4SGreg Roach            <input class="form-control" type="email" id="email" name="email" value="<?= e($user->email()) ?>" aria-describedby="email-description">
127315eb316SGreg Roach            <div class="form-text" id="email-description">
128dd6b2bfcSGreg Roach                <?= 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.') ?>
129315eb316SGreg Roach            </div>
130dd6b2bfcSGreg Roach        </div>
131dd6b2bfcSGreg Roach    </div>
132dd6b2bfcSGreg Roach
1339e3c2cf9SGreg Roach    <div class="row">
134dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label wt-page-options-label" for="contact-method">
135dd6b2bfcSGreg Roach            <?= I18N::translate('Contact method') ?>
136dd6b2bfcSGreg Roach        </label>
137dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
1381fe542e9SGreg Roach            <?= view('components/select', ['name' => 'contact-method', 'id' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
139315eb316SGreg Roach            <div class="form-text" id="contact-method-description">
140dd6b2bfcSGreg Roach            <?= 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.') ?>
141315eb316SGreg Roach            </div>
142dd6b2bfcSGreg Roach        </div>
143dd6b2bfcSGreg Roach    </div>
144dd6b2bfcSGreg Roach
1459e3c2cf9SGreg Roach    <fieldset class="row">
146dd6b2bfcSGreg Roach        <legend class="col-sm-3 col-form-label wt-page-options-label">
147dd6b2bfcSGreg Roach            <?= I18N::translate('Visible online') ?>
148dd6b2bfcSGreg Roach        </legend>
149dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
1501fe542e9SGreg Roach            <?= view('components/checkbox', ['label' => I18N::translate('Visible to other users when online'), 'name' => 'visible-online', 'checked' => (bool) $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE)]) ?>
151315eb316SGreg Roach            <div class="form-text" id="visible-online-description">
152dd6b2bfcSGreg Roach                <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
153dd6b2bfcSGreg Roach            </div>
154dd6b2bfcSGreg Roach        </div>
155dd6b2bfcSGreg Roach    </fieldset>
156dd6b2bfcSGreg Roach
1579e3c2cf9SGreg Roach    <div class="row mb-3">
158dd6b2bfcSGreg Roach        <div class="col-sm-3 wt-page-options-label"></div>
159dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
160a49d0e3fSGreg Roach            <button type="submit" class="btn btn-primary">
161a49d0e3fSGreg Roach                <?= view('icons/save') ?>
162a49d0e3fSGreg Roach                <?= I18N::translate('save') ?>
163a49d0e3fSGreg Roach            </button>
164dd6b2bfcSGreg Roach        </div>
165dd6b2bfcSGreg Roach    </div>
16681443e3cSGreg Roach
16781443e3cSGreg Roach    <?= csrf_field() ?>
168dd6b2bfcSGreg Roach</form>
169dd6b2bfcSGreg Roach
170dd6b2bfcSGreg Roach<?php if ($show_delete_option) : ?>
1719e3c2cf9SGreg Roach    <div class="row mb-3">
172dd6b2bfcSGreg Roach        <div class="col-sm-3 wt-page-options-label"></div>
173dd6b2bfcSGreg Roach        <div class="col-sm-9 wt-page-options-value">
174d4786c66SGreg Roach            <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)) ?>">
175a49d0e3fSGreg Roach                <?= view('icons/delete') ?>
176a49d0e3fSGreg Roach                <?= I18N::translate('Delete your account') ?>
177a49d0e3fSGreg Roach            </a>
178dd6b2bfcSGreg Roach        </div>
179dd6b2bfcSGreg Roach    </div>
180dd6b2bfcSGreg Roach<?php endif ?>
181