@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @return string List of elements |
| 33 | 33 | */ |
| 34 | 34 | public static function getListFromArray(array $array) { |
| 35 | - $n=count($array); |
|
| 35 | + $n = count($array); |
|
| 36 | 36 | switch ($n) { |
| 37 | 37 | case 0: |
| 38 | 38 | return ''; |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | default: |
| 42 | 42 | return implode( |
| 43 | 43 | /* I18N: list separator */ I18N::translate(', '), |
| 44 | - array_slice($array, 0, $n-1) |
|
| 45 | - ) . |
|
| 46 | - /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and ') . |
|
| 47 | - $array[$n-1]; |
|
| 44 | + array_slice($array, 0, $n - 1) |
|
| 45 | + ). |
|
| 46 | + /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and '). |
|
| 47 | + $array[$n - 1]; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
| 61 | 61 | ) { |
| 62 | 62 | $place = $fact->getPlace(); |
| 63 | - if(!$place->isEmpty()) { |
|
| 64 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
| 65 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
| 66 | - return '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
| 63 | + if (!$place->isEmpty()) { |
|
| 64 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
| 65 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
| 66 | + return '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | return ''; |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param number $size |
| 78 | 78 | * @return string HTML code of the inserted flag |
| 79 | 79 | */ |
| 80 | - public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
|
| 81 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 80 | + public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { |
|
| 81 | + return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />'; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $minimum = PHP_INT_MAX; |
| 97 | 97 | $maximum = 1; |
| 98 | 98 | foreach ($list as $params) { |
| 99 | - if(array_key_exists('count', $params)) { |
|
| 99 | + if (array_key_exists('count', $params)) { |
|
| 100 | 100 | $maximum = max($maximum, $params['count']); |
| 101 | 101 | $minimum = min($minimum, $params['count']); |
| 102 | 102 | } |
@@ -114,15 +114,15 @@ discard block |
||
| 114 | 114 | $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $html .= '<a style="font-size:' . $size . '%" href="' . $url . '">'; |
|
| 117 | + $html .= '<a style="font-size:'.$size.'%" href="'.$url.'">'; |
|
| 118 | 118 | if ($totals) { |
| 119 | - $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count)); |
|
| 119 | + $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count)); |
|
| 120 | 120 | } else { |
| 121 | 121 | $html .= $text; |
| 122 | 122 | } |
| 123 | 123 | $html .= '</a>'; |
| 124 | 124 | } |
| 125 | - return '<div class="tag_cloud">' . $html . '</div>'; |
|
| 125 | + return '<div class="tag_cloud">'.$html.'</div>'; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | * @param bool $isStrong Bolden the name ? |
| 158 | 158 | * @return string HTML Code for individual item |
| 159 | 159 | */ |
| 160 | - public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
|
| 160 | + public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { |
|
| 161 | 161 | $html = ''; |
| 162 | 162 | $tag = 'em'; |
| 163 | - if($isStrong) $tag = 'strong'; |
|
| 164 | - if($individual && $individual->canShow()){ |
|
| 163 | + if ($isStrong) $tag = 'strong'; |
|
| 164 | + if ($individual && $individual->canShow()) { |
|
| 165 | 165 | $dindi = new Individual($individual); |
| 166 | 166 | $html = $individual->getSexImage(); |
| 167 | 167 | $html .= '<a class="list_item" href="'. |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $html .= '</a>'; |
| 177 | 177 | } |
| 178 | 178 | else { |
| 179 | - $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
|
| 179 | + $html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>'; |
|
| 180 | 180 | } |
| 181 | 181 | return $html; |
| 182 | 182 | } |
@@ -188,20 +188,20 @@ discard block |
||
| 188 | 188 | * @param boolean $anchor option to print a link to calendar |
| 189 | 189 | * @return string HTML code for short date |
| 190 | 190 | */ |
| 191 | - public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) { |
|
| 192 | - $html=''; |
|
| 191 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
| 192 | + $html = ''; |
|
| 193 | 193 | $date = $fact->getDate(); |
| 194 | - if($date->isOK()){ |
|
| 195 | - $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
| 194 | + if ($date->isOK()) { |
|
| 195 | + $html .= ' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
| 196 | 196 | } |
| 197 | - else{ |
|
| 197 | + else { |
|
| 198 | 198 | // 1 DEAT Y with no DATE => print YES |
| 199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
| 200 | 200 | // 1 DEAT N is not allowed |
| 201 | 201 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
| 202 | 202 | $factdetail = explode(' ', trim($fact->getGedcom())); |
| 203 | 203 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
| 204 | - $html.=I18N::translate('yes'); |
|
| 204 | + $html .= I18N::translate('yes'); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | return $html; |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | * @param boolean $anchor option to print a link to placelist |
| 216 | 216 | * @return string HTML code for short place |
| 217 | 217 | */ |
| 218 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
| 219 | - $html=''; |
|
| 218 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
| 219 | + $html = ''; |
|
| 220 | 220 | |
| 221 | 221 | if ($fact === null) return $html; |
| 222 | 222 | $place = $fact->getPlace(); |
| 223 | - if($place){ |
|
| 223 | + if ($place) { |
|
| 224 | 224 | $dplace = new Place($place); |
| 225 | 225 | $html .= $dplace->htmlFormattedName($format, $anchor); |
| 226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
| 238 | 238 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
| 239 | 239 | * @return string HTML code for the formatted Sosa numbers |
| 240 | 240 | */ |
| 241 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
| 241 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
| 242 | 242 | $html = ''; |
| 243 | - switch($format){ |
|
| 243 | + switch ($format) { |
|
| 244 | 244 | case 1: |
| 245 | - if(count($sosatab)>0){ |
|
| 245 | + if (count($sosatab) > 0) { |
|
| 246 | 246 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | case 2: |
| 250 | - if(count($sosatab)>0){ |
|
| 250 | + if (count($sosatab) > 0) { |
|
| 251 | 251 | ksort($sosatab); |
| 252 | 252 | $tmp_html = array(); |
| 253 | 253 | foreach ($sosatab as $sosa => $gen) { |
| 254 | 254 | $tmp_html[] = sprintf( |
| 255 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
| 255 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
| 256 | 256 | $size, |
| 257 | 257 | $sosa |
| 258 | 258 | ); |
@@ -278,15 +278,15 @@ discard block |
||
| 278 | 278 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
| 279 | 279 | * @return string HTML code for IsSourced icon |
| 280 | 280 | */ |
| 281 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
| 282 | - $html=''; |
|
| 283 | - $image=null; |
|
| 284 | - $title=null; |
|
| 285 | - switch($format){ |
|
| 281 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
| 282 | + $html = ''; |
|
| 283 | + $image = null; |
|
| 284 | + $title = null; |
|
| 285 | + switch ($format) { |
|
| 286 | 286 | case 1: |
| 287 | - switch($sourceType){ |
|
| 287 | + switch ($sourceType) { |
|
| 288 | 288 | case 'E': |
| 289 | - switch($isSourced){ |
|
| 289 | + switch ($isSourced) { |
|
| 290 | 290 | case 0: |
| 291 | 291 | $image = 'event_unknown'; |
| 292 | 292 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | break; |
| 318 | 318 | case 'R': |
| 319 | - switch($isSourced){ |
|
| 319 | + switch ($isSourced) { |
|
| 320 | 320 | case -1: |
| 321 | 321 | $image = 'record_notsourced'; |
| 322 | 322 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | default: |
| 337 | 337 | break; |
| 338 | 338 | } |
| 339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 339 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 340 | 340 | break; |
| 341 | 341 | default: |
| 342 | 342 | break; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->view_bag = new ViewBag(); |
| 70 | 70 | $this->view_bag->set('generation', $this->generation); |
| 71 | 71 | $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
| 72 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 72 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 91 | 91 | |
| 92 | - if($this->view_bag->get('is_setup', false)) { |
|
| 92 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 93 | 93 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
| 94 | 94 | $this->view_bag->set('url_module', $this->module->getName()); |
| 95 | 95 | $this->view_bag->set('url_action', 'SosaList'); |
| 96 | 96 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
| 97 | 97 | $this->view_bag->set('min_gen', 1); |
| 98 | 98 | |
| 99 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 99 | + if ($this->view_bag->get('has_sosa', false)) { |
|
| 100 | 100 | $controller->addInlineJavascript(' |
| 101 | 101 | jQuery("#sosalist-tabs").tabs(); |
| 102 | 102 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | { |
| 107 | 107 | "mod" : "'.$this->module->getName().'", |
| 108 | 108 | "mod_action": "SosaList@sosalist", |
| 109 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
| 109 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
| 110 | 110 | "type" : "indi", |
| 111 | 111 | "gen" : "'.$this->generation.'" |
| 112 | 112 | }, |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | "mod" : "'.$this->module->getName().'", |
| 133 | 133 | "mod_action": "SosaList@sosalist", |
| 134 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
| 134 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
| 135 | 135 | "type" : "fam", |
| 136 | 136 | "gen" : "'.$this->generation.'" |
| 137 | 137 | }, |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $this->view_bag->set('title', $controller->getPageTitle()); |
| 171 | 171 | |
| 172 | - if($this->view_bag->get('is_setup', false)) { |
|
| 172 | + if ($this->view_bag->get('is_setup', false)) { |
|
| 173 | 173 | $this->view_bag->set('url_module', $this->module->getName()); |
| 174 | 174 | $this->view_bag->set('url_action', 'SosaList@missing'); |
| 175 | 175 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
| 179 | 179 | $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
| 180 | 180 | |
| 181 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 181 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
| 182 | 182 | $this->view_bag->set('perc_sosa', $perc_sosa); |
| 183 | 183 | |
| 184 | - if($this->view_bag->get('has_missing', false)) { |
|
| 185 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 184 | + if ($this->view_bag->get('has_missing', false)) { |
|
| 185 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
| 186 | 186 | $this->view_bag->set('table_id', $table_id); |
| 187 | 187 | |
| 188 | 188 | $controller |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 193 | 193 | |
| 194 | 194 | jQuery("#'.$table_id.'").dataTable( { |
| 195 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 195 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 196 | 196 | '.I18N::datatablesI18N().', |
| 197 | 197 | jQueryUI: true, |
| 198 | 198 | autoWidth:false, |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | pagingType: "full_numbers" |
| 219 | 219 | }); |
| 220 | 220 | |
| 221 | - jQuery("#' . $table_id . '") |
|
| 221 | + jQuery("#' . $table_id.'") |
|
| 222 | 222 | /* Filter buttons in table header */ |
| 223 | 223 | .on("click", "button[data-filter-column]", function() { |
| 224 | 224 | var btn = jQuery(this); |
| 225 | 225 | // De-activate the other buttons in this button group |
| 226 | 226 | btn.siblings().removeClass("ui-state-active"); |
| 227 | 227 | // Apply (or clear) this filter |
| 228 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 228 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 229 | 229 | if (btn.hasClass("ui-state-active")) { |
| 230 | 230 | btn.removeClass("ui-state-active"); |
| 231 | 231 | col.search("").draw(); |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $unique_indis = array(); |
| 243 | 243 | $sum_missing_different = 0; |
| 244 | 244 | $sum_missing_different_without_hidden = 0; |
| 245 | - foreach($missing_list as $num => $missing_tab) { |
|
| 246 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 245 | + foreach ($missing_list as $num => $missing_tab) { |
|
| 246 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
| 247 | 247 | unset($missing_list[$num]); |
| 248 | 248 | continue; |
| 249 | 249 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $this->view_bag->set('missing_list', $missing_list); |
| 262 | 262 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
| 263 | 263 | $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
| 264 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 264 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
| 265 | 265 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $controller = new AjaxController(); |
| 280 | 280 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
| 281 | 281 | |
| 282 | - switch ($type){ |
|
| 282 | + switch ($type) { |
|
| 283 | 283 | case 'indi': |
| 284 | 284 | $this->renderSosaListIndi($controller); |
| 285 | 285 | break; |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
| 302 | 302 | $this->view_bag->set('has_sosa', false); |
| 303 | 303 | |
| 304 | - if(count($listSosa) > 0) { |
|
| 304 | + if (count($listSosa) > 0) { |
|
| 305 | 305 | $this->view_bag->set('has_sosa', true); |
| 306 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 306 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
| 307 | 307 | $this->view_bag->set('table_id', $table_id); |
| 308 | 308 | |
| 309 | 309 | $controller |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 314 | 314 | |
| 315 | 315 | jQuery("#'.$table_id.'").dataTable( { |
| 316 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 317 | - ' . I18N::datatablesI18N() . ', |
|
| 316 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 317 | + ' . I18N::datatablesI18N().', |
|
| 318 | 318 | jQueryUI: true, |
| 319 | 319 | autoWidth: false, |
| 320 | 320 | processing: true, |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | pagingType: "full_numbers" |
| 344 | 344 | }); |
| 345 | 345 | |
| 346 | - jQuery("#' . $table_id . '") |
|
| 346 | + jQuery("#' . $table_id.'") |
|
| 347 | 347 | /* Hide/show parents */ |
| 348 | 348 | .on("click", ".btn-toggle-parents", function() { |
| 349 | 349 | jQuery(this).toggleClass("ui-state-active"); |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | /* Hide/show statistics */ |
| 353 | 353 | .on("click", ".btn-toggle-statistics", function() { |
| 354 | 354 | jQuery(this).toggleClass("ui-state-active"); |
| 355 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 355 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 356 | 356 | }) |
| 357 | 357 | /* Filter buttons in table header */ |
| 358 | 358 | .on("click", "button[data-filter-column]", function() { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | // De-activate the other buttons in this button group |
| 361 | 361 | btn.siblings().removeClass("ui-state-active"); |
| 362 | 362 | // Apply (or clear) this filter |
| 363 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 363 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 364 | 364 | if (btn.hasClass("ui-state-active")) { |
| 365 | 365 | btn.removeClass("ui-state-active"); |
| 366 | 366 | col.search("").draw(); |
@@ -395,30 +395,30 @@ discard block |
||
| 395 | 395 | $nb_displayed = 0; |
| 396 | 396 | |
| 397 | 397 | Individual::load($wt_tree, $listSosa); |
| 398 | - foreach($listSosa as $sosa => $pid) { |
|
| 398 | + foreach ($listSosa as $sosa => $pid) { |
|
| 399 | 399 | $person = Individual::getInstance($pid, $wt_tree); |
| 400 | 400 | if (!$person || !$person->canShowName()) { |
| 401 | 401 | unset($listSosa[$sosa]); |
| 402 | 402 | continue; |
| 403 | 403 | } |
| 404 | 404 | $nb_displayed++; |
| 405 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 405 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
| 406 | 406 | if ( |
| 407 | 407 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
| 408 | 408 | !isset($unique_indis[$person->getXref()]) |
| 409 | 409 | ) { |
| 410 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 410 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | else { |
| 414 | - $birth_dates[0]=new Date(''); |
|
| 414 | + $birth_dates[0] = new Date(''); |
|
| 415 | 415 | } |
| 416 | 416 | if ($death_dates = $person->getAllDeathDates()) { |
| 417 | 417 | if ( |
| 418 | 418 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
| 419 | 419 | !isset($unique_indis[$person->getXref()]) |
| 420 | 420 | ) { |
| 421 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 421 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | else { |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $this->view_bag->set('sosa_list', $listSosa); |
| 435 | 435 | |
| 436 | 436 | $this->view_bag->set('sosa_count', count($listSosa)); |
| 437 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 437 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
| 438 | 438 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
| 439 | 439 | |
| 440 | 440 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -453,12 +453,12 @@ discard block |
||
| 453 | 453 | */ |
| 454 | 454 | protected function renderFamSosaListIndi(AjaxController $controller) { |
| 455 | 455 | $wt_tree = Globals::getTree(); |
| 456 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 456 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
| 457 | 457 | $this->view_bag->set('has_sosa', false); |
| 458 | 458 | |
| 459 | - if(count($listFamSosa) > 0) { |
|
| 459 | + if (count($listFamSosa) > 0) { |
|
| 460 | 460 | $this->view_bag->set('has_sosa', true); |
| 461 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 461 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
| 462 | 462 | $this->view_bag->set('table_id', $table_id); |
| 463 | 463 | |
| 464 | 464 | $controller |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 469 | 469 | |
| 470 | 470 | jQuery("#'.$table_id.'").dataTable( { |
| 471 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
| 471 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
| 472 | 472 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
| 473 | 473 | jQueryUI: true, |
| 474 | 474 | autoWidth: false, |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | pagingType: "full_numbers" |
| 496 | 496 | }); |
| 497 | 497 | |
| 498 | - jQuery("#' . $table_id . '") |
|
| 498 | + jQuery("#' . $table_id.'") |
|
| 499 | 499 | /* Hide/show parents */ |
| 500 | 500 | .on("click", ".btn-toggle-parents", function() { |
| 501 | 501 | jQuery(this).toggleClass("ui-state-active"); |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | /* Hide/show statistics */ |
| 505 | 505 | .on("click", ".btn-toggle-statistics", function() { |
| 506 | 506 | jQuery(this).toggleClass("ui-state-active"); |
| 507 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
| 507 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
| 508 | 508 | }) |
| 509 | 509 | /* Filter buttons in table header */ |
| 510 | 510 | .on("click", "button[data-filter-column]", function() { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | // De-activate the other buttons in this button group |
| 513 | 513 | btn.siblings().removeClass("ui-state-active"); |
| 514 | 514 | // Apply (or clear) this filter |
| 515 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
| 515 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
| 516 | 516 | if (btn.hasClass("ui-state-active")) { |
| 517 | 517 | btn.removeClass("ui-state-active"); |
| 518 | 518 | col.search("").draw(); |
@@ -532,29 +532,29 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | //-- init chart data |
| 534 | 534 | $marr_by_age = array(); |
| 535 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 535 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 536 | 536 | $marr_by_age[$age] = ''; |
| 537 | 537 | } |
| 538 | 538 | $birt_by_decade = array(); |
| 539 | 539 | $marr_by_decade = array(); |
| 540 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 540 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 541 | 541 | $birt_by_decade[$year] = ''; |
| 542 | 542 | $marr_by_decade[$year] = ''; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 545 | + foreach ($listFamSosa as $sosa => $fid) { |
|
| 546 | 546 | $sfamily = Family::getInstance($fid, $wt_tree); |
| 547 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 547 | + if (!$sfamily || !$sfamily->canShow()) { |
|
| 548 | 548 | unset($listFamSosa[$sosa]); |
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | - $mdate=$sfamily->getMarriageDate(); |
|
| 551 | + $mdate = $sfamily->getMarriageDate(); |
|
| 552 | 552 | |
| 553 | - if( ($husb = $sfamily->getHusband()) && |
|
| 553 | + if (($husb = $sfamily->getHusband()) && |
|
| 554 | 554 | ($hdate = $husb->getBirthDate()) && |
| 555 | 555 | $hdate->isOK() && $mdate->isOK()) { |
| 556 | 556 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
| 557 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 557 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 558 | 558 | } |
| 559 | 559 | $hage = Date::getAge($hdate, $mdate, 0); |
| 560 | 560 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -562,11 +562,11 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - if(($wife = $sfamily->getWife()) && |
|
| 566 | - ($wdate=$wife->getBirthDate()) && |
|
| 565 | + if (($wife = $sfamily->getWife()) && |
|
| 566 | + ($wdate = $wife->getBirthDate()) && |
|
| 567 | 567 | $wdate->isOK() && $mdate->isOK()) { |
| 568 | 568 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
| 569 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 569 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 570 | 570 | } |
| 571 | 571 | $wage = Date::getAge($wdate, $mdate, 0); |
| 572 | 572 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
| 578 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 578 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | $listFamSosa[$sosa] = $sfamily; |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | protected $gedcomrecord; |
| 24 | 24 | |
| 25 | 25 | /** @var bool Is the GedcomRecord sourced (cache) */ |
| 26 | - protected $_issourced=null; |
|
| 26 | + protected $_issourced = null; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Contructor for the decorator |
| 30 | 30 | * |
| 31 | 31 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
| 32 | 32 | */ |
| 33 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
| 33 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
| 34 | 34 | $this->gedcomrecord = $gedcomrecord_in; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
| 41 | 41 | */ |
| 42 | - public function getDerivedRecord(){ |
|
| 42 | + public function getDerivedRecord() { |
|
| 43 | 43 | return $this->gedcomrecord; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
| 71 | 71 | switch ($style) { |
| 72 | 72 | case 10: |
| 73 | - return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
| 73 | + return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
| 74 | 74 | default: |
| 75 | 75 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
| 76 | 76 | } |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @param int $access_level |
| 86 | 86 | * @return boolean |
| 87 | 87 | */ |
| 88 | - public function canDisplayIsSourced($access_level = null){ |
|
| 89 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 90 | - if($access_level === null ) |
|
| 88 | + public function canDisplayIsSourced($access_level = null) { |
|
| 89 | + if (!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 90 | + if ($access_level === null) |
|
| 91 | 91 | $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
| 92 | 92 | |
| 93 | 93 | $global_facts = Globals::getGlobalFacts(); |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @return int Level of sources |
| 109 | 109 | */ |
| 110 | - public function isSourced(){ |
|
| 111 | - if($this->_issourced !== null) return $this->_issourced; |
|
| 112 | - $this->_issourced=-1; |
|
| 110 | + public function isSourced() { |
|
| 111 | + if ($this->_issourced !== null) return $this->_issourced; |
|
| 112 | + $this->_issourced = -1; |
|
| 113 | 113 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
| 114 | - foreach($sourcesfacts as $sourcefact){ |
|
| 115 | - $this->_issourced=max($this->_issourced, 1); |
|
| 116 | - if($sourcefact->getAttribute('_ACT')){ |
|
| 117 | - $this->_issourced=max($this->_issourced, 2); |
|
| 114 | + foreach ($sourcesfacts as $sourcefact) { |
|
| 115 | + $this->_issourced = max($this->_issourced, 1); |
|
| 116 | + if ($sourcefact->getAttribute('_ACT')) { |
|
| 117 | + $this->_issourced = max($this->_issourced, 2); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | return $this->_issourced; |
@@ -126,19 +126,19 @@ discard block |
||
| 126 | 126 | * @param string $eventslist |
| 127 | 127 | * @return int Level of sources |
| 128 | 128 | */ |
| 129 | - public function isFactSourced($eventslist){ |
|
| 130 | - if(empty($eventslist)) return 0; |
|
| 131 | - $isSourced=0; |
|
| 129 | + public function isFactSourced($eventslist) { |
|
| 130 | + if (empty($eventslist)) return 0; |
|
| 131 | + $isSourced = 0; |
|
| 132 | 132 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 133 | - foreach($facts as $fact){ |
|
| 134 | - if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){ |
|
| 133 | + foreach ($facts as $fact) { |
|
| 134 | + if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) { |
|
| 135 | 135 | $dfact = new Fact($fact); |
| 136 | 136 | $tmpIsSourced = $dfact->isSourced(); |
| 137 | - if($tmpIsSourced != 0) { |
|
| 138 | - if($isSourced==0) { |
|
| 139 | - $isSourced = $tmpIsSourced; |
|
| 137 | + if ($tmpIsSourced != 0) { |
|
| 138 | + if ($isSourced == 0) { |
|
| 139 | + $isSourced = $tmpIsSourced; |
|
| 140 | 140 | } |
| 141 | - else{ |
|
| 141 | + else { |
|
| 142 | 142 | $isSourced = max($isSourced, $tmpIsSourced); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | <?php |
| 32 | 32 | /** @var \Fisharebest\Webtrees\Individual $root_indi */ |
| 33 | 33 | $root_indi = $this->data->get('root_indi'); |
| 34 | - if($root_indi !== null && $root_indi->canShowName()) { ?> |
|
| 34 | + if ($root_indi !== null && $root_indi->canShowName()) { ?> |
|
| 35 | 35 | <h4 class="center"><?= I18N::translate('%s: %s', I18N::translate('Root individual'), $root_indi->getFullName()); ?><h4> |
| 36 | 36 | <?php } ?> |
| 37 | 37 | |
| 38 | - <?php if($this->data->get('is_setup')) { |
|
| 38 | + <?php if ($this->data->get('is_setup')) { |
|
| 39 | 39 | $general_stats = $this->data->get('general_stats'); ?> |
| 40 | 40 | <h3><?php echo I18N::translate('General statistics'); ?></h3> |
| 41 | 41 | <div class="maj-table"> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | </div> |
| 58 | 58 | <div class="maj-row"> |
| 59 | 59 | <div class="label"><?php echo I18N::translate('Mean generation time'); ?></div> |
| 60 | - <div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1)); ?></div> |
|
| 60 | + <div class="value"><?php echo I18N::plural('%s year', '%s years', $general_stats['mean_gen_time'], I18N::number($general_stats['mean_gen_time'], 1)); ?></div> |
|
| 61 | 61 | </div> |
| 62 | 62 | </div> |
| 63 | 63 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | </tr> |
| 98 | 98 | </thead> |
| 99 | 99 | <tbody> |
| 100 | - <?php foreach($this->data->get('generation_stats') as $gen => $row) { ?> |
|
| 100 | + <?php foreach ($this->data->get('generation_stats') as $gen => $row) { ?> |
|
| 101 | 101 | <tr class="maj-row"> |
| 102 | 102 | <td class="label"><?php echo I18N::translate('<strong>G%d</strong>', $gen); ?></td> |
| 103 | 103 | <td class="label"><?php echo I18N::translate('%1$s <> %2$s', $row['gen_min_birth'], $row['gen_max_birth']); ?></td> |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | <td class="value"><?php echo I18N::number($row['different']); ?></td> |
| 112 | 112 | <td class="value left percent_container"> |
| 113 | 113 | <div class="percent_frame"> |
| 114 | - <div class="percent_cell" style="width:<?php echo 100*$row['perc_different'] ?>%;"> |
|
| 114 | + <div class="percent_cell" style="width:<?php echo 100 * $row['perc_different'] ?>%;"> |
|
| 115 | 115 | <?php echo I18N::percentage($row['perc_different']); ?> |
| 116 | 116 | </div> |
| 117 | 117 | </div> |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | <tfoot> |
| 125 | 125 | <tr class="maj-row"> |
| 126 | 126 | <td class="label" colspan="13"> |
| 127 | - <?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'),2)); ?> |
|
| 127 | + <?php echo I18N::translate('Generation-equivalent: %s generations', I18N::number($this->data->get('equivalent_gen'), 2)); ?> |
|
| 128 | 128 | </td> |
| 129 | 129 | </tr> |
| 130 | 130 | </tfoot> |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | <?php |
| 135 | 135 | $top10_multi_ancestors = $this->data->get('top10multiancestors'); |
| 136 | - if(count($top10_multi_ancestors) > 0) { ?> |
|
| 136 | + if (count($top10_multi_ancestors) > 0) { ?> |
|
| 137 | 137 | <h3><?= I18N::translate('Most duplicated root Sosa ancestors'); ?></h3> |
| 138 | 138 | <div class="maj-table"> |
| 139 | - <?php foreach($top10_multi_ancestors as $count => $indis) { ?> |
|
| 139 | + <?php foreach ($top10_multi_ancestors as $count => $indis) { ?> |
|
| 140 | 140 | <div class="maj-row"> |
| 141 | 141 | <div class="label"><?= I18N::translate('%s times', I18N::number($count)); ?></div> |
| 142 | 142 | <div class="value"><?php |
| 143 | 143 | echo implode( |
| 144 | 144 | I18N::$list_separator, |
| 145 | 145 | array_map(function(Individual $indi) { |
| 146 | - return '<a href="'. $indi->getHtmlUrl(). '">'. $indi->getFullName() . ' ' . $indi->getSexImage() . '</a>'; |
|
| 146 | + return '<a href="'.$indi->getHtmlUrl().'">'.$indi->getFullName().' '.$indi->getSexImage().'</a>'; |
|
| 147 | 147 | }, $indis) |
| 148 | 148 | ); |
| 149 | 149 | ?></div> |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | <h3><?php echo I18N::translate('Known Sosa ancestors\' family dispersion'); ?></h3> |
| 156 | 156 | <div class="center"> |
| 157 | - <?php echo $this->data->get('chart_img_g2') ?: '' ; ?> |
|
| 158 | - <?php echo $this->data->get('chart_img_g3') ?: '' ; ?> |
|
| 157 | + <?php echo $this->data->get('chart_img_g2') ?: ''; ?> |
|
| 158 | + <?php echo $this->data->get('chart_img_g3') ?: ''; ?> |
|
| 159 | 159 | <!-- <canvas id="chart_ancestors_g2" width="300" height="300"></canvas> --> |
| 160 | 160 | </div> |
| 161 | 161 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $view_bag->set('title', $controller->getPageTitle()); |
| 63 | 63 | $view_bag->set('is_setup', false); |
| 64 | 64 | |
| 65 | - if($this->sosa_provider->isSetup()) { |
|
| 65 | + if ($this->sosa_provider->isSetup()) { |
|
| 66 | 66 | $view_bag->set('is_setup', true); |
| 67 | 67 | |
| 68 | 68 | $view_bag->set('root_indi', $this->sosa_provider->getRootIndi()); |
@@ -83,23 +83,23 @@ discard block |
||
| 83 | 83 | $view_bag->set('missinganc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList@missing&ged='.$wt_tree->getNameUrl().'&gen='); |
| 84 | 84 | $view_bag->set('sosaanc_url', 'module.php?mod='.$this->module->getName().'&mod_action=SosaList&ged='.$wt_tree->getNameUrl().'&gen='); |
| 85 | 85 | |
| 86 | - $gen_theoretical=1; |
|
| 87 | - $total_theoretical=0; |
|
| 88 | - $prev_diff=0; |
|
| 89 | - $prev_known=0.5; |
|
| 90 | - $gen_equiv=0; |
|
| 86 | + $gen_theoretical = 1; |
|
| 87 | + $total_theoretical = 0; |
|
| 88 | + $prev_diff = 0; |
|
| 89 | + $prev_known = 0.5; |
|
| 90 | + $gen_equiv = 0; |
|
| 91 | 91 | $generation_stats = array(); |
| 92 | 92 | |
| 93 | - foreach($stats_gen as $gen => $tab){ |
|
| 94 | - $genY1= I18N::translate('-'); |
|
| 95 | - $genY2= I18N::translate('-'); |
|
| 96 | - if($tab['firstBirth']>0) $genY1=$tab['firstBirth']; |
|
| 97 | - if($tab['lastBirth']>0) $genY2=$tab['lastBirth']; |
|
| 93 | + foreach ($stats_gen as $gen => $tab) { |
|
| 94 | + $genY1 = I18N::translate('-'); |
|
| 95 | + $genY2 = I18N::translate('-'); |
|
| 96 | + if ($tab['firstBirth'] > 0) $genY1 = $tab['firstBirth']; |
|
| 97 | + if ($tab['lastBirth'] > 0) $genY2 = $tab['lastBirth']; |
|
| 98 | 98 | $total_theoretical += $gen_theoretical; |
| 99 | 99 | $perc_sosa_count_theor = Functions::safeDivision($tab['sosaCount'], $gen_theoretical); |
| 100 | 100 | $gen_equiv += $perc_sosa_count_theor; |
| 101 | - $missing=2*$prev_known - $tab['sosaCount']; |
|
| 102 | - $gen_diff=$tab['diffSosaTotalCount']-$prev_diff; |
|
| 101 | + $missing = 2 * $prev_known - $tab['sosaCount']; |
|
| 102 | + $gen_diff = $tab['diffSosaTotalCount'] - $prev_diff; |
|
| 103 | 103 | |
| 104 | 104 | $generation_stats[$gen] = array( |
| 105 | 105 | 'gen_min_birth' => $genY1, |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | 'known' => $tab['sosaCount'], |
| 109 | 109 | 'perc_known' => $perc_sosa_count_theor, |
| 110 | 110 | 'missing' => $missing, |
| 111 | - 'perc_missing' => 1-Functions::safeDivision($tab['sosaCount'], 2*$prev_known), |
|
| 111 | + 'perc_missing' => 1 - Functions::safeDivision($tab['sosaCount'], 2 * $prev_known), |
|
| 112 | 112 | 'total_known' => $tab['sosaTotalCount'], |
| 113 | 113 | 'perc_total_known' => Functions::safeDivision($tab['sosaTotalCount'], $total_theoretical), |
| 114 | 114 | 'different' => $gen_diff, |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | 120 | $gen_theoretical = $gen_theoretical * 2; |
| 121 | - $prev_known=$tab['sosaCount']; |
|
| 122 | - $prev_diff=$tab['diffSosaTotalCount']; |
|
| 121 | + $prev_known = $tab['sosaCount']; |
|
| 122 | + $prev_diff = $tab['diffSosaTotalCount']; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $view_bag->set('generation_stats', $generation_stats); |
@@ -127,13 +127,12 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $top10multiancestors = $this->sosa_provider->getTopMultiSosaAncestorsNoTies(10); |
| 129 | 129 | $top10ancestors = array(); |
| 130 | - if($top10multiancestors !== null && count($top10multiancestors)) { |
|
| 131 | - foreach($top10multiancestors as $pid => $count) { |
|
| 130 | + if ($top10multiancestors !== null && count($top10multiancestors)) { |
|
| 131 | + foreach ($top10multiancestors as $pid => $count) { |
|
| 132 | 132 | $indi = Individual::getInstance($pid, $wt_tree); |
| 133 | - if($indi !== null && $indi->canShowName()) { |
|
| 133 | + if ($indi !== null && $indi->canShowName()) { |
|
| 134 | 134 | array_key_exists($count, $top10ancestors) ? |
| 135 | - $top10ancestors[$count][] = $indi: |
|
| 136 | - $top10ancestors[$count] = array($count => $indi); |
|
| 135 | + $top10ancestors[$count][] = $indi : $top10ancestors[$count] = array($count => $indi); |
|
| 137 | 136 | } |
| 138 | 137 | } |
| 139 | 138 | } |
@@ -154,27 +153,27 @@ discard block |
||
| 154 | 153 | private function htmlAncestorDispersionG2() |
| 155 | 154 | { |
| 156 | 155 | $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(2); |
| 157 | - if(count($ancestorsDispGen2) == 0) return; |
|
| 156 | + if (count($ancestorsDispGen2) == 0) return; |
|
| 158 | 157 | |
| 159 | 158 | $size = '600x300'; |
| 160 | 159 | |
| 161 | 160 | $total = array_sum($ancestorsDispGen2); |
| 162 | 161 | $father_count = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0; |
| 163 | - $father = array ( |
|
| 162 | + $father = array( |
|
| 164 | 163 | 'color' => '84beff', |
| 165 | 164 | 'count' => $father_count, |
| 166 | 165 | 'perc' => Functions::safeDivision($father_count, $total), |
| 167 | 166 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fat') |
| 168 | 167 | ); |
| 169 | 168 | $mother_count = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0; |
| 170 | - $mother = array ( |
|
| 169 | + $mother = array( |
|
| 171 | 170 | 'color' => 'ffd1dc', |
| 172 | 171 | 'count' => $mother_count, |
| 173 | 172 | 'perc' => Functions::safeDivision($mother_count, $total), |
| 174 | 173 | 'name' => \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('mot') |
| 175 | 174 | ); |
| 176 | 175 | $shared_count = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
| 177 | - $shared = array ( |
|
| 176 | + $shared = array( |
|
| 178 | 177 | 'color' => '777777', |
| 179 | 178 | 'count' => $shared_count, |
| 180 | 179 | 'perc' => Functions::safeDivision($shared_count, $total), |
@@ -184,10 +183,10 @@ discard block |
||
| 184 | 183 | $chd = $this->arrayToExtendedEncoding(array(4095 * $father['perc'], 4095 * $shared['perc'], 4095 * $mother['perc'])); |
| 185 | 184 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion'); |
| 186 | 185 | $chl = |
| 187 | - $father['name'] . ' - ' . I18N::percentage($father['perc'], 1) . '|' . |
|
| 188 | - $shared['name'] . ' - ' . I18N::percentage($shared['perc'], 1) . '|' . |
|
| 189 | - $mother['name'] . ' - ' . I18N::percentage($mother['perc'], 1); |
|
| 190 | - 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 . "\" />"; |
|
| 186 | + $father['name'].' - '.I18N::percentage($father['perc'], 1).'|'. |
|
| 187 | + $shared['name'].' - '.I18N::percentage($shared['perc'], 1).'|'. |
|
| 188 | + $mother['name'].' - '.I18N::percentage($mother['perc'], 1); |
|
| 189 | + 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."\" />"; |
|
| 191 | 190 | } |
| 192 | 191 | |
| 193 | 192 | /** |
@@ -211,7 +210,7 @@ discard block |
||
| 211 | 210 | $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0; |
| 212 | 211 | $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0; |
| 213 | 212 | $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0; |
| 214 | - $total = $total_fatfat + $total_fatmot + $total_motfat+ $total_motmot + $total_sha; |
|
| 213 | + $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha; |
|
| 215 | 214 | |
| 216 | 215 | $chd = $this->arrayToExtendedEncoding(array( |
| 217 | 216 | 4095 * Functions::safeDivision($total_fatfat, $total), |
@@ -222,12 +221,12 @@ discard block |
||
| 222 | 221 | )); |
| 223 | 222 | $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3'); |
| 224 | 223 | $chl = |
| 225 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . |
|
| 226 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . |
|
| 227 | - I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . |
|
| 228 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . |
|
| 229 | - \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
| 230 | - 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 . "\" />"; |
|
| 224 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat').' - '.I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1).'|'. |
|
| 225 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot').' - '.I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1).'|'. |
|
| 226 | + I18N::translate('Shared').' - '.I18N::percentage(Functions::safeDivision($total_sha, $total), 1).'|'. |
|
| 227 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat').' - '.I18N::percentage(Functions::safeDivision($total_motfat, $total), 1).'|'. |
|
| 228 | + \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot').' - '.I18N::percentage(Functions::safeDivision($total_motmot, $total), 1); |
|
| 229 | + 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."\" />"; |
|
| 231 | 230 | } |
| 232 | 231 | |
| 233 | 232 | /** |
@@ -243,9 +242,9 @@ discard block |
||
| 243 | 242 | if ($value < 0) { |
| 244 | 243 | $value = 0; |
| 245 | 244 | } |
| 246 | - $first = (int) ($value / 64); |
|
| 245 | + $first = (int)($value / 64); |
|
| 247 | 246 | $second = $value % 64; |
| 248 | - $encoding .= $xencoding[(int) $first] . $xencoding[(int) $second]; |
|
| 247 | + $encoding .= $xencoding[(int)$first].$xencoding[(int)$second]; |
|
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | return $encoding; |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $text Text to display |
| 34 | 34 | */ |
| 35 | - static public function promptAlert($text){ |
|
| 35 | + static public function promptAlert($text) { |
|
| 36 | 36 | echo '<script>'; |
| 37 | - echo 'alert("',fw\Filter::escapeHtml($text),'")'; |
|
| 37 | + echo 'alert("', fw\Filter::escapeHtml($text), '")'; |
|
| 38 | 38 | echo '</script>'; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return float Result of the safe division |
| 48 | 48 | */ |
| 49 | 49 | public static function safeDivision($num, $denom, $default = 0) { |
| 50 | - if($denom && $denom!=0){ |
|
| 50 | + if ($denom && $denom != 0) { |
|
| 51 | 51 | return $num / $denom; |
| 52 | 52 | } |
| 53 | 53 | return $default; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @param float $default Default value if denominator null or 0 |
| 62 | 62 | * @return float Percentage |
| 63 | 63 | */ |
| 64 | - public static function getPercentage($num, $denom, $default = 0){ |
|
| 64 | + public static function getPercentage($num, $denom, $default = 0) { |
|
| 65 | 65 | return 100 * self::safeDivision($num, $denom, $default); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @param int $target The final max width/height |
| 73 | 73 | * @return array array of ($width, $height). One of them must be $target |
| 74 | 74 | */ |
| 75 | - static public function getResizedImageSize($file, $target=25){ |
|
| 76 | - list($width, $height, , ) = getimagesize($file); |
|
| 75 | + static public function getResizedImageSize($file, $target = 25) { |
|
| 76 | + list($width, $height,,) = getimagesize($file); |
|
| 77 | 77 | $max = max($width, $height); |
| 78 | 78 | $rapp = $target / $max; |
| 79 | 79 | $width = intval($rapp * $width); |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | * @param int $length Length of the token, default to 32 |
| 104 | 104 | * @return string Random token |
| 105 | 105 | */ |
| 106 | - public static function generateRandomToken($length=32) { |
|
| 106 | + public static function generateRandomToken($length = 32) { |
|
| 107 | 107 | $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
| 108 | 108 | $len_chars = count($chars); |
| 109 | 109 | $token = ''; |
| 110 | 110 | |
| 111 | 111 | for ($i = 0; $i < $length; $i++) |
| 112 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
| 112 | + $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
| 113 | 113 | |
| 114 | 114 | # Number of 32 char chunks |
| 115 | - $chunks = ceil( strlen($token) / 32 ); |
|
| 115 | + $chunks = ceil(strlen($token) / 32); |
|
| 116 | 116 | $md5token = ''; |
| 117 | 117 | |
| 118 | 118 | # Run each chunk through md5 |
| 119 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
| 120 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
| 119 | + for ($i = 1; $i <= $chunks; $i++) |
|
| 120 | + $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
| 121 | 121 | |
| 122 | 122 | # Trim the token |
| 123 | 123 | return substr($md5token, 0, $length); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | protected static function getBase64EncryptionKey() { |
| 132 | 132 | $key = 'STANDARDKEYIFNOSERVER'; |
| 133 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
| 133 | + if (!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
| 134 | 134 | $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
| 135 | 135 | |
| 136 | 136 | return $key; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param string $data Text to encrypt |
| 144 | 144 | * @return string Encrypted and encoded text |
| 145 | 145 | */ |
| 146 | - public static function encryptToSafeBase64($data){ |
|
| 146 | + public static function encryptToSafeBase64($data) { |
|
| 147 | 147 | $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 148 | 148 | $id = sodium_crypto_secretbox($data, $nonce, self::getBase64EncryptionKey()); |
| 149 | 149 | $encrypted = base64_encode($nonce.$id); |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | * @param string $encrypted Text to decrypt |
| 164 | 164 | * @return string Decrypted text |
| 165 | 165 | */ |
| 166 | - public static function decryptFromSafeBase64($encrypted){ |
|
| 166 | + public static function decryptFromSafeBase64($encrypted) { |
|
| 167 | 167 | $encrypted = str_replace('-', '+', $encrypted); |
| 168 | 168 | $encrypted = str_replace('_', '/', $encrypted); |
| 169 | 169 | $encrypted = str_replace('*', '=', $encrypted); |
| 170 | 170 | $encrypted = base64_decode($encrypted); |
| 171 | - if($encrypted === false) |
|
| 171 | + if ($encrypted === false) |
|
| 172 | 172 | throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
| 173 | 173 | |
| 174 | 174 | if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey()); |
| 181 | 181 | |
| 182 | - if($decrypted === false) { |
|
| 182 | + if ($decrypted === false) { |
|
| 183 | 183 | throw new \InvalidArgumentException('The message has been tampered with in transit.'); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | * @param string $string Filesystem encoded string to encode |
| 195 | 195 | * @return string UTF-8 encoded string |
| 196 | 196 | */ |
| 197 | - public static function encodeFileSystemToUtf8($string){ |
|
| 197 | + public static function encodeFileSystemToUtf8($string) { |
|
| 198 | 198 | if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
| 199 | - return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
| 199 | + return iconv('cp1252', 'utf-8//IGNORE', $string); |
|
| 200 | 200 | } |
| 201 | 201 | return $string; |
| 202 | 202 | } |
@@ -207,9 +207,9 @@ discard block |
||
| 207 | 207 | * @param string $string UTF-8 encoded string to encode |
| 208 | 208 | * @return string Filesystem encoded string |
| 209 | 209 | */ |
| 210 | - public static function encodeUtf8ToFileSystem($string){ |
|
| 210 | + public static function encodeUtf8ToFileSystem($string) { |
|
| 211 | 211 | if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
| 212 | - return iconv('utf-8', 'cp1252//IGNORE' , $string); |
|
| 212 | + return iconv('utf-8', 'cp1252//IGNORE', $string); |
|
| 213 | 213 | } |
| 214 | 214 | return $string; |
| 215 | 215 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return boolean True if path valid |
| 223 | 223 | */ |
| 224 | 224 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
| 225 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
| 225 | + if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @return array Array of month short names |
| 235 | 235 | */ |
| 236 | 236 | public static function getCalendarShortMonths($calendarId = 0) { |
| 237 | - if(!isset(self::$calendarShortMonths[$calendarId])) { |
|
| 237 | + if (!isset(self::$calendarShortMonths[$calendarId])) { |
|
| 238 | 238 | $calendar_info = cal_info($calendarId); |
| 239 | 239 | self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths']; |
| 240 | 240 | } |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | * @param int $sosa Sosa number |
| 248 | 248 | * @return number |
| 249 | 249 | */ |
| 250 | - public static function getGeneration($sosa){ |
|
| 251 | - return(int)log($sosa, 2)+1; |
|
| 250 | + public static function getGeneration($sosa) { |
|
| 251 | + return(int)log($sosa, 2) + 1; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() |
| 26 | 26 | */ |
| 27 | 27 | public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { |
| 28 | - if(!$place->isEmpty()) { |
|
| 29 | - $parent = array_reverse(explode (',', $place->getGedcomName())); |
|
| 28 | + if (!$place->isEmpty()) { |
|
| 29 | + $parent = array_reverse(explode(',', $place->getGedcomName())); |
|
| 30 | 30 | $place_id = 0; |
| 31 | 31 | $nb_levels = count($parent); |
| 32 | - for ($i=0; $i < $nb_levels; $i++) { |
|
| 32 | + for ($i = 0; $i < $nb_levels; $i++) { |
|
| 33 | 33 | $parent[$i] = trim($parent[$i]); |
| 34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 35 | - $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
| 34 | + if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 35 | + $pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
| 36 | 36 | ->execute(array($i, $place_id, $parent[$i])) |
| 37 | 37 | ->fetchOne(); |
| 38 | 38 | if (empty($pl_id)) break; |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon() |
| 49 | 49 | */ |
| 50 | 50 | public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) { |
| 51 | - if(!$place->isEmpty()){ |
|
| 51 | + if (!$place->isEmpty()) { |
|
| 52 | 52 | $place_details = |
| 53 | 53 | Database::prepare('SELECT pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place') |
| 54 | 54 | ->execute(array($this->getProviderPlaceId($place))) |
| 55 | 55 | ->fetchOneRow(); |
| 56 | - if($place_details){ |
|
| 56 | + if ($place_details) { |
|
| 57 | 57 | return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks() |
| 72 | 72 | */ |
| 73 | 73 | public function getPossibleHooks() { |
| 74 | - static $hooks=null; |
|
| 74 | + static $hooks = null; |
|
| 75 | 75 | if ($hooks === null) { |
| 76 | 76 | $hooks = array(); |
| 77 | 77 | |
@@ -83,31 +83,31 @@ discard block |
||
| 83 | 83 | 'SELECT module_name FROM `##module`' |
| 84 | 84 | )->fetchOneColumn(); |
| 85 | 85 | |
| 86 | - foreach($module_names as $module_name) { |
|
| 86 | + foreach ($module_names as $module_name) { |
|
| 87 | 87 | $module = Module::getModuleByName($module_name); |
| 88 | 88 | |
| 89 | - if($module instanceof HookSubscriberInterface){ |
|
| 89 | + if ($module instanceof HookSubscriberInterface) { |
|
| 90 | 90 | $subscribedhooks = $module->getSubscribedHooks(); |
| 91 | - if(is_array($subscribedhooks)){ |
|
| 92 | - foreach($subscribedhooks as $key => $value){ |
|
| 93 | - if(is_int($key)) { |
|
| 91 | + if (is_array($subscribedhooks)) { |
|
| 92 | + foreach ($subscribedhooks as $key => $value) { |
|
| 93 | + if (is_int($key)) { |
|
| 94 | 94 | $hook_item = $value; |
| 95 | 95 | $priority = self::DEFAULT_PRIORITY; |
| 96 | 96 | } |
| 97 | - else{ |
|
| 97 | + else { |
|
| 98 | 98 | $hook_item = explode('#', $key, 2); |
| 99 | 99 | $priority = $value; |
| 100 | 100 | } |
| 101 | - if($hook_item && count($hook_item) == 2){ |
|
| 101 | + if ($hook_item && count($hook_item) == 2) { |
|
| 102 | 102 | $hook_func = $hook_item[0]; |
| 103 | 103 | $hook_cont = $hook_item[1]; |
| 104 | 104 | } |
| 105 | - else{ |
|
| 105 | + else { |
|
| 106 | 106 | $hook_func = $hook_item[0]; |
| 107 | 107 | $hook_cont = 'all'; |
| 108 | 108 | } |
| 109 | - if(method_exists($module, $hook_func)){ |
|
| 110 | - $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority; |
|
| 109 | + if (method_exists($module, $hook_func)) { |
|
| 110 | + $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * {@inheritDoc} |
| 122 | 122 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks() |
| 123 | 123 | */ |
| 124 | - public function getRawInstalledHooks(){ |
|
| 125 | - if(self::isModuleOperational()){ |
|
| 124 | + public function getRawInstalledHooks() { |
|
| 125 | + if (self::isModuleOperational()) { |
|
| 126 | 126 | return Database::prepare( |
| 127 | 127 | "SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority, majh_status AS status". |
| 128 | 128 | " FROM `##maj_hooks`". |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | * {@inheritDoc} |
| 137 | 137 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks() |
| 138 | 138 | */ |
| 139 | - public function getInstalledHooks(){ |
|
| 140 | - static $installedhooks =null; |
|
| 141 | - if($installedhooks===null){ |
|
| 142 | - $dbhooks=self::getRawInstalledHooks(); |
|
| 143 | - foreach($dbhooks as $dbhook){ |
|
| 139 | + public function getInstalledHooks() { |
|
| 140 | + static $installedhooks = null; |
|
| 141 | + if ($installedhooks === null) { |
|
| 142 | + $dbhooks = self::getRawInstalledHooks(); |
|
| 143 | + foreach ($dbhooks as $dbhook) { |
|
| 144 | 144 | $installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -153,15 +153,15 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function updateHooks() { |
| 155 | 155 | |
| 156 | - if(Auth::isAdmin()){ |
|
| 156 | + if (Auth::isAdmin()) { |
|
| 157 | 157 | $ihooks = self::getInstalledHooks(); |
| 158 | 158 | $phooks = self::getPossibleHooks(); |
| 159 | 159 | |
| 160 | 160 | // Insert hooks not existing yet in the DB |
| 161 | - if($phooks !== null){ |
|
| 162 | - foreach($phooks as $phook => $priority){ |
|
| 161 | + if ($phooks !== null) { |
|
| 162 | + foreach ($phooks as $phook => $priority) { |
|
| 163 | 163 | $array_hook = explode('#', $phook); |
| 164 | - if($ihooks === null || !array_key_exists($phook, $ihooks)){ |
|
| 164 | + if ($ihooks === null || !array_key_exists($phook, $ihooks)) { |
|
| 165 | 165 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 166 | 166 | $chook->subscribe($array_hook[0]); |
| 167 | 167 | $chook->setPriority($array_hook[0], $priority); |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | //Remove hooks not existing any more in the file system |
| 173 | - if($ihooks !== null){ |
|
| 174 | - foreach(array_keys($ihooks) as $ihook){ |
|
| 173 | + if ($ihooks !== null) { |
|
| 174 | + foreach (array_keys($ihooks) as $ihook) { |
|
| 175 | 175 | $array_hook = explode('#', $ihook); |
| 176 | - if($phooks === null || !array_key_exists($ihook, $phooks)){ |
|
| 176 | + if ($phooks === null || !array_key_exists($ihook, $phooks)) { |
|
| 177 | 177 | $chook = new Hook($array_hook[1], $array_hook[2]); |
| 178 | 178 | $chook->remove($array_hook[0]); |
| 179 | 179 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @return string |
| 164 | 164 | */ |
| 165 | 165 | public function getHtmlUrl() { |
| 166 | - return 'module.php?mod='. Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl(); |
|
| 166 | + return 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&mod_action=GeoAnalysis&ga_id='.$this->getId().'&ged='.$this->tree->getNameUrl(); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -186,53 +186,53 @@ discard block |
||
| 186 | 186 | $placesDispGeneral = null; |
| 187 | 187 | $placesDispGenerations = null; |
| 188 | 188 | |
| 189 | - if($sosalist && count($sosalist) > 0) { |
|
| 189 | + if ($sosalist && count($sosalist) > 0) { |
|
| 190 | 190 | $placesDispGeneral['knownsum'] = 0; |
| 191 | 191 | $placesDispGeneral['unknown'] = 0; |
| 192 | 192 | $placesDispGeneral['max'] = 0; |
| 193 | 193 | $placesDispGeneral['places'] = array(); |
| 194 | - foreach($sosalist as $sosaid => $gens) { |
|
| 194 | + foreach ($sosalist as $sosaid => $gens) { |
|
| 195 | 195 | $sosa = Individual::getIntance($sosaid, $this->tree); |
| 196 | - $place =$sosa->getSignificantPlace(); |
|
| 196 | + $place = $sosa->getSignificantPlace(); |
|
| 197 | 197 | $genstab = explode(',', $gens); |
| 198 | - $isUnknown=true; |
|
| 199 | - if($sosa->getDerivedRecord()->canShow() && !is_null($place)){ |
|
| 200 | - $levels = array_reverse(array_map('trim',explode(',', $place))); |
|
| 201 | - if(count($levels)>= $this->analysis_level){ |
|
| 198 | + $isUnknown = true; |
|
| 199 | + if ($sosa->getDerivedRecord()->canShow() && !is_null($place)) { |
|
| 200 | + $levels = array_reverse(array_map('trim', explode(',', $place))); |
|
| 201 | + if (count($levels) >= $this->analysis_level) { |
|
| 202 | 202 | $toplevelvalues = array(); |
| 203 | - if($this->hasMap() |
|
| 203 | + if ($this->hasMap() |
|
| 204 | 204 | && $this->options->getMap()->isLoaded() |
| 205 | 205 | && $toplevelvalue = $this->options->getMap()->getTopLevelName() |
| 206 | 206 | ) { |
| 207 | - $toplevelvalues = array_map('trim',explode(',', strtolower($toplevelvalue))); |
|
| 207 | + $toplevelvalues = array_map('trim', explode(',', strtolower($toplevelvalue))); |
|
| 208 | 208 | } |
| 209 | - if(!$this->hasMap() |
|
| 209 | + if (!$this->hasMap() |
|
| 210 | 210 | || is_null($this->options->getMapLevel()) |
| 211 | - || ( $this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') |
|
| 211 | + || ($this->options->getMap()->isLoaded() && $this->options->getMap()->getTopLevelName() == '*') |
|
| 212 | 212 | || ( |
| 213 | 213 | $this->options->getMapLevel() <= $this->analysis_level |
| 214 | 214 | && $this->options->getMapLevel() > 0 |
| 215 | 215 | && count($levels) >= $this->options->getMapLevel() |
| 216 | - && in_array(strtolower($levels[$this->options->getMapLevel()-1]), $toplevelvalues) |
|
| 216 | + && in_array(strtolower($levels[$this->options->getMapLevel() - 1]), $toplevelvalues) |
|
| 217 | 217 | ) |
| 218 | 218 | ) { |
| 219 | 219 | $placest = implode(I18N::$list_separator, array_slice($levels, 0, $this->analysis_level)); |
| 220 | - if(isset($placesDispGeneral['places'][$placest])) { |
|
| 220 | + if (isset($placesDispGeneral['places'][$placest])) { |
|
| 221 | 221 | $placesDispGeneral['places'][$placest] += 1; |
| 222 | 222 | } |
| 223 | 223 | else { |
| 224 | 224 | $placesDispGeneral['places'][$placest] = 1; |
| 225 | 225 | } |
| 226 | - if($placesDispGeneral['places'][$placest]>$placesDispGeneral['max']) |
|
| 226 | + if ($placesDispGeneral['places'][$placest] > $placesDispGeneral['max']) |
|
| 227 | 227 | $placesDispGeneral['max'] = $placesDispGeneral['places'][$placest]; |
| 228 | - foreach($genstab as $gen) { |
|
| 229 | - if(isset($placesDispGenerations[$gen]['places'][$placest])) { |
|
| 228 | + foreach ($genstab as $gen) { |
|
| 229 | + if (isset($placesDispGenerations[$gen]['places'][$placest])) { |
|
| 230 | 230 | $placesDispGenerations[$gen]['places'][$placest] += 1; |
| 231 | 231 | } |
| 232 | 232 | else { |
| 233 | 233 | $placesDispGenerations[$gen]['places'][$placest] = 1; |
| 234 | 234 | } |
| 235 | - if(isset($placesDispGenerations[$gen]['sum'])) { |
|
| 235 | + if (isset($placesDispGenerations[$gen]['sum'])) { |
|
| 236 | 236 | $placesDispGenerations[$gen]['sum'] += 1; |
| 237 | 237 | } |
| 238 | 238 | else { |
@@ -240,15 +240,15 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | - else{ |
|
| 244 | - if(isset($placesDispGeneral['other'])) { |
|
| 243 | + else { |
|
| 244 | + if (isset($placesDispGeneral['other'])) { |
|
| 245 | 245 | $placesDispGeneral['other'] += 1; |
| 246 | 246 | } |
| 247 | 247 | else { |
| 248 | 248 | $placesDispGeneral['other'] = 1; |
| 249 | 249 | } |
| 250 | - foreach($genstab as $gen) { |
|
| 251 | - if(isset($placesDispGenerations[$gen]['other'])) { |
|
| 250 | + foreach ($genstab as $gen) { |
|
| 251 | + if (isset($placesDispGenerations[$gen]['other'])) { |
|
| 252 | 252 | $placesDispGenerations[$gen]['other'] += 1; |
| 253 | 253 | } |
| 254 | 254 | else { |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | $isUnknown = false; |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | - if($isUnknown){ |
|
| 263 | + if ($isUnknown) { |
|
| 264 | 264 | $placesDispGeneral['unknown'] += 1; |
| 265 | - foreach($genstab as $gen) { |
|
| 266 | - if(isset($placesDispGenerations[$gen]['unknown'])) { |
|
| 265 | + foreach ($genstab as $gen) { |
|
| 266 | + if (isset($placesDispGenerations[$gen]['unknown'])) { |
|
| 267 | 267 | $placesDispGenerations[$gen]['unknown'] += 1; |
| 268 | 268 | } |
| 269 | 269 | else { |