xref: /webtrees/app/Module/DescendancyChartModule.php (revision 168ff6f357afa9bbd5aa14c12670d19e51ee770c)
1*168ff6f3Sric2016<?php
2*168ff6f3Sric2016/**
3*168ff6f3Sric2016 * webtrees: online genealogy
4*168ff6f3Sric2016 * Copyright (C) 2016 webtrees development team
5*168ff6f3Sric2016 * This program is free software: you can redistribute it and/or modify
6*168ff6f3Sric2016 * it under the terms of the GNU General Public License as published by
7*168ff6f3Sric2016 * the Free Software Foundation, either version 3 of the License, or
8*168ff6f3Sric2016 * (at your option) any later version.
9*168ff6f3Sric2016 * This program is distributed in the hope that it will be useful,
10*168ff6f3Sric2016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*168ff6f3Sric2016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*168ff6f3Sric2016 * GNU General Public License for more details.
13*168ff6f3Sric2016 * You should have received a copy of the GNU General Public License
14*168ff6f3Sric2016 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*168ff6f3Sric2016 */
16*168ff6f3Sric2016namespace Fisharebest\Webtrees\Module;
17*168ff6f3Sric2016
18*168ff6f3Sric2016use Fisharebest\Webtrees\Auth;
19*168ff6f3Sric2016use Fisharebest\Webtrees\I18N;
20*168ff6f3Sric2016use Fisharebest\Webtrees\Menu;
21*168ff6f3Sric2016use Fisharebest\Webtrees\Individual;
22*168ff6f3Sric2016
23*168ff6f3Sric2016/**
24*168ff6f3Sric2016 * Class DescendancyChartModule
25*168ff6f3Sric2016 */
26*168ff6f3Sric2016class DescendancyChartModule extends AbstractModule implements ModuleChartInterface {
27*168ff6f3Sric2016	/**
28*168ff6f3Sric2016	 * How should this module be labelled on tabs, menus, etc.?
29*168ff6f3Sric2016	 *
30*168ff6f3Sric2016	 * @return string
31*168ff6f3Sric2016	 */
32*168ff6f3Sric2016	public function getTitle() {
33*168ff6f3Sric2016		return /* I18N: Name of a module/chart */ I18N::translate('Descendants');
34*168ff6f3Sric2016	}
35*168ff6f3Sric2016
36*168ff6f3Sric2016	/**
37*168ff6f3Sric2016	 * A sentence describing what this module does.
38*168ff6f3Sric2016	 *
39*168ff6f3Sric2016	 * @return string
40*168ff6f3Sric2016	 */
41*168ff6f3Sric2016	public function getDescription() {
42*168ff6f3Sric2016		return /* I18N: Description of the “DescendancyChart” module */ I18N::translate('A chart of an individual’s descendants.');
43*168ff6f3Sric2016	}
44*168ff6f3Sric2016
45*168ff6f3Sric2016	/**
46*168ff6f3Sric2016	 * What is the default access level for this module?
47*168ff6f3Sric2016	 *
48*168ff6f3Sric2016	 * Some modules are aimed at admins or managers, and are not generally shown to users.
49*168ff6f3Sric2016	 *
50*168ff6f3Sric2016	 * @return int
51*168ff6f3Sric2016	 */
52*168ff6f3Sric2016	public function defaultAccessLevel() {
53*168ff6f3Sric2016		return Auth::PRIV_PRIVATE;
54*168ff6f3Sric2016	}
55*168ff6f3Sric2016
56*168ff6f3Sric2016	/**
57*168ff6f3Sric2016	 * Return a menu item for this chart.
58*168ff6f3Sric2016	 *
59*168ff6f3Sric2016	 * @return Menu
60*168ff6f3Sric2016	 */
61*168ff6f3Sric2016	public function getChartMenu(Individual $individual) {
62*168ff6f3Sric2016		global $controller, $WT_TREE;
63*168ff6f3Sric2016
64*168ff6f3Sric2016		return new Menu(
65*168ff6f3Sric2016			$this->getTitle(),
66*168ff6f3Sric2016			'descendancy.php?rootid=' . $individual->getXref() . '&amp;ged=' . $WT_TREE->getNameUrl(),
67*168ff6f3Sric2016			'menu-chart-descendants',
68*168ff6f3Sric2016			array('rel' => 'nofollow')
69*168ff6f3Sric2016		);
70*168ff6f3Sric2016	}
71*168ff6f3Sric2016
72*168ff6f3Sric2016	public function getBoxChartMenu(Individual $individual) {
73*168ff6f3Sric2016		return $this->getChartMenu($individual);
74*168ff6f3Sric2016	}
75*168ff6f3Sric2016}
76