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