]> 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                 <input type="checkbox" id="use_viewbox" <?php if ($sViewBox) echo "checked='checked'"; ?>>
26                 <label for="use_viewbox">apply viewbox</label>
27             </div>
28         </div>
29         <div class="search-type-link">
30             <a href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
31         </div>
32     </form>
33
34
35     <div id="content">
36
37 <?php if ($sQuery) { ?>
38
39         <div id="searchresults" class="sidebar">
40         <?php
41             $i = 0;
42             foreach($aSearchResults as $iResNum => $aResult)
43             {
44
45                 echo '<div class="result" data-position=' . $i . '>';
46
47                 echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
48                 echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
49                 // echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
50                 // echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
51                 if (isset($aResult['label']))
52                     echo ' <span class="type">('.$aResult['label'].')</span>';
53                 else if ($aResult['type'] == 'yes')
54                     echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
55                 else
56                     echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
57                 echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
58                 echo '</div>';
59                 $i = $i+1;
60             }
61             if (sizeof($aSearchResults) && $sMoreURL)
62             {
63                 echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
64             }
65             else
66             {
67                 echo '<div class="noresults">No search results found</div>';
68             }
69
70         ?>
71         </div>
72
73 <?php } else { ?>
74
75         <div id="intro" class="sidebar">
76             <?php include(CONST_BasePath.'/lib/template/includes/introduction.php'); ?>
77         </div>
78
79 <?php } ?>
80
81         <div id="map-wrapper">
82             <div id="map-position">
83                 <div id="map-position-inner"></div>
84                 <div id="map-position-close"><a href="#">hide</a></div>
85             </div>
86             <div id="map"></div>
87         </div>
88
89     </div> <!-- /content -->
90
91
92
93
94
95
96
97     <script type="text/javascript">
98     <?php
99
100         $aNominatimMapInit = array(
101             'zoom' => CONST_Default_Zoom,
102             'lat' => CONST_Default_Lat,
103             'lon' => CONST_Default_Lon,
104             'tile_url' => CONST_Map_Tile_URL,
105             'tile_attribution' => CONST_Map_Tile_Attribution
106         );
107         echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
108
109         echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';'; 
110     ?>
111     </script>
112     <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
113
114 </body>
115 </html>