X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1d836f6c5ccee069fd41137af1c0fef8d65f48f9..f0f6fcf256c83176dbcda0d0fd4fec977ea8a0ad:/lib/template/details-html.php
diff --git a/lib/template/details-html.php b/lib/template/details-html.php
index a38ee1bc..ae36b411 100644
--- a/lib/template/details-html.php
+++ b/lib/template/details-html.php
@@ -1,232 +1,283 @@
-
-
-
- ';
- echo '
Name: ';
- foreach($aPointDetails['aNames'] as $sKey => $sValue)
+
+ function headline3($sTitle)
+ {
+ echo "
".$sTitle." |
\n";
+ }
+
+ function osm_link($aFeature)
{
- echo '
'.$sValue.' ('.$sKey.')
';
+ $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
+ if ($sOSMType)
+ {
+ return '
'.$sOSMType.' '.$aFeature['osm_id'].'';
+ }
+ return '';
}
- echo '
';
- echo '
Type: '.$aPointDetails['class'].':'.$aPointDetails['type'].'
';
- echo '
Last Updated: '.$aPointDetails['indexed_date'].'
';
- echo '
Admin Level: '.$aPointDetails['admin_level'].'
';
- echo '
Rank: '.$aPointDetails['rank_search_label'].'
';
- if ($aPointDetails['calculated_importance']) echo '
Importance: '.$aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)').'
';
- echo '
Coverage: '.($aPointDetails['isarea']=='t'?'Polygon':'Point').'
';
- echo '
Centre Point: '.$aPointDetails['lat'].','.$aPointDetails['lon'].'
';
- $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
- if ($sOSMType) echo '
';
- if ($aPointDetails['wikipedia'])
+
+ function wikipedia_link($aFeature)
{
- list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aPointDetails['wikipedia']);
- echo '
';
+ if ($aFeature['wikipedia'])
+ {
+ list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
+ return '
'.$aFeature['wikipedia'].'';
+ }
+ return '';
}
- echo '
Extra Tags: ';
- foreach($aPointDetails['aExtraTags'] as $sKey => $sValue)
+
+ function nominatim_link($aFeature, $sTitle)
{
- echo '
'.$sValue.' ('.$sKey.')
';
+ return '
'.$sTitle.'';
}
- echo '
';
- echo '
';
-
- echo '';
- $iPrevRank = 1000000;
- $sPrevLocalName = '';
- foreach($aAddressLines as $aAddressLine)
- {
- $sOSMType = ($aAddressLine['osm_type'] == 'N'?'node':($aAddressLine['osm_type'] == 'W'?'way':($aAddressLine['osm_type'] == 'R'?'relation':'')));
-
- echo '
';
- if (!($iPrevRank<=$aAddressLine['rank_address'] || $sPrevLocalName == $aAddressLine['localname']))
+
+ function format_distance($fDistance)
+ {
+ // $fDistance is in meters
+ if ($fDistance < 1)
{
- $iPrevRank = $aAddressLine['rank_address'];
- $sPrevLocalName = $aAddressLine['localname'];
+ return '0';
}
- echo '
'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name').'';
- echo ' (';
- echo '
Type: '.$aAddressLine['class'].':'.$aAddressLine['type'].'';
- if ($sOSMType) echo ',
'.$sOSMType.' '.$aAddressLine['osm_id'].'';
- if (isset($aAddressLine['admin_level'])) echo ',
'.$aAddressLine['admin_level'].'';
- if (isset($aAddressLine['rank_search_label'])) echo ',
'.$aAddressLine['rank_search_label'].'';
-// echo ',
'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'';
- echo ',
'.$aAddressLine['distance'].'';
- echo '
GOTO';
- echo ')';
- echo '
';
+ elseif ($fDistance < 1000)
+ {
+ return'
~'.(round($fDistance,0)).' m';
+ }
+ else
+ {
+ return'
~'.(round($fDistance/1000,1)).' km';
+ }
+ }
+
+ function kv($sKey,$sValue)
+ {
+ echo '
' . $sKey . ' | '.$sValue.' |
'. "\n";
}
- echo '
';
+
+
+ function hash_to_subtable($aAssociatedList)
+ {
+ $sHTML = '';
+ foreach($aAssociatedList as $sKey => $sValue)
+ {
+ $sHTML = $sHTML.' '."\n";
+ echo ' '.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'No Name')." | \n";
+ echo ' ' . $aAddressLine['class'].':'.$aAddressLine['type'] . " | \n";
+ echo ' ' . osm_link($aAddressLine) . " | \n";
+ echo ' ' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . " | \n";
+ echo ' ' . format_distance($aAddressLine['distance'])." | \n";
+ echo ' ' . nominatim_link($aAddressLine,'details >') . " | \n";
+ echo "
\n";
+ }
+
+ function _one_keyword_row($keyword_token,$word_id){
+ echo "