xref: /webtrees/resources/views/admin/users-edit.phtml (revision 81443e3cbe4eef5ccdcf8dae716a7e35f7417b60)
1b6c326d8SGreg Roach<?php
2b6c326d8SGreg Roach
3b6c326d8SGreg Roachuse Fisharebest\Webtrees\Auth;
41fe542e9SGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
57c2c99faSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
64c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserEditAction;
74c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
8510d3f2fSGreg Roachuse Fisharebest\Webtrees\I18N;
97c2c99faSGreg Roachuse Fisharebest\Webtrees\Registry;
107c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree;
11b6c326d8SGreg Roachuse Fisharebest\Webtrees\View;
127c2c99faSGreg Roachuse Illuminate\Support\Collection;
137c2c99faSGreg Roach
147c2c99faSGreg Roach/**
157c2c99faSGreg Roach * @var array<string,string> $contact_methods
167c2c99faSGreg Roach * @var string               $default_language
177c2c99faSGreg Roach * @var array<string,string> $languages
187c2c99faSGreg Roach * @var array<string,string> $roles
197c2c99faSGreg Roach * @var array<string,string> $theme_options
207c2c99faSGreg Roach * @var string               $title
2136779af1SGreg Roach * @var Collection<int,Tree>     $trees
227c2c99faSGreg Roach * @var UserInterface        $user
237c2c99faSGreg Roach */
24b6c326d8SGreg Roach
25b6c326d8SGreg Roach?>
26dd6b2bfcSGreg Roach
274c3563c0SGreg Roach<?= view('components/breadcrumbs', ['links' => [
284c3563c0SGreg Roach    route(ControlPanel::class) => I18N::translate('Control panel'),
294c3563c0SGreg Roach    route(UserListPage::class) => I18N::translate('User administration'),
304c3563c0SGreg Roach    $title,
314c3563c0SGreg Roach]]) ?>
32dd6b2bfcSGreg Roach
33dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
34dd6b2bfcSGreg Roach
354c3563c0SGreg Roach<form method="post" action="<?= e(route(UserEditAction::class)) ?>" class="form-horizontal" autocomplete="off">
36895230eeSGreg Roach    <input type="hidden" name="user_id" value="<?= $user->id() ?>">
37dd6b2bfcSGreg Roach
38dd6b2bfcSGreg Roach    <!-- REAL NAME -->
399e3c2cf9SGreg Roach    <div class="row mb-3">
40dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="real_name">
41dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
42dd6b2bfcSGreg Roach        </label>
43dd6b2bfcSGreg Roach        <div class="col-sm-9">
447dca5265SGreg Roach            <input class="form-control" type="text" id="real_name" name="real_name" required="required" maxlength="64" value="<?= e($user->realName()) ?>" dir="auto">
45315eb316SGreg Roach            <div class="form-text">
46dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
47315eb316SGreg Roach            </div>
48dd6b2bfcSGreg Roach        </div>
49dd6b2bfcSGreg Roach    </div>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach    <!-- USER NAME -->
529e3c2cf9SGreg Roach    <div class="row mb-3">
53dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="username">
54dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
55dd6b2bfcSGreg Roach        </label>
56dd6b2bfcSGreg Roach        <div class="col-sm-9">
577dca5265SGreg Roach            <input class="form-control" type="text" id="username" name="username" required="required" maxlength="32" value="<?= e($user->userName()) ?>" dir="auto">
58315eb316SGreg Roach            <div class="form-text">
59dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
60315eb316SGreg Roach            </div>
61dd6b2bfcSGreg Roach        </div>
62dd6b2bfcSGreg Roach    </div>
63dd6b2bfcSGreg Roach
64dd6b2bfcSGreg Roach    <!-- PASSWORD -->
659e3c2cf9SGreg Roach    <div class="row mb-3">
66510d3f2fSGreg Roach        <label class="col-sm-3 col-form-label" for="password">
67dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
68dd6b2bfcSGreg Roach        </label>
69dd6b2bfcSGreg Roach        <div class="col-sm-9">
70d4786c66SGreg 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')) ?>">
71315eb316SGreg Roach            <div class="form-text">
7254bcf2f0SRico Sonntag                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
73315eb316SGreg Roach            </div>
74dd6b2bfcSGreg Roach        </div>
75dd6b2bfcSGreg Roach    </div>
76dd6b2bfcSGreg Roach
77dd6b2bfcSGreg Roach    <!-- EMAIL ADDRESS -->
789e3c2cf9SGreg Roach    <div class="row mb-3">
79dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="email">
80dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
81dd6b2bfcSGreg Roach        </label>
82dd6b2bfcSGreg Roach        <div class="col-sm-9">
837dca5265SGreg Roach            <input class="form-control" type="email" id="email" name="email" required="required" maxlength="64" value="<?= e($user->email()) ?>">
84315eb316SGreg Roach            <div class="form-text">
85dd6b2bfcSGreg 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.') ?>
86315eb316SGreg Roach            </div>
87dd6b2bfcSGreg Roach        </div>
88dd6b2bfcSGreg Roach    </div>
89dd6b2bfcSGreg Roach
90dd6b2bfcSGreg Roach    <!-- EMAIL VERIFIED -->
91dd6b2bfcSGreg Roach    <!-- ACCOUNT APPROVED -->
929e3c2cf9SGreg Roach    <div class="row mb-3">
93dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="verified">
94dd6b2bfcSGreg Roach            <?= I18N::translate('Account approval and email verification') ?>
95dd6b2bfcSGreg Roach        </label>
96dd6b2bfcSGreg Roach        <div class="col-sm-9">
97dd6b2bfcSGreg Roach            <div class="form-check">
98dd6b2bfcSGreg Roach                <label>
991fe542e9SGreg Roach                    <input type="checkbox" name="verified" value="1" <?= $user->getPreference(UserInterface::PREF_IS_EMAIL_VERIFIED) === '1' ? 'checked' : '' ?>>
100dd6b2bfcSGreg Roach                    <?= I18N::translate('Email verified') ?>
101dd6b2bfcSGreg Roach                </label>
102dd6b2bfcSGreg Roach                <label>
1031fe542e9SGreg Roach                    <input type="checkbox" name="approved" value="1" <?= $user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) === '1' ? 'checked' : '' ?>>
104dd6b2bfcSGreg Roach                    <?= I18N::translate('Approved by administrator') ?>
105dd6b2bfcSGreg Roach                </label>
106315eb316SGreg Roach                <div class="form-text">
107dd6b2bfcSGreg 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.') ?>
108315eb316SGreg Roach                </div>
109315eb316SGreg Roach                <div class="form-text">
110dd6b2bfcSGreg Roach                    <?= I18N::translate('If an administrator creates a user account, the verification email is not sent, and the email must be verified manually.') ?>
111315eb316SGreg Roach                </div>
112315eb316SGreg Roach                <div class="form-text">
113dd6b2bfcSGreg Roach                    <?= I18N::translate('You should not approve an account unless you know that the email address is correct.') ?>
114315eb316SGreg Roach                </div>
115315eb316SGreg Roach                <div class="form-text">
116dd6b2bfcSGreg Roach                    <?= I18N::translate('A user will not be able to sign in until both “email verified” and “approved by administrator” are selected.') ?>
117315eb316SGreg Roach                </div>
118dd6b2bfcSGreg Roach            </div>
119dd6b2bfcSGreg Roach        </div>
120dd6b2bfcSGreg Roach    </div>
121dd6b2bfcSGreg Roach
122dd6b2bfcSGreg Roach    <!-- LANGUAGE -->
1239e3c2cf9SGreg Roach    <div class="row mb-3">
124dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="language">
125dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
126dd6b2bfcSGreg Roach        </label>
127dd6b2bfcSGreg Roach        <div class="col-sm-9">
1281fe542e9SGreg Roach            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE, $default_language), 'options' => $languages]) ?>
129dd6b2bfcSGreg Roach        </div>
130dd6b2bfcSGreg Roach    </div>
131dd6b2bfcSGreg Roach
132dd6b2bfcSGreg Roach    <!-- TIMEZONE -->
1339e3c2cf9SGreg Roach    <div class="row mb-3">
134dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="timezone">
135dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
136dd6b2bfcSGreg Roach        </label>
137dd6b2bfcSGreg Roach        <div class="col-sm-9">
1381fe542e9SGreg Roach            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => array_combine(DateTimeZone::listIdentifiers(), DateTimeZone::listIdentifiers())]) ?>
139315eb316SGreg Roach            <div class="form-text">
140dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
141315eb316SGreg Roach            </div>
142dd6b2bfcSGreg Roach        </div>
143dd6b2bfcSGreg Roach    </div>
144dd6b2bfcSGreg Roach
145dd6b2bfcSGreg Roach    <!-- AUTO ACCEPT -->
1469e3c2cf9SGreg Roach    <div class="row mb-3">
147dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="auto_accept">
148dd6b2bfcSGreg Roach            <?= I18N::translate('Changes') ?>
149dd6b2bfcSGreg Roach        </label>
150dd6b2bfcSGreg Roach        <div class="col-sm-9">
151dd6b2bfcSGreg Roach            <div class="form-check">
152dd6b2bfcSGreg Roach                <label>
1531fe542e9SGreg Roach                    <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference(UserInterface::PREF_AUTO_ACCEPT_EDITS) === '1' ? 'checked' : '' ?>>
154dd6b2bfcSGreg Roach                    <?= I18N::translate('Automatically accept changes made by this user') ?>
155dd6b2bfcSGreg Roach                </label>
156315eb316SGreg Roach                <div class="form-text">
157dd6b2bfcSGreg 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.') ?>
158315eb316SGreg Roach                </div>
159dd6b2bfcSGreg Roach            </div>
160dd6b2bfcSGreg Roach        </div>
161dd6b2bfcSGreg Roach    </div>
162dd6b2bfcSGreg Roach
163dd6b2bfcSGreg Roach    <!-- VISIBLE ONLINE -->
1649e3c2cf9SGreg Roach    <div class="row mb-3">
1657c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="visible-online">
166dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Visible online') ?>
167dd6b2bfcSGreg Roach        </label>
168dd6b2bfcSGreg Roach        <div class="col-sm-9">
169dd6b2bfcSGreg Roach            <div class="form-check">
170dd6b2bfcSGreg Roach                <label>
1711fe542e9SGreg Roach                    <input type="checkbox" id="visible-online" name="visible-online" value="1" <?= $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE) === '1' ? 'checked' : '' ?>>
172dd6b2bfcSGreg Roach                    <?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
173dd6b2bfcSGreg Roach                </label>
174315eb316SGreg Roach                <div class="form-text">
175dd6b2bfcSGreg Roach                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
176315eb316SGreg Roach                </div>
177dd6b2bfcSGreg Roach            </div>
178dd6b2bfcSGreg Roach        </div>
179dd6b2bfcSGreg Roach    </div>
180dd6b2bfcSGreg Roach
181dd6b2bfcSGreg Roach    <!-- CONTACT METHOD -->
1829e3c2cf9SGreg Roach    <div class="row mb-3">
1837c4add84SGreg Roach        <label class="col-sm-3 col-form-label" for="contact-method">
184dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
185dd6b2bfcSGreg Roach        </label>
186dd6b2bfcSGreg Roach        <div class="col-sm-9">
1871fe542e9SGreg Roach            <?= view('components/select', ['id' => 'contact-method', 'name' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
188315eb316SGreg Roach            <div class="form-text">
189dd6b2bfcSGreg Roach                <?= /* I18N: Help text for the “Preferred contact method” configuration setting */
190dd6b2bfcSGreg 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.') ?>
191315eb316SGreg Roach            </div>
192dd6b2bfcSGreg Roach        </div>
193dd6b2bfcSGreg Roach    </div>
194dd6b2bfcSGreg Roach
195dd6b2bfcSGreg Roach    <!-- THEME -->
1969e3c2cf9SGreg Roach    <div class="row mb-3">
197dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="theme">
198dd6b2bfcSGreg Roach            <?= I18N::translate('Theme') ?>
199dd6b2bfcSGreg Roach        </label>
200dd6b2bfcSGreg Roach        <div class="col-sm-9">
2011fe542e9SGreg Roach            <?= view('components/select', ['name' => 'theme', 'selected' => $user->getPreference(UserInterface::PREF_THEME), 'options' => $theme_options]) ?>
202dd6b2bfcSGreg Roach        </div>
203dd6b2bfcSGreg Roach    </div>
204dd6b2bfcSGreg Roach
205dd6b2bfcSGreg Roach    <!-- COMMENTS -->
2069e3c2cf9SGreg Roach    <div class="row mb-3">
207e4f0f6f0SGreg Roach        <label class="col-sm-3 col-form-label" for="comment">
208dd6b2bfcSGreg Roach            <?= I18N::translate('Administrator comments on user') ?>
209dd6b2bfcSGreg Roach        </label>
210dd6b2bfcSGreg Roach        <div class="col-sm-9">
2111fe542e9SGreg Roach            <textarea class="form-control" id="comment" name="comment" rows="4" dir="auto" maxlength="255"><?= e($user->getPreference(UserInterface::PREF_NEW_ACCOUNT_COMMENT)) ?></textarea>
212dd6b2bfcSGreg Roach        </div>
213dd6b2bfcSGreg Roach    </div>
214dd6b2bfcSGreg Roach
215dd6b2bfcSGreg Roach    <!-- ADMINISTRATOR -->
2169e3c2cf9SGreg Roach    <div class="row mb-3">
217dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="admin">
218dd6b2bfcSGreg Roach        </label>
219dd6b2bfcSGreg Roach        <div class="col-sm-9">
220dd6b2bfcSGreg Roach            <div class="form-check">
221dd6b2bfcSGreg Roach                <label>
222c8d78f19SGreg 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"' : '' ?>>
223dd6b2bfcSGreg Roach                    <?= I18N::translate('Administrator') ?>
224dd6b2bfcSGreg Roach                </label>
225dd6b2bfcSGreg Roach            </div>
226dd6b2bfcSGreg Roach        </div>
227dd6b2bfcSGreg Roach    </div>
228dd6b2bfcSGreg Roach
229dd6b2bfcSGreg Roach    <h3><?= I18N::translate('Access to family trees') ?></h3>
230dd6b2bfcSGreg Roach
231dd6b2bfcSGreg Roach    <p>
232dd6b2bfcSGreg 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.') ?>
233dd6b2bfcSGreg Roach    </p>
234dd6b2bfcSGreg Roach
235dd6b2bfcSGreg Roach    <div class="row">
2365197b5a1SGreg Roach        <div class="col-sm-4">
237dd6b2bfcSGreg Roach            <h4>
238dd6b2bfcSGreg Roach                <?= I18N::translate('Visitor') ?>
239dd6b2bfcSGreg Roach            </h4>
240315eb316SGreg Roach            <div class="form-text">
241dd6b2bfcSGreg Roach                <?= I18N::translate('Everybody has this role, including visitors to the website and search engines.') ?>
242315eb316SGreg Roach            </div>
243dd6b2bfcSGreg Roach            <h4>
244dd6b2bfcSGreg Roach                <?= I18N::translate('Member') ?>
245dd6b2bfcSGreg Roach            </h4>
246315eb316SGreg Roach            <div class="form-text">
247dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the visitor role, plus any additional access granted by the family tree configuration.') ?>
248315eb316SGreg Roach            </div>
249dd6b2bfcSGreg Roach        </div>
2505197b5a1SGreg Roach        <div class="col-sm-4">
251dd6b2bfcSGreg Roach            <h4>
252dd6b2bfcSGreg Roach                <?= I18N::translate('Editor') ?>
253dd6b2bfcSGreg Roach            </h4>
254315eb316SGreg Roach            <div class="form-text">
255dd6b2bfcSGreg 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.') ?>
256315eb316SGreg Roach            </div>
257dd6b2bfcSGreg Roach            <h4>
258dd6b2bfcSGreg Roach                <?= I18N::translate('Moderator') ?>
259dd6b2bfcSGreg Roach            </h4>
260315eb316SGreg Roach            <div class="form-text">
261dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the editor role, plus permission to accept/reject changes made by other users.') ?>
262315eb316SGreg Roach            </div>
263dd6b2bfcSGreg Roach        </div>
2645197b5a1SGreg Roach        <div class="col-sm-4">
265dd6b2bfcSGreg Roach            <h4>
266dd6b2bfcSGreg Roach                <?= I18N::translate('Manager') ?>
267dd6b2bfcSGreg Roach            </h4>
268315eb316SGreg Roach            <div class="form-text">
269dd6b2bfcSGreg 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.') ?>
270315eb316SGreg Roach            </div>
271dd6b2bfcSGreg Roach            <h4>
272dd6b2bfcSGreg Roach                <?= I18N::translate('Administrator') ?>
273dd6b2bfcSGreg Roach            </h4>
274315eb316SGreg Roach            <div class="form-text">
275dd6b2bfcSGreg 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.') ?>
276315eb316SGreg Roach            </div>
277dd6b2bfcSGreg Roach        </div>
278dd6b2bfcSGreg Roach    </div>
279dd6b2bfcSGreg Roach
280dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
281dd6b2bfcSGreg Roach        <thead>
282dd6b2bfcSGreg Roach            <tr>
283dd6b2bfcSGreg Roach                <th>
284dd6b2bfcSGreg Roach                    <?= I18N::translate('Family tree') ?>
285dd6b2bfcSGreg Roach                </th>
286dd6b2bfcSGreg Roach                <th>
287dd6b2bfcSGreg Roach                    <?= I18N::translate('Role') ?>
288dd6b2bfcSGreg Roach                </th>
289dd6b2bfcSGreg Roach                <th>
290dd6b2bfcSGreg Roach                    <?= I18N::translate('Individual record') ?>
291dd6b2bfcSGreg Roach                </th>
292dd6b2bfcSGreg Roach                <th>
293dd6b2bfcSGreg Roach                    <?= I18N::translate('Restrict to immediate family') ?>
2940973b4d2SGreg Roach                    <?= view('help/link', ['topic' => 'relationship-privacy']) ?>
295dd6b2bfcSGreg Roach                </th>
296dd6b2bfcSGreg Roach            </tr>
297dd6b2bfcSGreg Roach            <tr>
298dd6b2bfcSGreg Roach                <td>
299dd6b2bfcSGreg Roach                </td>
300dd6b2bfcSGreg Roach                <td>
301dd6b2bfcSGreg Roach                </td>
302dd6b2bfcSGreg Roach                <td>
303315eb316SGreg Roach                    <div class="form-text">
304dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this user to an individual in the family tree.') ?>
305315eb316SGreg Roach                    </div>
306dd6b2bfcSGreg Roach                </td>
307dd6b2bfcSGreg Roach                <td>
308dd6b2bfcSGreg Roach                </td>
309dd6b2bfcSGreg Roach            </tr>
310dd6b2bfcSGreg Roach        </thead>
311dd6b2bfcSGreg Roach        <tbody>
312dd6b2bfcSGreg Roach            <?php foreach ($trees as $tree) : ?>
313dd6b2bfcSGreg Roach                <tr>
314dd6b2bfcSGreg Roach                    <td>
3155c7ad034SGreg Roach                        <?= e($tree->title()) ?>
316dd6b2bfcSGreg Roach                    </td>
317dd6b2bfcSGreg Roach                    <td>
3184b9213b3SGreg Roach                        <select class="form-select" name="canedit<?= $tree->id() ?>">
319dd6b2bfcSGreg Roach                            <?php foreach ($roles as $role => $description) : ?>
320dd6b2bfcSGreg Roach                                <option value="<?= $role ?>"
3211fe542e9SGreg Roach                                    <?= $role === $tree->getUserPreference($user, UserInterface::PREF_TREE_ROLE) ? 'selected' : '' ?>>
322dd6b2bfcSGreg Roach                                    <?= $description ?>
323dd6b2bfcSGreg Roach                                </option>
324dd6b2bfcSGreg Roach                            <?php endforeach ?>
325dd6b2bfcSGreg Roach                        </select>
326dd6b2bfcSGreg Roach                    </td>
327dd6b2bfcSGreg Roach                    <td>
3286b9cb339SGreg Roach                        <?= view('components/select-individual', ['name' => 'gedcomid' . $tree->id(), 'individual' => Registry::individualFactory()->make($tree->getUserPreference($user, 'gedcomid'), $tree), 'tree' => $tree]) ?>
329dd6b2bfcSGreg Roach                    </td>
330dd6b2bfcSGreg Roach                    <td>
3314b9213b3SGreg Roach                        <select class="form-select" name="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->id() ?>" class="relpath">
332dd6b2bfcSGreg Roach                            <?php for ($n = 0; $n <= 10; ++$n) : ?>
3337fa97a69SGreg Roach                                <option value="<?= $n ?>" <?= (int) $tree->getUserPreference($user, UserInterface::PREF_TREE_PATH_LENGTH) === $n ? 'selected' : '' ?>>
334dd6b2bfcSGreg Roach                                    <?= $n ?: I18N::translate('No') ?>
335dd6b2bfcSGreg Roach                                </option>
336dd6b2bfcSGreg Roach                            <?php endfor ?>
337dd6b2bfcSGreg Roach                        </select>
338dd6b2bfcSGreg Roach                    </td>
339dd6b2bfcSGreg Roach                </tr>
340dd6b2bfcSGreg Roach            <?php endforeach ?>
341dd6b2bfcSGreg Roach        </tbody>
342dd6b2bfcSGreg Roach    </table>
343dd6b2bfcSGreg Roach
3449e3c2cf9SGreg Roach    <div class="row mb-3">
345dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
346dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
347dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
348dd6b2bfcSGreg Roach            </button>
349dd6b2bfcSGreg Roach        </div>
350dd6b2bfcSGreg Roach    </div>
351*81443e3cSGreg Roach
352*81443e3cSGreg Roach    <?= csrf_field() ?>
353dd6b2bfcSGreg Roach</form>
354dd6b2bfcSGreg Roach
355c16be598SGreg Roach<?= view('modals/ajax') ?>
356c16be598SGreg Roach
357dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
358dd6b2bfcSGreg Roach<script>
359dd6b2bfcSGreg Roach    $(".relpath").change(function () {
360dd6b2bfcSGreg Roach        var fieldIDx = $(this).attr("id");
361dd6b2bfcSGreg Roach        var idNum    = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH", "");
362dd6b2bfcSGreg Roach        var newIDx   = "gedcomid" + idNum;
363dd6b2bfcSGreg Roach        if ($("#" + newIDx).val() === "" && $("#".fieldIDx).val() !== "0") {
364dd6b2bfcSGreg Roach            alert("<?= I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') ?>");
365dd6b2bfcSGreg Roach            $(this).val("0");
366dd6b2bfcSGreg Roach        }
367dd6b2bfcSGreg Roach    });
368dd6b2bfcSGreg Roach</script>
369dd6b2bfcSGreg Roach<?php View::endpush() ?>
370510d3f2fSGreg Roach
371