149a243cbSGreg Roach<?php 23976b470SGreg Roach 349a243cbSGreg Roach/** 449a243cbSGreg Roach * webtrees: online genealogy 549a243cbSGreg Roach * Copyright (C) 2019 webtrees development team 649a243cbSGreg Roach * This program is free software: you can redistribute it and/or modify 749a243cbSGreg Roach * it under the terms of the GNU General Public License as published by 849a243cbSGreg Roach * the Free Software Foundation, either version 3 of the License, or 949a243cbSGreg Roach * (at your option) any later version. 1049a243cbSGreg Roach * This program is distributed in the hope that it will be useful, 1149a243cbSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 1249a243cbSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1349a243cbSGreg Roach * GNU General Public License for more details. 1449a243cbSGreg Roach * You should have received a copy of the GNU General Public License 1549a243cbSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 1649a243cbSGreg Roach */ 17fcfa147eSGreg Roach 1849a243cbSGreg Roachdeclare(strict_types=1); 1949a243cbSGreg Roach 2049a243cbSGreg Roachnamespace Fisharebest\Webtrees\Module; 2149a243cbSGreg Roach 22*1cfe16bdSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ReportSetupPage; 239af6b024SGreg Roachuse Fisharebest\Webtrees\Individual; 249af6b024SGreg Roachuse Fisharebest\Webtrees\Menu; 259af6b024SGreg Roach 2649a243cbSGreg Roach/** 2749a243cbSGreg Roach * Trait ModuleReportTrait - default implementation of ModuleReportInterface 2849a243cbSGreg Roach */ 2949a243cbSGreg Roachtrait ModuleReportTrait 3049a243cbSGreg Roach{ 319af6b024SGreg Roach /** 32962ead51SGreg Roach * @return string 33962ead51SGreg Roach */ 34962ead51SGreg Roach abstract public function name(): string; 35962ead51SGreg Roach 36962ead51SGreg Roach /** 37b9de055cSGreg Roach * @return string 38b9de055cSGreg Roach */ 39b9de055cSGreg Roach abstract public function title(): string; 40b9de055cSGreg Roach 41b9de055cSGreg Roach /** 429af6b024SGreg Roach * Name of the XML report file, relative to the resources folder. 439af6b024SGreg Roach * 449af6b024SGreg Roach * @return string 459af6b024SGreg Roach */ 469af6b024SGreg Roach public function xmlFilename(): string 479af6b024SGreg Roach { 48aacc22caSGreg Roach return 'xml/reports/' . $this->name() . '.xml'; 499af6b024SGreg Roach } 509af6b024SGreg Roach 519af6b024SGreg Roach 529af6b024SGreg Roach /** 539af6b024SGreg Roach * Return a menu item for this report. 549af6b024SGreg Roach * 559af6b024SGreg Roach * @param Individual $individual 569af6b024SGreg Roach * 579af6b024SGreg Roach * @return Menu 589af6b024SGreg Roach */ 599af6b024SGreg Roach public function getReportMenu(Individual $individual): Menu 609af6b024SGreg Roach { 619af6b024SGreg Roach return new Menu( 629af6b024SGreg Roach $this->title(), 63*1cfe16bdSGreg Roach route(ReportSetupPage::class, [ 649af6b024SGreg Roach 'xref' => $individual->xref(), 65d72b284aSGreg Roach 'tree' => $individual->tree()->name(), 669af6b024SGreg Roach 'report' => $this->name(), 679af6b024SGreg Roach ]), 689af6b024SGreg Roach 'menu-report-' . $this->name(), 699af6b024SGreg Roach ['rel' => 'nofollow'] 709af6b024SGreg Roach ); 719af6b024SGreg Roach } 7249a243cbSGreg Roach} 73