xref: /webtrees/app/Module/LifespansChartModule.php (revision 8f53f488f13e53e44dc48778e8f51ec9f91352dd)
1168ff6f3Sric2016<?php
2168ff6f3Sric2016/**
3168ff6f3Sric2016 * webtrees: online genealogy
41062a142SGreg Roach * Copyright (C) 2018 webtrees development team
5168ff6f3Sric2016 * This program is free software: you can redistribute it and/or modify
6168ff6f3Sric2016 * it under the terms of the GNU General Public License as published by
7168ff6f3Sric2016 * the Free Software Foundation, either version 3 of the License, or
8168ff6f3Sric2016 * (at your option) any later version.
9168ff6f3Sric2016 * This program is distributed in the hope that it will be useful,
10168ff6f3Sric2016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11168ff6f3Sric2016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12168ff6f3Sric2016 * GNU General Public License for more details.
13168ff6f3Sric2016 * You should have received a copy of the GNU General Public License
14168ff6f3Sric2016 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15168ff6f3Sric2016 */
16168ff6f3Sric2016namespace Fisharebest\Webtrees\Module;
17168ff6f3Sric2016
18168ff6f3Sric2016use Fisharebest\Webtrees\Auth;
19168ff6f3Sric2016use Fisharebest\Webtrees\I18N;
20168ff6f3Sric2016use Fisharebest\Webtrees\Individual;
211f918143SScrutinizer Auto-Fixeruse Fisharebest\Webtrees\Menu;
22168ff6f3Sric2016
23168ff6f3Sric2016/**
24168ff6f3Sric2016 * Class LifespansChartModule
25168ff6f3Sric2016 */
26c1010edaSGreg Roachclass LifespansChartModule extends AbstractModule implements ModuleChartInterface
27c1010edaSGreg Roach{
28168ff6f3Sric2016    /**
29168ff6f3Sric2016     * How should this module be labelled on tabs, menus, etc.?
30168ff6f3Sric2016     *
31168ff6f3Sric2016     * @return string
32168ff6f3Sric2016     */
33*8f53f488SRico Sonntag    public function getTitle(): string
34c1010edaSGreg Roach    {
35bbb76c12SGreg Roach        /* I18N: Name of a module/chart */
36bbb76c12SGreg Roach        return I18N::translate('Lifespans');
37168ff6f3Sric2016    }
38168ff6f3Sric2016
39168ff6f3Sric2016    /**
40168ff6f3Sric2016     * A sentence describing what this module does.
41168ff6f3Sric2016     *
42168ff6f3Sric2016     * @return string
43168ff6f3Sric2016     */
44*8f53f488SRico Sonntag    public function getDescription(): string
45c1010edaSGreg Roach    {
46bbb76c12SGreg Roach        /* I18N: Description of the “LifespansChart” module */
47bbb76c12SGreg Roach        return I18N::translate('A chart of individuals’ lifespans.');
48168ff6f3Sric2016    }
49168ff6f3Sric2016
50168ff6f3Sric2016    /**
51168ff6f3Sric2016     * What is the default access level for this module?
52168ff6f3Sric2016     *
53168ff6f3Sric2016     * Some modules are aimed at admins or managers, and are not generally shown to users.
54168ff6f3Sric2016     *
55168ff6f3Sric2016     * @return int
56168ff6f3Sric2016     */
57*8f53f488SRico Sonntag    public function defaultAccessLevel(): int
58c1010edaSGreg Roach    {
59168ff6f3Sric2016        return Auth::PRIV_PRIVATE;
60168ff6f3Sric2016    }
61168ff6f3Sric2016
62168ff6f3Sric2016    /**
63168ff6f3Sric2016     * Return a menu item for this chart.
64168ff6f3Sric2016     *
6560bc3e3fSGreg Roach     * @param Individual $individual
6660bc3e3fSGreg Roach     *
674eb71cfaSGreg Roach     * @return Menu|null
68168ff6f3Sric2016     */
69c1010edaSGreg Roach    public function getChartMenu(Individual $individual)
70c1010edaSGreg Roach    {
71168ff6f3Sric2016        return new Menu(
72168ff6f3Sric2016            $this->getTitle(),
73c1010edaSGreg Roach            route('lifespans', [
74c1010edaSGreg Roach                'xrefs[]' => $individual->getXref(),
75c1010edaSGreg Roach                'ged'     => $individual->getTree()->getName(),
76c1010edaSGreg Roach            ]),
77168ff6f3Sric2016            'menu-chart-lifespan',
7813abd6f3SGreg Roach            ['rel' => 'nofollow']
79168ff6f3Sric2016        );
80168ff6f3Sric2016    }
81168ff6f3Sric2016
824eb71cfaSGreg Roach    /**
834eb71cfaSGreg Roach     * Return a menu item for this chart - for use in individual boxes.
844eb71cfaSGreg Roach     *
8560bc3e3fSGreg Roach     * @param Individual $individual
8660bc3e3fSGreg Roach     *
874eb71cfaSGreg Roach     * @return Menu|null
884eb71cfaSGreg Roach     */
89c1010edaSGreg Roach    public function getBoxChartMenu(Individual $individual)
90c1010edaSGreg Roach    {
91168ff6f3Sric2016        return null;
92168ff6f3Sric2016    }
93168ff6f3Sric2016}
94