2 header("content-type: text/html; charset=UTF-8");
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" />
9 <body id="search-page">
11 <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
13 <div class="top-bar" id="structured-query-selector">
14 <div class="search-type-link">
15 <a id="switch-to-reverse" href="<?php echo CONST_Website_BaseURL; ?>reverse.php?format=html">reverse search</a>
18 <div class="radio-inline">
19 <input type="radio" name="query-selector" id="simple" value="simple">
20 <label for="simple">simple</label>
22 <div class="radio-inline">
23 <input type="radio" name="query-selector" id="structured" value="structured">
24 <label for="structured">structured</label>
27 <form role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>search.php">
28 <div class="form-group-simple">
29 <input id="q" name="q" type="text" class="form-control input-sm" placeholder="Search" value="<?php echo htmlspecialchars($aMoreParams['q'] ?? ''); ?>" >
31 <div class="form-group-structured">
32 <div class="form-inline">
33 <input id="street" name="street" type="text" class="form-control input-sm" placeholder="House number/Street" value="<?php echo htmlspecialchars($aMoreParams['street'] ?? ''); ?>" >
34 <input id="city" name="city" type="text" class="form-control input-sm" placeholder="City" value="<?php echo htmlspecialchars($aMoreParams['city'] ?? ''); ?>" >
35 <input id="county" name="county" type="text" class="form-control input-sm" placeholder="County" value="<?php echo htmlspecialchars($aMoreParams['county'] ?? ''); ?>" >
36 <input id="state" name="state" type="text" class="form-control input-sm" placeholder="State" value="<?php echo htmlspecialchars($aMoreParams['state'] ?? ''); ?>" >
37 <input id="country" name="country" type="text" class="form-control input-sm" placeholder="Country" value="<?php echo htmlspecialchars($aMoreParams['country'] ?? ''); ?>" >
38 <input id="postalcode" name="postalcode" type="text" class="form-control input-sm" placeholder="Postal Code" value="<?php echo htmlspecialchars($aMoreParams['postalcode'] ?? ''); ?>" >
40 <div class="form-group search-button-group">
41 <button type="submit" class="btn btn-primary btn-sm">Search</button>
42 <?php if (CONST_Search_AreaPolygons) { ?>
43 <input type="hidden" value="1" name="polygon_geojson" />
45 <input type="hidden" name="viewbox" value="<?php echo htmlspecialchars($aMoreParams['viewbox'] ?? ''); ?>" />
46 <div class="checkbox-inline">
47 <input type="checkbox" id="use_viewbox" <?php if (!empty($aMoreParams['viewbox'])) echo "checked='checked'"; ?>>
48 <label for="use_viewbox">apply viewbox</label>
56 <?php if ($sQuery) { ?>
58 <div id="searchresults" class="sidebar">
61 foreach($aSearchResults as $iResNum => $aResult)
64 echo '<div class="result" data-position=' . $i . '>';
66 echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
67 echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
68 // echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
69 // echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
70 if (isset($aResult['label']))
71 echo ' <span class="type">('.$aResult['label'].')</span>';
72 else if ($aResult['type'] == 'yes')
73 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
75 echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
76 echo detailsPermaLink($aResult, 'details', 'class="btn btn-default btn-xs details"');
80 if (!empty($aSearchResults) && $sMoreURL)
82 echo '<div class="more"><a class="btn btn-primary" href="'.htmlentities($sMoreURL).'">Search for more results</a></div>';
86 echo '<div class="noresults">No search results found</div>';
94 <div id="intro" class="sidebar">
95 <?php include(CONST_BasePath.'/lib/template/includes/introduction.php'); ?>
100 <div id="map-wrapper">
101 <div id="map-position">
102 <div id="map-position-inner"></div>
103 <div id="map-position-close"><a href="#">hide</a></div>
108 </div> <!-- /content -->
112 <script type="text/javascript">
115 $aNominatimMapInit = array(
116 'zoom' => CONST_Default_Zoom,
117 'lat' => CONST_Default_Lat,
118 'lon' => CONST_Default_Lon,
119 'tile_url' => CONST_Map_Tile_URL,
120 'tile_attribution' => CONST_Map_Tile_Attribution
122 echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
124 echo 'var nominatim_results = ' . json_encode($aSearchResults, JSON_PRETTY_PRINT) . ';';
125 $sStructuredQuery = (empty($aMoreParams['q'])
126 && !(empty($aMoreParams['street'])
127 && empty($aMoreParams['city'])
128 && empty($aMoreParams['county'])
129 && empty($aMoreParams['state'])
130 && empty($aMoreParams['country'])
131 && empty($aMoreParams['postalcode'])))
133 echo 'var nominatim_structured_query = '.$sStructuredQuery.';';
136 <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>