- function headline($sTitle)
- {
- echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
- }
-
- function headline3($sTitle)
- {
- echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
- }
-
- function osm_link($aFeature)
- {
- $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
- if ($sOSMType)
- {
- return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
- }
- return '';
- }
-
- function wikipedia_link($aFeature)
- {
- if ($aFeature['wikipedia'])
- {
- list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
- return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
- }
- return '';
- }
-
- function nominatim_link($aFeature, $sTitle)
- {
- return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
- }
-
- function format_distance($fDistance)
- {
- // $fDistance is in meters
- if ($fDistance < 1)
- {
- return '0';
- }
- elseif ($fDistance < 1000)
- {
- return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
- }
- else
- {
- return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
- }
- }
-
- function kv($sKey,$sValue)
- {
- echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
- }
-
-
- function hash_to_subtable($aAssociatedList)
- {
- $sHTML = '';
- foreach($aAssociatedList as $sKey => $sValue)
- {
- $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
- }
- return $sHTML;
- }
-
- // function hash_to_subtable($aAssociatedList)
- // {
- // $sHTML = '<table class="table">';
- // foreach($aAssociatedList as $sKey => $sValue)
- // {
- // $sHTML = $sHTML . '<tr><td>'.$sKey.'</td><td class="name">'.$sValue.'</td></tr>'."\n";
- // }
- // $sHTML = $sHTML . '</table>';
- // return $sHTML;
- // }
-
-
- function map_icon($sIcon)
- {
- if ($sIcon){
- echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
- }
- }
-
-
- function _one_row($aAddressLine){
- $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
-
- echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
- echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
- echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
- echo ' <td>' . osm_link($aAddressLine) . "</td>\n";
- echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
- // echo '<td>' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') ."</td>\n";
- // echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
- echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
- echo ' <td>' . nominatim_link($aAddressLine,'details >') . "</td>\n";
- echo "</tr>\n";
- }
-
- function _one_keyword_row($keyword_token,$word_id){
- echo "<tr>\n";
- echo '<td>';
- // mark partial tokens (those starting with a space) with a star for readability
- echo ($keyword_token[0]==' '?'*':'');
- echo $keyword_token;
- if (isset($word_id))
- {
- echo '</td><td>('.$word_id.')';
- }
- echo "</td></tr>\n";
- }
+ function headline($sTitle)
+ {
+ echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
+ }
+
+ function headline3($sTitle)
+ {
+ echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
+ }
+
+
+ function format_distance($fDistance, $bInMeters = false)
+ {
+ if ($bInMeters) {
+ // $fDistance is in meters
+ if ($fDistance < 1) {
+ return '0';
+ }
+ elseif ($fDistance < 1000) {
+ return '<abbr class="distance" title="'.$fDistance.' meters">~'.(round($fDistance,0)).' m</abbr>';
+ }
+ else {
+ return '<abbr class="distance" title="'.$fDistance.' meters">~'.(round($fDistance/1000,1)).' km</abbr>';
+ }
+ } else {
+ if ($fDistance == 0) {
+ return '0';
+ } else {
+ return '<abbr class="distance" title="spheric distance '.$fDistance.'">'.(round($fDistance,4)).'</abbr>';
+ }
+ }
+ }
+
+ function kv($sKey,$sValue)
+ {
+ echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
+ }
+
+
+ function hash_to_subtable($aAssociatedList)
+ {
+ $sHTML = '';
+ foreach ($aAssociatedList as $sKey => $sValue) {
+ $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
+ }
+ return $sHTML;
+ }
+
+ function map_icon($sIcon)
+ {
+ if ($sIcon){
+ echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
+ }
+ }
+
+
+ function _one_row($aAddressLine, $bDistanceInMeters = false){
+ $bNotUsed = isset($aAddressLine['isaddress']) && !$aAddressLine['isaddress'];
+
+ echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
+ echo ' <td class="name">'.(trim($aAddressLine['localname'])!==null?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
+ echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
+ echo ' <td>' . osmLink($aAddressLine) . "</td>\n";
+ echo ' <td>' . (isset($aAddressLine['rank_address']) ? $aAddressLine['rank_address'] : '') . "</td>\n";
+ echo ' <td>' . ($aAddressLine['admin_level'] < 15 ? $aAddressLine['admin_level'] : '') . "</td>\n";
+ echo ' <td>' . format_distance($aAddressLine['distance'], $bDistanceInMeters)."</td>\n";
+ echo ' <td>' . detailsPermaLink($aAddressLine,'details >') . "</td>\n";
+ echo "</tr>\n";
+ }
+
+ function _one_keyword_row($keyword_token,$word_id){
+ echo "<tr>\n";
+ echo '<td>';
+ // mark partial tokens (those starting with a space) with a star for readability
+ echo ($keyword_token[0]==' '?'*':'');
+ echo $keyword_token;
+ if (isset($word_id))
+ {
+ echo '</td><td>word id: '.$word_id;
+ }
+ echo "</td></tr>\n";
+ }