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