@@ -303,22 +303,22 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function getPercentage($total, $type) { |
305 | 305 | switch ($type) { |
306 | - case 'individual': |
|
307 | - $type = $this->totalIndividualsQuery(); |
|
308 | - break; |
|
309 | - case 'family': |
|
310 | - $type = $this->totalFamiliesQuery(); |
|
311 | - break; |
|
312 | - case 'source': |
|
313 | - $type = $this->totalSourcesQuery(); |
|
314 | - break; |
|
315 | - case 'note': |
|
316 | - $type = $this->totalNotesQuery(); |
|
317 | - break; |
|
318 | - case 'all': |
|
319 | - default: |
|
320 | - $type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery(); |
|
321 | - break; |
|
306 | + case 'individual': |
|
307 | + $type = $this->totalIndividualsQuery(); |
|
308 | + break; |
|
309 | + case 'family': |
|
310 | + $type = $this->totalFamiliesQuery(); |
|
311 | + break; |
|
312 | + case 'source': |
|
313 | + $type = $this->totalSourcesQuery(); |
|
314 | + break; |
|
315 | + case 'note': |
|
316 | + $type = $this->totalNotesQuery(); |
|
317 | + break; |
|
318 | + case 'all': |
|
319 | + default: |
|
320 | + $type = $this->totalIndividualsQuery() + $this->totalFamiliesQuery() + $this->totalSourcesQuery(); |
|
321 | + break; |
|
322 | 322 | } |
323 | 323 | if ($type == 0) { |
324 | 324 | return I18N::percentage(0, 1); |
@@ -1444,29 +1444,29 @@ discard block |
||
1444 | 1444 | $row = $rows[0]; |
1445 | 1445 | $record = GedcomRecord::getInstance($row['d_gid'], $this->tree); |
1446 | 1446 | switch ($type) { |
1447 | - default: |
|
1448 | - case 'full': |
|
1449 | - if ($record->canShow()) { |
|
1450 | - $result = $record->formatList('span', false, $record->getFullName()); |
|
1451 | - } else { |
|
1452 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
1453 | - } |
|
1454 | - break; |
|
1455 | - case 'year': |
|
1456 | - $date = new Date($row['d_type'] . ' ' . $row['d_year']); |
|
1457 | - $result = $date->display(); |
|
1458 | - break; |
|
1459 | - case 'name': |
|
1460 | - $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
1461 | - break; |
|
1462 | - case 'place': |
|
1463 | - $fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']); |
|
1464 | - if ($fact) { |
|
1465 | - $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
1466 | - } else { |
|
1467 | - $result = I18N::translate('Private'); |
|
1468 | - } |
|
1469 | - break; |
|
1447 | + default: |
|
1448 | + case 'full': |
|
1449 | + if ($record->canShow()) { |
|
1450 | + $result = $record->formatList('span', false, $record->getFullName()); |
|
1451 | + } else { |
|
1452 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
1453 | + } |
|
1454 | + break; |
|
1455 | + case 'year': |
|
1456 | + $date = new Date($row['d_type'] . ' ' . $row['d_year']); |
|
1457 | + $result = $date->display(); |
|
1458 | + break; |
|
1459 | + case 'name': |
|
1460 | + $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
1461 | + break; |
|
1462 | + case 'place': |
|
1463 | + $fact = GedcomRecord::getInstance($row['d_gid'], $this->tree)->getFirstFact($row['d_fact']); |
|
1464 | + if ($fact) { |
|
1465 | + $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
1466 | + } else { |
|
1467 | + $result = I18N::translate('Private'); |
|
1468 | + } |
|
1469 | + break; |
|
1470 | 1470 | } |
1471 | 1471 | |
1472 | 1472 | return $result; |
@@ -1631,96 +1631,96 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | I18N::init(WT_LOCALE); |
1633 | 1633 | switch ($chart_type) { |
1634 | - case 'surname_distribution_chart': |
|
1635 | - if ($surname == "") { |
|
1636 | - $surname = $this->getCommonSurname(); |
|
1637 | - } |
|
1638 | - $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname; |
|
1639 | - // Count how many people are events in each country |
|
1640 | - $surn_countries = array(); |
|
1641 | - $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); |
|
1642 | - foreach ($indis as $person) { |
|
1643 | - if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) { |
|
1644 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1645 | - foreach ($matches[1] as $country) { |
|
1646 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1647 | - if (array_key_exists($country_to_iso3166[$country], $surn_countries)) { |
|
1648 | - $surn_countries[$country_to_iso3166[$country]]++; |
|
1649 | - } else { |
|
1650 | - $surn_countries[$country_to_iso3166[$country]] = 1; |
|
1634 | + case 'surname_distribution_chart': |
|
1635 | + if ($surname == "") { |
|
1636 | + $surname = $this->getCommonSurname(); |
|
1637 | + } |
|
1638 | + $chart_title = I18N::translate('Surname distribution chart') . ': ' . $surname; |
|
1639 | + // Count how many people are events in each country |
|
1640 | + $surn_countries = array(); |
|
1641 | + $indis = QueryName::individuals($this->tree, I18N::strtoupper($surname), '', '', false, false); |
|
1642 | + foreach ($indis as $person) { |
|
1643 | + if (preg_match_all('/^2 PLAC (?:.*, *)*(.*)/m', $person->getGedcom(), $matches)) { |
|
1644 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1645 | + foreach ($matches[1] as $country) { |
|
1646 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1647 | + if (array_key_exists($country_to_iso3166[$country], $surn_countries)) { |
|
1648 | + $surn_countries[$country_to_iso3166[$country]]++; |
|
1649 | + } else { |
|
1650 | + $surn_countries[$country_to_iso3166[$country]] = 1; |
|
1651 | + } |
|
1651 | 1652 | } |
1652 | 1653 | } |
1653 | 1654 | } |
1654 | - } |
|
1655 | - }; |
|
1656 | - break; |
|
1657 | - case 'birth_distribution_chart': |
|
1658 | - $chart_title = I18N::translate('Birth by country'); |
|
1659 | - // Count how many people were born in each country |
|
1660 | - $surn_countries = array(); |
|
1661 | - $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); |
|
1662 | - foreach ($b_countries as $place => $count) { |
|
1663 | - $country = $place; |
|
1664 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1665 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1666 | - $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1667 | - } else { |
|
1668 | - $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1655 | + }; |
|
1656 | + break; |
|
1657 | + case 'birth_distribution_chart': |
|
1658 | + $chart_title = I18N::translate('Birth by country'); |
|
1659 | + // Count how many people were born in each country |
|
1660 | + $surn_countries = array(); |
|
1661 | + $b_countries = $this->statsPlaces('INDI', 'BIRT', 0, true); |
|
1662 | + foreach ($b_countries as $place => $count) { |
|
1663 | + $country = $place; |
|
1664 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1665 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1666 | + $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1667 | + } else { |
|
1668 | + $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1669 | + } |
|
1669 | 1670 | } |
1670 | 1671 | } |
1671 | - } |
|
1672 | - break; |
|
1673 | - case 'death_distribution_chart': |
|
1674 | - $chart_title = I18N::translate('Death by country'); |
|
1675 | - // Count how many people were death in each country |
|
1676 | - $surn_countries = array(); |
|
1677 | - $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); |
|
1678 | - foreach ($d_countries as $place => $count) { |
|
1679 | - $country = $place; |
|
1680 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1681 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1682 | - $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1683 | - } else { |
|
1684 | - $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1672 | + break; |
|
1673 | + case 'death_distribution_chart': |
|
1674 | + $chart_title = I18N::translate('Death by country'); |
|
1675 | + // Count how many people were death in each country |
|
1676 | + $surn_countries = array(); |
|
1677 | + $d_countries = $this->statsPlaces('INDI', 'DEAT', 0, true); |
|
1678 | + foreach ($d_countries as $place => $count) { |
|
1679 | + $country = $place; |
|
1680 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1681 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1682 | + $surn_countries[$country_to_iso3166[$country]] = $count; |
|
1683 | + } else { |
|
1684 | + $surn_countries[$country_to_iso3166[$country]] += $count; |
|
1685 | + } |
|
1685 | 1686 | } |
1686 | 1687 | } |
1687 | - } |
|
1688 | - break; |
|
1689 | - case 'marriage_distribution_chart': |
|
1690 | - $chart_title = I18N::translate('Marriage by country'); |
|
1691 | - // Count how many families got marriage in each country |
|
1692 | - $surn_countries = array(); |
|
1693 | - $m_countries = $this->statsPlaces('FAM'); |
|
1694 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1695 | - foreach ($m_countries as $place) { |
|
1696 | - $country = $place['country']; |
|
1697 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1698 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1699 | - $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1700 | - } else { |
|
1701 | - $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1688 | + break; |
|
1689 | + case 'marriage_distribution_chart': |
|
1690 | + $chart_title = I18N::translate('Marriage by country'); |
|
1691 | + // Count how many families got marriage in each country |
|
1692 | + $surn_countries = array(); |
|
1693 | + $m_countries = $this->statsPlaces('FAM'); |
|
1694 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1695 | + foreach ($m_countries as $place) { |
|
1696 | + $country = $place['country']; |
|
1697 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1698 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1699 | + $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1700 | + } else { |
|
1701 | + $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1702 | + } |
|
1702 | 1703 | } |
1703 | 1704 | } |
1704 | - } |
|
1705 | - break; |
|
1706 | - case 'indi_distribution_chart': |
|
1707 | - default: |
|
1708 | - $chart_title = I18N::translate('Individual distribution chart'); |
|
1709 | - // Count how many people have events in each country |
|
1710 | - $surn_countries = array(); |
|
1711 | - $a_countries = $this->statsPlaces('INDI'); |
|
1712 | - // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1713 | - foreach ($a_countries as $place) { |
|
1714 | - $country = $place['country']; |
|
1715 | - if (array_key_exists($country, $country_to_iso3166)) { |
|
1716 | - if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1717 | - $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1718 | - } else { |
|
1719 | - $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1705 | + break; |
|
1706 | + case 'indi_distribution_chart': |
|
1707 | + default: |
|
1708 | + $chart_title = I18N::translate('Individual distribution chart'); |
|
1709 | + // Count how many people have events in each country |
|
1710 | + $surn_countries = array(); |
|
1711 | + $a_countries = $this->statsPlaces('INDI'); |
|
1712 | + // webtrees uses 3 letter country codes and localised country names, but google uses 2 letter codes. |
|
1713 | + foreach ($a_countries as $place) { |
|
1714 | + $country = $place['country']; |
|
1715 | + if (array_key_exists($country, $country_to_iso3166)) { |
|
1716 | + if (!isset($surn_countries[$country_to_iso3166[$country]])) { |
|
1717 | + $surn_countries[$country_to_iso3166[$country]] = $place['tot']; |
|
1718 | + } else { |
|
1719 | + $surn_countries[$country_to_iso3166[$country]] += $place['tot']; |
|
1720 | + } |
|
1720 | 1721 | } |
1721 | 1722 | } |
1722 | - } |
|
1723 | - break; |
|
1723 | + break; |
|
1724 | 1724 | } |
1725 | 1725 | $chart_url = "https://chart.googleapis.com/chart?cht=t&chtm=" . $chart_shows; |
1726 | 1726 | $chart_url .= "&chco=" . $WT_STATS_CHART_COLOR1 . "," . $WT_STATS_CHART_COLOR3 . "," . $WT_STATS_CHART_COLOR2; // country colours |
@@ -2259,20 +2259,20 @@ discard block |
||
2259 | 2259 | $row = $rows[0]; |
2260 | 2260 | $person = Individual::getInstance($row['id'], $this->tree); |
2261 | 2261 | switch ($type) { |
2262 | - default: |
|
2263 | - case 'full': |
|
2264 | - if ($person->canShowName()) { |
|
2265 | - $result = $person->formatList('span', false, $person->getFullName()); |
|
2266 | - } else { |
|
2267 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
2268 | - } |
|
2269 | - break; |
|
2270 | - case 'age': |
|
2271 | - $result = I18N::number((int) ($row['age'] / 365.25)); |
|
2272 | - break; |
|
2273 | - case 'name': |
|
2274 | - $result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>"; |
|
2275 | - break; |
|
2262 | + default: |
|
2263 | + case 'full': |
|
2264 | + if ($person->canShowName()) { |
|
2265 | + $result = $person->formatList('span', false, $person->getFullName()); |
|
2266 | + } else { |
|
2267 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
2268 | + } |
|
2269 | + break; |
|
2270 | + case 'age': |
|
2271 | + $result = I18N::number((int) ($row['age'] / 365.25)); |
|
2272 | + break; |
|
2273 | + case 'name': |
|
2274 | + $result = "<a href=\"" . $person->getHtmlUrl() . "\">" . $person->getFullName() . "</a>"; |
|
2275 | + break; |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | return $result; |
@@ -2942,36 +2942,36 @@ discard block |
||
2942 | 2942 | $row = $rows[0]; |
2943 | 2943 | $record = GedcomRecord::getInstance($row['id'], $this->tree); |
2944 | 2944 | switch ($type) { |
2945 | - default: |
|
2946 | - case 'full': |
|
2947 | - if ($record->canShow()) { |
|
2948 | - $result = $record->formatList('span', false, $record->getFullName()); |
|
2949 | - } else { |
|
2950 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
2951 | - } |
|
2952 | - break; |
|
2953 | - case 'year': |
|
2954 | - $date = new Date($row['type'] . ' ' . $row['year']); |
|
2955 | - $result = $date->display(); |
|
2956 | - break; |
|
2957 | - case 'type': |
|
2958 | - if (isset($eventTypes[$row['fact']])) { |
|
2959 | - $result = $eventTypes[$row['fact']]; |
|
2960 | - } else { |
|
2961 | - $result = GedcomTag::getLabel($row['fact']); |
|
2962 | - } |
|
2963 | - break; |
|
2964 | - case 'name': |
|
2965 | - $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
2966 | - break; |
|
2967 | - case 'place': |
|
2968 | - $fact = $record->getFirstFact($row['fact']); |
|
2969 | - if ($fact) { |
|
2970 | - $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
2971 | - } else { |
|
2972 | - $result = I18N::translate('Private'); |
|
2973 | - } |
|
2974 | - break; |
|
2945 | + default: |
|
2946 | + case 'full': |
|
2947 | + if ($record->canShow()) { |
|
2948 | + $result = $record->formatList('span', false, $record->getFullName()); |
|
2949 | + } else { |
|
2950 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
2951 | + } |
|
2952 | + break; |
|
2953 | + case 'year': |
|
2954 | + $date = new Date($row['type'] . ' ' . $row['year']); |
|
2955 | + $result = $date->display(); |
|
2956 | + break; |
|
2957 | + case 'type': |
|
2958 | + if (isset($eventTypes[$row['fact']])) { |
|
2959 | + $result = $eventTypes[$row['fact']]; |
|
2960 | + } else { |
|
2961 | + $result = GedcomTag::getLabel($row['fact']); |
|
2962 | + } |
|
2963 | + break; |
|
2964 | + case 'name': |
|
2965 | + $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>"; |
|
2966 | + break; |
|
2967 | + case 'place': |
|
2968 | + $fact = $record->getFirstFact($row['fact']); |
|
2969 | + if ($fact) { |
|
2970 | + $result = FunctionsPrint::formatFactPlace($fact, true, true, true); |
|
2971 | + } else { |
|
2972 | + $result = I18N::translate('Private'); |
|
2973 | + } |
|
2974 | + break; |
|
2975 | 2975 | } |
2976 | 2976 | |
2977 | 2977 | return $result; |
@@ -3116,32 +3116,32 @@ discard block |
||
3116 | 3116 | $person = Individual::getInstance($row['i_id'], $this->tree); |
3117 | 3117 | } |
3118 | 3118 | switch ($type) { |
3119 | - default: |
|
3120 | - case 'full': |
|
3121 | - if ($family->canShow()) { |
|
3122 | - $result = $family->formatList('span', false, $person->getFullName()); |
|
3123 | - } else { |
|
3124 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
3125 | - } |
|
3126 | - break; |
|
3127 | - case 'name': |
|
3128 | - $result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3129 | - break; |
|
3130 | - case 'age': |
|
3131 | - $age = $row['age']; |
|
3132 | - if ($show_years) { |
|
3133 | - if ((int) ($age / 365.25) > 0) { |
|
3134 | - $age = (int) ($age / 365.25) . 'y'; |
|
3135 | - } elseif ((int) ($age / 30.4375) > 0) { |
|
3136 | - $age = (int) ($age / 30.4375) . 'm'; |
|
3119 | + default: |
|
3120 | + case 'full': |
|
3121 | + if ($family->canShow()) { |
|
3122 | + $result = $family->formatList('span', false, $person->getFullName()); |
|
3137 | 3123 | } else { |
3138 | - $age = $age . 'd'; |
|
3124 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
3139 | 3125 | } |
3140 | - $result = FunctionsDate::getAgeAtEvent($age); |
|
3141 | - } else { |
|
3142 | - $result = I18N::number((int) ($age / 365.25)); |
|
3143 | - } |
|
3144 | - break; |
|
3126 | + break; |
|
3127 | + case 'name': |
|
3128 | + $result = '<a href="' . $family->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3129 | + break; |
|
3130 | + case 'age': |
|
3131 | + $age = $row['age']; |
|
3132 | + if ($show_years) { |
|
3133 | + if ((int) ($age / 365.25) > 0) { |
|
3134 | + $age = (int) ($age / 365.25) . 'y'; |
|
3135 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3136 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3137 | + } else { |
|
3138 | + $age = $age . 'd'; |
|
3139 | + } |
|
3140 | + $result = FunctionsDate::getAgeAtEvent($age); |
|
3141 | + } else { |
|
3142 | + $result = I18N::number((int) ($age / 365.25)); |
|
3143 | + } |
|
3144 | + break; |
|
3145 | 3145 | } |
3146 | 3146 | |
3147 | 3147 | return $result; |
@@ -3414,32 +3414,32 @@ discard block |
||
3414 | 3414 | $person = Individual::getInstance($row['id'], $this->tree); |
3415 | 3415 | } |
3416 | 3416 | switch ($type) { |
3417 | - default: |
|
3418 | - case 'full': |
|
3419 | - if ($person->canShow()) { |
|
3420 | - $result = $person->formatList('span', false, $person->getFullName()); |
|
3421 | - } else { |
|
3422 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
3423 | - } |
|
3424 | - break; |
|
3425 | - case 'name': |
|
3426 | - $result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3427 | - break; |
|
3428 | - case 'age': |
|
3429 | - $age = $row['age']; |
|
3430 | - if ($show_years) { |
|
3431 | - if ((int) ($age / 365.25) > 0) { |
|
3432 | - $age = (int) ($age / 365.25) . 'y'; |
|
3433 | - } elseif ((int) ($age / 30.4375) > 0) { |
|
3434 | - $age = (int) ($age / 30.4375) . 'm'; |
|
3417 | + default: |
|
3418 | + case 'full': |
|
3419 | + if ($person->canShow()) { |
|
3420 | + $result = $person->formatList('span', false, $person->getFullName()); |
|
3435 | 3421 | } else { |
3436 | - $age = $age . 'd'; |
|
3422 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
3437 | 3423 | } |
3438 | - $result = FunctionsDate::getAgeAtEvent($age); |
|
3439 | - } else { |
|
3440 | - $result = (int) ($age / 365.25); |
|
3441 | - } |
|
3442 | - break; |
|
3424 | + break; |
|
3425 | + case 'name': |
|
3426 | + $result = '<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>'; |
|
3427 | + break; |
|
3428 | + case 'age': |
|
3429 | + $age = $row['age']; |
|
3430 | + if ($show_years) { |
|
3431 | + if ((int) ($age / 365.25) > 0) { |
|
3432 | + $age = (int) ($age / 365.25) . 'y'; |
|
3433 | + } elseif ((int) ($age / 30.4375) > 0) { |
|
3434 | + $age = (int) ($age / 30.4375) . 'm'; |
|
3435 | + } else { |
|
3436 | + $age = $age . 'd'; |
|
3437 | + } |
|
3438 | + $result = FunctionsDate::getAgeAtEvent($age); |
|
3439 | + } else { |
|
3440 | + $result = (int) ($age / 365.25); |
|
3441 | + } |
|
3442 | + break; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | return $result; |
@@ -4397,20 +4397,20 @@ discard block |
||
4397 | 4397 | $row = $rows[0]; |
4398 | 4398 | $family = Family::getInstance($row['id'], $this->tree); |
4399 | 4399 | switch ($type) { |
4400 | - default: |
|
4401 | - case 'full': |
|
4402 | - if ($family->canShow()) { |
|
4403 | - $result = $family->formatList('span', false, $family->getFullName()); |
|
4404 | - } else { |
|
4405 | - $result = I18N::translate('This information is private and cannot be shown.'); |
|
4406 | - } |
|
4407 | - break; |
|
4408 | - case 'size': |
|
4409 | - $result = I18N::number($row['tot']); |
|
4410 | - break; |
|
4411 | - case 'name': |
|
4412 | - $result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>'; |
|
4413 | - break; |
|
4400 | + default: |
|
4401 | + case 'full': |
|
4402 | + if ($family->canShow()) { |
|
4403 | + $result = $family->formatList('span', false, $family->getFullName()); |
|
4404 | + } else { |
|
4405 | + $result = I18N::translate('This information is private and cannot be shown.'); |
|
4406 | + } |
|
4407 | + break; |
|
4408 | + case 'size': |
|
4409 | + $result = I18N::number($row['tot']); |
|
4410 | + break; |
|
4411 | + case 'name': |
|
4412 | + $result = "<a href=\"" . $family->getHtmlUrl() . "\">" . $family->getFullName() . '</a>'; |
|
4413 | + break; |
|
4414 | 4414 | } |
4415 | 4415 | |
4416 | 4416 | return $result; |
@@ -4689,43 +4689,43 @@ discard block |
||
4689 | 4689 | foreach ($rows as $values) { |
4690 | 4690 | $counts[] = round(100 * $values['total'] / $tot, 0); |
4691 | 4691 | switch ($values['d_month']) { |
4692 | - default: |
|
4693 | - case 'JAN': |
|
4694 | - $values['d_month'] = 1; |
|
4695 | - break; |
|
4696 | - case 'FEB': |
|
4697 | - $values['d_month'] = 2; |
|
4698 | - break; |
|
4699 | - case 'MAR': |
|
4700 | - $values['d_month'] = 3; |
|
4701 | - break; |
|
4702 | - case 'APR': |
|
4703 | - $values['d_month'] = 4; |
|
4704 | - break; |
|
4705 | - case 'MAY': |
|
4706 | - $values['d_month'] = 5; |
|
4707 | - break; |
|
4708 | - case 'JUN': |
|
4709 | - $values['d_month'] = 6; |
|
4710 | - break; |
|
4711 | - case 'JUL': |
|
4712 | - $values['d_month'] = 7; |
|
4713 | - break; |
|
4714 | - case 'AUG': |
|
4715 | - $values['d_month'] = 8; |
|
4716 | - break; |
|
4717 | - case 'SEP': |
|
4718 | - $values['d_month'] = 9; |
|
4719 | - break; |
|
4720 | - case 'OCT': |
|
4721 | - $values['d_month'] = 10; |
|
4722 | - break; |
|
4723 | - case 'NOV': |
|
4724 | - $values['d_month'] = 11; |
|
4725 | - break; |
|
4726 | - case 'DEC': |
|
4727 | - $values['d_month'] = 12; |
|
4728 | - break; |
|
4692 | + default: |
|
4693 | + case 'JAN': |
|
4694 | + $values['d_month'] = 1; |
|
4695 | + break; |
|
4696 | + case 'FEB': |
|
4697 | + $values['d_month'] = 2; |
|
4698 | + break; |
|
4699 | + case 'MAR': |
|
4700 | + $values['d_month'] = 3; |
|
4701 | + break; |
|
4702 | + case 'APR': |
|
4703 | + $values['d_month'] = 4; |
|
4704 | + break; |
|
4705 | + case 'MAY': |
|
4706 | + $values['d_month'] = 5; |
|
4707 | + break; |
|
4708 | + case 'JUN': |
|
4709 | + $values['d_month'] = 6; |
|
4710 | + break; |
|
4711 | + case 'JUL': |
|
4712 | + $values['d_month'] = 7; |
|
4713 | + break; |
|
4714 | + case 'AUG': |
|
4715 | + $values['d_month'] = 8; |
|
4716 | + break; |
|
4717 | + case 'SEP': |
|
4718 | + $values['d_month'] = 9; |
|
4719 | + break; |
|
4720 | + case 'OCT': |
|
4721 | + $values['d_month'] = 10; |
|
4722 | + break; |
|
4723 | + case 'NOV': |
|
4724 | + $values['d_month'] = 11; |
|
4725 | + break; |
|
4726 | + case 'DEC': |
|
4727 | + $values['d_month'] = 12; |
|
4728 | + break; |
|
4729 | 4729 | } |
4730 | 4730 | $text .= I18N::translate(ucfirst(strtolower(($values['d_month'])))) . ' - ' . $values['total'] . '|'; |
4731 | 4731 | } |
@@ -5316,16 +5316,16 @@ discard block |
||
5316 | 5316 | } |
5317 | 5317 | |
5318 | 5318 | switch ($sorting) { |
5319 | - default: |
|
5320 | - case 'alpha': |
|
5321 | - uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
5322 | - break; |
|
5323 | - case 'count': |
|
5324 | - asort($surname_list); |
|
5325 | - break; |
|
5326 | - case 'rcount': |
|
5327 | - arsort($surname_list); |
|
5328 | - break; |
|
5319 | + default: |
|
5320 | + case 'alpha': |
|
5321 | + uksort($surname_list, '\Fisharebest\Webtrees\I18N::strcasecmp'); |
|
5322 | + break; |
|
5323 | + case 'count': |
|
5324 | + asort($surname_list); |
|
5325 | + break; |
|
5326 | + case 'rcount': |
|
5327 | + arsort($surname_list); |
|
5328 | + break; |
|
5329 | 5329 | } |
5330 | 5330 | |
5331 | 5331 | // Note that we count/display SPFX SURN, but sort/group under just SURN |
@@ -5439,9 +5439,9 @@ discard block |
||
5439 | 5439 | } |
5440 | 5440 | } |
5441 | 5441 | switch ($SURNAME_TRADITION) { |
5442 | - case 'polish': |
|
5443 | - // most common surname should be in male variant (Kowalski, not Kowalska) |
|
5444 | - $top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name); |
|
5442 | + case 'polish': |
|
5443 | + // most common surname should be in male variant (Kowalski, not Kowalska) |
|
5444 | + $top_name = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $top_name); |
|
5445 | 5445 | } |
5446 | 5446 | $per = round(100 * $count_per / $tot_indi, 0); |
5447 | 5447 | $chd .= $this->arrayToExtendedEncoding(array($per)); |
@@ -5481,19 +5481,19 @@ discard block |
||
5481 | 5481 | } |
5482 | 5482 | |
5483 | 5483 | switch ($sex) { |
5484 | - case 'M': |
|
5485 | - $sex_sql = "i_sex='M'"; |
|
5486 | - break; |
|
5487 | - case 'F': |
|
5488 | - $sex_sql = "i_sex='F'"; |
|
5489 | - break; |
|
5490 | - case 'U': |
|
5491 | - $sex_sql = "i_sex='U'"; |
|
5492 | - break; |
|
5493 | - case 'B': |
|
5494 | - default: |
|
5495 | - $sex_sql = "i_sex<>'U'"; |
|
5496 | - break; |
|
5484 | + case 'M': |
|
5485 | + $sex_sql = "i_sex='M'"; |
|
5486 | + break; |
|
5487 | + case 'F': |
|
5488 | + $sex_sql = "i_sex='F'"; |
|
5489 | + break; |
|
5490 | + case 'U': |
|
5491 | + $sex_sql = "i_sex='U'"; |
|
5492 | + break; |
|
5493 | + case 'B': |
|
5494 | + default: |
|
5495 | + $sex_sql = "i_sex<>'U'"; |
|
5496 | + break; |
|
5497 | 5497 | } |
5498 | 5498 | $ged_id = $this->tree->getTreeId(); |
5499 | 5499 | |
@@ -5538,25 +5538,25 @@ discard block |
||
5538 | 5538 | $tot = ''; |
5539 | 5539 | } |
5540 | 5540 | switch ($type) { |
5541 | - case 'table': |
|
5542 | - $common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>'; |
|
5543 | - break; |
|
5544 | - case 'list': |
|
5545 | - $common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>'; |
|
5546 | - break; |
|
5547 | - case 'nolist': |
|
5548 | - $common[] = '<span dir="auto">' . $given . '</span>' . $tot; |
|
5549 | - break; |
|
5541 | + case 'table': |
|
5542 | + $common[] = '<tr><td>' . $given . '</td><td>' . I18N::number($total) . '</td><td>' . $total . '</td></tr>'; |
|
5543 | + break; |
|
5544 | + case 'list': |
|
5545 | + $common[] = '<li><span dir="auto">' . $given . '</span>' . $tot . '</li>'; |
|
5546 | + break; |
|
5547 | + case 'nolist': |
|
5548 | + $common[] = '<span dir="auto">' . $given . '</span>' . $tot; |
|
5549 | + break; |
|
5550 | 5550 | } |
5551 | 5551 | } |
5552 | 5552 | if ($common) { |
5553 | 5553 | switch ($type) { |
5554 | - case 'table': |
|
5555 | - global $controller; |
|
5556 | - $table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page |
|
5557 | - $controller |
|
5558 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
5559 | - ->addInlineJavascript(' |
|
5554 | + case 'table': |
|
5555 | + global $controller; |
|
5556 | + $table_id = Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page |
|
5557 | + $controller |
|
5558 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
5559 | + ->addInlineJavascript(' |
|
5560 | 5560 | jQuery("#' . $table_id . '").dataTable({ |
5561 | 5561 | dom: \'t\', |
5562 | 5562 | autoWidth: false, |
@@ -5574,15 +5574,15 @@ discard block |
||
5574 | 5574 | }); |
5575 | 5575 | jQuery("#' . $table_id . '").css("visibility", "visible"); |
5576 | 5576 | '); |
5577 | - $lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All')); |
|
5577 | + $lookup = array('M' => I18N::translate('Male'), 'F' => I18N::translate('Female'), 'U' => I18N::translateContext('unknown gender', 'Unknown'), 'B' => I18N::translate('All')); |
|
5578 | 5578 | |
5579 | - return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>'; |
|
5580 | - case 'list': |
|
5581 | - return '<ul>' . implode('', $common) . '</ul>'; |
|
5582 | - case 'nolist': |
|
5583 | - return implode(I18N::$list_separator, $common); |
|
5584 | - default: |
|
5585 | - return ''; |
|
5579 | + return '<table id="' . $table_id . '" class="givn-list"><thead><tr><th class="ui-state-default" colspan="3">' . $lookup[$sex] . '</th></tr><tr><th>' . I18N::translate('Name') . '</th><th>' . I18N::translate('Count') . '</th><th>COUNT</th></tr></thead><tbody>' . implode('', $common) . '</tbody></table>'; |
|
5580 | + case 'list': |
|
5581 | + return '<ul>' . implode('', $common) . '</ul>'; |
|
5582 | + case 'nolist': |
|
5583 | + return implode(I18N::$list_separator, $common); |
|
5584 | + default: |
|
5585 | + return ''; |
|
5586 | 5586 | } |
5587 | 5587 | } else { |
5588 | 5588 | return ''; |
@@ -6069,42 +6069,42 @@ discard block |
||
6069 | 6069 | } |
6070 | 6070 | |
6071 | 6071 | switch ($type) { |
6072 | - default: |
|
6073 | - case 'userid': |
|
6074 | - return $user->getUserId(); |
|
6075 | - case 'username': |
|
6076 | - return Filter::escapeHtml($user->getUserName()); |
|
6077 | - case 'fullname': |
|
6078 | - return $user->getRealNameHtml(); |
|
6079 | - case 'regdate': |
|
6080 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6081 | - $datestamp = $params[0]; |
|
6082 | - } else { |
|
6083 | - $datestamp = I18N::dateFormat(); |
|
6084 | - } |
|
6072 | + default: |
|
6073 | + case 'userid': |
|
6074 | + return $user->getUserId(); |
|
6075 | + case 'username': |
|
6076 | + return Filter::escapeHtml($user->getUserName()); |
|
6077 | + case 'fullname': |
|
6078 | + return $user->getRealNameHtml(); |
|
6079 | + case 'regdate': |
|
6080 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6081 | + $datestamp = $params[0]; |
|
6082 | + } else { |
|
6083 | + $datestamp = I18N::dateFormat(); |
|
6084 | + } |
|
6085 | 6085 | |
6086 | - return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6087 | - case 'regtime': |
|
6088 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6089 | - $datestamp = $params[0]; |
|
6090 | - } else { |
|
6091 | - $datestamp = str_replace('%', '', I18N::timeFormat()); |
|
6092 | - } |
|
6086 | + return FunctionsDate::timestampToGedcomDate($user->getPreference('reg_timestamp'))->display(false, $datestamp); |
|
6087 | + case 'regtime': |
|
6088 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6089 | + $datestamp = $params[0]; |
|
6090 | + } else { |
|
6091 | + $datestamp = str_replace('%', '', I18N::timeFormat()); |
|
6092 | + } |
|
6093 | 6093 | |
6094 | - return date($datestamp, $user->getPreference('reg_timestamp')); |
|
6095 | - case 'loggedin': |
|
6096 | - if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6097 | - $yes = $params[0]; |
|
6098 | - } else { |
|
6099 | - $yes = I18N::translate('yes'); |
|
6100 | - } |
|
6101 | - if (is_array($params) && isset($params[1]) && $params[1] != '') { |
|
6102 | - $no = $params[1]; |
|
6103 | - } else { |
|
6104 | - $no = I18N::translate('no'); |
|
6105 | - } |
|
6094 | + return date($datestamp, $user->getPreference('reg_timestamp')); |
|
6095 | + case 'loggedin': |
|
6096 | + if (is_array($params) && isset($params[0]) && $params[0] != '') { |
|
6097 | + $yes = $params[0]; |
|
6098 | + } else { |
|
6099 | + $yes = I18N::translate('yes'); |
|
6100 | + } |
|
6101 | + if (is_array($params) && isset($params[1]) && $params[1] != '') { |
|
6102 | + $no = $params[1]; |
|
6103 | + } else { |
|
6104 | + $no = I18N::translate('no'); |
|
6105 | + } |
|
6106 | 6106 | |
6107 | - return Database::prepare("SELECT 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no; |
|
6107 | + return Database::prepare("SELECT 1 FROM `##session` WHERE user_id=? LIMIT 1")->execute(array($user->getUserId()))->fetchOne() ? $yes : $no; |
|
6108 | 6108 | } |
6109 | 6109 | } |
6110 | 6110 | |
@@ -6941,50 +6941,50 @@ discard block |
||
6941 | 6941 | } |
6942 | 6942 | // The current chart engine (Google charts) can't handle <sup></sup> markup |
6943 | 6943 | switch ($century) { |
6944 | - case 21: |
|
6945 | - return strip_tags(I18N::translateContext('CENTURY', '21st')); |
|
6946 | - case 20: |
|
6947 | - return strip_tags(I18N::translateContext('CENTURY', '20th')); |
|
6948 | - case 19: |
|
6949 | - return strip_tags(I18N::translateContext('CENTURY', '19th')); |
|
6950 | - case 18: |
|
6951 | - return strip_tags(I18N::translateContext('CENTURY', '18th')); |
|
6952 | - case 17: |
|
6953 | - return strip_tags(I18N::translateContext('CENTURY', '17th')); |
|
6954 | - case 16: |
|
6955 | - return strip_tags(I18N::translateContext('CENTURY', '16th')); |
|
6956 | - case 15: |
|
6957 | - return strip_tags(I18N::translateContext('CENTURY', '15th')); |
|
6958 | - case 14: |
|
6959 | - return strip_tags(I18N::translateContext('CENTURY', '14th')); |
|
6960 | - case 13: |
|
6961 | - return strip_tags(I18N::translateContext('CENTURY', '13th')); |
|
6962 | - case 12: |
|
6963 | - return strip_tags(I18N::translateContext('CENTURY', '12th')); |
|
6964 | - case 11: |
|
6965 | - return strip_tags(I18N::translateContext('CENTURY', '11th')); |
|
6966 | - case 10: |
|
6967 | - return strip_tags(I18N::translateContext('CENTURY', '10th')); |
|
6968 | - case 9: |
|
6969 | - return strip_tags(I18N::translateContext('CENTURY', '9th')); |
|
6970 | - case 8: |
|
6971 | - return strip_tags(I18N::translateContext('CENTURY', '8th')); |
|
6972 | - case 7: |
|
6973 | - return strip_tags(I18N::translateContext('CENTURY', '7th')); |
|
6974 | - case 6: |
|
6975 | - return strip_tags(I18N::translateContext('CENTURY', '6th')); |
|
6976 | - case 5: |
|
6977 | - return strip_tags(I18N::translateContext('CENTURY', '5th')); |
|
6978 | - case 4: |
|
6979 | - return strip_tags(I18N::translateContext('CENTURY', '4th')); |
|
6980 | - case 3: |
|
6981 | - return strip_tags(I18N::translateContext('CENTURY', '3rd')); |
|
6982 | - case 2: |
|
6983 | - return strip_tags(I18N::translateContext('CENTURY', '2nd')); |
|
6984 | - case 1: |
|
6985 | - return strip_tags(I18N::translateContext('CENTURY', '1st')); |
|
6986 | - default: |
|
6987 | - return ($century - 1) . '01-' . $century . '00'; |
|
6944 | + case 21: |
|
6945 | + return strip_tags(I18N::translateContext('CENTURY', '21st')); |
|
6946 | + case 20: |
|
6947 | + return strip_tags(I18N::translateContext('CENTURY', '20th')); |
|
6948 | + case 19: |
|
6949 | + return strip_tags(I18N::translateContext('CENTURY', '19th')); |
|
6950 | + case 18: |
|
6951 | + return strip_tags(I18N::translateContext('CENTURY', '18th')); |
|
6952 | + case 17: |
|
6953 | + return strip_tags(I18N::translateContext('CENTURY', '17th')); |
|
6954 | + case 16: |
|
6955 | + return strip_tags(I18N::translateContext('CENTURY', '16th')); |
|
6956 | + case 15: |
|
6957 | + return strip_tags(I18N::translateContext('CENTURY', '15th')); |
|
6958 | + case 14: |
|
6959 | + return strip_tags(I18N::translateContext('CENTURY', '14th')); |
|
6960 | + case 13: |
|
6961 | + return strip_tags(I18N::translateContext('CENTURY', '13th')); |
|
6962 | + case 12: |
|
6963 | + return strip_tags(I18N::translateContext('CENTURY', '12th')); |
|
6964 | + case 11: |
|
6965 | + return strip_tags(I18N::translateContext('CENTURY', '11th')); |
|
6966 | + case 10: |
|
6967 | + return strip_tags(I18N::translateContext('CENTURY', '10th')); |
|
6968 | + case 9: |
|
6969 | + return strip_tags(I18N::translateContext('CENTURY', '9th')); |
|
6970 | + case 8: |
|
6971 | + return strip_tags(I18N::translateContext('CENTURY', '8th')); |
|
6972 | + case 7: |
|
6973 | + return strip_tags(I18N::translateContext('CENTURY', '7th')); |
|
6974 | + case 6: |
|
6975 | + return strip_tags(I18N::translateContext('CENTURY', '6th')); |
|
6976 | + case 5: |
|
6977 | + return strip_tags(I18N::translateContext('CENTURY', '5th')); |
|
6978 | + case 4: |
|
6979 | + return strip_tags(I18N::translateContext('CENTURY', '4th')); |
|
6980 | + case 3: |
|
6981 | + return strip_tags(I18N::translateContext('CENTURY', '3rd')); |
|
6982 | + case 2: |
|
6983 | + return strip_tags(I18N::translateContext('CENTURY', '2nd')); |
|
6984 | + case 1: |
|
6985 | + return strip_tags(I18N::translateContext('CENTURY', '1st')); |
|
6986 | + default: |
|
6987 | + return ($century - 1) . '01-' . $century . '00'; |
|
6988 | 6988 | } |
6989 | 6989 | } |
6990 | 6990 | } |