xref: /webtrees/app/Module/BirthDeathMarriageReportModule.php (revision e7f56f2af615447ab1a7646851f88b465ace9e04)
10e62c4b8SGreg Roach<?php
20e62c4b8SGreg Roach/**
30e62c4b8SGreg Roach * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
50e62c4b8SGreg Roach * This program is free software: you can redistribute it and/or modify
60e62c4b8SGreg Roach * it under the terms of the GNU General Public License as published by
70e62c4b8SGreg Roach * the Free Software Foundation, either version 3 of the License, or
80e62c4b8SGreg Roach * (at your option) any later version.
90e62c4b8SGreg Roach * This program is distributed in the hope that it will be useful,
100e62c4b8SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
110e62c4b8SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120e62c4b8SGreg Roach * GNU General Public License for more details.
130e62c4b8SGreg Roach * You should have received a copy of the GNU General Public License
140e62c4b8SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
150e62c4b8SGreg Roach */
16*e7f56f2aSGreg Roachdeclare(strict_types=1);
17*e7f56f2aSGreg Roach
1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
1976692c8bSGreg Roach
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth;
210e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
220e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
23dc809433SGreg Roachuse Fisharebest\Webtrees\Tree;
240e62c4b8SGreg Roach
250e62c4b8SGreg Roach/**
260e62c4b8SGreg Roach * Class BirthDeathMarriageReportModule
270e62c4b8SGreg Roach */
28c1010edaSGreg Roachclass BirthDeathMarriageReportModule extends AbstractModule implements ModuleReportInterface
29c1010edaSGreg Roach{
3076692c8bSGreg Roach    /**
3176692c8bSGreg Roach     * How should this module be labelled on tabs, menus, etc.?
3276692c8bSGreg Roach     *
3376692c8bSGreg Roach     * @return string
3476692c8bSGreg Roach     */
358f53f488SRico Sonntag    public function getTitle(): string
36c1010edaSGreg Roach    {
370e62c4b8SGreg Roach        // This text also appears in the .XML file - update both together
38bbb76c12SGreg Roach        /* I18N: Name of a module/report. “Vital records” are life events - birth/marriage/death */
39bbb76c12SGreg Roach        return I18N::translate('Vital records');
400e62c4b8SGreg Roach    }
410e62c4b8SGreg Roach
4276692c8bSGreg Roach    /**
4376692c8bSGreg Roach     * A sentence describing what this module does.
4476692c8bSGreg Roach     *
4576692c8bSGreg Roach     * @return string
4676692c8bSGreg Roach     */
478f53f488SRico Sonntag    public function getDescription(): string
48c1010edaSGreg Roach    {
490e62c4b8SGreg Roach        // This text also appears in the .XML file - update both together
50bbb76c12SGreg Roach        /* I18N: Description of the “Vital records” module. “Vital records” are life events - birth/marriage/death */
51bbb76c12SGreg Roach        return I18N::translate('A report of vital records for a given date or place.');
520e62c4b8SGreg Roach    }
530e62c4b8SGreg Roach
5476692c8bSGreg Roach    /**
5576692c8bSGreg Roach     * What is the default access level for this module?
5676692c8bSGreg Roach     *
5776692c8bSGreg Roach     * Some modules are aimed at admins or managers, and are not generally shown to users.
5876692c8bSGreg Roach     *
5976692c8bSGreg Roach     * @return int
6076692c8bSGreg Roach     */
618f53f488SRico Sonntag    public function defaultAccessLevel(): int
62c1010edaSGreg Roach    {
630e62c4b8SGreg Roach        return Auth::PRIV_PRIVATE;
640e62c4b8SGreg Roach    }
650e62c4b8SGreg Roach
6676692c8bSGreg Roach    /**
670ee13198SGreg Roach     * Return a menu item for this report.
6876692c8bSGreg Roach     *
69962e29c9SGreg Roach     * @param Tree $tree
70962e29c9SGreg Roach     *
710ee13198SGreg Roach     * @return Menu
7276692c8bSGreg Roach     */
73c1010edaSGreg Roach    public function getReportMenu(Tree $tree): Menu
74c1010edaSGreg Roach    {
750ee13198SGreg Roach        return new Menu(
760e62c4b8SGreg Roach            $this->getTitle(),
77c1010edaSGreg Roach            route('report-setup', ['ged'    => $tree->getName(),
78c1010edaSGreg Roach                                   'report' => $this->getName(),
79c1010edaSGreg Roach            ]),
800ee13198SGreg Roach            'menu-report-' . $this->getName(),
8113abd6f3SGreg Roach            ['rel' => 'nofollow']
820e62c4b8SGreg Roach        );
830e62c4b8SGreg Roach    }
840e62c4b8SGreg Roach}
85