xref: /webtrees/app/Elements/RestrictionNotice.php (revision 7c2c99fad7cacd17c98be88238ff735d82c6351b)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2021 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Elements;
21
22use Fisharebest\Webtrees\I18N;
23
24use function strtolower;
25
26/**
27 * RESTRICTION_NOTICE := {Size=6:7}
28 * [confidential | locked | privacy ]
29 * The restriction notice is defined for Ancestral File usage. Ancestral File
30 * download GEDCOM files may contain this data.
31 * Where:
32 * confidential = This data was marked as confidential by the user. In some systems data marked as
33 *                confidential will be treated differently, for example, there might be an option
34 *                that would stop confidential data from appearing on printed reports or would
35 *                prevent that information from being exported.
36 * locked       = Some records in Ancestral File have been satisfactorily proven by evidence, but
37 *                because of source conflicts or incorrect traditions, there are repeated attempts
38 *                to change this record. By arrangement, the Ancestral File Custodian can lock a
39 *                record so that it cannot be changed without an agreement from the person assigned
40 *                as the steward of such a record. The assigned steward is either the submitter
41 *                listed for the record or Family History Support when no submitter is listed.
42 * privacy      = Indicate that information concerning this record is not present due to rights of
43 *                or an approved request for privacy. For example, data from requested downloads of
44 *                the Ancestral File may have individuals marked with ‘privacy’ if they are assumed
45 *                living, that is they were born within the last 110 years and there isn’t a death
46 *                date. In certain cases family records may also be marked with the RESN tag of
47 *                privacy if either individual acting in the role of HUSB or WIFE is assumed living.
48 */
49class RestrictionNotice extends AbstractElement
50{
51    /**
52     * Convert a value to a canonical form.
53     *
54     * @param string $value
55     *
56     * @return string
57     */
58    public function canonical(string $value): string
59    {
60        return strtolower(parent::canonical($value));
61    }
62
63    /**
64     * A list of controlled values for this element
65     *
66     * @return array<int|string,string>
67     */
68    public function values(): array
69    {
70        // Note: "1 RESN none" is not valid gedcom.
71        // However, webtrees privacy rules will interpret it as "show an otherwise private record to public".
72
73        return [
74            ''             => '',
75            'none'         => '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'),
76            'privacy'      => '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'),
77            'confidential' => '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'),
78            'locked'       => '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'),
79        ];
80    }
81}
82