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