1168ff6f3Sric2016<?php 2168ff6f3Sric2016/** 3168ff6f3Sric2016 * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 webtrees development team 5168ff6f3Sric2016 * This program is free software: you can redistribute it and/or modify 6168ff6f3Sric2016 * it under the terms of the GNU General Public License as published by 7168ff6f3Sric2016 * the Free Software Foundation, either version 3 of the License, or 8168ff6f3Sric2016 * (at your option) any later version. 9168ff6f3Sric2016 * This program is distributed in the hope that it will be useful, 10168ff6f3Sric2016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11168ff6f3Sric2016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12168ff6f3Sric2016 * GNU General Public License for more details. 13168ff6f3Sric2016 * You should have received a copy of the GNU General Public License 14168ff6f3Sric2016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15168ff6f3Sric2016 */ 16168ff6f3Sric2016namespace Fisharebest\Webtrees\Module; 17168ff6f3Sric2016 18168ff6f3Sric2016use Fisharebest\Webtrees\Auth; 19168ff6f3Sric2016use Fisharebest\Webtrees\I18N; 20168ff6f3Sric2016use Fisharebest\Webtrees\Individual; 216664b4a3SGreg Roachuse Fisharebest\Webtrees\Menu; 22168ff6f3Sric2016 23168ff6f3Sric2016/** 24168ff6f3Sric2016 * Class FanChartModule 25168ff6f3Sric2016 */ 26c1010edaSGreg Roachclass FanChartModule extends AbstractModule implements ModuleChartInterface 27c1010edaSGreg Roach{ 28168ff6f3Sric2016 /** 29168ff6f3Sric2016 * How should this module be labelled on tabs, menus, etc.? 30168ff6f3Sric2016 * 31168ff6f3Sric2016 * @return string 32168ff6f3Sric2016 */ 33c1010edaSGreg Roach public function getTitle() 34c1010edaSGreg Roach { 35*bbb76c12SGreg Roach /* I18N: Name of a module/chart */ 36*bbb76c12SGreg Roach return I18N::translate('Fan chart'); 37168ff6f3Sric2016 } 38168ff6f3Sric2016 39168ff6f3Sric2016 /** 40168ff6f3Sric2016 * A sentence describing what this module does. 41168ff6f3Sric2016 * 42168ff6f3Sric2016 * @return string 43168ff6f3Sric2016 */ 44c1010edaSGreg Roach public function getDescription() 45c1010edaSGreg Roach { 46*bbb76c12SGreg Roach /* I18N: Description of the “Fan Chart” module */ 47*bbb76c12SGreg Roach return I18N::translate('A fan chart of an individual’s ancestors.'); 48168ff6f3Sric2016 } 49168ff6f3Sric2016 50168ff6f3Sric2016 /** 51168ff6f3Sric2016 * What is the default access level for this module? 52168ff6f3Sric2016 * 53168ff6f3Sric2016 * Some modules are aimed at admins or managers, and are not generally shown to users. 54168ff6f3Sric2016 * 55168ff6f3Sric2016 * @return int 56168ff6f3Sric2016 */ 57c1010edaSGreg Roach public function defaultAccessLevel() 58c1010edaSGreg Roach { 59168ff6f3Sric2016 return Auth::PRIV_PRIVATE; 60168ff6f3Sric2016 } 61168ff6f3Sric2016 62168ff6f3Sric2016 /** 63168ff6f3Sric2016 * Return a menu item for this chart. 64168ff6f3Sric2016 * 65168ff6f3Sric2016 * We can only do this if the GD2 library is installed with TrueType support. 66168ff6f3Sric2016 * 6760bc3e3fSGreg Roach * @param Individual $individual 6860bc3e3fSGreg Roach * 694eb71cfaSGreg Roach * @return Menu|null 70168ff6f3Sric2016 */ 71c1010edaSGreg Roach public function getChartMenu(Individual $individual) 72c1010edaSGreg Roach { 73168ff6f3Sric2016 if (function_exists('imagettftext')) { 74168ff6f3Sric2016 return new Menu( 75168ff6f3Sric2016 $this->getTitle(), 76c1010edaSGreg Roach route('fan', [ 77c1010edaSGreg Roach 'xref' => $individual->getXref(), 78c1010edaSGreg Roach 'ged' => $individual->getTree()->getName(), 79c1010edaSGreg Roach ]), 80168ff6f3Sric2016 'menu-chart-fanchart', 8113abd6f3SGreg Roach ['rel' => 'nofollow'] 82168ff6f3Sric2016 ); 83168ff6f3Sric2016 } else { 84168ff6f3Sric2016 return null; 85168ff6f3Sric2016 } 86168ff6f3Sric2016 } 87168ff6f3Sric2016 884eb71cfaSGreg Roach /** 894eb71cfaSGreg Roach * Return a menu item for this chart - for use in individual boxes. 904eb71cfaSGreg Roach * 9160bc3e3fSGreg Roach * @param Individual $individual 9260bc3e3fSGreg Roach * 934eb71cfaSGreg Roach * @return Menu|null 944eb71cfaSGreg Roach */ 95c1010edaSGreg Roach public function getBoxChartMenu(Individual $individual) 96c1010edaSGreg Roach { 97168ff6f3Sric2016 return $this->getChartMenu($individual); 98168ff6f3Sric2016 } 99168ff6f3Sric2016} 100