xref: /webtrees/resources/views/admin/users-edit.phtml (revision dd6b2bfcc550270bb6d6778e11576148f71e4330)
1*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Auth; ?>
2*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Bootstrap4; ?>
3*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
4*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
5*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Individual; ?>
6*dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\View; ?>
7*dd6b2bfcSGreg Roach
8*dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
9*dd6b2bfcSGreg Roach
10*dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
11*dd6b2bfcSGreg Roach
12*dd6b2bfcSGreg Roach<form class="form-horizontal" name="newform" method="post" autocomplete="off" action="<?= e(route('admin-users-edit')) ?>">
13*dd6b2bfcSGreg Roach    <?= csrf_field() ?>
14*dd6b2bfcSGreg Roach    <input type="hidden" name="user_id" value="<?= $user->getUserId() ?>">
15*dd6b2bfcSGreg Roach
16*dd6b2bfcSGreg Roach    <!-- REAL NAME -->
17*dd6b2bfcSGreg Roach    <div class="row form-group">
18*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="real_name">
19*dd6b2bfcSGreg Roach            <?= I18N::translate('Real name') ?>
20*dd6b2bfcSGreg Roach        </label>
21*dd6b2bfcSGreg Roach        <div class="col-sm-9">
22*dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="real_name" name="real_name" required maxlength="64" value="<?= e($user->getRealName()) ?>" dir="auto">
23*dd6b2bfcSGreg Roach            <p class="small text-muted">
24*dd6b2bfcSGreg Roach                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
25*dd6b2bfcSGreg Roach            </p>
26*dd6b2bfcSGreg Roach        </div>
27*dd6b2bfcSGreg Roach    </div>
28*dd6b2bfcSGreg Roach
29*dd6b2bfcSGreg Roach    <!-- USER NAME -->
30*dd6b2bfcSGreg Roach    <div class="row form-group">
31*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="username">
32*dd6b2bfcSGreg Roach            <?= I18N::translate('Username') ?>
33*dd6b2bfcSGreg Roach        </label>
34*dd6b2bfcSGreg Roach        <div class="col-sm-9">
35*dd6b2bfcSGreg Roach            <input class="form-control" type="text" id="username" name="username" required maxlength="32" value="<?= e($user->getUserName()) ?>" dir="auto">
36*dd6b2bfcSGreg Roach            <p class="small text-muted">
37*dd6b2bfcSGreg Roach                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
38*dd6b2bfcSGreg Roach            </p>
39*dd6b2bfcSGreg Roach        </div>
40*dd6b2bfcSGreg Roach    </div>
41*dd6b2bfcSGreg Roach
42*dd6b2bfcSGreg Roach    <!-- PASSWORD -->
43*dd6b2bfcSGreg Roach    <div class="row form-group">
44*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="pass1">
45*dd6b2bfcSGreg Roach            <?= I18N::translate('Password') ?>
46*dd6b2bfcSGreg Roach        </label>
47*dd6b2bfcSGreg Roach        <div class="col-sm-9">
48*dd6b2bfcSGreg Roach            <input class="form-control" type="password" id="pass1" name="pass1" pattern = "<?= WT_REGEX_PASSWORD ?>" placeholder="<?= I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, I18N::number(WT_MINIMUM_PASSWORD_LENGTH)) ?>" <?= $user->getUserId() ? '' : 'required' ?> onchange="form.pass2.pattern = regex_quote(this.value);" autocomplete="new-password">
49*dd6b2bfcSGreg Roach            <p class="small text-muted">
50*dd6b2bfcSGreg Roach                <?= I18N::translate('Passwords must be at least 6 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
51*dd6b2bfcSGreg Roach            </p>
52*dd6b2bfcSGreg Roach        </div>
53*dd6b2bfcSGreg Roach    </div>
54*dd6b2bfcSGreg Roach
55*dd6b2bfcSGreg Roach    <!-- CONFIRM PASSWORD -->
56*dd6b2bfcSGreg Roach    <div class="row form-group">
57*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="pass2">
58*dd6b2bfcSGreg Roach            <?= I18N::translate('Confirm password') ?>
59*dd6b2bfcSGreg Roach        </label>
60*dd6b2bfcSGreg Roach        <div class="col-sm-9">
61*dd6b2bfcSGreg Roach            <input class="form-control" type="password" id="pass2" name="pass2" pattern = "<?= WT_REGEX_PASSWORD ?>" placeholder="<?= I18N::translate('Type the password again.') ?>" <?= $user->getUserId() ? '' : 'required' ?> autocomplete="new-password">
62*dd6b2bfcSGreg Roach        </div>
63*dd6b2bfcSGreg Roach    </div>
64*dd6b2bfcSGreg Roach
65*dd6b2bfcSGreg Roach    <!-- EMAIL ADDRESS -->
66*dd6b2bfcSGreg Roach    <div class="row form-group">
67*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="email">
68*dd6b2bfcSGreg Roach            <?= I18N::translate('Email address') ?>
69*dd6b2bfcSGreg Roach        </label>
70*dd6b2bfcSGreg Roach        <div class="col-sm-9">
71*dd6b2bfcSGreg Roach            <input class="form-control" type="email" id="email" name="email" required maxlength="64" value="<?= e($user->getEmail()) ?>">
72*dd6b2bfcSGreg Roach            <p class="small text-muted">
73*dd6b2bfcSGreg 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.') ?>
74*dd6b2bfcSGreg Roach            </p>
75*dd6b2bfcSGreg Roach        </div>
76*dd6b2bfcSGreg Roach    </div>
77*dd6b2bfcSGreg Roach
78*dd6b2bfcSGreg Roach    <!-- EMAIL VERIFIED -->
79*dd6b2bfcSGreg Roach    <!-- ACCOUNT APPROVED -->
80*dd6b2bfcSGreg Roach    <div class="row form-group">
81*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="verified">
82*dd6b2bfcSGreg Roach            <?= I18N::translate('Account approval and email verification') ?>
83*dd6b2bfcSGreg Roach        </label>
84*dd6b2bfcSGreg Roach        <div class="col-sm-9">
85*dd6b2bfcSGreg Roach            <div class="form-check">
86*dd6b2bfcSGreg Roach                <label>
87*dd6b2bfcSGreg Roach                    <input type="checkbox" name="verified" value="1" <?= $user->getPreference('verified') ? 'checked' : '' ?>>
88*dd6b2bfcSGreg Roach                    <?= I18N::translate('Email verified') ?>
89*dd6b2bfcSGreg Roach                </label>
90*dd6b2bfcSGreg Roach                <label>
91*dd6b2bfcSGreg Roach                    <input type="checkbox" name="approved" value="1" <?= $user->getPreference('verified_by_admin') ? 'checked' : '' ?>>
92*dd6b2bfcSGreg Roach                    <?= I18N::translate('Approved by administrator') ?>
93*dd6b2bfcSGreg Roach                </label>
94*dd6b2bfcSGreg Roach                <p class="small text-muted">
95*dd6b2bfcSGreg 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.') ?>
96*dd6b2bfcSGreg Roach                </p>
97*dd6b2bfcSGreg Roach                <p class="small text-muted">
98*dd6b2bfcSGreg Roach                    <?= I18N::translate('If an administrator creates a user account, the verification email is not sent, and the email must be verified manually.') ?>
99*dd6b2bfcSGreg Roach                </p>
100*dd6b2bfcSGreg Roach                <p class="small text-muted">
101*dd6b2bfcSGreg Roach                    <?= I18N::translate('You should not approve an account unless you know that the email address is correct.') ?>
102*dd6b2bfcSGreg Roach                </p>
103*dd6b2bfcSGreg Roach                <p class="small text-muted">
104*dd6b2bfcSGreg Roach                    <?= I18N::translate('A user will not be able to sign in until both “email verified” and “approved by administrator” are selected.') ?>
105*dd6b2bfcSGreg Roach                </p>
106*dd6b2bfcSGreg Roach            </div>
107*dd6b2bfcSGreg Roach        </div>
108*dd6b2bfcSGreg Roach    </div>
109*dd6b2bfcSGreg Roach
110*dd6b2bfcSGreg Roach    <!-- LANGUAGE -->
111*dd6b2bfcSGreg Roach    <div class="row form-group">
112*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="language">
113*dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Language') ?>
114*dd6b2bfcSGreg Roach        </label>
115*dd6b2bfcSGreg Roach        <div class="col-sm-9">
116*dd6b2bfcSGreg Roach            <select id="language" name="language" class="form-control">
117*dd6b2bfcSGreg Roach                <?php foreach ($locales as $locale) : ?>
118*dd6b2bfcSGreg Roach                    <option value="<?= $locale->languageTag() ?>" <?= $user->getPreference('language', $default_locale) === $locale->languageTag() ? 'selected' : '' ?>>
119*dd6b2bfcSGreg Roach                        <?= $locale->endonym() ?>
120*dd6b2bfcSGreg Roach                    </option>
121*dd6b2bfcSGreg Roach                <?php endforeach ?>
122*dd6b2bfcSGreg Roach            </select>
123*dd6b2bfcSGreg Roach        </div>
124*dd6b2bfcSGreg Roach    </div>
125*dd6b2bfcSGreg Roach
126*dd6b2bfcSGreg Roach    <!-- TIMEZONE -->
127*dd6b2bfcSGreg Roach    <div class="row form-group">
128*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="timezone">
129*dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Time zone') ?>
130*dd6b2bfcSGreg Roach        </label>
131*dd6b2bfcSGreg Roach        <div class="col-sm-9">
132*dd6b2bfcSGreg Roach            <?= Bootstrap4::select(array_combine(\DateTimeZone::listIdentifiers(), \DateTimeZone::listIdentifiers()), $user->getPreference('TIMEZONE', 'UTC'), ['id' => 'timezone', 'name' => 'timezone']) ?>
133*dd6b2bfcSGreg Roach            <p class="small text-muted">
134*dd6b2bfcSGreg Roach                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
135*dd6b2bfcSGreg Roach            </p>
136*dd6b2bfcSGreg Roach        </div>
137*dd6b2bfcSGreg Roach    </div>
138*dd6b2bfcSGreg Roach
139*dd6b2bfcSGreg Roach    <!-- AUTO ACCEPT -->
140*dd6b2bfcSGreg Roach    <div class="row form-group">
141*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="auto_accept">
142*dd6b2bfcSGreg Roach            <?= I18N::translate('Changes') ?>
143*dd6b2bfcSGreg Roach        </label>
144*dd6b2bfcSGreg Roach        <div class="col-sm-9">
145*dd6b2bfcSGreg Roach            <div class="form-check">
146*dd6b2bfcSGreg Roach                <label>
147*dd6b2bfcSGreg Roach                    <input type="checkbox" name="auto_accept" value="1" <?= $user->getPreference('auto_accept') ? 'checked' : '' ?>>
148*dd6b2bfcSGreg Roach                    <?= I18N::translate('Automatically accept changes made by this user') ?>
149*dd6b2bfcSGreg Roach                </label>
150*dd6b2bfcSGreg Roach                <p class="small text-muted">
151*dd6b2bfcSGreg 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.') ?>
152*dd6b2bfcSGreg Roach                </p>
153*dd6b2bfcSGreg Roach            </div>
154*dd6b2bfcSGreg Roach        </div>
155*dd6b2bfcSGreg Roach    </div>
156*dd6b2bfcSGreg Roach
157*dd6b2bfcSGreg Roach    <!-- VISIBLE ONLINE -->
158*dd6b2bfcSGreg Roach    <div class="row form-group">
159*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="visible_online">
160*dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Visible online') ?>
161*dd6b2bfcSGreg Roach        </label>
162*dd6b2bfcSGreg Roach        <div class="col-sm-9">
163*dd6b2bfcSGreg Roach            <div class="form-check">
164*dd6b2bfcSGreg Roach                <label>
165*dd6b2bfcSGreg Roach                    <input type="checkbox" id="visible_online" name="visible_online" value="1" <?= $user->getPreference('visibleonline') ? 'checked' : '' ?>>
166*dd6b2bfcSGreg Roach                    <?= /* I18N: A configuration setting */ I18N::translate('Visible to other users when online') ?>
167*dd6b2bfcSGreg Roach                </label>
168*dd6b2bfcSGreg Roach                <p class="small text-muted">
169*dd6b2bfcSGreg Roach                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
170*dd6b2bfcSGreg Roach                </p>
171*dd6b2bfcSGreg Roach            </div>
172*dd6b2bfcSGreg Roach        </div>
173*dd6b2bfcSGreg Roach    </div>
174*dd6b2bfcSGreg Roach
175*dd6b2bfcSGreg Roach    <!-- CONTACT METHOD -->
176*dd6b2bfcSGreg Roach    <div class="row form-group">
177*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="contactmethod">
178*dd6b2bfcSGreg Roach            <?= /* I18N: A configuration setting */ I18N::translate('Preferred contact method') ?>
179*dd6b2bfcSGreg Roach        </label>
180*dd6b2bfcSGreg Roach        <div class="col-sm-9">
181*dd6b2bfcSGreg Roach            <?= Bootstrap4::select($contact_methods, $user->getPreference('contactmethod'), ['id' => 'contact_method', 'name' => 'contact_method']) ?>
182*dd6b2bfcSGreg Roach            <p class="small text-muted">
183*dd6b2bfcSGreg Roach                <?= /* I18N: Help text for the “Preferred contact method” configuration setting */
184*dd6b2bfcSGreg 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.') ?>
185*dd6b2bfcSGreg Roach            </p>
186*dd6b2bfcSGreg Roach        </div>
187*dd6b2bfcSGreg Roach    </div>
188*dd6b2bfcSGreg Roach
189*dd6b2bfcSGreg Roach    <!-- THEME -->
190*dd6b2bfcSGreg Roach    <div class="row form-group">
191*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="theme">
192*dd6b2bfcSGreg Roach            <?= I18N::translate('Theme') ?>
193*dd6b2bfcSGreg Roach        </label>
194*dd6b2bfcSGreg Roach        <div class="col-sm-9">
195*dd6b2bfcSGreg Roach            <?= Bootstrap4::select($theme_options, $user->getPreference('theme'), ['id' => 'theme', 'name' => 'theme']) ?>
196*dd6b2bfcSGreg Roach        </div>
197*dd6b2bfcSGreg Roach    </div>
198*dd6b2bfcSGreg Roach
199*dd6b2bfcSGreg Roach    <!-- COMMENTS -->
200*dd6b2bfcSGreg Roach    <div class="row form-group">
201*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="comment">
202*dd6b2bfcSGreg Roach            <?= I18N::translate('Administrator comments on user') ?>
203*dd6b2bfcSGreg Roach        </label>
204*dd6b2bfcSGreg Roach        <div class="col-sm-9">
205*dd6b2bfcSGreg Roach            <textarea class="form-control" id="comment" name="comment" rows="5" maxlength="255"><?= e($user->getPreference('comment')) ?></textarea>
206*dd6b2bfcSGreg Roach        </div>
207*dd6b2bfcSGreg Roach    </div>
208*dd6b2bfcSGreg Roach
209*dd6b2bfcSGreg Roach    <!-- ADMINISTRATOR -->
210*dd6b2bfcSGreg Roach    <div class="row form-group">
211*dd6b2bfcSGreg Roach        <label class="col-sm-3 col-form-label" for="admin">
212*dd6b2bfcSGreg Roach        </label>
213*dd6b2bfcSGreg Roach        <div class="col-sm-9">
214*dd6b2bfcSGreg Roach            <div class="form-check">
215*dd6b2bfcSGreg Roach                <label>
216*dd6b2bfcSGreg Roach                    <input type="checkbox" id="admin" name="canadmin" value="1" <?= $user->getPreference('canadmin') ? 'checked' : '' ?>  <?= $user->getUserId() === Auth::id() ? 'disabled' : '' ?>>
217*dd6b2bfcSGreg Roach                    <?= I18N::translate('Administrator') ?>
218*dd6b2bfcSGreg Roach                </label>
219*dd6b2bfcSGreg Roach            </div>
220*dd6b2bfcSGreg Roach        </div>
221*dd6b2bfcSGreg Roach    </div>
222*dd6b2bfcSGreg Roach
223*dd6b2bfcSGreg Roach    <h3><?= I18N::translate('Access to family trees') ?></h3>
224*dd6b2bfcSGreg Roach
225*dd6b2bfcSGreg Roach    <p>
226*dd6b2bfcSGreg 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.') ?>
227*dd6b2bfcSGreg Roach    </p>
228*dd6b2bfcSGreg Roach
229*dd6b2bfcSGreg Roach    <div class="row">
230*dd6b2bfcSGreg Roach        <div class="col-xs-4">
231*dd6b2bfcSGreg Roach            <h4>
232*dd6b2bfcSGreg Roach                <?= I18N::translate('Visitor') ?>
233*dd6b2bfcSGreg Roach            </h4>
234*dd6b2bfcSGreg Roach            <p class="small text-muted">
235*dd6b2bfcSGreg Roach                <?= I18N::translate('Everybody has this role, including visitors to the website and search engines.') ?>
236*dd6b2bfcSGreg Roach            </p>
237*dd6b2bfcSGreg Roach            <h4>
238*dd6b2bfcSGreg Roach                <?= I18N::translate('Member') ?>
239*dd6b2bfcSGreg Roach            </h4>
240*dd6b2bfcSGreg Roach            <p class="small text-muted">
241*dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the visitor role, plus any additional access granted by the family tree configuration.') ?>
242*dd6b2bfcSGreg Roach            </p>
243*dd6b2bfcSGreg Roach        </div>
244*dd6b2bfcSGreg Roach        <div class="col-xs-4">
245*dd6b2bfcSGreg Roach            <h4>
246*dd6b2bfcSGreg Roach                <?= I18N::translate('Editor') ?>
247*dd6b2bfcSGreg Roach            </h4>
248*dd6b2bfcSGreg Roach            <p class="small text-muted">
249*dd6b2bfcSGreg 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.') ?>
250*dd6b2bfcSGreg Roach            </p>
251*dd6b2bfcSGreg Roach            <h4>
252*dd6b2bfcSGreg Roach                <?= I18N::translate('Moderator') ?>
253*dd6b2bfcSGreg Roach            </h4>
254*dd6b2bfcSGreg Roach            <p class="small text-muted">
255*dd6b2bfcSGreg Roach                <?= I18N::translate('This role has all the permissions of the editor role, plus permission to accept/reject changes made by other users.') ?>
256*dd6b2bfcSGreg Roach            </p>
257*dd6b2bfcSGreg Roach        </div>
258*dd6b2bfcSGreg Roach        <div class="col-xs-4">
259*dd6b2bfcSGreg Roach            <h4>
260*dd6b2bfcSGreg Roach                <?= I18N::translate('Manager') ?>
261*dd6b2bfcSGreg Roach            </h4>
262*dd6b2bfcSGreg Roach            <p class="small text-muted">
263*dd6b2bfcSGreg 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.') ?>
264*dd6b2bfcSGreg Roach            </p>
265*dd6b2bfcSGreg Roach            <h4>
266*dd6b2bfcSGreg Roach                <?= I18N::translate('Administrator') ?>
267*dd6b2bfcSGreg Roach            </h4>
268*dd6b2bfcSGreg Roach            <p class="small text-muted">
269*dd6b2bfcSGreg 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.') ?>
270*dd6b2bfcSGreg Roach            </p>
271*dd6b2bfcSGreg Roach        </div>
272*dd6b2bfcSGreg Roach    </div>
273*dd6b2bfcSGreg Roach
274*dd6b2bfcSGreg Roach    <table class="table table-bordered table-sm">
275*dd6b2bfcSGreg Roach        <thead>
276*dd6b2bfcSGreg Roach            <tr>
277*dd6b2bfcSGreg Roach                <th>
278*dd6b2bfcSGreg Roach                    <?= I18N::translate('Family tree') ?>
279*dd6b2bfcSGreg Roach                </th>
280*dd6b2bfcSGreg Roach                <th>
281*dd6b2bfcSGreg Roach                    <?= I18N::translate('Role') ?>
282*dd6b2bfcSGreg Roach                </th>
283*dd6b2bfcSGreg Roach                <th>
284*dd6b2bfcSGreg Roach                    <?= I18N::translate('Individual record') ?>
285*dd6b2bfcSGreg Roach                </th>
286*dd6b2bfcSGreg Roach                <th>
287*dd6b2bfcSGreg Roach                    <?= I18N::translate('Restrict to immediate family') ?>
288*dd6b2bfcSGreg Roach                </th>
289*dd6b2bfcSGreg Roach            </tr>
290*dd6b2bfcSGreg Roach            <tr>
291*dd6b2bfcSGreg Roach                <td>
292*dd6b2bfcSGreg Roach                </td>
293*dd6b2bfcSGreg Roach                <td>
294*dd6b2bfcSGreg Roach                </td>
295*dd6b2bfcSGreg Roach                <td>
296*dd6b2bfcSGreg Roach                    <p class="small text-muted">
297*dd6b2bfcSGreg Roach                        <?= I18N::translate('Link this user to an individual in the family tree.') ?>
298*dd6b2bfcSGreg Roach                    </p>
299*dd6b2bfcSGreg Roach                </td>
300*dd6b2bfcSGreg Roach                <td>
301*dd6b2bfcSGreg Roach                    <p class="small text-muted">
302*dd6b2bfcSGreg Roach                        <?= I18N::translate('Where a user is associated to an individual record in a family tree and has a role of member, editor, or moderator, you can prevent them from accessing the details of distant, living relations. You specify the number of relationship steps that the user is allowed to see.') ?>
303*dd6b2bfcSGreg Roach                        <?= I18N::translate('For example, if you specify a path length of 2, the individual will be able to see their grandson (child, child), their aunt (parent, sibling), their step-daughter (spouse, child), but not their first cousin (parent, sibling, child).') ?>
304*dd6b2bfcSGreg Roach                        <?= I18N::translate('Note: longer path lengths require a lot of calculation, which can make your website run slowly for these users.') ?>
305*dd6b2bfcSGreg Roach                    </p>
306*dd6b2bfcSGreg Roach                </td>
307*dd6b2bfcSGreg Roach            </tr>
308*dd6b2bfcSGreg Roach        </thead>
309*dd6b2bfcSGreg Roach        <tbody>
310*dd6b2bfcSGreg Roach            <?php foreach ($trees as $tree) : ?>
311*dd6b2bfcSGreg Roach                <tr>
312*dd6b2bfcSGreg Roach                    <td>
313*dd6b2bfcSGreg Roach                        <?= e($tree->getTitle()) ?>
314*dd6b2bfcSGreg Roach                    </td>
315*dd6b2bfcSGreg Roach                    <td>
316*dd6b2bfcSGreg Roach                        <select class="form-control" name="canedit<?= $tree->getTreeId() ?>">
317*dd6b2bfcSGreg Roach                            <?php foreach ($roles as $role => $description) : ?>
318*dd6b2bfcSGreg Roach                                <option value="<?= $role ?>"
319*dd6b2bfcSGreg Roach                                    <?= $role === $tree->getUserPreference($user, 'canedit') ? 'selected' : '' ?>>
320*dd6b2bfcSGreg Roach                                    <?= $description ?>
321*dd6b2bfcSGreg Roach                                </option>
322*dd6b2bfcSGreg Roach                            <?php endforeach ?>
323*dd6b2bfcSGreg Roach                        </select>
324*dd6b2bfcSGreg Roach                    </td>
325*dd6b2bfcSGreg Roach                    <td>
326*dd6b2bfcSGreg Roach                        <?= FunctionsEdit::formControlIndividual($tree, Individual::getInstance($tree->getUserPreference($user, 'gedcomid'), $tree), ['id' => 'gedcomid' . $tree->getTreeId(), 'name' => 'gedcomid' . $tree->getTreeId()]) ?>
327*dd6b2bfcSGreg Roach                    </td>
328*dd6b2bfcSGreg Roach                    <td>
329*dd6b2bfcSGreg Roach                        <select class="form-control" name="RELATIONSHIP_PATH_LENGTH<?= $tree->getTreeId() ?>" id="RELATIONSHIP_PATH_LENGTH<?= $tree->getTreeId() ?>" class="relpath">
330*dd6b2bfcSGreg Roach                            <?php for ($n = 0; $n <= 10; ++$n) : ?>
331*dd6b2bfcSGreg Roach                                <option value="<?= $n ?>" <?= $tree->getUserPreference($user, 'RELATIONSHIP_PATH_LENGTH') == $n ? 'selected' : '' ?>>
332*dd6b2bfcSGreg Roach                                    <?= $n ?: I18N::translate('No') ?>
333*dd6b2bfcSGreg Roach                                </option>
334*dd6b2bfcSGreg Roach                            <?php endfor ?>
335*dd6b2bfcSGreg Roach                        </select>
336*dd6b2bfcSGreg Roach                    </td>
337*dd6b2bfcSGreg Roach                </tr>
338*dd6b2bfcSGreg Roach            <?php endforeach ?>
339*dd6b2bfcSGreg Roach        </tbody>
340*dd6b2bfcSGreg Roach    </table>
341*dd6b2bfcSGreg Roach
342*dd6b2bfcSGreg Roach    <div class="row form-group">
343*dd6b2bfcSGreg Roach        <div class="offset-sm-3 col-sm-9">
344*dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
345*dd6b2bfcSGreg Roach                <?= I18N::translate('save') ?>
346*dd6b2bfcSGreg Roach            </button>
347*dd6b2bfcSGreg Roach        </div>
348*dd6b2bfcSGreg Roach    </div>
349*dd6b2bfcSGreg Roach</form>
350*dd6b2bfcSGreg Roach
351*dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
352*dd6b2bfcSGreg Roach<script>
353*dd6b2bfcSGreg Roach  $(".relpath").change(function() {
354*dd6b2bfcSGreg Roach    var fieldIDx = $(this).attr("id");
355*dd6b2bfcSGreg Roach    var idNum = fieldIDx.replace("RELATIONSHIP_PATH_LENGTH","");
356*dd6b2bfcSGreg Roach    var newIDx = "gedcomid"+idNum;
357*dd6b2bfcSGreg Roach    if ($("#"+newIDx).val() === "" && $("#".fieldIDx).val() !== "0") {
358*dd6b2bfcSGreg Roach      alert("<?= I18N::translate('You must specify an individual record before you can restrict the user to their immediate family.') ?>");
359*dd6b2bfcSGreg Roach      $(this).val("0");
360*dd6b2bfcSGreg Roach    }
361*dd6b2bfcSGreg Roach  });
362*dd6b2bfcSGreg Roach  function regex_quote(str) {
363*dd6b2bfcSGreg Roach    return str.replace(/[\\.?+*()[\](){}|]/g, "\\$&");
364*dd6b2bfcSGreg Roach  }
365*dd6b2bfcSGreg Roach</script>
366*dd6b2bfcSGreg Roach<?php View::endpush() ?>
367