diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-02-01 00:01:36 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-02-02 17:34:31 +0000 |
| commit | a25f0a04682c4c39c1947220c90af4118c713952 (patch) | |
| tree | f7e9c2c630a50dd3e5dd76ce501dff4b1d8d4c26 /famlist.php | |
| parent | 4d2a5476ceb1c11dc1fd146bfb0be077baa5fb01 (diff) | |
| download | webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.gz webtrees-a25f0a04682c4c39c1947220c90af4118c713952.tar.bz2 webtrees-a25f0a04682c4c39c1947220c90af4118c713952.zip | |
Refactor classes to use namespaces, as per PSR-4. Replace GPL2 with GPL3.
Diffstat (limited to 'famlist.php')
| -rw-r--r-- | famlist.php | 108 |
1 files changed, 49 insertions, 59 deletions
diff --git a/famlist.php b/famlist.php index 0ffbf10c71..87d4997090 100644 --- a/famlist.php +++ b/famlist.php @@ -1,51 +1,41 @@ <?php -// Family List -// -// NOTE: indilist.php and famlist.php contain mostly identical code. -// Updates to one file almost certainly need to be made to the other one as well. -// -// webtrees: Web based Family History software -// Copyright (C) 2014 webtrees development team. -// -// Derived from PhpGedView -// Copyright (C) 2002 to 2009 PGV Development Team. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +namespace Webtrees; -use WT\Auth; +/** + * webtrees: online genealogy + * Copyright (C) 2015 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ define('WT_SCRIPT_NAME', 'famlist.php'); require './includes/session.php'; require_once WT_ROOT . 'includes/functions/functions_print_lists.php'; -$controller = new WT_Controller_Page; +$controller = new PageController; // We show three different lists: initials, surnames and individuals // Note that the data may contain special chars, such as surname="<unknown>", -$alpha = WT_Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none -$surname = WT_Filter::get('surname'); // All indis with this surname -$show_all = WT_Filter::get('show_all', 'no|yes', 'no'); // All indis +$alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none +$surname = Filter::get('surname'); // All indis with this surname +$show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis // Long lists can be broken down by given name -$show_all_firstnames = WT_Filter::get('show_all_firstnames', 'no|yes', 'no'); +$show_all_firstnames = Filter::get('show_all_firstnames', 'no|yes', 'no'); if ($show_all_firstnames === 'yes') { $falpha = ''; } else { - $falpha = WT_Filter::get('falpha'); // All first names beginning with this letter + $falpha = Filter::get('falpha'); // All first names beginning with this letter } -$show_marnm = WT_Filter::get('show_marnm', 'no|yes'); +$show_marnm = Filter::get('show_marnm', 'no|yes'); switch ($show_marnm) { case 'no': case 'yes': @@ -61,21 +51,21 @@ if ($show_all === 'yes') { if ($show_all_firstnames === 'yes') { $alpha = ''; $surname = ''; - $legend = WT_I18N::translate('All'); + $legend = I18N::translate('All'); $url = WT_SCRIPT_NAME . '?show_all=yes&ged=' . WT_GEDURL; $show = 'indi'; } elseif ($falpha) { $alpha = ''; $surname = ''; - $legend = WT_I18N::translate('All') . ', ' . WT_Filter::escapeHtml($falpha) . '…'; + $legend = I18N::translate('All') . ', ' . Filter::escapeHtml($falpha) . '…'; $url = WT_SCRIPT_NAME . '?show_all=yes&ged=' . WT_GEDURL; $show = 'indi'; } else { $alpha = ''; $surname = ''; - $legend = WT_I18N::translate('All'); + $legend = I18N::translate('All'); $url = WT_SCRIPT_NAME . '?show_all=yes' . '&ged=' . WT_GEDURL; - $show = WT_Filter::get('show', 'surn|indi', 'surn'); + $show = Filter::get('show', 'surn|indi', 'surn'); } } elseif ($surname) { $alpha = WT_Query_Name::initialLetter($surname); // so we can highlight the initial letter @@ -83,7 +73,7 @@ if ($show_all === 'yes') { if ($surname === '@N.N.') { $legend = $UNKNOWN_NN; } else { - $legend = WT_Filter::escapeHtml($surname); + $legend = Filter::escapeHtml($surname); } $url = WT_SCRIPT_NAME . '?surname=' . rawurlencode($surname) . '&ged=' . WT_GEDURL; switch ($falpha) { @@ -94,7 +84,7 @@ if ($show_all === 'yes') { $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . WT_GEDURL; break; default: - $legend .= ', ' . WT_Filter::escapeHtml($falpha) . '…'; + $legend .= ', ' . Filter::escapeHtml($falpha) . '…'; $url .= '&falpha=' . rawurlencode($falpha) . '&ged=' . WT_GEDURL; break; } @@ -106,14 +96,14 @@ if ($show_all === 'yes') { $show = 'indi'; // SURN list makes no sense here } elseif ($alpha === ',') { $show_all = 'no'; - $legend = WT_I18N::translate('None'); + $legend = I18N::translate('None'); $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . WT_GEDURL; $show = 'indi'; // SURN list makes no sense here } elseif ($alpha) { $show_all = 'no'; - $legend = WT_Filter::escapeHtml($alpha) . '…'; + $legend = Filter::escapeHtml($alpha) . '…'; $url = WT_SCRIPT_NAME . '?alpha=' . rawurlencode($alpha) . '&ged=' . WT_GEDURL; - $show = WT_Filter::get('show', 'surn|indi', 'surn'); + $show = Filter::get('show', 'surn|indi', 'surn'); } else { $show_all = 'no'; $legend = '…'; @@ -123,10 +113,10 @@ if ($show_all === 'yes') { $legend = '<span dir="auto">' . $legend . '</span>'; $controller - ->setPageTitle(WT_I18N::translate('Families') . ' : ' . $legend) + ->setPageTitle(I18N::translate('Families') . ' : ' . $legend) ->pageHeader(); -echo '<h2 class="center">', WT_I18N::translate('Families'), '</h2>'; +echo '<h2 class="center">', I18N::translate('Families'), '</h2>'; // Print a selection list of initial letters $list = array(); @@ -136,17 +126,17 @@ foreach (WT_Query_Name::surnameAlpha($show_marnm === 'yes', true, WT_GED_ID) as $html = $UNKNOWN_NN; break; case ',': - $html = WT_I18N::translate('None'); + $html = I18N::translate('None'); break; default: - $html = WT_Filter::escapeHtml($letter); + $html = Filter::escapeHtml($letter); break; } if ($count) { if ($letter == $alpha) { - $list[] = '<a href="' . WT_SCRIPT_NAME . '?alpha=' . rawurlencode($letter) . '&ged=' . WT_GEDURL . '" class="warning" title="' . WT_I18N::number($count) . '">' . $html . '</a>'; + $list[] = '<a href="' . WT_SCRIPT_NAME . '?alpha=' . rawurlencode($letter) . '&ged=' . WT_GEDURL . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; } else { - $list[] = '<a href="' . WT_SCRIPT_NAME . '?alpha=' . rawurlencode($letter) . '&ged=' . WT_GEDURL . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>'; + $list[] = '<a href="' . WT_SCRIPT_NAME . '?alpha=' . rawurlencode($letter) . '&ged=' . WT_GEDURL . '" title="' . I18N::number($count) . '">' . $html . '</a>'; } } else { $list[] = $html; @@ -156,9 +146,9 @@ foreach (WT_Query_Name::surnameAlpha($show_marnm === 'yes', true, WT_GED_ID) as // Search spiders don't get the "show all" option as the other links give them everything. if (!$SEARCH_SPIDER) { if ($show_all === 'yes') { - $list[] = '<span class="warning">' . WT_I18N::translate('All') . '</span>'; + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; } else { - $list[] = '<a href="' . WT_SCRIPT_NAME . '?show_all=yes' . '&ged=' . WT_GEDURL . '">' . WT_I18N::translate('All') . '</a>'; + $list[] = '<a href="' . WT_SCRIPT_NAME . '?show_all=yes' . '&ged=' . WT_GEDURL . '">' . I18N::translate('All') . '</a>'; } } echo '<p class="center alpha_index">', join(' | ', $list), '</p>'; @@ -169,16 +159,16 @@ if (!$SEARCH_SPIDER) { echo '<p class="center">'; if ($show !== 'none') { if ($show_marnm === 'yes') { - echo '<a href="', $url, '&show=' . $show . '&show_marnm=no">', WT_I18N::translate('Exclude individuals with “%s” as a married name', $legend), '</a>'; + echo '<a href="', $url, '&show=' . $show . '&show_marnm=no">', I18N::translate('Exclude individuals with “%s” as a married name', $legend), '</a>'; } else { - echo '<a href="', $url, '&show=' . $show . '&show_marnm=yes">', WT_I18N::translate('Include individuals with “%s” as a married name', $legend), '</a>'; + echo '<a href="', $url, '&show=' . $show . '&show_marnm=yes">', I18N::translate('Include individuals with “%s” as a married name', $legend), '</a>'; } if ($alpha !== '@' && $alpha !== ',' && !$surname) { if ($show === 'surn') { - echo '<br><a href="', $url, '&show=indi">', WT_I18N::translate('Show the list of individuals'), '</a>'; + echo '<br><a href="', $url, '&show=indi">', I18N::translate('Show the list of individuals'), '</a>'; } else { - echo '<br><a href="', $url, '&show=surn">', WT_I18N::translate('Show the list of surnames'), '</a>'; + echo '<br><a href="', $url, '&show=surn">', I18N::translate('Show the list of surnames'), '</a>'; } } } @@ -226,14 +216,14 @@ if ($show === 'indi' || $show === 'surn') { $html = $UNKNOWN_PN; break; default: - $html = WT_Filter::escapeHtml($givn_initial); + $html = Filter::escapeHtml($givn_initial); break; } if ($count) { if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') { - $list[] = '<a class="warning" href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>'; + $list[] = '<a class="warning" href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>'; } else { - $list[] = '<a href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>'; + $list[] = '<a href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>'; } } else { $list[] = $html; @@ -242,13 +232,13 @@ if ($show === 'indi' || $show === 'surn') { // Search spiders don't get the "show all" option as the other links give them everything. if (!$SEARCH_SPIDER) { if ($show_all_firstnames === 'yes') { - $list[] = '<span class="warning">' . WT_I18N::translate('All') . '</span>'; + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; } else { - $list[] = '<a href="' . $url . '&show_all_firstnames=yes">' . WT_I18N::translate('All') . '</a>'; + $list[] = '<a href="' . $url . '&show_all_firstnames=yes">' . I18N::translate('All') . '</a>'; } } if ($show_all === 'no') { - echo '<h2 class="center">', WT_I18N::translate('Individuals with surname %s', $legend), '</h2>'; + echo '<h2 class="center">', I18N::translate('Individuals with surname %s', $legend), '</h2>'; } echo '<p class="center alpha_index">', join(' | ', $list), '</p>'; } |
