X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b14bc75dc4a0ca44485599d8ab4cf1c5781098e2..da7218350b42f6470d575b88b9e6bb72b6e65ee5:/lib/output.php
diff --git a/lib/output.php b/lib/output.php
index 722d73b1..823a6631 100644
--- a/lib/output.php
+++ b/lib/output.php
@@ -1,43 +1,73 @@
'.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'';
- }
- return '';
- }
-
- function wikipediaLink($aFeature)
- {
- if ($aFeature['wikipedia'])
- {
- list($sLanguage, $sArticle) = explode(':',$aFeature['wikipedia']);
- return ''.$aFeature['wikipedia'].'';
- }
- return '';
- }
-
- function detailsLink($aFeature, $sTitle=false)
- {
- if (!$aFeature['place_id']) return '';
-
- return ''.($sTitle?$sTitle:$aFeature['place_id']).'';
- }
+function formatOSMType($sType, $bIncludeExternal = true)
+{
+ if ($sType == 'N') return 'node';
+ if ($sType == 'W') return 'way';
+ if ($sType == 'R') return 'relation';
+
+ if (!$bIncludeExternal) return '';
+
+ if ($sType == 'T') return 'way';
+ if ($sType == 'I') return 'way';
+
+ // not handled: P, L
+
+ return '';
+}
+
+function osmLink($aFeature, $sRefText = false)
+{
+ $sOSMType = formatOSMType($aFeature['osm_type'], false);
+ if ($sOSMType) {
+ return ''.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).'';
+ }
+ return '';
+}
+
+function wikipediaLink($aFeature)
+{
+ if ($aFeature['wikipedia']) {
+ list($sLanguage, $sArticle) = explode(':', $aFeature['wikipedia']);
+ return ''.$aFeature['wikipedia'].'';
+ }
+ return '';
+}
+
+function detailsLink($aFeature, $sTitle = false, $sExtraProperties = false)
+{
+ if (!$aFeature['place_id']) return '';
+
+ $sHtml = ''.($sTitle?$sTitle:$aFeature['place_id']).'';
+
+ return $sHtml;
+}
+
+function detailsPermaLink($aFeature, $sRefText = false, $sExtraProperties = false)
+{
+ $sOSMType = formatOSMType($aFeature['osm_type'], false);
+
+ if ($sOSMType) {
+ $sHtml = '';
+
+ if ($sRefText) {
+ $sHtml .= $sRefText.'';
+ } else {
+ $sHtml .= $sOSMType.' '.$aFeature['osm_id'].'';
+ }
+
+ return $sHtml;
+ }
+ return detailsLink($aFeature, $sRefText, $sExtraProperties);
+}