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