]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-html.php
corrected layout of keywords on HTML details page
[nominatim.git] / lib / template / address-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
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/search.css" rel="stylesheet" type="text/css" />
7 </head>
8
9 <body id="reverse-page">
10
11         <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
12
13         <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
14                 <div class="form-group">
15                         <input name="format" type="hidden" value="html">
16                         <input name="lat" type="text" class="form-control input-sm" placeholder="latitude"  value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
17                         <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
18                         max zoom
19
20                         <select name="zoom" class="form-control input-sm" value="<?php echo htmlspecialchars($_GET['zoom']); ?>">
21                                 <option value="" <?php echo $_GET['zoom']==''?'selected':'' ?> >--</option>
22                                 <?php
23
24                                         $aZoomLevels = array(
25                                                  0 => "Continent / Sea",
26                                                  1 => "",
27                                                  2 => "",
28                                                  3 => "Country",
29                                                  4 => "",
30                                                  5 => "State",
31                                                  6 => "Region",
32                                                  7 => "",
33                                                  8 => "County",
34                                                  9 => "",
35                                                 10 => "City",
36                                                 11 => "",
37                                                 12 => "Town / Village",
38                                                 13 => "",
39                                                 14 => "Suburb",
40                                                 15 => "",
41                                                 16 => "Street",
42                                                 17 => "",
43                                                 18 => "Building",
44                                                 19 => "",
45                                                 20 => "",
46                                                 21 => "",
47                                         );
48
49                                         foreach($aZoomLevels as $iZoomLevel => $sLabel)
50                                         {
51                                                 $bSel = isset($_GET['zoom']) && ($_GET['zoom'] == (string)$iZoomLevel);
52                                                 echo '<option value="'.$iZoomLevel.'"'.($bSel?'selected':'').'>'.$iZoomLevel.' '.$sLabel.'</option>'."\n";
53                                         }
54                                 ?>
55                         </select>
56                 </div>
57                 <div class="form-group search-button-group">
58                         <button type="submit" class="btn btn-primary btn-sm">Search</button>
59                 </div>
60                 <div class="search-type-link">
61                         <a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a>
62                 </div>
63         </form>
64
65
66         <div id="content">
67
68 <?php if ($aPlace) { ?>
69
70                 <div id="searchresults" class="sidebar">
71                 <?php
72                         $aResult = $aPlace;
73
74                         echo '<div class="result" data-position="0">';
75
76                         echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
77                         echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>';
78                         if (isset($aResult['label']))
79                                 echo ' <span class="type">('.$aResult['label'].')</span>';
80                         else if ($aResult['type'] == 'yes')
81                                 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
82                         else
83                                 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
84                         echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>';
85                         echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
86                         echo '</div>';
87                 ?>
88                 </div>
89
90 <?php } else { ?>
91
92                 <div id="intro" class="sidebar">
93                         Search for coordinates or click anywhere on the map.
94                 </div>
95
96 <?php } ?>
97
98                 <div id="map-wrapper">
99                         <div id="map-position"></div>
100                         <div id="map"></div>
101                 </div>
102
103         </div> <!-- /content -->
104
105
106
107
108
109
110
111         <script type="text/javascript">
112         <?php
113
114                 $aNominatimMapInit = [
115                         'zoom' => isset($_GET['zoom']) ? htmlspecialchars($_GET['zoom']) : CONST_Default_Zoom,
116                         'lat'  => isset($_GET['lat'] ) ? htmlspecialchars($_GET['lat'] ) : CONST_Default_Lat,
117                         'lon'  => isset($_GET['lon'] ) ? htmlspecialchars($_GET['lon'] ) : CONST_Default_Lon,
118                         'tile_url' => $sTileURL,
119                         'tile_attribution' => $sTileAttribution
120                 ];
121                 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
122
123                 echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; 
124         ?>
125         </script>
126         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
127
128 </body>
129 </html>