1<?php 2 3/** 4 * webtrees: online genealogy 5 * Copyright (C) 2022 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 public const RESTRICTION_NONE = 'none'; 52 public const RESTRICTION_PRIVACY = 'privacy'; 53 public const RESTRICTION_CONFIDENTIAL = 'confidential'; 54 public const RESTRICTION_LOCKED = 'locked'; 55 56 /** 57 * Convert a value to a canonical form. 58 * 59 * @param string $value 60 * 61 * @return string 62 */ 63 public function canonical(string $value): string 64 { 65 return strtolower(parent::canonical($value)); 66 } 67 68 /** 69 * A list of controlled values for this element 70 * 71 * @return array<int|string,string> 72 */ 73 public function values(): array 74 { 75 // Note: "1 RESN none" is not valid gedcom. 76 // However, webtrees privacy rules will interpret it as "show an otherwise private record to public". 77 78 return [ 79 '' => '', 80 self::RESTRICTION_NONE => '<i class="icon-resn-none"></i> ' . I18N::translate('Show to visitors'), 81 self::RESTRICTION_PRIVACY => '<i class="icon-resn-privacy"></i> ' . I18N::translate('Show to members'), 82 self::RESTRICTION_CONFIDENTIAL => '<i class="icon-resn-confidential"></i> ' . I18N::translate('Show to managers'), 83 self::RESTRICTION_LOCKED => '<i class="icon-resn-locked"></i> ' . I18N::translate('Only managers can edit'), 84 ]; 85 } 86} 87