xref: /webtrees/app/Module/FactSourcesReportModule.php (revision b2ce94c6833c25934b40a7e6bc15985d50b5f42a)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2018 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16namespace Fisharebest\Webtrees\Module;
17
18use Fisharebest\Webtrees\Auth;
19use Fisharebest\Webtrees\I18N;
20use Fisharebest\Webtrees\Menu;
21use Fisharebest\Webtrees\Tree;
22
23/**
24 * Class FactSourcesReportModule
25 */
26class FactSourcesReportModule extends AbstractModule implements ModuleReportInterface
27{
28    /** {@inheritdoc} */
29    public function getTitle(): string
30    {
31        // This text also appears in the .XML file - update both together
32        /* I18N: Name of a module/report */
33        return I18N::translate('Source');
34    }
35
36    /** {@inheritdoc} */
37    public function getDescription(): string
38    {
39        // This text also appears in the .XML file - update both together
40        /* I18N: Description of the “Source” module */
41        return I18N::translate('A report of the information provided by a source.');
42    }
43
44    /**
45     * What is the default access level for this module?
46     *
47     * Some modules are aimed at admins or managers, and are not generally shown to users.
48     *
49     * @return int
50     */
51    public function defaultAccessLevel(): int
52    {
53        return Auth::PRIV_USER;
54    }
55
56    /**
57     * Return a menu item for this report.
58     *
59     * @param Tree $tree
60     *
61     * @return Menu
62     */
63    public function getReportMenu(Tree $tree): Menu
64    {
65        return new Menu(
66            $this->getTitle(),
67            route('report-setup', ['ged'    => $tree->getName(),
68                                   'report' => $this->getName(),
69            ]),
70            'menu-report-' . $this->getName(),
71            ['rel' => 'nofollow']
72        );
73    }
74}
75