|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* webtrees: online genealogy |
|
4
|
|
|
* Copyright (C) 2016 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
|
|
|
*/ |
|
16
|
|
|
namespace Fisharebest\Webtrees\Module; |
|
17
|
|
|
|
|
18
|
|
|
use Fisharebest\Webtrees\Auth; |
|
19
|
|
|
use Fisharebest\Webtrees\I18N; |
|
20
|
|
|
use Fisharebest\Webtrees\Menu; |
|
21
|
|
|
use Fisharebest\Webtrees\Individual; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class AncestorsChartModule |
|
25
|
|
|
*/ |
|
26
|
|
|
class AncestorsChartModule extends AbstractModule implements ModuleChartInterface { |
|
27
|
|
|
/** |
|
28
|
|
|
* How should this module be labelled on tabs, menus, etc.? |
|
29
|
|
|
* |
|
30
|
|
|
* @return string |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getTitle() { |
|
33
|
|
|
return /* I18N: Name of a module/chart */ I18N::translate('Ancestors'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* A sentence describing what this module does. |
|
38
|
|
|
* |
|
39
|
|
|
* @return string |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getDescription() { |
|
42
|
|
|
return /* I18N: Description of the “AncestorsChart” module */ I18N::translate('A chart of an individual’s ancestors.'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* What is the default access level for this module? |
|
47
|
|
|
* |
|
48
|
|
|
* Some modules are aimed at admins or managers, and are not generally shown to users. |
|
49
|
|
|
* |
|
50
|
|
|
* @return int |
|
51
|
|
|
*/ |
|
52
|
|
|
public function defaultAccessLevel() { |
|
53
|
|
|
return Auth::PRIV_PRIVATE; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Return a menu item for this chart. |
|
58
|
|
|
* |
|
59
|
|
|
* @return Menu|null |
|
|
|
|
|
|
60
|
|
|
*/ |
|
61
|
|
|
public function getChartMenu(Individual $individual) { |
|
62
|
|
|
return new Menu( |
|
63
|
|
|
$this->getTitle(), |
|
64
|
|
|
'ancestry.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
65
|
|
|
'menu-chart-ancestry', |
|
66
|
|
|
array('rel' => 'nofollow') |
|
67
|
|
|
); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Return a menu item for this chart - for use in individual boxes. |
|
72
|
|
|
* |
|
73
|
|
|
* @return Menu|null |
|
|
|
|
|
|
74
|
|
|
*/ |
|
75
|
|
|
public function getBoxChartMenu(Individual $individual) { |
|
76
|
|
|
return $this->getChartMenu($individual); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.