2 header("content-type: text/html; charset=UTF-8");
4 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
5 <link href="css/common.css" rel="stylesheet" type="text/css" />
6 <link href="css/details.css" rel="stylesheet" type="text/css" />
13 function headline($sTitle)
15 echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
18 function headline3($sTitle)
20 echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
23 function osm_link($aFeature)
25 $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
28 return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
33 function wikipedia_link($aFeature)
35 if ($aFeature['wikipedia'])
37 list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
38 return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
43 function nominatim_link($aFeature, $sTitle)
45 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
48 function format_distance($fDistance)
50 // $fDistance is in meters
55 elseif ($fDistance < 1000)
57 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
61 return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
65 function kv($sKey,$sValue)
67 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
71 function hash_to_subtable($aAssociatedList)
74 foreach($aAssociatedList as $sKey => $sValue)
76 $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
81 function map_icon($sIcon)
84 echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
89 function _one_row($aAddressLine){
90 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
92 echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
93 echo ' <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
94 echo ' <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
95 echo ' <td>' . osm_link($aAddressLine) . "</td>\n";
96 echo ' <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
97 echo ' <td>' . format_distance($aAddressLine['distance'])."</td>\n";
98 echo ' <td>' . nominatim_link($aAddressLine,'details >') . "</td>\n";
102 function _one_keyword_row($keyword_token,$word_id){
105 // mark partial tokens (those starting with a space) with a star for readability
106 echo ($keyword_token[0]==' '?'*':'');
110 echo '</td><td>word id: '.$word_id;
119 <body id="details-page">
120 <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
121 <div class="container">
123 <div class="col-sm-10">
124 <h1><?php echo $aPointDetails['localname'] ?></h1>
126 <div class="col-sm-2 text-right">
127 <?php map_icon($aPointDetails['icon']) ?>
131 <div class="col-md-6">
132 <table id="locationdetails" class="table table-striped">
136 kv('Name' , hash_to_subtable($aPointDetails['aNames']) );
137 kv('Type' , $aPointDetails['class'].':'.$aPointDetails['type'] );
138 kv('Last Updated' , $aPointDetails['indexed_date'] );
139 kv('Admin Level' , $aPointDetails['admin_level'] );
140 kv('Rank' , $aPointDetails['rank_search_label'] );
141 if ($aPointDetails['calculated_importance']) {
142 kv('Importance' , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
144 kv('Coverage' , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
145 kv('Centre Point' , $aPointDetails['lat'].','.$aPointDetails['lon'] );
146 kv('OSM' , osm_link($aPointDetails) );
147 if ($aPointDetails['wikipedia'])
149 kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
152 kv('Extra Tags' , hash_to_subtable($aPointDetails['aExtraTags']) );
159 <div class="col-md-6">
165 <div class="col-md-12">
169 <table id="address" class="table table-striped table-responsive">
184 foreach($aAddressLines as $aAddressLine)
186 _one_row($aAddressLine);
196 headline('Linked Places');
197 foreach($aLinkedLines as $aAddressLine)
199 _one_row($aAddressLine);
205 if ($aPlaceSearchNameKeywords)
207 headline('Name Keywords');
208 foreach($aPlaceSearchNameKeywords as $aRow)
210 _one_keyword_row($aRow['word_token'], $aRow['word_id']);
214 if ($aPlaceSearchAddressKeywords)
216 headline('Address Keywords');
217 foreach($aPlaceSearchAddressKeywords as $aRow)
219 _one_keyword_row($aRow['word_token'], $aRow['word_id']);
223 if (sizeof($aParentOfLines))
225 headline('Parent Of');
227 $aGroupedAddressLines = array();
228 foreach($aParentOfLines as $aAddressLine)
230 if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
231 else $sType = $aAddressLine['type'];
233 if (!isset($aGroupedAddressLines[$sType]))
234 $aGroupedAddressLines[$sType] = array();
235 $aGroupedAddressLines[$sType][] = $aAddressLine;
237 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
239 $sGroupHeading = ucwords($sGroupHeading);
240 headline3($sGroupHeading);
242 foreach($aParentOfLines as $aAddressLine)
244 _one_row($aAddressLine);
247 if (sizeof($aParentOfLines) >= 500) {
248 echo '<p>There are more child objects which are not shown.</p>';
259 <script type="text/javascript">
262 $aNominatimMapInit = array(
263 'tile_url' => $sTileURL,
264 'tile_attribution' => $sTileAttribution
266 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
269 'outlinestring' => $aPointDetails['outlinestring'],
270 'lon' => $aPointDetails['lon'],
271 'lat' => $aPointDetails['lat'],
273 echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';';
281 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>