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