1168ff6f3Sric2016<?php 2168ff6f3Sric2016/** 3168ff6f3Sric2016 * webtrees: online genealogy 4168ff6f3Sric2016 * Copyright (C) 2016 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\Menu; 21168ff6f3Sric2016use Fisharebest\Webtrees\Individual; 22168ff6f3Sric2016 23168ff6f3Sric2016/** 24168ff6f3Sric2016 * Class FamilyBookChartModule 25168ff6f3Sric2016 */ 26168ff6f3Sric2016class FamilyBookChartModule extends AbstractModule implements ModuleChartInterface { 27168ff6f3Sric2016 /** 28168ff6f3Sric2016 * How should this module be labelled on tabs, menus, etc.? 29168ff6f3Sric2016 * 30168ff6f3Sric2016 * @return string 31168ff6f3Sric2016 */ 32168ff6f3Sric2016 public function getTitle() { 33168ff6f3Sric2016 return /* I18N: Name of a module/chart */ I18N::translate('Family book'); 34168ff6f3Sric2016 } 35168ff6f3Sric2016 36168ff6f3Sric2016 /** 37168ff6f3Sric2016 * A sentence describing what this module does. 38168ff6f3Sric2016 * 39168ff6f3Sric2016 * @return string 40168ff6f3Sric2016 */ 41168ff6f3Sric2016 public function getDescription() { 42168ff6f3Sric2016 return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A chart of an individual’s ancestors and descendants, as a family book.'); 43168ff6f3Sric2016 } 44168ff6f3Sric2016 45168ff6f3Sric2016 /** 46168ff6f3Sric2016 * What is the default access level for this module? 47168ff6f3Sric2016 * 48168ff6f3Sric2016 * Some modules are aimed at admins or managers, and are not generally shown to users. 49168ff6f3Sric2016 * 50168ff6f3Sric2016 * @return int 51168ff6f3Sric2016 */ 52168ff6f3Sric2016 public function defaultAccessLevel() { 53168ff6f3Sric2016 return Auth::PRIV_PRIVATE; 54168ff6f3Sric2016 } 55168ff6f3Sric2016 56168ff6f3Sric2016 /** 57168ff6f3Sric2016 * Return a menu item for this chart. 58168ff6f3Sric2016 * 59*4eb71cfaSGreg Roach * @return Menu|null 60168ff6f3Sric2016 */ 61168ff6f3Sric2016 public function getChartMenu(Individual $individual) { 62168ff6f3Sric2016 return new Menu( 63168ff6f3Sric2016 $this->getTitle(), 64*4eb71cfaSGreg Roach 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 65168ff6f3Sric2016 'menu-chart-familybook', 66168ff6f3Sric2016 array('rel' => 'nofollow') 67168ff6f3Sric2016 ); 68168ff6f3Sric2016 } 69168ff6f3Sric2016 70*4eb71cfaSGreg Roach /** 71*4eb71cfaSGreg Roach * Return a menu item for this chart - for use in individual boxes. 72*4eb71cfaSGreg Roach * 73*4eb71cfaSGreg Roach * @return Menu|null 74*4eb71cfaSGreg Roach */ 75168ff6f3Sric2016 public function getBoxChartMenu(Individual $individual) { 76168ff6f3Sric2016 return $this->getChartMenu($individual); 77168ff6f3Sric2016 } 78168ff6f3Sric2016} 79