xref: /webtrees/app/Module/IndividualReportModule.php (revision 49a243cb5fe7c21b24e262552d556b018bfe3f41)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 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 */
16e7f56f2aSGreg Roachdeclare(strict_types=1);
17e7f56f2aSGreg Roach
1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
1976692c8bSGreg Roach
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
212c2c92e6SGreg Roachuse Fisharebest\Webtrees\Individual;
220e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
238c2e8227SGreg Roach
248c2e8227SGreg Roach/**
258c2e8227SGreg Roach * Class IndividualReportModule
268c2e8227SGreg Roach */
27*49a243cbSGreg Roachclass IndividualReportModule extends AbstractModule implements ModuleInterface, ModuleReportInterface
28c1010edaSGreg Roach{
29*49a243cbSGreg Roach    use ModuleReportTrait;
30*49a243cbSGreg Roach
318c2e8227SGreg Roach    /** {@inheritdoc} */
32*49a243cbSGreg Roach    public function title(): string
33c1010edaSGreg Roach    {
348c2e8227SGreg Roach        // This text also appears in the .XML file - update both together
35bbb76c12SGreg Roach        /* I18N: Name of a module/report */
36bbb76c12SGreg Roach        return I18N::translate('Individual');
378c2e8227SGreg Roach    }
388c2e8227SGreg Roach
398c2e8227SGreg Roach    /** {@inheritdoc} */
40*49a243cbSGreg Roach    public function description(): string
41c1010edaSGreg Roach    {
428c2e8227SGreg Roach        // This text also appears in the .XML file - update both together
43bbb76c12SGreg Roach        /* I18N: Description of the “Individual” module */
44bbb76c12SGreg Roach        return I18N::translate('A report of an individual’s details.');
458c2e8227SGreg Roach    }
468c2e8227SGreg Roach
470ee13198SGreg Roach    /**
480ee13198SGreg Roach     * Return a menu item for this report.
490ee13198SGreg Roach     *
502c2c92e6SGreg Roach     * @param Individual $individual
51dc809433SGreg Roach     *
520ee13198SGreg Roach     * @return Menu
530ee13198SGreg Roach     */
542c2c92e6SGreg Roach    public function getReportMenu(Individual $individual): Menu
55c1010edaSGreg Roach    {
560ee13198SGreg Roach        return new Menu(
57*49a243cbSGreg Roach            $this->title(),
582c2c92e6SGreg Roach            route('report-setup', [
592c2c92e6SGreg Roach                'xref'   => $individual->xref(),
602c2c92e6SGreg Roach                'ged'    => $individual->tree()->name(),
61c1010edaSGreg Roach                'report' => $this->getName(),
62c1010edaSGreg Roach            ]),
630ee13198SGreg Roach            'menu-report-' . $this->getName(),
6413abd6f3SGreg Roach            ['rel' => 'nofollow']
658c2e8227SGreg Roach        );
668c2e8227SGreg Roach    }
678c2e8227SGreg Roach}
68