xref: /webtrees/app/Module/BirthDeathMarriageReportModule.php (revision 8f53f488f13e53e44dc48778e8f51ec9f91352dd)
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 */
1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module;
1776692c8bSGreg Roach
180e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth;
190e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
200e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
21dc809433SGreg Roachuse Fisharebest\Webtrees\Tree;
220e62c4b8SGreg Roach
230e62c4b8SGreg Roach/**
240e62c4b8SGreg Roach * Class BirthDeathMarriageReportModule
250e62c4b8SGreg Roach */
26c1010edaSGreg Roachclass BirthDeathMarriageReportModule extends AbstractModule implements ModuleReportInterface
27c1010edaSGreg Roach{
2876692c8bSGreg Roach    /**
2976692c8bSGreg Roach     * How should this module be labelled on tabs, menus, etc.?
3076692c8bSGreg Roach     *
3176692c8bSGreg Roach     * @return string
3276692c8bSGreg Roach     */
33*8f53f488SRico Sonntag    public function getTitle(): string
34c1010edaSGreg Roach    {
350e62c4b8SGreg Roach        // This text also appears in the .XML file - update both together
36bbb76c12SGreg Roach        /* I18N: Name of a module/report. “Vital records” are life events - birth/marriage/death */
37bbb76c12SGreg Roach        return I18N::translate('Vital records');
380e62c4b8SGreg Roach    }
390e62c4b8SGreg Roach
4076692c8bSGreg Roach    /**
4176692c8bSGreg Roach     * A sentence describing what this module does.
4276692c8bSGreg Roach     *
4376692c8bSGreg Roach     * @return string
4476692c8bSGreg Roach     */
45*8f53f488SRico Sonntag    public function getDescription(): string
46c1010edaSGreg Roach    {
470e62c4b8SGreg Roach        // This text also appears in the .XML file - update both together
48bbb76c12SGreg Roach        /* I18N: Description of the “Vital records” module. “Vital records” are life events - birth/marriage/death */
49bbb76c12SGreg Roach        return I18N::translate('A report of vital records for a given date or place.');
500e62c4b8SGreg Roach    }
510e62c4b8SGreg Roach
5276692c8bSGreg Roach    /**
5376692c8bSGreg Roach     * What is the default access level for this module?
5476692c8bSGreg Roach     *
5576692c8bSGreg Roach     * Some modules are aimed at admins or managers, and are not generally shown to users.
5676692c8bSGreg Roach     *
5776692c8bSGreg Roach     * @return int
5876692c8bSGreg Roach     */
59*8f53f488SRico Sonntag    public function defaultAccessLevel(): int
60c1010edaSGreg Roach    {
610e62c4b8SGreg Roach        return Auth::PRIV_PRIVATE;
620e62c4b8SGreg Roach    }
630e62c4b8SGreg Roach
6476692c8bSGreg Roach    /**
650ee13198SGreg Roach     * Return a menu item for this report.
6676692c8bSGreg Roach     *
67962e29c9SGreg Roach     * @param Tree $tree
68962e29c9SGreg Roach     *
690ee13198SGreg Roach     * @return Menu
7076692c8bSGreg Roach     */
71c1010edaSGreg Roach    public function getReportMenu(Tree $tree): Menu
72c1010edaSGreg Roach    {
730ee13198SGreg Roach        return new Menu(
740e62c4b8SGreg Roach            $this->getTitle(),
75c1010edaSGreg Roach            route('report-setup', ['ged'    => $tree->getName(),
76c1010edaSGreg Roach                                   'report' => $this->getName(),
77c1010edaSGreg Roach            ]),
780ee13198SGreg Roach            'menu-report-' . $this->getName(),
7913abd6f3SGreg Roach            ['rel' => 'nofollow']
800e62c4b8SGreg Roach        );
810e62c4b8SGreg Roach    }
820e62c4b8SGreg Roach}
83