xref: /webtrees/resources/views/admin/users-edit.phtml (revision 0acf1b4bae16cbf21a23b10e22e968d2efdf4aea)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
5b6c326d8SGreg Roachuse Fisharebest\Webtrees\Auth;
61fe542e9SGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
77c2c99faSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
84c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserEditAction;
94c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
10510d3f2fSGreg Roachuse Fisharebest\Webtrees\I18N;
117c2c99faSGreg Roachuse Fisharebest\Webtrees\Registry;
127c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
13b6c326d8SGreg Roachuse Fisharebest\Webtrees\View;
147c2c99faSGreg Roachuse Illuminate\Support\Collection;
157c2c99faSGreg Roach
167c2c99faSGreg Roach/**
177c2c99faSGreg Roach * @var array<string,string> $contact_methods
187c2c99faSGreg Roach * @var string               $default_language
197c2c99faSGreg Roach * @var array<string,string> $languages
207c2c99faSGreg Roach * @var array<string,string> $roles
217c2c99faSGreg Roach * @var array<string,string> $theme_options
227c2c99faSGreg Roach * @var string               $title
2336779af1SGreg Roach * @var Collection<int,Tree>     $trees
247c2c99faSGreg Roach * @var UserInterface        $user
257c2c99faSGreg Roach */
26b6c326d8SGreg Roach
27b6c326d8SGreg Roach?>
28dd6b2bfcSGreg Roach
294c3563c0SGreg Roach<?= view('components/breadcrumbs', ['links' => [
304c3563c0SGreg Roach    route(ControlPanel::class) => I18N::translate('Control panel'),
314c3563c0SGreg Roach    route(UserListPage::class) => I18N::translate('User administration'),
324c3563c0SGreg Roach    $title,
334c3563c0SGreg Roach]]) ?>
34dd6b2bfcSGreg Roach
35dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
36dd6b2bfcSGreg Roach
374c3563c0SGreg Roach<form method="post" action="<?= e(route(UserEditAction::class)) ?>" class="form-horizontal" autocomplete="off">
38895230eeSGreg Roach    <input type="hidden" name="user_id" value="<?= $user->id() ?>">
39dd6b2bfcSGreg Roach
40dd6b2bfcSGreg Roach    <!-- REAL NAME -->
419e3c2cf9SGreg Roach    <div class="row mb-3">
42dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="real_name">
43dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
44dd6b2bfcSGreg Roach        </label>
45dd6b2bfcSGreg Roach        <div class="col-sm-9">
467dca5265SGreg Roach            <input class="form-control" type="text" id="real_name" name="real_name" required="required" maxlength="64" value="<?= e($user->realName()) ?>" dir="auto">
47315eb316SGreg Roach            <div class="form-text">
48dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
49315eb316SGreg Roach            </div>
50dd6b2bfcSGreg Roach        </div>
51dd6b2bfcSGreg Roach    </div>
52dd6b2bfcSGreg Roach
53dd6b2bfcSGreg Roach    <!-- USER NAME -->
549e3c2cf9SGreg Roach    <div class="row mb-3">
55dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="username">
56dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
57dd6b2bfcSGreg Roach        </label>
58dd6b2bfcSGreg Roach        <div class="col-sm-9">
597dca5265SGreg Roach            <input class="form-control" type="text" id="username" name="username" required="required" maxlength="32" value="<?= e($user->userName()) ?>" dir="auto">
60315eb316SGreg Roach            <div class="form-text">
61dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
62315eb316SGreg Roach            </div>
63dd6b2bfcSGreg Roach        </div>
64dd6b2bfcSGreg Roach    </div>
65dd6b2bfcSGreg Roach
66dd6b2bfcSGreg Roach    <!-- PASSWORD -->
679e3c2cf9SGreg Roach    <div class="row mb-3">
68510d3f2fSGreg Roach        <label class="col-sm-3 col-form-label" for="password">
69dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
70dd6b2bfcSGreg Roach        </label>
71dd6b2bfcSGreg Roach        <div class="col-sm-9">
72d4786c66SGreg Roach            <input class="form-control" type="password" id="password" name="password" pattern = ".{8,}" placeholder="<?= I18N::plural('Use at least %s character.', 'Use at least %s characters.', 8, I18N::number(8)) ?>" <?= $user->id() ? '' : 'required' ?> 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')) ?>">
73315eb316SGreg Roach            <div class="form-text">
7454bcf2f0SRico Sonntag                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
75315eb316SGreg Roach            </div>
76dd6b2bfcSGreg Roach        </div>
77dd6b2bfcSGreg Roach    </div>
78dd6b2bfcSGreg Roach
79dd6b2bfcSGreg Roach    <!-- EMAIL ADDRESS -->
809e3c2cf9SGreg Roach    <div class="row mb-3">
81dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="email">
82dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
83dd6b2bfcSGreg Roach        </label>
84dd6b2bfcSGreg Roach        <div class="col-sm-9">
857dca5265SGreg Roach            <input class="form-control" type="email" id="email" name="email" required="required" maxlength="64" value="<?= e($user->email()) ?>">
86315eb316SGreg Roach            <div class="form-text">
87dd6b2bfcSGreg 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.') ?>
88315eb316SGreg Roach            </div>
89dd6b2bfcSGreg Roach        </div>
90dd6b2bfcSGreg Roach    </div>
91dd6b2bfcSGreg Roach
92dd6b2bfcSGreg Roach    <!-- EMAIL VERIFIED -->
93dd6b2bfcSGreg Roach    <!-- ACCOUNT APPROVED -->
949e3c2cf9SGreg Roach    <div class="row mb-3">
95dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="verified">
96dd6b2bfcSGreg Roach            <?= I18N::translate('Account approval and email verification') ?>
97dd6b2bfcSGreg Roach        </label>
98dd6b2bfcSGreg Roach        <div class="col-sm-9">
99dd6b2bfcSGreg Roach            <div class="form-check">
100dd6b2bfcSGreg Roach                <label>
1011fe542e9SGreg Roach                    <input type="checkbox" name="verified" value="1" <?= $user->getPreference(UserInterface::PREF_IS_EMAIL_VERIFIED) === '1' ? 'checked' : '' ?>>
102dd6b2bfcSGreg Roach                    <?= I18N::translate('Email verified') ?>
103dd6b2bfcSGreg Roach                </label>
104dd6b2bfcSGreg Roach                <label>
1051fe542e9SGreg Roach                    <input type="checkbox" name="approved" value="1" <?= $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) === '1' ? 'checked' : '' ?>>
106dd6b2bfcSGreg Roach                    <?= I18N::translate('Approved by administrator') ?>
107dd6b2bfcSGreg Roach                </label>
108315eb316SGreg Roach                <div class="form-text">
109dd6b2bfcSGreg Roach                    <?= I18N::translate('When a user registers for an account, an email is sent to their email address with a verification link. When they follow this link, we know the email address is correct, and the “email verified” option is selected automatically.') ?>
110315eb316SGreg Roach                </div>
111315eb316SGreg Roach                <div class="form-text">
112dd6b2bfcSGreg Roach                    <?= I18N::translate('If an administrator creates a user account, the verification email is not sent, and the email must be verified manually.') ?>
113315eb316SGreg Roach                </div>
114315eb316SGreg Roach                <div class="form-text">
115dd6b2bfcSGreg Roach                    <?= I18N::translate('You should not approve an account unless you know that the email address is correct.') ?>
116315eb316SGreg Roach                </div>
117315eb316SGreg Roach                <div class="form-text">
118dd6b2bfcSGreg Roach                    <?= I18N::translate('A user will not be able to sign in until both “email verified” and “approved by administrator” are selected.') ?>
119315eb316SGreg Roach                </div>
120dd6b2bfcSGreg Roach            </div>
121dd6b2bfcSGreg Roach        </div>
122dd6b2bfcSGreg Roach    </div>
123dd6b2bfcSGreg Roach
124dd6b2bfcSGreg Roach    <!-- LANGUAGE -->
1259e3c2cf9SGreg Roach    <div class="row mb-3">
126dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="language">
127dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
128dd6b2bfcSGreg Roach        </label>
129dd6b2bfcSGreg Roach        <div class="col-sm-9">
1301fe542e9SGreg Roach            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE, $default_language), 'options' => $languages]) ?>
131dd6b2bfcSGreg Roach        </div>
132dd6b2bfcSGreg Roach    </div>
133dd6b2bfcSGreg Roach
134dd6b2bfcSGreg Roach    <!-- TIMEZONE -->
1359e3c2cf9SGreg Roach    <div class="row mb-3">
136dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="timezone">
137dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
138dd6b2bfcSGreg Roach        </label>
139dd6b2bfcSGreg Roach        <div class="col-sm-9">
1401fe542e9SGreg Roach            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
141315eb316SGreg Roach            <div class="form-text">
142dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
143315eb316SGreg Roach            </div>
144dd6b2bfcSGreg Roach        </div>
145dd6b2bfcSGreg Roach    </div>
146dd6b2bfcSGreg Roach
147dd6b2bfcSGreg Roach    <!-- AUTO ACCEPT -->
1489e3c2cf9SGreg Roach    <div class="row mb-3">
149dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="auto_accept">
150dd6b2bfcSGreg Roach            <?= I18N::translate('Changes') ?>
151dd6b2bfcSGreg Roach        </label>
152dd6b2bfcSGreg Roach        <div class="col-sm-9">
153dd6b2bfcSGreg Roach            <div class="form-check">
154dd6b2bfcSGreg Roach                <label>
1551fe542e9SGreg Roach                    <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1' ? 'checked' : '' ?>>
156dd6b2bfcSGreg Roach                    <?= I18N::translate('Automatically accept changes made by this user') ?>
157dd6b2bfcSGreg Roach                </label>
158315eb316SGreg Roach                <div class="form-text">
159dd6b2bfcSGreg Roach                    <?= I18N::translate('Normally, any changes made to a family tree need to be reviewed by a moderator. This option allows a user to make changes without needing a moderator.') ?>
160315eb316SGreg Roach                </div>
161dd6b2bfcSGreg Roach            </div>
162dd6b2bfcSGreg Roach        </div>
163dd6b2bfcSGreg Roach    </div>
164dd6b2bfcSGreg Roach
165dd6b2bfcSGreg Roach    <!-- VISIBLE ONLINE -->
1669e3c2cf9SGreg Roach    <div class="row mb-3">
1677c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="visible-online">
168dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Visible online') ?>
169dd6b2bfcSGreg Roach        </label>
170dd6b2bfcSGreg Roach        <div class="col-sm-9">
171dd6b2bfcSGreg Roach            <div class="form-check">
172dd6b2bfcSGreg Roach                <label>
1731fe542e9SGreg Roach                    <input type="checkbox" id="visible-online" name="visible-online" value="1" <?= $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1' ? 'checked' : '' ?>>
174dd6b2bfcSGreg Roach                    <?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
175dd6b2bfcSGreg Roach                </label>
176315eb316SGreg Roach                <div class="form-text">
177dd6b2bfcSGreg Roach                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
178315eb316SGreg Roach                </div>
179dd6b2bfcSGreg Roach            </div>
180dd6b2bfcSGreg Roach        </div>
181dd6b2bfcSGreg Roach    </div>
182dd6b2bfcSGreg Roach
183dd6b2bfcSGreg Roach    <!-- CONTACT METHOD -->
1849e3c2cf9SGreg Roach    <div class="row mb-3">
1857c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="contact-method">
186dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
187dd6b2bfcSGreg Roach        </label>
188dd6b2bfcSGreg Roach        <div class="col-sm-9">
1891fe542e9SGreg Roach            <?= view('components/select', ['id' => 'contact-method', 'name' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
190315eb316SGreg Roach            <div class="form-text">
191dd6b2bfcSGreg Roach                <?= /* I18N: Help text for the “Preferred contact method” configuration setting */
192dd6b2bfcSGreg 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.') ?>
193315eb316SGreg Roach            </div>
194dd6b2bfcSGreg Roach        </div>
195dd6b2bfcSGreg Roach    </div>
196dd6b2bfcSGreg Roach
197dd6b2bfcSGreg Roach    <!-- THEME -->
1989e3c2cf9SGreg Roach    <div class="row mb-3">
199dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="theme">
200dd6b2bfcSGreg Roach            <?= I18N::translate('Theme') ?>
201dd6b2bfcSGreg Roach        </label>
202dd6b2bfcSGreg Roach        <div class="col-sm-9">
2031fe542e9SGreg Roach            <?= view('components/select', ['name' => 'theme', 'selected' => $user->getPreference(UserInterface::PREF_THEME), 'options' => $theme_options]) ?>
204dd6b2bfcSGreg Roach        </div>
205dd6b2bfcSGreg Roach    </div>
206dd6b2bfcSGreg Roach
207dd6b2bfcSGreg Roach    <!-- COMMENTS -->
2089e3c2cf9SGreg Roach    <div class="row mb-3">
209e4f0f6f0SGreg Roach        <label class="col-sm-3 col-form-label" for="comment">
210dd6b2bfcSGreg Roach            <?= I18N::translate('Administrator comments on user') ?>
211dd6b2bfcSGreg Roach        </label>
212dd6b2bfcSGreg Roach        <div class="col-sm-9">
2131fe542e9SGreg Roach            <textarea class="form-control" id="comment" name="comment" rows="4" dir="auto" maxlength="255"><?= e($user->getPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT)) ?></textarea>
214dd6b2bfcSGreg Roach        </div>
215dd6b2bfcSGreg Roach    </div>
216dd6b2bfcSGreg Roach
217dd6b2bfcSGreg Roach    <!-- ADMINISTRATOR -->
2189e3c2cf9SGreg Roach    <div class="row mb-3">
219dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="admin">
220dd6b2bfcSGreg Roach        </label>
221dd6b2bfcSGreg Roach        <div class="col-sm-9">
222dd6b2bfcSGreg Roach            <div class="form-check">
223dd6b2bfcSGreg Roach                <label>
224c8d78f19SGreg Roach                    <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference(UserInterface::PREF_IS_ADMINISTRATOR) === '1' ? 'checked="checked"' : '' ?>  <?= $user->id() === Auth::id() ? 'disabled="disabled"' : '' ?>>
225dd6b2bfcSGreg Roach                    <?= I18N::translate('Administrator') ?>
226dd6b2bfcSGreg Roach                </label>
227dd6b2bfcSGreg Roach            </div>
228dd6b2bfcSGreg Roach        </div>
229dd6b2bfcSGreg Roach    </div>
230dd6b2bfcSGreg Roach
231dd6b2bfcSGreg Roach    <h3><?= I18N::translate('Access to family trees') ?></h3>
232dd6b2bfcSGreg Roach
233dd6b2bfcSGreg Roach    <p>
234dd6b2bfcSGreg Roach        <?= I18N::translate('A role is a set of access rights, which give permission to view data, change preferences, etc. Access rights are assigned to roles, and roles are granted to users. Each family tree can assign different access to each role, and users can have a different role in each family tree.') ?>
235dd6b2bfcSGreg Roach    </p>
236dd6b2bfcSGreg Roach
237dd6b2bfcSGreg Roach    <div class="row">
2385197b5a1SGreg Roach        <div class="col-sm-4">
239dd6b2bfcSGreg Roach            <h4>
240dd6b2bfcSGreg Roach                <?= I18N::translate('Visitor') ?>
241dd6b2bfcSGreg Roach            </h4>
242315eb316SGreg Roach            <div class="form-text">
243dd6b2bfcSGreg Roach                <?= I18N::translate('Everybody has this role, including visitors to the website and search engines.') ?>
244315eb316SGreg Roach            </div>
245dd6b2bfcSGreg Roach            <h4>
246dd6b2bfcSGreg Roach                <?= I18N::translate('Member') ?>
247dd6b2bfcSGreg Roach            </h4>
248315eb316SGreg Roach            <div class="form-text">
249dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the visitor role, plus any additional access granted by the family tree configuration.') ?>
250315eb316SGreg Roach            </div>
251dd6b2bfcSGreg Roach        </div>
2525197b5a1SGreg Roach        <div class="col-sm-4">
253dd6b2bfcSGreg Roach            <h4>
254dd6b2bfcSGreg Roach                <?= I18N::translate('Editor') ?>
255dd6b2bfcSGreg Roach            </h4>
256315eb316SGreg Roach            <div class="form-text">
257dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the member role, plus permission to add/change/delete data. Any changes will need to be reviewed by a moderator, unless the user has the “automatically accept changes” option enabled.') ?>
258315eb316SGreg Roach            </div>
259dd6b2bfcSGreg Roach            <h4>
260dd6b2bfcSGreg Roach                <?= I18N::translate('Moderator') ?>
261dd6b2bfcSGreg Roach            </h4>
262315eb316SGreg Roach            <div class="form-text">
263dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the editor role, plus permission to accept/reject changes made by other users.') ?>
264315eb316SGreg Roach            </div>
265dd6b2bfcSGreg Roach        </div>
2665197b5a1SGreg Roach        <div class="col-sm-4">
267dd6b2bfcSGreg Roach            <h4>
268dd6b2bfcSGreg Roach                <?= I18N::translate('Manager') ?>
269dd6b2bfcSGreg Roach            </h4>
270315eb316SGreg Roach            <div class="form-text">
271dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the moderator role, plus any additional access granted by the family tree configuration, plus permission to change the settings/configuration of a family tree.') ?>
272315eb316SGreg Roach            </div>
273dd6b2bfcSGreg Roach            <h4>
274dd6b2bfcSGreg Roach                <?= I18N::translate('Administrator') ?>
275dd6b2bfcSGreg Roach            </h4>
276315eb316SGreg Roach            <div class="form-text">
277dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the manager role in all family trees, plus permission to change the settings/configuration of the website, users, and modules.') ?>
278315eb316SGreg Roach            </div>
279dd6b2bfcSGreg Roach        </div>
280dd6b2bfcSGreg Roach    </div>
281dd6b2bfcSGreg Roach
282dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
283dd6b2bfcSGreg Roach        <thead>
284dd6b2bfcSGreg Roach            <tr>
285dd6b2bfcSGreg Roach                <th>
286dd6b2bfcSGreg Roach                    <?= I18N::translate('Family tree') ?>
287dd6b2bfcSGreg Roach                </th>
288dd6b2bfcSGreg Roach                <th>
289dd6b2bfcSGreg Roach                    <?= I18N::translate('Role') ?>
290dd6b2bfcSGreg Roach                </th>
291dd6b2bfcSGreg Roach                <th>
292dd6b2bfcSGreg Roach                    <?= I18N::translate('Individual record') ?>
293dd6b2bfcSGreg Roach                </th>
294dd6b2bfcSGreg Roach                <th>
295dd6b2bfcSGreg Roach                    <?= I18N::translate('Restrict to immediate family') ?>
2960973b4d2SGreg Roach                    <?= view('help/link', ['topic' => 'relationship-privacy']) ?>
297dd6b2bfcSGreg Roach                </th>
298dd6b2bfcSGreg Roach            </tr>
299dd6b2bfcSGreg Roach            <tr>
300dd6b2bfcSGreg Roach                <td>
301dd6b2bfcSGreg Roach                </td>
302dd6b2bfcSGreg Roach                <td>
303dd6b2bfcSGreg Roach                </td>
304dd6b2bfcSGreg Roach                <td>
305315eb316SGreg Roach                    <div class="form-text">
306dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this user to an individual in the family tree.') ?>
307315eb316SGreg Roach                    </div>
308dd6b2bfcSGreg Roach                </td>
309dd6b2bfcSGreg Roach                <td>
310dd6b2bfcSGreg Roach                </td>
311dd6b2bfcSGreg Roach            </tr>
312dd6b2bfcSGreg Roach        </thead>
313dd6b2bfcSGreg Roach        <tbody>
314dd6b2bfcSGreg Roach            <?php foreach ($trees as $tree) : ?>
315dd6b2bfcSGreg Roach                <tr>
316dd6b2bfcSGreg Roach                    <td>
3175c7ad034SGreg Roach                        <?= e($tree->title()) ?>
318dd6b2bfcSGreg Roach                    </td>
319dd6b2bfcSGreg Roach                    <td>
3204b9213b3SGreg Roach                        <select class="form-select" name="canedit<?= $tree->id() ?>">
321dd6b2bfcSGreg Roach                            <?php foreach ($roles as $role => $description) : ?>
322dd6b2bfcSGreg Roach                                <option value="<?= $role ?>"
3231fe542e9SGreg Roach                                    <?= $role === $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) ? 'selected' : '' ?>>
324dd6b2bfcSGreg Roach                                    <?= $description ?>
325dd6b2bfcSGreg Roach                                </option>
326dd6b2bfcSGreg Roach                            <?php endforeach ?>
327dd6b2bfcSGreg Roach                        </select>
328dd6b2bfcSGreg Roach                    </td>
329dd6b2bfcSGreg Roach                    <td>
3306b9cb339SGreg Roach                        <?= view('components/select-individual', ['name' => 'gedcomid' . $tree->id(), 'individual' => Registry::individualFactory()->make($tree->getUserPreference($user, 'gedcomid'), $tree), 'tree' => $tree]) ?>
331dd6b2bfcSGreg Roach                    </td>
332dd6b2bfcSGreg Roach                    <td>
3334b9213b3SGreg Roach                        <select class="form-select" name="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" class="relpath">
334dd6b2bfcSGreg Roach                            <?php for ($n = 0; $n <= 10; ++$n) : ?>
3357fa97a69SGreg Roach                                <option value="<?= $n ?>" <?= (int) $tree->getUserPreference($user, UserInterface::PREF_TREE_PATH_LENGTH) === $n ? 'selected' : '' ?>>
336dd6b2bfcSGreg Roach                                    <?= $n ?: I18N::translate('No') ?>
337dd6b2bfcSGreg Roach                                </option>
338dd6b2bfcSGreg Roach                            <?php endfor ?>
339dd6b2bfcSGreg Roach                        </select>
340dd6b2bfcSGreg Roach                    </td>
341dd6b2bfcSGreg Roach                </tr>
342dd6b2bfcSGreg Roach            <?php endforeach ?>
343dd6b2bfcSGreg Roach        </tbody>
344dd6b2bfcSGreg Roach    </table>
345dd6b2bfcSGreg Roach
3469e3c2cf9SGreg Roach    <div class="row mb-3">
347dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
348dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
349dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
350dd6b2bfcSGreg Roach            </button>
351dd6b2bfcSGreg Roach        </div>
352dd6b2bfcSGreg Roach    </div>
35381443e3cSGreg Roach
35481443e3cSGreg Roach    <?= csrf_field() ?>
355dd6b2bfcSGreg Roach</form>
356dd6b2bfcSGreg Roach
357c16be598SGreg Roach<?= view('modals/ajax') ?>
358c16be598SGreg Roach
359dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
360dd6b2bfcSGreg Roach<script>
361dd6b2bfcSGreg Roach    $(".relpath").change(function () {
362dd6b2bfcSGreg Roach        var fieldIDx = $(this).attr("id");
363dd6b2bfcSGreg Roach        var idNum    = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH", "");
364dd6b2bfcSGreg Roach        var newIDx   = "gedcomid" + idNum;
365dd6b2bfcSGreg Roach        if ($("#" + newIDx).val() === "" && $("#".fieldIDx).val() !== "0") {
366dd6b2bfcSGreg Roach            alert("<?= I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') ?>");
367dd6b2bfcSGreg Roach            $(this).val("0");
368dd6b2bfcSGreg Roach        }
369dd6b2bfcSGreg Roach    });
370dd6b2bfcSGreg Roach</script>
371dd6b2bfcSGreg Roach<?php View::endpush() ?>
372