X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6a3c6c43ea7133c934834ce1face9212f4e3d239..f00baba40c6f73ba8e637ac4cea60d59a11692f4:/website/hierarchy.php
diff --git a/website/hierarchy.php b/website/hierarchy.php
old mode 100755
new mode 100644
index 8f2f5237..419a0474
--- a/website/hierarchy.php
+++ b/website/hierarchy.php
@@ -1,10 +1,8 @@
setLanguagePreference($aLangPrefOrder);
-$oPlaceLookup->setIncludeAddressDetails(true);
-$aPlaceAddress = array_reverse($oPlaceLookup->getAddressDetails($iPlaceID));
+$oAddressLookup = new AddressDetails($oDB, $iPlaceID, -1, $aLangPrefOrder);
+$aPlaceAddress = array_reverse($oAddressLookup->getAddressDetails());
-if (!sizeof($aPlaceAddress)) userError('Unknown place id.');
+if (empty($aPlaceAddress)) userError('Unknown place id.');
$aBreadcrums = array();
foreach ($aPlaceAddress as $i => $aPlace) {
@@ -100,20 +96,14 @@ $sSQL .= ' where parent_place_id in ('.join(',', $aRelatedPlaceIDs).') and name
$sSQL .= ' order by rank_address asc,rank_search asc,localname,class, type,housenumber';
$aParentOfLines = chksql($oDB->getAll($sSQL));
-if (sizeof($aParentOfLines)) {
+if (!empty($aParentOfLines)) {
echo '
Parent Of:
';
- $aClassType = getClassTypesWithImportance();
$aGroupedAddressLines = array();
foreach ($aParentOfLines as $aAddressLine) {
- if (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'])
- && $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label']
- ) {
- $aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type'].':'.$aAddressLine['admin_level']]['label'];
- } elseif (isset($aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'])
- && $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label']
- ) {
- $aAddressLine['label'] = $aClassType[$aAddressLine['class'].':'.$aAddressLine['type']]['label'];
- } else $aAddressLine['label'] = ucwords($aAddressLine['type']);
+ $aAddressLine['label'] = Nominatim\ClassTypes\getProperty($aAddressLine, 'label');
+ if (!$aAddressLine['label']) {
+ $aAddressLine['label'] = ucwords($aAddressLine['type']);
+ }
if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
$aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
@@ -136,7 +126,7 @@ if (sizeof($aParentOfLines)) {
echo '';
}
}
- if (sizeof($aParentOfLines) >= 500) {
+ if (count($aParentOfLines) >= 500) {
echo 'There are more child objects which are not shown.
';
}
echo '';