@@ -25,14 +25,17 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class TopGivenNamesModule |
27 | 27 | */ |
28 | -class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface { |
|
28 | +class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface |
|
29 | +{ |
|
29 | 30 | /** {@inheritdoc} */ |
30 | - public function getTitle() { |
|
31 | + public function getTitle() |
|
32 | + { |
|
31 | 33 | return /* I18N: Name of a module. Top=Most common */ I18N::translate('Top given names'); |
32 | 34 | } |
33 | 35 | |
34 | 36 | /** {@inheritdoc} */ |
35 | - public function getDescription() { |
|
37 | + public function getDescription() |
|
38 | + { |
|
36 | 39 | return /* I18N: Description of the “Top given names” module */ I18N::translate('A list of the most popular given names.'); |
37 | 40 | } |
38 | 41 | |
@@ -45,7 +48,8 @@ discard block |
||
45 | 48 | * |
46 | 49 | * @return string |
47 | 50 | */ |
48 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
51 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
52 | + { |
|
49 | 53 | global $ctype, $WT_TREE; |
50 | 54 | |
51 | 55 | $num = $this->getBlockSetting($block_id, 'num', '10'); |
@@ -114,17 +118,20 @@ discard block |
||
114 | 118 | } |
115 | 119 | |
116 | 120 | /** {@inheritdoc} */ |
117 | - public function loadAjax() { |
|
121 | + public function loadAjax() |
|
122 | + { |
|
118 | 123 | return true; |
119 | 124 | } |
120 | 125 | |
121 | 126 | /** {@inheritdoc} */ |
122 | - public function isUserBlock() { |
|
127 | + public function isUserBlock() |
|
128 | + { |
|
123 | 129 | return true; |
124 | 130 | } |
125 | 131 | |
126 | 132 | /** {@inheritdoc} */ |
127 | - public function isGedcomBlock() { |
|
133 | + public function isGedcomBlock() |
|
134 | + { |
|
128 | 135 | return true; |
129 | 136 | } |
130 | 137 | |
@@ -133,7 +140,8 @@ discard block |
||
133 | 140 | * |
134 | 141 | * @param int $block_id |
135 | 142 | */ |
136 | - public function configureBlock($block_id) { |
|
143 | + public function configureBlock($block_id) |
|
144 | + { |
|
137 | 145 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
138 | 146 | $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10)); |
139 | 147 | $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table')); |
@@ -20,5 +20,6 @@ |
||
20 | 20 | * |
21 | 21 | * This class is not currently used |
22 | 22 | */ |
23 | -interface ModuleThemeInterface { |
|
23 | +interface ModuleThemeInterface |
|
24 | +{ |
|
24 | 25 | } |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class DescendancyReportModule |
24 | 24 | */ |
25 | -class DescendancyReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class DescendancyReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Descendants'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Descendants” module */ I18N::translate('A report of an individual’s descendants, in a narrative style.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_PRIVATE; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $controller, $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class IndividualFamiliesReportModule |
24 | 24 | */ |
25 | -class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class IndividualFamiliesReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Related families'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Related families” */ I18N::translate('A report of the families that are closely related to an individual.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_USER; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $controller, $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -25,14 +25,17 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class OnThisDayModule |
27 | 27 | */ |
28 | -class OnThisDayModule extends AbstractModule implements ModuleBlockInterface { |
|
28 | +class OnThisDayModule extends AbstractModule implements ModuleBlockInterface |
|
29 | +{ |
|
29 | 30 | /** {@inheritdoc} */ |
30 | - public function getTitle() { |
|
31 | + public function getTitle() |
|
32 | + { |
|
31 | 33 | return /* I18N: Name of a module */ I18N::translate('On this day'); |
32 | 34 | } |
33 | 35 | |
34 | 36 | /** {@inheritdoc} */ |
35 | - public function getDescription() { |
|
37 | + public function getDescription() |
|
38 | + { |
|
36 | 39 | return /* I18N: Description of the “On this day” module */ I18N::translate('A list of the anniversaries that occur today.'); |
37 | 40 | } |
38 | 41 | |
@@ -45,7 +48,8 @@ discard block |
||
45 | 48 | * |
46 | 49 | * @return string |
47 | 50 | */ |
48 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
51 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
52 | + { |
|
49 | 53 | global $ctype, $WT_TREE; |
50 | 54 | |
51 | 55 | $filter = $this->getBlockSetting($block_id, 'filter', '1'); |
@@ -100,17 +104,20 @@ discard block |
||
100 | 104 | } |
101 | 105 | |
102 | 106 | /** {@inheritdoc} */ |
103 | - public function loadAjax() { |
|
107 | + public function loadAjax() |
|
108 | + { |
|
104 | 109 | return true; |
105 | 110 | } |
106 | 111 | |
107 | 112 | /** {@inheritdoc} */ |
108 | - public function isUserBlock() { |
|
113 | + public function isUserBlock() |
|
114 | + { |
|
109 | 115 | return true; |
110 | 116 | } |
111 | 117 | |
112 | 118 | /** {@inheritdoc} */ |
113 | - public function isGedcomBlock() { |
|
119 | + public function isGedcomBlock() |
|
120 | + { |
|
114 | 121 | return true; |
115 | 122 | } |
116 | 123 | |
@@ -119,7 +126,8 @@ discard block |
||
119 | 126 | * |
120 | 127 | * @param int $block_id |
121 | 128 | */ |
122 | - public function configureBlock($block_id) { |
|
129 | + public function configureBlock($block_id) |
|
130 | + { |
|
123 | 131 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
124 | 132 | $this->setBlockSetting($block_id, 'filter', Filter::postBool('filter')); |
125 | 133 | $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table')); |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class AbstractModule - common functions for blocks |
24 | 24 | */ |
25 | -abstract class AbstractModule { |
|
25 | +abstract class AbstractModule |
|
26 | +{ |
|
26 | 27 | /** @var string The directory where the module is installed */ |
27 | 28 | private $directory; |
28 | 29 | |
@@ -40,7 +41,8 @@ discard block |
||
40 | 41 | * |
41 | 42 | * @param string $directory Where is this module installed |
42 | 43 | */ |
43 | - public function __construct($directory) { |
|
44 | + public function __construct($directory) |
|
45 | + { |
|
44 | 46 | $this->directory = $directory; |
45 | 47 | } |
46 | 48 | |
@@ -53,7 +55,8 @@ discard block |
||
53 | 55 | * |
54 | 56 | * @return null|string |
55 | 57 | */ |
56 | - public function getBlockSetting($block_id, $setting_name, $default_value = null) { |
|
58 | + public function getBlockSetting($block_id, $setting_name, $default_value = null) |
|
59 | + { |
|
57 | 60 | $setting_value = Database::prepare( |
58 | 61 | "SELECT setting_value FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name" |
59 | 62 | )->execute(array( |
@@ -73,7 +76,8 @@ discard block |
||
73 | 76 | * |
74 | 77 | * @return $this |
75 | 78 | */ |
76 | - public function setBlockSetting($block_id, $setting_name, $setting_value) { |
|
79 | + public function setBlockSetting($block_id, $setting_name, $setting_value) |
|
80 | + { |
|
77 | 81 | if ($setting_value === null) { |
78 | 82 | Database::prepare( |
79 | 83 | "DELETE FROM `##block_setting` WHERE block_id = :block_id AND setting_name = :setting_name" |
@@ -115,7 +119,8 @@ discard block |
||
115 | 119 | * |
116 | 120 | * @return int |
117 | 121 | */ |
118 | - public function defaultAccessLevel() { |
|
122 | + public function defaultAccessLevel() |
|
123 | + { |
|
119 | 124 | // Returns one of: Auth::PRIV_HIDE, Auth::PRIV_PRIVATE, Auth::PRIV_USER, WT_PRIV_ADMIN |
120 | 125 | return Auth::PRIV_PRIVATE; |
121 | 126 | } |
@@ -125,7 +130,8 @@ discard block |
||
125 | 130 | * |
126 | 131 | * @return string |
127 | 132 | */ |
128 | - public function getName() { |
|
133 | + public function getName() |
|
134 | + { |
|
129 | 135 | return basename($this->directory); |
130 | 136 | } |
131 | 137 | |
@@ -135,7 +141,8 @@ discard block |
||
135 | 141 | * Since modules may have many settings, and will probably want to use |
136 | 142 | * lots of them, load them all at once and cache them. |
137 | 143 | */ |
138 | - private function loadAllSettings() { |
|
144 | + private function loadAllSettings() |
|
145 | + { |
|
139 | 146 | if ($this->settings === null) { |
140 | 147 | $this->settings = Database::prepare( |
141 | 148 | "SELECT setting_name, setting_value FROM `##module_setting` WHERE module_name = ?" |
@@ -151,7 +158,8 @@ discard block |
||
151 | 158 | * |
152 | 159 | * @return string|null |
153 | 160 | */ |
154 | - public function getSetting($setting_name, $default = null) { |
|
161 | + public function getSetting($setting_name, $default = null) |
|
162 | + { |
|
155 | 163 | $this->loadAllSettings(); |
156 | 164 | |
157 | 165 | if (array_key_exists($setting_name, $this->settings)) { |
@@ -170,7 +178,8 @@ discard block |
||
170 | 178 | * @param string $setting_name |
171 | 179 | * @param string $setting_value |
172 | 180 | */ |
173 | - public function setSetting($setting_name, $setting_value) { |
|
181 | + public function setSetting($setting_name, $setting_value) |
|
182 | + { |
|
174 | 183 | $this->loadAllSettings(); |
175 | 184 | |
176 | 185 | if ($setting_value === null) { |
@@ -199,7 +208,8 @@ discard block |
||
199 | 208 | * |
200 | 209 | * @param string $mod_action |
201 | 210 | */ |
202 | - public function modAction($mod_action) { |
|
211 | + public function modAction($mod_action) |
|
212 | + { |
|
203 | 213 | } |
204 | 214 | |
205 | 215 | /** |
@@ -210,7 +220,8 @@ discard block |
||
210 | 220 | * |
211 | 221 | * @return int |
212 | 222 | */ |
213 | - public function getAccessLevel(Tree $tree, $component) { |
|
223 | + public function getAccessLevel(Tree $tree, $component) |
|
224 | + { |
|
214 | 225 | $access_level = Database::prepare( |
215 | 226 | "SELECT access_level FROM `##module_privacy` WHERE gedcom_id = :gedcom_id AND module_name = :module_name AND component = :component" |
216 | 227 | )->execute(array( |
@@ -31,14 +31,17 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * Class YahrzeitModule |
33 | 33 | */ |
34 | -class YahrzeitModule extends AbstractModule implements ModuleBlockInterface { |
|
34 | +class YahrzeitModule extends AbstractModule implements ModuleBlockInterface |
|
35 | +{ |
|
35 | 36 | /** {@inheritdoc} */ |
36 | - public function getTitle() { |
|
37 | + public function getTitle() |
|
38 | + { |
|
37 | 39 | return /* I18N: Name of a module. Yahrzeiten (the plural of Yahrzeit) are special anniversaries of deaths in the Hebrew faith/calendar. */ I18N::translate('Yahrzeiten'); |
38 | 40 | } |
39 | 41 | |
40 | 42 | /** {@inheritdoc} */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “Yahrzeiten” module. A “Hebrew death” is a death where the date is recorded in the Hebrew calendar. */ I18N::translate('A list of the Hebrew death anniversaries that will occur in the near future.'); |
43 | 46 | } |
44 | 47 | |
@@ -51,7 +54,8 @@ discard block |
||
51 | 54 | * |
52 | 55 | * @return string |
53 | 56 | */ |
54 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
57 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
58 | + { |
|
55 | 59 | global $ctype, $controller, $WT_TREE; |
56 | 60 | |
57 | 61 | $days = $this->getBlockSetting($block_id, 'days', '7'); |
@@ -231,17 +235,20 @@ discard block |
||
231 | 235 | } |
232 | 236 | |
233 | 237 | /** {@inheritdoc} */ |
234 | - public function loadAjax() { |
|
238 | + public function loadAjax() |
|
239 | + { |
|
235 | 240 | return true; |
236 | 241 | } |
237 | 242 | |
238 | 243 | /** {@inheritdoc} */ |
239 | - public function isUserBlock() { |
|
244 | + public function isUserBlock() |
|
245 | + { |
|
240 | 246 | return true; |
241 | 247 | } |
242 | 248 | |
243 | 249 | /** {@inheritdoc} */ |
244 | - public function isGedcomBlock() { |
|
250 | + public function isGedcomBlock() |
|
251 | + { |
|
245 | 252 | return true; |
246 | 253 | } |
247 | 254 | |
@@ -250,7 +257,8 @@ discard block |
||
250 | 257 | * |
251 | 258 | * @param int $block_id |
252 | 259 | */ |
253 | - public function configureBlock($block_id) { |
|
260 | + public function configureBlock($block_id) |
|
261 | + { |
|
254 | 262 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
255 | 263 | $this->setBlockSetting($block_id, 'days', Filter::postInteger('days', 1, 30, 7)); |
256 | 264 | $this->setBlockSetting($block_id, 'infoStyle', Filter::post('infoStyle', 'list|table', 'table')); |
@@ -28,9 +28,11 @@ discard block |
||
28 | 28 | * |
29 | 29 | * The "user favorites" module is almost identical to the "family tree favorites" module |
30 | 30 | */ |
31 | -class UserFavoritesModule extends FamilyTreeFavoritesModule { |
|
31 | +class UserFavoritesModule extends FamilyTreeFavoritesModule |
|
32 | +{ |
|
32 | 33 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
34 | + public function getDescription() |
|
35 | + { |
|
34 | 36 | return /* I18N: Description of the “Favorites” module */ I18N::translate('Display and manage a user’s favorite pages.'); |
35 | 37 | } |
36 | 38 | |
@@ -39,7 +41,8 @@ discard block |
||
39 | 41 | * |
40 | 42 | * @return bool |
41 | 43 | */ |
42 | - public function isUserBlock() { |
|
44 | + public function isUserBlock() |
|
45 | + { |
|
43 | 46 | return true; |
44 | 47 | } |
45 | 48 | |
@@ -48,7 +51,8 @@ discard block |
||
48 | 51 | * |
49 | 52 | * @return bool |
50 | 53 | */ |
51 | - public function isGedcomBlock() { |
|
54 | + public function isGedcomBlock() |
|
55 | + { |
|
52 | 56 | return false; |
53 | 57 | } |
54 | 58 | |
@@ -59,7 +63,8 @@ discard block |
||
59 | 63 | * |
60 | 64 | * @return string[][] |
61 | 65 | */ |
62 | - public static function getFavorites($user_id) { |
|
66 | + public static function getFavorites($user_id) |
|
67 | + { |
|
63 | 68 | global $WT_TREE; |
64 | 69 | |
65 | 70 | return |
@@ -76,7 +81,8 @@ discard block |
||
76 | 81 | * |
77 | 82 | * @param string $mod_action |
78 | 83 | */ |
79 | - public function modAction($mod_action) { |
|
84 | + public function modAction($mod_action) |
|
85 | + { |
|
80 | 86 | global $WT_TREE; |
81 | 87 | |
82 | 88 | switch ($mod_action) { |
@@ -23,14 +23,17 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class UserWelcomeModule |
25 | 25 | */ |
26 | -class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { |
|
26 | +class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface |
|
27 | +{ |
|
27 | 28 | /** {@inheritdoc} */ |
28 | - public function getTitle() { |
|
29 | + public function getTitle() |
|
30 | + { |
|
29 | 31 | return /* I18N: Name of a module */ I18N::translate('My page'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | return /* I18N: Description of the “My page” module */ I18N::translate('A greeting message and useful links for a user.'); |
35 | 38 | } |
36 | 39 | |
@@ -43,7 +46,8 @@ discard block |
||
43 | 46 | * |
44 | 47 | * @return string |
45 | 48 | */ |
46 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
49 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
50 | + { |
|
47 | 51 | global $WT_TREE; |
48 | 52 | |
49 | 53 | $id = $this->getName() . $block_id; |
@@ -70,17 +74,20 @@ discard block |
||
70 | 74 | } |
71 | 75 | |
72 | 76 | /** {@inheritdoc} */ |
73 | - public function loadAjax() { |
|
77 | + public function loadAjax() |
|
78 | + { |
|
74 | 79 | return false; |
75 | 80 | } |
76 | 81 | |
77 | 82 | /** {@inheritdoc} */ |
78 | - public function isUserBlock() { |
|
83 | + public function isUserBlock() |
|
84 | + { |
|
79 | 85 | return true; |
80 | 86 | } |
81 | 87 | |
82 | 88 | /** {@inheritdoc} */ |
83 | - public function isGedcomBlock() { |
|
89 | + public function isGedcomBlock() |
|
90 | + { |
|
84 | 91 | return false; |
85 | 92 | } |
86 | 93 | |
@@ -89,6 +96,7 @@ discard block |
||
89 | 96 | * |
90 | 97 | * @param int $block_id |
91 | 98 | */ |
92 | - public function configureBlock($block_id) { |
|
99 | + public function configureBlock($block_id) |
|
100 | + { |
|
93 | 101 | } |
94 | 102 | } |