xref: /webtrees/app/Module/IndividualFamiliesReportModule.php (revision 8fcd0d32e56ee262912bbdb593202cfd1cbc1615)
18c2e8227SGreg Roach<?php
28c2e8227SGreg Roach/**
38c2e8227SGreg Roach * webtrees: online genealogy
4*8fcd0d32SGreg 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\Auth;
210e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N;
222c2c92e6SGreg Roachuse Fisharebest\Webtrees\Individual;
230e62c4b8SGreg Roachuse Fisharebest\Webtrees\Menu;
248c2e8227SGreg Roach
258c2e8227SGreg Roach/**
268c2e8227SGreg Roach * Class IndividualFamiliesReportModule
278c2e8227SGreg Roach */
28c1010edaSGreg Roachclass IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface
29c1010edaSGreg Roach{
308c2e8227SGreg Roach    /** {@inheritdoc} */
318f53f488SRico Sonntag    public function getTitle(): string
32c1010edaSGreg Roach    {
338c2e8227SGreg Roach        // This text also appears in the .XML file - update both together
34bbb76c12SGreg Roach        /* I18N: Name of a module/report */
35bbb76c12SGreg Roach        return I18N::translate('Related families');
368c2e8227SGreg Roach    }
378c2e8227SGreg Roach
388c2e8227SGreg Roach    /** {@inheritdoc} */
398f53f488SRico Sonntag    public function getDescription(): string
40c1010edaSGreg Roach    {
418c2e8227SGreg Roach        // This text also appears in the .XML file - update both together
42bbb76c12SGreg Roach        /* I18N: Description of the “Related families” */
43bbb76c12SGreg Roach        return I18N::translate('A report of the families that are closely related to an individual.');
448c2e8227SGreg Roach    }
458c2e8227SGreg Roach
460ee13198SGreg Roach    /**
470ee13198SGreg Roach     * What is the default access level for this module?
480ee13198SGreg Roach     * Some modules are aimed at admins or managers, and are not generally shown to users.
490ee13198SGreg Roach     *
500ee13198SGreg Roach     * @return int
510ee13198SGreg Roach     */
528f53f488SRico Sonntag    public function defaultAccessLevel(): int
53c1010edaSGreg Roach    {
544b9ff166SGreg Roach        return Auth::PRIV_USER;
558c2e8227SGreg Roach    }
568c2e8227SGreg Roach
570ee13198SGreg Roach    /**
580ee13198SGreg Roach     * Return a menu item for this report.
590ee13198SGreg Roach     *
602c2c92e6SGreg Roach     * @param Individual $individual
61dc809433SGreg Roach     *
620ee13198SGreg Roach     * @return Menu
630ee13198SGreg Roach     */
642c2c92e6SGreg Roach    public function getReportMenu(Individual $individual): Menu
65c1010edaSGreg Roach    {
660ee13198SGreg Roach        return new Menu(
678c2e8227SGreg Roach            $this->getTitle(),
682c2c92e6SGreg Roach            route('report-setup', [
692c2c92e6SGreg Roach                'ged'    => $individual->tree()->name(),
70c1010edaSGreg Roach                'report' => $this->getName(),
71c1010edaSGreg Roach            ]),
720ee13198SGreg Roach            'menu-report-' . $this->getName(),
7313abd6f3SGreg Roach            ['rel' => 'nofollow']
748c2e8227SGreg Roach        );
758c2e8227SGreg Roach    }
768c2e8227SGreg Roach}
77