diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2018-03-24 14:16:44 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2018-03-24 14:16:44 +0000 |
| commit | b7ccea42c3065e848edbb018d0fb7c4cb6cb30ba (patch) | |
| tree | e20ec913bb41e6edec84f68eb464a31dfbb0ffaf | |
| parent | 3f7ece235657803185e6526d810ae993daf0d8ff (diff) | |
| download | webtrees-b7ccea42c3065e848edbb018d0fb7c4cb6cb30ba.tar.gz webtrees-b7ccea42c3065e848edbb018d0fb7c4cb6cb30ba.tar.bz2 webtrees-b7ccea42c3065e848edbb018d0fb7c4cb6cb30ba.zip | |
Fix: #1662 - links to individual and family lists
| -rw-r--r-- | app/Functions/FunctionsPrintLists.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/app/Functions/FunctionsPrintLists.php b/app/Functions/FunctionsPrintLists.php index 1b28332e10..dfa12459f9 100644 --- a/app/Functions/FunctionsPrintLists.php +++ b/app/Functions/FunctionsPrintLists.php @@ -1241,13 +1241,13 @@ class FunctionsPrintLists { * Print a tagcloud of surnames. * * @param string[][] $surnames array (of SURN, of array of SPFX_SURN, of array of PID) - * @param string $script indilist or famlist + * @param string $route individual-list or family-listlist * @param bool $totals show totals after each name * @param Tree $tree generate links to this tree * * @return string */ - public static function surnameTagCloud($surnames, $script, $totals, Tree $tree) { + public static function surnameTagCloud($surnames, $route, $totals, Tree $tree) { $minimum = PHP_INT_MAX; $maximum = 1; foreach ($surnames as $surn => $surns) { @@ -1266,7 +1266,8 @@ class FunctionsPrintLists { } else { $size = 75.0 + 125.0 * (count($indis) - $minimum) / ($maximum - $minimum); } - $html .= '<a style="font-size:' . $size . '%" href="' . $script . '?surname=' . rawurlencode($surn) . '&ged=' . $tree->getNameUrl() . '">'; + $url = route($route, ['surname' => $surn, 'ged' => $tree->getName()]); + $html .= '<a style="font-size:' . $size . '%" href="' . e($url) . '">'; if ($totals) { $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $spfxsurn . '</span>', I18N::number(count($indis))); } else { @@ -1285,19 +1286,19 @@ class FunctionsPrintLists { * @param string[][] $surnames array (of SURN, of array of SPFX_SURN, of array of PID) * @param int $style 1=bullet list, 2=semicolon-separated list, 3=tabulated list with up to 4 columns * @param bool $totals show totals after each name - * @param string $script indilist or famlist + * @param string $route individual-list or family-list * @param Tree $tree Link back to the individual list in this tree * * @return string */ - public static function surnameList($surnames, $style, $totals, $script, Tree $tree) { + public static function surnameList($surnames, $style, $totals, $route, Tree $tree) { $html = []; foreach ($surnames as $surn => $surns) { // Each surname links back to the indilist if ($surn) { - $url = $script . '?surname=' . urlencode($surn) . '&ged=' . $tree->getNameUrl(); + $url = route($route, ['surname' => $surn, 'ged' => $tree->getName()]); } else { - $url = $script . '?alpha=,&ged=' . $tree->getNameUrl(); + $url = route($route, ['alpha' => ',', 'ged' => $tree->getName()]); } // If all the surnames are just case variants, then merge them into one // Comment out this block if you want SMITH listed separately from Smith @@ -1312,7 +1313,7 @@ class FunctionsPrintLists { $first_spfxsurn = $spfxsurn; } } - $subhtml = '<a href="' . $url . '" dir="auto">' . e(implode(I18N::$list_separator, array_keys($surns))) . '</a>'; + $subhtml = '<a href="' . e($url) . '" dir="auto">' . e(implode(I18N::$list_separator, array_keys($surns))) . '</a>'; if ($totals) { $subtotal = 0; |
