18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 webtrees development team 58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88c2e8227SGreg Roach * (at your option) any later version. 98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2e8227SGreg Roach * GNU General Public License for more details. 138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158c2e8227SGreg Roach */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1776692c8bSGreg Roach 180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 190e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Individual; 218c2e8227SGreg Roach 228c2e8227SGreg Roach/** 238c2e8227SGreg Roach * Class RelativesTabModule 248c2e8227SGreg Roach */ 25c1010edaSGreg Roachclass RelativesTabModule extends AbstractModule implements ModuleTabInterface 26c1010edaSGreg Roach{ 2776692c8bSGreg Roach /** 2876692c8bSGreg Roach * How should this module be labelled on tabs, menus, etc.? 2976692c8bSGreg Roach * 3076692c8bSGreg Roach * @return string 3176692c8bSGreg Roach */ 32c1010edaSGreg Roach public function getTitle() 33c1010edaSGreg Roach { 34*bbb76c12SGreg Roach /* I18N: Name of a module */ 35*bbb76c12SGreg Roach return I18N::translate('Families'); 368c2e8227SGreg Roach } 378c2e8227SGreg Roach 3876692c8bSGreg Roach /** 3976692c8bSGreg Roach * A sentence describing what this module does. 4076692c8bSGreg Roach * 4176692c8bSGreg Roach * @return string 4276692c8bSGreg Roach */ 43c1010edaSGreg Roach public function getDescription() 44c1010edaSGreg Roach { 45*bbb76c12SGreg Roach /* I18N: Description of the “Families” module */ 46*bbb76c12SGreg Roach return I18N::translate('A tab showing the close relatives of an individual.'); 478c2e8227SGreg Roach } 488c2e8227SGreg Roach 4976692c8bSGreg Roach /** 5076692c8bSGreg Roach * The user can re-arrange the tab order, but until they do, this 5176692c8bSGreg Roach * is the order in which tabs are shown. 5276692c8bSGreg Roach * 5376692c8bSGreg Roach * @return int 5476692c8bSGreg Roach */ 55c1010edaSGreg Roach public function defaultTabOrder() 56c1010edaSGreg Roach { 578c2e8227SGreg Roach return 20; 588c2e8227SGreg Roach } 598c2e8227SGreg Roach 60225e381fSGreg Roach /** {@inheritdoc} */ 61c1010edaSGreg Roach public function getTabContent(Individual $individual) 62c1010edaSGreg Roach { 63225e381fSGreg Roach $tree = $individual->getTree(); 64225e381fSGreg Roach if ($tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { 65225e381fSGreg Roach $fam_access_level = Auth::PRIV_HIDE; 668c2e8227SGreg Roach } else { 67225e381fSGreg Roach $fam_access_level = Auth::accessLevel($tree); 688c2e8227SGreg Roach } 698c2e8227SGreg Roach 70a8cd57e1SGreg Roach return view('modules/relatives/tab', [ 71225e381fSGreg Roach 'fam_access_level' => $fam_access_level, 72225e381fSGreg Roach 'can_edit' => $individual->canEdit(), 73225e381fSGreg Roach 'individual' => $individual, 74225e381fSGreg Roach 'parent_families' => $individual->getChildFamilies(), 75225e381fSGreg Roach 'spouse_families' => $individual->getSpouseFamilies(), 76225e381fSGreg Roach 'step_child_familiess' => $individual->getSpouseStepFamilies(), 77225e381fSGreg Roach 'step_parent_families' => $individual->getChildStepFamilies(), 78225e381fSGreg Roach ]); 798c2e8227SGreg Roach } 808c2e8227SGreg Roach 818c2e8227SGreg Roach /** {@inheritdoc} */ 82c1010edaSGreg Roach public function hasTabContent(Individual $individual) 83c1010edaSGreg Roach { 848c2e8227SGreg Roach return true; 858c2e8227SGreg Roach } 86c1010edaSGreg Roach 878c2e8227SGreg Roach /** {@inheritdoc} */ 88c1010edaSGreg Roach public function isGrayedOut(Individual $individual) 89c1010edaSGreg Roach { 908c2e8227SGreg Roach return false; 918c2e8227SGreg Roach } 92c1010edaSGreg Roach 938c2e8227SGreg Roach /** {@inheritdoc} */ 94c1010edaSGreg Roach public function canLoadAjax() 95c1010edaSGreg Roach { 9615d603e7SGreg Roach return false; 978c2e8227SGreg Roach } 988c2e8227SGreg Roach} 99