diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-05-30 19:13:51 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-05-30 23:29:57 +0100 |
| commit | cbc1590a8c715aa2d88bd745610b899587bd9563 (patch) | |
| tree | 8411c52737b981c7eff37ffcdd083902cb769141 /app/Query | |
| parent | ffd703ea1e658c7dcb5e5f1f9ef137a420f2d167 (diff) | |
| download | webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.tar.gz webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.tar.bz2 webtrees-cbc1590a8c715aa2d88bd745610b899587bd9563.zip | |
Code style
Diffstat (limited to 'app/Query')
| -rw-r--r-- | app/Query/QueryMedia.php | 8 | ||||
| -rw-r--r-- | app/Query/QueryName.php | 104 |
2 files changed, 53 insertions, 59 deletions
diff --git a/app/Query/QueryMedia.php b/app/Query/QueryMedia.php index 605ddc22e6..42ab27fbc8 100644 --- a/app/Query/QueryMedia.php +++ b/app/Query/QueryMedia.php @@ -18,10 +18,6 @@ namespace Fisharebest\Webtrees; /** * Class QueryMedia - generate lists of files for admin_media.php - * - * @package webtrees - * @copyright (c) 2014 webtrees development team - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 */ class QueryMedia { /** @@ -80,8 +76,9 @@ class QueryMedia { * @param string $filter optional search string * @param string $form_type option OBJE/FILE/FORM/TYPE * - * @return Media[] * @throws \Exception + * + * @return Media[] */ public static function mediaList($folder, $subfolders, $sort, $filter, $form_type) { global $WT_TREE; @@ -148,6 +145,7 @@ class QueryMedia { $list[] = $media; } } + return $list; } } diff --git a/app/Query/QueryName.php b/app/Query/QueryName.php index e825baa92f..306ae2dc1e 100644 --- a/app/Query/QueryName.php +++ b/app/Query/QueryName.php @@ -18,10 +18,6 @@ namespace Fisharebest\Webtrees; /** * Class QueryName - generate lists for indilist.php and famlist.php - * - * @package webtrees - * @copyright (c) 2015 webtrees development team - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 */ class QueryName { /** @@ -35,82 +31,82 @@ class QueryName { switch ($locale) { case 'ar': return array( - 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی' + 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی', ); case 'cs': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'da': case 'nb': case 'nn': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å', ); case 'el': return array( - 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω' + 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω', ); case 'es': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'et': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y', ); case 'fi': case 'sv': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö', ); case 'he': return array( - 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת' + 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת', ); case 'hu': return array( - 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS' + 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS', ); case 'lt': return array( - 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž' + 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž', ); case 'nl': return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ', ); case 'pl': return array( - 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż' + 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż', ); case 'ro': return array( - 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z', ); case 'ru': return array( - 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я' + 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', ); case 'sk': return array( - 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž' + 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž', ); case 'sl': return array( - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž' + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', ); case 'sr': return array( - 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž' + 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž', ); case 'tr': return array( - 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z' + 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z', ); default: return array( - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ); } } @@ -231,10 +227,10 @@ class QueryName { /** * Get a list of initial surname letters for indilist.php and famlist.php * - * @param Tree $tree Find surnames from this tree - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records - * @param boolean $totals if set, count the number of names beginning with each letter + * @param Tree $tree Find surnames from this tree + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records + * @param bool $totals if set, count the number of names beginning with each letter * * @return integer[] */ @@ -275,7 +271,7 @@ class QueryName { foreach (self::getAlphabetForLocale(WT_LOCALE) as $n => $letter) { $sql .= " AND n_surn COLLATE :collate_" . $n . " NOT LIKE :letter_" . $n; $args['collate_' . $n] = I18N::collation(); - $args['letter_' . $n] = $letter . '%'; + $args['letter_' . $n] = $letter . '%'; } $sql .= " GROUP BY UPPER(LEFT(n_surn, 1))) AS subquery ORDER BY initial = '', initial = '@', initial"; foreach (Database::prepare($sql)->execute($args)->fetchAssoc() as $alpha => $count) { @@ -306,11 +302,11 @@ class QueryName { /** * Get a list of initial given name letters for indilist.php and famlist.php * - * @param Tree $tree Find names in this tree - * @param string $surn if set, only consider people with this surname - * @param string $salpha if set, only consider surnames starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records + * @param Tree $tree Find names in this tree + * @param string $surn if set, only consider people with this surname + * @param string $salpha if set, only consider surnames starting with this letter + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records * * @return integer[] */ @@ -341,7 +337,7 @@ class QueryName { // are any names beginning with that letter. It looks better to // show the full alphabet, rather than omitting rare letters such as X foreach (self::getAlphabetForLocale(WT_LOCALE) as $letter) { - $count = Database::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne(); + $count = Database::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne(); $alphas[$letter] = $count; } @@ -361,7 +357,7 @@ class QueryName { if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -388,11 +384,11 @@ class QueryName { /** * Get a list of actual surnames and variants, based on a "root" surname. * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only consider surnames starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only consider individuals with FAMS records + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only consider surnames starting with this letter + * @param bool $marnm if set, include married names + * @param bool $fams if set, only consider individuals with FAMS records * * @return array */ @@ -406,14 +402,14 @@ class QueryName { ($marnm ? "" : " AND n_type != '_MARNM'"); $args = array( - 'tree_id' => $tree->getTreeId(), + 'tree_id' => $tree->getTreeId(), 'collate_0' => I18N::collation(), ); if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -442,12 +438,12 @@ class QueryName { * To search for unknown names, use $surn="@N.N.", $salpha="@" or $galpha="@" * To search for names with no surnames, use $salpha="," * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only fetch surnames starting with this letter + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only fetch surnames starting with this letter * @param string $galpha if set, only fetch given names starting with this letter - * @param boolean $marnm if set, include married names - * @param boolean $fams if set, only fetch individuals with FAMS records + * @param bool $marnm if set, include married names + * @param bool $fams if set, only fetch individuals with FAMS records * * @return Individual[] */ @@ -467,7 +463,7 @@ class QueryName { if ($surn) { $sql .= " AND n_surn COLLATE :collate_1 = :surn"; $args['collate_1'] = I18N::collation(); - $args['surn'] = $surn; + $args['surn'] = $surn; } elseif ($salpha === ',') { $sql .= " AND n_surn = ''"; } elseif ($salpha === '@') { @@ -491,7 +487,7 @@ class QueryName { foreach ($rows as $row) { $person = Individual::getInstance($row->xref, $tree, $row->gedcom); // The name from the database may be private - check the filtered list... - foreach ($person->getAllNames() as $n=>$name) { + foreach ($person->getAllNames() as $n => $name) { if ($name['fullNN'] == $row->n_full) { $person->setPrimaryName($n); // We need to clone $person, as we may have multiple references to the @@ -512,11 +508,11 @@ class QueryName { * To search for unknown names, use $surn="@N.N.", $salpha="@" or $galpha="@" * To search for names with no surnames, use $salpha="," * - * @param Tree $tree only fetch individuals from this tree - * @param string $surn if set, only fetch people with this surname - * @param string $salpha if set, only fetch surnames starting with this letter - * @param string $galpha if set, only fetch given names starting with this letter - * @param boolean $marnm if set, include married names + * @param Tree $tree only fetch individuals from this tree + * @param string $surn if set, only fetch people with this surname + * @param string $salpha if set, only fetch surnames starting with this letter + * @param string $galpha if set, only fetch given names starting with this letter + * @param bool $marnm if set, include married names * * @return Family[] */ |
