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" />
 
  12         function headline($sTitle)
 
  14                 echo "<tr class='all-columns'><td colspan='6'><h2>".$sTitle."</h2></td></tr>\n";
 
  17         function headline3($sTitle)
 
  19                 echo "<tr class='all-columns'><td colspan='6'><h3>".$sTitle."</h3></td></tr>\n";
 
  23         function format_distance($fDistance)
 
  25                 // $fDistance is in meters
 
  30                 elseif ($fDistance < 1000)
 
  32                         return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance,0)).' m</abbr>';
 
  36                         return'<abbr class="distance" title="'.$fDistance.'">~'.(round($fDistance/1000,1)).' km</abbr>';
 
  40         function kv($sKey,$sValue)
 
  42                 echo ' <tr><td>' . $sKey . '</td><td>'.$sValue.'</td></tr>'. "\n";
 
  46         function hash_to_subtable($aAssociatedList)
 
  49                 foreach($aAssociatedList as $sKey => $sValue)
 
  51                         $sHTML = $sHTML.' <div class="line"><span class="name">'.$sValue.'</span> ('.$sKey.')</div>'."\n";
 
  56         function map_icon($sIcon)
 
  59                         echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
 
  64         function _one_row($aAddressLine){
 
  65                 $bNotUsed = (isset($aAddressLine['isaddress']) && $aAddressLine['isaddress'] == 'f');
 
  67                 echo '<tr class="' . ($bNotUsed?'notused':'') . '">'."\n";
 
  68                 echo '  <td class="name">'.(trim($aAddressLine['localname'])?$aAddressLine['localname']:'<span class="noname">No Name</span>')."</td>\n";
 
  69                 echo '  <td>' . $aAddressLine['class'].':'.$aAddressLine['type'] . "</td>\n";
 
  70                 echo '  <td>' . osmLink($aAddressLine) . "</td>\n";
 
  71                 echo '  <td>' . (isset($aAddressLine['admin_level']) ? $aAddressLine['admin_level'] : '') . "</td>\n";
 
  72                 echo '  <td>' . format_distance($aAddressLine['distance'])."</td>\n";
 
  73                 echo '  <td>' . detailsLink($aAddressLine,'details >') . "</td>\n";
 
  77         function _one_keyword_row($keyword_token,$word_id){
 
  80                 // mark partial tokens (those starting with a space) with a star for readability
 
  81                 echo ($keyword_token[0]==' '?'*':'');
 
  85                         echo '</td><td>word id: '.$word_id;
 
  94 <body id="details-page">
 
  95         <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
 
  96         <div class="container">
 
  98                         <div class="col-sm-10">
 
  99                                 <h1><?php echo $aPointDetails['localname'] ?></h1>
 
 101                         <div class="col-sm-2 text-right">
 
 102                                 <?php map_icon($aPointDetails['icon']) ?>
 
 106                         <div class="col-md-6">
 
 107                                 <table id="locationdetails" class="table table-striped">
 
 111                                         kv('Name'            , hash_to_subtable($aPointDetails['aNames']) );
 
 112                                         kv('Type'            , $aPointDetails['class'].':'.$aPointDetails['type'] );
 
 113                                         kv('Last Updated'    , $aPointDetails['indexed_date'] );
 
 114                                         kv('Admin Level'     , $aPointDetails['admin_level'] );
 
 115                                         kv('Rank'            , $aPointDetails['rank_search_label'] );
 
 116                                         if ($aPointDetails['calculated_importance']) {
 
 117                                                 kv('Importance'    , $aPointDetails['calculated_importance'].($aPointDetails['importance']?'':' (estimated)') );
 
 119                                         kv('Coverage'        , ($aPointDetails['isarea']=='t'?'Polygon':'Point') );
 
 120                                         kv('Centre Point'    , $aPointDetails['lat'].','.$aPointDetails['lon'] );
 
 121                                         kv('OSM'             , osmLink($aPointDetails) );
 
 122                                         if ($aPointDetails['wikipedia'])
 
 124                                                 kv('Wikipedia Calculated' , wikipediaLink($aPointDetails) );
 
 127                                         kv('Extra Tags'      , hash_to_subtable($aPointDetails['aExtraTags']) );
 
 134                         <div class="col-md-6">
 
 140                         <div class="col-md-12">
 
 144                         <table id="address" class="table table-striped table-responsive">
 
 159                                         foreach($aAddressLines as $aAddressLine)
 
 161                                                 _one_row($aAddressLine);
 
 171                 headline('Linked Places');
 
 172                 foreach($aLinkedLines as $aAddressLine)
 
 174                         _one_row($aAddressLine);
 
 180         if ($aPlaceSearchNameKeywords)
 
 182                 headline('Name Keywords');
 
 183                 foreach($aPlaceSearchNameKeywords as $aRow)
 
 185                         _one_keyword_row($aRow['word_token'], $aRow['word_id']);
 
 189         if ($aPlaceSearchAddressKeywords)
 
 191                 headline('Address Keywords');
 
 192                 foreach($aPlaceSearchAddressKeywords as $aRow)
 
 194                         _one_keyword_row($aRow['word_token'], $aRow['word_id']);
 
 198         if (sizeof($aParentOfLines))
 
 200                 headline('Parent Of');
 
 202                 $aGroupedAddressLines = array();
 
 203                 foreach($aParentOfLines as $aAddressLine)
 
 205                         if ($aAddressLine['type'] == 'yes') $sType = $aAddressLine['class'];
 
 206                         else $sType = $aAddressLine['type'];
 
 208                         if (!isset($aGroupedAddressLines[$sType]))
 
 209                                 $aGroupedAddressLines[$sType] = array();
 
 210                         $aGroupedAddressLines[$sType][] = $aAddressLine;
 
 212                 foreach($aGroupedAddressLines as $sGroupHeading => $aParentOfLines)
 
 214                         $sGroupHeading = ucwords($sGroupHeading);
 
 215                         headline3($sGroupHeading);
 
 217                         foreach($aParentOfLines as $aAddressLine)
 
 219                                 _one_row($aAddressLine);
 
 222                 if (sizeof($aParentOfLines) >= 500) {
 
 223                         echo '<p>There are more child objects which are not shown.</p>';
 
 234         <script type="text/javascript">
 
 237                 $aNominatimMapInit = array(
 
 238                   'tile_url' => $sTileURL,
 
 239                   'tile_attribution' => $sTileAttribution
 
 241                 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
 
 244                                 'outlinestring' => $aPointDetails['outlinestring'],
 
 245                                 'lon' => $aPointDetails['lon'],
 
 246                                 'lat' => $aPointDetails['lat'],
 
 248                 echo 'var nominatim_result = ' . json_encode($aPlace, JSON_PRETTY_PRINT) . ';'; 
 
 256         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>