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