@@ -29,143 +29,143 @@ discard block |
||
29 | 29 | * Certificates Module. |
30 | 30 | */ |
31 | 31 | class CertificatesModule |
32 | - extends AbstractModule |
|
33 | - implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface |
|
32 | + extends AbstractModule |
|
33 | + implements HookSubscriberInterface, ModuleConfigInterface, ModuleMenuItemInterface, FactSourceTextExtenderInterface, CustomSimpleTagManagerInterface |
|
34 | 34 | { |
35 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
36 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
35 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
36 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Provider for Certificates |
|
40 | - * @var CertificateProviderInterface $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * Provider for Certificates |
|
40 | + * @var CertificateProviderInterface $provider |
|
41 | + */ |
|
42 | + protected $provider; |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inhericDoc} |
|
46 | - */ |
|
47 | - public function getTitle() { |
|
48 | - return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
49 | - } |
|
44 | + /** |
|
45 | + * {@inhericDoc} |
|
46 | + */ |
|
47 | + public function getTitle() { |
|
48 | + return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates'); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inhericDoc} |
|
53 | - */ |
|
54 | - public function getDescription() { |
|
55 | - return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
56 | - } |
|
51 | + /** |
|
52 | + * {@inhericDoc} |
|
53 | + */ |
|
54 | + public function getDescription() { |
|
55 | + return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * {@inhericDoc} |
|
60 | - */ |
|
61 | - public function modAction($mod_action) { |
|
62 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
63 | - } |
|
58 | + /** |
|
59 | + * {@inhericDoc} |
|
60 | + */ |
|
61 | + public function modAction($mod_action) { |
|
62 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * {@inhericDoc} |
|
67 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
68 | - */ |
|
69 | - public function getConfigLink() { |
|
70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | - } |
|
65 | + /** |
|
66 | + * {@inhericDoc} |
|
67 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
68 | + */ |
|
69 | + public function getConfigLink() { |
|
70 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inhericDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
76 | - */ |
|
77 | - public function getSubscribedHooks() { |
|
78 | - return array( |
|
79 | - 'hFactSourcePrepend' => 50, |
|
80 | - 'hGetExpectedTags' => 50, |
|
81 | - 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
82 | - 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
83 | - 'hAddSimpleTag#SOUR' => 50, |
|
84 | - 'hHasHelpTextTag#_ACT' => 50, |
|
85 | - 'hGetHelpTextTag#_ACT' => 50 |
|
86 | - ); |
|
87 | - } |
|
73 | + /** |
|
74 | + * {@inhericDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
76 | + */ |
|
77 | + public function getSubscribedHooks() { |
|
78 | + return array( |
|
79 | + 'hFactSourcePrepend' => 50, |
|
80 | + 'hGetExpectedTags' => 50, |
|
81 | + 'hHtmlSimpleTagDisplay#_ACT' => 50, |
|
82 | + 'hHtmlSimpleTagEditor#_ACT' => 50, |
|
83 | + 'hAddSimpleTag#SOUR' => 50, |
|
84 | + 'hHasHelpTextTag#_ACT' => 50, |
|
85 | + 'hGetHelpTextTag#_ACT' => 50 |
|
86 | + ); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * {@inhericDoc} |
|
91 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
92 | - */ |
|
93 | - public function getMenu(Tree $tree, $reference = null) { |
|
94 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
95 | - return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
96 | - } |
|
89 | + /** |
|
90 | + * {@inhericDoc} |
|
91 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
92 | + */ |
|
93 | + public function getMenu(Tree $tree, $reference = null) { |
|
94 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
95 | + return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * {@inhericDoc} |
|
100 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
101 | - */ |
|
102 | - public function hFactSourcePrepend($srec) { |
|
103 | - global $WT_TREE; |
|
98 | + /** |
|
99 | + * {@inhericDoc} |
|
100 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend() |
|
101 | + */ |
|
102 | + public function hFactSourcePrepend($srec) { |
|
103 | + global $WT_TREE; |
|
104 | 104 | |
105 | - $html=''; |
|
106 | - $sid=null; |
|
105 | + $html=''; |
|
106 | + $sid=null; |
|
107 | 107 | |
108 | - if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
|
109 | - if (!$srec || strlen($srec) == 0) return $html; |
|
108 | + if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
|
109 | + if (!$srec || strlen($srec) == 0) return $html; |
|
110 | 110 | |
111 | - $certificate = null; |
|
112 | - $subrecords = explode("\n", $srec); |
|
113 | - $levelSOUR = substr($subrecords[0], 0, 1); |
|
114 | - $match = null; |
|
115 | - if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
116 | - $sid=$match[1]; |
|
117 | - }; |
|
118 | - $nb_subrecords = count($subrecords); |
|
119 | - for ($i=0; $i < $nb_subrecords; $i++) { |
|
120 | - $subrecords[$i] = trim($subrecords[$i]); |
|
121 | - $tag = substr($subrecords[$i], 2, 4); |
|
122 | - $text = substr($subrecords[$i], 7); |
|
123 | - if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
124 | - } |
|
111 | + $certificate = null; |
|
112 | + $subrecords = explode("\n", $srec); |
|
113 | + $levelSOUR = substr($subrecords[0], 0, 1); |
|
114 | + $match = null; |
|
115 | + if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
|
116 | + $sid=$match[1]; |
|
117 | + }; |
|
118 | + $nb_subrecords = count($subrecords); |
|
119 | + for ($i=0; $i < $nb_subrecords; $i++) { |
|
120 | + $subrecords[$i] = trim($subrecords[$i]); |
|
121 | + $tag = substr($subrecords[$i], 2, 4); |
|
122 | + $text = substr($subrecords[$i], 7); |
|
123 | + if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
124 | + } |
|
125 | 125 | |
126 | - if($certificate && $certificate->canShow()) |
|
127 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
126 | + if($certificate && $certificate->canShow()) |
|
127 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
128 | 128 | |
129 | - } |
|
130 | - return $html; |
|
131 | - } |
|
129 | + } |
|
130 | + return $html; |
|
131 | + } |
|
132 | 132 | |
133 | - /** |
|
134 | - * {@inhericDoc} |
|
135 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
136 | - */ |
|
137 | - public function hFactSourceAppend($srec) { } |
|
133 | + /** |
|
134 | + * {@inhericDoc} |
|
135 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourceAppend() |
|
136 | + */ |
|
137 | + public function hFactSourceAppend($srec) { } |
|
138 | 138 | |
139 | - /** |
|
140 | - * {@inhericDoc} |
|
141 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
142 | - */ |
|
143 | - public function hGetExpectedTags() { |
|
144 | - return array('SOUR' => '_ACT'); |
|
145 | - } |
|
139 | + /** |
|
140 | + * {@inhericDoc} |
|
141 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetExpectedTags() |
|
142 | + */ |
|
143 | + public function hGetExpectedTags() { |
|
144 | + return array('SOUR' => '_ACT'); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * {@inhericDoc} |
|
149 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
150 | - */ |
|
151 | - public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
152 | - $html = ''; |
|
153 | - switch($tag){ |
|
154 | - case '_ACT': |
|
155 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
156 | - break; |
|
157 | - } |
|
158 | - return $html; |
|
159 | - } |
|
147 | + /** |
|
148 | + * {@inhericDoc} |
|
149 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagDisplay() |
|
150 | + */ |
|
151 | + public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
|
152 | + $html = ''; |
|
153 | + switch($tag){ |
|
154 | + case '_ACT': |
|
155 | + if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
156 | + break; |
|
157 | + } |
|
158 | + return $html; |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * {@inhericDoc} |
|
163 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
164 | - */ |
|
165 | - public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
166 | - global $controller, $WT_TREE; |
|
161 | + /** |
|
162 | + * {@inhericDoc} |
|
163 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor() |
|
164 | + */ |
|
165 | + public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
|
166 | + global $controller, $WT_TREE; |
|
167 | 167 | |
168 | - $html = ''; |
|
168 | + $html = ''; |
|
169 | 169 | |
170 | 170 | switch($tag){ |
171 | 171 | case '_ACT': |
@@ -193,77 +193,77 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | return $html; |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | - /** |
|
199 | - * {@inhericDoc} |
|
200 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
201 | - */ |
|
202 | - public function hAddSimpleTag($context, $level) { |
|
203 | - switch($context){ |
|
204 | - case 'SOUR': |
|
205 | - FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
206 | - break; |
|
207 | - } |
|
208 | - } |
|
198 | + /** |
|
199 | + * {@inhericDoc} |
|
200 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
|
201 | + */ |
|
202 | + public function hAddSimpleTag($context, $level) { |
|
203 | + switch($context){ |
|
204 | + case 'SOUR': |
|
205 | + FunctionsEdit::addSimpleTag($level.' _ACT'); |
|
206 | + break; |
|
207 | + } |
|
208 | + } |
|
209 | 209 | |
210 | - /** |
|
211 | - * {@inhericDoc} |
|
212 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
213 | - */ |
|
214 | - public function hHasHelpTextTag($tag) { |
|
215 | - switch($tag){ |
|
210 | + /** |
|
211 | + * {@inhericDoc} |
|
212 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
|
213 | + */ |
|
214 | + public function hHasHelpTextTag($tag) { |
|
215 | + switch($tag){ |
|
216 | 216 | case '_ACT': |
217 | 217 | return true; |
218 | 218 | } |
219 | 219 | return false; |
220 | - } |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * {@inhericDoc} |
|
224 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
225 | - */ |
|
226 | - public function hGetHelpTextTag($tag) { |
|
227 | - switch($tag){ |
|
228 | - case '_ACT': |
|
229 | - return array( |
|
230 | - I18N::translate('Certificate'), |
|
231 | - '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
232 | - default: |
|
233 | - return null; |
|
234 | - } |
|
235 | - } |
|
222 | + /** |
|
223 | + * {@inhericDoc} |
|
224 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
|
225 | + */ |
|
226 | + public function hGetHelpTextTag($tag) { |
|
227 | + switch($tag){ |
|
228 | + case '_ACT': |
|
229 | + return array( |
|
230 | + I18N::translate('Certificate'), |
|
231 | + '<p>'.I18N::translate('Path to a certificate linked to a source reference.').'</p>'); |
|
232 | + default: |
|
233 | + return null; |
|
234 | + } |
|
235 | + } |
|
236 | 236 | |
237 | - /** |
|
238 | - * Returns the default Certificate File Provider, as configured in the module |
|
239 | - * |
|
240 | - * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
241 | - */ |
|
242 | - public function getProvider() { |
|
243 | - global $WT_TREE; |
|
237 | + /** |
|
238 | + * Returns the default Certificate File Provider, as configured in the module |
|
239 | + * |
|
240 | + * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
|
241 | + */ |
|
242 | + public function getProvider() { |
|
243 | + global $WT_TREE; |
|
244 | 244 | |
245 | - if(!$this->provider) { |
|
246 | - $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
247 | - $this->provider = new CertificateFileProvider($root_path, $WT_TREE); |
|
248 | - } |
|
249 | - return $this->provider; |
|
250 | - } |
|
245 | + if(!$this->provider) { |
|
246 | + $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
|
247 | + $this->provider = new CertificateFileProvider($root_path, $WT_TREE); |
|
248 | + } |
|
249 | + return $this->provider; |
|
250 | + } |
|
251 | 251 | |
252 | 252 | |
253 | - /** |
|
254 | - * Return the HTML code for custom simple tag _ACT |
|
255 | - * |
|
256 | - * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
257 | - * @param string|null $sid Linked Source ID, if it exists |
|
258 | - */ |
|
259 | - protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
260 | - $html = ''; |
|
261 | - if($certificate){ |
|
262 | - $certificate->setSource($sid); |
|
263 | - $html = $certificate->displayImage('icon'); |
|
264 | - } |
|
265 | - return $html; |
|
266 | - } |
|
253 | + /** |
|
254 | + * Return the HTML code for custom simple tag _ACT |
|
255 | + * |
|
256 | + * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
257 | + * @param string|null $sid Linked Source ID, if it exists |
|
258 | + */ |
|
259 | + protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
260 | + $html = ''; |
|
261 | + if($certificate){ |
|
262 | + $certificate->setSource($sid); |
|
263 | + $html = $certificate->displayImage('icon'); |
|
264 | + } |
|
265 | + return $html; |
|
266 | + } |
|
267 | 267 | |
268 | 268 | } |
269 | 269 | |
270 | 270 | \ No newline at end of file |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | * {@inhericDoc} |
30 | 30 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
31 | 31 | */ |
32 | - protected function renderContent() { |
|
33 | - ?> |
|
32 | + protected function renderContent() { |
|
33 | + ?> |
|
34 | 34 | <div id="maj-sosa-missing-page" class="center"> |
35 | 35 | <h2><?php echo $this->data->get('title'); ?></h2> |
36 | 36 | |
37 | 37 | <?php if($this->data->get('is_setup')) { |
38 | - $this->renderSosaHeader(); |
|
39 | - if($this->data->get('has_missing', false)) { |
|
40 | - $table_id = $this->data->get('table_id'); |
|
41 | - ?> |
|
38 | + $this->renderSosaHeader(); |
|
39 | + if($this->data->get('has_missing', false)) { |
|
40 | + $table_id = $this->data->get('table_id'); |
|
41 | + ?> |
|
42 | 42 | <div id="sosa-indi-missing" class="smissing-list"> |
43 | 43 | <table id="<?php echo $table_id;?>"> |
44 | 44 | <thead> |
@@ -109,44 +109,44 @@ discard block |
||
109 | 109 | <tbody> |
110 | 110 | |
111 | 111 | <?php foreach($this->data->get('missing_list') as $missing_tab) { |
112 | - $person = $missing_tab['indi']; |
|
112 | + $person = $missing_tab['indi']; |
|
113 | 113 | |
114 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
115 | - if ($person->isPendingAddtion()) { |
|
116 | - $class = ' class="new"'; |
|
117 | - } elseif ($person->isPendingDeletion()) { |
|
118 | - $class = ' class="old"'; |
|
119 | - } else { |
|
120 | - $class = ''; |
|
121 | - } |
|
122 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
123 | - ?> |
|
114 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
115 | + if ($person->isPendingAddtion()) { |
|
116 | + $class = ' class="new"'; |
|
117 | + } elseif ($person->isPendingDeletion()) { |
|
118 | + $class = ' class="old"'; |
|
119 | + } else { |
|
120 | + $class = ''; |
|
121 | + } |
|
122 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
123 | + ?> |
|
124 | 124 | <tr <?php echo $class?>> |
125 | 125 | <td class="transparent"><?php echo $missing_tab['sosa']; ?></td> |
126 | 126 | <td class="transparent"><?php echo $person->getXref(); ?></td> |
127 | 127 | <td colspan="2"> |
128 | 128 | <?php foreach ($person->getAllNames() as $num=>$name) { |
129 | - if ($name['type']=='NAME') { |
|
130 | - $title=''; |
|
131 | - } else { |
|
132 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
133 | - } |
|
134 | - if ($num==$person->getPrimaryName()) { |
|
135 | - $class=' class="name2"'; |
|
136 | - $sex_image=$person->getSexImage(); |
|
137 | - list($surn, $givn)=explode(',', $name['sort']); |
|
138 | - } else { |
|
139 | - $class=''; |
|
140 | - $sex_image=''; |
|
141 | - } ?> |
|
129 | + if ($name['type']=='NAME') { |
|
130 | + $title=''; |
|
131 | + } else { |
|
132 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
133 | + } |
|
134 | + if ($num==$person->getPrimaryName()) { |
|
135 | + $class=' class="name2"'; |
|
136 | + $sex_image=$person->getSexImage(); |
|
137 | + list($surn, $givn)=explode(',', $name['sort']); |
|
138 | + } else { |
|
139 | + $class=''; |
|
140 | + $sex_image=''; |
|
141 | + } ?> |
|
142 | 142 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
143 | 143 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
144 | 144 | </a> |
145 | 145 | <?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller'); ?> |
146 | 146 | <br/> |
147 | 147 | <?php } |
148 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
149 | - ?> |
|
148 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
149 | + ?> |
|
150 | 150 | </td> |
151 | 151 | <td style="display:none;"></td> |
152 | 152 | <td> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
157 | 157 | </td> |
158 | 158 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
159 | - $isISourced = $dperson->isSourced(); ?> |
|
159 | + $isISourced = $dperson->isSourced(); ?> |
|
160 | 160 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium'); ?></td> |
161 | 161 | <td><?php echo $isISourced; ?></td> |
162 | 162 | <?php } else { ?> |
@@ -167,34 +167,34 @@ discard block |
||
167 | 167 | <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X';?></td> |
168 | 168 | <td> |
169 | 169 | <?php |
170 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
171 | - foreach ($birth_dates as $num=>$birth_date) { |
|
172 | - if ($num) { ?><br/><?php } ?> |
|
170 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
171 | + foreach ($birth_dates as $num=>$birth_date) { |
|
172 | + if ($num) { ?><br/><?php } ?> |
|
173 | 173 | <?php echo $birth_date->display(true); |
174 | - } |
|
175 | - } else { |
|
176 | - $birth_date=$person->getEstimatedBirthDate(); |
|
177 | - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
178 | - $birth_date->display(true); |
|
179 | - } else { |
|
180 | - echo ' '; |
|
181 | - } |
|
182 | - $birth_dates[0] = new Date(''); |
|
183 | - } |
|
184 | - ?> |
|
174 | + } |
|
175 | + } else { |
|
176 | + $birth_date=$person->getEstimatedBirthDate(); |
|
177 | + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
178 | + $birth_date->display(true); |
|
179 | + } else { |
|
180 | + echo ' '; |
|
181 | + } |
|
182 | + $birth_dates[0] = new Date(''); |
|
183 | + } |
|
184 | + ?> |
|
185 | 185 | </td> |
186 | 186 | <td><?php echo $birth_date->julianDay();?></td> |
187 | 187 | <td> |
188 | 188 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
189 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
190 | - if ($n) { ?><br><?php } ?> |
|
189 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
190 | + if ($n) { ?><br><?php } ?> |
|
191 | 191 | <a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>"> |
192 | 192 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?> |
193 | 193 | </a> |
194 | 194 | <?php } ?> |
195 | 195 | </td> |
196 | 196 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
197 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
197 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
198 | 198 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td> |
199 | 199 | <td><?php echo $isBSourced; ?></td> |
200 | 200 | <?php } else { ?> |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | <?php } else { ?> |
222 | 222 | <p><?php echo I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)); ?></p> |
223 | 223 | <?php } |
224 | - } else { ?> |
|
224 | + } else { ?> |
|
225 | 225 | <p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/> |
226 | 226 | <ul> |
227 | 227 | <li><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></li> |
@@ -232,6 +232,6 @@ discard block |
||
232 | 232 | <?php } ?> |
233 | 233 | </div> |
234 | 234 | <?php |
235 | - } |
|
235 | + } |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | \ No newline at end of file |
@@ -19,116 +19,116 @@ |
||
19 | 19 | */ |
20 | 20 | class SosaCalculator { |
21 | 21 | |
22 | - /** |
|
23 | - * Maximium size for the temporary Sosa table |
|
24 | - * @var int TMP_SOSA_TABLE_LIMIT |
|
25 | - */ |
|
26 | - const TMP_SOSA_TABLE_LIMIT = 1000; |
|
22 | + /** |
|
23 | + * Maximium size for the temporary Sosa table |
|
24 | + * @var int TMP_SOSA_TABLE_LIMIT |
|
25 | + */ |
|
26 | + const TMP_SOSA_TABLE_LIMIT = 1000; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Reference user |
|
30 | - * @var Fisharebest\Webtrees\User $user |
|
31 | - */ |
|
32 | - protected $user; |
|
28 | + /** |
|
29 | + * Reference user |
|
30 | + * @var Fisharebest\Webtrees\User $user |
|
31 | + */ |
|
32 | + protected $user; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Reference tree |
|
36 | - * @var Fisharebest\Webtrees\Tree $tree |
|
37 | - */ |
|
38 | - protected $tree; |
|
34 | + /** |
|
35 | + * Reference tree |
|
36 | + * @var Fisharebest\Webtrees\Tree $tree |
|
37 | + */ |
|
38 | + protected $tree; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Sosa Provider for the calculator |
|
42 | - * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider |
|
43 | - */ |
|
44 | - protected $sosa_provider; |
|
40 | + /** |
|
41 | + * Sosa Provider for the calculator |
|
42 | + * @var \MyArtJaub\Webtrees\Module\Sosa\Model\SosaCalculator $sosa_provider |
|
43 | + */ |
|
44 | + protected $sosa_provider; |
|
45 | 45 | |
46 | - /** |
|
47 | - * Temporary Sosa table, used during construction |
|
48 | - * @var array $tmp_sosa_table |
|
49 | - */ |
|
50 | - protected $tmp_sosa_table; |
|
46 | + /** |
|
47 | + * Temporary Sosa table, used during construction |
|
48 | + * @var array $tmp_sosa_table |
|
49 | + */ |
|
50 | + protected $tmp_sosa_table; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Constructor for the Sosa Calculator |
|
54 | - * @param Tree $tree |
|
55 | - * @param User $user |
|
56 | - */ |
|
57 | - public function __construct(Tree $tree, User $user) { |
|
58 | - $this->tree = $tree; |
|
59 | - $this->user = $user; |
|
52 | + /** |
|
53 | + * Constructor for the Sosa Calculator |
|
54 | + * @param Tree $tree |
|
55 | + * @param User $user |
|
56 | + */ |
|
57 | + public function __construct(Tree $tree, User $user) { |
|
58 | + $this->tree = $tree; |
|
59 | + $this->user = $user; |
|
60 | 60 | |
61 | - $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
62 | - } |
|
61 | + $this->sosa_provider = new SosaProvider($this->tree, $this->user);; |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Compute all Sosa ancestors from the user's root individual. |
|
66 | - * @return bool Result of the computation |
|
67 | - */ |
|
68 | - public function computeAll() { |
|
69 | - $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
70 | - $indi = Individual::getInstance($root_id, $this->tree); |
|
71 | - if($indi){ |
|
72 | - $this->sosa_provider->deleteAll(); |
|
73 | - $this->addNode($indi, 1); |
|
74 | - $this->flushTmpSosaTable(true); |
|
75 | - return true; |
|
76 | - } |
|
77 | - return false; |
|
78 | - } |
|
64 | + /** |
|
65 | + * Compute all Sosa ancestors from the user's root individual. |
|
66 | + * @return bool Result of the computation |
|
67 | + */ |
|
68 | + public function computeAll() { |
|
69 | + $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
70 | + $indi = Individual::getInstance($root_id, $this->tree); |
|
71 | + if($indi){ |
|
72 | + $this->sosa_provider->deleteAll(); |
|
73 | + $this->addNode($indi, 1); |
|
74 | + $this->flushTmpSosaTable(true); |
|
75 | + return true; |
|
76 | + } |
|
77 | + return false; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Compute all Sosa Ancestors from a specified Individual |
|
82 | - * @param Individual $indi |
|
83 | - * @return bool Result of the computation |
|
84 | - */ |
|
85 | - public function computeFromIndividual(Individual $indi) { |
|
86 | - $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
|
87 | - $current_sosas = $dindi->getSosaNumbers(); |
|
88 | - foreach($current_sosas as $current_sosa => $gen) { |
|
89 | - $this->sosa_provider->deleteAncestors($current_sosa); |
|
90 | - $this->addNode($indi, $current_sosa); |
|
91 | - } |
|
92 | - $this->flushTmpSosaTable(true); |
|
93 | - return true; |
|
94 | - } |
|
80 | + /** |
|
81 | + * Compute all Sosa Ancestors from a specified Individual |
|
82 | + * @param Individual $indi |
|
83 | + * @return bool Result of the computation |
|
84 | + */ |
|
85 | + public function computeFromIndividual(Individual $indi) { |
|
86 | + $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
|
87 | + $current_sosas = $dindi->getSosaNumbers(); |
|
88 | + foreach($current_sosas as $current_sosa => $gen) { |
|
89 | + $this->sosa_provider->deleteAncestors($current_sosa); |
|
90 | + $this->addNode($indi, $current_sosa); |
|
91 | + } |
|
92 | + $this->flushTmpSosaTable(true); |
|
93 | + return true; |
|
94 | + } |
|
95 | 95 | |
96 | - /** |
|
97 | - * Recursive method to add individual to the Sosa table, and flush it regularly |
|
98 | - * @param Individual $indi Individual to add |
|
99 | - * @param int $sosa Individual's sosa |
|
100 | - */ |
|
101 | - protected function addNode(Individual $indi, $sosa) { |
|
102 | - $birth_year = $indi->getEstimatedBirthDate()->gregorianYear(); |
|
103 | - $death_year = $indi->getEstimatedDeathDate()->gregorianYear(); |
|
96 | + /** |
|
97 | + * Recursive method to add individual to the Sosa table, and flush it regularly |
|
98 | + * @param Individual $indi Individual to add |
|
99 | + * @param int $sosa Individual's sosa |
|
100 | + */ |
|
101 | + protected function addNode(Individual $indi, $sosa) { |
|
102 | + $birth_year = $indi->getEstimatedBirthDate()->gregorianYear(); |
|
103 | + $death_year = $indi->getEstimatedDeathDate()->gregorianYear(); |
|
104 | 104 | |
105 | - $this->tmp_sosa_table[] = array( |
|
106 | - 'indi' => $indi->getXref(), |
|
107 | - 'sosa' => $sosa, |
|
108 | - 'birth_year' => $birth_year, |
|
109 | - 'death_year' => $death_year |
|
110 | - ); |
|
105 | + $this->tmp_sosa_table[] = array( |
|
106 | + 'indi' => $indi->getXref(), |
|
107 | + 'sosa' => $sosa, |
|
108 | + 'birth_year' => $birth_year, |
|
109 | + 'death_year' => $death_year |
|
110 | + ); |
|
111 | 111 | |
112 | - $this->flushTmpSosaTable(); |
|
112 | + $this->flushTmpSosaTable(); |
|
113 | 113 | |
114 | - if($fam = $indi->getPrimaryChildFamily()) { |
|
115 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
116 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
117 | - } |
|
118 | - } |
|
114 | + if($fam = $indi->getPrimaryChildFamily()) { |
|
115 | + if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
116 | + if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
117 | + } |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
122 | - * |
|
123 | - * @param bool $force Should the flush be forced |
|
124 | - */ |
|
125 | - protected function flushTmpSosaTable($force = false) { |
|
126 | - if( count($this->tmp_sosa_table)> 0 && |
|
127 | - ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
128 | - $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
|
129 | - $this->tmp_sosa_table = array(); |
|
130 | - } |
|
131 | - } |
|
120 | + /** |
|
121 | + * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
122 | + * |
|
123 | + * @param bool $force Should the flush be forced |
|
124 | + */ |
|
125 | + protected function flushTmpSosaTable($force = false) { |
|
126 | + if( count($this->tmp_sosa_table)> 0 && |
|
127 | + ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT)){ |
|
128 | + $this->sosa_provider->insertOrUpdate($this->tmp_sosa_table); |
|
129 | + $this->tmp_sosa_table = array(); |
|
130 | + } |
|
131 | + } |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
135 | 135 | \ No newline at end of file |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class HealthCheckEmailTask extends AbstractTask implements ConfigurableTaskInterface { |
31 | 31 | |
32 | - /** |
|
33 | - * {@inheritDoc} |
|
34 | - * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle() |
|
35 | - */ |
|
36 | - public function getTitle() { |
|
32 | + /** |
|
33 | + * {@inheritDoc} |
|
34 | + * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getTitle() |
|
35 | + */ |
|
36 | + public function getTitle() { |
|
37 | 37 | return I18N::translate('Healthcheck Email'); |
38 | 38 | } |
39 | 39 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * {@inheritDoc} |
42 | 42 | * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::getDefaultFrequency() |
43 | 43 | */ |
44 | - public function getDefaultFrequency() { |
|
44 | + public function getDefaultFrequency() { |
|
45 | 45 | return 10080; // = 1 week = 7 * 24 * 60 min |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * {@inheritDoc} |
50 | 50 | * @see \MyArtJaub\Webtrees\Module\AdminTasks\Model\AbstractTask::executeSteps() |
51 | 51 | */ |
52 | - protected function executeSteps() { |
|
52 | + protected function executeSteps() { |
|
53 | 53 | |
54 | 54 | $res = false; |
55 | 55 | |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $interval = max($this->frequency, $interval_sincelast); |
64 | 64 | $nbdays = ceil($interval / (24 * 60)); |
65 | 65 | |
66 | - // Check for updates |
|
67 | - $latest_version_txt = Functions::fetchLatestVersion(); |
|
68 | - if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
|
69 | - list($latest_version, , $download_url) = explode('|', $latest_version_txt); |
|
70 | - } else { |
|
71 | - // Cannot determine the latest version |
|
72 | - list($latest_version, , $download_url) = explode('|', '||'); |
|
73 | - } |
|
66 | + // Check for updates |
|
67 | + $latest_version_txt = Functions::fetchLatestVersion(); |
|
68 | + if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
|
69 | + list($latest_version, , $download_url) = explode('|', $latest_version_txt); |
|
70 | + } else { |
|
71 | + // Cannot determine the latest version |
|
72 | + list($latest_version, , $download_url) = explode('|', '||'); |
|
73 | + } |
|
74 | 74 | |
75 | 75 | // Users statistics |
76 | 76 | $warnusers = 0; |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | $html = ' |
214 | 214 | <div class="form-group"> |
215 | 215 | <label class="control-label col-sm-3"> '. |
216 | - I18N::translate('Enable healthcheck emails for') . |
|
217 | - '</label> |
|
216 | + I18N::translate('Enable healthcheck emails for') . |
|
217 | + '</label> |
|
218 | 218 | <div class="col-sm-9">'; |
219 | 219 | |
220 | 220 | foreach(Tree::getAll() as $tree){ |
221 | 221 | if(Auth::isManager($tree)){ |
222 | - $html .= '<div class="form-group row"> |
|
222 | + $html .= '<div class="form-group row"> |
|
223 | 223 | <span class="col-sm-3 control-label">' . |
224 | - $tree->getTitle() . |
|
224 | + $tree->getTitle() . |
|
225 | 225 | '</span> |
226 | 226 | <div class="col-sm-2">'; |
227 | 227 | $html .= FunctionsEdit::editFieldYesNo('HEALTHCHECK_ENABLED_' . $tree->getTreeId(), $tree->getPreference('MAJ_AT_'.$this->getName().'_ENABLED', 1), 'class="radio-inline"'); |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | $html .= ' <p class="small text-muted">'. |
233 | - I18N::translate('Enable the health check emails for each of the selected trees.') . |
|
234 | - '</p> |
|
233 | + I18N::translate('Enable the health check emails for each of the selected trees.') . |
|
234 | + '</p> |
|
235 | 235 | </div> |
236 | 236 | </div>'; |
237 | 237 |
@@ -24,16 +24,16 @@ |
||
24 | 24 | */ |
25 | 25 | public function upgrade() { |
26 | 26 | Database::exec( |
27 | - 'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('. |
|
28 | - ' majat_name VARCHAR(32) NOT NULL,'. |
|
29 | - ' majat_status ENUM(\'enabled\',\'disabled\') NOT NULL DEFAULT \'disabled\','. |
|
30 | - ' majat_last_run DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\','. |
|
31 | - ' majat_last_result TINYINT(1) NOT NULL DEFAULT 1,'. // 0 means error, 1 is success |
|
32 | - ' majat_frequency INTEGER NOT NULL DEFAULT 10080,'. // In min, Default every week |
|
33 | - ' majat_nb_occur SMALLINT NOT NULL DEFAULT 0,'. |
|
34 | - ' majat_running TINYINT(1) NOT NULL DEFAULT 0,'. |
|
35 | - ' PRIMARY KEY (majat_name)'. |
|
36 | - ') COLLATE utf8_unicode_ci ENGINE=InnoDB' |
|
27 | + 'CREATE TABLE IF NOT EXISTS `##maj_admintasks` ('. |
|
28 | + ' majat_name VARCHAR(32) NOT NULL,'. |
|
29 | + ' majat_status ENUM(\'enabled\',\'disabled\') NOT NULL DEFAULT \'disabled\','. |
|
30 | + ' majat_last_run DATETIME NOT NULL DEFAULT \'2000-01-01 00:00:00\','. |
|
31 | + ' majat_last_result TINYINT(1) NOT NULL DEFAULT 1,'. // 0 means error, 1 is success |
|
32 | + ' majat_frequency INTEGER NOT NULL DEFAULT 10080,'. // In min, Default every week |
|
33 | + ' majat_nb_occur SMALLINT NOT NULL DEFAULT 0,'. |
|
34 | + ' majat_running TINYINT(1) NOT NULL DEFAULT 0,'. |
|
35 | + ' PRIMARY KEY (majat_name)'. |
|
36 | + ') COLLATE utf8_unicode_ci ENGINE=InnoDB' |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | } |
@@ -24,89 +24,89 @@ discard block |
||
24 | 24 | * {@inhericDoc} |
25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
26 | 26 | */ |
27 | - protected function renderContent() { |
|
27 | + protected function renderContent() { |
|
28 | 28 | |
29 | - $max_details_gen = $this->data->get('max_details_gen'); |
|
30 | - $analysis_level = $this->data->get('analysis_level'); |
|
31 | - $results_by_gen = $this->data->get('results_by_generations'); |
|
32 | - $display_all_places = $this->data->get('display_all_places', true); |
|
29 | + $max_details_gen = $this->data->get('max_details_gen'); |
|
30 | + $analysis_level = $this->data->get('analysis_level'); |
|
31 | + $results_by_gen = $this->data->get('results_by_generations'); |
|
32 | + $display_all_places = $this->data->get('display_all_places', true); |
|
33 | 33 | |
34 | - $html = |
|
35 | - '<div id="geodispersion_gen"> |
|
34 | + $html = |
|
35 | + '<div id="geodispersion_gen"> |
|
36 | 36 | <table id="geodispersion_gentable" class="center">'; |
37 | 37 | |
38 | - foreach($results_by_gen as $gen => $genData){ |
|
39 | - $html .= |
|
40 | - '<tr> |
|
38 | + foreach($results_by_gen as $gen => $genData){ |
|
39 | + $html .= |
|
40 | + '<tr> |
|
41 | 41 | <td class="descriptionbox">' . |
42 | - I18N::translate("Generation %s", I18N::number($gen)). |
|
43 | - ($display_all_places ? '<br />' : ' '). |
|
44 | - I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . |
|
45 | - '</td> |
|
42 | + I18N::translate("Generation %s", I18N::number($gen)). |
|
43 | + ($display_all_places ? '<br />' : ' '). |
|
44 | + I18N::translate('(%s)', I18N::percentage(Functions::safeDivision($genData['sum'] + $genData['other'], $genData['sum'] + $genData['other'] + $genData['unknown']),1)) . |
|
45 | + '</td> |
|
46 | 46 | <td class="optionbox left">'. |
47 | - ($display_all_places ? |
|
48 | - $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : |
|
49 | - $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
50 | - ) . |
|
51 | - '</ditdv> |
|
47 | + ($display_all_places ? |
|
48 | + $this->htmlGenerationAllPlacesRow($genData, $analysis_level) : |
|
49 | + $this->htmlGenerationTopPlacesRow($genData, $analysis_level) |
|
50 | + ) . |
|
51 | + '</ditdv> |
|
52 | 52 | </tr>'; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - $html.= |
|
56 | - '</table> |
|
55 | + $html.= |
|
56 | + '</table> |
|
57 | 57 | <div class="left"> |
58 | 58 | <strong>' . I18N::translate('Interpretation help:') . '</strong> |
59 | 59 | <br />'. |
60 | - I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . |
|
61 | - '<br />'; |
|
62 | - if(!is_null($max_details_gen) && $max_details_gen == 0){ |
|
63 | - $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
|
64 | - $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
|
65 | - } |
|
66 | - else{ |
|
67 | - $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
|
68 | - $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
|
69 | - } |
|
70 | - $html.= |
|
71 | - '</div> |
|
60 | + I18N::translate('<strong>Generation X (yy %%)</strong>: The percentage indicates the number of found places compared to the total number of ancestors in this generation.') . |
|
61 | + '<br />'; |
|
62 | + if(!is_null($max_details_gen) && $max_details_gen == 0){ |
|
63 | + $html .= I18N::translate('<strong><em>Place</em> or <em>Flag</em> aa (bb %%)</strong>: The first number indicates the total number of ancestors born in this place, the percentage relates this count to the total number of found places. No percentage means it is less than 10%%.').'<br />'; |
|
64 | + $html .= I18N::translate('If any, the darker area indicates the number of unknown places within the generation or places outside the analysed area, and its percentage compared to the number of ancestors. No percentage means it is less than 10%%.'); |
|
65 | + } |
|
66 | + else{ |
|
67 | + $html .= I18N::translate('<strong><em>Place</em> [aa - bb %%]</strong>: The first number indicates the total number of ancestors born in this place, the percentage compares this count to the total number of found places.').'<br />'; |
|
68 | + $html .= I18N::translate('Only the %d more frequent places for each generation are displayed.', $max_details_gen); |
|
69 | + } |
|
70 | + $html.= |
|
71 | + '</div> |
|
72 | 72 | </div>'; |
73 | 73 | |
74 | - return $html; |
|
75 | - } |
|
74 | + return $html; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Return the HTML code to display a row with all places found in a generation. |
|
80 | - * |
|
81 | - * @param array $data Data array |
|
82 | - * @param int $analysis_level Level of subdivision of analysis |
|
83 | - * @return string HTML code for all places row |
|
84 | - */ |
|
85 | - protected function htmlGenerationAllPlacesRow($data, $analysis_level) { |
|
86 | - $html = |
|
87 | - '<table class="geodispersion_bigrow"> |
|
78 | + /** |
|
79 | + * Return the HTML code to display a row with all places found in a generation. |
|
80 | + * |
|
81 | + * @param array $data Data array |
|
82 | + * @param int $analysis_level Level of subdivision of analysis |
|
83 | + * @return string HTML code for all places row |
|
84 | + */ |
|
85 | + protected function htmlGenerationAllPlacesRow($data, $analysis_level) { |
|
86 | + $html = |
|
87 | + '<table class="geodispersion_bigrow"> |
|
88 | 88 | <tr>'; |
89 | 89 | |
90 | - $sum_gen = $data['sum']; |
|
91 | - $unknownother = $data['unknown'] + $data['other']; |
|
92 | - foreach($data['places'] as $placename=> $dataplace){ |
|
93 | - $levels = array_map('trim',explode(',', $placename)); |
|
94 | - $content = ''; |
|
95 | - if(isset($dataplace['flag'])){ |
|
96 | - $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
|
97 | - } |
|
98 | - else{ |
|
99 | - $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
|
100 | - } |
|
101 | - $count = $dataplace['count']; |
|
102 | - $content .= I18N::number($count); |
|
103 | - $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
|
104 | - $perc2= Functions::safeDivision($count, $sum_gen); |
|
105 | - if($perc2>=0.1) |
|
106 | - $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
107 | - $content .= '</td>'; |
|
90 | + $sum_gen = $data['sum']; |
|
91 | + $unknownother = $data['unknown'] + $data['other']; |
|
92 | + foreach($data['places'] as $placename=> $dataplace){ |
|
93 | + $levels = array_map('trim',explode(',', $placename)); |
|
94 | + $content = ''; |
|
95 | + if(isset($dataplace['flag'])){ |
|
96 | + $content .= '<td class="geodispersion_flag">'. FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) .'</td><td>'; |
|
97 | + } |
|
98 | + else{ |
|
99 | + $content .= '<td><span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span><br/>'; |
|
100 | + } |
|
101 | + $count = $dataplace['count']; |
|
102 | + $content .= I18N::number($count); |
|
103 | + $perc = Functions::safeDivision($count, $sum_gen + $unknownother); |
|
104 | + $perc2= Functions::safeDivision($count, $sum_gen); |
|
105 | + if($perc2>=0.1) |
|
106 | + $content.= '<br/><span class="small">('.I18N::percentage($perc2, 1).')</span>'; |
|
107 | + $content .= '</td>'; |
|
108 | 108 | |
109 | - $html .= ' |
|
109 | + $html .= ' |
|
110 | 110 | <td class="geodispersion_rowitem" width="'.max(round(100*$perc, 0),1).'%"> |
111 | 111 | <table> |
112 | 112 | <tr> |
@@ -118,46 +118,46 @@ discard block |
||
118 | 118 | </tr> |
119 | 119 | </table> |
120 | 120 | </td>'; |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - if($unknownother>0){ |
|
124 | - $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
125 | - $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
126 | - if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
127 | - $html .='</td>'; |
|
128 | - } |
|
123 | + if($unknownother>0){ |
|
124 | + $perc= Functions::safeDivision($unknownother, $sum_gen + $unknownother); |
|
125 | + $html .='<td class="geodispersion_unknownitem left" >'.I18N::number($unknownother); |
|
126 | + if($perc>=0.1) $html.= '<br/><span class="small">('.I18N::percentage($perc, 1).')</span>'; |
|
127 | + $html .='</td>'; |
|
128 | + } |
|
129 | 129 | |
130 | - $html .= |
|
131 | - '</tr> |
|
130 | + $html .= |
|
131 | + '</tr> |
|
132 | 132 | </table>'; |
133 | - return $html; |
|
134 | - } |
|
133 | + return $html; |
|
134 | + } |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Returns the HTML code fo display a row of the Top Places found for a generation. |
138 | 138 | * |
139 | 139 | * @param array $data Data array |
140 | - * @param int $analysis_level Level of subdivision of analysis |
|
140 | + * @param int $analysis_level Level of subdivision of analysis |
|
141 | 141 | * @return string HTML code for Top Places row |
142 | 142 | */ |
143 | - protected function htmlGenerationTopPlacesRow($data, $analysis_level) { |
|
144 | - $tmp_places = array(); |
|
145 | - $sum_gen = $data['sum']; |
|
146 | - $other = $data['other']; |
|
143 | + protected function htmlGenerationTopPlacesRow($data, $analysis_level) { |
|
144 | + $tmp_places = array(); |
|
145 | + $sum_gen = $data['sum']; |
|
146 | + $other = $data['other']; |
|
147 | 147 | |
148 | - foreach($data['places'] as $placename => $count) { |
|
149 | - if($placename != 'other'){ |
|
150 | - $levels = array_map('trim',explode(',', $placename)); |
|
151 | - $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
|
152 | - } |
|
153 | - else{ |
|
154 | - $placename = I18N::translate('Other places'); |
|
155 | - } |
|
156 | - $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
|
157 | - } |
|
148 | + foreach($data['places'] as $placename => $count) { |
|
149 | + if($placename != 'other'){ |
|
150 | + $levels = array_map('trim',explode(',', $placename)); |
|
151 | + $placename = '<span title="'.implode(I18N::$list_separator, array_reverse($levels)).'">'.$levels[$analysis_level-1].'</span>'; |
|
152 | + } |
|
153 | + else{ |
|
154 | + $placename = I18N::translate('Other places'); |
|
155 | + } |
|
156 | + $tmp_places[] = I18N::translate('<strong>%s</strong> [%d - %s]', $placename, $count, I18N::percentage(Functions::safeDivision($count, $sum_gen + $other), 1)); |
|
157 | + } |
|
158 | 158 | |
159 | - return implode(I18N::$list_separator, $tmp_places); |
|
160 | - } |
|
159 | + return implode(I18N::$list_separator, $tmp_places); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | 164 | \ No newline at end of file |