]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-html.php
Merge pull request #1 from lonvia/mobile-responsive-compact-header
[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     </div>
19     <div class="form-group search-button-group">
20       <button type="submit" class="btn btn-primary btn-sm">Search</button>
21     </div>
22     <div class="search-type-link">
23       <a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a>
24     </div>
25   </form>
26
27
28   <div id="content">
29
30 <?php if ($aPlace) { ?>
31
32     <div id="searchresults" class="sidebar">
33     <?php
34       $aResult = $aPlace;
35
36       echo '<div class="result" data-position="0">';
37
38       echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
39       echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>';
40       if (isset($aResult['label']))
41         echo ' <span class="type">('.$aResult['label'].')</span>';
42       else if ($aResult['type'] == 'yes')
43         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
44       else
45         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
46       echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>';
47       echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
48       echo '</div>';
49     ?>
50     </div>
51
52 <?php } else { ?>
53
54     <div id="intro" class="sidebar">
55       Search for coordinates or click anywhere on the map.
56     </div>
57
58 <?php } ?>
59
60     <div id="map-wrapper">
61       <div id="map-position"></div>
62       <div id="map"></div>
63     </div>
64
65   </div> <!-- /content -->
66
67
68
69
70
71
72
73   <script type="text/javascript">
74   <?php
75
76     $aNominatimMapInit = [
77       'zoom' => (isset($_GET['lat'])||$_GET['lat'])?16:NULL,
78       'lat' => isset($_GET['lat'])?htmlspecialchars($_GET['lat']):NULL,
79       'lon' => isset($_GET['lon'])?htmlspecialchars($_GET['lon']):NULL
80     ];
81     echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
82
83     echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; 
84   ?>
85   </script>
86   <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
87
88 </body>
89 </html>