- 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)
- {
- // $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 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>' . osmLink($aAddressLine) . "</td>\n";
- echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
- echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
- echo ' <td>' . detailsLink($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";
- }
+ 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($aPlace)
+ {
+ $sIcon = Nominatim\ClassTypes\getIconFile($aPlace);
+ if (isset($sIcon)) {
+ $sLabel = Nominatim\ClassTypes\getIcon($aPlace);
+ echo '<img id="mapicon" src="'.$sIcon.'" alt="'.$sLabel.'" />';
+ }
+ }
+
+
+ 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'];
+ if ($aAddressLine['type'] == 'administrative'
+ && isset($aAddressLine['place_type']))
+ {
+ echo '('.$aAddressLine['place_type'].')';
+ }
+ echo "</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";
+ }