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" />
 
   9 <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
 
  14         function headline($sTitle)
 
  16                 echo "<h2>".$sTitle."</h2>\n";
 
  19         function osm_link($aFeature)
 
  21                 $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':'')));
 
  24                         return '<a href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aFeature['osm_id'].'">'.$sOSMType.' '.$aFeature['osm_id'].'</a>';
 
  29         function wikipedia_link($aFeature)
 
  31                 if ($aFeature['wikipedia'])
 
  33                         list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']);
 
  34                         return '<a href="https://'.$sWikipediaLanguage.'.wikipedia.org/wiki/'.urlencode($sWikipediaArticle).'" target="_blank">'.$aFeature['wikipedia'].'</a>';
 
  39         function nominatim_link($aFeature, $sTitle)
 
  41                 return '<a href="details.php?place_id='.$aFeature['place_id'].'">'.$sTitle.'</a>';
 
  44         function format_distance($fDistance)
 
  46                 // $fDistance is in meters
 
  51                 elseif ($fDistance < 1000)
 
  53                         return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
 
  57                         return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
 
  61         function kv($sKey,$sValue)
 
  63                 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
 
  67         function hash_to_subtable($aAssociatedList)
 
  70                 foreach($aAssociatedList as $sKey => $sValue)
 
  72                         $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
 
  77         // function hash_to_subtable($aAssociatedList)
 
  79         //      $sHTML = '<table class="table">';
 
  80         //      foreach($aAssociatedList as $sKey => $sValue)
 
  82         //              $sHTML = $sHTML . '<tr><td>'.$sKey.'</td><td class="name">'.$sValue.'</td></tr>'."\n";
 
  84         //      $sHTML = $sHTML . '</table>';
 
  89         function map_icon($sIcon)
 
  92                         echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
 
  97         function _one_row($aAddressLine){
 
  98                 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
 
 100                 echo '<tr class="' . ($bNotUsed?'notused':'') . '">';
 
 101                 echo '  <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>').'</td>';
 
 102                 echo '  <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . '</td>';
 
 103                 echo '  <td>' . osm_link($aAddressLine) . '</td>';
 
 104                 echo '  <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . '</td>';
 
 105                 // echo '<td>' . (isset($aAddressLine['rank_search_label']) ? $aAddressLine['rank_search_label'] : '') .'</td>';
 
 106                 // echo ', <span class="area">'.($aAddressLine['fromarea']=='t'?'Polygon':'Point').'</span>';
 
 107                 echo '  <td>' . format_distance($aAddressLine['distance']).'</td>';;
 
 108                 echo '  <td>' . nominatim_link($aAddressLine,'details >') . '</td>';;
 
 116 <body id="details-page">
 
 117         <div class="container">
 
 119                         <div class="col-sm-10">
 
 120                                 <h1><?php echo $aPointDetails['localname'] ?></h1>
 
 122                         <div class="col-sm-2 text-right">
 
 123                                 <?php map_icon($aPointDetails['icon']) ?>
 
 127                         <div class="col-md-6">
 
 128                                 <table id="locationdetails" class="table table-striped">
 
 132                                         kv('Name'            , hash_to_subtable($aPointDetails['aNames']) );
 
 133                                         kv('Type'            , $aPointDetails['class'].':'.$aPointDetails['type'] );
 
 134                                         kv('Last Updated'    , $aPointDetails['indexed_date'] );
 
 135                                         kv('Admin Level'     , $aPointDetails['admin_level'] );
 
 136                                         kv('Rank'            , $aPointDetails['rank_search_label'] );
 
 137                                         if ($aPointDetails['calculated_importance']) {
 
 138                                                 kv('Importance'    , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
 
 140                                         kv('Coverage'        , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
 
 141                                         kv('Centre Point'    , $aPointDetails['lat'].','.$aPointDetails['lon'] );
 
 142                                         kv('OSM'             , osm_link($aPointDetails) );
 
 143                                         if ($aPointDetails['wikipedia'])
 
 145                                                 kv('Wikipedia Calculated' , wikipedia_link($aPointDetails) );
 
 148                                         kv('Extra Tags'      , hash_to_subtable($aPointDetails['aExtraTags']) );
 
 155                         <div class="col-md-6">
 
 161                         <div class="col-md-12">
 
 165                         <table id="address" class="table table-striped table-responsive">
 
 172                                           <!-- <td>Search rank</td> -->
 
 181                                         foreach($aAddressLines as $aAddressLine)
 
 183                                                 _one_row($aAddressLine);
 
 195                 headline('Linked Places');
 
 196                 echo '<table id="linked" class="table table-striped table-responsive">';
 
 197                 foreach($aLinkedLines as $aAddressLine)
 
 199                         _one_row($aAddressLine);
 
 206         if ($aPlaceSearchNameKeywords)
 
 208                 headline('Name Keywords');
 
 209                 foreach($aPlaceSearchNameKeywords as $aRow)
 
 211                         echo '<div>'.$aRow['word_token']."</div>\n";
 
 215         if ($aPlaceSearchAddressKeywords)
 
 217                 headline('Address Keywords');
 
 218                 foreach($aPlaceSearchAddressKeywords as $aRow)
 
 220                         echo '<div>'.($aRow['word_token'][0]==' '?'*':'').$aRow['word_token'].'('.$aRow['word_id'].')'."</div>\n";
 
 224         if (sizeof($aParentOfLines))
 
 226                 headline('Parent Of');
 
 228                 $aGroupedAddressLines = array();
 
 229                 foreach($aParentOfLines as $aAddressLine)
 
 231                         if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
 
 232                         else $sType = $aAddressLine['type'];
 
 234                         if (!isset($aGroupedAddressLines[$sType]))
 
 235                                 $aGroupedAddressLines[$sType] = array();
 
 236                         $aGroupedAddressLines[$sType][] = $aAddressLine;
 
 238                 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
 
 240                         $sGroupHeading = ucwords($sGroupHeading);
 
 241                         echo "<h3>$sGroupHeading</h3>\n";
 
 243                         echo '<table id="linked" class="table table-striped table-responsive">';
 
 244                         foreach($aParentOfLines as $aAddressLine)
 
 246                                 _one_row($aAddressLine);
 
 250                 if (sizeof($aParentOfLines) >= 500) {
 
 251                         echo '<p>There are more child objects which are not shown.</p>';
 
 255         // headline('Other Parts');
 
 256         // headline('Linked To');
 
 263         <script type="text/javascript">
 
 265                 var nominatim_result = {
 
 266                         outlinestring: '<?php echo $aPointDetails['outlinestring'];?>',
 
 267                         lon: <?php echo $aPointDetails['lon'];?>,
 
 268                         lat: <?php echo $aPointDetails['lat'];?>,
 
 275         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>