]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-html.php
status after hackweekend London
[nominatim.git] / lib / template / search-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
4 <body id="search-page">
5
6 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
7
8         <header class="container-fluid">
9                 <div class="row">
10                         <div class="col-xs-4">
11                                 <div class="brand">
12                                         <a href="<?php echo CONST_Website_BaseURL;?>">
13                                         <img alt="logo" src="images/osm_logo.120px.png" width="40" height="40"/>
14                                         <h1>Nominatim</h1>
15                                         </a>
16                                 </div>
17                         </div>
18                         <div id="last-updated" class="col-xs-4 text-center">
19                                 Data last updated:
20                                 <br>
21                                 <?php echo $sDataDate; ?>
22                         </div>
23                         <div class="col-xs-4 text-right">
24                                 <div class="btn-group">
25                                         <button class="dropdown-toggle btn btn-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
26                                                 About &amp; Help <span class="caret"></span>
27                                         </button>
28                                         <ul class="dropdown-menu dropdown-menu-right">
29                                                 <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a></li>
30                                                 <li><a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" target="_blank">FAQ</a></li>
31                                                 <li role="separator" class="divider"></li>
32                                                 <li><a href="#" class="" data-toggle="modal" data-target="#report-modal">Report problem with results</a></li>
33                                         </ul>
34                                 </div>
35                         </div>
36                 </div>
37         </header>
38
39         <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
40                 <div class="form-group">
41                         <input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($sQuery); ?>" >
42                 </div>
43                 <div class="form-group">
44                         <button type="submit" class="btn btn-primary btn-sm">Search</button>
45                         <?php if (CONST_Search_AreaPolygons) { ?>
46                                 <!-- <input type="checkbox" value="1" name="polygon" <?php if ($bAsText) echo "checked='checked'"; ?>/> Highlight -->
47                                 <input type="hidden" value="1" name="polygon" />
48                         <?php } ?>
49                         <input type="hidden" name="viewbox" value="<?php echo $sViewBox; ?>" />
50                         <div class="checkbox-inline">
51                                 <label>
52                                         <input type="checkbox" id="use_viewbox" <?php if ($sViewBox) echo "checked='checked'"; ?>>
53                                         apply viewbox
54                                 </label>
55                         </div>
56                 </div>
57         </form>
58
59
60         <div id="content">
61 <?php
62         if ($sQuery)
63         {
64 ?>
65         <div id="searchresults" class="sidebar">
66 <?php
67         $i = 0;
68         foreach($aSearchResults as $iResNum => $aResult)
69         {
70
71                 echo '<div class="result" data-position=' . $i . '>';
72
73                 echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
74                 echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
75                 // echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
76                 // echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
77                 if (isset($aResult['label']))
78                         echo ' <span class="type">('.$aResult['label'].')</span>';
79                 else if ($aResult['type'] == 'yes')
80                         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
81                 else
82                         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
83                 echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
84                 echo '</div>';
85                 $i = $i+1;
86         }
87         if (sizeof($aSearchResults) && $sMoreURL)
88         {
89                 echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
90         }
91         else
92         {
93                 echo '<div class="noresults">No search results found</div>';
94         }
95
96 ?>
97         </div>
98 <?php
99         }
100         else
101         {
102 ?>
103         <div id="intro" class="sidebar">
104         </div>
105
106 <?php
107
108         }
109 ?>
110                         <div id="map-wrapper">
111                                 <div id="map-position"></div>
112                                 <div id="map"></div>
113                         </div>
114                 </div>
115
116         </div>
117
118         <footer>
119                 <p class="disclaimer">
120                         Addresses and postcodes are approximate
121                 </p>
122                 <p class="copyright">
123                         &copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors
124                 </p>
125         </footer>
126
127         <div class="modal fade" id="report-modal">
128                 <div class="modal-dialog">
129                         <div class="modal-content">
130                                 <div class="modal-header">
131                                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
132                                         <h4 class="modal-title">Report a problem</h4>
133                                 </div>
134                                 <div class="modal-body">
135                                         <?php include(CONST_BasePath.'/lib/template/includes/report-errors.php'); ?>
136                                 </div>
137                                 <div class="modal-footer">
138                                         <button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
139                                 </div>
140                         </div>
141                 </div>
142         </div>
143
144
145
146
147         <script type="text/javascript">
148         <?php
149
150                 $aNominatimMapInit = [
151                         'zoom' => $iZoom,
152                         'lat' => $fLat,
153                         'lon' => $fLon
154                 ];
155                 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
156
157                 $aNominatimResults = [];
158                 echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';'; 
159         ?>
160         </script>
161         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
162
163 </body>
164 </html>