@@ -218,7 +218,10 @@ |
||
218 | 218 | $missing_hidden = $this->data->get('missing_hidden'); |
219 | 219 | ?> |
220 | 220 | <?php echo I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))); ?> |
221 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
221 | + <?php if($this->data->get('missing_hidden') > 0) { |
|
222 | + echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; |
|
223 | +} |
|
224 | +?> |
|
222 | 225 | <?php echo ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)); ?> |
223 | 226 | <?php echo ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']'; ?> |
224 | 227 | </div> |
@@ -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,35 +167,35 @@ 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 = new Date(''); |
|
177 | - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
178 | - $birth_date=$person->getEstimatedBirthDate(); |
|
179 | - echo $birth_date->display(true); |
|
180 | - } else { |
|
181 | - echo ' '; |
|
182 | - } |
|
183 | - $birth_dates[0] = new Date(''); |
|
184 | - } |
|
185 | - ?> |
|
174 | + } |
|
175 | + } else { |
|
176 | + $birth_date = new Date(''); |
|
177 | + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
|
178 | + $birth_date=$person->getEstimatedBirthDate(); |
|
179 | + echo $birth_date->display(true); |
|
180 | + } else { |
|
181 | + echo ' '; |
|
182 | + } |
|
183 | + $birth_dates[0] = new Date(''); |
|
184 | + } |
|
185 | + ?> |
|
186 | 186 | </td> |
187 | 187 | <td><?php echo $birth_date->julianDay();?></td> |
188 | 188 | <td> |
189 | 189 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
190 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
191 | - if ($n) { ?><br><?php } ?> |
|
190 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
191 | + if ($n) { ?><br><?php } ?> |
|
192 | 192 | <a href="'<?php echo $tmp->getURL(); ?>" title="<?php echo strip_tags($tmp->getFullName()); ?>"> |
193 | 193 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()); ?> |
194 | 194 | </a> |
195 | 195 | <?php } ?> |
196 | 196 | </td> |
197 | 197 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
198 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
198 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
199 | 199 | <td><?php echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium'); ?></td> |
200 | 200 | <td><?php echo $isBSourced; ?></td> |
201 | 201 | <?php } else { ?> |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | <?php } else if ($this->data->get('generation', 0) > 0) { ?> |
223 | 223 | <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> |
224 | 224 | <?php } |
225 | - } else { ?> |
|
225 | + } else { ?> |
|
226 | 226 | <p class="warning"><?php echo I18N::translate('The list could not be displayed. Reasons might be:'); ?><br/> |
227 | 227 | <ul> |
228 | 228 | <li><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></li> |
@@ -233,6 +233,6 @@ discard block |
||
233 | 233 | <?php } ?> |
234 | 234 | </div> |
235 | 235 | <?php |
236 | - } |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | \ No newline at end of file |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | <div id="maj-sosa-missing-page" class="center"> |
35 | 35 | <h2><?php echo $this->data->get('title'); ?></h2> |
36 | 36 | |
37 | - <?php if($this->data->get('is_setup')) { |
|
37 | + <?php if ($this->data->get('is_setup')) { |
|
38 | 38 | $this->renderSosaHeader(); |
39 | - if($this->data->get('has_missing', false)) { |
|
39 | + if ($this->data->get('has_missing', false)) { |
|
40 | 40 | $table_id = $this->data->get('table_id'); |
41 | 41 | ?> |
42 | 42 | <div id="sosa-indi-missing" class="smissing-list"> |
43 | - <table id="<?php echo $table_id;?>"> |
|
43 | + <table id="<?php echo $table_id; ?>"> |
|
44 | 44 | <thead> |
45 | 45 | <tr> |
46 | 46 | <th colspan="16"> |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | </thead> |
109 | 109 | <tbody> |
110 | 110 | |
111 | - <?php foreach($this->data->get('missing_list') as $missing_tab) { |
|
111 | + <?php foreach ($this->data->get('missing_list') as $missing_tab) { |
|
112 | 112 | $person = $missing_tab['indi']; |
113 | 113 | |
114 | 114 | /** @var \Fisharebest\Webtrees\Individual $person */ |
@@ -126,18 +126,18 @@ discard block |
||
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=''; |
|
129 | + if ($name['type'] == 'NAME') { |
|
130 | + $title = ''; |
|
131 | 131 | } else { |
132 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
132 | + $title = 'title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
133 | 133 | } |
134 | - if ($num==$person->getPrimaryName()) { |
|
135 | - $class=' class="name2"'; |
|
136 | - $sex_image=$person->getSexImage(); |
|
137 | - list($surn, $givn)=explode(',', $name['sort']); |
|
134 | + if ($num == $person->getPrimaryName()) { |
|
135 | + $class = ' class="name2"'; |
|
136 | + $sex_image = $person->getSexImage(); |
|
137 | + list($surn, $givn) = explode(',', $name['sort']); |
|
138 | 138 | } else { |
139 | - $class=''; |
|
140 | - $sex_image=''; |
|
139 | + $class = ''; |
|
140 | + $sex_image = ''; |
|
141 | 141 | } ?> |
142 | 142 | <a <?php echo $title.' '.$class; ?> href="<?php echo $person->getHtmlUrl(); ?>"> |
143 | 143 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | </td> |
151 | 151 | <td style="display:none;"></td> |
152 | 152 | <td> |
153 | - <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
153 | + <?php echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)).'AAAA'.Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)); ?> |
|
154 | 154 | </td> |
155 | 155 | <td> |
156 | - <?php echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)); ?> |
|
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 | 159 | $isISourced = $dperson->isSourced(); ?> |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | <td> </td> |
164 | 164 | <td></td> |
165 | 165 | <?php } ?> |
166 | - <td><?php echo $missing_tab['has_father'] ? ' ' : 'X';?></td> |
|
167 | - <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X';?></td> |
|
166 | + <td><?php echo $missing_tab['has_father'] ? ' ' : 'X'; ?></td> |
|
167 | + <td><?php echo $missing_tab['has_mother'] ? ' ' : 'X'; ?></td> |
|
168 | 168 | <td> |
169 | 169 | <?php |
170 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
170 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
171 | 171 | foreach ($birth_dates as $num=>$birth_date) { |
172 | 172 | if ($num) { ?><br/><?php } ?> |
173 | 173 | <?php echo $birth_date->display(true); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } else { |
176 | 176 | $birth_date = new Date(''); |
177 | 177 | if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) { |
178 | - $birth_date=$person->getEstimatedBirthDate(); |
|
178 | + $birth_date = $person->getEstimatedBirthDate(); |
|
179 | 179 | echo $birth_date->display(true); |
180 | 180 | } else { |
181 | 181 | echo ' '; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | ?> |
186 | 186 | </td> |
187 | - <td><?php echo $birth_date->julianDay();?></td> |
|
187 | + <td><?php echo $birth_date->julianDay(); ?></td> |
|
188 | 188 | <td> |
189 | 189 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
190 | 190 | $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | <td class="ui-state-default" colspan="16"> |
212 | 212 | <div class="center"> |
213 | 213 | <?php echo I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count'))); ?> |
214 | - <?php if($this->data->get('missing_hidden') > 0) echo ' ['. I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
215 | - <?php echo ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)); ?> |
|
216 | - <?php echo ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'),2)).']'; ?> |
|
214 | + <?php if ($this->data->get('missing_hidden') > 0) echo ' ['.I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))).']'; ?> |
|
215 | + <?php echo ' - '.I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2)); ?> |
|
216 | + <?php echo ' ['.I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'), 2)).']'; ?> |
|
217 | 217 | </div> |
218 | 218 | </td> |
219 | 219 | </tr> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $view_bag->set('title', $controller->getPageTitle()); |
65 | 65 | $view_bag->set('is_setup', false); |
66 | 66 | |
67 | - if($this->sosa_provider->isSetup()) { |
|
67 | + if ($this->sosa_provider->isSetup()) { |
|
68 | 68 | $view_bag->set('is_setup', true); |
69 | 69 | |
70 | 70 | $sosaCount = $this->sosa_provider->getSosaCount(); |
@@ -82,23 +82,23 @@ discard block |
||
82 | 82 | $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); |
83 | 83 | $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
84 | 84 | |
85 | - $gen_theoretical=1; |
|
86 | - $total_theoretical=0; |
|
87 | - $prev_diff=0; |
|
88 | - $prev_known=0.5; |
|
89 | - $gen_equiv=0; |
|
85 | + $gen_theoretical = 1; |
|
86 | + $total_theoretical = 0; |
|
87 | + $prev_diff = 0; |
|
88 | + $prev_known = 0.5; |
|
89 | + $gen_equiv = 0; |
|
90 | 90 | $generation_stats = array(); |
91 | 91 | |
92 | - foreach($stats_gen as $gen => $tab){ |
|
93 | - $genY1= I18N::translate('-'); |
|
94 | - $genY2= I18N::translate('-'); |
|
95 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
96 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
92 | + foreach ($stats_gen as $gen => $tab) { |
|
93 | + $genY1 = I18N::translate('-'); |
|
94 | + $genY2 = I18N::translate('-'); |
|
95 | + if ($tab['firstBirth'] > 0) $genY1 = $tab['firstBirth']; |
|
96 | + if ($tab['lastBirth'] > 0) $genY2 = $tab['lastBirth']; |
|
97 | 97 | $total_theoretical += $gen_theoretical; |
98 | 98 | $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
99 | 99 | $gen_equiv += $perc_sosa_count_theor; |
100 | - $missing=2*$prev_known - $tab['sosaCount']; |
|
101 | - $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
100 | + $missing = 2 * $prev_known - $tab['sosaCount']; |
|
101 | + $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff; |
|
102 | 102 | |
103 | 103 | $generation_stats[$gen] = array( |
104 | 104 | 'gen_min_birth' => $genY1, |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'known' => $tab['sosaCount'], |
108 | 108 | 'perc_known' => $perc_sosa_count_theor, |
109 | 109 | 'missing' => $missing, |
110 | - 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
110 | + 'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known), |
|
111 | 111 | 'total_known' => $tab['sosaTotalCount'], |
112 | 112 | 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
113 | 113 | 'different' => $gen_diff, |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | ); |
118 | 118 | |
119 | 119 | $gen_theoretical = $gen_theoretical * 2; |
120 | - $prev_known=$tab['sosaCount']; |
|
121 | - $prev_diff=$tab['diffSosaTotalCount']; |
|
120 | + $prev_known = $tab['sosaCount']; |
|
121 | + $prev_diff = $tab['diffSosaTotalCount']; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $view_bag->set('generation_stats', $generation_stats); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | private function htmlAncestorDispersionG2() |
140 | 140 | { |
141 | 141 | $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
142 | - if(count($ancestorsDispGen2) == 0) return; |
|
142 | + if (count($ancestorsDispGen2) == 0) return; |
|
143 | 143 | |
144 | 144 | $size = '600x300'; |
145 | 145 | $sizes = explode('x', $size); |
@@ -150,21 +150,21 @@ discard block |
||
150 | 150 | |
151 | 151 | $total = array_sum($ancestorsDispGen2); |
152 | 152 | $father_count = isset($ancestorsDispGen2[1]) ? $ancestorsDispGen2[1] : 0; |
153 | - $father = array ( |
|
153 | + $father = array( |
|
154 | 154 | 'color' => '84beff', |
155 | 155 | 'count' => $father_count, |
156 | 156 | 'perc' => Functions::safeDivision($father_count, $total), |
157 | 157 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
158 | 158 | ); |
159 | 159 | $mother_count = isset($ancestorsDispGen2[2]) ? $ancestorsDispGen2[2] : 0; |
160 | - $mother = array ( |
|
160 | + $mother = array( |
|
161 | 161 | 'color' => 'ffd1dc', |
162 | 162 | 'count' => $mother_count, |
163 | 163 | 'perc' => Functions::safeDivision($mother_count, $total), |
164 | 164 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
165 | 165 | ); |
166 | 166 | $shared_count = isset($ancestorsDispGen2[-1]) ? $ancestorsDispGen2[-1] : 0; |
167 | - $shared = array ( |
|
167 | + $shared = array( |
|
168 | 168 | 'color' => '777777', |
169 | 169 | 'count' => $shared_count, |
170 | 170 | 'perc' => Functions::safeDivision($shared_count, $total), |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
175 | 175 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
176 | 176 | $chl = |
177 | - $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
178 | - $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
179 | - $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
180 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
177 | + $father['name'].' - '.I18N::percentage($father['perc'], 1).'|'. |
|
178 | + $shared['name'].' - '.I18N::percentage($shared['perc'], 1).'|'. |
|
179 | + $mother['name'].' - '.I18N::percentage($mother['perc'], 1); |
|
180 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />"; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $total_motfat = $ancestorsDispGen2[4] ?: 0; |
202 | 202 | $total_motmot = $ancestorsDispGen2[8] ?: 0; |
203 | 203 | $total_sha = $ancestorsDispGen2[-1] ?: 0; |
204 | - $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
204 | + $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha; |
|
205 | 205 | |
206 | 206 | $chd = $this->arrayToExtendedEncoding(array( |
207 | 207 | 4095 * $total_fatfat / $total, |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | )); |
213 | 213 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
214 | 214 | $chl = |
215 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
216 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
217 | - I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
218 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
219 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
220 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
215 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat').' - '.I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1).'|'. |
|
216 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot').' - '.I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1).'|'. |
|
217 | + I18N::translate('Shared').' - '.I18N::percentage(Functions::safeDivision($total_sha, $total), 1).'|'. |
|
218 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat').' - '.I18N::percentage(Functions::safeDivision($total_motfat, $total), 1).'|'. |
|
219 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot').' - '.I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
220 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"".$chart_title."\" title=\"".$chart_title."\" />"; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | if ($value < 0) { |
234 | 234 | $value = 0; |
235 | 235 | } |
236 | - $first = (int) ($value / 64); |
|
236 | + $first = (int)($value / 64); |
|
237 | 237 | $second = $value % 64; |
238 | - $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
238 | + $encoding .= $xencoding[(int)$first].$xencoding[(int)$second]; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | return $encoding; |
@@ -92,8 +92,12 @@ discard block |
||
92 | 92 | foreach($stats_gen as $gen => $tab){ |
93 | 93 | $genY1= I18N::translate('-'); |
94 | 94 | $genY2= I18N::translate('-'); |
95 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
96 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
95 | + if($tab['firstBirth']>0) { |
|
96 | + $genY1=$tab['firstBirth']; |
|
97 | + } |
|
98 | + if($tab['lastBirth']>0) { |
|
99 | + $genY2=$tab['lastBirth']; |
|
100 | + } |
|
97 | 101 | $total_theoretical += $gen_theoretical; |
98 | 102 | $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
99 | 103 | $gen_equiv += $perc_sosa_count_theor; |
@@ -139,7 +143,9 @@ discard block |
||
139 | 143 | private function htmlAncestorDispersionG2() |
140 | 144 | { |
141 | 145 | $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
142 | - if(count($ancestorsDispGen2) == 0) return; |
|
146 | + if(count($ancestorsDispGen2) == 0) { |
|
147 | + return; |
|
148 | + } |
|
143 | 149 | |
144 | 150 | $size = '600x300'; |
145 | 151 | $sizes = explode('x', $size); |
@@ -219,7 +219,7 @@ |
||
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Convert an array to Google Chart encoding |
222 | - * @param arrat $a Array to encode |
|
222 | + * @param integer[] $a Array to encode |
|
223 | 223 | * @return string |
224 | 224 | */ |
225 | 225 | private function arrayToExtendedEncoding($a) { |
@@ -25,218 +25,218 @@ |
||
25 | 25 | */ |
26 | 26 | class SosaStatsController extends MvcController |
27 | 27 | { |
28 | - /** |
|
29 | - * Sosa Provider for the controller |
|
30 | - * @var SosaProvider $sosa_provider |
|
31 | - */ |
|
32 | - protected $sosa_provider; |
|
28 | + /** |
|
29 | + * Sosa Provider for the controller |
|
30 | + * @var SosaProvider $sosa_provider |
|
31 | + */ |
|
32 | + protected $sosa_provider; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Constructor for SosaStatsController |
|
36 | - * @param AbstractModule $module |
|
37 | - */ |
|
38 | - public function __construct(AbstractModule $module) { |
|
39 | - global $WT_TREE; |
|
34 | + /** |
|
35 | + * Constructor for SosaStatsController |
|
36 | + * @param AbstractModule $module |
|
37 | + */ |
|
38 | + public function __construct(AbstractModule $module) { |
|
39 | + global $WT_TREE; |
|
40 | 40 | |
41 | - parent::__construct($module); |
|
41 | + parent::__construct($module); |
|
42 | 42 | |
43 | - $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
44 | - } |
|
43 | + $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Pages |
|
48 | - */ |
|
46 | + /** |
|
47 | + * Pages |
|
48 | + */ |
|
49 | 49 | |
50 | - /** |
|
51 | - * SosaStats@index |
|
52 | - */ |
|
53 | - public function index() { |
|
54 | - global $WT_TREE; |
|
50 | + /** |
|
51 | + * SosaStats@index |
|
52 | + */ |
|
53 | + public function index() { |
|
54 | + global $WT_TREE; |
|
55 | 55 | |
56 | - $controller = new PageController(); |
|
57 | - $controller |
|
58 | - ->setPageTitle(I18N::translate('Sosa Statistics')) |
|
59 | - ->addInlineJavascript('$(".help_tooltip").tooltip();') |
|
60 | - ; |
|
56 | + $controller = new PageController(); |
|
57 | + $controller |
|
58 | + ->setPageTitle(I18N::translate('Sosa Statistics')) |
|
59 | + ->addInlineJavascript('$(".help_tooltip").tooltip();') |
|
60 | + ; |
|
61 | 61 | |
62 | - $view_bag = new ViewBag(); |
|
63 | - $view_bag->set('title', $controller->getPageTitle()); |
|
64 | - $view_bag->set('is_setup', false); |
|
62 | + $view_bag = new ViewBag(); |
|
63 | + $view_bag->set('title', $controller->getPageTitle()); |
|
64 | + $view_bag->set('is_setup', false); |
|
65 | 65 | |
66 | - if($this->sosa_provider->isSetup()) { |
|
67 | - $view_bag->set('is_setup', true); |
|
66 | + if($this->sosa_provider->isSetup()) { |
|
67 | + $view_bag->set('is_setup', true); |
|
68 | 68 | |
69 | - $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); |
|
69 | + $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); |
|
70 | 70 | |
71 | - $sosaCount = $this->sosa_provider->getSosaCount(); |
|
72 | - $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); |
|
71 | + $sosaCount = $this->sosa_provider->getSosaCount(); |
|
72 | + $diffSosaCount = $this->sosa_provider->getDifferentSosaCount(); |
|
73 | 73 | |
74 | - $general_stats = array( |
|
75 | - 'sosa_count' => $sosaCount, |
|
76 | - 'distinct_count' => $diffSosaCount, |
|
77 | - 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), |
|
78 | - 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), |
|
79 | - 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime() |
|
80 | - ); |
|
81 | - $view_bag->set('general_stats', $general_stats); |
|
74 | + $general_stats = array( |
|
75 | + 'sosa_count' => $sosaCount, |
|
76 | + 'distinct_count' => $diffSosaCount, |
|
77 | + 'sosa_rate' => Functions::safeDivision($diffSosaCount, $this->sosa_provider->getTotalIndividuals()), |
|
78 | + 'pedi_collapse' => 1 - Functions::safeDivision($diffSosaCount, $sosaCount), |
|
79 | + 'mean_gen_time' => $this->sosa_provider->getMeanGenerationTime() |
|
80 | + ); |
|
81 | + $view_bag->set('general_stats', $general_stats); |
|
82 | 82 | |
83 | - $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); |
|
84 | - $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
85 | - $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
83 | + $stats_gen = $this->sosa_provider->getStatisticsByGeneration(); |
|
84 | + $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
85 | + $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$WT_TREE->getNameUrl().'&gen='); |
|
86 | 86 | |
87 | - $gen_theoretical=1; |
|
88 | - $total_theoretical=0; |
|
89 | - $prev_diff=0; |
|
90 | - $prev_known=0.5; |
|
91 | - $gen_equiv=0; |
|
92 | - $generation_stats = array(); |
|
87 | + $gen_theoretical=1; |
|
88 | + $total_theoretical=0; |
|
89 | + $prev_diff=0; |
|
90 | + $prev_known=0.5; |
|
91 | + $gen_equiv=0; |
|
92 | + $generation_stats = array(); |
|
93 | 93 | |
94 | - foreach($stats_gen as $gen => $tab){ |
|
95 | - $genY1= I18N::translate('-'); |
|
96 | - $genY2= I18N::translate('-'); |
|
97 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
98 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
99 | - $total_theoretical += $gen_theoretical; |
|
100 | - $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
|
101 | - $gen_equiv += $perc_sosa_count_theor; |
|
102 | - $missing=2*$prev_known - $tab['sosaCount']; |
|
103 | - $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
94 | + foreach($stats_gen as $gen => $tab){ |
|
95 | + $genY1= I18N::translate('-'); |
|
96 | + $genY2= I18N::translate('-'); |
|
97 | + if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
98 | + if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
99 | + $total_theoretical += $gen_theoretical; |
|
100 | + $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
|
101 | + $gen_equiv += $perc_sosa_count_theor; |
|
102 | + $missing=2*$prev_known - $tab['sosaCount']; |
|
103 | + $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
104 | 104 | |
105 | - $generation_stats[$gen] = array( |
|
106 | - 'gen_min_birth' => $genY1, |
|
107 | - 'gen_max_birth' => $genY2, |
|
108 | - 'theoretical' => $gen_theoretical, |
|
109 | - 'known' => $tab['sosaCount'], |
|
110 | - 'perc_known' => $perc_sosa_count_theor, |
|
111 | - 'missing' => $missing, |
|
112 | - 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
113 | - 'total_known' => $tab['sosaTotalCount'], |
|
114 | - 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
|
115 | - 'different' => $gen_diff, |
|
116 | - 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), |
|
117 | - 'total_different' => $tab['diffSosaTotalCount'], |
|
118 | - 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount']) |
|
119 | - ); |
|
105 | + $generation_stats[$gen] = array( |
|
106 | + 'gen_min_birth' => $genY1, |
|
107 | + 'gen_max_birth' => $genY2, |
|
108 | + 'theoretical' => $gen_theoretical, |
|
109 | + 'known' => $tab['sosaCount'], |
|
110 | + 'perc_known' => $perc_sosa_count_theor, |
|
111 | + 'missing' => $missing, |
|
112 | + 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
113 | + 'total_known' => $tab['sosaTotalCount'], |
|
114 | + 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
|
115 | + 'different' => $gen_diff, |
|
116 | + 'perc_different' => Functions::safeDivision($gen_diff, $tab['sosaCount']), |
|
117 | + 'total_different' => $tab['diffSosaTotalCount'], |
|
118 | + 'pedi_collapse' => 1 - Functions::safeDivision($tab['diffSosaTotalCount'], $tab['sosaTotalCount']) |
|
119 | + ); |
|
120 | 120 | |
121 | - $gen_theoretical = $gen_theoretical * 2; |
|
122 | - $prev_known=$tab['sosaCount']; |
|
123 | - $prev_diff=$tab['diffSosaTotalCount']; |
|
124 | - } |
|
121 | + $gen_theoretical = $gen_theoretical * 2; |
|
122 | + $prev_known=$tab['sosaCount']; |
|
123 | + $prev_diff=$tab['diffSosaTotalCount']; |
|
124 | + } |
|
125 | 125 | |
126 | - $view_bag->set('generation_stats', $generation_stats); |
|
127 | - $view_bag->set('equivalent_gen', $gen_equiv); |
|
126 | + $view_bag->set('generation_stats', $generation_stats); |
|
127 | + $view_bag->set('equivalent_gen', $gen_equiv); |
|
128 | 128 | |
129 | - $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); |
|
130 | - $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); |
|
129 | + $view_bag->set('chart_img_g2', $this->htmlAncestorDispersionG2()); |
|
130 | + $view_bag->set('chart_img_g3', $this->htmlAncestorDispersionG3()); |
|
131 | 131 | |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); |
|
135 | - } |
|
134 | + ViewFactory::make('SosaStats', $this, $controller, $view_bag)->render(); |
|
135 | + } |
|
136 | 136 | |
137 | - /** |
|
138 | - * Returns HTML code for a graph showing the dispersion of ancestors across father & mother |
|
139 | - * @return string HTML code |
|
140 | - */ |
|
141 | - private function htmlAncestorDispersionG2() |
|
142 | - { |
|
143 | - $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
|
144 | - if(count($ancestorsDispGen2) == 0) return; |
|
137 | + /** |
|
138 | + * Returns HTML code for a graph showing the dispersion of ancestors across father & mother |
|
139 | + * @return string HTML code |
|
140 | + */ |
|
141 | + private function htmlAncestorDispersionG2() |
|
142 | + { |
|
143 | + $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
|
144 | + if(count($ancestorsDispGen2) == 0) return; |
|
145 | 145 | |
146 | - $size = '600x300'; |
|
146 | + $size = '600x300'; |
|
147 | 147 | |
148 | - $total = array_sum($ancestorsDispGen2); |
|
149 | - $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
|
150 | - $father = array ( |
|
151 | - 'color' => '84beff', |
|
152 | - 'count' => $father_count, |
|
153 | - 'perc' => Functions::safeDivision($father_count, $total), |
|
154 | - 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
|
155 | - ); |
|
156 | - $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
|
157 | - $mother = array ( |
|
158 | - 'color' => 'ffd1dc', |
|
159 | - 'count' => $mother_count, |
|
160 | - 'perc' => Functions::safeDivision($mother_count, $total), |
|
161 | - 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
|
162 | - ); |
|
163 | - $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
|
164 | - $shared = array ( |
|
165 | - 'color' => '777777', |
|
166 | - 'count' => $shared_count, |
|
167 | - 'perc' => Functions::safeDivision($shared_count, $total), |
|
168 | - 'name' => I18N::translate('Shared') |
|
169 | - ); |
|
148 | + $total = array_sum($ancestorsDispGen2); |
|
149 | + $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
|
150 | + $father = array ( |
|
151 | + 'color' => '84beff', |
|
152 | + 'count' => $father_count, |
|
153 | + 'perc' => Functions::safeDivision($father_count, $total), |
|
154 | + 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
|
155 | + ); |
|
156 | + $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
|
157 | + $mother = array ( |
|
158 | + 'color' => 'ffd1dc', |
|
159 | + 'count' => $mother_count, |
|
160 | + 'perc' => Functions::safeDivision($mother_count, $total), |
|
161 | + 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
|
162 | + ); |
|
163 | + $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
|
164 | + $shared = array ( |
|
165 | + 'color' => '777777', |
|
166 | + 'count' => $shared_count, |
|
167 | + 'perc' => Functions::safeDivision($shared_count, $total), |
|
168 | + 'name' => I18N::translate('Shared') |
|
169 | + ); |
|
170 | 170 | |
171 | - $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
|
172 | - $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
|
173 | - $chl = |
|
174 | - $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
175 | - $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
176 | - $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
177 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
178 | - } |
|
171 | + $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
|
172 | + $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
|
173 | + $chl = |
|
174 | + $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
175 | + $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
176 | + $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
177 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$father['color']},{$shared['color']},{$mother['color']}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents |
|
182 | - * @return string HTML code |
|
183 | - */ |
|
184 | - private function htmlAncestorDispersionG3() |
|
185 | - { |
|
186 | - $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3); |
|
180 | + /** |
|
181 | + * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents |
|
182 | + * @return string HTML code |
|
183 | + */ |
|
184 | + private function htmlAncestorDispersionG3() |
|
185 | + { |
|
186 | + $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3); |
|
187 | 187 | |
188 | - $size = '700x300'; |
|
188 | + $size = '700x300'; |
|
189 | 189 | |
190 | - $color_motmot = 'ffd1dc'; |
|
191 | - $color_motfat = 'b998a0'; |
|
192 | - $color_fatfat = '577292'; |
|
193 | - $color_fatmot = '84beff'; |
|
194 | - $color_shared = '777777'; |
|
190 | + $color_motmot = 'ffd1dc'; |
|
191 | + $color_motfat = 'b998a0'; |
|
192 | + $color_fatfat = '577292'; |
|
193 | + $color_fatmot = '84beff'; |
|
194 | + $color_shared = '777777'; |
|
195 | 195 | |
196 | - $total_fatfat = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
|
197 | - $total_fatmot = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
|
198 | - $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0; |
|
199 | - $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0; |
|
200 | - $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
|
201 | - $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
196 | + $total_fatfat = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
|
197 | + $total_fatmot = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
|
198 | + $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0; |
|
199 | + $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0; |
|
200 | + $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
|
201 | + $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
202 | 202 | |
203 | - $chd = $this->arrayToExtendedEncoding(array( |
|
204 | - 4095 * Functions::safeDivision($total_fatfat, $total), |
|
205 | - 4095 * Functions::safeDivision($total_fatmot, $total), |
|
206 | - 4095 * Functions::safeDivision($total_sha, $total), |
|
207 | - 4095 * Functions::safeDivision($total_motfat, $total), |
|
208 | - 4095 * Functions::safeDivision($total_motmot, $total) |
|
209 | - )); |
|
210 | - $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
|
211 | - $chl = |
|
212 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
213 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
214 | - I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
215 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
216 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
217 | - return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
218 | - } |
|
203 | + $chd = $this->arrayToExtendedEncoding(array( |
|
204 | + 4095 * Functions::safeDivision($total_fatfat, $total), |
|
205 | + 4095 * Functions::safeDivision($total_fatmot, $total), |
|
206 | + 4095 * Functions::safeDivision($total_sha, $total), |
|
207 | + 4095 * Functions::safeDivision($total_motfat, $total), |
|
208 | + 4095 * Functions::safeDivision($total_motmot, $total) |
|
209 | + )); |
|
210 | + $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
|
211 | + $chl = |
|
212 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
213 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
214 | + I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
215 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
216 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
217 | + return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />"; |
|
218 | + } |
|
219 | 219 | |
220 | - /** |
|
221 | - * Convert an array to Google Chart encoding |
|
222 | - * @param arrat $a Array to encode |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - private function arrayToExtendedEncoding($a) { |
|
226 | - $xencoding = WT_GOOGLE_CHART_ENCODING; |
|
220 | + /** |
|
221 | + * Convert an array to Google Chart encoding |
|
222 | + * @param arrat $a Array to encode |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + private function arrayToExtendedEncoding($a) { |
|
226 | + $xencoding = WT_GOOGLE_CHART_ENCODING; |
|
227 | 227 | |
228 | - $encoding = ''; |
|
229 | - foreach ($a as $value) { |
|
230 | - if ($value < 0) { |
|
231 | - $value = 0; |
|
232 | - } |
|
233 | - $first = (int) ($value / 64); |
|
234 | - $second = $value % 64; |
|
235 | - $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
236 | - } |
|
228 | + $encoding = ''; |
|
229 | + foreach ($a as $value) { |
|
230 | + if ($value < 0) { |
|
231 | + $value = 0; |
|
232 | + } |
|
233 | + $first = (int) ($value / 64); |
|
234 | + $second = $value % 64; |
|
235 | + $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
236 | + } |
|
237 | 237 | |
238 | - return $encoding; |
|
239 | - } |
|
238 | + return $encoding; |
|
239 | + } |
|
240 | 240 | |
241 | 241 | |
242 | 242 | } |
243 | 243 | \ No newline at end of file |
@@ -37,12 +37,12 @@ |
||
37 | 37 | * @param Place $place |
38 | 38 | */ |
39 | 39 | public function addPlace(Place $place) { |
40 | - if(!is_null($place) && !$place->isEmpty()){ |
|
40 | + if (!is_null($place) && !$place->isEmpty()) { |
|
41 | 41 | $place_name = $place->getFullName(); |
42 | - if(isset($this->places[$place_name])){ |
|
43 | - $this->places[$place_name]+=1; |
|
42 | + if (isset($this->places[$place_name])) { |
|
43 | + $this->places[$place_name] += 1; |
|
44 | 44 | } |
45 | - else{ |
|
45 | + else { |
|
46 | 46 | $this->places[$place_name] = 1; |
47 | 47 | } |
48 | 48 | } |
@@ -77,8 +77,7 @@ |
||
77 | 77 | $index = str_replace('%', '', $match2); |
78 | 78 | if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
79 | 79 | $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
80 | - } |
|
81 | - else{ |
|
80 | + } else{ |
|
82 | 81 | $displayPlace = str_replace($match2, '' , $displayPlace); |
83 | 82 | } |
84 | 83 | } |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
56 | 56 | break; |
57 | 57 | } |
58 | - } |
|
59 | - else if ($this->data->get('islineages', false)) { |
|
58 | + } else if ($this->data->get('islineages', false)) { |
|
60 | 59 | //Link to indilist |
61 | 60 | echo '<p class="center"><strong>'. |
62 | 61 | '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
@@ -81,7 +80,9 @@ discard block |
||
81 | 80 | |
82 | 81 | foreach($lineages as $i => $lineage) { |
83 | 82 | $this->printRootLineage($lineage); |
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
83 | + if($i < $nb_lineages - 1) { |
|
84 | + echo '<hr />'; |
|
85 | + } |
|
85 | 86 | } |
86 | 87 | |
87 | 88 | echo '</div>'; |
@@ -156,8 +157,7 @@ discard block |
||
156 | 157 | } |
157 | 158 | } |
158 | 159 | } |
159 | - } |
|
160 | - else { |
|
160 | + } else { |
|
161 | 161 | $this->printLineage($node); |
162 | 162 | } |
163 | 163 | echo '</div>'; |
@@ -185,8 +185,7 @@ discard block |
||
185 | 185 | echo '<li>'; |
186 | 186 | if($is_first_family){ |
187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
188 | - } |
|
189 | - else{ |
|
188 | + } else{ |
|
190 | 189 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 190 | } |
192 | 191 | //Get individual's spouse |
@@ -207,15 +206,13 @@ discard block |
||
207 | 206 | foreach($fam_nodes[$fam] as $child_node) { |
208 | 207 | if($child_node) { |
209 | 208 | $this->printLineage($child_node); |
210 | - } |
|
211 | - else { |
|
209 | + } else { |
|
212 | 210 | echo '<ul><li><strong>…</strong></li></ul>'; |
213 | 211 | } |
214 | 212 | } |
215 | 213 | $is_first_family = false; |
216 | 214 | } |
217 | - } |
|
218 | - else { |
|
215 | + } else { |
|
219 | 216 | echo '<li>'; |
220 | 217 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
221 | 218 | if($node->hasFollowUpSurname()) { |
@@ -31,161 +31,161 @@ discard block |
||
31 | 31 | * {@inhericDoc} |
32 | 32 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
33 | 33 | */ |
34 | - protected function renderContent() { |
|
34 | + protected function renderContent() { |
|
35 | 35 | |
36 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
37 | - $tree = $this->data->get('tree'); |
|
36 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
37 | + $tree = $this->data->get('tree'); |
|
38 | 38 | |
39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
40 | - echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
39 | + echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
40 | + echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
41 | 41 | |
42 | - if($this->data->get('issurnames', false)) { |
|
43 | - $surns = $this->data->get('surnameslist', array()); |
|
44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | - // Show the surname list |
|
46 | - switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
47 | - case 'style1': |
|
42 | + if($this->data->get('issurnames', false)) { |
|
43 | + $surns = $this->data->get('surnameslist', array()); |
|
44 | + $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | + // Show the surname list |
|
46 | + switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
47 | + case 'style1': |
|
48 | 48 | echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params); |
49 | 49 | break; |
50 | - case 'style3': |
|
51 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
52 | - break; |
|
53 | - case 'style2': |
|
54 | - default: |
|
55 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
56 | - break; |
|
57 | - } |
|
58 | - } |
|
59 | - else if ($this->data->get('islineages', false)) { |
|
60 | - //Link to indilist |
|
61 | - echo '<p class="center"><strong>'. |
|
62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
63 | - I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
64 | - '</a></strong></p>'; |
|
50 | + case 'style3': |
|
51 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
52 | + break; |
|
53 | + case 'style2': |
|
54 | + default: |
|
55 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
56 | + break; |
|
57 | + } |
|
58 | + } |
|
59 | + else if ($this->data->get('islineages', false)) { |
|
60 | + //Link to indilist |
|
61 | + echo '<p class="center"><strong>'. |
|
62 | + '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
63 | + I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
64 | + '</a></strong></p>'; |
|
65 | 65 | |
66 | - $lineages = $this->data->get('lineages', null); |
|
67 | - $nb_lineages = count($lineages); |
|
68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
69 | - echo '<p class="center"><span class="warning">', |
|
70 | - I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
72 | - '</span></p>'; |
|
73 | - } else { |
|
66 | + $lineages = $this->data->get('lineages', null); |
|
67 | + $nb_lineages = count($lineages); |
|
68 | + if(is_null($lineages) || $nb_lineages == 0) { |
|
69 | + echo '<p class="center"><span class="warning">', |
|
70 | + I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
71 | + '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
72 | + '</span></p>'; |
|
73 | + } else { |
|
74 | 74 | |
75 | - echo '<div id="patronymiclineages">'. |
|
76 | - '<div class="list_label">', |
|
77 | - $this->data->get('table_title'), |
|
78 | - '</div>'; |
|
75 | + echo '<div id="patronymiclineages">'. |
|
76 | + '<div class="list_label">', |
|
77 | + $this->data->get('table_title'), |
|
78 | + '</div>'; |
|
79 | 79 | |
80 | - echo '<div class="list_value_wrap">'; |
|
80 | + echo '<div class="list_value_wrap">'; |
|
81 | 81 | |
82 | - foreach($lineages as $i => $lineage) { |
|
83 | - $this->printRootLineage($lineage); |
|
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | - } |
|
82 | + foreach($lineages as $i => $lineage) { |
|
83 | + $this->printRootLineage($lineage); |
|
84 | + if($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | + } |
|
86 | 86 | |
87 | - echo '</div>'; |
|
87 | + echo '</div>'; |
|
88 | 88 | |
89 | - echo '<div class="list_label">', |
|
90 | - I18N::translate('%s lineages found', $nb_lineages), |
|
91 | - '</div>'. |
|
92 | - '</div>'; |
|
89 | + echo '<div class="list_label">', |
|
90 | + I18N::translate('%s lineages found', $nb_lineages), |
|
91 | + '</div>'. |
|
92 | + '</div>'; |
|
93 | 93 | |
94 | - } |
|
95 | - } |
|
96 | - } |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Get the list of initial letters |
|
100 | - * |
|
101 | - * @return string[] |
|
102 | - */ |
|
103 | - private function getInitialLettersList() { |
|
104 | - $list = array(); |
|
105 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
106 | - $tree = $this->data->get('tree'); |
|
98 | + /** |
|
99 | + * Get the list of initial letters |
|
100 | + * |
|
101 | + * @return string[] |
|
102 | + */ |
|
103 | + private function getInitialLettersList() { |
|
104 | + $list = array(); |
|
105 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
106 | + $tree = $this->data->get('tree'); |
|
107 | 107 | $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
108 | 108 | |
109 | - foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
110 | - switch ($letter) { |
|
111 | - case '@': |
|
112 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
113 | - break; |
|
114 | - case ',': |
|
115 | - $html = I18N::translate('None'); |
|
116 | - break; |
|
117 | - default: |
|
118 | - $html = Filter::escapeHtml($letter); |
|
119 | - break; |
|
120 | - } |
|
121 | - if ($count) { |
|
122 | - if ($letter == $this->data->get('alpha')) { |
|
123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
124 | - } else { |
|
125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
126 | - } |
|
127 | - } else { |
|
128 | - $list[] = $html; |
|
129 | - } |
|
130 | - } |
|
109 | + foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
110 | + switch ($letter) { |
|
111 | + case '@': |
|
112 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
113 | + break; |
|
114 | + case ',': |
|
115 | + $html = I18N::translate('None'); |
|
116 | + break; |
|
117 | + default: |
|
118 | + $html = Filter::escapeHtml($letter); |
|
119 | + break; |
|
120 | + } |
|
121 | + if ($count) { |
|
122 | + if ($letter == $this->data->get('alpha')) { |
|
123 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
124 | + } else { |
|
125 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
126 | + } |
|
127 | + } else { |
|
128 | + $list[] = $html; |
|
129 | + } |
|
130 | + } |
|
131 | 131 | |
132 | - // Search spiders don't get the "show all" option as the other links give them everything. |
|
133 | - if (!Auth::isSearchEngine()) { |
|
134 | - if ($this->data->get('show_all') === 'yes') { |
|
135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
136 | - } else { |
|
137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
138 | - } |
|
139 | - } |
|
132 | + // Search spiders don't get the "show all" option as the other links give them everything. |
|
133 | + if (!Auth::isSearchEngine()) { |
|
134 | + if ($this->data->get('show_all') === 'yes') { |
|
135 | + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
136 | + } else { |
|
137 | + $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | - return $list; |
|
142 | - } |
|
141 | + return $list; |
|
142 | + } |
|
143 | 143 | |
144 | - /** |
|
145 | - * Print a root lineage node |
|
146 | - * @param LineageRootNode $node |
|
147 | - */ |
|
148 | - private function printRootLineage(LineageRootNode $node) { |
|
149 | - print '<div class="patrolin_tree">'; |
|
150 | - if($node->getIndividual() === null) { |
|
151 | - $fam_nodes = $node->getFamiliesNodes(); |
|
152 | - foreach($fam_nodes as $fam){ |
|
153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
154 | - if($child_node) { |
|
155 | - $this->printLineage($child_node); |
|
156 | - } |
|
157 | - } |
|
158 | - } |
|
159 | - } |
|
160 | - else { |
|
161 | - $this->printLineage($node); |
|
162 | - } |
|
163 | - echo '</div>'; |
|
144 | + /** |
|
145 | + * Print a root lineage node |
|
146 | + * @param LineageRootNode $node |
|
147 | + */ |
|
148 | + private function printRootLineage(LineageRootNode $node) { |
|
149 | + print '<div class="patrolin_tree">'; |
|
150 | + if($node->getIndividual() === null) { |
|
151 | + $fam_nodes = $node->getFamiliesNodes(); |
|
152 | + foreach($fam_nodes as $fam){ |
|
153 | + foreach($fam_nodes[$fam] as $child_node) { |
|
154 | + if($child_node) { |
|
155 | + $this->printLineage($child_node); |
|
156 | + } |
|
157 | + } |
|
158 | + } |
|
159 | + } |
|
160 | + else { |
|
161 | + $this->printLineage($node); |
|
162 | + } |
|
163 | + echo '</div>'; |
|
164 | 164 | |
165 | - $places = $node->getPlaces(); |
|
166 | - if($places && count($places)>0){ |
|
167 | - echo '<div class="patrolin_places">'; |
|
168 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
169 | - echo '</div>'; |
|
170 | - } |
|
171 | - } |
|
165 | + $places = $node->getPlaces(); |
|
166 | + if($places && count($places)>0){ |
|
167 | + echo '<div class="patrolin_places">'; |
|
168 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
169 | + echo '</div>'; |
|
170 | + } |
|
171 | + } |
|
172 | 172 | |
173 | - /** |
|
174 | - * Print a lineage node, recursively. |
|
175 | - * @param LineageNode $node |
|
176 | - */ |
|
177 | - private function printLineage(LineageNode $node) { |
|
173 | + /** |
|
174 | + * Print a lineage node, recursively. |
|
175 | + * @param LineageNode $node |
|
176 | + */ |
|
177 | + private function printLineage(LineageNode $node) { |
|
178 | 178 | |
179 | - echo '<ul>'; |
|
180 | - $fam_nodes = $node->getFamiliesNodes(); |
|
181 | - if(count($fam_nodes) > 0) { |
|
182 | - $is_first_family = true; |
|
183 | - foreach($fam_nodes as $fam) { |
|
184 | - $node_indi = $node->getIndividual(); |
|
185 | - echo '<li>'; |
|
186 | - if($is_first_family){ |
|
187 | - echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
188 | - } |
|
179 | + echo '<ul>'; |
|
180 | + $fam_nodes = $node->getFamiliesNodes(); |
|
181 | + if(count($fam_nodes) > 0) { |
|
182 | + $is_first_family = true; |
|
183 | + foreach($fam_nodes as $fam) { |
|
184 | + $node_indi = $node->getIndividual(); |
|
185 | + echo '<li>'; |
|
186 | + if($is_first_family){ |
|
187 | + echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
188 | + } |
|
189 | 189 | else{ |
190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 191 | } |
@@ -204,32 +204,32 @@ discard block |
||
204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
206 | 206 | } |
207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
208 | - if($child_node) { |
|
209 | - $this->printLineage($child_node); |
|
210 | - } |
|
211 | - else { |
|
212 | - echo '<ul><li><strong>…</strong></li></ul>'; |
|
213 | - } |
|
214 | - } |
|
215 | - $is_first_family = false; |
|
216 | - } |
|
217 | - } |
|
218 | - else { |
|
219 | - echo '<li>'; |
|
220 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
221 | - if($node->hasFollowUpSurname()) { |
|
222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
223 | - echo ' '. |
|
224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
225 | - '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
226 | - '</a>'; |
|
227 | - } |
|
228 | - echo '</li>'; |
|
229 | - } |
|
230 | - echo '</ul>'; |
|
207 | + foreach($fam_nodes[$fam] as $child_node) { |
|
208 | + if($child_node) { |
|
209 | + $this->printLineage($child_node); |
|
210 | + } |
|
211 | + else { |
|
212 | + echo '<ul><li><strong>…</strong></li></ul>'; |
|
213 | + } |
|
214 | + } |
|
215 | + $is_first_family = false; |
|
216 | + } |
|
217 | + } |
|
218 | + else { |
|
219 | + echo '<li>'; |
|
220 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
221 | + if($node->hasFollowUpSurname()) { |
|
222 | + $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
223 | + echo ' '. |
|
224 | + '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
225 | + '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
226 | + '</a>'; |
|
227 | + } |
|
228 | + echo '</li>'; |
|
229 | + } |
|
230 | + echo '</ul>'; |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
236 | 236 | \ No newline at end of file |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
37 | 37 | $tree = $this->data->get('tree'); |
38 | 38 | |
39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
39 | + echo '<h2 class="center">', $this->data->get('title'), '</h2>'; |
|
40 | 40 | echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
41 | 41 | |
42 | - if($this->data->get('issurnames', false)) { |
|
42 | + if ($this->data->get('issurnames', false)) { |
|
43 | 43 | $surns = $this->data->get('surnameslist', array()); |
44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
44 | + $extra_params = array('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
45 | 45 | // Show the surname list |
46 | 46 | switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
47 | 47 | case 'style1': |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | else if ($this->data->get('islineages', false)) { |
60 | 60 | //Link to indilist |
61 | 61 | echo '<p class="center"><strong>'. |
62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
62 | + '<a href="indilist.php?ged='.$tree->getNameUrl().'&surname='.rawurlencode($this->data->get('surname')).'">'. |
|
63 | 63 | I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
64 | 64 | '</a></strong></p>'; |
65 | 65 | |
66 | 66 | $lineages = $this->data->get('lineages', null); |
67 | 67 | $nb_lineages = count($lineages); |
68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
68 | + if (is_null($lineages) || $nb_lineages == 0) { |
|
69 | 69 | echo '<p class="center"><span class="warning">', |
70 | 70 | I18N::translate('No individuals with surname %s has been found. Please try another name.', |
71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
71 | + '<span dir="auto">'.$this->data->get('legend').'</span>'), |
|
72 | 72 | '</span></p>'; |
73 | 73 | } else { |
74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | |
80 | 80 | echo '<div class="list_value_wrap">'; |
81 | 81 | |
82 | - foreach($lineages as $i => $lineage) { |
|
82 | + foreach ($lineages as $i => $lineage) { |
|
83 | 83 | $this->printRootLineage($lineage); |
84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
84 | + if ($i < $nb_lineages - 1) echo '<hr />'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | echo '</div>'; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $list = array(); |
105 | 105 | /** @var \Fisharebest\Webtrees\Tree $tree */ |
106 | 106 | $tree = $this->data->get('tree'); |
107 | - $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
107 | + $script_base_url = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
108 | 108 | |
109 | 109 | foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
110 | 110 | switch ($letter) { |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | } |
121 | 121 | if ($count) { |
122 | 122 | if ($letter == $this->data->get('alpha')) { |
123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
123 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" class="warning" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
124 | 124 | } else { |
125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
125 | + $list[] = '<a href="'.$script_base_url.'&alpha='.rawurlencode($letter).'&ged='.$tree->getNameUrl().'" title="'.I18N::number($count).'">'.$html.'</a>'; |
|
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | $list[] = $html; |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | // Search spiders don't get the "show all" option as the other links give them everything. |
133 | 133 | if (!Auth::isSearchEngine()) { |
134 | 134 | if ($this->data->get('show_all') === 'yes') { |
135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
135 | + $list[] = '<span class="warning">'.I18N::translate('All').'</span>'; |
|
136 | 136 | } else { |
137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
137 | + $list[] = '<a href="'.$script_base_url.'&show_all=yes'.'&ged='.$tree->getNameUrl().'">'.I18N::translate('All').'</a>'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -147,11 +147,11 @@ discard block |
||
147 | 147 | */ |
148 | 148 | private function printRootLineage(LineageRootNode $node) { |
149 | 149 | print '<div class="patrolin_tree">'; |
150 | - if($node->getIndividual() === null) { |
|
150 | + if ($node->getIndividual() === null) { |
|
151 | 151 | $fam_nodes = $node->getFamiliesNodes(); |
152 | - foreach($fam_nodes as $fam){ |
|
153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
154 | - if($child_node) { |
|
152 | + foreach ($fam_nodes as $fam) { |
|
153 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
154 | + if ($child_node) { |
|
155 | 155 | $this->printLineage($child_node); |
156 | 156 | } |
157 | 157 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | echo '</div>'; |
164 | 164 | |
165 | 165 | $places = $node->getPlaces(); |
166 | - if($places && count($places)>0){ |
|
166 | + if ($places && count($places) > 0) { |
|
167 | 167 | echo '<div class="patrolin_places">'; |
168 | 168 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
169 | 169 | echo '</div>'; |
@@ -178,34 +178,34 @@ discard block |
||
178 | 178 | |
179 | 179 | echo '<ul>'; |
180 | 180 | $fam_nodes = $node->getFamiliesNodes(); |
181 | - if(count($fam_nodes) > 0) { |
|
181 | + if (count($fam_nodes) > 0) { |
|
182 | 182 | $is_first_family = true; |
183 | - foreach($fam_nodes as $fam) { |
|
183 | + foreach ($fam_nodes as $fam) { |
|
184 | 184 | $node_indi = $node->getIndividual(); |
185 | 185 | echo '<li>'; |
186 | - if($is_first_family){ |
|
186 | + if ($is_first_family) { |
|
187 | 187 | echo FunctionsPrint::htmlIndividualForList($node_indi); |
188 | 188 | } |
189 | - else{ |
|
189 | + else { |
|
190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
191 | 191 | } |
192 | 192 | //Get individual's spouse |
193 | 193 | $dfam = new Family($fam); |
194 | - $spouse=$dfam->getSpouseById($node_indi); |
|
194 | + $spouse = $dfam->getSpouseById($node_indi); |
|
195 | 195 | //Print the spouse if relevant |
196 | - if($spouse){ |
|
196 | + if ($spouse) { |
|
197 | 197 | $marrdate = I18N::translate('yes'); |
198 | 198 | $marryear = ''; |
199 | 199 | echo ' <a href="'.$fam->getHtmlUrl().'">'; |
200 | - if ($fam->getMarriageYear()){ |
|
200 | + if ($fam->getMarriageYear()) { |
|
201 | 201 | $marrdate = strip_tags($fam->getMarriageDate()->Display()); |
202 | 202 | $marryear = $fam->getMarriageYear(); |
203 | 203 | } |
204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
206 | 206 | } |
207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
208 | - if($child_node) { |
|
207 | + foreach ($fam_nodes[$fam] as $child_node) { |
|
208 | + if ($child_node) { |
|
209 | 209 | $this->printLineage($child_node); |
210 | 210 | } |
211 | 211 | else { |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | else { |
219 | 219 | echo '<li>'; |
220 | 220 | echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
221 | - if($node->hasFollowUpSurname()) { |
|
222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
221 | + if ($node->hasFollowUpSurname()) { |
|
222 | + $url_base = WT_SCRIPT_NAME.'?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME.'&mod_action=Lineage'; |
|
223 | 223 | echo ' '. |
224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
224 | + '<a href="'.$url_base.'&surname='.rawurlencode($node->getFollowUpSurname()).'&ged='.$this->data->get('tree')->getNameUrl().'">'. |
|
225 | 225 | '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
226 | 226 | '</a>'; |
227 | 227 | } |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $this->show = 'lineage'; // SURN list makes no sense here |
93 | 93 | } elseif ($this->alpha) { |
94 | 94 | $this->show_all = 'no'; |
95 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
95 | + $this->legend = Filter::escapeHtml($this->alpha).'…'; |
|
96 | 96 | $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
97 | 97 | } else { |
98 | 98 | $this->show_all = 'no'; |
99 | 99 | $this->legend = '…'; |
100 | 100 | $this->show = 'none'; // Don't show lists until something is chosen |
101 | 101 | } |
102 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
102 | + $this->legend = '<span dir="auto">'.$this->legend.'</span>'; |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | global $WT_TREE; |
153 | 153 | |
154 | 154 | $controller = new PageController(); |
155 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
155 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages').' : '.$this->legend); |
|
156 | 156 | |
157 | 157 | $view_bag = new ViewBag(); |
158 | 158 | $view_bag->set('title', $controller->getPageTitle()); |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | $view_bag->set('surname', $this->surname); |
162 | 162 | $view_bag->set('legend', $this->legend); |
163 | 163 | $view_bag->set('show_all', $this->show_all); |
164 | - if($this->isShowingSurnames()) { |
|
164 | + if ($this->isShowingSurnames()) { |
|
165 | 165 | $view_bag->set('issurnames', true); |
166 | 166 | $view_bag->set('surnameslist', $this->getSurnamesList()); |
167 | 167 | } |
168 | - if($this->isShowingLineages()) { |
|
168 | + if ($this->isShowingLineages()) { |
|
169 | 169 | $view_bag->set('islineages', true); |
170 | 170 | $view_bag->set('lineages', $this->getLineages()); |
171 | 171 | |
172 | - if ($this->show_all==='no') { |
|
172 | + if ($this->show_all === 'no') { |
|
173 | 173 | $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
174 | 174 | } |
175 | 175 | else { |
@@ -171,8 +171,7 @@ |
||
171 | 171 | |
172 | 172 | if ($this->show_all==='no') { |
173 | 173 | $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
174 | - } |
|
175 | - else { |
|
174 | + } else { |
|
176 | 175 | $view_bag->set('table_title', I18N::translate('All lineages')); |
177 | 176 | } |
178 | 177 | } |
@@ -26,166 +26,166 @@ |
||
26 | 26 | class LineageController extends MvcController |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * Generate the patronymic lineage for this surname |
|
31 | - * @var string $surname Reference surname |
|
32 | - */ |
|
33 | - private $surname; |
|
29 | + /** |
|
30 | + * Generate the patronymic lineage for this surname |
|
31 | + * @var string $surname Reference surname |
|
32 | + */ |
|
33 | + private $surname; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Initial letter |
|
37 | - * @var string $alpha |
|
38 | - */ |
|
39 | - private $alpha; |
|
35 | + /** |
|
36 | + * Initial letter |
|
37 | + * @var string $alpha |
|
38 | + */ |
|
39 | + private $alpha; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Show all names (values: yes|no) |
|
43 | - * @var bool $show |
|
44 | - */ |
|
45 | - private $show_all; |
|
41 | + /** |
|
42 | + * Show all names (values: yes|no) |
|
43 | + * @var bool $show |
|
44 | + */ |
|
45 | + private $show_all; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Page to display (values: surn|lineage) |
|
49 | - * @var unknown $show |
|
50 | - */ |
|
51 | - private $show; |
|
47 | + /** |
|
48 | + * Page to display (values: surn|lineage) |
|
49 | + * @var unknown $show |
|
50 | + */ |
|
51 | + private $show; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Page title |
|
55 | - * @var string $legend |
|
56 | - */ |
|
57 | - private $legend; |
|
53 | + /** |
|
54 | + * Page title |
|
55 | + * @var string $legend |
|
56 | + */ |
|
57 | + private $legend; |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | - */ |
|
63 | - public function __construct(AbstractModule $module) { |
|
64 | - global $WT_TREE; |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | + */ |
|
63 | + public function __construct(AbstractModule $module) { |
|
64 | + global $WT_TREE; |
|
65 | 65 | |
66 | - parent::__construct($module); |
|
66 | + parent::__construct($module); |
|
67 | 67 | |
68 | - $this->surname = Filter::get('surname'); |
|
69 | - $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | - $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | - // Make sure selections are consistent. |
|
72 | - // i.e. can’t specify show_all and surname at the same time. |
|
73 | - if ($this->show_all === 'yes') { |
|
74 | - $this->alpha = ''; |
|
75 | - $this->surname = ''; |
|
76 | - $this->legend = I18N::translate('All'); |
|
77 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | - } elseif ($this->surname) { |
|
79 | - $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | - $this->show_all = 'no'; |
|
81 | - if ($this->surname === '@N.N.') { |
|
82 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | - } else { |
|
84 | - $this->legend = Filter::escapeHtml($this->surname); |
|
85 | - // The surname parameter is a root/canonical form. |
|
86 | - // Display it as the actual surname |
|
87 | - foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | - $this->legend = implode('/', array_keys($details)); |
|
89 | - } |
|
90 | - } |
|
91 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | - } elseif ($this->alpha === '@') { |
|
93 | - $this->show_all = 'no'; |
|
94 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | - } elseif ($this->alpha === ',') { |
|
97 | - $this->show_all = 'no'; |
|
98 | - $this->legend = I18N::translate('None'); |
|
99 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | - } elseif ($this->alpha) { |
|
101 | - $this->show_all = 'no'; |
|
102 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | - } else { |
|
105 | - $this->show_all = 'no'; |
|
106 | - $this->legend = '…'; |
|
107 | - $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | - } |
|
109 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
68 | + $this->surname = Filter::get('surname'); |
|
69 | + $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | + $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | + // Make sure selections are consistent. |
|
72 | + // i.e. can’t specify show_all and surname at the same time. |
|
73 | + if ($this->show_all === 'yes') { |
|
74 | + $this->alpha = ''; |
|
75 | + $this->surname = ''; |
|
76 | + $this->legend = I18N::translate('All'); |
|
77 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | + } elseif ($this->surname) { |
|
79 | + $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | + $this->show_all = 'no'; |
|
81 | + if ($this->surname === '@N.N.') { |
|
82 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | + } else { |
|
84 | + $this->legend = Filter::escapeHtml($this->surname); |
|
85 | + // The surname parameter is a root/canonical form. |
|
86 | + // Display it as the actual surname |
|
87 | + foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | + $this->legend = implode('/', array_keys($details)); |
|
89 | + } |
|
90 | + } |
|
91 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | + } elseif ($this->alpha === '@') { |
|
93 | + $this->show_all = 'no'; |
|
94 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | + } elseif ($this->alpha === ',') { |
|
97 | + $this->show_all = 'no'; |
|
98 | + $this->legend = I18N::translate('None'); |
|
99 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | + } elseif ($this->alpha) { |
|
101 | + $this->show_all = 'no'; |
|
102 | + $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | + } else { |
|
105 | + $this->show_all = 'no'; |
|
106 | + $this->legend = '…'; |
|
107 | + $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | + } |
|
109 | + $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Indicates whether the list of surname should be displayed |
|
115 | - * @return bool |
|
116 | - */ |
|
117 | - protected function isShowingSurnames() { |
|
118 | - return $this->show === 'surn'; |
|
119 | - } |
|
113 | + /** |
|
114 | + * Indicates whether the list of surname should be displayed |
|
115 | + * @return bool |
|
116 | + */ |
|
117 | + protected function isShowingSurnames() { |
|
118 | + return $this->show === 'surn'; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Indicates whether the lineages should be displayed |
|
123 | - * @return bool |
|
124 | - */ |
|
125 | - protected function isShowingLineages() { |
|
126 | - return $this->show === 'lineage'; |
|
127 | - } |
|
121 | + /** |
|
122 | + * Indicates whether the lineages should be displayed |
|
123 | + * @return bool |
|
124 | + */ |
|
125 | + protected function isShowingLineages() { |
|
126 | + return $this->show === 'lineage'; |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Get list of surnames, starting with the specified initial |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - protected function getSurnamesList() { |
|
134 | - global $WT_TREE; |
|
129 | + /** |
|
130 | + * Get list of surnames, starting with the specified initial |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + protected function getSurnamesList() { |
|
134 | + global $WT_TREE; |
|
135 | 135 | |
136 | - return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | - } |
|
136 | + return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Get the lineages for the controller's specified surname |
|
141 | - */ |
|
142 | - protected function getLineages() { |
|
139 | + /** |
|
140 | + * Get the lineages for the controller's specified surname |
|
141 | + */ |
|
142 | + protected function getLineages() { |
|
143 | 143 | global $WT_TREE; |
144 | 144 | |
145 | 145 | $builder = new LineageBuilder($this->surname, $WT_TREE); |
146 | 146 | $lineages = $builder->buildLineages(); |
147 | 147 | |
148 | - return $lineages; |
|
149 | - } |
|
148 | + return $lineages; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Pages |
|
153 | - */ |
|
151 | + /** |
|
152 | + * Pages |
|
153 | + */ |
|
154 | 154 | |
155 | - /** |
|
156 | - * Lineage@index |
|
157 | - */ |
|
158 | - public function index() { |
|
159 | - global $WT_TREE; |
|
155 | + /** |
|
156 | + * Lineage@index |
|
157 | + */ |
|
158 | + public function index() { |
|
159 | + global $WT_TREE; |
|
160 | 160 | |
161 | - $controller = new PageController(); |
|
162 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
161 | + $controller = new PageController(); |
|
162 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
163 | 163 | |
164 | - $view_bag = new ViewBag(); |
|
165 | - $view_bag->set('title', $controller->getPageTitle()); |
|
166 | - $view_bag->set('tree', $WT_TREE); |
|
167 | - $view_bag->set('alpha', $this->alpha); |
|
168 | - $view_bag->set('surname', $this->surname); |
|
169 | - $view_bag->set('legend', $this->legend); |
|
170 | - $view_bag->set('show_all', $this->show_all); |
|
171 | - if($this->isShowingSurnames()) { |
|
172 | - $view_bag->set('issurnames', true); |
|
173 | - $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | - } |
|
175 | - if($this->isShowingLineages()) { |
|
176 | - $view_bag->set('islineages', true); |
|
177 | - $view_bag->set('lineages', $this->getLineages()); |
|
164 | + $view_bag = new ViewBag(); |
|
165 | + $view_bag->set('title', $controller->getPageTitle()); |
|
166 | + $view_bag->set('tree', $WT_TREE); |
|
167 | + $view_bag->set('alpha', $this->alpha); |
|
168 | + $view_bag->set('surname', $this->surname); |
|
169 | + $view_bag->set('legend', $this->legend); |
|
170 | + $view_bag->set('show_all', $this->show_all); |
|
171 | + if($this->isShowingSurnames()) { |
|
172 | + $view_bag->set('issurnames', true); |
|
173 | + $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | + } |
|
175 | + if($this->isShowingLineages()) { |
|
176 | + $view_bag->set('islineages', true); |
|
177 | + $view_bag->set('lineages', $this->getLineages()); |
|
178 | 178 | |
179 | - if ($this->show_all==='no') { |
|
180 | - $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | - } |
|
182 | - else { |
|
183 | - $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | - } |
|
185 | - } |
|
179 | + if ($this->show_all==='no') { |
|
180 | + $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | + } |
|
182 | + else { |
|
183 | + $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | + } |
|
185 | + } |
|
186 | 186 | |
187 | - ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | - } |
|
187 | + ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | 191 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function getConfigLink() { |
78 | 78 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
79 | 79 | |
80 | - return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
80 | + return 'module.php?mod='.$this->getName().'&mod_action=SosaConfig'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /********** |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | global $WT_TREE, $controller; |
101 | 101 | |
102 | 102 | $menu = null; |
103 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
103 | + if (ModuleManager::getInstance()->isOperational($this->getName())) { |
|
104 | 104 | |
105 | - $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
106 | - $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
105 | + $root_url = 'module.php?mod='.$this->getName().'&ged='.$WT_TREE->getNameUrl().'&'; |
|
106 | + $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url.'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
107 | 107 | |
108 | 108 | $menu = clone $sosa_stat_menu; |
109 | 109 | $menu->setClass('menu-maj-sosa'); |
110 | 110 | |
111 | 111 | $submenus = array_filter(array( |
112 | - new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
113 | - new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
112 | + new Menu(I18N::translate('Sosa Ancestors'), $root_url.'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
113 | + new Menu(I18N::translate('Missing Ancestors'), $root_url.'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
114 | 114 | $sosa_stat_menu |
115 | 115 | )); |
116 | 116 | |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
120 | 120 | ) |
121 | 121 | { |
122 | - if(count($ga_list) > 0) { |
|
123 | - $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
122 | + if (count($ga_list) > 0) { |
|
123 | + $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&ged='.$WT_TREE->getNameUrl().'&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if(Auth::check()) { |
|
127 | + if (Auth::check()) { |
|
128 | 128 | $submenus[] = new Menu( |
129 | 129 | I18N::translate('Sosa Configuration'), |
130 | 130 | $this->getConfigLink(), |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ->addInlineJavascript(' |
141 | 141 | function majComputeSosaFromIndi(){ |
142 | 142 | if($("#computesosadlg").length == 0) { |
143 | - $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
143 | + $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation').'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
144 | 144 | } |
145 | 145 | $("#computesosadlg").dialog({ |
146 | 146 | modal: true, |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | open: function(event, ui) { |
150 | 150 | $("button.ui-dialog-titlebar-close").hide(); |
151 | 151 | $("#sosaloadingarea").empty().html("<i class=\"icon-loading-small\"></i>"); |
152 | - $("#sosaloadingarea").load("module.php?mod=' . $this->getName() . '&mod_action=SosaConfig@computePartial&ged='. $WT_TREE->getNameUrl() .'&userid='.Auth::user()->getUserId().'&pid=' . $controller->getSignificantIndividual()->getXref() . '", |
|
152 | + $("#sosaloadingarea").load("module.php?mod=' . $this->getName().'&mod_action=SosaConfig@computePartial&ged='.$WT_TREE->getNameUrl().'&userid='.Auth::user()->getUserId().'&pid='.$controller->getSignificantIndividual()->getXref().'", |
|
153 | 153 | function(){ |
154 | 154 | $("button.ui-dialog-titlebar-close").show(); |
155 | 155 | setTimeout(function(){ |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderIcons() |
200 | 200 | */ |
201 | 201 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
202 | - if($ctrlIndi){ |
|
202 | + if ($ctrlIndi) { |
|
203 | 203 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
204 | 204 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
205 | 205 | } |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderRight() |
218 | 218 | */ |
219 | 219 | public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
220 | - if($ctrlIndi){ |
|
220 | + if ($ctrlIndi) { |
|
221 | 221 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
222 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
222 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
223 | 223 | } |
224 | 224 | return ''; |
225 | 225 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNameAppend() |
230 | 230 | */ |
231 | 231 | public function hRecordNameAppend(GedcomRecord $grec) { |
232 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
232 | + if ($grec instanceof \Fisharebest\Webtrees\Individual) { // Only apply to individuals |
|
233 | 233 | $dindi = new Individual($grec); |
234 | 234 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
235 | 235 | } |
@@ -31,116 +31,116 @@ discard block |
||
31 | 31 | * Sosa Module. |
32 | 32 | */ |
33 | 33 | class SosaModule |
34 | - extends AbstractModule |
|
35 | - implements ModuleMenuInterface, |
|
36 | - ModuleConfigInterface, |
|
37 | - HookSubscriberInterface, |
|
38 | - IndividualHeaderExtenderInterface, |
|
39 | - RecordNameTextExtenderInterface |
|
34 | + extends AbstractModule |
|
35 | + implements ModuleMenuInterface, |
|
36 | + ModuleConfigInterface, |
|
37 | + HookSubscriberInterface, |
|
38 | + IndividualHeaderExtenderInterface, |
|
39 | + RecordNameTextExtenderInterface |
|
40 | 40 | { |
41 | - // How to update the database schema for this module |
|
42 | - const SCHEMA_TARGET_VERSION = 1; |
|
43 | - const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
44 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
41 | + // How to update the database schema for this module |
|
42 | + const SCHEMA_TARGET_VERSION = 1; |
|
43 | + const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
|
44 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\Sosa\Schema'; |
|
45 | 45 | |
46 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
47 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
48 | - |
|
49 | - /** |
|
50 | - * {@inhericDoc} |
|
51 | - */ |
|
52 | - public function getTitle() { |
|
53 | - return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inhericDoc} |
|
58 | - */ |
|
59 | - public function getDescription() { |
|
60 | - return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * {@inhericDoc} |
|
65 | - */ |
|
66 | - public function modAction($mod_action) { |
|
67 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
46 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
47 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
48 | + |
|
49 | + /** |
|
50 | + * {@inhericDoc} |
|
51 | + */ |
|
52 | + public function getTitle() { |
|
53 | + return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa'); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inhericDoc} |
|
58 | + */ |
|
59 | + public function getDescription() { |
|
60 | + return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.'); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * {@inhericDoc} |
|
65 | + */ |
|
66 | + public function modAction($mod_action) { |
|
67 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
68 | 68 | |
69 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
70 | - } |
|
69 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
70 | + } |
|
71 | 71 | |
72 | - /********** |
|
72 | + /********** |
|
73 | 73 | * ModuleConfigInterface |
74 | 74 | **********/ |
75 | 75 | |
76 | - /** |
|
77 | - * {@inhericDoc} |
|
78 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
79 | - */ |
|
80 | - public function getConfigLink() { |
|
81 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
76 | + /** |
|
77 | + * {@inhericDoc} |
|
78 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
79 | + */ |
|
80 | + public function getConfigLink() { |
|
81 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
82 | 82 | |
83 | - return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
84 | - } |
|
83 | + return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
84 | + } |
|
85 | 85 | |
86 | - /********** |
|
86 | + /********** |
|
87 | 87 | * ModuleMenuInterface |
88 | 88 | **********/ |
89 | 89 | |
90 | - /** |
|
91 | - * {@inhericDoc} |
|
92 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
93 | - */ |
|
94 | - public function defaultMenuOrder() { |
|
95 | - return 5; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * {@inhericDoc} |
|
100 | - * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
101 | - */ |
|
102 | - public function getMenu() { |
|
103 | - global $WT_TREE, $controller; |
|
90 | + /** |
|
91 | + * {@inhericDoc} |
|
92 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder() |
|
93 | + */ |
|
94 | + public function defaultMenuOrder() { |
|
95 | + return 5; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * {@inhericDoc} |
|
100 | + * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu() |
|
101 | + */ |
|
102 | + public function getMenu() { |
|
103 | + global $WT_TREE, $controller; |
|
104 | 104 | |
105 | - $menu = null; |
|
106 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
105 | + $menu = null; |
|
106 | + if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
107 | 107 | |
108 | - $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
109 | - $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
108 | + $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $WT_TREE->getNameUrl() . '&'; |
|
109 | + $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
110 | 110 | |
111 | - $menu = clone $sosa_stat_menu; |
|
112 | - $menu->setClass('menu-maj-sosa'); |
|
111 | + $menu = clone $sosa_stat_menu; |
|
112 | + $menu->setClass('menu-maj-sosa'); |
|
113 | 113 | |
114 | - $submenus = array_filter(array( |
|
115 | - new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
116 | - new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
117 | - $sosa_stat_menu |
|
118 | - )); |
|
114 | + $submenus = array_filter(array( |
|
115 | + new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
116 | + new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
117 | + $sosa_stat_menu |
|
118 | + )); |
|
119 | 119 | |
120 | 120 | |
121 | - if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
122 | - && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
123 | - ) |
|
124 | - { |
|
125 | - if(count($ga_list) > 0) { |
|
126 | - $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
127 | - } |
|
128 | - } |
|
121 | + if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_GEODISP_NAME) |
|
122 | + && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
|
123 | + ) |
|
124 | + { |
|
125 | + if(count($ga_list) > 0) { |
|
126 | + $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $WT_TREE->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - if(Auth::check()) { |
|
131 | - $submenus[] = new Menu( |
|
132 | - I18N::translate('Sosa Configuration'), |
|
133 | - $this->getConfigLink(), |
|
134 | - 'menu-maj-sosa-configuration', |
|
135 | - array('rel' => 'nofollow')); |
|
136 | - } |
|
130 | + if(Auth::check()) { |
|
131 | + $submenus[] = new Menu( |
|
132 | + I18N::translate('Sosa Configuration'), |
|
133 | + $this->getConfigLink(), |
|
134 | + 'menu-maj-sosa-configuration', |
|
135 | + array('rel' => 'nofollow')); |
|
136 | + } |
|
137 | 137 | |
138 | - //-- recompute Sosa submenu |
|
139 | - if (!empty($controller) && $controller instanceof IndividualController |
|
140 | - && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
141 | - ) { |
|
142 | - $controller |
|
143 | - ->addInlineJavascript(' |
|
138 | + //-- recompute Sosa submenu |
|
139 | + if (!empty($controller) && $controller instanceof IndividualController |
|
140 | + && Auth::check() && $WT_TREE->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID') |
|
141 | + ) { |
|
142 | + $controller |
|
143 | + ->addInlineJavascript(' |
|
144 | 144 | function majComputeSosaFromIndi(){ |
145 | 145 | if($("#computesosadlg").length == 0) { |
146 | 146 | $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
@@ -163,87 +163,87 @@ discard block |
||
163 | 163 | }); |
164 | 164 | }'); |
165 | 165 | |
166 | - $submenus[] = new Menu( |
|
167 | - I18N::translate('Complete Sosas'), |
|
168 | - '#', |
|
169 | - 'menu-maj-sosa-recompute', |
|
170 | - array( |
|
171 | - 'rel' => 'nofollow', |
|
172 | - 'onclick' => 'return majComputeSosaFromIndi();' |
|
173 | - )); |
|
174 | - } |
|
166 | + $submenus[] = new Menu( |
|
167 | + I18N::translate('Complete Sosas'), |
|
168 | + '#', |
|
169 | + 'menu-maj-sosa-recompute', |
|
170 | + array( |
|
171 | + 'rel' => 'nofollow', |
|
172 | + 'onclick' => 'return majComputeSosaFromIndi();' |
|
173 | + )); |
|
174 | + } |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - $menu->setSubmenus($submenus); |
|
178 | + $menu->setSubmenus($submenus); |
|
179 | 179 | |
180 | - return $menu; |
|
180 | + return $menu; |
|
181 | 181 | |
182 | - } |
|
182 | + } |
|
183 | 183 | |
184 | - /********** |
|
184 | + /********** |
|
185 | 185 | * Hooks |
186 | 186 | **********/ |
187 | 187 | |
188 | - /** |
|
189 | - * {@inhericDoc} |
|
190 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
191 | - */ |
|
192 | - public function getSubscribedHooks() { |
|
193 | - return array( |
|
194 | - 'hExtendIndiHeaderIcons' => 20, |
|
195 | - 'hExtendIndiHeaderRight' => 20, |
|
196 | - 'hRecordNameAppend' => 20 |
|
197 | - ); |
|
198 | - } |
|
199 | - |
|
200 | - /** |
|
201 | - * {@inhericDoc} |
|
202 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
203 | - */ |
|
204 | - public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
205 | - if($ctrlIndi){ |
|
206 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
207 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
208 | - } |
|
209 | - return ''; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * {@inhericDoc} |
|
214 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
215 | - */ |
|
216 | - public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
217 | - |
|
218 | - /** |
|
219 | - * {@inhericDoc} |
|
220 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
221 | - */ |
|
222 | - public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
223 | - if($ctrlIndi){ |
|
224 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
225 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
226 | - } |
|
227 | - return ''; |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * {@inhericDoc} |
|
232 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
233 | - */ |
|
234 | - public function hRecordNameAppend(GedcomRecord $grec) { |
|
235 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
236 | - $dindi = new Individual($grec); |
|
237 | - return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
238 | - } |
|
239 | - return ''; |
|
240 | - } |
|
241 | - |
|
242 | - /** |
|
243 | - * {@inhericDoc} |
|
244 | - * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
245 | - */ |
|
246 | - public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
188 | + /** |
|
189 | + * {@inhericDoc} |
|
190 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
191 | + */ |
|
192 | + public function getSubscribedHooks() { |
|
193 | + return array( |
|
194 | + 'hExtendIndiHeaderIcons' => 20, |
|
195 | + 'hExtendIndiHeaderRight' => 20, |
|
196 | + 'hRecordNameAppend' => 20 |
|
197 | + ); |
|
198 | + } |
|
199 | + |
|
200 | + /** |
|
201 | + * {@inhericDoc} |
|
202 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
|
203 | + */ |
|
204 | + public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
|
205 | + if($ctrlIndi){ |
|
206 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
207 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
|
208 | + } |
|
209 | + return ''; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * {@inhericDoc} |
|
214 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft() |
|
215 | + */ |
|
216 | + public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi) { } |
|
217 | + |
|
218 | + /** |
|
219 | + * {@inhericDoc} |
|
220 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
|
221 | + */ |
|
222 | + public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
|
223 | + if($ctrlIndi){ |
|
224 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
225 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
226 | + } |
|
227 | + return ''; |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * {@inhericDoc} |
|
232 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
|
233 | + */ |
|
234 | + public function hRecordNameAppend(GedcomRecord $grec) { |
|
235 | + if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
236 | + $dindi = new Individual($grec); |
|
237 | + return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small'); |
|
238 | + } |
|
239 | + return ''; |
|
240 | + } |
|
241 | + |
|
242 | + /** |
|
243 | + * {@inhericDoc} |
|
244 | + * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNamePrepend() |
|
245 | + */ |
|
246 | + public function hRecordNamePrepend(GedcomRecord $grec) {} |
|
247 | 247 | |
248 | 248 | |
249 | 249 |
@@ -23,17 +23,17 @@ |
||
23 | 23 | |
24 | 24 | Database::exec( |
25 | 25 | "CREATE TABLE IF NOT EXISTS `##maj_hooks` (". |
26 | - " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
27 | - " majh_hook_function VARCHAR(32) NOT NULL,". |
|
26 | + " majh_id INTEGER AUTO_INCREMENT NOT NULL,". |
|
27 | + " majh_hook_function VARCHAR(32) NOT NULL,". |
|
28 | 28 | " majh_hook_context VARCHAR(32) NOT NULL DEFAULT 'all',". |
29 | - " majh_module_name VARCHAR(32) NOT NULL,". |
|
30 | - " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
31 | - " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
32 | - " PRIMARY KEY (majh_id),". |
|
33 | - " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
34 | - " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
29 | + " majh_module_name VARCHAR(32) NOT NULL,". |
|
30 | + " majh_module_priority INTEGER NOT NULL DEFAULT 99,". |
|
31 | + " majh_status ENUM('enabled', 'disabled') NOT NULL DEFAULT 'enabled',". |
|
32 | + " PRIMARY KEY (majh_id),". |
|
33 | + " UNIQUE KEY `##maj_hooks_uk` (majh_hook_function, majh_hook_context, majh_module_name),". |
|
34 | + " FOREIGN KEY `##module_name_fk1` (majh_module_name)". |
|
35 | 35 | " REFERENCES `##module` (module_name) ON DELETE CASCADE ON UPDATE CASCADE". |
36 | - ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
36 | + ") COLLATE utf8_unicode_ci ENGINE=InnoDB" |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | } |
@@ -47,7 +47,9 @@ discard block |
||
47 | 47 | $array_hook = explode('#', $ihook); |
48 | 48 | //Update status |
49 | 49 | $new_status= Filter::postBool('status-' . $params['id']); |
50 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | + if(in_array($array_hook[0], $module_names)) { |
|
51 | + $new_status = false; |
|
52 | + } |
|
51 | 53 | $previous_status = $params['status']; |
52 | 54 | if ($new_status !== null) { |
53 | 55 | $new_status= $new_status ? 'enabled' : 'disabled'; |
@@ -94,7 +96,9 @@ discard block |
||
94 | 96 | HookProvider::updateHooks(); |
95 | 97 | |
96 | 98 | $action = Filter::post('action'); |
97 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
99 | + if($action == 'update' && Filter::checkCsrf()) { |
|
100 | + $this->update(); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
100 | 104 | $ctrl = new PageController(); |
@@ -33,26 +33,26 @@ discard block |
||
33 | 33 | * Manage updates sent from the AdminConfig@index form. |
34 | 34 | */ |
35 | 35 | protected function update() { |
36 | - if(Auth::isAdmin()){ |
|
36 | + if (Auth::isAdmin()) { |
|
37 | 37 | $ihooks = HookProvider::getInstalledHooks(); |
38 | 38 | |
39 | - $module_names= Database::prepare( |
|
39 | + $module_names = Database::prepare( |
|
40 | 40 | "SELECT module_name FROM `##module` WHERE status='disabled'" |
41 | 41 | )->fetchOneColumn(); |
42 | 42 | |
43 | - if($ihooks !== null){ |
|
43 | + if ($ihooks !== null) { |
|
44 | 44 | foreach ($ihooks as $ihook => $params) { |
45 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
45 | + if (Filter::post('hook-'.$params['id']) === 'yes') { |
|
46 | 46 | $array_hook = explode('#', $ihook); |
47 | 47 | //Update status |
48 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
49 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
48 | + $new_status = Filter::postBool('status-'.$params['id']); |
|
49 | + if (in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | 50 | $previous_status = $params['status']; |
51 | 51 | if ($new_status !== null) { |
52 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
53 | - if($new_status != $previous_status){ |
|
52 | + $new_status = $new_status ? 'enabled' : 'disabled'; |
|
53 | + if ($new_status != $previous_status) { |
|
54 | 54 | $chook = new Hook($array_hook[1], $array_hook[2]); |
55 | - switch($new_status){ |
|
55 | + switch ($new_status) { |
|
56 | 56 | case 'enabled': |
57 | 57 | $chook->enable($array_hook[0]); |
58 | 58 | break; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
70 | 70 | $previous_priority = $params['priority']; |
71 | 71 | if ($new_priority !== null) { |
72 | - if($new_priority != $previous_priority){ |
|
72 | + if ($new_priority != $previous_priority) { |
|
73 | 73 | $chook = new Hook($array_hook[1], $array_hook[2]); |
74 | 74 | $chook->setPriority($array_hook[0], $new_priority); |
75 | 75 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | HookProvider::updateHooks(); |
94 | 94 | |
95 | 95 | $action = Filter::post('action'); |
96 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
96 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
97 | 97 | |
98 | 98 | Theme::theme(new AdministrationTheme)->init($WT_TREE); |
99 | 99 | $ctrl = new PageController(); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ->restrictAccess(Auth::isAdmin()) |
102 | 102 | ->setPageTitle($this->module->getTitle()); |
103 | 103 | |
104 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
104 | + $table_id = 'table-installedhooks-'.Uuid::uuid4(); |
|
105 | 105 | |
106 | 106 | $view_bag = new ViewBag(); |
107 | 107 | $view_bag->set('title', $ctrl->getPageTitle()); |
@@ -29,89 +29,89 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class AdminConfigController extends MvcController |
31 | 31 | { |
32 | - /** |
|
33 | - * Manage updates sent from the AdminConfig@index form. |
|
34 | - */ |
|
35 | - protected function update() { |
|
36 | - if(Auth::isAdmin()){ |
|
37 | - $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
|
32 | + /** |
|
33 | + * Manage updates sent from the AdminConfig@index form. |
|
34 | + */ |
|
35 | + protected function update() { |
|
36 | + if(Auth::isAdmin()){ |
|
37 | + $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
|
38 | 38 | |
39 | - $module_names= Database::prepare( |
|
40 | - "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
41 | - )->fetchOneColumn(); |
|
39 | + $module_names= Database::prepare( |
|
40 | + "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
41 | + )->fetchOneColumn(); |
|
42 | 42 | |
43 | - if($ihooks !== null){ |
|
44 | - foreach ($ihooks as $ihook => $params) { |
|
45 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | - $array_hook = explode('#', $ihook); |
|
47 | - //Update status |
|
48 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
49 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | - $previous_status = $params['status']; |
|
51 | - if ($new_status !== null) { |
|
52 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
53 | - if($new_status != $previous_status){ |
|
54 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
55 | - switch($new_status){ |
|
56 | - case 'enabled': |
|
57 | - $chook->enable($array_hook[0]); |
|
58 | - break; |
|
59 | - case 'disabled': |
|
60 | - $chook->disable($array_hook[0]); |
|
61 | - break; |
|
62 | - default: |
|
63 | - break; |
|
64 | - } |
|
65 | - } |
|
66 | - } |
|
43 | + if($ihooks !== null){ |
|
44 | + foreach ($ihooks as $ihook => $params) { |
|
45 | + if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | + $array_hook = explode('#', $ihook); |
|
47 | + //Update status |
|
48 | + $new_status= Filter::postBool('status-' . $params['id']); |
|
49 | + if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
50 | + $previous_status = $params['status']; |
|
51 | + if ($new_status !== null) { |
|
52 | + $new_status= $new_status ? 'enabled' : 'disabled'; |
|
53 | + if($new_status != $previous_status){ |
|
54 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
55 | + switch($new_status){ |
|
56 | + case 'enabled': |
|
57 | + $chook->enable($array_hook[0]); |
|
58 | + break; |
|
59 | + case 'disabled': |
|
60 | + $chook->disable($array_hook[0]); |
|
61 | + break; |
|
62 | + default: |
|
63 | + break; |
|
64 | + } |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - //Update priority |
|
69 | - $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
70 | - $previous_priority = $params['priority']; |
|
71 | - if ($new_priority !== null) { |
|
72 | - if($new_priority != $previous_priority){ |
|
73 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
74 | - $chook->setPriority($array_hook[0], $new_priority); |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
68 | + //Update priority |
|
69 | + $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
70 | + $previous_priority = $params['priority']; |
|
71 | + if ($new_priority !== null) { |
|
72 | + if($new_priority != $previous_priority){ |
|
73 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
74 | + $chook->setPriority($array_hook[0], $new_priority); |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Pages |
|
85 | - */ |
|
83 | + /** |
|
84 | + * Pages |
|
85 | + */ |
|
86 | 86 | |
87 | - /** |
|
88 | - * AdminConfig@index |
|
89 | - */ |
|
90 | - public function index() { |
|
91 | - global $WT_TREE; |
|
87 | + /** |
|
88 | + * AdminConfig@index |
|
89 | + */ |
|
90 | + public function index() { |
|
91 | + global $WT_TREE; |
|
92 | 92 | |
93 | - HookProvider::getInstance()->updateHooks(); |
|
93 | + HookProvider::getInstance()->updateHooks(); |
|
94 | 94 | |
95 | - $action = Filter::post('action'); |
|
96 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
95 | + $action = Filter::post('action'); |
|
96 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
97 | 97 | |
98 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
99 | - $ctrl = new PageController(); |
|
100 | - $ctrl |
|
101 | - ->restrictAccess(Auth::isAdmin()) |
|
102 | - ->setPageTitle($this->module->getTitle()); |
|
98 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
99 | + $ctrl = new PageController(); |
|
100 | + $ctrl |
|
101 | + ->restrictAccess(Auth::isAdmin()) |
|
102 | + ->setPageTitle($this->module->getTitle()); |
|
103 | 103 | |
104 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
104 | + $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
105 | 105 | |
106 | - $view_bag = new ViewBag(); |
|
107 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
108 | - $view_bag->set('table_id', $table_id); |
|
109 | - $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); |
|
106 | + $view_bag = new ViewBag(); |
|
107 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
108 | + $view_bag->set('table_id', $table_id); |
|
109 | + $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); |
|
110 | 110 | |
111 | - $ctrl |
|
112 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
113 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
114 | - ->addInlineJavascript(' |
|
111 | + $ctrl |
|
112 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
113 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
114 | + ->addInlineJavascript(' |
|
115 | 115 | jQuery(document).ready(function() { |
116 | 116 | jQuery("#'.$table_id.'").dataTable( { |
117 | 117 | '.I18N::datatablesI18N().', |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | }); |
132 | 132 | '); |
133 | 133 | |
134 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
135 | - } |
|
134 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
135 | + } |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | \ No newline at end of file |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | * {@inhericDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
27 | 27 | */ |
28 | - protected function renderContent() { |
|
28 | + protected function renderContent() { |
|
29 | 29 | |
30 | - $table_id = $this->data->get('table_id'); |
|
30 | + $table_id = $this->data->get('table_id'); |
|
31 | 31 | |
32 | - ?> |
|
32 | + ?> |
|
33 | 33 | <ol class="breadcrumb small"> |
34 | 34 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
35 | 35 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | </div> |
80 | 80 | |
81 | 81 | <?php |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | 86 | \ No newline at end of file |
@@ -60,13 +60,13 @@ |
||
60 | 60 | ?> |
61 | 61 | <tr> |
62 | 62 | <td> |
63 | - <input type="hidden" name="hook-<?php echo $hook->id;?>" value="yes" > |
|
64 | - <?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status)=='enabled'); ?> |
|
63 | + <input type="hidden" name="hook-<?php echo $hook->id; ?>" value="yes" > |
|
64 | + <?php echo FunctionsEdit::twoStateCheckbox('status-'.($hook->id), ($hook->status) == 'enabled'); ?> |
|
65 | 65 | </td> |
66 | - <td><?php echo (($hook->status)=='enabled'); ?></td> |
|
66 | + <td><?php echo (($hook->status) == 'enabled'); ?></td> |
|
67 | 67 | <td><?php echo $hook->hook; ?></td> |
68 | 68 | <td><?php echo $hook->context; ?></td> |
69 | - <td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
69 | + <td><?php if ($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
70 | 70 | <td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td> |
71 | 71 | <td><?php echo $hook->priority; ?></td> |
72 | 72 | </tr> |
@@ -66,7 +66,10 @@ |
||
66 | 66 | <td><?php echo (($hook->status)=='enabled'); ?></td> |
67 | 67 | <td><?php echo $hook->hook; ?></td> |
68 | 68 | <td><?php echo $hook->context; ?></td> |
69 | - <td><?php if($mod = Module::getModuleByName($hook->module)) echo $mod->getTitle(); ?></td> |
|
69 | + <td><?php if($mod = Module::getModuleByName($hook->module)) { |
|
70 | + echo $mod->getTitle(); |
|
71 | +} |
|
72 | +?></td> |
|
70 | 73 | <td><input type="text" class="center" size="2" value="<?php echo $hook->priority; ?>" name="moduleorder-<?php echo $hook->id; ?>" /></td> |
71 | 74 | <td><?php echo $hook->priority; ?></td> |
72 | 75 | </tr> |