]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/search-html.php
Merge remote-tracking branch 'upstream/master'
[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/common.css" rel="stylesheet" type="text/css" />
6         <link href="css/search.css" rel="stylesheet" type="text/css" />
7 </head>
8
9 <body id="search-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; ?>search.php">
14                 <div class="form-group">
15                         <input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($sQuery); ?>" >
16                 </div>
17                 <div class="form-group search-button-group">
18                         <button type="submit" class="btn btn-primary btn-sm">Search</button>
19                         <?php if (CONST_Search_AreaPolygons) { ?>
20                                 <!-- <input type="checkbox" value="1" name="polygon" <?php if ($bAsText) echo "checked='checked'"; ?>/> Highlight -->
21                                 <input type="hidden" value="1" name="polygon" />
22                         <?php } ?>
23                         <input type="hidden" name="viewbox" value="<?php echo $sViewBox; ?>" />
24                         <div class="checkbox-inline">
25                                 <label>
26                                         <input type="checkbox" id="use_viewbox" <?php if ($sViewBox) echo "checked='checked'"; ?>>
27                                         apply viewbox
28                                 </label>
29                         </div>
30                 </div>
31                 <div class="search-type-link">
32                         <a href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
33                 </div>
34         </form>
35
36
37         <div id="content">
38
39 <?php if ($sQuery) { ?>
40
41                 <div id="searchresults" class="sidebar">
42                 <?php
43                         $i = 0;
44                         foreach($aSearchResults as $iResNum => $aResult)
45                         {
46
47                                 echo '<div class="result" data-position=' . $i . '>';
48
49                                 echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
50                                 echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
51                                 // echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
52                                 // echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
53                                 if (isset($aResult['label']))
54                                         echo ' <span class="type">('.$aResult['label'].')</span>';
55                                 else if ($aResult['type'] == 'yes')
56                                         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
57                                 else
58                                         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
59                                 echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
60                                 echo '</div>';
61                                 $i = $i+1;
62                         }
63                         if (sizeof($aSearchResults) && $sMoreURL)
64                         {
65                                 echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
66                         }
67                         else
68                         {
69                                 echo '<div class="noresults">No search results found</div>';
70                         }
71
72                 ?>
73                 </div>
74
75 <?php } else { ?>
76
77                 <div id="intro" class="sidebar">
78                         <?php include(CONST_BasePath.'/lib/template/includes/introduction.php'); ?>
79                 </div>
80
81 <?php } ?>
82
83                 <div id="map-wrapper">
84                         <div id="map-position"></div>
85                         <div id="map"></div>
86                 </div>
87
88         </div> <!-- /content -->
89
90
91
92
93
94
95
96         <script type="text/javascript">
97         <?php
98
99                 $aNominatimMapInit = [
100                         'zoom' => $iZoom,
101                         'lat' => $fLat,
102                         'lon' => $fLon
103                 ];
104                 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
105
106                 echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';'; 
107         ?>
108         </script>
109         <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
110
111 </body>
112 </html>